View file File name : vendor.bundle.js Content :webpackJsonp(["vendor"],{ /***/ "./node_modules/@angular/animations/esm2015/animations.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AnimationBuilder", function() { return AnimationBuilder; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AnimationFactory", function() { return AnimationFactory; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AUTO_STYLE", function() { return AUTO_STYLE; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "animate", function() { return animate; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "animateChild", function() { return animateChild; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "animation", function() { return animation; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "group", function() { return group; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "keyframes", function() { return keyframes; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "query", function() { return query; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "sequence", function() { return sequence; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "stagger", function() { return stagger; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "state", function() { return state; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "style", function() { return style; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "transition", function() { return transition; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "trigger", function() { return trigger; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "useAnimation", function() { return useAnimation; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NoopAnimationPlayer", function() { return NoopAnimationPlayer; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵAnimationGroupPlayer", function() { return AnimationGroupPlayer; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵPRE_STYLE", function() { return ɵPRE_STYLE; }); /** * @license Angular v5.2.10 * (c) 2010-2018 Google, Inc. https://angular.io/ * License: MIT */ /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * AnimationBuilder is an injectable service that is available when the {\@link * BrowserAnimationsModule BrowserAnimationsModule} or {\@link NoopAnimationsModule * NoopAnimationsModule} modules are used within an application. * * The purpose if this service is to produce an animation sequence programmatically within an * angular component or directive. * * Programmatic animations are first built and then a player is created when the build animation is * attached to an element. * * ```ts * // remember to include the BrowserAnimationsModule module for this to work... * import {AnimationBuilder} from '\@angular/animations'; * * class MyCmp { * constructor(private _builder: AnimationBuilder) {} * * makeAnimation(element: any) { * // first build the animation * const myAnimation = this._builder.build([ * style({ width: 0 }), * animate(1000, style({ width: '100px' })) * ]); * * // then create a player from it * const player = myAnimation.create(element); * * player.play(); * } * } * ``` * * When an animation is built an instance of {\@link AnimationFactory AnimationFactory} will be * returned. Using that an {\@link AnimationPlayer AnimationPlayer} can be created which can then be * used to start the animation. * * \@experimental Animation support is experimental. * @abstract */ class AnimationBuilder { } /** * An instance of `AnimationFactory` is returned from {\@link AnimationBuilder#build * AnimationBuilder.build}. * * \@experimental Animation support is experimental. * @abstract */ class AnimationFactory { } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license * @record */ /** * \@experimental Animation support is experimental. */ const AUTO_STYLE = '*'; /** * \@experimental Animation support is experimental. * @record */ /** * Metadata representing the entry of animations. Instances of this interface are provided via the * animation DSL when the {\@link trigger trigger animation function} is called. * * \@experimental Animation support is experimental. * @record */ /** * Metadata representing the entry of animations. Instances of this interface are provided via the * animation DSL when the {\@link state state animation function} is called. * * \@experimental Animation support is experimental. * @record */ /** * Metadata representing the entry of animations. Instances of this interface are provided via the * animation DSL when the {\@link transition transition animation function} is called. * * \@experimental Animation support is experimental. * @record */ /** * \@experimental Animation support is experimental. * @record */ /** * \@experimental Animation support is experimental. * @record */ /** * Metadata representing the entry of animations. Instances of this interface are provided via the * animation DSL when the {\@link keyframes keyframes animation function} is called. * * \@experimental Animation support is experimental. * @record */ /** * Metadata representing the entry of animations. Instances of this interface are provided via the * animation DSL when the {\@link style style animation function} is called. * * \@experimental Animation support is experimental. * @record */ /** * Metadata representing the entry of animations. Instances of this interface are provided via the * animation DSL when the {\@link animate animate animation function} is called. * * \@experimental Animation support is experimental. * @record */ /** * Metadata representing the entry of animations. Instances of this interface are provided via the * animation DSL when the {\@link animateChild animateChild animation function} is called. * * \@experimental Animation support is experimental. * @record */ /** * Metadata representing the entry of animations. Instances of this interface are provided via the * animation DSL when the {\@link useAnimation useAnimation animation function} is called. * * \@experimental Animation support is experimental. * @record */ /** * Metadata representing the entry of animations. Instances of this interface are provided via the * animation DSL when the {\@link sequence sequence animation function} is called. * * \@experimental Animation support is experimental. * @record */ /** * Metadata representing the entry of animations. Instances of this interface are provided via the * animation DSL when the {\@link group group animation function} is called. * * \@experimental Animation support is experimental. * @record */ /** * Metadata representing the entry of animations. Instances of this interface are provided via the * animation DSL when the {\@link stagger stagger animation function} is called. * * \@experimental Animation support is experimental. * @record */ /** * `trigger` is an animation-specific function that is designed to be used inside of Angular's * animation DSL language. If this information is new, please navigate to the * {\@link Component#animations component animations metadata page} to gain a better * understanding of how animations in Angular are used. * * `trigger` Creates an animation trigger which will a list of {\@link state state} and * {\@link transition transition} entries that will be evaluated when the expression * bound to the trigger changes. * * Triggers are registered within the component annotation data under the * {\@link Component#animations animations section}. An animation trigger can be placed on an element * within a template by referencing the name of the trigger followed by the expression value that * the * trigger is bound to (in the form of `[\@triggerName]="expression"`. * * Animation trigger bindings strigify values and then match the previous and current values against * any linked transitions. If a boolean value is provided into the trigger binding then it will both * be represented as `1` or `true` and `0` or `false` for a true and false boolean values * respectively. * * ### Usage * * `trigger` will create an animation trigger reference based on the provided `name` value. The * provided `animation` value is expected to be an array consisting of {\@link state state} and * {\@link transition transition} declarations. * * ```typescript * \@Component({ * selector: 'my-component', * templateUrl: 'my-component-tpl.html', * animations: [ * trigger("myAnimationTrigger", [ * state(...), * state(...), * transition(...), * transition(...) * ]) * ] * }) * class MyComponent { * myStatusExp = "something"; * } * ``` * * The template associated with this component will make use of the `myAnimationTrigger` animation * trigger by binding to an element within its template code. * * ```html * <!-- somewhere inside of my-component-tpl.html --> * <div [\@myAnimationTrigger]="myStatusExp">...</div> * ``` * * ## Disable Animations * A special animation control binding called `\@.disabled` can be placed on an element which will * then disable animations for any inner animation triggers situated within the element as well as * any animations on the element itself. * * When true, the `\@.disabled` binding will prevent all animations from rendering. The example * below shows how to use this feature: * * ```ts * \@Component({ * selector: 'my-component', * template: ` * <div [\@.disabled]="isDisabled"> * <div [\@childAnimation]="exp"></div> * </div> * `, * animations: [ * trigger("childAnimation", [ * // ... * ]) * ] * }) * class MyComponent { * isDisabled = true; * exp = '...'; * } * ``` * * The `\@childAnimation` trigger will not animate because `\@.disabled` prevents it from happening * (when true). * * Note that `\@.disabled` will only disable all animations (this means any animations running on * the same element will also be disabled). * * ### Disabling Animations Application-wide * When an area of the template is set to have animations disabled, **all** inner components will * also have their animations disabled as well. This means that all animations for an angular * application can be disabled by placing a host binding set on `\@.disabled` on the topmost Angular * component. * * ```ts * import {Component, HostBinding} from '\@angular/core'; * * \@Component({ * selector: 'app-component', * templateUrl: 'app.component.html', * }) * class AppComponent { * \@HostBinding('\@.disabled') * public animationsDisabled = true; * } * ``` * * ### What about animations that us `query()` and `animateChild()`? * Despite inner animations being disabled, a parent animation can {\@link query query} for inner * elements located in disabled areas of the template and still animate them as it sees fit. This is * also the case for when a sub animation is queried by a parent and then later animated using {\@link * animateChild animateChild}. * * \@experimental Animation support is experimental. * @param {?} name * @param {?} definitions * @return {?} */ function trigger(name, definitions) { return { type: 7 /* Trigger */, name, definitions, options: {} }; } /** * `animate` is an animation-specific function that is designed to be used inside of Angular's * animation DSL language. If this information is new, please navigate to the {\@link * Component#animations component animations metadata page} to gain a better understanding of * how animations in Angular are used. * * `animate` specifies an animation step that will apply the provided `styles` data for a given * amount of time based on the provided `timing` expression value. Calls to `animate` are expected * to be used within {\@link sequence an animation sequence}, {\@link group group}, or {\@link * transition transition}. * * ### Usage * * The `animate` function accepts two input parameters: `timing` and `styles`: * * - `timing` is a string based value that can be a combination of a duration with optional delay * and easing values. The format for the expression breaks down to `duration delay easing` * (therefore a value such as `1s 100ms ease-out` will be parse itself into `duration=1000, * delay=100, easing=ease-out`. If a numeric value is provided then that will be used as the * `duration` value in millisecond form. * - `styles` is the style input data which can either be a call to {\@link style style} or {\@link * keyframes keyframes}. If left empty then the styles from the destination state will be collected * and used (this is useful when describing an animation step that will complete an animation by * {\@link transition#the-final-animate-call animating to the final state}). * * ```typescript * // various functions for specifying timing data * animate(500, style(...)) * animate("1s", style(...)) * animate("100ms 0.5s", style(...)) * animate("5s ease", style(...)) * animate("5s 10ms cubic-bezier(.17,.67,.88,.1)", style(...)) * * // either style() of keyframes() can be used * animate(500, style({ background: "red" })) * animate(500, keyframes([ * style({ background: "blue" })), * style({ background: "red" })) * ]) * ``` * * {\@example core/animation/ts/dsl/animation_example.ts region='Component'} * * \@experimental Animation support is experimental. * @param {?} timings * @param {?=} styles * @return {?} */ function animate(timings, styles = null) { return { type: 4 /* Animate */, styles, timings }; } /** * `group` is an animation-specific function that is designed to be used inside of Angular's * animation DSL language. If this information is new, please navigate to the {\@link * Component#animations component animations metadata page} to gain a better understanding of * how animations in Angular are used. * * `group` specifies a list of animation steps that are all run in parallel. Grouped animations are * useful when a series of styles must be animated/closed off at different starting/ending times. * * The `group` function can either be used within a {\@link sequence sequence} or a {\@link transition * transition} and it will only continue to the next instruction once all of the inner animation * steps have completed. * * ### Usage * * The `steps` data that is passed into the `group` animation function can either consist of {\@link * style style} or {\@link animate animate} function calls. Each call to `style()` or `animate()` * within a group will be executed instantly (use {\@link keyframes keyframes} or a {\@link * animate#usage animate() with a delay value} to offset styles to be applied at a later time). * * ```typescript * group([ * animate("1s", { background: "black" })) * animate("2s", { color: "white" })) * ]) * ``` * * {\@example core/animation/ts/dsl/animation_example.ts region='Component'} * * \@experimental Animation support is experimental. * @param {?} steps * @param {?=} options * @return {?} */ function group(steps, options = null) { return { type: 3 /* Group */, steps, options }; } /** * `sequence` is an animation-specific function that is designed to be used inside of Angular's * animation DSL language. If this information is new, please navigate to the {\@link * Component#animations component animations metadata page} to gain a better understanding of * how animations in Angular are used. * * `sequence` Specifies a list of animation steps that are run one by one. (`sequence` is used by * default when an array is passed as animation data into {\@link transition transition}.) * * The `sequence` function can either be used within a {\@link group group} or a {\@link transition * transition} and it will only continue to the next instruction once each of the inner animation * steps have completed. * * To perform animation styling in parallel with other animation steps then have a look at the * {\@link group group} animation function. * * ### Usage * * The `steps` data that is passed into the `sequence` animation function can either consist of * {\@link style style} or {\@link animate animate} function calls. A call to `style()` will apply the * provided styling data immediately while a call to `animate()` will apply its styling data over a * given time depending on its timing data. * * ```typescript * sequence([ * style({ opacity: 0 })), * animate("1s", { opacity: 1 })) * ]) * ``` * * {\@example core/animation/ts/dsl/animation_example.ts region='Component'} * * \@experimental Animation support is experimental. * @param {?} steps * @param {?=} options * @return {?} */ function sequence(steps, options = null) { return { type: 2 /* Sequence */, steps, options }; } /** * `style` is an animation-specific function that is designed to be used inside of Angular's * animation DSL language. If this information is new, please navigate to the {\@link * Component#animations component animations metadata page} to gain a better understanding of * how animations in Angular are used. * * `style` declares a key/value object containing CSS properties/styles that can then be used for * {\@link state animation states}, within an {\@link sequence animation sequence}, or as styling data * for both {\@link animate animate} and {\@link keyframes keyframes}. * * ### Usage * * `style` takes in a key/value string map as data and expects one or more CSS property/value pairs * to be defined. * * ```typescript * // string values are used for css properties * style({ background: "red", color: "blue" }) * * // numerical (pixel) values are also supported * style({ width: 100, height: 0 }) * ``` * * #### Auto-styles (using `*`) * * When an asterix (`*`) character is used as a value then it will be detected from the element * being animated and applied as animation data when the animation starts. * * This feature proves useful for a state depending on layout and/or environment factors; in such * cases the styles are calculated just before the animation starts. * * ```typescript * // the steps below will animate from 0 to the * // actual height of the element * style({ height: 0 }), * animate("1s", style({ height: "*" })) * ``` * * {\@example core/animation/ts/dsl/animation_example.ts region='Component'} * * \@experimental Animation support is experimental. * @param {?} tokens * @return {?} */ function style(tokens) { return { type: 6 /* Style */, styles: tokens, offset: null }; } /** * `state` is an animation-specific function that is designed to be used inside of Angular's * animation DSL language. If this information is new, please navigate to the {\@link * Component#animations component animations metadata page} to gain a better understanding of * how animations in Angular are used. * * `state` declares an animation state within the given trigger. When a state is active within a * component then its associated styles will persist on the element that the trigger is attached to * (even when the animation ends). * * To animate between states, have a look at the animation {\@link transition transition} DSL * function. To register states to an animation trigger please have a look at the {\@link trigger * trigger} function. * * #### The `void` state * * The `void` state value is a reserved word that angular uses to determine when the element is not * apart of the application anymore (e.g. when an `ngIf` evaluates to false then the state of the * associated element is void). * * #### The `*` (default) state * * The `*` state (when styled) is a fallback state that will be used if the state that is being * animated is not declared within the trigger. * * ### Usage * * `state` will declare an animation state with its associated styles * within the given trigger. * * - `stateNameExpr` can be one or more state names separated by commas. * - `styles` refers to the {\@link style styling data} that will be persisted on the element once * the state has been reached. * * ```typescript * // "void" is a reserved name for a state and is used to represent * // the state in which an element is detached from from the application. * state("void", style({ height: 0 })) * * // user-defined states * state("closed", style({ height: 0 })) * state("open, visible", style({ height: "*" })) * ``` * * {\@example core/animation/ts/dsl/animation_example.ts region='Component'} * * \@experimental Animation support is experimental. * @param {?} name * @param {?} styles * @param {?=} options * @return {?} */ function state(name, styles, options) { return { type: 0 /* State */, name, styles, options }; } /** * `keyframes` is an animation-specific function that is designed to be used inside of Angular's * animation DSL language. If this information is new, please navigate to the {\@link * Component#animations component animations metadata page} to gain a better understanding of * how animations in Angular are used. * * `keyframes` specifies a collection of {\@link style style} entries each optionally characterized * by an `offset` value. * * ### Usage * * The `keyframes` animation function is designed to be used alongside the {\@link animate animate} * animation function. Instead of applying animations from where they are currently to their * destination, keyframes can describe how each style entry is applied and at what point within the * animation arc (much like CSS Keyframe Animations do). * * For each `style()` entry an `offset` value can be set. Doing so allows to specifiy at what * percentage of the animate time the styles will be applied. * * ```typescript * // the provided offset values describe when each backgroundColor value is applied. * animate("5s", keyframes([ * style({ backgroundColor: "red", offset: 0 }), * style({ backgroundColor: "blue", offset: 0.2 }), * style({ backgroundColor: "orange", offset: 0.3 }), * style({ backgroundColor: "black", offset: 1 }) * ])) * ``` * * Alternatively, if there are no `offset` values used within the style entries then the offsets * will be calculated automatically. * * ```typescript * animate("5s", keyframes([ * style({ backgroundColor: "red" }) // offset = 0 * style({ backgroundColor: "blue" }) // offset = 0.33 * style({ backgroundColor: "orange" }) // offset = 0.66 * style({ backgroundColor: "black" }) // offset = 1 * ])) * ``` * * {\@example core/animation/ts/dsl/animation_example.ts region='Component'} * * \@experimental Animation support is experimental. * @param {?} steps * @return {?} */ function keyframes(steps) { return { type: 5 /* Keyframes */, steps }; } /** * `transition` is an animation-specific function that is designed to be used inside of Angular's * animation DSL language. If this information is new, please navigate to the {\@link * Component#animations component animations metadata page} to gain a better understanding of * how animations in Angular are used. * * `transition` declares the {\@link sequence sequence of animation steps} that will be run when the * provided `stateChangeExpr` value is satisfied. The `stateChangeExpr` consists of a `state1 => * state2` which consists of two known states (use an asterix (`*`) to refer to a dynamic starting * and/or ending state). * * A function can also be provided as the `stateChangeExpr` argument for a transition and this * function will be executed each time a state change occurs. If the value returned within the * function is true then the associated animation will be run. * * Animation transitions are placed within an {\@link trigger animation trigger}. For an transition * to animate to a state value and persist its styles then one or more {\@link state animation * states} is expected to be defined. * * ### Usage * * An animation transition is kicked off the `stateChangeExpr` predicate evaluates to true based on * what the previous state is and what the current state has become. In other words, if a transition * is defined that matches the old/current state criteria then the associated animation will be * triggered. * * ```typescript * // all transition/state changes are defined within an animation trigger * trigger("myAnimationTrigger", [ * // if a state is defined then its styles will be persisted when the * // animation has fully completed itself * state("on", style({ background: "green" })), * state("off", style({ background: "grey" })), * * // a transition animation that will be kicked off when the state value * // bound to "myAnimationTrigger" changes from "on" to "off" * transition("on => off", animate(500)), * * // it is also possible to do run the same animation for both directions * transition("on <=> off", animate(500)), * * // or to define multiple states pairs separated by commas * transition("on => off, off => void", animate(500)), * * // this is a catch-all state change for when an element is inserted into * // the page and the destination state is unknown * transition("void => *", [ * style({ opacity: 0 }), * animate(500) * ]), * * // this will capture a state change between any states * transition("* => *", animate("1s 0s")), * * // you can also go full out and include a function * transition((fromState, toState) => { * // when `true` then it will allow the animation below to be invoked * return fromState == "off" && toState == "on"; * }, animate("1s 0s")) * ]) * ``` * * The template associated with this component will make use of the `myAnimationTrigger` animation * trigger by binding to an element within its template code. * * ```html * <!-- somewhere inside of my-component-tpl.html --> * <div [\@myAnimationTrigger]="myStatusExp">...</div> * ``` * * #### The final `animate` call * * If the final step within the transition steps is a call to `animate()` that **only** uses a * timing value with **no style data** then it will be automatically used as the final animation arc * for the element to animate itself to the final state. This involves an automatic mix of * adding/removing CSS styles so that the element will be in the exact state it should be for the * applied state to be presented correctly. * * ``` * // start off by hiding the element, but make sure that it animates properly to whatever state * // is currently active for "myAnimationTrigger" * transition("void => *", [ * style({ opacity: 0 }), * animate(500) * ]) * ``` * * ### Using :enter and :leave * * Given that enter (insertion) and leave (removal) animations are so common, the `transition` * function accepts both `:enter` and `:leave` values which are aliases for the `void => *` and `* * => void` state changes. * * ``` * transition(":enter", [ * style({ opacity: 0 }), * animate(500, style({ opacity: 1 })) * ]), * transition(":leave", [ * animate(500, style({ opacity: 0 })) * ]) * ``` * * ### Boolean values * if a trigger binding value is a boolean value then it can be matched using a transition * expression that compares `true` and `false` or `1` and `0`. * * ``` * // in the template * <div [\@openClose]="open ? true : false">...</div> * * // in the component metadata * trigger('openClose', [ * state('true', style({ height: '*' })), * state('false', style({ height: '0px' })), * transition('false <=> true', animate(500)) * ]) * ``` * * ### Using :increment and :decrement * In addition to the :enter and :leave transition aliases, the :increment and :decrement aliases * can be used to kick off a transition when a numeric value has increased or decreased in value. * * ``` * import {group, animate, query, transition, style, trigger} from '\@angular/animations'; * import {Component} from '\@angular/core'; * * \@Component({ * selector: 'banner-carousel-component', * styles: [` * .banner-container { * position:relative; * height:500px; * overflow:hidden; * } * .banner-container > .banner { * position:absolute; * left:0; * top:0; * font-size:200px; * line-height:500px; * font-weight:bold; * text-align:center; * width:100%; * } * `], * template: ` * <button (click)="previous()">Previous</button> * <button (click)="next()">Next</button> * <hr> * <div [\@bannerAnimation]="selectedIndex" class="banner-container"> * <div class="banner" *ngFor="let banner of banners"> {{ banner }} </div> * </div> * `, * animations: [ * trigger('bannerAnimation', [ * transition(":increment", group([ * query(':enter', [ * style({ left: '100%' }), * animate('0.5s ease-out', style('*')) * ]), * query(':leave', [ * animate('0.5s ease-out', style({ left: '-100%' })) * ]) * ])), * transition(":decrement", group([ * query(':enter', [ * style({ left: '-100%' }), * animate('0.5s ease-out', style('*')) * ]), * query(':leave', [ * animate('0.5s ease-out', style({ left: '100%' })) * ]) * ])) * ]) * ] * }) * class BannerCarouselComponent { * allBanners: string[] = ['1', '2', '3', '4']; * selectedIndex: number = 0; * * get banners() { * return [this.allBanners[this.selectedIndex]]; * } * * previous() { * this.selectedIndex = Math.max(this.selectedIndex - 1, 0); * } * * next() { * this.selectedIndex = Math.min(this.selectedIndex + 1, this.allBanners.length - 1); * } * } * ``` * * {\@example core/animation/ts/dsl/animation_example.ts region='Component'} * * \@experimental Animation support is experimental. * @param {?} stateChangeExpr * @param {?} steps * @param {?=} options * @return {?} */ function transition(stateChangeExpr, steps, options = null) { return { type: 1 /* Transition */, expr: stateChangeExpr, animation: steps, options }; } /** * `animation` is an animation-specific function that is designed to be used inside of Angular's * animation DSL language. * * `var myAnimation = animation(...)` is designed to produce a reusable animation that can be later * invoked in another animation or sequence. Reusable animations are designed to make use of * animation parameters and the produced animation can be used via the `useAnimation` method. * * ``` * var fadeAnimation = animation([ * style({ opacity: '{{ start }}' }), * animate('{{ time }}', * style({ opacity: '{{ end }}'})) * ], { params: { time: '1000ms', start: 0, end: 1 }}); * ``` * * If parameters are attached to an animation then they act as **default parameter values**. When an * animation is invoked via `useAnimation` then parameter values are allowed to be passed in * directly. If any of the passed in parameter values are missing then the default values will be * used. * * ``` * useAnimation(fadeAnimation, { * params: { * time: '2s', * start: 1, * end: 0 * } * }) * ``` * * If one or more parameter values are missing before animated then an error will be thrown. * * \@experimental Animation support is experimental. * @param {?} steps * @param {?=} options * @return {?} */ function animation(steps, options = null) { return { type: 8 /* Reference */, animation: steps, options }; } /** * `animateChild` is an animation-specific function that is designed to be used inside of Angular's * animation DSL language. It works by allowing a queried element to execute its own * animation within the animation sequence. * * Each time an animation is triggered in angular, the parent animation * will always get priority and any child animations will be blocked. In order * for a child animation to run, the parent animation must query each of the elements * containing child animations and then allow the animations to run using `animateChild`. * * The example HTML code below shows both parent and child elements that have animation * triggers that will execute at the same time. * * ```html * <!-- parent-child.component.html --> * <button (click)="exp =! exp">Toggle</button> * <hr> * * <div [\@parentAnimation]="exp"> * <header>Hello</header> * <div [\@childAnimation]="exp"> * one * </div> * <div [\@childAnimation]="exp"> * two * </div> * <div [\@childAnimation]="exp"> * three * </div> * </div> * ``` * * Now when the `exp` value changes to true, only the `parentAnimation` animation will animate * because it has priority. However, using `query` and `animateChild` each of the inner animations * can also fire: * * ```ts * // parent-child.component.ts * import {trigger, transition, animate, style, query, animateChild} from '\@angular/animations'; * \@Component({ * selector: 'parent-child-component', * animations: [ * trigger('parentAnimation', [ * transition('false => true', [ * query('header', [ * style({ opacity: 0 }), * animate(500, style({ opacity: 1 })) * ]), * query('\@childAnimation', [ * animateChild() * ]) * ]) * ]), * trigger('childAnimation', [ * transition('false => true', [ * style({ opacity: 0 }), * animate(500, style({ opacity: 1 })) * ]) * ]) * ] * }) * class ParentChildCmp { * exp: boolean = false; * } * ``` * * In the animation code above, when the `parentAnimation` transition kicks off it first queries to * find the header element and fades it in. It then finds each of the sub elements that contain the * `\@childAnimation` trigger and then allows for their animations to fire. * * This example can be further extended by using stagger: * * ```ts * query('\@childAnimation', stagger(100, [ * animateChild() * ])) * ``` * * Now each of the sub animations start off with respect to the `100ms` staggering step. * * ## The first frame of child animations * When sub animations are executed using `animateChild` the animation engine will always apply the * first frame of every sub animation immediately at the start of the animation sequence. This way * the parent animation does not need to set any initial styling data on the sub elements before the * sub animations kick off. * * In the example above the first frame of the `childAnimation`'s `false => true` transition * consists of a style of `opacity: 0`. This is applied immediately when the `parentAnimation` * animation transition sequence starts. Only then when the `\@childAnimation` is queried and called * with `animateChild` will it then animate to its destination of `opacity: 1`. * * Note that this feature designed to be used alongside {\@link query query()} and it will only work * with animations that are assigned using the Angular animation DSL (this means that CSS keyframes * and transitions are not handled by this API). * * \@experimental Animation support is experimental. * @param {?=} options * @return {?} */ function animateChild(options = null) { return { type: 9 /* AnimateChild */, options }; } /** * `useAnimation` is an animation-specific function that is designed to be used inside of Angular's * animation DSL language. It is used to kick off a reusable animation that is created using {\@link * animation animation()}. * * \@experimental Animation support is experimental. * @param {?} animation * @param {?=} options * @return {?} */ function useAnimation(animation, options = null) { return { type: 10 /* AnimateRef */, animation, options }; } /** * `query` is an animation-specific function that is designed to be used inside of Angular's * animation DSL language. * * query() is used to find one or more inner elements within the current element that is * being animated within the sequence. The provided animation steps are applied * to the queried element (by default, an array is provided, then this will be * treated as an animation sequence). * * ### Usage * * query() is designed to collect mutiple elements and works internally by using * `element.querySelectorAll`. An additional options object can be provided which * can be used to limit the total amount of items to be collected. * * ```js * query('div', [ * animate(...), * animate(...) * ], { limit: 1 }) * ``` * * query(), by default, will throw an error when zero items are found. If a query * has the `optional` flag set to true then this error will be ignored. * * ```js * query('.some-element-that-may-not-be-there', [ * animate(...), * animate(...) * ], { optional: true }) * ``` * * ### Special Selector Values * * The selector value within a query can collect elements that contain angular-specific * characteristics * using special pseudo-selectors tokens. * * These include: * * - Querying for newly inserted/removed elements using `query(":enter")`/`query(":leave")` * - Querying all currently animating elements using `query(":animating")` * - Querying elements that contain an animation trigger using `query("\@triggerName")` * - Querying all elements that contain an animation triggers using `query("\@*")` * - Including the current element into the animation sequence using `query(":self")` * * * Each of these pseudo-selector tokens can be merged together into a combined query selector * string: * * ``` * query(':self, .record:enter, .record:leave, \@subTrigger', [...]) * ``` * * ### Demo * * ``` * \@Component({ * selector: 'inner', * template: ` * <div [\@queryAnimation]="exp"> * <h1>Title</h1> * <div class="content"> * Blah blah blah * </div> * </div> * `, * animations: [ * trigger('queryAnimation', [ * transition('* => goAnimate', [ * // hide the inner elements * query('h1', style({ opacity: 0 })), * query('.content', style({ opacity: 0 })), * * // animate the inner elements in, one by one * query('h1', animate(1000, style({ opacity: 1 })), * query('.content', animate(1000, style({ opacity: 1 })), * ]) * ]) * ] * }) * class Cmp { * exp = ''; * * goAnimate() { * this.exp = 'goAnimate'; * } * } * ``` * * \@experimental Animation support is experimental. * @param {?} selector * @param {?} animation * @param {?=} options * @return {?} */ function query(selector, animation, options = null) { return { type: 11 /* Query */, selector, animation, options }; } /** * `stagger` is an animation-specific function that is designed to be used inside of Angular's * animation DSL language. It is designed to be used inside of an animation {\@link query query()} * and works by issuing a timing gap between after each queried item is animated. * * ### Usage * * In the example below there is a container element that wraps a list of items stamped out * by an ngFor. The container element contains an animation trigger that will later be set * to query for each of the inner items. * * ```html * <!-- list.component.html --> * <button (click)="toggle()">Show / Hide Items</button> * <hr /> * <div [\@listAnimation]="items.length"> * <div *ngFor="let item of items"> * {{ item }} * </div> * </div> * ``` * * The component code for this looks as such: * * ```ts * import {trigger, transition, style, animate, query, stagger} from '\@angular/animations'; * \@Component({ * templateUrl: 'list.component.html', * animations: [ * trigger('listAnimation', [ * //... * ]) * ] * }) * class ListComponent { * items = []; * * showItems() { * this.items = [0,1,2,3,4]; * } * * hideItems() { * this.items = []; * } * * toggle() { * this.items.length ? this.hideItems() : this.showItems(); * } * } * ``` * * And now for the animation trigger code: * * ```ts * trigger('listAnimation', [ * transition('* => *', [ // each time the binding value changes * query(':leave', [ * stagger(100, [ * animate('0.5s', style({ opacity: 0 })) * ]) * ]), * query(':enter', [ * style({ opacity: 0 }), * stagger(100, [ * animate('0.5s', style({ opacity: 1 })) * ]) * ]) * ]) * ]) * ``` * * Now each time the items are added/removed then either the opacity * fade-in animation will run or each removed item will be faded out. * When either of these animations occur then a stagger effect will be * applied after each item's animation is started. * * \@experimental Animation support is experimental. * @param {?} timings * @param {?} animation * @return {?} */ function stagger(timings, animation) { return { type: 12 /* Stagger */, timings, animation }; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license * @param {?} cb * @return {?} */ function scheduleMicroTask(cb) { Promise.resolve(null).then(cb); } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * AnimationPlayer controls an animation sequence that was produced from a programmatic animation. * (see {\@link AnimationBuilder AnimationBuilder} for more information on how to create programmatic * animations.) * * \@experimental Animation support is experimental. * @record */ /** * \@experimental Animation support is experimental. */ class NoopAnimationPlayer { constructor() { this._onDoneFns = []; this._onStartFns = []; this._onDestroyFns = []; this._started = false; this._destroyed = false; this._finished = false; this.parentPlayer = null; this.totalTime = 0; } /** * @return {?} */ _onFinish() { if (!this._finished) { this._finished = true; this._onDoneFns.forEach(fn => fn()); this._onDoneFns = []; } } /** * @param {?} fn * @return {?} */ onStart(fn) { this._onStartFns.push(fn); } /** * @param {?} fn * @return {?} */ onDone(fn) { this._onDoneFns.push(fn); } /** * @param {?} fn * @return {?} */ onDestroy(fn) { this._onDestroyFns.push(fn); } /** * @return {?} */ hasStarted() { return this._started; } /** * @return {?} */ init() { } /** * @return {?} */ play() { if (!this.hasStarted()) { this._onStart(); this.triggerMicrotask(); } this._started = true; } /** * @return {?} */ triggerMicrotask() { scheduleMicroTask(() => this._onFinish()); } /** * @return {?} */ _onStart() { this._onStartFns.forEach(fn => fn()); this._onStartFns = []; } /** * @return {?} */ pause() { } /** * @return {?} */ restart() { } /** * @return {?} */ finish() { this._onFinish(); } /** * @return {?} */ destroy() { if (!this._destroyed) { this._destroyed = true; if (!this.hasStarted()) { this._onStart(); } this.finish(); this._onDestroyFns.forEach(fn => fn()); this._onDestroyFns = []; } } /** * @return {?} */ reset() { } /** * @param {?} p * @return {?} */ setPosition(p) { } /** * @return {?} */ getPosition() { return 0; } /** * @param {?} phaseName * @return {?} */ triggerCallback(phaseName) { const /** @type {?} */ methods = phaseName == 'start' ? this._onStartFns : this._onDoneFns; methods.forEach(fn => fn()); methods.length = 0; } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ class AnimationGroupPlayer { /** * @param {?} _players */ constructor(_players) { this._onDoneFns = []; this._onStartFns = []; this._finished = false; this._started = false; this._destroyed = false; this._onDestroyFns = []; this.parentPlayer = null; this.totalTime = 0; this.players = _players; let /** @type {?} */ doneCount = 0; let /** @type {?} */ destroyCount = 0; let /** @type {?} */ startCount = 0; const /** @type {?} */ total = this.players.length; if (total == 0) { scheduleMicroTask(() => this._onFinish()); } else { this.players.forEach(player => { player.onDone(() => { if (++doneCount == total) { this._onFinish(); } }); player.onDestroy(() => { if (++destroyCount == total) { this._onDestroy(); } }); player.onStart(() => { if (++startCount == total) { this._onStart(); } }); }); } this.totalTime = this.players.reduce((time, player) => Math.max(time, player.totalTime), 0); } /** * @return {?} */ _onFinish() { if (!this._finished) { this._finished = true; this._onDoneFns.forEach(fn => fn()); this._onDoneFns = []; } } /** * @return {?} */ init() { this.players.forEach(player => player.init()); } /** * @param {?} fn * @return {?} */ onStart(fn) { this._onStartFns.push(fn); } /** * @return {?} */ _onStart() { if (!this.hasStarted()) { this._started = true; this._onStartFns.forEach(fn => fn()); this._onStartFns = []; } } /** * @param {?} fn * @return {?} */ onDone(fn) { this._onDoneFns.push(fn); } /** * @param {?} fn * @return {?} */ onDestroy(fn) { this._onDestroyFns.push(fn); } /** * @return {?} */ hasStarted() { return this._started; } /** * @return {?} */ play() { if (!this.parentPlayer) { this.init(); } this._onStart(); this.players.forEach(player => player.play()); } /** * @return {?} */ pause() { this.players.forEach(player => player.pause()); } /** * @return {?} */ restart() { this.players.forEach(player => player.restart()); } /** * @return {?} */ finish() { this._onFinish(); this.players.forEach(player => player.finish()); } /** * @return {?} */ destroy() { this._onDestroy(); } /** * @return {?} */ _onDestroy() { if (!this._destroyed) { this._destroyed = true; this._onFinish(); this.players.forEach(player => player.destroy()); this._onDestroyFns.forEach(fn => fn()); this._onDestroyFns = []; } } /** * @return {?} */ reset() { this.players.forEach(player => player.reset()); this._destroyed = false; this._finished = false; this._started = false; } /** * @param {?} p * @return {?} */ setPosition(p) { const /** @type {?} */ timeAtPosition = p * this.totalTime; this.players.forEach(player => { const /** @type {?} */ position = player.totalTime ? Math.min(1, timeAtPosition / player.totalTime) : 1; player.setPosition(position); }); } /** * @return {?} */ getPosition() { let /** @type {?} */ min = 0; this.players.forEach(player => { const /** @type {?} */ p = player.getPosition(); min = Math.min(p, min); }); return min; } /** * @return {?} */ beforeDestroy() { this.players.forEach(player => { if (player.beforeDestroy) { player.beforeDestroy(); } }); } /** * @param {?} phaseName * @return {?} */ triggerCallback(phaseName) { const /** @type {?} */ methods = phaseName == 'start' ? this._onStartFns : this._onDoneFns; methods.forEach(fn => fn()); methods.length = 0; } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ const ɵPRE_STYLE = '!'; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @module * @description * Entry point for all public APIs of this package. */ /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * Generated bundle index. Do not edit. */ //# sourceMappingURL=animations.js.map /***/ }), /***/ "./node_modules/@angular/animations/esm2015/browser.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return AnimationDriver; }); /* unused harmony export ɵAnimation */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return AnimationStyleNormalizer; }); /* unused harmony export ɵNoopAnimationStyleNormalizer */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return WebAnimationsStyleNormalizer; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return NoopAnimationDriver; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return AnimationEngine; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return WebAnimationsDriver; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return supportsWebAnimations; }); /* unused harmony export ɵWebAnimationsPlayer */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_animations__ = __webpack_require__("./node_modules/@angular/animations/esm2015/animations.js"); /** * @license Angular v5.2.10 * (c) 2010-2018 Google, Inc. https://angular.io/ * License: MIT */ /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @param {?} players * @return {?} */ function optimizeGroupPlayer(players) { switch (players.length) { case 0: return new __WEBPACK_IMPORTED_MODULE_0__angular_animations__["NoopAnimationPlayer"](); case 1: return players[0]; default: return new __WEBPACK_IMPORTED_MODULE_0__angular_animations__["ɵAnimationGroupPlayer"](players); } } /** * @param {?} driver * @param {?} normalizer * @param {?} element * @param {?} keyframes * @param {?=} preStyles * @param {?=} postStyles * @return {?} */ function normalizeKeyframes(driver, normalizer, element, keyframes, preStyles = {}, postStyles = {}) { const /** @type {?} */ errors = []; const /** @type {?} */ normalizedKeyframes = []; let /** @type {?} */ previousOffset = -1; let /** @type {?} */ previousKeyframe = null; keyframes.forEach(kf => { const /** @type {?} */ offset = /** @type {?} */ (kf['offset']); const /** @type {?} */ isSameOffset = offset == previousOffset; const /** @type {?} */ normalizedKeyframe = (isSameOffset && previousKeyframe) || {}; Object.keys(kf).forEach(prop => { let /** @type {?} */ normalizedProp = prop; let /** @type {?} */ normalizedValue = kf[prop]; if (prop !== 'offset') { normalizedProp = normalizer.normalizePropertyName(normalizedProp, errors); switch (normalizedValue) { case __WEBPACK_IMPORTED_MODULE_0__angular_animations__["ɵPRE_STYLE"]: normalizedValue = preStyles[prop]; break; case __WEBPACK_IMPORTED_MODULE_0__angular_animations__["AUTO_STYLE"]: normalizedValue = postStyles[prop]; break; default: normalizedValue = normalizer.normalizeStyleValue(prop, normalizedProp, normalizedValue, errors); break; } } normalizedKeyframe[normalizedProp] = normalizedValue; }); if (!isSameOffset) { normalizedKeyframes.push(normalizedKeyframe); } previousKeyframe = normalizedKeyframe; previousOffset = offset; }); if (errors.length) { const /** @type {?} */ LINE_START = '\n - '; throw new Error(`Unable to animate due to the following errors:${LINE_START}${errors.join(LINE_START)}`); } return normalizedKeyframes; } /** * @param {?} player * @param {?} eventName * @param {?} event * @param {?} callback * @return {?} */ function listenOnPlayer(player, eventName, event, callback) { switch (eventName) { case 'start': player.onStart(() => callback(event && copyAnimationEvent(event, 'start', player.totalTime))); break; case 'done': player.onDone(() => callback(event && copyAnimationEvent(event, 'done', player.totalTime))); break; case 'destroy': player.onDestroy(() => callback(event && copyAnimationEvent(event, 'destroy', player.totalTime))); break; } } /** * @param {?} e * @param {?=} phaseName * @param {?=} totalTime * @return {?} */ function copyAnimationEvent(e, phaseName, totalTime) { const /** @type {?} */ event = makeAnimationEvent(e.element, e.triggerName, e.fromState, e.toState, phaseName || e.phaseName, totalTime == undefined ? e.totalTime : totalTime); const /** @type {?} */ data = (/** @type {?} */ (e))['_data']; if (data != null) { (/** @type {?} */ (event))['_data'] = data; } return event; } /** * @param {?} element * @param {?} triggerName * @param {?} fromState * @param {?} toState * @param {?=} phaseName * @param {?=} totalTime * @return {?} */ function makeAnimationEvent(element, triggerName, fromState, toState, phaseName = '', totalTime = 0) { return { element, triggerName, fromState, toState, phaseName, totalTime }; } /** * @param {?} map * @param {?} key * @param {?} defaultValue * @return {?} */ function getOrSetAsInMap(map, key, defaultValue) { let /** @type {?} */ value; if (map instanceof Map) { value = map.get(key); if (!value) { map.set(key, value = defaultValue); } } else { value = map[key]; if (!value) { value = map[key] = defaultValue; } } return value; } /** * @param {?} command * @return {?} */ function parseTimelineCommand(command) { const /** @type {?} */ separatorPos = command.indexOf(':'); const /** @type {?} */ id = command.substring(1, separatorPos); const /** @type {?} */ action = command.substr(separatorPos + 1); return [id, action]; } let _contains = (elm1, elm2) => false; let _matches = (element, selector) => false; let _query = (element, selector, multi) => { return []; }; if (typeof Element != 'undefined') { // this is well supported in all browsers _contains = (elm1, elm2) => { return /** @type {?} */ (elm1.contains(elm2)); }; if (Element.prototype.matches) { _matches = (element, selector) => element.matches(selector); } else { const /** @type {?} */ proto = /** @type {?} */ (Element.prototype); const /** @type {?} */ fn = proto.matchesSelector || proto.mozMatchesSelector || proto.msMatchesSelector || proto.oMatchesSelector || proto.webkitMatchesSelector; if (fn) { _matches = (element, selector) => fn.apply(element, [selector]); } } _query = (element, selector, multi) => { let /** @type {?} */ results = []; if (multi) { results.push(...element.querySelectorAll(selector)); } else { const /** @type {?} */ elm = element.querySelector(selector); if (elm) { results.push(elm); } } return results; }; } /** * @param {?} prop * @return {?} */ function containsVendorPrefix(prop) { // Webkit is the only real popular vendor prefix nowadays // cc: http://shouldiprefix.com/ return prop.substring(1, 6) == 'ebkit'; // webkit or Webkit } let _CACHED_BODY = null; let _IS_WEBKIT = false; /** * @param {?} prop * @return {?} */ function validateStyleProperty(prop) { if (!_CACHED_BODY) { _CACHED_BODY = getBodyNode() || {}; _IS_WEBKIT = /** @type {?} */ ((_CACHED_BODY)).style ? ('WebkitAppearance' in /** @type {?} */ ((_CACHED_BODY)).style) : false; } let /** @type {?} */ result = true; if (/** @type {?} */ ((_CACHED_BODY)).style && !containsVendorPrefix(prop)) { result = prop in /** @type {?} */ ((_CACHED_BODY)).style; if (!result && _IS_WEBKIT) { const /** @type {?} */ camelProp = 'Webkit' + prop.charAt(0).toUpperCase() + prop.substr(1); result = camelProp in /** @type {?} */ ((_CACHED_BODY)).style; } } return result; } /** * @return {?} */ function getBodyNode() { if (typeof document != 'undefined') { return document.body; } return null; } const matchesElement = _matches; const containsElement = _contains; const invokeQuery = _query; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * \@experimental */ class NoopAnimationDriver { /** * @param {?} prop * @return {?} */ validateStyleProperty(prop) { return validateStyleProperty(prop); } /** * @param {?} element * @param {?} selector * @return {?} */ matchesElement(element, selector) { return matchesElement(element, selector); } /** * @param {?} elm1 * @param {?} elm2 * @return {?} */ containsElement(elm1, elm2) { return containsElement(elm1, elm2); } /** * @param {?} element * @param {?} selector * @param {?} multi * @return {?} */ query(element, selector, multi) { return invokeQuery(element, selector, multi); } /** * @param {?} element * @param {?} prop * @param {?=} defaultValue * @return {?} */ computeStyle(element, prop, defaultValue) { return defaultValue || ''; } /** * @param {?} element * @param {?} keyframes * @param {?} duration * @param {?} delay * @param {?} easing * @param {?=} previousPlayers * @return {?} */ animate(element, keyframes, duration, delay, easing, previousPlayers = []) { return new __WEBPACK_IMPORTED_MODULE_0__angular_animations__["NoopAnimationPlayer"](); } } /** * \@experimental * @abstract */ class AnimationDriver { } AnimationDriver.NOOP = new NoopAnimationDriver(); /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ const ONE_SECOND = 1000; const SUBSTITUTION_EXPR_START = '{{'; const SUBSTITUTION_EXPR_END = '}}'; const ENTER_CLASSNAME = 'ng-enter'; const LEAVE_CLASSNAME = 'ng-leave'; const NG_TRIGGER_CLASSNAME = 'ng-trigger'; const NG_TRIGGER_SELECTOR = '.ng-trigger'; const NG_ANIMATING_CLASSNAME = 'ng-animating'; const NG_ANIMATING_SELECTOR = '.ng-animating'; /** * @param {?} value * @return {?} */ function resolveTimingValue(value) { if (typeof value == 'number') return value; const /** @type {?} */ matches = (/** @type {?} */ (value)).match(/^(-?[\.\d]+)(m?s)/); if (!matches || matches.length < 2) return 0; return _convertTimeValueToMS(parseFloat(matches[1]), matches[2]); } /** * @param {?} value * @param {?} unit * @return {?} */ function _convertTimeValueToMS(value, unit) { switch (unit) { case 's': return value * ONE_SECOND; default: // ms or something else return value; } } /** * @param {?} timings * @param {?} errors * @param {?=} allowNegativeValues * @return {?} */ function resolveTiming(timings, errors, allowNegativeValues) { return timings.hasOwnProperty('duration') ? /** @type {?} */ (timings) : parseTimeExpression(/** @type {?} */ (timings), errors, allowNegativeValues); } /** * @param {?} exp * @param {?} errors * @param {?=} allowNegativeValues * @return {?} */ function parseTimeExpression(exp, errors, allowNegativeValues) { const /** @type {?} */ regex = /^(-?[\.\d]+)(m?s)(?:\s+(-?[\.\d]+)(m?s))?(?:\s+([-a-z]+(?:\(.+?\))?))?$/i; let /** @type {?} */ duration; let /** @type {?} */ delay = 0; let /** @type {?} */ easing = ''; if (typeof exp === 'string') { const /** @type {?} */ matches = exp.match(regex); if (matches === null) { errors.push(`The provided timing value "${exp}" is invalid.`); return { duration: 0, delay: 0, easing: '' }; } duration = _convertTimeValueToMS(parseFloat(matches[1]), matches[2]); const /** @type {?} */ delayMatch = matches[3]; if (delayMatch != null) { delay = _convertTimeValueToMS(Math.floor(parseFloat(delayMatch)), matches[4]); } const /** @type {?} */ easingVal = matches[5]; if (easingVal) { easing = easingVal; } } else { duration = /** @type {?} */ (exp); } if (!allowNegativeValues) { let /** @type {?} */ containsErrors = false; let /** @type {?} */ startIndex = errors.length; if (duration < 0) { errors.push(`Duration values below 0 are not allowed for this animation step.`); containsErrors = true; } if (delay < 0) { errors.push(`Delay values below 0 are not allowed for this animation step.`); containsErrors = true; } if (containsErrors) { errors.splice(startIndex, 0, `The provided timing value "${exp}" is invalid.`); } } return { duration, delay, easing }; } /** * @param {?} obj * @param {?=} destination * @return {?} */ function copyObj(obj, destination = {}) { Object.keys(obj).forEach(prop => { destination[prop] = obj[prop]; }); return destination; } /** * @param {?} styles * @return {?} */ function normalizeStyles(styles) { const /** @type {?} */ normalizedStyles = {}; if (Array.isArray(styles)) { styles.forEach(data => copyStyles(data, false, normalizedStyles)); } else { copyStyles(styles, false, normalizedStyles); } return normalizedStyles; } /** * @param {?} styles * @param {?} readPrototype * @param {?=} destination * @return {?} */ function copyStyles(styles, readPrototype, destination = {}) { if (readPrototype) { // we make use of a for-in loop so that the // prototypically inherited properties are // revealed from the backFill map for (let /** @type {?} */ prop in styles) { destination[prop] = styles[prop]; } } else { copyObj(styles, destination); } return destination; } /** * @param {?} element * @param {?} styles * @return {?} */ function setStyles(element, styles) { if (element['style']) { Object.keys(styles).forEach(prop => { const /** @type {?} */ camelProp = dashCaseToCamelCase(prop); element.style[camelProp] = styles[prop]; }); } } /** * @param {?} element * @param {?} styles * @return {?} */ function eraseStyles(element, styles) { if (element['style']) { Object.keys(styles).forEach(prop => { const /** @type {?} */ camelProp = dashCaseToCamelCase(prop); element.style[camelProp] = ''; }); } } /** * @param {?} steps * @return {?} */ function normalizeAnimationEntry(steps) { if (Array.isArray(steps)) { if (steps.length == 1) return steps[0]; return Object(__WEBPACK_IMPORTED_MODULE_0__angular_animations__["sequence"])(steps); } return /** @type {?} */ (steps); } /** * @param {?} value * @param {?} options * @param {?} errors * @return {?} */ function validateStyleParams(value, options, errors) { const /** @type {?} */ params = options.params || {}; const /** @type {?} */ matches = extractStyleParams(value); if (matches.length) { matches.forEach(varName => { if (!params.hasOwnProperty(varName)) { errors.push(`Unable to resolve the local animation param ${varName} in the given list of values`); } }); } } const PARAM_REGEX = new RegExp(`${SUBSTITUTION_EXPR_START}\\s*(.+?)\\s*${SUBSTITUTION_EXPR_END}`, 'g'); /** * @param {?} value * @return {?} */ function extractStyleParams(value) { let /** @type {?} */ params = []; if (typeof value === 'string') { const /** @type {?} */ val = value.toString(); let /** @type {?} */ match; while (match = PARAM_REGEX.exec(val)) { params.push(/** @type {?} */ (match[1])); } PARAM_REGEX.lastIndex = 0; } return params; } /** * @param {?} value * @param {?} params * @param {?} errors * @return {?} */ function interpolateParams(value, params, errors) { const /** @type {?} */ original = value.toString(); const /** @type {?} */ str = original.replace(PARAM_REGEX, (_, varName) => { let /** @type {?} */ localVal = params[varName]; // this means that the value was never overidden by the data passed in by the user if (!params.hasOwnProperty(varName)) { errors.push(`Please provide a value for the animation param ${varName}`); localVal = ''; } return localVal.toString(); }); // we do this to assert that numeric values stay as they are return str == original ? value : str; } /** * @param {?} iterator * @return {?} */ function iteratorToArray(iterator) { const /** @type {?} */ arr = []; let /** @type {?} */ item = iterator.next(); while (!item.done) { arr.push(item.value); item = iterator.next(); } return arr; } /** * @param {?} source * @param {?} destination * @return {?} */ const DASH_CASE_REGEXP = /-+([a-z0-9])/g; /** * @param {?} input * @return {?} */ function dashCaseToCamelCase(input) { return input.replace(DASH_CASE_REGEXP, (...m) => m[1].toUpperCase()); } /** * @param {?} duration * @param {?} delay * @return {?} */ function allowPreviousPlayerStylesMerge(duration, delay) { return duration === 0 || delay === 0; } /** * @param {?} visitor * @param {?} node * @param {?} context * @return {?} */ function visitDslNode(visitor, node, context) { switch (node.type) { case 7 /* Trigger */: return visitor.visitTrigger(node, context); case 0 /* State */: return visitor.visitState(node, context); case 1 /* Transition */: return visitor.visitTransition(node, context); case 2 /* Sequence */: return visitor.visitSequence(node, context); case 3 /* Group */: return visitor.visitGroup(node, context); case 4 /* Animate */: return visitor.visitAnimate(node, context); case 5 /* Keyframes */: return visitor.visitKeyframes(node, context); case 6 /* Style */: return visitor.visitStyle(node, context); case 8 /* Reference */: return visitor.visitReference(node, context); case 9 /* AnimateChild */: return visitor.visitAnimateChild(node, context); case 10 /* AnimateRef */: return visitor.visitAnimateRef(node, context); case 11 /* Query */: return visitor.visitQuery(node, context); case 12 /* Stagger */: return visitor.visitStagger(node, context); default: throw new Error(`Unable to resolve animation metadata node #${node.type}`); } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ const ANY_STATE = '*'; /** * @param {?} transitionValue * @param {?} errors * @return {?} */ function parseTransitionExpr(transitionValue, errors) { const /** @type {?} */ expressions = []; if (typeof transitionValue == 'string') { (/** @type {?} */ (transitionValue)) .split(/\s*,\s*/) .forEach(str => parseInnerTransitionStr(str, expressions, errors)); } else { expressions.push(/** @type {?} */ (transitionValue)); } return expressions; } /** * @param {?} eventStr * @param {?} expressions * @param {?} errors * @return {?} */ function parseInnerTransitionStr(eventStr, expressions, errors) { if (eventStr[0] == ':') { const /** @type {?} */ result = parseAnimationAlias(eventStr, errors); if (typeof result == 'function') { expressions.push(result); return; } eventStr = /** @type {?} */ (result); } const /** @type {?} */ match = eventStr.match(/^(\*|[-\w]+)\s*(<?[=-]>)\s*(\*|[-\w]+)$/); if (match == null || match.length < 4) { errors.push(`The provided transition expression "${eventStr}" is not supported`); return expressions; } const /** @type {?} */ fromState = match[1]; const /** @type {?} */ separator = match[2]; const /** @type {?} */ toState = match[3]; expressions.push(makeLambdaFromStates(fromState, toState)); const /** @type {?} */ isFullAnyStateExpr = fromState == ANY_STATE && toState == ANY_STATE; if (separator[0] == '<' && !isFullAnyStateExpr) { expressions.push(makeLambdaFromStates(toState, fromState)); } } /** * @param {?} alias * @param {?} errors * @return {?} */ function parseAnimationAlias(alias, errors) { switch (alias) { case ':enter': return 'void => *'; case ':leave': return '* => void'; case ':increment': return (fromState, toState) => parseFloat(toState) > parseFloat(fromState); case ':decrement': return (fromState, toState) => parseFloat(toState) < parseFloat(fromState); default: errors.push(`The transition alias value "${alias}" is not supported`); return '* => *'; } } // DO NOT REFACTOR ... keep the follow set instantiations // with the values intact (closure compiler for some reason // removes follow-up lines that add the values outside of // the constructor... const TRUE_BOOLEAN_VALUES = new Set(['true', '1']); const FALSE_BOOLEAN_VALUES = new Set(['false', '0']); /** * @param {?} lhs * @param {?} rhs * @return {?} */ function makeLambdaFromStates(lhs, rhs) { const /** @type {?} */ LHS_MATCH_BOOLEAN = TRUE_BOOLEAN_VALUES.has(lhs) || FALSE_BOOLEAN_VALUES.has(lhs); const /** @type {?} */ RHS_MATCH_BOOLEAN = TRUE_BOOLEAN_VALUES.has(rhs) || FALSE_BOOLEAN_VALUES.has(rhs); return (fromState, toState) => { let /** @type {?} */ lhsMatch = lhs == ANY_STATE || lhs == fromState; let /** @type {?} */ rhsMatch = rhs == ANY_STATE || rhs == toState; if (!lhsMatch && LHS_MATCH_BOOLEAN && typeof fromState === 'boolean') { lhsMatch = fromState ? TRUE_BOOLEAN_VALUES.has(lhs) : FALSE_BOOLEAN_VALUES.has(lhs); } if (!rhsMatch && RHS_MATCH_BOOLEAN && typeof toState === 'boolean') { rhsMatch = toState ? TRUE_BOOLEAN_VALUES.has(rhs) : FALSE_BOOLEAN_VALUES.has(rhs); } return lhsMatch && rhsMatch; }; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ const SELF_TOKEN = ':self'; const SELF_TOKEN_REGEX = new RegExp(`\s*${SELF_TOKEN}\s*,?`, 'g'); /** * @param {?} driver * @param {?} metadata * @param {?} errors * @return {?} */ function buildAnimationAst(driver, metadata, errors) { return new AnimationAstBuilderVisitor(driver).build(metadata, errors); } const ROOT_SELECTOR = ''; class AnimationAstBuilderVisitor { /** * @param {?} _driver */ constructor(_driver) { this._driver = _driver; } /** * @param {?} metadata * @param {?} errors * @return {?} */ build(metadata, errors) { const /** @type {?} */ context = new AnimationAstBuilderContext(errors); this._resetContextStyleTimingState(context); return /** @type {?} */ (visitDslNode(this, normalizeAnimationEntry(metadata), context)); } /** * @param {?} context * @return {?} */ _resetContextStyleTimingState(context) { context.currentQuerySelector = ROOT_SELECTOR; context.collectedStyles = {}; context.collectedStyles[ROOT_SELECTOR] = {}; context.currentTime = 0; } /** * @param {?} metadata * @param {?} context * @return {?} */ visitTrigger(metadata, context) { let /** @type {?} */ queryCount = context.queryCount = 0; let /** @type {?} */ depCount = context.depCount = 0; const /** @type {?} */ states = []; const /** @type {?} */ transitions = []; if (metadata.name.charAt(0) == '@') { context.errors.push('animation triggers cannot be prefixed with an `@` sign (e.g. trigger(\'@foo\', [...]))'); } metadata.definitions.forEach(def => { this._resetContextStyleTimingState(context); if (def.type == 0 /* State */) { const /** @type {?} */ stateDef = /** @type {?} */ (def); const /** @type {?} */ name = stateDef.name; name.split(/\s*,\s*/).forEach(n => { stateDef.name = n; states.push(this.visitState(stateDef, context)); }); stateDef.name = name; } else if (def.type == 1 /* Transition */) { const /** @type {?} */ transition = this.visitTransition(/** @type {?} */ (def), context); queryCount += transition.queryCount; depCount += transition.depCount; transitions.push(transition); } else { context.errors.push('only state() and transition() definitions can sit inside of a trigger()'); } }); return { type: 7 /* Trigger */, name: metadata.name, states, transitions, queryCount, depCount, options: null }; } /** * @param {?} metadata * @param {?} context * @return {?} */ visitState(metadata, context) { const /** @type {?} */ styleAst = this.visitStyle(metadata.styles, context); const /** @type {?} */ astParams = (metadata.options && metadata.options.params) || null; if (styleAst.containsDynamicStyles) { const /** @type {?} */ missingSubs = new Set(); const /** @type {?} */ params = astParams || {}; styleAst.styles.forEach(value => { if (isObject(value)) { const /** @type {?} */ stylesObj = /** @type {?} */ (value); Object.keys(stylesObj).forEach(prop => { extractStyleParams(stylesObj[prop]).forEach(sub => { if (!params.hasOwnProperty(sub)) { missingSubs.add(sub); } }); }); } }); if (missingSubs.size) { const /** @type {?} */ missingSubsArr = iteratorToArray(missingSubs.values()); context.errors.push(`state("${metadata.name}", ...) must define default values for all the following style substitutions: ${missingSubsArr.join(', ')}`); } } return { type: 0 /* State */, name: metadata.name, style: styleAst, options: astParams ? { params: astParams } : null }; } /** * @param {?} metadata * @param {?} context * @return {?} */ visitTransition(metadata, context) { context.queryCount = 0; context.depCount = 0; const /** @type {?} */ animation = visitDslNode(this, normalizeAnimationEntry(metadata.animation), context); const /** @type {?} */ matchers = parseTransitionExpr(metadata.expr, context.errors); return { type: 1 /* Transition */, matchers, animation, queryCount: context.queryCount, depCount: context.depCount, options: normalizeAnimationOptions(metadata.options) }; } /** * @param {?} metadata * @param {?} context * @return {?} */ visitSequence(metadata, context) { return { type: 2 /* Sequence */, steps: metadata.steps.map(s => visitDslNode(this, s, context)), options: normalizeAnimationOptions(metadata.options) }; } /** * @param {?} metadata * @param {?} context * @return {?} */ visitGroup(metadata, context) { const /** @type {?} */ currentTime = context.currentTime; let /** @type {?} */ furthestTime = 0; const /** @type {?} */ steps = metadata.steps.map(step => { context.currentTime = currentTime; const /** @type {?} */ innerAst = visitDslNode(this, step, context); furthestTime = Math.max(furthestTime, context.currentTime); return innerAst; }); context.currentTime = furthestTime; return { type: 3 /* Group */, steps, options: normalizeAnimationOptions(metadata.options) }; } /** * @param {?} metadata * @param {?} context * @return {?} */ visitAnimate(metadata, context) { const /** @type {?} */ timingAst = constructTimingAst(metadata.timings, context.errors); context.currentAnimateTimings = timingAst; let /** @type {?} */ styleAst; let /** @type {?} */ styleMetadata = metadata.styles ? metadata.styles : Object(__WEBPACK_IMPORTED_MODULE_0__angular_animations__["style"])({}); if (styleMetadata.type == 5 /* Keyframes */) { styleAst = this.visitKeyframes(/** @type {?} */ (styleMetadata), context); } else { let /** @type {?} */ styleMetadata = /** @type {?} */ (metadata.styles); let /** @type {?} */ isEmpty = false; if (!styleMetadata) { isEmpty = true; const /** @type {?} */ newStyleData = {}; if (timingAst.easing) { newStyleData['easing'] = timingAst.easing; } styleMetadata = Object(__WEBPACK_IMPORTED_MODULE_0__angular_animations__["style"])(newStyleData); } context.currentTime += timingAst.duration + timingAst.delay; const /** @type {?} */ _styleAst = this.visitStyle(styleMetadata, context); _styleAst.isEmptyStep = isEmpty; styleAst = _styleAst; } context.currentAnimateTimings = null; return { type: 4 /* Animate */, timings: timingAst, style: styleAst, options: null }; } /** * @param {?} metadata * @param {?} context * @return {?} */ visitStyle(metadata, context) { const /** @type {?} */ ast = this._makeStyleAst(metadata, context); this._validateStyleAst(ast, context); return ast; } /** * @param {?} metadata * @param {?} context * @return {?} */ _makeStyleAst(metadata, context) { const /** @type {?} */ styles = []; if (Array.isArray(metadata.styles)) { (/** @type {?} */ (metadata.styles)).forEach(styleTuple => { if (typeof styleTuple == 'string') { if (styleTuple == __WEBPACK_IMPORTED_MODULE_0__angular_animations__["AUTO_STYLE"]) { styles.push(/** @type {?} */ (styleTuple)); } else { context.errors.push(`The provided style string value ${styleTuple} is not allowed.`); } } else { styles.push(/** @type {?} */ (styleTuple)); } }); } else { styles.push(metadata.styles); } let /** @type {?} */ containsDynamicStyles = false; let /** @type {?} */ collectedEasing = null; styles.forEach(styleData => { if (isObject(styleData)) { const /** @type {?} */ styleMap = /** @type {?} */ (styleData); const /** @type {?} */ easing = styleMap['easing']; if (easing) { collectedEasing = /** @type {?} */ (easing); delete styleMap['easing']; } if (!containsDynamicStyles) { for (let /** @type {?} */ prop in styleMap) { const /** @type {?} */ value = styleMap[prop]; if (value.toString().indexOf(SUBSTITUTION_EXPR_START) >= 0) { containsDynamicStyles = true; break; } } } } }); return { type: 6 /* Style */, styles, easing: collectedEasing, offset: metadata.offset, containsDynamicStyles, options: null }; } /** * @param {?} ast * @param {?} context * @return {?} */ _validateStyleAst(ast, context) { const /** @type {?} */ timings = context.currentAnimateTimings; let /** @type {?} */ endTime = context.currentTime; let /** @type {?} */ startTime = context.currentTime; if (timings && startTime > 0) { startTime -= timings.duration + timings.delay; } ast.styles.forEach(tuple => { if (typeof tuple == 'string') return; Object.keys(tuple).forEach(prop => { if (!this._driver.validateStyleProperty(prop)) { context.errors.push(`The provided animation property "${prop}" is not a supported CSS property for animations`); return; } const /** @type {?} */ collectedStyles = context.collectedStyles[/** @type {?} */ ((context.currentQuerySelector))]; const /** @type {?} */ collectedEntry = collectedStyles[prop]; let /** @type {?} */ updateCollectedStyle = true; if (collectedEntry) { if (startTime != endTime && startTime >= collectedEntry.startTime && endTime <= collectedEntry.endTime) { context.errors.push(`The CSS property "${prop}" that exists between the times of "${collectedEntry.startTime}ms" and "${collectedEntry.endTime}ms" is also being animated in a parallel animation between the times of "${startTime}ms" and "${endTime}ms"`); updateCollectedStyle = false; } // we always choose the smaller start time value since we // want to have a record of the entire animation window where // the style property is being animated in between startTime = collectedEntry.startTime; } if (updateCollectedStyle) { collectedStyles[prop] = { startTime, endTime }; } if (context.options) { validateStyleParams(tuple[prop], context.options, context.errors); } }); }); } /** * @param {?} metadata * @param {?} context * @return {?} */ visitKeyframes(metadata, context) { const /** @type {?} */ ast = { type: 5 /* Keyframes */, styles: [], options: null }; if (!context.currentAnimateTimings) { context.errors.push(`keyframes() must be placed inside of a call to animate()`); return ast; } const /** @type {?} */ MAX_KEYFRAME_OFFSET = 1; let /** @type {?} */ totalKeyframesWithOffsets = 0; const /** @type {?} */ offsets = []; let /** @type {?} */ offsetsOutOfOrder = false; let /** @type {?} */ keyframesOutOfRange = false; let /** @type {?} */ previousOffset = 0; const /** @type {?} */ keyframes = metadata.steps.map(styles => { const /** @type {?} */ style$$1 = this._makeStyleAst(styles, context); let /** @type {?} */ offsetVal = style$$1.offset != null ? style$$1.offset : consumeOffset(style$$1.styles); let /** @type {?} */ offset = 0; if (offsetVal != null) { totalKeyframesWithOffsets++; offset = style$$1.offset = offsetVal; } keyframesOutOfRange = keyframesOutOfRange || offset < 0 || offset > 1; offsetsOutOfOrder = offsetsOutOfOrder || offset < previousOffset; previousOffset = offset; offsets.push(offset); return style$$1; }); if (keyframesOutOfRange) { context.errors.push(`Please ensure that all keyframe offsets are between 0 and 1`); } if (offsetsOutOfOrder) { context.errors.push(`Please ensure that all keyframe offsets are in order`); } const /** @type {?} */ length = metadata.steps.length; let /** @type {?} */ generatedOffset = 0; if (totalKeyframesWithOffsets > 0 && totalKeyframesWithOffsets < length) { context.errors.push(`Not all style() steps within the declared keyframes() contain offsets`); } else if (totalKeyframesWithOffsets == 0) { generatedOffset = MAX_KEYFRAME_OFFSET / (length - 1); } const /** @type {?} */ limit = length - 1; const /** @type {?} */ currentTime = context.currentTime; const /** @type {?} */ currentAnimateTimings = /** @type {?} */ ((context.currentAnimateTimings)); const /** @type {?} */ animateDuration = currentAnimateTimings.duration; keyframes.forEach((kf, i) => { const /** @type {?} */ offset = generatedOffset > 0 ? (i == limit ? 1 : (generatedOffset * i)) : offsets[i]; const /** @type {?} */ durationUpToThisFrame = offset * animateDuration; context.currentTime = currentTime + currentAnimateTimings.delay + durationUpToThisFrame; currentAnimateTimings.duration = durationUpToThisFrame; this._validateStyleAst(kf, context); kf.offset = offset; ast.styles.push(kf); }); return ast; } /** * @param {?} metadata * @param {?} context * @return {?} */ visitReference(metadata, context) { return { type: 8 /* Reference */, animation: visitDslNode(this, normalizeAnimationEntry(metadata.animation), context), options: normalizeAnimationOptions(metadata.options) }; } /** * @param {?} metadata * @param {?} context * @return {?} */ visitAnimateChild(metadata, context) { context.depCount++; return { type: 9 /* AnimateChild */, options: normalizeAnimationOptions(metadata.options) }; } /** * @param {?} metadata * @param {?} context * @return {?} */ visitAnimateRef(metadata, context) { return { type: 10 /* AnimateRef */, animation: this.visitReference(metadata.animation, context), options: normalizeAnimationOptions(metadata.options) }; } /** * @param {?} metadata * @param {?} context * @return {?} */ visitQuery(metadata, context) { const /** @type {?} */ parentSelector = /** @type {?} */ ((context.currentQuerySelector)); const /** @type {?} */ options = /** @type {?} */ ((metadata.options || {})); context.queryCount++; context.currentQuery = metadata; const [selector, includeSelf] = normalizeSelector(metadata.selector); context.currentQuerySelector = parentSelector.length ? (parentSelector + ' ' + selector) : selector; getOrSetAsInMap(context.collectedStyles, context.currentQuerySelector, {}); const /** @type {?} */ animation = visitDslNode(this, normalizeAnimationEntry(metadata.animation), context); context.currentQuery = null; context.currentQuerySelector = parentSelector; return { type: 11 /* Query */, selector, limit: options.limit || 0, optional: !!options.optional, includeSelf, animation, originalSelector: metadata.selector, options: normalizeAnimationOptions(metadata.options) }; } /** * @param {?} metadata * @param {?} context * @return {?} */ visitStagger(metadata, context) { if (!context.currentQuery) { context.errors.push(`stagger() can only be used inside of query()`); } const /** @type {?} */ timings = metadata.timings === 'full' ? { duration: 0, delay: 0, easing: 'full' } : resolveTiming(metadata.timings, context.errors, true); return { type: 12 /* Stagger */, animation: visitDslNode(this, normalizeAnimationEntry(metadata.animation), context), timings, options: null }; } } /** * @param {?} selector * @return {?} */ function normalizeSelector(selector) { const /** @type {?} */ hasAmpersand = selector.split(/\s*,\s*/).find(token => token == SELF_TOKEN) ? true : false; if (hasAmpersand) { selector = selector.replace(SELF_TOKEN_REGEX, ''); } // the :enter and :leave selectors are filled in at runtime during timeline building selector = selector.replace(/@\*/g, NG_TRIGGER_SELECTOR) .replace(/@\w+/g, match => NG_TRIGGER_SELECTOR + '-' + match.substr(1)) .replace(/:animating/g, NG_ANIMATING_SELECTOR); return [selector, hasAmpersand]; } /** * @param {?} obj * @return {?} */ function normalizeParams(obj) { return obj ? copyObj(obj) : null; } class AnimationAstBuilderContext { /** * @param {?} errors */ constructor(errors) { this.errors = errors; this.queryCount = 0; this.depCount = 0; this.currentTransition = null; this.currentQuery = null; this.currentQuerySelector = null; this.currentAnimateTimings = null; this.currentTime = 0; this.collectedStyles = {}; this.options = null; } } /** * @param {?} styles * @return {?} */ function consumeOffset(styles) { if (typeof styles == 'string') return null; let /** @type {?} */ offset = null; if (Array.isArray(styles)) { styles.forEach(styleTuple => { if (isObject(styleTuple) && styleTuple.hasOwnProperty('offset')) { const /** @type {?} */ obj = /** @type {?} */ (styleTuple); offset = parseFloat(/** @type {?} */ (obj['offset'])); delete obj['offset']; } }); } else if (isObject(styles) && styles.hasOwnProperty('offset')) { const /** @type {?} */ obj = /** @type {?} */ (styles); offset = parseFloat(/** @type {?} */ (obj['offset'])); delete obj['offset']; } return offset; } /** * @param {?} value * @return {?} */ function isObject(value) { return !Array.isArray(value) && typeof value == 'object'; } /** * @param {?} value * @param {?} errors * @return {?} */ function constructTimingAst(value, errors) { let /** @type {?} */ timings = null; if (value.hasOwnProperty('duration')) { timings = /** @type {?} */ (value); } else if (typeof value == 'number') { const /** @type {?} */ duration = resolveTiming(/** @type {?} */ (value), errors).duration; return makeTimingAst(/** @type {?} */ (duration), 0, ''); } const /** @type {?} */ strValue = /** @type {?} */ (value); const /** @type {?} */ isDynamic = strValue.split(/\s+/).some(v => v.charAt(0) == '{' && v.charAt(1) == '{'); if (isDynamic) { const /** @type {?} */ ast = /** @type {?} */ (makeTimingAst(0, 0, '')); ast.dynamic = true; ast.strValue = strValue; return /** @type {?} */ (ast); } timings = timings || resolveTiming(strValue, errors); return makeTimingAst(timings.duration, timings.delay, timings.easing); } /** * @param {?} options * @return {?} */ function normalizeAnimationOptions(options) { if (options) { options = copyObj(options); if (options['params']) { options['params'] = /** @type {?} */ ((normalizeParams(options['params']))); } } else { options = {}; } return options; } /** * @param {?} duration * @param {?} delay * @param {?} easing * @return {?} */ function makeTimingAst(duration, delay, easing) { return { duration, delay, easing }; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @record */ /** * @param {?} element * @param {?} keyframes * @param {?} preStyleProps * @param {?} postStyleProps * @param {?} duration * @param {?} delay * @param {?=} easing * @param {?=} subTimeline * @return {?} */ function createTimelineInstruction(element, keyframes, preStyleProps, postStyleProps, duration, delay, easing = null, subTimeline = false) { return { type: 1 /* TimelineAnimation */, element, keyframes, preStyleProps, postStyleProps, duration, delay, totalTime: duration + delay, easing, subTimeline }; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ class ElementInstructionMap { constructor() { this._map = new Map(); } /** * @param {?} element * @return {?} */ consume(element) { let /** @type {?} */ instructions = this._map.get(element); if (instructions) { this._map.delete(element); } else { instructions = []; } return instructions; } /** * @param {?} element * @param {?} instructions * @return {?} */ append(element, instructions) { let /** @type {?} */ existingInstructions = this._map.get(element); if (!existingInstructions) { this._map.set(element, existingInstructions = []); } existingInstructions.push(...instructions); } /** * @param {?} element * @return {?} */ has(element) { return this._map.has(element); } /** * @return {?} */ clear() { this._map.clear(); } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ const ONE_FRAME_IN_MILLISECONDS = 1; const ENTER_TOKEN = ':enter'; const ENTER_TOKEN_REGEX = new RegExp(ENTER_TOKEN, 'g'); const LEAVE_TOKEN = ':leave'; const LEAVE_TOKEN_REGEX = new RegExp(LEAVE_TOKEN, 'g'); /** * @param {?} driver * @param {?} rootElement * @param {?} ast * @param {?} enterClassName * @param {?} leaveClassName * @param {?=} startingStyles * @param {?=} finalStyles * @param {?=} options * @param {?=} subInstructions * @param {?=} errors * @return {?} */ function buildAnimationTimelines(driver, rootElement, ast, enterClassName, leaveClassName, startingStyles = {}, finalStyles = {}, options, subInstructions, errors = []) { return new AnimationTimelineBuilderVisitor().buildKeyframes(driver, rootElement, ast, enterClassName, leaveClassName, startingStyles, finalStyles, options, subInstructions, errors); } class AnimationTimelineBuilderVisitor { /** * @param {?} driver * @param {?} rootElement * @param {?} ast * @param {?} enterClassName * @param {?} leaveClassName * @param {?} startingStyles * @param {?} finalStyles * @param {?} options * @param {?=} subInstructions * @param {?=} errors * @return {?} */ buildKeyframes(driver, rootElement, ast, enterClassName, leaveClassName, startingStyles, finalStyles, options, subInstructions, errors = []) { subInstructions = subInstructions || new ElementInstructionMap(); const /** @type {?} */ context = new AnimationTimelineContext(driver, rootElement, subInstructions, enterClassName, leaveClassName, errors, []); context.options = options; context.currentTimeline.setStyles([startingStyles], null, context.errors, options); visitDslNode(this, ast, context); // this checks to see if an actual animation happened const /** @type {?} */ timelines = context.timelines.filter(timeline => timeline.containsAnimation()); if (timelines.length && Object.keys(finalStyles).length) { const /** @type {?} */ tl = timelines[timelines.length - 1]; if (!tl.allowOnlyTimelineStyles()) { tl.setStyles([finalStyles], null, context.errors, options); } } return timelines.length ? timelines.map(timeline => timeline.buildKeyframes()) : [createTimelineInstruction(rootElement, [], [], [], 0, 0, '', false)]; } /** * @param {?} ast * @param {?} context * @return {?} */ visitTrigger(ast, context) { // these values are not visited in this AST } /** * @param {?} ast * @param {?} context * @return {?} */ visitState(ast, context) { // these values are not visited in this AST } /** * @param {?} ast * @param {?} context * @return {?} */ visitTransition(ast, context) { // these values are not visited in this AST } /** * @param {?} ast * @param {?} context * @return {?} */ visitAnimateChild(ast, context) { const /** @type {?} */ elementInstructions = context.subInstructions.consume(context.element); if (elementInstructions) { const /** @type {?} */ innerContext = context.createSubContext(ast.options); const /** @type {?} */ startTime = context.currentTimeline.currentTime; const /** @type {?} */ endTime = this._visitSubInstructions(elementInstructions, innerContext, /** @type {?} */ (innerContext.options)); if (startTime != endTime) { // we do this on the upper context because we created a sub context for // the sub child animations context.transformIntoNewTimeline(endTime); } } context.previousNode = ast; } /** * @param {?} ast * @param {?} context * @return {?} */ visitAnimateRef(ast, context) { const /** @type {?} */ innerContext = context.createSubContext(ast.options); innerContext.transformIntoNewTimeline(); this.visitReference(ast.animation, innerContext); context.transformIntoNewTimeline(innerContext.currentTimeline.currentTime); context.previousNode = ast; } /** * @param {?} instructions * @param {?} context * @param {?} options * @return {?} */ _visitSubInstructions(instructions, context, options) { const /** @type {?} */ startTime = context.currentTimeline.currentTime; let /** @type {?} */ furthestTime = startTime; // this is a special-case for when a user wants to skip a sub // animation from being fired entirely. const /** @type {?} */ duration = options.duration != null ? resolveTimingValue(options.duration) : null; const /** @type {?} */ delay = options.delay != null ? resolveTimingValue(options.delay) : null; if (duration !== 0) { instructions.forEach(instruction => { const /** @type {?} */ instructionTimings = context.appendInstructionToTimeline(instruction, duration, delay); furthestTime = Math.max(furthestTime, instructionTimings.duration + instructionTimings.delay); }); } return furthestTime; } /** * @param {?} ast * @param {?} context * @return {?} */ visitReference(ast, context) { context.updateOptions(ast.options, true); visitDslNode(this, ast.animation, context); context.previousNode = ast; } /** * @param {?} ast * @param {?} context * @return {?} */ visitSequence(ast, context) { const /** @type {?} */ subContextCount = context.subContextCount; let /** @type {?} */ ctx = context; const /** @type {?} */ options = ast.options; if (options && (options.params || options.delay)) { ctx = context.createSubContext(options); ctx.transformIntoNewTimeline(); if (options.delay != null) { if (ctx.previousNode.type == 6 /* Style */) { ctx.currentTimeline.snapshotCurrentStyles(); ctx.previousNode = DEFAULT_NOOP_PREVIOUS_NODE; } const /** @type {?} */ delay = resolveTimingValue(options.delay); ctx.delayNextStep(delay); } } if (ast.steps.length) { ast.steps.forEach(s => visitDslNode(this, s, ctx)); // this is here just incase the inner steps only contain or end with a style() call ctx.currentTimeline.applyStylesToKeyframe(); // this means that some animation function within the sequence // ended up creating a sub timeline (which means the current // timeline cannot overlap with the contents of the sequence) if (ctx.subContextCount > subContextCount) { ctx.transformIntoNewTimeline(); } } context.previousNode = ast; } /** * @param {?} ast * @param {?} context * @return {?} */ visitGroup(ast, context) { const /** @type {?} */ innerTimelines = []; let /** @type {?} */ furthestTime = context.currentTimeline.currentTime; const /** @type {?} */ delay = ast.options && ast.options.delay ? resolveTimingValue(ast.options.delay) : 0; ast.steps.forEach(s => { const /** @type {?} */ innerContext = context.createSubContext(ast.options); if (delay) { innerContext.delayNextStep(delay); } visitDslNode(this, s, innerContext); furthestTime = Math.max(furthestTime, innerContext.currentTimeline.currentTime); innerTimelines.push(innerContext.currentTimeline); }); // this operation is run after the AST loop because otherwise // if the parent timeline's collected styles were updated then // it would pass in invalid data into the new-to-be forked items innerTimelines.forEach(timeline => context.currentTimeline.mergeTimelineCollectedStyles(timeline)); context.transformIntoNewTimeline(furthestTime); context.previousNode = ast; } /** * @param {?} ast * @param {?} context * @return {?} */ _visitTiming(ast, context) { if ((/** @type {?} */ (ast)).dynamic) { const /** @type {?} */ strValue = (/** @type {?} */ (ast)).strValue; const /** @type {?} */ timingValue = context.params ? interpolateParams(strValue, context.params, context.errors) : strValue; return resolveTiming(timingValue, context.errors); } else { return { duration: ast.duration, delay: ast.delay, easing: ast.easing }; } } /** * @param {?} ast * @param {?} context * @return {?} */ visitAnimate(ast, context) { const /** @type {?} */ timings = context.currentAnimateTimings = this._visitTiming(ast.timings, context); const /** @type {?} */ timeline = context.currentTimeline; if (timings.delay) { context.incrementTime(timings.delay); timeline.snapshotCurrentStyles(); } const /** @type {?} */ style$$1 = ast.style; if (style$$1.type == 5 /* Keyframes */) { this.visitKeyframes(style$$1, context); } else { context.incrementTime(timings.duration); this.visitStyle(/** @type {?} */ (style$$1), context); timeline.applyStylesToKeyframe(); } context.currentAnimateTimings = null; context.previousNode = ast; } /** * @param {?} ast * @param {?} context * @return {?} */ visitStyle(ast, context) { const /** @type {?} */ timeline = context.currentTimeline; const /** @type {?} */ timings = /** @type {?} */ ((context.currentAnimateTimings)); // this is a special case for when a style() call // directly follows an animate() call (but not inside of an animate() call) if (!timings && timeline.getCurrentStyleProperties().length) { timeline.forwardFrame(); } const /** @type {?} */ easing = (timings && timings.easing) || ast.easing; if (ast.isEmptyStep) { timeline.applyEmptyStep(easing); } else { timeline.setStyles(ast.styles, easing, context.errors, context.options); } context.previousNode = ast; } /** * @param {?} ast * @param {?} context * @return {?} */ visitKeyframes(ast, context) { const /** @type {?} */ currentAnimateTimings = /** @type {?} */ ((context.currentAnimateTimings)); const /** @type {?} */ startTime = (/** @type {?} */ ((context.currentTimeline))).duration; const /** @type {?} */ duration = currentAnimateTimings.duration; const /** @type {?} */ innerContext = context.createSubContext(); const /** @type {?} */ innerTimeline = innerContext.currentTimeline; innerTimeline.easing = currentAnimateTimings.easing; ast.styles.forEach(step => { const /** @type {?} */ offset = step.offset || 0; innerTimeline.forwardTime(offset * duration); innerTimeline.setStyles(step.styles, step.easing, context.errors, context.options); innerTimeline.applyStylesToKeyframe(); }); // this will ensure that the parent timeline gets all the styles from // the child even if the new timeline below is not used context.currentTimeline.mergeTimelineCollectedStyles(innerTimeline); // we do this because the window between this timeline and the sub timeline // should ensure that the styles within are exactly the same as they were before context.transformIntoNewTimeline(startTime + duration); context.previousNode = ast; } /** * @param {?} ast * @param {?} context * @return {?} */ visitQuery(ast, context) { // in the event that the first step before this is a style step we need // to ensure the styles are applied before the children are animated const /** @type {?} */ startTime = context.currentTimeline.currentTime; const /** @type {?} */ options = /** @type {?} */ ((ast.options || {})); const /** @type {?} */ delay = options.delay ? resolveTimingValue(options.delay) : 0; if (delay && (context.previousNode.type === 6 /* Style */ || (startTime == 0 && context.currentTimeline.getCurrentStyleProperties().length))) { context.currentTimeline.snapshotCurrentStyles(); context.previousNode = DEFAULT_NOOP_PREVIOUS_NODE; } let /** @type {?} */ furthestTime = startTime; const /** @type {?} */ elms = context.invokeQuery(ast.selector, ast.originalSelector, ast.limit, ast.includeSelf, options.optional ? true : false, context.errors); context.currentQueryTotal = elms.length; let /** @type {?} */ sameElementTimeline = null; elms.forEach((element, i) => { context.currentQueryIndex = i; const /** @type {?} */ innerContext = context.createSubContext(ast.options, element); if (delay) { innerContext.delayNextStep(delay); } if (element === context.element) { sameElementTimeline = innerContext.currentTimeline; } visitDslNode(this, ast.animation, innerContext); // this is here just incase the inner steps only contain or end // with a style() call (which is here to signal that this is a preparatory // call to style an element before it is animated again) innerContext.currentTimeline.applyStylesToKeyframe(); const /** @type {?} */ endTime = innerContext.currentTimeline.currentTime; furthestTime = Math.max(furthestTime, endTime); }); context.currentQueryIndex = 0; context.currentQueryTotal = 0; context.transformIntoNewTimeline(furthestTime); if (sameElementTimeline) { context.currentTimeline.mergeTimelineCollectedStyles(sameElementTimeline); context.currentTimeline.snapshotCurrentStyles(); } context.previousNode = ast; } /** * @param {?} ast * @param {?} context * @return {?} */ visitStagger(ast, context) { const /** @type {?} */ parentContext = /** @type {?} */ ((context.parentContext)); const /** @type {?} */ tl = context.currentTimeline; const /** @type {?} */ timings = ast.timings; const /** @type {?} */ duration = Math.abs(timings.duration); const /** @type {?} */ maxTime = duration * (context.currentQueryTotal - 1); let /** @type {?} */ delay = duration * context.currentQueryIndex; let /** @type {?} */ staggerTransformer = timings.duration < 0 ? 'reverse' : timings.easing; switch (staggerTransformer) { case 'reverse': delay = maxTime - delay; break; case 'full': delay = parentContext.currentStaggerTime; break; } const /** @type {?} */ timeline = context.currentTimeline; if (delay) { timeline.delayNextStep(delay); } const /** @type {?} */ startingTime = timeline.currentTime; visitDslNode(this, ast.animation, context); context.previousNode = ast; // time = duration + delay // the reason why this computation is so complex is because // the inner timeline may either have a delay value or a stretched // keyframe depending on if a subtimeline is not used or is used. parentContext.currentStaggerTime = (tl.currentTime - startingTime) + (tl.startTime - parentContext.currentTimeline.startTime); } } const DEFAULT_NOOP_PREVIOUS_NODE = /** @type {?} */ ({}); class AnimationTimelineContext { /** * @param {?} _driver * @param {?} element * @param {?} subInstructions * @param {?} _enterClassName * @param {?} _leaveClassName * @param {?} errors * @param {?} timelines * @param {?=} initialTimeline */ constructor(_driver, element, subInstructions, _enterClassName, _leaveClassName, errors, timelines, initialTimeline) { this._driver = _driver; this.element = element; this.subInstructions = subInstructions; this._enterClassName = _enterClassName; this._leaveClassName = _leaveClassName; this.errors = errors; this.timelines = timelines; this.parentContext = null; this.currentAnimateTimings = null; this.previousNode = DEFAULT_NOOP_PREVIOUS_NODE; this.subContextCount = 0; this.options = {}; this.currentQueryIndex = 0; this.currentQueryTotal = 0; this.currentStaggerTime = 0; this.currentTimeline = initialTimeline || new TimelineBuilder(this._driver, element, 0); timelines.push(this.currentTimeline); } /** * @return {?} */ get params() { return this.options.params; } /** * @param {?} options * @param {?=} skipIfExists * @return {?} */ updateOptions(options, skipIfExists) { if (!options) return; const /** @type {?} */ newOptions = /** @type {?} */ (options); let /** @type {?} */ optionsToUpdate = this.options; // NOTE: this will get patched up when other animation methods support duration overrides if (newOptions.duration != null) { (/** @type {?} */ (optionsToUpdate)).duration = resolveTimingValue(newOptions.duration); } if (newOptions.delay != null) { optionsToUpdate.delay = resolveTimingValue(newOptions.delay); } const /** @type {?} */ newParams = newOptions.params; if (newParams) { let /** @type {?} */ paramsToUpdate = /** @type {?} */ ((optionsToUpdate.params)); if (!paramsToUpdate) { paramsToUpdate = this.options.params = {}; } Object.keys(newParams).forEach(name => { if (!skipIfExists || !paramsToUpdate.hasOwnProperty(name)) { paramsToUpdate[name] = interpolateParams(newParams[name], paramsToUpdate, this.errors); } }); } } /** * @return {?} */ _copyOptions() { const /** @type {?} */ options = {}; if (this.options) { const /** @type {?} */ oldParams = this.options.params; if (oldParams) { const /** @type {?} */ params = options['params'] = {}; Object.keys(oldParams).forEach(name => { params[name] = oldParams[name]; }); } } return options; } /** * @param {?=} options * @param {?=} element * @param {?=} newTime * @return {?} */ createSubContext(options = null, element, newTime) { const /** @type {?} */ target = element || this.element; const /** @type {?} */ context = new AnimationTimelineContext(this._driver, target, this.subInstructions, this._enterClassName, this._leaveClassName, this.errors, this.timelines, this.currentTimeline.fork(target, newTime || 0)); context.previousNode = this.previousNode; context.currentAnimateTimings = this.currentAnimateTimings; context.options = this._copyOptions(); context.updateOptions(options); context.currentQueryIndex = this.currentQueryIndex; context.currentQueryTotal = this.currentQueryTotal; context.parentContext = this; this.subContextCount++; return context; } /** * @param {?=} newTime * @return {?} */ transformIntoNewTimeline(newTime) { this.previousNode = DEFAULT_NOOP_PREVIOUS_NODE; this.currentTimeline = this.currentTimeline.fork(this.element, newTime); this.timelines.push(this.currentTimeline); return this.currentTimeline; } /** * @param {?} instruction * @param {?} duration * @param {?} delay * @return {?} */ appendInstructionToTimeline(instruction, duration, delay) { const /** @type {?} */ updatedTimings = { duration: duration != null ? duration : instruction.duration, delay: this.currentTimeline.currentTime + (delay != null ? delay : 0) + instruction.delay, easing: '' }; const /** @type {?} */ builder = new SubTimelineBuilder(this._driver, instruction.element, instruction.keyframes, instruction.preStyleProps, instruction.postStyleProps, updatedTimings, instruction.stretchStartingKeyframe); this.timelines.push(builder); return updatedTimings; } /** * @param {?} time * @return {?} */ incrementTime(time) { this.currentTimeline.forwardTime(this.currentTimeline.duration + time); } /** * @param {?} delay * @return {?} */ delayNextStep(delay) { // negative delays are not yet supported if (delay > 0) { this.currentTimeline.delayNextStep(delay); } } /** * @param {?} selector * @param {?} originalSelector * @param {?} limit * @param {?} includeSelf * @param {?} optional * @param {?} errors * @return {?} */ invokeQuery(selector, originalSelector, limit, includeSelf, optional, errors) { let /** @type {?} */ results = []; if (includeSelf) { results.push(this.element); } if (selector.length > 0) { // if :self is only used then the selector is empty selector = selector.replace(ENTER_TOKEN_REGEX, '.' + this._enterClassName); selector = selector.replace(LEAVE_TOKEN_REGEX, '.' + this._leaveClassName); const /** @type {?} */ multi = limit != 1; let /** @type {?} */ elements = this._driver.query(this.element, selector, multi); if (limit !== 0) { elements = limit < 0 ? elements.slice(elements.length + limit, elements.length) : elements.slice(0, limit); } results.push(...elements); } if (!optional && results.length == 0) { errors.push(`\`query("${originalSelector}")\` returned zero elements. (Use \`query("${originalSelector}", { optional: true })\` if you wish to allow this.)`); } return results; } } class TimelineBuilder { /** * @param {?} _driver * @param {?} element * @param {?} startTime * @param {?=} _elementTimelineStylesLookup */ constructor(_driver, element, startTime, _elementTimelineStylesLookup) { this._driver = _driver; this.element = element; this.startTime = startTime; this._elementTimelineStylesLookup = _elementTimelineStylesLookup; this.duration = 0; this._previousKeyframe = {}; this._currentKeyframe = {}; this._keyframes = new Map(); this._styleSummary = {}; this._pendingStyles = {}; this._backFill = {}; this._currentEmptyStepKeyframe = null; if (!this._elementTimelineStylesLookup) { this._elementTimelineStylesLookup = new Map(); } this._localTimelineStyles = Object.create(this._backFill, {}); this._globalTimelineStyles = /** @type {?} */ ((this._elementTimelineStylesLookup.get(element))); if (!this._globalTimelineStyles) { this._globalTimelineStyles = this._localTimelineStyles; this._elementTimelineStylesLookup.set(element, this._localTimelineStyles); } this._loadKeyframe(); } /** * @return {?} */ containsAnimation() { switch (this._keyframes.size) { case 0: return false; case 1: return this.getCurrentStyleProperties().length > 0; default: return true; } } /** * @return {?} */ getCurrentStyleProperties() { return Object.keys(this._currentKeyframe); } /** * @return {?} */ get currentTime() { return this.startTime + this.duration; } /** * @param {?} delay * @return {?} */ delayNextStep(delay) { // in the event that a style() step is placed right before a stagger() // and that style() step is the very first style() value in the animation // then we need to make a copy of the keyframe [0, copy, 1] so that the delay // properly applies the style() values to work with the stagger... const /** @type {?} */ hasPreStyleStep = this._keyframes.size == 1 && Object.keys(this._pendingStyles).length; if (this.duration || hasPreStyleStep) { this.forwardTime(this.currentTime + delay); if (hasPreStyleStep) { this.snapshotCurrentStyles(); } } else { this.startTime += delay; } } /** * @param {?} element * @param {?=} currentTime * @return {?} */ fork(element, currentTime) { this.applyStylesToKeyframe(); return new TimelineBuilder(this._driver, element, currentTime || this.currentTime, this._elementTimelineStylesLookup); } /** * @return {?} */ _loadKeyframe() { if (this._currentKeyframe) { this._previousKeyframe = this._currentKeyframe; } this._currentKeyframe = /** @type {?} */ ((this._keyframes.get(this.duration))); if (!this._currentKeyframe) { this._currentKeyframe = Object.create(this._backFill, {}); this._keyframes.set(this.duration, this._currentKeyframe); } } /** * @return {?} */ forwardFrame() { this.duration += ONE_FRAME_IN_MILLISECONDS; this._loadKeyframe(); } /** * @param {?} time * @return {?} */ forwardTime(time) { this.applyStylesToKeyframe(); this.duration = time; this._loadKeyframe(); } /** * @param {?} prop * @param {?} value * @return {?} */ _updateStyle(prop, value) { this._localTimelineStyles[prop] = value; this._globalTimelineStyles[prop] = value; this._styleSummary[prop] = { time: this.currentTime, value }; } /** * @return {?} */ allowOnlyTimelineStyles() { return this._currentEmptyStepKeyframe !== this._currentKeyframe; } /** * @param {?} easing * @return {?} */ applyEmptyStep(easing) { if (easing) { this._previousKeyframe['easing'] = easing; } // special case for animate(duration): // all missing styles are filled with a `*` value then // if any destination styles are filled in later on the same // keyframe then they will override the overridden styles // We use `_globalTimelineStyles` here because there may be // styles in previous keyframes that are not present in this timeline Object.keys(this._globalTimelineStyles).forEach(prop => { this._backFill[prop] = this._globalTimelineStyles[prop] || __WEBPACK_IMPORTED_MODULE_0__angular_animations__["AUTO_STYLE"]; this._currentKeyframe[prop] = __WEBPACK_IMPORTED_MODULE_0__angular_animations__["AUTO_STYLE"]; }); this._currentEmptyStepKeyframe = this._currentKeyframe; } /** * @param {?} input * @param {?} easing * @param {?} errors * @param {?=} options * @return {?} */ setStyles(input, easing, errors, options) { if (easing) { this._previousKeyframe['easing'] = easing; } const /** @type {?} */ params = (options && options.params) || {}; const /** @type {?} */ styles = flattenStyles(input, this._globalTimelineStyles); Object.keys(styles).forEach(prop => { const /** @type {?} */ val = interpolateParams(styles[prop], params, errors); this._pendingStyles[prop] = val; if (!this._localTimelineStyles.hasOwnProperty(prop)) { this._backFill[prop] = this._globalTimelineStyles.hasOwnProperty(prop) ? this._globalTimelineStyles[prop] : __WEBPACK_IMPORTED_MODULE_0__angular_animations__["AUTO_STYLE"]; } this._updateStyle(prop, val); }); } /** * @return {?} */ applyStylesToKeyframe() { const /** @type {?} */ styles = this._pendingStyles; const /** @type {?} */ props = Object.keys(styles); if (props.length == 0) return; this._pendingStyles = {}; props.forEach(prop => { const /** @type {?} */ val = styles[prop]; this._currentKeyframe[prop] = val; }); Object.keys(this._localTimelineStyles).forEach(prop => { if (!this._currentKeyframe.hasOwnProperty(prop)) { this._currentKeyframe[prop] = this._localTimelineStyles[prop]; } }); } /** * @return {?} */ snapshotCurrentStyles() { Object.keys(this._localTimelineStyles).forEach(prop => { const /** @type {?} */ val = this._localTimelineStyles[prop]; this._pendingStyles[prop] = val; this._updateStyle(prop, val); }); } /** * @return {?} */ getFinalKeyframe() { return this._keyframes.get(this.duration); } /** * @return {?} */ get properties() { const /** @type {?} */ properties = []; for (let /** @type {?} */ prop in this._currentKeyframe) { properties.push(prop); } return properties; } /** * @param {?} timeline * @return {?} */ mergeTimelineCollectedStyles(timeline) { Object.keys(timeline._styleSummary).forEach(prop => { const /** @type {?} */ details0 = this._styleSummary[prop]; const /** @type {?} */ details1 = timeline._styleSummary[prop]; if (!details0 || details1.time > details0.time) { this._updateStyle(prop, details1.value); } }); } /** * @return {?} */ buildKeyframes() { this.applyStylesToKeyframe(); const /** @type {?} */ preStyleProps = new Set(); const /** @type {?} */ postStyleProps = new Set(); const /** @type {?} */ isEmpty = this._keyframes.size === 1 && this.duration === 0; let /** @type {?} */ finalKeyframes = []; this._keyframes.forEach((keyframe, time) => { const /** @type {?} */ finalKeyframe = copyStyles(keyframe, true); Object.keys(finalKeyframe).forEach(prop => { const /** @type {?} */ value = finalKeyframe[prop]; if (value == __WEBPACK_IMPORTED_MODULE_0__angular_animations__["ɵPRE_STYLE"]) { preStyleProps.add(prop); } else if (value == __WEBPACK_IMPORTED_MODULE_0__angular_animations__["AUTO_STYLE"]) { postStyleProps.add(prop); } }); if (!isEmpty) { finalKeyframe['offset'] = time / this.duration; } finalKeyframes.push(finalKeyframe); }); const /** @type {?} */ preProps = preStyleProps.size ? iteratorToArray(preStyleProps.values()) : []; const /** @type {?} */ postProps = postStyleProps.size ? iteratorToArray(postStyleProps.values()) : []; // special case for a 0-second animation (which is designed just to place styles onscreen) if (isEmpty) { const /** @type {?} */ kf0 = finalKeyframes[0]; const /** @type {?} */ kf1 = copyObj(kf0); kf0['offset'] = 0; kf1['offset'] = 1; finalKeyframes = [kf0, kf1]; } return createTimelineInstruction(this.element, finalKeyframes, preProps, postProps, this.duration, this.startTime, this.easing, false); } } class SubTimelineBuilder extends TimelineBuilder { /** * @param {?} driver * @param {?} element * @param {?} keyframes * @param {?} preStyleProps * @param {?} postStyleProps * @param {?} timings * @param {?=} _stretchStartingKeyframe */ constructor(driver, element, keyframes, preStyleProps, postStyleProps, timings, _stretchStartingKeyframe = false) { super(driver, element, timings.delay); this.element = element; this.keyframes = keyframes; this.preStyleProps = preStyleProps; this.postStyleProps = postStyleProps; this._stretchStartingKeyframe = _stretchStartingKeyframe; this.timings = { duration: timings.duration, delay: timings.delay, easing: timings.easing }; } /** * @return {?} */ containsAnimation() { return this.keyframes.length > 1; } /** * @return {?} */ buildKeyframes() { let /** @type {?} */ keyframes = this.keyframes; let { delay, duration, easing } = this.timings; if (this._stretchStartingKeyframe && delay) { const /** @type {?} */ newKeyframes = []; const /** @type {?} */ totalTime = duration + delay; const /** @type {?} */ startingGap = delay / totalTime; // the original starting keyframe now starts once the delay is done const /** @type {?} */ newFirstKeyframe = copyStyles(keyframes[0], false); newFirstKeyframe['offset'] = 0; newKeyframes.push(newFirstKeyframe); const /** @type {?} */ oldFirstKeyframe = copyStyles(keyframes[0], false); oldFirstKeyframe['offset'] = roundOffset(startingGap); newKeyframes.push(oldFirstKeyframe); /* When the keyframe is stretched then it means that the delay before the animation starts is gone. Instead the first keyframe is placed at the start of the animation and it is then copied to where it starts when the original delay is over. This basically means nothing animates during that delay, but the styles are still renderered. For this to work the original offset values that exist in the original keyframes must be "warped" so that they can take the new keyframe + delay into account. delay=1000, duration=1000, keyframes = 0 .5 1 turns into delay=0, duration=2000, keyframes = 0 .33 .66 1 */ // offsets between 1 ... n -1 are all warped by the keyframe stretch const /** @type {?} */ limit = keyframes.length - 1; for (let /** @type {?} */ i = 1; i <= limit; i++) { let /** @type {?} */ kf = copyStyles(keyframes[i], false); const /** @type {?} */ oldOffset = /** @type {?} */ (kf['offset']); const /** @type {?} */ timeAtKeyframe = delay + oldOffset * duration; kf['offset'] = roundOffset(timeAtKeyframe / totalTime); newKeyframes.push(kf); } // the new starting keyframe should be added at the start duration = totalTime; delay = 0; easing = ''; keyframes = newKeyframes; } return createTimelineInstruction(this.element, keyframes, this.preStyleProps, this.postStyleProps, duration, delay, easing, true); } } /** * @param {?} offset * @param {?=} decimalPoints * @return {?} */ function roundOffset(offset, decimalPoints = 3) { const /** @type {?} */ mult = Math.pow(10, decimalPoints - 1); return Math.round(offset * mult) / mult; } /** * @param {?} input * @param {?} allStyles * @return {?} */ function flattenStyles(input, allStyles) { const /** @type {?} */ styles = {}; let /** @type {?} */ allProperties; input.forEach(token => { if (token === '*') { allProperties = allProperties || Object.keys(allStyles); allProperties.forEach(prop => { styles[prop] = __WEBPACK_IMPORTED_MODULE_0__angular_animations__["AUTO_STYLE"]; }); } else { copyStyles(/** @type {?} */ (token), false, styles); } }); return styles; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ class Animation { /** * @param {?} _driver * @param {?} input */ constructor(_driver, input) { this._driver = _driver; const /** @type {?} */ errors = []; const /** @type {?} */ ast = buildAnimationAst(_driver, input, errors); if (errors.length) { const /** @type {?} */ errorMessage = `animation validation failed:\n${errors.join("\n")}`; throw new Error(errorMessage); } this._animationAst = ast; } /** * @param {?} element * @param {?} startingStyles * @param {?} destinationStyles * @param {?} options * @param {?=} subInstructions * @return {?} */ buildTimelines(element, startingStyles, destinationStyles, options, subInstructions) { const /** @type {?} */ start = Array.isArray(startingStyles) ? normalizeStyles(startingStyles) : /** @type {?} */ (startingStyles); const /** @type {?} */ dest = Array.isArray(destinationStyles) ? normalizeStyles(destinationStyles) : /** @type {?} */ (destinationStyles); const /** @type {?} */ errors = []; subInstructions = subInstructions || new ElementInstructionMap(); const /** @type {?} */ result = buildAnimationTimelines(this._driver, element, this._animationAst, ENTER_CLASSNAME, LEAVE_CLASSNAME, start, dest, options, subInstructions, errors); if (errors.length) { const /** @type {?} */ errorMessage = `animation building failed:\n${errors.join("\n")}`; throw new Error(errorMessage); } return result; } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * \@experimental Animation support is experimental. * @abstract */ class AnimationStyleNormalizer { } /** * \@experimental Animation support is experimental. */ class NoopAnimationStyleNormalizer { /** * @param {?} propertyName * @param {?} errors * @return {?} */ normalizePropertyName(propertyName, errors) { return propertyName; } /** * @param {?} userProvidedProperty * @param {?} normalizedProperty * @param {?} value * @param {?} errors * @return {?} */ normalizeStyleValue(userProvidedProperty, normalizedProperty, value, errors) { return /** @type {?} */ (value); } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ class WebAnimationsStyleNormalizer extends AnimationStyleNormalizer { /** * @param {?} propertyName * @param {?} errors * @return {?} */ normalizePropertyName(propertyName, errors) { return dashCaseToCamelCase(propertyName); } /** * @param {?} userProvidedProperty * @param {?} normalizedProperty * @param {?} value * @param {?} errors * @return {?} */ normalizeStyleValue(userProvidedProperty, normalizedProperty, value, errors) { let /** @type {?} */ unit = ''; const /** @type {?} */ strVal = value.toString().trim(); if (DIMENSIONAL_PROP_MAP[normalizedProperty] && value !== 0 && value !== '0') { if (typeof value === 'number') { unit = 'px'; } else { const /** @type {?} */ valAndSuffixMatch = value.match(/^[+-]?[\d\.]+([a-z]*)$/); if (valAndSuffixMatch && valAndSuffixMatch[1].length == 0) { errors.push(`Please provide a CSS unit value for ${userProvidedProperty}:${value}`); } } } return strVal + unit; } } const DIMENSIONAL_PROP_MAP = makeBooleanMap('width,height,minWidth,minHeight,maxWidth,maxHeight,left,top,bottom,right,fontSize,outlineWidth,outlineOffset,paddingTop,paddingLeft,paddingBottom,paddingRight,marginTop,marginLeft,marginBottom,marginRight,borderRadius,borderWidth,borderTopWidth,borderLeftWidth,borderRightWidth,borderBottomWidth,textIndent,perspective' .split(',')); /** * @param {?} keys * @return {?} */ function makeBooleanMap(keys) { const /** @type {?} */ map = {}; keys.forEach(key => map[key] = true); return map; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @record */ /** * @param {?} element * @param {?} triggerName * @param {?} fromState * @param {?} toState * @param {?} isRemovalTransition * @param {?} fromStyles * @param {?} toStyles * @param {?} timelines * @param {?} queriedElements * @param {?} preStyleProps * @param {?} postStyleProps * @param {?=} errors * @return {?} */ function createTransitionInstruction(element, triggerName, fromState, toState, isRemovalTransition, fromStyles, toStyles, timelines, queriedElements, preStyleProps, postStyleProps, errors) { return { type: 0 /* TransitionAnimation */, element, triggerName, isRemovalTransition, fromState, fromStyles, toState, toStyles, timelines, queriedElements, preStyleProps, postStyleProps, errors }; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ const EMPTY_OBJECT = {}; class AnimationTransitionFactory { /** * @param {?} _triggerName * @param {?} ast * @param {?} _stateStyles */ constructor(_triggerName, ast, _stateStyles) { this._triggerName = _triggerName; this.ast = ast; this._stateStyles = _stateStyles; } /** * @param {?} currentState * @param {?} nextState * @return {?} */ match(currentState, nextState) { return oneOrMoreTransitionsMatch(this.ast.matchers, currentState, nextState); } /** * @param {?} stateName * @param {?} params * @param {?} errors * @return {?} */ buildStyles(stateName, params, errors) { const /** @type {?} */ backupStateStyler = this._stateStyles['*']; const /** @type {?} */ stateStyler = this._stateStyles[stateName]; const /** @type {?} */ backupStyles = backupStateStyler ? backupStateStyler.buildStyles(params, errors) : {}; return stateStyler ? stateStyler.buildStyles(params, errors) : backupStyles; } /** * @param {?} driver * @param {?} element * @param {?} currentState * @param {?} nextState * @param {?} enterClassName * @param {?} leaveClassName * @param {?=} currentOptions * @param {?=} nextOptions * @param {?=} subInstructions * @return {?} */ build(driver, element, currentState, nextState, enterClassName, leaveClassName, currentOptions, nextOptions, subInstructions) { const /** @type {?} */ errors = []; const /** @type {?} */ transitionAnimationParams = this.ast.options && this.ast.options.params || EMPTY_OBJECT; const /** @type {?} */ currentAnimationParams = currentOptions && currentOptions.params || EMPTY_OBJECT; const /** @type {?} */ currentStateStyles = this.buildStyles(currentState, currentAnimationParams, errors); const /** @type {?} */ nextAnimationParams = nextOptions && nextOptions.params || EMPTY_OBJECT; const /** @type {?} */ nextStateStyles = this.buildStyles(nextState, nextAnimationParams, errors); const /** @type {?} */ queriedElements = new Set(); const /** @type {?} */ preStyleMap = new Map(); const /** @type {?} */ postStyleMap = new Map(); const /** @type {?} */ isRemoval = nextState === 'void'; const /** @type {?} */ animationOptions = { params: Object.assign({}, transitionAnimationParams, nextAnimationParams) }; const /** @type {?} */ timelines = buildAnimationTimelines(driver, element, this.ast.animation, enterClassName, leaveClassName, currentStateStyles, nextStateStyles, animationOptions, subInstructions, errors); if (errors.length) { return createTransitionInstruction(element, this._triggerName, currentState, nextState, isRemoval, currentStateStyles, nextStateStyles, [], [], preStyleMap, postStyleMap, errors); } timelines.forEach(tl => { const /** @type {?} */ elm = tl.element; const /** @type {?} */ preProps = getOrSetAsInMap(preStyleMap, elm, {}); tl.preStyleProps.forEach(prop => preProps[prop] = true); const /** @type {?} */ postProps = getOrSetAsInMap(postStyleMap, elm, {}); tl.postStyleProps.forEach(prop => postProps[prop] = true); if (elm !== element) { queriedElements.add(elm); } }); const /** @type {?} */ queriedElementsList = iteratorToArray(queriedElements.values()); return createTransitionInstruction(element, this._triggerName, currentState, nextState, isRemoval, currentStateStyles, nextStateStyles, timelines, queriedElementsList, preStyleMap, postStyleMap); } } /** * @param {?} matchFns * @param {?} currentState * @param {?} nextState * @return {?} */ function oneOrMoreTransitionsMatch(matchFns, currentState, nextState) { return matchFns.some(fn => fn(currentState, nextState)); } class AnimationStateStyles { /** * @param {?} styles * @param {?} defaultParams */ constructor(styles, defaultParams) { this.styles = styles; this.defaultParams = defaultParams; } /** * @param {?} params * @param {?} errors * @return {?} */ buildStyles(params, errors) { const /** @type {?} */ finalStyles = {}; const /** @type {?} */ combinedParams = copyObj(this.defaultParams); Object.keys(params).forEach(key => { const /** @type {?} */ value = params[key]; if (value != null) { combinedParams[key] = value; } }); this.styles.styles.forEach(value => { if (typeof value !== 'string') { const /** @type {?} */ styleObj = /** @type {?} */ (value); Object.keys(styleObj).forEach(prop => { let /** @type {?} */ val = styleObj[prop]; if (val.length > 1) { val = interpolateParams(val, combinedParams, errors); } finalStyles[prop] = val; }); } }); return finalStyles; } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * \@experimental Animation support is experimental. * @param {?} name * @param {?} ast * @return {?} */ function buildTrigger(name, ast) { return new AnimationTrigger(name, ast); } /** * \@experimental Animation support is experimental. */ class AnimationTrigger { /** * @param {?} name * @param {?} ast */ constructor(name, ast) { this.name = name; this.ast = ast; this.transitionFactories = []; this.states = {}; ast.states.forEach(ast => { const /** @type {?} */ defaultParams = (ast.options && ast.options.params) || {}; this.states[ast.name] = new AnimationStateStyles(ast.style, defaultParams); }); balanceProperties(this.states, 'true', '1'); balanceProperties(this.states, 'false', '0'); ast.transitions.forEach(ast => { this.transitionFactories.push(new AnimationTransitionFactory(name, ast, this.states)); }); this.fallbackTransition = createFallbackTransition(name, this.states); } /** * @return {?} */ get containsQueries() { return this.ast.queryCount > 0; } /** * @param {?} currentState * @param {?} nextState * @return {?} */ matchTransition(currentState, nextState) { const /** @type {?} */ entry = this.transitionFactories.find(f => f.match(currentState, nextState)); return entry || null; } /** * @param {?} currentState * @param {?} params * @param {?} errors * @return {?} */ matchStyles(currentState, params, errors) { return this.fallbackTransition.buildStyles(currentState, params, errors); } } /** * @param {?} triggerName * @param {?} states * @return {?} */ function createFallbackTransition(triggerName, states) { const /** @type {?} */ matchers = [(fromState, toState) => true]; const /** @type {?} */ animation = { type: 2 /* Sequence */, steps: [], options: null }; const /** @type {?} */ transition = { type: 1 /* Transition */, animation, matchers, options: null, queryCount: 0, depCount: 0 }; return new AnimationTransitionFactory(triggerName, transition, states); } /** * @param {?} obj * @param {?} key1 * @param {?} key2 * @return {?} */ function balanceProperties(obj, key1, key2) { if (obj.hasOwnProperty(key1)) { if (!obj.hasOwnProperty(key2)) { obj[key2] = obj[key1]; } } else if (obj.hasOwnProperty(key2)) { obj[key1] = obj[key2]; } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ const EMPTY_INSTRUCTION_MAP = new ElementInstructionMap(); class TimelineAnimationEngine { /** * @param {?} _driver * @param {?} _normalizer */ constructor(_driver, _normalizer) { this._driver = _driver; this._normalizer = _normalizer; this._animations = {}; this._playersById = {}; this.players = []; } /** * @param {?} id * @param {?} metadata * @return {?} */ register(id, metadata) { const /** @type {?} */ errors = []; const /** @type {?} */ ast = buildAnimationAst(this._driver, metadata, errors); if (errors.length) { throw new Error(`Unable to build the animation due to the following errors: ${errors.join("\n")}`); } else { this._animations[id] = ast; } } /** * @param {?} i * @param {?} preStyles * @param {?=} postStyles * @return {?} */ _buildPlayer(i, preStyles, postStyles) { const /** @type {?} */ element = i.element; const /** @type {?} */ keyframes = normalizeKeyframes(this._driver, this._normalizer, element, i.keyframes, preStyles, postStyles); return this._driver.animate(element, keyframes, i.duration, i.delay, i.easing, []); } /** * @param {?} id * @param {?} element * @param {?=} options * @return {?} */ create(id, element, options = {}) { const /** @type {?} */ errors = []; const /** @type {?} */ ast = this._animations[id]; let /** @type {?} */ instructions; const /** @type {?} */ autoStylesMap = new Map(); if (ast) { instructions = buildAnimationTimelines(this._driver, element, ast, ENTER_CLASSNAME, LEAVE_CLASSNAME, {}, {}, options, EMPTY_INSTRUCTION_MAP, errors); instructions.forEach(inst => { const /** @type {?} */ styles = getOrSetAsInMap(autoStylesMap, inst.element, {}); inst.postStyleProps.forEach(prop => styles[prop] = null); }); } else { errors.push('The requested animation doesn\'t exist or has already been destroyed'); instructions = []; } if (errors.length) { throw new Error(`Unable to create the animation due to the following errors: ${errors.join("\n")}`); } autoStylesMap.forEach((styles, element) => { Object.keys(styles).forEach(prop => { styles[prop] = this._driver.computeStyle(element, prop, __WEBPACK_IMPORTED_MODULE_0__angular_animations__["AUTO_STYLE"]); }); }); const /** @type {?} */ players = instructions.map(i => { const /** @type {?} */ styles = autoStylesMap.get(i.element); return this._buildPlayer(i, {}, styles); }); const /** @type {?} */ player = optimizeGroupPlayer(players); this._playersById[id] = player; player.onDestroy(() => this.destroy(id)); this.players.push(player); return player; } /** * @param {?} id * @return {?} */ destroy(id) { const /** @type {?} */ player = this._getPlayer(id); player.destroy(); delete this._playersById[id]; const /** @type {?} */ index = this.players.indexOf(player); if (index >= 0) { this.players.splice(index, 1); } } /** * @param {?} id * @return {?} */ _getPlayer(id) { const /** @type {?} */ player = this._playersById[id]; if (!player) { throw new Error(`Unable to find the timeline player referenced by ${id}`); } return player; } /** * @param {?} id * @param {?} element * @param {?} eventName * @param {?} callback * @return {?} */ listen(id, element, eventName, callback) { // triggerName, fromState, toState are all ignored for timeline animations const /** @type {?} */ baseEvent = makeAnimationEvent(element, '', '', ''); listenOnPlayer(this._getPlayer(id), eventName, baseEvent, callback); return () => { }; } /** * @param {?} id * @param {?} element * @param {?} command * @param {?} args * @return {?} */ command(id, element, command, args) { if (command == 'register') { this.register(id, /** @type {?} */ (args[0])); return; } if (command == 'create') { const /** @type {?} */ options = /** @type {?} */ ((args[0] || {})); this.create(id, element, options); return; } const /** @type {?} */ player = this._getPlayer(id); switch (command) { case 'play': player.play(); break; case 'pause': player.pause(); break; case 'reset': player.reset(); break; case 'restart': player.restart(); break; case 'finish': player.finish(); break; case 'init': player.init(); break; case 'setPosition': player.setPosition(parseFloat(/** @type {?} */ (args[0]))); break; case 'destroy': this.destroy(id); break; } } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ const QUEUED_CLASSNAME = 'ng-animate-queued'; const QUEUED_SELECTOR = '.ng-animate-queued'; const DISABLED_CLASSNAME = 'ng-animate-disabled'; const DISABLED_SELECTOR = '.ng-animate-disabled'; const STAR_CLASSNAME = 'ng-star-inserted'; const STAR_SELECTOR = '.ng-star-inserted'; const EMPTY_PLAYER_ARRAY = []; const NULL_REMOVAL_STATE = { namespaceId: '', setForRemoval: null, hasAnimation: false, removedBeforeQueried: false }; const NULL_REMOVED_QUERIED_STATE = { namespaceId: '', setForRemoval: null, hasAnimation: false, removedBeforeQueried: true }; /** * @record */ const REMOVAL_FLAG = '__ng_removed'; /** * @record */ class StateValue { /** * @param {?} input * @param {?=} namespaceId */ constructor(input, namespaceId = '') { this.namespaceId = namespaceId; const /** @type {?} */ isObj = input && input.hasOwnProperty('value'); const /** @type {?} */ value = isObj ? input['value'] : input; this.value = normalizeTriggerValue(value); if (isObj) { const /** @type {?} */ options = copyObj(/** @type {?} */ (input)); delete options['value']; this.options = /** @type {?} */ (options); } else { this.options = {}; } if (!this.options.params) { this.options.params = {}; } } /** * @return {?} */ get params() { return /** @type {?} */ (this.options.params); } /** * @param {?} options * @return {?} */ absorbOptions(options) { const /** @type {?} */ newParams = options.params; if (newParams) { const /** @type {?} */ oldParams = /** @type {?} */ ((this.options.params)); Object.keys(newParams).forEach(prop => { if (oldParams[prop] == null) { oldParams[prop] = newParams[prop]; } }); } } } const VOID_VALUE = 'void'; const DEFAULT_STATE_VALUE = new StateValue(VOID_VALUE); const DELETED_STATE_VALUE = new StateValue('DELETED'); class AnimationTransitionNamespace { /** * @param {?} id * @param {?} hostElement * @param {?} _engine */ constructor(id, hostElement, _engine) { this.id = id; this.hostElement = hostElement; this._engine = _engine; this.players = []; this._triggers = {}; this._queue = []; this._elementListeners = new Map(); this._hostClassName = 'ng-tns-' + id; addClass(hostElement, this._hostClassName); } /** * @param {?} element * @param {?} name * @param {?} phase * @param {?} callback * @return {?} */ listen(element, name, phase, callback) { if (!this._triggers.hasOwnProperty(name)) { throw new Error(`Unable to listen on the animation trigger event "${phase}" because the animation trigger "${name}" doesn\'t exist!`); } if (phase == null || phase.length == 0) { throw new Error(`Unable to listen on the animation trigger "${name}" because the provided event is undefined!`); } if (!isTriggerEventValid(phase)) { throw new Error(`The provided animation trigger event "${phase}" for the animation trigger "${name}" is not supported!`); } const /** @type {?} */ listeners = getOrSetAsInMap(this._elementListeners, element, []); const /** @type {?} */ data = { name, phase, callback }; listeners.push(data); const /** @type {?} */ triggersWithStates = getOrSetAsInMap(this._engine.statesByElement, element, {}); if (!triggersWithStates.hasOwnProperty(name)) { addClass(element, NG_TRIGGER_CLASSNAME); addClass(element, NG_TRIGGER_CLASSNAME + '-' + name); triggersWithStates[name] = DEFAULT_STATE_VALUE; } return () => { // the event listener is removed AFTER the flush has occurred such // that leave animations callbacks can fire (otherwise if the node // is removed in between then the listeners would be deregistered) this._engine.afterFlush(() => { const /** @type {?} */ index = listeners.indexOf(data); if (index >= 0) { listeners.splice(index, 1); } if (!this._triggers[name]) { delete triggersWithStates[name]; } }); }; } /** * @param {?} name * @param {?} ast * @return {?} */ register(name, ast) { if (this._triggers[name]) { // throw return false; } else { this._triggers[name] = ast; return true; } } /** * @param {?} name * @return {?} */ _getTrigger(name) { const /** @type {?} */ trigger = this._triggers[name]; if (!trigger) { throw new Error(`The provided animation trigger "${name}" has not been registered!`); } return trigger; } /** * @param {?} element * @param {?} triggerName * @param {?} value * @param {?=} defaultToFallback * @return {?} */ trigger(element, triggerName, value, defaultToFallback = true) { const /** @type {?} */ trigger = this._getTrigger(triggerName); const /** @type {?} */ player = new TransitionAnimationPlayer(this.id, triggerName, element); let /** @type {?} */ triggersWithStates = this._engine.statesByElement.get(element); if (!triggersWithStates) { addClass(element, NG_TRIGGER_CLASSNAME); addClass(element, NG_TRIGGER_CLASSNAME + '-' + triggerName); this._engine.statesByElement.set(element, triggersWithStates = {}); } let /** @type {?} */ fromState = triggersWithStates[triggerName]; const /** @type {?} */ toState = new StateValue(value, this.id); const /** @type {?} */ isObj = value && value.hasOwnProperty('value'); if (!isObj && fromState) { toState.absorbOptions(fromState.options); } triggersWithStates[triggerName] = toState; if (!fromState) { fromState = DEFAULT_STATE_VALUE; } else if (fromState === DELETED_STATE_VALUE) { return player; } const /** @type {?} */ isRemoval = toState.value === VOID_VALUE; // normally this isn't reached by here, however, if an object expression // is passed in then it may be a new object each time. Comparing the value // is important since that will stay the same despite there being a new object. // The removal arc here is special cased because the same element is triggered // twice in the event that it contains animations on the outer/inner portions // of the host container if (!isRemoval && fromState.value === toState.value) { // this means that despite the value not changing, some inner params // have changed which means that the animation final styles need to be applied if (!objEquals(fromState.params, toState.params)) { const /** @type {?} */ errors = []; const /** @type {?} */ fromStyles = trigger.matchStyles(fromState.value, fromState.params, errors); const /** @type {?} */ toStyles = trigger.matchStyles(toState.value, toState.params, errors); if (errors.length) { this._engine.reportError(errors); } else { this._engine.afterFlush(() => { eraseStyles(element, fromStyles); setStyles(element, toStyles); }); } } return; } const /** @type {?} */ playersOnElement = getOrSetAsInMap(this._engine.playersByElement, element, []); playersOnElement.forEach(player => { // only remove the player if it is queued on the EXACT same trigger/namespace // we only also deal with queued players here because if the animation has // started then we want to keep the player alive until the flush happens // (which is where the previousPlayers are passed into the new palyer) if (player.namespaceId == this.id && player.triggerName == triggerName && player.queued) { player.destroy(); } }); let /** @type {?} */ transition = trigger.matchTransition(fromState.value, toState.value); let /** @type {?} */ isFallbackTransition = false; if (!transition) { if (!defaultToFallback) return; transition = trigger.fallbackTransition; isFallbackTransition = true; } this._engine.totalQueuedPlayers++; this._queue.push({ element, triggerName, transition, fromState, toState, player, isFallbackTransition }); if (!isFallbackTransition) { addClass(element, QUEUED_CLASSNAME); player.onStart(() => { removeClass(element, QUEUED_CLASSNAME); }); } player.onDone(() => { let /** @type {?} */ index = this.players.indexOf(player); if (index >= 0) { this.players.splice(index, 1); } const /** @type {?} */ players = this._engine.playersByElement.get(element); if (players) { let /** @type {?} */ index = players.indexOf(player); if (index >= 0) { players.splice(index, 1); } } }); this.players.push(player); playersOnElement.push(player); return player; } /** * @param {?} name * @return {?} */ deregister(name) { delete this._triggers[name]; this._engine.statesByElement.forEach((stateMap, element) => { delete stateMap[name]; }); this._elementListeners.forEach((listeners, element) => { this._elementListeners.set(element, listeners.filter(entry => { return entry.name != name; })); }); } /** * @param {?} element * @return {?} */ clearElementCache(element) { this._engine.statesByElement.delete(element); this._elementListeners.delete(element); const /** @type {?} */ elementPlayers = this._engine.playersByElement.get(element); if (elementPlayers) { elementPlayers.forEach(player => player.destroy()); this._engine.playersByElement.delete(element); } } /** * @param {?} rootElement * @param {?} context * @param {?=} animate * @return {?} */ _signalRemovalForInnerTriggers(rootElement, context, animate = false) { // emulate a leave animation for all inner nodes within this node. // If there are no animations found for any of the nodes then clear the cache // for the element. this._engine.driver.query(rootElement, NG_TRIGGER_SELECTOR, true).forEach(elm => { // this means that an inner remove() operation has already kicked off // the animation on this element... if (elm[REMOVAL_FLAG]) return; const /** @type {?} */ namespaces = this._engine.fetchNamespacesByElement(elm); if (namespaces.size) { namespaces.forEach(ns => ns.triggerLeaveAnimation(elm, context, false, true)); } else { this.clearElementCache(elm); } }); } /** * @param {?} element * @param {?} context * @param {?=} destroyAfterComplete * @param {?=} defaultToFallback * @return {?} */ triggerLeaveAnimation(element, context, destroyAfterComplete, defaultToFallback) { const /** @type {?} */ triggerStates = this._engine.statesByElement.get(element); if (triggerStates) { const /** @type {?} */ players = []; Object.keys(triggerStates).forEach(triggerName => { // this check is here in the event that an element is removed // twice (both on the host level and the component level) if (this._triggers[triggerName]) { const /** @type {?} */ player = this.trigger(element, triggerName, VOID_VALUE, defaultToFallback); if (player) { players.push(player); } } }); if (players.length) { this._engine.markElementAsRemoved(this.id, element, true, context); if (destroyAfterComplete) { optimizeGroupPlayer(players).onDone(() => this._engine.processLeaveNode(element)); } return true; } } return false; } /** * @param {?} element * @return {?} */ prepareLeaveAnimationListeners(element) { const /** @type {?} */ listeners = this._elementListeners.get(element); if (listeners) { const /** @type {?} */ visitedTriggers = new Set(); listeners.forEach(listener => { const /** @type {?} */ triggerName = listener.name; if (visitedTriggers.has(triggerName)) return; visitedTriggers.add(triggerName); const /** @type {?} */ trigger = this._triggers[triggerName]; const /** @type {?} */ transition = trigger.fallbackTransition; const /** @type {?} */ elementStates = /** @type {?} */ ((this._engine.statesByElement.get(element))); const /** @type {?} */ fromState = elementStates[triggerName] || DEFAULT_STATE_VALUE; const /** @type {?} */ toState = new StateValue(VOID_VALUE); const /** @type {?} */ player = new TransitionAnimationPlayer(this.id, triggerName, element); this._engine.totalQueuedPlayers++; this._queue.push({ element, triggerName, transition, fromState, toState, player, isFallbackTransition: true }); }); } } /** * @param {?} element * @param {?} context * @return {?} */ removeNode(element, context) { const /** @type {?} */ engine = this._engine; if (element.childElementCount) { this._signalRemovalForInnerTriggers(element, context, true); } // this means that a * => VOID animation was detected and kicked off if (this.triggerLeaveAnimation(element, context, true)) return; // find the player that is animating and make sure that the // removal is delayed until that player has completed let /** @type {?} */ containsPotentialParentTransition = false; if (engine.totalAnimations) { const /** @type {?} */ currentPlayers = engine.players.length ? engine.playersByQueriedElement.get(element) : []; // when this `if statement` does not continue forward it means that // a previous animation query has selected the current element and // is animating it. In this situation want to continue fowards and // allow the element to be queued up for animation later. if (currentPlayers && currentPlayers.length) { containsPotentialParentTransition = true; } else { let /** @type {?} */ parent = element; while (parent = parent.parentNode) { const /** @type {?} */ triggers = engine.statesByElement.get(parent); if (triggers) { containsPotentialParentTransition = true; break; } } } } // at this stage we know that the element will either get removed // during flush or will be picked up by a parent query. Either way // we need to fire the listeners for this element when it DOES get // removed (once the query parent animation is done or after flush) this.prepareLeaveAnimationListeners(element); // whether or not a parent has an animation we need to delay the deferral of the leave // operation until we have more information (which we do after flush() has been called) if (containsPotentialParentTransition) { engine.markElementAsRemoved(this.id, element, false, context); } else { // we do this after the flush has occurred such // that the callbacks can be fired engine.afterFlush(() => this.clearElementCache(element)); engine.destroyInnerAnimations(element); engine._onRemovalComplete(element, context); } } /** * @param {?} element * @param {?} parent * @return {?} */ insertNode(element, parent) { addClass(element, this._hostClassName); } /** * @param {?} microtaskId * @return {?} */ drainQueuedTransitions(microtaskId) { const /** @type {?} */ instructions = []; this._queue.forEach(entry => { const /** @type {?} */ player = entry.player; if (player.destroyed) return; const /** @type {?} */ element = entry.element; const /** @type {?} */ listeners = this._elementListeners.get(element); if (listeners) { listeners.forEach((listener) => { if (listener.name == entry.triggerName) { const /** @type {?} */ baseEvent = makeAnimationEvent(element, entry.triggerName, entry.fromState.value, entry.toState.value); (/** @type {?} */ (baseEvent))['_data'] = microtaskId; listenOnPlayer(entry.player, listener.phase, baseEvent, listener.callback); } }); } if (player.markedForDestroy) { this._engine.afterFlush(() => { // now we can destroy the element properly since the event listeners have // been bound to the player player.destroy(); }); } else { instructions.push(entry); } }); this._queue = []; return instructions.sort((a, b) => { // if depCount == 0 them move to front // otherwise if a contains b then move back const /** @type {?} */ d0 = a.transition.ast.depCount; const /** @type {?} */ d1 = b.transition.ast.depCount; if (d0 == 0 || d1 == 0) { return d0 - d1; } return this._engine.driver.containsElement(a.element, b.element) ? 1 : -1; }); } /** * @param {?} context * @return {?} */ destroy(context) { this.players.forEach(p => p.destroy()); this._signalRemovalForInnerTriggers(this.hostElement, context); } /** * @param {?} element * @return {?} */ elementContainsData(element) { let /** @type {?} */ containsData = false; if (this._elementListeners.has(element)) containsData = true; containsData = (this._queue.find(entry => entry.element === element) ? true : false) || containsData; return containsData; } } /** * @record */ class TransitionAnimationEngine { /** * @param {?} driver * @param {?} _normalizer */ constructor(driver, _normalizer) { this.driver = driver; this._normalizer = _normalizer; this.players = []; this.newHostElements = new Map(); this.playersByElement = new Map(); this.playersByQueriedElement = new Map(); this.statesByElement = new Map(); this.disabledNodes = new Set(); this.totalAnimations = 0; this.totalQueuedPlayers = 0; this._namespaceLookup = {}; this._namespaceList = []; this._flushFns = []; this._whenQuietFns = []; this.namespacesByHostElement = new Map(); this.collectedEnterElements = []; this.collectedLeaveElements = []; this.onRemovalComplete = (element, context) => { }; } /** * \@internal * @param {?} element * @param {?} context * @return {?} */ _onRemovalComplete(element, context) { this.onRemovalComplete(element, context); } /** * @return {?} */ get queuedPlayers() { const /** @type {?} */ players = []; this._namespaceList.forEach(ns => { ns.players.forEach(player => { if (player.queued) { players.push(player); } }); }); return players; } /** * @param {?} namespaceId * @param {?} hostElement * @return {?} */ createNamespace(namespaceId, hostElement) { const /** @type {?} */ ns = new AnimationTransitionNamespace(namespaceId, hostElement, this); if (hostElement.parentNode) { this._balanceNamespaceList(ns, hostElement); } else { // defer this later until flush during when the host element has // been inserted so that we know exactly where to place it in // the namespace list this.newHostElements.set(hostElement, ns); // given that this host element is apart of the animation code, it // may or may not be inserted by a parent node that is an of an // animation renderer type. If this happens then we can still have // access to this item when we query for :enter nodes. If the parent // is a renderer then the set data-structure will normalize the entry this.collectEnterElement(hostElement); } return this._namespaceLookup[namespaceId] = ns; } /** * @param {?} ns * @param {?} hostElement * @return {?} */ _balanceNamespaceList(ns, hostElement) { const /** @type {?} */ limit = this._namespaceList.length - 1; if (limit >= 0) { let /** @type {?} */ found = false; for (let /** @type {?} */ i = limit; i >= 0; i--) { const /** @type {?} */ nextNamespace = this._namespaceList[i]; if (this.driver.containsElement(nextNamespace.hostElement, hostElement)) { this._namespaceList.splice(i + 1, 0, ns); found = true; break; } } if (!found) { this._namespaceList.splice(0, 0, ns); } } else { this._namespaceList.push(ns); } this.namespacesByHostElement.set(hostElement, ns); return ns; } /** * @param {?} namespaceId * @param {?} hostElement * @return {?} */ register(namespaceId, hostElement) { let /** @type {?} */ ns = this._namespaceLookup[namespaceId]; if (!ns) { ns = this.createNamespace(namespaceId, hostElement); } return ns; } /** * @param {?} namespaceId * @param {?} name * @param {?} trigger * @return {?} */ registerTrigger(namespaceId, name, trigger) { let /** @type {?} */ ns = this._namespaceLookup[namespaceId]; if (ns && ns.register(name, trigger)) { this.totalAnimations++; } } /** * @param {?} namespaceId * @param {?} context * @return {?} */ destroy(namespaceId, context) { if (!namespaceId) return; const /** @type {?} */ ns = this._fetchNamespace(namespaceId); this.afterFlush(() => { this.namespacesByHostElement.delete(ns.hostElement); delete this._namespaceLookup[namespaceId]; const /** @type {?} */ index = this._namespaceList.indexOf(ns); if (index >= 0) { this._namespaceList.splice(index, 1); } }); this.afterFlushAnimationsDone(() => ns.destroy(context)); } /** * @param {?} id * @return {?} */ _fetchNamespace(id) { return this._namespaceLookup[id]; } /** * @param {?} element * @return {?} */ fetchNamespacesByElement(element) { // normally there should only be one namespace per element, however // if @triggers are placed on both the component element and then // its host element (within the component code) then there will be // two namespaces returned. We use a set here to simply the dedupe // of namespaces incase there are multiple triggers both the elm and host const /** @type {?} */ namespaces = new Set(); const /** @type {?} */ elementStates = this.statesByElement.get(element); if (elementStates) { const /** @type {?} */ keys = Object.keys(elementStates); for (let /** @type {?} */ i = 0; i < keys.length; i++) { const /** @type {?} */ nsId = elementStates[keys[i]].namespaceId; if (nsId) { const /** @type {?} */ ns = this._fetchNamespace(nsId); if (ns) { namespaces.add(ns); } } } } return namespaces; } /** * @param {?} namespaceId * @param {?} element * @param {?} name * @param {?} value * @return {?} */ trigger(namespaceId, element, name, value) { if (isElementNode(element)) { this._fetchNamespace(namespaceId).trigger(element, name, value); return true; } return false; } /** * @param {?} namespaceId * @param {?} element * @param {?} parent * @param {?} insertBefore * @return {?} */ insertNode(namespaceId, element, parent, insertBefore) { if (!isElementNode(element)) return; // special case for when an element is removed and reinserted (move operation) // when this occurs we do not want to use the element for deletion later const /** @type {?} */ details = /** @type {?} */ (element[REMOVAL_FLAG]); if (details && details.setForRemoval) { details.setForRemoval = false; } // in the event that the namespaceId is blank then the caller // code does not contain any animation code in it, but it is // just being called so that the node is marked as being inserted if (namespaceId) { const /** @type {?} */ ns = this._fetchNamespace(namespaceId); // This if-statement is a workaround for router issue #21947. // The router sometimes hits a race condition where while a route // is being instantiated a new navigation arrives, triggering leave // animation of DOM that has not been fully initialized, until this // is resolved, we need to handle the scenario when DOM is not in a // consistent state during the animation. if (ns) { ns.insertNode(element, parent); } } // only *directives and host elements are inserted before if (insertBefore) { this.collectEnterElement(element); } } /** * @param {?} element * @return {?} */ collectEnterElement(element) { this.collectedEnterElements.push(element); } /** * @param {?} element * @param {?} value * @return {?} */ markElementAsDisabled(element, value) { if (value) { if (!this.disabledNodes.has(element)) { this.disabledNodes.add(element); addClass(element, DISABLED_CLASSNAME); } } else if (this.disabledNodes.has(element)) { this.disabledNodes.delete(element); removeClass(element, DISABLED_CLASSNAME); } } /** * @param {?} namespaceId * @param {?} element * @param {?} context * @return {?} */ removeNode(namespaceId, element, context) { if (!isElementNode(element)) { this._onRemovalComplete(element, context); return; } const /** @type {?} */ ns = namespaceId ? this._fetchNamespace(namespaceId) : null; if (ns) { ns.removeNode(element, context); } else { this.markElementAsRemoved(namespaceId, element, false, context); } } /** * @param {?} namespaceId * @param {?} element * @param {?=} hasAnimation * @param {?=} context * @return {?} */ markElementAsRemoved(namespaceId, element, hasAnimation, context) { this.collectedLeaveElements.push(element); element[REMOVAL_FLAG] = { namespaceId, setForRemoval: context, hasAnimation, removedBeforeQueried: false }; } /** * @param {?} namespaceId * @param {?} element * @param {?} name * @param {?} phase * @param {?} callback * @return {?} */ listen(namespaceId, element, name, phase, callback) { if (isElementNode(element)) { return this._fetchNamespace(namespaceId).listen(element, name, phase, callback); } return () => { }; } /** * @param {?} entry * @param {?} subTimelines * @param {?} enterClassName * @param {?} leaveClassName * @return {?} */ _buildInstruction(entry, subTimelines, enterClassName, leaveClassName) { return entry.transition.build(this.driver, entry.element, entry.fromState.value, entry.toState.value, enterClassName, leaveClassName, entry.fromState.options, entry.toState.options, subTimelines); } /** * @param {?} containerElement * @return {?} */ destroyInnerAnimations(containerElement) { let /** @type {?} */ elements = this.driver.query(containerElement, NG_TRIGGER_SELECTOR, true); elements.forEach(element => this.destroyActiveAnimationsForElement(element)); if (this.playersByQueriedElement.size == 0) return; elements = this.driver.query(containerElement, NG_ANIMATING_SELECTOR, true); elements.forEach(element => this.finishActiveQueriedAnimationOnElement(element)); } /** * @param {?} element * @return {?} */ destroyActiveAnimationsForElement(element) { const /** @type {?} */ players = this.playersByElement.get(element); if (players) { players.forEach(player => { // special case for when an element is set for destruction, but hasn't started. // in this situation we want to delay the destruction until the flush occurs // so that any event listeners attached to the player are triggered. if (player.queued) { player.markedForDestroy = true; } else { player.destroy(); } }); } const /** @type {?} */ stateMap = this.statesByElement.get(element); if (stateMap) { Object.keys(stateMap).forEach(triggerName => stateMap[triggerName] = DELETED_STATE_VALUE); } } /** * @param {?} element * @return {?} */ finishActiveQueriedAnimationOnElement(element) { const /** @type {?} */ players = this.playersByQueriedElement.get(element); if (players) { players.forEach(player => player.finish()); } } /** * @return {?} */ whenRenderingDone() { return new Promise(resolve => { if (this.players.length) { return optimizeGroupPlayer(this.players).onDone(() => resolve()); } else { resolve(); } }); } /** * @param {?} element * @return {?} */ processLeaveNode(element) { const /** @type {?} */ details = /** @type {?} */ (element[REMOVAL_FLAG]); if (details && details.setForRemoval) { // this will prevent it from removing it twice element[REMOVAL_FLAG] = NULL_REMOVAL_STATE; if (details.namespaceId) { this.destroyInnerAnimations(element); const /** @type {?} */ ns = this._fetchNamespace(details.namespaceId); if (ns) { ns.clearElementCache(element); } } this._onRemovalComplete(element, details.setForRemoval); } if (this.driver.matchesElement(element, DISABLED_SELECTOR)) { this.markElementAsDisabled(element, false); } this.driver.query(element, DISABLED_SELECTOR, true).forEach(node => { this.markElementAsDisabled(element, false); }); } /** * @param {?=} microtaskId * @return {?} */ flush(microtaskId = -1) { let /** @type {?} */ players = []; if (this.newHostElements.size) { this.newHostElements.forEach((ns, element) => this._balanceNamespaceList(ns, element)); this.newHostElements.clear(); } if (this.totalAnimations && this.collectedEnterElements.length) { for (let /** @type {?} */ i = 0; i < this.collectedEnterElements.length; i++) { const /** @type {?} */ elm = this.collectedEnterElements[i]; addClass(elm, STAR_CLASSNAME); } } if (this._namespaceList.length && (this.totalQueuedPlayers || this.collectedLeaveElements.length)) { const /** @type {?} */ cleanupFns = []; try { players = this._flushAnimations(cleanupFns, microtaskId); } finally { for (let /** @type {?} */ i = 0; i < cleanupFns.length; i++) { cleanupFns[i](); } } } else { for (let /** @type {?} */ i = 0; i < this.collectedLeaveElements.length; i++) { const /** @type {?} */ element = this.collectedLeaveElements[i]; this.processLeaveNode(element); } } this.totalQueuedPlayers = 0; this.collectedEnterElements.length = 0; this.collectedLeaveElements.length = 0; this._flushFns.forEach(fn => fn()); this._flushFns = []; if (this._whenQuietFns.length) { // we move these over to a variable so that // if any new callbacks are registered in another // flush they do not populate the existing set const /** @type {?} */ quietFns = this._whenQuietFns; this._whenQuietFns = []; if (players.length) { optimizeGroupPlayer(players).onDone(() => { quietFns.forEach(fn => fn()); }); } else { quietFns.forEach(fn => fn()); } } } /** * @param {?} errors * @return {?} */ reportError(errors) { throw new Error(`Unable to process animations due to the following failed trigger transitions\n ${errors.join('\n')}`); } /** * @param {?} cleanupFns * @param {?} microtaskId * @return {?} */ _flushAnimations(cleanupFns, microtaskId) { const /** @type {?} */ subTimelines = new ElementInstructionMap(); const /** @type {?} */ skippedPlayers = []; const /** @type {?} */ skippedPlayersMap = new Map(); const /** @type {?} */ queuedInstructions = []; const /** @type {?} */ queriedElements = new Map(); const /** @type {?} */ allPreStyleElements = new Map(); const /** @type {?} */ allPostStyleElements = new Map(); const /** @type {?} */ disabledElementsSet = new Set(); this.disabledNodes.forEach(node => { disabledElementsSet.add(node); const /** @type {?} */ nodesThatAreDisabled = this.driver.query(node, QUEUED_SELECTOR, true); for (let /** @type {?} */ i = 0; i < nodesThatAreDisabled.length; i++) { disabledElementsSet.add(nodesThatAreDisabled[i]); } }); const /** @type {?} */ bodyNode = getBodyNode(); const /** @type {?} */ allTriggerElements = Array.from(this.statesByElement.keys()); const /** @type {?} */ enterNodeMap = buildRootMap(allTriggerElements, this.collectedEnterElements); // this must occur before the instructions are built below such that // the :enter queries match the elements (since the timeline queries // are fired during instruction building). const /** @type {?} */ enterNodeMapIds = new Map(); let /** @type {?} */ i = 0; enterNodeMap.forEach((nodes, root) => { const /** @type {?} */ className = ENTER_CLASSNAME + i++; enterNodeMapIds.set(root, className); nodes.forEach(node => addClass(node, className)); }); const /** @type {?} */ allLeaveNodes = []; const /** @type {?} */ mergedLeaveNodes = new Set(); const /** @type {?} */ leaveNodesWithoutAnimations = new Set(); for (let /** @type {?} */ i = 0; i < this.collectedLeaveElements.length; i++) { const /** @type {?} */ element = this.collectedLeaveElements[i]; const /** @type {?} */ details = /** @type {?} */ (element[REMOVAL_FLAG]); if (details && details.setForRemoval) { allLeaveNodes.push(element); mergedLeaveNodes.add(element); if (details.hasAnimation) { this.driver.query(element, STAR_SELECTOR, true).forEach(elm => mergedLeaveNodes.add(elm)); } else { leaveNodesWithoutAnimations.add(element); } } } const /** @type {?} */ leaveNodeMapIds = new Map(); const /** @type {?} */ leaveNodeMap = buildRootMap(allTriggerElements, Array.from(mergedLeaveNodes)); leaveNodeMap.forEach((nodes, root) => { const /** @type {?} */ className = LEAVE_CLASSNAME + i++; leaveNodeMapIds.set(root, className); nodes.forEach(node => addClass(node, className)); }); cleanupFns.push(() => { enterNodeMap.forEach((nodes, root) => { const /** @type {?} */ className = /** @type {?} */ ((enterNodeMapIds.get(root))); nodes.forEach(node => removeClass(node, className)); }); leaveNodeMap.forEach((nodes, root) => { const /** @type {?} */ className = /** @type {?} */ ((leaveNodeMapIds.get(root))); nodes.forEach(node => removeClass(node, className)); }); allLeaveNodes.forEach(element => { this.processLeaveNode(element); }); }); const /** @type {?} */ allPlayers = []; const /** @type {?} */ erroneousTransitions = []; for (let /** @type {?} */ i = this._namespaceList.length - 1; i >= 0; i--) { const /** @type {?} */ ns = this._namespaceList[i]; ns.drainQueuedTransitions(microtaskId).forEach(entry => { const /** @type {?} */ player = entry.player; allPlayers.push(player); const /** @type {?} */ element = entry.element; if (!bodyNode || !this.driver.containsElement(bodyNode, element)) { player.destroy(); return; } const /** @type {?} */ leaveClassName = /** @type {?} */ ((leaveNodeMapIds.get(element))); const /** @type {?} */ enterClassName = /** @type {?} */ ((enterNodeMapIds.get(element))); const /** @type {?} */ instruction = /** @type {?} */ ((this._buildInstruction(entry, subTimelines, enterClassName, leaveClassName))); if (instruction.errors && instruction.errors.length) { erroneousTransitions.push(instruction); return; } // if a unmatched transition is queued to go then it SHOULD NOT render // an animation and cancel the previously running animations. if (entry.isFallbackTransition) { player.onStart(() => eraseStyles(element, instruction.fromStyles)); player.onDestroy(() => setStyles(element, instruction.toStyles)); skippedPlayers.push(player); return; } // this means that if a parent animation uses this animation as a sub trigger // then it will instruct the timeline builder to not add a player delay, but // instead stretch the first keyframe gap up until the animation starts. The // reason this is important is to prevent extra initialization styles from being // required by the user in the animation. instruction.timelines.forEach(tl => tl.stretchStartingKeyframe = true); subTimelines.append(element, instruction.timelines); const /** @type {?} */ tuple = { instruction, player, element }; queuedInstructions.push(tuple); instruction.queriedElements.forEach(element => getOrSetAsInMap(queriedElements, element, []).push(player)); instruction.preStyleProps.forEach((stringMap, element) => { const /** @type {?} */ props = Object.keys(stringMap); if (props.length) { let /** @type {?} */ setVal = /** @type {?} */ ((allPreStyleElements.get(element))); if (!setVal) { allPreStyleElements.set(element, setVal = new Set()); } props.forEach(prop => setVal.add(prop)); } }); instruction.postStyleProps.forEach((stringMap, element) => { const /** @type {?} */ props = Object.keys(stringMap); let /** @type {?} */ setVal = /** @type {?} */ ((allPostStyleElements.get(element))); if (!setVal) { allPostStyleElements.set(element, setVal = new Set()); } props.forEach(prop => setVal.add(prop)); }); }); } if (erroneousTransitions.length) { const /** @type {?} */ errors = []; erroneousTransitions.forEach(instruction => { errors.push(`@${instruction.triggerName} has failed due to:\n`); /** @type {?} */ ((instruction.errors)).forEach(error => errors.push(`- ${error}\n`)); }); allPlayers.forEach(player => player.destroy()); this.reportError(errors); } const /** @type {?} */ allPreviousPlayersMap = new Map(); // this map works to tell which element in the DOM tree is contained by // which animation. Further down below this map will get populated once // the players are built and in doing so it can efficiently figure out // if a sub player is skipped due to a parent player having priority. const /** @type {?} */ animationElementMap = new Map(); queuedInstructions.forEach(entry => { const /** @type {?} */ element = entry.element; if (subTimelines.has(element)) { animationElementMap.set(element, element); this._beforeAnimationBuild(entry.player.namespaceId, entry.instruction, allPreviousPlayersMap); } }); skippedPlayers.forEach(player => { const /** @type {?} */ element = player.element; const /** @type {?} */ previousPlayers = this._getPreviousPlayers(element, false, player.namespaceId, player.triggerName, null); previousPlayers.forEach(prevPlayer => { getOrSetAsInMap(allPreviousPlayersMap, element, []).push(prevPlayer); prevPlayer.destroy(); }); }); // this is a special case for nodes that will be removed (either by) // having their own leave animations or by being queried in a container // that will be removed once a parent animation is complete. The idea // here is that * styles must be identical to ! styles because of // backwards compatibility (* is also filled in by default in many places). // Otherwise * styles will return an empty value or auto since the element // that is being getComputedStyle'd will not be visible (since * = destination) const /** @type {?} */ replaceNodes = allLeaveNodes.filter(node => { return replacePostStylesAsPre(node, allPreStyleElements, allPostStyleElements); }); // POST STAGE: fill the * styles const /** @type {?} */ postStylesMap = new Map(); const /** @type {?} */ allLeaveQueriedNodes = cloakAndComputeStyles(postStylesMap, this.driver, leaveNodesWithoutAnimations, allPostStyleElements, __WEBPACK_IMPORTED_MODULE_0__angular_animations__["AUTO_STYLE"]); allLeaveQueriedNodes.forEach(node => { if (replacePostStylesAsPre(node, allPreStyleElements, allPostStyleElements)) { replaceNodes.push(node); } }); // PRE STAGE: fill the ! styles const /** @type {?} */ preStylesMap = new Map(); enterNodeMap.forEach((nodes, root) => { cloakAndComputeStyles(preStylesMap, this.driver, new Set(nodes), allPreStyleElements, __WEBPACK_IMPORTED_MODULE_0__angular_animations__["ɵPRE_STYLE"]); }); replaceNodes.forEach(node => { const /** @type {?} */ post = postStylesMap.get(node); const /** @type {?} */ pre = preStylesMap.get(node); postStylesMap.set(node, /** @type {?} */ (Object.assign({}, post, pre))); }); const /** @type {?} */ rootPlayers = []; const /** @type {?} */ subPlayers = []; const /** @type {?} */ NO_PARENT_ANIMATION_ELEMENT_DETECTED = {}; queuedInstructions.forEach(entry => { const { element, player, instruction } = entry; // this means that it was never consumed by a parent animation which // means that it is independent and therefore should be set for animation if (subTimelines.has(element)) { if (disabledElementsSet.has(element)) { player.onDestroy(() => setStyles(element, instruction.toStyles)); skippedPlayers.push(player); return; } // this will flow up the DOM and query the map to figure out // if a parent animation has priority over it. In the situation // that a parent is detected then it will cancel the loop. If // nothing is detected, or it takes a few hops to find a parent, // then it will fill in the missing nodes and signal them as having // a detected parent (or a NO_PARENT value via a special constant). let /** @type {?} */ parentWithAnimation = NO_PARENT_ANIMATION_ELEMENT_DETECTED; if (animationElementMap.size > 1) { let /** @type {?} */ elm = element; const /** @type {?} */ parentsToAdd = []; while (elm = elm.parentNode) { const /** @type {?} */ detectedParent = animationElementMap.get(elm); if (detectedParent) { parentWithAnimation = detectedParent; break; } parentsToAdd.push(elm); } parentsToAdd.forEach(parent => animationElementMap.set(parent, parentWithAnimation)); } const /** @type {?} */ innerPlayer = this._buildAnimation(player.namespaceId, instruction, allPreviousPlayersMap, skippedPlayersMap, preStylesMap, postStylesMap); player.setRealPlayer(innerPlayer); if (parentWithAnimation === NO_PARENT_ANIMATION_ELEMENT_DETECTED) { rootPlayers.push(player); } else { const /** @type {?} */ parentPlayers = this.playersByElement.get(parentWithAnimation); if (parentPlayers && parentPlayers.length) { player.parentPlayer = optimizeGroupPlayer(parentPlayers); } skippedPlayers.push(player); } } else { eraseStyles(element, instruction.fromStyles); player.onDestroy(() => setStyles(element, instruction.toStyles)); // there still might be a ancestor player animating this // element therefore we will still add it as a sub player // even if its animation may be disabled subPlayers.push(player); if (disabledElementsSet.has(element)) { skippedPlayers.push(player); } } }); // find all of the sub players' corresponding inner animation player subPlayers.forEach(player => { // even if any players are not found for a sub animation then it // will still complete itself after the next tick since it's Noop const /** @type {?} */ playersForElement = skippedPlayersMap.get(player.element); if (playersForElement && playersForElement.length) { const /** @type {?} */ innerPlayer = optimizeGroupPlayer(playersForElement); player.setRealPlayer(innerPlayer); } }); // the reason why we don't actually play the animation is // because all that a skipped player is designed to do is to // fire the start/done transition callback events skippedPlayers.forEach(player => { if (player.parentPlayer) { player.syncPlayerEvents(player.parentPlayer); } else { player.destroy(); } }); // run through all of the queued removals and see if they // were picked up by a query. If not then perform the removal // operation right away unless a parent animation is ongoing. for (let /** @type {?} */ i = 0; i < allLeaveNodes.length; i++) { const /** @type {?} */ element = allLeaveNodes[i]; const /** @type {?} */ details = /** @type {?} */ (element[REMOVAL_FLAG]); removeClass(element, LEAVE_CLASSNAME); // this means the element has a removal animation that is being // taken care of and therefore the inner elements will hang around // until that animation is over (or the parent queried animation) if (details && details.hasAnimation) continue; let /** @type {?} */ players = []; // if this element is queried or if it contains queried children // then we want for the element not to be removed from the page // until the queried animations have finished if (queriedElements.size) { let /** @type {?} */ queriedPlayerResults = queriedElements.get(element); if (queriedPlayerResults && queriedPlayerResults.length) { players.push(...queriedPlayerResults); } let /** @type {?} */ queriedInnerElements = this.driver.query(element, NG_ANIMATING_SELECTOR, true); for (let /** @type {?} */ j = 0; j < queriedInnerElements.length; j++) { let /** @type {?} */ queriedPlayers = queriedElements.get(queriedInnerElements[j]); if (queriedPlayers && queriedPlayers.length) { players.push(...queriedPlayers); } } } const /** @type {?} */ activePlayers = players.filter(p => !p.destroyed); if (activePlayers.length) { removeNodesAfterAnimationDone(this, element, activePlayers); } else { this.processLeaveNode(element); } } // this is required so the cleanup method doesn't remove them allLeaveNodes.length = 0; rootPlayers.forEach(player => { this.players.push(player); player.onDone(() => { player.destroy(); const /** @type {?} */ index = this.players.indexOf(player); this.players.splice(index, 1); }); player.play(); }); return rootPlayers; } /** * @param {?} namespaceId * @param {?} element * @return {?} */ elementContainsData(namespaceId, element) { let /** @type {?} */ containsData = false; const /** @type {?} */ details = /** @type {?} */ (element[REMOVAL_FLAG]); if (details && details.setForRemoval) containsData = true; if (this.playersByElement.has(element)) containsData = true; if (this.playersByQueriedElement.has(element)) containsData = true; if (this.statesByElement.has(element)) containsData = true; return this._fetchNamespace(namespaceId).elementContainsData(element) || containsData; } /** * @param {?} callback * @return {?} */ afterFlush(callback) { this._flushFns.push(callback); } /** * @param {?} callback * @return {?} */ afterFlushAnimationsDone(callback) { this._whenQuietFns.push(callback); } /** * @param {?} element * @param {?} isQueriedElement * @param {?=} namespaceId * @param {?=} triggerName * @param {?=} toStateValue * @return {?} */ _getPreviousPlayers(element, isQueriedElement, namespaceId, triggerName, toStateValue) { let /** @type {?} */ players = []; if (isQueriedElement) { const /** @type {?} */ queriedElementPlayers = this.playersByQueriedElement.get(element); if (queriedElementPlayers) { players = queriedElementPlayers; } } else { const /** @type {?} */ elementPlayers = this.playersByElement.get(element); if (elementPlayers) { const /** @type {?} */ isRemovalAnimation = !toStateValue || toStateValue == VOID_VALUE; elementPlayers.forEach(player => { if (player.queued) return; if (!isRemovalAnimation && player.triggerName != triggerName) return; players.push(player); }); } } if (namespaceId || triggerName) { players = players.filter(player => { if (namespaceId && namespaceId != player.namespaceId) return false; if (triggerName && triggerName != player.triggerName) return false; return true; }); } return players; } /** * @param {?} namespaceId * @param {?} instruction * @param {?} allPreviousPlayersMap * @return {?} */ _beforeAnimationBuild(namespaceId, instruction, allPreviousPlayersMap) { const /** @type {?} */ triggerName = instruction.triggerName; const /** @type {?} */ rootElement = instruction.element; // when a removal animation occurs, ALL previous players are collected // and destroyed (even if they are outside of the current namespace) const /** @type {?} */ targetNameSpaceId = instruction.isRemovalTransition ? undefined : namespaceId; const /** @type {?} */ targetTriggerName = instruction.isRemovalTransition ? undefined : triggerName; for (const /** @type {?} */ timelineInstruction of instruction.timelines) { const /** @type {?} */ element = timelineInstruction.element; const /** @type {?} */ isQueriedElement = element !== rootElement; const /** @type {?} */ players = getOrSetAsInMap(allPreviousPlayersMap, element, []); const /** @type {?} */ previousPlayers = this._getPreviousPlayers(element, isQueriedElement, targetNameSpaceId, targetTriggerName, instruction.toState); previousPlayers.forEach(player => { const /** @type {?} */ realPlayer = /** @type {?} */ (player.getRealPlayer()); if (realPlayer.beforeDestroy) { realPlayer.beforeDestroy(); } player.destroy(); players.push(player); }); } // this needs to be done so that the PRE/POST styles can be // computed properly without interfering with the previous animation eraseStyles(rootElement, instruction.fromStyles); } /** * @param {?} namespaceId * @param {?} instruction * @param {?} allPreviousPlayersMap * @param {?} skippedPlayersMap * @param {?} preStylesMap * @param {?} postStylesMap * @return {?} */ _buildAnimation(namespaceId, instruction, allPreviousPlayersMap, skippedPlayersMap, preStylesMap, postStylesMap) { const /** @type {?} */ triggerName = instruction.triggerName; const /** @type {?} */ rootElement = instruction.element; // we first run this so that the previous animation player // data can be passed into the successive animation players const /** @type {?} */ allQueriedPlayers = []; const /** @type {?} */ allConsumedElements = new Set(); const /** @type {?} */ allSubElements = new Set(); const /** @type {?} */ allNewPlayers = instruction.timelines.map(timelineInstruction => { const /** @type {?} */ element = timelineInstruction.element; allConsumedElements.add(element); // FIXME (matsko): make sure to-be-removed animations are removed properly const /** @type {?} */ details = element[REMOVAL_FLAG]; if (details && details.removedBeforeQueried) return new __WEBPACK_IMPORTED_MODULE_0__angular_animations__["NoopAnimationPlayer"](); const /** @type {?} */ isQueriedElement = element !== rootElement; const /** @type {?} */ previousPlayers = flattenGroupPlayers((allPreviousPlayersMap.get(element) || EMPTY_PLAYER_ARRAY) .map(p => p.getRealPlayer())) .filter(p => { // the `element` is not apart of the AnimationPlayer definition, but // Mock/WebAnimations // use the element within their implementation. This will be added in Angular5 to // AnimationPlayer const /** @type {?} */ pp = /** @type {?} */ (p); return pp.element ? pp.element === element : false; }); const /** @type {?} */ preStyles = preStylesMap.get(element); const /** @type {?} */ postStyles = postStylesMap.get(element); const /** @type {?} */ keyframes = normalizeKeyframes(this.driver, this._normalizer, element, timelineInstruction.keyframes, preStyles, postStyles); const /** @type {?} */ player = this._buildPlayer(timelineInstruction, keyframes, previousPlayers); // this means that this particular player belongs to a sub trigger. It is // important that we match this player up with the corresponding (@trigger.listener) if (timelineInstruction.subTimeline && skippedPlayersMap) { allSubElements.add(element); } if (isQueriedElement) { const /** @type {?} */ wrappedPlayer = new TransitionAnimationPlayer(namespaceId, triggerName, element); wrappedPlayer.setRealPlayer(player); allQueriedPlayers.push(wrappedPlayer); } return player; }); allQueriedPlayers.forEach(player => { getOrSetAsInMap(this.playersByQueriedElement, player.element, []).push(player); player.onDone(() => deleteOrUnsetInMap(this.playersByQueriedElement, player.element, player)); }); allConsumedElements.forEach(element => addClass(element, NG_ANIMATING_CLASSNAME)); const /** @type {?} */ player = optimizeGroupPlayer(allNewPlayers); player.onDestroy(() => { allConsumedElements.forEach(element => removeClass(element, NG_ANIMATING_CLASSNAME)); setStyles(rootElement, instruction.toStyles); }); // this basically makes all of the callbacks for sub element animations // be dependent on the upper players for when they finish allSubElements.forEach(element => { getOrSetAsInMap(skippedPlayersMap, element, []).push(player); }); return player; } /** * @param {?} instruction * @param {?} keyframes * @param {?} previousPlayers * @return {?} */ _buildPlayer(instruction, keyframes, previousPlayers) { if (keyframes.length > 0) { return this.driver.animate(instruction.element, keyframes, instruction.duration, instruction.delay, instruction.easing, previousPlayers); } // special case for when an empty transition|definition is provided // ... there is no point in rendering an empty animation return new __WEBPACK_IMPORTED_MODULE_0__angular_animations__["NoopAnimationPlayer"](); } } class TransitionAnimationPlayer { /** * @param {?} namespaceId * @param {?} triggerName * @param {?} element */ constructor(namespaceId, triggerName, element) { this.namespaceId = namespaceId; this.triggerName = triggerName; this.element = element; this._player = new __WEBPACK_IMPORTED_MODULE_0__angular_animations__["NoopAnimationPlayer"](); this._containsRealPlayer = false; this._queuedCallbacks = {}; this.destroyed = false; this.markedForDestroy = false; this.queued = true; } /** * @param {?} player * @return {?} */ setRealPlayer(player) { if (this._containsRealPlayer) return; this._player = player; Object.keys(this._queuedCallbacks).forEach(phase => { this._queuedCallbacks[phase].forEach(callback => listenOnPlayer(player, phase, undefined, callback)); }); this._queuedCallbacks = {}; this._containsRealPlayer = true; (/** @type {?} */ (this)).queued = false; } /** * @return {?} */ getRealPlayer() { return this._player; } /** * @param {?} player * @return {?} */ syncPlayerEvents(player) { const /** @type {?} */ p = /** @type {?} */ (this._player); if (p.triggerCallback) { player.onStart(() => p.triggerCallback('start')); } player.onDone(() => this.finish()); player.onDestroy(() => this.destroy()); } /** * @param {?} name * @param {?} callback * @return {?} */ _queueEvent(name, callback) { getOrSetAsInMap(this._queuedCallbacks, name, []).push(callback); } /** * @param {?} fn * @return {?} */ onDone(fn) { if (this.queued) { this._queueEvent('done', fn); } this._player.onDone(fn); } /** * @param {?} fn * @return {?} */ onStart(fn) { if (this.queued) { this._queueEvent('start', fn); } this._player.onStart(fn); } /** * @param {?} fn * @return {?} */ onDestroy(fn) { if (this.queued) { this._queueEvent('destroy', fn); } this._player.onDestroy(fn); } /** * @return {?} */ init() { this._player.init(); } /** * @return {?} */ hasStarted() { return this.queued ? false : this._player.hasStarted(); } /** * @return {?} */ play() { !this.queued && this._player.play(); } /** * @return {?} */ pause() { !this.queued && this._player.pause(); } /** * @return {?} */ restart() { !this.queued && this._player.restart(); } /** * @return {?} */ finish() { this._player.finish(); } /** * @return {?} */ destroy() { (/** @type {?} */ (this)).destroyed = true; this._player.destroy(); } /** * @return {?} */ reset() { !this.queued && this._player.reset(); } /** * @param {?} p * @return {?} */ setPosition(p) { if (!this.queued) { this._player.setPosition(p); } } /** * @return {?} */ getPosition() { return this.queued ? 0 : this._player.getPosition(); } /** * @return {?} */ get totalTime() { return this._player.totalTime; } /** * @param {?} phaseName * @return {?} */ triggerCallback(phaseName) { const /** @type {?} */ p = /** @type {?} */ (this._player); if (p.triggerCallback) { p.triggerCallback(phaseName); } } } /** * @param {?} map * @param {?} key * @param {?} value * @return {?} */ function deleteOrUnsetInMap(map, key, value) { let /** @type {?} */ currentValues; if (map instanceof Map) { currentValues = map.get(key); if (currentValues) { if (currentValues.length) { const /** @type {?} */ index = currentValues.indexOf(value); currentValues.splice(index, 1); } if (currentValues.length == 0) { map.delete(key); } } } else { currentValues = map[key]; if (currentValues) { if (currentValues.length) { const /** @type {?} */ index = currentValues.indexOf(value); currentValues.splice(index, 1); } if (currentValues.length == 0) { delete map[key]; } } } return currentValues; } /** * @param {?} value * @return {?} */ function normalizeTriggerValue(value) { // we use `!= null` here because it's the most simple // way to test against a "falsy" value without mixing // in empty strings or a zero value. DO NOT OPTIMIZE. return value != null ? value : null; } /** * @param {?} node * @return {?} */ function isElementNode(node) { return node && node['nodeType'] === 1; } /** * @param {?} eventName * @return {?} */ function isTriggerEventValid(eventName) { return eventName == 'start' || eventName == 'done'; } /** * @param {?} element * @param {?=} value * @return {?} */ function cloakElement(element, value) { const /** @type {?} */ oldValue = element.style.display; element.style.display = value != null ? value : 'none'; return oldValue; } /** * @param {?} valuesMap * @param {?} driver * @param {?} elements * @param {?} elementPropsMap * @param {?} defaultStyle * @return {?} */ function cloakAndComputeStyles(valuesMap, driver, elements, elementPropsMap, defaultStyle) { const /** @type {?} */ cloakVals = []; elements.forEach(element => cloakVals.push(cloakElement(element))); const /** @type {?} */ failedElements = []; elementPropsMap.forEach((props, element) => { const /** @type {?} */ styles = {}; props.forEach(prop => { const /** @type {?} */ value = styles[prop] = driver.computeStyle(element, prop, defaultStyle); // there is no easy way to detect this because a sub element could be removed // by a parent animation element being detached. if (!value || value.length == 0) { element[REMOVAL_FLAG] = NULL_REMOVED_QUERIED_STATE; failedElements.push(element); } }); valuesMap.set(element, styles); }); // we use a index variable here since Set.forEach(a, i) does not return // an index value for the closure (but instead just the value) let /** @type {?} */ i = 0; elements.forEach(element => cloakElement(element, cloakVals[i++])); return failedElements; } /** * @param {?} roots * @param {?} nodes * @return {?} */ function buildRootMap(roots, nodes) { const /** @type {?} */ rootMap = new Map(); roots.forEach(root => rootMap.set(root, [])); if (nodes.length == 0) return rootMap; const /** @type {?} */ NULL_NODE = 1; const /** @type {?} */ nodeSet = new Set(nodes); const /** @type {?} */ localRootMap = new Map(); /** * @param {?} node * @return {?} */ function getRoot(node) { if (!node) return NULL_NODE; let /** @type {?} */ root = localRootMap.get(node); if (root) return root; const /** @type {?} */ parent = node.parentNode; if (rootMap.has(parent)) { // ngIf inside @trigger root = parent; } else if (nodeSet.has(parent)) { // ngIf inside ngIf root = NULL_NODE; } else { // recurse upwards root = getRoot(parent); } localRootMap.set(node, root); return root; } nodes.forEach(node => { const /** @type {?} */ root = getRoot(node); if (root !== NULL_NODE) { /** @type {?} */ ((rootMap.get(root))).push(node); } }); return rootMap; } const CLASSES_CACHE_KEY = '$$classes'; /** * @param {?} element * @param {?} className * @return {?} */ function addClass(element, className) { if (element.classList) { element.classList.add(className); } else { let /** @type {?} */ classes = element[CLASSES_CACHE_KEY]; if (!classes) { classes = element[CLASSES_CACHE_KEY] = {}; } classes[className] = true; } } /** * @param {?} element * @param {?} className * @return {?} */ function removeClass(element, className) { if (element.classList) { element.classList.remove(className); } else { let /** @type {?} */ classes = element[CLASSES_CACHE_KEY]; if (classes) { delete classes[className]; } } } /** * @param {?} engine * @param {?} element * @param {?} players * @return {?} */ function removeNodesAfterAnimationDone(engine, element, players) { optimizeGroupPlayer(players).onDone(() => engine.processLeaveNode(element)); } /** * @param {?} players * @return {?} */ function flattenGroupPlayers(players) { const /** @type {?} */ finalPlayers = []; _flattenGroupPlayersRecur(players, finalPlayers); return finalPlayers; } /** * @param {?} players * @param {?} finalPlayers * @return {?} */ function _flattenGroupPlayersRecur(players, finalPlayers) { for (let /** @type {?} */ i = 0; i < players.length; i++) { const /** @type {?} */ player = players[i]; if (player instanceof __WEBPACK_IMPORTED_MODULE_0__angular_animations__["ɵAnimationGroupPlayer"]) { _flattenGroupPlayersRecur(player.players, finalPlayers); } else { finalPlayers.push(/** @type {?} */ (player)); } } } /** * @param {?} a * @param {?} b * @return {?} */ function objEquals(a, b) { const /** @type {?} */ k1 = Object.keys(a); const /** @type {?} */ k2 = Object.keys(b); if (k1.length != k2.length) return false; for (let /** @type {?} */ i = 0; i < k1.length; i++) { const /** @type {?} */ prop = k1[i]; if (!b.hasOwnProperty(prop) || a[prop] !== b[prop]) return false; } return true; } /** * @param {?} element * @param {?} allPreStyleElements * @param {?} allPostStyleElements * @return {?} */ function replacePostStylesAsPre(element, allPreStyleElements, allPostStyleElements) { const /** @type {?} */ postEntry = allPostStyleElements.get(element); if (!postEntry) return false; let /** @type {?} */ preEntry = allPreStyleElements.get(element); if (preEntry) { postEntry.forEach(data => /** @type {?} */ ((preEntry)).add(data)); } else { allPreStyleElements.set(element, postEntry); } allPostStyleElements.delete(element); return true; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ class AnimationEngine { /** * @param {?} _driver * @param {?} normalizer */ constructor(_driver, normalizer) { this._driver = _driver; this._triggerCache = {}; this.onRemovalComplete = (element, context) => { }; this._transitionEngine = new TransitionAnimationEngine(_driver, normalizer); this._timelineEngine = new TimelineAnimationEngine(_driver, normalizer); this._transitionEngine.onRemovalComplete = (element, context) => this.onRemovalComplete(element, context); } /** * @param {?} componentId * @param {?} namespaceId * @param {?} hostElement * @param {?} name * @param {?} metadata * @return {?} */ registerTrigger(componentId, namespaceId, hostElement, name, metadata) { const /** @type {?} */ cacheKey = componentId + '-' + name; let /** @type {?} */ trigger = this._triggerCache[cacheKey]; if (!trigger) { const /** @type {?} */ errors = []; const /** @type {?} */ ast = /** @type {?} */ (buildAnimationAst(this._driver, /** @type {?} */ (metadata), errors)); if (errors.length) { throw new Error(`The animation trigger "${name}" has failed to build due to the following errors:\n - ${errors.join("\n - ")}`); } trigger = buildTrigger(name, ast); this._triggerCache[cacheKey] = trigger; } this._transitionEngine.registerTrigger(namespaceId, name, trigger); } /** * @param {?} namespaceId * @param {?} hostElement * @return {?} */ register(namespaceId, hostElement) { this._transitionEngine.register(namespaceId, hostElement); } /** * @param {?} namespaceId * @param {?} context * @return {?} */ destroy(namespaceId, context) { this._transitionEngine.destroy(namespaceId, context); } /** * @param {?} namespaceId * @param {?} element * @param {?} parent * @param {?} insertBefore * @return {?} */ onInsert(namespaceId, element, parent, insertBefore) { this._transitionEngine.insertNode(namespaceId, element, parent, insertBefore); } /** * @param {?} namespaceId * @param {?} element * @param {?} context * @return {?} */ onRemove(namespaceId, element, context) { this._transitionEngine.removeNode(namespaceId, element, context); } /** * @param {?} element * @param {?} disable * @return {?} */ disableAnimations(element, disable) { this._transitionEngine.markElementAsDisabled(element, disable); } /** * @param {?} namespaceId * @param {?} element * @param {?} property * @param {?} value * @return {?} */ process(namespaceId, element, property, value) { if (property.charAt(0) == '@') { const [id, action] = parseTimelineCommand(property); const /** @type {?} */ args = /** @type {?} */ (value); this._timelineEngine.command(id, element, action, args); } else { this._transitionEngine.trigger(namespaceId, element, property, value); } } /** * @param {?} namespaceId * @param {?} element * @param {?} eventName * @param {?} eventPhase * @param {?} callback * @return {?} */ listen(namespaceId, element, eventName, eventPhase, callback) { // @@listen if (eventName.charAt(0) == '@') { const [id, action] = parseTimelineCommand(eventName); return this._timelineEngine.listen(id, element, action, callback); } return this._transitionEngine.listen(namespaceId, element, eventName, eventPhase, callback); } /** * @param {?=} microtaskId * @return {?} */ flush(microtaskId = -1) { this._transitionEngine.flush(microtaskId); } /** * @return {?} */ get players() { return (/** @type {?} */ (this._transitionEngine.players)) .concat(/** @type {?} */ (this._timelineEngine.players)); } /** * @return {?} */ whenRenderingDone() { return this._transitionEngine.whenRenderingDone(); } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ class WebAnimationsPlayer { /** * @param {?} element * @param {?} keyframes * @param {?} options * @param {?=} previousPlayers */ constructor(element, keyframes, options, previousPlayers = []) { this.element = element; this.keyframes = keyframes; this.options = options; this.previousPlayers = previousPlayers; this._onDoneFns = []; this._onStartFns = []; this._onDestroyFns = []; this._initialized = false; this._finished = false; this._started = false; this._destroyed = false; this.time = 0; this.parentPlayer = null; this.previousStyles = {}; this.currentSnapshot = {}; this._duration = /** @type {?} */ (options['duration']); this._delay = /** @type {?} */ (options['delay']) || 0; this.time = this._duration + this._delay; if (allowPreviousPlayerStylesMerge(this._duration, this._delay)) { previousPlayers.forEach(player => { let /** @type {?} */ styles = player.currentSnapshot; Object.keys(styles).forEach(prop => this.previousStyles[prop] = styles[prop]); }); } } /** * @return {?} */ _onFinish() { if (!this._finished) { this._finished = true; this._onDoneFns.forEach(fn => fn()); this._onDoneFns = []; } } /** * @return {?} */ init() { this._buildPlayer(); this._preparePlayerBeforeStart(); } /** * @return {?} */ _buildPlayer() { if (this._initialized) return; this._initialized = true; const /** @type {?} */ keyframes = this.keyframes.map(styles => copyStyles(styles, false)); const /** @type {?} */ previousStyleProps = Object.keys(this.previousStyles); if (previousStyleProps.length && keyframes.length) { let /** @type {?} */ startingKeyframe = keyframes[0]; let /** @type {?} */ missingStyleProps = []; previousStyleProps.forEach(prop => { if (!startingKeyframe.hasOwnProperty(prop)) { missingStyleProps.push(prop); } startingKeyframe[prop] = this.previousStyles[prop]; }); if (missingStyleProps.length) { const /** @type {?} */ self = this; // tslint:disable-next-line for (var /** @type {?} */ i = 1; i < keyframes.length; i++) { let /** @type {?} */ kf = keyframes[i]; missingStyleProps.forEach(function (prop) { kf[prop] = _computeStyle(self.element, prop); }); } } } (/** @type {?} */ (this)).domPlayer = this._triggerWebAnimation(this.element, keyframes, this.options); this._finalKeyframe = keyframes.length ? keyframes[keyframes.length - 1] : {}; this.domPlayer.addEventListener('finish', () => this._onFinish()); } /** * @return {?} */ _preparePlayerBeforeStart() { // this is required so that the player doesn't start to animate right away if (this._delay) { this._resetDomPlayerState(); } else { this.domPlayer.pause(); } } /** * \@internal * @param {?} element * @param {?} keyframes * @param {?} options * @return {?} */ _triggerWebAnimation(element, keyframes, options) { // jscompiler doesn't seem to know animate is a native property because it's not fully // supported yet across common browsers (we polyfill it for Edge/Safari) [CL #143630929] return /** @type {?} */ (element['animate'](keyframes, options)); } /** * @param {?} fn * @return {?} */ onStart(fn) { this._onStartFns.push(fn); } /** * @param {?} fn * @return {?} */ onDone(fn) { this._onDoneFns.push(fn); } /** * @param {?} fn * @return {?} */ onDestroy(fn) { this._onDestroyFns.push(fn); } /** * @return {?} */ play() { this._buildPlayer(); if (!this.hasStarted()) { this._onStartFns.forEach(fn => fn()); this._onStartFns = []; this._started = true; } this.domPlayer.play(); } /** * @return {?} */ pause() { this.init(); this.domPlayer.pause(); } /** * @return {?} */ finish() { this.init(); this._onFinish(); this.domPlayer.finish(); } /** * @return {?} */ reset() { this._resetDomPlayerState(); this._destroyed = false; this._finished = false; this._started = false; } /** * @return {?} */ _resetDomPlayerState() { if (this.domPlayer) { this.domPlayer.cancel(); } } /** * @return {?} */ restart() { this.reset(); this.play(); } /** * @return {?} */ hasStarted() { return this._started; } /** * @return {?} */ destroy() { if (!this._destroyed) { this._destroyed = true; this._resetDomPlayerState(); this._onFinish(); this._onDestroyFns.forEach(fn => fn()); this._onDestroyFns = []; } } /** * @param {?} p * @return {?} */ setPosition(p) { this.domPlayer.currentTime = p * this.time; } /** * @return {?} */ getPosition() { return this.domPlayer.currentTime / this.time; } /** * @return {?} */ get totalTime() { return this._delay + this._duration; } /** * @return {?} */ beforeDestroy() { const /** @type {?} */ styles = {}; if (this.hasStarted()) { Object.keys(this._finalKeyframe).forEach(prop => { if (prop != 'offset') { styles[prop] = this._finished ? this._finalKeyframe[prop] : _computeStyle(this.element, prop); } }); } this.currentSnapshot = styles; } /** * @param {?} phaseName * @return {?} */ triggerCallback(phaseName) { const /** @type {?} */ methods = phaseName == 'start' ? this._onStartFns : this._onDoneFns; methods.forEach(fn => fn()); methods.length = 0; } } /** * @param {?} element * @param {?} prop * @return {?} */ function _computeStyle(element, prop) { return (/** @type {?} */ (window.getComputedStyle(element)))[prop]; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ class WebAnimationsDriver { /** * @param {?} prop * @return {?} */ validateStyleProperty(prop) { return validateStyleProperty(prop); } /** * @param {?} element * @param {?} selector * @return {?} */ matchesElement(element, selector) { return matchesElement(element, selector); } /** * @param {?} elm1 * @param {?} elm2 * @return {?} */ containsElement(elm1, elm2) { return containsElement(elm1, elm2); } /** * @param {?} element * @param {?} selector * @param {?} multi * @return {?} */ query(element, selector, multi) { return invokeQuery(element, selector, multi); } /** * @param {?} element * @param {?} prop * @param {?=} defaultValue * @return {?} */ computeStyle(element, prop, defaultValue) { return /** @type {?} */ ((/** @type {?} */ (window.getComputedStyle(element)))[prop]); } /** * @param {?} element * @param {?} keyframes * @param {?} duration * @param {?} delay * @param {?} easing * @param {?=} previousPlayers * @return {?} */ animate(element, keyframes, duration, delay, easing, previousPlayers = []) { const /** @type {?} */ fill = delay == 0 ? 'both' : 'forwards'; const /** @type {?} */ playerOptions = { duration, delay, fill }; // we check for this to avoid having a null|undefined value be present // for the easing (which results in an error for certain browsers #9752) if (easing) { playerOptions['easing'] = easing; } const /** @type {?} */ previousWebAnimationPlayers = /** @type {?} */ (previousPlayers.filter(player => { return player instanceof WebAnimationsPlayer; })); return new WebAnimationsPlayer(element, keyframes, playerOptions, previousWebAnimationPlayers); } } /** * @return {?} */ function supportsWebAnimations() { return typeof Element !== 'undefined' && typeof (/** @type {?} */ (Element)).prototype['animate'] === 'function'; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @module * @description * Entry point for all public APIs of this package. */ /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * Generated bundle index. Do not edit. */ //# sourceMappingURL=browser.js.map /***/ }), /***/ "./node_modules/@angular/common/esm2015/common.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵregisterLocaleData", function() { return registerLocaleData; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgLocaleLocalization", function() { return NgLocaleLocalization; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgLocalization", function() { return NgLocalization; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "registerLocaleData", function() { return registerLocaleData; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Plural", function() { return Plural; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NumberFormatStyle", function() { return NumberFormatStyle; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FormStyle", function() { return FormStyle; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TranslationWidth", function() { return TranslationWidth; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FormatWidth", function() { return FormatWidth; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NumberSymbol", function() { return NumberSymbol; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "WeekDay", function() { return WeekDay; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getCurrencySymbol", function() { return getCurrencySymbol; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLocaleDayPeriods", function() { return getLocaleDayPeriods; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLocaleDayNames", function() { return getLocaleDayNames; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLocaleMonthNames", function() { return getLocaleMonthNames; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLocaleId", function() { return getLocaleId; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLocaleEraNames", function() { return getLocaleEraNames; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLocaleWeekEndRange", function() { return getLocaleWeekEndRange; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLocaleFirstDayOfWeek", function() { return getLocaleFirstDayOfWeek; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLocaleDateFormat", function() { return getLocaleDateFormat; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLocaleDateTimeFormat", function() { return getLocaleDateTimeFormat; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLocaleExtraDayPeriodRules", function() { return getLocaleExtraDayPeriodRules; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLocaleExtraDayPeriods", function() { return getLocaleExtraDayPeriods; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLocalePluralCase", function() { return getLocalePluralCase; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLocaleTimeFormat", function() { return getLocaleTimeFormat; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLocaleNumberSymbol", function() { return getLocaleNumberSymbol; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLocaleNumberFormat", function() { return getLocaleNumberFormat; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLocaleCurrencyName", function() { return getLocaleCurrencyName; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLocaleCurrencySymbol", function() { return getLocaleCurrencySymbol; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵparseCookieValue", function() { return parseCookieValue; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CommonModule", function() { return CommonModule; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DeprecatedI18NPipesModule", function() { return DeprecatedI18NPipesModule; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgClass", function() { return NgClass; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgForOf", function() { return NgForOf; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgForOfContext", function() { return NgForOfContext; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgIf", function() { return NgIf; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgIfContext", function() { return NgIfContext; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgPlural", function() { return NgPlural; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgPluralCase", function() { return NgPluralCase; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgStyle", function() { return NgStyle; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgSwitch", function() { return NgSwitch; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgSwitchCase", function() { return NgSwitchCase; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgSwitchDefault", function() { return NgSwitchDefault; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgTemplateOutlet", function() { return NgTemplateOutlet; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgComponentOutlet", function() { return NgComponentOutlet; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DOCUMENT", function() { return DOCUMENT; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AsyncPipe", function() { return AsyncPipe; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DatePipe", function() { return DatePipe; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "I18nPluralPipe", function() { return I18nPluralPipe; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "I18nSelectPipe", function() { return I18nSelectPipe; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "JsonPipe", function() { return JsonPipe; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LowerCasePipe", function() { return LowerCasePipe; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CurrencyPipe", function() { return CurrencyPipe; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DecimalPipe", function() { return DecimalPipe; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PercentPipe", function() { return PercentPipe; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SlicePipe", function() { return SlicePipe; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "UpperCasePipe", function() { return UpperCasePipe; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TitleCasePipe", function() { return TitleCasePipe; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DeprecatedDatePipe", function() { return DeprecatedDatePipe; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DeprecatedCurrencyPipe", function() { return DeprecatedCurrencyPipe; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DeprecatedDecimalPipe", function() { return DeprecatedDecimalPipe; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DeprecatedPercentPipe", function() { return DeprecatedPercentPipe; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵPLATFORM_BROWSER_ID", function() { return PLATFORM_BROWSER_ID; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵPLATFORM_SERVER_ID", function() { return PLATFORM_SERVER_ID; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵPLATFORM_WORKER_APP_ID", function() { return PLATFORM_WORKER_APP_ID; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵPLATFORM_WORKER_UI_ID", function() { return PLATFORM_WORKER_UI_ID; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isPlatformBrowser", function() { return isPlatformBrowser; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isPlatformServer", function() { return isPlatformServer; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isPlatformWorkerApp", function() { return isPlatformWorkerApp; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isPlatformWorkerUi", function() { return isPlatformWorkerUi; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "VERSION", function() { return VERSION; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PlatformLocation", function() { return PlatformLocation; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LOCATION_INITIALIZED", function() { return LOCATION_INITIALIZED; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LocationStrategy", function() { return LocationStrategy; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "APP_BASE_HREF", function() { return APP_BASE_HREF; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HashLocationStrategy", function() { return HashLocationStrategy; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PathLocationStrategy", function() { return PathLocationStrategy; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Location", function() { return Location; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵe", function() { return COMMON_DIRECTIVES; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵd", function() { return findLocaleData; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵa", function() { return DEPRECATED_PLURAL_FN; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵb", function() { return getPluralCase; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵg", function() { return COMMON_DEPRECATED_I18N_PIPES; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵf", function() { return COMMON_PIPES; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); /** * @license Angular v5.2.10 * (c) 2010-2018 Google, Inc. https://angular.io/ * License: MIT */ /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * This class should not be used directly by an application developer. Instead, use * {\@link Location}. * * `PlatformLocation` encapsulates all calls to DOM apis, which allows the Router to be platform * agnostic. * This means that we can have different implementation of `PlatformLocation` for the different * platforms that angular supports. For example, `\@angular/platform-browser` provides an * implementation specific to the browser environment, while `\@angular/platform-webworker` provides * one suitable for use with web workers. * * The `PlatformLocation` class is used directly by all implementations of {\@link LocationStrategy} * when they need to interact with the DOM apis like pushState, popState, etc... * * {\@link LocationStrategy} in turn is used by the {\@link Location} service which is used directly * by the {\@link Router} in order to navigate between routes. Since all interactions between {\@link * Router} / * {\@link Location} / {\@link LocationStrategy} and DOM apis flow through the `PlatformLocation` * class they are all platform independent. * * \@stable * @abstract */ class PlatformLocation { } /** * \@whatItDoes indicates when a location is initialized * \@experimental */ const LOCATION_INITIALIZED = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["InjectionToken"]('Location Initialized'); /** * A serializable version of the event from onPopState or onHashChange * * \@experimental * @record */ /** * \@experimental * @record */ /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * `LocationStrategy` is responsible for representing and reading route state * from the browser's URL. Angular provides two strategies: * {\@link HashLocationStrategy} and {\@link PathLocationStrategy}. * * This is used under the hood of the {\@link Location} service. * * Applications should use the {\@link Router} or {\@link Location} services to * interact with application route state. * * For instance, {\@link HashLocationStrategy} produces URLs like * `http://example.com#/foo`, and {\@link PathLocationStrategy} produces * `http://example.com/foo` as an equivalent URL. * * See these two classes for more. * * \@stable * @abstract */ class LocationStrategy { } /** * The `APP_BASE_HREF` token represents the base href to be used with the * {\@link PathLocationStrategy}. * * If you're using {\@link PathLocationStrategy}, you must provide a provider to a string * representing the URL prefix that should be preserved when generating and recognizing * URLs. * * ### Example * * ```typescript * import {Component, NgModule} from '\@angular/core'; * import {APP_BASE_HREF} from '\@angular/common'; * * \@NgModule({ * providers: [{provide: APP_BASE_HREF, useValue: '/my/app'}] * }) * class AppModule {} * ``` * * \@stable */ const APP_BASE_HREF = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["InjectionToken"]('appBaseHref'); /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * \@experimental * @record */ /** * \@whatItDoes `Location` is a service that applications can use to interact with a browser's URL. * \@description * Depending on which {\@link LocationStrategy} is used, `Location` will either persist * to the URL's path or the URL's hash segment. * * Note: it's better to use {\@link Router#navigate} service to trigger route changes. Use * `Location` only if you need to interact with or create normalized URLs outside of * routing. * * `Location` is responsible for normalizing the URL against the application's base href. * A normalized URL is absolute from the URL host, includes the application's base href, and has no * trailing slash: * - `/my/app/user/123` is normalized * - `my/app/user/123` **is not** normalized * - `/my/app/user/123/` **is not** normalized * * ### Example * {\@example common/location/ts/path_location_component.ts region='LocationComponent'} * \@stable */ class Location { /** * @param {?} platformStrategy */ constructor(platformStrategy) { /** * \@internal */ this._subject = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); this._platformStrategy = platformStrategy; const /** @type {?} */ browserBaseHref = this._platformStrategy.getBaseHref(); this._baseHref = Location.stripTrailingSlash(_stripIndexHtml(browserBaseHref)); this._platformStrategy.onPopState((ev) => { this._subject.emit({ 'url': this.path(true), 'pop': true, 'type': ev.type, }); }); } /** * Returns the normalized URL path. * @param {?=} includeHash * @return {?} */ path(includeHash = false) { return this.normalize(this._platformStrategy.path(includeHash)); } /** * Normalizes the given path and compares to the current normalized path. * @param {?} path * @param {?=} query * @return {?} */ isCurrentPathEqualTo(path, query = '') { return this.path() == this.normalize(path + Location.normalizeQueryParams(query)); } /** * Given a string representing a URL, returns the normalized URL path without leading or * trailing slashes. * @param {?} url * @return {?} */ normalize(url) { return Location.stripTrailingSlash(_stripBaseHref(this._baseHref, _stripIndexHtml(url))); } /** * Given a string representing a URL, returns the platform-specific external URL path. * If the given URL doesn't begin with a leading slash (`'/'`), this method adds one * before normalizing. This method will also add a hash if `HashLocationStrategy` is * used, or the `APP_BASE_HREF` if the `PathLocationStrategy` is in use. * @param {?} url * @return {?} */ prepareExternalUrl(url) { if (url && url[0] !== '/') { url = '/' + url; } return this._platformStrategy.prepareExternalUrl(url); } /** * Changes the browsers URL to the normalized version of the given URL, and pushes a * new item onto the platform's history. * @param {?} path * @param {?=} query * @return {?} */ go(path, query = '') { this._platformStrategy.pushState(null, '', path, query); } /** * Changes the browsers URL to the normalized version of the given URL, and replaces * the top item on the platform's history stack. * @param {?} path * @param {?=} query * @return {?} */ replaceState(path, query = '') { this._platformStrategy.replaceState(null, '', path, query); } /** * Navigates forward in the platform's history. * @return {?} */ forward() { this._platformStrategy.forward(); } /** * Navigates back in the platform's history. * @return {?} */ back() { this._platformStrategy.back(); } /** * Subscribe to the platform's `popState` events. * @param {?} onNext * @param {?=} onThrow * @param {?=} onReturn * @return {?} */ subscribe(onNext, onThrow, onReturn) { return this._subject.subscribe({ next: onNext, error: onThrow, complete: onReturn }); } /** * Given a string of url parameters, prepend with '?' if needed, otherwise return parameters as * is. * @param {?} params * @return {?} */ static normalizeQueryParams(params) { return params && params[0] !== '?' ? '?' + params : params; } /** * Given 2 parts of a url, join them with a slash if needed. * @param {?} start * @param {?} end * @return {?} */ static joinWithSlash(start, end) { if (start.length == 0) { return end; } if (end.length == 0) { return start; } let /** @type {?} */ slashes = 0; if (start.endsWith('/')) { slashes++; } if (end.startsWith('/')) { slashes++; } if (slashes == 2) { return start + end.substring(1); } if (slashes == 1) { return start + end; } return start + '/' + end; } /** * If url has a trailing slash, remove it, otherwise return url as is. This * method looks for the first occurence of either #, ?, or the end of the * line as `/` characters after any of these should not be replaced. * @param {?} url * @return {?} */ static stripTrailingSlash(url) { const /** @type {?} */ match = url.match(/#|\?|$/); const /** @type {?} */ pathEndIdx = match && match.index || url.length; const /** @type {?} */ droppedSlashIdx = pathEndIdx - (url[pathEndIdx - 1] === '/' ? 1 : 0); return url.slice(0, droppedSlashIdx) + url.slice(pathEndIdx); } } Location.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Injectable"] }, ]; /** @nocollapse */ Location.ctorParameters = () => [ { type: LocationStrategy, }, ]; /** * @param {?} baseHref * @param {?} url * @return {?} */ function _stripBaseHref(baseHref, url) { return baseHref && url.startsWith(baseHref) ? url.substring(baseHref.length) : url; } /** * @param {?} url * @return {?} */ function _stripIndexHtml(url) { return url.replace(/\/index.html$/, ''); } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * \@whatItDoes Use URL hash for storing application location data. * \@description * `HashLocationStrategy` is a {\@link LocationStrategy} used to configure the * {\@link Location} service to represent its state in the * [hash fragment](https://en.wikipedia.org/wiki/Uniform_Resource_Locator#Syntax) * of the browser's URL. * * For instance, if you call `location.go('/foo')`, the browser's URL will become * `example.com#/foo`. * * ### Example * * {\@example common/location/ts/hash_location_component.ts region='LocationComponent'} * * \@stable */ class HashLocationStrategy extends LocationStrategy { /** * @param {?} _platformLocation * @param {?=} _baseHref */ constructor(_platformLocation, _baseHref) { super(); this._platformLocation = _platformLocation; this._baseHref = ''; if (_baseHref != null) { this._baseHref = _baseHref; } } /** * @param {?} fn * @return {?} */ onPopState(fn) { this._platformLocation.onPopState(fn); this._platformLocation.onHashChange(fn); } /** * @return {?} */ getBaseHref() { return this._baseHref; } /** * @param {?=} includeHash * @return {?} */ path(includeHash = false) { // the hash value is always prefixed with a `#` // and if it is empty then it will stay empty let /** @type {?} */ path = this._platformLocation.hash; if (path == null) path = '#'; return path.length > 0 ? path.substring(1) : path; } /** * @param {?} internal * @return {?} */ prepareExternalUrl(internal) { const /** @type {?} */ url = Location.joinWithSlash(this._baseHref, internal); return url.length > 0 ? ('#' + url) : url; } /** * @param {?} state * @param {?} title * @param {?} path * @param {?} queryParams * @return {?} */ pushState(state, title, path, queryParams) { let /** @type {?} */ url = this.prepareExternalUrl(path + Location.normalizeQueryParams(queryParams)); if (url.length == 0) { url = this._platformLocation.pathname; } this._platformLocation.pushState(state, title, url); } /** * @param {?} state * @param {?} title * @param {?} path * @param {?} queryParams * @return {?} */ replaceState(state, title, path, queryParams) { let /** @type {?} */ url = this.prepareExternalUrl(path + Location.normalizeQueryParams(queryParams)); if (url.length == 0) { url = this._platformLocation.pathname; } this._platformLocation.replaceState(state, title, url); } /** * @return {?} */ forward() { this._platformLocation.forward(); } /** * @return {?} */ back() { this._platformLocation.back(); } } HashLocationStrategy.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Injectable"] }, ]; /** @nocollapse */ HashLocationStrategy.ctorParameters = () => [ { type: PlatformLocation, }, { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Optional"] }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Inject"], args: [APP_BASE_HREF,] },] }, ]; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * \@whatItDoes Use URL for storing application location data. * \@description * `PathLocationStrategy` is a {\@link LocationStrategy} used to configure the * {\@link Location} service to represent its state in the * [path](https://en.wikipedia.org/wiki/Uniform_Resource_Locator#Syntax) of the * browser's URL. * * If you're using `PathLocationStrategy`, you must provide a {\@link APP_BASE_HREF} * or add a base element to the document. This URL prefix that will be preserved * when generating and recognizing URLs. * * For instance, if you provide an `APP_BASE_HREF` of `'/my/app'` and call * `location.go('/foo')`, the browser's URL will become * `example.com/my/app/foo`. * * Similarly, if you add `<base href='/my/app'/>` to the document and call * `location.go('/foo')`, the browser's URL will become * `example.com/my/app/foo`. * * ### Example * * {\@example common/location/ts/path_location_component.ts region='LocationComponent'} * * \@stable */ class PathLocationStrategy extends LocationStrategy { /** * @param {?} _platformLocation * @param {?=} href */ constructor(_platformLocation, href) { super(); this._platformLocation = _platformLocation; if (href == null) { href = this._platformLocation.getBaseHrefFromDOM(); } if (href == null) { throw new Error(`No base href set. Please provide a value for the APP_BASE_HREF token or add a base element to the document.`); } this._baseHref = href; } /** * @param {?} fn * @return {?} */ onPopState(fn) { this._platformLocation.onPopState(fn); this._platformLocation.onHashChange(fn); } /** * @return {?} */ getBaseHref() { return this._baseHref; } /** * @param {?} internal * @return {?} */ prepareExternalUrl(internal) { return Location.joinWithSlash(this._baseHref, internal); } /** * @param {?=} includeHash * @return {?} */ path(includeHash = false) { const /** @type {?} */ pathname = this._platformLocation.pathname + Location.normalizeQueryParams(this._platformLocation.search); const /** @type {?} */ hash = this._platformLocation.hash; return hash && includeHash ? `${pathname}${hash}` : pathname; } /** * @param {?} state * @param {?} title * @param {?} url * @param {?} queryParams * @return {?} */ pushState(state, title, url, queryParams) { const /** @type {?} */ externalUrl = this.prepareExternalUrl(url + Location.normalizeQueryParams(queryParams)); this._platformLocation.pushState(state, title, externalUrl); } /** * @param {?} state * @param {?} title * @param {?} url * @param {?} queryParams * @return {?} */ replaceState(state, title, url, queryParams) { const /** @type {?} */ externalUrl = this.prepareExternalUrl(url + Location.normalizeQueryParams(queryParams)); this._platformLocation.replaceState(state, title, externalUrl); } /** * @return {?} */ forward() { this._platformLocation.forward(); } /** * @return {?} */ back() { this._platformLocation.back(); } } PathLocationStrategy.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Injectable"] }, ]; /** @nocollapse */ PathLocationStrategy.ctorParameters = () => [ { type: PlatformLocation, }, { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Optional"] }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Inject"], args: [APP_BASE_HREF,] },] }, ]; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ // THIS CODE IS GENERATED - DO NOT MODIFY // See angular/tools/gulp-tasks/cldr/extract.js /** * \@internal */ const CURRENCIES = { 'AOA': [, 'Kz'], 'ARS': [, '$'], 'AUD': ['A$', '$'], 'BAM': [, 'KM'], 'BBD': [, '$'], 'BDT': [, '৳'], 'BMD': [, '$'], 'BND': [, '$'], 'BOB': [, 'Bs'], 'BRL': ['R$'], 'BSD': [, '$'], 'BWP': [, 'P'], 'BYN': [, 'р.'], 'BZD': [, '$'], 'CAD': ['CA$', '$'], 'CLP': [, '$'], 'CNY': ['CN¥', '¥'], 'COP': [, '$'], 'CRC': [, '₡'], 'CUC': [, '$'], 'CUP': [, '$'], 'CZK': [, 'Kč'], 'DKK': [, 'kr'], 'DOP': [, '$'], 'EGP': [, 'E£'], 'ESP': [, '₧'], 'EUR': ['€'], 'FJD': [, '$'], 'FKP': [, '£'], 'GBP': ['£'], 'GEL': [, '₾'], 'GIP': [, '£'], 'GNF': [, 'FG'], 'GTQ': [, 'Q'], 'GYD': [, '$'], 'HKD': ['HK$', '$'], 'HNL': [, 'L'], 'HRK': [, 'kn'], 'HUF': [, 'Ft'], 'IDR': [, 'Rp'], 'ILS': ['₪'], 'INR': ['₹'], 'ISK': [, 'kr'], 'JMD': [, '$'], 'JPY': ['¥'], 'KHR': [, '៛'], 'KMF': [, 'CF'], 'KPW': [, '₩'], 'KRW': ['₩'], 'KYD': [, '$'], 'KZT': [, '₸'], 'LAK': [, '₭'], 'LBP': [, 'L£'], 'LKR': [, 'Rs'], 'LRD': [, '$'], 'LTL': [, 'Lt'], 'LVL': [, 'Ls'], 'MGA': [, 'Ar'], 'MMK': [, 'K'], 'MNT': [, '₮'], 'MUR': [, 'Rs'], 'MXN': ['MX$', '$'], 'MYR': [, 'RM'], 'NAD': [, '$'], 'NGN': [, '₦'], 'NIO': [, 'C$'], 'NOK': [, 'kr'], 'NPR': [, 'Rs'], 'NZD': ['NZ$', '$'], 'PHP': [, '₱'], 'PKR': [, 'Rs'], 'PLN': [, 'zł'], 'PYG': [, '₲'], 'RON': [, 'lei'], 'RUB': [, '₽'], 'RUR': [, 'р.'], 'RWF': [, 'RF'], 'SBD': [, '$'], 'SEK': [, 'kr'], 'SGD': [, '$'], 'SHP': [, '£'], 'SRD': [, '$'], 'SSP': [, '£'], 'STD': [, 'Db'], 'SYP': [, '£'], 'THB': [, '฿'], 'TOP': [, 'T$'], 'TRY': [, '₺'], 'TTD': [, '$'], 'TWD': ['NT$', '$'], 'UAH': [, '₴'], 'USD': ['$'], 'UYU': [, '$'], 'VEF': [, 'Bs'], 'VND': ['₫'], 'XAF': ['FCFA'], 'XCD': ['EC$', '$'], 'XOF': ['CFA'], 'XPF': ['CFPF'], 'ZAR': [, 'R'], 'ZMW': [, 'ZK'], }; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ // THIS CODE IS GENERATED - DO NOT MODIFY // See angular/tools/gulp-tasks/cldr/extract.js /** * @param {?} n * @return {?} */ function plural(n) { let /** @type {?} */ i = Math.floor(Math.abs(n)), /** @type {?} */ v = n.toString().replace(/^[^.]*\.?/, '').length; if (i === 1 && v === 0) return 1; return 5; } var localeEn = [ 'en', [ ['a', 'p'], ['AM', 'PM'], ], [ ['AM', 'PM'], , ], [ ['S', 'M', 'T', 'W', 'T', 'F', 'S'], ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'] ], , [ ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'], ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], [ 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' ] ], , [['B', 'A'], ['BC', 'AD'], ['Before Christ', 'Anno Domini']], 0, [6, 0], ['M/d/yy', 'MMM d, y', 'MMMM d, y', 'EEEE, MMMM d, y'], ['h:mm a', 'h:mm:ss a', 'h:mm:ss a z', 'h:mm:ss a zzzz'], [ '{1}, {0}', , '{1} \'at\' {0}', ], ['.', ',', ';', '%', '+', '-', 'E', '×', '‰', '∞', 'NaN', ':'], ['#,##0.###', '#,##0%', '¤#,##0.00', '#E0'], '$', 'US Dollar', plural ]; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * \@experimental i18n support is experimental. */ const LOCALE_DATA = {}; /** * Register global data to be used internally by Angular. See the * {\@linkDocs guide/i18n#i18n-pipes "I18n guide"} to know how to import additional locale data. * * \@experimental i18n support is experimental. * @param {?} data * @param {?=} localeId * @param {?=} extraData * @return {?} */ function registerLocaleData(data, localeId, extraData) { if (typeof localeId !== 'string') { extraData = localeId; localeId = data[0 /* LocaleId */]; } localeId = localeId.toLowerCase().replace(/_/g, '-'); LOCALE_DATA[localeId] = data; if (extraData) { LOCALE_DATA[localeId][18 /* ExtraData */] = extraData; } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** @enum {number} */ const NumberFormatStyle = { Decimal: 0, Percent: 1, Currency: 2, Scientific: 3, }; NumberFormatStyle[NumberFormatStyle.Decimal] = "Decimal"; NumberFormatStyle[NumberFormatStyle.Percent] = "Percent"; NumberFormatStyle[NumberFormatStyle.Currency] = "Currency"; NumberFormatStyle[NumberFormatStyle.Scientific] = "Scientific"; /** @enum {number} */ const Plural = { Zero: 0, One: 1, Two: 2, Few: 3, Many: 4, Other: 5, }; Plural[Plural.Zero] = "Zero"; Plural[Plural.One] = "One"; Plural[Plural.Two] = "Two"; Plural[Plural.Few] = "Few"; Plural[Plural.Many] = "Many"; Plural[Plural.Other] = "Other"; /** @enum {number} */ const FormStyle = { Format: 0, Standalone: 1, }; FormStyle[FormStyle.Format] = "Format"; FormStyle[FormStyle.Standalone] = "Standalone"; /** @enum {number} */ const TranslationWidth = { Narrow: 0, Abbreviated: 1, Wide: 2, Short: 3, }; TranslationWidth[TranslationWidth.Narrow] = "Narrow"; TranslationWidth[TranslationWidth.Abbreviated] = "Abbreviated"; TranslationWidth[TranslationWidth.Wide] = "Wide"; TranslationWidth[TranslationWidth.Short] = "Short"; /** @enum {number} */ const FormatWidth = { Short: 0, Medium: 1, Long: 2, Full: 3, }; FormatWidth[FormatWidth.Short] = "Short"; FormatWidth[FormatWidth.Medium] = "Medium"; FormatWidth[FormatWidth.Long] = "Long"; FormatWidth[FormatWidth.Full] = "Full"; /** @enum {number} */ const NumberSymbol = { Decimal: 0, Group: 1, List: 2, PercentSign: 3, PlusSign: 4, MinusSign: 5, Exponential: 6, SuperscriptingExponent: 7, PerMille: 8, Infinity: 9, NaN: 10, TimeSeparator: 11, CurrencyDecimal: 12, CurrencyGroup: 13, }; NumberSymbol[NumberSymbol.Decimal] = "Decimal"; NumberSymbol[NumberSymbol.Group] = "Group"; NumberSymbol[NumberSymbol.List] = "List"; NumberSymbol[NumberSymbol.PercentSign] = "PercentSign"; NumberSymbol[NumberSymbol.PlusSign] = "PlusSign"; NumberSymbol[NumberSymbol.MinusSign] = "MinusSign"; NumberSymbol[NumberSymbol.Exponential] = "Exponential"; NumberSymbol[NumberSymbol.SuperscriptingExponent] = "SuperscriptingExponent"; NumberSymbol[NumberSymbol.PerMille] = "PerMille"; NumberSymbol[NumberSymbol.Infinity] = "Infinity"; NumberSymbol[NumberSymbol.NaN] = "NaN"; NumberSymbol[NumberSymbol.TimeSeparator] = "TimeSeparator"; NumberSymbol[NumberSymbol.CurrencyDecimal] = "CurrencyDecimal"; NumberSymbol[NumberSymbol.CurrencyGroup] = "CurrencyGroup"; /** @enum {number} */ const WeekDay = { Sunday: 0, Monday: 1, Tuesday: 2, Wednesday: 3, Thursday: 4, Friday: 5, Saturday: 6, }; WeekDay[WeekDay.Sunday] = "Sunday"; WeekDay[WeekDay.Monday] = "Monday"; WeekDay[WeekDay.Tuesday] = "Tuesday"; WeekDay[WeekDay.Wednesday] = "Wednesday"; WeekDay[WeekDay.Thursday] = "Thursday"; WeekDay[WeekDay.Friday] = "Friday"; WeekDay[WeekDay.Saturday] = "Saturday"; /** * The locale id for the chosen locale (e.g `en-GB`). * * \@experimental i18n support is experimental. * @param {?} locale * @return {?} */ function getLocaleId(locale) { return findLocaleData(locale)[0 /* LocaleId */]; } /** * Periods of the day (e.g. `[AM, PM]` for en-US). * * \@experimental i18n support is experimental. * @param {?} locale * @param {?} formStyle * @param {?} width * @return {?} */ function getLocaleDayPeriods(locale, formStyle, width) { const /** @type {?} */ data = findLocaleData(locale); const /** @type {?} */ amPmData = /** @type {?} */ ([data[1 /* DayPeriodsFormat */], data[2 /* DayPeriodsStandalone */]]); const /** @type {?} */ amPm = getLastDefinedValue(amPmData, formStyle); return getLastDefinedValue(amPm, width); } /** * Days of the week for the Gregorian calendar (e.g. `[Sunday, Monday, ... Saturday]` for en-US). * * \@experimental i18n support is experimental. * @param {?} locale * @param {?} formStyle * @param {?} width * @return {?} */ function getLocaleDayNames(locale, formStyle, width) { const /** @type {?} */ data = findLocaleData(locale); const /** @type {?} */ daysData = /** @type {?} */ ([data[3 /* DaysFormat */], data[4 /* DaysStandalone */]]); const /** @type {?} */ days = getLastDefinedValue(daysData, formStyle); return getLastDefinedValue(days, width); } /** * Months of the year for the Gregorian calendar (e.g. `[January, February, ...]` for en-US). * * \@experimental i18n support is experimental. * @param {?} locale * @param {?} formStyle * @param {?} width * @return {?} */ function getLocaleMonthNames(locale, formStyle, width) { const /** @type {?} */ data = findLocaleData(locale); const /** @type {?} */ monthsData = /** @type {?} */ ([data[5 /* MonthsFormat */], data[6 /* MonthsStandalone */]]); const /** @type {?} */ months = getLastDefinedValue(monthsData, formStyle); return getLastDefinedValue(months, width); } /** * Eras for the Gregorian calendar (e.g. AD/BC). * * \@experimental i18n support is experimental. * @param {?} locale * @param {?} width * @return {?} */ function getLocaleEraNames(locale, width) { const /** @type {?} */ data = findLocaleData(locale); const /** @type {?} */ erasData = /** @type {?} */ (data[7 /* Eras */]); return getLastDefinedValue(erasData, width); } /** * First day of the week for this locale, based on english days (Sunday = 0, Monday = 1, ...). * For example in french the value would be 1 because the first day of the week is Monday. * * \@experimental i18n support is experimental. * @param {?} locale * @return {?} */ function getLocaleFirstDayOfWeek(locale) { const /** @type {?} */ data = findLocaleData(locale); return data[8 /* FirstDayOfWeek */]; } /** * Range of days in the week that represent the week-end for this locale, based on english days * (Sunday = 0, Monday = 1, ...). * For example in english the value would be [6,0] for Saturday to Sunday. * * \@experimental i18n support is experimental. * @param {?} locale * @return {?} */ function getLocaleWeekEndRange(locale) { const /** @type {?} */ data = findLocaleData(locale); return data[9 /* WeekendRange */]; } /** * Date format that depends on the locale. * * There are four basic date formats: * - `full` should contain long-weekday (EEEE), year (y), long-month (MMMM), day (d). * * For example, English uses `EEEE, MMMM d, y`, corresponding to a date like * "Tuesday, September 14, 1999". * * - `long` should contain year, long-month, day. * * For example, `MMMM d, y`, corresponding to a date like "September 14, 1999". * * - `medium` should contain year, abbreviated-month (MMM), day. * * For example, `MMM d, y`, corresponding to a date like "Sep 14, 1999". * For languages that do not use abbreviated months, use the numeric month (MM/M). For example, * `y/MM/dd`, corresponding to a date like "1999/09/14". * * - `short` should contain year, numeric-month (MM/M), and day. * * For example, `M/d/yy`, corresponding to a date like "9/14/99". * * \@experimental i18n support is experimental. * @param {?} locale * @param {?} width * @return {?} */ function getLocaleDateFormat(locale, width) { const /** @type {?} */ data = findLocaleData(locale); return getLastDefinedValue(data[10 /* DateFormat */], width); } /** * Time format that depends on the locale. * * The standard formats include four basic time formats: * - `full` should contain hour (h/H), minute (mm), second (ss), and zone (zzzz). * - `long` should contain hour, minute, second, and zone (z) * - `medium` should contain hour, minute, second. * - `short` should contain hour, minute. * * Note: The patterns depend on whether the main country using your language uses 12-hour time or * not: * - For 12-hour time, use a pattern like `hh:mm a` using h to mean a 12-hour clock cycle running * 1 through 12 (midnight plus 1 minute is 12:01), or using K to mean a 12-hour clock cycle * running 0 through 11 (midnight plus 1 minute is 0:01). * - For 24-hour time, use a pattern like `HH:mm` using H to mean a 24-hour clock cycle running 0 * through 23 (midnight plus 1 minute is 0:01), or using k to mean a 24-hour clock cycle running * 1 through 24 (midnight plus 1 minute is 24:01). * * \@experimental i18n support is experimental. * @param {?} locale * @param {?} width * @return {?} */ function getLocaleTimeFormat(locale, width) { const /** @type {?} */ data = findLocaleData(locale); return getLastDefinedValue(data[11 /* TimeFormat */], width); } /** * Date-time format that depends on the locale. * * The date-time pattern shows how to combine separate patterns for date (represented by {1}) * and time (represented by {0}) into a single pattern. It usually doesn't need to be changed. * What you want to pay attention to are: * - possibly removing a space for languages that don't use it, such as many East Asian languages * - possibly adding a comma, other punctuation, or a combining word * * For example: * - English uses `{1} 'at' {0}` or `{1}, {0}` (depending on date style), while Japanese uses * `{1}{0}`. * - An English formatted date-time using the combining pattern `{1}, {0}` could be * `Dec 10, 2010, 3:59:49 PM`. Notice the comma and space between the date portion and the time * portion. * * There are four formats (`full`, `long`, `medium`, `short`); the determination of which to use * is normally based on the date style. For example, if the date has a full month and weekday * name, the full combining pattern will be used to combine that with a time. If the date has * numeric month, the short version of the combining pattern will be used to combine that with a * time. English uses `{1} 'at' {0}` for full and long styles, and `{1}, {0}` for medium and short * styles. * * \@experimental i18n support is experimental. * @param {?} locale * @param {?} width * @return {?} */ function getLocaleDateTimeFormat(locale, width) { const /** @type {?} */ data = findLocaleData(locale); const /** @type {?} */ dateTimeFormatData = /** @type {?} */ (data[12 /* DateTimeFormat */]); return getLastDefinedValue(dateTimeFormatData, width); } /** * Number symbol that can be used to replace placeholders in number formats. * See {\@link NumberSymbol} for more information. * * \@experimental i18n support is experimental. * @param {?} locale * @param {?} symbol * @return {?} */ function getLocaleNumberSymbol(locale, symbol) { const /** @type {?} */ data = findLocaleData(locale); const /** @type {?} */ res = data[13 /* NumberSymbols */][symbol]; if (typeof res === 'undefined') { if (symbol === NumberSymbol.CurrencyDecimal) { return data[13 /* NumberSymbols */][NumberSymbol.Decimal]; } else if (symbol === NumberSymbol.CurrencyGroup) { return data[13 /* NumberSymbols */][NumberSymbol.Group]; } } return res; } /** * Number format that depends on the locale. * * Numbers are formatted using patterns, like `#,###.00`. For example, the pattern `#,###.00` * when used to format the number 12345.678 could result in "12'345,67". That would happen if the * grouping separator for your language is an apostrophe, and the decimal separator is a comma. * * <b>Important:</b> The characters `.` `,` `0` `#` (and others below) are special placeholders; * they stand for the decimal separator, and so on, and are NOT real characters. * You must NOT "translate" the placeholders; for example, don't change `.` to `,` even though in * your language the decimal point is written with a comma. The symbols should be replaced by the * local equivalents, using the Number Symbols for your language. * * Here are the special characters used in number patterns: * * | Symbol | Meaning | * |--------|---------| * | . | Replaced automatically by the character used for the decimal point. | * | , | Replaced by the "grouping" (thousands) separator. | * | 0 | Replaced by a digit (or zero if there aren't enough digits). | * | # | Replaced by a digit (or nothing if there aren't enough). | * | ¤ | This will be replaced by a currency symbol, such as $ or USD. | * | % | This marks a percent format. The % symbol may change position, but must be retained. | * | E | This marks a scientific format. The E symbol may change position, but must be retained. | * | ' | Special characters used as literal characters are quoted with ASCII single quotes. | * * You can find more information * [on the CLDR website](http://cldr.unicode.org/translation/number-patterns) * * \@experimental i18n support is experimental. * @param {?} locale * @param {?} type * @return {?} */ function getLocaleNumberFormat(locale, type) { const /** @type {?} */ data = findLocaleData(locale); return data[14 /* NumberFormats */][type]; } /** * The symbol used to represent the currency for the main country using this locale (e.g. $ for * the locale en-US). * The symbol will be `null` if the main country cannot be determined. * * \@experimental i18n support is experimental. * @param {?} locale * @return {?} */ function getLocaleCurrencySymbol(locale) { const /** @type {?} */ data = findLocaleData(locale); return data[15 /* CurrencySymbol */] || null; } /** * The name of the currency for the main country using this locale (e.g. USD for the locale * en-US). * The name will be `null` if the main country cannot be determined. * * \@experimental i18n support is experimental. * @param {?} locale * @return {?} */ function getLocaleCurrencyName(locale) { const /** @type {?} */ data = findLocaleData(locale); return data[16 /* CurrencyName */] || null; } /** * The locale plural function used by ICU expressions to determine the plural case to use. * See {\@link NgPlural} for more information. * * \@experimental i18n support is experimental. * @param {?} locale * @return {?} */ function getLocalePluralCase(locale) { const /** @type {?} */ data = findLocaleData(locale); return data[17 /* PluralCase */]; } /** * @param {?} data * @return {?} */ function checkFullData(data) { if (!data[18 /* ExtraData */]) { throw new Error(`Missing extra locale data for the locale "${data[0 /* LocaleId */]}". Use "registerLocaleData" to load new data. See the "I18n guide" on angular.io to know more.`); } } /** * Rules used to determine which day period to use (See `dayPeriods` below). * The rules can either be an array or a single value. If it's an array, consider it as "from" * and "to". If it's a single value then it means that the period is only valid at this exact * value. * There is always the same number of rules as the number of day periods, which means that the * first rule is applied to the first day period and so on. * You should fallback to AM/PM when there are no rules available. * * Note: this is only available if you load the full locale data. * See the {\@linkDocs guide/i18n#i18n-pipes "I18n guide"} to know how to import additional locale * data. * * \@experimental i18n support is experimental. * @param {?} locale * @return {?} */ function getLocaleExtraDayPeriodRules(locale) { const /** @type {?} */ data = findLocaleData(locale); checkFullData(data); const /** @type {?} */ rules = data[18 /* ExtraData */][2 /* ExtraDayPeriodsRules */] || []; return rules.map((rule) => { if (typeof rule === 'string') { return extractTime(rule); } return [extractTime(rule[0]), extractTime(rule[1])]; }); } /** * Day Periods indicate roughly how the day is broken up in different languages (e.g. morning, * noon, afternoon, midnight, ...). * You should use the function {\@link getLocaleExtraDayPeriodRules} to determine which period to * use. * You should fallback to AM/PM when there are no day periods available. * * Note: this is only available if you load the full locale data. * See the {\@linkDocs guide/i18n#i18n-pipes "I18n guide"} to know how to import additional locale * data. * * \@experimental i18n support is experimental. * @param {?} locale * @param {?} formStyle * @param {?} width * @return {?} */ function getLocaleExtraDayPeriods(locale, formStyle, width) { const /** @type {?} */ data = findLocaleData(locale); checkFullData(data); const /** @type {?} */ dayPeriodsData = /** @type {?} */ ([ data[18 /* ExtraData */][0 /* ExtraDayPeriodFormats */], data[18 /* ExtraData */][1 /* ExtraDayPeriodStandalone */] ]); const /** @type {?} */ dayPeriods = getLastDefinedValue(dayPeriodsData, formStyle) || []; return getLastDefinedValue(dayPeriods, width) || []; } /** * Returns the first value that is defined in an array, going backwards. * * To avoid repeating the same data (e.g. when "format" and "standalone" are the same) we only * add the first one to the locale data arrays, the other ones are only defined when different. * We use this function to retrieve the first defined value. * * \@experimental i18n support is experimental. * @template T * @param {?} data * @param {?} index * @return {?} */ function getLastDefinedValue(data, index) { for (let /** @type {?} */ i = index; i > -1; i--) { if (typeof data[i] !== 'undefined') { return data[i]; } } throw new Error('Locale data API: locale data undefined'); } /** * Extract the hours and minutes from a string like "15:45" * @param {?} time * @return {?} */ function extractTime(time) { const [h, m] = time.split(':'); return { hours: +h, minutes: +m }; } /** * Finds the locale data for a locale id * * \@experimental i18n support is experimental. * @param {?} locale * @return {?} */ function findLocaleData(locale) { const /** @type {?} */ normalizedLocale = locale.toLowerCase().replace(/_/g, '-'); let /** @type {?} */ match = LOCALE_DATA[normalizedLocale]; if (match) { return match; } // let's try to find a parent locale const /** @type {?} */ parentLocale = normalizedLocale.split('-')[0]; match = LOCALE_DATA[parentLocale]; if (match) { return match; } if (parentLocale === 'en') { return localeEn; } throw new Error(`Missing locale data for the locale "${locale}".`); } /** * Return the currency symbol for a given currency code, or the code if no symbol available * (e.g.: format narrow = $, format wide = US$, code = USD) * * \@experimental i18n support is experimental. * @param {?} code * @param {?} format * @return {?} */ function getCurrencySymbol(code, format) { const /** @type {?} */ currency = CURRENCIES[code] || []; const /** @type {?} */ symbolNarrow = currency[1]; if (format === 'narrow' && typeof symbolNarrow === 'string') { return symbolNarrow; } return currency[0] || code; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @deprecated from v5 */ const DEPRECATED_PLURAL_FN = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["InjectionToken"]('UseV4Plurals'); /** * \@experimental * @abstract */ class NgLocalization { } /** * Returns the plural category for a given value. * - "=value" when the case exists, * - the plural category otherwise * @param {?} value * @param {?} cases * @param {?} ngLocalization * @param {?=} locale * @return {?} */ function getPluralCategory(value, cases, ngLocalization, locale) { let /** @type {?} */ key = `=${value}`; if (cases.indexOf(key) > -1) { return key; } key = ngLocalization.getPluralCategory(value, locale); if (cases.indexOf(key) > -1) { return key; } if (cases.indexOf('other') > -1) { return 'other'; } throw new Error(`No plural message found for value "${value}"`); } /** * Returns the plural case based on the locale * * \@experimental */ class NgLocaleLocalization extends NgLocalization { /** * @param {?} locale * @param {?=} deprecatedPluralFn */ constructor(locale, /** @deprecated from v5 */ deprecatedPluralFn) { super(); this.locale = locale; this.deprecatedPluralFn = deprecatedPluralFn; } /** * @param {?} value * @param {?=} locale * @return {?} */ getPluralCategory(value, locale) { const /** @type {?} */ plural = this.deprecatedPluralFn ? this.deprecatedPluralFn(locale || this.locale, value) : getLocalePluralCase(locale || this.locale)(value); switch (plural) { case Plural.Zero: return 'zero'; case Plural.One: return 'one'; case Plural.Two: return 'two'; case Plural.Few: return 'few'; case Plural.Many: return 'many'; default: return 'other'; } } } NgLocaleLocalization.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Injectable"] }, ]; /** @nocollapse */ NgLocaleLocalization.ctorParameters = () => [ { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Inject"], args: [__WEBPACK_IMPORTED_MODULE_0__angular_core__["LOCALE_ID"],] },] }, { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Optional"] }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Inject"], args: [DEPRECATED_PLURAL_FN,] },] }, ]; /** * Returns the plural case based on the locale * * @deprecated from v5 the plural case function is in locale data files common/locales/*.ts * \@experimental * @param {?} locale * @param {?} nLike * @return {?} */ function getPluralCase(locale, nLike) { // TODO(vicb): lazy compute if (typeof nLike === 'string') { nLike = parseInt(/** @type {?} */ (nLike), 10); } const /** @type {?} */ n = /** @type {?} */ (nLike); const /** @type {?} */ nDecimal = n.toString().replace(/^[^.]*\.?/, ''); const /** @type {?} */ i = Math.floor(Math.abs(n)); const /** @type {?} */ v = nDecimal.length; const /** @type {?} */ f = parseInt(nDecimal, 10); const /** @type {?} */ t = parseInt(n.toString().replace(/^[^.]*\.?|0+$/g, ''), 10) || 0; const /** @type {?} */ lang = locale.split('-')[0].toLowerCase(); switch (lang) { case 'af': case 'asa': case 'az': case 'bem': case 'bez': case 'bg': case 'brx': case 'ce': case 'cgg': case 'chr': case 'ckb': case 'ee': case 'el': case 'eo': case 'es': case 'eu': case 'fo': case 'fur': case 'gsw': case 'ha': case 'haw': case 'hu': case 'jgo': case 'jmc': case 'ka': case 'kk': case 'kkj': case 'kl': case 'ks': case 'ksb': case 'ky': case 'lb': case 'lg': case 'mas': case 'mgo': case 'ml': case 'mn': case 'nb': case 'nd': case 'ne': case 'nn': case 'nnh': case 'nyn': case 'om': case 'or': case 'os': case 'ps': case 'rm': case 'rof': case 'rwk': case 'saq': case 'seh': case 'sn': case 'so': case 'sq': case 'ta': case 'te': case 'teo': case 'tk': case 'tr': case 'ug': case 'uz': case 'vo': case 'vun': case 'wae': case 'xog': if (n === 1) return Plural.One; return Plural.Other; case 'ak': case 'ln': case 'mg': case 'pa': case 'ti': if (n === Math.floor(n) && n >= 0 && n <= 1) return Plural.One; return Plural.Other; case 'am': case 'as': case 'bn': case 'fa': case 'gu': case 'hi': case 'kn': case 'mr': case 'zu': if (i === 0 || n === 1) return Plural.One; return Plural.Other; case 'ar': if (n === 0) return Plural.Zero; if (n === 1) return Plural.One; if (n === 2) return Plural.Two; if (n % 100 === Math.floor(n % 100) && n % 100 >= 3 && n % 100 <= 10) return Plural.Few; if (n % 100 === Math.floor(n % 100) && n % 100 >= 11 && n % 100 <= 99) return Plural.Many; return Plural.Other; case 'ast': case 'ca': case 'de': case 'en': case 'et': case 'fi': case 'fy': case 'gl': case 'it': case 'nl': case 'sv': case 'sw': case 'ur': case 'yi': if (i === 1 && v === 0) return Plural.One; return Plural.Other; case 'be': if (n % 10 === 1 && !(n % 100 === 11)) return Plural.One; if (n % 10 === Math.floor(n % 10) && n % 10 >= 2 && n % 10 <= 4 && !(n % 100 >= 12 && n % 100 <= 14)) return Plural.Few; if (n % 10 === 0 || n % 10 === Math.floor(n % 10) && n % 10 >= 5 && n % 10 <= 9 || n % 100 === Math.floor(n % 100) && n % 100 >= 11 && n % 100 <= 14) return Plural.Many; return Plural.Other; case 'br': if (n % 10 === 1 && !(n % 100 === 11 || n % 100 === 71 || n % 100 === 91)) return Plural.One; if (n % 10 === 2 && !(n % 100 === 12 || n % 100 === 72 || n % 100 === 92)) return Plural.Two; if (n % 10 === Math.floor(n % 10) && (n % 10 >= 3 && n % 10 <= 4 || n % 10 === 9) && !(n % 100 >= 10 && n % 100 <= 19 || n % 100 >= 70 && n % 100 <= 79 || n % 100 >= 90 && n % 100 <= 99)) return Plural.Few; if (!(n === 0) && n % 1e6 === 0) return Plural.Many; return Plural.Other; case 'bs': case 'hr': case 'sr': if (v === 0 && i % 10 === 1 && !(i % 100 === 11) || f % 10 === 1 && !(f % 100 === 11)) return Plural.One; if (v === 0 && i % 10 === Math.floor(i % 10) && i % 10 >= 2 && i % 10 <= 4 && !(i % 100 >= 12 && i % 100 <= 14) || f % 10 === Math.floor(f % 10) && f % 10 >= 2 && f % 10 <= 4 && !(f % 100 >= 12 && f % 100 <= 14)) return Plural.Few; return Plural.Other; case 'cs': case 'sk': if (i === 1 && v === 0) return Plural.One; if (i === Math.floor(i) && i >= 2 && i <= 4 && v === 0) return Plural.Few; if (!(v === 0)) return Plural.Many; return Plural.Other; case 'cy': if (n === 0) return Plural.Zero; if (n === 1) return Plural.One; if (n === 2) return Plural.Two; if (n === 3) return Plural.Few; if (n === 6) return Plural.Many; return Plural.Other; case 'da': if (n === 1 || !(t === 0) && (i === 0 || i === 1)) return Plural.One; return Plural.Other; case 'dsb': case 'hsb': if (v === 0 && i % 100 === 1 || f % 100 === 1) return Plural.One; if (v === 0 && i % 100 === 2 || f % 100 === 2) return Plural.Two; if (v === 0 && i % 100 === Math.floor(i % 100) && i % 100 >= 3 && i % 100 <= 4 || f % 100 === Math.floor(f % 100) && f % 100 >= 3 && f % 100 <= 4) return Plural.Few; return Plural.Other; case 'ff': case 'fr': case 'hy': case 'kab': if (i === 0 || i === 1) return Plural.One; return Plural.Other; case 'fil': if (v === 0 && (i === 1 || i === 2 || i === 3) || v === 0 && !(i % 10 === 4 || i % 10 === 6 || i % 10 === 9) || !(v === 0) && !(f % 10 === 4 || f % 10 === 6 || f % 10 === 9)) return Plural.One; return Plural.Other; case 'ga': if (n === 1) return Plural.One; if (n === 2) return Plural.Two; if (n === Math.floor(n) && n >= 3 && n <= 6) return Plural.Few; if (n === Math.floor(n) && n >= 7 && n <= 10) return Plural.Many; return Plural.Other; case 'gd': if (n === 1 || n === 11) return Plural.One; if (n === 2 || n === 12) return Plural.Two; if (n === Math.floor(n) && (n >= 3 && n <= 10 || n >= 13 && n <= 19)) return Plural.Few; return Plural.Other; case 'gv': if (v === 0 && i % 10 === 1) return Plural.One; if (v === 0 && i % 10 === 2) return Plural.Two; if (v === 0 && (i % 100 === 0 || i % 100 === 20 || i % 100 === 40 || i % 100 === 60 || i % 100 === 80)) return Plural.Few; if (!(v === 0)) return Plural.Many; return Plural.Other; case 'he': if (i === 1 && v === 0) return Plural.One; if (i === 2 && v === 0) return Plural.Two; if (v === 0 && !(n >= 0 && n <= 10) && n % 10 === 0) return Plural.Many; return Plural.Other; case 'is': if (t === 0 && i % 10 === 1 && !(i % 100 === 11) || !(t === 0)) return Plural.One; return Plural.Other; case 'ksh': if (n === 0) return Plural.Zero; if (n === 1) return Plural.One; return Plural.Other; case 'kw': case 'naq': case 'se': case 'smn': if (n === 1) return Plural.One; if (n === 2) return Plural.Two; return Plural.Other; case 'lag': if (n === 0) return Plural.Zero; if ((i === 0 || i === 1) && !(n === 0)) return Plural.One; return Plural.Other; case 'lt': if (n % 10 === 1 && !(n % 100 >= 11 && n % 100 <= 19)) return Plural.One; if (n % 10 === Math.floor(n % 10) && n % 10 >= 2 && n % 10 <= 9 && !(n % 100 >= 11 && n % 100 <= 19)) return Plural.Few; if (!(f === 0)) return Plural.Many; return Plural.Other; case 'lv': case 'prg': if (n % 10 === 0 || n % 100 === Math.floor(n % 100) && n % 100 >= 11 && n % 100 <= 19 || v === 2 && f % 100 === Math.floor(f % 100) && f % 100 >= 11 && f % 100 <= 19) return Plural.Zero; if (n % 10 === 1 && !(n % 100 === 11) || v === 2 && f % 10 === 1 && !(f % 100 === 11) || !(v === 2) && f % 10 === 1) return Plural.One; return Plural.Other; case 'mk': if (v === 0 && i % 10 === 1 || f % 10 === 1) return Plural.One; return Plural.Other; case 'mt': if (n === 1) return Plural.One; if (n === 0 || n % 100 === Math.floor(n % 100) && n % 100 >= 2 && n % 100 <= 10) return Plural.Few; if (n % 100 === Math.floor(n % 100) && n % 100 >= 11 && n % 100 <= 19) return Plural.Many; return Plural.Other; case 'pl': if (i === 1 && v === 0) return Plural.One; if (v === 0 && i % 10 === Math.floor(i % 10) && i % 10 >= 2 && i % 10 <= 4 && !(i % 100 >= 12 && i % 100 <= 14)) return Plural.Few; if (v === 0 && !(i === 1) && i % 10 === Math.floor(i % 10) && i % 10 >= 0 && i % 10 <= 1 || v === 0 && i % 10 === Math.floor(i % 10) && i % 10 >= 5 && i % 10 <= 9 || v === 0 && i % 100 === Math.floor(i % 100) && i % 100 >= 12 && i % 100 <= 14) return Plural.Many; return Plural.Other; case 'pt': if (n === Math.floor(n) && n >= 0 && n <= 2 && !(n === 2)) return Plural.One; return Plural.Other; case 'ro': if (i === 1 && v === 0) return Plural.One; if (!(v === 0) || n === 0 || !(n === 1) && n % 100 === Math.floor(n % 100) && n % 100 >= 1 && n % 100 <= 19) return Plural.Few; return Plural.Other; case 'ru': case 'uk': if (v === 0 && i % 10 === 1 && !(i % 100 === 11)) return Plural.One; if (v === 0 && i % 10 === Math.floor(i % 10) && i % 10 >= 2 && i % 10 <= 4 && !(i % 100 >= 12 && i % 100 <= 14)) return Plural.Few; if (v === 0 && i % 10 === 0 || v === 0 && i % 10 === Math.floor(i % 10) && i % 10 >= 5 && i % 10 <= 9 || v === 0 && i % 100 === Math.floor(i % 100) && i % 100 >= 11 && i % 100 <= 14) return Plural.Many; return Plural.Other; case 'shi': if (i === 0 || n === 1) return Plural.One; if (n === Math.floor(n) && n >= 2 && n <= 10) return Plural.Few; return Plural.Other; case 'si': if (n === 0 || n === 1 || i === 0 && f === 1) return Plural.One; return Plural.Other; case 'sl': if (v === 0 && i % 100 === 1) return Plural.One; if (v === 0 && i % 100 === 2) return Plural.Two; if (v === 0 && i % 100 === Math.floor(i % 100) && i % 100 >= 3 && i % 100 <= 4 || !(v === 0)) return Plural.Few; return Plural.Other; case 'tzm': if (n === Math.floor(n) && n >= 0 && n <= 1 || n === Math.floor(n) && n >= 11 && n <= 99) return Plural.One; return Plural.Other; // When there is no specification, the default is always "other" // Spec: http://cldr.unicode.org/index/cldr-spec/plural-rules // > other (required—general plural form — also used if the language only has a single form) default: return Plural.Other; } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @param {?} cookieStr * @param {?} name * @return {?} */ function parseCookieValue(cookieStr, name) { name = encodeURIComponent(name); for (const /** @type {?} */ cookie of cookieStr.split(';')) { const /** @type {?} */ eqIndex = cookie.indexOf('='); const [cookieName, cookieValue] = eqIndex == -1 ? [cookie, ''] : [cookie.slice(0, eqIndex), cookie.slice(eqIndex + 1)]; if (cookieName.trim() === name) { return decodeURIComponent(cookieValue); } } return null; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * \@ngModule CommonModule * * \@whatItDoes Adds and removes CSS classes on an HTML element. * * \@howToUse * ``` * <some-element [ngClass]="'first second'">...</some-element> * * <some-element [ngClass]="['first', 'second']">...</some-element> * * <some-element [ngClass]="{'first': true, 'second': true, 'third': false}">...</some-element> * * <some-element [ngClass]="stringExp|arrayExp|objExp">...</some-element> * * <some-element [ngClass]="{'class1 class2 class3' : true}">...</some-element> * ``` * * \@description * * The CSS classes are updated as follows, depending on the type of the expression evaluation: * - `string` - the CSS classes listed in the string (space delimited) are added, * - `Array` - the CSS classes declared as Array elements are added, * - `Object` - keys are CSS classes that get added when the expression given in the value * evaluates to a truthy value, otherwise they are removed. * * \@stable */ class NgClass { /** * @param {?} _iterableDiffers * @param {?} _keyValueDiffers * @param {?} _ngEl * @param {?} _renderer */ constructor(_iterableDiffers, _keyValueDiffers, _ngEl, _renderer) { this._iterableDiffers = _iterableDiffers; this._keyValueDiffers = _keyValueDiffers; this._ngEl = _ngEl; this._renderer = _renderer; this._initialClasses = []; } /** * @param {?} v * @return {?} */ set klass(v) { this._removeClasses(this._initialClasses); this._initialClasses = typeof v === 'string' ? v.split(/\s+/) : []; this._applyClasses(this._initialClasses); this._applyClasses(this._rawClass); } /** * @param {?} v * @return {?} */ set ngClass(v) { this._removeClasses(this._rawClass); this._applyClasses(this._initialClasses); this._iterableDiffer = null; this._keyValueDiffer = null; this._rawClass = typeof v === 'string' ? v.split(/\s+/) : v; if (this._rawClass) { if (Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["ɵisListLikeIterable"])(this._rawClass)) { this._iterableDiffer = this._iterableDiffers.find(this._rawClass).create(); } else { this._keyValueDiffer = this._keyValueDiffers.find(this._rawClass).create(); } } } /** * @return {?} */ ngDoCheck() { if (this._iterableDiffer) { const /** @type {?} */ iterableChanges = this._iterableDiffer.diff(/** @type {?} */ (this._rawClass)); if (iterableChanges) { this._applyIterableChanges(iterableChanges); } } else if (this._keyValueDiffer) { const /** @type {?} */ keyValueChanges = this._keyValueDiffer.diff(/** @type {?} */ (this._rawClass)); if (keyValueChanges) { this._applyKeyValueChanges(keyValueChanges); } } } /** * @param {?} changes * @return {?} */ _applyKeyValueChanges(changes) { changes.forEachAddedItem((record) => this._toggleClass(record.key, record.currentValue)); changes.forEachChangedItem((record) => this._toggleClass(record.key, record.currentValue)); changes.forEachRemovedItem((record) => { if (record.previousValue) { this._toggleClass(record.key, false); } }); } /** * @param {?} changes * @return {?} */ _applyIterableChanges(changes) { changes.forEachAddedItem((record) => { if (typeof record.item === 'string') { this._toggleClass(record.item, true); } else { throw new Error(`NgClass can only toggle CSS classes expressed as strings, got ${Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["ɵstringify"])(record.item)}`); } }); changes.forEachRemovedItem((record) => this._toggleClass(record.item, false)); } /** * Applies a collection of CSS classes to the DOM element. * * For argument of type Set and Array CSS class names contained in those collections are always * added. * For argument of type Map CSS class name in the map's key is toggled based on the value (added * for truthy and removed for falsy). * @param {?} rawClassVal * @return {?} */ _applyClasses(rawClassVal) { if (rawClassVal) { if (Array.isArray(rawClassVal) || rawClassVal instanceof Set) { (/** @type {?} */ (rawClassVal)).forEach((klass) => this._toggleClass(klass, true)); } else { Object.keys(rawClassVal).forEach(klass => this._toggleClass(klass, !!rawClassVal[klass])); } } } /** * Removes a collection of CSS classes from the DOM element. This is mostly useful for cleanup * purposes. * @param {?} rawClassVal * @return {?} */ _removeClasses(rawClassVal) { if (rawClassVal) { if (Array.isArray(rawClassVal) || rawClassVal instanceof Set) { (/** @type {?} */ (rawClassVal)).forEach((klass) => this._toggleClass(klass, false)); } else { Object.keys(rawClassVal).forEach(klass => this._toggleClass(klass, false)); } } } /** * @param {?} klass * @param {?} enabled * @return {?} */ _toggleClass(klass, enabled) { klass = klass.trim(); if (klass) { klass.split(/\s+/g).forEach(klass => { if (enabled) { this._renderer.addClass(this._ngEl.nativeElement, klass); } else { this._renderer.removeClass(this._ngEl.nativeElement, klass); } }); } } } NgClass.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: '[ngClass]' },] }, ]; /** @nocollapse */ NgClass.ctorParameters = () => [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["IterableDiffers"], }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["KeyValueDiffers"], }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ElementRef"], }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Renderer2"], }, ]; NgClass.propDecorators = { "klass": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"], args: ['class',] },], "ngClass": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], }; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * Instantiates a single {\@link Component} type and inserts its Host View into current View. * `NgComponentOutlet` provides a declarative approach for dynamic component creation. * * `NgComponentOutlet` requires a component type, if a falsy value is set the view will clear and * any existing component will get destroyed. * * ### Fine tune control * * You can control the component creation process by using the following optional attributes: * * * `ngComponentOutletInjector`: Optional custom {\@link Injector} that will be used as parent for * the Component. Defaults to the injector of the current view container. * * * `ngComponentOutletContent`: Optional list of projectable nodes to insert into the content * section of the component, if exists. * * * `ngComponentOutletNgModuleFactory`: Optional module factory to allow dynamically loading other * module, then load a component from that module. * * ### Syntax * * Simple * ``` * <ng-container *ngComponentOutlet="componentTypeExpression"></ng-container> * ``` * * Customized injector/content * ``` * <ng-container *ngComponentOutlet="componentTypeExpression; * injector: injectorExpression; * content: contentNodesExpression;"> * </ng-container> * ``` * * Customized ngModuleFactory * ``` * <ng-container *ngComponentOutlet="componentTypeExpression; * ngModuleFactory: moduleFactory;"> * </ng-container> * ``` * ## Example * * {\@example common/ngComponentOutlet/ts/module.ts region='SimpleExample'} * * A more complete example with additional options: * * {\@example common/ngComponentOutlet/ts/module.ts region='CompleteExample'} * A more complete example with ngModuleFactory: * * {\@example common/ngComponentOutlet/ts/module.ts region='NgModuleFactoryExample'} * * \@experimental */ class NgComponentOutlet { /** * @param {?} _viewContainerRef */ constructor(_viewContainerRef) { this._viewContainerRef = _viewContainerRef; this._componentRef = null; this._moduleRef = null; } /** * @param {?} changes * @return {?} */ ngOnChanges(changes) { this._viewContainerRef.clear(); this._componentRef = null; if (this.ngComponentOutlet) { const /** @type {?} */ elInjector = this.ngComponentOutletInjector || this._viewContainerRef.parentInjector; if (changes['ngComponentOutletNgModuleFactory']) { if (this._moduleRef) this._moduleRef.destroy(); if (this.ngComponentOutletNgModuleFactory) { const /** @type {?} */ parentModule = elInjector.get(__WEBPACK_IMPORTED_MODULE_0__angular_core__["NgModuleRef"]); this._moduleRef = this.ngComponentOutletNgModuleFactory.create(parentModule.injector); } else { this._moduleRef = null; } } const /** @type {?} */ componentFactoryResolver = this._moduleRef ? this._moduleRef.componentFactoryResolver : elInjector.get(__WEBPACK_IMPORTED_MODULE_0__angular_core__["ComponentFactoryResolver"]); const /** @type {?} */ componentFactory = componentFactoryResolver.resolveComponentFactory(this.ngComponentOutlet); this._componentRef = this._viewContainerRef.createComponent(componentFactory, this._viewContainerRef.length, elInjector, this.ngComponentOutletContent); } } /** * @return {?} */ ngOnDestroy() { if (this._moduleRef) this._moduleRef.destroy(); } } NgComponentOutlet.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: '[ngComponentOutlet]' },] }, ]; /** @nocollapse */ NgComponentOutlet.ctorParameters = () => [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ViewContainerRef"], }, ]; NgComponentOutlet.propDecorators = { "ngComponentOutlet": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "ngComponentOutletInjector": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "ngComponentOutletContent": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "ngComponentOutletNgModuleFactory": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], }; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * \@stable * @template T */ class NgForOfContext { /** * @param {?} $implicit * @param {?} ngForOf * @param {?} index * @param {?} count */ constructor($implicit, ngForOf, index, count) { this.$implicit = $implicit; this.ngForOf = ngForOf; this.index = index; this.count = count; } /** * @return {?} */ get first() { return this.index === 0; } /** * @return {?} */ get last() { return this.index === this.count - 1; } /** * @return {?} */ get even() { return this.index % 2 === 0; } /** * @return {?} */ get odd() { return !this.even; } } /** * The `NgForOf` directive instantiates a template once per item from an iterable. The context * for each instantiated template inherits from the outer context with the given loop variable * set to the current item from the iterable. * * ### Local Variables * * `NgForOf` provides several exported values that can be aliased to local variables: * * - `$implicit: T`: The value of the individual items in the iterable (`ngForOf`). * - `ngForOf: NgIterable<T>`: The value of the iterable expression. Useful when the expression is * more complex then a property access, for example when using the async pipe (`userStreams | * async`). * - `index: number`: The index of the current item in the iterable. * - `first: boolean`: True when the item is the first item in the iterable. * - `last: boolean`: True when the item is the last item in the iterable. * - `even: boolean`: True when the item has an even index in the iterable. * - `odd: boolean`: True when the item has an odd index in the iterable. * * ``` * <li *ngFor="let user of userObservable | async as users; index as i; first as isFirst"> * {{i}}/{{users.length}}. {{user}} <span *ngIf="isFirst">default</span> * </li> * ``` * * ### Change Propagation * * When the contents of the iterator changes, `NgForOf` makes the corresponding changes to the DOM: * * * When an item is added, a new instance of the template is added to the DOM. * * When an item is removed, its template instance is removed from the DOM. * * When items are reordered, their respective templates are reordered in the DOM. * * Otherwise, the DOM element for that item will remain the same. * * Angular uses object identity to track insertions and deletions within the iterator and reproduce * those changes in the DOM. This has important implications for animations and any stateful * controls (such as `<input>` elements which accept user input) that are present. Inserted rows can * be animated in, deleted rows can be animated out, and unchanged rows retain any unsaved state * such as user input. * * It is possible for the identities of elements in the iterator to change while the data does not. * This can happen, for example, if the iterator produced from an RPC to the server, and that * RPC is re-run. Even if the data hasn't changed, the second response will produce objects with * different identities, and Angular will tear down the entire DOM and rebuild it (as if all old * elements were deleted and all new elements inserted). This is an expensive operation and should * be avoided if possible. * * To customize the default tracking algorithm, `NgForOf` supports `trackBy` option. * `trackBy` takes a function which has two arguments: `index` and `item`. * If `trackBy` is given, Angular tracks changes by the return value of the function. * * ### Syntax * * - `<li *ngFor="let item of items; index as i; trackBy: trackByFn">...</li>` * * With `<ng-template>` element: * * ``` * <ng-template ngFor let-item [ngForOf]="items" let-i="index" [ngForTrackBy]="trackByFn"> * <li>...</li> * </ng-template> * ``` * * ### Example * * See a [live demo](http://plnkr.co/edit/KVuXxDp0qinGDyo307QW?p=preview) for a more detailed * example. * * \@stable * @template T */ class NgForOf { /** * @param {?} _viewContainer * @param {?} _template * @param {?} _differs */ constructor(_viewContainer, _template, _differs) { this._viewContainer = _viewContainer; this._template = _template; this._differs = _differs; this._differ = null; } /** * @param {?} fn * @return {?} */ set ngForTrackBy(fn) { if (Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["isDevMode"])() && fn != null && typeof fn !== 'function') { // TODO(vicb): use a log service once there is a public one available if (/** @type {?} */ (console) && /** @type {?} */ (console.warn)) { console.warn(`trackBy must be a function, but received ${JSON.stringify(fn)}. ` + `See https://angular.io/docs/ts/latest/api/common/index/NgFor-directive.html#!#change-propagation for more information.`); } } this._trackByFn = fn; } /** * @return {?} */ get ngForTrackBy() { return this._trackByFn; } /** * @param {?} value * @return {?} */ set ngForTemplate(value) { // TODO(TS2.1): make TemplateRef<Partial<NgForRowOf<T>>> once we move to TS v2.1 // The current type is too restrictive; a template that just uses index, for example, // should be acceptable. if (value) { this._template = value; } } /** * @param {?} changes * @return {?} */ ngOnChanges(changes) { if ('ngForOf' in changes) { // React on ngForOf changes only once all inputs have been initialized const /** @type {?} */ value = changes['ngForOf'].currentValue; if (!this._differ && value) { try { this._differ = this._differs.find(value).create(this.ngForTrackBy); } catch (/** @type {?} */ e) { throw new Error(`Cannot find a differ supporting object '${value}' of type '${getTypeNameForDebugging(value)}'. NgFor only supports binding to Iterables such as Arrays.`); } } } } /** * @return {?} */ ngDoCheck() { if (this._differ) { const /** @type {?} */ changes = this._differ.diff(this.ngForOf); if (changes) this._applyChanges(changes); } } /** * @param {?} changes * @return {?} */ _applyChanges(changes) { const /** @type {?} */ insertTuples = []; changes.forEachOperation((item, adjustedPreviousIndex, currentIndex) => { if (item.previousIndex == null) { const /** @type {?} */ view = this._viewContainer.createEmbeddedView(this._template, new NgForOfContext(/** @type {?} */ ((null)), this.ngForOf, -1, -1), currentIndex); const /** @type {?} */ tuple = new RecordViewTuple(item, view); insertTuples.push(tuple); } else if (currentIndex == null) { this._viewContainer.remove(adjustedPreviousIndex); } else { const /** @type {?} */ view = /** @type {?} */ ((this._viewContainer.get(adjustedPreviousIndex))); this._viewContainer.move(view, currentIndex); const /** @type {?} */ tuple = new RecordViewTuple(item, /** @type {?} */ (view)); insertTuples.push(tuple); } }); for (let /** @type {?} */ i = 0; i < insertTuples.length; i++) { this._perViewChange(insertTuples[i].view, insertTuples[i].record); } for (let /** @type {?} */ i = 0, /** @type {?} */ ilen = this._viewContainer.length; i < ilen; i++) { const /** @type {?} */ viewRef = /** @type {?} */ (this._viewContainer.get(i)); viewRef.context.index = i; viewRef.context.count = ilen; } changes.forEachIdentityChange((record) => { const /** @type {?} */ viewRef = /** @type {?} */ (this._viewContainer.get(record.currentIndex)); viewRef.context.$implicit = record.item; }); } /** * @param {?} view * @param {?} record * @return {?} */ _perViewChange(view, record) { view.context.$implicit = record.item; } } NgForOf.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: '[ngFor][ngForOf]' },] }, ]; /** @nocollapse */ NgForOf.ctorParameters = () => [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ViewContainerRef"], }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["TemplateRef"], }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["IterableDiffers"], }, ]; NgForOf.propDecorators = { "ngForOf": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "ngForTrackBy": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "ngForTemplate": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], }; /** * @template T */ class RecordViewTuple { /** * @param {?} record * @param {?} view */ constructor(record, view) { this.record = record; this.view = view; } } /** * @param {?} type * @return {?} */ function getTypeNameForDebugging(type) { return type['name'] || typeof type; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * Conditionally includes a template based on the value of an `expression`. * * `ngIf` evaluates the `expression` and then renders the `then` or `else` template in its place * when expression is truthy or falsy respectively. Typically the: * - `then` template is the inline template of `ngIf` unless bound to a different value. * - `else` template is blank unless it is bound. * * ## Most common usage * * The most common usage of the `ngIf` directive is to conditionally show the inline template as * seen in this example: * {\@example common/ngIf/ts/module.ts region='NgIfSimple'} * * ## Showing an alternative template using `else` * * If it is necessary to display a template when the `expression` is falsy use the `else` template * binding as shown. Note that the `else` binding points to a `<ng-template>` labeled `#elseBlock`. * The template can be defined anywhere in the component view but is typically placed right after * `ngIf` for readability. * * {\@example common/ngIf/ts/module.ts region='NgIfElse'} * * ## Using non-inlined `then` template * * Usually the `then` template is the inlined template of the `ngIf`, but it can be changed using * a binding (just like `else`). Because `then` and `else` are bindings, the template references can * change at runtime as shown in this example. * * {\@example common/ngIf/ts/module.ts region='NgIfThenElse'} * * ## Storing conditional result in a variable * * A common pattern is that we need to show a set of properties from the same object. If the * object is undefined, then we have to use the safe-traversal-operator `?.` to guard against * dereferencing a `null` value. This is especially the case when waiting on async data such as * when using the `async` pipe as shown in following example: * * ``` * Hello {{ (userStream|async)?.last }}, {{ (userStream|async)?.first }}! * ``` * * There are several inefficiencies in the above example: * - We create multiple subscriptions on `userStream`. One for each `async` pipe, or two in the * example above. * - We cannot display an alternative screen while waiting for the data to arrive asynchronously. * - We have to use the safe-traversal-operator `?.` to access properties, which is cumbersome. * - We have to place the `async` pipe in parenthesis. * * A better way to do this is to use `ngIf` and store the result of the condition in a local * variable as shown in the the example below: * * {\@example common/ngIf/ts/module.ts region='NgIfAs'} * * Notice that: * - We use only one `async` pipe and hence only one subscription gets created. * - `ngIf` stores the result of the `userStream|async` in the local variable `user`. * - The local `user` can then be bound repeatedly in a more efficient way. * - No need to use the safe-traversal-operator `?.` to access properties as `ngIf` will only * display the data if `userStream` returns a value. * - We can display an alternative template while waiting for the data. * * ### Syntax * * Simple form: * - `<div *ngIf="condition">...</div>` * - `<ng-template [ngIf]="condition"><div>...</div></ng-template>` * * Form with an else block: * ``` * <div *ngIf="condition; else elseBlock">...</div> * <ng-template #elseBlock>...</ng-template> * ``` * * Form with a `then` and `else` block: * ``` * <div *ngIf="condition; then thenBlock else elseBlock"></div> * <ng-template #thenBlock>...</ng-template> * <ng-template #elseBlock>...</ng-template> * ``` * * Form with storing the value locally: * ``` * <div *ngIf="condition as value; else elseBlock">{{value}}</div> * <ng-template #elseBlock>...</ng-template> * ``` * * \@stable */ class NgIf { /** * @param {?} _viewContainer * @param {?} templateRef */ constructor(_viewContainer, templateRef) { this._viewContainer = _viewContainer; this._context = new NgIfContext(); this._thenTemplateRef = null; this._elseTemplateRef = null; this._thenViewRef = null; this._elseViewRef = null; this._thenTemplateRef = templateRef; } /** * @param {?} condition * @return {?} */ set ngIf(condition) { this._context.$implicit = this._context.ngIf = condition; this._updateView(); } /** * @param {?} templateRef * @return {?} */ set ngIfThen(templateRef) { this._thenTemplateRef = templateRef; this._thenViewRef = null; // clear previous view if any. this._updateView(); } /** * @param {?} templateRef * @return {?} */ set ngIfElse(templateRef) { this._elseTemplateRef = templateRef; this._elseViewRef = null; // clear previous view if any. this._updateView(); } /** * @return {?} */ _updateView() { if (this._context.$implicit) { if (!this._thenViewRef) { this._viewContainer.clear(); this._elseViewRef = null; if (this._thenTemplateRef) { this._thenViewRef = this._viewContainer.createEmbeddedView(this._thenTemplateRef, this._context); } } } else { if (!this._elseViewRef) { this._viewContainer.clear(); this._thenViewRef = null; if (this._elseTemplateRef) { this._elseViewRef = this._viewContainer.createEmbeddedView(this._elseTemplateRef, this._context); } } } } } NgIf.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: '[ngIf]' },] }, ]; /** @nocollapse */ NgIf.ctorParameters = () => [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ViewContainerRef"], }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["TemplateRef"], }, ]; NgIf.propDecorators = { "ngIf": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "ngIfThen": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "ngIfElse": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], }; /** * \@stable */ class NgIfContext { constructor() { this.$implicit = null; this.ngIf = null; } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ class SwitchView { /** * @param {?} _viewContainerRef * @param {?} _templateRef */ constructor(_viewContainerRef, _templateRef) { this._viewContainerRef = _viewContainerRef; this._templateRef = _templateRef; this._created = false; } /** * @return {?} */ create() { this._created = true; this._viewContainerRef.createEmbeddedView(this._templateRef); } /** * @return {?} */ destroy() { this._created = false; this._viewContainerRef.clear(); } /** * @param {?} created * @return {?} */ enforceState(created) { if (created && !this._created) { this.create(); } else if (!created && this._created) { this.destroy(); } } } /** * \@ngModule CommonModule * * \@whatItDoes Adds / removes DOM sub-trees when the nest match expressions matches the switch * expression. * * \@howToUse * ``` * <container-element [ngSwitch]="switch_expression"> * <some-element *ngSwitchCase="match_expression_1">...</some-element> * <some-element *ngSwitchCase="match_expression_2">...</some-element> * <some-other-element *ngSwitchCase="match_expression_3">...</some-other-element> * <ng-container *ngSwitchCase="match_expression_3"> * <!-- use a ng-container to group multiple root nodes --> * <inner-element></inner-element> * <inner-other-element></inner-other-element> * </ng-container> * <some-element *ngSwitchDefault>...</some-element> * </container-element> * ``` * \@description * * `NgSwitch` stamps out nested views when their match expression value matches the value of the * switch expression. * * In other words: * - you define a container element (where you place the directive with a switch expression on the * `[ngSwitch]="..."` attribute) * - you define inner views inside the `NgSwitch` and place a `*ngSwitchCase` attribute on the view * root elements. * * Elements within `NgSwitch` but outside of a `NgSwitchCase` or `NgSwitchDefault` directives will * be preserved at the location. * * The `ngSwitchCase` directive informs the parent `NgSwitch` of which view to display when the * expression is evaluated. * When no matching expression is found on a `ngSwitchCase` view, the `ngSwitchDefault` view is * stamped out. * * \@stable */ class NgSwitch { constructor() { this._defaultUsed = false; this._caseCount = 0; this._lastCaseCheckIndex = 0; this._lastCasesMatched = false; } /** * @param {?} newValue * @return {?} */ set ngSwitch(newValue) { this._ngSwitch = newValue; if (this._caseCount === 0) { this._updateDefaultCases(true); } } /** * \@internal * @return {?} */ _addCase() { return this._caseCount++; } /** * \@internal * @param {?} view * @return {?} */ _addDefault(view) { if (!this._defaultViews) { this._defaultViews = []; } this._defaultViews.push(view); } /** * \@internal * @param {?} value * @return {?} */ _matchCase(value) { const /** @type {?} */ matched = value == this._ngSwitch; this._lastCasesMatched = this._lastCasesMatched || matched; this._lastCaseCheckIndex++; if (this._lastCaseCheckIndex === this._caseCount) { this._updateDefaultCases(!this._lastCasesMatched); this._lastCaseCheckIndex = 0; this._lastCasesMatched = false; } return matched; } /** * @param {?} useDefault * @return {?} */ _updateDefaultCases(useDefault) { if (this._defaultViews && useDefault !== this._defaultUsed) { this._defaultUsed = useDefault; for (let /** @type {?} */ i = 0; i < this._defaultViews.length; i++) { const /** @type {?} */ defaultView = this._defaultViews[i]; defaultView.enforceState(useDefault); } } } } NgSwitch.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: '[ngSwitch]' },] }, ]; /** @nocollapse */ NgSwitch.ctorParameters = () => []; NgSwitch.propDecorators = { "ngSwitch": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], }; /** * \@ngModule CommonModule * * \@whatItDoes Creates a view that will be added/removed from the parent {\@link NgSwitch} when the * given expression evaluate to respectively the same/different value as the switch * expression. * * \@howToUse * ``` * <container-element [ngSwitch]="switch_expression"> * <some-element *ngSwitchCase="match_expression_1">...</some-element> * </container-element> * ``` * \@description * * Insert the sub-tree when the expression evaluates to the same value as the enclosing switch * expression. * * If multiple match expressions match the switch expression value, all of them are displayed. * * See {\@link NgSwitch} for more details and example. * * \@stable */ class NgSwitchCase { /** * @param {?} viewContainer * @param {?} templateRef * @param {?} ngSwitch */ constructor(viewContainer, templateRef, ngSwitch) { this.ngSwitch = ngSwitch; ngSwitch._addCase(); this._view = new SwitchView(viewContainer, templateRef); } /** * @return {?} */ ngDoCheck() { this._view.enforceState(this.ngSwitch._matchCase(this.ngSwitchCase)); } } NgSwitchCase.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: '[ngSwitchCase]' },] }, ]; /** @nocollapse */ NgSwitchCase.ctorParameters = () => [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ViewContainerRef"], }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["TemplateRef"], }, { type: NgSwitch, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Host"] },] }, ]; NgSwitchCase.propDecorators = { "ngSwitchCase": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], }; /** * \@ngModule CommonModule * \@whatItDoes Creates a view that is added to the parent {\@link NgSwitch} when no case expressions * match the * switch expression. * * \@howToUse * ``` * <container-element [ngSwitch]="switch_expression"> * <some-element *ngSwitchCase="match_expression_1">...</some-element> * <some-other-element *ngSwitchDefault>...</some-other-element> * </container-element> * ``` * * \@description * * Insert the sub-tree when no case expressions evaluate to the same value as the enclosing switch * expression. * * See {\@link NgSwitch} for more details and example. * * \@stable */ class NgSwitchDefault { /** * @param {?} viewContainer * @param {?} templateRef * @param {?} ngSwitch */ constructor(viewContainer, templateRef, ngSwitch) { ngSwitch._addDefault(new SwitchView(viewContainer, templateRef)); } } NgSwitchDefault.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: '[ngSwitchDefault]' },] }, ]; /** @nocollapse */ NgSwitchDefault.ctorParameters = () => [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ViewContainerRef"], }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["TemplateRef"], }, { type: NgSwitch, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Host"] },] }, ]; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * \@ngModule CommonModule * * \@whatItDoes Adds / removes DOM sub-trees based on a numeric value. Tailored for pluralization. * * \@howToUse * ``` * <some-element [ngPlural]="value"> * <ng-template ngPluralCase="=0">there is nothing</ng-template> * <ng-template ngPluralCase="=1">there is one</ng-template> * <ng-template ngPluralCase="few">there are a few</ng-template> * </some-element> * ``` * * \@description * * Displays DOM sub-trees that match the switch expression value, or failing that, DOM sub-trees * that match the switch expression's pluralization category. * * To use this directive you must provide a container element that sets the `[ngPlural]` attribute * to a switch expression. Inner elements with a `[ngPluralCase]` will display based on their * expression: * - if `[ngPluralCase]` is set to a value starting with `=`, it will only display if the value * matches the switch expression exactly, * - otherwise, the view will be treated as a "category match", and will only display if exact * value matches aren't found and the value maps to its category for the defined locale. * * See http://cldr.unicode.org/index/cldr-spec/plural-rules * * \@experimental */ class NgPlural { /** * @param {?} _localization */ constructor(_localization) { this._localization = _localization; this._caseViews = {}; } /** * @param {?} value * @return {?} */ set ngPlural(value) { this._switchValue = value; this._updateView(); } /** * @param {?} value * @param {?} switchView * @return {?} */ addCase(value, switchView) { this._caseViews[value] = switchView; } /** * @return {?} */ _updateView() { this._clearViews(); const /** @type {?} */ cases = Object.keys(this._caseViews); const /** @type {?} */ key = getPluralCategory(this._switchValue, cases, this._localization); this._activateView(this._caseViews[key]); } /** * @return {?} */ _clearViews() { if (this._activeView) this._activeView.destroy(); } /** * @param {?} view * @return {?} */ _activateView(view) { if (view) { this._activeView = view; this._activeView.create(); } } } NgPlural.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: '[ngPlural]' },] }, ]; /** @nocollapse */ NgPlural.ctorParameters = () => [ { type: NgLocalization, }, ]; NgPlural.propDecorators = { "ngPlural": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], }; /** * \@ngModule CommonModule * * \@whatItDoes Creates a view that will be added/removed from the parent {\@link NgPlural} when the * given expression matches the plural expression according to CLDR rules. * * \@howToUse * ``` * <some-element [ngPlural]="value"> * <ng-template ngPluralCase="=0">...</ng-template> * <ng-template ngPluralCase="other">...</ng-template> * </some-element> * ``` * * See {\@link NgPlural} for more details and example. * * \@experimental */ class NgPluralCase { /** * @param {?} value * @param {?} template * @param {?} viewContainer * @param {?} ngPlural */ constructor(value, template, viewContainer, ngPlural) { this.value = value; const /** @type {?} */ isANumber = !isNaN(Number(value)); ngPlural.addCase(isANumber ? `=${value}` : value, new SwitchView(viewContainer, template)); } } NgPluralCase.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: '[ngPluralCase]' },] }, ]; /** @nocollapse */ NgPluralCase.ctorParameters = () => [ { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Attribute"], args: ['ngPluralCase',] },] }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["TemplateRef"], }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ViewContainerRef"], }, { type: NgPlural, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Host"] },] }, ]; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * \@ngModule CommonModule * * \@whatItDoes Update an HTML element styles. * * \@howToUse * ``` * <some-element [ngStyle]="{'font-style': styleExp}">...</some-element> * * <some-element [ngStyle]="{'max-width.px': widthExp}">...</some-element> * * <some-element [ngStyle]="objExp">...</some-element> * ``` * * \@description * * The styles are updated according to the value of the expression evaluation: * - keys are style names with an optional `.<unit>` suffix (ie 'top.px', 'font-style.em'), * - values are the values assigned to those properties (expressed in the given unit). * * \@stable */ class NgStyle { /** * @param {?} _differs * @param {?} _ngEl * @param {?} _renderer */ constructor(_differs, _ngEl, _renderer) { this._differs = _differs; this._ngEl = _ngEl; this._renderer = _renderer; } /** * @param {?} v * @return {?} */ set ngStyle(v) { this._ngStyle = v; if (!this._differ && v) { this._differ = this._differs.find(v).create(); } } /** * @return {?} */ ngDoCheck() { if (this._differ) { const /** @type {?} */ changes = this._differ.diff(this._ngStyle); if (changes) { this._applyChanges(changes); } } } /** * @param {?} changes * @return {?} */ _applyChanges(changes) { changes.forEachRemovedItem((record) => this._setStyle(record.key, null)); changes.forEachAddedItem((record) => this._setStyle(record.key, record.currentValue)); changes.forEachChangedItem((record) => this._setStyle(record.key, record.currentValue)); } /** * @param {?} nameAndUnit * @param {?} value * @return {?} */ _setStyle(nameAndUnit, value) { const [name, unit] = nameAndUnit.split('.'); value = value != null && unit ? `${value}${unit}` : value; if (value != null) { this._renderer.setStyle(this._ngEl.nativeElement, name, /** @type {?} */ (value)); } else { this._renderer.removeStyle(this._ngEl.nativeElement, name); } } } NgStyle.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: '[ngStyle]' },] }, ]; /** @nocollapse */ NgStyle.ctorParameters = () => [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["KeyValueDiffers"], }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ElementRef"], }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Renderer2"], }, ]; NgStyle.propDecorators = { "ngStyle": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], }; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * \@ngModule CommonModule * * \@whatItDoes Inserts an embedded view from a prepared `TemplateRef` * * \@howToUse * ``` * <ng-container *ngTemplateOutlet="templateRefExp; context: contextExp"></ng-container> * ``` * * \@description * * You can attach a context object to the `EmbeddedViewRef` by setting `[ngTemplateOutletContext]`. * `[ngTemplateOutletContext]` should be an object, the object's keys will be available for binding * by the local template `let` declarations. * * Note: using the key `$implicit` in the context object will set its value as default. * * ## Example * * {\@example common/ngTemplateOutlet/ts/module.ts region='NgTemplateOutlet'} * * \@stable */ class NgTemplateOutlet { /** * @param {?} _viewContainerRef */ constructor(_viewContainerRef) { this._viewContainerRef = _viewContainerRef; } /** * @param {?} changes * @return {?} */ ngOnChanges(changes) { const /** @type {?} */ recreateView = this._shouldRecreateView(changes); if (recreateView) { if (this._viewRef) { this._viewContainerRef.remove(this._viewContainerRef.indexOf(this._viewRef)); } if (this.ngTemplateOutlet) { this._viewRef = this._viewContainerRef.createEmbeddedView(this.ngTemplateOutlet, this.ngTemplateOutletContext); } } else { if (this._viewRef && this.ngTemplateOutletContext) { this._updateExistingContext(this.ngTemplateOutletContext); } } } /** * We need to re-create existing embedded view if: * - templateRef has changed * - context has changes * * We mark context object as changed when the corresponding object * shape changes (new properties are added or existing properties are removed). * In other words we consider context with the same properties as "the same" even * if object reference changes (see https://github.com/angular/angular/issues/13407). * @param {?} changes * @return {?} */ _shouldRecreateView(changes) { const /** @type {?} */ ctxChange = changes['ngTemplateOutletContext']; return !!changes['ngTemplateOutlet'] || (ctxChange && this._hasContextShapeChanged(ctxChange)); } /** * @param {?} ctxChange * @return {?} */ _hasContextShapeChanged(ctxChange) { const /** @type {?} */ prevCtxKeys = Object.keys(ctxChange.previousValue || {}); const /** @type {?} */ currCtxKeys = Object.keys(ctxChange.currentValue || {}); if (prevCtxKeys.length === currCtxKeys.length) { for (let /** @type {?} */ propName of currCtxKeys) { if (prevCtxKeys.indexOf(propName) === -1) { return true; } } return false; } else { return true; } } /** * @param {?} ctx * @return {?} */ _updateExistingContext(ctx) { for (let /** @type {?} */ propName of Object.keys(ctx)) { (/** @type {?} */ (this._viewRef.context))[propName] = (/** @type {?} */ (this.ngTemplateOutletContext))[propName]; } } } NgTemplateOutlet.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: '[ngTemplateOutlet]' },] }, ]; /** @nocollapse */ NgTemplateOutlet.ctorParameters = () => [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ViewContainerRef"], }, ]; NgTemplateOutlet.propDecorators = { "ngTemplateOutletContext": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "ngTemplateOutlet": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], }; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * A collection of Angular directives that are likely to be used in each and every Angular * application. */ const COMMON_DIRECTIVES = [ NgClass, NgComponentOutlet, NgForOf, NgIf, NgTemplateOutlet, NgStyle, NgSwitch, NgSwitchCase, NgSwitchDefault, NgPlural, NgPluralCase, ]; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ const NAMED_FORMATS = {}; const DATE_FORMATS_SPLIT = /((?:[^GyMLwWdEabBhHmsSzZO']+)|(?:'(?:[^']|'')*')|(?:G{1,5}|y{1,4}|M{1,5}|L{1,5}|w{1,2}|W{1}|d{1,2}|E{1,6}|a{1,5}|b{1,5}|B{1,5}|h{1,2}|H{1,2}|m{1,2}|s{1,2}|S{1,3}|z{1,4}|Z{1,5}|O{1,4}))([\s\S]*)/; /** @enum {number} */ const ZoneWidth = { Short: 0, ShortGMT: 1, Long: 2, Extended: 3, }; ZoneWidth[ZoneWidth.Short] = "Short"; ZoneWidth[ZoneWidth.ShortGMT] = "ShortGMT"; ZoneWidth[ZoneWidth.Long] = "Long"; ZoneWidth[ZoneWidth.Extended] = "Extended"; /** @enum {number} */ const DateType = { FullYear: 0, Month: 1, Date: 2, Hours: 3, Minutes: 4, Seconds: 5, Milliseconds: 6, Day: 7, }; DateType[DateType.FullYear] = "FullYear"; DateType[DateType.Month] = "Month"; DateType[DateType.Date] = "Date"; DateType[DateType.Hours] = "Hours"; DateType[DateType.Minutes] = "Minutes"; DateType[DateType.Seconds] = "Seconds"; DateType[DateType.Milliseconds] = "Milliseconds"; DateType[DateType.Day] = "Day"; /** @enum {number} */ const TranslationType = { DayPeriods: 0, Days: 1, Months: 2, Eras: 3, }; TranslationType[TranslationType.DayPeriods] = "DayPeriods"; TranslationType[TranslationType.Days] = "Days"; TranslationType[TranslationType.Months] = "Months"; TranslationType[TranslationType.Eras] = "Eras"; /** * Transforms a date to a locale string based on a pattern and a timezone * * \@internal * @param {?} date * @param {?} format * @param {?} locale * @param {?=} timezone * @return {?} */ function formatDate(date, format, locale, timezone) { const /** @type {?} */ namedFormat = getNamedFormat(locale, format); format = namedFormat || format; let /** @type {?} */ parts = []; let /** @type {?} */ match; while (format) { match = DATE_FORMATS_SPLIT.exec(format); if (match) { parts = parts.concat(match.slice(1)); const /** @type {?} */ part = parts.pop(); if (!part) { break; } format = part; } else { parts.push(format); break; } } let /** @type {?} */ dateTimezoneOffset = date.getTimezoneOffset(); if (timezone) { dateTimezoneOffset = timezoneToOffset(timezone, dateTimezoneOffset); date = convertTimezoneToLocal(date, timezone, true); } let /** @type {?} */ text = ''; parts.forEach(value => { const /** @type {?} */ dateFormatter = getDateFormatter(value); text += dateFormatter ? dateFormatter(date, locale, dateTimezoneOffset) : value === '\'\'' ? '\'' : value.replace(/(^'|'$)/g, '').replace(/''/g, '\''); }); return text; } /** * @param {?} locale * @param {?} format * @return {?} */ function getNamedFormat(locale, format) { const /** @type {?} */ localeId = getLocaleId(locale); NAMED_FORMATS[localeId] = NAMED_FORMATS[localeId] || {}; if (NAMED_FORMATS[localeId][format]) { return NAMED_FORMATS[localeId][format]; } let /** @type {?} */ formatValue = ''; switch (format) { case 'shortDate': formatValue = getLocaleDateFormat(locale, FormatWidth.Short); break; case 'mediumDate': formatValue = getLocaleDateFormat(locale, FormatWidth.Medium); break; case 'longDate': formatValue = getLocaleDateFormat(locale, FormatWidth.Long); break; case 'fullDate': formatValue = getLocaleDateFormat(locale, FormatWidth.Full); break; case 'shortTime': formatValue = getLocaleTimeFormat(locale, FormatWidth.Short); break; case 'mediumTime': formatValue = getLocaleTimeFormat(locale, FormatWidth.Medium); break; case 'longTime': formatValue = getLocaleTimeFormat(locale, FormatWidth.Long); break; case 'fullTime': formatValue = getLocaleTimeFormat(locale, FormatWidth.Full); break; case 'short': const /** @type {?} */ shortTime = getNamedFormat(locale, 'shortTime'); const /** @type {?} */ shortDate = getNamedFormat(locale, 'shortDate'); formatValue = formatDateTime(getLocaleDateTimeFormat(locale, FormatWidth.Short), [shortTime, shortDate]); break; case 'medium': const /** @type {?} */ mediumTime = getNamedFormat(locale, 'mediumTime'); const /** @type {?} */ mediumDate = getNamedFormat(locale, 'mediumDate'); formatValue = formatDateTime(getLocaleDateTimeFormat(locale, FormatWidth.Medium), [mediumTime, mediumDate]); break; case 'long': const /** @type {?} */ longTime = getNamedFormat(locale, 'longTime'); const /** @type {?} */ longDate = getNamedFormat(locale, 'longDate'); formatValue = formatDateTime(getLocaleDateTimeFormat(locale, FormatWidth.Long), [longTime, longDate]); break; case 'full': const /** @type {?} */ fullTime = getNamedFormat(locale, 'fullTime'); const /** @type {?} */ fullDate = getNamedFormat(locale, 'fullDate'); formatValue = formatDateTime(getLocaleDateTimeFormat(locale, FormatWidth.Full), [fullTime, fullDate]); break; } if (formatValue) { NAMED_FORMATS[localeId][format] = formatValue; } return formatValue; } /** * @param {?} str * @param {?} opt_values * @return {?} */ function formatDateTime(str, opt_values) { if (opt_values) { str = str.replace(/\{([^}]+)}/g, function (match, key) { return (opt_values != null && key in opt_values) ? opt_values[key] : match; }); } return str; } /** * @param {?} num * @param {?} digits * @param {?=} minusSign * @param {?=} trim * @param {?=} negWrap * @return {?} */ function padNumber(num, digits, minusSign = '-', trim, negWrap) { let /** @type {?} */ neg = ''; if (num < 0 || (negWrap && num <= 0)) { if (negWrap) { num = -num + 1; } else { num = -num; neg = minusSign; } } let /** @type {?} */ strNum = '' + num; while (strNum.length < digits) strNum = '0' + strNum; if (trim) { strNum = strNum.substr(strNum.length - digits); } return neg + strNum; } /** * Returns a date formatter that transforms a date into its locale digit representation * @param {?} name * @param {?} size * @param {?=} offset * @param {?=} trim * @param {?=} negWrap * @return {?} */ function dateGetter(name, size, offset = 0, trim = false, negWrap = false) { return function (date, locale) { let /** @type {?} */ part = getDatePart(name, date, size); if (offset > 0 || part > -offset) { part += offset; } if (name === DateType.Hours && part === 0 && offset === -12) { part = 12; } return padNumber(part, size, getLocaleNumberSymbol(locale, NumberSymbol.MinusSign), trim, negWrap); }; } /** * @param {?} name * @param {?} date * @param {?} size * @return {?} */ function getDatePart(name, date, size) { switch (name) { case DateType.FullYear: return date.getFullYear(); case DateType.Month: return date.getMonth(); case DateType.Date: return date.getDate(); case DateType.Hours: return date.getHours(); case DateType.Minutes: return date.getMinutes(); case DateType.Seconds: return date.getSeconds(); case DateType.Milliseconds: const /** @type {?} */ div = size === 1 ? 100 : (size === 2 ? 10 : 1); return Math.round(date.getMilliseconds() / div); case DateType.Day: return date.getDay(); default: throw new Error(`Unknown DateType value "${name}".`); } } /** * Returns a date formatter that transforms a date into its locale string representation * @param {?} name * @param {?} width * @param {?=} form * @param {?=} extended * @return {?} */ function dateStrGetter(name, width, form = FormStyle.Format, extended = false) { return function (date, locale) { return getDateTranslation(date, locale, name, width, form, extended); }; } /** * Returns the locale translation of a date for a given form, type and width * @param {?} date * @param {?} locale * @param {?} name * @param {?} width * @param {?} form * @param {?} extended * @return {?} */ function getDateTranslation(date, locale, name, width, form, extended) { switch (name) { case TranslationType.Months: return getLocaleMonthNames(locale, form, width)[date.getMonth()]; case TranslationType.Days: return getLocaleDayNames(locale, form, width)[date.getDay()]; case TranslationType.DayPeriods: const /** @type {?} */ currentHours = date.getHours(); const /** @type {?} */ currentMinutes = date.getMinutes(); if (extended) { const /** @type {?} */ rules = getLocaleExtraDayPeriodRules(locale); const /** @type {?} */ dayPeriods = getLocaleExtraDayPeriods(locale, form, width); let /** @type {?} */ result; rules.forEach((rule, index) => { if (Array.isArray(rule)) { // morning, afternoon, evening, night const { hours: hoursFrom, minutes: minutesFrom } = rule[0]; const { hours: hoursTo, minutes: minutesTo } = rule[1]; if (currentHours >= hoursFrom && currentMinutes >= minutesFrom && (currentHours < hoursTo || (currentHours === hoursTo && currentMinutes < minutesTo))) { result = dayPeriods[index]; } } else { // noon or midnight const { hours, minutes } = rule; if (hours === currentHours && minutes === currentMinutes) { result = dayPeriods[index]; } } }); if (result) { return result; } } // if no rules for the day periods, we use am/pm by default return getLocaleDayPeriods(locale, form, /** @type {?} */ (width))[currentHours < 12 ? 0 : 1]; case TranslationType.Eras: return getLocaleEraNames(locale, /** @type {?} */ (width))[date.getFullYear() <= 0 ? 0 : 1]; default: // This default case is not needed by TypeScript compiler, as the switch is exhaustive. // However Closure Compiler does not understand that and reports an error in typed mode. // The `throw new Error` below works around the problem, and the unexpected: never variable // makes sure tsc still checks this code is unreachable. const /** @type {?} */ unexpected = name; throw new Error(`unexpected translation type ${unexpected}`); } } /** * Returns a date formatter that transforms a date and an offset into a timezone with ISO8601 or * GMT format depending on the width (eg: short = +0430, short:GMT = GMT+4, long = GMT+04:30, * extended = +04:30) * @param {?} width * @return {?} */ function timeZoneGetter(width) { return function (date, locale, offset) { const /** @type {?} */ zone = -1 * offset; const /** @type {?} */ minusSign = getLocaleNumberSymbol(locale, NumberSymbol.MinusSign); const /** @type {?} */ hours = zone > 0 ? Math.floor(zone / 60) : Math.ceil(zone / 60); switch (width) { case ZoneWidth.Short: return ((zone >= 0) ? '+' : '') + padNumber(hours, 2, minusSign) + padNumber(Math.abs(zone % 60), 2, minusSign); case ZoneWidth.ShortGMT: return 'GMT' + ((zone >= 0) ? '+' : '') + padNumber(hours, 1, minusSign); case ZoneWidth.Long: return 'GMT' + ((zone >= 0) ? '+' : '') + padNumber(hours, 2, minusSign) + ':' + padNumber(Math.abs(zone % 60), 2, minusSign); case ZoneWidth.Extended: if (offset === 0) { return 'Z'; } else { return ((zone >= 0) ? '+' : '') + padNumber(hours, 2, minusSign) + ':' + padNumber(Math.abs(zone % 60), 2, minusSign); } default: throw new Error(`Unknown zone width "${width}"`); } }; } const JANUARY = 0; const THURSDAY = 4; /** * @param {?} year * @return {?} */ function getFirstThursdayOfYear(year) { const /** @type {?} */ firstDayOfYear = (new Date(year, JANUARY, 1)).getDay(); return new Date(year, 0, 1 + ((firstDayOfYear <= THURSDAY) ? THURSDAY : THURSDAY + 7) - firstDayOfYear); } /** * @param {?} datetime * @return {?} */ function getThursdayThisWeek(datetime) { return new Date(datetime.getFullYear(), datetime.getMonth(), datetime.getDate() + (THURSDAY - datetime.getDay())); } /** * @param {?} size * @param {?=} monthBased * @return {?} */ function weekGetter(size, monthBased = false) { return function (date, locale) { let /** @type {?} */ result; if (monthBased) { const /** @type {?} */ nbDaysBefore1stDayOfMonth = new Date(date.getFullYear(), date.getMonth(), 1).getDay() - 1; const /** @type {?} */ today = date.getDate(); result = 1 + Math.floor((today + nbDaysBefore1stDayOfMonth) / 7); } else { const /** @type {?} */ firstThurs = getFirstThursdayOfYear(date.getFullYear()); const /** @type {?} */ thisThurs = getThursdayThisWeek(date); const /** @type {?} */ diff = thisThurs.getTime() - firstThurs.getTime(); result = 1 + Math.round(diff / 6.048e8); // 6.048e8 ms per week } return padNumber(result, size, getLocaleNumberSymbol(locale, NumberSymbol.MinusSign)); }; } const DATE_FORMATS = {}; /** * @param {?} format * @return {?} */ function getDateFormatter(format) { if (DATE_FORMATS[format]) { return DATE_FORMATS[format]; } let /** @type {?} */ formatter; switch (format) { // Era name (AD/BC) case 'G': case 'GG': case 'GGG': formatter = dateStrGetter(TranslationType.Eras, TranslationWidth.Abbreviated); break; case 'GGGG': formatter = dateStrGetter(TranslationType.Eras, TranslationWidth.Wide); break; case 'GGGGG': formatter = dateStrGetter(TranslationType.Eras, TranslationWidth.Narrow); break; // 1 digit representation of the year, e.g. (AD 1 => 1, AD 199 => 199) case 'y': formatter = dateGetter(DateType.FullYear, 1, 0, false, true); break; // 2 digit representation of the year, padded (00-99). (e.g. AD 2001 => 01, AD 2010 => 10) case 'yy': formatter = dateGetter(DateType.FullYear, 2, 0, true, true); break; // 3 digit representation of the year, padded (000-999). (e.g. AD 2001 => 01, AD 2010 => 10) case 'yyy': formatter = dateGetter(DateType.FullYear, 3, 0, false, true); break; // 4 digit representation of the year (e.g. AD 1 => 0001, AD 2010 => 2010) case 'yyyy': formatter = dateGetter(DateType.FullYear, 4, 0, false, true); break; // Month of the year (1-12), numeric case 'M': case 'L': formatter = dateGetter(DateType.Month, 1, 1); break; case 'MM': case 'LL': formatter = dateGetter(DateType.Month, 2, 1); break; // Month of the year (January, ...), string, format case 'MMM': formatter = dateStrGetter(TranslationType.Months, TranslationWidth.Abbreviated); break; case 'MMMM': formatter = dateStrGetter(TranslationType.Months, TranslationWidth.Wide); break; case 'MMMMM': formatter = dateStrGetter(TranslationType.Months, TranslationWidth.Narrow); break; // Month of the year (January, ...), string, standalone case 'LLL': formatter = dateStrGetter(TranslationType.Months, TranslationWidth.Abbreviated, FormStyle.Standalone); break; case 'LLLL': formatter = dateStrGetter(TranslationType.Months, TranslationWidth.Wide, FormStyle.Standalone); break; case 'LLLLL': formatter = dateStrGetter(TranslationType.Months, TranslationWidth.Narrow, FormStyle.Standalone); break; // Week of the year (1, ... 52) case 'w': formatter = weekGetter(1); break; case 'ww': formatter = weekGetter(2); break; // Week of the month (1, ...) case 'W': formatter = weekGetter(1, true); break; // Day of the month (1-31) case 'd': formatter = dateGetter(DateType.Date, 1); break; case 'dd': formatter = dateGetter(DateType.Date, 2); break; // Day of the Week case 'E': case 'EE': case 'EEE': formatter = dateStrGetter(TranslationType.Days, TranslationWidth.Abbreviated); break; case 'EEEE': formatter = dateStrGetter(TranslationType.Days, TranslationWidth.Wide); break; case 'EEEEE': formatter = dateStrGetter(TranslationType.Days, TranslationWidth.Narrow); break; case 'EEEEEE': formatter = dateStrGetter(TranslationType.Days, TranslationWidth.Short); break; // Generic period of the day (am-pm) case 'a': case 'aa': case 'aaa': formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Abbreviated); break; case 'aaaa': formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Wide); break; case 'aaaaa': formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Narrow); break; // Extended period of the day (midnight, at night, ...), standalone case 'b': case 'bb': case 'bbb': formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Abbreviated, FormStyle.Standalone, true); break; case 'bbbb': formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Wide, FormStyle.Standalone, true); break; case 'bbbbb': formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Narrow, FormStyle.Standalone, true); break; // Extended period of the day (midnight, night, ...), standalone case 'B': case 'BB': case 'BBB': formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Abbreviated, FormStyle.Format, true); break; case 'BBBB': formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Wide, FormStyle.Format, true); break; case 'BBBBB': formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Narrow, FormStyle.Format, true); break; // Hour in AM/PM, (1-12) case 'h': formatter = dateGetter(DateType.Hours, 1, -12); break; case 'hh': formatter = dateGetter(DateType.Hours, 2, -12); break; // Hour of the day (0-23) case 'H': formatter = dateGetter(DateType.Hours, 1); break; // Hour in day, padded (00-23) case 'HH': formatter = dateGetter(DateType.Hours, 2); break; // Minute of the hour (0-59) case 'm': formatter = dateGetter(DateType.Minutes, 1); break; case 'mm': formatter = dateGetter(DateType.Minutes, 2); break; // Second of the minute (0-59) case 's': formatter = dateGetter(DateType.Seconds, 1); break; case 'ss': formatter = dateGetter(DateType.Seconds, 2); break; // Fractional second padded (0-9) case 'S': formatter = dateGetter(DateType.Milliseconds, 1); break; case 'SS': formatter = dateGetter(DateType.Milliseconds, 2); break; // = millisecond case 'SSS': formatter = dateGetter(DateType.Milliseconds, 3); break; // Timezone ISO8601 short format (-0430) case 'Z': case 'ZZ': case 'ZZZ': formatter = timeZoneGetter(ZoneWidth.Short); break; // Timezone ISO8601 extended format (-04:30) case 'ZZZZZ': formatter = timeZoneGetter(ZoneWidth.Extended); break; // Timezone GMT short format (GMT+4) case 'O': case 'OO': case 'OOO': // Should be location, but fallback to format O instead because we don't have the data yet case 'z': case 'zz': case 'zzz': formatter = timeZoneGetter(ZoneWidth.ShortGMT); break; // Timezone GMT long format (GMT+0430) case 'OOOO': case 'ZZZZ': // Should be location, but fallback to format O instead because we don't have the data yet case 'zzzz': formatter = timeZoneGetter(ZoneWidth.Long); break; default: return null; } DATE_FORMATS[format] = formatter; return formatter; } /** * @param {?} timezone * @param {?} fallback * @return {?} */ function timezoneToOffset(timezone, fallback) { // Support: IE 9-11 only, Edge 13-15+ // IE/Edge do not "understand" colon (`:`) in timezone timezone = timezone.replace(/:/g, ''); const /** @type {?} */ requestedTimezoneOffset = Date.parse('Jan 01, 1970 00:00:00 ' + timezone) / 60000; return isNaN(requestedTimezoneOffset) ? fallback : requestedTimezoneOffset; } /** * @param {?} date * @param {?} minutes * @return {?} */ function addDateMinutes(date, minutes) { date = new Date(date.getTime()); date.setMinutes(date.getMinutes() + minutes); return date; } /** * @param {?} date * @param {?} timezone * @param {?} reverse * @return {?} */ function convertTimezoneToLocal(date, timezone, reverse) { const /** @type {?} */ reverseValue = reverse ? -1 : 1; const /** @type {?} */ dateTimezoneOffset = date.getTimezoneOffset(); const /** @type {?} */ timezoneOffset = timezoneToOffset(timezone, dateTimezoneOffset); return addDateMinutes(date, reverseValue * (timezoneOffset - dateTimezoneOffset)); } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @param {?} type * @param {?} value * @return {?} */ function invalidPipeArgumentError(type, value) { return Error(`InvalidPipeArgument: '${value}' for pipe '${Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["ɵstringify"])(type)}'`); } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ const ISO8601_DATE_REGEX = /^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|([+-])(\d\d):?(\d\d))?)?$/; /** * \@ngModule CommonModule * \@whatItDoes Formats a date according to locale rules. * \@howToUse `date_expression | date[:format[:timezone[:locale]]]` * \@description * * Where: * - `expression` is a date object or a number (milliseconds since UTC epoch) or an ISO string * (https://www.w3.org/TR/NOTE-datetime). * - `format` indicates which date/time components to include. The format can be predefined as * shown below (all examples are given for `en-US`) or custom as shown in the table. * - `'short'`: equivalent to `'M/d/yy, h:mm a'` (e.g. `6/15/15, 9:03 AM`) * - `'medium'`: equivalent to `'MMM d, y, h:mm:ss a'` (e.g. `Jun 15, 2015, 9:03:01 AM`) * - `'long'`: equivalent to `'MMMM d, y, h:mm:ss a z'` (e.g. `June 15, 2015 at 9:03:01 AM GMT+1`) * - `'full'`: equivalent to `'EEEE, MMMM d, y, h:mm:ss a zzzz'` (e.g. `Monday, June 15, 2015 at * 9:03:01 AM GMT+01:00`) * - `'shortDate'`: equivalent to `'M/d/yy'` (e.g. `6/15/15`) * - `'mediumDate'`: equivalent to `'MMM d, y'` (e.g. `Jun 15, 2015`) * - `'longDate'`: equivalent to `'MMMM d, y'` (e.g. `June 15, 2015`) * - `'fullDate'`: equivalent to `'EEEE, MMMM d, y'` (e.g. `Monday, June 15, 2015`) * - `'shortTime'`: equivalent to `'h:mm a'` (e.g. `9:03 AM`) * - `'mediumTime'`: equivalent to `'h:mm:ss a'` (e.g. `9:03:01 AM`) * - `'longTime'`: equivalent to `'h:mm:ss a z'` (e.g. `9:03:01 AM GMT+1`) * - `'fullTime'`: equivalent to `'h:mm:ss a zzzz'` (e.g. `9:03:01 AM GMT+01:00`) * - `timezone` to be used for formatting. It understands UTC/GMT and the continental US time zone * abbreviations, but for general use, use a time zone offset, for example, * `'+0430'` (4 hours, 30 minutes east of the Greenwich meridian) * If not specified, the local system timezone of the end-user's browser will be used. * - `locale` is a `string` defining the locale to use (uses the current {\@link LOCALE_ID} by * default) * * * | Field Type | Format | Description | Example Value | * |--------------------|-------------|---------------------------------------------------------------|------------------------------------------------------------| * | Era | G, GG & GGG | Abbreviated | AD | * | | GGGG | Wide | Anno Domini | * | | GGGGG | Narrow | A | * | Year | y | Numeric: minimum digits | 2, 20, 201, 2017, 20173 | * | | yy | Numeric: 2 digits + zero padded | 02, 20, 01, 17, 73 | * | | yyy | Numeric: 3 digits + zero padded | 002, 020, 201, 2017, 20173 | * | | yyyy | Numeric: 4 digits or more + zero padded | 0002, 0020, 0201, 2017, 20173 | * | Month | M | Numeric: 1 digit | 9, 12 | * | | MM | Numeric: 2 digits + zero padded | 09, 12 | * | | MMM | Abbreviated | Sep | * | | MMMM | Wide | September | * | | MMMMM | Narrow | S | * | Month standalone | L | Numeric: 1 digit | 9, 12 | * | | LL | Numeric: 2 digits + zero padded | 09, 12 | * | | LLL | Abbreviated | Sep | * | | LLLL | Wide | September | * | | LLLLL | Narrow | S | * | Week of year | w | Numeric: minimum digits | 1... 53 | * | | ww | Numeric: 2 digits + zero padded | 01... 53 | * | Week of month | W | Numeric: 1 digit | 1... 5 | * | Day of month | d | Numeric: minimum digits | 1 | * | | dd | Numeric: 2 digits + zero padded | 01 | * | Week day | E, EE & EEE | Abbreviated | Tue | * | | EEEE | Wide | Tuesday | * | | EEEEE | Narrow | T | * | | EEEEEE | Short | Tu | * | Period | a, aa & aaa | Abbreviated | am/pm or AM/PM | * | | aaaa | Wide (fallback to `a` when missing) | ante meridiem/post meridiem | * | | aaaaa | Narrow | a/p | * | Period* | B, BB & BBB | Abbreviated | mid. | * | | BBBB | Wide | am, pm, midnight, noon, morning, afternoon, evening, night | * | | BBBBB | Narrow | md | * | Period standalone* | b, bb & bbb | Abbreviated | mid. | * | | bbbb | Wide | am, pm, midnight, noon, morning, afternoon, evening, night | * | | bbbbb | Narrow | md | * | Hour 1-12 | h | Numeric: minimum digits | 1, 12 | * | | hh | Numeric: 2 digits + zero padded | 01, 12 | * | Hour 0-23 | H | Numeric: minimum digits | 0, 23 | * | | HH | Numeric: 2 digits + zero padded | 00, 23 | * | Minute | m | Numeric: minimum digits | 8, 59 | * | | mm | Numeric: 2 digits + zero padded | 08, 59 | * | Second | s | Numeric: minimum digits | 0... 59 | * | | ss | Numeric: 2 digits + zero padded | 00... 59 | * | Fractional seconds | S | Numeric: 1 digit | 0... 9 | * | | SS | Numeric: 2 digits + zero padded | 00... 99 | * | | SSS | Numeric: 3 digits + zero padded (= milliseconds) | 000... 999 | * | Zone | z, zz & zzz | Short specific non location format (fallback to O) | GMT-8 | * | | zzzz | Long specific non location format (fallback to OOOO) | GMT-08:00 | * | | Z, ZZ & ZZZ | ISO8601 basic format | -0800 | * | | ZZZZ | Long localized GMT format | GMT-8:00 | * | | ZZZZZ | ISO8601 extended format + Z indicator for offset 0 (= XXXXX) | -08:00 | * | | O, OO & OOO | Short localized GMT format | GMT-8 | * | | OOOO | Long localized GMT format | GMT-08:00 | * * * When the expression is a ISO string without time (e.g. 2016-09-19) the time zone offset is not * applied and the formatted text will have the same day, month and year of the expression. * * WARNINGS: * - this pipe has only access to en-US locale data by default. If you want to localize the dates * in another language, you will have to import data for other locales. * See the {\@linkDocs guide/i18n#i18n-pipes "I18n guide"} to know how to import additional locale * data. * - Fields suffixed with * are only available in the extra dataset. * See the {\@linkDocs guide/i18n#i18n-pipes "I18n guide"} to know how to import extra locale * data. * - this pipe is marked as pure hence it will not be re-evaluated when the input is mutated. * Instead users should treat the date as an immutable object and change the reference when the * pipe needs to re-run (this is to avoid reformatting the date on every change detection run * which would be an expensive operation). * * ### Examples * * Assuming `dateObj` is (year: 2015, month: 6, day: 15, hour: 21, minute: 43, second: 11) * in the _local_ time and locale is 'en-US': * * {\@example common/pipes/ts/date_pipe.ts region='DatePipe'} * * \@stable */ class DatePipe { /** * @param {?} locale */ constructor(locale) { this.locale = locale; } /** * @param {?} value * @param {?=} format * @param {?=} timezone * @param {?=} locale * @return {?} */ transform(value, format = 'mediumDate', timezone, locale) { if (value == null || value === '' || value !== value) return null; if (typeof value === 'string') { value = value.trim(); } let /** @type {?} */ date; let /** @type {?} */ match; if (isDate$1(value)) { date = value; } else if (!isNaN(value - parseFloat(value))) { date = new Date(parseFloat(value)); } else if (typeof value === 'string' && /^(\d{4}-\d{1,2}-\d{1,2})$/.test(value)) { /** * For ISO Strings without time the day, month and year must be extracted from the ISO String * before Date creation to avoid time offset and errors in the new Date. * If we only replace '-' with ',' in the ISO String ("2015,01,01"), and try to create a new * date, some browsers (e.g. IE 9) will throw an invalid Date error * If we leave the '-' ("2015-01-01") and try to create a new Date("2015-01-01") the timeoffset * is applied * Note: ISO months are 0 for January, 1 for February, ... */ const [y, m, d] = value.split('-').map((val) => +val); date = new Date(y, m - 1, d); } else if ((typeof value === 'string') && (match = value.match(ISO8601_DATE_REGEX))) { date = isoStringToDate(match); } else { date = new Date(value); } if (!isDate$1(date)) { throw invalidPipeArgumentError(DatePipe, value); } return formatDate(date, format, locale || this.locale, timezone); } } DatePipe.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Pipe"], args: [{ name: 'date', pure: true },] }, ]; /** @nocollapse */ DatePipe.ctorParameters = () => [ { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Inject"], args: [__WEBPACK_IMPORTED_MODULE_0__angular_core__["LOCALE_ID"],] },] }, ]; /** * \@internal * @param {?} match * @return {?} */ function isoStringToDate(match) { const /** @type {?} */ date = new Date(0); let /** @type {?} */ tzHour = 0; let /** @type {?} */ tzMin = 0; // match[8] means that the string contains "Z" (UTC) or a timezone like "+01:00" or "+0100" const /** @type {?} */ dateSetter = match[8] ? date.setUTCFullYear : date.setFullYear; const /** @type {?} */ timeSetter = match[8] ? date.setUTCHours : date.setHours; // if there is a timezone defined like "+01:00" or "+0100" if (match[9]) { tzHour = +(match[9] + match[10]); tzMin = +(match[9] + match[11]); } dateSetter.call(date, +(match[1]), +(match[2]) - 1, +(match[3])); const /** @type {?} */ h = +(match[4] || '0') - tzHour; const /** @type {?} */ m = +(match[5] || '0') - tzMin; const /** @type {?} */ s = +(match[6] || '0'); const /** @type {?} */ ms = Math.round(parseFloat('0.' + (match[7] || 0)) * 1000); timeSetter.call(date, h, m, s, ms); return date; } /** * @param {?} value * @return {?} */ function isDate$1(value) { return value instanceof Date && !isNaN(value.valueOf()); } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ class NumberFormatter { /** * @param {?} num * @param {?} locale * @param {?} style * @param {?=} opts * @return {?} */ static format(num, locale, style, opts = {}) { const { minimumIntegerDigits, minimumFractionDigits, maximumFractionDigits, currency, currencyAsSymbol = false } = opts; const /** @type {?} */ options = { minimumIntegerDigits, minimumFractionDigits, maximumFractionDigits, style: NumberFormatStyle[style].toLowerCase() }; if (style == NumberFormatStyle.Currency) { options.currency = typeof currency == 'string' ? currency : undefined; options.currencyDisplay = currencyAsSymbol ? 'symbol' : 'code'; } return new Intl.NumberFormat(locale, options).format(num); } } const DATE_FORMATS_SPLIT$1 = /((?:[^yMLdHhmsazZEwGjJ']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|L+|d+|H+|h+|J+|j+|m+|s+|a|z|Z|G+|w+))(.*)/; const PATTERN_ALIASES = { // Keys are quoted so they do not get renamed during closure compilation. 'yMMMdjms': datePartGetterFactory(combine([ digitCondition('year', 1), nameCondition('month', 3), digitCondition('day', 1), digitCondition('hour', 1), digitCondition('minute', 1), digitCondition('second', 1), ])), 'yMdjm': datePartGetterFactory(combine([ digitCondition('year', 1), digitCondition('month', 1), digitCondition('day', 1), digitCondition('hour', 1), digitCondition('minute', 1) ])), 'yMMMMEEEEd': datePartGetterFactory(combine([ digitCondition('year', 1), nameCondition('month', 4), nameCondition('weekday', 4), digitCondition('day', 1) ])), 'yMMMMd': datePartGetterFactory(combine([digitCondition('year', 1), nameCondition('month', 4), digitCondition('day', 1)])), 'yMMMd': datePartGetterFactory(combine([digitCondition('year', 1), nameCondition('month', 3), digitCondition('day', 1)])), 'yMd': datePartGetterFactory(combine([digitCondition('year', 1), digitCondition('month', 1), digitCondition('day', 1)])), 'jms': datePartGetterFactory(combine([digitCondition('hour', 1), digitCondition('second', 1), digitCondition('minute', 1)])), 'jm': datePartGetterFactory(combine([digitCondition('hour', 1), digitCondition('minute', 1)])) }; const DATE_FORMATS$1 = { // Keys are quoted so they do not get renamed. 'yyyy': datePartGetterFactory(digitCondition('year', 4)), 'yy': datePartGetterFactory(digitCondition('year', 2)), 'y': datePartGetterFactory(digitCondition('year', 1)), 'MMMM': datePartGetterFactory(nameCondition('month', 4)), 'MMM': datePartGetterFactory(nameCondition('month', 3)), 'MM': datePartGetterFactory(digitCondition('month', 2)), 'M': datePartGetterFactory(digitCondition('month', 1)), 'LLLL': datePartGetterFactory(nameCondition('month', 4)), 'L': datePartGetterFactory(nameCondition('month', 1)), 'dd': datePartGetterFactory(digitCondition('day', 2)), 'd': datePartGetterFactory(digitCondition('day', 1)), 'HH': digitModifier(hourExtractor(datePartGetterFactory(hour12Modify(digitCondition('hour', 2), false)))), 'H': hourExtractor(datePartGetterFactory(hour12Modify(digitCondition('hour', 1), false))), 'hh': digitModifier(hourExtractor(datePartGetterFactory(hour12Modify(digitCondition('hour', 2), true)))), 'h': hourExtractor(datePartGetterFactory(hour12Modify(digitCondition('hour', 1), true))), 'jj': datePartGetterFactory(digitCondition('hour', 2)), 'j': datePartGetterFactory(digitCondition('hour', 1)), 'mm': digitModifier(datePartGetterFactory(digitCondition('minute', 2))), 'm': datePartGetterFactory(digitCondition('minute', 1)), 'ss': digitModifier(datePartGetterFactory(digitCondition('second', 2))), 's': datePartGetterFactory(digitCondition('second', 1)), // while ISO 8601 requires fractions to be prefixed with `.` or `,` // we can be just safely rely on using `sss` since we currently don't support single or two digit // fractions 'sss': datePartGetterFactory(digitCondition('second', 3)), 'EEEE': datePartGetterFactory(nameCondition('weekday', 4)), 'EEE': datePartGetterFactory(nameCondition('weekday', 3)), 'EE': datePartGetterFactory(nameCondition('weekday', 2)), 'E': datePartGetterFactory(nameCondition('weekday', 1)), 'a': hourClockExtractor(datePartGetterFactory(hour12Modify(digitCondition('hour', 1), true))), 'Z': timeZoneGetter$1('short'), 'z': timeZoneGetter$1('long'), 'ww': datePartGetterFactory({}), // Week of year, padded (00-53). Week 01 is the week with the // first Thursday of the year. not support ? 'w': datePartGetterFactory({}), // Week of year (0-53). Week 1 is the week with the first Thursday // of the year not support ? 'G': datePartGetterFactory(nameCondition('era', 1)), 'GG': datePartGetterFactory(nameCondition('era', 2)), 'GGG': datePartGetterFactory(nameCondition('era', 3)), 'GGGG': datePartGetterFactory(nameCondition('era', 4)) }; /** * @param {?} inner * @return {?} */ function digitModifier(inner) { return function (date, locale) { const /** @type {?} */ result = inner(date, locale); return result.length == 1 ? '0' + result : result; }; } /** * @param {?} inner * @return {?} */ function hourClockExtractor(inner) { return function (date, locale) { return inner(date, locale).split(' ')[1]; }; } /** * @param {?} inner * @return {?} */ function hourExtractor(inner) { return function (date, locale) { return inner(date, locale).split(' ')[0]; }; } /** * @param {?} date * @param {?} locale * @param {?} options * @return {?} */ function intlDateFormat(date, locale, options) { return new Intl.DateTimeFormat(locale, options).format(date).replace(/[\u200e\u200f]/g, ''); } /** * @param {?} timezone * @return {?} */ function timeZoneGetter$1(timezone) { // To workaround `Intl` API restriction for single timezone let format with 24 hours const /** @type {?} */ options = { hour: '2-digit', hour12: false, timeZoneName: timezone }; return function (date, locale) { const /** @type {?} */ result = intlDateFormat(date, locale, options); // Then extract first 3 letters that related to hours return result ? result.substring(3) : ''; }; } /** * @param {?} options * @param {?} value * @return {?} */ function hour12Modify(options, value) { options.hour12 = value; return options; } /** * @param {?} prop * @param {?} len * @return {?} */ function digitCondition(prop, len) { const /** @type {?} */ result = {}; result[prop] = len === 2 ? '2-digit' : 'numeric'; return result; } /** * @param {?} prop * @param {?} len * @return {?} */ function nameCondition(prop, len) { const /** @type {?} */ result = {}; if (len < 4) { result[prop] = len > 1 ? 'short' : 'narrow'; } else { result[prop] = 'long'; } return result; } /** * @param {?} options * @return {?} */ function combine(options) { return options.reduce((merged, opt) => (Object.assign({}, merged, opt)), {}); } /** * @param {?} ret * @return {?} */ function datePartGetterFactory(ret) { return (date, locale) => intlDateFormat(date, locale, ret); } const DATE_FORMATTER_CACHE = new Map(); /** * @param {?} format * @param {?} date * @param {?} locale * @return {?} */ function dateFormatter(format, date, locale) { const /** @type {?} */ fn = PATTERN_ALIASES[format]; if (fn) return fn(date, locale); const /** @type {?} */ cacheKey = format; let /** @type {?} */ parts = DATE_FORMATTER_CACHE.get(cacheKey); if (!parts) { parts = []; let /** @type {?} */ match; DATE_FORMATS_SPLIT$1.exec(format); let /** @type {?} */ _format = format; while (_format) { match = DATE_FORMATS_SPLIT$1.exec(_format); if (match) { parts = parts.concat(match.slice(1)); _format = /** @type {?} */ ((parts.pop())); } else { parts.push(_format); _format = null; } } DATE_FORMATTER_CACHE.set(cacheKey, parts); } return parts.reduce((text, part) => { const /** @type {?} */ fn = DATE_FORMATS$1[part]; return text + (fn ? fn(date, locale) : partToTime(part)); }, ''); } /** * @param {?} part * @return {?} */ function partToTime(part) { return part === '\'\'' ? '\'' : part.replace(/(^'|'$)/g, '').replace(/''/g, '\''); } class DateFormatter { /** * @param {?} date * @param {?} locale * @param {?} pattern * @return {?} */ static format(date, locale, pattern) { return dateFormatter(pattern, date, locale); } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * \@ngModule CommonModule * \@whatItDoes Formats a date according to locale rules. * \@howToUse `date_expression | date[:format]` * \@description * * Where: * - `expression` is a date object or a number (milliseconds since UTC epoch) or an ISO string * (https://www.w3.org/TR/NOTE-datetime). * - `format` indicates which date/time components to include. The format can be predefined as * shown below or custom as shown in the table. * - `'medium'`: equivalent to `'yMMMdjms'` (e.g. `Sep 3, 2010, 12:05:08 PM` for `en-US`) * - `'short'`: equivalent to `'yMdjm'` (e.g. `9/3/2010, 12:05 PM` for `en-US`) * - `'fullDate'`: equivalent to `'yMMMMEEEEd'` (e.g. `Friday, September 3, 2010` for `en-US`) * - `'longDate'`: equivalent to `'yMMMMd'` (e.g. `September 3, 2010` for `en-US`) * - `'mediumDate'`: equivalent to `'yMMMd'` (e.g. `Sep 3, 2010` for `en-US`) * - `'shortDate'`: equivalent to `'yMd'` (e.g. `9/3/2010` for `en-US`) * - `'mediumTime'`: equivalent to `'jms'` (e.g. `12:05:08 PM` for `en-US`) * - `'shortTime'`: equivalent to `'jm'` (e.g. `12:05 PM` for `en-US`) * * * | Component | Symbol | Narrow | Short Form | Long Form | Numeric | 2-digit | * |-----------|:------:|--------|--------------|-------------------|-----------|-----------| * | era | G | G (A) | GGG (AD) | GGGG (Anno Domini)| - | - | * | year | y | - | - | - | y (2015) | yy (15) | * | month | M | L (S) | MMM (Sep) | MMMM (September) | M (9) | MM (09) | * | day | d | - | - | - | d (3) | dd (03) | * | weekday | E | E (S) | EEE (Sun) | EEEE (Sunday) | - | - | * | hour | j | - | - | - | j (13) | jj (13) | * | hour12 | h | - | - | - | h (1 PM) | hh (01 PM)| * | hour24 | H | - | - | - | H (13) | HH (13) | * | minute | m | - | - | - | m (5) | mm (05) | * | second | s | - | - | - | s (9) | ss (09) | * | timezone | z | - | - | z (Pacific Standard Time)| - | - | * | timezone | Z | - | Z (GMT-8:00) | - | - | - | * | timezone | a | - | a (PM) | - | - | - | * * In javascript, only the components specified will be respected (not the ordering, * punctuations, ...) and details of the formatting will be dependent on the locale. * * Timezone of the formatted text will be the local system timezone of the end-user's machine. * * When the expression is a ISO string without time (e.g. 2016-09-19) the time zone offset is not * applied and the formatted text will have the same day, month and year of the expression. * * WARNINGS: * - this pipe is marked as pure hence it will not be re-evaluated when the input is mutated. * Instead users should treat the date as an immutable object and change the reference when the * pipe needs to re-run (this is to avoid reformatting the date on every change detection run * which would be an expensive operation). * - this pipe uses the Internationalization API. Therefore it is only reliable in Chrome and Opera * browsers. * * ### Examples * * Assuming `dateObj` is (year: 2010, month: 9, day: 3, hour: 12 PM, minute: 05, second: 08) * in the _local_ time and locale is 'en-US': * * {\@example common/pipes/ts/date_pipe.ts region='DeprecatedDatePipe'} * * \@stable */ class DeprecatedDatePipe { /** * @param {?} _locale */ constructor(_locale) { this._locale = _locale; } /** * @param {?} value * @param {?=} pattern * @return {?} */ transform(value, pattern = 'mediumDate') { if (value == null || value === '' || value !== value) return null; let /** @type {?} */ date; if (typeof value === 'string') { value = value.trim(); } if (isDate(value)) { date = value; } else if (!isNaN(value - parseFloat(value))) { date = new Date(parseFloat(value)); } else if (typeof value === 'string' && /^(\d{4}-\d{1,2}-\d{1,2})$/.test(value)) { /** * For ISO Strings without time the day, month and year must be extracted from the ISO String * before Date creation to avoid time offset and errors in the new Date. * If we only replace '-' with ',' in the ISO String ("2015,01,01"), and try to create a new * date, some browsers (e.g. IE 9) will throw an invalid Date error * If we leave the '-' ("2015-01-01") and try to create a new Date("2015-01-01") the * timeoffset * is applied * Note: ISO months are 0 for January, 1 for February, ... */ const [y, m, d] = value.split('-').map((val) => parseInt(val, 10)); date = new Date(y, m - 1, d); } else { date = new Date(value); } if (!isDate(date)) { let /** @type {?} */ match; if ((typeof value === 'string') && (match = value.match(ISO8601_DATE_REGEX))) { date = isoStringToDate(match); } else { throw invalidPipeArgumentError(DeprecatedDatePipe, value); } } return DateFormatter.format(date, this._locale, DeprecatedDatePipe._ALIASES[pattern] || pattern); } } /** * \@internal */ DeprecatedDatePipe._ALIASES = { 'medium': 'yMMMdjms', 'short': 'yMdjm', 'fullDate': 'yMMMMEEEEd', 'longDate': 'yMMMMd', 'mediumDate': 'yMMMd', 'shortDate': 'yMd', 'mediumTime': 'jms', 'shortTime': 'jm' }; DeprecatedDatePipe.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Pipe"], args: [{ name: 'date', pure: true },] }, ]; /** @nocollapse */ DeprecatedDatePipe.ctorParameters = () => [ { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Inject"], args: [__WEBPACK_IMPORTED_MODULE_0__angular_core__["LOCALE_ID"],] },] }, ]; /** * @param {?} value * @return {?} */ function isDate(value) { return value instanceof Date && !isNaN(value.valueOf()); } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ const NUMBER_FORMAT_REGEXP = /^(\d+)?\.((\d+)(-(\d+))?)?$/; const MAX_DIGITS = 22; const DECIMAL_SEP = '.'; const ZERO_CHAR = '0'; const PATTERN_SEP = ';'; const GROUP_SEP = ','; const DIGIT_CHAR = '#'; const CURRENCY_CHAR = '¤'; const PERCENT_CHAR = '%'; /** * Transform a number to a locale string based on a style and a format * * \@internal * @param {?} value * @param {?} locale * @param {?} style * @param {?=} digitsInfo * @param {?=} currency * @return {?} */ function formatNumber$1(value, locale, style, digitsInfo, currency = null) { const /** @type {?} */ res = { str: null }; const /** @type {?} */ format = getLocaleNumberFormat(locale, style); let /** @type {?} */ num; // Convert strings to numbers if (typeof value === 'string' && !isNaN(+value - parseFloat(value))) { num = +value; } else if (typeof value !== 'number') { res.error = `${value} is not a number`; return res; } else { num = value; } const /** @type {?} */ pattern = parseNumberFormat(format, getLocaleNumberSymbol(locale, NumberSymbol.MinusSign)); let /** @type {?} */ formattedText = ''; let /** @type {?} */ isZero = false; if (!isFinite(num)) { formattedText = getLocaleNumberSymbol(locale, NumberSymbol.Infinity); } else { let /** @type {?} */ parsedNumber = parseNumber(num); if (style === NumberFormatStyle.Percent) { parsedNumber = toPercent(parsedNumber); } let /** @type {?} */ minInt = pattern.minInt; let /** @type {?} */ minFraction = pattern.minFrac; let /** @type {?} */ maxFraction = pattern.maxFrac; if (digitsInfo) { const /** @type {?} */ parts = digitsInfo.match(NUMBER_FORMAT_REGEXP); if (parts === null) { res.error = `${digitsInfo} is not a valid digit info`; return res; } const /** @type {?} */ minIntPart = parts[1]; const /** @type {?} */ minFractionPart = parts[3]; const /** @type {?} */ maxFractionPart = parts[5]; if (minIntPart != null) { minInt = parseIntAutoRadix(minIntPart); } if (minFractionPart != null) { minFraction = parseIntAutoRadix(minFractionPart); } if (maxFractionPart != null) { maxFraction = parseIntAutoRadix(maxFractionPart); } else if (minFractionPart != null && minFraction > maxFraction) { maxFraction = minFraction; } } roundNumber(parsedNumber, minFraction, maxFraction); let /** @type {?} */ digits = parsedNumber.digits; let /** @type {?} */ integerLen = parsedNumber.integerLen; const /** @type {?} */ exponent = parsedNumber.exponent; let /** @type {?} */ decimals = []; isZero = digits.every(d => !d); // pad zeros for small numbers for (; integerLen < minInt; integerLen++) { digits.unshift(0); } // pad zeros for small numbers for (; integerLen < 0; integerLen++) { digits.unshift(0); } // extract decimals digits if (integerLen > 0) { decimals = digits.splice(integerLen, digits.length); } else { decimals = digits; digits = [0]; } // format the integer digits with grouping separators const /** @type {?} */ groups = []; if (digits.length >= pattern.lgSize) { groups.unshift(digits.splice(-pattern.lgSize, digits.length).join('')); } while (digits.length > pattern.gSize) { groups.unshift(digits.splice(-pattern.gSize, digits.length).join('')); } if (digits.length) { groups.unshift(digits.join('')); } const /** @type {?} */ groupSymbol = currency ? NumberSymbol.CurrencyGroup : NumberSymbol.Group; formattedText = groups.join(getLocaleNumberSymbol(locale, groupSymbol)); // append the decimal digits if (decimals.length) { const /** @type {?} */ decimalSymbol = currency ? NumberSymbol.CurrencyDecimal : NumberSymbol.Decimal; formattedText += getLocaleNumberSymbol(locale, decimalSymbol) + decimals.join(''); } if (exponent) { formattedText += getLocaleNumberSymbol(locale, NumberSymbol.Exponential) + '+' + exponent; } } if (num < 0 && !isZero) { formattedText = pattern.negPre + formattedText + pattern.negSuf; } else { formattedText = pattern.posPre + formattedText + pattern.posSuf; } if (style === NumberFormatStyle.Currency && currency !== null) { res.str = formattedText .replace(CURRENCY_CHAR, currency) .replace(CURRENCY_CHAR, ''); return res; } if (style === NumberFormatStyle.Percent) { res.str = formattedText.replace(new RegExp(PERCENT_CHAR, 'g'), getLocaleNumberSymbol(locale, NumberSymbol.PercentSign)); return res; } res.str = formattedText; return res; } /** * @param {?} format * @param {?=} minusSign * @return {?} */ function parseNumberFormat(format, minusSign = '-') { const /** @type {?} */ p = { minInt: 1, minFrac: 0, maxFrac: 0, posPre: '', posSuf: '', negPre: '', negSuf: '', gSize: 0, lgSize: 0 }; const /** @type {?} */ patternParts = format.split(PATTERN_SEP); const /** @type {?} */ positive = patternParts[0]; const /** @type {?} */ negative = patternParts[1]; const /** @type {?} */ positiveParts = positive.indexOf(DECIMAL_SEP) !== -1 ? positive.split(DECIMAL_SEP) : [ positive.substring(0, positive.lastIndexOf(ZERO_CHAR) + 1), positive.substring(positive.lastIndexOf(ZERO_CHAR) + 1) ], /** @type {?} */ integer = positiveParts[0], /** @type {?} */ fraction = positiveParts[1] || ''; p.posPre = integer.substr(0, integer.indexOf(DIGIT_CHAR)); for (let /** @type {?} */ i = 0; i < fraction.length; i++) { const /** @type {?} */ ch = fraction.charAt(i); if (ch === ZERO_CHAR) { p.minFrac = p.maxFrac = i + 1; } else if (ch === DIGIT_CHAR) { p.maxFrac = i + 1; } else { p.posSuf += ch; } } const /** @type {?} */ groups = integer.split(GROUP_SEP); p.gSize = groups[1] ? groups[1].length : 0; p.lgSize = (groups[2] || groups[1]) ? (groups[2] || groups[1]).length : 0; if (negative) { const /** @type {?} */ trunkLen = positive.length - p.posPre.length - p.posSuf.length, /** @type {?} */ pos = negative.indexOf(DIGIT_CHAR); p.negPre = negative.substr(0, pos).replace(/'/g, ''); p.negSuf = negative.substr(pos + trunkLen).replace(/'/g, ''); } else { p.negPre = minusSign + p.posPre; p.negSuf = p.posSuf; } return p; } /** * @param {?} parsedNumber * @return {?} */ function toPercent(parsedNumber) { // if the number is 0, don't do anything if (parsedNumber.digits[0] === 0) { return parsedNumber; } // Getting the current number of decimals const /** @type {?} */ fractionLen = parsedNumber.digits.length - parsedNumber.integerLen; if (parsedNumber.exponent) { parsedNumber.exponent += 2; } else { if (fractionLen === 0) { parsedNumber.digits.push(0, 0); } else if (fractionLen === 1) { parsedNumber.digits.push(0); } parsedNumber.integerLen += 2; } return parsedNumber; } /** * Parses a number. * Significant bits of this parse algorithm came from https://github.com/MikeMcl/big.js/ * @param {?} num * @return {?} */ function parseNumber(num) { let /** @type {?} */ numStr = Math.abs(num) + ''; let /** @type {?} */ exponent = 0, /** @type {?} */ digits, /** @type {?} */ integerLen; let /** @type {?} */ i, /** @type {?} */ j, /** @type {?} */ zeros; // Decimal point? if ((integerLen = numStr.indexOf(DECIMAL_SEP)) > -1) { numStr = numStr.replace(DECIMAL_SEP, ''); } // Exponential form? if ((i = numStr.search(/e/i)) > 0) { // Work out the exponent. if (integerLen < 0) integerLen = i; integerLen += +numStr.slice(i + 1); numStr = numStr.substring(0, i); } else if (integerLen < 0) { // There was no decimal point or exponent so it is an integer. integerLen = numStr.length; } // Count the number of leading zeros. for (i = 0; numStr.charAt(i) === ZERO_CHAR; i++) { /* empty */ } if (i === (zeros = numStr.length)) { // The digits are all zero. digits = [0]; integerLen = 1; } else { // Count the number of trailing zeros zeros--; while (numStr.charAt(zeros) === ZERO_CHAR) zeros--; // Trailing zeros are insignificant so ignore them integerLen -= i; digits = []; // Convert string to array of digits without leading/trailing zeros. for (j = 0; i <= zeros; i++, j++) { digits[j] = +numStr.charAt(i); } } // If the number overflows the maximum allowed digits then use an exponent. if (integerLen > MAX_DIGITS) { digits = digits.splice(0, MAX_DIGITS - 1); exponent = integerLen - 1; integerLen = 1; } return { digits, exponent, integerLen }; } /** * Round the parsed number to the specified number of decimal places * This function changes the parsedNumber in-place * @param {?} parsedNumber * @param {?} minFrac * @param {?} maxFrac * @return {?} */ function roundNumber(parsedNumber, minFrac, maxFrac) { if (minFrac > maxFrac) { throw new Error(`The minimum number of digits after fraction (${minFrac}) is higher than the maximum (${maxFrac}).`); } let /** @type {?} */ digits = parsedNumber.digits; let /** @type {?} */ fractionLen = digits.length - parsedNumber.integerLen; const /** @type {?} */ fractionSize = Math.min(Math.max(minFrac, fractionLen), maxFrac); // The index of the digit to where rounding is to occur let /** @type {?} */ roundAt = fractionSize + parsedNumber.integerLen; let /** @type {?} */ digit = digits[roundAt]; if (roundAt > 0) { // Drop fractional digits beyond `roundAt` digits.splice(Math.max(parsedNumber.integerLen, roundAt)); // Set non-fractional digits beyond `roundAt` to 0 for (let /** @type {?} */ j = roundAt; j < digits.length; j++) { digits[j] = 0; } } else { // We rounded to zero so reset the parsedNumber fractionLen = Math.max(0, fractionLen); parsedNumber.integerLen = 1; digits.length = Math.max(1, roundAt = fractionSize + 1); digits[0] = 0; for (let /** @type {?} */ i = 1; i < roundAt; i++) digits[i] = 0; } if (digit >= 5) { if (roundAt - 1 < 0) { for (let /** @type {?} */ k = 0; k > roundAt; k--) { digits.unshift(0); parsedNumber.integerLen++; } digits.unshift(1); parsedNumber.integerLen++; } else { digits[roundAt - 1]++; } } // Pad out with zeros to get the required fraction length for (; fractionLen < Math.max(0, fractionSize); fractionLen++) digits.push(0); let /** @type {?} */ dropTrailingZeros = fractionSize !== 0; // Minimal length = nb of decimals required + current nb of integers // Any number besides that is optional and can be removed if it's a trailing 0 const /** @type {?} */ minLen = minFrac + parsedNumber.integerLen; // Do any carrying, e.g. a digit was rounded up to 10 const /** @type {?} */ carry = digits.reduceRight(function (carry, d, i, digits) { d = d + carry; digits[i] = d < 10 ? d : d - 10; // d % 10 if (dropTrailingZeros) { // Do not keep meaningless fractional trailing zeros (e.g. 15.52000 --> 15.52) if (digits[i] === 0 && i >= minLen) { digits.pop(); } else { dropTrailingZeros = false; } } return d >= 10 ? 1 : 0; // Math.floor(d / 10); }, 0); if (carry) { digits.unshift(carry); parsedNumber.integerLen++; } } /** * \@internal * @param {?} text * @return {?} */ function parseIntAutoRadix(text) { const /** @type {?} */ result = parseInt(text); if (isNaN(result)) { throw new Error('Invalid integer literal when parsing ' + text); } return result; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @param {?} pipe * @param {?} locale * @param {?} value * @param {?} style * @param {?=} digits * @param {?=} currency * @param {?=} currencyAsSymbol * @return {?} */ function formatNumber(pipe, locale, value, style, digits, currency = null, currencyAsSymbol = false) { if (value == null) return null; // Convert strings to numbers value = typeof value === 'string' && !isNaN(+value - parseFloat(value)) ? +value : value; if (typeof value !== 'number') { throw invalidPipeArgumentError(pipe, value); } let /** @type {?} */ minInt; let /** @type {?} */ minFraction; let /** @type {?} */ maxFraction; if (style !== NumberFormatStyle.Currency) { // rely on Intl default for currency minInt = 1; minFraction = 0; maxFraction = 3; } if (digits) { const /** @type {?} */ parts = digits.match(NUMBER_FORMAT_REGEXP); if (parts === null) { throw new Error(`${digits} is not a valid digit info for number pipes`); } if (parts[1] != null) { // min integer digits minInt = parseIntAutoRadix(parts[1]); } if (parts[3] != null) { // min fraction digits minFraction = parseIntAutoRadix(parts[3]); } if (parts[5] != null) { // max fraction digits maxFraction = parseIntAutoRadix(parts[5]); } } return NumberFormatter.format(/** @type {?} */ (value), locale, style, { minimumIntegerDigits: minInt, minimumFractionDigits: minFraction, maximumFractionDigits: maxFraction, currency: currency, currencyAsSymbol: currencyAsSymbol, }); } /** * \@ngModule CommonModule * \@whatItDoes Formats a number according to locale rules. * \@howToUse `number_expression | number[:digitInfo]` * * Formats a number as text. Group sizing and separator and other locale-specific * configurations are based on the active locale. * * where `expression` is a number: * - `digitInfo` is a `string` which has a following format: <br> * <code>{minIntegerDigits}.{minFractionDigits}-{maxFractionDigits}</code> * - `minIntegerDigits` is the minimum number of integer digits to use. Defaults to `1`. * - `minFractionDigits` is the minimum number of digits after fraction. Defaults to `0`. * - `maxFractionDigits` is the maximum number of digits after fraction. Defaults to `3`. * * For more information on the acceptable range for each of these numbers and other * details see your native internationalization library. * * WARNING: this pipe uses the Internationalization API which is not yet available in all browsers * and may require a polyfill. See [Browser Support](guide/browser-support) for details. * * ### Example * * {\@example common/pipes/ts/number_pipe.ts region='DeprecatedNumberPipe'} * * \@stable */ class DeprecatedDecimalPipe { /** * @param {?} _locale */ constructor(_locale) { this._locale = _locale; } /** * @param {?} value * @param {?=} digits * @return {?} */ transform(value, digits) { return formatNumber(DeprecatedDecimalPipe, this._locale, value, NumberFormatStyle.Decimal, digits); } } DeprecatedDecimalPipe.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Pipe"], args: [{ name: 'number' },] }, ]; /** @nocollapse */ DeprecatedDecimalPipe.ctorParameters = () => [ { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Inject"], args: [__WEBPACK_IMPORTED_MODULE_0__angular_core__["LOCALE_ID"],] },] }, ]; /** * \@ngModule CommonModule * \@whatItDoes Formats a number as a percentage according to locale rules. * \@howToUse `number_expression | percent[:digitInfo]` * * \@description * * Formats a number as percentage. * * - `digitInfo` See {\@link DecimalPipe} for detailed description. * * WARNING: this pipe uses the Internationalization API which is not yet available in all browsers * and may require a polyfill. See [Browser Support](guide/browser-support) for details. * * ### Example * * {\@example common/pipes/ts/percent_pipe.ts region='DeprecatedPercentPipe'} * * \@stable */ class DeprecatedPercentPipe { /** * @param {?} _locale */ constructor(_locale) { this._locale = _locale; } /** * @param {?} value * @param {?=} digits * @return {?} */ transform(value, digits) { return formatNumber(DeprecatedPercentPipe, this._locale, value, NumberFormatStyle.Percent, digits); } } DeprecatedPercentPipe.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Pipe"], args: [{ name: 'percent' },] }, ]; /** @nocollapse */ DeprecatedPercentPipe.ctorParameters = () => [ { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Inject"], args: [__WEBPACK_IMPORTED_MODULE_0__angular_core__["LOCALE_ID"],] },] }, ]; /** * \@ngModule CommonModule * \@whatItDoes Formats a number as currency using locale rules. * \@howToUse `number_expression | currency[:currencyCode[:symbolDisplay[:digitInfo]]]` * \@description * * Use `currency` to format a number as currency. * * - `currencyCode` is the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code, such * as `USD` for the US dollar and `EUR` for the euro. * - `symbolDisplay` is a boolean indicating whether to use the currency symbol or code. * - `true`: use symbol (e.g. `$`). * - `false`(default): use code (e.g. `USD`). * - `digitInfo` See {\@link DecimalPipe} for detailed description. * * WARNING: this pipe uses the Internationalization API which is not yet available in all browsers * and may require a polyfill. See [Browser Support](guide/browser-support) for details. * * ### Example * * {\@example common/pipes/ts/currency_pipe.ts region='DeprecatedCurrencyPipe'} * * \@stable */ class DeprecatedCurrencyPipe { /** * @param {?} _locale */ constructor(_locale) { this._locale = _locale; } /** * @param {?} value * @param {?=} currencyCode * @param {?=} symbolDisplay * @param {?=} digits * @return {?} */ transform(value, currencyCode = 'USD', symbolDisplay = false, digits) { return formatNumber(DeprecatedCurrencyPipe, this._locale, value, NumberFormatStyle.Currency, digits, currencyCode, symbolDisplay); } } DeprecatedCurrencyPipe.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Pipe"], args: [{ name: 'currency' },] }, ]; /** @nocollapse */ DeprecatedCurrencyPipe.ctorParameters = () => [ { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Inject"], args: [__WEBPACK_IMPORTED_MODULE_0__angular_core__["LOCALE_ID"],] },] }, ]; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * A collection of deprecated i18n pipes that require intl api * * @deprecated from v5 */ const COMMON_DEPRECATED_I18N_PIPES = [DeprecatedDecimalPipe, DeprecatedPercentPipe, DeprecatedCurrencyPipe, DeprecatedDatePipe]; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ class ObservableStrategy { /** * @param {?} async * @param {?} updateLatestValue * @return {?} */ createSubscription(async, updateLatestValue) { return async.subscribe({ next: updateLatestValue, error: (e) => { throw e; } }); } /** * @param {?} subscription * @return {?} */ dispose(subscription) { subscription.unsubscribe(); } /** * @param {?} subscription * @return {?} */ onDestroy(subscription) { subscription.unsubscribe(); } } class PromiseStrategy { /** * @param {?} async * @param {?} updateLatestValue * @return {?} */ createSubscription(async, updateLatestValue) { return async.then(updateLatestValue, e => { throw e; }); } /** * @param {?} subscription * @return {?} */ dispose(subscription) { } /** * @param {?} subscription * @return {?} */ onDestroy(subscription) { } } const _promiseStrategy = new PromiseStrategy(); const _observableStrategy = new ObservableStrategy(); /** * \@ngModule CommonModule * \@whatItDoes Unwraps a value from an asynchronous primitive. * \@howToUse `observable_or_promise_expression | async` * \@description * The `async` pipe subscribes to an `Observable` or `Promise` and returns the latest value it has * emitted. When a new value is emitted, the `async` pipe marks the component to be checked for * changes. When the component gets destroyed, the `async` pipe unsubscribes automatically to avoid * potential memory leaks. * * * ## Examples * * This example binds a `Promise` to the view. Clicking the `Resolve` button resolves the * promise. * * {\@example common/pipes/ts/async_pipe.ts region='AsyncPipePromise'} * * It's also possible to use `async` with Observables. The example below binds the `time` Observable * to the view. The Observable continuously updates the view with the current time. * * {\@example common/pipes/ts/async_pipe.ts region='AsyncPipeObservable'} * * \@stable */ class AsyncPipe { /** * @param {?} _ref */ constructor(_ref) { this._ref = _ref; this._latestValue = null; this._latestReturnedValue = null; this._subscription = null; this._obj = null; this._strategy = /** @type {?} */ ((null)); } /** * @return {?} */ ngOnDestroy() { if (this._subscription) { this._dispose(); } } /** * @param {?} obj * @return {?} */ transform(obj) { if (!this._obj) { if (obj) { this._subscribe(obj); } this._latestReturnedValue = this._latestValue; return this._latestValue; } if (obj !== this._obj) { this._dispose(); return this.transform(/** @type {?} */ (obj)); } if (this._latestValue === this._latestReturnedValue) { return this._latestReturnedValue; } this._latestReturnedValue = this._latestValue; return __WEBPACK_IMPORTED_MODULE_0__angular_core__["WrappedValue"].wrap(this._latestValue); } /** * @param {?} obj * @return {?} */ _subscribe(obj) { this._obj = obj; this._strategy = this._selectStrategy(obj); this._subscription = this._strategy.createSubscription(obj, (value) => this._updateLatestValue(obj, value)); } /** * @param {?} obj * @return {?} */ _selectStrategy(obj) { if (Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["ɵisPromise"])(obj)) { return _promiseStrategy; } if (Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["ɵisObservable"])(obj)) { return _observableStrategy; } throw invalidPipeArgumentError(AsyncPipe, obj); } /** * @return {?} */ _dispose() { this._strategy.dispose(/** @type {?} */ ((this._subscription))); this._latestValue = null; this._latestReturnedValue = null; this._subscription = null; this._obj = null; } /** * @param {?} async * @param {?} value * @return {?} */ _updateLatestValue(async, value) { if (async === this._obj) { this._latestValue = value; this._ref.markForCheck(); } } } AsyncPipe.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Pipe"], args: [{ name: 'async', pure: false },] }, ]; /** @nocollapse */ AsyncPipe.ctorParameters = () => [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectorRef"], }, ]; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * Transforms text to lowercase. * * {\@example common/pipes/ts/lowerupper_pipe.ts region='LowerUpperPipe' } * * \@stable */ class LowerCasePipe { /** * @param {?} value * @return {?} */ transform(value) { if (!value) return value; if (typeof value !== 'string') { throw invalidPipeArgumentError(LowerCasePipe, value); } return value.toLowerCase(); } } LowerCasePipe.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Pipe"], args: [{ name: 'lowercase' },] }, ]; /** @nocollapse */ LowerCasePipe.ctorParameters = () => []; /** * Helper method to transform a single word to titlecase. * * \@stable * @param {?} word * @return {?} */ function titleCaseWord(word) { if (!word) return word; return word[0].toUpperCase() + word.substr(1).toLowerCase(); } /** * Transforms text to titlecase. * * \@stable */ class TitleCasePipe { /** * @param {?} value * @return {?} */ transform(value) { if (!value) return value; if (typeof value !== 'string') { throw invalidPipeArgumentError(TitleCasePipe, value); } return value.split(/\b/g).map(word => titleCaseWord(word)).join(''); } } TitleCasePipe.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Pipe"], args: [{ name: 'titlecase' },] }, ]; /** @nocollapse */ TitleCasePipe.ctorParameters = () => []; /** * Transforms text to uppercase. * * \@stable */ class UpperCasePipe { /** * @param {?} value * @return {?} */ transform(value) { if (!value) return value; if (typeof value !== 'string') { throw invalidPipeArgumentError(UpperCasePipe, value); } return value.toUpperCase(); } } UpperCasePipe.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Pipe"], args: [{ name: 'uppercase' },] }, ]; /** @nocollapse */ UpperCasePipe.ctorParameters = () => []; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ const _INTERPOLATION_REGEXP = /#/g; /** * \@ngModule CommonModule * \@whatItDoes Maps a value to a string that pluralizes the value according to locale rules. * \@howToUse `expression | i18nPlural:mapping[:locale]` * \@description * * Where: * - `expression` is a number. * - `mapping` is an object that mimics the ICU format, see * http://userguide.icu-project.org/formatparse/messages * - `locale` is a `string` defining the locale to use (uses the current {\@link LOCALE_ID} by * default) * * ## Example * * {\@example common/pipes/ts/i18n_pipe.ts region='I18nPluralPipeComponent'} * * \@experimental */ class I18nPluralPipe { /** * @param {?} _localization */ constructor(_localization) { this._localization = _localization; } /** * @param {?} value * @param {?} pluralMap * @param {?=} locale * @return {?} */ transform(value, pluralMap, locale) { if (value == null) return ''; if (typeof pluralMap !== 'object' || pluralMap === null) { throw invalidPipeArgumentError(I18nPluralPipe, pluralMap); } const /** @type {?} */ key = getPluralCategory(value, Object.keys(pluralMap), this._localization, locale); return pluralMap[key].replace(_INTERPOLATION_REGEXP, value.toString()); } } I18nPluralPipe.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Pipe"], args: [{ name: 'i18nPlural', pure: true },] }, ]; /** @nocollapse */ I18nPluralPipe.ctorParameters = () => [ { type: NgLocalization, }, ]; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * \@ngModule CommonModule * \@whatItDoes Generic selector that displays the string that matches the current value. * \@howToUse `expression | i18nSelect:mapping` * \@description * * Where `mapping` is an object that indicates the text that should be displayed * for different values of the provided `expression`. * If none of the keys of the mapping match the value of the `expression`, then the content * of the `other` key is returned when present, otherwise an empty string is returned. * * ## Example * * {\@example common/pipes/ts/i18n_pipe.ts region='I18nSelectPipeComponent'} * * \@experimental */ class I18nSelectPipe { /** * @param {?} value * @param {?} mapping * @return {?} */ transform(value, mapping) { if (value == null) return ''; if (typeof mapping !== 'object' || typeof value !== 'string') { throw invalidPipeArgumentError(I18nSelectPipe, mapping); } if (mapping.hasOwnProperty(value)) { return mapping[value]; } if (mapping.hasOwnProperty('other')) { return mapping['other']; } return ''; } } I18nSelectPipe.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Pipe"], args: [{ name: 'i18nSelect', pure: true },] }, ]; /** @nocollapse */ I18nSelectPipe.ctorParameters = () => []; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * \@ngModule CommonModule * \@whatItDoes Converts value into JSON string. * \@howToUse `expression | json` * \@description * * Converts value into string using `JSON.stringify`. Useful for debugging. * * ### Example * {\@example common/pipes/ts/json_pipe.ts region='JsonPipe'} * * \@stable */ class JsonPipe { /** * @param {?} value * @return {?} */ transform(value) { return JSON.stringify(value, null, 2); } } JsonPipe.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Pipe"], args: [{ name: 'json', pure: false },] }, ]; /** @nocollapse */ JsonPipe.ctorParameters = () => []; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * \@ngModule CommonModule * \@whatItDoes Formats a number according to locale rules. * \@howToUse `number_expression | number[:digitInfo[:locale]]` * * Formats a number as text. Group sizing and separator and other locale-specific * configurations are based on the active locale. * * where `expression` is a number: * - `digitInfo` is a `string` which has a following format: <br> * <code>{minIntegerDigits}.{minFractionDigits}-{maxFractionDigits}</code> * - `minIntegerDigits` is the minimum number of integer digits to use. Defaults to `1`. * - `minFractionDigits` is the minimum number of digits after fraction. Defaults to `0`. * - `maxFractionDigits` is the maximum number of digits after fraction. Defaults to `3`. * - `locale` is a `string` defining the locale to use (uses the current {\@link LOCALE_ID} by * default) * * For more information on the acceptable range for each of these numbers and other * details see your native internationalization library. * * ### Example * * {\@example common/pipes/ts/number_pipe.ts region='NumberPipe'} * * \@stable */ class DecimalPipe { /** * @param {?} _locale */ constructor(_locale) { this._locale = _locale; } /** * @param {?} value * @param {?=} digits * @param {?=} locale * @return {?} */ transform(value, digits, locale) { if (isEmpty(value)) return null; locale = locale || this._locale; const { str, error } = formatNumber$1(value, locale, NumberFormatStyle.Decimal, digits); if (error) { throw invalidPipeArgumentError(DecimalPipe, error); } return str; } } DecimalPipe.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Pipe"], args: [{ name: 'number' },] }, ]; /** @nocollapse */ DecimalPipe.ctorParameters = () => [ { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Inject"], args: [__WEBPACK_IMPORTED_MODULE_0__angular_core__["LOCALE_ID"],] },] }, ]; /** * \@ngModule CommonModule * \@whatItDoes Formats a number as a percentage according to locale rules. * \@howToUse `number_expression | percent[:digitInfo[:locale]]` * * \@description * * Formats a number as percentage. * * - `digitInfo` See {\@link DecimalPipe} for detailed description. * - `locale` is a `string` defining the locale to use (uses the current {\@link LOCALE_ID} by * default) * * ### Example * * {\@example common/pipes/ts/percent_pipe.ts region='PercentPipe'} * * \@stable */ class PercentPipe { /** * @param {?} _locale */ constructor(_locale) { this._locale = _locale; } /** * @param {?} value * @param {?=} digits * @param {?=} locale * @return {?} */ transform(value, digits, locale) { if (isEmpty(value)) return null; locale = locale || this._locale; const { str, error } = formatNumber$1(value, locale, NumberFormatStyle.Percent, digits); if (error) { throw invalidPipeArgumentError(PercentPipe, error); } return str; } } PercentPipe.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Pipe"], args: [{ name: 'percent' },] }, ]; /** @nocollapse */ PercentPipe.ctorParameters = () => [ { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Inject"], args: [__WEBPACK_IMPORTED_MODULE_0__angular_core__["LOCALE_ID"],] },] }, ]; /** * \@ngModule CommonModule * \@whatItDoes Formats a number as currency using locale rules. * \@howToUse `number_expression | currency[:currencyCode[:display[:digitInfo[:locale]]]]` * \@description * * Use `currency` to format a number as currency. * * - `currencyCode` is the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code, such * as `USD` for the US dollar and `EUR` for the euro. * - `display` indicates whether to show the currency symbol or the code. * - `code`: use code (e.g. `USD`). * - `symbol`(default): use symbol (e.g. `$`). * - `symbol-narrow`: some countries have two symbols for their currency, one regular and one * narrow (e.g. the canadian dollar CAD has the symbol `CA$` and the symbol-narrow `$`). * - boolean (deprecated from v5): `true` for symbol and false for `code` * If there is no narrow symbol for the chosen currency, the regular symbol will be used. * - `digitInfo` See {\@link DecimalPipe} for detailed description. * - `locale` is a `string` defining the locale to use (uses the current {\@link LOCALE_ID} by * default) * * ### Example * * {\@example common/pipes/ts/currency_pipe.ts region='CurrencyPipe'} * * \@stable */ class CurrencyPipe { /** * @param {?} _locale */ constructor(_locale) { this._locale = _locale; } /** * @param {?} value * @param {?=} currencyCode * @param {?=} display * @param {?=} digits * @param {?=} locale * @return {?} */ transform(value, currencyCode, display = 'symbol', digits, locale) { if (isEmpty(value)) return null; locale = locale || this._locale; if (typeof display === 'boolean') { if (/** @type {?} */ (console) && /** @type {?} */ (console.warn)) { console.warn(`Warning: the currency pipe has been changed in Angular v5. The symbolDisplay option (third parameter) is now a string instead of a boolean. The accepted values are "code", "symbol" or "symbol-narrow".`); } display = display ? 'symbol' : 'code'; } let /** @type {?} */ currency = currencyCode || 'USD'; if (display !== 'code') { currency = getCurrencySymbol(currency, display === 'symbol' ? 'wide' : 'narrow'); } const { str, error } = formatNumber$1(value, locale, NumberFormatStyle.Currency, digits, currency); if (error) { throw invalidPipeArgumentError(CurrencyPipe, error); } return str; } } CurrencyPipe.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Pipe"], args: [{ name: 'currency' },] }, ]; /** @nocollapse */ CurrencyPipe.ctorParameters = () => [ { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Inject"], args: [__WEBPACK_IMPORTED_MODULE_0__angular_core__["LOCALE_ID"],] },] }, ]; /** * @param {?} value * @return {?} */ function isEmpty(value) { return value == null || value === '' || value !== value; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * \@ngModule CommonModule * \@whatItDoes Creates a new List or String containing a subset (slice) of the elements. * \@howToUse `array_or_string_expression | slice:start[:end]` * \@description * * Where the input expression is a `List` or `String`, and: * - `start`: The starting index of the subset to return. * - **a positive integer**: return the item at `start` index and all items after * in the list or string expression. * - **a negative integer**: return the item at `start` index from the end and all items after * in the list or string expression. * - **if positive and greater than the size of the expression**: return an empty list or string. * - **if negative and greater than the size of the expression**: return entire list or string. * - `end`: The ending index of the subset to return. * - **omitted**: return all items until the end. * - **if positive**: return all items before `end` index of the list or string. * - **if negative**: return all items before `end` index from the end of the list or string. * * All behavior is based on the expected behavior of the JavaScript API `Array.prototype.slice()` * and `String.prototype.slice()`. * * When operating on a [List], the returned list is always a copy even when all * the elements are being returned. * * When operating on a blank value, the pipe returns the blank value. * * ## List Example * * This `ngFor` example: * * {\@example common/pipes/ts/slice_pipe.ts region='SlicePipe_list'} * * produces the following: * * <li>b</li> * <li>c</li> * * ## String Examples * * {\@example common/pipes/ts/slice_pipe.ts region='SlicePipe_string'} * * \@stable */ class SlicePipe { /** * @param {?} value * @param {?} start * @param {?=} end * @return {?} */ transform(value, start, end) { if (value == null) return value; if (!this.supports(value)) { throw invalidPipeArgumentError(SlicePipe, value); } return value.slice(start, end); } /** * @param {?} obj * @return {?} */ supports(obj) { return typeof obj === 'string' || Array.isArray(obj); } } SlicePipe.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Pipe"], args: [{ name: 'slice', pure: false },] }, ]; /** @nocollapse */ SlicePipe.ctorParameters = () => []; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * A collection of Angular pipes that are likely to be used in each and every application. */ const COMMON_PIPES = [ AsyncPipe, UpperCasePipe, LowerCasePipe, JsonPipe, SlicePipe, DecimalPipe, PercentPipe, TitleCasePipe, CurrencyPipe, DatePipe, I18nPluralPipe, I18nSelectPipe, ]; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * The module that includes all the basic Angular directives like {\@link NgIf}, {\@link NgForOf}, ... * * \@stable */ class CommonModule { } CommonModule.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["NgModule"], args: [{ declarations: [COMMON_DIRECTIVES, COMMON_PIPES], exports: [COMMON_DIRECTIVES, COMMON_PIPES], providers: [ { provide: NgLocalization, useClass: NgLocaleLocalization }, ], },] }, ]; /** @nocollapse */ CommonModule.ctorParameters = () => []; const ɵ0 = getPluralCase; /** * A module that contains the deprecated i18n pipes. * * @deprecated from v5 */ class DeprecatedI18NPipesModule { } DeprecatedI18NPipesModule.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["NgModule"], args: [{ declarations: [COMMON_DEPRECATED_I18N_PIPES], exports: [COMMON_DEPRECATED_I18N_PIPES], providers: [{ provide: DEPRECATED_PLURAL_FN, useValue: ɵ0 }], },] }, ]; /** @nocollapse */ DeprecatedI18NPipesModule.ctorParameters = () => []; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * A DI Token representing the main rendering context. In a browser this is the DOM Document. * * Note: Document might not be available in the Application Context when Application and Rendering * Contexts are not the same (e.g. when running the application into a Web Worker). * * \@stable */ const DOCUMENT = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["InjectionToken"]('DocumentToken'); /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ const PLATFORM_BROWSER_ID = 'browser'; const PLATFORM_SERVER_ID = 'server'; const PLATFORM_WORKER_APP_ID = 'browserWorkerApp'; const PLATFORM_WORKER_UI_ID = 'browserWorkerUi'; /** * Returns whether a platform id represents a browser platform. * \@experimental * @param {?} platformId * @return {?} */ function isPlatformBrowser(platformId) { return platformId === PLATFORM_BROWSER_ID; } /** * Returns whether a platform id represents a server platform. * \@experimental * @param {?} platformId * @return {?} */ function isPlatformServer(platformId) { return platformId === PLATFORM_SERVER_ID; } /** * Returns whether a platform id represents a web worker app platform. * \@experimental * @param {?} platformId * @return {?} */ function isPlatformWorkerApp(platformId) { return platformId === PLATFORM_WORKER_APP_ID; } /** * Returns whether a platform id represents a web worker UI platform. * \@experimental * @param {?} platformId * @return {?} */ function isPlatformWorkerUi(platformId) { return platformId === PLATFORM_WORKER_UI_ID; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * \@stable */ const VERSION = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["Version"]('5.2.10'); /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @module * @description * Entry point for all public APIs of the common package. */ /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @module * @description * Entry point for all public APIs of this package. */ // This file only reexports content of the `src` folder. Keep it that way. /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * Generated bundle index. Do not edit. */ //# sourceMappingURL=common.js.map /***/ }), /***/ "./node_modules/@angular/common/esm2015/http.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export HttpBackend */ /* unused harmony export HttpHandler */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return HttpClient; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return HttpHeaders; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return HTTP_INTERCEPTORS; }); /* unused harmony export JsonpClientBackend */ /* unused harmony export JsonpInterceptor */ /* unused harmony export HttpClientJsonpModule */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return HttpClientModule; }); /* unused harmony export HttpClientXsrfModule */ /* unused harmony export ɵinterceptingHandler */ /* unused harmony export HttpParams */ /* unused harmony export HttpUrlEncodingCodec */ /* unused harmony export HttpRequest */ /* unused harmony export HttpErrorResponse */ /* unused harmony export HttpEventType */ /* unused harmony export HttpHeaderResponse */ /* unused harmony export HttpResponse */ /* unused harmony export HttpResponseBase */ /* unused harmony export HttpXhrBackend */ /* unused harmony export XhrFactory */ /* unused harmony export HttpXsrfTokenExtractor */ /* unused harmony export ɵa */ /* unused harmony export ɵb */ /* unused harmony export ɵc */ /* unused harmony export ɵd */ /* unused harmony export ɵe */ /* unused harmony export ɵh */ /* unused harmony export ɵi */ /* unused harmony export ɵf */ /* unused harmony export ɵg */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_rxjs_observable_of__ = __webpack_require__("./node_modules/rxjs/_esm2015/observable/of.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_rxjs_operator_concatMap__ = __webpack_require__("./node_modules/rxjs/_esm2015/operator/concatMap.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_rxjs_operator_filter__ = __webpack_require__("./node_modules/rxjs/_esm2015/operator/filter.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_rxjs_operator_map__ = __webpack_require__("./node_modules/rxjs/_esm2015/operator/map.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__angular_common__ = __webpack_require__("./node_modules/@angular/common/esm2015/common.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_rxjs_Observable__ = __webpack_require__("./node_modules/rxjs/_esm2015/Observable.js"); /** * @license Angular v5.2.10 * (c) 2010-2018 Google, Inc. https://angular.io/ * License: MIT */ /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * Transforms an `HttpRequest` into a stream of `HttpEvent`s, one of which will likely be a * `HttpResponse`. * * `HttpHandler` is injectable. When injected, the handler instance dispatches requests to the * first interceptor in the chain, which dispatches to the second, etc, eventually reaching the * `HttpBackend`. * * In an `HttpInterceptor`, the `HttpHandler` parameter is the next interceptor in the chain. * * \@stable * @abstract */ class HttpHandler { } /** * A final `HttpHandler` which will dispatch the request via browser HTTP APIs to a backend. * * Interceptors sit between the `HttpClient` interface and the `HttpBackend`. * * When injected, `HttpBackend` dispatches requests directly to the backend, without going * through the interceptor chain. * * \@stable * @abstract */ class HttpBackend { } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @record */ /** * Immutable set of Http headers, with lazy parsing. * \@stable */ class HttpHeaders { /** * @param {?=} headers */ constructor(headers) { /** * Internal map of lowercased header names to the normalized * form of the name (the form seen first). */ this.normalizedNames = new Map(); /** * Queued updates to be materialized the next initialization. */ this.lazyUpdate = null; if (!headers) { this.headers = new Map(); } else if (typeof headers === 'string') { this.lazyInit = () => { this.headers = new Map(); headers.split('\n').forEach(line => { const /** @type {?} */ index = line.indexOf(':'); if (index > 0) { const /** @type {?} */ name = line.slice(0, index); const /** @type {?} */ key = name.toLowerCase(); const /** @type {?} */ value = line.slice(index + 1).trim(); this.maybeSetNormalizedName(name, key); if (this.headers.has(key)) { /** @type {?} */ ((this.headers.get(key))).push(value); } else { this.headers.set(key, [value]); } } }); }; } else { this.lazyInit = () => { this.headers = new Map(); Object.keys(headers).forEach(name => { let /** @type {?} */ values = headers[name]; const /** @type {?} */ key = name.toLowerCase(); if (typeof values === 'string') { values = [values]; } if (values.length > 0) { this.headers.set(key, values); this.maybeSetNormalizedName(name, key); } }); }; } } /** * Checks for existence of header by given name. * @param {?} name * @return {?} */ has(name) { this.init(); return this.headers.has(name.toLowerCase()); } /** * Returns first header that matches given name. * @param {?} name * @return {?} */ get(name) { this.init(); const /** @type {?} */ values = this.headers.get(name.toLowerCase()); return values && values.length > 0 ? values[0] : null; } /** * Returns the names of the headers * @return {?} */ keys() { this.init(); return Array.from(this.normalizedNames.values()); } /** * Returns list of header values for a given name. * @param {?} name * @return {?} */ getAll(name) { this.init(); return this.headers.get(name.toLowerCase()) || null; } /** * @param {?} name * @param {?} value * @return {?} */ append(name, value) { return this.clone({ name, value, op: 'a' }); } /** * @param {?} name * @param {?} value * @return {?} */ set(name, value) { return this.clone({ name, value, op: 's' }); } /** * @param {?} name * @param {?=} value * @return {?} */ delete(name, value) { return this.clone({ name, value, op: 'd' }); } /** * @param {?} name * @param {?} lcName * @return {?} */ maybeSetNormalizedName(name, lcName) { if (!this.normalizedNames.has(lcName)) { this.normalizedNames.set(lcName, name); } } /** * @return {?} */ init() { if (!!this.lazyInit) { if (this.lazyInit instanceof HttpHeaders) { this.copyFrom(this.lazyInit); } else { this.lazyInit(); } this.lazyInit = null; if (!!this.lazyUpdate) { this.lazyUpdate.forEach(update => this.applyUpdate(update)); this.lazyUpdate = null; } } } /** * @param {?} other * @return {?} */ copyFrom(other) { other.init(); Array.from(other.headers.keys()).forEach(key => { this.headers.set(key, /** @type {?} */ ((other.headers.get(key)))); this.normalizedNames.set(key, /** @type {?} */ ((other.normalizedNames.get(key)))); }); } /** * @param {?} update * @return {?} */ clone(update) { const /** @type {?} */ clone = new HttpHeaders(); clone.lazyInit = (!!this.lazyInit && this.lazyInit instanceof HttpHeaders) ? this.lazyInit : this; clone.lazyUpdate = (this.lazyUpdate || []).concat([update]); return clone; } /** * @param {?} update * @return {?} */ applyUpdate(update) { const /** @type {?} */ key = update.name.toLowerCase(); switch (update.op) { case 'a': case 's': let /** @type {?} */ value = /** @type {?} */ ((update.value)); if (typeof value === 'string') { value = [value]; } if (value.length === 0) { return; } this.maybeSetNormalizedName(update.name, key); const /** @type {?} */ base = (update.op === 'a' ? this.headers.get(key) : undefined) || []; base.push(...value); this.headers.set(key, base); break; case 'd': const /** @type {?} */ toDelete = /** @type {?} */ (update.value); if (!toDelete) { this.headers.delete(key); this.normalizedNames.delete(key); } else { let /** @type {?} */ existing = this.headers.get(key); if (!existing) { return; } existing = existing.filter(value => toDelete.indexOf(value) === -1); if (existing.length === 0) { this.headers.delete(key); this.normalizedNames.delete(key); } else { this.headers.set(key, existing); } } break; } } /** * \@internal * @param {?} fn * @return {?} */ forEach(fn) { this.init(); Array.from(this.normalizedNames.keys()) .forEach(key => fn(/** @type {?} */ ((this.normalizedNames.get(key))), /** @type {?} */ ((this.headers.get(key))))); } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * A codec for encoding and decoding parameters in URLs. * * Used by `HttpParams`. * * \@stable * * @record */ /** * A `HttpParameterCodec` that uses `encodeURIComponent` and `decodeURIComponent` to * serialize and parse URL parameter keys and values. * * \@stable */ class HttpUrlEncodingCodec { /** * @param {?} k * @return {?} */ encodeKey(k) { return standardEncoding(k); } /** * @param {?} v * @return {?} */ encodeValue(v) { return standardEncoding(v); } /** * @param {?} k * @return {?} */ decodeKey(k) { return decodeURIComponent(k); } /** * @param {?} v * @return {?} */ decodeValue(v) { return decodeURIComponent(v); } } /** * @param {?} rawParams * @param {?} codec * @return {?} */ function paramParser(rawParams, codec) { const /** @type {?} */ map$$1 = new Map(); if (rawParams.length > 0) { const /** @type {?} */ params = rawParams.split('&'); params.forEach((param) => { const /** @type {?} */ eqIdx = param.indexOf('='); const [key, val] = eqIdx == -1 ? [codec.decodeKey(param), ''] : [codec.decodeKey(param.slice(0, eqIdx)), codec.decodeValue(param.slice(eqIdx + 1))]; const /** @type {?} */ list = map$$1.get(key) || []; list.push(val); map$$1.set(key, list); }); } return map$$1; } /** * @param {?} v * @return {?} */ function standardEncoding(v) { return encodeURIComponent(v) .replace(/%40/gi, '@') .replace(/%3A/gi, ':') .replace(/%24/gi, '$') .replace(/%2C/gi, ',') .replace(/%3B/gi, ';') .replace(/%2B/gi, '+') .replace(/%3D/gi, '=') .replace(/%3F/gi, '?') .replace(/%2F/gi, '/'); } /** * An HTTP request/response body that represents serialized parameters, * per the MIME type `application/x-www-form-urlencoded`. * * This class is immutable - all mutation operations return a new instance. * * \@stable */ class HttpParams { /** * @param {?=} options */ constructor(options = /** @type {?} */ ({})) { this.updates = null; this.cloneFrom = null; this.encoder = options.encoder || new HttpUrlEncodingCodec(); if (!!options.fromString) { if (!!options.fromObject) { throw new Error(`Cannot specify both fromString and fromObject.`); } this.map = paramParser(options.fromString, this.encoder); } else if (!!options.fromObject) { this.map = new Map(); Object.keys(options.fromObject).forEach(key => { const /** @type {?} */ value = (/** @type {?} */ (options.fromObject))[key]; /** @type {?} */ ((this.map)).set(key, Array.isArray(value) ? value : [value]); }); } else { this.map = null; } } /** * Check whether the body has one or more values for the given parameter name. * @param {?} param * @return {?} */ has(param) { this.init(); return /** @type {?} */ ((this.map)).has(param); } /** * Get the first value for the given parameter name, or `null` if it's not present. * @param {?} param * @return {?} */ get(param) { this.init(); const /** @type {?} */ res = /** @type {?} */ ((this.map)).get(param); return !!res ? res[0] : null; } /** * Get all values for the given parameter name, or `null` if it's not present. * @param {?} param * @return {?} */ getAll(param) { this.init(); return /** @type {?} */ ((this.map)).get(param) || null; } /** * Get all the parameter names for this body. * @return {?} */ keys() { this.init(); return Array.from(/** @type {?} */ ((this.map)).keys()); } /** * Construct a new body with an appended value for the given parameter name. * @param {?} param * @param {?} value * @return {?} */ append(param, value) { return this.clone({ param, value, op: 'a' }); } /** * Construct a new body with a new value for the given parameter name. * @param {?} param * @param {?} value * @return {?} */ set(param, value) { return this.clone({ param, value, op: 's' }); } /** * Construct a new body with either the given value for the given parameter * removed, if a value is given, or all values for the given parameter removed * if not. * @param {?} param * @param {?=} value * @return {?} */ delete(param, value) { return this.clone({ param, value, op: 'd' }); } /** * Serialize the body to an encoded string, where key-value pairs (separated by `=`) are * separated by `&`s. * @return {?} */ toString() { this.init(); return this.keys() .map(key => { const /** @type {?} */ eKey = this.encoder.encodeKey(key); return /** @type {?} */ ((/** @type {?} */ ((this.map)).get(key))).map(value => eKey + '=' + this.encoder.encodeValue(value)).join('&'); }) .join('&'); } /** * @param {?} update * @return {?} */ clone(update) { const /** @type {?} */ clone = new HttpParams({ encoder: this.encoder }); clone.cloneFrom = this.cloneFrom || this; clone.updates = (this.updates || []).concat([update]); return clone; } /** * @return {?} */ init() { if (this.map === null) { this.map = new Map(); } if (this.cloneFrom !== null) { this.cloneFrom.init(); this.cloneFrom.keys().forEach(key => /** @type {?} */ ((this.map)).set(key, /** @type {?} */ ((/** @type {?} */ ((/** @type {?} */ ((this.cloneFrom)).map)).get(key))))); /** @type {?} */ ((this.updates)).forEach(update => { switch (update.op) { case 'a': case 's': const /** @type {?} */ base = (update.op === 'a' ? /** @type {?} */ ((this.map)).get(update.param) : undefined) || []; base.push(/** @type {?} */ ((update.value))); /** @type {?} */ ((this.map)).set(update.param, base); break; case 'd': if (update.value !== undefined) { let /** @type {?} */ base = /** @type {?} */ ((this.map)).get(update.param) || []; const /** @type {?} */ idx = base.indexOf(update.value); if (idx !== -1) { base.splice(idx, 1); } if (base.length > 0) { /** @type {?} */ ((this.map)).set(update.param, base); } else { /** @type {?} */ ((this.map)).delete(update.param); } } else { /** @type {?} */ ((this.map)).delete(update.param); break; } } }); this.cloneFrom = null; } } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * Determine whether the given HTTP method may include a body. * @param {?} method * @return {?} */ function mightHaveBody(method) { switch (method) { case 'DELETE': case 'GET': case 'HEAD': case 'OPTIONS': case 'JSONP': return false; default: return true; } } /** * Safely assert whether the given value is an ArrayBuffer. * * In some execution environments ArrayBuffer is not defined. * @param {?} value * @return {?} */ function isArrayBuffer(value) { return typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer; } /** * Safely assert whether the given value is a Blob. * * In some execution environments Blob is not defined. * @param {?} value * @return {?} */ function isBlob(value) { return typeof Blob !== 'undefined' && value instanceof Blob; } /** * Safely assert whether the given value is a FormData instance. * * In some execution environments FormData is not defined. * @param {?} value * @return {?} */ function isFormData(value) { return typeof FormData !== 'undefined' && value instanceof FormData; } /** * An outgoing HTTP request with an optional typed body. * * `HttpRequest` represents an outgoing request, including URL, method, * headers, body, and other request configuration options. Instances should be * assumed to be immutable. To modify a `HttpRequest`, the `clone` * method should be used. * * \@stable * @template T */ class HttpRequest { /** * @param {?} method * @param {?} url * @param {?=} third * @param {?=} fourth */ constructor(method, url, third, fourth) { this.url = url; /** * The request body, or `null` if one isn't set. * * Bodies are not enforced to be immutable, as they can include a reference to any * user-defined data type. However, interceptors should take care to preserve * idempotence by treating them as such. */ this.body = null; /** * Whether this request should be made in a way that exposes progress events. * * Progress events are expensive (change detection runs on each event) and so * they should only be requested if the consumer intends to monitor them. */ this.reportProgress = false; /** * Whether this request should be sent with outgoing credentials (cookies). */ this.withCredentials = false; /** * The expected response type of the server. * * This is used to parse the response appropriately before returning it to * the requestee. */ this.responseType = 'json'; this.method = method.toUpperCase(); // Next, need to figure out which argument holds the HttpRequestInit // options, if any. let /** @type {?} */ options; // Check whether a body argument is expected. The only valid way to omit // the body argument is to use a known no-body method like GET. if (mightHaveBody(this.method) || !!fourth) { // Body is the third argument, options are the fourth. this.body = (third !== undefined) ? /** @type {?} */ (third) : null; options = fourth; } else { // No body required, options are the third argument. The body stays null. options = /** @type {?} */ (third); } // If options have been passed, interpret them. if (options) { // Normalize reportProgress and withCredentials. this.reportProgress = !!options.reportProgress; this.withCredentials = !!options.withCredentials; // Override default response type of 'json' if one is provided. if (!!options.responseType) { this.responseType = options.responseType; } // Override headers if they're provided. if (!!options.headers) { this.headers = options.headers; } if (!!options.params) { this.params = options.params; } } // If no headers have been passed in, construct a new HttpHeaders instance. if (!this.headers) { this.headers = new HttpHeaders(); } // If no parameters have been passed in, construct a new HttpUrlEncodedParams instance. if (!this.params) { this.params = new HttpParams(); this.urlWithParams = url; } else { // Encode the parameters to a string in preparation for inclusion in the URL. const /** @type {?} */ params = this.params.toString(); if (params.length === 0) { // No parameters, the visible URL is just the URL given at creation time. this.urlWithParams = url; } else { // Does the URL already have query parameters? Look for '?'. const /** @type {?} */ qIdx = url.indexOf('?'); // There are 3 cases to handle: // 1) No existing parameters -> append '?' followed by params. // 2) '?' exists and is followed by existing query string -> // append '&' followed by params. // 3) '?' exists at the end of the url -> append params directly. // This basically amounts to determining the character, if any, with // which to join the URL and parameters. const /** @type {?} */ sep = qIdx === -1 ? '?' : (qIdx < url.length - 1 ? '&' : ''); this.urlWithParams = url + sep + params; } } } /** * Transform the free-form body into a serialized format suitable for * transmission to the server. * @return {?} */ serializeBody() { // If no body is present, no need to serialize it. if (this.body === null) { return null; } // Check whether the body is already in a serialized form. If so, // it can just be returned directly. if (isArrayBuffer(this.body) || isBlob(this.body) || isFormData(this.body) || typeof this.body === 'string') { return this.body; } // Check whether the body is an instance of HttpUrlEncodedParams. if (this.body instanceof HttpParams) { return this.body.toString(); } // Check whether the body is an object or array, and serialize with JSON if so. if (typeof this.body === 'object' || typeof this.body === 'boolean' || Array.isArray(this.body)) { return JSON.stringify(this.body); } // Fall back on toString() for everything else. return (/** @type {?} */ (this.body)).toString(); } /** * Examine the body and attempt to infer an appropriate MIME type * for it. * * If no such type can be inferred, this method will return `null`. * @return {?} */ detectContentTypeHeader() { // An empty body has no content type. if (this.body === null) { return null; } // FormData bodies rely on the browser's content type assignment. if (isFormData(this.body)) { return null; } // Blobs usually have their own content type. If it doesn't, then // no type can be inferred. if (isBlob(this.body)) { return this.body.type || null; } // Array buffers have unknown contents and thus no type can be inferred. if (isArrayBuffer(this.body)) { return null; } // Technically, strings could be a form of JSON data, but it's safe enough // to assume they're plain strings. if (typeof this.body === 'string') { return 'text/plain'; } // `HttpUrlEncodedParams` has its own content-type. if (this.body instanceof HttpParams) { return 'application/x-www-form-urlencoded;charset=UTF-8'; } // Arrays, objects, and numbers will be encoded as JSON. if (typeof this.body === 'object' || typeof this.body === 'number' || Array.isArray(this.body)) { return 'application/json'; } // No type could be inferred. return null; } /** * @param {?=} update * @return {?} */ clone(update = {}) { // For method, url, and responseType, take the current value unless // it is overridden in the update hash. const /** @type {?} */ method = update.method || this.method; const /** @type {?} */ url = update.url || this.url; const /** @type {?} */ responseType = update.responseType || this.responseType; // The body is somewhat special - a `null` value in update.body means // whatever current body is present is being overridden with an empty // body, whereas an `undefined` value in update.body implies no // override. const /** @type {?} */ body = (update.body !== undefined) ? update.body : this.body; // Carefully handle the boolean options to differentiate between // `false` and `undefined` in the update args. const /** @type {?} */ withCredentials = (update.withCredentials !== undefined) ? update.withCredentials : this.withCredentials; const /** @type {?} */ reportProgress = (update.reportProgress !== undefined) ? update.reportProgress : this.reportProgress; // Headers and params may be appended to if `setHeaders` or // `setParams` are used. let /** @type {?} */ headers = update.headers || this.headers; let /** @type {?} */ params = update.params || this.params; // Check whether the caller has asked to add headers. if (update.setHeaders !== undefined) { // Set every requested header. headers = Object.keys(update.setHeaders) .reduce((headers, name) => headers.set(name, /** @type {?} */ ((update.setHeaders))[name]), headers); } // Check whether the caller has asked to set params. if (update.setParams) { // Set every requested param. params = Object.keys(update.setParams) .reduce((params, param) => params.set(param, /** @type {?} */ ((update.setParams))[param]), params); } // Finally, construct the new HttpRequest using the pieces from above. return new HttpRequest(method, url, body, { params, headers, reportProgress, responseType, withCredentials, }); } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** @enum {number} */ const HttpEventType = { /** * The request was sent out over the wire. */ Sent: 0, /** * An upload progress event was received. */ UploadProgress: 1, /** * The response status code and headers were received. */ ResponseHeader: 2, /** * A download progress event was received. */ DownloadProgress: 3, /** * The full response including the body was received. */ Response: 4, /** * A custom event from an interceptor or a backend. */ User: 5, }; HttpEventType[HttpEventType.Sent] = "Sent"; HttpEventType[HttpEventType.UploadProgress] = "UploadProgress"; HttpEventType[HttpEventType.ResponseHeader] = "ResponseHeader"; HttpEventType[HttpEventType.DownloadProgress] = "DownloadProgress"; HttpEventType[HttpEventType.Response] = "Response"; HttpEventType[HttpEventType.User] = "User"; /** * Base interface for progress events. * * \@stable * @record */ /** * A download progress event. * * \@stable * @record */ /** * An upload progress event. * * \@stable * @record */ /** * An event indicating that the request was sent to the server. Useful * when a request may be retried multiple times, to distinguish between * retries on the final event stream. * * \@stable * @record */ /** * A user-defined event. * * Grouping all custom events under this type ensures they will be handled * and forwarded by all implementations of interceptors. * * \@stable * @record * @template T */ /** * An error that represents a failed attempt to JSON.parse text coming back * from the server. * * It bundles the Error object with the actual response body that failed to parse. * * \@stable * @record */ /** * Base class for both `HttpResponse` and `HttpHeaderResponse`. * * \@stable * @abstract */ class HttpResponseBase { /** * Super-constructor for all responses. * * The single parameter accepted is an initialization hash. Any properties * of the response passed there will override the default values. * @param {?} init * @param {?=} defaultStatus * @param {?=} defaultStatusText */ constructor(init, defaultStatus = 200, defaultStatusText = 'OK') { // If the hash has values passed, use them to initialize the response. // Otherwise use the default values. this.headers = init.headers || new HttpHeaders(); this.status = init.status !== undefined ? init.status : defaultStatus; this.statusText = init.statusText || defaultStatusText; this.url = init.url || null; // Cache the ok value to avoid defining a getter. this.ok = this.status >= 200 && this.status < 300; } } /** * A partial HTTP response which only includes the status and header data, * but no response body. * * `HttpHeaderResponse` is a `HttpEvent` available on the response * event stream, only when progress events are requested. * * \@stable */ class HttpHeaderResponse extends HttpResponseBase { /** * Create a new `HttpHeaderResponse` with the given parameters. * @param {?=} init */ constructor(init = {}) { super(init); this.type = HttpEventType.ResponseHeader; } /** * Copy this `HttpHeaderResponse`, overriding its contents with the * given parameter hash. * @param {?=} update * @return {?} */ clone(update = {}) { // Perform a straightforward initialization of the new HttpHeaderResponse, // overriding the current parameters with new ones if given. return new HttpHeaderResponse({ headers: update.headers || this.headers, status: update.status !== undefined ? update.status : this.status, statusText: update.statusText || this.statusText, url: update.url || this.url || undefined, }); } } /** * A full HTTP response, including a typed response body (which may be `null` * if one was not returned). * * `HttpResponse` is a `HttpEvent` available on the response event * stream. * * \@stable * @template T */ class HttpResponse extends HttpResponseBase { /** * Construct a new `HttpResponse`. * @param {?=} init */ constructor(init = {}) { super(init); this.type = HttpEventType.Response; this.body = init.body !== undefined ? init.body : null; } /** * @param {?=} update * @return {?} */ clone(update = {}) { return new HttpResponse({ body: (update.body !== undefined) ? update.body : this.body, headers: update.headers || this.headers, status: (update.status !== undefined) ? update.status : this.status, statusText: update.statusText || this.statusText, url: update.url || this.url || undefined, }); } } /** * A response that represents an error or failure, either from a * non-successful HTTP status, an error while executing the request, * or some other failure which occurred during the parsing of the response. * * Any error returned on the `Observable` response stream will be * wrapped in an `HttpErrorResponse` to provide additional context about * the state of the HTTP layer when the error occurred. The error property * will contain either a wrapped Error object or the error response returned * from the server. * * \@stable */ class HttpErrorResponse extends HttpResponseBase { /** * @param {?} init */ constructor(init) { // Initialize with a default status of 0 / Unknown Error. super(init, 0, 'Unknown Error'); this.name = 'HttpErrorResponse'; /** * Errors are never okay, even when the status code is in the 2xx success range. */ this.ok = false; // If the response was successful, then this was a parse error. Otherwise, it was // a protocol-level failure of some sort. Either the request failed in transit // or the server returned an unsuccessful status code. if (this.status >= 200 && this.status < 300) { this.message = `Http failure during parsing for ${init.url || '(unknown url)'}`; } else { this.message = `Http failure response for ${init.url || '(unknown url)'}: ${init.status} ${init.statusText}`; } this.error = init.error || null; } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * Construct an instance of `HttpRequestOptions<T>` from a source `HttpMethodOptions` and * the given `body`. Basically, this clones the object and adds the body. * @template T * @param {?} options * @param {?} body * @return {?} */ function addBody(options, body) { return { body, headers: options.headers, observe: options.observe, params: options.params, reportProgress: options.reportProgress, responseType: options.responseType, withCredentials: options.withCredentials, }; } /** * Perform HTTP requests. * * `HttpClient` is available as an injectable class, with methods to perform HTTP requests. * Each request method has multiple signatures, and the return type varies according to which * signature is called (mainly the values of `observe` and `responseType`). * * \@stable */ class HttpClient { /** * @param {?} handler */ constructor(handler) { this.handler = handler; } /** * Constructs an `Observable` for a particular HTTP request that, when subscribed, * fires the request through the chain of registered interceptors and on to the * server. * * This method can be called in one of two ways. Either an `HttpRequest` * instance can be passed directly as the only parameter, or a method can be * passed as the first parameter, a string URL as the second, and an * options hash as the third. * * If a `HttpRequest` object is passed directly, an `Observable` of the * raw `HttpEvent` stream will be returned. * * If a request is instead built by providing a URL, the options object * determines the return type of `request()`. In addition to configuring * request parameters such as the outgoing headers and/or the body, the options * hash specifies two key pieces of information about the request: the * `responseType` and what to `observe`. * * The `responseType` value determines how a successful response body will be * parsed. If `responseType` is the default `json`, a type interface for the * resulting object may be passed as a type parameter to `request()`. * * The `observe` value determines the return type of `request()`, based on what * the consumer is interested in observing. A value of `events` will return an * `Observable<HttpEvent>` representing the raw `HttpEvent` stream, * including progress events by default. A value of `response` will return an * `Observable<HttpResponse<T>>` where the `T` parameter of `HttpResponse` * depends on the `responseType` and any optionally provided type parameter. * A value of `body` will return an `Observable<T>` with the same `T` body type. * @param {?} first * @param {?=} url * @param {?=} options * @return {?} */ request(first, url, options = {}) { let /** @type {?} */ req; // Firstly, check whether the primary argument is an instance of `HttpRequest`. if (first instanceof HttpRequest) { // It is. The other arguments must be undefined (per the signatures) and can be // ignored. req = /** @type {?} */ (first); } else { // It's a string, so it represents a URL. Construct a request based on it, // and incorporate the remaining arguments (assuming GET unless a method is // provided. // Figure out the headers. let /** @type {?} */ headers = undefined; if (options.headers instanceof HttpHeaders) { headers = options.headers; } else { headers = new HttpHeaders(options.headers); } // Sort out parameters. let /** @type {?} */ params = undefined; if (!!options.params) { if (options.params instanceof HttpParams) { params = options.params; } else { params = new HttpParams({ fromObject: options.params }); } } // Construct the request. req = new HttpRequest(first, /** @type {?} */ ((url)), (options.body !== undefined ? options.body : null), { headers, params, reportProgress: options.reportProgress, // By default, JSON is assumed to be returned for all calls. responseType: options.responseType || 'json', withCredentials: options.withCredentials, }); } // Start with an Observable.of() the initial request, and run the handler (which // includes all interceptors) inside a concatMap(). This way, the handler runs // inside an Observable chain, which causes interceptors to be re-run on every // subscription (this also makes retries re-run the handler, including interceptors). const /** @type {?} */ events$ = __WEBPACK_IMPORTED_MODULE_2_rxjs_operator_concatMap__["a" /* concatMap */].call(Object(__WEBPACK_IMPORTED_MODULE_1_rxjs_observable_of__["a" /* of */])(req), (req) => this.handler.handle(req)); // If coming via the API signature which accepts a previously constructed HttpRequest, // the only option is to get the event stream. Otherwise, return the event stream if // that is what was requested. if (first instanceof HttpRequest || options.observe === 'events') { return events$; } // The requested stream contains either the full response or the body. In either // case, the first step is to filter the event stream to extract a stream of // responses(s). const /** @type {?} */ res$ = __WEBPACK_IMPORTED_MODULE_3_rxjs_operator_filter__["a" /* filter */].call(events$, (event) => event instanceof HttpResponse); // Decide which stream to return. switch (options.observe || 'body') { case 'body': // The requested stream is the body. Map the response stream to the response // body. This could be done more simply, but a misbehaving interceptor might // transform the response body into a different format and ignore the requested // responseType. Guard against this by validating that the response is of the // requested type. switch (req.responseType) { case 'arraybuffer': return __WEBPACK_IMPORTED_MODULE_4_rxjs_operator_map__["a" /* map */].call(res$, (res) => { // Validate that the body is an ArrayBuffer. if (res.body !== null && !(res.body instanceof ArrayBuffer)) { throw new Error('Response is not an ArrayBuffer.'); } return res.body; }); case 'blob': return __WEBPACK_IMPORTED_MODULE_4_rxjs_operator_map__["a" /* map */].call(res$, (res) => { // Validate that the body is a Blob. if (res.body !== null && !(res.body instanceof Blob)) { throw new Error('Response is not a Blob.'); } return res.body; }); case 'text': return __WEBPACK_IMPORTED_MODULE_4_rxjs_operator_map__["a" /* map */].call(res$, (res) => { // Validate that the body is a string. if (res.body !== null && typeof res.body !== 'string') { throw new Error('Response is not a string.'); } return res.body; }); case 'json': default: // No validation needed for JSON responses, as they can be of any type. return __WEBPACK_IMPORTED_MODULE_4_rxjs_operator_map__["a" /* map */].call(res$, (res) => res.body); } case 'response': // The response stream was requested directly, so return it. return res$; default: // Guard against new future observe types being added. throw new Error(`Unreachable: unhandled observe type ${options.observe}}`); } } /** * Constructs an `Observable` which, when subscribed, will cause the configured * DELETE request to be executed on the server. See the individual overloads for * details of `delete()`'s return type based on the provided options. * @param {?} url * @param {?=} options * @return {?} */ delete(url, options = {}) { return this.request('DELETE', url, /** @type {?} */ (options)); } /** * Constructs an `Observable` which, when subscribed, will cause the configured * GET request to be executed on the server. See the individual overloads for * details of `get()`'s return type based on the provided options. * @param {?} url * @param {?=} options * @return {?} */ get(url, options = {}) { return this.request('GET', url, /** @type {?} */ (options)); } /** * Constructs an `Observable` which, when subscribed, will cause the configured * HEAD request to be executed on the server. See the individual overloads for * details of `head()`'s return type based on the provided options. * @param {?} url * @param {?=} options * @return {?} */ head(url, options = {}) { return this.request('HEAD', url, /** @type {?} */ (options)); } /** * Constructs an `Observable` which, when subscribed, will cause a request * with the special method `JSONP` to be dispatched via the interceptor pipeline. * * A suitable interceptor must be installed (e.g. via the `HttpClientJsonpModule`). * If no such interceptor is reached, then the `JSONP` request will likely be * rejected by the configured backend. * @template T * @param {?} url * @param {?} callbackParam * @return {?} */ jsonp(url, callbackParam) { return this.request('JSONP', url, { params: new HttpParams().append(callbackParam, 'JSONP_CALLBACK'), observe: 'body', responseType: 'json', }); } /** * Constructs an `Observable` which, when subscribed, will cause the configured * OPTIONS request to be executed on the server. See the individual overloads for * details of `options()`'s return type based on the provided options. * @param {?} url * @param {?=} options * @return {?} */ options(url, options = {}) { return this.request('OPTIONS', url, /** @type {?} */ (options)); } /** * Constructs an `Observable` which, when subscribed, will cause the configured * PATCH request to be executed on the server. See the individual overloads for * details of `patch()`'s return type based on the provided options. * @param {?} url * @param {?} body * @param {?=} options * @return {?} */ patch(url, body, options = {}) { return this.request('PATCH', url, addBody(options, body)); } /** * Constructs an `Observable` which, when subscribed, will cause the configured * POST request to be executed on the server. See the individual overloads for * details of `post()`'s return type based on the provided options. * @param {?} url * @param {?} body * @param {?=} options * @return {?} */ post(url, body, options = {}) { return this.request('POST', url, addBody(options, body)); } /** * Constructs an `Observable` which, when subscribed, will cause the configured * POST request to be executed on the server. See the individual overloads for * details of `post()`'s return type based on the provided options. * @param {?} url * @param {?} body * @param {?=} options * @return {?} */ put(url, body, options = {}) { return this.request('PUT', url, addBody(options, body)); } } HttpClient.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Injectable"] }, ]; /** @nocollapse */ HttpClient.ctorParameters = () => [ { type: HttpHandler, }, ]; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * Intercepts `HttpRequest` and handles them. * * Most interceptors will transform the outgoing request before passing it to the * next interceptor in the chain, by calling `next.handle(transformedReq)`. * * In rare cases, interceptors may wish to completely handle a request themselves, * and not delegate to the remainder of the chain. This behavior is allowed. * * \@stable * @record */ /** * `HttpHandler` which applies an `HttpInterceptor` to an `HttpRequest`. * * \@stable */ class HttpInterceptorHandler { /** * @param {?} next * @param {?} interceptor */ constructor(next, interceptor) { this.next = next; this.interceptor = interceptor; } /** * @param {?} req * @return {?} */ handle(req) { return this.interceptor.intercept(req, this.next); } } /** * A multi-provider token which represents the array of `HttpInterceptor`s that * are registered. * * \@stable */ const HTTP_INTERCEPTORS = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["InjectionToken"]('HTTP_INTERCEPTORS'); class NoopInterceptor { /** * @param {?} req * @param {?} next * @return {?} */ intercept(req, next) { return next.handle(req); } } NoopInterceptor.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Injectable"] }, ]; /** @nocollapse */ NoopInterceptor.ctorParameters = () => []; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ // Every request made through JSONP needs a callback name that's unique across the // whole page. Each request is assigned an id and the callback name is constructed // from that. The next id to be assigned is tracked in a global variable here that // is shared among all applications on the page. let nextRequestId = 0; // Error text given when a JSONP script is injected, but doesn't invoke the callback // passed in its URL. const JSONP_ERR_NO_CALLBACK = 'JSONP injected script did not invoke callback.'; // Error text given when a request is passed to the JsonpClientBackend that doesn't // have a request method JSONP. const JSONP_ERR_WRONG_METHOD = 'JSONP requests must use JSONP request method.'; const JSONP_ERR_WRONG_RESPONSE_TYPE = 'JSONP requests must use Json response type.'; /** * DI token/abstract type representing a map of JSONP callbacks. * * In the browser, this should always be the `window` object. * * \@stable * @abstract */ class JsonpCallbackContext { } /** * `HttpBackend` that only processes `HttpRequest` with the JSONP method, * by performing JSONP style requests. * * \@stable */ class JsonpClientBackend { /** * @param {?} callbackMap * @param {?} document */ constructor(callbackMap, document) { this.callbackMap = callbackMap; this.document = document; } /** * Get the name of the next callback method, by incrementing the global `nextRequestId`. * @return {?} */ nextCallback() { return `ng_jsonp_callback_${nextRequestId++}`; } /** * Process a JSONP request and return an event stream of the results. * @param {?} req * @return {?} */ handle(req) { // Firstly, check both the method and response type. If either doesn't match // then the request was improperly routed here and cannot be handled. if (req.method !== 'JSONP') { throw new Error(JSONP_ERR_WRONG_METHOD); } else if (req.responseType !== 'json') { throw new Error(JSONP_ERR_WRONG_RESPONSE_TYPE); } // Everything else happens inside the Observable boundary. return new __WEBPACK_IMPORTED_MODULE_6_rxjs_Observable__["a" /* Observable */]((observer) => { // The first step to make a request is to generate the callback name, and replace the // callback placeholder in the URL with the name. Care has to be taken here to ensure // a trailing &, if matched, gets inserted back into the URL in the correct place. const /** @type {?} */ callback = this.nextCallback(); const /** @type {?} */ url = req.urlWithParams.replace(/=JSONP_CALLBACK(&|$)/, `=${callback}$1`); // Construct the <script> tag and point it at the URL. const /** @type {?} */ node = this.document.createElement('script'); node.src = url; // A JSONP request requires waiting for multiple callbacks. These variables // are closed over and track state across those callbacks. // The response object, if one has been received, or null otherwise. let /** @type {?} */ body = null; // Whether the response callback has been called. let /** @type {?} */ finished = false; // Whether the request has been cancelled (and thus any other callbacks) // should be ignored. let /** @type {?} */ cancelled = false; // Set the response callback in this.callbackMap (which will be the window // object in the browser. The script being loaded via the <script> tag will // eventually call this callback. this.callbackMap[callback] = (data) => { // Data has been received from the JSONP script. Firstly, delete this callback. delete this.callbackMap[callback]; // Next, make sure the request wasn't cancelled in the meantime. if (cancelled) { return; } // Set state to indicate data was received. body = data; finished = true; }; // cleanup() is a utility closure that removes the <script> from the page and // the response callback from the window. This logic is used in both the // success, error, and cancellation paths, so it's extracted out for convenience. const /** @type {?} */ cleanup = () => { // Remove the <script> tag if it's still on the page. if (node.parentNode) { node.parentNode.removeChild(node); } // Remove the response callback from the callbackMap (window object in the // browser). delete this.callbackMap[callback]; }; // onLoad() is the success callback which runs after the response callback // if the JSONP script loads successfully. The event itself is unimportant. // If something went wrong, onLoad() may run without the response callback // having been invoked. const /** @type {?} */ onLoad = (event) => { // Do nothing if the request has been cancelled. if (cancelled) { return; } // Cleanup the page. cleanup(); // Check whether the response callback has run. if (!finished) { // It hasn't, something went wrong with the request. Return an error via // the Observable error path. All JSONP errors have status 0. observer.error(new HttpErrorResponse({ url, status: 0, statusText: 'JSONP Error', error: new Error(JSONP_ERR_NO_CALLBACK), })); return; } // Success. body either contains the response body or null if none was // returned. observer.next(new HttpResponse({ body, status: 200, statusText: 'OK', url, })); // Complete the stream, the response is over. observer.complete(); }; // onError() is the error callback, which runs if the script returned generates // a Javascript error. It emits the error via the Observable error channel as // a HttpErrorResponse. const /** @type {?} */ onError = (error) => { // If the request was already cancelled, no need to emit anything. if (cancelled) { return; } cleanup(); // Wrap the error in a HttpErrorResponse. observer.error(new HttpErrorResponse({ error, status: 0, statusText: 'JSONP Error', url, })); }; // Subscribe to both the success (load) and error events on the <script> tag, // and add it to the page. node.addEventListener('load', onLoad); node.addEventListener('error', onError); this.document.body.appendChild(node); // The request has now been successfully sent. observer.next({ type: HttpEventType.Sent }); // Cancellation handler. return () => { // Track the cancellation so event listeners won't do anything even if already scheduled. cancelled = true; // Remove the event listeners so they won't run if the events later fire. node.removeEventListener('load', onLoad); node.removeEventListener('error', onError); // And finally, clean up the page. cleanup(); }; }); } } JsonpClientBackend.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Injectable"] }, ]; /** @nocollapse */ JsonpClientBackend.ctorParameters = () => [ { type: JsonpCallbackContext, }, { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Inject"], args: [__WEBPACK_IMPORTED_MODULE_5__angular_common__["DOCUMENT"],] },] }, ]; /** * An `HttpInterceptor` which identifies requests with the method JSONP and * shifts them to the `JsonpClientBackend`. * * \@stable */ class JsonpInterceptor { /** * @param {?} jsonp */ constructor(jsonp) { this.jsonp = jsonp; } /** * @param {?} req * @param {?} next * @return {?} */ intercept(req, next) { if (req.method === 'JSONP') { return this.jsonp.handle(/** @type {?} */ (req)); } // Fall through for normal HTTP requests. return next.handle(req); } } JsonpInterceptor.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Injectable"] }, ]; /** @nocollapse */ JsonpInterceptor.ctorParameters = () => [ { type: JsonpClientBackend, }, ]; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ const XSSI_PREFIX = /^\)\]\}',?\n/; /** * Determine an appropriate URL for the response, by checking either * XMLHttpRequest.responseURL or the X-Request-URL header. * @param {?} xhr * @return {?} */ function getResponseUrl(xhr) { if ('responseURL' in xhr && xhr.responseURL) { return xhr.responseURL; } if (/^X-Request-URL:/m.test(xhr.getAllResponseHeaders())) { return xhr.getResponseHeader('X-Request-URL'); } return null; } /** * A wrapper around the `XMLHttpRequest` constructor. * * \@stable * @abstract */ class XhrFactory { } /** * A factory for \@{link HttpXhrBackend} that uses the `XMLHttpRequest` browser API. * * \@stable */ class BrowserXhr { constructor() { } /** * @return {?} */ build() { return /** @type {?} */ ((new XMLHttpRequest())); } } BrowserXhr.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Injectable"] }, ]; /** @nocollapse */ BrowserXhr.ctorParameters = () => []; /** * An `HttpBackend` which uses the XMLHttpRequest API to send * requests to a backend server. * * \@stable */ class HttpXhrBackend { /** * @param {?} xhrFactory */ constructor(xhrFactory) { this.xhrFactory = xhrFactory; } /** * Process a request and return a stream of response events. * @param {?} req * @return {?} */ handle(req) { // Quick check to give a better error message when a user attempts to use // HttpClient.jsonp() without installing the JsonpClientModule if (req.method === 'JSONP') { throw new Error(`Attempted to construct Jsonp request without JsonpClientModule installed.`); } // Everything happens on Observable subscription. return new __WEBPACK_IMPORTED_MODULE_6_rxjs_Observable__["a" /* Observable */]((observer) => { // Start by setting up the XHR object with request method, URL, and withCredentials flag. const /** @type {?} */ xhr = this.xhrFactory.build(); xhr.open(req.method, req.urlWithParams); if (!!req.withCredentials) { xhr.withCredentials = true; } // Add all the requested headers. req.headers.forEach((name, values) => xhr.setRequestHeader(name, values.join(','))); // Add an Accept header if one isn't present already. if (!req.headers.has('Accept')) { xhr.setRequestHeader('Accept', 'application/json, text/plain, */*'); } // Auto-detect the Content-Type header if one isn't present already. if (!req.headers.has('Content-Type')) { const /** @type {?} */ detectedType = req.detectContentTypeHeader(); // Sometimes Content-Type detection fails. if (detectedType !== null) { xhr.setRequestHeader('Content-Type', detectedType); } } // Set the responseType if one was requested. if (req.responseType) { const /** @type {?} */ responseType = req.responseType.toLowerCase(); // JSON responses need to be processed as text. This is because if the server // returns an XSSI-prefixed JSON response, the browser will fail to parse it, // xhr.response will be null, and xhr.responseText cannot be accessed to // retrieve the prefixed JSON data in order to strip the prefix. Thus, all JSON // is parsed by first requesting text and then applying JSON.parse. xhr.responseType = /** @type {?} */ (((responseType !== 'json') ? responseType : 'text')); } // Serialize the request body if one is present. If not, this will be set to null. const /** @type {?} */ reqBody = req.serializeBody(); // If progress events are enabled, response headers will be delivered // in two events - the HttpHeaderResponse event and the full HttpResponse // event. However, since response headers don't change in between these // two events, it doesn't make sense to parse them twice. So headerResponse // caches the data extracted from the response whenever it's first parsed, // to ensure parsing isn't duplicated. let /** @type {?} */ headerResponse = null; // partialFromXhr extracts the HttpHeaderResponse from the current XMLHttpRequest // state, and memoizes it into headerResponse. const /** @type {?} */ partialFromXhr = () => { if (headerResponse !== null) { return headerResponse; } // Read status and normalize an IE9 bug (http://bugs.jquery.com/ticket/1450). const /** @type {?} */ status = xhr.status === 1223 ? 204 : xhr.status; const /** @type {?} */ statusText = xhr.statusText || 'OK'; // Parse headers from XMLHttpRequest - this step is lazy. const /** @type {?} */ headers = new HttpHeaders(xhr.getAllResponseHeaders()); // Read the response URL from the XMLHttpResponse instance and fall back on the // request URL. const /** @type {?} */ url = getResponseUrl(xhr) || req.url; // Construct the HttpHeaderResponse and memoize it. headerResponse = new HttpHeaderResponse({ headers, status, statusText, url }); return headerResponse; }; // Next, a few closures are defined for the various events which XMLHttpRequest can // emit. This allows them to be unregistered as event listeners later. // First up is the load event, which represents a response being fully available. const /** @type {?} */ onLoad = () => { // Read response state from the memoized partial data. let { headers, status, statusText, url } = partialFromXhr(); // The body will be read out if present. let /** @type {?} */ body = null; if (status !== 204) { // Use XMLHttpRequest.response if set, responseText otherwise. body = (typeof xhr.response === 'undefined') ? xhr.responseText : xhr.response; } // Normalize another potential bug (this one comes from CORS). if (status === 0) { status = !!body ? 200 : 0; } // ok determines whether the response will be transmitted on the event or // error channel. Unsuccessful status codes (not 2xx) will always be errors, // but a successful status code can still result in an error if the user // asked for JSON data and the body cannot be parsed as such. let /** @type {?} */ ok = status >= 200 && status < 300; // Check whether the body needs to be parsed as JSON (in many cases the browser // will have done that already). if (req.responseType === 'json' && typeof body === 'string') { // Save the original body, before attempting XSSI prefix stripping. const /** @type {?} */ originalBody = body; body = body.replace(XSSI_PREFIX, ''); try { // Attempt the parse. If it fails, a parse error should be delivered to the user. body = body !== '' ? JSON.parse(body) : null; } catch (/** @type {?} */ error) { // Since the JSON.parse failed, it's reasonable to assume this might not have been a // JSON response. Restore the original body (including any XSSI prefix) to deliver // a better error response. body = originalBody; // If this was an error request to begin with, leave it as a string, it probably // just isn't JSON. Otherwise, deliver the parsing error to the user. if (ok) { // Even though the response status was 2xx, this is still an error. ok = false; // The parse error contains the text of the body that failed to parse. body = /** @type {?} */ ({ error, text: body }); } } } if (ok) { // A successful response is delivered on the event stream. observer.next(new HttpResponse({ body, headers, status, statusText, url: url || undefined, })); // The full body has been received and delivered, no further events // are possible. This request is complete. observer.complete(); } else { // An unsuccessful request is delivered on the error channel. observer.error(new HttpErrorResponse({ // The error in this case is the response body (error from the server). error: body, headers, status, statusText, url: url || undefined, })); } }; // The onError callback is called when something goes wrong at the network level. // Connection timeout, DNS error, offline, etc. These are actual errors, and are // transmitted on the error channel. const /** @type {?} */ onError = (error) => { const /** @type {?} */ res = new HttpErrorResponse({ error, status: xhr.status || 0, statusText: xhr.statusText || 'Unknown Error', }); observer.error(res); }; // The sentHeaders flag tracks whether the HttpResponseHeaders event // has been sent on the stream. This is necessary to track if progress // is enabled since the event will be sent on only the first download // progerss event. let /** @type {?} */ sentHeaders = false; // The download progress event handler, which is only registered if // progress events are enabled. const /** @type {?} */ onDownProgress = (event) => { // Send the HttpResponseHeaders event if it hasn't been sent already. if (!sentHeaders) { observer.next(partialFromXhr()); sentHeaders = true; } // Start building the download progress event to deliver on the response // event stream. let /** @type {?} */ progressEvent = { type: HttpEventType.DownloadProgress, loaded: event.loaded, }; // Set the total number of bytes in the event if it's available. if (event.lengthComputable) { progressEvent.total = event.total; } // If the request was for text content and a partial response is // available on XMLHttpRequest, include it in the progress event // to allow for streaming reads. if (req.responseType === 'text' && !!xhr.responseText) { progressEvent.partialText = xhr.responseText; } // Finally, fire the event. observer.next(progressEvent); }; // The upload progress event handler, which is only registered if // progress events are enabled. const /** @type {?} */ onUpProgress = (event) => { // Upload progress events are simpler. Begin building the progress // event. let /** @type {?} */ progress = { type: HttpEventType.UploadProgress, loaded: event.loaded, }; // If the total number of bytes being uploaded is available, include // it. if (event.lengthComputable) { progress.total = event.total; } // Send the event. observer.next(progress); }; // By default, register for load and error events. xhr.addEventListener('load', onLoad); xhr.addEventListener('error', onError); // Progress events are only enabled if requested. if (req.reportProgress) { // Download progress is always enabled if requested. xhr.addEventListener('progress', onDownProgress); // Upload progress depends on whether there is a body to upload. if (reqBody !== null && xhr.upload) { xhr.upload.addEventListener('progress', onUpProgress); } } // Fire the request, and notify the event stream that it was fired. xhr.send(reqBody); observer.next({ type: HttpEventType.Sent }); // This is the return from the Observable function, which is the // request cancellation handler. return () => { // On a cancellation, remove all registered event listeners. xhr.removeEventListener('error', onError); xhr.removeEventListener('load', onLoad); if (req.reportProgress) { xhr.removeEventListener('progress', onDownProgress); if (reqBody !== null && xhr.upload) { xhr.upload.removeEventListener('progress', onUpProgress); } } // Finally, abort the in-flight request. xhr.abort(); }; }); } } HttpXhrBackend.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Injectable"] }, ]; /** @nocollapse */ HttpXhrBackend.ctorParameters = () => [ { type: XhrFactory, }, ]; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ const XSRF_COOKIE_NAME = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["InjectionToken"]('XSRF_COOKIE_NAME'); const XSRF_HEADER_NAME = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["InjectionToken"]('XSRF_HEADER_NAME'); /** * Retrieves the current XSRF token to use with the next outgoing request. * * \@stable * @abstract */ class HttpXsrfTokenExtractor { } /** * `HttpXsrfTokenExtractor` which retrieves the token from a cookie. */ class HttpXsrfCookieExtractor { /** * @param {?} doc * @param {?} platform * @param {?} cookieName */ constructor(doc, platform, cookieName) { this.doc = doc; this.platform = platform; this.cookieName = cookieName; this.lastCookieString = ''; this.lastToken = null; /** * \@internal for testing */ this.parseCount = 0; } /** * @return {?} */ getToken() { if (this.platform === 'server') { return null; } const /** @type {?} */ cookieString = this.doc.cookie || ''; if (cookieString !== this.lastCookieString) { this.parseCount++; this.lastToken = Object(__WEBPACK_IMPORTED_MODULE_5__angular_common__["ɵparseCookieValue"])(cookieString, this.cookieName); this.lastCookieString = cookieString; } return this.lastToken; } } HttpXsrfCookieExtractor.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Injectable"] }, ]; /** @nocollapse */ HttpXsrfCookieExtractor.ctorParameters = () => [ { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Inject"], args: [__WEBPACK_IMPORTED_MODULE_5__angular_common__["DOCUMENT"],] },] }, { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Inject"], args: [__WEBPACK_IMPORTED_MODULE_0__angular_core__["PLATFORM_ID"],] },] }, { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Inject"], args: [XSRF_COOKIE_NAME,] },] }, ]; /** * `HttpInterceptor` which adds an XSRF token to eligible outgoing requests. */ class HttpXsrfInterceptor { /** * @param {?} tokenService * @param {?} headerName */ constructor(tokenService, headerName) { this.tokenService = tokenService; this.headerName = headerName; } /** * @param {?} req * @param {?} next * @return {?} */ intercept(req, next) { const /** @type {?} */ lcUrl = req.url.toLowerCase(); // Skip both non-mutating requests and absolute URLs. // Non-mutating requests don't require a token, and absolute URLs require special handling // anyway as the cookie set // on our origin is not the same as the token expected by another origin. if (req.method === 'GET' || req.method === 'HEAD' || lcUrl.startsWith('http://') || lcUrl.startsWith('https://')) { return next.handle(req); } const /** @type {?} */ token = this.tokenService.getToken(); // Be careful not to overwrite an existing header of the same name. if (token !== null && !req.headers.has(this.headerName)) { req = req.clone({ headers: req.headers.set(this.headerName, token) }); } return next.handle(req); } } HttpXsrfInterceptor.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Injectable"] }, ]; /** @nocollapse */ HttpXsrfInterceptor.ctorParameters = () => [ { type: HttpXsrfTokenExtractor, }, { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Inject"], args: [XSRF_HEADER_NAME,] },] }, ]; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * An `HttpHandler` that applies a bunch of `HttpInterceptor`s * to a request before passing it to the given `HttpBackend`. * * The interceptors are loaded lazily from the injector, to allow * interceptors to themselves inject classes depending indirectly * on `HttpInterceptingHandler` itself. */ class HttpInterceptingHandler { /** * @param {?} backend * @param {?} injector */ constructor(backend, injector) { this.backend = backend; this.injector = injector; this.chain = null; } /** * @param {?} req * @return {?} */ handle(req) { if (this.chain === null) { const /** @type {?} */ interceptors = this.injector.get(HTTP_INTERCEPTORS, []); this.chain = interceptors.reduceRight((next, interceptor) => new HttpInterceptorHandler(next, interceptor), this.backend); } return this.chain.handle(req); } } HttpInterceptingHandler.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Injectable"] }, ]; /** @nocollapse */ HttpInterceptingHandler.ctorParameters = () => [ { type: HttpBackend, }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Injector"], }, ]; /** * Constructs an `HttpHandler` that applies a bunch of `HttpInterceptor`s * to a request before passing it to the given `HttpBackend`. * * Meant to be used as a factory function within `HttpClientModule`. * * \@stable * @param {?} backend * @param {?=} interceptors * @return {?} */ function interceptingHandler(backend, interceptors = []) { if (!interceptors) { return backend; } return interceptors.reduceRight((next, interceptor) => new HttpInterceptorHandler(next, interceptor), backend); } /** * Factory function that determines where to store JSONP callbacks. * * Ordinarily JSONP callbacks are stored on the `window` object, but this may not exist * in test environments. In that case, callbacks are stored on an anonymous object instead. * * \@stable * @return {?} */ function jsonpCallbackContext() { if (typeof window === 'object') { return window; } return {}; } /** * `NgModule` which adds XSRF protection support to outgoing requests. * * Provided the server supports a cookie-based XSRF protection system, this * module can be used directly to configure XSRF protection with the correct * cookie and header names. * * If no such names are provided, the default is to use `X-XSRF-TOKEN` for * the header name and `XSRF-TOKEN` for the cookie name. * * \@stable */ class HttpClientXsrfModule { /** * Disable the default XSRF protection. * @return {?} */ static disable() { return { ngModule: HttpClientXsrfModule, providers: [ { provide: HttpXsrfInterceptor, useClass: NoopInterceptor }, ], }; } /** * Configure XSRF protection to use the given cookie name or header name, * or the default names (as described above) if not provided. * @param {?=} options * @return {?} */ static withOptions(options = {}) { return { ngModule: HttpClientXsrfModule, providers: [ options.cookieName ? { provide: XSRF_COOKIE_NAME, useValue: options.cookieName } : [], options.headerName ? { provide: XSRF_HEADER_NAME, useValue: options.headerName } : [], ], }; } } HttpClientXsrfModule.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["NgModule"], args: [{ providers: [ HttpXsrfInterceptor, { provide: HTTP_INTERCEPTORS, useExisting: HttpXsrfInterceptor, multi: true }, { provide: HttpXsrfTokenExtractor, useClass: HttpXsrfCookieExtractor }, { provide: XSRF_COOKIE_NAME, useValue: 'XSRF-TOKEN' }, { provide: XSRF_HEADER_NAME, useValue: 'X-XSRF-TOKEN' }, ], },] }, ]; /** @nocollapse */ HttpClientXsrfModule.ctorParameters = () => []; /** * `NgModule` which provides the `HttpClient` and associated services. * * Interceptors can be added to the chain behind `HttpClient` by binding them * to the multiprovider for `HTTP_INTERCEPTORS`. * * \@stable */ class HttpClientModule { } HttpClientModule.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["NgModule"], args: [{ imports: [ HttpClientXsrfModule.withOptions({ cookieName: 'XSRF-TOKEN', headerName: 'X-XSRF-TOKEN', }), ], providers: [ HttpClient, { provide: HttpHandler, useClass: HttpInterceptingHandler }, HttpXhrBackend, { provide: HttpBackend, useExisting: HttpXhrBackend }, BrowserXhr, { provide: XhrFactory, useExisting: BrowserXhr }, ], },] }, ]; /** @nocollapse */ HttpClientModule.ctorParameters = () => []; /** * `NgModule` which enables JSONP support in `HttpClient`. * * Without this module, Jsonp requests will reach the backend * with method JSONP, where they'll be rejected. * * \@stable */ class HttpClientJsonpModule { } HttpClientJsonpModule.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["NgModule"], args: [{ providers: [ JsonpClientBackend, { provide: JsonpCallbackContext, useFactory: jsonpCallbackContext }, { provide: HTTP_INTERCEPTORS, useClass: JsonpInterceptor, multi: true }, ], },] }, ]; /** @nocollapse */ HttpClientJsonpModule.ctorParameters = () => []; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * Generated bundle index. Do not edit. */ //# sourceMappingURL=http.js.map /***/ }), /***/ "./node_modules/@angular/compiler/esm2015/compiler.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export core */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return CompilerConfig; }); /* unused harmony export preserveWhitespacesDefault */ /* unused harmony export isLoweredSymbol */ /* unused harmony export createLoweredSymbol */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return Identifiers; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return JitCompiler; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return DirectiveResolver; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "q", function() { return PipeResolver; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "o", function() { return NgModuleResolver; }); /* unused harmony export DEFAULT_INTERPOLATION_CONFIG */ /* unused harmony export InterpolationConfig */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "n", function() { return NgModuleCompiler; }); /* unused harmony export AssertNotNull */ /* unused harmony export BinaryOperator */ /* unused harmony export BinaryOperatorExpr */ /* unused harmony export BuiltinMethod */ /* unused harmony export BuiltinVar */ /* unused harmony export CastExpr */ /* unused harmony export ClassStmt */ /* unused harmony export CommaExpr */ /* unused harmony export CommentStmt */ /* unused harmony export ConditionalExpr */ /* unused harmony export DeclareFunctionStmt */ /* unused harmony export DeclareVarStmt */ /* unused harmony export ExpressionStatement */ /* unused harmony export ExternalExpr */ /* unused harmony export ExternalReference */ /* unused harmony export FunctionExpr */ /* unused harmony export IfStmt */ /* unused harmony export InstantiateExpr */ /* unused harmony export InvokeFunctionExpr */ /* unused harmony export InvokeMethodExpr */ /* unused harmony export LiteralArrayExpr */ /* unused harmony export LiteralExpr */ /* unused harmony export LiteralMapExpr */ /* unused harmony export NotExpr */ /* unused harmony export ReadKeyExpr */ /* unused harmony export ReadPropExpr */ /* unused harmony export ReadVarExpr */ /* unused harmony export ReturnStatement */ /* unused harmony export ThrowStmt */ /* unused harmony export TryCatchStmt */ /* unused harmony export WriteKeyExpr */ /* unused harmony export WritePropExpr */ /* unused harmony export WriteVarExpr */ /* unused harmony export StmtModifier */ /* unused harmony export Statement */ /* unused harmony export collectExternalReferences */ /* unused harmony export EmitterVisitorContext */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "y", function() { return ViewCompiler; }); /* unused harmony export getParseErrors */ /* unused harmony export isSyntaxError */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "A", function() { return syntaxError; }); /* unused harmony export Version */ /* unused harmony export VERSION */ /* unused harmony export TextAst */ /* unused harmony export BoundTextAst */ /* unused harmony export AttrAst */ /* unused harmony export BoundElementPropertyAst */ /* unused harmony export BoundEventAst */ /* unused harmony export ReferenceAst */ /* unused harmony export VariableAst */ /* unused harmony export ElementAst */ /* unused harmony export EmbeddedTemplateAst */ /* unused harmony export BoundDirectivePropertyAst */ /* unused harmony export DirectiveAst */ /* unused harmony export ProviderAst */ /* unused harmony export ProviderAstType */ /* unused harmony export NgContentAst */ /* unused harmony export PropertyBindingType */ /* unused harmony export NullTemplateVisitor */ /* unused harmony export RecursiveTemplateAstVisitor */ /* unused harmony export templateVisitAll */ /* unused harmony export identifierName */ /* unused harmony export identifierModuleUrl */ /* unused harmony export viewClassName */ /* unused harmony export rendererTypeName */ /* unused harmony export hostViewClassName */ /* unused harmony export componentFactoryName */ /* unused harmony export CompileSummaryKind */ /* unused harmony export tokenName */ /* unused harmony export tokenReference */ /* unused harmony export CompileStylesheetMetadata */ /* unused harmony export CompileTemplateMetadata */ /* unused harmony export CompileDirectiveMetadata */ /* unused harmony export CompilePipeMetadata */ /* unused harmony export CompileNgModuleMetadata */ /* unused harmony export TransitiveCompileNgModuleMetadata */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "r", function() { return ProviderMeta; }); /* unused harmony export flatten */ /* unused harmony export templateSourceUrl */ /* unused harmony export sharedStylesheetJitUrl */ /* unused harmony export ngModuleJitUrl */ /* unused harmony export templateJitUrl */ /* unused harmony export createAotUrlResolver */ /* unused harmony export createAotCompiler */ /* unused harmony export AotCompiler */ /* unused harmony export analyzeNgModules */ /* unused harmony export analyzeAndValidateNgModules */ /* unused harmony export analyzeFile */ /* unused harmony export mergeAnalyzedFiles */ /* unused harmony export GeneratedFile */ /* unused harmony export toTypeScript */ /* unused harmony export formattedError */ /* unused harmony export isFormattedError */ /* unused harmony export StaticReflector */ /* unused harmony export StaticSymbol */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "t", function() { return StaticSymbolCache; }); /* unused harmony export ResolvedStaticSymbol */ /* unused harmony export StaticSymbolResolver */ /* unused harmony export unescapeIdentifier */ /* unused harmony export unwrapResolvedMetadata */ /* unused harmony export AotSummaryResolver */ /* unused harmony export AstPath */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "v", function() { return SummaryResolver; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "l", function() { return JitSummaryResolver; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return CompileReflector; }); /* unused harmony export createUrlResolverWithoutPackagePrefix */ /* unused harmony export createOfflineCompileUrlResolver */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "x", function() { return UrlResolver; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "z", function() { return getUrlScheme; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "s", function() { return ResourceLoader; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return ElementSchemaRegistry; }); /* unused harmony export Extractor */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return I18NHtmlParser; }); /* unused harmony export MessageBundle */ /* unused harmony export Serializer */ /* unused harmony export Xliff */ /* unused harmony export Xliff2 */ /* unused harmony export Xmb */ /* unused harmony export Xtb */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return DirectiveNormalizer; }); /* unused harmony export ParserError */ /* unused harmony export ParseSpan */ /* unused harmony export AST */ /* unused harmony export Quote */ /* unused harmony export EmptyExpr */ /* unused harmony export ImplicitReceiver */ /* unused harmony export Chain */ /* unused harmony export Conditional */ /* unused harmony export PropertyRead */ /* unused harmony export PropertyWrite */ /* unused harmony export SafePropertyRead */ /* unused harmony export KeyedRead */ /* unused harmony export KeyedWrite */ /* unused harmony export BindingPipe */ /* unused harmony export LiteralPrimitive */ /* unused harmony export LiteralArray */ /* unused harmony export LiteralMap */ /* unused harmony export Interpolation */ /* unused harmony export Binary */ /* unused harmony export PrefixNot */ /* unused harmony export NonNullAssert */ /* unused harmony export MethodCall */ /* unused harmony export SafeMethodCall */ /* unused harmony export FunctionCall */ /* unused harmony export ASTWithSource */ /* unused harmony export TemplateBinding */ /* unused harmony export NullAstVisitor */ /* unused harmony export RecursiveAstVisitor */ /* unused harmony export AstTransformer */ /* unused harmony export visitAstChildren */ /* unused harmony export TokenType */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "m", function() { return Lexer; }); /* unused harmony export Token */ /* unused harmony export EOF */ /* unused harmony export isIdentifier */ /* unused harmony export isQuote */ /* unused harmony export SplitInterpolation */ /* unused harmony export TemplateBindingParseResult */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "p", function() { return Parser; }); /* unused harmony export _ParseAST */ /* unused harmony export ERROR_COMPONENT_TYPE */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return CompileMetadataResolver; }); /* unused harmony export Text */ /* unused harmony export Expansion */ /* unused harmony export ExpansionCase */ /* unused harmony export Attribute */ /* unused harmony export Element */ /* unused harmony export Comment */ /* unused harmony export visitAll */ /* unused harmony export RecursiveVisitor */ /* unused harmony export findNode */ /* unused harmony export ParseTreeResult */ /* unused harmony export TreeError */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return HtmlParser; }); /* unused harmony export HtmlTagDefinition */ /* unused harmony export getHtmlTagDefinition */ /* unused harmony export TagContentType */ /* unused harmony export splitNsName */ /* unused harmony export isNgContainer */ /* unused harmony export isNgContent */ /* unused harmony export isNgTemplate */ /* unused harmony export getNsPrefix */ /* unused harmony export mergeNsAndName */ /* unused harmony export NAMED_ENTITIES */ /* unused harmony export NGSP_UNICODE */ /* unused harmony export debugOutputAstAsTypeScript */ /* unused harmony export TypeScriptEmitter */ /* unused harmony export ParseLocation */ /* unused harmony export ParseSourceFile */ /* unused harmony export ParseSourceSpan */ /* unused harmony export ParseErrorLevel */ /* unused harmony export ParseError */ /* unused harmony export typeSourceSpan */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return DomElementSchemaRegistry; }); /* unused harmony export CssSelector */ /* unused harmony export SelectorMatcher */ /* unused harmony export SelectorListContext */ /* unused harmony export SelectorContext */ /* unused harmony export StylesCompileDependency */ /* unused harmony export CompiledStylesheet */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "u", function() { return StyleCompiler; }); /* unused harmony export TemplateParseError */ /* unused harmony export TemplateParseResult */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "w", function() { return TemplateParser; }); /* unused harmony export splitClasses */ /* unused harmony export createElementCssSelector */ /* unused harmony export removeSummaryDuplicates */ /** * @license Angular v5.2.10 * (c) 2010-2018 Google, Inc. https://angular.io/ * License: MIT */ /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ // Attention: // This file duplicates types and values from @angular/core // so that we are able to make @angular/compiler independent of @angular/core. // This is important to prevent a build cycle, as @angular/core needs to // be compiled with the compiler. /** * @record */ function Inject() { } const createInject = makeMetadataFactory('Inject', (token) => ({ token })); const createInjectionToken = makeMetadataFactory('InjectionToken', (desc) => ({ _desc: desc })); /** * @record */ function Attribute() { } const createAttribute = makeMetadataFactory('Attribute', (attributeName) => ({ attributeName })); /** * @record */ function Query() { } const createContentChildren = makeMetadataFactory('ContentChildren', (selector, data = {}) => (Object.assign({ selector, first: false, isViewQuery: false, descendants: false }, data))); const createContentChild = makeMetadataFactory('ContentChild', (selector, data = {}) => (Object.assign({ selector, first: true, isViewQuery: false, descendants: true }, data))); const createViewChildren = makeMetadataFactory('ViewChildren', (selector, data = {}) => (Object.assign({ selector, first: false, isViewQuery: true, descendants: true }, data))); const createViewChild = makeMetadataFactory('ViewChild', (selector, data) => (Object.assign({ selector, first: true, isViewQuery: true, descendants: true }, data))); /** * @record */ function Directive() { } const createDirective = makeMetadataFactory('Directive', (dir = {}) => dir); /** * @record */ function Component() { } /** @enum {number} */ const ViewEncapsulation = { Emulated: 0, Native: 1, None: 2, }; ViewEncapsulation[ViewEncapsulation.Emulated] = "Emulated"; ViewEncapsulation[ViewEncapsulation.Native] = "Native"; ViewEncapsulation[ViewEncapsulation.None] = "None"; /** @enum {number} */ const ChangeDetectionStrategy = { OnPush: 0, Default: 1, }; ChangeDetectionStrategy[ChangeDetectionStrategy.OnPush] = "OnPush"; ChangeDetectionStrategy[ChangeDetectionStrategy.Default] = "Default"; const createComponent = makeMetadataFactory('Component', (c = {}) => (Object.assign({ changeDetection: ChangeDetectionStrategy.Default }, c))); /** * @record */ function Pipe() { } const createPipe = makeMetadataFactory('Pipe', (p) => (Object.assign({ pure: true }, p))); /** * @record */ function Input() { } const createInput = makeMetadataFactory('Input', (bindingPropertyName) => ({ bindingPropertyName })); /** * @record */ function Output() { } const createOutput = makeMetadataFactory('Output', (bindingPropertyName) => ({ bindingPropertyName })); /** * @record */ function HostBinding() { } const createHostBinding = makeMetadataFactory('HostBinding', (hostPropertyName) => ({ hostPropertyName })); /** * @record */ function HostListener() { } const createHostListener = makeMetadataFactory('HostListener', (eventName, args) => ({ eventName, args })); /** * @record */ function NgModule() { } const createNgModule = makeMetadataFactory('NgModule', (ngModule) => ngModule); /** * @record */ function ModuleWithProviders() { } /** * @record */ function SchemaMetadata() { } const CUSTOM_ELEMENTS_SCHEMA = { name: 'custom-elements' }; const NO_ERRORS_SCHEMA = { name: 'no-errors-schema' }; const createOptional = makeMetadataFactory('Optional'); const createInjectable = makeMetadataFactory('Injectable'); const createSelf = makeMetadataFactory('Self'); const createSkipSelf = makeMetadataFactory('SkipSelf'); const createHost = makeMetadataFactory('Host'); const Type = Function; /** @enum {number} */ const SecurityContext = { NONE: 0, HTML: 1, STYLE: 2, SCRIPT: 3, URL: 4, RESOURCE_URL: 5, }; SecurityContext[SecurityContext.NONE] = "NONE"; SecurityContext[SecurityContext.HTML] = "HTML"; SecurityContext[SecurityContext.STYLE] = "STYLE"; SecurityContext[SecurityContext.SCRIPT] = "SCRIPT"; SecurityContext[SecurityContext.URL] = "URL"; SecurityContext[SecurityContext.RESOURCE_URL] = "RESOURCE_URL"; /** @enum {number} */ const NodeFlags = { None: 0, TypeElement: 1, TypeText: 2, ProjectedTemplate: 4, CatRenderNode: 3, TypeNgContent: 8, TypePipe: 16, TypePureArray: 32, TypePureObject: 64, TypePurePipe: 128, CatPureExpression: 224, TypeValueProvider: 256, TypeClassProvider: 512, TypeFactoryProvider: 1024, TypeUseExistingProvider: 2048, LazyProvider: 4096, PrivateProvider: 8192, TypeDirective: 16384, Component: 32768, CatProviderNoDirective: 3840, CatProvider: 20224, OnInit: 65536, OnDestroy: 131072, DoCheck: 262144, OnChanges: 524288, AfterContentInit: 1048576, AfterContentChecked: 2097152, AfterViewInit: 4194304, AfterViewChecked: 8388608, EmbeddedViews: 16777216, ComponentView: 33554432, TypeContentQuery: 67108864, TypeViewQuery: 134217728, StaticQuery: 268435456, DynamicQuery: 536870912, CatQuery: 201326592, // mutually exclusive values... Types: 201347067, }; /** @enum {number} */ const DepFlags = { None: 0, SkipSelf: 1, Optional: 2, Value: 8, }; /** @enum {number} */ const ArgumentType = { Inline: 0, Dynamic: 1, }; /** @enum {number} */ const BindingFlags = { TypeElementAttribute: 1, TypeElementClass: 2, TypeElementStyle: 4, TypeProperty: 8, SyntheticProperty: 16, SyntheticHostProperty: 32, CatSyntheticProperty: 48, // mutually exclusive values... Types: 15, }; /** @enum {number} */ const QueryBindingType = { First: 0, All: 1, }; /** @enum {number} */ const QueryValueType = { ElementRef: 0, RenderElement: 1, TemplateRef: 2, ViewContainerRef: 3, Provider: 4, }; /** @enum {number} */ const ViewFlags = { None: 0, OnPush: 2, }; /** @enum {number} */ const MissingTranslationStrategy = { Error: 0, Warning: 1, Ignore: 2, }; MissingTranslationStrategy[MissingTranslationStrategy.Error] = "Error"; MissingTranslationStrategy[MissingTranslationStrategy.Warning] = "Warning"; MissingTranslationStrategy[MissingTranslationStrategy.Ignore] = "Ignore"; /** * @record * @template T */ function MetadataFactory() { } /** * @template T * @param {?} name * @param {?=} props * @return {?} */ function makeMetadataFactory(name, props) { const /** @type {?} */ factory = (...args) => { const /** @type {?} */ values = props ? props(...args) : {}; return Object.assign({ ngMetadataName: name }, values); }; factory.isTypeOf = (obj) => obj && obj.ngMetadataName === name; factory.ngMetadataName = name; return factory; } /** * @record */ function Route() { } var core = Object.freeze({ Inject: Inject, createInject: createInject, createInjectionToken: createInjectionToken, Attribute: Attribute, createAttribute: createAttribute, Query: Query, createContentChildren: createContentChildren, createContentChild: createContentChild, createViewChildren: createViewChildren, createViewChild: createViewChild, Directive: Directive, createDirective: createDirective, Component: Component, ViewEncapsulation: ViewEncapsulation, ChangeDetectionStrategy: ChangeDetectionStrategy, createComponent: createComponent, Pipe: Pipe, createPipe: createPipe, Input: Input, createInput: createInput, Output: Output, createOutput: createOutput, HostBinding: HostBinding, createHostBinding: createHostBinding, HostListener: HostListener, createHostListener: createHostListener, NgModule: NgModule, createNgModule: createNgModule, ModuleWithProviders: ModuleWithProviders, SchemaMetadata: SchemaMetadata, CUSTOM_ELEMENTS_SCHEMA: CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA: NO_ERRORS_SCHEMA, createOptional: createOptional, createInjectable: createInjectable, createSelf: createSelf, createSkipSelf: createSkipSelf, createHost: createHost, Type: Type, SecurityContext: SecurityContext, NodeFlags: NodeFlags, DepFlags: DepFlags, ArgumentType: ArgumentType, BindingFlags: BindingFlags, QueryBindingType: QueryBindingType, QueryValueType: QueryValueType, ViewFlags: ViewFlags, MissingTranslationStrategy: MissingTranslationStrategy, MetadataFactory: MetadataFactory, Route: Route }); /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ const DASH_CASE_REGEXP = /-+([a-z0-9])/g; /** * @param {?} input * @return {?} */ function dashCaseToCamelCase(input) { return input.replace(DASH_CASE_REGEXP, (...m) => m[1].toUpperCase()); } /** * @param {?} input * @param {?} defaultValues * @return {?} */ function splitAtColon(input, defaultValues) { return _splitAt(input, ':', defaultValues); } /** * @param {?} input * @param {?} defaultValues * @return {?} */ function splitAtPeriod(input, defaultValues) { return _splitAt(input, '.', defaultValues); } /** * @param {?} input * @param {?} character * @param {?} defaultValues * @return {?} */ function _splitAt(input, character, defaultValues) { const /** @type {?} */ characterIndex = input.indexOf(character); if (characterIndex == -1) return defaultValues; return [input.slice(0, characterIndex).trim(), input.slice(characterIndex + 1).trim()]; } /** * @param {?} value * @param {?} visitor * @param {?} context * @return {?} */ function visitValue(value, visitor, context) { if (Array.isArray(value)) { return visitor.visitArray(/** @type {?} */ (value), context); } if (isStrictStringMap(value)) { return visitor.visitStringMap(/** @type {?} */ (value), context); } if (value == null || typeof value == 'string' || typeof value == 'number' || typeof value == 'boolean') { return visitor.visitPrimitive(value, context); } return visitor.visitOther(value, context); } /** * @param {?} val * @return {?} */ function isDefined(val) { return val !== null && val !== undefined; } /** * @template T * @param {?} val * @return {?} */ function noUndefined(val) { return val === undefined ? /** @type {?} */ ((null)) : val; } /** * @record */ class ValueTransformer { /** * @param {?} arr * @param {?} context * @return {?} */ visitArray(arr, context) { return arr.map(value => visitValue(value, this, context)); } /** * @param {?} map * @param {?} context * @return {?} */ visitStringMap(map, context) { const /** @type {?} */ result = {}; Object.keys(map).forEach(key => { result[key] = visitValue(map[key], this, context); }); return result; } /** * @param {?} value * @param {?} context * @return {?} */ visitPrimitive(value, context) { return value; } /** * @param {?} value * @param {?} context * @return {?} */ visitOther(value, context) { return value; } } const SyncAsync = { assertSync: (value) => { if (isPromise(value)) { throw new Error(`Illegal state: value cannot be a promise`); } return value; }, then: (value, cb) => { return isPromise(value) ? value.then(cb) : cb(value); }, all: (syncAsyncValues) => { return syncAsyncValues.some(isPromise) ? Promise.all(syncAsyncValues) : /** @type {?} */ (syncAsyncValues); } }; /** * @param {?} msg * @param {?=} parseErrors * @return {?} */ function syntaxError(msg, parseErrors) { const /** @type {?} */ error = Error(msg); (/** @type {?} */ (error))[ERROR_SYNTAX_ERROR] = true; if (parseErrors) (/** @type {?} */ (error))[ERROR_PARSE_ERRORS] = parseErrors; return error; } const ERROR_SYNTAX_ERROR = 'ngSyntaxError'; const ERROR_PARSE_ERRORS = 'ngParseErrors'; /** * @param {?} error * @return {?} */ function isSyntaxError(error) { return (/** @type {?} */ (error))[ERROR_SYNTAX_ERROR]; } /** * @param {?} error * @return {?} */ function getParseErrors(error) { return (/** @type {?} */ (error))[ERROR_PARSE_ERRORS] || []; } /** * @param {?} s * @return {?} */ function escapeRegExp(s) { return s.replace(/([.*+?^=!:${}()|[\]\/\\])/g, '\\$1'); } const STRING_MAP_PROTO = Object.getPrototypeOf({}); /** * @param {?} obj * @return {?} */ function isStrictStringMap(obj) { return typeof obj === 'object' && obj !== null && Object.getPrototypeOf(obj) === STRING_MAP_PROTO; } /** * @param {?} str * @return {?} */ function utf8Encode(str) { let /** @type {?} */ encoded = ''; for (let /** @type {?} */ index = 0; index < str.length; index++) { let /** @type {?} */ codePoint = str.charCodeAt(index); // decode surrogate // see https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae if (codePoint >= 0xd800 && codePoint <= 0xdbff && str.length > (index + 1)) { const /** @type {?} */ low = str.charCodeAt(index + 1); if (low >= 0xdc00 && low <= 0xdfff) { index++; codePoint = ((codePoint - 0xd800) << 10) + low - 0xdc00 + 0x10000; } } if (codePoint <= 0x7f) { encoded += String.fromCharCode(codePoint); } else if (codePoint <= 0x7ff) { encoded += String.fromCharCode(((codePoint >> 6) & 0x1F) | 0xc0, (codePoint & 0x3f) | 0x80); } else if (codePoint <= 0xffff) { encoded += String.fromCharCode((codePoint >> 12) | 0xe0, ((codePoint >> 6) & 0x3f) | 0x80, (codePoint & 0x3f) | 0x80); } else if (codePoint <= 0x1fffff) { encoded += String.fromCharCode(((codePoint >> 18) & 0x07) | 0xf0, ((codePoint >> 12) & 0x3f) | 0x80, ((codePoint >> 6) & 0x3f) | 0x80, (codePoint & 0x3f) | 0x80); } } return encoded; } /** * @record */ /** * @param {?} token * @return {?} */ function stringify(token) { if (typeof token === 'string') { return token; } if (token instanceof Array) { return '[' + token.map(stringify).join(', ') + ']'; } if (token == null) { return '' + token; } if (token.overriddenName) { return `${token.overriddenName}`; } if (token.name) { return `${token.name}`; } const /** @type {?} */ res = token.toString(); if (res == null) { return '' + res; } const /** @type {?} */ newLineIndex = res.indexOf('\n'); return newLineIndex === -1 ? res : res.substring(0, newLineIndex); } /** * Lazily retrieves the reference value from a forwardRef. * @param {?} type * @return {?} */ function resolveForwardRef(type) { if (typeof type === 'function' && type.hasOwnProperty('__forward_ref__')) { return type(); } else { return type; } } /** * Determine if the argument is shaped like a Promise * @param {?} obj * @return {?} */ function isPromise(obj) { // allow any Promise/A+ compliant thenable. // It's up to the caller to ensure that obj.then conforms to the spec return !!obj && typeof obj.then === 'function'; } class Version { /** * @param {?} full */ constructor(full) { this.full = full; const /** @type {?} */ splits = full.split('.'); this.major = splits[0]; this.minor = splits[1]; this.patch = splits.slice(2).join('.'); } } /** * @record */ /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * \@stable */ const VERSION = new Version('5.2.10'); /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * An Abstract Syntax Tree node representing part of a parsed Angular template. * @record */ /** * A segment of text within the template. */ class TextAst { /** * @param {?} value * @param {?} ngContentIndex * @param {?} sourceSpan */ constructor(value, ngContentIndex, sourceSpan) { this.value = value; this.ngContentIndex = ngContentIndex; this.sourceSpan = sourceSpan; } /** * @param {?} visitor * @param {?} context * @return {?} */ visit(visitor, context) { return visitor.visitText(this, context); } } /** * A bound expression within the text of a template. */ class BoundTextAst { /** * @param {?} value * @param {?} ngContentIndex * @param {?} sourceSpan */ constructor(value, ngContentIndex, sourceSpan) { this.value = value; this.ngContentIndex = ngContentIndex; this.sourceSpan = sourceSpan; } /** * @param {?} visitor * @param {?} context * @return {?} */ visit(visitor, context) { return visitor.visitBoundText(this, context); } } /** * A plain attribute on an element. */ class AttrAst { /** * @param {?} name * @param {?} value * @param {?} sourceSpan */ constructor(name, value, sourceSpan) { this.name = name; this.value = value; this.sourceSpan = sourceSpan; } /** * @param {?} visitor * @param {?} context * @return {?} */ visit(visitor, context) { return visitor.visitAttr(this, context); } } /** * A binding for an element property (e.g. `[property]="expression"`) or an animation trigger (e.g. * `[\@trigger]="stateExp"`) */ class BoundElementPropertyAst { /** * @param {?} name * @param {?} type * @param {?} securityContext * @param {?} value * @param {?} unit * @param {?} sourceSpan */ constructor(name, type, securityContext, value, unit, sourceSpan) { this.name = name; this.type = type; this.securityContext = securityContext; this.value = value; this.unit = unit; this.sourceSpan = sourceSpan; this.isAnimation = this.type === PropertyBindingType.Animation; } /** * @param {?} visitor * @param {?} context * @return {?} */ visit(visitor, context) { return visitor.visitElementProperty(this, context); } } /** * A binding for an element event (e.g. `(event)="handler()"`) or an animation trigger event (e.g. * `(\@trigger.phase)="callback($event)"`). */ class BoundEventAst { /** * @param {?} name * @param {?} target * @param {?} phase * @param {?} handler * @param {?} sourceSpan */ constructor(name, target, phase, handler, sourceSpan) { this.name = name; this.target = target; this.phase = phase; this.handler = handler; this.sourceSpan = sourceSpan; this.fullName = BoundEventAst.calcFullName(this.name, this.target, this.phase); this.isAnimation = !!this.phase; } /** * @param {?} name * @param {?} target * @param {?} phase * @return {?} */ static calcFullName(name, target, phase) { if (target) { return `${target}:${name}`; } else if (phase) { return `@${name}.${phase}`; } else { return name; } } /** * @param {?} visitor * @param {?} context * @return {?} */ visit(visitor, context) { return visitor.visitEvent(this, context); } } /** * A reference declaration on an element (e.g. `let someName="expression"`). */ class ReferenceAst { /** * @param {?} name * @param {?} value * @param {?} sourceSpan */ constructor(name, value, sourceSpan) { this.name = name; this.value = value; this.sourceSpan = sourceSpan; } /** * @param {?} visitor * @param {?} context * @return {?} */ visit(visitor, context) { return visitor.visitReference(this, context); } } /** * A variable declaration on a <ng-template> (e.g. `var-someName="someLocalName"`). */ class VariableAst { /** * @param {?} name * @param {?} value * @param {?} sourceSpan */ constructor(name, value, sourceSpan) { this.name = name; this.value = value; this.sourceSpan = sourceSpan; } /** * @param {?} visitor * @param {?} context * @return {?} */ visit(visitor, context) { return visitor.visitVariable(this, context); } } /** * An element declaration in a template. */ class ElementAst { /** * @param {?} name * @param {?} attrs * @param {?} inputs * @param {?} outputs * @param {?} references * @param {?} directives * @param {?} providers * @param {?} hasViewContainer * @param {?} queryMatches * @param {?} children * @param {?} ngContentIndex * @param {?} sourceSpan * @param {?} endSourceSpan */ constructor(name, attrs, inputs, outputs, references, directives, providers, hasViewContainer, queryMatches, children, ngContentIndex, sourceSpan, endSourceSpan) { this.name = name; this.attrs = attrs; this.inputs = inputs; this.outputs = outputs; this.references = references; this.directives = directives; this.providers = providers; this.hasViewContainer = hasViewContainer; this.queryMatches = queryMatches; this.children = children; this.ngContentIndex = ngContentIndex; this.sourceSpan = sourceSpan; this.endSourceSpan = endSourceSpan; } /** * @param {?} visitor * @param {?} context * @return {?} */ visit(visitor, context) { return visitor.visitElement(this, context); } } /** * A `<ng-template>` element included in an Angular template. */ class EmbeddedTemplateAst { /** * @param {?} attrs * @param {?} outputs * @param {?} references * @param {?} variables * @param {?} directives * @param {?} providers * @param {?} hasViewContainer * @param {?} queryMatches * @param {?} children * @param {?} ngContentIndex * @param {?} sourceSpan */ constructor(attrs, outputs, references, variables, directives, providers, hasViewContainer, queryMatches, children, ngContentIndex, sourceSpan) { this.attrs = attrs; this.outputs = outputs; this.references = references; this.variables = variables; this.directives = directives; this.providers = providers; this.hasViewContainer = hasViewContainer; this.queryMatches = queryMatches; this.children = children; this.ngContentIndex = ngContentIndex; this.sourceSpan = sourceSpan; } /** * @param {?} visitor * @param {?} context * @return {?} */ visit(visitor, context) { return visitor.visitEmbeddedTemplate(this, context); } } /** * A directive property with a bound value (e.g. `*ngIf="condition"). */ class BoundDirectivePropertyAst { /** * @param {?} directiveName * @param {?} templateName * @param {?} value * @param {?} sourceSpan */ constructor(directiveName, templateName, value, sourceSpan) { this.directiveName = directiveName; this.templateName = templateName; this.value = value; this.sourceSpan = sourceSpan; } /** * @param {?} visitor * @param {?} context * @return {?} */ visit(visitor, context) { return visitor.visitDirectiveProperty(this, context); } } /** * A directive declared on an element. */ class DirectiveAst { /** * @param {?} directive * @param {?} inputs * @param {?} hostProperties * @param {?} hostEvents * @param {?} contentQueryStartId * @param {?} sourceSpan */ constructor(directive, inputs, hostProperties, hostEvents, contentQueryStartId, sourceSpan) { this.directive = directive; this.inputs = inputs; this.hostProperties = hostProperties; this.hostEvents = hostEvents; this.contentQueryStartId = contentQueryStartId; this.sourceSpan = sourceSpan; } /** * @param {?} visitor * @param {?} context * @return {?} */ visit(visitor, context) { return visitor.visitDirective(this, context); } } /** * A provider declared on an element */ class ProviderAst { /** * @param {?} token * @param {?} multiProvider * @param {?} eager * @param {?} providers * @param {?} providerType * @param {?} lifecycleHooks * @param {?} sourceSpan */ constructor(token, multiProvider, eager, providers, providerType, lifecycleHooks, sourceSpan) { this.token = token; this.multiProvider = multiProvider; this.eager = eager; this.providers = providers; this.providerType = providerType; this.lifecycleHooks = lifecycleHooks; this.sourceSpan = sourceSpan; } /** * @param {?} visitor * @param {?} context * @return {?} */ visit(visitor, context) { // No visit method in the visitor for now... return null; } } /** @enum {number} */ const ProviderAstType = { PublicService: 0, PrivateService: 1, Component: 2, Directive: 3, Builtin: 4, }; ProviderAstType[ProviderAstType.PublicService] = "PublicService"; ProviderAstType[ProviderAstType.PrivateService] = "PrivateService"; ProviderAstType[ProviderAstType.Component] = "Component"; ProviderAstType[ProviderAstType.Directive] = "Directive"; ProviderAstType[ProviderAstType.Builtin] = "Builtin"; /** * Position where content is to be projected (instance of `<ng-content>` in a template). */ class NgContentAst { /** * @param {?} index * @param {?} ngContentIndex * @param {?} sourceSpan */ constructor(index, ngContentIndex, sourceSpan) { this.index = index; this.ngContentIndex = ngContentIndex; this.sourceSpan = sourceSpan; } /** * @param {?} visitor * @param {?} context * @return {?} */ visit(visitor, context) { return visitor.visitNgContent(this, context); } } /** @enum {number} */ const PropertyBindingType = { /** * A normal binding to a property (e.g. `[property]="expression"`). */ Property: 0, /** * A binding to an element attribute (e.g. `[attr.name]="expression"`). */ Attribute: 1, /** * A binding to a CSS class (e.g. `[class.name]="condition"`). */ Class: 2, /** * A binding to a style rule (e.g. `[style.rule]="expression"`). */ Style: 3, /** * A binding to an animation reference (e.g. `[animate.key]="expression"`). */ Animation: 4, }; PropertyBindingType[PropertyBindingType.Property] = "Property"; PropertyBindingType[PropertyBindingType.Attribute] = "Attribute"; PropertyBindingType[PropertyBindingType.Class] = "Class"; PropertyBindingType[PropertyBindingType.Style] = "Style"; PropertyBindingType[PropertyBindingType.Animation] = "Animation"; /** * @record */ /** * A visitor for {\@link TemplateAst} trees that will process each node. * @record */ /** * A visitor that accepts each node but doesn't do anything. It is intended to be used * as the base class for a visitor that is only interested in a subset of the node types. */ class NullTemplateVisitor { /** * @param {?} ast * @param {?} context * @return {?} */ visitNgContent(ast, context) { } /** * @param {?} ast * @param {?} context * @return {?} */ visitEmbeddedTemplate(ast, context) { } /** * @param {?} ast * @param {?} context * @return {?} */ visitElement(ast, context) { } /** * @param {?} ast * @param {?} context * @return {?} */ visitReference(ast, context) { } /** * @param {?} ast * @param {?} context * @return {?} */ visitVariable(ast, context) { } /** * @param {?} ast * @param {?} context * @return {?} */ visitEvent(ast, context) { } /** * @param {?} ast * @param {?} context * @return {?} */ visitElementProperty(ast, context) { } /** * @param {?} ast * @param {?} context * @return {?} */ visitAttr(ast, context) { } /** * @param {?} ast * @param {?} context * @return {?} */ visitBoundText(ast, context) { } /** * @param {?} ast * @param {?} context * @return {?} */ visitText(ast, context) { } /** * @param {?} ast * @param {?} context * @return {?} */ visitDirective(ast, context) { } /** * @param {?} ast * @param {?} context * @return {?} */ visitDirectiveProperty(ast, context) { } } /** * Base class that can be used to build a visitor that visits each node * in an template ast recursively. */ class RecursiveTemplateAstVisitor extends NullTemplateVisitor { constructor() { super(); } /** * @param {?} ast * @param {?} context * @return {?} */ visitEmbeddedTemplate(ast, context) { return this.visitChildren(context, visit => { visit(ast.attrs); visit(ast.references); visit(ast.variables); visit(ast.directives); visit(ast.providers); visit(ast.children); }); } /** * @param {?} ast * @param {?} context * @return {?} */ visitElement(ast, context) { return this.visitChildren(context, visit => { visit(ast.attrs); visit(ast.inputs); visit(ast.outputs); visit(ast.references); visit(ast.directives); visit(ast.providers); visit(ast.children); }); } /** * @param {?} ast * @param {?} context * @return {?} */ visitDirective(ast, context) { return this.visitChildren(context, visit => { visit(ast.inputs); visit(ast.hostProperties); visit(ast.hostEvents); }); } /** * @template T * @param {?} context * @param {?} cb * @return {?} */ visitChildren(context, cb) { let /** @type {?} */ results = []; let /** @type {?} */ t = this; /** * @template T * @param {?} children * @return {?} */ function visit(children) { if (children && children.length) results.push(templateVisitAll(t, children, context)); } cb(visit); return [].concat.apply([], results); } } /** * Visit every node in a list of {\@link TemplateAst}s with the given {\@link TemplateAstVisitor}. * @param {?} visitor * @param {?} asts * @param {?=} context * @return {?} */ function templateVisitAll(visitor, asts, context = null) { const /** @type {?} */ result = []; const /** @type {?} */ visit = visitor.visit ? (ast) => /** @type {?} */ ((visitor.visit))(ast, context) || ast.visit(visitor, context) : (ast) => ast.visit(visitor, context); asts.forEach(ast => { const /** @type {?} */ astResult = visit(ast); if (astResult) { result.push(astResult); } }); return result; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ class CompilerConfig { /** * @param {?=} __0 */ constructor({ defaultEncapsulation = ViewEncapsulation.Emulated, useJit = true, jitDevMode = false, missingTranslation = null, enableLegacyTemplate, preserveWhitespaces, strictInjectionParameters } = {}) { this.defaultEncapsulation = defaultEncapsulation; this.useJit = !!useJit; this.jitDevMode = !!jitDevMode; this.missingTranslation = missingTranslation; this.enableLegacyTemplate = enableLegacyTemplate === true; this.preserveWhitespaces = preserveWhitespacesDefault(noUndefined(preserveWhitespaces)); this.strictInjectionParameters = strictInjectionParameters === true; } } /** * @param {?} preserveWhitespacesOption * @param {?=} defaultSetting * @return {?} */ function preserveWhitespacesDefault(preserveWhitespacesOption, defaultSetting = true) { return preserveWhitespacesOption === null ? defaultSetting : preserveWhitespacesOption; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * A token representing the a reference to a static type. * * This token is unique for a filePath and name and can be used as a hash table key. */ class StaticSymbol { /** * @param {?} filePath * @param {?} name * @param {?} members */ constructor(filePath, name, members) { this.filePath = filePath; this.name = name; this.members = members; } /** * @return {?} */ assertNoMembers() { if (this.members.length) { throw new Error(`Illegal state: symbol without members expected, but got ${JSON.stringify(this)}.`); } } } /** * A cache of static symbol used by the StaticReflector to return the same symbol for the * same symbol values. */ class StaticSymbolCache { constructor() { this.cache = new Map(); } /** * @param {?} declarationFile * @param {?} name * @param {?=} members * @return {?} */ get(declarationFile, name, members) { members = members || []; const /** @type {?} */ memberSuffix = members.length ? `.${members.join('.')}` : ''; const /** @type {?} */ key = `"${declarationFile}".${name}${memberSuffix}`; let /** @type {?} */ result = this.cache.get(key); if (!result) { result = new StaticSymbol(declarationFile, name, members); this.cache.set(key, result); } return result; } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ // group 0: "[prop] or (event) or @trigger" // group 1: "prop" from "[prop]" // group 2: "event" from "(event)" // group 3: "@trigger" from "@trigger" const HOST_REG_EXP = /^(?:(?:\[([^\]]+)\])|(?:\(([^\)]+)\)))|(\@[-\w]+)$/; /** * @param {?} name * @return {?} */ function _sanitizeIdentifier(name) { return name.replace(/\W/g, '_'); } let _anonymousTypeIndex = 0; /** * @param {?} compileIdentifier * @return {?} */ function identifierName(compileIdentifier) { if (!compileIdentifier || !compileIdentifier.reference) { return null; } const /** @type {?} */ ref = compileIdentifier.reference; if (ref instanceof StaticSymbol) { return ref.name; } if (ref['__anonymousType']) { return ref['__anonymousType']; } let /** @type {?} */ identifier = stringify(ref); if (identifier.indexOf('(') >= 0) { // case: anonymous functions! identifier = `anonymous_${_anonymousTypeIndex++}`; ref['__anonymousType'] = identifier; } else { identifier = _sanitizeIdentifier(identifier); } return identifier; } /** * @param {?} compileIdentifier * @return {?} */ function identifierModuleUrl(compileIdentifier) { const /** @type {?} */ ref = compileIdentifier.reference; if (ref instanceof StaticSymbol) { return ref.filePath; } // Runtime type return `./${stringify(ref)}`; } /** * @param {?} compType * @param {?} embeddedTemplateIndex * @return {?} */ function viewClassName(compType, embeddedTemplateIndex) { return `View_${identifierName({ reference: compType })}_${embeddedTemplateIndex}`; } /** * @param {?} compType * @return {?} */ function rendererTypeName(compType) { return `RenderType_${identifierName({ reference: compType })}`; } /** * @param {?} compType * @return {?} */ function hostViewClassName(compType) { return `HostView_${identifierName({ reference: compType })}`; } /** * @param {?} compType * @return {?} */ function componentFactoryName(compType) { return `${identifierName({ reference: compType })}NgFactory`; } /** * @record */ /** * @record */ /** @enum {number} */ const CompileSummaryKind = { Pipe: 0, Directive: 1, NgModule: 2, Injectable: 3, }; CompileSummaryKind[CompileSummaryKind.Pipe] = "Pipe"; CompileSummaryKind[CompileSummaryKind.Directive] = "Directive"; CompileSummaryKind[CompileSummaryKind.NgModule] = "NgModule"; CompileSummaryKind[CompileSummaryKind.Injectable] = "Injectable"; /** * A CompileSummary is the data needed to use a directive / pipe / module * in other modules / components. However, this data is not enough to compile * the directive / module itself. * @record */ /** * @record */ /** * @record */ /** * @record */ /** * @param {?} token * @return {?} */ function tokenName(token) { return token.value != null ? _sanitizeIdentifier(token.value) : identifierName(token.identifier); } /** * @param {?} token * @return {?} */ function tokenReference(token) { if (token.identifier != null) { return token.identifier.reference; } else { return token.value; } } /** * @record */ /** * Metadata regarding compilation of a type. * @record */ /** * @record */ /** * Metadata about a stylesheet */ class CompileStylesheetMetadata { /** * @param {?=} __0 */ constructor({ moduleUrl, styles, styleUrls } = {}) { this.moduleUrl = moduleUrl || null; this.styles = _normalizeArray(styles); this.styleUrls = _normalizeArray(styleUrls); } } /** * Summary Metadata regarding compilation of a template. * @record */ /** * Metadata regarding compilation of a template. */ class CompileTemplateMetadata { /** * @param {?} __0 */ constructor({ encapsulation, template, templateUrl, htmlAst, styles, styleUrls, externalStylesheets, animations, ngContentSelectors, interpolation, isInline, preserveWhitespaces }) { this.encapsulation = encapsulation; this.template = template; this.templateUrl = templateUrl; this.htmlAst = htmlAst; this.styles = _normalizeArray(styles); this.styleUrls = _normalizeArray(styleUrls); this.externalStylesheets = _normalizeArray(externalStylesheets); this.animations = animations ? flatten(animations) : []; this.ngContentSelectors = ngContentSelectors || []; if (interpolation && interpolation.length != 2) { throw new Error(`'interpolation' should have a start and an end symbol.`); } this.interpolation = interpolation; this.isInline = isInline; this.preserveWhitespaces = preserveWhitespaces; } /** * @return {?} */ toSummary() { return { ngContentSelectors: this.ngContentSelectors, encapsulation: this.encapsulation, }; } } /** * @record */ /** * @record */ /** * Metadata regarding compilation of a directive. */ class CompileDirectiveMetadata { /** * @param {?} __0 * @return {?} */ static create({ isHost, type, isComponent, selector, exportAs, changeDetection, inputs, outputs, host, providers, viewProviders, queries, guards, viewQueries, entryComponents, template, componentViewType, rendererType, componentFactory }) { const /** @type {?} */ hostListeners = {}; const /** @type {?} */ hostProperties = {}; const /** @type {?} */ hostAttributes = {}; if (host != null) { Object.keys(host).forEach(key => { const /** @type {?} */ value = host[key]; const /** @type {?} */ matches = key.match(HOST_REG_EXP); if (matches === null) { hostAttributes[key] = value; } else if (matches[1] != null) { hostProperties[matches[1]] = value; } else if (matches[2] != null) { hostListeners[matches[2]] = value; } }); } const /** @type {?} */ inputsMap = {}; if (inputs != null) { inputs.forEach((bindConfig) => { // canonical syntax: `dirProp: elProp` // if there is no `:`, use dirProp = elProp const /** @type {?} */ parts = splitAtColon(bindConfig, [bindConfig, bindConfig]); inputsMap[parts[0]] = parts[1]; }); } const /** @type {?} */ outputsMap = {}; if (outputs != null) { outputs.forEach((bindConfig) => { // canonical syntax: `dirProp: elProp` // if there is no `:`, use dirProp = elProp const /** @type {?} */ parts = splitAtColon(bindConfig, [bindConfig, bindConfig]); outputsMap[parts[0]] = parts[1]; }); } return new CompileDirectiveMetadata({ isHost, type, isComponent: !!isComponent, selector, exportAs, changeDetection, inputs: inputsMap, outputs: outputsMap, hostListeners, hostProperties, hostAttributes, providers, viewProviders, queries, guards, viewQueries, entryComponents, template, componentViewType, rendererType, componentFactory, }); } /** * @param {?} __0 */ constructor({ isHost, type, isComponent, selector, exportAs, changeDetection, inputs, outputs, hostListeners, hostProperties, hostAttributes, providers, viewProviders, queries, guards, viewQueries, entryComponents, template, componentViewType, rendererType, componentFactory }) { this.isHost = !!isHost; this.type = type; this.isComponent = isComponent; this.selector = selector; this.exportAs = exportAs; this.changeDetection = changeDetection; this.inputs = inputs; this.outputs = outputs; this.hostListeners = hostListeners; this.hostProperties = hostProperties; this.hostAttributes = hostAttributes; this.providers = _normalizeArray(providers); this.viewProviders = _normalizeArray(viewProviders); this.queries = _normalizeArray(queries); this.guards = guards; this.viewQueries = _normalizeArray(viewQueries); this.entryComponents = _normalizeArray(entryComponents); this.template = template; this.componentViewType = componentViewType; this.rendererType = rendererType; this.componentFactory = componentFactory; } /** * @return {?} */ toSummary() { return { summaryKind: CompileSummaryKind.Directive, type: this.type, isComponent: this.isComponent, selector: this.selector, exportAs: this.exportAs, inputs: this.inputs, outputs: this.outputs, hostListeners: this.hostListeners, hostProperties: this.hostProperties, hostAttributes: this.hostAttributes, providers: this.providers, viewProviders: this.viewProviders, queries: this.queries, guards: this.guards, viewQueries: this.viewQueries, entryComponents: this.entryComponents, changeDetection: this.changeDetection, template: this.template && this.template.toSummary(), componentViewType: this.componentViewType, rendererType: this.rendererType, componentFactory: this.componentFactory }; } } /** * @record */ class CompilePipeMetadata { /** * @param {?} __0 */ constructor({ type, name, pure }) { this.type = type; this.name = name; this.pure = !!pure; } /** * @return {?} */ toSummary() { return { summaryKind: CompileSummaryKind.Pipe, type: this.type, name: this.name, pure: this.pure }; } } /** * @record */ /** * Metadata regarding compilation of a module. */ class CompileNgModuleMetadata { /** * @param {?} __0 */ constructor({ type, providers, declaredDirectives, exportedDirectives, declaredPipes, exportedPipes, entryComponents, bootstrapComponents, importedModules, exportedModules, schemas, transitiveModule, id }) { this.type = type || null; this.declaredDirectives = _normalizeArray(declaredDirectives); this.exportedDirectives = _normalizeArray(exportedDirectives); this.declaredPipes = _normalizeArray(declaredPipes); this.exportedPipes = _normalizeArray(exportedPipes); this.providers = _normalizeArray(providers); this.entryComponents = _normalizeArray(entryComponents); this.bootstrapComponents = _normalizeArray(bootstrapComponents); this.importedModules = _normalizeArray(importedModules); this.exportedModules = _normalizeArray(exportedModules); this.schemas = _normalizeArray(schemas); this.id = id || null; this.transitiveModule = transitiveModule || null; } /** * @return {?} */ toSummary() { const /** @type {?} */ module = /** @type {?} */ ((this.transitiveModule)); return { summaryKind: CompileSummaryKind.NgModule, type: this.type, entryComponents: module.entryComponents, providers: module.providers, modules: module.modules, exportedDirectives: module.exportedDirectives, exportedPipes: module.exportedPipes }; } } class TransitiveCompileNgModuleMetadata { constructor() { this.directivesSet = new Set(); this.directives = []; this.exportedDirectivesSet = new Set(); this.exportedDirectives = []; this.pipesSet = new Set(); this.pipes = []; this.exportedPipesSet = new Set(); this.exportedPipes = []; this.modulesSet = new Set(); this.modules = []; this.entryComponentsSet = new Set(); this.entryComponents = []; this.providers = []; } /** * @param {?} provider * @param {?} module * @return {?} */ addProvider(provider, module) { this.providers.push({ provider: provider, module: module }); } /** * @param {?} id * @return {?} */ addDirective(id) { if (!this.directivesSet.has(id.reference)) { this.directivesSet.add(id.reference); this.directives.push(id); } } /** * @param {?} id * @return {?} */ addExportedDirective(id) { if (!this.exportedDirectivesSet.has(id.reference)) { this.exportedDirectivesSet.add(id.reference); this.exportedDirectives.push(id); } } /** * @param {?} id * @return {?} */ addPipe(id) { if (!this.pipesSet.has(id.reference)) { this.pipesSet.add(id.reference); this.pipes.push(id); } } /** * @param {?} id * @return {?} */ addExportedPipe(id) { if (!this.exportedPipesSet.has(id.reference)) { this.exportedPipesSet.add(id.reference); this.exportedPipes.push(id); } } /** * @param {?} id * @return {?} */ addModule(id) { if (!this.modulesSet.has(id.reference)) { this.modulesSet.add(id.reference); this.modules.push(id); } } /** * @param {?} ec * @return {?} */ addEntryComponent(ec) { if (!this.entryComponentsSet.has(ec.componentType)) { this.entryComponentsSet.add(ec.componentType); this.entryComponents.push(ec); } } } /** * @param {?} obj * @return {?} */ function _normalizeArray(obj) { return obj || []; } class ProviderMeta { /** * @param {?} token * @param {?} __1 */ constructor(token, { useClass, useValue, useExisting, useFactory, deps, multi }) { this.token = token; this.useClass = useClass || null; this.useValue = useValue; this.useExisting = useExisting; this.useFactory = useFactory || null; this.dependencies = deps || null; this.multi = !!multi; } } /** * @template T * @param {?} list * @return {?} */ function flatten(list) { return list.reduce((flat, item) => { const /** @type {?} */ flatItem = Array.isArray(item) ? flatten(item) : item; return (/** @type {?} */ (flat)).concat(flatItem); }, []); } /** * @param {?} url * @return {?} */ function jitSourceUrl(url) { // Note: We need 3 "/" so that ng shows up as a separate domain // in the chrome dev tools. return url.replace(/(\w+:\/\/[\w:-]+)?(\/+)?/, 'ng:///'); } /** * @param {?} ngModuleType * @param {?} compMeta * @param {?} templateMeta * @return {?} */ function templateSourceUrl(ngModuleType, compMeta, templateMeta) { let /** @type {?} */ url; if (templateMeta.isInline) { if (compMeta.type.reference instanceof StaticSymbol) { // Note: a .ts file might contain multiple components with inline templates, // so we need to give them unique urls, as these will be used for sourcemaps. url = `${compMeta.type.reference.filePath}.${compMeta.type.reference.name}.html`; } else { url = `${identifierName(ngModuleType)}/${identifierName(compMeta.type)}.html`; } } else { url = /** @type {?} */ ((templateMeta.templateUrl)); } return compMeta.type.reference instanceof StaticSymbol ? url : jitSourceUrl(url); } /** * @param {?} meta * @param {?} id * @return {?} */ function sharedStylesheetJitUrl(meta, id) { const /** @type {?} */ pathParts = /** @type {?} */ ((meta.moduleUrl)).split(/\/\\/g); const /** @type {?} */ baseName = pathParts[pathParts.length - 1]; return jitSourceUrl(`css/${id}${baseName}.ngstyle.js`); } /** * @param {?} moduleMeta * @return {?} */ function ngModuleJitUrl(moduleMeta) { return jitSourceUrl(`${identifierName(moduleMeta.type)}/module.ngfactory.js`); } /** * @param {?} ngModuleType * @param {?} compMeta * @return {?} */ function templateJitUrl(ngModuleType, compMeta) { return jitSourceUrl(`${identifierName(ngModuleType)}/${identifierName(compMeta.type)}.ngfactory.js`); } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * A path is an ordered set of elements. Typically a path is to a * particular offset in a source file. The head of the list is the top * most node. The tail is the node that contains the offset directly. * * For example, the expresion `a + b + c` might have an ast that looks * like: * + * / \ * a + * / \ * b c * * The path to the node at offset 9 would be `['+' at 1-10, '+' at 7-10, * 'c' at 9-10]` and the path the node at offset 1 would be * `['+' at 1-10, 'a' at 1-2]`. * @template T */ class AstPath { /** * @param {?} path * @param {?=} position */ constructor(path, position = -1) { this.path = path; this.position = position; } /** * @return {?} */ get empty() { return !this.path || !this.path.length; } /** * @return {?} */ get head() { return this.path[0]; } /** * @return {?} */ get tail() { return this.path[this.path.length - 1]; } /** * @param {?} node * @return {?} */ parentOf(node) { return node && this.path[this.path.indexOf(node) - 1]; } /** * @param {?} node * @return {?} */ childOf(node) { return this.path[this.path.indexOf(node) + 1]; } /** * @template N * @param {?} ctor * @return {?} */ first(ctor) { for (let /** @type {?} */ i = this.path.length - 1; i >= 0; i--) { let /** @type {?} */ item = this.path[i]; if (item instanceof ctor) return /** @type {?} */ (item); } } /** * @param {?} node * @return {?} */ push(node) { this.path.push(node); } /** * @return {?} */ pop() { return /** @type {?} */ ((this.path.pop())); } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @record */ class Text { /** * @param {?} value * @param {?} sourceSpan */ constructor(value, sourceSpan) { this.value = value; this.sourceSpan = sourceSpan; } /** * @param {?} visitor * @param {?} context * @return {?} */ visit(visitor, context) { return visitor.visitText(this, context); } } class Expansion { /** * @param {?} switchValue * @param {?} type * @param {?} cases * @param {?} sourceSpan * @param {?} switchValueSourceSpan */ constructor(switchValue, type, cases, sourceSpan, switchValueSourceSpan) { this.switchValue = switchValue; this.type = type; this.cases = cases; this.sourceSpan = sourceSpan; this.switchValueSourceSpan = switchValueSourceSpan; } /** * @param {?} visitor * @param {?} context * @return {?} */ visit(visitor, context) { return visitor.visitExpansion(this, context); } } class ExpansionCase { /** * @param {?} value * @param {?} expression * @param {?} sourceSpan * @param {?} valueSourceSpan * @param {?} expSourceSpan */ constructor(value, expression, sourceSpan, valueSourceSpan, expSourceSpan) { this.value = value; this.expression = expression; this.sourceSpan = sourceSpan; this.valueSourceSpan = valueSourceSpan; this.expSourceSpan = expSourceSpan; } /** * @param {?} visitor * @param {?} context * @return {?} */ visit(visitor, context) { return visitor.visitExpansionCase(this, context); } } class Attribute$1 { /** * @param {?} name * @param {?} value * @param {?} sourceSpan * @param {?=} valueSpan */ constructor(name, value, sourceSpan, valueSpan) { this.name = name; this.value = value; this.sourceSpan = sourceSpan; this.valueSpan = valueSpan; } /** * @param {?} visitor * @param {?} context * @return {?} */ visit(visitor, context) { return visitor.visitAttribute(this, context); } } class Element { /** * @param {?} name * @param {?} attrs * @param {?} children * @param {?} sourceSpan * @param {?=} startSourceSpan * @param {?=} endSourceSpan */ constructor(name, attrs, children, sourceSpan, startSourceSpan = null, endSourceSpan = null) { this.name = name; this.attrs = attrs; this.children = children; this.sourceSpan = sourceSpan; this.startSourceSpan = startSourceSpan; this.endSourceSpan = endSourceSpan; } /** * @param {?} visitor * @param {?} context * @return {?} */ visit(visitor, context) { return visitor.visitElement(this, context); } } class Comment { /** * @param {?} value * @param {?} sourceSpan */ constructor(value, sourceSpan) { this.value = value; this.sourceSpan = sourceSpan; } /** * @param {?} visitor * @param {?} context * @return {?} */ visit(visitor, context) { return visitor.visitComment(this, context); } } /** * @record */ /** * @param {?} visitor * @param {?} nodes * @param {?=} context * @return {?} */ function visitAll(visitor, nodes, context = null) { const /** @type {?} */ result = []; const /** @type {?} */ visit = visitor.visit ? (ast) => /** @type {?} */ ((visitor.visit))(ast, context) || ast.visit(visitor, context) : (ast) => ast.visit(visitor, context); nodes.forEach(ast => { const /** @type {?} */ astResult = visit(ast); if (astResult) { result.push(astResult); } }); return result; } class RecursiveVisitor { constructor() { } /** * @param {?} ast * @param {?} context * @return {?} */ visitElement(ast, context) { this.visitChildren(context, visit => { visit(ast.attrs); visit(ast.children); }); } /** * @param {?} ast * @param {?} context * @return {?} */ visitAttribute(ast, context) { } /** * @param {?} ast * @param {?} context * @return {?} */ visitText(ast, context) { } /** * @param {?} ast * @param {?} context * @return {?} */ visitComment(ast, context) { } /** * @param {?} ast * @param {?} context * @return {?} */ visitExpansion(ast, context) { return this.visitChildren(context, visit => { visit(ast.cases); }); } /** * @param {?} ast * @param {?} context * @return {?} */ visitExpansionCase(ast, context) { } /** * @template T * @param {?} context * @param {?} cb * @return {?} */ visitChildren(context, cb) { let /** @type {?} */ results = []; let /** @type {?} */ t = this; /** * @template T * @param {?} children * @return {?} */ function visit(children) { if (children) results.push(visitAll(t, children, context)); } cb(visit); return [].concat.apply([], results); } } /** * @param {?} ast * @return {?} */ function spanOf(ast) { const /** @type {?} */ start = ast.sourceSpan.start.offset; let /** @type {?} */ end = ast.sourceSpan.end.offset; if (ast instanceof Element) { if (ast.endSourceSpan) { end = ast.endSourceSpan.end.offset; } else if (ast.children && ast.children.length) { end = spanOf(ast.children[ast.children.length - 1]).end; } } return { start, end }; } /** * @param {?} nodes * @param {?} position * @return {?} */ function findNode(nodes, position) { const /** @type {?} */ path = []; const /** @type {?} */ visitor = new class extends RecursiveVisitor { /** * @param {?} ast * @param {?} context * @return {?} */ visit(ast, context) { const /** @type {?} */ span = spanOf(ast); if (span.start <= position && position < span.end) { path.push(ast); } else { // Returning a value here will result in the children being skipped. return true; } } }; visitAll(visitor, nodes); return new AstPath(path, position); } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @param {?} identifier * @param {?} value * @return {?} */ function assertArrayOfStrings(identifier, value) { if (value == null) { return; } if (!Array.isArray(value)) { throw new Error(`Expected '${identifier}' to be an array of strings.`); } for (let /** @type {?} */ i = 0; i < value.length; i += 1) { if (typeof value[i] !== 'string') { throw new Error(`Expected '${identifier}' to be an array of strings.`); } } } const INTERPOLATION_BLACKLIST_REGEXPS = [ /^\s*$/, /[<>]/, /^[{}]$/, /&(#|[a-z])/i, /^\/\//, ]; /** * @param {?} identifier * @param {?} value * @return {?} */ function assertInterpolationSymbols(identifier, value) { if (value != null && !(Array.isArray(value) && value.length == 2)) { throw new Error(`Expected '${identifier}' to be an array, [start, end].`); } else if (value != null) { const /** @type {?} */ start = /** @type {?} */ (value[0]); const /** @type {?} */ end = /** @type {?} */ (value[1]); // black list checking INTERPOLATION_BLACKLIST_REGEXPS.forEach(regexp => { if (regexp.test(start) || regexp.test(end)) { throw new Error(`['${start}', '${end}'] contains unusable interpolation symbol.`); } }); } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ class InterpolationConfig { /** * @param {?} start * @param {?} end */ constructor(start, end) { this.start = start; this.end = end; } /** * @param {?} markers * @return {?} */ static fromArray(markers) { if (!markers) { return DEFAULT_INTERPOLATION_CONFIG; } assertInterpolationSymbols('interpolation', markers); return new InterpolationConfig(markers[0], markers[1]); } } const DEFAULT_INTERPOLATION_CONFIG = new InterpolationConfig('{{', '}}'); /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ class StyleWithImports { /** * @param {?} style * @param {?} styleUrls */ constructor(style, styleUrls) { this.style = style; this.styleUrls = styleUrls; } } /** * @param {?} url * @return {?} */ function isStyleUrlResolvable(url) { if (url == null || url.length === 0 || url[0] == '/') return false; const /** @type {?} */ schemeMatch = url.match(URL_WITH_SCHEMA_REGEXP); return schemeMatch === null || schemeMatch[1] == 'package' || schemeMatch[1] == 'asset'; } /** * Rewrites stylesheets by resolving and removing the \@import urls that * are either relative or don't have a `package:` scheme * @param {?} resolver * @param {?} baseUrl * @param {?} cssText * @return {?} */ function extractStyleUrls(resolver, baseUrl, cssText) { const /** @type {?} */ foundUrls = []; const /** @type {?} */ modifiedCssText = cssText.replace(CSS_STRIPPABLE_COMMENT_REGEXP, '') .replace(CSS_IMPORT_REGEXP, (...m) => { const /** @type {?} */ url = m[1] || m[2]; if (!isStyleUrlResolvable(url)) { // Do not attempt to resolve non-package absolute URLs with URI // scheme return m[0]; } foundUrls.push(resolver.resolve(baseUrl, url)); return ''; }); return new StyleWithImports(modifiedCssText, foundUrls); } const CSS_IMPORT_REGEXP = /@import\s+(?:url\()?\s*(?:(?:['"]([^'"]*))|([^;\)\s]*))[^;]*;?/g; const CSS_STRIPPABLE_COMMENT_REGEXP = /\/\*(?!#\s*(?:sourceURL|sourceMappingURL)=)[\s\S]+?\*\//g; const URL_WITH_SCHEMA_REGEXP = /^([^:/?#]+):/; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** @enum {number} */ const TagContentType = { RAW_TEXT: 0, ESCAPABLE_RAW_TEXT: 1, PARSABLE_DATA: 2, }; TagContentType[TagContentType.RAW_TEXT] = "RAW_TEXT"; TagContentType[TagContentType.ESCAPABLE_RAW_TEXT] = "ESCAPABLE_RAW_TEXT"; TagContentType[TagContentType.PARSABLE_DATA] = "PARSABLE_DATA"; /** * @record */ /** * @param {?} elementName * @return {?} */ function splitNsName(elementName) { if (elementName[0] != ':') { return [null, elementName]; } const /** @type {?} */ colonIndex = elementName.indexOf(':', 1); if (colonIndex == -1) { throw new Error(`Unsupported format "${elementName}" expecting ":namespace:name"`); } return [elementName.slice(1, colonIndex), elementName.slice(colonIndex + 1)]; } /** * @param {?} tagName * @return {?} */ function isNgContainer(tagName) { return splitNsName(tagName)[1] === 'ng-container'; } /** * @param {?} tagName * @return {?} */ function isNgContent(tagName) { return splitNsName(tagName)[1] === 'ng-content'; } /** * @param {?} tagName * @return {?} */ function isNgTemplate(tagName) { return splitNsName(tagName)[1] === 'ng-template'; } /** * @param {?} fullName * @return {?} */ function getNsPrefix(fullName) { return fullName === null ? null : splitNsName(fullName)[0]; } /** * @param {?} prefix * @param {?} localName * @return {?} */ function mergeNsAndName(prefix, localName) { return prefix ? `:${prefix}:${localName}` : localName; } // see http://www.w3.org/TR/html51/syntax.html#named-character-references // see https://html.spec.whatwg.org/multipage/entities.json // This list is not exhaustive to keep the compiler footprint low. // The `{` / `ƫ` syntax should be used when the named character reference does not // exist. const NAMED_ENTITIES = { 'Aacute': '\u00C1', 'aacute': '\u00E1', 'Acirc': '\u00C2', 'acirc': '\u00E2', 'acute': '\u00B4', 'AElig': '\u00C6', 'aelig': '\u00E6', 'Agrave': '\u00C0', 'agrave': '\u00E0', 'alefsym': '\u2135', 'Alpha': '\u0391', 'alpha': '\u03B1', 'amp': '&', 'and': '\u2227', 'ang': '\u2220', 'apos': '\u0027', 'Aring': '\u00C5', 'aring': '\u00E5', 'asymp': '\u2248', 'Atilde': '\u00C3', 'atilde': '\u00E3', 'Auml': '\u00C4', 'auml': '\u00E4', 'bdquo': '\u201E', 'Beta': '\u0392', 'beta': '\u03B2', 'brvbar': '\u00A6', 'bull': '\u2022', 'cap': '\u2229', 'Ccedil': '\u00C7', 'ccedil': '\u00E7', 'cedil': '\u00B8', 'cent': '\u00A2', 'Chi': '\u03A7', 'chi': '\u03C7', 'circ': '\u02C6', 'clubs': '\u2663', 'cong': '\u2245', 'copy': '\u00A9', 'crarr': '\u21B5', 'cup': '\u222A', 'curren': '\u00A4', 'dagger': '\u2020', 'Dagger': '\u2021', 'darr': '\u2193', 'dArr': '\u21D3', 'deg': '\u00B0', 'Delta': '\u0394', 'delta': '\u03B4', 'diams': '\u2666', 'divide': '\u00F7', 'Eacute': '\u00C9', 'eacute': '\u00E9', 'Ecirc': '\u00CA', 'ecirc': '\u00EA', 'Egrave': '\u00C8', 'egrave': '\u00E8', 'empty': '\u2205', 'emsp': '\u2003', 'ensp': '\u2002', 'Epsilon': '\u0395', 'epsilon': '\u03B5', 'equiv': '\u2261', 'Eta': '\u0397', 'eta': '\u03B7', 'ETH': '\u00D0', 'eth': '\u00F0', 'Euml': '\u00CB', 'euml': '\u00EB', 'euro': '\u20AC', 'exist': '\u2203', 'fnof': '\u0192', 'forall': '\u2200', 'frac12': '\u00BD', 'frac14': '\u00BC', 'frac34': '\u00BE', 'frasl': '\u2044', 'Gamma': '\u0393', 'gamma': '\u03B3', 'ge': '\u2265', 'gt': '>', 'harr': '\u2194', 'hArr': '\u21D4', 'hearts': '\u2665', 'hellip': '\u2026', 'Iacute': '\u00CD', 'iacute': '\u00ED', 'Icirc': '\u00CE', 'icirc': '\u00EE', 'iexcl': '\u00A1', 'Igrave': '\u00CC', 'igrave': '\u00EC', 'image': '\u2111', 'infin': '\u221E', 'int': '\u222B', 'Iota': '\u0399', 'iota': '\u03B9', 'iquest': '\u00BF', 'isin': '\u2208', 'Iuml': '\u00CF', 'iuml': '\u00EF', 'Kappa': '\u039A', 'kappa': '\u03BA', 'Lambda': '\u039B', 'lambda': '\u03BB', 'lang': '\u27E8', 'laquo': '\u00AB', 'larr': '\u2190', 'lArr': '\u21D0', 'lceil': '\u2308', 'ldquo': '\u201C', 'le': '\u2264', 'lfloor': '\u230A', 'lowast': '\u2217', 'loz': '\u25CA', 'lrm': '\u200E', 'lsaquo': '\u2039', 'lsquo': '\u2018', 'lt': '<', 'macr': '\u00AF', 'mdash': '\u2014', 'micro': '\u00B5', 'middot': '\u00B7', 'minus': '\u2212', 'Mu': '\u039C', 'mu': '\u03BC', 'nabla': '\u2207', 'nbsp': '\u00A0', 'ndash': '\u2013', 'ne': '\u2260', 'ni': '\u220B', 'not': '\u00AC', 'notin': '\u2209', 'nsub': '\u2284', 'Ntilde': '\u00D1', 'ntilde': '\u00F1', 'Nu': '\u039D', 'nu': '\u03BD', 'Oacute': '\u00D3', 'oacute': '\u00F3', 'Ocirc': '\u00D4', 'ocirc': '\u00F4', 'OElig': '\u0152', 'oelig': '\u0153', 'Ograve': '\u00D2', 'ograve': '\u00F2', 'oline': '\u203E', 'Omega': '\u03A9', 'omega': '\u03C9', 'Omicron': '\u039F', 'omicron': '\u03BF', 'oplus': '\u2295', 'or': '\u2228', 'ordf': '\u00AA', 'ordm': '\u00BA', 'Oslash': '\u00D8', 'oslash': '\u00F8', 'Otilde': '\u00D5', 'otilde': '\u00F5', 'otimes': '\u2297', 'Ouml': '\u00D6', 'ouml': '\u00F6', 'para': '\u00B6', 'permil': '\u2030', 'perp': '\u22A5', 'Phi': '\u03A6', 'phi': '\u03C6', 'Pi': '\u03A0', 'pi': '\u03C0', 'piv': '\u03D6', 'plusmn': '\u00B1', 'pound': '\u00A3', 'prime': '\u2032', 'Prime': '\u2033', 'prod': '\u220F', 'prop': '\u221D', 'Psi': '\u03A8', 'psi': '\u03C8', 'quot': '\u0022', 'radic': '\u221A', 'rang': '\u27E9', 'raquo': '\u00BB', 'rarr': '\u2192', 'rArr': '\u21D2', 'rceil': '\u2309', 'rdquo': '\u201D', 'real': '\u211C', 'reg': '\u00AE', 'rfloor': '\u230B', 'Rho': '\u03A1', 'rho': '\u03C1', 'rlm': '\u200F', 'rsaquo': '\u203A', 'rsquo': '\u2019', 'sbquo': '\u201A', 'Scaron': '\u0160', 'scaron': '\u0161', 'sdot': '\u22C5', 'sect': '\u00A7', 'shy': '\u00AD', 'Sigma': '\u03A3', 'sigma': '\u03C3', 'sigmaf': '\u03C2', 'sim': '\u223C', 'spades': '\u2660', 'sub': '\u2282', 'sube': '\u2286', 'sum': '\u2211', 'sup': '\u2283', 'sup1': '\u00B9', 'sup2': '\u00B2', 'sup3': '\u00B3', 'supe': '\u2287', 'szlig': '\u00DF', 'Tau': '\u03A4', 'tau': '\u03C4', 'there4': '\u2234', 'Theta': '\u0398', 'theta': '\u03B8', 'thetasym': '\u03D1', 'thinsp': '\u2009', 'THORN': '\u00DE', 'thorn': '\u00FE', 'tilde': '\u02DC', 'times': '\u00D7', 'trade': '\u2122', 'Uacute': '\u00DA', 'uacute': '\u00FA', 'uarr': '\u2191', 'uArr': '\u21D1', 'Ucirc': '\u00DB', 'ucirc': '\u00FB', 'Ugrave': '\u00D9', 'ugrave': '\u00F9', 'uml': '\u00A8', 'upsih': '\u03D2', 'Upsilon': '\u03A5', 'upsilon': '\u03C5', 'Uuml': '\u00DC', 'uuml': '\u00FC', 'weierp': '\u2118', 'Xi': '\u039E', 'xi': '\u03BE', 'Yacute': '\u00DD', 'yacute': '\u00FD', 'yen': '\u00A5', 'yuml': '\u00FF', 'Yuml': '\u0178', 'Zeta': '\u0396', 'zeta': '\u03B6', 'zwj': '\u200D', 'zwnj': '\u200C', }; // The &ngsp; pseudo-entity is denoting a space. see: // https://github.com/dart-lang/angular/blob/0bb611387d29d65b5af7f9d2515ab571fd3fbee4/_tests/test/compiler/preserve_whitespace_test.dart const NGSP_UNICODE = '\uE500'; NAMED_ENTITIES['ngsp'] = NGSP_UNICODE; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ const NG_CONTENT_SELECT_ATTR = 'select'; const LINK_ELEMENT = 'link'; const LINK_STYLE_REL_ATTR = 'rel'; const LINK_STYLE_HREF_ATTR = 'href'; const LINK_STYLE_REL_VALUE = 'stylesheet'; const STYLE_ELEMENT = 'style'; const SCRIPT_ELEMENT = 'script'; const NG_NON_BINDABLE_ATTR = 'ngNonBindable'; const NG_PROJECT_AS = 'ngProjectAs'; /** * @param {?} ast * @return {?} */ function preparseElement(ast) { let /** @type {?} */ selectAttr = /** @type {?} */ ((null)); let /** @type {?} */ hrefAttr = /** @type {?} */ ((null)); let /** @type {?} */ relAttr = /** @type {?} */ ((null)); let /** @type {?} */ nonBindable = false; let /** @type {?} */ projectAs = /** @type {?} */ ((null)); ast.attrs.forEach(attr => { const /** @type {?} */ lcAttrName = attr.name.toLowerCase(); if (lcAttrName == NG_CONTENT_SELECT_ATTR) { selectAttr = attr.value; } else if (lcAttrName == LINK_STYLE_HREF_ATTR) { hrefAttr = attr.value; } else if (lcAttrName == LINK_STYLE_REL_ATTR) { relAttr = attr.value; } else if (attr.name == NG_NON_BINDABLE_ATTR) { nonBindable = true; } else if (attr.name == NG_PROJECT_AS) { if (attr.value.length > 0) { projectAs = attr.value; } } }); selectAttr = normalizeNgContentSelect(selectAttr); const /** @type {?} */ nodeName = ast.name.toLowerCase(); let /** @type {?} */ type = PreparsedElementType.OTHER; if (isNgContent(nodeName)) { type = PreparsedElementType.NG_CONTENT; } else if (nodeName == STYLE_ELEMENT) { type = PreparsedElementType.STYLE; } else if (nodeName == SCRIPT_ELEMENT) { type = PreparsedElementType.SCRIPT; } else if (nodeName == LINK_ELEMENT && relAttr == LINK_STYLE_REL_VALUE) { type = PreparsedElementType.STYLESHEET; } return new PreparsedElement(type, selectAttr, hrefAttr, nonBindable, projectAs); } /** @enum {number} */ const PreparsedElementType = { NG_CONTENT: 0, STYLE: 1, STYLESHEET: 2, SCRIPT: 3, OTHER: 4, }; PreparsedElementType[PreparsedElementType.NG_CONTENT] = "NG_CONTENT"; PreparsedElementType[PreparsedElementType.STYLE] = "STYLE"; PreparsedElementType[PreparsedElementType.STYLESHEET] = "STYLESHEET"; PreparsedElementType[PreparsedElementType.SCRIPT] = "SCRIPT"; PreparsedElementType[PreparsedElementType.OTHER] = "OTHER"; class PreparsedElement { /** * @param {?} type * @param {?} selectAttr * @param {?} hrefAttr * @param {?} nonBindable * @param {?} projectAs */ constructor(type, selectAttr, hrefAttr, nonBindable, projectAs) { this.type = type; this.selectAttr = selectAttr; this.hrefAttr = hrefAttr; this.nonBindable = nonBindable; this.projectAs = projectAs; } } /** * @param {?} selectAttr * @return {?} */ function normalizeNgContentSelect(selectAttr) { if (selectAttr === null || selectAttr.length === 0) { return '*'; } return selectAttr; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @record */ class DirectiveNormalizer { /** * @param {?} _resourceLoader * @param {?} _urlResolver * @param {?} _htmlParser * @param {?} _config */ constructor(_resourceLoader, _urlResolver, _htmlParser, _config) { this._resourceLoader = _resourceLoader; this._urlResolver = _urlResolver; this._htmlParser = _htmlParser; this._config = _config; this._resourceLoaderCache = new Map(); } /** * @return {?} */ clearCache() { this._resourceLoaderCache.clear(); } /** * @param {?} normalizedDirective * @return {?} */ clearCacheFor(normalizedDirective) { if (!normalizedDirective.isComponent) { return; } const /** @type {?} */ template = /** @type {?} */ ((normalizedDirective.template)); this._resourceLoaderCache.delete(/** @type {?} */ ((template.templateUrl))); template.externalStylesheets.forEach((stylesheet) => { this._resourceLoaderCache.delete(/** @type {?} */ ((stylesheet.moduleUrl))); }); } /** * @param {?} url * @return {?} */ _fetch(url) { let /** @type {?} */ result = this._resourceLoaderCache.get(url); if (!result) { result = this._resourceLoader.get(url); this._resourceLoaderCache.set(url, result); } return result; } /** * @param {?} prenormData * @return {?} */ normalizeTemplate(prenormData) { if (isDefined(prenormData.template)) { if (isDefined(prenormData.templateUrl)) { throw syntaxError(`'${stringify(prenormData.componentType)}' component cannot define both template and templateUrl`); } if (typeof prenormData.template !== 'string') { throw syntaxError(`The template specified for component ${stringify(prenormData.componentType)} is not a string`); } } else if (isDefined(prenormData.templateUrl)) { if (typeof prenormData.templateUrl !== 'string') { throw syntaxError(`The templateUrl specified for component ${stringify(prenormData.componentType)} is not a string`); } } else { throw syntaxError(`No template specified for component ${stringify(prenormData.componentType)}`); } if (isDefined(prenormData.preserveWhitespaces) && typeof prenormData.preserveWhitespaces !== 'boolean') { throw syntaxError(`The preserveWhitespaces option for component ${stringify(prenormData.componentType)} must be a boolean`); } return SyncAsync.then(this._preParseTemplate(prenormData), (preparsedTemplate) => this._normalizeTemplateMetadata(prenormData, preparsedTemplate)); } /** * @param {?} prenomData * @return {?} */ _preParseTemplate(prenomData) { let /** @type {?} */ template; let /** @type {?} */ templateUrl; if (prenomData.template != null) { template = prenomData.template; templateUrl = prenomData.moduleUrl; } else { templateUrl = this._urlResolver.resolve(prenomData.moduleUrl, /** @type {?} */ ((prenomData.templateUrl))); template = this._fetch(templateUrl); } return SyncAsync.then(template, (template) => this._preparseLoadedTemplate(prenomData, template, templateUrl)); } /** * @param {?} prenormData * @param {?} template * @param {?} templateAbsUrl * @return {?} */ _preparseLoadedTemplate(prenormData, template, templateAbsUrl) { const /** @type {?} */ isInline = !!prenormData.template; const /** @type {?} */ interpolationConfig = InterpolationConfig.fromArray(/** @type {?} */ ((prenormData.interpolation))); const /** @type {?} */ rootNodesAndErrors = this._htmlParser.parse(template, templateSourceUrl({ reference: prenormData.ngModuleType }, { type: { reference: prenormData.componentType } }, { isInline, templateUrl: templateAbsUrl }), true, interpolationConfig); if (rootNodesAndErrors.errors.length > 0) { const /** @type {?} */ errorString = rootNodesAndErrors.errors.join('\n'); throw syntaxError(`Template parse errors:\n${errorString}`); } const /** @type {?} */ templateMetadataStyles = this._normalizeStylesheet(new CompileStylesheetMetadata({ styles: prenormData.styles, moduleUrl: prenormData.moduleUrl })); const /** @type {?} */ visitor = new TemplatePreparseVisitor(); visitAll(visitor, rootNodesAndErrors.rootNodes); const /** @type {?} */ templateStyles = this._normalizeStylesheet(new CompileStylesheetMetadata({ styles: visitor.styles, styleUrls: visitor.styleUrls, moduleUrl: templateAbsUrl })); const /** @type {?} */ styles = templateMetadataStyles.styles.concat(templateStyles.styles); const /** @type {?} */ inlineStyleUrls = templateMetadataStyles.styleUrls.concat(templateStyles.styleUrls); const /** @type {?} */ styleUrls = this ._normalizeStylesheet(new CompileStylesheetMetadata({ styleUrls: prenormData.styleUrls, moduleUrl: prenormData.moduleUrl })) .styleUrls; return { template, templateUrl: templateAbsUrl, isInline, htmlAst: rootNodesAndErrors, styles, inlineStyleUrls, styleUrls, ngContentSelectors: visitor.ngContentSelectors, }; } /** * @param {?} prenormData * @param {?} preparsedTemplate * @return {?} */ _normalizeTemplateMetadata(prenormData, preparsedTemplate) { return SyncAsync.then(this._loadMissingExternalStylesheets(preparsedTemplate.styleUrls.concat(preparsedTemplate.inlineStyleUrls)), (externalStylesheets) => this._normalizeLoadedTemplateMetadata(prenormData, preparsedTemplate, externalStylesheets)); } /** * @param {?} prenormData * @param {?} preparsedTemplate * @param {?} stylesheets * @return {?} */ _normalizeLoadedTemplateMetadata(prenormData, preparsedTemplate, stylesheets) { // Algorithm: // - produce exactly 1 entry per original styleUrl in // CompileTemplateMetadata.externalStylesheets whith all styles inlined // - inline all styles that are referenced by the template into CompileTemplateMetadata.styles. // Reason: be able to determine how many stylesheets there are even without loading // the template nor the stylesheets, so we can create a stub for TypeScript always synchronously // (as resouce loading may be async) const /** @type {?} */ styles = [...preparsedTemplate.styles]; this._inlineStyles(preparsedTemplate.inlineStyleUrls, stylesheets, styles); const /** @type {?} */ styleUrls = preparsedTemplate.styleUrls; const /** @type {?} */ externalStylesheets = styleUrls.map(styleUrl => { const /** @type {?} */ stylesheet = /** @type {?} */ ((stylesheets.get(styleUrl))); const /** @type {?} */ styles = [...stylesheet.styles]; this._inlineStyles(stylesheet.styleUrls, stylesheets, styles); return new CompileStylesheetMetadata({ moduleUrl: styleUrl, styles: styles }); }); let /** @type {?} */ encapsulation = prenormData.encapsulation; if (encapsulation == null) { encapsulation = this._config.defaultEncapsulation; } if (encapsulation === ViewEncapsulation.Emulated && styles.length === 0 && styleUrls.length === 0) { encapsulation = ViewEncapsulation.None; } return new CompileTemplateMetadata({ encapsulation, template: preparsedTemplate.template, templateUrl: preparsedTemplate.templateUrl, htmlAst: preparsedTemplate.htmlAst, styles, styleUrls, ngContentSelectors: preparsedTemplate.ngContentSelectors, animations: prenormData.animations, interpolation: prenormData.interpolation, isInline: preparsedTemplate.isInline, externalStylesheets, preserveWhitespaces: preserveWhitespacesDefault(prenormData.preserveWhitespaces, this._config.preserveWhitespaces), }); } /** * @param {?} styleUrls * @param {?} stylesheets * @param {?} targetStyles * @return {?} */ _inlineStyles(styleUrls, stylesheets, targetStyles) { styleUrls.forEach(styleUrl => { const /** @type {?} */ stylesheet = /** @type {?} */ ((stylesheets.get(styleUrl))); stylesheet.styles.forEach(style => targetStyles.push(style)); this._inlineStyles(stylesheet.styleUrls, stylesheets, targetStyles); }); } /** * @param {?} styleUrls * @param {?=} loadedStylesheets * @return {?} */ _loadMissingExternalStylesheets(styleUrls, loadedStylesheets = new Map()) { return SyncAsync.then(SyncAsync.all(styleUrls.filter((styleUrl) => !loadedStylesheets.has(styleUrl)) .map(styleUrl => SyncAsync.then(this._fetch(styleUrl), (loadedStyle) => { const /** @type {?} */ stylesheet = this._normalizeStylesheet(new CompileStylesheetMetadata({ styles: [loadedStyle], moduleUrl: styleUrl })); loadedStylesheets.set(styleUrl, stylesheet); return this._loadMissingExternalStylesheets(stylesheet.styleUrls, loadedStylesheets); }))), (_) => loadedStylesheets); } /** * @param {?} stylesheet * @return {?} */ _normalizeStylesheet(stylesheet) { const /** @type {?} */ moduleUrl = /** @type {?} */ ((stylesheet.moduleUrl)); const /** @type {?} */ allStyleUrls = stylesheet.styleUrls.filter(isStyleUrlResolvable) .map(url => this._urlResolver.resolve(moduleUrl, url)); const /** @type {?} */ allStyles = stylesheet.styles.map(style => { const /** @type {?} */ styleWithImports = extractStyleUrls(this._urlResolver, moduleUrl, style); allStyleUrls.push(...styleWithImports.styleUrls); return styleWithImports.style; }); return new CompileStylesheetMetadata({ styles: allStyles, styleUrls: allStyleUrls, moduleUrl: moduleUrl }); } } class TemplatePreparseVisitor { constructor() { this.ngContentSelectors = []; this.styles = []; this.styleUrls = []; this.ngNonBindableStackCount = 0; } /** * @param {?} ast * @param {?} context * @return {?} */ visitElement(ast, context) { const /** @type {?} */ preparsedElement = preparseElement(ast); switch (preparsedElement.type) { case PreparsedElementType.NG_CONTENT: if (this.ngNonBindableStackCount === 0) { this.ngContentSelectors.push(preparsedElement.selectAttr); } break; case PreparsedElementType.STYLE: let /** @type {?} */ textContent = ''; ast.children.forEach(child => { if (child instanceof Text) { textContent += child.value; } }); this.styles.push(textContent); break; case PreparsedElementType.STYLESHEET: this.styleUrls.push(preparsedElement.hrefAttr); break; default: break; } if (preparsedElement.nonBindable) { this.ngNonBindableStackCount++; } visitAll(this, ast.children); if (preparsedElement.nonBindable) { this.ngNonBindableStackCount--; } return null; } /** * @param {?} ast * @param {?} context * @return {?} */ visitExpansion(ast, context) { visitAll(this, ast.cases); } /** * @param {?} ast * @param {?} context * @return {?} */ visitExpansionCase(ast, context) { visitAll(this, ast.expression); } /** * @param {?} ast * @param {?} context * @return {?} */ visitComment(ast, context) { return null; } /** * @param {?} ast * @param {?} context * @return {?} */ visitAttribute(ast, context) { return null; } /** * @param {?} ast * @param {?} context * @return {?} */ visitText(ast, context) { return null; } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ const QUERY_METADATA_IDENTIFIERS = [ createViewChild, createViewChildren, createContentChild, createContentChildren, ]; class DirectiveResolver { /** * @param {?} _reflector */ constructor(_reflector) { this._reflector = _reflector; } /** * @param {?} type * @return {?} */ isDirective(type) { const /** @type {?} */ typeMetadata = this._reflector.annotations(resolveForwardRef(type)); return typeMetadata && typeMetadata.some(isDirectiveMetadata); } /** * @param {?} type * @param {?=} throwIfNotFound * @return {?} */ resolve(type, throwIfNotFound = true) { const /** @type {?} */ typeMetadata = this._reflector.annotations(resolveForwardRef(type)); if (typeMetadata) { const /** @type {?} */ metadata = findLast(typeMetadata, isDirectiveMetadata); if (metadata) { const /** @type {?} */ propertyMetadata = this._reflector.propMetadata(type); const /** @type {?} */ guards = this._reflector.guards(type); return this._mergeWithPropertyMetadata(metadata, propertyMetadata, guards, type); } } if (throwIfNotFound) { throw new Error(`No Directive annotation found on ${stringify(type)}`); } return null; } /** * @param {?} dm * @param {?} propertyMetadata * @param {?} guards * @param {?} directiveType * @return {?} */ _mergeWithPropertyMetadata(dm, propertyMetadata, guards, directiveType) { const /** @type {?} */ inputs = []; const /** @type {?} */ outputs = []; const /** @type {?} */ host = {}; const /** @type {?} */ queries = {}; Object.keys(propertyMetadata).forEach((propName) => { const /** @type {?} */ input = findLast(propertyMetadata[propName], (a) => createInput.isTypeOf(a)); if (input) { if (input.bindingPropertyName) { inputs.push(`${propName}: ${input.bindingPropertyName}`); } else { inputs.push(propName); } } const /** @type {?} */ output = findLast(propertyMetadata[propName], (a) => createOutput.isTypeOf(a)); if (output) { if (output.bindingPropertyName) { outputs.push(`${propName}: ${output.bindingPropertyName}`); } else { outputs.push(propName); } } const /** @type {?} */ hostBindings = propertyMetadata[propName].filter(a => createHostBinding.isTypeOf(a)); hostBindings.forEach(hostBinding => { if (hostBinding.hostPropertyName) { const /** @type {?} */ startWith = hostBinding.hostPropertyName[0]; if (startWith === '(') { throw new Error(`@HostBinding can not bind to events. Use @HostListener instead.`); } else if (startWith === '[') { throw new Error(`@HostBinding parameter should be a property name, 'class.<name>', or 'attr.<name>'.`); } host[`[${hostBinding.hostPropertyName}]`] = propName; } else { host[`[${propName}]`] = propName; } }); const /** @type {?} */ hostListeners = propertyMetadata[propName].filter(a => createHostListener.isTypeOf(a)); hostListeners.forEach(hostListener => { const /** @type {?} */ args = hostListener.args || []; host[`(${hostListener.eventName})`] = `${propName}(${args.join(',')})`; }); const /** @type {?} */ query = findLast(propertyMetadata[propName], (a) => QUERY_METADATA_IDENTIFIERS.some(i => i.isTypeOf(a))); if (query) { queries[propName] = query; } }); return this._merge(dm, inputs, outputs, host, queries, guards, directiveType); } /** * @param {?} def * @return {?} */ _extractPublicName(def) { return splitAtColon(def, [/** @type {?} */ ((null)), def])[1].trim(); } /** * @param {?} bindings * @return {?} */ _dedupeBindings(bindings) { const /** @type {?} */ names = new Set(); const /** @type {?} */ publicNames = new Set(); const /** @type {?} */ reversedResult = []; // go last to first to allow later entries to overwrite previous entries for (let /** @type {?} */ i = bindings.length - 1; i >= 0; i--) { const /** @type {?} */ binding = bindings[i]; const /** @type {?} */ name = this._extractPublicName(binding); publicNames.add(name); if (!names.has(name)) { names.add(name); reversedResult.push(binding); } } return reversedResult.reverse(); } /** * @param {?} directive * @param {?} inputs * @param {?} outputs * @param {?} host * @param {?} queries * @param {?} guards * @param {?} directiveType * @return {?} */ _merge(directive, inputs, outputs, host, queries, guards, directiveType) { const /** @type {?} */ mergedInputs = this._dedupeBindings(directive.inputs ? directive.inputs.concat(inputs) : inputs); const /** @type {?} */ mergedOutputs = this._dedupeBindings(directive.outputs ? directive.outputs.concat(outputs) : outputs); const /** @type {?} */ mergedHost = directive.host ? Object.assign({}, directive.host, host) : host; const /** @type {?} */ mergedQueries = directive.queries ? Object.assign({}, directive.queries, queries) : queries; if (createComponent.isTypeOf(directive)) { const /** @type {?} */ comp = /** @type {?} */ (directive); return createComponent({ selector: comp.selector, inputs: mergedInputs, outputs: mergedOutputs, host: mergedHost, exportAs: comp.exportAs, moduleId: comp.moduleId, queries: mergedQueries, changeDetection: comp.changeDetection, providers: comp.providers, viewProviders: comp.viewProviders, entryComponents: comp.entryComponents, template: comp.template, templateUrl: comp.templateUrl, styles: comp.styles, styleUrls: comp.styleUrls, encapsulation: comp.encapsulation, animations: comp.animations, interpolation: comp.interpolation, preserveWhitespaces: directive.preserveWhitespaces, }); } else { return createDirective({ selector: directive.selector, inputs: mergedInputs, outputs: mergedOutputs, host: mergedHost, exportAs: directive.exportAs, queries: mergedQueries, providers: directive.providers, guards }); } } } /** * @param {?} type * @return {?} */ function isDirectiveMetadata(type) { return createDirective.isTypeOf(type) || createComponent.isTypeOf(type); } /** * @template T * @param {?} arr * @param {?} condition * @return {?} */ function findLast(arr, condition) { for (let /** @type {?} */ i = arr.length - 1; i >= 0; i--) { if (condition(arr[i])) { return arr[i]; } } return null; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ const $EOF = 0; const $TAB = 9; const $LF = 10; const $VTAB = 11; const $FF = 12; const $CR = 13; const $SPACE = 32; const $BANG = 33; const $DQ = 34; const $HASH = 35; const $$ = 36; const $PERCENT = 37; const $AMPERSAND = 38; const $SQ = 39; const $LPAREN = 40; const $RPAREN = 41; const $STAR = 42; const $PLUS = 43; const $COMMA = 44; const $MINUS = 45; const $PERIOD = 46; const $SLASH = 47; const $COLON = 58; const $SEMICOLON = 59; const $LT = 60; const $EQ = 61; const $GT = 62; const $QUESTION = 63; const $0 = 48; const $9 = 57; const $A = 65; const $E = 69; const $F = 70; const $X = 88; const $Z = 90; const $LBRACKET = 91; const $BACKSLASH = 92; const $RBRACKET = 93; const $CARET = 94; const $_ = 95; const $a = 97; const $e = 101; const $f = 102; const $n = 110; const $r = 114; const $t = 116; const $u = 117; const $v = 118; const $x = 120; const $z = 122; const $LBRACE = 123; const $BAR = 124; const $RBRACE = 125; const $NBSP = 160; const $BT = 96; /** * @param {?} code * @return {?} */ function isWhitespace(code) { return (code >= $TAB && code <= $SPACE) || (code == $NBSP); } /** * @param {?} code * @return {?} */ function isDigit(code) { return $0 <= code && code <= $9; } /** * @param {?} code * @return {?} */ function isAsciiLetter(code) { return code >= $a && code <= $z || code >= $A && code <= $Z; } /** * @param {?} code * @return {?} */ function isAsciiHexDigit(code) { return code >= $a && code <= $f || code >= $A && code <= $F || isDigit(code); } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** @enum {number} */ const TokenType = { Character: 0, Identifier: 1, Keyword: 2, String: 3, Operator: 4, Number: 5, Error: 6, }; TokenType[TokenType.Character] = "Character"; TokenType[TokenType.Identifier] = "Identifier"; TokenType[TokenType.Keyword] = "Keyword"; TokenType[TokenType.String] = "String"; TokenType[TokenType.Operator] = "Operator"; TokenType[TokenType.Number] = "Number"; TokenType[TokenType.Error] = "Error"; const KEYWORDS = ['var', 'let', 'as', 'null', 'undefined', 'true', 'false', 'if', 'else', 'this']; class Lexer { /** * @param {?} text * @return {?} */ tokenize(text) { const /** @type {?} */ scanner = new _Scanner(text); const /** @type {?} */ tokens = []; let /** @type {?} */ token = scanner.scanToken(); while (token != null) { tokens.push(token); token = scanner.scanToken(); } return tokens; } } class Token { /** * @param {?} index * @param {?} type * @param {?} numValue * @param {?} strValue */ constructor(index, type, numValue, strValue) { this.index = index; this.type = type; this.numValue = numValue; this.strValue = strValue; } /** * @param {?} code * @return {?} */ isCharacter(code) { return this.type == TokenType.Character && this.numValue == code; } /** * @return {?} */ isNumber() { return this.type == TokenType.Number; } /** * @return {?} */ isString() { return this.type == TokenType.String; } /** * @param {?} operater * @return {?} */ isOperator(operater) { return this.type == TokenType.Operator && this.strValue == operater; } /** * @return {?} */ isIdentifier() { return this.type == TokenType.Identifier; } /** * @return {?} */ isKeyword() { return this.type == TokenType.Keyword; } /** * @return {?} */ isKeywordLet() { return this.type == TokenType.Keyword && this.strValue == 'let'; } /** * @return {?} */ isKeywordAs() { return this.type == TokenType.Keyword && this.strValue == 'as'; } /** * @return {?} */ isKeywordNull() { return this.type == TokenType.Keyword && this.strValue == 'null'; } /** * @return {?} */ isKeywordUndefined() { return this.type == TokenType.Keyword && this.strValue == 'undefined'; } /** * @return {?} */ isKeywordTrue() { return this.type == TokenType.Keyword && this.strValue == 'true'; } /** * @return {?} */ isKeywordFalse() { return this.type == TokenType.Keyword && this.strValue == 'false'; } /** * @return {?} */ isKeywordThis() { return this.type == TokenType.Keyword && this.strValue == 'this'; } /** * @return {?} */ isError() { return this.type == TokenType.Error; } /** * @return {?} */ toNumber() { return this.type == TokenType.Number ? this.numValue : -1; } /** * @return {?} */ toString() { switch (this.type) { case TokenType.Character: case TokenType.Identifier: case TokenType.Keyword: case TokenType.Operator: case TokenType.String: case TokenType.Error: return this.strValue; case TokenType.Number: return this.numValue.toString(); default: return null; } } } /** * @param {?} index * @param {?} code * @return {?} */ function newCharacterToken(index, code) { return new Token(index, TokenType.Character, code, String.fromCharCode(code)); } /** * @param {?} index * @param {?} text * @return {?} */ function newIdentifierToken(index, text) { return new Token(index, TokenType.Identifier, 0, text); } /** * @param {?} index * @param {?} text * @return {?} */ function newKeywordToken(index, text) { return new Token(index, TokenType.Keyword, 0, text); } /** * @param {?} index * @param {?} text * @return {?} */ function newOperatorToken(index, text) { return new Token(index, TokenType.Operator, 0, text); } /** * @param {?} index * @param {?} text * @return {?} */ function newStringToken(index, text) { return new Token(index, TokenType.String, 0, text); } /** * @param {?} index * @param {?} n * @return {?} */ function newNumberToken(index, n) { return new Token(index, TokenType.Number, n, ''); } /** * @param {?} index * @param {?} message * @return {?} */ function newErrorToken(index, message) { return new Token(index, TokenType.Error, 0, message); } const EOF = new Token(-1, TokenType.Character, 0, ''); class _Scanner { /** * @param {?} input */ constructor(input) { this.input = input; this.peek = 0; this.index = -1; this.length = input.length; this.advance(); } /** * @return {?} */ advance() { this.peek = ++this.index >= this.length ? $EOF : this.input.charCodeAt(this.index); } /** * @return {?} */ scanToken() { const /** @type {?} */ input = this.input, /** @type {?} */ length = this.length; let /** @type {?} */ peek = this.peek, /** @type {?} */ index = this.index; // Skip whitespace. while (peek <= $SPACE) { if (++index >= length) { peek = $EOF; break; } else { peek = input.charCodeAt(index); } } this.peek = peek; this.index = index; if (index >= length) { return null; } // Handle identifiers and numbers. if (isIdentifierStart(peek)) return this.scanIdentifier(); if (isDigit(peek)) return this.scanNumber(index); const /** @type {?} */ start = index; switch (peek) { case $PERIOD: this.advance(); return isDigit(this.peek) ? this.scanNumber(start) : newCharacterToken(start, $PERIOD); case $LPAREN: case $RPAREN: case $LBRACE: case $RBRACE: case $LBRACKET: case $RBRACKET: case $COMMA: case $COLON: case $SEMICOLON: return this.scanCharacter(start, peek); case $SQ: case $DQ: return this.scanString(); case $HASH: case $PLUS: case $MINUS: case $STAR: case $SLASH: case $PERCENT: case $CARET: return this.scanOperator(start, String.fromCharCode(peek)); case $QUESTION: return this.scanComplexOperator(start, '?', $PERIOD, '.'); case $LT: case $GT: return this.scanComplexOperator(start, String.fromCharCode(peek), $EQ, '='); case $BANG: case $EQ: return this.scanComplexOperator(start, String.fromCharCode(peek), $EQ, '=', $EQ, '='); case $AMPERSAND: return this.scanComplexOperator(start, '&', $AMPERSAND, '&'); case $BAR: return this.scanComplexOperator(start, '|', $BAR, '|'); case $NBSP: while (isWhitespace(this.peek)) this.advance(); return this.scanToken(); } this.advance(); return this.error(`Unexpected character [${String.fromCharCode(peek)}]`, 0); } /** * @param {?} start * @param {?} code * @return {?} */ scanCharacter(start, code) { this.advance(); return newCharacterToken(start, code); } /** * @param {?} start * @param {?} str * @return {?} */ scanOperator(start, str) { this.advance(); return newOperatorToken(start, str); } /** * Tokenize a 2/3 char long operator * * @param {?} start start index in the expression * @param {?} one first symbol (always part of the operator) * @param {?} twoCode code point for the second symbol * @param {?} two second symbol (part of the operator when the second code point matches) * @param {?=} threeCode code point for the third symbol * @param {?=} three third symbol (part of the operator when provided and matches source expression) * @return {?} */ scanComplexOperator(start, one, twoCode, two, threeCode, three) { this.advance(); let /** @type {?} */ str = one; if (this.peek == twoCode) { this.advance(); str += two; } if (threeCode != null && this.peek == threeCode) { this.advance(); str += three; } return newOperatorToken(start, str); } /** * @return {?} */ scanIdentifier() { const /** @type {?} */ start = this.index; this.advance(); while (isIdentifierPart(this.peek)) this.advance(); const /** @type {?} */ str = this.input.substring(start, this.index); return KEYWORDS.indexOf(str) > -1 ? newKeywordToken(start, str) : newIdentifierToken(start, str); } /** * @param {?} start * @return {?} */ scanNumber(start) { let /** @type {?} */ simple = (this.index === start); this.advance(); // Skip initial digit. while (true) { if (isDigit(this.peek)) { // Do nothing. } else if (this.peek == $PERIOD) { simple = false; } else if (isExponentStart(this.peek)) { this.advance(); if (isExponentSign(this.peek)) this.advance(); if (!isDigit(this.peek)) return this.error('Invalid exponent', -1); simple = false; } else { break; } this.advance(); } const /** @type {?} */ str = this.input.substring(start, this.index); const /** @type {?} */ value = simple ? parseIntAutoRadix(str) : parseFloat(str); return newNumberToken(start, value); } /** * @return {?} */ scanString() { const /** @type {?} */ start = this.index; const /** @type {?} */ quote = this.peek; this.advance(); // Skip initial quote. let /** @type {?} */ buffer = ''; let /** @type {?} */ marker = this.index; const /** @type {?} */ input = this.input; while (this.peek != quote) { if (this.peek == $BACKSLASH) { buffer += input.substring(marker, this.index); this.advance(); let /** @type {?} */ unescapedCode; // Workaround for TS2.1-introduced type strictness this.peek = this.peek; if (this.peek == $u) { // 4 character hex code for unicode character. const /** @type {?} */ hex = input.substring(this.index + 1, this.index + 5); if (/^[0-9a-f]+$/i.test(hex)) { unescapedCode = parseInt(hex, 16); } else { return this.error(`Invalid unicode escape [\\u${hex}]`, 0); } for (let /** @type {?} */ i = 0; i < 5; i++) { this.advance(); } } else { unescapedCode = unescape(this.peek); this.advance(); } buffer += String.fromCharCode(unescapedCode); marker = this.index; } else if (this.peek == $EOF) { return this.error('Unterminated quote', 0); } else { this.advance(); } } const /** @type {?} */ last = input.substring(marker, this.index); this.advance(); // Skip terminating quote. return newStringToken(start, buffer + last); } /** * @param {?} message * @param {?} offset * @return {?} */ error(message, offset) { const /** @type {?} */ position = this.index + offset; return newErrorToken(position, `Lexer Error: ${message} at column ${position} in expression [${this.input}]`); } } /** * @param {?} code * @return {?} */ function isIdentifierStart(code) { return ($a <= code && code <= $z) || ($A <= code && code <= $Z) || (code == $_) || (code == $$); } /** * @param {?} input * @return {?} */ function isIdentifier(input) { if (input.length == 0) return false; const /** @type {?} */ scanner = new _Scanner(input); if (!isIdentifierStart(scanner.peek)) return false; scanner.advance(); while (scanner.peek !== $EOF) { if (!isIdentifierPart(scanner.peek)) return false; scanner.advance(); } return true; } /** * @param {?} code * @return {?} */ function isIdentifierPart(code) { return isAsciiLetter(code) || isDigit(code) || (code == $_) || (code == $$); } /** * @param {?} code * @return {?} */ function isExponentStart(code) { return code == $e || code == $E; } /** * @param {?} code * @return {?} */ function isExponentSign(code) { return code == $MINUS || code == $PLUS; } /** * @param {?} code * @return {?} */ function isQuote(code) { return code === $SQ || code === $DQ || code === $BT; } /** * @param {?} code * @return {?} */ function unescape(code) { switch (code) { case $n: return $LF; case $f: return $FF; case $r: return $CR; case $t: return $TAB; case $v: return $VTAB; default: return code; } } /** * @param {?} text * @return {?} */ function parseIntAutoRadix(text) { const /** @type {?} */ result = parseInt(text); if (isNaN(result)) { throw new Error('Invalid integer literal when parsing ' + text); } return result; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ class ParserError { /** * @param {?} message * @param {?} input * @param {?} errLocation * @param {?=} ctxLocation */ constructor(message, input, errLocation, ctxLocation) { this.input = input; this.errLocation = errLocation; this.ctxLocation = ctxLocation; this.message = `Parser Error: ${message} ${errLocation} [${input}] in ${ctxLocation}`; } } class ParseSpan { /** * @param {?} start * @param {?} end */ constructor(start, end) { this.start = start; this.end = end; } } class AST { /** * @param {?} span */ constructor(span) { this.span = span; } /** * @param {?} visitor * @param {?=} context * @return {?} */ visit(visitor, context = null) { return null; } /** * @return {?} */ toString() { return 'AST'; } } /** * Represents a quoted expression of the form: * * quote = prefix `:` uninterpretedExpression * prefix = identifier * uninterpretedExpression = arbitrary string * * A quoted expression is meant to be pre-processed by an AST transformer that * converts it into another AST that no longer contains quoted expressions. * It is meant to allow third-party developers to extend Angular template * expression language. The `uninterpretedExpression` part of the quote is * therefore not interpreted by the Angular's own expression parser. */ class Quote extends AST { /** * @param {?} span * @param {?} prefix * @param {?} uninterpretedExpression * @param {?} location */ constructor(span, prefix, uninterpretedExpression, location) { super(span); this.prefix = prefix; this.uninterpretedExpression = uninterpretedExpression; this.location = location; } /** * @param {?} visitor * @param {?=} context * @return {?} */ visit(visitor, context = null) { return visitor.visitQuote(this, context); } /** * @return {?} */ toString() { return 'Quote'; } } class EmptyExpr extends AST { /** * @param {?} visitor * @param {?=} context * @return {?} */ visit(visitor, context = null) { // do nothing } } class ImplicitReceiver extends AST { /** * @param {?} visitor * @param {?=} context * @return {?} */ visit(visitor, context = null) { return visitor.visitImplicitReceiver(this, context); } } /** * Multiple expressions separated by a semicolon. */ class Chain extends AST { /** * @param {?} span * @param {?} expressions */ constructor(span, expressions) { super(span); this.expressions = expressions; } /** * @param {?} visitor * @param {?=} context * @return {?} */ visit(visitor, context = null) { return visitor.visitChain(this, context); } } class Conditional extends AST { /** * @param {?} span * @param {?} condition * @param {?} trueExp * @param {?} falseExp */ constructor(span, condition, trueExp, falseExp) { super(span); this.condition = condition; this.trueExp = trueExp; this.falseExp = falseExp; } /** * @param {?} visitor * @param {?=} context * @return {?} */ visit(visitor, context = null) { return visitor.visitConditional(this, context); } } class PropertyRead extends AST { /** * @param {?} span * @param {?} receiver * @param {?} name */ constructor(span, receiver, name) { super(span); this.receiver = receiver; this.name = name; } /** * @param {?} visitor * @param {?=} context * @return {?} */ visit(visitor, context = null) { return visitor.visitPropertyRead(this, context); } } class PropertyWrite extends AST { /** * @param {?} span * @param {?} receiver * @param {?} name * @param {?} value */ constructor(span, receiver, name, value) { super(span); this.receiver = receiver; this.name = name; this.value = value; } /** * @param {?} visitor * @param {?=} context * @return {?} */ visit(visitor, context = null) { return visitor.visitPropertyWrite(this, context); } } class SafePropertyRead extends AST { /** * @param {?} span * @param {?} receiver * @param {?} name */ constructor(span, receiver, name) { super(span); this.receiver = receiver; this.name = name; } /** * @param {?} visitor * @param {?=} context * @return {?} */ visit(visitor, context = null) { return visitor.visitSafePropertyRead(this, context); } } class KeyedRead extends AST { /** * @param {?} span * @param {?} obj * @param {?} key */ constructor(span, obj, key) { super(span); this.obj = obj; this.key = key; } /** * @param {?} visitor * @param {?=} context * @return {?} */ visit(visitor, context = null) { return visitor.visitKeyedRead(this, context); } } class KeyedWrite extends AST { /** * @param {?} span * @param {?} obj * @param {?} key * @param {?} value */ constructor(span, obj, key, value) { super(span); this.obj = obj; this.key = key; this.value = value; } /** * @param {?} visitor * @param {?=} context * @return {?} */ visit(visitor, context = null) { return visitor.visitKeyedWrite(this, context); } } class BindingPipe extends AST { /** * @param {?} span * @param {?} exp * @param {?} name * @param {?} args */ constructor(span, exp, name, args) { super(span); this.exp = exp; this.name = name; this.args = args; } /** * @param {?} visitor * @param {?=} context * @return {?} */ visit(visitor, context = null) { return visitor.visitPipe(this, context); } } class LiteralPrimitive extends AST { /** * @param {?} span * @param {?} value */ constructor(span, value) { super(span); this.value = value; } /** * @param {?} visitor * @param {?=} context * @return {?} */ visit(visitor, context = null) { return visitor.visitLiteralPrimitive(this, context); } } class LiteralArray extends AST { /** * @param {?} span * @param {?} expressions */ constructor(span, expressions) { super(span); this.expressions = expressions; } /** * @param {?} visitor * @param {?=} context * @return {?} */ visit(visitor, context = null) { return visitor.visitLiteralArray(this, context); } } class LiteralMap extends AST { /** * @param {?} span * @param {?} keys * @param {?} values */ constructor(span, keys, values) { super(span); this.keys = keys; this.values = values; } /** * @param {?} visitor * @param {?=} context * @return {?} */ visit(visitor, context = null) { return visitor.visitLiteralMap(this, context); } } class Interpolation extends AST { /** * @param {?} span * @param {?} strings * @param {?} expressions */ constructor(span, strings, expressions) { super(span); this.strings = strings; this.expressions = expressions; } /** * @param {?} visitor * @param {?=} context * @return {?} */ visit(visitor, context = null) { return visitor.visitInterpolation(this, context); } } class Binary extends AST { /** * @param {?} span * @param {?} operation * @param {?} left * @param {?} right */ constructor(span, operation, left, right) { super(span); this.operation = operation; this.left = left; this.right = right; } /** * @param {?} visitor * @param {?=} context * @return {?} */ visit(visitor, context = null) { return visitor.visitBinary(this, context); } } class PrefixNot extends AST { /** * @param {?} span * @param {?} expression */ constructor(span, expression) { super(span); this.expression = expression; } /** * @param {?} visitor * @param {?=} context * @return {?} */ visit(visitor, context = null) { return visitor.visitPrefixNot(this, context); } } class NonNullAssert extends AST { /** * @param {?} span * @param {?} expression */ constructor(span, expression) { super(span); this.expression = expression; } /** * @param {?} visitor * @param {?=} context * @return {?} */ visit(visitor, context = null) { return visitor.visitNonNullAssert(this, context); } } class MethodCall extends AST { /** * @param {?} span * @param {?} receiver * @param {?} name * @param {?} args */ constructor(span, receiver, name, args) { super(span); this.receiver = receiver; this.name = name; this.args = args; } /** * @param {?} visitor * @param {?=} context * @return {?} */ visit(visitor, context = null) { return visitor.visitMethodCall(this, context); } } class SafeMethodCall extends AST { /** * @param {?} span * @param {?} receiver * @param {?} name * @param {?} args */ constructor(span, receiver, name, args) { super(span); this.receiver = receiver; this.name = name; this.args = args; } /** * @param {?} visitor * @param {?=} context * @return {?} */ visit(visitor, context = null) { return visitor.visitSafeMethodCall(this, context); } } class FunctionCall extends AST { /** * @param {?} span * @param {?} target * @param {?} args */ constructor(span, target, args) { super(span); this.target = target; this.args = args; } /** * @param {?} visitor * @param {?=} context * @return {?} */ visit(visitor, context = null) { return visitor.visitFunctionCall(this, context); } } class ASTWithSource extends AST { /** * @param {?} ast * @param {?} source * @param {?} location * @param {?} errors */ constructor(ast, source, location, errors) { super(new ParseSpan(0, source == null ? 0 : source.length)); this.ast = ast; this.source = source; this.location = location; this.errors = errors; } /** * @param {?} visitor * @param {?=} context * @return {?} */ visit(visitor, context = null) { return this.ast.visit(visitor, context); } /** * @return {?} */ toString() { return `${this.source} in ${this.location}`; } } class TemplateBinding { /** * @param {?} span * @param {?} key * @param {?} keyIsVar * @param {?} name * @param {?} expression */ constructor(span, key, keyIsVar, name, expression) { this.span = span; this.key = key; this.keyIsVar = keyIsVar; this.name = name; this.expression = expression; } } /** * @record */ class NullAstVisitor { /** * @param {?} ast * @param {?} context * @return {?} */ visitBinary(ast, context) { } /** * @param {?} ast * @param {?} context * @return {?} */ visitChain(ast, context) { } /** * @param {?} ast * @param {?} context * @return {?} */ visitConditional(ast, context) { } /** * @param {?} ast * @param {?} context * @return {?} */ visitFunctionCall(ast, context) { } /** * @param {?} ast * @param {?} context * @return {?} */ visitImplicitReceiver(ast, context) { } /** * @param {?} ast * @param {?} context * @return {?} */ visitInterpolation(ast, context) { } /** * @param {?} ast * @param {?} context * @return {?} */ visitKeyedRead(ast, context) { } /** * @param {?} ast * @param {?} context * @return {?} */ visitKeyedWrite(ast, context) { } /** * @param {?} ast * @param {?} context * @return {?} */ visitLiteralArray(ast, context) { } /** * @param {?} ast * @param {?} context * @return {?} */ visitLiteralMap(ast, context) { } /** * @param {?} ast * @param {?} context * @return {?} */ visitLiteralPrimitive(ast, context) { } /** * @param {?} ast * @param {?} context * @return {?} */ visitMethodCall(ast, context) { } /** * @param {?} ast * @param {?} context * @return {?} */ visitPipe(ast, context) { } /** * @param {?} ast * @param {?} context * @return {?} */ visitPrefixNot(ast, context) { } /** * @param {?} ast * @param {?} context * @return {?} */ visitNonNullAssert(ast, context) { } /** * @param {?} ast * @param {?} context * @return {?} */ visitPropertyRead(ast, context) { } /** * @param {?} ast * @param {?} context * @return {?} */ visitPropertyWrite(ast, context) { } /** * @param {?} ast * @param {?} context * @return {?} */ visitQuote(ast, context) { } /** * @param {?} ast * @param {?} context * @return {?} */ visitSafeMethodCall(ast, context) { } /** * @param {?} ast * @param {?} context * @return {?} */ visitSafePropertyRead(ast, context) { } } class RecursiveAstVisitor { /** * @param {?} ast * @param {?} context * @return {?} */ visitBinary(ast, context) { ast.left.visit(this); ast.right.visit(this); return null; } /** * @param {?} ast * @param {?} context * @return {?} */ visitChain(ast, context) { return this.visitAll(ast.expressions, context); } /** * @param {?} ast * @param {?} context * @return {?} */ visitConditional(ast, context) { ast.condition.visit(this); ast.trueExp.visit(this); ast.falseExp.visit(this); return null; } /** * @param {?} ast * @param {?} context * @return {?} */ visitPipe(ast, context) { ast.exp.visit(this); this.visitAll(ast.args, context); return null; } /** * @param {?} ast * @param {?} context * @return {?} */ visitFunctionCall(ast, context) { /** @type {?} */ ((ast.target)).visit(this); this.visitAll(ast.args, context); return null; } /** * @param {?} ast * @param {?} context * @return {?} */ visitImplicitReceiver(ast, context) { return null; } /** * @param {?} ast * @param {?} context * @return {?} */ visitInterpolation(ast, context) { return this.visitAll(ast.expressions, context); } /** * @param {?} ast * @param {?} context * @return {?} */ visitKeyedRead(ast, context) { ast.obj.visit(this); ast.key.visit(this); return null; } /** * @param {?} ast * @param {?} context * @return {?} */ visitKeyedWrite(ast, context) { ast.obj.visit(this); ast.key.visit(this); ast.value.visit(this); return null; } /** * @param {?} ast * @param {?} context * @return {?} */ visitLiteralArray(ast, context) { return this.visitAll(ast.expressions, context); } /** * @param {?} ast * @param {?} context * @return {?} */ visitLiteralMap(ast, context) { return this.visitAll(ast.values, context); } /** * @param {?} ast * @param {?} context * @return {?} */ visitLiteralPrimitive(ast, context) { return null; } /** * @param {?} ast * @param {?} context * @return {?} */ visitMethodCall(ast, context) { ast.receiver.visit(this); return this.visitAll(ast.args, context); } /** * @param {?} ast * @param {?} context * @return {?} */ visitPrefixNot(ast, context) { ast.expression.visit(this); return null; } /** * @param {?} ast * @param {?} context * @return {?} */ visitNonNullAssert(ast, context) { ast.expression.visit(this); return null; } /** * @param {?} ast * @param {?} context * @return {?} */ visitPropertyRead(ast, context) { ast.receiver.visit(this); return null; } /** * @param {?} ast * @param {?} context * @return {?} */ visitPropertyWrite(ast, context) { ast.receiver.visit(this); ast.value.visit(this); return null; } /** * @param {?} ast * @param {?} context * @return {?} */ visitSafePropertyRead(ast, context) { ast.receiver.visit(this); return null; } /** * @param {?} ast * @param {?} context * @return {?} */ visitSafeMethodCall(ast, context) { ast.receiver.visit(this); return this.visitAll(ast.args, context); } /** * @param {?} asts * @param {?} context * @return {?} */ visitAll(asts, context) { asts.forEach(ast => ast.visit(this, context)); return null; } /** * @param {?} ast * @param {?} context * @return {?} */ visitQuote(ast, context) { return null; } } class AstTransformer { /** * @param {?} ast * @param {?} context * @return {?} */ visitImplicitReceiver(ast, context) { return ast; } /** * @param {?} ast * @param {?} context * @return {?} */ visitInterpolation(ast, context) { return new Interpolation(ast.span, ast.strings, this.visitAll(ast.expressions)); } /** * @param {?} ast * @param {?} context * @return {?} */ visitLiteralPrimitive(ast, context) { return new LiteralPrimitive(ast.span, ast.value); } /** * @param {?} ast * @param {?} context * @return {?} */ visitPropertyRead(ast, context) { return new PropertyRead(ast.span, ast.receiver.visit(this), ast.name); } /** * @param {?} ast * @param {?} context * @return {?} */ visitPropertyWrite(ast, context) { return new PropertyWrite(ast.span, ast.receiver.visit(this), ast.name, ast.value.visit(this)); } /** * @param {?} ast * @param {?} context * @return {?} */ visitSafePropertyRead(ast, context) { return new SafePropertyRead(ast.span, ast.receiver.visit(this), ast.name); } /** * @param {?} ast * @param {?} context * @return {?} */ visitMethodCall(ast, context) { return new MethodCall(ast.span, ast.receiver.visit(this), ast.name, this.visitAll(ast.args)); } /** * @param {?} ast * @param {?} context * @return {?} */ visitSafeMethodCall(ast, context) { return new SafeMethodCall(ast.span, ast.receiver.visit(this), ast.name, this.visitAll(ast.args)); } /** * @param {?} ast * @param {?} context * @return {?} */ visitFunctionCall(ast, context) { return new FunctionCall(ast.span, /** @type {?} */ ((ast.target)).visit(this), this.visitAll(ast.args)); } /** * @param {?} ast * @param {?} context * @return {?} */ visitLiteralArray(ast, context) { return new LiteralArray(ast.span, this.visitAll(ast.expressions)); } /** * @param {?} ast * @param {?} context * @return {?} */ visitLiteralMap(ast, context) { return new LiteralMap(ast.span, ast.keys, this.visitAll(ast.values)); } /** * @param {?} ast * @param {?} context * @return {?} */ visitBinary(ast, context) { return new Binary(ast.span, ast.operation, ast.left.visit(this), ast.right.visit(this)); } /** * @param {?} ast * @param {?} context * @return {?} */ visitPrefixNot(ast, context) { return new PrefixNot(ast.span, ast.expression.visit(this)); } /** * @param {?} ast * @param {?} context * @return {?} */ visitNonNullAssert(ast, context) { return new NonNullAssert(ast.span, ast.expression.visit(this)); } /** * @param {?} ast * @param {?} context * @return {?} */ visitConditional(ast, context) { return new Conditional(ast.span, ast.condition.visit(this), ast.trueExp.visit(this), ast.falseExp.visit(this)); } /** * @param {?} ast * @param {?} context * @return {?} */ visitPipe(ast, context) { return new BindingPipe(ast.span, ast.exp.visit(this), ast.name, this.visitAll(ast.args)); } /** * @param {?} ast * @param {?} context * @return {?} */ visitKeyedRead(ast, context) { return new KeyedRead(ast.span, ast.obj.visit(this), ast.key.visit(this)); } /** * @param {?} ast * @param {?} context * @return {?} */ visitKeyedWrite(ast, context) { return new KeyedWrite(ast.span, ast.obj.visit(this), ast.key.visit(this), ast.value.visit(this)); } /** * @param {?} asts * @return {?} */ visitAll(asts) { const /** @type {?} */ res = new Array(asts.length); for (let /** @type {?} */ i = 0; i < asts.length; ++i) { res[i] = asts[i].visit(this); } return res; } /** * @param {?} ast * @param {?} context * @return {?} */ visitChain(ast, context) { return new Chain(ast.span, this.visitAll(ast.expressions)); } /** * @param {?} ast * @param {?} context * @return {?} */ visitQuote(ast, context) { return new Quote(ast.span, ast.prefix, ast.uninterpretedExpression, ast.location); } } /** * @param {?} ast * @param {?} visitor * @param {?=} context * @return {?} */ function visitAstChildren(ast, visitor, context) { /** * @param {?} ast * @return {?} */ function visit(ast) { visitor.visit && visitor.visit(ast, context) || ast.visit(visitor, context); } /** * @template T * @param {?} asts * @return {?} */ function visitAll(asts) { asts.forEach(visit); } ast.visit({ /** * @param {?} ast * @return {?} */ visitBinary(ast) { visit(ast.left); visit(ast.right); }, /** * @param {?} ast * @return {?} */ visitChain(ast) { visitAll(ast.expressions); }, /** * @param {?} ast * @return {?} */ visitConditional(ast) { visit(ast.condition); visit(ast.trueExp); visit(ast.falseExp); }, /** * @param {?} ast * @return {?} */ visitFunctionCall(ast) { if (ast.target) { visit(ast.target); } visitAll(ast.args); }, /** * @param {?} ast * @return {?} */ visitImplicitReceiver(ast) { }, /** * @param {?} ast * @return {?} */ visitInterpolation(ast) { visitAll(ast.expressions); }, /** * @param {?} ast * @return {?} */ visitKeyedRead(ast) { visit(ast.obj); visit(ast.key); }, /** * @param {?} ast * @return {?} */ visitKeyedWrite(ast) { visit(ast.obj); visit(ast.key); visit(ast.obj); }, /** * @param {?} ast * @return {?} */ visitLiteralArray(ast) { visitAll(ast.expressions); }, /** * @param {?} ast * @return {?} */ visitLiteralMap(ast) { }, /** * @param {?} ast * @return {?} */ visitLiteralPrimitive(ast) { }, /** * @param {?} ast * @return {?} */ visitMethodCall(ast) { visit(ast.receiver); visitAll(ast.args); }, /** * @param {?} ast * @return {?} */ visitPipe(ast) { visit(ast.exp); visitAll(ast.args); }, /** * @param {?} ast * @return {?} */ visitPrefixNot(ast) { visit(ast.expression); }, /** * @param {?} ast * @return {?} */ visitNonNullAssert(ast) { visit(ast.expression); }, /** * @param {?} ast * @return {?} */ visitPropertyRead(ast) { visit(ast.receiver); }, /** * @param {?} ast * @return {?} */ visitPropertyWrite(ast) { visit(ast.receiver); visit(ast.value); }, /** * @param {?} ast * @return {?} */ visitQuote(ast) { }, /** * @param {?} ast * @return {?} */ visitSafeMethodCall(ast) { visit(ast.receiver); visitAll(ast.args); }, /** * @param {?} ast * @return {?} */ visitSafePropertyRead(ast) { visit(ast.receiver); }, }); } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ class SplitInterpolation { /** * @param {?} strings * @param {?} expressions * @param {?} offsets */ constructor(strings, expressions, offsets) { this.strings = strings; this.expressions = expressions; this.offsets = offsets; } } class TemplateBindingParseResult { /** * @param {?} templateBindings * @param {?} warnings * @param {?} errors */ constructor(templateBindings, warnings, errors) { this.templateBindings = templateBindings; this.warnings = warnings; this.errors = errors; } } /** * @param {?} config * @return {?} */ function _createInterpolateRegExp(config) { const /** @type {?} */ pattern = escapeRegExp(config.start) + '([\\s\\S]*?)' + escapeRegExp(config.end); return new RegExp(pattern, 'g'); } class Parser { /** * @param {?} _lexer */ constructor(_lexer) { this._lexer = _lexer; this.errors = []; } /** * @param {?} input * @param {?} location * @param {?=} interpolationConfig * @return {?} */ parseAction(input, location, interpolationConfig = DEFAULT_INTERPOLATION_CONFIG) { this._checkNoInterpolation(input, location, interpolationConfig); const /** @type {?} */ sourceToLex = this._stripComments(input); const /** @type {?} */ tokens = this._lexer.tokenize(this._stripComments(input)); const /** @type {?} */ ast = new _ParseAST(input, location, tokens, sourceToLex.length, true, this.errors, input.length - sourceToLex.length) .parseChain(); return new ASTWithSource(ast, input, location, this.errors); } /** * @param {?} input * @param {?} location * @param {?=} interpolationConfig * @return {?} */ parseBinding(input, location, interpolationConfig = DEFAULT_INTERPOLATION_CONFIG) { const /** @type {?} */ ast = this._parseBindingAst(input, location, interpolationConfig); return new ASTWithSource(ast, input, location, this.errors); } /** * @param {?} input * @param {?} location * @param {?=} interpolationConfig * @return {?} */ parseSimpleBinding(input, location, interpolationConfig = DEFAULT_INTERPOLATION_CONFIG) { const /** @type {?} */ ast = this._parseBindingAst(input, location, interpolationConfig); const /** @type {?} */ errors = SimpleExpressionChecker.check(ast); if (errors.length > 0) { this._reportError(`Host binding expression cannot contain ${errors.join(' ')}`, input, location); } return new ASTWithSource(ast, input, location, this.errors); } /** * @param {?} message * @param {?} input * @param {?} errLocation * @param {?=} ctxLocation * @return {?} */ _reportError(message, input, errLocation, ctxLocation) { this.errors.push(new ParserError(message, input, errLocation, ctxLocation)); } /** * @param {?} input * @param {?} location * @param {?} interpolationConfig * @return {?} */ _parseBindingAst(input, location, interpolationConfig) { // Quotes expressions use 3rd-party expression language. We don't want to use // our lexer or parser for that, so we check for that ahead of time. const /** @type {?} */ quote = this._parseQuote(input, location); if (quote != null) { return quote; } this._checkNoInterpolation(input, location, interpolationConfig); const /** @type {?} */ sourceToLex = this._stripComments(input); const /** @type {?} */ tokens = this._lexer.tokenize(sourceToLex); return new _ParseAST(input, location, tokens, sourceToLex.length, false, this.errors, input.length - sourceToLex.length) .parseChain(); } /** * @param {?} input * @param {?} location * @return {?} */ _parseQuote(input, location) { if (input == null) return null; const /** @type {?} */ prefixSeparatorIndex = input.indexOf(':'); if (prefixSeparatorIndex == -1) return null; const /** @type {?} */ prefix = input.substring(0, prefixSeparatorIndex).trim(); if (!isIdentifier(prefix)) return null; const /** @type {?} */ uninterpretedExpression = input.substring(prefixSeparatorIndex + 1); return new Quote(new ParseSpan(0, input.length), prefix, uninterpretedExpression, location); } /** * @param {?} prefixToken * @param {?} input * @param {?} location * @return {?} */ parseTemplateBindings(prefixToken, input, location) { const /** @type {?} */ tokens = this._lexer.tokenize(input); if (prefixToken) { // Prefix the tokens with the tokens from prefixToken but have them take no space (0 index). const /** @type {?} */ prefixTokens = this._lexer.tokenize(prefixToken).map(t => { t.index = 0; return t; }); tokens.unshift(...prefixTokens); } return new _ParseAST(input, location, tokens, input.length, false, this.errors, 0) .parseTemplateBindings(); } /** * @param {?} input * @param {?} location * @param {?=} interpolationConfig * @return {?} */ parseInterpolation(input, location, interpolationConfig = DEFAULT_INTERPOLATION_CONFIG) { const /** @type {?} */ split = this.splitInterpolation(input, location, interpolationConfig); if (split == null) return null; const /** @type {?} */ expressions = []; for (let /** @type {?} */ i = 0; i < split.expressions.length; ++i) { const /** @type {?} */ expressionText = split.expressions[i]; const /** @type {?} */ sourceToLex = this._stripComments(expressionText); const /** @type {?} */ tokens = this._lexer.tokenize(sourceToLex); const /** @type {?} */ ast = new _ParseAST(input, location, tokens, sourceToLex.length, false, this.errors, split.offsets[i] + (expressionText.length - sourceToLex.length)) .parseChain(); expressions.push(ast); } return new ASTWithSource(new Interpolation(new ParseSpan(0, input == null ? 0 : input.length), split.strings, expressions), input, location, this.errors); } /** * @param {?} input * @param {?} location * @param {?=} interpolationConfig * @return {?} */ splitInterpolation(input, location, interpolationConfig = DEFAULT_INTERPOLATION_CONFIG) { const /** @type {?} */ regexp = _createInterpolateRegExp(interpolationConfig); const /** @type {?} */ parts = input.split(regexp); if (parts.length <= 1) { return null; } const /** @type {?} */ strings = []; const /** @type {?} */ expressions = []; const /** @type {?} */ offsets = []; let /** @type {?} */ offset = 0; for (let /** @type {?} */ i = 0; i < parts.length; i++) { const /** @type {?} */ part = parts[i]; if (i % 2 === 0) { // fixed string strings.push(part); offset += part.length; } else if (part.trim().length > 0) { offset += interpolationConfig.start.length; expressions.push(part); offsets.push(offset); offset += part.length + interpolationConfig.end.length; } else { this._reportError('Blank expressions are not allowed in interpolated strings', input, `at column ${this._findInterpolationErrorColumn(parts, i, interpolationConfig)} in`, location); expressions.push('$implict'); offsets.push(offset); } } return new SplitInterpolation(strings, expressions, offsets); } /** * @param {?} input * @param {?} location * @return {?} */ wrapLiteralPrimitive(input, location) { return new ASTWithSource(new LiteralPrimitive(new ParseSpan(0, input == null ? 0 : input.length), input), input, location, this.errors); } /** * @param {?} input * @return {?} */ _stripComments(input) { const /** @type {?} */ i = this._commentStart(input); return i != null ? input.substring(0, i).trim() : input; } /** * @param {?} input * @return {?} */ _commentStart(input) { let /** @type {?} */ outerQuote = null; for (let /** @type {?} */ i = 0; i < input.length - 1; i++) { const /** @type {?} */ char = input.charCodeAt(i); const /** @type {?} */ nextChar = input.charCodeAt(i + 1); if (char === $SLASH && nextChar == $SLASH && outerQuote == null) return i; if (outerQuote === char) { outerQuote = null; } else if (outerQuote == null && isQuote(char)) { outerQuote = char; } } return null; } /** * @param {?} input * @param {?} location * @param {?} interpolationConfig * @return {?} */ _checkNoInterpolation(input, location, interpolationConfig) { const /** @type {?} */ regexp = _createInterpolateRegExp(interpolationConfig); const /** @type {?} */ parts = input.split(regexp); if (parts.length > 1) { this._reportError(`Got interpolation (${interpolationConfig.start}${interpolationConfig.end}) where expression was expected`, input, `at column ${this._findInterpolationErrorColumn(parts, 1, interpolationConfig)} in`, location); } } /** * @param {?} parts * @param {?} partInErrIdx * @param {?} interpolationConfig * @return {?} */ _findInterpolationErrorColumn(parts, partInErrIdx, interpolationConfig) { let /** @type {?} */ errLocation = ''; for (let /** @type {?} */ j = 0; j < partInErrIdx; j++) { errLocation += j % 2 === 0 ? parts[j] : `${interpolationConfig.start}${parts[j]}${interpolationConfig.end}`; } return errLocation.length; } } class _ParseAST { /** * @param {?} input * @param {?} location * @param {?} tokens * @param {?} inputLength * @param {?} parseAction * @param {?} errors * @param {?} offset */ constructor(input, location, tokens, inputLength, parseAction, errors, offset) { this.input = input; this.location = location; this.tokens = tokens; this.inputLength = inputLength; this.parseAction = parseAction; this.errors = errors; this.offset = offset; this.rparensExpected = 0; this.rbracketsExpected = 0; this.rbracesExpected = 0; this.index = 0; } /** * @param {?} offset * @return {?} */ peek(offset) { const /** @type {?} */ i = this.index + offset; return i < this.tokens.length ? this.tokens[i] : EOF; } /** * @return {?} */ get next() { return this.peek(0); } /** * @return {?} */ get inputIndex() { return (this.index < this.tokens.length) ? this.next.index + this.offset : this.inputLength + this.offset; } /** * @param {?} start * @return {?} */ span(start) { return new ParseSpan(start, this.inputIndex); } /** * @return {?} */ advance() { this.index++; } /** * @param {?} code * @return {?} */ optionalCharacter(code) { if (this.next.isCharacter(code)) { this.advance(); return true; } else { return false; } } /** * @return {?} */ peekKeywordLet() { return this.next.isKeywordLet(); } /** * @return {?} */ peekKeywordAs() { return this.next.isKeywordAs(); } /** * @param {?} code * @return {?} */ expectCharacter(code) { if (this.optionalCharacter(code)) return; this.error(`Missing expected ${String.fromCharCode(code)}`); } /** * @param {?} op * @return {?} */ optionalOperator(op) { if (this.next.isOperator(op)) { this.advance(); return true; } else { return false; } } /** * @param {?} operator * @return {?} */ expectOperator(operator) { if (this.optionalOperator(operator)) return; this.error(`Missing expected operator ${operator}`); } /** * @return {?} */ expectIdentifierOrKeyword() { const /** @type {?} */ n = this.next; if (!n.isIdentifier() && !n.isKeyword()) { this.error(`Unexpected token ${n}, expected identifier or keyword`); return ''; } this.advance(); return /** @type {?} */ (n.toString()); } /** * @return {?} */ expectIdentifierOrKeywordOrString() { const /** @type {?} */ n = this.next; if (!n.isIdentifier() && !n.isKeyword() && !n.isString()) { this.error(`Unexpected token ${n}, expected identifier, keyword, or string`); return ''; } this.advance(); return /** @type {?} */ (n.toString()); } /** * @return {?} */ parseChain() { const /** @type {?} */ exprs = []; const /** @type {?} */ start = this.inputIndex; while (this.index < this.tokens.length) { const /** @type {?} */ expr = this.parsePipe(); exprs.push(expr); if (this.optionalCharacter($SEMICOLON)) { if (!this.parseAction) { this.error('Binding expression cannot contain chained expression'); } while (this.optionalCharacter($SEMICOLON)) { } // read all semicolons } else if (this.index < this.tokens.length) { this.error(`Unexpected token '${this.next}'`); } } if (exprs.length == 0) return new EmptyExpr(this.span(start)); if (exprs.length == 1) return exprs[0]; return new Chain(this.span(start), exprs); } /** * @return {?} */ parsePipe() { let /** @type {?} */ result = this.parseExpression(); if (this.optionalOperator('|')) { if (this.parseAction) { this.error('Cannot have a pipe in an action expression'); } do { const /** @type {?} */ name = this.expectIdentifierOrKeyword(); const /** @type {?} */ args = []; while (this.optionalCharacter($COLON)) { args.push(this.parseExpression()); } result = new BindingPipe(this.span(result.span.start), result, name, args); } while (this.optionalOperator('|')); } return result; } /** * @return {?} */ parseExpression() { return this.parseConditional(); } /** * @return {?} */ parseConditional() { const /** @type {?} */ start = this.inputIndex; const /** @type {?} */ result = this.parseLogicalOr(); if (this.optionalOperator('?')) { const /** @type {?} */ yes = this.parsePipe(); let /** @type {?} */ no; if (!this.optionalCharacter($COLON)) { const /** @type {?} */ end = this.inputIndex; const /** @type {?} */ expression = this.input.substring(start, end); this.error(`Conditional expression ${expression} requires all 3 expressions`); no = new EmptyExpr(this.span(start)); } else { no = this.parsePipe(); } return new Conditional(this.span(start), result, yes, no); } else { return result; } } /** * @return {?} */ parseLogicalOr() { // '||' let /** @type {?} */ result = this.parseLogicalAnd(); while (this.optionalOperator('||')) { const /** @type {?} */ right = this.parseLogicalAnd(); result = new Binary(this.span(result.span.start), '||', result, right); } return result; } /** * @return {?} */ parseLogicalAnd() { // '&&' let /** @type {?} */ result = this.parseEquality(); while (this.optionalOperator('&&')) { const /** @type {?} */ right = this.parseEquality(); result = new Binary(this.span(result.span.start), '&&', result, right); } return result; } /** * @return {?} */ parseEquality() { // '==','!=','===','!==' let /** @type {?} */ result = this.parseRelational(); while (this.next.type == TokenType.Operator) { const /** @type {?} */ operator = this.next.strValue; switch (operator) { case '==': case '===': case '!=': case '!==': this.advance(); const /** @type {?} */ right = this.parseRelational(); result = new Binary(this.span(result.span.start), operator, result, right); continue; } break; } return result; } /** * @return {?} */ parseRelational() { // '<', '>', '<=', '>=' let /** @type {?} */ result = this.parseAdditive(); while (this.next.type == TokenType.Operator) { const /** @type {?} */ operator = this.next.strValue; switch (operator) { case '<': case '>': case '<=': case '>=': this.advance(); const /** @type {?} */ right = this.parseAdditive(); result = new Binary(this.span(result.span.start), operator, result, right); continue; } break; } return result; } /** * @return {?} */ parseAdditive() { // '+', '-' let /** @type {?} */ result = this.parseMultiplicative(); while (this.next.type == TokenType.Operator) { const /** @type {?} */ operator = this.next.strValue; switch (operator) { case '+': case '-': this.advance(); let /** @type {?} */ right = this.parseMultiplicative(); result = new Binary(this.span(result.span.start), operator, result, right); continue; } break; } return result; } /** * @return {?} */ parseMultiplicative() { // '*', '%', '/' let /** @type {?} */ result = this.parsePrefix(); while (this.next.type == TokenType.Operator) { const /** @type {?} */ operator = this.next.strValue; switch (operator) { case '*': case '%': case '/': this.advance(); let /** @type {?} */ right = this.parsePrefix(); result = new Binary(this.span(result.span.start), operator, result, right); continue; } break; } return result; } /** * @return {?} */ parsePrefix() { if (this.next.type == TokenType.Operator) { const /** @type {?} */ start = this.inputIndex; const /** @type {?} */ operator = this.next.strValue; let /** @type {?} */ result; switch (operator) { case '+': this.advance(); result = this.parsePrefix(); return new Binary(this.span(start), '-', result, new LiteralPrimitive(new ParseSpan(start, start), 0)); case '-': this.advance(); result = this.parsePrefix(); return new Binary(this.span(start), operator, new LiteralPrimitive(new ParseSpan(start, start), 0), result); case '!': this.advance(); result = this.parsePrefix(); return new PrefixNot(this.span(start), result); } } return this.parseCallChain(); } /** * @return {?} */ parseCallChain() { let /** @type {?} */ result = this.parsePrimary(); while (true) { if (this.optionalCharacter($PERIOD)) { result = this.parseAccessMemberOrMethodCall(result, false); } else if (this.optionalOperator('?.')) { result = this.parseAccessMemberOrMethodCall(result, true); } else if (this.optionalCharacter($LBRACKET)) { this.rbracketsExpected++; const /** @type {?} */ key = this.parsePipe(); this.rbracketsExpected--; this.expectCharacter($RBRACKET); if (this.optionalOperator('=')) { const /** @type {?} */ value = this.parseConditional(); result = new KeyedWrite(this.span(result.span.start), result, key, value); } else { result = new KeyedRead(this.span(result.span.start), result, key); } } else if (this.optionalCharacter($LPAREN)) { this.rparensExpected++; const /** @type {?} */ args = this.parseCallArguments(); this.rparensExpected--; this.expectCharacter($RPAREN); result = new FunctionCall(this.span(result.span.start), result, args); } else if (this.optionalOperator('!')) { result = new NonNullAssert(this.span(result.span.start), result); } else { return result; } } } /** * @return {?} */ parsePrimary() { const /** @type {?} */ start = this.inputIndex; if (this.optionalCharacter($LPAREN)) { this.rparensExpected++; const /** @type {?} */ result = this.parsePipe(); this.rparensExpected--; this.expectCharacter($RPAREN); return result; } else if (this.next.isKeywordNull()) { this.advance(); return new LiteralPrimitive(this.span(start), null); } else if (this.next.isKeywordUndefined()) { this.advance(); return new LiteralPrimitive(this.span(start), void 0); } else if (this.next.isKeywordTrue()) { this.advance(); return new LiteralPrimitive(this.span(start), true); } else if (this.next.isKeywordFalse()) { this.advance(); return new LiteralPrimitive(this.span(start), false); } else if (this.next.isKeywordThis()) { this.advance(); return new ImplicitReceiver(this.span(start)); } else if (this.optionalCharacter($LBRACKET)) { this.rbracketsExpected++; const /** @type {?} */ elements = this.parseExpressionList($RBRACKET); this.rbracketsExpected--; this.expectCharacter($RBRACKET); return new LiteralArray(this.span(start), elements); } else if (this.next.isCharacter($LBRACE)) { return this.parseLiteralMap(); } else if (this.next.isIdentifier()) { return this.parseAccessMemberOrMethodCall(new ImplicitReceiver(this.span(start)), false); } else if (this.next.isNumber()) { const /** @type {?} */ value = this.next.toNumber(); this.advance(); return new LiteralPrimitive(this.span(start), value); } else if (this.next.isString()) { const /** @type {?} */ literalValue = this.next.toString(); this.advance(); return new LiteralPrimitive(this.span(start), literalValue); } else if (this.index >= this.tokens.length) { this.error(`Unexpected end of expression: ${this.input}`); return new EmptyExpr(this.span(start)); } else { this.error(`Unexpected token ${this.next}`); return new EmptyExpr(this.span(start)); } } /** * @param {?} terminator * @return {?} */ parseExpressionList(terminator) { const /** @type {?} */ result = []; if (!this.next.isCharacter(terminator)) { do { result.push(this.parsePipe()); } while (this.optionalCharacter($COMMA)); } return result; } /** * @return {?} */ parseLiteralMap() { const /** @type {?} */ keys = []; const /** @type {?} */ values = []; const /** @type {?} */ start = this.inputIndex; this.expectCharacter($LBRACE); if (!this.optionalCharacter($RBRACE)) { this.rbracesExpected++; do { const /** @type {?} */ quoted = this.next.isString(); const /** @type {?} */ key = this.expectIdentifierOrKeywordOrString(); keys.push({ key, quoted }); this.expectCharacter($COLON); values.push(this.parsePipe()); } while (this.optionalCharacter($COMMA)); this.rbracesExpected--; this.expectCharacter($RBRACE); } return new LiteralMap(this.span(start), keys, values); } /** * @param {?} receiver * @param {?=} isSafe * @return {?} */ parseAccessMemberOrMethodCall(receiver, isSafe = false) { const /** @type {?} */ start = receiver.span.start; const /** @type {?} */ id = this.expectIdentifierOrKeyword(); if (this.optionalCharacter($LPAREN)) { this.rparensExpected++; const /** @type {?} */ args = this.parseCallArguments(); this.expectCharacter($RPAREN); this.rparensExpected--; const /** @type {?} */ span = this.span(start); return isSafe ? new SafeMethodCall(span, receiver, id, args) : new MethodCall(span, receiver, id, args); } else { if (isSafe) { if (this.optionalOperator('=')) { this.error('The \'?.\' operator cannot be used in the assignment'); return new EmptyExpr(this.span(start)); } else { return new SafePropertyRead(this.span(start), receiver, id); } } else { if (this.optionalOperator('=')) { if (!this.parseAction) { this.error('Bindings cannot contain assignments'); return new EmptyExpr(this.span(start)); } const /** @type {?} */ value = this.parseConditional(); return new PropertyWrite(this.span(start), receiver, id, value); } else { return new PropertyRead(this.span(start), receiver, id); } } } } /** * @return {?} */ parseCallArguments() { if (this.next.isCharacter($RPAREN)) return []; const /** @type {?} */ positionals = []; do { positionals.push(this.parsePipe()); } while (this.optionalCharacter($COMMA)); return /** @type {?} */ (positionals); } /** * An identifier, a keyword, a string with an optional `-` inbetween. * @return {?} */ expectTemplateBindingKey() { let /** @type {?} */ result = ''; let /** @type {?} */ operatorFound = false; do { result += this.expectIdentifierOrKeywordOrString(); operatorFound = this.optionalOperator('-'); if (operatorFound) { result += '-'; } } while (operatorFound); return result.toString(); } /** * @return {?} */ parseTemplateBindings() { const /** @type {?} */ bindings = []; let /** @type {?} */ prefix = /** @type {?} */ ((null)); const /** @type {?} */ warnings = []; while (this.index < this.tokens.length) { const /** @type {?} */ start = this.inputIndex; let /** @type {?} */ keyIsVar = this.peekKeywordLet(); if (keyIsVar) { this.advance(); } let /** @type {?} */ rawKey = this.expectTemplateBindingKey(); let /** @type {?} */ key = rawKey; if (!keyIsVar) { if (prefix == null) { prefix = key; } else { key = prefix + key[0].toUpperCase() + key.substring(1); } } this.optionalCharacter($COLON); let /** @type {?} */ name = /** @type {?} */ ((null)); let /** @type {?} */ expression = /** @type {?} */ ((null)); if (keyIsVar) { if (this.optionalOperator('=')) { name = this.expectTemplateBindingKey(); } else { name = '\$implicit'; } } else if (this.peekKeywordAs()) { const /** @type {?} */ letStart = this.inputIndex; this.advance(); // consume `as` name = rawKey; key = this.expectTemplateBindingKey(); // read local var name keyIsVar = true; } else if (this.next !== EOF && !this.peekKeywordLet()) { const /** @type {?} */ start = this.inputIndex; const /** @type {?} */ ast = this.parsePipe(); const /** @type {?} */ source = this.input.substring(start - this.offset, this.inputIndex - this.offset); expression = new ASTWithSource(ast, source, this.location, this.errors); } bindings.push(new TemplateBinding(this.span(start), key, keyIsVar, name, expression)); if (this.peekKeywordAs() && !keyIsVar) { const /** @type {?} */ letStart = this.inputIndex; this.advance(); // consume `as` const /** @type {?} */ letName = this.expectTemplateBindingKey(); // read local var name bindings.push(new TemplateBinding(this.span(letStart), letName, true, key, /** @type {?} */ ((null)))); } if (!this.optionalCharacter($SEMICOLON)) { this.optionalCharacter($COMMA); } } return new TemplateBindingParseResult(bindings, warnings, this.errors); } /** * @param {?} message * @param {?=} index * @return {?} */ error(message, index = null) { this.errors.push(new ParserError(message, this.input, this.locationText(index), this.location)); this.skip(); } /** * @param {?=} index * @return {?} */ locationText(index = null) { if (index == null) index = this.index; return (index < this.tokens.length) ? `at column ${this.tokens[index].index + 1} in` : `at the end of the expression`; } /** * @return {?} */ skip() { let /** @type {?} */ n = this.next; while (this.index < this.tokens.length && !n.isCharacter($SEMICOLON) && (this.rparensExpected <= 0 || !n.isCharacter($RPAREN)) && (this.rbracesExpected <= 0 || !n.isCharacter($RBRACE)) && (this.rbracketsExpected <= 0 || !n.isCharacter($RBRACKET))) { if (this.next.isError()) { this.errors.push(new ParserError(/** @type {?} */ ((this.next.toString())), this.input, this.locationText(), this.location)); } this.advance(); n = this.next; } } } class SimpleExpressionChecker { constructor() { this.errors = []; } /** * @param {?} ast * @return {?} */ static check(ast) { const /** @type {?} */ s = new SimpleExpressionChecker(); ast.visit(s); return s.errors; } /** * @param {?} ast * @param {?} context * @return {?} */ visitImplicitReceiver(ast, context) { } /** * @param {?} ast * @param {?} context * @return {?} */ visitInterpolation(ast, context) { } /** * @param {?} ast * @param {?} context * @return {?} */ visitLiteralPrimitive(ast, context) { } /** * @param {?} ast * @param {?} context * @return {?} */ visitPropertyRead(ast, context) { } /** * @param {?} ast * @param {?} context * @return {?} */ visitPropertyWrite(ast, context) { } /** * @param {?} ast * @param {?} context * @return {?} */ visitSafePropertyRead(ast, context) { } /** * @param {?} ast * @param {?} context * @return {?} */ visitMethodCall(ast, context) { } /** * @param {?} ast * @param {?} context * @return {?} */ visitSafeMethodCall(ast, context) { } /** * @param {?} ast * @param {?} context * @return {?} */ visitFunctionCall(ast, context) { } /** * @param {?} ast * @param {?} context * @return {?} */ visitLiteralArray(ast, context) { this.visitAll(ast.expressions); } /** * @param {?} ast * @param {?} context * @return {?} */ visitLiteralMap(ast, context) { this.visitAll(ast.values); } /** * @param {?} ast * @param {?} context * @return {?} */ visitBinary(ast, context) { } /** * @param {?} ast * @param {?} context * @return {?} */ visitPrefixNot(ast, context) { } /** * @param {?} ast * @param {?} context * @return {?} */ visitNonNullAssert(ast, context) { } /** * @param {?} ast * @param {?} context * @return {?} */ visitConditional(ast, context) { } /** * @param {?} ast * @param {?} context * @return {?} */ visitPipe(ast, context) { this.errors.push('pipes'); } /** * @param {?} ast * @param {?} context * @return {?} */ visitKeyedRead(ast, context) { } /** * @param {?} ast * @param {?} context * @return {?} */ visitKeyedWrite(ast, context) { } /** * @param {?} asts * @return {?} */ visitAll(asts) { return asts.map(node => node.visit(this)); } /** * @param {?} ast * @param {?} context * @return {?} */ visitChain(ast, context) { } /** * @param {?} ast * @param {?} context * @return {?} */ visitQuote(ast, context) { } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ class ParseLocation { /** * @param {?} file * @param {?} offset * @param {?} line * @param {?} col */ constructor(file, offset, line, col) { this.file = file; this.offset = offset; this.line = line; this.col = col; } /** * @return {?} */ toString() { return this.offset != null ? `${this.file.url}@${this.line}:${this.col}` : this.file.url; } /** * @param {?} delta * @return {?} */ moveBy(delta) { const /** @type {?} */ source = this.file.content; const /** @type {?} */ len = source.length; let /** @type {?} */ offset = this.offset; let /** @type {?} */ line = this.line; let /** @type {?} */ col = this.col; while (offset > 0 && delta < 0) { offset--; delta++; const /** @type {?} */ ch = source.charCodeAt(offset); if (ch == $LF) { line--; const /** @type {?} */ priorLine = source.substr(0, offset - 1).lastIndexOf(String.fromCharCode($LF)); col = priorLine > 0 ? offset - priorLine : offset; } else { col--; } } while (offset < len && delta > 0) { const /** @type {?} */ ch = source.charCodeAt(offset); offset++; delta--; if (ch == $LF) { line++; col = 0; } else { col++; } } return new ParseLocation(this.file, offset, line, col); } /** * @param {?} maxChars * @param {?} maxLines * @return {?} */ getContext(maxChars, maxLines) { const /** @type {?} */ content = this.file.content; let /** @type {?} */ startOffset = this.offset; if (startOffset != null) { if (startOffset > content.length - 1) { startOffset = content.length - 1; } let /** @type {?} */ endOffset = startOffset; let /** @type {?} */ ctxChars = 0; let /** @type {?} */ ctxLines = 0; while (ctxChars < maxChars && startOffset > 0) { startOffset--; ctxChars++; if (content[startOffset] == '\n') { if (++ctxLines == maxLines) { break; } } } ctxChars = 0; ctxLines = 0; while (ctxChars < maxChars && endOffset < content.length - 1) { endOffset++; ctxChars++; if (content[endOffset] == '\n') { if (++ctxLines == maxLines) { break; } } } return { before: content.substring(startOffset, this.offset), after: content.substring(this.offset, endOffset + 1), }; } return null; } } class ParseSourceFile { /** * @param {?} content * @param {?} url */ constructor(content, url) { this.content = content; this.url = url; } } class ParseSourceSpan { /** * @param {?} start * @param {?} end * @param {?=} details */ constructor(start, end, details = null) { this.start = start; this.end = end; this.details = details; } /** * @return {?} */ toString() { return this.start.file.content.substring(this.start.offset, this.end.offset); } } /** @enum {number} */ const ParseErrorLevel = { WARNING: 0, ERROR: 1, }; ParseErrorLevel[ParseErrorLevel.WARNING] = "WARNING"; ParseErrorLevel[ParseErrorLevel.ERROR] = "ERROR"; class ParseError { /** * @param {?} span * @param {?} msg * @param {?=} level */ constructor(span, msg, level = ParseErrorLevel.ERROR) { this.span = span; this.msg = msg; this.level = level; } /** * @return {?} */ contextualMessage() { const /** @type {?} */ ctx = this.span.start.getContext(100, 3); return ctx ? `${this.msg} ("${ctx.before}[${ParseErrorLevel[this.level]} ->]${ctx.after}")` : this.msg; } /** * @return {?} */ toString() { const /** @type {?} */ details = this.span.details ? `, ${this.span.details}` : ''; return `${this.contextualMessage()}: ${this.span.start}${details}`; } } /** * @param {?} kind * @param {?} type * @return {?} */ function typeSourceSpan(kind, type) { const /** @type {?} */ moduleUrl = identifierModuleUrl(type); const /** @type {?} */ sourceFileName = moduleUrl != null ? `in ${kind} ${identifierName(type)} in ${moduleUrl}` : `in ${kind} ${identifierName(type)}`; const /** @type {?} */ sourceFile = new ParseSourceFile('', sourceFileName); return new ParseSourceSpan(new ParseLocation(sourceFile, -1, -1, -1), new ParseLocation(sourceFile, -1, -1, -1)); } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** @enum {number} */ const TokenType$1 = { TAG_OPEN_START: 0, TAG_OPEN_END: 1, TAG_OPEN_END_VOID: 2, TAG_CLOSE: 3, TEXT: 4, ESCAPABLE_RAW_TEXT: 5, RAW_TEXT: 6, COMMENT_START: 7, COMMENT_END: 8, CDATA_START: 9, CDATA_END: 10, ATTR_NAME: 11, ATTR_VALUE: 12, DOC_TYPE: 13, EXPANSION_FORM_START: 14, EXPANSION_CASE_VALUE: 15, EXPANSION_CASE_EXP_START: 16, EXPANSION_CASE_EXP_END: 17, EXPANSION_FORM_END: 18, EOF: 19, }; TokenType$1[TokenType$1.TAG_OPEN_START] = "TAG_OPEN_START"; TokenType$1[TokenType$1.TAG_OPEN_END] = "TAG_OPEN_END"; TokenType$1[TokenType$1.TAG_OPEN_END_VOID] = "TAG_OPEN_END_VOID"; TokenType$1[TokenType$1.TAG_CLOSE] = "TAG_CLOSE"; TokenType$1[TokenType$1.TEXT] = "TEXT"; TokenType$1[TokenType$1.ESCAPABLE_RAW_TEXT] = "ESCAPABLE_RAW_TEXT"; TokenType$1[TokenType$1.RAW_TEXT] = "RAW_TEXT"; TokenType$1[TokenType$1.COMMENT_START] = "COMMENT_START"; TokenType$1[TokenType$1.COMMENT_END] = "COMMENT_END"; TokenType$1[TokenType$1.CDATA_START] = "CDATA_START"; TokenType$1[TokenType$1.CDATA_END] = "CDATA_END"; TokenType$1[TokenType$1.ATTR_NAME] = "ATTR_NAME"; TokenType$1[TokenType$1.ATTR_VALUE] = "ATTR_VALUE"; TokenType$1[TokenType$1.DOC_TYPE] = "DOC_TYPE"; TokenType$1[TokenType$1.EXPANSION_FORM_START] = "EXPANSION_FORM_START"; TokenType$1[TokenType$1.EXPANSION_CASE_VALUE] = "EXPANSION_CASE_VALUE"; TokenType$1[TokenType$1.EXPANSION_CASE_EXP_START] = "EXPANSION_CASE_EXP_START"; TokenType$1[TokenType$1.EXPANSION_CASE_EXP_END] = "EXPANSION_CASE_EXP_END"; TokenType$1[TokenType$1.EXPANSION_FORM_END] = "EXPANSION_FORM_END"; TokenType$1[TokenType$1.EOF] = "EOF"; class Token$1 { /** * @param {?} type * @param {?} parts * @param {?} sourceSpan */ constructor(type, parts, sourceSpan) { this.type = type; this.parts = parts; this.sourceSpan = sourceSpan; } } class TokenError extends ParseError { /** * @param {?} errorMsg * @param {?} tokenType * @param {?} span */ constructor(errorMsg, tokenType, span) { super(span, errorMsg); this.tokenType = tokenType; } } class TokenizeResult { /** * @param {?} tokens * @param {?} errors */ constructor(tokens, errors) { this.tokens = tokens; this.errors = errors; } } /** * @param {?} source * @param {?} url * @param {?} getTagDefinition * @param {?=} tokenizeExpansionForms * @param {?=} interpolationConfig * @return {?} */ function tokenize(source, url, getTagDefinition, tokenizeExpansionForms = false, interpolationConfig = DEFAULT_INTERPOLATION_CONFIG) { return new _Tokenizer(new ParseSourceFile(source, url), getTagDefinition, tokenizeExpansionForms, interpolationConfig) .tokenize(); } const _CR_OR_CRLF_REGEXP = /\r\n?/g; /** * @param {?} charCode * @return {?} */ function _unexpectedCharacterErrorMsg(charCode) { const /** @type {?} */ char = charCode === $EOF ? 'EOF' : String.fromCharCode(charCode); return `Unexpected character "${char}"`; } /** * @param {?} entitySrc * @return {?} */ function _unknownEntityErrorMsg(entitySrc) { return `Unknown entity "${entitySrc}" - use the "&#<decimal>;" or "&#x<hex>;" syntax`; } class _ControlFlowError { /** * @param {?} error */ constructor(error) { this.error = error; } } class _Tokenizer { /** * @param {?} _file The html source * @param {?} _getTagDefinition * @param {?} _tokenizeIcu Whether to tokenize ICU messages (considered as text nodes when false) * @param {?=} _interpolationConfig */ constructor(_file, _getTagDefinition, _tokenizeIcu, _interpolationConfig = DEFAULT_INTERPOLATION_CONFIG) { this._file = _file; this._getTagDefinition = _getTagDefinition; this._tokenizeIcu = _tokenizeIcu; this._interpolationConfig = _interpolationConfig; this._peek = -1; this._nextPeek = -1; this._index = -1; this._line = 0; this._column = -1; this._expansionCaseStack = []; this._inInterpolation = false; this.tokens = []; this.errors = []; this._input = _file.content; this._length = _file.content.length; this._advance(); } /** * @param {?} content * @return {?} */ _processCarriageReturns(content) { // http://www.w3.org/TR/html5/syntax.html#preprocessing-the-input-stream // In order to keep the original position in the source, we can not // pre-process it. // Instead CRs are processed right before instantiating the tokens. return content.replace(_CR_OR_CRLF_REGEXP, '\n'); } /** * @return {?} */ tokenize() { while (this._peek !== $EOF) { const /** @type {?} */ start = this._getLocation(); try { if (this._attemptCharCode($LT)) { if (this._attemptCharCode($BANG)) { if (this._attemptCharCode($LBRACKET)) { this._consumeCdata(start); } else if (this._attemptCharCode($MINUS)) { this._consumeComment(start); } else { this._consumeDocType(start); } } else if (this._attemptCharCode($SLASH)) { this._consumeTagClose(start); } else { this._consumeTagOpen(start); } } else if (!(this._tokenizeIcu && this._tokenizeExpansionForm())) { this._consumeText(); } } catch (/** @type {?} */ e) { if (e instanceof _ControlFlowError) { this.errors.push(e.error); } else { throw e; } } } this._beginToken(TokenType$1.EOF); this._endToken([]); return new TokenizeResult(mergeTextTokens(this.tokens), this.errors); } /** * \@internal * @return {?} whether an ICU token has been created */ _tokenizeExpansionForm() { if (isExpansionFormStart(this._input, this._index, this._interpolationConfig)) { this._consumeExpansionFormStart(); return true; } if (isExpansionCaseStart(this._peek) && this._isInExpansionForm()) { this._consumeExpansionCaseStart(); return true; } if (this._peek === $RBRACE) { if (this._isInExpansionCase()) { this._consumeExpansionCaseEnd(); return true; } if (this._isInExpansionForm()) { this._consumeExpansionFormEnd(); return true; } } return false; } /** * @return {?} */ _getLocation() { return new ParseLocation(this._file, this._index, this._line, this._column); } /** * @param {?=} start * @param {?=} end * @return {?} */ _getSpan(start = this._getLocation(), end = this._getLocation()) { return new ParseSourceSpan(start, end); } /** * @param {?} type * @param {?=} start * @return {?} */ _beginToken(type, start = this._getLocation()) { this._currentTokenStart = start; this._currentTokenType = type; } /** * @param {?} parts * @param {?=} end * @return {?} */ _endToken(parts, end = this._getLocation()) { const /** @type {?} */ token = new Token$1(this._currentTokenType, parts, new ParseSourceSpan(this._currentTokenStart, end)); this.tokens.push(token); this._currentTokenStart = /** @type {?} */ ((null)); this._currentTokenType = /** @type {?} */ ((null)); return token; } /** * @param {?} msg * @param {?} span * @return {?} */ _createError(msg, span) { if (this._isInExpansionForm()) { msg += ` (Do you have an unescaped "{" in your template? Use "{{ '{' }}") to escape it.)`; } const /** @type {?} */ error = new TokenError(msg, this._currentTokenType, span); this._currentTokenStart = /** @type {?} */ ((null)); this._currentTokenType = /** @type {?} */ ((null)); return new _ControlFlowError(error); } /** * @return {?} */ _advance() { if (this._index >= this._length) { throw this._createError(_unexpectedCharacterErrorMsg($EOF), this._getSpan()); } if (this._peek === $LF) { this._line++; this._column = 0; } else if (this._peek !== $LF && this._peek !== $CR) { this._column++; } this._index++; this._peek = this._index >= this._length ? $EOF : this._input.charCodeAt(this._index); this._nextPeek = this._index + 1 >= this._length ? $EOF : this._input.charCodeAt(this._index + 1); } /** * @param {?} charCode * @return {?} */ _attemptCharCode(charCode) { if (this._peek === charCode) { this._advance(); return true; } return false; } /** * @param {?} charCode * @return {?} */ _attemptCharCodeCaseInsensitive(charCode) { if (compareCharCodeCaseInsensitive(this._peek, charCode)) { this._advance(); return true; } return false; } /** * @param {?} charCode * @return {?} */ _requireCharCode(charCode) { const /** @type {?} */ location = this._getLocation(); if (!this._attemptCharCode(charCode)) { throw this._createError(_unexpectedCharacterErrorMsg(this._peek), this._getSpan(location, location)); } } /** * @param {?} chars * @return {?} */ _attemptStr(chars) { const /** @type {?} */ len = chars.length; if (this._index + len > this._length) { return false; } const /** @type {?} */ initialPosition = this._savePosition(); for (let /** @type {?} */ i = 0; i < len; i++) { if (!this._attemptCharCode(chars.charCodeAt(i))) { // If attempting to parse the string fails, we want to reset the parser // to where it was before the attempt this._restorePosition(initialPosition); return false; } } return true; } /** * @param {?} chars * @return {?} */ _attemptStrCaseInsensitive(chars) { for (let /** @type {?} */ i = 0; i < chars.length; i++) { if (!this._attemptCharCodeCaseInsensitive(chars.charCodeAt(i))) { return false; } } return true; } /** * @param {?} chars * @return {?} */ _requireStr(chars) { const /** @type {?} */ location = this._getLocation(); if (!this._attemptStr(chars)) { throw this._createError(_unexpectedCharacterErrorMsg(this._peek), this._getSpan(location)); } } /** * @param {?} predicate * @return {?} */ _attemptCharCodeUntilFn(predicate) { while (!predicate(this._peek)) { this._advance(); } } /** * @param {?} predicate * @param {?} len * @return {?} */ _requireCharCodeUntilFn(predicate, len) { const /** @type {?} */ start = this._getLocation(); this._attemptCharCodeUntilFn(predicate); if (this._index - start.offset < len) { throw this._createError(_unexpectedCharacterErrorMsg(this._peek), this._getSpan(start, start)); } } /** * @param {?} char * @return {?} */ _attemptUntilChar(char) { while (this._peek !== char) { this._advance(); } } /** * @param {?} decodeEntities * @return {?} */ _readChar(decodeEntities) { if (decodeEntities && this._peek === $AMPERSAND) { return this._decodeEntity(); } else { const /** @type {?} */ index = this._index; this._advance(); return this._input[index]; } } /** * @return {?} */ _decodeEntity() { const /** @type {?} */ start = this._getLocation(); this._advance(); if (this._attemptCharCode($HASH)) { const /** @type {?} */ isHex = this._attemptCharCode($x) || this._attemptCharCode($X); const /** @type {?} */ numberStart = this._getLocation().offset; this._attemptCharCodeUntilFn(isDigitEntityEnd); if (this._peek != $SEMICOLON) { throw this._createError(_unexpectedCharacterErrorMsg(this._peek), this._getSpan()); } this._advance(); const /** @type {?} */ strNum = this._input.substring(numberStart, this._index - 1); try { const /** @type {?} */ charCode = parseInt(strNum, isHex ? 16 : 10); return String.fromCharCode(charCode); } catch (/** @type {?} */ e) { const /** @type {?} */ entity = this._input.substring(start.offset + 1, this._index - 1); throw this._createError(_unknownEntityErrorMsg(entity), this._getSpan(start)); } } else { const /** @type {?} */ startPosition = this._savePosition(); this._attemptCharCodeUntilFn(isNamedEntityEnd); if (this._peek != $SEMICOLON) { this._restorePosition(startPosition); return '&'; } this._advance(); const /** @type {?} */ name = this._input.substring(start.offset + 1, this._index - 1); const /** @type {?} */ char = NAMED_ENTITIES[name]; if (!char) { throw this._createError(_unknownEntityErrorMsg(name), this._getSpan(start)); } return char; } } /** * @param {?} decodeEntities * @param {?} firstCharOfEnd * @param {?} attemptEndRest * @return {?} */ _consumeRawText(decodeEntities, firstCharOfEnd, attemptEndRest) { let /** @type {?} */ tagCloseStart; const /** @type {?} */ textStart = this._getLocation(); this._beginToken(decodeEntities ? TokenType$1.ESCAPABLE_RAW_TEXT : TokenType$1.RAW_TEXT, textStart); const /** @type {?} */ parts = []; while (true) { tagCloseStart = this._getLocation(); if (this._attemptCharCode(firstCharOfEnd) && attemptEndRest()) { break; } if (this._index > tagCloseStart.offset) { // add the characters consumed by the previous if statement to the output parts.push(this._input.substring(tagCloseStart.offset, this._index)); } while (this._peek !== firstCharOfEnd) { parts.push(this._readChar(decodeEntities)); } } return this._endToken([this._processCarriageReturns(parts.join(''))], tagCloseStart); } /** * @param {?} start * @return {?} */ _consumeComment(start) { this._beginToken(TokenType$1.COMMENT_START, start); this._requireCharCode($MINUS); this._endToken([]); const /** @type {?} */ textToken = this._consumeRawText(false, $MINUS, () => this._attemptStr('->')); this._beginToken(TokenType$1.COMMENT_END, textToken.sourceSpan.end); this._endToken([]); } /** * @param {?} start * @return {?} */ _consumeCdata(start) { this._beginToken(TokenType$1.CDATA_START, start); this._requireStr('CDATA['); this._endToken([]); const /** @type {?} */ textToken = this._consumeRawText(false, $RBRACKET, () => this._attemptStr(']>')); this._beginToken(TokenType$1.CDATA_END, textToken.sourceSpan.end); this._endToken([]); } /** * @param {?} start * @return {?} */ _consumeDocType(start) { this._beginToken(TokenType$1.DOC_TYPE, start); this._attemptUntilChar($GT); this._advance(); this._endToken([this._input.substring(start.offset + 2, this._index - 1)]); } /** * @return {?} */ _consumePrefixAndName() { const /** @type {?} */ nameOrPrefixStart = this._index; let /** @type {?} */ prefix = /** @type {?} */ ((null)); while (this._peek !== $COLON && !isPrefixEnd(this._peek)) { this._advance(); } let /** @type {?} */ nameStart; if (this._peek === $COLON) { this._advance(); prefix = this._input.substring(nameOrPrefixStart, this._index - 1); nameStart = this._index; } else { nameStart = nameOrPrefixStart; } this._requireCharCodeUntilFn(isNameEnd, this._index === nameStart ? 1 : 0); const /** @type {?} */ name = this._input.substring(nameStart, this._index); return [prefix, name]; } /** * @param {?} start * @return {?} */ _consumeTagOpen(start) { const /** @type {?} */ savedPos = this._savePosition(); let /** @type {?} */ tagName; let /** @type {?} */ lowercaseTagName; try { if (!isAsciiLetter(this._peek)) { throw this._createError(_unexpectedCharacterErrorMsg(this._peek), this._getSpan()); } const /** @type {?} */ nameStart = this._index; this._consumeTagOpenStart(start); tagName = this._input.substring(nameStart, this._index); lowercaseTagName = tagName.toLowerCase(); this._attemptCharCodeUntilFn(isNotWhitespace); while (this._peek !== $SLASH && this._peek !== $GT) { this._consumeAttributeName(); this._attemptCharCodeUntilFn(isNotWhitespace); if (this._attemptCharCode($EQ)) { this._attemptCharCodeUntilFn(isNotWhitespace); this._consumeAttributeValue(); } this._attemptCharCodeUntilFn(isNotWhitespace); } this._consumeTagOpenEnd(); } catch (/** @type {?} */ e) { if (e instanceof _ControlFlowError) { // When the start tag is invalid, assume we want a "<" this._restorePosition(savedPos); // Back to back text tokens are merged at the end this._beginToken(TokenType$1.TEXT, start); this._endToken(['<']); return; } throw e; } const /** @type {?} */ contentTokenType = this._getTagDefinition(tagName).contentType; if (contentTokenType === TagContentType.RAW_TEXT) { this._consumeRawTextWithTagClose(lowercaseTagName, false); } else if (contentTokenType === TagContentType.ESCAPABLE_RAW_TEXT) { this._consumeRawTextWithTagClose(lowercaseTagName, true); } } /** * @param {?} lowercaseTagName * @param {?} decodeEntities * @return {?} */ _consumeRawTextWithTagClose(lowercaseTagName, decodeEntities) { const /** @type {?} */ textToken = this._consumeRawText(decodeEntities, $LT, () => { if (!this._attemptCharCode($SLASH)) return false; this._attemptCharCodeUntilFn(isNotWhitespace); if (!this._attemptStrCaseInsensitive(lowercaseTagName)) return false; this._attemptCharCodeUntilFn(isNotWhitespace); return this._attemptCharCode($GT); }); this._beginToken(TokenType$1.TAG_CLOSE, textToken.sourceSpan.end); this._endToken([/** @type {?} */ ((null)), lowercaseTagName]); } /** * @param {?} start * @return {?} */ _consumeTagOpenStart(start) { this._beginToken(TokenType$1.TAG_OPEN_START, start); const /** @type {?} */ parts = this._consumePrefixAndName(); this._endToken(parts); } /** * @return {?} */ _consumeAttributeName() { this._beginToken(TokenType$1.ATTR_NAME); const /** @type {?} */ prefixAndName = this._consumePrefixAndName(); this._endToken(prefixAndName); } /** * @return {?} */ _consumeAttributeValue() { this._beginToken(TokenType$1.ATTR_VALUE); let /** @type {?} */ value; if (this._peek === $SQ || this._peek === $DQ) { const /** @type {?} */ quoteChar = this._peek; this._advance(); const /** @type {?} */ parts = []; while (this._peek !== quoteChar) { parts.push(this._readChar(true)); } value = parts.join(''); this._advance(); } else { const /** @type {?} */ valueStart = this._index; this._requireCharCodeUntilFn(isNameEnd, 1); value = this._input.substring(valueStart, this._index); } this._endToken([this._processCarriageReturns(value)]); } /** * @return {?} */ _consumeTagOpenEnd() { const /** @type {?} */ tokenType = this._attemptCharCode($SLASH) ? TokenType$1.TAG_OPEN_END_VOID : TokenType$1.TAG_OPEN_END; this._beginToken(tokenType); this._requireCharCode($GT); this._endToken([]); } /** * @param {?} start * @return {?} */ _consumeTagClose(start) { this._beginToken(TokenType$1.TAG_CLOSE, start); this._attemptCharCodeUntilFn(isNotWhitespace); const /** @type {?} */ prefixAndName = this._consumePrefixAndName(); this._attemptCharCodeUntilFn(isNotWhitespace); this._requireCharCode($GT); this._endToken(prefixAndName); } /** * @return {?} */ _consumeExpansionFormStart() { this._beginToken(TokenType$1.EXPANSION_FORM_START, this._getLocation()); this._requireCharCode($LBRACE); this._endToken([]); this._expansionCaseStack.push(TokenType$1.EXPANSION_FORM_START); this._beginToken(TokenType$1.RAW_TEXT, this._getLocation()); const /** @type {?} */ condition = this._readUntil($COMMA); this._endToken([condition], this._getLocation()); this._requireCharCode($COMMA); this._attemptCharCodeUntilFn(isNotWhitespace); this._beginToken(TokenType$1.RAW_TEXT, this._getLocation()); const /** @type {?} */ type = this._readUntil($COMMA); this._endToken([type], this._getLocation()); this._requireCharCode($COMMA); this._attemptCharCodeUntilFn(isNotWhitespace); } /** * @return {?} */ _consumeExpansionCaseStart() { this._beginToken(TokenType$1.EXPANSION_CASE_VALUE, this._getLocation()); const /** @type {?} */ value = this._readUntil($LBRACE).trim(); this._endToken([value], this._getLocation()); this._attemptCharCodeUntilFn(isNotWhitespace); this._beginToken(TokenType$1.EXPANSION_CASE_EXP_START, this._getLocation()); this._requireCharCode($LBRACE); this._endToken([], this._getLocation()); this._attemptCharCodeUntilFn(isNotWhitespace); this._expansionCaseStack.push(TokenType$1.EXPANSION_CASE_EXP_START); } /** * @return {?} */ _consumeExpansionCaseEnd() { this._beginToken(TokenType$1.EXPANSION_CASE_EXP_END, this._getLocation()); this._requireCharCode($RBRACE); this._endToken([], this._getLocation()); this._attemptCharCodeUntilFn(isNotWhitespace); this._expansionCaseStack.pop(); } /** * @return {?} */ _consumeExpansionFormEnd() { this._beginToken(TokenType$1.EXPANSION_FORM_END, this._getLocation()); this._requireCharCode($RBRACE); this._endToken([]); this._expansionCaseStack.pop(); } /** * @return {?} */ _consumeText() { const /** @type {?} */ start = this._getLocation(); this._beginToken(TokenType$1.TEXT, start); const /** @type {?} */ parts = []; do { if (this._interpolationConfig && this._attemptStr(this._interpolationConfig.start)) { parts.push(this._interpolationConfig.start); this._inInterpolation = true; } else if (this._interpolationConfig && this._inInterpolation && this._attemptStr(this._interpolationConfig.end)) { parts.push(this._interpolationConfig.end); this._inInterpolation = false; } else { parts.push(this._readChar(true)); } } while (!this._isTextEnd()); this._endToken([this._processCarriageReturns(parts.join(''))]); } /** * @return {?} */ _isTextEnd() { if (this._peek === $LT || this._peek === $EOF) { return true; } if (this._tokenizeIcu && !this._inInterpolation) { if (isExpansionFormStart(this._input, this._index, this._interpolationConfig)) { // start of an expansion form return true; } if (this._peek === $RBRACE && this._isInExpansionCase()) { // end of and expansion case return true; } } return false; } /** * @return {?} */ _savePosition() { return [this._peek, this._index, this._column, this._line, this.tokens.length]; } /** * @param {?} char * @return {?} */ _readUntil(char) { const /** @type {?} */ start = this._index; this._attemptUntilChar(char); return this._input.substring(start, this._index); } /** * @param {?} position * @return {?} */ _restorePosition(position) { this._peek = position[0]; this._index = position[1]; this._column = position[2]; this._line = position[3]; const /** @type {?} */ nbTokens = position[4]; if (nbTokens < this.tokens.length) { // remove any extra tokens this.tokens = this.tokens.slice(0, nbTokens); } } /** * @return {?} */ _isInExpansionCase() { return this._expansionCaseStack.length > 0 && this._expansionCaseStack[this._expansionCaseStack.length - 1] === TokenType$1.EXPANSION_CASE_EXP_START; } /** * @return {?} */ _isInExpansionForm() { return this._expansionCaseStack.length > 0 && this._expansionCaseStack[this._expansionCaseStack.length - 1] === TokenType$1.EXPANSION_FORM_START; } } /** * @param {?} code * @return {?} */ function isNotWhitespace(code) { return !isWhitespace(code) || code === $EOF; } /** * @param {?} code * @return {?} */ function isNameEnd(code) { return isWhitespace(code) || code === $GT || code === $SLASH || code === $SQ || code === $DQ || code === $EQ; } /** * @param {?} code * @return {?} */ function isPrefixEnd(code) { return (code < $a || $z < code) && (code < $A || $Z < code) && (code < $0 || code > $9); } /** * @param {?} code * @return {?} */ function isDigitEntityEnd(code) { return code == $SEMICOLON || code == $EOF || !isAsciiHexDigit(code); } /** * @param {?} code * @return {?} */ function isNamedEntityEnd(code) { return code == $SEMICOLON || code == $EOF || !isAsciiLetter(code); } /** * @param {?} input * @param {?} offset * @param {?} interpolationConfig * @return {?} */ function isExpansionFormStart(input, offset, interpolationConfig) { const /** @type {?} */ isInterpolationStart = interpolationConfig ? input.indexOf(interpolationConfig.start, offset) == offset : false; return input.charCodeAt(offset) == $LBRACE && !isInterpolationStart; } /** * @param {?} peek * @return {?} */ function isExpansionCaseStart(peek) { return peek === $EQ || isAsciiLetter(peek) || isDigit(peek); } /** * @param {?} code1 * @param {?} code2 * @return {?} */ function compareCharCodeCaseInsensitive(code1, code2) { return toUpperCaseCharCode(code1) == toUpperCaseCharCode(code2); } /** * @param {?} code * @return {?} */ function toUpperCaseCharCode(code) { return code >= $a && code <= $z ? code - $a + $A : code; } /** * @param {?} srcTokens * @return {?} */ function mergeTextTokens(srcTokens) { const /** @type {?} */ dstTokens = []; let /** @type {?} */ lastDstToken = undefined; for (let /** @type {?} */ i = 0; i < srcTokens.length; i++) { const /** @type {?} */ token = srcTokens[i]; if (lastDstToken && lastDstToken.type == TokenType$1.TEXT && token.type == TokenType$1.TEXT) { lastDstToken.parts[0] += token.parts[0]; lastDstToken.sourceSpan.end = token.sourceSpan.end; } else { lastDstToken = token; dstTokens.push(lastDstToken); } } return dstTokens; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ class TreeError extends ParseError { /** * @param {?} elementName * @param {?} span * @param {?} msg */ constructor(elementName, span, msg) { super(span, msg); this.elementName = elementName; } /** * @param {?} elementName * @param {?} span * @param {?} msg * @return {?} */ static create(elementName, span, msg) { return new TreeError(elementName, span, msg); } } class ParseTreeResult { /** * @param {?} rootNodes * @param {?} errors */ constructor(rootNodes, errors) { this.rootNodes = rootNodes; this.errors = errors; } } class Parser$1 { /** * @param {?} getTagDefinition */ constructor(getTagDefinition) { this.getTagDefinition = getTagDefinition; } /** * @param {?} source * @param {?} url * @param {?=} parseExpansionForms * @param {?=} interpolationConfig * @return {?} */ parse(source, url, parseExpansionForms = false, interpolationConfig = DEFAULT_INTERPOLATION_CONFIG) { const /** @type {?} */ tokensAndErrors = tokenize(source, url, this.getTagDefinition, parseExpansionForms, interpolationConfig); const /** @type {?} */ treeAndErrors = new _TreeBuilder(tokensAndErrors.tokens, this.getTagDefinition).build(); return new ParseTreeResult(treeAndErrors.rootNodes, (/** @type {?} */ (tokensAndErrors.errors)).concat(treeAndErrors.errors)); } } class _TreeBuilder { /** * @param {?} tokens * @param {?} getTagDefinition */ constructor(tokens, getTagDefinition) { this.tokens = tokens; this.getTagDefinition = getTagDefinition; this._index = -1; this._rootNodes = []; this._errors = []; this._elementStack = []; this._advance(); } /** * @return {?} */ build() { while (this._peek.type !== TokenType$1.EOF) { if (this._peek.type === TokenType$1.TAG_OPEN_START) { this._consumeStartTag(this._advance()); } else if (this._peek.type === TokenType$1.TAG_CLOSE) { this._consumeEndTag(this._advance()); } else if (this._peek.type === TokenType$1.CDATA_START) { this._closeVoidElement(); this._consumeCdata(this._advance()); } else if (this._peek.type === TokenType$1.COMMENT_START) { this._closeVoidElement(); this._consumeComment(this._advance()); } else if (this._peek.type === TokenType$1.TEXT || this._peek.type === TokenType$1.RAW_TEXT || this._peek.type === TokenType$1.ESCAPABLE_RAW_TEXT) { this._closeVoidElement(); this._consumeText(this._advance()); } else if (this._peek.type === TokenType$1.EXPANSION_FORM_START) { this._consumeExpansion(this._advance()); } else { // Skip all other tokens... this._advance(); } } return new ParseTreeResult(this._rootNodes, this._errors); } /** * @return {?} */ _advance() { const /** @type {?} */ prev = this._peek; if (this._index < this.tokens.length - 1) { // Note: there is always an EOF token at the end this._index++; } this._peek = this.tokens[this._index]; return prev; } /** * @param {?} type * @return {?} */ _advanceIf(type) { if (this._peek.type === type) { return this._advance(); } return null; } /** * @param {?} startToken * @return {?} */ _consumeCdata(startToken) { this._consumeText(this._advance()); this._advanceIf(TokenType$1.CDATA_END); } /** * @param {?} token * @return {?} */ _consumeComment(token) { const /** @type {?} */ text = this._advanceIf(TokenType$1.RAW_TEXT); this._advanceIf(TokenType$1.COMMENT_END); const /** @type {?} */ value = text != null ? text.parts[0].trim() : null; this._addToParent(new Comment(value, token.sourceSpan)); } /** * @param {?} token * @return {?} */ _consumeExpansion(token) { const /** @type {?} */ switchValue = this._advance(); const /** @type {?} */ type = this._advance(); const /** @type {?} */ cases = []; // read = while (this._peek.type === TokenType$1.EXPANSION_CASE_VALUE) { const /** @type {?} */ expCase = this._parseExpansionCase(); if (!expCase) return; // error cases.push(expCase); } // read the final } if (this._peek.type !== TokenType$1.EXPANSION_FORM_END) { this._errors.push(TreeError.create(null, this._peek.sourceSpan, `Invalid ICU message. Missing '}'.`)); return; } const /** @type {?} */ sourceSpan = new ParseSourceSpan(token.sourceSpan.start, this._peek.sourceSpan.end); this._addToParent(new Expansion(switchValue.parts[0], type.parts[0], cases, sourceSpan, switchValue.sourceSpan)); this._advance(); } /** * @return {?} */ _parseExpansionCase() { const /** @type {?} */ value = this._advance(); // read { if (this._peek.type !== TokenType$1.EXPANSION_CASE_EXP_START) { this._errors.push(TreeError.create(null, this._peek.sourceSpan, `Invalid ICU message. Missing '{'.`)); return null; } // read until } const /** @type {?} */ start = this._advance(); const /** @type {?} */ exp = this._collectExpansionExpTokens(start); if (!exp) return null; const /** @type {?} */ end = this._advance(); exp.push(new Token$1(TokenType$1.EOF, [], end.sourceSpan)); // parse everything in between { and } const /** @type {?} */ parsedExp = new _TreeBuilder(exp, this.getTagDefinition).build(); if (parsedExp.errors.length > 0) { this._errors = this._errors.concat(/** @type {?} */ (parsedExp.errors)); return null; } const /** @type {?} */ sourceSpan = new ParseSourceSpan(value.sourceSpan.start, end.sourceSpan.end); const /** @type {?} */ expSourceSpan = new ParseSourceSpan(start.sourceSpan.start, end.sourceSpan.end); return new ExpansionCase(value.parts[0], parsedExp.rootNodes, sourceSpan, value.sourceSpan, expSourceSpan); } /** * @param {?} start * @return {?} */ _collectExpansionExpTokens(start) { const /** @type {?} */ exp = []; const /** @type {?} */ expansionFormStack = [TokenType$1.EXPANSION_CASE_EXP_START]; while (true) { if (this._peek.type === TokenType$1.EXPANSION_FORM_START || this._peek.type === TokenType$1.EXPANSION_CASE_EXP_START) { expansionFormStack.push(this._peek.type); } if (this._peek.type === TokenType$1.EXPANSION_CASE_EXP_END) { if (lastOnStack(expansionFormStack, TokenType$1.EXPANSION_CASE_EXP_START)) { expansionFormStack.pop(); if (expansionFormStack.length == 0) return exp; } else { this._errors.push(TreeError.create(null, start.sourceSpan, `Invalid ICU message. Missing '}'.`)); return null; } } if (this._peek.type === TokenType$1.EXPANSION_FORM_END) { if (lastOnStack(expansionFormStack, TokenType$1.EXPANSION_FORM_START)) { expansionFormStack.pop(); } else { this._errors.push(TreeError.create(null, start.sourceSpan, `Invalid ICU message. Missing '}'.`)); return null; } } if (this._peek.type === TokenType$1.EOF) { this._errors.push(TreeError.create(null, start.sourceSpan, `Invalid ICU message. Missing '}'.`)); return null; } exp.push(this._advance()); } } /** * @param {?} token * @return {?} */ _consumeText(token) { let /** @type {?} */ text = token.parts[0]; if (text.length > 0 && text[0] == '\n') { const /** @type {?} */ parent = this._getParentElement(); if (parent != null && parent.children.length == 0 && this.getTagDefinition(parent.name).ignoreFirstLf) { text = text.substring(1); } } if (text.length > 0) { this._addToParent(new Text(text, token.sourceSpan)); } } /** * @return {?} */ _closeVoidElement() { const /** @type {?} */ el = this._getParentElement(); if (el && this.getTagDefinition(el.name).isVoid) { this._elementStack.pop(); } } /** * @param {?} startTagToken * @return {?} */ _consumeStartTag(startTagToken) { const /** @type {?} */ prefix = startTagToken.parts[0]; const /** @type {?} */ name = startTagToken.parts[1]; const /** @type {?} */ attrs = []; while (this._peek.type === TokenType$1.ATTR_NAME) { attrs.push(this._consumeAttr(this._advance())); } const /** @type {?} */ fullName = this._getElementFullName(prefix, name, this._getParentElement()); let /** @type {?} */ selfClosing = false; // Note: There could have been a tokenizer error // so that we don't get a token for the end tag... if (this._peek.type === TokenType$1.TAG_OPEN_END_VOID) { this._advance(); selfClosing = true; const /** @type {?} */ tagDef = this.getTagDefinition(fullName); if (!(tagDef.canSelfClose || getNsPrefix(fullName) !== null || tagDef.isVoid)) { this._errors.push(TreeError.create(fullName, startTagToken.sourceSpan, `Only void and foreign elements can be self closed "${startTagToken.parts[1]}"`)); } } else if (this._peek.type === TokenType$1.TAG_OPEN_END) { this._advance(); selfClosing = false; } const /** @type {?} */ end = this._peek.sourceSpan.start; const /** @type {?} */ span = new ParseSourceSpan(startTagToken.sourceSpan.start, end); const /** @type {?} */ el = new Element(fullName, attrs, [], span, span, undefined); this._pushElement(el); if (selfClosing) { this._popElement(fullName); el.endSourceSpan = span; } } /** * @param {?} el * @return {?} */ _pushElement(el) { const /** @type {?} */ parentEl = this._getParentElement(); if (parentEl && this.getTagDefinition(parentEl.name).isClosedByChild(el.name)) { this._elementStack.pop(); } const /** @type {?} */ tagDef = this.getTagDefinition(el.name); const { parent, container } = this._getParentElementSkippingContainers(); if (parent && tagDef.requireExtraParent(parent.name)) { const /** @type {?} */ newParent = new Element(tagDef.parentToAdd, [], [], el.sourceSpan, el.startSourceSpan, el.endSourceSpan); this._insertBeforeContainer(parent, container, newParent); } this._addToParent(el); this._elementStack.push(el); } /** * @param {?} endTagToken * @return {?} */ _consumeEndTag(endTagToken) { const /** @type {?} */ fullName = this._getElementFullName(endTagToken.parts[0], endTagToken.parts[1], this._getParentElement()); if (this._getParentElement()) { /** @type {?} */ ((this._getParentElement())).endSourceSpan = endTagToken.sourceSpan; } if (this.getTagDefinition(fullName).isVoid) { this._errors.push(TreeError.create(fullName, endTagToken.sourceSpan, `Void elements do not have end tags "${endTagToken.parts[1]}"`)); } else if (!this._popElement(fullName)) { const /** @type {?} */ errMsg = `Unexpected closing tag "${fullName}". It may happen when the tag has already been closed by another tag. For more info see https://www.w3.org/TR/html5/syntax.html#closing-elements-that-have-implied-end-tags`; this._errors.push(TreeError.create(fullName, endTagToken.sourceSpan, errMsg)); } } /** * @param {?} fullName * @return {?} */ _popElement(fullName) { for (let /** @type {?} */ stackIndex = this._elementStack.length - 1; stackIndex >= 0; stackIndex--) { const /** @type {?} */ el = this._elementStack[stackIndex]; if (el.name == fullName) { this._elementStack.splice(stackIndex, this._elementStack.length - stackIndex); return true; } if (!this.getTagDefinition(el.name).closedByParent) { return false; } } return false; } /** * @param {?} attrName * @return {?} */ _consumeAttr(attrName) { const /** @type {?} */ fullName = mergeNsAndName(attrName.parts[0], attrName.parts[1]); let /** @type {?} */ end = attrName.sourceSpan.end; let /** @type {?} */ value = ''; let /** @type {?} */ valueSpan = /** @type {?} */ ((undefined)); if (this._peek.type === TokenType$1.ATTR_VALUE) { const /** @type {?} */ valueToken = this._advance(); value = valueToken.parts[0]; end = valueToken.sourceSpan.end; valueSpan = valueToken.sourceSpan; } return new Attribute$1(fullName, value, new ParseSourceSpan(attrName.sourceSpan.start, end), valueSpan); } /** * @return {?} */ _getParentElement() { return this._elementStack.length > 0 ? this._elementStack[this._elementStack.length - 1] : null; } /** * Returns the parent in the DOM and the container. * * `<ng-container>` elements are skipped as they are not rendered as DOM element. * @return {?} */ _getParentElementSkippingContainers() { let /** @type {?} */ container = null; for (let /** @type {?} */ i = this._elementStack.length - 1; i >= 0; i--) { if (!isNgContainer(this._elementStack[i].name)) { return { parent: this._elementStack[i], container }; } container = this._elementStack[i]; } return { parent: null, container }; } /** * @param {?} node * @return {?} */ _addToParent(node) { const /** @type {?} */ parent = this._getParentElement(); if (parent != null) { parent.children.push(node); } else { this._rootNodes.push(node); } } /** * Insert a node between the parent and the container. * When no container is given, the node is appended as a child of the parent. * Also updates the element stack accordingly. * * \@internal * @param {?} parent * @param {?} container * @param {?} node * @return {?} */ _insertBeforeContainer(parent, container, node) { if (!container) { this._addToParent(node); this._elementStack.push(node); } else { if (parent) { // replace the container with the new node in the children const /** @type {?} */ index = parent.children.indexOf(container); parent.children[index] = node; } else { this._rootNodes.push(node); } node.children.push(container); this._elementStack.splice(this._elementStack.indexOf(container), 0, node); } } /** * @param {?} prefix * @param {?} localName * @param {?} parentElement * @return {?} */ _getElementFullName(prefix, localName, parentElement) { if (prefix == null) { prefix = /** @type {?} */ ((this.getTagDefinition(localName).implicitNamespacePrefix)); if (prefix == null && parentElement != null) { prefix = getNsPrefix(parentElement.name); } } return mergeNsAndName(prefix, localName); } } /** * @param {?} stack * @param {?} element * @return {?} */ function lastOnStack(stack, element) { return stack.length > 0 && stack[stack.length - 1] === element; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @param {?} message * @return {?} */ function digest(message) { return message.id || sha1(serializeNodes(message.nodes).join('') + `[${message.meaning}]`); } /** * @param {?} message * @return {?} */ function decimalDigest(message) { if (message.id) { return message.id; } const /** @type {?} */ visitor = new _SerializerIgnoreIcuExpVisitor(); const /** @type {?} */ parts = message.nodes.map(a => a.visit(visitor, null)); return computeMsgId(parts.join(''), message.meaning); } /** * Serialize the i18n ast to something xml-like in order to generate an UID. * * The visitor is also used in the i18n parser tests * * \@internal */ class _SerializerVisitor { /** * @param {?} text * @param {?} context * @return {?} */ visitText(text, context) { return text.value; } /** * @param {?} container * @param {?} context * @return {?} */ visitContainer(container, context) { return `[${container.children.map(child => child.visit(this)).join(', ')}]`; } /** * @param {?} icu * @param {?} context * @return {?} */ visitIcu(icu, context) { const /** @type {?} */ strCases = Object.keys(icu.cases).map((k) => `${k} {${icu.cases[k].visit(this)}}`); return `{${icu.expression}, ${icu.type}, ${strCases.join(', ')}}`; } /** * @param {?} ph * @param {?} context * @return {?} */ visitTagPlaceholder(ph, context) { return ph.isVoid ? `<ph tag name="${ph.startName}"/>` : `<ph tag name="${ph.startName}">${ph.children.map(child => child.visit(this)).join(', ')}</ph name="${ph.closeName}">`; } /** * @param {?} ph * @param {?} context * @return {?} */ visitPlaceholder(ph, context) { return ph.value ? `<ph name="${ph.name}">${ph.value}</ph>` : `<ph name="${ph.name}"/>`; } /** * @param {?} ph * @param {?=} context * @return {?} */ visitIcuPlaceholder(ph, context) { return `<ph icu name="${ph.name}">${ph.value.visit(this)}</ph>`; } } const serializerVisitor = new _SerializerVisitor(); /** * @param {?} nodes * @return {?} */ function serializeNodes(nodes) { return nodes.map(a => a.visit(serializerVisitor, null)); } /** * Serialize the i18n ast to something xml-like in order to generate an UID. * * Ignore the ICU expressions so that message IDs stays identical if only the expression changes. * * \@internal */ class _SerializerIgnoreIcuExpVisitor extends _SerializerVisitor { /** * @param {?} icu * @param {?} context * @return {?} */ visitIcu(icu, context) { let /** @type {?} */ strCases = Object.keys(icu.cases).map((k) => `${k} {${icu.cases[k].visit(this)}}`); // Do not take the expression into account return `{${icu.type}, ${strCases.join(', ')}}`; } } /** * Compute the SHA1 of the given string * * see http://csrc.nist.gov/publications/fips/fips180-4/fips-180-4.pdf * * WARNING: this function has not been designed not tested with security in mind. * DO NOT USE IT IN A SECURITY SENSITIVE CONTEXT. * @param {?} str * @return {?} */ function sha1(str) { const /** @type {?} */ utf8 = utf8Encode(str); const /** @type {?} */ words32 = stringToWords32(utf8, Endian.Big); const /** @type {?} */ len = utf8.length * 8; const /** @type {?} */ w = new Array(80); let [a, b, c, d, e] = [0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0]; words32[len >> 5] |= 0x80 << (24 - len % 32); words32[((len + 64 >> 9) << 4) + 15] = len; for (let /** @type {?} */ i = 0; i < words32.length; i += 16) { const [h0, h1, h2, h3, h4] = [a, b, c, d, e]; for (let /** @type {?} */ j = 0; j < 80; j++) { if (j < 16) { w[j] = words32[i + j]; } else { w[j] = rol32(w[j - 3] ^ w[j - 8] ^ w[j - 14] ^ w[j - 16], 1); } const [f, k] = fk(j, b, c, d); const /** @type {?} */ temp = [rol32(a, 5), f, e, k, w[j]].reduce(add32); [e, d, c, b, a] = [d, c, rol32(b, 30), a, temp]; } [a, b, c, d, e] = [add32(a, h0), add32(b, h1), add32(c, h2), add32(d, h3), add32(e, h4)]; } return byteStringToHexString(words32ToByteString([a, b, c, d, e])); } /** * @param {?} index * @param {?} b * @param {?} c * @param {?} d * @return {?} */ function fk(index, b, c, d) { if (index < 20) { return [(b & c) | (~b & d), 0x5a827999]; } if (index < 40) { return [b ^ c ^ d, 0x6ed9eba1]; } if (index < 60) { return [(b & c) | (b & d) | (c & d), 0x8f1bbcdc]; } return [b ^ c ^ d, 0xca62c1d6]; } /** * Compute the fingerprint of the given string * * The output is 64 bit number encoded as a decimal string * * based on: * https://github.com/google/closure-compiler/blob/master/src/com/google/javascript/jscomp/GoogleJsMessageIdGenerator.java * @param {?} str * @return {?} */ function fingerprint(str) { const /** @type {?} */ utf8 = utf8Encode(str); let [hi, lo] = [hash32(utf8, 0), hash32(utf8, 102072)]; if (hi == 0 && (lo == 0 || lo == 1)) { hi = hi ^ 0x130f9bef; lo = lo ^ -0x6b5f56d8; } return [hi, lo]; } /** * @param {?} msg * @param {?} meaning * @return {?} */ function computeMsgId(msg, meaning) { let [hi, lo] = fingerprint(msg); if (meaning) { const [him, lom] = fingerprint(meaning); [hi, lo] = add64(rol64([hi, lo], 1), [him, lom]); } return byteStringToDecString(words32ToByteString([hi & 0x7fffffff, lo])); } /** * @param {?} str * @param {?} c * @return {?} */ function hash32(str, c) { let [a, b] = [0x9e3779b9, 0x9e3779b9]; let /** @type {?} */ i; const /** @type {?} */ len = str.length; for (i = 0; i + 12 <= len; i += 12) { a = add32(a, wordAt(str, i, Endian.Little)); b = add32(b, wordAt(str, i + 4, Endian.Little)); c = add32(c, wordAt(str, i + 8, Endian.Little)); [a, b, c] = mix([a, b, c]); } a = add32(a, wordAt(str, i, Endian.Little)); b = add32(b, wordAt(str, i + 4, Endian.Little)); // the first byte of c is reserved for the length c = add32(c, len); c = add32(c, wordAt(str, i + 8, Endian.Little) << 8); return mix([a, b, c])[2]; } /** * @param {?} __0 * @return {?} */ function mix([a, b, c]) { a = sub32(a, b); a = sub32(a, c); a ^= c >>> 13; b = sub32(b, c); b = sub32(b, a); b ^= a << 8; c = sub32(c, a); c = sub32(c, b); c ^= b >>> 13; a = sub32(a, b); a = sub32(a, c); a ^= c >>> 12; b = sub32(b, c); b = sub32(b, a); b ^= a << 16; c = sub32(c, a); c = sub32(c, b); c ^= b >>> 5; a = sub32(a, b); a = sub32(a, c); a ^= c >>> 3; b = sub32(b, c); b = sub32(b, a); b ^= a << 10; c = sub32(c, a); c = sub32(c, b); c ^= b >>> 15; return [a, b, c]; } /** @enum {number} */ const Endian = { Little: 0, Big: 1, }; Endian[Endian.Little] = "Little"; Endian[Endian.Big] = "Big"; /** * @param {?} a * @param {?} b * @return {?} */ function add32(a, b) { return add32to64(a, b)[1]; } /** * @param {?} a * @param {?} b * @return {?} */ function add32to64(a, b) { const /** @type {?} */ low = (a & 0xffff) + (b & 0xffff); const /** @type {?} */ high = (a >>> 16) + (b >>> 16) + (low >>> 16); return [high >>> 16, (high << 16) | (low & 0xffff)]; } /** * @param {?} __0 * @param {?} __1 * @return {?} */ function add64([ah, al], [bh, bl]) { const [carry, l] = add32to64(al, bl); const /** @type {?} */ h = add32(add32(ah, bh), carry); return [h, l]; } /** * @param {?} a * @param {?} b * @return {?} */ function sub32(a, b) { const /** @type {?} */ low = (a & 0xffff) - (b & 0xffff); const /** @type {?} */ high = (a >> 16) - (b >> 16) + (low >> 16); return (high << 16) | (low & 0xffff); } /** * @param {?} a * @param {?} count * @return {?} */ function rol32(a, count) { return (a << count) | (a >>> (32 - count)); } /** * @param {?} __0 * @param {?} count * @return {?} */ function rol64([hi, lo], count) { const /** @type {?} */ h = (hi << count) | (lo >>> (32 - count)); const /** @type {?} */ l = (lo << count) | (hi >>> (32 - count)); return [h, l]; } /** * @param {?} str * @param {?} endian * @return {?} */ function stringToWords32(str, endian) { const /** @type {?} */ words32 = Array((str.length + 3) >>> 2); for (let /** @type {?} */ i = 0; i < words32.length; i++) { words32[i] = wordAt(str, i * 4, endian); } return words32; } /** * @param {?} str * @param {?} index * @return {?} */ function byteAt(str, index) { return index >= str.length ? 0 : str.charCodeAt(index) & 0xff; } /** * @param {?} str * @param {?} index * @param {?} endian * @return {?} */ function wordAt(str, index, endian) { let /** @type {?} */ word = 0; if (endian === Endian.Big) { for (let /** @type {?} */ i = 0; i < 4; i++) { word += byteAt(str, index + i) << (24 - 8 * i); } } else { for (let /** @type {?} */ i = 0; i < 4; i++) { word += byteAt(str, index + i) << 8 * i; } } return word; } /** * @param {?} words32 * @return {?} */ function words32ToByteString(words32) { return words32.reduce((str, word) => str + word32ToByteString(word), ''); } /** * @param {?} word * @return {?} */ function word32ToByteString(word) { let /** @type {?} */ str = ''; for (let /** @type {?} */ i = 0; i < 4; i++) { str += String.fromCharCode((word >>> 8 * (3 - i)) & 0xff); } return str; } /** * @param {?} str * @return {?} */ function byteStringToHexString(str) { let /** @type {?} */ hex = ''; for (let /** @type {?} */ i = 0; i < str.length; i++) { const /** @type {?} */ b = byteAt(str, i); hex += (b >>> 4).toString(16) + (b & 0x0f).toString(16); } return hex.toLowerCase(); } /** * @param {?} str * @return {?} */ function byteStringToDecString(str) { let /** @type {?} */ decimal = ''; let /** @type {?} */ toThePower = '1'; for (let /** @type {?} */ i = str.length - 1; i >= 0; i--) { decimal = addBigInt(decimal, numberTimesBigInt(byteAt(str, i), toThePower)); toThePower = numberTimesBigInt(256, toThePower); } return decimal.split('').reverse().join(''); } /** * @param {?} x * @param {?} y * @return {?} */ function addBigInt(x, y) { let /** @type {?} */ sum = ''; const /** @type {?} */ len = Math.max(x.length, y.length); for (let /** @type {?} */ i = 0, /** @type {?} */ carry = 0; i < len || carry; i++) { const /** @type {?} */ tmpSum = carry + +(x[i] || 0) + +(y[i] || 0); if (tmpSum >= 10) { carry = 1; sum += tmpSum - 10; } else { carry = 0; sum += tmpSum; } } return sum; } /** * @param {?} num * @param {?} b * @return {?} */ function numberTimesBigInt(num, b) { let /** @type {?} */ product = ''; let /** @type {?} */ bToThePower = b; for (; num !== 0; num = num >>> 1) { if (num & 1) product = addBigInt(product, bToThePower); bToThePower = addBigInt(bToThePower, bToThePower); } return product; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ class Message { /** * @param {?} nodes message AST * @param {?} placeholders maps placeholder names to static content * @param {?} placeholderToMessage maps placeholder names to messages (used for nested ICU messages) * @param {?} meaning * @param {?} description * @param {?} id */ constructor(nodes, placeholders, placeholderToMessage, meaning, description, id) { this.nodes = nodes; this.placeholders = placeholders; this.placeholderToMessage = placeholderToMessage; this.meaning = meaning; this.description = description; this.id = id; if (nodes.length) { this.sources = [{ filePath: nodes[0].sourceSpan.start.file.url, startLine: nodes[0].sourceSpan.start.line + 1, startCol: nodes[0].sourceSpan.start.col + 1, endLine: nodes[nodes.length - 1].sourceSpan.end.line + 1, endCol: nodes[0].sourceSpan.start.col + 1 }]; } else { this.sources = []; } } } /** * @record */ /** * @record */ class Text$1 { /** * @param {?} value * @param {?} sourceSpan */ constructor(value, sourceSpan) { this.value = value; this.sourceSpan = sourceSpan; } /** * @param {?} visitor * @param {?=} context * @return {?} */ visit(visitor, context) { return visitor.visitText(this, context); } } class Container { /** * @param {?} children * @param {?} sourceSpan */ constructor(children, sourceSpan) { this.children = children; this.sourceSpan = sourceSpan; } /** * @param {?} visitor * @param {?=} context * @return {?} */ visit(visitor, context) { return visitor.visitContainer(this, context); } } class Icu { /** * @param {?} expression * @param {?} type * @param {?} cases * @param {?} sourceSpan */ constructor(expression, type, cases, sourceSpan) { this.expression = expression; this.type = type; this.cases = cases; this.sourceSpan = sourceSpan; } /** * @param {?} visitor * @param {?=} context * @return {?} */ visit(visitor, context) { return visitor.visitIcu(this, context); } } class TagPlaceholder { /** * @param {?} tag * @param {?} attrs * @param {?} startName * @param {?} closeName * @param {?} children * @param {?} isVoid * @param {?} sourceSpan */ constructor(tag, attrs, startName, closeName, children, isVoid, sourceSpan) { this.tag = tag; this.attrs = attrs; this.startName = startName; this.closeName = closeName; this.children = children; this.isVoid = isVoid; this.sourceSpan = sourceSpan; } /** * @param {?} visitor * @param {?=} context * @return {?} */ visit(visitor, context) { return visitor.visitTagPlaceholder(this, context); } } class Placeholder { /** * @param {?} value * @param {?} name * @param {?} sourceSpan */ constructor(value, name, sourceSpan) { this.value = value; this.name = name; this.sourceSpan = sourceSpan; } /** * @param {?} visitor * @param {?=} context * @return {?} */ visit(visitor, context) { return visitor.visitPlaceholder(this, context); } } class IcuPlaceholder { /** * @param {?} value * @param {?} name * @param {?} sourceSpan */ constructor(value, name, sourceSpan) { this.value = value; this.name = name; this.sourceSpan = sourceSpan; } /** * @param {?} visitor * @param {?=} context * @return {?} */ visit(visitor, context) { return visitor.visitIcuPlaceholder(this, context); } } /** * @record */ class CloneVisitor { /** * @param {?} text * @param {?=} context * @return {?} */ visitText(text, context) { return new Text$1(text.value, text.sourceSpan); } /** * @param {?} container * @param {?=} context * @return {?} */ visitContainer(container, context) { const /** @type {?} */ children = container.children.map(n => n.visit(this, context)); return new Container(children, container.sourceSpan); } /** * @param {?} icu * @param {?=} context * @return {?} */ visitIcu(icu, context) { const /** @type {?} */ cases = {}; Object.keys(icu.cases).forEach(key => cases[key] = icu.cases[key].visit(this, context)); const /** @type {?} */ msg = new Icu(icu.expression, icu.type, cases, icu.sourceSpan); msg.expressionPlaceholder = icu.expressionPlaceholder; return msg; } /** * @param {?} ph * @param {?=} context * @return {?} */ visitTagPlaceholder(ph, context) { const /** @type {?} */ children = ph.children.map(n => n.visit(this, context)); return new TagPlaceholder(ph.tag, ph.attrs, ph.startName, ph.closeName, children, ph.isVoid, ph.sourceSpan); } /** * @param {?} ph * @param {?=} context * @return {?} */ visitPlaceholder(ph, context) { return new Placeholder(ph.value, ph.name, ph.sourceSpan); } /** * @param {?} ph * @param {?=} context * @return {?} */ visitIcuPlaceholder(ph, context) { return new IcuPlaceholder(ph.value, ph.name, ph.sourceSpan); } } class RecurseVisitor { /** * @param {?} text * @param {?=} context * @return {?} */ visitText(text, context) { } /** * @param {?} container * @param {?=} context * @return {?} */ visitContainer(container, context) { container.children.forEach(child => child.visit(this)); } /** * @param {?} icu * @param {?=} context * @return {?} */ visitIcu(icu, context) { Object.keys(icu.cases).forEach(k => { icu.cases[k].visit(this); }); } /** * @param {?} ph * @param {?=} context * @return {?} */ visitTagPlaceholder(ph, context) { ph.children.forEach(child => child.visit(this)); } /** * @param {?} ph * @param {?=} context * @return {?} */ visitPlaceholder(ph, context) { } /** * @param {?} ph * @param {?=} context * @return {?} */ visitIcuPlaceholder(ph, context) { } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ class HtmlTagDefinition { /** * @param {?=} __0 */ constructor({ closedByChildren, requiredParents, implicitNamespacePrefix, contentType = TagContentType.PARSABLE_DATA, closedByParent = false, isVoid = false, ignoreFirstLf = false } = {}) { this.closedByChildren = {}; this.closedByParent = false; this.canSelfClose = false; if (closedByChildren && closedByChildren.length > 0) { closedByChildren.forEach(tagName => this.closedByChildren[tagName] = true); } this.isVoid = isVoid; this.closedByParent = closedByParent || isVoid; if (requiredParents && requiredParents.length > 0) { this.requiredParents = {}; // The first parent is the list is automatically when none of the listed parents are present this.parentToAdd = requiredParents[0]; requiredParents.forEach(tagName => this.requiredParents[tagName] = true); } this.implicitNamespacePrefix = implicitNamespacePrefix || null; this.contentType = contentType; this.ignoreFirstLf = ignoreFirstLf; } /** * @param {?} currentParent * @return {?} */ requireExtraParent(currentParent) { if (!this.requiredParents) { return false; } if (!currentParent) { return true; } const /** @type {?} */ lcParent = currentParent.toLowerCase(); const /** @type {?} */ isParentTemplate = lcParent === 'template' || currentParent === 'ng-template'; return !isParentTemplate && this.requiredParents[lcParent] != true; } /** * @param {?} name * @return {?} */ isClosedByChild(name) { return this.isVoid || name.toLowerCase() in this.closedByChildren; } } // see http://www.w3.org/TR/html51/syntax.html#optional-tags // This implementation does not fully conform to the HTML5 spec. const TAG_DEFINITIONS = { 'base': new HtmlTagDefinition({ isVoid: true }), 'meta': new HtmlTagDefinition({ isVoid: true }), 'area': new HtmlTagDefinition({ isVoid: true }), 'embed': new HtmlTagDefinition({ isVoid: true }), 'link': new HtmlTagDefinition({ isVoid: true }), 'img': new HtmlTagDefinition({ isVoid: true }), 'input': new HtmlTagDefinition({ isVoid: true }), 'param': new HtmlTagDefinition({ isVoid: true }), 'hr': new HtmlTagDefinition({ isVoid: true }), 'br': new HtmlTagDefinition({ isVoid: true }), 'source': new HtmlTagDefinition({ isVoid: true }), 'track': new HtmlTagDefinition({ isVoid: true }), 'wbr': new HtmlTagDefinition({ isVoid: true }), 'p': new HtmlTagDefinition({ 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' ], closedByParent: true }), 'thead': new HtmlTagDefinition({ closedByChildren: ['tbody', 'tfoot'] }), 'tbody': new HtmlTagDefinition({ closedByChildren: ['tbody', 'tfoot'], closedByParent: true }), 'tfoot': new HtmlTagDefinition({ closedByChildren: ['tbody'], closedByParent: true }), 'tr': new HtmlTagDefinition({ closedByChildren: ['tr'], requiredParents: ['tbody', 'tfoot', 'thead'], closedByParent: true }), 'td': new HtmlTagDefinition({ closedByChildren: ['td', 'th'], closedByParent: true }), 'th': new HtmlTagDefinition({ closedByChildren: ['td', 'th'], closedByParent: true }), 'col': new HtmlTagDefinition({ requiredParents: ['colgroup'], isVoid: true }), 'svg': new HtmlTagDefinition({ implicitNamespacePrefix: 'svg' }), 'math': new HtmlTagDefinition({ implicitNamespacePrefix: 'math' }), 'li': new HtmlTagDefinition({ closedByChildren: ['li'], closedByParent: true }), 'dt': new HtmlTagDefinition({ closedByChildren: ['dt', 'dd'] }), 'dd': new HtmlTagDefinition({ closedByChildren: ['dt', 'dd'], closedByParent: true }), 'rb': new HtmlTagDefinition({ closedByChildren: ['rb', 'rt', 'rtc', 'rp'], closedByParent: true }), 'rt': new HtmlTagDefinition({ closedByChildren: ['rb', 'rt', 'rtc', 'rp'], closedByParent: true }), 'rtc': new HtmlTagDefinition({ closedByChildren: ['rb', 'rtc', 'rp'], closedByParent: true }), 'rp': new HtmlTagDefinition({ closedByChildren: ['rb', 'rt', 'rtc', 'rp'], closedByParent: true }), 'optgroup': new HtmlTagDefinition({ closedByChildren: ['optgroup'], closedByParent: true }), 'option': new HtmlTagDefinition({ closedByChildren: ['option', 'optgroup'], closedByParent: true }), 'pre': new HtmlTagDefinition({ ignoreFirstLf: true }), 'listing': new HtmlTagDefinition({ ignoreFirstLf: true }), 'style': new HtmlTagDefinition({ contentType: TagContentType.RAW_TEXT }), 'script': new HtmlTagDefinition({ contentType: TagContentType.RAW_TEXT }), 'title': new HtmlTagDefinition({ contentType: TagContentType.ESCAPABLE_RAW_TEXT }), 'textarea': new HtmlTagDefinition({ contentType: TagContentType.ESCAPABLE_RAW_TEXT, ignoreFirstLf: true }), }; const _DEFAULT_TAG_DEFINITION = new HtmlTagDefinition(); /** * @param {?} tagName * @return {?} */ function getHtmlTagDefinition(tagName) { return TAG_DEFINITIONS[tagName.toLowerCase()] || _DEFAULT_TAG_DEFINITION; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ const TAG_TO_PLACEHOLDER_NAMES = { 'A': 'LINK', 'B': 'BOLD_TEXT', 'BR': 'LINE_BREAK', 'EM': 'EMPHASISED_TEXT', 'H1': 'HEADING_LEVEL1', 'H2': 'HEADING_LEVEL2', 'H3': 'HEADING_LEVEL3', 'H4': 'HEADING_LEVEL4', 'H5': 'HEADING_LEVEL5', 'H6': 'HEADING_LEVEL6', 'HR': 'HORIZONTAL_RULE', 'I': 'ITALIC_TEXT', 'LI': 'LIST_ITEM', 'LINK': 'MEDIA_LINK', 'OL': 'ORDERED_LIST', 'P': 'PARAGRAPH', 'Q': 'QUOTATION', 'S': 'STRIKETHROUGH_TEXT', 'SMALL': 'SMALL_TEXT', 'SUB': 'SUBSTRIPT', 'SUP': 'SUPERSCRIPT', 'TBODY': 'TABLE_BODY', 'TD': 'TABLE_CELL', 'TFOOT': 'TABLE_FOOTER', 'TH': 'TABLE_HEADER_CELL', 'THEAD': 'TABLE_HEADER', 'TR': 'TABLE_ROW', 'TT': 'MONOSPACED_TEXT', 'U': 'UNDERLINED_TEXT', 'UL': 'UNORDERED_LIST', }; /** * Creates unique names for placeholder with different content. * * Returns the same placeholder name when the content is identical. */ class PlaceholderRegistry { constructor() { this._placeHolderNameCounts = {}; this._signatureToName = {}; } /** * @param {?} tag * @param {?} attrs * @param {?} isVoid * @return {?} */ getStartTagPlaceholderName(tag, attrs, isVoid) { const /** @type {?} */ signature = this._hashTag(tag, attrs, isVoid); if (this._signatureToName[signature]) { return this._signatureToName[signature]; } const /** @type {?} */ upperTag = tag.toUpperCase(); const /** @type {?} */ baseName = TAG_TO_PLACEHOLDER_NAMES[upperTag] || `TAG_${upperTag}`; const /** @type {?} */ name = this._generateUniqueName(isVoid ? baseName : `START_${baseName}`); this._signatureToName[signature] = name; return name; } /** * @param {?} tag * @return {?} */ getCloseTagPlaceholderName(tag) { const /** @type {?} */ signature = this._hashClosingTag(tag); if (this._signatureToName[signature]) { return this._signatureToName[signature]; } const /** @type {?} */ upperTag = tag.toUpperCase(); const /** @type {?} */ baseName = TAG_TO_PLACEHOLDER_NAMES[upperTag] || `TAG_${upperTag}`; const /** @type {?} */ name = this._generateUniqueName(`CLOSE_${baseName}`); this._signatureToName[signature] = name; return name; } /** * @param {?} name * @param {?} content * @return {?} */ getPlaceholderName(name, content) { const /** @type {?} */ upperName = name.toUpperCase(); const /** @type {?} */ signature = `PH: ${upperName}=${content}`; if (this._signatureToName[signature]) { return this._signatureToName[signature]; } const /** @type {?} */ uniqueName = this._generateUniqueName(upperName); this._signatureToName[signature] = uniqueName; return uniqueName; } /** * @param {?} name * @return {?} */ getUniquePlaceholder(name) { return this._generateUniqueName(name.toUpperCase()); } /** * @param {?} tag * @param {?} attrs * @param {?} isVoid * @return {?} */ _hashTag(tag, attrs, isVoid) { const /** @type {?} */ start = `<${tag}`; const /** @type {?} */ strAttrs = Object.keys(attrs).sort().map((name) => ` ${name}=${attrs[name]}`).join(''); const /** @type {?} */ end = isVoid ? '/>' : `></${tag}>`; return start + strAttrs + end; } /** * @param {?} tag * @return {?} */ _hashClosingTag(tag) { return this._hashTag(`/${tag}`, {}, false); } /** * @param {?} base * @return {?} */ _generateUniqueName(base) { const /** @type {?} */ seen = this._placeHolderNameCounts.hasOwnProperty(base); if (!seen) { this._placeHolderNameCounts[base] = 1; return base; } const /** @type {?} */ id = this._placeHolderNameCounts[base]; this._placeHolderNameCounts[base] = id + 1; return `${base}_${id}`; } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ const _expParser = new Parser(new Lexer()); /** * Returns a function converting html nodes to an i18n Message given an interpolationConfig * @param {?} interpolationConfig * @return {?} */ function createI18nMessageFactory(interpolationConfig) { const /** @type {?} */ visitor = new _I18nVisitor(_expParser, interpolationConfig); return (nodes, meaning, description, id) => visitor.toI18nMessage(nodes, meaning, description, id); } class _I18nVisitor { /** * @param {?} _expressionParser * @param {?} _interpolationConfig */ constructor(_expressionParser, _interpolationConfig) { this._expressionParser = _expressionParser; this._interpolationConfig = _interpolationConfig; } /** * @param {?} nodes * @param {?} meaning * @param {?} description * @param {?} id * @return {?} */ toI18nMessage(nodes, meaning, description, id) { this._isIcu = nodes.length == 1 && nodes[0] instanceof Expansion; this._icuDepth = 0; this._placeholderRegistry = new PlaceholderRegistry(); this._placeholderToContent = {}; this._placeholderToMessage = {}; const /** @type {?} */ i18nodes = visitAll(this, nodes, {}); return new Message(i18nodes, this._placeholderToContent, this._placeholderToMessage, meaning, description, id); } /** * @param {?} el * @param {?} context * @return {?} */ visitElement(el, context) { const /** @type {?} */ children = visitAll(this, el.children); const /** @type {?} */ attrs = {}; el.attrs.forEach(attr => { // Do not visit the attributes, translatable ones are top-level ASTs attrs[attr.name] = attr.value; }); const /** @type {?} */ isVoid = getHtmlTagDefinition(el.name).isVoid; const /** @type {?} */ startPhName = this._placeholderRegistry.getStartTagPlaceholderName(el.name, attrs, isVoid); this._placeholderToContent[startPhName] = /** @type {?} */ ((el.sourceSpan)).toString(); let /** @type {?} */ closePhName = ''; if (!isVoid) { closePhName = this._placeholderRegistry.getCloseTagPlaceholderName(el.name); this._placeholderToContent[closePhName] = `</${el.name}>`; } return new TagPlaceholder(el.name, attrs, startPhName, closePhName, children, isVoid, /** @type {?} */ ((el.sourceSpan))); } /** * @param {?} attribute * @param {?} context * @return {?} */ visitAttribute(attribute, context) { return this._visitTextWithInterpolation(attribute.value, attribute.sourceSpan); } /** * @param {?} text * @param {?} context * @return {?} */ visitText(text, context) { return this._visitTextWithInterpolation(text.value, /** @type {?} */ ((text.sourceSpan))); } /** * @param {?} comment * @param {?} context * @return {?} */ visitComment(comment, context) { return null; } /** * @param {?} icu * @param {?} context * @return {?} */ visitExpansion(icu, context) { this._icuDepth++; const /** @type {?} */ i18nIcuCases = {}; const /** @type {?} */ i18nIcu = new Icu(icu.switchValue, icu.type, i18nIcuCases, icu.sourceSpan); icu.cases.forEach((caze) => { i18nIcuCases[caze.value] = new Container(caze.expression.map((node) => node.visit(this, {})), caze.expSourceSpan); }); this._icuDepth--; if (this._isIcu || this._icuDepth > 0) { // Returns an ICU node when: // - the message (vs a part of the message) is an ICU message, or // - the ICU message is nested. const /** @type {?} */ expPh = this._placeholderRegistry.getUniquePlaceholder(`VAR_${icu.type}`); i18nIcu.expressionPlaceholder = expPh; this._placeholderToContent[expPh] = icu.switchValue; return i18nIcu; } // Else returns a placeholder // ICU placeholders should not be replaced with their original content but with the their // translations. We need to create a new visitor (they are not re-entrant) to compute the // message id. // TODO(vicb): add a html.Node -> i18n.Message cache to avoid having to re-create the msg const /** @type {?} */ phName = this._placeholderRegistry.getPlaceholderName('ICU', icu.sourceSpan.toString()); const /** @type {?} */ visitor = new _I18nVisitor(this._expressionParser, this._interpolationConfig); this._placeholderToMessage[phName] = visitor.toI18nMessage([icu], '', '', ''); return new IcuPlaceholder(i18nIcu, phName, icu.sourceSpan); } /** * @param {?} icuCase * @param {?} context * @return {?} */ visitExpansionCase(icuCase, context) { throw new Error('Unreachable code'); } /** * @param {?} text * @param {?} sourceSpan * @return {?} */ _visitTextWithInterpolation(text, sourceSpan) { const /** @type {?} */ splitInterpolation = this._expressionParser.splitInterpolation(text, sourceSpan.start.toString(), this._interpolationConfig); if (!splitInterpolation) { // No expression, return a single text return new Text$1(text, sourceSpan); } // Return a group of text + expressions const /** @type {?} */ nodes = []; const /** @type {?} */ container = new Container(nodes, sourceSpan); const { start: sDelimiter, end: eDelimiter } = this._interpolationConfig; for (let /** @type {?} */ i = 0; i < splitInterpolation.strings.length - 1; i++) { const /** @type {?} */ expression = splitInterpolation.expressions[i]; const /** @type {?} */ baseName = _extractPlaceholderName(expression) || 'INTERPOLATION'; const /** @type {?} */ phName = this._placeholderRegistry.getPlaceholderName(baseName, expression); if (splitInterpolation.strings[i].length) { // No need to add empty strings nodes.push(new Text$1(splitInterpolation.strings[i], sourceSpan)); } nodes.push(new Placeholder(expression, phName, sourceSpan)); this._placeholderToContent[phName] = sDelimiter + expression + eDelimiter; } // The last index contains no expression const /** @type {?} */ lastStringIdx = splitInterpolation.strings.length - 1; if (splitInterpolation.strings[lastStringIdx].length) { nodes.push(new Text$1(splitInterpolation.strings[lastStringIdx], sourceSpan)); } return container; } } const _CUSTOM_PH_EXP = /\/\/[\s\S]*i18n[\s\S]*\([\s\S]*ph[\s\S]*=[\s\S]*("|')([\s\S]*?)\1[\s\S]*\)/g; /** * @param {?} input * @return {?} */ function _extractPlaceholderName(input) { return input.split(_CUSTOM_PH_EXP)[2]; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * An i18n error. */ class I18nError extends ParseError { /** * @param {?} span * @param {?} msg */ constructor(span, msg) { super(span, msg); } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ const _I18N_ATTR = 'i18n'; const _I18N_ATTR_PREFIX = 'i18n-'; const _I18N_COMMENT_PREFIX_REGEXP = /^i18n:?/; const MEANING_SEPARATOR = '|'; const ID_SEPARATOR = '@@'; let i18nCommentsWarned = false; /** * Extract translatable messages from an html AST * @param {?} nodes * @param {?} interpolationConfig * @param {?} implicitTags * @param {?} implicitAttrs * @return {?} */ function extractMessages(nodes, interpolationConfig, implicitTags, implicitAttrs) { const /** @type {?} */ visitor = new _Visitor(implicitTags, implicitAttrs); return visitor.extract(nodes, interpolationConfig); } /** * @param {?} nodes * @param {?} translations * @param {?} interpolationConfig * @param {?} implicitTags * @param {?} implicitAttrs * @return {?} */ function mergeTranslations(nodes, translations, interpolationConfig, implicitTags, implicitAttrs) { const /** @type {?} */ visitor = new _Visitor(implicitTags, implicitAttrs); return visitor.merge(nodes, translations, interpolationConfig); } class ExtractionResult { /** * @param {?} messages * @param {?} errors */ constructor(messages, errors) { this.messages = messages; this.errors = errors; } } /** @enum {number} */ const _VisitorMode = { Extract: 0, Merge: 1, }; _VisitorMode[_VisitorMode.Extract] = "Extract"; _VisitorMode[_VisitorMode.Merge] = "Merge"; /** * This Visitor is used: * 1. to extract all the translatable strings from an html AST (see `extract()`), * 2. to replace the translatable strings with the actual translations (see `merge()`) * * \@internal */ class _Visitor { /** * @param {?} _implicitTags * @param {?} _implicitAttrs */ constructor(_implicitTags, _implicitAttrs) { this._implicitTags = _implicitTags; this._implicitAttrs = _implicitAttrs; } /** * Extracts the messages from the tree * @param {?} nodes * @param {?} interpolationConfig * @return {?} */ extract(nodes, interpolationConfig) { this._init(_VisitorMode.Extract, interpolationConfig); nodes.forEach(node => node.visit(this, null)); if (this._inI18nBlock) { this._reportError(nodes[nodes.length - 1], 'Unclosed block'); } return new ExtractionResult(this._messages, this._errors); } /** * Returns a tree where all translatable nodes are translated * @param {?} nodes * @param {?} translations * @param {?} interpolationConfig * @return {?} */ merge(nodes, translations, interpolationConfig) { this._init(_VisitorMode.Merge, interpolationConfig); this._translations = translations; // Construct a single fake root element const /** @type {?} */ wrapper = new Element('wrapper', [], nodes, /** @type {?} */ ((undefined)), undefined, undefined); const /** @type {?} */ translatedNode = wrapper.visit(this, null); if (this._inI18nBlock) { this._reportError(nodes[nodes.length - 1], 'Unclosed block'); } return new ParseTreeResult(translatedNode.children, this._errors); } /** * @param {?} icuCase * @param {?} context * @return {?} */ visitExpansionCase(icuCase, context) { // Parse cases for translatable html attributes const /** @type {?} */ expression = visitAll(this, icuCase.expression, context); if (this._mode === _VisitorMode.Merge) { return new ExpansionCase(icuCase.value, expression, icuCase.sourceSpan, icuCase.valueSourceSpan, icuCase.expSourceSpan); } } /** * @param {?} icu * @param {?} context * @return {?} */ visitExpansion(icu, context) { this._mayBeAddBlockChildren(icu); const /** @type {?} */ wasInIcu = this._inIcu; if (!this._inIcu) { // nested ICU messages should not be extracted but top-level translated as a whole if (this._isInTranslatableSection) { this._addMessage([icu]); } this._inIcu = true; } const /** @type {?} */ cases = visitAll(this, icu.cases, context); if (this._mode === _VisitorMode.Merge) { icu = new Expansion(icu.switchValue, icu.type, cases, icu.sourceSpan, icu.switchValueSourceSpan); } this._inIcu = wasInIcu; return icu; } /** * @param {?} comment * @param {?} context * @return {?} */ visitComment(comment, context) { const /** @type {?} */ isOpening = _isOpeningComment(comment); if (isOpening && this._isInTranslatableSection) { this._reportError(comment, 'Could not start a block inside a translatable section'); return; } const /** @type {?} */ isClosing = _isClosingComment(comment); if (isClosing && !this._inI18nBlock) { this._reportError(comment, 'Trying to close an unopened block'); return; } if (!this._inI18nNode && !this._inIcu) { if (!this._inI18nBlock) { if (isOpening) { // deprecated from v5 you should use <ng-container i18n> instead of i18n comments if (!i18nCommentsWarned && /** @type {?} */ (console) && /** @type {?} */ (console.warn)) { i18nCommentsWarned = true; const /** @type {?} */ details = comment.sourceSpan.details ? `, ${comment.sourceSpan.details}` : ''; // TODO(ocombe): use a log service once there is a public one available console.warn(`I18n comments are deprecated, use an <ng-container> element instead (${comment.sourceSpan.start}${details})`); } this._inI18nBlock = true; this._blockStartDepth = this._depth; this._blockChildren = []; this._blockMeaningAndDesc = /** @type {?} */ ((comment.value)).replace(_I18N_COMMENT_PREFIX_REGEXP, '').trim(); this._openTranslatableSection(comment); } } else { if (isClosing) { if (this._depth == this._blockStartDepth) { this._closeTranslatableSection(comment, this._blockChildren); this._inI18nBlock = false; const /** @type {?} */ message = /** @type {?} */ ((this._addMessage(this._blockChildren, this._blockMeaningAndDesc))); // merge attributes in sections const /** @type {?} */ nodes = this._translateMessage(comment, message); return visitAll(this, nodes); } else { this._reportError(comment, 'I18N blocks should not cross element boundaries'); return; } } } } } /** * @param {?} text * @param {?} context * @return {?} */ visitText(text, context) { if (this._isInTranslatableSection) { this._mayBeAddBlockChildren(text); } return text; } /** * @param {?} el * @param {?} context * @return {?} */ visitElement(el, context) { this._mayBeAddBlockChildren(el); this._depth++; const /** @type {?} */ wasInI18nNode = this._inI18nNode; const /** @type {?} */ wasInImplicitNode = this._inImplicitNode; let /** @type {?} */ childNodes = []; let /** @type {?} */ translatedChildNodes = /** @type {?} */ ((undefined)); // Extract: // - top level nodes with the (implicit) "i18n" attribute if not already in a section // - ICU messages const /** @type {?} */ i18nAttr = _getI18nAttr(el); const /** @type {?} */ i18nMeta = i18nAttr ? i18nAttr.value : ''; const /** @type {?} */ isImplicit = this._implicitTags.some(tag => el.name === tag) && !this._inIcu && !this._isInTranslatableSection; const /** @type {?} */ isTopLevelImplicit = !wasInImplicitNode && isImplicit; this._inImplicitNode = wasInImplicitNode || isImplicit; if (!this._isInTranslatableSection && !this._inIcu) { if (i18nAttr || isTopLevelImplicit) { this._inI18nNode = true; const /** @type {?} */ message = /** @type {?} */ ((this._addMessage(el.children, i18nMeta))); translatedChildNodes = this._translateMessage(el, message); } if (this._mode == _VisitorMode.Extract) { const /** @type {?} */ isTranslatable = i18nAttr || isTopLevelImplicit; if (isTranslatable) this._openTranslatableSection(el); visitAll(this, el.children); if (isTranslatable) this._closeTranslatableSection(el, el.children); } } else { if (i18nAttr || isTopLevelImplicit) { this._reportError(el, 'Could not mark an element as translatable inside a translatable section'); } if (this._mode == _VisitorMode.Extract) { // Descend into child nodes for extraction visitAll(this, el.children); } } if (this._mode === _VisitorMode.Merge) { const /** @type {?} */ visitNodes = translatedChildNodes || el.children; visitNodes.forEach(child => { const /** @type {?} */ visited = child.visit(this, context); if (visited && !this._isInTranslatableSection) { // Do not add the children from translatable sections (= i18n blocks here) // They will be added later in this loop when the block closes (i.e. on `<!-- /i18n -->`) childNodes = childNodes.concat(visited); } }); } this._visitAttributesOf(el); this._depth--; this._inI18nNode = wasInI18nNode; this._inImplicitNode = wasInImplicitNode; if (this._mode === _VisitorMode.Merge) { const /** @type {?} */ translatedAttrs = this._translateAttributes(el); return new Element(el.name, translatedAttrs, childNodes, el.sourceSpan, el.startSourceSpan, el.endSourceSpan); } return null; } /** * @param {?} attribute * @param {?} context * @return {?} */ visitAttribute(attribute, context) { throw new Error('unreachable code'); } /** * @param {?} mode * @param {?} interpolationConfig * @return {?} */ _init(mode, interpolationConfig) { this._mode = mode; this._inI18nBlock = false; this._inI18nNode = false; this._depth = 0; this._inIcu = false; this._msgCountAtSectionStart = undefined; this._errors = []; this._messages = []; this._inImplicitNode = false; this._createI18nMessage = createI18nMessageFactory(interpolationConfig); } /** * @param {?} el * @return {?} */ _visitAttributesOf(el) { const /** @type {?} */ explicitAttrNameToValue = {}; const /** @type {?} */ implicitAttrNames = this._implicitAttrs[el.name] || []; el.attrs.filter(attr => attr.name.startsWith(_I18N_ATTR_PREFIX)) .forEach(attr => explicitAttrNameToValue[attr.name.slice(_I18N_ATTR_PREFIX.length)] = attr.value); el.attrs.forEach(attr => { if (attr.name in explicitAttrNameToValue) { this._addMessage([attr], explicitAttrNameToValue[attr.name]); } else if (implicitAttrNames.some(name => attr.name === name)) { this._addMessage([attr]); } }); } /** * @param {?} ast * @param {?=} msgMeta * @return {?} */ _addMessage(ast, msgMeta) { if (ast.length == 0 || ast.length == 1 && ast[0] instanceof Attribute$1 && !(/** @type {?} */ (ast[0])).value) { // Do not create empty messages return null; } const { meaning, description, id } = _parseMessageMeta(msgMeta); const /** @type {?} */ message = this._createI18nMessage(ast, meaning, description, id); this._messages.push(message); return message; } /** * @param {?} el * @param {?} message * @return {?} */ _translateMessage(el, message) { if (message && this._mode === _VisitorMode.Merge) { const /** @type {?} */ nodes = this._translations.get(message); if (nodes) { return nodes; } this._reportError(el, `Translation unavailable for message id="${this._translations.digest(message)}"`); } return []; } /** * @param {?} el * @return {?} */ _translateAttributes(el) { const /** @type {?} */ attributes = el.attrs; const /** @type {?} */ i18nParsedMessageMeta = {}; attributes.forEach(attr => { if (attr.name.startsWith(_I18N_ATTR_PREFIX)) { i18nParsedMessageMeta[attr.name.slice(_I18N_ATTR_PREFIX.length)] = _parseMessageMeta(attr.value); } }); const /** @type {?} */ translatedAttributes = []; attributes.forEach((attr) => { if (attr.name === _I18N_ATTR || attr.name.startsWith(_I18N_ATTR_PREFIX)) { // strip i18n specific attributes return; } if (attr.value && attr.value != '' && i18nParsedMessageMeta.hasOwnProperty(attr.name)) { const { meaning, description, id } = i18nParsedMessageMeta[attr.name]; const /** @type {?} */ message = this._createI18nMessage([attr], meaning, description, id); const /** @type {?} */ nodes = this._translations.get(message); if (nodes) { if (nodes.length == 0) { translatedAttributes.push(new Attribute$1(attr.name, '', attr.sourceSpan)); } else if (nodes[0] instanceof Text) { const /** @type {?} */ value = (/** @type {?} */ (nodes[0])).value; translatedAttributes.push(new Attribute$1(attr.name, value, attr.sourceSpan)); } else { this._reportError(el, `Unexpected translation for attribute "${attr.name}" (id="${id || this._translations.digest(message)}")`); } } else { this._reportError(el, `Translation unavailable for attribute "${attr.name}" (id="${id || this._translations.digest(message)}")`); } } else { translatedAttributes.push(attr); } }); return translatedAttributes; } /** * Add the node as a child of the block when: * - we are in a block, * - we are not inside a ICU message (those are handled separately), * - the node is a "direct child" of the block * @param {?} node * @return {?} */ _mayBeAddBlockChildren(node) { if (this._inI18nBlock && !this._inIcu && this._depth == this._blockStartDepth) { this._blockChildren.push(node); } } /** * Marks the start of a section, see `_closeTranslatableSection` * @param {?} node * @return {?} */ _openTranslatableSection(node) { if (this._isInTranslatableSection) { this._reportError(node, 'Unexpected section start'); } else { this._msgCountAtSectionStart = this._messages.length; } } /** * A translatable section could be: * - the content of translatable element, * - nodes between `<!-- i18n -->` and `<!-- /i18n -->` comments * @return {?} */ get _isInTranslatableSection() { return this._msgCountAtSectionStart !== void 0; } /** * Terminates a section. * * If a section has only one significant children (comments not significant) then we should not * keep the message from this children: * * `<p i18n="meaning|description">{ICU message}</p>` would produce two messages: * - one for the <p> content with meaning and description, * - another one for the ICU message. * * In this case the last message is discarded as it contains less information (the AST is * otherwise identical). * * Note that we should still keep messages extracted from attributes inside the section (ie in the * ICU message here) * @param {?} node * @param {?} directChildren * @return {?} */ _closeTranslatableSection(node, directChildren) { if (!this._isInTranslatableSection) { this._reportError(node, 'Unexpected section end'); return; } const /** @type {?} */ startIndex = this._msgCountAtSectionStart; const /** @type {?} */ significantChildren = directChildren.reduce((count, node) => count + (node instanceof Comment ? 0 : 1), 0); if (significantChildren == 1) { for (let /** @type {?} */ i = this._messages.length - 1; i >= /** @type {?} */ ((startIndex)); i--) { const /** @type {?} */ ast = this._messages[i].nodes; if (!(ast.length == 1 && ast[0] instanceof Text$1)) { this._messages.splice(i, 1); break; } } } this._msgCountAtSectionStart = undefined; } /** * @param {?} node * @param {?} msg * @return {?} */ _reportError(node, msg) { this._errors.push(new I18nError(/** @type {?} */ ((node.sourceSpan)), msg)); } } /** * @param {?} n * @return {?} */ function _isOpeningComment(n) { return !!(n instanceof Comment && n.value && n.value.startsWith('i18n')); } /** * @param {?} n * @return {?} */ function _isClosingComment(n) { return !!(n instanceof Comment && n.value && n.value === '/i18n'); } /** * @param {?} p * @return {?} */ function _getI18nAttr(p) { return p.attrs.find(attr => attr.name === _I18N_ATTR) || null; } /** * @param {?=} i18n * @return {?} */ function _parseMessageMeta(i18n) { if (!i18n) return { meaning: '', description: '', id: '' }; const /** @type {?} */ idIndex = i18n.indexOf(ID_SEPARATOR); const /** @type {?} */ descIndex = i18n.indexOf(MEANING_SEPARATOR); const [meaningAndDesc, id] = (idIndex > -1) ? [i18n.slice(0, idIndex), i18n.slice(idIndex + 2)] : [i18n, '']; const [meaning, description] = (descIndex > -1) ? [meaningAndDesc.slice(0, descIndex), meaningAndDesc.slice(descIndex + 1)] : ['', meaningAndDesc]; return { meaning, description, id }; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ class XmlTagDefinition { constructor() { this.closedByParent = false; this.contentType = TagContentType.PARSABLE_DATA; this.isVoid = false; this.ignoreFirstLf = false; this.canSelfClose = true; } /** * @param {?} currentParent * @return {?} */ requireExtraParent(currentParent) { return false; } /** * @param {?} name * @return {?} */ isClosedByChild(name) { return false; } } const _TAG_DEFINITION = new XmlTagDefinition(); /** * @param {?} tagName * @return {?} */ function getXmlTagDefinition(tagName) { return _TAG_DEFINITION; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ class XmlParser extends Parser$1 { constructor() { super(getXmlTagDefinition); } /** * @param {?} source * @param {?} url * @param {?=} parseExpansionForms * @return {?} */ parse(source, url, parseExpansionForms = false) { return super.parse(source, url, parseExpansionForms); } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @abstract */ class Serializer { /** * @param {?} message * @return {?} */ createNameMapper(message) { return null; } } /** * A `PlaceholderMapper` converts placeholder names from internal to serialized representation and * back. * * It should be used for serialization format that put constraints on the placeholder names. * @record */ /** * A simple mapper that take a function to transform an internal name to a public name */ class SimplePlaceholderMapper extends RecurseVisitor { /** * @param {?} message * @param {?} mapName */ constructor(message, mapName) { super(); this.mapName = mapName; this.internalToPublic = {}; this.publicToNextId = {}; this.publicToInternal = {}; message.nodes.forEach(node => node.visit(this)); } /** * @param {?} internalName * @return {?} */ toPublicName(internalName) { return this.internalToPublic.hasOwnProperty(internalName) ? this.internalToPublic[internalName] : null; } /** * @param {?} publicName * @return {?} */ toInternalName(publicName) { return this.publicToInternal.hasOwnProperty(publicName) ? this.publicToInternal[publicName] : null; } /** * @param {?} text * @param {?=} context * @return {?} */ visitText(text, context) { return null; } /** * @param {?} ph * @param {?=} context * @return {?} */ visitTagPlaceholder(ph, context) { this.visitPlaceholderName(ph.startName); super.visitTagPlaceholder(ph, context); this.visitPlaceholderName(ph.closeName); } /** * @param {?} ph * @param {?=} context * @return {?} */ visitPlaceholder(ph, context) { this.visitPlaceholderName(ph.name); } /** * @param {?} ph * @param {?=} context * @return {?} */ visitIcuPlaceholder(ph, context) { this.visitPlaceholderName(ph.name); } /** * @param {?} internalName * @return {?} */ visitPlaceholderName(internalName) { if (!internalName || this.internalToPublic.hasOwnProperty(internalName)) { return; } let /** @type {?} */ publicName = this.mapName(internalName); if (this.publicToInternal.hasOwnProperty(publicName)) { // Create a new XMB when it has already been used const /** @type {?} */ nextId = this.publicToNextId[publicName]; this.publicToNextId[publicName] = nextId + 1; publicName = `${publicName}_${nextId}`; } else { this.publicToNextId[publicName] = 1; } this.internalToPublic[internalName] = publicName; this.publicToInternal[publicName] = internalName; } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @record */ class _Visitor$1 { /** * @param {?} tag * @return {?} */ visitTag(tag) { const /** @type {?} */ strAttrs = this._serializeAttributes(tag.attrs); if (tag.children.length == 0) { return `<${tag.name}${strAttrs}/>`; } const /** @type {?} */ strChildren = tag.children.map(node => node.visit(this)); return `<${tag.name}${strAttrs}>${strChildren.join('')}</${tag.name}>`; } /** * @param {?} text * @return {?} */ visitText(text) { return text.value; } /** * @param {?} decl * @return {?} */ visitDeclaration(decl) { return `<?xml${this._serializeAttributes(decl.attrs)} ?>`; } /** * @param {?} attrs * @return {?} */ _serializeAttributes(attrs) { const /** @type {?} */ strAttrs = Object.keys(attrs).map((name) => `${name}="${attrs[name]}"`).join(' '); return strAttrs.length > 0 ? ' ' + strAttrs : ''; } /** * @param {?} doctype * @return {?} */ visitDoctype(doctype) { return `<!DOCTYPE ${doctype.rootTag} [\n${doctype.dtd}\n]>`; } } const _visitor = new _Visitor$1(); /** * @param {?} nodes * @return {?} */ function serialize(nodes) { return nodes.map((node) => node.visit(_visitor)).join(''); } /** * @record */ class Declaration { /** * @param {?} unescapedAttrs */ constructor(unescapedAttrs) { this.attrs = {}; Object.keys(unescapedAttrs).forEach((k) => { this.attrs[k] = escapeXml(unescapedAttrs[k]); }); } /** * @param {?} visitor * @return {?} */ visit(visitor) { return visitor.visitDeclaration(this); } } class Doctype { /** * @param {?} rootTag * @param {?} dtd */ constructor(rootTag, dtd) { this.rootTag = rootTag; this.dtd = dtd; } /** * @param {?} visitor * @return {?} */ visit(visitor) { return visitor.visitDoctype(this); } } class Tag { /** * @param {?} name * @param {?=} unescapedAttrs * @param {?=} children */ constructor(name, unescapedAttrs = {}, children = []) { this.name = name; this.children = children; this.attrs = {}; Object.keys(unescapedAttrs).forEach((k) => { this.attrs[k] = escapeXml(unescapedAttrs[k]); }); } /** * @param {?} visitor * @return {?} */ visit(visitor) { return visitor.visitTag(this); } } class Text$2 { /** * @param {?} unescapedValue */ constructor(unescapedValue) { this.value = escapeXml(unescapedValue); } /** * @param {?} visitor * @return {?} */ visit(visitor) { return visitor.visitText(this); } } class CR extends Text$2 { /** * @param {?=} ws */ constructor(ws = 0) { super(`\n${new Array(ws + 1).join(' ')}`); } } const _ESCAPED_CHARS = [ [/&/g, '&'], [/"/g, '"'], [/'/g, '''], [/</g, '<'], [/>/g, '>'], ]; /** * @param {?} text * @return {?} */ function escapeXml(text) { return _ESCAPED_CHARS.reduce((text, entry) => text.replace(entry[0], entry[1]), text); } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ const _VERSION = '1.2'; const _XMLNS = 'urn:oasis:names:tc:xliff:document:1.2'; // TODO(vicb): make this a param (s/_/-/) const _DEFAULT_SOURCE_LANG = 'en'; const _PLACEHOLDER_TAG = 'x'; const _MARKER_TAG = 'mrk'; const _FILE_TAG = 'file'; const _SOURCE_TAG = 'source'; const _SEGMENT_SOURCE_TAG = 'seg-source'; const _TARGET_TAG = 'target'; const _UNIT_TAG = 'trans-unit'; const _CONTEXT_GROUP_TAG = 'context-group'; const _CONTEXT_TAG = 'context'; class Xliff extends Serializer { /** * @param {?} messages * @param {?} locale * @return {?} */ write(messages, locale) { const /** @type {?} */ visitor = new _WriteVisitor(); const /** @type {?} */ transUnits = []; messages.forEach(message => { let /** @type {?} */ contextTags = []; message.sources.forEach((source) => { let /** @type {?} */ contextGroupTag = new Tag(_CONTEXT_GROUP_TAG, { purpose: 'location' }); contextGroupTag.children.push(new CR(10), new Tag(_CONTEXT_TAG, { 'context-type': 'sourcefile' }, [new Text$2(source.filePath)]), new CR(10), new Tag(_CONTEXT_TAG, { 'context-type': 'linenumber' }, [new Text$2(`${source.startLine}`)]), new CR(8)); contextTags.push(new CR(8), contextGroupTag); }); const /** @type {?} */ transUnit = new Tag(_UNIT_TAG, { id: message.id, datatype: 'html' }); transUnit.children.push(new CR(8), new Tag(_SOURCE_TAG, {}, visitor.serialize(message.nodes)), ...contextTags); if (message.description) { transUnit.children.push(new CR(8), new Tag('note', { priority: '1', from: 'description' }, [new Text$2(message.description)])); } if (message.meaning) { transUnit.children.push(new CR(8), new Tag('note', { priority: '1', from: 'meaning' }, [new Text$2(message.meaning)])); } transUnit.children.push(new CR(6)); transUnits.push(new CR(6), transUnit); }); const /** @type {?} */ body = new Tag('body', {}, [...transUnits, new CR(4)]); const /** @type {?} */ file = new Tag('file', { 'source-language': locale || _DEFAULT_SOURCE_LANG, datatype: 'plaintext', original: 'ng2.template', }, [new CR(4), body, new CR(2)]); const /** @type {?} */ xliff = new Tag('xliff', { version: _VERSION, xmlns: _XMLNS }, [new CR(2), file, new CR()]); return serialize([ new Declaration({ version: '1.0', encoding: 'UTF-8' }), new CR(), xliff, new CR() ]); } /** * @param {?} content * @param {?} url * @return {?} */ load(content, url) { // xliff to xml nodes const /** @type {?} */ xliffParser = new XliffParser(); const { locale, msgIdToHtml, errors } = xliffParser.parse(content, url); // xml nodes to i18n nodes const /** @type {?} */ i18nNodesByMsgId = {}; const /** @type {?} */ converter = new XmlToI18n(); Object.keys(msgIdToHtml).forEach(msgId => { const { i18nNodes, errors: e } = converter.convert(msgIdToHtml[msgId], url); errors.push(...e); i18nNodesByMsgId[msgId] = i18nNodes; }); if (errors.length) { throw new Error(`xliff parse errors:\n${errors.join('\n')}`); } return { locale: /** @type {?} */ ((locale)), i18nNodesByMsgId }; } /** * @param {?} message * @return {?} */ digest(message) { return digest(message); } } class _WriteVisitor { /** * @param {?} text * @param {?=} context * @return {?} */ visitText(text, context) { return [new Text$2(text.value)]; } /** * @param {?} container * @param {?=} context * @return {?} */ visitContainer(container, context) { const /** @type {?} */ nodes = []; container.children.forEach((node) => nodes.push(...node.visit(this))); return nodes; } /** * @param {?} icu * @param {?=} context * @return {?} */ visitIcu(icu, context) { const /** @type {?} */ nodes = [new Text$2(`{${icu.expressionPlaceholder}, ${icu.type}, `)]; Object.keys(icu.cases).forEach((c) => { nodes.push(new Text$2(`${c} {`), ...icu.cases[c].visit(this), new Text$2(`} `)); }); nodes.push(new Text$2(`}`)); return nodes; } /** * @param {?} ph * @param {?=} context * @return {?} */ visitTagPlaceholder(ph, context) { const /** @type {?} */ ctype = getCtypeForTag(ph.tag); if (ph.isVoid) { // void tags have no children nor closing tags return [new Tag(_PLACEHOLDER_TAG, { id: ph.startName, ctype, 'equiv-text': `<${ph.tag}/>` })]; } const /** @type {?} */ startTagPh = new Tag(_PLACEHOLDER_TAG, { id: ph.startName, ctype, 'equiv-text': `<${ph.tag}>` }); const /** @type {?} */ closeTagPh = new Tag(_PLACEHOLDER_TAG, { id: ph.closeName, ctype, 'equiv-text': `</${ph.tag}>` }); return [startTagPh, ...this.serialize(ph.children), closeTagPh]; } /** * @param {?} ph * @param {?=} context * @return {?} */ visitPlaceholder(ph, context) { return [new Tag(_PLACEHOLDER_TAG, { id: ph.name, 'equiv-text': `{{${ph.value}}}` })]; } /** * @param {?} ph * @param {?=} context * @return {?} */ visitIcuPlaceholder(ph, context) { const /** @type {?} */ equivText = `{${ph.value.expression}, ${ph.value.type}, ${Object.keys(ph.value.cases).map((value) => value + ' {...}').join(' ')}}`; return [new Tag(_PLACEHOLDER_TAG, { id: ph.name, 'equiv-text': equivText })]; } /** * @param {?} nodes * @return {?} */ serialize(nodes) { return [].concat(...nodes.map(node => node.visit(this))); } } class XliffParser { constructor() { this._locale = null; } /** * @param {?} xliff * @param {?} url * @return {?} */ parse(xliff, url) { this._unitMlString = null; this._msgIdToHtml = {}; const /** @type {?} */ xml = new XmlParser().parse(xliff, url, false); this._errors = xml.errors; visitAll(this, xml.rootNodes, null); return { msgIdToHtml: this._msgIdToHtml, errors: this._errors, locale: this._locale, }; } /** * @param {?} element * @param {?} context * @return {?} */ visitElement(element, context) { switch (element.name) { case _UNIT_TAG: this._unitMlString = /** @type {?} */ ((null)); const /** @type {?} */ idAttr = element.attrs.find((attr) => attr.name === 'id'); if (!idAttr) { this._addError(element, `<${_UNIT_TAG}> misses the "id" attribute`); } else { const /** @type {?} */ id = idAttr.value; if (this._msgIdToHtml.hasOwnProperty(id)) { this._addError(element, `Duplicated translations for msg ${id}`); } else { visitAll(this, element.children, null); if (typeof this._unitMlString === 'string') { this._msgIdToHtml[id] = this._unitMlString; } else { this._addError(element, `Message ${id} misses a translation`); } } } break; // ignore those tags case _SOURCE_TAG: case _SEGMENT_SOURCE_TAG: break; case _TARGET_TAG: const /** @type {?} */ innerTextStart = /** @type {?} */ ((element.startSourceSpan)).end.offset; const /** @type {?} */ innerTextEnd = /** @type {?} */ ((element.endSourceSpan)).start.offset; const /** @type {?} */ content = /** @type {?} */ ((element.startSourceSpan)).start.file.content; const /** @type {?} */ innerText = content.slice(innerTextStart, innerTextEnd); this._unitMlString = innerText; break; case _FILE_TAG: const /** @type {?} */ localeAttr = element.attrs.find((attr) => attr.name === 'target-language'); if (localeAttr) { this._locale = localeAttr.value; } visitAll(this, element.children, null); break; default: // TODO(vicb): assert file structure, xliff version // For now only recurse on unhandled nodes visitAll(this, element.children, null); } } /** * @param {?} attribute * @param {?} context * @return {?} */ visitAttribute(attribute, context) { } /** * @param {?} text * @param {?} context * @return {?} */ visitText(text, context) { } /** * @param {?} comment * @param {?} context * @return {?} */ visitComment(comment, context) { } /** * @param {?} expansion * @param {?} context * @return {?} */ visitExpansion(expansion, context) { } /** * @param {?} expansionCase * @param {?} context * @return {?} */ visitExpansionCase(expansionCase, context) { } /** * @param {?} node * @param {?} message * @return {?} */ _addError(node, message) { this._errors.push(new I18nError(/** @type {?} */ ((node.sourceSpan)), message)); } } class XmlToI18n { /** * @param {?} message * @param {?} url * @return {?} */ convert(message, url) { const /** @type {?} */ xmlIcu = new XmlParser().parse(message, url, true); this._errors = xmlIcu.errors; const /** @type {?} */ i18nNodes = this._errors.length > 0 || xmlIcu.rootNodes.length == 0 ? [] : [].concat(...visitAll(this, xmlIcu.rootNodes)); return { i18nNodes: i18nNodes, errors: this._errors, }; } /** * @param {?} text * @param {?} context * @return {?} */ visitText(text, context) { return new Text$1(text.value, /** @type {?} */ ((text.sourceSpan))); } /** * @param {?} el * @param {?} context * @return {?} */ visitElement(el, context) { if (el.name === _PLACEHOLDER_TAG) { const /** @type {?} */ nameAttr = el.attrs.find((attr) => attr.name === 'id'); if (nameAttr) { return new Placeholder('', nameAttr.value, /** @type {?} */ ((el.sourceSpan))); } this._addError(el, `<${_PLACEHOLDER_TAG}> misses the "id" attribute`); return null; } if (el.name === _MARKER_TAG) { return [].concat(...visitAll(this, el.children)); } this._addError(el, `Unexpected tag`); return null; } /** * @param {?} icu * @param {?} context * @return {?} */ visitExpansion(icu, context) { const /** @type {?} */ caseMap = {}; visitAll(this, icu.cases).forEach((c) => { caseMap[c.value] = new Container(c.nodes, icu.sourceSpan); }); return new Icu(icu.switchValue, icu.type, caseMap, icu.sourceSpan); } /** * @param {?} icuCase * @param {?} context * @return {?} */ visitExpansionCase(icuCase, context) { return { value: icuCase.value, nodes: visitAll(this, icuCase.expression), }; } /** * @param {?} comment * @param {?} context * @return {?} */ visitComment(comment, context) { } /** * @param {?} attribute * @param {?} context * @return {?} */ visitAttribute(attribute, context) { } /** * @param {?} node * @param {?} message * @return {?} */ _addError(node, message) { this._errors.push(new I18nError(/** @type {?} */ ((node.sourceSpan)), message)); } } /** * @param {?} tag * @return {?} */ function getCtypeForTag(tag) { switch (tag.toLowerCase()) { case 'br': return 'lb'; case 'img': return 'image'; default: return `x-${tag}`; } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ const _VERSION$1 = '2.0'; const _XMLNS$1 = 'urn:oasis:names:tc:xliff:document:2.0'; // TODO(vicb): make this a param (s/_/-/) const _DEFAULT_SOURCE_LANG$1 = 'en'; const _PLACEHOLDER_TAG$1 = 'ph'; const _PLACEHOLDER_SPANNING_TAG = 'pc'; const _MARKER_TAG$1 = 'mrk'; const _XLIFF_TAG = 'xliff'; const _SOURCE_TAG$1 = 'source'; const _TARGET_TAG$1 = 'target'; const _UNIT_TAG$1 = 'unit'; class Xliff2 extends Serializer { /** * @param {?} messages * @param {?} locale * @return {?} */ write(messages, locale) { const /** @type {?} */ visitor = new _WriteVisitor$1(); const /** @type {?} */ units = []; messages.forEach(message => { const /** @type {?} */ unit = new Tag(_UNIT_TAG$1, { id: message.id }); const /** @type {?} */ notes = new Tag('notes'); if (message.description || message.meaning) { if (message.description) { notes.children.push(new CR(8), new Tag('note', { category: 'description' }, [new Text$2(message.description)])); } if (message.meaning) { notes.children.push(new CR(8), new Tag('note', { category: 'meaning' }, [new Text$2(message.meaning)])); } } message.sources.forEach((source) => { notes.children.push(new CR(8), new Tag('note', { category: 'location' }, [ new Text$2(`${source.filePath}:${source.startLine}${source.endLine !== source.startLine ? ',' + source.endLine : ''}`) ])); }); notes.children.push(new CR(6)); unit.children.push(new CR(6), notes); const /** @type {?} */ segment = new Tag('segment'); segment.children.push(new CR(8), new Tag(_SOURCE_TAG$1, {}, visitor.serialize(message.nodes)), new CR(6)); unit.children.push(new CR(6), segment, new CR(4)); units.push(new CR(4), unit); }); const /** @type {?} */ file = new Tag('file', { 'original': 'ng.template', id: 'ngi18n' }, [...units, new CR(2)]); const /** @type {?} */ xliff = new Tag(_XLIFF_TAG, { version: _VERSION$1, xmlns: _XMLNS$1, srcLang: locale || _DEFAULT_SOURCE_LANG$1 }, [new CR(2), file, new CR()]); return serialize([ new Declaration({ version: '1.0', encoding: 'UTF-8' }), new CR(), xliff, new CR() ]); } /** * @param {?} content * @param {?} url * @return {?} */ load(content, url) { // xliff to xml nodes const /** @type {?} */ xliff2Parser = new Xliff2Parser(); const { locale, msgIdToHtml, errors } = xliff2Parser.parse(content, url); // xml nodes to i18n nodes const /** @type {?} */ i18nNodesByMsgId = {}; const /** @type {?} */ converter = new XmlToI18n$1(); Object.keys(msgIdToHtml).forEach(msgId => { const { i18nNodes, errors: e } = converter.convert(msgIdToHtml[msgId], url); errors.push(...e); i18nNodesByMsgId[msgId] = i18nNodes; }); if (errors.length) { throw new Error(`xliff2 parse errors:\n${errors.join('\n')}`); } return { locale: /** @type {?} */ ((locale)), i18nNodesByMsgId }; } /** * @param {?} message * @return {?} */ digest(message) { return decimalDigest(message); } } class _WriteVisitor$1 { /** * @param {?} text * @param {?=} context * @return {?} */ visitText(text, context) { return [new Text$2(text.value)]; } /** * @param {?} container * @param {?=} context * @return {?} */ visitContainer(container, context) { const /** @type {?} */ nodes = []; container.children.forEach((node) => nodes.push(...node.visit(this))); return nodes; } /** * @param {?} icu * @param {?=} context * @return {?} */ visitIcu(icu, context) { const /** @type {?} */ nodes = [new Text$2(`{${icu.expressionPlaceholder}, ${icu.type}, `)]; Object.keys(icu.cases).forEach((c) => { nodes.push(new Text$2(`${c} {`), ...icu.cases[c].visit(this), new Text$2(`} `)); }); nodes.push(new Text$2(`}`)); return nodes; } /** * @param {?} ph * @param {?=} context * @return {?} */ visitTagPlaceholder(ph, context) { const /** @type {?} */ type = getTypeForTag(ph.tag); if (ph.isVoid) { const /** @type {?} */ tagPh = new Tag(_PLACEHOLDER_TAG$1, { id: (this._nextPlaceholderId++).toString(), equiv: ph.startName, type: type, disp: `<${ph.tag}/>`, }); return [tagPh]; } const /** @type {?} */ tagPc = new Tag(_PLACEHOLDER_SPANNING_TAG, { id: (this._nextPlaceholderId++).toString(), equivStart: ph.startName, equivEnd: ph.closeName, type: type, dispStart: `<${ph.tag}>`, dispEnd: `</${ph.tag}>`, }); const /** @type {?} */ nodes = [].concat(...ph.children.map(node => node.visit(this))); if (nodes.length) { nodes.forEach((node) => tagPc.children.push(node)); } else { tagPc.children.push(new Text$2('')); } return [tagPc]; } /** * @param {?} ph * @param {?=} context * @return {?} */ visitPlaceholder(ph, context) { const /** @type {?} */ idStr = (this._nextPlaceholderId++).toString(); return [new Tag(_PLACEHOLDER_TAG$1, { id: idStr, equiv: ph.name, disp: `{{${ph.value}}}`, })]; } /** * @param {?} ph * @param {?=} context * @return {?} */ visitIcuPlaceholder(ph, context) { const /** @type {?} */ cases = Object.keys(ph.value.cases).map((value) => value + ' {...}').join(' '); const /** @type {?} */ idStr = (this._nextPlaceholderId++).toString(); return [new Tag(_PLACEHOLDER_TAG$1, { id: idStr, equiv: ph.name, disp: `{${ph.value.expression}, ${ph.value.type}, ${cases}}` })]; } /** * @param {?} nodes * @return {?} */ serialize(nodes) { this._nextPlaceholderId = 0; return [].concat(...nodes.map(node => node.visit(this))); } } class Xliff2Parser { constructor() { this._locale = null; } /** * @param {?} xliff * @param {?} url * @return {?} */ parse(xliff, url) { this._unitMlString = null; this._msgIdToHtml = {}; const /** @type {?} */ xml = new XmlParser().parse(xliff, url, false); this._errors = xml.errors; visitAll(this, xml.rootNodes, null); return { msgIdToHtml: this._msgIdToHtml, errors: this._errors, locale: this._locale, }; } /** * @param {?} element * @param {?} context * @return {?} */ visitElement(element, context) { switch (element.name) { case _UNIT_TAG$1: this._unitMlString = null; const /** @type {?} */ idAttr = element.attrs.find((attr) => attr.name === 'id'); if (!idAttr) { this._addError(element, `<${_UNIT_TAG$1}> misses the "id" attribute`); } else { const /** @type {?} */ id = idAttr.value; if (this._msgIdToHtml.hasOwnProperty(id)) { this._addError(element, `Duplicated translations for msg ${id}`); } else { visitAll(this, element.children, null); if (typeof this._unitMlString === 'string') { this._msgIdToHtml[id] = this._unitMlString; } else { this._addError(element, `Message ${id} misses a translation`); } } } break; case _SOURCE_TAG$1: // ignore source message break; case _TARGET_TAG$1: const /** @type {?} */ innerTextStart = /** @type {?} */ ((element.startSourceSpan)).end.offset; const /** @type {?} */ innerTextEnd = /** @type {?} */ ((element.endSourceSpan)).start.offset; const /** @type {?} */ content = /** @type {?} */ ((element.startSourceSpan)).start.file.content; const /** @type {?} */ innerText = content.slice(innerTextStart, innerTextEnd); this._unitMlString = innerText; break; case _XLIFF_TAG: const /** @type {?} */ localeAttr = element.attrs.find((attr) => attr.name === 'trgLang'); if (localeAttr) { this._locale = localeAttr.value; } const /** @type {?} */ versionAttr = element.attrs.find((attr) => attr.name === 'version'); if (versionAttr) { const /** @type {?} */ version = versionAttr.value; if (version !== '2.0') { this._addError(element, `The XLIFF file version ${version} is not compatible with XLIFF 2.0 serializer`); } else { visitAll(this, element.children, null); } } break; default: visitAll(this, element.children, null); } } /** * @param {?} attribute * @param {?} context * @return {?} */ visitAttribute(attribute, context) { } /** * @param {?} text * @param {?} context * @return {?} */ visitText(text, context) { } /** * @param {?} comment * @param {?} context * @return {?} */ visitComment(comment, context) { } /** * @param {?} expansion * @param {?} context * @return {?} */ visitExpansion(expansion, context) { } /** * @param {?} expansionCase * @param {?} context * @return {?} */ visitExpansionCase(expansionCase, context) { } /** * @param {?} node * @param {?} message * @return {?} */ _addError(node, message) { this._errors.push(new I18nError(node.sourceSpan, message)); } } class XmlToI18n$1 { /** * @param {?} message * @param {?} url * @return {?} */ convert(message, url) { const /** @type {?} */ xmlIcu = new XmlParser().parse(message, url, true); this._errors = xmlIcu.errors; const /** @type {?} */ i18nNodes = this._errors.length > 0 || xmlIcu.rootNodes.length == 0 ? [] : [].concat(...visitAll(this, xmlIcu.rootNodes)); return { i18nNodes, errors: this._errors, }; } /** * @param {?} text * @param {?} context * @return {?} */ visitText(text, context) { return new Text$1(text.value, text.sourceSpan); } /** * @param {?} el * @param {?} context * @return {?} */ visitElement(el, context) { switch (el.name) { case _PLACEHOLDER_TAG$1: const /** @type {?} */ nameAttr = el.attrs.find((attr) => attr.name === 'equiv'); if (nameAttr) { return [new Placeholder('', nameAttr.value, el.sourceSpan)]; } this._addError(el, `<${_PLACEHOLDER_TAG$1}> misses the "equiv" attribute`); break; case _PLACEHOLDER_SPANNING_TAG: const /** @type {?} */ startAttr = el.attrs.find((attr) => attr.name === 'equivStart'); const /** @type {?} */ endAttr = el.attrs.find((attr) => attr.name === 'equivEnd'); if (!startAttr) { this._addError(el, `<${_PLACEHOLDER_TAG$1}> misses the "equivStart" attribute`); } else if (!endAttr) { this._addError(el, `<${_PLACEHOLDER_TAG$1}> misses the "equivEnd" attribute`); } else { const /** @type {?} */ startId = startAttr.value; const /** @type {?} */ endId = endAttr.value; const /** @type {?} */ nodes = []; return nodes.concat(new Placeholder('', startId, el.sourceSpan), ...el.children.map(node => node.visit(this, null)), new Placeholder('', endId, el.sourceSpan)); } break; case _MARKER_TAG$1: return [].concat(...visitAll(this, el.children)); default: this._addError(el, `Unexpected tag`); } return null; } /** * @param {?} icu * @param {?} context * @return {?} */ visitExpansion(icu, context) { const /** @type {?} */ caseMap = {}; visitAll(this, icu.cases).forEach((c) => { caseMap[c.value] = new Container(c.nodes, icu.sourceSpan); }); return new Icu(icu.switchValue, icu.type, caseMap, icu.sourceSpan); } /** * @param {?} icuCase * @param {?} context * @return {?} */ visitExpansionCase(icuCase, context) { return { value: icuCase.value, nodes: [].concat(...visitAll(this, icuCase.expression)), }; } /** * @param {?} comment * @param {?} context * @return {?} */ visitComment(comment, context) { } /** * @param {?} attribute * @param {?} context * @return {?} */ visitAttribute(attribute, context) { } /** * @param {?} node * @param {?} message * @return {?} */ _addError(node, message) { this._errors.push(new I18nError(node.sourceSpan, message)); } } /** * @param {?} tag * @return {?} */ function getTypeForTag(tag) { switch (tag.toLowerCase()) { case 'br': case 'b': case 'i': case 'u': return 'fmt'; case 'img': return 'image'; case 'a': return 'link'; default: return 'other'; } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ const _MESSAGES_TAG = 'messagebundle'; const _MESSAGE_TAG = 'msg'; const _PLACEHOLDER_TAG$2 = 'ph'; const _EXEMPLE_TAG = 'ex'; const _SOURCE_TAG$2 = 'source'; const _DOCTYPE = `<!ELEMENT messagebundle (msg)*> <!ATTLIST messagebundle class CDATA #IMPLIED> <!ELEMENT msg (#PCDATA|ph|source)*> <!ATTLIST msg id CDATA #IMPLIED> <!ATTLIST msg seq CDATA #IMPLIED> <!ATTLIST msg name CDATA #IMPLIED> <!ATTLIST msg desc CDATA #IMPLIED> <!ATTLIST msg meaning CDATA #IMPLIED> <!ATTLIST msg obsolete (obsolete) #IMPLIED> <!ATTLIST msg xml:space (default|preserve) "default"> <!ATTLIST msg is_hidden CDATA #IMPLIED> <!ELEMENT source (#PCDATA)> <!ELEMENT ph (#PCDATA|ex)*> <!ATTLIST ph name CDATA #REQUIRED> <!ELEMENT ex (#PCDATA)>`; class Xmb extends Serializer { /** * @param {?} messages * @param {?} locale * @return {?} */ write(messages, locale) { const /** @type {?} */ exampleVisitor = new ExampleVisitor(); const /** @type {?} */ visitor = new _Visitor$2(); let /** @type {?} */ rootNode = new Tag(_MESSAGES_TAG); messages.forEach(message => { const /** @type {?} */ attrs = { id: message.id }; if (message.description) { attrs['desc'] = message.description; } if (message.meaning) { attrs['meaning'] = message.meaning; } let /** @type {?} */ sourceTags = []; message.sources.forEach((source) => { sourceTags.push(new Tag(_SOURCE_TAG$2, {}, [ new Text$2(`${source.filePath}:${source.startLine}${source.endLine !== source.startLine ? ',' + source.endLine : ''}`) ])); }); rootNode.children.push(new CR(2), new Tag(_MESSAGE_TAG, attrs, [...sourceTags, ...visitor.serialize(message.nodes)])); }); rootNode.children.push(new CR()); return serialize([ new Declaration({ version: '1.0', encoding: 'UTF-8' }), new CR(), new Doctype(_MESSAGES_TAG, _DOCTYPE), new CR(), exampleVisitor.addDefaultExamples(rootNode), new CR(), ]); } /** * @param {?} content * @param {?} url * @return {?} */ load(content, url) { throw new Error('Unsupported'); } /** * @param {?} message * @return {?} */ digest(message) { return digest$1(message); } /** * @param {?} message * @return {?} */ createNameMapper(message) { return new SimplePlaceholderMapper(message, toPublicName); } } class _Visitor$2 { /** * @param {?} text * @param {?=} context * @return {?} */ visitText(text, context) { return [new Text$2(text.value)]; } /** * @param {?} container * @param {?} context * @return {?} */ visitContainer(container, context) { const /** @type {?} */ nodes = []; container.children.forEach((node) => nodes.push(...node.visit(this))); return nodes; } /** * @param {?} icu * @param {?=} context * @return {?} */ visitIcu(icu, context) { const /** @type {?} */ nodes = [new Text$2(`{${icu.expressionPlaceholder}, ${icu.type}, `)]; Object.keys(icu.cases).forEach((c) => { nodes.push(new Text$2(`${c} {`), ...icu.cases[c].visit(this), new Text$2(`} `)); }); nodes.push(new Text$2(`}`)); return nodes; } /** * @param {?} ph * @param {?=} context * @return {?} */ visitTagPlaceholder(ph, context) { const /** @type {?} */ startEx = new Tag(_EXEMPLE_TAG, {}, [new Text$2(`<${ph.tag}>`)]); const /** @type {?} */ startTagPh = new Tag(_PLACEHOLDER_TAG$2, { name: ph.startName }, [startEx]); if (ph.isVoid) { // void tags have no children nor closing tags return [startTagPh]; } const /** @type {?} */ closeEx = new Tag(_EXEMPLE_TAG, {}, [new Text$2(`</${ph.tag}>`)]); const /** @type {?} */ closeTagPh = new Tag(_PLACEHOLDER_TAG$2, { name: ph.closeName }, [closeEx]); return [startTagPh, ...this.serialize(ph.children), closeTagPh]; } /** * @param {?} ph * @param {?=} context * @return {?} */ visitPlaceholder(ph, context) { const /** @type {?} */ exTag = new Tag(_EXEMPLE_TAG, {}, [new Text$2(`{{${ph.value}}}`)]); return [new Tag(_PLACEHOLDER_TAG$2, { name: ph.name }, [exTag])]; } /** * @param {?} ph * @param {?=} context * @return {?} */ visitIcuPlaceholder(ph, context) { const /** @type {?} */ exTag = new Tag(_EXEMPLE_TAG, {}, [ new Text$2(`{${ph.value.expression}, ${ph.value.type}, ${Object.keys(ph.value.cases).map((value) => value + ' {...}').join(' ')}}`) ]); return [new Tag(_PLACEHOLDER_TAG$2, { name: ph.name }, [exTag])]; } /** * @param {?} nodes * @return {?} */ serialize(nodes) { return [].concat(...nodes.map(node => node.visit(this))); } } /** * @param {?} message * @return {?} */ function digest$1(message) { return decimalDigest(message); } class ExampleVisitor { /** * @param {?} node * @return {?} */ addDefaultExamples(node) { node.visit(this); return node; } /** * @param {?} tag * @return {?} */ visitTag(tag) { if (tag.name === _PLACEHOLDER_TAG$2) { if (!tag.children || tag.children.length == 0) { const /** @type {?} */ exText = new Text$2(tag.attrs['name'] || '...'); tag.children = [new Tag(_EXEMPLE_TAG, {}, [exText])]; } } else if (tag.children) { tag.children.forEach(node => node.visit(this)); } } /** * @param {?} text * @return {?} */ visitText(text) { } /** * @param {?} decl * @return {?} */ visitDeclaration(decl) { } /** * @param {?} doctype * @return {?} */ visitDoctype(doctype) { } } /** * @param {?} internalName * @return {?} */ function toPublicName(internalName) { return internalName.toUpperCase().replace(/[^A-Z0-9_]/g, '_'); } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ const _TRANSLATIONS_TAG = 'translationbundle'; const _TRANSLATION_TAG = 'translation'; const _PLACEHOLDER_TAG$3 = 'ph'; class Xtb extends Serializer { /** * @param {?} messages * @param {?} locale * @return {?} */ write(messages, locale) { throw new Error('Unsupported'); } /** * @param {?} content * @param {?} url * @return {?} */ load(content, url) { // xtb to xml nodes const /** @type {?} */ xtbParser = new XtbParser(); const { locale, msgIdToHtml, errors } = xtbParser.parse(content, url); // xml nodes to i18n nodes const /** @type {?} */ i18nNodesByMsgId = {}; const /** @type {?} */ converter = new XmlToI18n$2(); // Because we should be able to load xtb files that rely on features not supported by angular, // we need to delay the conversion of html to i18n nodes so that non angular messages are not // converted Object.keys(msgIdToHtml).forEach(msgId => { const /** @type {?} */ valueFn = function () { const { i18nNodes, errors } = converter.convert(msgIdToHtml[msgId], url); if (errors.length) { throw new Error(`xtb parse errors:\n${errors.join('\n')}`); } return i18nNodes; }; createLazyProperty(i18nNodesByMsgId, msgId, valueFn); }); if (errors.length) { throw new Error(`xtb parse errors:\n${errors.join('\n')}`); } return { locale: /** @type {?} */ ((locale)), i18nNodesByMsgId }; } /** * @param {?} message * @return {?} */ digest(message) { return digest$1(message); } /** * @param {?} message * @return {?} */ createNameMapper(message) { return new SimplePlaceholderMapper(message, toPublicName); } } /** * @param {?} messages * @param {?} id * @param {?} valueFn * @return {?} */ function createLazyProperty(messages, id, valueFn) { Object.defineProperty(messages, id, { configurable: true, enumerable: true, get: function () { const /** @type {?} */ value = valueFn(); Object.defineProperty(messages, id, { enumerable: true, value }); return value; }, set: _ => { throw new Error('Could not overwrite an XTB translation'); }, }); } class XtbParser { constructor() { this._locale = null; } /** * @param {?} xtb * @param {?} url * @return {?} */ parse(xtb, url) { this._bundleDepth = 0; this._msgIdToHtml = {}; // We can not parse the ICU messages at this point as some messages might not originate // from Angular that could not be lex'd. const /** @type {?} */ xml = new XmlParser().parse(xtb, url, false); this._errors = xml.errors; visitAll(this, xml.rootNodes); return { msgIdToHtml: this._msgIdToHtml, errors: this._errors, locale: this._locale, }; } /** * @param {?} element * @param {?} context * @return {?} */ visitElement(element, context) { switch (element.name) { case _TRANSLATIONS_TAG: this._bundleDepth++; if (this._bundleDepth > 1) { this._addError(element, `<${_TRANSLATIONS_TAG}> elements can not be nested`); } const /** @type {?} */ langAttr = element.attrs.find((attr) => attr.name === 'lang'); if (langAttr) { this._locale = langAttr.value; } visitAll(this, element.children, null); this._bundleDepth--; break; case _TRANSLATION_TAG: const /** @type {?} */ idAttr = element.attrs.find((attr) => attr.name === 'id'); if (!idAttr) { this._addError(element, `<${_TRANSLATION_TAG}> misses the "id" attribute`); } else { const /** @type {?} */ id = idAttr.value; if (this._msgIdToHtml.hasOwnProperty(id)) { this._addError(element, `Duplicated translations for msg ${id}`); } else { const /** @type {?} */ innerTextStart = /** @type {?} */ ((element.startSourceSpan)).end.offset; const /** @type {?} */ innerTextEnd = /** @type {?} */ ((element.endSourceSpan)).start.offset; const /** @type {?} */ content = /** @type {?} */ ((element.startSourceSpan)).start.file.content; const /** @type {?} */ innerText = content.slice(/** @type {?} */ ((innerTextStart)), /** @type {?} */ ((innerTextEnd))); this._msgIdToHtml[id] = innerText; } } break; default: this._addError(element, 'Unexpected tag'); } } /** * @param {?} attribute * @param {?} context * @return {?} */ visitAttribute(attribute, context) { } /** * @param {?} text * @param {?} context * @return {?} */ visitText(text, context) { } /** * @param {?} comment * @param {?} context * @return {?} */ visitComment(comment, context) { } /** * @param {?} expansion * @param {?} context * @return {?} */ visitExpansion(expansion, context) { } /** * @param {?} expansionCase * @param {?} context * @return {?} */ visitExpansionCase(expansionCase, context) { } /** * @param {?} node * @param {?} message * @return {?} */ _addError(node, message) { this._errors.push(new I18nError(/** @type {?} */ ((node.sourceSpan)), message)); } } class XmlToI18n$2 { /** * @param {?} message * @param {?} url * @return {?} */ convert(message, url) { const /** @type {?} */ xmlIcu = new XmlParser().parse(message, url, true); this._errors = xmlIcu.errors; const /** @type {?} */ i18nNodes = this._errors.length > 0 || xmlIcu.rootNodes.length == 0 ? [] : visitAll(this, xmlIcu.rootNodes); return { i18nNodes, errors: this._errors, }; } /** * @param {?} text * @param {?} context * @return {?} */ visitText(text, context) { return new Text$1(text.value, /** @type {?} */ ((text.sourceSpan))); } /** * @param {?} icu * @param {?} context * @return {?} */ visitExpansion(icu, context) { const /** @type {?} */ caseMap = {}; visitAll(this, icu.cases).forEach(c => { caseMap[c.value] = new Container(c.nodes, icu.sourceSpan); }); return new Icu(icu.switchValue, icu.type, caseMap, icu.sourceSpan); } /** * @param {?} icuCase * @param {?} context * @return {?} */ visitExpansionCase(icuCase, context) { return { value: icuCase.value, nodes: visitAll(this, icuCase.expression), }; } /** * @param {?} el * @param {?} context * @return {?} */ visitElement(el, context) { if (el.name === _PLACEHOLDER_TAG$3) { const /** @type {?} */ nameAttr = el.attrs.find((attr) => attr.name === 'name'); if (nameAttr) { return new Placeholder('', nameAttr.value, /** @type {?} */ ((el.sourceSpan))); } this._addError(el, `<${_PLACEHOLDER_TAG$3}> misses the "name" attribute`); } else { this._addError(el, `Unexpected tag`); } return null; } /** * @param {?} comment * @param {?} context * @return {?} */ visitComment(comment, context) { } /** * @param {?} attribute * @param {?} context * @return {?} */ visitAttribute(attribute, context) { } /** * @param {?} node * @param {?} message * @return {?} */ _addError(node, message) { this._errors.push(new I18nError(/** @type {?} */ ((node.sourceSpan)), message)); } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ class HtmlParser extends Parser$1 { constructor() { super(getHtmlTagDefinition); } /** * @param {?} source * @param {?} url * @param {?=} parseExpansionForms * @param {?=} interpolationConfig * @return {?} */ parse(source, url, parseExpansionForms = false, interpolationConfig = DEFAULT_INTERPOLATION_CONFIG) { return super.parse(source, url, parseExpansionForms, interpolationConfig); } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * A container for translated messages */ class TranslationBundle { /** * @param {?=} _i18nNodesByMsgId * @param {?=} locale * @param {?=} digest * @param {?=} mapperFactory * @param {?=} missingTranslationStrategy * @param {?=} console */ constructor(_i18nNodesByMsgId = {}, locale, digest, mapperFactory, missingTranslationStrategy = MissingTranslationStrategy.Warning, console) { this._i18nNodesByMsgId = _i18nNodesByMsgId; this.digest = digest; this.mapperFactory = mapperFactory; this._i18nToHtml = new I18nToHtmlVisitor(_i18nNodesByMsgId, locale, digest, /** @type {?} */ ((mapperFactory)), missingTranslationStrategy, console); } /** * @param {?} content * @param {?} url * @param {?} serializer * @param {?} missingTranslationStrategy * @param {?=} console * @return {?} */ static load(content, url, serializer, missingTranslationStrategy, console) { const { locale, i18nNodesByMsgId } = serializer.load(content, url); const /** @type {?} */ digestFn = (m) => serializer.digest(m); const /** @type {?} */ mapperFactory = (m) => /** @type {?} */ ((serializer.createNameMapper(m))); return new TranslationBundle(i18nNodesByMsgId, locale, digestFn, mapperFactory, missingTranslationStrategy, console); } /** * @param {?} srcMsg * @return {?} */ get(srcMsg) { const /** @type {?} */ html = this._i18nToHtml.convert(srcMsg); if (html.errors.length) { throw new Error(html.errors.join('\n')); } return html.nodes; } /** * @param {?} srcMsg * @return {?} */ has(srcMsg) { return this.digest(srcMsg) in this._i18nNodesByMsgId; } } class I18nToHtmlVisitor { /** * @param {?=} _i18nNodesByMsgId * @param {?=} _locale * @param {?=} _digest * @param {?=} _mapperFactory * @param {?=} _missingTranslationStrategy * @param {?=} _console */ constructor(_i18nNodesByMsgId = {}, _locale, _digest, _mapperFactory, _missingTranslationStrategy, _console) { this._i18nNodesByMsgId = _i18nNodesByMsgId; this._locale = _locale; this._digest = _digest; this._mapperFactory = _mapperFactory; this._missingTranslationStrategy = _missingTranslationStrategy; this._console = _console; this._contextStack = []; this._errors = []; } /** * @param {?} srcMsg * @return {?} */ convert(srcMsg) { this._contextStack.length = 0; this._errors.length = 0; // i18n to text const /** @type {?} */ text = this._convertToText(srcMsg); // text to html const /** @type {?} */ url = srcMsg.nodes[0].sourceSpan.start.file.url; const /** @type {?} */ html = new HtmlParser().parse(text, url, true); return { nodes: html.rootNodes, errors: [...this._errors, ...html.errors], }; } /** * @param {?} text * @param {?=} context * @return {?} */ visitText(text, context) { // `convert()` uses an `HtmlParser` to return `html.Node`s // we should then make sure that any special characters are escaped return escapeXml(text.value); } /** * @param {?} container * @param {?=} context * @return {?} */ visitContainer(container, context) { return container.children.map(n => n.visit(this)).join(''); } /** * @param {?} icu * @param {?=} context * @return {?} */ visitIcu(icu, context) { const /** @type {?} */ cases = Object.keys(icu.cases).map(k => `${k} {${icu.cases[k].visit(this)}}`); // TODO(vicb): Once all format switch to using expression placeholders // we should throw when the placeholder is not in the source message const /** @type {?} */ exp = this._srcMsg.placeholders.hasOwnProperty(icu.expression) ? this._srcMsg.placeholders[icu.expression] : icu.expression; return `{${exp}, ${icu.type}, ${cases.join(' ')}}`; } /** * @param {?} ph * @param {?=} context * @return {?} */ visitPlaceholder(ph, context) { const /** @type {?} */ phName = this._mapper(ph.name); if (this._srcMsg.placeholders.hasOwnProperty(phName)) { return this._srcMsg.placeholders[phName]; } if (this._srcMsg.placeholderToMessage.hasOwnProperty(phName)) { return this._convertToText(this._srcMsg.placeholderToMessage[phName]); } this._addError(ph, `Unknown placeholder "${ph.name}"`); return ''; } /** * @param {?} ph * @param {?=} context * @return {?} */ visitTagPlaceholder(ph, context) { const /** @type {?} */ tag = `${ph.tag}`; const /** @type {?} */ attrs = Object.keys(ph.attrs).map(name => `${name}="${ph.attrs[name]}"`).join(' '); if (ph.isVoid) { return `<${tag} ${attrs}/>`; } const /** @type {?} */ children = ph.children.map((c) => c.visit(this)).join(''); return `<${tag} ${attrs}>${children}</${tag}>`; } /** * @param {?} ph * @param {?=} context * @return {?} */ visitIcuPlaceholder(ph, context) { // An ICU placeholder references the source message to be serialized return this._convertToText(this._srcMsg.placeholderToMessage[ph.name]); } /** * Convert a source message to a translated text string: * - text nodes are replaced with their translation, * - placeholders are replaced with their content, * - ICU nodes are converted to ICU expressions. * @param {?} srcMsg * @return {?} */ _convertToText(srcMsg) { const /** @type {?} */ id = this._digest(srcMsg); const /** @type {?} */ mapper = this._mapperFactory ? this._mapperFactory(srcMsg) : null; let /** @type {?} */ nodes; this._contextStack.push({ msg: this._srcMsg, mapper: this._mapper }); this._srcMsg = srcMsg; if (this._i18nNodesByMsgId.hasOwnProperty(id)) { // When there is a translation use its nodes as the source // And create a mapper to convert serialized placeholder names to internal names nodes = this._i18nNodesByMsgId[id]; this._mapper = (name) => mapper ? /** @type {?} */ ((mapper.toInternalName(name))) : name; } else { // When no translation has been found // - report an error / a warning / nothing, // - use the nodes from the original message // - placeholders are already internal and need no mapper if (this._missingTranslationStrategy === MissingTranslationStrategy.Error) { const /** @type {?} */ ctx = this._locale ? ` for locale "${this._locale}"` : ''; this._addError(srcMsg.nodes[0], `Missing translation for message "${id}"${ctx}`); } else if (this._console && this._missingTranslationStrategy === MissingTranslationStrategy.Warning) { const /** @type {?} */ ctx = this._locale ? ` for locale "${this._locale}"` : ''; this._console.warn(`Missing translation for message "${id}"${ctx}`); } nodes = srcMsg.nodes; this._mapper = (name) => name; } const /** @type {?} */ text = nodes.map(node => node.visit(this)).join(''); const /** @type {?} */ context = /** @type {?} */ ((this._contextStack.pop())); this._srcMsg = context.msg; this._mapper = context.mapper; return text; } /** * @param {?} el * @param {?} msg * @return {?} */ _addError(el, msg) { this._errors.push(new I18nError(el.sourceSpan, msg)); } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ class I18NHtmlParser { /** * @param {?} _htmlParser * @param {?=} translations * @param {?=} translationsFormat * @param {?=} missingTranslation * @param {?=} console */ constructor(_htmlParser, translations, translationsFormat, missingTranslation = MissingTranslationStrategy.Warning, console) { this._htmlParser = _htmlParser; if (translations) { const /** @type {?} */ serializer = createSerializer(translationsFormat); this._translationBundle = TranslationBundle.load(translations, 'i18n', serializer, missingTranslation, console); } else { this._translationBundle = new TranslationBundle({}, null, digest, undefined, missingTranslation, console); } } /** * @param {?} source * @param {?} url * @param {?=} parseExpansionForms * @param {?=} interpolationConfig * @return {?} */ parse(source, url, parseExpansionForms = false, interpolationConfig = DEFAULT_INTERPOLATION_CONFIG) { const /** @type {?} */ parseResult = this._htmlParser.parse(source, url, parseExpansionForms, interpolationConfig); if (parseResult.errors.length) { return new ParseTreeResult(parseResult.rootNodes, parseResult.errors); } return mergeTranslations(parseResult.rootNodes, this._translationBundle, interpolationConfig, [], {}); } } /** * @param {?=} format * @return {?} */ function createSerializer(format) { format = (format || 'xlf').toLowerCase(); switch (format) { case 'xmb': return new Xmb(); case 'xtb': return new Xtb(); case 'xliff2': case 'xlf2': return new Xliff2(); case 'xliff': case 'xlf': default: return new Xliff(); } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ const STRIP_SRC_FILE_SUFFIXES = /(\.ts|\.d\.ts|\.js|\.jsx|\.tsx)$/; const GENERATED_FILE = /\.ngfactory\.|\.ngsummary\./; const JIT_SUMMARY_FILE = /\.ngsummary\./; const JIT_SUMMARY_NAME = /NgSummary$/; /** * @param {?} filePath * @param {?=} forceSourceFile * @return {?} */ function ngfactoryFilePath(filePath, forceSourceFile = false) { const /** @type {?} */ urlWithSuffix = splitTypescriptSuffix(filePath, forceSourceFile); return `${urlWithSuffix[0]}.ngfactory${normalizeGenFileSuffix(urlWithSuffix[1])}`; } /** * @param {?} filePath * @return {?} */ function stripGeneratedFileSuffix(filePath) { return filePath.replace(GENERATED_FILE, '.'); } /** * @param {?} filePath * @return {?} */ function isGeneratedFile(filePath) { return GENERATED_FILE.test(filePath); } /** * @param {?} path * @param {?=} forceSourceFile * @return {?} */ function splitTypescriptSuffix(path, forceSourceFile = false) { if (path.endsWith('.d.ts')) { return [path.slice(0, -5), forceSourceFile ? '.ts' : '.d.ts']; } const /** @type {?} */ lastDot = path.lastIndexOf('.'); if (lastDot !== -1) { return [path.substring(0, lastDot), path.substring(lastDot)]; } return [path, '']; } /** * @param {?} srcFileSuffix * @return {?} */ function normalizeGenFileSuffix(srcFileSuffix) { return srcFileSuffix === '.tsx' ? '.ts' : srcFileSuffix; } /** * @param {?} fileName * @return {?} */ function summaryFileName(fileName) { const /** @type {?} */ fileNameWithoutSuffix = fileName.replace(STRIP_SRC_FILE_SUFFIXES, ''); return `${fileNameWithoutSuffix}.ngsummary.json`; } /** * @param {?} fileName * @param {?=} forceSourceFile * @return {?} */ function summaryForJitFileName(fileName, forceSourceFile = false) { const /** @type {?} */ urlWithSuffix = splitTypescriptSuffix(stripGeneratedFileSuffix(fileName), forceSourceFile); return `${urlWithSuffix[0]}.ngsummary${urlWithSuffix[1]}`; } /** * @param {?} filePath * @return {?} */ function stripSummaryForJitFileSuffix(filePath) { return filePath.replace(JIT_SUMMARY_FILE, '.'); } /** * @param {?} symbolName * @return {?} */ function summaryForJitName(symbolName) { return `${symbolName}NgSummary`; } /** * @param {?} symbolName * @return {?} */ function stripSummaryForJitNameSuffix(symbolName) { return symbolName.replace(JIT_SUMMARY_NAME, ''); } const LOWERED_SYMBOL = /\u0275\d+/; /** * @param {?} name * @return {?} */ function isLoweredSymbol(name) { return LOWERED_SYMBOL.test(name); } /** * @param {?} id * @return {?} */ function createLoweredSymbol(id) { return `\u0275${id}`; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ const CORE = '@angular/core'; class Identifiers { } Identifiers.ANALYZE_FOR_ENTRY_COMPONENTS = { name: 'ANALYZE_FOR_ENTRY_COMPONENTS', moduleName: CORE, }; Identifiers.ElementRef = { name: 'ElementRef', moduleName: CORE }; Identifiers.NgModuleRef = { name: 'NgModuleRef', moduleName: CORE }; Identifiers.ViewContainerRef = { name: 'ViewContainerRef', moduleName: CORE }; Identifiers.ChangeDetectorRef = { name: 'ChangeDetectorRef', moduleName: CORE, }; Identifiers.QueryList = { name: 'QueryList', moduleName: CORE }; Identifiers.TemplateRef = { name: 'TemplateRef', moduleName: CORE }; Identifiers.CodegenComponentFactoryResolver = { name: 'ɵCodegenComponentFactoryResolver', moduleName: CORE, }; Identifiers.ComponentFactoryResolver = { name: 'ComponentFactoryResolver', moduleName: CORE, }; Identifiers.ComponentFactory = { name: 'ComponentFactory', moduleName: CORE }; Identifiers.ComponentRef = { name: 'ComponentRef', moduleName: CORE }; Identifiers.NgModuleFactory = { name: 'NgModuleFactory', moduleName: CORE }; Identifiers.createModuleFactory = { name: 'ɵcmf', moduleName: CORE, }; Identifiers.moduleDef = { name: 'ɵmod', moduleName: CORE, }; Identifiers.moduleProviderDef = { name: 'ɵmpd', moduleName: CORE, }; Identifiers.RegisterModuleFactoryFn = { name: 'ɵregisterModuleFactory', moduleName: CORE, }; Identifiers.Injector = { name: 'Injector', moduleName: CORE }; Identifiers.ViewEncapsulation = { name: 'ViewEncapsulation', moduleName: CORE, }; Identifiers.ChangeDetectionStrategy = { name: 'ChangeDetectionStrategy', moduleName: CORE, }; Identifiers.SecurityContext = { name: 'SecurityContext', moduleName: CORE, }; Identifiers.LOCALE_ID = { name: 'LOCALE_ID', moduleName: CORE }; Identifiers.TRANSLATIONS_FORMAT = { name: 'TRANSLATIONS_FORMAT', moduleName: CORE, }; Identifiers.inlineInterpolate = { name: 'ɵinlineInterpolate', moduleName: CORE, }; Identifiers.interpolate = { name: 'ɵinterpolate', moduleName: CORE }; Identifiers.EMPTY_ARRAY = { name: 'ɵEMPTY_ARRAY', moduleName: CORE }; Identifiers.EMPTY_MAP = { name: 'ɵEMPTY_MAP', moduleName: CORE }; Identifiers.Renderer = { name: 'Renderer', moduleName: CORE }; Identifiers.viewDef = { name: 'ɵvid', moduleName: CORE }; Identifiers.elementDef = { name: 'ɵeld', moduleName: CORE }; Identifiers.anchorDef = { name: 'ɵand', moduleName: CORE }; Identifiers.textDef = { name: 'ɵted', moduleName: CORE }; Identifiers.directiveDef = { name: 'ɵdid', moduleName: CORE }; Identifiers.providerDef = { name: 'ɵprd', moduleName: CORE }; Identifiers.queryDef = { name: 'ɵqud', moduleName: CORE }; Identifiers.pureArrayDef = { name: 'ɵpad', moduleName: CORE }; Identifiers.pureObjectDef = { name: 'ɵpod', moduleName: CORE }; Identifiers.purePipeDef = { name: 'ɵppd', moduleName: CORE }; Identifiers.pipeDef = { name: 'ɵpid', moduleName: CORE }; Identifiers.nodeValue = { name: 'ɵnov', moduleName: CORE }; Identifiers.ngContentDef = { name: 'ɵncd', moduleName: CORE }; Identifiers.unwrapValue = { name: 'ɵunv', moduleName: CORE }; Identifiers.createRendererType2 = { name: 'ɵcrt', moduleName: CORE }; // type only Identifiers.RendererType2 = { name: 'RendererType2', moduleName: CORE, }; // type only Identifiers.ViewDefinition = { name: 'ɵViewDefinition', moduleName: CORE, }; Identifiers.createComponentFactory = { name: 'ɵccf', moduleName: CORE }; /** * @param {?} reference * @return {?} */ function createTokenForReference(reference) { return { identifier: { reference: reference } }; } /** * @param {?} reflector * @param {?} reference * @return {?} */ function createTokenForExternalReference(reflector, reference) { return createTokenForReference(reflector.resolveExternalReference(reference)); } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** @enum {number} */ const LifecycleHooks = { OnInit: 0, OnDestroy: 1, DoCheck: 2, OnChanges: 3, AfterContentInit: 4, AfterContentChecked: 5, AfterViewInit: 6, AfterViewChecked: 7, }; LifecycleHooks[LifecycleHooks.OnInit] = "OnInit"; LifecycleHooks[LifecycleHooks.OnDestroy] = "OnDestroy"; LifecycleHooks[LifecycleHooks.DoCheck] = "DoCheck"; LifecycleHooks[LifecycleHooks.OnChanges] = "OnChanges"; LifecycleHooks[LifecycleHooks.AfterContentInit] = "AfterContentInit"; LifecycleHooks[LifecycleHooks.AfterContentChecked] = "AfterContentChecked"; LifecycleHooks[LifecycleHooks.AfterViewInit] = "AfterViewInit"; LifecycleHooks[LifecycleHooks.AfterViewChecked] = "AfterViewChecked"; const LIFECYCLE_HOOKS_VALUES = [ LifecycleHooks.OnInit, LifecycleHooks.OnDestroy, LifecycleHooks.DoCheck, LifecycleHooks.OnChanges, LifecycleHooks.AfterContentInit, LifecycleHooks.AfterContentChecked, LifecycleHooks.AfterViewInit, LifecycleHooks.AfterViewChecked ]; /** * @param {?} reflector * @param {?} hook * @param {?} token * @return {?} */ function hasLifecycleHook(reflector, hook, token) { return reflector.hasLifecycleHook(token, getHookName(hook)); } /** * @param {?} reflector * @param {?} token * @return {?} */ function getAllLifecycleHooks(reflector, token) { return LIFECYCLE_HOOKS_VALUES.filter(hook => hasLifecycleHook(reflector, hook, token)); } /** * @param {?} hook * @return {?} */ function getHookName(hook) { switch (hook) { case LifecycleHooks.OnInit: return 'ngOnInit'; case LifecycleHooks.OnDestroy: return 'ngOnDestroy'; case LifecycleHooks.DoCheck: return 'ngDoCheck'; case LifecycleHooks.OnChanges: return 'ngOnChanges'; case LifecycleHooks.AfterContentInit: return 'ngAfterContentInit'; case LifecycleHooks.AfterContentChecked: return 'ngAfterContentChecked'; case LifecycleHooks.AfterViewInit: return 'ngAfterViewInit'; case LifecycleHooks.AfterViewChecked: return 'ngAfterViewChecked'; } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ const _SELECTOR_REGEXP = new RegExp('(\\:not\\()|' + //":not(" '([-\\w]+)|' + // "tag" '(?:\\.([-\\w]+))|' + // ".class" '(?:\\[([-.\\w*]+)(?:=([\"\']?)([^\\]\"\']*)\\5)?\\])|' + // "[name]", "[name=value]", '(\\))|' + // ")" '(\\s*,\\s*)', // "," 'g'); /** * A css selector contains an element name, * css classes and attribute/value pairs with the purpose * of selecting subsets out of them. */ class CssSelector { constructor() { this.element = null; this.classNames = []; this.attrs = []; this.notSelectors = []; } /** * @param {?} selector * @return {?} */ static parse(selector) { const /** @type {?} */ results = []; const /** @type {?} */ _addResult = (res, cssSel) => { if (cssSel.notSelectors.length > 0 && !cssSel.element && cssSel.classNames.length == 0 && cssSel.attrs.length == 0) { cssSel.element = '*'; } res.push(cssSel); }; let /** @type {?} */ cssSelector = new CssSelector(); let /** @type {?} */ match; let /** @type {?} */ current = cssSelector; let /** @type {?} */ inNot = false; _SELECTOR_REGEXP.lastIndex = 0; while (match = _SELECTOR_REGEXP.exec(selector)) { if (match[1]) { if (inNot) { throw new Error('Nesting :not is not allowed in a selector'); } inNot = true; current = new CssSelector(); cssSelector.notSelectors.push(current); } if (match[2]) { current.setElement(match[2]); } if (match[3]) { current.addClassName(match[3]); } if (match[4]) { current.addAttribute(match[4], match[6]); } if (match[7]) { inNot = false; current = cssSelector; } if (match[8]) { if (inNot) { throw new Error('Multiple selectors in :not are not supported'); } _addResult(results, cssSelector); cssSelector = current = new CssSelector(); } } _addResult(results, cssSelector); return results; } /** * @return {?} */ isElementSelector() { return this.hasElementSelector() && this.classNames.length == 0 && this.attrs.length == 0 && this.notSelectors.length === 0; } /** * @return {?} */ hasElementSelector() { return !!this.element; } /** * @param {?=} element * @return {?} */ setElement(element = null) { this.element = element; } /** * Gets a template string for an element that matches the selector. * @return {?} */ getMatchingElementTemplate() { const /** @type {?} */ tagName = this.element || 'div'; const /** @type {?} */ classAttr = this.classNames.length > 0 ? ` class="${this.classNames.join(' ')}"` : ''; let /** @type {?} */ attrs = ''; for (let /** @type {?} */ i = 0; i < this.attrs.length; i += 2) { const /** @type {?} */ attrName = this.attrs[i]; const /** @type {?} */ attrValue = this.attrs[i + 1] !== '' ? `="${this.attrs[i + 1]}"` : ''; attrs += ` ${attrName}${attrValue}`; } return getHtmlTagDefinition(tagName).isVoid ? `<${tagName}${classAttr}${attrs}/>` : `<${tagName}${classAttr}${attrs}></${tagName}>`; } /** * @param {?} name * @param {?=} value * @return {?} */ addAttribute(name, value = '') { this.attrs.push(name, value && value.toLowerCase() || ''); } /** * @param {?} name * @return {?} */ addClassName(name) { this.classNames.push(name.toLowerCase()); } /** * @return {?} */ toString() { let /** @type {?} */ res = this.element || ''; if (this.classNames) { this.classNames.forEach(klass => res += `.${klass}`); } if (this.attrs) { for (let /** @type {?} */ i = 0; i < this.attrs.length; i += 2) { const /** @type {?} */ name = this.attrs[i]; const /** @type {?} */ value = this.attrs[i + 1]; res += `[${name}${value ? '=' + value : ''}]`; } } this.notSelectors.forEach(notSelector => res += `:not(${notSelector})`); return res; } } /** * Reads a list of CssSelectors and allows to calculate which ones * are contained in a given CssSelector. */ class SelectorMatcher { constructor() { this._elementMap = new Map(); this._elementPartialMap = new Map(); this._classMap = new Map(); this._classPartialMap = new Map(); this._attrValueMap = new Map(); this._attrValuePartialMap = new Map(); this._listContexts = []; } /** * @param {?} notSelectors * @return {?} */ static createNotMatcher(notSelectors) { const /** @type {?} */ notMatcher = new SelectorMatcher(); notMatcher.addSelectables(notSelectors, null); return notMatcher; } /** * @param {?} cssSelectors * @param {?=} callbackCtxt * @return {?} */ addSelectables(cssSelectors, callbackCtxt) { let /** @type {?} */ listContext = /** @type {?} */ ((null)); if (cssSelectors.length > 1) { listContext = new SelectorListContext(cssSelectors); this._listContexts.push(listContext); } for (let /** @type {?} */ i = 0; i < cssSelectors.length; i++) { this._addSelectable(cssSelectors[i], callbackCtxt, listContext); } } /** * Add an object that can be found later on by calling `match`. * @param {?} cssSelector A css selector * @param {?} callbackCtxt An opaque object that will be given to the callback of the `match` function * @param {?} listContext * @return {?} */ _addSelectable(cssSelector, callbackCtxt, listContext) { let /** @type {?} */ matcher = this; const /** @type {?} */ element = cssSelector.element; const /** @type {?} */ classNames = cssSelector.classNames; const /** @type {?} */ attrs = cssSelector.attrs; const /** @type {?} */ selectable = new SelectorContext(cssSelector, callbackCtxt, listContext); if (element) { const /** @type {?} */ isTerminal = attrs.length === 0 && classNames.length === 0; if (isTerminal) { this._addTerminal(matcher._elementMap, element, selectable); } else { matcher = this._addPartial(matcher._elementPartialMap, element); } } if (classNames) { for (let /** @type {?} */ i = 0; i < classNames.length; i++) { const /** @type {?} */ isTerminal = attrs.length === 0 && i === classNames.length - 1; const /** @type {?} */ className = classNames[i]; if (isTerminal) { this._addTerminal(matcher._classMap, className, selectable); } else { matcher = this._addPartial(matcher._classPartialMap, className); } } } if (attrs) { for (let /** @type {?} */ i = 0; i < attrs.length; i += 2) { const /** @type {?} */ isTerminal = i === attrs.length - 2; const /** @type {?} */ name = attrs[i]; const /** @type {?} */ value = attrs[i + 1]; if (isTerminal) { const /** @type {?} */ terminalMap = matcher._attrValueMap; let /** @type {?} */ terminalValuesMap = terminalMap.get(name); if (!terminalValuesMap) { terminalValuesMap = new Map(); terminalMap.set(name, terminalValuesMap); } this._addTerminal(terminalValuesMap, value, selectable); } else { const /** @type {?} */ partialMap = matcher._attrValuePartialMap; let /** @type {?} */ partialValuesMap = partialMap.get(name); if (!partialValuesMap) { partialValuesMap = new Map(); partialMap.set(name, partialValuesMap); } matcher = this._addPartial(partialValuesMap, value); } } } } /** * @param {?} map * @param {?} name * @param {?} selectable * @return {?} */ _addTerminal(map, name, selectable) { let /** @type {?} */ terminalList = map.get(name); if (!terminalList) { terminalList = []; map.set(name, terminalList); } terminalList.push(selectable); } /** * @param {?} map * @param {?} name * @return {?} */ _addPartial(map, name) { let /** @type {?} */ matcher = map.get(name); if (!matcher) { matcher = new SelectorMatcher(); map.set(name, matcher); } return matcher; } /** * Find the objects that have been added via `addSelectable` * whose css selector is contained in the given css selector. * @param {?} cssSelector A css selector * @param {?} matchedCallback This callback will be called with the object handed into `addSelectable` * @return {?} boolean true if a match was found */ match(cssSelector, matchedCallback) { let /** @type {?} */ result = false; const /** @type {?} */ element = /** @type {?} */ ((cssSelector.element)); const /** @type {?} */ classNames = cssSelector.classNames; const /** @type {?} */ attrs = cssSelector.attrs; for (let /** @type {?} */ i = 0; i < this._listContexts.length; i++) { this._listContexts[i].alreadyMatched = false; } result = this._matchTerminal(this._elementMap, element, cssSelector, matchedCallback) || result; result = this._matchPartial(this._elementPartialMap, element, cssSelector, matchedCallback) || result; if (classNames) { for (let /** @type {?} */ i = 0; i < classNames.length; i++) { const /** @type {?} */ className = classNames[i]; result = this._matchTerminal(this._classMap, className, cssSelector, matchedCallback) || result; result = this._matchPartial(this._classPartialMap, className, cssSelector, matchedCallback) || result; } } if (attrs) { for (let /** @type {?} */ i = 0; i < attrs.length; i += 2) { const /** @type {?} */ name = attrs[i]; const /** @type {?} */ value = attrs[i + 1]; const /** @type {?} */ terminalValuesMap = /** @type {?} */ ((this._attrValueMap.get(name))); if (value) { result = this._matchTerminal(terminalValuesMap, '', cssSelector, matchedCallback) || result; } result = this._matchTerminal(terminalValuesMap, value, cssSelector, matchedCallback) || result; const /** @type {?} */ partialValuesMap = /** @type {?} */ ((this._attrValuePartialMap.get(name))); if (value) { result = this._matchPartial(partialValuesMap, '', cssSelector, matchedCallback) || result; } result = this._matchPartial(partialValuesMap, value, cssSelector, matchedCallback) || result; } } return result; } /** * \@internal * @param {?} map * @param {?} name * @param {?} cssSelector * @param {?} matchedCallback * @return {?} */ _matchTerminal(map, name, cssSelector, matchedCallback) { if (!map || typeof name !== 'string') { return false; } let /** @type {?} */ selectables = map.get(name) || []; const /** @type {?} */ starSelectables = /** @type {?} */ ((map.get('*'))); if (starSelectables) { selectables = selectables.concat(starSelectables); } if (selectables.length === 0) { return false; } let /** @type {?} */ selectable; let /** @type {?} */ result = false; for (let /** @type {?} */ i = 0; i < selectables.length; i++) { selectable = selectables[i]; result = selectable.finalize(cssSelector, matchedCallback) || result; } return result; } /** * \@internal * @param {?} map * @param {?} name * @param {?} cssSelector * @param {?} matchedCallback * @return {?} */ _matchPartial(map, name, cssSelector, matchedCallback) { if (!map || typeof name !== 'string') { return false; } const /** @type {?} */ nestedSelector = map.get(name); if (!nestedSelector) { return false; } // TODO(perf): get rid of recursion and measure again // TODO(perf): don't pass the whole selector into the recursion, // but only the not processed parts return nestedSelector.match(cssSelector, matchedCallback); } } class SelectorListContext { /** * @param {?} selectors */ constructor(selectors) { this.selectors = selectors; this.alreadyMatched = false; } } class SelectorContext { /** * @param {?} selector * @param {?} cbContext * @param {?} listContext */ constructor(selector, cbContext, listContext) { this.selector = selector; this.cbContext = cbContext; this.listContext = listContext; this.notSelectors = selector.notSelectors; } /** * @param {?} cssSelector * @param {?} callback * @return {?} */ finalize(cssSelector, callback) { let /** @type {?} */ result = true; if (this.notSelectors.length > 0 && (!this.listContext || !this.listContext.alreadyMatched)) { const /** @type {?} */ notMatcher = SelectorMatcher.createNotMatcher(this.notSelectors); result = !notMatcher.match(cssSelector, null); } if (result && callback && (!this.listContext || !this.listContext.alreadyMatched)) { if (this.listContext) { this.listContext.alreadyMatched = true; } callback(this.selector, this.cbContext); } return result; } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ const ERROR_COMPONENT_TYPE = 'ngComponentType'; class CompileMetadataResolver { /** * @param {?} _config * @param {?} _htmlParser * @param {?} _ngModuleResolver * @param {?} _directiveResolver * @param {?} _pipeResolver * @param {?} _summaryResolver * @param {?} _schemaRegistry * @param {?} _directiveNormalizer * @param {?} _console * @param {?} _staticSymbolCache * @param {?} _reflector * @param {?=} _errorCollector */ constructor(_config, _htmlParser, _ngModuleResolver, _directiveResolver, _pipeResolver, _summaryResolver, _schemaRegistry, _directiveNormalizer, _console, _staticSymbolCache, _reflector, _errorCollector) { this._config = _config; this._htmlParser = _htmlParser; this._ngModuleResolver = _ngModuleResolver; this._directiveResolver = _directiveResolver; this._pipeResolver = _pipeResolver; this._summaryResolver = _summaryResolver; this._schemaRegistry = _schemaRegistry; this._directiveNormalizer = _directiveNormalizer; this._console = _console; this._staticSymbolCache = _staticSymbolCache; this._reflector = _reflector; this._errorCollector = _errorCollector; this._nonNormalizedDirectiveCache = new Map(); this._directiveCache = new Map(); this._summaryCache = new Map(); this._pipeCache = new Map(); this._ngModuleCache = new Map(); this._ngModuleOfTypes = new Map(); } /** * @return {?} */ getReflector() { return this._reflector; } /** * @param {?} type * @return {?} */ clearCacheFor(type) { const /** @type {?} */ dirMeta = this._directiveCache.get(type); this._directiveCache.delete(type); this._nonNormalizedDirectiveCache.delete(type); this._summaryCache.delete(type); this._pipeCache.delete(type); this._ngModuleOfTypes.delete(type); // Clear all of the NgModule as they contain transitive information! this._ngModuleCache.clear(); if (dirMeta) { this._directiveNormalizer.clearCacheFor(dirMeta); } } /** * @return {?} */ clearCache() { this._directiveCache.clear(); this._nonNormalizedDirectiveCache.clear(); this._summaryCache.clear(); this._pipeCache.clear(); this._ngModuleCache.clear(); this._ngModuleOfTypes.clear(); this._directiveNormalizer.clearCache(); } /** * @param {?} baseType * @param {?} name * @return {?} */ _createProxyClass(baseType, name) { let /** @type {?} */ delegate = null; const /** @type {?} */ proxyClass = /** @type {?} */ (function () { if (!delegate) { throw new Error(`Illegal state: Class ${name} for type ${stringify(baseType)} is not compiled yet!`); } return delegate.apply(this, arguments); }); proxyClass.setDelegate = (d) => { delegate = d; (/** @type {?} */ (proxyClass)).prototype = d.prototype; }; // Make stringify work correctly (/** @type {?} */ (proxyClass)).overriddenName = name; return proxyClass; } /** * @param {?} dirType * @param {?} name * @return {?} */ getGeneratedClass(dirType, name) { if (dirType instanceof StaticSymbol) { return this._staticSymbolCache.get(ngfactoryFilePath(dirType.filePath), name); } else { return this._createProxyClass(dirType, name); } } /** * @param {?} dirType * @return {?} */ getComponentViewClass(dirType) { return this.getGeneratedClass(dirType, viewClassName(dirType, 0)); } /** * @param {?} dirType * @return {?} */ getHostComponentViewClass(dirType) { return this.getGeneratedClass(dirType, hostViewClassName(dirType)); } /** * @param {?} dirType * @return {?} */ getHostComponentType(dirType) { const /** @type {?} */ name = `${identifierName({ reference: dirType })}_Host`; if (dirType instanceof StaticSymbol) { return this._staticSymbolCache.get(dirType.filePath, name); } else { const /** @type {?} */ HostClass = /** @type {?} */ (function HostClass() { }); HostClass.overriddenName = name; return HostClass; } } /** * @param {?} dirType * @return {?} */ getRendererType(dirType) { if (dirType instanceof StaticSymbol) { return this._staticSymbolCache.get(ngfactoryFilePath(dirType.filePath), rendererTypeName(dirType)); } else { // returning an object as proxy, // that we fill later during runtime compilation. return /** @type {?} */ ({}); } } /** * @param {?} selector * @param {?} dirType * @param {?} inputs * @param {?} outputs * @return {?} */ getComponentFactory(selector, dirType, inputs, outputs) { if (dirType instanceof StaticSymbol) { return this._staticSymbolCache.get(ngfactoryFilePath(dirType.filePath), componentFactoryName(dirType)); } else { const /** @type {?} */ hostView = this.getHostComponentViewClass(dirType); // Note: ngContentSelectors will be filled later once the template is // loaded. const /** @type {?} */ createComponentFactory = this._reflector.resolveExternalReference(Identifiers.createComponentFactory); return createComponentFactory(selector, dirType, /** @type {?} */ (hostView), inputs, outputs, []); } } /** * @param {?} factory * @param {?} ngContentSelectors * @return {?} */ initComponentFactory(factory, ngContentSelectors) { if (!(factory instanceof StaticSymbol)) { (/** @type {?} */ (factory)).ngContentSelectors.push(...ngContentSelectors); } } /** * @param {?} type * @param {?} kind * @return {?} */ _loadSummary(type, kind) { let /** @type {?} */ typeSummary = this._summaryCache.get(type); if (!typeSummary) { const /** @type {?} */ summary = this._summaryResolver.resolveSummary(type); typeSummary = summary ? summary.type : null; this._summaryCache.set(type, typeSummary || null); } return typeSummary && typeSummary.summaryKind === kind ? typeSummary : null; } /** * @param {?} compMeta * @param {?=} hostViewType * @return {?} */ getHostComponentMetadata(compMeta, hostViewType) { const /** @type {?} */ hostType = this.getHostComponentType(compMeta.type.reference); if (!hostViewType) { hostViewType = this.getHostComponentViewClass(hostType); } // Note: ! is ok here as this method should only be called with normalized directive // metadata, which always fills in the selector. const /** @type {?} */ template = CssSelector.parse(/** @type {?} */ ((compMeta.selector)))[0].getMatchingElementTemplate(); const /** @type {?} */ templateUrl = ''; const /** @type {?} */ htmlAst = this._htmlParser.parse(template, templateUrl); return CompileDirectiveMetadata.create({ isHost: true, type: { reference: hostType, diDeps: [], lifecycleHooks: [] }, template: new CompileTemplateMetadata({ encapsulation: ViewEncapsulation.None, template, templateUrl, htmlAst, styles: [], styleUrls: [], ngContentSelectors: [], animations: [], isInline: true, externalStylesheets: [], interpolation: null, preserveWhitespaces: false, }), exportAs: null, changeDetection: ChangeDetectionStrategy.Default, inputs: [], outputs: [], host: {}, isComponent: true, selector: '*', providers: [], viewProviders: [], queries: [], guards: {}, viewQueries: [], componentViewType: hostViewType, rendererType: /** @type {?} */ ({ id: '__Host__', encapsulation: ViewEncapsulation.None, styles: [], data: {} }), entryComponents: [], componentFactory: null }); } /** * @param {?} ngModuleType * @param {?} directiveType * @param {?} isSync * @return {?} */ loadDirectiveMetadata(ngModuleType, directiveType, isSync) { if (this._directiveCache.has(directiveType)) { return null; } directiveType = resolveForwardRef(directiveType); const { annotation, metadata } = /** @type {?} */ ((this.getNonNormalizedDirectiveMetadata(directiveType))); const /** @type {?} */ createDirectiveMetadata = (templateMetadata) => { const /** @type {?} */ normalizedDirMeta = new CompileDirectiveMetadata({ isHost: false, type: metadata.type, isComponent: metadata.isComponent, selector: metadata.selector, exportAs: metadata.exportAs, changeDetection: metadata.changeDetection, inputs: metadata.inputs, outputs: metadata.outputs, hostListeners: metadata.hostListeners, hostProperties: metadata.hostProperties, hostAttributes: metadata.hostAttributes, providers: metadata.providers, viewProviders: metadata.viewProviders, queries: metadata.queries, guards: metadata.guards, viewQueries: metadata.viewQueries, entryComponents: metadata.entryComponents, componentViewType: metadata.componentViewType, rendererType: metadata.rendererType, componentFactory: metadata.componentFactory, template: templateMetadata }); if (templateMetadata) { this.initComponentFactory(/** @type {?} */ ((metadata.componentFactory)), templateMetadata.ngContentSelectors); } this._directiveCache.set(directiveType, normalizedDirMeta); this._summaryCache.set(directiveType, normalizedDirMeta.toSummary()); return null; }; if (metadata.isComponent) { const /** @type {?} */ template = /** @type {?} */ ((metadata.template)); const /** @type {?} */ templateMeta = this._directiveNormalizer.normalizeTemplate({ ngModuleType, componentType: directiveType, moduleUrl: this._reflector.componentModuleUrl(directiveType, annotation), encapsulation: template.encapsulation, template: template.template, templateUrl: template.templateUrl, styles: template.styles, styleUrls: template.styleUrls, animations: template.animations, interpolation: template.interpolation, preserveWhitespaces: template.preserveWhitespaces }); if (isPromise(templateMeta) && isSync) { this._reportError(componentStillLoadingError(directiveType), directiveType); return null; } return SyncAsync.then(templateMeta, createDirectiveMetadata); } else { // directive createDirectiveMetadata(null); return null; } } /** * @param {?} directiveType * @return {?} */ getNonNormalizedDirectiveMetadata(directiveType) { directiveType = resolveForwardRef(directiveType); if (!directiveType) { return null; } let /** @type {?} */ cacheEntry = this._nonNormalizedDirectiveCache.get(directiveType); if (cacheEntry) { return cacheEntry; } const /** @type {?} */ dirMeta = this._directiveResolver.resolve(directiveType, false); if (!dirMeta) { return null; } let /** @type {?} */ nonNormalizedTemplateMetadata = /** @type {?} */ ((undefined)); if (createComponent.isTypeOf(dirMeta)) { // component const /** @type {?} */ compMeta = /** @type {?} */ (dirMeta); assertArrayOfStrings('styles', compMeta.styles); assertArrayOfStrings('styleUrls', compMeta.styleUrls); assertInterpolationSymbols('interpolation', compMeta.interpolation); const /** @type {?} */ animations = compMeta.animations; nonNormalizedTemplateMetadata = new CompileTemplateMetadata({ encapsulation: noUndefined(compMeta.encapsulation), template: noUndefined(compMeta.template), templateUrl: noUndefined(compMeta.templateUrl), htmlAst: null, styles: compMeta.styles || [], styleUrls: compMeta.styleUrls || [], animations: animations || [], interpolation: noUndefined(compMeta.interpolation), isInline: !!compMeta.template, externalStylesheets: [], ngContentSelectors: [], preserveWhitespaces: noUndefined(dirMeta.preserveWhitespaces), }); } let /** @type {?} */ changeDetectionStrategy = /** @type {?} */ ((null)); let /** @type {?} */ viewProviders = []; let /** @type {?} */ entryComponentMetadata = []; let /** @type {?} */ selector = dirMeta.selector; if (createComponent.isTypeOf(dirMeta)) { // Component const /** @type {?} */ compMeta = /** @type {?} */ (dirMeta); changeDetectionStrategy = /** @type {?} */ ((compMeta.changeDetection)); if (compMeta.viewProviders) { viewProviders = this._getProvidersMetadata(compMeta.viewProviders, entryComponentMetadata, `viewProviders for "${stringifyType(directiveType)}"`, [], directiveType); } if (compMeta.entryComponents) { entryComponentMetadata = flattenAndDedupeArray(compMeta.entryComponents) .map((type) => /** @type {?} */ ((this._getEntryComponentMetadata(type)))) .concat(entryComponentMetadata); } if (!selector) { selector = this._schemaRegistry.getDefaultComponentElementName(); } } else { // Directive if (!selector) { this._reportError(syntaxError(`Directive ${stringifyType(directiveType)} has no selector, please add it!`), directiveType); selector = 'error'; } } let /** @type {?} */ providers = []; if (dirMeta.providers != null) { providers = this._getProvidersMetadata(dirMeta.providers, entryComponentMetadata, `providers for "${stringifyType(directiveType)}"`, [], directiveType); } let /** @type {?} */ queries = []; let /** @type {?} */ viewQueries = []; if (dirMeta.queries != null) { queries = this._getQueriesMetadata(dirMeta.queries, false, directiveType); viewQueries = this._getQueriesMetadata(dirMeta.queries, true, directiveType); } const /** @type {?} */ metadata = CompileDirectiveMetadata.create({ isHost: false, selector: selector, exportAs: noUndefined(dirMeta.exportAs), isComponent: !!nonNormalizedTemplateMetadata, type: this._getTypeMetadata(directiveType), template: nonNormalizedTemplateMetadata, changeDetection: changeDetectionStrategy, inputs: dirMeta.inputs || [], outputs: dirMeta.outputs || [], host: dirMeta.host || {}, providers: providers || [], viewProviders: viewProviders || [], queries: queries || [], guards: dirMeta.guards || {}, viewQueries: viewQueries || [], entryComponents: entryComponentMetadata, componentViewType: nonNormalizedTemplateMetadata ? this.getComponentViewClass(directiveType) : null, rendererType: nonNormalizedTemplateMetadata ? this.getRendererType(directiveType) : null, componentFactory: null }); if (nonNormalizedTemplateMetadata) { metadata.componentFactory = this.getComponentFactory(selector, directiveType, metadata.inputs, metadata.outputs); } cacheEntry = { metadata, annotation: dirMeta }; this._nonNormalizedDirectiveCache.set(directiveType, cacheEntry); return cacheEntry; } /** * Gets the metadata for the given directive. * This assumes `loadNgModuleDirectiveAndPipeMetadata` has been called first. * @param {?} directiveType * @return {?} */ getDirectiveMetadata(directiveType) { const /** @type {?} */ dirMeta = /** @type {?} */ ((this._directiveCache.get(directiveType))); if (!dirMeta) { this._reportError(syntaxError(`Illegal state: getDirectiveMetadata can only be called after loadNgModuleDirectiveAndPipeMetadata for a module that declares it. Directive ${stringifyType(directiveType)}.`), directiveType); } return dirMeta; } /** * @param {?} dirType * @return {?} */ getDirectiveSummary(dirType) { const /** @type {?} */ dirSummary = /** @type {?} */ (this._loadSummary(dirType, CompileSummaryKind.Directive)); if (!dirSummary) { this._reportError(syntaxError(`Illegal state: Could not load the summary for directive ${stringifyType(dirType)}.`), dirType); } return dirSummary; } /** * @param {?} type * @return {?} */ isDirective(type) { return !!this._loadSummary(type, CompileSummaryKind.Directive) || this._directiveResolver.isDirective(type); } /** * @param {?} type * @return {?} */ isPipe(type) { return !!this._loadSummary(type, CompileSummaryKind.Pipe) || this._pipeResolver.isPipe(type); } /** * @param {?} type * @return {?} */ isNgModule(type) { return !!this._loadSummary(type, CompileSummaryKind.NgModule) || this._ngModuleResolver.isNgModule(type); } /** * @param {?} moduleType * @param {?=} alreadyCollecting * @return {?} */ getNgModuleSummary(moduleType, alreadyCollecting = null) { let /** @type {?} */ moduleSummary = /** @type {?} */ (this._loadSummary(moduleType, CompileSummaryKind.NgModule)); if (!moduleSummary) { const /** @type {?} */ moduleMeta = this.getNgModuleMetadata(moduleType, false, alreadyCollecting); moduleSummary = moduleMeta ? moduleMeta.toSummary() : null; if (moduleSummary) { this._summaryCache.set(moduleType, moduleSummary); } } return moduleSummary; } /** * Loads the declared directives and pipes of an NgModule. * @param {?} moduleType * @param {?} isSync * @param {?=} throwIfNotFound * @return {?} */ loadNgModuleDirectiveAndPipeMetadata(moduleType, isSync, throwIfNotFound = true) { const /** @type {?} */ ngModule = this.getNgModuleMetadata(moduleType, throwIfNotFound); const /** @type {?} */ loading = []; if (ngModule) { ngModule.declaredDirectives.forEach((id) => { const /** @type {?} */ promise = this.loadDirectiveMetadata(moduleType, id.reference, isSync); if (promise) { loading.push(promise); } }); ngModule.declaredPipes.forEach((id) => this._loadPipeMetadata(id.reference)); } return Promise.all(loading); } /** * @param {?} moduleType * @param {?=} throwIfNotFound * @param {?=} alreadyCollecting * @return {?} */ getNgModuleMetadata(moduleType, throwIfNotFound = true, alreadyCollecting = null) { moduleType = resolveForwardRef(moduleType); let /** @type {?} */ compileMeta = this._ngModuleCache.get(moduleType); if (compileMeta) { return compileMeta; } const /** @type {?} */ meta = this._ngModuleResolver.resolve(moduleType, throwIfNotFound); if (!meta) { return null; } const /** @type {?} */ declaredDirectives = []; const /** @type {?} */ exportedNonModuleIdentifiers = []; const /** @type {?} */ declaredPipes = []; const /** @type {?} */ importedModules = []; const /** @type {?} */ exportedModules = []; const /** @type {?} */ providers = []; const /** @type {?} */ entryComponents = []; const /** @type {?} */ bootstrapComponents = []; const /** @type {?} */ schemas = []; if (meta.imports) { flattenAndDedupeArray(meta.imports).forEach((importedType) => { let /** @type {?} */ importedModuleType = /** @type {?} */ ((undefined)); if (isValidType(importedType)) { importedModuleType = importedType; } else if (importedType && importedType.ngModule) { const /** @type {?} */ moduleWithProviders = importedType; importedModuleType = moduleWithProviders.ngModule; if (moduleWithProviders.providers) { providers.push(...this._getProvidersMetadata(moduleWithProviders.providers, entryComponents, `provider for the NgModule '${stringifyType(importedModuleType)}'`, [], importedType)); } } if (importedModuleType) { if (this._checkSelfImport(moduleType, importedModuleType)) return; if (!alreadyCollecting) alreadyCollecting = new Set(); if (alreadyCollecting.has(importedModuleType)) { this._reportError(syntaxError(`${this._getTypeDescriptor(importedModuleType)} '${stringifyType(importedType)}' is imported recursively by the module '${stringifyType(moduleType)}'.`), moduleType); return; } alreadyCollecting.add(importedModuleType); const /** @type {?} */ importedModuleSummary = this.getNgModuleSummary(importedModuleType, alreadyCollecting); alreadyCollecting.delete(importedModuleType); if (!importedModuleSummary) { this._reportError(syntaxError(`Unexpected ${this._getTypeDescriptor(importedType)} '${stringifyType(importedType)}' imported by the module '${stringifyType(moduleType)}'. Please add a @NgModule annotation.`), moduleType); return; } importedModules.push(importedModuleSummary); } else { this._reportError(syntaxError(`Unexpected value '${stringifyType(importedType)}' imported by the module '${stringifyType(moduleType)}'`), moduleType); return; } }); } if (meta.exports) { flattenAndDedupeArray(meta.exports).forEach((exportedType) => { if (!isValidType(exportedType)) { this._reportError(syntaxError(`Unexpected value '${stringifyType(exportedType)}' exported by the module '${stringifyType(moduleType)}'`), moduleType); return; } if (!alreadyCollecting) alreadyCollecting = new Set(); if (alreadyCollecting.has(exportedType)) { this._reportError(syntaxError(`${this._getTypeDescriptor(exportedType)} '${stringify(exportedType)}' is exported recursively by the module '${stringifyType(moduleType)}'`), moduleType); return; } alreadyCollecting.add(exportedType); const /** @type {?} */ exportedModuleSummary = this.getNgModuleSummary(exportedType, alreadyCollecting); alreadyCollecting.delete(exportedType); if (exportedModuleSummary) { exportedModules.push(exportedModuleSummary); } else { exportedNonModuleIdentifiers.push(this._getIdentifierMetadata(exportedType)); } }); } // Note: This will be modified later, so we rely on // getting a new instance every time! const /** @type {?} */ transitiveModule = this._getTransitiveNgModuleMetadata(importedModules, exportedModules); if (meta.declarations) { flattenAndDedupeArray(meta.declarations).forEach((declaredType) => { if (!isValidType(declaredType)) { this._reportError(syntaxError(`Unexpected value '${stringifyType(declaredType)}' declared by the module '${stringifyType(moduleType)}'`), moduleType); return; } const /** @type {?} */ declaredIdentifier = this._getIdentifierMetadata(declaredType); if (this.isDirective(declaredType)) { transitiveModule.addDirective(declaredIdentifier); declaredDirectives.push(declaredIdentifier); this._addTypeToModule(declaredType, moduleType); } else if (this.isPipe(declaredType)) { transitiveModule.addPipe(declaredIdentifier); transitiveModule.pipes.push(declaredIdentifier); declaredPipes.push(declaredIdentifier); this._addTypeToModule(declaredType, moduleType); } else { this._reportError(syntaxError(`Unexpected ${this._getTypeDescriptor(declaredType)} '${stringifyType(declaredType)}' declared by the module '${stringifyType(moduleType)}'. Please add a @Pipe/@Directive/@Component annotation.`), moduleType); return; } }); } const /** @type {?} */ exportedDirectives = []; const /** @type {?} */ exportedPipes = []; exportedNonModuleIdentifiers.forEach((exportedId) => { if (transitiveModule.directivesSet.has(exportedId.reference)) { exportedDirectives.push(exportedId); transitiveModule.addExportedDirective(exportedId); } else if (transitiveModule.pipesSet.has(exportedId.reference)) { exportedPipes.push(exportedId); transitiveModule.addExportedPipe(exportedId); } else { this._reportError(syntaxError(`Can't export ${this._getTypeDescriptor(exportedId.reference)} ${stringifyType(exportedId.reference)} from ${stringifyType(moduleType)} as it was neither declared nor imported!`), moduleType); return; } }); // The providers of the module have to go last // so that they overwrite any other provider we already added. if (meta.providers) { providers.push(...this._getProvidersMetadata(meta.providers, entryComponents, `provider for the NgModule '${stringifyType(moduleType)}'`, [], moduleType)); } if (meta.entryComponents) { entryComponents.push(...flattenAndDedupeArray(meta.entryComponents) .map(type => /** @type {?} */ ((this._getEntryComponentMetadata(type))))); } if (meta.bootstrap) { flattenAndDedupeArray(meta.bootstrap).forEach(type => { if (!isValidType(type)) { this._reportError(syntaxError(`Unexpected value '${stringifyType(type)}' used in the bootstrap property of module '${stringifyType(moduleType)}'`), moduleType); return; } bootstrapComponents.push(this._getIdentifierMetadata(type)); }); } entryComponents.push(...bootstrapComponents.map(type => /** @type {?} */ ((this._getEntryComponentMetadata(type.reference))))); if (meta.schemas) { schemas.push(...flattenAndDedupeArray(meta.schemas)); } compileMeta = new CompileNgModuleMetadata({ type: this._getTypeMetadata(moduleType), providers, entryComponents, bootstrapComponents, schemas, declaredDirectives, exportedDirectives, declaredPipes, exportedPipes, importedModules, exportedModules, transitiveModule, id: meta.id || null, }); entryComponents.forEach((id) => transitiveModule.addEntryComponent(id)); providers.forEach((provider) => transitiveModule.addProvider(provider, /** @type {?} */ ((compileMeta)).type)); transitiveModule.addModule(compileMeta.type); this._ngModuleCache.set(moduleType, compileMeta); return compileMeta; } /** * @param {?} moduleType * @param {?} importedModuleType * @return {?} */ _checkSelfImport(moduleType, importedModuleType) { if (moduleType === importedModuleType) { this._reportError(syntaxError(`'${stringifyType(moduleType)}' module can't import itself`), moduleType); return true; } return false; } /** * @param {?} type * @return {?} */ _getTypeDescriptor(type) { if (isValidType(type)) { if (this.isDirective(type)) { return 'directive'; } if (this.isPipe(type)) { return 'pipe'; } if (this.isNgModule(type)) { return 'module'; } } if ((/** @type {?} */ (type)).provide) { return 'provider'; } return 'value'; } /** * @param {?} type * @param {?} moduleType * @return {?} */ _addTypeToModule(type, moduleType) { const /** @type {?} */ oldModule = this._ngModuleOfTypes.get(type); if (oldModule && oldModule !== moduleType) { this._reportError(syntaxError(`Type ${stringifyType(type)} is part of the declarations of 2 modules: ${stringifyType(oldModule)} and ${stringifyType(moduleType)}! ` + `Please consider moving ${stringifyType(type)} to a higher module that imports ${stringifyType(oldModule)} and ${stringifyType(moduleType)}. ` + `You can also create a new NgModule that exports and includes ${stringifyType(type)} then import that NgModule in ${stringifyType(oldModule)} and ${stringifyType(moduleType)}.`), moduleType); return; } this._ngModuleOfTypes.set(type, moduleType); } /** * @param {?} importedModules * @param {?} exportedModules * @return {?} */ _getTransitiveNgModuleMetadata(importedModules, exportedModules) { // collect `providers` / `entryComponents` from all imported and all exported modules const /** @type {?} */ result = new TransitiveCompileNgModuleMetadata(); const /** @type {?} */ modulesByToken = new Map(); importedModules.concat(exportedModules).forEach((modSummary) => { modSummary.modules.forEach((mod) => result.addModule(mod)); modSummary.entryComponents.forEach((comp) => result.addEntryComponent(comp)); const /** @type {?} */ addedTokens = new Set(); modSummary.providers.forEach((entry) => { const /** @type {?} */ tokenRef = tokenReference(entry.provider.token); let /** @type {?} */ prevModules = modulesByToken.get(tokenRef); if (!prevModules) { prevModules = new Set(); modulesByToken.set(tokenRef, prevModules); } const /** @type {?} */ moduleRef = entry.module.reference; // Note: the providers of one module may still contain multiple providers // per token (e.g. for multi providers), and we need to preserve these. if (addedTokens.has(tokenRef) || !prevModules.has(moduleRef)) { prevModules.add(moduleRef); addedTokens.add(tokenRef); result.addProvider(entry.provider, entry.module); } }); }); exportedModules.forEach((modSummary) => { modSummary.exportedDirectives.forEach((id) => result.addExportedDirective(id)); modSummary.exportedPipes.forEach((id) => result.addExportedPipe(id)); }); importedModules.forEach((modSummary) => { modSummary.exportedDirectives.forEach((id) => result.addDirective(id)); modSummary.exportedPipes.forEach((id) => result.addPipe(id)); }); return result; } /** * @param {?} type * @return {?} */ _getIdentifierMetadata(type) { type = resolveForwardRef(type); return { reference: type }; } /** * @param {?} type * @return {?} */ isInjectable(type) { const /** @type {?} */ annotations = this._reflector.annotations(type); return annotations.some(ann => createInjectable.isTypeOf(ann)); } /** * @param {?} type * @return {?} */ getInjectableSummary(type) { return { summaryKind: CompileSummaryKind.Injectable, type: this._getTypeMetadata(type, null, false) }; } /** * @param {?} type * @param {?=} dependencies * @return {?} */ _getInjectableMetadata(type, dependencies = null) { const /** @type {?} */ typeSummary = this._loadSummary(type, CompileSummaryKind.Injectable); if (typeSummary) { return typeSummary.type; } return this._getTypeMetadata(type, dependencies); } /** * @param {?} type * @param {?=} dependencies * @param {?=} throwOnUnknownDeps * @return {?} */ _getTypeMetadata(type, dependencies = null, throwOnUnknownDeps = true) { const /** @type {?} */ identifier = this._getIdentifierMetadata(type); return { reference: identifier.reference, diDeps: this._getDependenciesMetadata(identifier.reference, dependencies, throwOnUnknownDeps), lifecycleHooks: getAllLifecycleHooks(this._reflector, identifier.reference), }; } /** * @param {?} factory * @param {?=} dependencies * @return {?} */ _getFactoryMetadata(factory, dependencies = null) { factory = resolveForwardRef(factory); return { reference: factory, diDeps: this._getDependenciesMetadata(factory, dependencies) }; } /** * Gets the metadata for the given pipe. * This assumes `loadNgModuleDirectiveAndPipeMetadata` has been called first. * @param {?} pipeType * @return {?} */ getPipeMetadata(pipeType) { const /** @type {?} */ pipeMeta = this._pipeCache.get(pipeType); if (!pipeMeta) { this._reportError(syntaxError(`Illegal state: getPipeMetadata can only be called after loadNgModuleDirectiveAndPipeMetadata for a module that declares it. Pipe ${stringifyType(pipeType)}.`), pipeType); } return pipeMeta || null; } /** * @param {?} pipeType * @return {?} */ getPipeSummary(pipeType) { const /** @type {?} */ pipeSummary = /** @type {?} */ (this._loadSummary(pipeType, CompileSummaryKind.Pipe)); if (!pipeSummary) { this._reportError(syntaxError(`Illegal state: Could not load the summary for pipe ${stringifyType(pipeType)}.`), pipeType); } return pipeSummary; } /** * @param {?} pipeType * @return {?} */ getOrLoadPipeMetadata(pipeType) { let /** @type {?} */ pipeMeta = this._pipeCache.get(pipeType); if (!pipeMeta) { pipeMeta = this._loadPipeMetadata(pipeType); } return pipeMeta; } /** * @param {?} pipeType * @return {?} */ _loadPipeMetadata(pipeType) { pipeType = resolveForwardRef(pipeType); const /** @type {?} */ pipeAnnotation = /** @type {?} */ ((this._pipeResolver.resolve(pipeType))); const /** @type {?} */ pipeMeta = new CompilePipeMetadata({ type: this._getTypeMetadata(pipeType), name: pipeAnnotation.name, pure: !!pipeAnnotation.pure }); this._pipeCache.set(pipeType, pipeMeta); this._summaryCache.set(pipeType, pipeMeta.toSummary()); return pipeMeta; } /** * @param {?} typeOrFunc * @param {?} dependencies * @param {?=} throwOnUnknownDeps * @return {?} */ _getDependenciesMetadata(typeOrFunc, dependencies, throwOnUnknownDeps = true) { let /** @type {?} */ hasUnknownDeps = false; const /** @type {?} */ params = dependencies || this._reflector.parameters(typeOrFunc) || []; const /** @type {?} */ dependenciesMetadata = params.map((param) => { let /** @type {?} */ isAttribute = false; let /** @type {?} */ isHost = false; let /** @type {?} */ isSelf = false; let /** @type {?} */ isSkipSelf = false; let /** @type {?} */ isOptional = false; let /** @type {?} */ token = null; if (Array.isArray(param)) { param.forEach((paramEntry) => { if (createHost.isTypeOf(paramEntry)) { isHost = true; } else if (createSelf.isTypeOf(paramEntry)) { isSelf = true; } else if (createSkipSelf.isTypeOf(paramEntry)) { isSkipSelf = true; } else if (createOptional.isTypeOf(paramEntry)) { isOptional = true; } else if (createAttribute.isTypeOf(paramEntry)) { isAttribute = true; token = paramEntry.attributeName; } else if (createInject.isTypeOf(paramEntry)) { token = paramEntry.token; } else if (createInjectionToken.isTypeOf(paramEntry) || paramEntry instanceof StaticSymbol) { token = paramEntry; } else if (isValidType(paramEntry) && token == null) { token = paramEntry; } }); } else { token = param; } if (token == null) { hasUnknownDeps = true; return /** @type {?} */ ((null)); } return { isAttribute, isHost, isSelf, isSkipSelf, isOptional, token: this._getTokenMetadata(token) }; }); if (hasUnknownDeps) { const /** @type {?} */ depsTokens = dependenciesMetadata.map((dep) => dep ? stringifyType(dep.token) : '?').join(', '); const /** @type {?} */ message = `Can't resolve all parameters for ${stringifyType(typeOrFunc)}: (${depsTokens}).`; if (throwOnUnknownDeps || this._config.strictInjectionParameters) { this._reportError(syntaxError(message), typeOrFunc); } else { this._console.warn(`Warning: ${message} This will become an error in Angular v6.x`); } } return dependenciesMetadata; } /** * @param {?} token * @return {?} */ _getTokenMetadata(token) { token = resolveForwardRef(token); let /** @type {?} */ compileToken; if (typeof token === 'string') { compileToken = { value: token }; } else { compileToken = { identifier: { reference: token } }; } return compileToken; } /** * @param {?} providers * @param {?} targetEntryComponents * @param {?=} debugInfo * @param {?=} compileProviders * @param {?=} type * @return {?} */ _getProvidersMetadata(providers, targetEntryComponents, debugInfo, compileProviders = [], type) { providers.forEach((provider, providerIdx) => { if (Array.isArray(provider)) { this._getProvidersMetadata(provider, targetEntryComponents, debugInfo, compileProviders); } else { provider = resolveForwardRef(provider); let /** @type {?} */ providerMeta = /** @type {?} */ ((undefined)); if (provider && typeof provider === 'object' && provider.hasOwnProperty('provide')) { this._validateProvider(provider); providerMeta = new ProviderMeta(provider.provide, provider); } else if (isValidType(provider)) { providerMeta = new ProviderMeta(provider, { useClass: provider }); } else if (provider === void 0) { this._reportError(syntaxError(`Encountered undefined provider! Usually this means you have a circular dependencies (might be caused by using 'barrel' index.ts files.`)); return; } else { const /** @type {?} */ providersInfo = (/** @type {?} */ (providers.reduce((soFar, seenProvider, seenProviderIdx) => { if (seenProviderIdx < providerIdx) { soFar.push(`${stringifyType(seenProvider)}`); } else if (seenProviderIdx == providerIdx) { soFar.push(`?${stringifyType(seenProvider)}?`); } else if (seenProviderIdx == providerIdx + 1) { soFar.push('...'); } return soFar; }, []))) .join(', '); this._reportError(syntaxError(`Invalid ${debugInfo ? debugInfo : 'provider'} - only instances of Provider and Type are allowed, got: [${providersInfo}]`), type); return; } if (providerMeta.token === this._reflector.resolveExternalReference(Identifiers.ANALYZE_FOR_ENTRY_COMPONENTS)) { targetEntryComponents.push(...this._getEntryComponentsFromProvider(providerMeta, type)); } else { compileProviders.push(this.getProviderMetadata(providerMeta)); } } }); return compileProviders; } /** * @param {?} provider * @return {?} */ _validateProvider(provider) { if (provider.hasOwnProperty('useClass') && provider.useClass == null) { this._reportError(syntaxError(`Invalid provider for ${stringifyType(provider.provide)}. useClass cannot be ${provider.useClass}. Usually it happens when: 1. There's a circular dependency (might be caused by using index.ts (barrel) files). 2. Class was used before it was declared. Use forwardRef in this case.`)); } } /** * @param {?} provider * @param {?=} type * @return {?} */ _getEntryComponentsFromProvider(provider, type) { const /** @type {?} */ components = []; const /** @type {?} */ collectedIdentifiers = []; if (provider.useFactory || provider.useExisting || provider.useClass) { this._reportError(syntaxError(`The ANALYZE_FOR_ENTRY_COMPONENTS token only supports useValue!`), type); return []; } if (!provider.multi) { this._reportError(syntaxError(`The ANALYZE_FOR_ENTRY_COMPONENTS token only supports 'multi = true'!`), type); return []; } extractIdentifiers(provider.useValue, collectedIdentifiers); collectedIdentifiers.forEach((identifier) => { const /** @type {?} */ entry = this._getEntryComponentMetadata(identifier.reference, false); if (entry) { components.push(entry); } }); return components; } /** * @param {?} dirType * @param {?=} throwIfNotFound * @return {?} */ _getEntryComponentMetadata(dirType, throwIfNotFound = true) { const /** @type {?} */ dirMeta = this.getNonNormalizedDirectiveMetadata(dirType); if (dirMeta && dirMeta.metadata.isComponent) { return { componentType: dirType, componentFactory: /** @type {?} */ ((dirMeta.metadata.componentFactory)) }; } const /** @type {?} */ dirSummary = /** @type {?} */ (this._loadSummary(dirType, CompileSummaryKind.Directive)); if (dirSummary && dirSummary.isComponent) { return { componentType: dirType, componentFactory: /** @type {?} */ ((dirSummary.componentFactory)) }; } if (throwIfNotFound) { throw syntaxError(`${dirType.name} cannot be used as an entry component.`); } return null; } /** * @param {?} provider * @return {?} */ getProviderMetadata(provider) { let /** @type {?} */ compileDeps = /** @type {?} */ ((undefined)); let /** @type {?} */ compileTypeMetadata = /** @type {?} */ ((null)); let /** @type {?} */ compileFactoryMetadata = /** @type {?} */ ((null)); let /** @type {?} */ token = this._getTokenMetadata(provider.token); if (provider.useClass) { compileTypeMetadata = this._getInjectableMetadata(provider.useClass, provider.dependencies); compileDeps = compileTypeMetadata.diDeps; if (provider.token === provider.useClass) { // use the compileTypeMetadata as it contains information about lifecycleHooks... token = { identifier: compileTypeMetadata }; } } else if (provider.useFactory) { compileFactoryMetadata = this._getFactoryMetadata(provider.useFactory, provider.dependencies); compileDeps = compileFactoryMetadata.diDeps; } return { token: token, useClass: compileTypeMetadata, useValue: provider.useValue, useFactory: compileFactoryMetadata, useExisting: provider.useExisting ? this._getTokenMetadata(provider.useExisting) : undefined, deps: compileDeps, multi: provider.multi }; } /** * @param {?} queries * @param {?} isViewQuery * @param {?} directiveType * @return {?} */ _getQueriesMetadata(queries, isViewQuery, directiveType) { const /** @type {?} */ res = []; Object.keys(queries).forEach((propertyName) => { const /** @type {?} */ query = queries[propertyName]; if (query.isViewQuery === isViewQuery) { res.push(this._getQueryMetadata(query, propertyName, directiveType)); } }); return res; } /** * @param {?} selector * @return {?} */ _queryVarBindings(selector) { return selector.split(/\s*,\s*/); } /** * @param {?} q * @param {?} propertyName * @param {?} typeOrFunc * @return {?} */ _getQueryMetadata(q, propertyName, typeOrFunc) { let /** @type {?} */ selectors; if (typeof q.selector === 'string') { selectors = this._queryVarBindings(q.selector).map(varName => this._getTokenMetadata(varName)); } else { if (!q.selector) { this._reportError(syntaxError(`Can't construct a query for the property "${propertyName}" of "${stringifyType(typeOrFunc)}" since the query selector wasn't defined.`), typeOrFunc); selectors = []; } else { selectors = [this._getTokenMetadata(q.selector)]; } } return { selectors, first: q.first, descendants: q.descendants, propertyName, read: q.read ? this._getTokenMetadata(q.read) : /** @type {?} */ ((null)) }; } /** * @param {?} error * @param {?=} type * @param {?=} otherType * @return {?} */ _reportError(error, type, otherType) { if (this._errorCollector) { this._errorCollector(error, type); if (otherType) { this._errorCollector(error, otherType); } } else { throw error; } } } /** * @param {?} tree * @param {?=} out * @return {?} */ function flattenArray(tree, out = []) { if (tree) { for (let /** @type {?} */ i = 0; i < tree.length; i++) { const /** @type {?} */ item = resolveForwardRef(tree[i]); if (Array.isArray(item)) { flattenArray(item, out); } else { out.push(item); } } } return out; } /** * @param {?} array * @return {?} */ function dedupeArray(array) { if (array) { return Array.from(new Set(array)); } return []; } /** * @param {?} tree * @return {?} */ function flattenAndDedupeArray(tree) { return dedupeArray(flattenArray(tree)); } /** * @param {?} value * @return {?} */ function isValidType(value) { return (value instanceof StaticSymbol) || (value instanceof Type); } /** * @param {?} value * @param {?} targetIdentifiers * @return {?} */ function extractIdentifiers(value, targetIdentifiers) { visitValue(value, new _CompileValueConverter(), targetIdentifiers); } class _CompileValueConverter extends ValueTransformer { /** * @param {?} value * @param {?} targetIdentifiers * @return {?} */ visitOther(value, targetIdentifiers) { targetIdentifiers.push({ reference: value }); } } /** * @param {?} type * @return {?} */ function stringifyType(type) { if (type instanceof StaticSymbol) { return `${type.name} in ${type.filePath}`; } else { return stringify(type); } } /** * Indicates that a component is still being loaded in a synchronous compile. * @param {?} compType * @return {?} */ function componentStillLoadingError(compType) { const /** @type {?} */ error = Error(`Can't compile synchronously as ${stringify(compType)} is still being loaded!`); (/** @type {?} */ (error))[ERROR_COMPONENT_TYPE] = compType; return error; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** @enum {number} */ const TypeModifier = { Const: 0, }; TypeModifier[TypeModifier.Const] = "Const"; /** * @abstract */ class Type$1 { /** * @param {?=} modifiers */ constructor(modifiers = null) { this.modifiers = modifiers; if (!modifiers) { this.modifiers = []; } } /** * @param {?} modifier * @return {?} */ hasModifier(modifier) { return /** @type {?} */ ((this.modifiers)).indexOf(modifier) !== -1; } } /** @enum {number} */ const BuiltinTypeName = { Dynamic: 0, Bool: 1, String: 2, Int: 3, Number: 4, Function: 5, Inferred: 6, }; BuiltinTypeName[BuiltinTypeName.Dynamic] = "Dynamic"; BuiltinTypeName[BuiltinTypeName.Bool] = "Bool"; BuiltinTypeName[BuiltinTypeName.String] = "String"; BuiltinTypeName[BuiltinTypeName.Int] = "Int"; BuiltinTypeName[BuiltinTypeName.Number] = "Number"; BuiltinTypeName[BuiltinTypeName.Function] = "Function"; BuiltinTypeName[BuiltinTypeName.Inferred] = "Inferred"; class BuiltinType extends Type$1 { /** * @param {?} name * @param {?=} modifiers */ constructor(name, modifiers = null) { super(modifiers); this.name = name; } /** * @param {?} visitor * @param {?} context * @return {?} */ visitType(visitor, context) { return visitor.visitBuiltintType(this, context); } } class ExpressionType extends Type$1 { /** * @param {?} value * @param {?=} modifiers */ constructor(value, modifiers = null) { super(modifiers); this.value = value; } /** * @param {?} visitor * @param {?} context * @return {?} */ visitType(visitor, context) { return visitor.visitExpressionType(this, context); } } class ArrayType extends Type$1 { /** * @param {?} of * @param {?=} modifiers */ constructor(of, modifiers = null) { super(modifiers); this.of = of; } /** * @param {?} visitor * @param {?} context * @return {?} */ visitType(visitor, context) { return visitor.visitArrayType(this, context); } } class MapType extends Type$1 { /** * @param {?} valueType * @param {?=} modifiers */ constructor(valueType, modifiers = null) { super(modifiers); this.valueType = valueType || null; } /** * @param {?} visitor * @param {?} context * @return {?} */ visitType(visitor, context) { return visitor.visitMapType(this, context); } } const DYNAMIC_TYPE = new BuiltinType(BuiltinTypeName.Dynamic); const INFERRED_TYPE = new BuiltinType(BuiltinTypeName.Inferred); const BOOL_TYPE = new BuiltinType(BuiltinTypeName.Bool); const INT_TYPE = new BuiltinType(BuiltinTypeName.Int); const NUMBER_TYPE = new BuiltinType(BuiltinTypeName.Number); const STRING_TYPE = new BuiltinType(BuiltinTypeName.String); const FUNCTION_TYPE = new BuiltinType(BuiltinTypeName.Function); /** * @record */ /** @enum {number} */ const BinaryOperator = { Equals: 0, NotEquals: 1, Identical: 2, NotIdentical: 3, Minus: 4, Plus: 5, Divide: 6, Multiply: 7, Modulo: 8, And: 9, Or: 10, Lower: 11, LowerEquals: 12, Bigger: 13, BiggerEquals: 14, }; BinaryOperator[BinaryOperator.Equals] = "Equals"; BinaryOperator[BinaryOperator.NotEquals] = "NotEquals"; BinaryOperator[BinaryOperator.Identical] = "Identical"; BinaryOperator[BinaryOperator.NotIdentical] = "NotIdentical"; BinaryOperator[BinaryOperator.Minus] = "Minus"; BinaryOperator[BinaryOperator.Plus] = "Plus"; BinaryOperator[BinaryOperator.Divide] = "Divide"; BinaryOperator[BinaryOperator.Multiply] = "Multiply"; BinaryOperator[BinaryOperator.Modulo] = "Modulo"; BinaryOperator[BinaryOperator.And] = "And"; BinaryOperator[BinaryOperator.Or] = "Or"; BinaryOperator[BinaryOperator.Lower] = "Lower"; BinaryOperator[BinaryOperator.LowerEquals] = "LowerEquals"; BinaryOperator[BinaryOperator.Bigger] = "Bigger"; BinaryOperator[BinaryOperator.BiggerEquals] = "BiggerEquals"; /** * @template T * @param {?} base * @param {?} other * @return {?} */ function nullSafeIsEquivalent(base, other) { if (base == null || other == null) { return base == other; } return base.isEquivalent(other); } /** * @template T * @param {?} base * @param {?} other * @return {?} */ function areAllEquivalent(base, other) { const /** @type {?} */ len = base.length; if (len !== other.length) { return false; } for (let /** @type {?} */ i = 0; i < len; i++) { if (!base[i].isEquivalent(other[i])) { return false; } } return true; } /** * @abstract */ class Expression { /** * @param {?} type * @param {?=} sourceSpan */ constructor(type, sourceSpan) { this.type = type || null; this.sourceSpan = sourceSpan || null; } /** * @param {?} name * @param {?=} sourceSpan * @return {?} */ prop(name, sourceSpan) { return new ReadPropExpr(this, name, null, sourceSpan); } /** * @param {?} index * @param {?=} type * @param {?=} sourceSpan * @return {?} */ key(index, type, sourceSpan) { return new ReadKeyExpr(this, index, type, sourceSpan); } /** * @param {?} name * @param {?} params * @param {?=} sourceSpan * @return {?} */ callMethod(name, params, sourceSpan) { return new InvokeMethodExpr(this, name, params, null, sourceSpan); } /** * @param {?} params * @param {?=} sourceSpan * @return {?} */ callFn(params, sourceSpan) { return new InvokeFunctionExpr(this, params, null, sourceSpan); } /** * @param {?} params * @param {?=} type * @param {?=} sourceSpan * @return {?} */ instantiate(params, type, sourceSpan) { return new InstantiateExpr(this, params, type, sourceSpan); } /** * @param {?} trueCase * @param {?=} falseCase * @param {?=} sourceSpan * @return {?} */ conditional(trueCase, falseCase = null, sourceSpan) { return new ConditionalExpr(this, trueCase, falseCase, null, sourceSpan); } /** * @param {?} rhs * @param {?=} sourceSpan * @return {?} */ equals(rhs, sourceSpan) { return new BinaryOperatorExpr(BinaryOperator.Equals, this, rhs, null, sourceSpan); } /** * @param {?} rhs * @param {?=} sourceSpan * @return {?} */ notEquals(rhs, sourceSpan) { return new BinaryOperatorExpr(BinaryOperator.NotEquals, this, rhs, null, sourceSpan); } /** * @param {?} rhs * @param {?=} sourceSpan * @return {?} */ identical(rhs, sourceSpan) { return new BinaryOperatorExpr(BinaryOperator.Identical, this, rhs, null, sourceSpan); } /** * @param {?} rhs * @param {?=} sourceSpan * @return {?} */ notIdentical(rhs, sourceSpan) { return new BinaryOperatorExpr(BinaryOperator.NotIdentical, this, rhs, null, sourceSpan); } /** * @param {?} rhs * @param {?=} sourceSpan * @return {?} */ minus(rhs, sourceSpan) { return new BinaryOperatorExpr(BinaryOperator.Minus, this, rhs, null, sourceSpan); } /** * @param {?} rhs * @param {?=} sourceSpan * @return {?} */ plus(rhs, sourceSpan) { return new BinaryOperatorExpr(BinaryOperator.Plus, this, rhs, null, sourceSpan); } /** * @param {?} rhs * @param {?=} sourceSpan * @return {?} */ divide(rhs, sourceSpan) { return new BinaryOperatorExpr(BinaryOperator.Divide, this, rhs, null, sourceSpan); } /** * @param {?} rhs * @param {?=} sourceSpan * @return {?} */ multiply(rhs, sourceSpan) { return new BinaryOperatorExpr(BinaryOperator.Multiply, this, rhs, null, sourceSpan); } /** * @param {?} rhs * @param {?=} sourceSpan * @return {?} */ modulo(rhs, sourceSpan) { return new BinaryOperatorExpr(BinaryOperator.Modulo, this, rhs, null, sourceSpan); } /** * @param {?} rhs * @param {?=} sourceSpan * @return {?} */ and(rhs, sourceSpan) { return new BinaryOperatorExpr(BinaryOperator.And, this, rhs, null, sourceSpan); } /** * @param {?} rhs * @param {?=} sourceSpan * @return {?} */ or(rhs, sourceSpan) { return new BinaryOperatorExpr(BinaryOperator.Or, this, rhs, null, sourceSpan); } /** * @param {?} rhs * @param {?=} sourceSpan * @return {?} */ lower(rhs, sourceSpan) { return new BinaryOperatorExpr(BinaryOperator.Lower, this, rhs, null, sourceSpan); } /** * @param {?} rhs * @param {?=} sourceSpan * @return {?} */ lowerEquals(rhs, sourceSpan) { return new BinaryOperatorExpr(BinaryOperator.LowerEquals, this, rhs, null, sourceSpan); } /** * @param {?} rhs * @param {?=} sourceSpan * @return {?} */ bigger(rhs, sourceSpan) { return new BinaryOperatorExpr(BinaryOperator.Bigger, this, rhs, null, sourceSpan); } /** * @param {?} rhs * @param {?=} sourceSpan * @return {?} */ biggerEquals(rhs, sourceSpan) { return new BinaryOperatorExpr(BinaryOperator.BiggerEquals, this, rhs, null, sourceSpan); } /** * @param {?=} sourceSpan * @return {?} */ isBlank(sourceSpan) { // Note: We use equals by purpose here to compare to null and undefined in JS. // We use the typed null to allow strictNullChecks to narrow types. return this.equals(TYPED_NULL_EXPR, sourceSpan); } /** * @param {?} type * @param {?=} sourceSpan * @return {?} */ cast(type, sourceSpan) { return new CastExpr(this, type, sourceSpan); } /** * @return {?} */ toStmt() { return new ExpressionStatement(this, null); } } /** @enum {number} */ const BuiltinVar = { This: 0, Super: 1, CatchError: 2, CatchStack: 3, }; BuiltinVar[BuiltinVar.This] = "This"; BuiltinVar[BuiltinVar.Super] = "Super"; BuiltinVar[BuiltinVar.CatchError] = "CatchError"; BuiltinVar[BuiltinVar.CatchStack] = "CatchStack"; class ReadVarExpr extends Expression { /** * @param {?} name * @param {?=} type * @param {?=} sourceSpan */ constructor(name, type, sourceSpan) { super(type, sourceSpan); if (typeof name === 'string') { this.name = name; this.builtin = null; } else { this.name = null; this.builtin = /** @type {?} */ (name); } } /** * @param {?} e * @return {?} */ isEquivalent(e) { return e instanceof ReadVarExpr && this.name === e.name && this.builtin === e.builtin; } /** * @param {?} visitor * @param {?} context * @return {?} */ visitExpression(visitor, context) { return visitor.visitReadVarExpr(this, context); } /** * @param {?} value * @return {?} */ set(value) { if (!this.name) { throw new Error(`Built in variable ${this.builtin} can not be assigned to.`); } return new WriteVarExpr(this.name, value, null, this.sourceSpan); } } class WriteVarExpr extends Expression { /** * @param {?} name * @param {?} value * @param {?=} type * @param {?=} sourceSpan */ constructor(name, value, type, sourceSpan) { super(type || value.type, sourceSpan); this.name = name; this.value = value; } /** * @param {?} e * @return {?} */ isEquivalent(e) { return e instanceof WriteVarExpr && this.name === e.name && this.value.isEquivalent(e.value); } /** * @param {?} visitor * @param {?} context * @return {?} */ visitExpression(visitor, context) { return visitor.visitWriteVarExpr(this, context); } /** * @param {?=} type * @param {?=} modifiers * @return {?} */ toDeclStmt(type, modifiers) { return new DeclareVarStmt(this.name, this.value, type, modifiers, this.sourceSpan); } } class WriteKeyExpr extends Expression { /** * @param {?} receiver * @param {?} index * @param {?} value * @param {?=} type * @param {?=} sourceSpan */ constructor(receiver, index, value, type, sourceSpan) { super(type || value.type, sourceSpan); this.receiver = receiver; this.index = index; this.value = value; } /** * @param {?} e * @return {?} */ isEquivalent(e) { return e instanceof WriteKeyExpr && this.receiver.isEquivalent(e.receiver) && this.index.isEquivalent(e.index) && this.value.isEquivalent(e.value); } /** * @param {?} visitor * @param {?} context * @return {?} */ visitExpression(visitor, context) { return visitor.visitWriteKeyExpr(this, context); } } class WritePropExpr extends Expression { /** * @param {?} receiver * @param {?} name * @param {?} value * @param {?=} type * @param {?=} sourceSpan */ constructor(receiver, name, value, type, sourceSpan) { super(type || value.type, sourceSpan); this.receiver = receiver; this.name = name; this.value = value; } /** * @param {?} e * @return {?} */ isEquivalent(e) { return e instanceof WritePropExpr && this.receiver.isEquivalent(e.receiver) && this.name === e.name && this.value.isEquivalent(e.value); } /** * @param {?} visitor * @param {?} context * @return {?} */ visitExpression(visitor, context) { return visitor.visitWritePropExpr(this, context); } } /** @enum {number} */ const BuiltinMethod = { ConcatArray: 0, SubscribeObservable: 1, Bind: 2, }; BuiltinMethod[BuiltinMethod.ConcatArray] = "ConcatArray"; BuiltinMethod[BuiltinMethod.SubscribeObservable] = "SubscribeObservable"; BuiltinMethod[BuiltinMethod.Bind] = "Bind"; class InvokeMethodExpr extends Expression { /** * @param {?} receiver * @param {?} method * @param {?} args * @param {?=} type * @param {?=} sourceSpan */ constructor(receiver, method, args, type, sourceSpan) { super(type, sourceSpan); this.receiver = receiver; this.args = args; if (typeof method === 'string') { this.name = method; this.builtin = null; } else { this.name = null; this.builtin = /** @type {?} */ (method); } } /** * @param {?} e * @return {?} */ isEquivalent(e) { return e instanceof InvokeMethodExpr && this.receiver.isEquivalent(e.receiver) && this.name === e.name && this.builtin === e.builtin && areAllEquivalent(this.args, e.args); } /** * @param {?} visitor * @param {?} context * @return {?} */ visitExpression(visitor, context) { return visitor.visitInvokeMethodExpr(this, context); } } class InvokeFunctionExpr extends Expression { /** * @param {?} fn * @param {?} args * @param {?=} type * @param {?=} sourceSpan */ constructor(fn, args, type, sourceSpan) { super(type, sourceSpan); this.fn = fn; this.args = args; } /** * @param {?} e * @return {?} */ isEquivalent(e) { return e instanceof InvokeFunctionExpr && this.fn.isEquivalent(e.fn) && areAllEquivalent(this.args, e.args); } /** * @param {?} visitor * @param {?} context * @return {?} */ visitExpression(visitor, context) { return visitor.visitInvokeFunctionExpr(this, context); } } class InstantiateExpr extends Expression { /** * @param {?} classExpr * @param {?} args * @param {?=} type * @param {?=} sourceSpan */ constructor(classExpr, args, type, sourceSpan) { super(type, sourceSpan); this.classExpr = classExpr; this.args = args; } /** * @param {?} e * @return {?} */ isEquivalent(e) { return e instanceof InstantiateExpr && this.classExpr.isEquivalent(e.classExpr) && areAllEquivalent(this.args, e.args); } /** * @param {?} visitor * @param {?} context * @return {?} */ visitExpression(visitor, context) { return visitor.visitInstantiateExpr(this, context); } } class LiteralExpr extends Expression { /** * @param {?} value * @param {?=} type * @param {?=} sourceSpan */ constructor(value, type, sourceSpan) { super(type, sourceSpan); this.value = value; } /** * @param {?} e * @return {?} */ isEquivalent(e) { return e instanceof LiteralExpr && this.value === e.value; } /** * @param {?} visitor * @param {?} context * @return {?} */ visitExpression(visitor, context) { return visitor.visitLiteralExpr(this, context); } } class ExternalExpr extends Expression { /** * @param {?} value * @param {?=} type * @param {?=} typeParams * @param {?=} sourceSpan */ constructor(value, type, typeParams = null, sourceSpan) { super(type, sourceSpan); this.value = value; this.typeParams = typeParams; } /** * @param {?} e * @return {?} */ isEquivalent(e) { return e instanceof ExternalExpr && this.value.name === e.value.name && this.value.moduleName === e.value.moduleName && this.value.runtime === e.value.runtime; } /** * @param {?} visitor * @param {?} context * @return {?} */ visitExpression(visitor, context) { return visitor.visitExternalExpr(this, context); } } class ExternalReference { /** * @param {?} moduleName * @param {?} name * @param {?=} runtime */ constructor(moduleName, name, runtime) { this.moduleName = moduleName; this.name = name; this.runtime = runtime; } } class ConditionalExpr extends Expression { /** * @param {?} condition * @param {?} trueCase * @param {?=} falseCase * @param {?=} type * @param {?=} sourceSpan */ constructor(condition, trueCase, falseCase = null, type, sourceSpan) { super(type || trueCase.type, sourceSpan); this.condition = condition; this.falseCase = falseCase; this.trueCase = trueCase; } /** * @param {?} e * @return {?} */ isEquivalent(e) { return e instanceof ConditionalExpr && this.condition.isEquivalent(e.condition) && this.trueCase.isEquivalent(e.trueCase) && nullSafeIsEquivalent(this.falseCase, e.falseCase); } /** * @param {?} visitor * @param {?} context * @return {?} */ visitExpression(visitor, context) { return visitor.visitConditionalExpr(this, context); } } class NotExpr extends Expression { /** * @param {?} condition * @param {?=} sourceSpan */ constructor(condition, sourceSpan) { super(BOOL_TYPE, sourceSpan); this.condition = condition; } /** * @param {?} e * @return {?} */ isEquivalent(e) { return e instanceof NotExpr && this.condition.isEquivalent(e.condition); } /** * @param {?} visitor * @param {?} context * @return {?} */ visitExpression(visitor, context) { return visitor.visitNotExpr(this, context); } } class AssertNotNull extends Expression { /** * @param {?} condition * @param {?=} sourceSpan */ constructor(condition, sourceSpan) { super(condition.type, sourceSpan); this.condition = condition; } /** * @param {?} e * @return {?} */ isEquivalent(e) { return e instanceof AssertNotNull && this.condition.isEquivalent(e.condition); } /** * @param {?} visitor * @param {?} context * @return {?} */ visitExpression(visitor, context) { return visitor.visitAssertNotNullExpr(this, context); } } class CastExpr extends Expression { /** * @param {?} value * @param {?=} type * @param {?=} sourceSpan */ constructor(value, type, sourceSpan) { super(type, sourceSpan); this.value = value; } /** * @param {?} e * @return {?} */ isEquivalent(e) { return e instanceof CastExpr && this.value.isEquivalent(e.value); } /** * @param {?} visitor * @param {?} context * @return {?} */ visitExpression(visitor, context) { return visitor.visitCastExpr(this, context); } } class FnParam { /** * @param {?} name * @param {?=} type */ constructor(name, type = null) { this.name = name; this.type = type; } /** * @param {?} param * @return {?} */ isEquivalent(param) { return this.name === param.name; } } class FunctionExpr extends Expression { /** * @param {?} params * @param {?} statements * @param {?=} type * @param {?=} sourceSpan */ constructor(params, statements, type, sourceSpan) { super(type, sourceSpan); this.params = params; this.statements = statements; } /** * @param {?} e * @return {?} */ isEquivalent(e) { return e instanceof FunctionExpr && areAllEquivalent(this.params, e.params) && areAllEquivalent(this.statements, e.statements); } /** * @param {?} visitor * @param {?} context * @return {?} */ visitExpression(visitor, context) { return visitor.visitFunctionExpr(this, context); } /** * @param {?} name * @param {?=} modifiers * @return {?} */ toDeclStmt(name, modifiers = null) { return new DeclareFunctionStmt(name, this.params, this.statements, this.type, modifiers, this.sourceSpan); } } class BinaryOperatorExpr extends Expression { /** * @param {?} operator * @param {?} lhs * @param {?} rhs * @param {?=} type * @param {?=} sourceSpan */ constructor(operator, lhs, rhs, type, sourceSpan) { super(type || lhs.type, sourceSpan); this.operator = operator; this.rhs = rhs; this.lhs = lhs; } /** * @param {?} e * @return {?} */ isEquivalent(e) { return e instanceof BinaryOperatorExpr && this.operator === e.operator && this.lhs.isEquivalent(e.lhs) && this.rhs.isEquivalent(e.rhs); } /** * @param {?} visitor * @param {?} context * @return {?} */ visitExpression(visitor, context) { return visitor.visitBinaryOperatorExpr(this, context); } } class ReadPropExpr extends Expression { /** * @param {?} receiver * @param {?} name * @param {?=} type * @param {?=} sourceSpan */ constructor(receiver, name, type, sourceSpan) { super(type, sourceSpan); this.receiver = receiver; this.name = name; } /** * @param {?} e * @return {?} */ isEquivalent(e) { return e instanceof ReadPropExpr && this.receiver.isEquivalent(e.receiver) && this.name === e.name; } /** * @param {?} visitor * @param {?} context * @return {?} */ visitExpression(visitor, context) { return visitor.visitReadPropExpr(this, context); } /** * @param {?} value * @return {?} */ set(value) { return new WritePropExpr(this.receiver, this.name, value, null, this.sourceSpan); } } class ReadKeyExpr extends Expression { /** * @param {?} receiver * @param {?} index * @param {?=} type * @param {?=} sourceSpan */ constructor(receiver, index, type, sourceSpan) { super(type, sourceSpan); this.receiver = receiver; this.index = index; } /** * @param {?} e * @return {?} */ isEquivalent(e) { return e instanceof ReadKeyExpr && this.receiver.isEquivalent(e.receiver) && this.index.isEquivalent(e.index); } /** * @param {?} visitor * @param {?} context * @return {?} */ visitExpression(visitor, context) { return visitor.visitReadKeyExpr(this, context); } /** * @param {?} value * @return {?} */ set(value) { return new WriteKeyExpr(this.receiver, this.index, value, null, this.sourceSpan); } } class LiteralArrayExpr extends Expression { /** * @param {?} entries * @param {?=} type * @param {?=} sourceSpan */ constructor(entries, type, sourceSpan) { super(type, sourceSpan); this.entries = entries; } /** * @param {?} e * @return {?} */ isEquivalent(e) { return e instanceof LiteralArrayExpr && areAllEquivalent(this.entries, e.entries); } /** * @param {?} visitor * @param {?} context * @return {?} */ visitExpression(visitor, context) { return visitor.visitLiteralArrayExpr(this, context); } } class LiteralMapEntry { /** * @param {?} key * @param {?} value * @param {?} quoted */ constructor(key, value, quoted) { this.key = key; this.value = value; this.quoted = quoted; } /** * @param {?} e * @return {?} */ isEquivalent(e) { return this.key === e.key && this.value.isEquivalent(e.value); } } class LiteralMapExpr extends Expression { /** * @param {?} entries * @param {?=} type * @param {?=} sourceSpan */ constructor(entries, type, sourceSpan) { super(type, sourceSpan); this.entries = entries; this.valueType = null; if (type) { this.valueType = type.valueType; } } /** * @param {?} e * @return {?} */ isEquivalent(e) { return e instanceof LiteralMapExpr && areAllEquivalent(this.entries, e.entries); } /** * @param {?} visitor * @param {?} context * @return {?} */ visitExpression(visitor, context) { return visitor.visitLiteralMapExpr(this, context); } } class CommaExpr extends Expression { /** * @param {?} parts * @param {?=} sourceSpan */ constructor(parts, sourceSpan) { super(parts[parts.length - 1].type, sourceSpan); this.parts = parts; } /** * @param {?} e * @return {?} */ isEquivalent(e) { return e instanceof CommaExpr && areAllEquivalent(this.parts, e.parts); } /** * @param {?} visitor * @param {?} context * @return {?} */ visitExpression(visitor, context) { return visitor.visitCommaExpr(this, context); } } /** * @record */ const THIS_EXPR = new ReadVarExpr(BuiltinVar.This, null, null); const SUPER_EXPR = new ReadVarExpr(BuiltinVar.Super, null, null); const CATCH_ERROR_VAR = new ReadVarExpr(BuiltinVar.CatchError, null, null); const CATCH_STACK_VAR = new ReadVarExpr(BuiltinVar.CatchStack, null, null); const NULL_EXPR = new LiteralExpr(null, null, null); const TYPED_NULL_EXPR = new LiteralExpr(null, INFERRED_TYPE, null); /** @enum {number} */ const StmtModifier = { Final: 0, Private: 1, Exported: 2, }; StmtModifier[StmtModifier.Final] = "Final"; StmtModifier[StmtModifier.Private] = "Private"; StmtModifier[StmtModifier.Exported] = "Exported"; /** * @abstract */ class Statement { /** * @param {?=} modifiers * @param {?=} sourceSpan */ constructor(modifiers, sourceSpan) { this.modifiers = modifiers || []; this.sourceSpan = sourceSpan || null; } /** * @param {?} modifier * @return {?} */ hasModifier(modifier) { return /** @type {?} */ ((this.modifiers)).indexOf(modifier) !== -1; } } class DeclareVarStmt extends Statement { /** * @param {?} name * @param {?} value * @param {?=} type * @param {?=} modifiers * @param {?=} sourceSpan */ constructor(name, value, type, modifiers = null, sourceSpan) { super(modifiers, sourceSpan); this.name = name; this.value = value; this.type = type || value.type; } /** * @param {?} stmt * @return {?} */ isEquivalent(stmt) { return stmt instanceof DeclareVarStmt && this.name === stmt.name && this.value.isEquivalent(stmt.value); } /** * @param {?} visitor * @param {?} context * @return {?} */ visitStatement(visitor, context) { return visitor.visitDeclareVarStmt(this, context); } } class DeclareFunctionStmt extends Statement { /** * @param {?} name * @param {?} params * @param {?} statements * @param {?=} type * @param {?=} modifiers * @param {?=} sourceSpan */ constructor(name, params, statements, type, modifiers = null, sourceSpan) { super(modifiers, sourceSpan); this.name = name; this.params = params; this.statements = statements; this.type = type || null; } /** * @param {?} stmt * @return {?} */ isEquivalent(stmt) { return stmt instanceof DeclareFunctionStmt && areAllEquivalent(this.params, stmt.params) && areAllEquivalent(this.statements, stmt.statements); } /** * @param {?} visitor * @param {?} context * @return {?} */ visitStatement(visitor, context) { return visitor.visitDeclareFunctionStmt(this, context); } } class ExpressionStatement extends Statement { /** * @param {?} expr * @param {?=} sourceSpan */ constructor(expr, sourceSpan) { super(null, sourceSpan); this.expr = expr; } /** * @param {?} stmt * @return {?} */ isEquivalent(stmt) { return stmt instanceof ExpressionStatement && this.expr.isEquivalent(stmt.expr); } /** * @param {?} visitor * @param {?} context * @return {?} */ visitStatement(visitor, context) { return visitor.visitExpressionStmt(this, context); } } class ReturnStatement extends Statement { /** * @param {?} value * @param {?=} sourceSpan */ constructor(value, sourceSpan) { super(null, sourceSpan); this.value = value; } /** * @param {?} stmt * @return {?} */ isEquivalent(stmt) { return stmt instanceof ReturnStatement && this.value.isEquivalent(stmt.value); } /** * @param {?} visitor * @param {?} context * @return {?} */ visitStatement(visitor, context) { return visitor.visitReturnStmt(this, context); } } class AbstractClassPart { /** * @param {?} type * @param {?} modifiers */ constructor(type, modifiers) { this.modifiers = modifiers; if (!modifiers) { this.modifiers = []; } this.type = type || null; } /** * @param {?} modifier * @return {?} */ hasModifier(modifier) { return /** @type {?} */ ((this.modifiers)).indexOf(modifier) !== -1; } } class ClassMethod extends AbstractClassPart { /** * @param {?} name * @param {?} params * @param {?} body * @param {?=} type * @param {?=} modifiers */ constructor(name, params, body, type, modifiers = null) { super(type, modifiers); this.name = name; this.params = params; this.body = body; } /** * @param {?} m * @return {?} */ isEquivalent(m) { return this.name === m.name && areAllEquivalent(this.body, m.body); } } class ClassGetter extends AbstractClassPart { /** * @param {?} name * @param {?} body * @param {?=} type * @param {?=} modifiers */ constructor(name, body, type, modifiers = null) { super(type, modifiers); this.name = name; this.body = body; } /** * @param {?} m * @return {?} */ isEquivalent(m) { return this.name === m.name && areAllEquivalent(this.body, m.body); } } class ClassStmt extends Statement { /** * @param {?} name * @param {?} parent * @param {?} fields * @param {?} getters * @param {?} constructorMethod * @param {?} methods * @param {?=} modifiers * @param {?=} sourceSpan */ constructor(name, parent, fields, getters, constructorMethod, methods, modifiers = null, sourceSpan) { super(modifiers, sourceSpan); this.name = name; this.parent = parent; this.fields = fields; this.getters = getters; this.constructorMethod = constructorMethod; this.methods = methods; } /** * @param {?} stmt * @return {?} */ isEquivalent(stmt) { return stmt instanceof ClassStmt && this.name === stmt.name && nullSafeIsEquivalent(this.parent, stmt.parent) && areAllEquivalent(this.fields, stmt.fields) && areAllEquivalent(this.getters, stmt.getters) && this.constructorMethod.isEquivalent(stmt.constructorMethod) && areAllEquivalent(this.methods, stmt.methods); } /** * @param {?} visitor * @param {?} context * @return {?} */ visitStatement(visitor, context) { return visitor.visitDeclareClassStmt(this, context); } } class IfStmt extends Statement { /** * @param {?} condition * @param {?} trueCase * @param {?=} falseCase * @param {?=} sourceSpan */ constructor(condition, trueCase, falseCase = [], sourceSpan) { super(null, sourceSpan); this.condition = condition; this.trueCase = trueCase; this.falseCase = falseCase; } /** * @param {?} stmt * @return {?} */ isEquivalent(stmt) { return stmt instanceof IfStmt && this.condition.isEquivalent(stmt.condition) && areAllEquivalent(this.trueCase, stmt.trueCase) && areAllEquivalent(this.falseCase, stmt.falseCase); } /** * @param {?} visitor * @param {?} context * @return {?} */ visitStatement(visitor, context) { return visitor.visitIfStmt(this, context); } } class CommentStmt extends Statement { /** * @param {?} comment * @param {?=} sourceSpan */ constructor(comment, sourceSpan) { super(null, sourceSpan); this.comment = comment; } /** * @param {?} stmt * @return {?} */ isEquivalent(stmt) { return stmt instanceof CommentStmt; } /** * @param {?} visitor * @param {?} context * @return {?} */ visitStatement(visitor, context) { return visitor.visitCommentStmt(this, context); } } class TryCatchStmt extends Statement { /** * @param {?} bodyStmts * @param {?} catchStmts * @param {?=} sourceSpan */ constructor(bodyStmts, catchStmts, sourceSpan) { super(null, sourceSpan); this.bodyStmts = bodyStmts; this.catchStmts = catchStmts; } /** * @param {?} stmt * @return {?} */ isEquivalent(stmt) { return stmt instanceof TryCatchStmt && areAllEquivalent(this.bodyStmts, stmt.bodyStmts) && areAllEquivalent(this.catchStmts, stmt.catchStmts); } /** * @param {?} visitor * @param {?} context * @return {?} */ visitStatement(visitor, context) { return visitor.visitTryCatchStmt(this, context); } } class ThrowStmt extends Statement { /** * @param {?} error * @param {?=} sourceSpan */ constructor(error, sourceSpan) { super(null, sourceSpan); this.error = error; } /** * @param {?} stmt * @return {?} */ isEquivalent(stmt) { return stmt instanceof TryCatchStmt && this.error.isEquivalent(stmt.error); } /** * @param {?} visitor * @param {?} context * @return {?} */ visitStatement(visitor, context) { return visitor.visitThrowStmt(this, context); } } /** * @record */ class AstTransformer$1 { /** * @param {?} expr * @param {?} context * @return {?} */ transformExpr(expr, context) { return expr; } /** * @param {?} stmt * @param {?} context * @return {?} */ transformStmt(stmt, context) { return stmt; } /** * @param {?} ast * @param {?} context * @return {?} */ visitReadVarExpr(ast, context) { return this.transformExpr(ast, context); } /** * @param {?} expr * @param {?} context * @return {?} */ visitWriteVarExpr(expr, context) { return this.transformExpr(new WriteVarExpr(expr.name, expr.value.visitExpression(this, context), expr.type, expr.sourceSpan), context); } /** * @param {?} expr * @param {?} context * @return {?} */ visitWriteKeyExpr(expr, context) { return this.transformExpr(new WriteKeyExpr(expr.receiver.visitExpression(this, context), expr.index.visitExpression(this, context), expr.value.visitExpression(this, context), expr.type, expr.sourceSpan), context); } /** * @param {?} expr * @param {?} context * @return {?} */ visitWritePropExpr(expr, context) { return this.transformExpr(new WritePropExpr(expr.receiver.visitExpression(this, context), expr.name, expr.value.visitExpression(this, context), expr.type, expr.sourceSpan), context); } /** * @param {?} ast * @param {?} context * @return {?} */ visitInvokeMethodExpr(ast, context) { const /** @type {?} */ method = ast.builtin || ast.name; return this.transformExpr(new InvokeMethodExpr(ast.receiver.visitExpression(this, context), /** @type {?} */ ((method)), this.visitAllExpressions(ast.args, context), ast.type, ast.sourceSpan), context); } /** * @param {?} ast * @param {?} context * @return {?} */ visitInvokeFunctionExpr(ast, context) { return this.transformExpr(new InvokeFunctionExpr(ast.fn.visitExpression(this, context), this.visitAllExpressions(ast.args, context), ast.type, ast.sourceSpan), context); } /** * @param {?} ast * @param {?} context * @return {?} */ visitInstantiateExpr(ast, context) { return this.transformExpr(new InstantiateExpr(ast.classExpr.visitExpression(this, context), this.visitAllExpressions(ast.args, context), ast.type, ast.sourceSpan), context); } /** * @param {?} ast * @param {?} context * @return {?} */ visitLiteralExpr(ast, context) { return this.transformExpr(ast, context); } /** * @param {?} ast * @param {?} context * @return {?} */ visitExternalExpr(ast, context) { return this.transformExpr(ast, context); } /** * @param {?} ast * @param {?} context * @return {?} */ visitConditionalExpr(ast, context) { return this.transformExpr(new ConditionalExpr(ast.condition.visitExpression(this, context), ast.trueCase.visitExpression(this, context), /** @type {?} */ ((ast.falseCase)).visitExpression(this, context), ast.type, ast.sourceSpan), context); } /** * @param {?} ast * @param {?} context * @return {?} */ visitNotExpr(ast, context) { return this.transformExpr(new NotExpr(ast.condition.visitExpression(this, context), ast.sourceSpan), context); } /** * @param {?} ast * @param {?} context * @return {?} */ visitAssertNotNullExpr(ast, context) { return this.transformExpr(new AssertNotNull(ast.condition.visitExpression(this, context), ast.sourceSpan), context); } /** * @param {?} ast * @param {?} context * @return {?} */ visitCastExpr(ast, context) { return this.transformExpr(new CastExpr(ast.value.visitExpression(this, context), ast.type, ast.sourceSpan), context); } /** * @param {?} ast * @param {?} context * @return {?} */ visitFunctionExpr(ast, context) { return this.transformExpr(new FunctionExpr(ast.params, this.visitAllStatements(ast.statements, context), ast.type, ast.sourceSpan), context); } /** * @param {?} ast * @param {?} context * @return {?} */ visitBinaryOperatorExpr(ast, context) { return this.transformExpr(new BinaryOperatorExpr(ast.operator, ast.lhs.visitExpression(this, context), ast.rhs.visitExpression(this, context), ast.type, ast.sourceSpan), context); } /** * @param {?} ast * @param {?} context * @return {?} */ visitReadPropExpr(ast, context) { return this.transformExpr(new ReadPropExpr(ast.receiver.visitExpression(this, context), ast.name, ast.type, ast.sourceSpan), context); } /** * @param {?} ast * @param {?} context * @return {?} */ visitReadKeyExpr(ast, context) { return this.transformExpr(new ReadKeyExpr(ast.receiver.visitExpression(this, context), ast.index.visitExpression(this, context), ast.type, ast.sourceSpan), context); } /** * @param {?} ast * @param {?} context * @return {?} */ visitLiteralArrayExpr(ast, context) { return this.transformExpr(new LiteralArrayExpr(this.visitAllExpressions(ast.entries, context), ast.type, ast.sourceSpan), context); } /** * @param {?} ast * @param {?} context * @return {?} */ visitLiteralMapExpr(ast, context) { const /** @type {?} */ entries = ast.entries.map((entry) => new LiteralMapEntry(entry.key, entry.value.visitExpression(this, context), entry.quoted)); const /** @type {?} */ mapType = new MapType(ast.valueType, null); return this.transformExpr(new LiteralMapExpr(entries, mapType, ast.sourceSpan), context); } /** * @param {?} ast * @param {?} context * @return {?} */ visitCommaExpr(ast, context) { return this.transformExpr(new CommaExpr(this.visitAllExpressions(ast.parts, context), ast.sourceSpan), context); } /** * @param {?} exprs * @param {?} context * @return {?} */ visitAllExpressions(exprs, context) { return exprs.map(expr => expr.visitExpression(this, context)); } /** * @param {?} stmt * @param {?} context * @return {?} */ visitDeclareVarStmt(stmt, context) { return this.transformStmt(new DeclareVarStmt(stmt.name, stmt.value.visitExpression(this, context), stmt.type, stmt.modifiers, stmt.sourceSpan), context); } /** * @param {?} stmt * @param {?} context * @return {?} */ visitDeclareFunctionStmt(stmt, context) { return this.transformStmt(new DeclareFunctionStmt(stmt.name, stmt.params, this.visitAllStatements(stmt.statements, context), stmt.type, stmt.modifiers, stmt.sourceSpan), context); } /** * @param {?} stmt * @param {?} context * @return {?} */ visitExpressionStmt(stmt, context) { return this.transformStmt(new ExpressionStatement(stmt.expr.visitExpression(this, context), stmt.sourceSpan), context); } /** * @param {?} stmt * @param {?} context * @return {?} */ visitReturnStmt(stmt, context) { return this.transformStmt(new ReturnStatement(stmt.value.visitExpression(this, context), stmt.sourceSpan), context); } /** * @param {?} stmt * @param {?} context * @return {?} */ visitDeclareClassStmt(stmt, context) { const /** @type {?} */ parent = /** @type {?} */ ((stmt.parent)).visitExpression(this, context); const /** @type {?} */ getters = stmt.getters.map(getter => new ClassGetter(getter.name, this.visitAllStatements(getter.body, context), getter.type, getter.modifiers)); const /** @type {?} */ ctorMethod = stmt.constructorMethod && new ClassMethod(stmt.constructorMethod.name, stmt.constructorMethod.params, this.visitAllStatements(stmt.constructorMethod.body, context), stmt.constructorMethod.type, stmt.constructorMethod.modifiers); const /** @type {?} */ methods = stmt.methods.map(method => new ClassMethod(method.name, method.params, this.visitAllStatements(method.body, context), method.type, method.modifiers)); return this.transformStmt(new ClassStmt(stmt.name, parent, stmt.fields, getters, ctorMethod, methods, stmt.modifiers, stmt.sourceSpan), context); } /** * @param {?} stmt * @param {?} context * @return {?} */ visitIfStmt(stmt, context) { return this.transformStmt(new IfStmt(stmt.condition.visitExpression(this, context), this.visitAllStatements(stmt.trueCase, context), this.visitAllStatements(stmt.falseCase, context), stmt.sourceSpan), context); } /** * @param {?} stmt * @param {?} context * @return {?} */ visitTryCatchStmt(stmt, context) { return this.transformStmt(new TryCatchStmt(this.visitAllStatements(stmt.bodyStmts, context), this.visitAllStatements(stmt.catchStmts, context), stmt.sourceSpan), context); } /** * @param {?} stmt * @param {?} context * @return {?} */ visitThrowStmt(stmt, context) { return this.transformStmt(new ThrowStmt(stmt.error.visitExpression(this, context), stmt.sourceSpan), context); } /** * @param {?} stmt * @param {?} context * @return {?} */ visitCommentStmt(stmt, context) { return this.transformStmt(stmt, context); } /** * @param {?} stmts * @param {?} context * @return {?} */ visitAllStatements(stmts, context) { return stmts.map(stmt => stmt.visitStatement(this, context)); } } class RecursiveAstVisitor$1 { /** * @param {?} ast * @param {?} context * @return {?} */ visitType(ast, context) { return ast; } /** * @param {?} ast * @param {?} context * @return {?} */ visitExpression(ast, context) { if (ast.type) { ast.type.visitType(this, context); } return ast; } /** * @param {?} type * @param {?} context * @return {?} */ visitBuiltintType(type, context) { return this.visitType(type, context); } /** * @param {?} type * @param {?} context * @return {?} */ visitExpressionType(type, context) { type.value.visitExpression(this, context); return this.visitType(type, context); } /** * @param {?} type * @param {?} context * @return {?} */ visitArrayType(type, context) { return this.visitType(type, context); } /** * @param {?} type * @param {?} context * @return {?} */ visitMapType(type, context) { return this.visitType(type, context); } /** * @param {?} ast * @param {?} context * @return {?} */ visitReadVarExpr(ast, context) { return this.visitExpression(ast, context); } /** * @param {?} ast * @param {?} context * @return {?} */ visitWriteVarExpr(ast, context) { ast.value.visitExpression(this, context); return this.visitExpression(ast, context); } /** * @param {?} ast * @param {?} context * @return {?} */ visitWriteKeyExpr(ast, context) { ast.receiver.visitExpression(this, context); ast.index.visitExpression(this, context); ast.value.visitExpression(this, context); return this.visitExpression(ast, context); } /** * @param {?} ast * @param {?} context * @return {?} */ visitWritePropExpr(ast, context) { ast.receiver.visitExpression(this, context); ast.value.visitExpression(this, context); return this.visitExpression(ast, context); } /** * @param {?} ast * @param {?} context * @return {?} */ visitInvokeMethodExpr(ast, context) { ast.receiver.visitExpression(this, context); this.visitAllExpressions(ast.args, context); return this.visitExpression(ast, context); } /** * @param {?} ast * @param {?} context * @return {?} */ visitInvokeFunctionExpr(ast, context) { ast.fn.visitExpression(this, context); this.visitAllExpressions(ast.args, context); return this.visitExpression(ast, context); } /** * @param {?} ast * @param {?} context * @return {?} */ visitInstantiateExpr(ast, context) { ast.classExpr.visitExpression(this, context); this.visitAllExpressions(ast.args, context); return this.visitExpression(ast, context); } /** * @param {?} ast * @param {?} context * @return {?} */ visitLiteralExpr(ast, context) { return this.visitExpression(ast, context); } /** * @param {?} ast * @param {?} context * @return {?} */ visitExternalExpr(ast, context) { if (ast.typeParams) { ast.typeParams.forEach(type => type.visitType(this, context)); } return this.visitExpression(ast, context); } /** * @param {?} ast * @param {?} context * @return {?} */ visitConditionalExpr(ast, context) { ast.condition.visitExpression(this, context); ast.trueCase.visitExpression(this, context); /** @type {?} */ ((ast.falseCase)).visitExpression(this, context); return this.visitExpression(ast, context); } /** * @param {?} ast * @param {?} context * @return {?} */ visitNotExpr(ast, context) { ast.condition.visitExpression(this, context); return this.visitExpression(ast, context); } /** * @param {?} ast * @param {?} context * @return {?} */ visitAssertNotNullExpr(ast, context) { ast.condition.visitExpression(this, context); return this.visitExpression(ast, context); } /** * @param {?} ast * @param {?} context * @return {?} */ visitCastExpr(ast, context) { ast.value.visitExpression(this, context); return this.visitExpression(ast, context); } /** * @param {?} ast * @param {?} context * @return {?} */ visitFunctionExpr(ast, context) { this.visitAllStatements(ast.statements, context); return this.visitExpression(ast, context); } /** * @param {?} ast * @param {?} context * @return {?} */ visitBinaryOperatorExpr(ast, context) { ast.lhs.visitExpression(this, context); ast.rhs.visitExpression(this, context); return this.visitExpression(ast, context); } /** * @param {?} ast * @param {?} context * @return {?} */ visitReadPropExpr(ast, context) { ast.receiver.visitExpression(this, context); return this.visitExpression(ast, context); } /** * @param {?} ast * @param {?} context * @return {?} */ visitReadKeyExpr(ast, context) { ast.receiver.visitExpression(this, context); ast.index.visitExpression(this, context); return this.visitExpression(ast, context); } /** * @param {?} ast * @param {?} context * @return {?} */ visitLiteralArrayExpr(ast, context) { this.visitAllExpressions(ast.entries, context); return this.visitExpression(ast, context); } /** * @param {?} ast * @param {?} context * @return {?} */ visitLiteralMapExpr(ast, context) { ast.entries.forEach((entry) => entry.value.visitExpression(this, context)); return this.visitExpression(ast, context); } /** * @param {?} ast * @param {?} context * @return {?} */ visitCommaExpr(ast, context) { this.visitAllExpressions(ast.parts, context); return this.visitExpression(ast, context); } /** * @param {?} exprs * @param {?} context * @return {?} */ visitAllExpressions(exprs, context) { exprs.forEach(expr => expr.visitExpression(this, context)); } /** * @param {?} stmt * @param {?} context * @return {?} */ visitDeclareVarStmt(stmt, context) { stmt.value.visitExpression(this, context); if (stmt.type) { stmt.type.visitType(this, context); } return stmt; } /** * @param {?} stmt * @param {?} context * @return {?} */ visitDeclareFunctionStmt(stmt, context) { this.visitAllStatements(stmt.statements, context); if (stmt.type) { stmt.type.visitType(this, context); } return stmt; } /** * @param {?} stmt * @param {?} context * @return {?} */ visitExpressionStmt(stmt, context) { stmt.expr.visitExpression(this, context); return stmt; } /** * @param {?} stmt * @param {?} context * @return {?} */ visitReturnStmt(stmt, context) { stmt.value.visitExpression(this, context); return stmt; } /** * @param {?} stmt * @param {?} context * @return {?} */ visitDeclareClassStmt(stmt, context) { /** @type {?} */ ((stmt.parent)).visitExpression(this, context); stmt.getters.forEach(getter => this.visitAllStatements(getter.body, context)); if (stmt.constructorMethod) { this.visitAllStatements(stmt.constructorMethod.body, context); } stmt.methods.forEach(method => this.visitAllStatements(method.body, context)); return stmt; } /** * @param {?} stmt * @param {?} context * @return {?} */ visitIfStmt(stmt, context) { stmt.condition.visitExpression(this, context); this.visitAllStatements(stmt.trueCase, context); this.visitAllStatements(stmt.falseCase, context); return stmt; } /** * @param {?} stmt * @param {?} context * @return {?} */ visitTryCatchStmt(stmt, context) { this.visitAllStatements(stmt.bodyStmts, context); this.visitAllStatements(stmt.catchStmts, context); return stmt; } /** * @param {?} stmt * @param {?} context * @return {?} */ visitThrowStmt(stmt, context) { stmt.error.visitExpression(this, context); return stmt; } /** * @param {?} stmt * @param {?} context * @return {?} */ visitCommentStmt(stmt, context) { return stmt; } /** * @param {?} stmts * @param {?} context * @return {?} */ visitAllStatements(stmts, context) { stmts.forEach(stmt => stmt.visitStatement(this, context)); } } /** * @param {?} stmts * @return {?} */ function findReadVarNames(stmts) { const /** @type {?} */ visitor = new _ReadVarVisitor(); visitor.visitAllStatements(stmts, null); return visitor.varNames; } class _ReadVarVisitor extends RecursiveAstVisitor$1 { constructor() { super(...arguments); this.varNames = new Set(); } /** * @param {?} stmt * @param {?} context * @return {?} */ visitDeclareFunctionStmt(stmt, context) { // Don't descend into nested functions return stmt; } /** * @param {?} stmt * @param {?} context * @return {?} */ visitDeclareClassStmt(stmt, context) { // Don't descend into nested classes return stmt; } /** * @param {?} ast * @param {?} context * @return {?} */ visitReadVarExpr(ast, context) { if (ast.name) { this.varNames.add(ast.name); } return null; } } /** * @param {?} stmts * @return {?} */ function collectExternalReferences(stmts) { const /** @type {?} */ visitor = new _FindExternalReferencesVisitor(); visitor.visitAllStatements(stmts, null); return visitor.externalReferences; } class _FindExternalReferencesVisitor extends RecursiveAstVisitor$1 { constructor() { super(...arguments); this.externalReferences = []; } /** * @param {?} e * @param {?} context * @return {?} */ visitExternalExpr(e, context) { this.externalReferences.push(e.value); return super.visitExternalExpr(e, context); } } /** * @param {?} stmt * @param {?} sourceSpan * @return {?} */ function applySourceSpanToStatementIfNeeded(stmt, sourceSpan) { if (!sourceSpan) { return stmt; } const /** @type {?} */ transformer = new _ApplySourceSpanTransformer(sourceSpan); return stmt.visitStatement(transformer, null); } /** * @param {?} expr * @param {?} sourceSpan * @return {?} */ function applySourceSpanToExpressionIfNeeded(expr, sourceSpan) { if (!sourceSpan) { return expr; } const /** @type {?} */ transformer = new _ApplySourceSpanTransformer(sourceSpan); return expr.visitExpression(transformer, null); } class _ApplySourceSpanTransformer extends AstTransformer$1 { /** * @param {?} sourceSpan */ constructor(sourceSpan) { super(); this.sourceSpan = sourceSpan; } /** * @param {?} obj * @return {?} */ _clone(obj) { const /** @type {?} */ clone = Object.create(obj.constructor.prototype); for (let /** @type {?} */ prop in obj) { clone[prop] = obj[prop]; } return clone; } /** * @param {?} expr * @param {?} context * @return {?} */ transformExpr(expr, context) { if (!expr.sourceSpan) { expr = this._clone(expr); expr.sourceSpan = this.sourceSpan; } return expr; } /** * @param {?} stmt * @param {?} context * @return {?} */ transformStmt(stmt, context) { if (!stmt.sourceSpan) { stmt = this._clone(stmt); stmt.sourceSpan = this.sourceSpan; } return stmt; } } /** * @param {?} name * @param {?=} type * @param {?=} sourceSpan * @return {?} */ function variable(name, type, sourceSpan) { return new ReadVarExpr(name, type, sourceSpan); } /** * @param {?} id * @param {?=} typeParams * @param {?=} sourceSpan * @return {?} */ function importExpr(id, typeParams = null, sourceSpan) { return new ExternalExpr(id, null, typeParams, sourceSpan); } /** * @param {?} id * @param {?=} typeParams * @param {?=} typeModifiers * @return {?} */ function importType(id, typeParams = null, typeModifiers = null) { return id != null ? expressionType(importExpr(id, typeParams, null), typeModifiers) : null; } /** * @param {?} expr * @param {?=} typeModifiers * @return {?} */ function expressionType(expr, typeModifiers = null) { return new ExpressionType(expr, typeModifiers); } /** * @param {?} values * @param {?=} type * @param {?=} sourceSpan * @return {?} */ function literalArr(values, type, sourceSpan) { return new LiteralArrayExpr(values, type, sourceSpan); } /** * @param {?} values * @param {?=} type * @return {?} */ function literalMap(values, type = null) { return new LiteralMapExpr(values.map(e => new LiteralMapEntry(e.key, e.value, e.quoted)), type, null); } /** * @param {?} expr * @param {?=} sourceSpan * @return {?} */ function not(expr, sourceSpan) { return new NotExpr(expr, sourceSpan); } /** * @param {?} expr * @param {?=} sourceSpan * @return {?} */ function assertNotNull(expr, sourceSpan) { return new AssertNotNull(expr, sourceSpan); } /** * @param {?} params * @param {?} body * @param {?=} type * @param {?=} sourceSpan * @return {?} */ function fn(params, body, type, sourceSpan) { return new FunctionExpr(params, body, type, sourceSpan); } /** * @param {?} value * @param {?=} type * @param {?=} sourceSpan * @return {?} */ function literal(value, type, sourceSpan) { return new LiteralExpr(value, type, sourceSpan); } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ class ProviderError extends ParseError { /** * @param {?} message * @param {?} span */ constructor(message, span) { super(span, message); } } /** * @record */ class ProviderViewContext { /** * @param {?} reflector * @param {?} component */ constructor(reflector, component) { this.reflector = reflector; this.component = component; this.errors = []; this.viewQueries = _getViewQueries(component); this.viewProviders = new Map(); component.viewProviders.forEach((provider) => { if (this.viewProviders.get(tokenReference(provider.token)) == null) { this.viewProviders.set(tokenReference(provider.token), true); } }); } } class ProviderElementContext { /** * @param {?} viewContext * @param {?} _parent * @param {?} _isViewRoot * @param {?} _directiveAsts * @param {?} attrs * @param {?} refs * @param {?} isTemplate * @param {?} contentQueryStartId * @param {?} _sourceSpan */ constructor(viewContext, _parent, _isViewRoot, _directiveAsts, attrs, refs, isTemplate, contentQueryStartId, _sourceSpan) { this.viewContext = viewContext; this._parent = _parent; this._isViewRoot = _isViewRoot; this._directiveAsts = _directiveAsts; this._sourceSpan = _sourceSpan; this._transformedProviders = new Map(); this._seenProviders = new Map(); this._queriedTokens = new Map(); this.transformedHasViewContainer = false; this._attrs = {}; attrs.forEach((attrAst) => this._attrs[attrAst.name] = attrAst.value); const /** @type {?} */ directivesMeta = _directiveAsts.map(directiveAst => directiveAst.directive); this._allProviders = _resolveProvidersFromDirectives(directivesMeta, _sourceSpan, viewContext.errors); this._contentQueries = _getContentQueries(contentQueryStartId, directivesMeta); Array.from(this._allProviders.values()).forEach((provider) => { this._addQueryReadsTo(provider.token, provider.token, this._queriedTokens); }); if (isTemplate) { const /** @type {?} */ templateRefId = createTokenForExternalReference(this.viewContext.reflector, Identifiers.TemplateRef); this._addQueryReadsTo(templateRefId, templateRefId, this._queriedTokens); } refs.forEach((refAst) => { let /** @type {?} */ defaultQueryValue = refAst.value || createTokenForExternalReference(this.viewContext.reflector, Identifiers.ElementRef); this._addQueryReadsTo({ value: refAst.name }, defaultQueryValue, this._queriedTokens); }); if (this._queriedTokens.get(this.viewContext.reflector.resolveExternalReference(Identifiers.ViewContainerRef))) { this.transformedHasViewContainer = true; } // create the providers that we know are eager first Array.from(this._allProviders.values()).forEach((provider) => { const /** @type {?} */ eager = provider.eager || this._queriedTokens.get(tokenReference(provider.token)); if (eager) { this._getOrCreateLocalProvider(provider.providerType, provider.token, true); } }); } /** * @return {?} */ afterElement() { // collect lazy providers Array.from(this._allProviders.values()).forEach((provider) => { this._getOrCreateLocalProvider(provider.providerType, provider.token, false); }); } /** * @return {?} */ get transformProviders() { // Note: Maps keep their insertion order. const /** @type {?} */ lazyProviders = []; const /** @type {?} */ eagerProviders = []; this._transformedProviders.forEach(provider => { if (provider.eager) { eagerProviders.push(provider); } else { lazyProviders.push(provider); } }); return lazyProviders.concat(eagerProviders); } /** * @return {?} */ get transformedDirectiveAsts() { const /** @type {?} */ sortedProviderTypes = this.transformProviders.map(provider => provider.token.identifier); const /** @type {?} */ sortedDirectives = this._directiveAsts.slice(); sortedDirectives.sort((dir1, dir2) => sortedProviderTypes.indexOf(dir1.directive.type) - sortedProviderTypes.indexOf(dir2.directive.type)); return sortedDirectives; } /** * @return {?} */ get queryMatches() { const /** @type {?} */ allMatches = []; this._queriedTokens.forEach((matches) => { allMatches.push(...matches); }); return allMatches; } /** * @param {?} token * @param {?} defaultValue * @param {?} queryReadTokens * @return {?} */ _addQueryReadsTo(token, defaultValue, queryReadTokens) { this._getQueriesFor(token).forEach((query) => { const /** @type {?} */ queryValue = query.meta.read || defaultValue; const /** @type {?} */ tokenRef = tokenReference(queryValue); let /** @type {?} */ queryMatches = queryReadTokens.get(tokenRef); if (!queryMatches) { queryMatches = []; queryReadTokens.set(tokenRef, queryMatches); } queryMatches.push({ queryId: query.queryId, value: queryValue }); }); } /** * @param {?} token * @return {?} */ _getQueriesFor(token) { const /** @type {?} */ result = []; let /** @type {?} */ currentEl = this; let /** @type {?} */ distance = 0; let /** @type {?} */ queries; while (currentEl !== null) { queries = currentEl._contentQueries.get(tokenReference(token)); if (queries) { result.push(...queries.filter((query) => query.meta.descendants || distance <= 1)); } if (currentEl._directiveAsts.length > 0) { distance++; } currentEl = currentEl._parent; } queries = this.viewContext.viewQueries.get(tokenReference(token)); if (queries) { result.push(...queries); } return result; } /** * @param {?} requestingProviderType * @param {?} token * @param {?} eager * @return {?} */ _getOrCreateLocalProvider(requestingProviderType, token, eager) { const /** @type {?} */ resolvedProvider = this._allProviders.get(tokenReference(token)); if (!resolvedProvider || ((requestingProviderType === ProviderAstType.Directive || requestingProviderType === ProviderAstType.PublicService) && resolvedProvider.providerType === ProviderAstType.PrivateService) || ((requestingProviderType === ProviderAstType.PrivateService || requestingProviderType === ProviderAstType.PublicService) && resolvedProvider.providerType === ProviderAstType.Builtin)) { return null; } let /** @type {?} */ transformedProviderAst = this._transformedProviders.get(tokenReference(token)); if (transformedProviderAst) { return transformedProviderAst; } if (this._seenProviders.get(tokenReference(token)) != null) { this.viewContext.errors.push(new ProviderError(`Cannot instantiate cyclic dependency! ${tokenName(token)}`, this._sourceSpan)); return null; } this._seenProviders.set(tokenReference(token), true); const /** @type {?} */ transformedProviders = resolvedProvider.providers.map((provider) => { let /** @type {?} */ transformedUseValue = provider.useValue; let /** @type {?} */ transformedUseExisting = /** @type {?} */ ((provider.useExisting)); let /** @type {?} */ transformedDeps = /** @type {?} */ ((undefined)); if (provider.useExisting != null) { const /** @type {?} */ existingDiDep = /** @type {?} */ ((this._getDependency(resolvedProvider.providerType, { token: provider.useExisting }, eager))); if (existingDiDep.token != null) { transformedUseExisting = existingDiDep.token; } else { transformedUseExisting = /** @type {?} */ ((null)); transformedUseValue = existingDiDep.value; } } else if (provider.useFactory) { const /** @type {?} */ deps = provider.deps || provider.useFactory.diDeps; transformedDeps = deps.map((dep) => /** @type {?} */ ((this._getDependency(resolvedProvider.providerType, dep, eager)))); } else if (provider.useClass) { const /** @type {?} */ deps = provider.deps || provider.useClass.diDeps; transformedDeps = deps.map((dep) => /** @type {?} */ ((this._getDependency(resolvedProvider.providerType, dep, eager)))); } return _transformProvider(provider, { useExisting: transformedUseExisting, useValue: transformedUseValue, deps: transformedDeps }); }); transformedProviderAst = _transformProviderAst(resolvedProvider, { eager: eager, providers: transformedProviders }); this._transformedProviders.set(tokenReference(token), transformedProviderAst); return transformedProviderAst; } /** * @param {?} requestingProviderType * @param {?} dep * @param {?=} eager * @return {?} */ _getLocalDependency(requestingProviderType, dep, eager = false) { if (dep.isAttribute) { const /** @type {?} */ attrValue = this._attrs[/** @type {?} */ ((dep.token)).value]; return { isValue: true, value: attrValue == null ? null : attrValue }; } if (dep.token != null) { // access builtints if ((requestingProviderType === ProviderAstType.Directive || requestingProviderType === ProviderAstType.Component)) { if (tokenReference(dep.token) === this.viewContext.reflector.resolveExternalReference(Identifiers.Renderer) || tokenReference(dep.token) === this.viewContext.reflector.resolveExternalReference(Identifiers.ElementRef) || tokenReference(dep.token) === this.viewContext.reflector.resolveExternalReference(Identifiers.ChangeDetectorRef) || tokenReference(dep.token) === this.viewContext.reflector.resolveExternalReference(Identifiers.TemplateRef)) { return dep; } if (tokenReference(dep.token) === this.viewContext.reflector.resolveExternalReference(Identifiers.ViewContainerRef)) { (/** @type {?} */ (this)).transformedHasViewContainer = true; } } // access the injector if (tokenReference(dep.token) === this.viewContext.reflector.resolveExternalReference(Identifiers.Injector)) { return dep; } // access providers if (this._getOrCreateLocalProvider(requestingProviderType, dep.token, eager) != null) { return dep; } } return null; } /** * @param {?} requestingProviderType * @param {?} dep * @param {?=} eager * @return {?} */ _getDependency(requestingProviderType, dep, eager = false) { let /** @type {?} */ currElement = this; let /** @type {?} */ currEager = eager; let /** @type {?} */ result = null; if (!dep.isSkipSelf) { result = this._getLocalDependency(requestingProviderType, dep, eager); } if (dep.isSelf) { if (!result && dep.isOptional) { result = { isValue: true, value: null }; } } else { // check parent elements while (!result && currElement._parent) { const /** @type {?} */ prevElement = currElement; currElement = currElement._parent; if (prevElement._isViewRoot) { currEager = false; } result = currElement._getLocalDependency(ProviderAstType.PublicService, dep, currEager); } // check @Host restriction if (!result) { if (!dep.isHost || this.viewContext.component.isHost || this.viewContext.component.type.reference === tokenReference(/** @type {?} */ ((dep.token))) || this.viewContext.viewProviders.get(tokenReference(/** @type {?} */ ((dep.token)))) != null) { result = dep; } else { result = dep.isOptional ? result = { isValue: true, value: null } : null; } } } if (!result) { this.viewContext.errors.push(new ProviderError(`No provider for ${tokenName((/** @type {?} */ ((dep.token))))}`, this._sourceSpan)); } return result; } } class NgModuleProviderAnalyzer { /** * @param {?} reflector * @param {?} ngModule * @param {?} extraProviders * @param {?} sourceSpan */ constructor(reflector, ngModule, extraProviders, sourceSpan) { this.reflector = reflector; this._transformedProviders = new Map(); this._seenProviders = new Map(); this._errors = []; this._allProviders = new Map(); ngModule.transitiveModule.modules.forEach((ngModuleType) => { const /** @type {?} */ ngModuleProvider = { token: { identifier: ngModuleType }, useClass: ngModuleType }; _resolveProviders([ngModuleProvider], ProviderAstType.PublicService, true, sourceSpan, this._errors, this._allProviders); }); _resolveProviders(ngModule.transitiveModule.providers.map(entry => entry.provider).concat(extraProviders), ProviderAstType.PublicService, false, sourceSpan, this._errors, this._allProviders); } /** * @return {?} */ parse() { Array.from(this._allProviders.values()).forEach((provider) => { this._getOrCreateLocalProvider(provider.token, provider.eager); }); if (this._errors.length > 0) { const /** @type {?} */ errorString = this._errors.join('\n'); throw new Error(`Provider parse errors:\n${errorString}`); } // Note: Maps keep their insertion order. const /** @type {?} */ lazyProviders = []; const /** @type {?} */ eagerProviders = []; this._transformedProviders.forEach(provider => { if (provider.eager) { eagerProviders.push(provider); } else { lazyProviders.push(provider); } }); return lazyProviders.concat(eagerProviders); } /** * @param {?} token * @param {?} eager * @return {?} */ _getOrCreateLocalProvider(token, eager) { const /** @type {?} */ resolvedProvider = this._allProviders.get(tokenReference(token)); if (!resolvedProvider) { return null; } let /** @type {?} */ transformedProviderAst = this._transformedProviders.get(tokenReference(token)); if (transformedProviderAst) { return transformedProviderAst; } if (this._seenProviders.get(tokenReference(token)) != null) { this._errors.push(new ProviderError(`Cannot instantiate cyclic dependency! ${tokenName(token)}`, resolvedProvider.sourceSpan)); return null; } this._seenProviders.set(tokenReference(token), true); const /** @type {?} */ transformedProviders = resolvedProvider.providers.map((provider) => { let /** @type {?} */ transformedUseValue = provider.useValue; let /** @type {?} */ transformedUseExisting = /** @type {?} */ ((provider.useExisting)); let /** @type {?} */ transformedDeps = /** @type {?} */ ((undefined)); if (provider.useExisting != null) { const /** @type {?} */ existingDiDep = this._getDependency({ token: provider.useExisting }, eager, resolvedProvider.sourceSpan); if (existingDiDep.token != null) { transformedUseExisting = existingDiDep.token; } else { transformedUseExisting = /** @type {?} */ ((null)); transformedUseValue = existingDiDep.value; } } else if (provider.useFactory) { const /** @type {?} */ deps = provider.deps || provider.useFactory.diDeps; transformedDeps = deps.map((dep) => this._getDependency(dep, eager, resolvedProvider.sourceSpan)); } else if (provider.useClass) { const /** @type {?} */ deps = provider.deps || provider.useClass.diDeps; transformedDeps = deps.map((dep) => this._getDependency(dep, eager, resolvedProvider.sourceSpan)); } return _transformProvider(provider, { useExisting: transformedUseExisting, useValue: transformedUseValue, deps: transformedDeps }); }); transformedProviderAst = _transformProviderAst(resolvedProvider, { eager: eager, providers: transformedProviders }); this._transformedProviders.set(tokenReference(token), transformedProviderAst); return transformedProviderAst; } /** * @param {?} dep * @param {?=} eager * @param {?=} requestorSourceSpan * @return {?} */ _getDependency(dep, eager = false, requestorSourceSpan) { let /** @type {?} */ foundLocal = false; if (!dep.isSkipSelf && dep.token != null) { // access the injector if (tokenReference(dep.token) === this.reflector.resolveExternalReference(Identifiers.Injector) || tokenReference(dep.token) === this.reflector.resolveExternalReference(Identifiers.ComponentFactoryResolver)) { foundLocal = true; // access providers } else if (this._getOrCreateLocalProvider(dep.token, eager) != null) { foundLocal = true; } } let /** @type {?} */ result = dep; if (dep.isSelf && !foundLocal) { if (dep.isOptional) { result = { isValue: true, value: null }; } else { this._errors.push(new ProviderError(`No provider for ${tokenName((/** @type {?} */ ((dep.token))))}`, requestorSourceSpan)); } } return result; } } /** * @param {?} provider * @param {?} __1 * @return {?} */ function _transformProvider(provider, { useExisting, useValue, deps }) { return { token: provider.token, useClass: provider.useClass, useExisting: useExisting, useFactory: provider.useFactory, useValue: useValue, deps: deps, multi: provider.multi }; } /** * @param {?} provider * @param {?} __1 * @return {?} */ function _transformProviderAst(provider, { eager, providers }) { return new ProviderAst(provider.token, provider.multiProvider, provider.eager || eager, providers, provider.providerType, provider.lifecycleHooks, provider.sourceSpan); } /** * @param {?} directives * @param {?} sourceSpan * @param {?} targetErrors * @return {?} */ function _resolveProvidersFromDirectives(directives, sourceSpan, targetErrors) { const /** @type {?} */ providersByToken = new Map(); directives.forEach((directive) => { const /** @type {?} */ dirProvider = { token: { identifier: directive.type }, useClass: directive.type }; _resolveProviders([dirProvider], directive.isComponent ? ProviderAstType.Component : ProviderAstType.Directive, true, sourceSpan, targetErrors, providersByToken); }); // Note: directives need to be able to overwrite providers of a component! const /** @type {?} */ directivesWithComponentFirst = directives.filter(dir => dir.isComponent).concat(directives.filter(dir => !dir.isComponent)); directivesWithComponentFirst.forEach((directive) => { _resolveProviders(directive.providers, ProviderAstType.PublicService, false, sourceSpan, targetErrors, providersByToken); _resolveProviders(directive.viewProviders, ProviderAstType.PrivateService, false, sourceSpan, targetErrors, providersByToken); }); return providersByToken; } /** * @param {?} providers * @param {?} providerType * @param {?} eager * @param {?} sourceSpan * @param {?} targetErrors * @param {?} targetProvidersByToken * @return {?} */ function _resolveProviders(providers, providerType, eager, sourceSpan, targetErrors, targetProvidersByToken) { providers.forEach((provider) => { let /** @type {?} */ resolvedProvider = targetProvidersByToken.get(tokenReference(provider.token)); if (resolvedProvider != null && !!resolvedProvider.multiProvider !== !!provider.multi) { targetErrors.push(new ProviderError(`Mixing multi and non multi provider is not possible for token ${tokenName(resolvedProvider.token)}`, sourceSpan)); } if (!resolvedProvider) { const /** @type {?} */ lifecycleHooks = provider.token.identifier && (/** @type {?} */ (provider.token.identifier)).lifecycleHooks ? (/** @type {?} */ (provider.token.identifier)).lifecycleHooks : []; const /** @type {?} */ isUseValue = !(provider.useClass || provider.useExisting || provider.useFactory); resolvedProvider = new ProviderAst(provider.token, !!provider.multi, eager || isUseValue, [provider], providerType, lifecycleHooks, sourceSpan); targetProvidersByToken.set(tokenReference(provider.token), resolvedProvider); } else { if (!provider.multi) { resolvedProvider.providers.length = 0; } resolvedProvider.providers.push(provider); } }); } /** * @param {?} component * @return {?} */ function _getViewQueries(component) { // Note: queries start with id 1 so we can use the number in a Bloom filter! let /** @type {?} */ viewQueryId = 1; const /** @type {?} */ viewQueries = new Map(); if (component.viewQueries) { component.viewQueries.forEach((query) => _addQueryToTokenMap(viewQueries, { meta: query, queryId: viewQueryId++ })); } return viewQueries; } /** * @param {?} contentQueryStartId * @param {?} directives * @return {?} */ function _getContentQueries(contentQueryStartId, directives) { let /** @type {?} */ contentQueryId = contentQueryStartId; const /** @type {?} */ contentQueries = new Map(); directives.forEach((directive, directiveIndex) => { if (directive.queries) { directive.queries.forEach((query) => _addQueryToTokenMap(contentQueries, { meta: query, queryId: contentQueryId++ })); } }); return contentQueries; } /** * @param {?} map * @param {?} query * @return {?} */ function _addQueryToTokenMap(map, query) { query.meta.selectors.forEach((token) => { let /** @type {?} */ entry = map.get(tokenReference(token)); if (!entry) { entry = []; map.set(tokenReference(token), entry); } entry.push(query); }); } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ const QUOTED_KEYS = '$quoted$'; /** * @param {?} ctx * @param {?} value * @param {?=} type * @return {?} */ function convertValueToOutputAst(ctx, value, type = null) { return visitValue(value, new _ValueOutputAstTransformer(ctx), type); } class _ValueOutputAstTransformer { /** * @param {?} ctx */ constructor(ctx) { this.ctx = ctx; } /** * @param {?} arr * @param {?} type * @return {?} */ visitArray(arr, type) { return literalArr(arr.map(value => visitValue(value, this, null)), type); } /** * @param {?} map * @param {?} type * @return {?} */ visitStringMap(map, type) { const /** @type {?} */ entries = []; const /** @type {?} */ quotedSet = new Set(map && map[QUOTED_KEYS]); Object.keys(map).forEach(key => { entries.push(new LiteralMapEntry(key, visitValue(map[key], this, null), quotedSet.has(key))); }); return new LiteralMapExpr(entries, type); } /** * @param {?} value * @param {?} type * @return {?} */ visitPrimitive(value, type) { return literal(value, type); } /** * @param {?} value * @param {?} type * @return {?} */ visitOther(value, type) { if (value instanceof Expression) { return value; } else { return this.ctx.importExpr(value); } } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @param {?} ctx * @param {?} providerAst * @return {?} */ function providerDef(ctx, providerAst) { let /** @type {?} */ flags = 0; if (!providerAst.eager) { flags |= 4096 /* LazyProvider */; } if (providerAst.providerType === ProviderAstType.PrivateService) { flags |= 8192 /* PrivateProvider */; } providerAst.lifecycleHooks.forEach((lifecycleHook) => { // for regular providers, we only support ngOnDestroy if (lifecycleHook === LifecycleHooks.OnDestroy || providerAst.providerType === ProviderAstType.Directive || providerAst.providerType === ProviderAstType.Component) { flags |= lifecycleHookToNodeFlag(lifecycleHook); } }); const { providerExpr, flags: providerFlags, depsExpr } = providerAst.multiProvider ? multiProviderDef(ctx, flags, providerAst.providers) : singleProviderDef(ctx, flags, providerAst.providerType, providerAst.providers[0]); return { providerExpr, flags: providerFlags, depsExpr, tokenExpr: tokenExpr(ctx, providerAst.token), }; } /** * @param {?} ctx * @param {?} flags * @param {?} providers * @return {?} */ function multiProviderDef(ctx, flags, providers) { const /** @type {?} */ allDepDefs = []; const /** @type {?} */ allParams = []; const /** @type {?} */ exprs = providers.map((provider, providerIndex) => { let /** @type {?} */ expr; if (provider.useClass) { const /** @type {?} */ depExprs = convertDeps(providerIndex, provider.deps || provider.useClass.diDeps); expr = ctx.importExpr(provider.useClass.reference).instantiate(depExprs); } else if (provider.useFactory) { const /** @type {?} */ depExprs = convertDeps(providerIndex, provider.deps || provider.useFactory.diDeps); expr = ctx.importExpr(provider.useFactory.reference).callFn(depExprs); } else if (provider.useExisting) { const /** @type {?} */ depExprs = convertDeps(providerIndex, [{ token: provider.useExisting }]); expr = depExprs[0]; } else { expr = convertValueToOutputAst(ctx, provider.useValue); } return expr; }); const /** @type {?} */ providerExpr = fn(allParams, [new ReturnStatement(literalArr(exprs))], INFERRED_TYPE); return { providerExpr, flags: flags | 1024 /* TypeFactoryProvider */, depsExpr: literalArr(allDepDefs) }; /** * @param {?} providerIndex * @param {?} deps * @return {?} */ function convertDeps(providerIndex, deps) { return deps.map((dep, depIndex) => { const /** @type {?} */ paramName = `p${providerIndex}_${depIndex}`; allParams.push(new FnParam(paramName, DYNAMIC_TYPE)); allDepDefs.push(depDef(ctx, dep)); return variable(paramName); }); } } /** * @param {?} ctx * @param {?} flags * @param {?} providerType * @param {?} providerMeta * @return {?} */ function singleProviderDef(ctx, flags, providerType, providerMeta) { let /** @type {?} */ providerExpr; let /** @type {?} */ deps; if (providerType === ProviderAstType.Directive || providerType === ProviderAstType.Component) { providerExpr = ctx.importExpr(/** @type {?} */ ((providerMeta.useClass)).reference); flags |= 16384 /* TypeDirective */; deps = providerMeta.deps || /** @type {?} */ ((providerMeta.useClass)).diDeps; } else { if (providerMeta.useClass) { providerExpr = ctx.importExpr(providerMeta.useClass.reference); flags |= 512 /* TypeClassProvider */; deps = providerMeta.deps || providerMeta.useClass.diDeps; } else if (providerMeta.useFactory) { providerExpr = ctx.importExpr(providerMeta.useFactory.reference); flags |= 1024 /* TypeFactoryProvider */; deps = providerMeta.deps || providerMeta.useFactory.diDeps; } else if (providerMeta.useExisting) { providerExpr = NULL_EXPR; flags |= 2048 /* TypeUseExistingProvider */; deps = [{ token: providerMeta.useExisting }]; } else { providerExpr = convertValueToOutputAst(ctx, providerMeta.useValue); flags |= 256 /* TypeValueProvider */; deps = []; } } const /** @type {?} */ depsExpr = literalArr(deps.map(dep => depDef(ctx, dep))); return { providerExpr, flags, depsExpr }; } /** * @param {?} ctx * @param {?} tokenMeta * @return {?} */ function tokenExpr(ctx, tokenMeta) { return tokenMeta.identifier ? ctx.importExpr(tokenMeta.identifier.reference) : literal(tokenMeta.value); } /** * @param {?} ctx * @param {?} dep * @return {?} */ function depDef(ctx, dep) { // Note: the following fields have already been normalized out by provider_analyzer: // - isAttribute, isSelf, isHost const /** @type {?} */ expr = dep.isValue ? convertValueToOutputAst(ctx, dep.value) : tokenExpr(ctx, /** @type {?} */ ((dep.token))); let /** @type {?} */ flags = 0; if (dep.isSkipSelf) { flags |= 1 /* SkipSelf */; } if (dep.isOptional) { flags |= 2 /* Optional */; } if (dep.isValue) { flags |= 8 /* Value */; } return flags === 0 /* None */ ? expr : literalArr([literal(flags), expr]); } /** * @param {?} lifecycleHook * @return {?} */ function lifecycleHookToNodeFlag(lifecycleHook) { let /** @type {?} */ nodeFlag = 0; switch (lifecycleHook) { case LifecycleHooks.AfterContentChecked: nodeFlag = 2097152 /* AfterContentChecked */; break; case LifecycleHooks.AfterContentInit: nodeFlag = 1048576 /* AfterContentInit */; break; case LifecycleHooks.AfterViewChecked: nodeFlag = 8388608 /* AfterViewChecked */; break; case LifecycleHooks.AfterViewInit: nodeFlag = 4194304 /* AfterViewInit */; break; case LifecycleHooks.DoCheck: nodeFlag = 262144 /* DoCheck */; break; case LifecycleHooks.OnChanges: nodeFlag = 524288 /* OnChanges */; break; case LifecycleHooks.OnDestroy: nodeFlag = 131072 /* OnDestroy */; break; case LifecycleHooks.OnInit: nodeFlag = 65536 /* OnInit */; break; } return nodeFlag; } /** * @param {?} reflector * @param {?} ctx * @param {?} flags * @param {?} entryComponents * @return {?} */ function componentFactoryResolverProviderDef(reflector, ctx, flags, entryComponents) { const /** @type {?} */ entryComponentFactories = entryComponents.map((entryComponent) => ctx.importExpr(entryComponent.componentFactory)); const /** @type {?} */ token = createTokenForExternalReference(reflector, Identifiers.ComponentFactoryResolver); const /** @type {?} */ classMeta = { diDeps: [ { isValue: true, value: literalArr(entryComponentFactories) }, { token: token, isSkipSelf: true, isOptional: true }, { token: createTokenForExternalReference(reflector, Identifiers.NgModuleRef) }, ], lifecycleHooks: [], reference: reflector.resolveExternalReference(Identifiers.CodegenComponentFactoryResolver) }; const { providerExpr, flags: providerFlags, depsExpr } = singleProviderDef(ctx, flags, ProviderAstType.PrivateService, { token, multi: false, useClass: classMeta, }); return { providerExpr, flags: providerFlags, depsExpr, tokenExpr: tokenExpr(ctx, token) }; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ class NgModuleCompileResult { /** * @param {?} ngModuleFactoryVar */ constructor(ngModuleFactoryVar) { this.ngModuleFactoryVar = ngModuleFactoryVar; } } const LOG_VAR = variable('_l'); class NgModuleCompiler { /** * @param {?} reflector */ constructor(reflector) { this.reflector = reflector; } /** * @param {?} ctx * @param {?} ngModuleMeta * @param {?} extraProviders * @return {?} */ compile(ctx, ngModuleMeta, extraProviders) { const /** @type {?} */ sourceSpan = typeSourceSpan('NgModule', ngModuleMeta.type); const /** @type {?} */ entryComponentFactories = ngModuleMeta.transitiveModule.entryComponents; const /** @type {?} */ bootstrapComponents = ngModuleMeta.bootstrapComponents; const /** @type {?} */ providerParser = new NgModuleProviderAnalyzer(this.reflector, ngModuleMeta, extraProviders, sourceSpan); const /** @type {?} */ providerDefs = [componentFactoryResolverProviderDef(this.reflector, ctx, 0 /* None */, entryComponentFactories)] .concat(providerParser.parse().map((provider) => providerDef(ctx, provider))) .map(({ providerExpr, depsExpr, flags, tokenExpr }) => { return importExpr(Identifiers.moduleProviderDef).callFn([ literal(flags), tokenExpr, providerExpr, depsExpr ]); }); const /** @type {?} */ ngModuleDef = importExpr(Identifiers.moduleDef).callFn([literalArr(providerDefs)]); const /** @type {?} */ ngModuleDefFactory = fn([new FnParam(/** @type {?} */ ((LOG_VAR.name)))], [new ReturnStatement(ngModuleDef)], INFERRED_TYPE); const /** @type {?} */ ngModuleFactoryVar = `${identifierName(ngModuleMeta.type)}NgFactory`; this._createNgModuleFactory(ctx, ngModuleMeta.type.reference, importExpr(Identifiers.createModuleFactory).callFn([ ctx.importExpr(ngModuleMeta.type.reference), literalArr(bootstrapComponents.map(id => ctx.importExpr(id.reference))), ngModuleDefFactory ])); if (ngModuleMeta.id) { const /** @type {?} */ registerFactoryStmt = importExpr(Identifiers.RegisterModuleFactoryFn) .callFn([literal(ngModuleMeta.id), variable(ngModuleFactoryVar)]) .toStmt(); ctx.statements.push(registerFactoryStmt); } return new NgModuleCompileResult(ngModuleFactoryVar); } /** * @param {?} ctx * @param {?} ngModuleReference * @return {?} */ createStub(ctx, ngModuleReference) { this._createNgModuleFactory(ctx, ngModuleReference, NULL_EXPR); } /** * @param {?} ctx * @param {?} reference * @param {?} value * @return {?} */ _createNgModuleFactory(ctx, reference, value) { const /** @type {?} */ ngModuleFactoryVar = `${identifierName({ reference: reference })}NgFactory`; const /** @type {?} */ ngModuleFactoryStmt = variable(ngModuleFactoryVar) .set(value) .toDeclStmt(importType(Identifiers.NgModuleFactory, [/** @type {?} */ ((expressionType(ctx.importExpr(reference))))], [TypeModifier.Const]), [StmtModifier.Final, StmtModifier.Exported]); ctx.statements.push(ngModuleFactoryStmt); } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * Resolves types to {\@link NgModule}. */ class NgModuleResolver { /** * @param {?} _reflector */ constructor(_reflector) { this._reflector = _reflector; } /** * @param {?} type * @return {?} */ isNgModule(type) { return this._reflector.annotations(type).some(createNgModule.isTypeOf); } /** * @param {?} type * @param {?=} throwIfNotFound * @return {?} */ resolve(type, throwIfNotFound = true) { const /** @type {?} */ ngModuleMeta = findLast(this._reflector.annotations(type), createNgModule.isTypeOf); if (ngModuleMeta) { return ngModuleMeta; } else { if (throwIfNotFound) { throw new Error(`No NgModule metadata found for '${stringify(type)}'.`); } return null; } } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ // https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit const VERSION$1 = 3; const JS_B64_PREFIX = '# sourceMappingURL=data:application/json;base64,'; class SourceMapGenerator { /** * @param {?=} file */ constructor(file = null) { this.file = file; this.sourcesContent = new Map(); this.lines = []; this.lastCol0 = 0; this.hasMappings = false; } /** * @param {?} url * @param {?=} content * @return {?} */ addSource(url, content = null) { if (!this.sourcesContent.has(url)) { this.sourcesContent.set(url, content); } return this; } /** * @return {?} */ addLine() { this.lines.push([]); this.lastCol0 = 0; return this; } /** * @param {?} col0 * @param {?=} sourceUrl * @param {?=} sourceLine0 * @param {?=} sourceCol0 * @return {?} */ addMapping(col0, sourceUrl, sourceLine0, sourceCol0) { if (!this.currentLine) { throw new Error(`A line must be added before mappings can be added`); } if (sourceUrl != null && !this.sourcesContent.has(sourceUrl)) { throw new Error(`Unknown source file "${sourceUrl}"`); } if (col0 == null) { throw new Error(`The column in the generated code must be provided`); } if (col0 < this.lastCol0) { throw new Error(`Mapping should be added in output order`); } if (sourceUrl && (sourceLine0 == null || sourceCol0 == null)) { throw new Error(`The source location must be provided when a source url is provided`); } this.hasMappings = true; this.lastCol0 = col0; this.currentLine.push({ col0, sourceUrl, sourceLine0, sourceCol0 }); return this; } /** * @return {?} */ get currentLine() { return this.lines.slice(-1)[0]; } /** * @return {?} */ toJSON() { if (!this.hasMappings) { return null; } const /** @type {?} */ sourcesIndex = new Map(); const /** @type {?} */ sources = []; const /** @type {?} */ sourcesContent = []; Array.from(this.sourcesContent.keys()).forEach((url, i) => { sourcesIndex.set(url, i); sources.push(url); sourcesContent.push(this.sourcesContent.get(url) || null); }); let /** @type {?} */ mappings = ''; let /** @type {?} */ lastCol0 = 0; let /** @type {?} */ lastSourceIndex = 0; let /** @type {?} */ lastSourceLine0 = 0; let /** @type {?} */ lastSourceCol0 = 0; this.lines.forEach(segments => { lastCol0 = 0; mappings += segments .map(segment => { // zero-based starting column of the line in the generated code let /** @type {?} */ segAsStr = toBase64VLQ(segment.col0 - lastCol0); lastCol0 = segment.col0; if (segment.sourceUrl != null) { // zero-based index into the “sources” list segAsStr += toBase64VLQ(/** @type {?} */ ((sourcesIndex.get(segment.sourceUrl))) - lastSourceIndex); lastSourceIndex = /** @type {?} */ ((sourcesIndex.get(segment.sourceUrl))); // the zero-based starting line in the original source segAsStr += toBase64VLQ(/** @type {?} */ ((segment.sourceLine0)) - lastSourceLine0); lastSourceLine0 = /** @type {?} */ ((segment.sourceLine0)); // the zero-based starting column in the original source segAsStr += toBase64VLQ(/** @type {?} */ ((segment.sourceCol0)) - lastSourceCol0); lastSourceCol0 = /** @type {?} */ ((segment.sourceCol0)); } return segAsStr; }) .join(','); mappings += ';'; }); mappings = mappings.slice(0, -1); return { 'file': this.file || '', 'version': VERSION$1, 'sourceRoot': '', 'sources': sources, 'sourcesContent': sourcesContent, 'mappings': mappings, }; } /** * @return {?} */ toJsComment() { return this.hasMappings ? '//' + JS_B64_PREFIX + toBase64String(JSON.stringify(this, null, 0)) : ''; } } /** * @param {?} value * @return {?} */ function toBase64String(value) { let /** @type {?} */ b64 = ''; value = utf8Encode(value); for (let /** @type {?} */ i = 0; i < value.length;) { const /** @type {?} */ i1 = value.charCodeAt(i++); const /** @type {?} */ i2 = value.charCodeAt(i++); const /** @type {?} */ i3 = value.charCodeAt(i++); b64 += toBase64Digit(i1 >> 2); b64 += toBase64Digit(((i1 & 3) << 4) | (isNaN(i2) ? 0 : i2 >> 4)); b64 += isNaN(i2) ? '=' : toBase64Digit(((i2 & 15) << 2) | (i3 >> 6)); b64 += isNaN(i2) || isNaN(i3) ? '=' : toBase64Digit(i3 & 63); } return b64; } /** * @param {?} value * @return {?} */ function toBase64VLQ(value) { value = value < 0 ? ((-value) << 1) + 1 : value << 1; let /** @type {?} */ out = ''; do { let /** @type {?} */ digit = value & 31; value = value >> 5; if (value > 0) { digit = digit | 32; } out += toBase64Digit(digit); } while (value > 0); return out; } const B64_DIGITS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; /** * @param {?} value * @return {?} */ function toBase64Digit(value) { if (value < 0 || value >= 64) { throw new Error(`Can only encode value in the range [0, 63]`); } return B64_DIGITS[value]; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ const _SINGLE_QUOTE_ESCAPE_STRING_RE = /'|\\|\n|\r|\$/g; const _LEGAL_IDENTIFIER_RE = /^[$A-Z_][0-9A-Z_$]*$/i; const _INDENT_WITH = ' '; const CATCH_ERROR_VAR$1 = variable('error', null, null); const CATCH_STACK_VAR$1 = variable('stack', null, null); /** * @record */ class _EmittedLine { /** * @param {?} indent */ constructor(indent) { this.indent = indent; this.partsLength = 0; this.parts = []; this.srcSpans = []; } } class EmitterVisitorContext { /** * @param {?} _indent */ constructor(_indent) { this._indent = _indent; this._classes = []; this._preambleLineCount = 0; this._lines = [new _EmittedLine(_indent)]; } /** * @return {?} */ static createRoot() { return new EmitterVisitorContext(0); } /** * @return {?} */ get _currentLine() { return this._lines[this._lines.length - 1]; } /** * @param {?=} from * @param {?=} lastPart * @return {?} */ println(from, lastPart = '') { this.print(from || null, lastPart, true); } /** * @return {?} */ lineIsEmpty() { return this._currentLine.parts.length === 0; } /** * @return {?} */ lineLength() { return this._currentLine.indent * _INDENT_WITH.length + this._currentLine.partsLength; } /** * @param {?} from * @param {?} part * @param {?=} newLine * @return {?} */ print(from, part, newLine = false) { if (part.length > 0) { this._currentLine.parts.push(part); this._currentLine.partsLength += part.length; this._currentLine.srcSpans.push(from && from.sourceSpan || null); } if (newLine) { this._lines.push(new _EmittedLine(this._indent)); } } /** * @return {?} */ removeEmptyLastLine() { if (this.lineIsEmpty()) { this._lines.pop(); } } /** * @return {?} */ incIndent() { this._indent++; if (this.lineIsEmpty()) { this._currentLine.indent = this._indent; } } /** * @return {?} */ decIndent() { this._indent--; if (this.lineIsEmpty()) { this._currentLine.indent = this._indent; } } /** * @param {?} clazz * @return {?} */ pushClass(clazz) { this._classes.push(clazz); } /** * @return {?} */ popClass() { return /** @type {?} */ ((this._classes.pop())); } /** * @return {?} */ get currentClass() { return this._classes.length > 0 ? this._classes[this._classes.length - 1] : null; } /** * @return {?} */ toSource() { return this.sourceLines .map(l => l.parts.length > 0 ? _createIndent(l.indent) + l.parts.join('') : '') .join('\n'); } /** * @param {?} genFilePath * @param {?=} startsAtLine * @return {?} */ toSourceMapGenerator(genFilePath, startsAtLine = 0) { const /** @type {?} */ map = new SourceMapGenerator(genFilePath); let /** @type {?} */ firstOffsetMapped = false; const /** @type {?} */ mapFirstOffsetIfNeeded = () => { if (!firstOffsetMapped) { // Add a single space so that tools won't try to load the file from disk. // Note: We are using virtual urls like `ng:///`, so we have to // provide a content here. map.addSource(genFilePath, ' ').addMapping(0, genFilePath, 0, 0); firstOffsetMapped = true; } }; for (let /** @type {?} */ i = 0; i < startsAtLine; i++) { map.addLine(); mapFirstOffsetIfNeeded(); } this.sourceLines.forEach((line, lineIdx) => { map.addLine(); const /** @type {?} */ spans = line.srcSpans; const /** @type {?} */ parts = line.parts; let /** @type {?} */ col0 = line.indent * _INDENT_WITH.length; let /** @type {?} */ spanIdx = 0; // skip leading parts without source spans while (spanIdx < spans.length && !spans[spanIdx]) { col0 += parts[spanIdx].length; spanIdx++; } if (spanIdx < spans.length && lineIdx === 0 && col0 === 0) { firstOffsetMapped = true; } else { mapFirstOffsetIfNeeded(); } while (spanIdx < spans.length) { const /** @type {?} */ span = /** @type {?} */ ((spans[spanIdx])); const /** @type {?} */ source = span.start.file; const /** @type {?} */ sourceLine = span.start.line; const /** @type {?} */ sourceCol = span.start.col; map.addSource(source.url, source.content) .addMapping(col0, source.url, sourceLine, sourceCol); col0 += parts[spanIdx].length; spanIdx++; // assign parts without span or the same span to the previous segment while (spanIdx < spans.length && (span === spans[spanIdx] || !spans[spanIdx])) { col0 += parts[spanIdx].length; spanIdx++; } } }); return map; } /** * @param {?} count * @return {?} */ setPreambleLineCount(count) { return this._preambleLineCount = count; } /** * @param {?} line * @param {?} column * @return {?} */ spanOf(line, column) { const /** @type {?} */ emittedLine = this._lines[line - this._preambleLineCount]; if (emittedLine) { let /** @type {?} */ columnsLeft = column - _createIndent(emittedLine.indent).length; for (let /** @type {?} */ partIndex = 0; partIndex < emittedLine.parts.length; partIndex++) { const /** @type {?} */ part = emittedLine.parts[partIndex]; if (part.length > columnsLeft) { return emittedLine.srcSpans[partIndex]; } columnsLeft -= part.length; } } return null; } /** * @return {?} */ get sourceLines() { if (this._lines.length && this._lines[this._lines.length - 1].parts.length === 0) { return this._lines.slice(0, -1); } return this._lines; } } /** * @abstract */ class AbstractEmitterVisitor { /** * @param {?} _escapeDollarInStrings */ constructor(_escapeDollarInStrings) { this._escapeDollarInStrings = _escapeDollarInStrings; } /** * @param {?} stmt * @param {?} ctx * @return {?} */ visitExpressionStmt(stmt, ctx) { stmt.expr.visitExpression(this, ctx); ctx.println(stmt, ';'); return null; } /** * @param {?} stmt * @param {?} ctx * @return {?} */ visitReturnStmt(stmt, ctx) { ctx.print(stmt, `return `); stmt.value.visitExpression(this, ctx); ctx.println(stmt, ';'); return null; } /** * @param {?} stmt * @param {?} ctx * @return {?} */ visitIfStmt(stmt, ctx) { ctx.print(stmt, `if (`); stmt.condition.visitExpression(this, ctx); ctx.print(stmt, `) {`); const /** @type {?} */ hasElseCase = stmt.falseCase != null && stmt.falseCase.length > 0; if (stmt.trueCase.length <= 1 && !hasElseCase) { ctx.print(stmt, ` `); this.visitAllStatements(stmt.trueCase, ctx); ctx.removeEmptyLastLine(); ctx.print(stmt, ` `); } else { ctx.println(); ctx.incIndent(); this.visitAllStatements(stmt.trueCase, ctx); ctx.decIndent(); if (hasElseCase) { ctx.println(stmt, `} else {`); ctx.incIndent(); this.visitAllStatements(stmt.falseCase, ctx); ctx.decIndent(); } } ctx.println(stmt, `}`); return null; } /** * @param {?} stmt * @param {?} ctx * @return {?} */ visitThrowStmt(stmt, ctx) { ctx.print(stmt, `throw `); stmt.error.visitExpression(this, ctx); ctx.println(stmt, `;`); return null; } /** * @param {?} stmt * @param {?} ctx * @return {?} */ visitCommentStmt(stmt, ctx) { const /** @type {?} */ lines = stmt.comment.split('\n'); lines.forEach((line) => { ctx.println(stmt, `// ${line}`); }); return null; } /** * @param {?} expr * @param {?} ctx * @return {?} */ visitWriteVarExpr(expr, ctx) { const /** @type {?} */ lineWasEmpty = ctx.lineIsEmpty(); if (!lineWasEmpty) { ctx.print(expr, '('); } ctx.print(expr, `${expr.name} = `); expr.value.visitExpression(this, ctx); if (!lineWasEmpty) { ctx.print(expr, ')'); } return null; } /** * @param {?} expr * @param {?} ctx * @return {?} */ visitWriteKeyExpr(expr, ctx) { const /** @type {?} */ lineWasEmpty = ctx.lineIsEmpty(); if (!lineWasEmpty) { ctx.print(expr, '('); } expr.receiver.visitExpression(this, ctx); ctx.print(expr, `[`); expr.index.visitExpression(this, ctx); ctx.print(expr, `] = `); expr.value.visitExpression(this, ctx); if (!lineWasEmpty) { ctx.print(expr, ')'); } return null; } /** * @param {?} expr * @param {?} ctx * @return {?} */ visitWritePropExpr(expr, ctx) { const /** @type {?} */ lineWasEmpty = ctx.lineIsEmpty(); if (!lineWasEmpty) { ctx.print(expr, '('); } expr.receiver.visitExpression(this, ctx); ctx.print(expr, `.${expr.name} = `); expr.value.visitExpression(this, ctx); if (!lineWasEmpty) { ctx.print(expr, ')'); } return null; } /** * @param {?} expr * @param {?} ctx * @return {?} */ visitInvokeMethodExpr(expr, ctx) { expr.receiver.visitExpression(this, ctx); let /** @type {?} */ name = expr.name; if (expr.builtin != null) { name = this.getBuiltinMethodName(expr.builtin); if (name == null) { // some builtins just mean to skip the call. return null; } } ctx.print(expr, `.${name}(`); this.visitAllExpressions(expr.args, ctx, `,`); ctx.print(expr, `)`); return null; } /** * @param {?} expr * @param {?} ctx * @return {?} */ visitInvokeFunctionExpr(expr, ctx) { expr.fn.visitExpression(this, ctx); ctx.print(expr, `(`); this.visitAllExpressions(expr.args, ctx, ','); ctx.print(expr, `)`); return null; } /** * @param {?} ast * @param {?} ctx * @return {?} */ visitReadVarExpr(ast, ctx) { let /** @type {?} */ varName = /** @type {?} */ ((ast.name)); if (ast.builtin != null) { switch (ast.builtin) { case BuiltinVar.Super: varName = 'super'; break; case BuiltinVar.This: varName = 'this'; break; case BuiltinVar.CatchError: varName = /** @type {?} */ ((CATCH_ERROR_VAR$1.name)); break; case BuiltinVar.CatchStack: varName = /** @type {?} */ ((CATCH_STACK_VAR$1.name)); break; default: throw new Error(`Unknown builtin variable ${ast.builtin}`); } } ctx.print(ast, varName); return null; } /** * @param {?} ast * @param {?} ctx * @return {?} */ visitInstantiateExpr(ast, ctx) { ctx.print(ast, `new `); ast.classExpr.visitExpression(this, ctx); ctx.print(ast, `(`); this.visitAllExpressions(ast.args, ctx, ','); ctx.print(ast, `)`); return null; } /** * @param {?} ast * @param {?} ctx * @return {?} */ visitLiteralExpr(ast, ctx) { const /** @type {?} */ value = ast.value; if (typeof value === 'string') { ctx.print(ast, escapeIdentifier(value, this._escapeDollarInStrings)); } else { ctx.print(ast, `${value}`); } return null; } /** * @param {?} ast * @param {?} ctx * @return {?} */ visitConditionalExpr(ast, ctx) { ctx.print(ast, `(`); ast.condition.visitExpression(this, ctx); ctx.print(ast, '? '); ast.trueCase.visitExpression(this, ctx); ctx.print(ast, ': '); /** @type {?} */ ((ast.falseCase)).visitExpression(this, ctx); ctx.print(ast, `)`); return null; } /** * @param {?} ast * @param {?} ctx * @return {?} */ visitNotExpr(ast, ctx) { ctx.print(ast, '!'); ast.condition.visitExpression(this, ctx); return null; } /** * @param {?} ast * @param {?} ctx * @return {?} */ visitAssertNotNullExpr(ast, ctx) { ast.condition.visitExpression(this, ctx); return null; } /** * @param {?} ast * @param {?} ctx * @return {?} */ visitBinaryOperatorExpr(ast, ctx) { let /** @type {?} */ opStr; switch (ast.operator) { case BinaryOperator.Equals: opStr = '=='; break; case BinaryOperator.Identical: opStr = '==='; break; case BinaryOperator.NotEquals: opStr = '!='; break; case BinaryOperator.NotIdentical: opStr = '!=='; break; case BinaryOperator.And: opStr = '&&'; break; case BinaryOperator.Or: opStr = '||'; break; case BinaryOperator.Plus: opStr = '+'; break; case BinaryOperator.Minus: opStr = '-'; break; case BinaryOperator.Divide: opStr = '/'; break; case BinaryOperator.Multiply: opStr = '*'; break; case BinaryOperator.Modulo: opStr = '%'; break; case BinaryOperator.Lower: opStr = '<'; break; case BinaryOperator.LowerEquals: opStr = '<='; break; case BinaryOperator.Bigger: opStr = '>'; break; case BinaryOperator.BiggerEquals: opStr = '>='; break; default: throw new Error(`Unknown operator ${ast.operator}`); } ctx.print(ast, `(`); ast.lhs.visitExpression(this, ctx); ctx.print(ast, ` ${opStr} `); ast.rhs.visitExpression(this, ctx); ctx.print(ast, `)`); return null; } /** * @param {?} ast * @param {?} ctx * @return {?} */ visitReadPropExpr(ast, ctx) { ast.receiver.visitExpression(this, ctx); ctx.print(ast, `.`); ctx.print(ast, ast.name); return null; } /** * @param {?} ast * @param {?} ctx * @return {?} */ visitReadKeyExpr(ast, ctx) { ast.receiver.visitExpression(this, ctx); ctx.print(ast, `[`); ast.index.visitExpression(this, ctx); ctx.print(ast, `]`); return null; } /** * @param {?} ast * @param {?} ctx * @return {?} */ visitLiteralArrayExpr(ast, ctx) { ctx.print(ast, `[`); this.visitAllExpressions(ast.entries, ctx, ','); ctx.print(ast, `]`); return null; } /** * @param {?} ast * @param {?} ctx * @return {?} */ visitLiteralMapExpr(ast, ctx) { ctx.print(ast, `{`); this.visitAllObjects(entry => { ctx.print(ast, `${escapeIdentifier(entry.key, this._escapeDollarInStrings, entry.quoted)}:`); entry.value.visitExpression(this, ctx); }, ast.entries, ctx, ','); ctx.print(ast, `}`); return null; } /** * @param {?} ast * @param {?} ctx * @return {?} */ visitCommaExpr(ast, ctx) { ctx.print(ast, '('); this.visitAllExpressions(ast.parts, ctx, ','); ctx.print(ast, ')'); return null; } /** * @param {?} expressions * @param {?} ctx * @param {?} separator * @return {?} */ visitAllExpressions(expressions, ctx, separator) { this.visitAllObjects(expr => expr.visitExpression(this, ctx), expressions, ctx, separator); } /** * @template T * @param {?} handler * @param {?} expressions * @param {?} ctx * @param {?} separator * @return {?} */ visitAllObjects(handler, expressions, ctx, separator) { let /** @type {?} */ incrementedIndent = false; for (let /** @type {?} */ i = 0; i < expressions.length; i++) { if (i > 0) { if (ctx.lineLength() > 80) { ctx.print(null, separator, true); if (!incrementedIndent) { // continuation are marked with double indent. ctx.incIndent(); ctx.incIndent(); incrementedIndent = true; } } else { ctx.print(null, separator, false); } } handler(expressions[i]); } if (incrementedIndent) { // continuation are marked with double indent. ctx.decIndent(); ctx.decIndent(); } } /** * @param {?} statements * @param {?} ctx * @return {?} */ visitAllStatements(statements, ctx) { statements.forEach((stmt) => stmt.visitStatement(this, ctx)); } } /** * @param {?} input * @param {?} escapeDollar * @param {?=} alwaysQuote * @return {?} */ function escapeIdentifier(input, escapeDollar, alwaysQuote = true) { if (input == null) { return null; } const /** @type {?} */ body = input.replace(_SINGLE_QUOTE_ESCAPE_STRING_RE, (...match) => { if (match[0] == '$') { return escapeDollar ? '\\$' : '$'; } else if (match[0] == '\n') { return '\\n'; } else if (match[0] == '\r') { return '\\r'; } else { return `\\${match[0]}`; } }); const /** @type {?} */ requiresQuotes = alwaysQuote || !_LEGAL_IDENTIFIER_RE.test(body); return requiresQuotes ? `'${body}'` : body; } /** * @param {?} count * @return {?} */ function _createIndent(count) { let /** @type {?} */ res = ''; for (let /** @type {?} */ i = 0; i < count; i++) { res += _INDENT_WITH; } return res; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @param {?} ast * @return {?} */ function debugOutputAstAsTypeScript(ast) { const /** @type {?} */ converter = new _TsEmitterVisitor(); const /** @type {?} */ ctx = EmitterVisitorContext.createRoot(); const /** @type {?} */ asts = Array.isArray(ast) ? ast : [ast]; asts.forEach((ast) => { if (ast instanceof Statement) { ast.visitStatement(converter, ctx); } else if (ast instanceof Expression) { ast.visitExpression(converter, ctx); } else if (ast instanceof Type$1) { ast.visitType(converter, ctx); } else { throw new Error(`Don't know how to print debug info for ${ast}`); } }); return ctx.toSource(); } class TypeScriptEmitter { /** * @param {?} genFilePath * @param {?} stmts * @param {?=} preamble * @param {?=} emitSourceMaps * @param {?=} referenceFilter * @return {?} */ emitStatementsAndContext(genFilePath, stmts, preamble = '', emitSourceMaps = true, referenceFilter) { const /** @type {?} */ converter = new _TsEmitterVisitor(referenceFilter); const /** @type {?} */ ctx = EmitterVisitorContext.createRoot(); converter.visitAllStatements(stmts, ctx); const /** @type {?} */ preambleLines = preamble ? preamble.split('\n') : []; converter.reexports.forEach((reexports, exportedModuleName) => { const /** @type {?} */ reexportsCode = reexports.map(reexport => `${reexport.name} as ${reexport.as}`).join(','); preambleLines.push(`export {${reexportsCode}} from '${exportedModuleName}';`); }); converter.importsWithPrefixes.forEach((prefix, importedModuleName) => { // Note: can't write the real word for import as it screws up system.js auto detection... preambleLines.push(`imp` + `ort * as ${prefix} from '${importedModuleName}';`); }); const /** @type {?} */ sm = emitSourceMaps ? ctx.toSourceMapGenerator(genFilePath, preambleLines.length).toJsComment() : ''; const /** @type {?} */ lines = [...preambleLines, ctx.toSource(), sm]; if (sm) { // always add a newline at the end, as some tools have bugs without it. lines.push(''); } ctx.setPreambleLineCount(preambleLines.length); return { sourceText: lines.join('\n'), context: ctx }; } /** * @param {?} genFilePath * @param {?} stmts * @param {?=} preamble * @return {?} */ emitStatements(genFilePath, stmts, preamble = '') { return this.emitStatementsAndContext(genFilePath, stmts, preamble).sourceText; } } class _TsEmitterVisitor extends AbstractEmitterVisitor { /** * @param {?=} referenceFilter */ constructor(referenceFilter) { super(false); this.referenceFilter = referenceFilter; this.typeExpression = 0; this.importsWithPrefixes = new Map(); this.reexports = new Map(); } /** * @param {?} t * @param {?} ctx * @param {?=} defaultType * @return {?} */ visitType(t, ctx, defaultType = 'any') { if (t) { this.typeExpression++; t.visitType(this, ctx); this.typeExpression--; } else { ctx.print(null, defaultType); } } /** * @param {?} ast * @param {?} ctx * @return {?} */ visitLiteralExpr(ast, ctx) { const /** @type {?} */ value = ast.value; if (value == null && ast.type != INFERRED_TYPE) { ctx.print(ast, `(${value} as any)`); return null; } return super.visitLiteralExpr(ast, ctx); } /** * @param {?} ast * @param {?} ctx * @return {?} */ visitLiteralArrayExpr(ast, ctx) { if (ast.entries.length === 0) { ctx.print(ast, '('); } const /** @type {?} */ result = super.visitLiteralArrayExpr(ast, ctx); if (ast.entries.length === 0) { ctx.print(ast, ' as any[])'); } return result; } /** * @param {?} ast * @param {?} ctx * @return {?} */ visitExternalExpr(ast, ctx) { this._visitIdentifier(ast.value, ast.typeParams, ctx); return null; } /** * @param {?} ast * @param {?} ctx * @return {?} */ visitAssertNotNullExpr(ast, ctx) { const /** @type {?} */ result = super.visitAssertNotNullExpr(ast, ctx); ctx.print(ast, '!'); return result; } /** * @param {?} stmt * @param {?} ctx * @return {?} */ visitDeclareVarStmt(stmt, ctx) { if (stmt.hasModifier(StmtModifier.Exported) && stmt.value instanceof ExternalExpr && !stmt.type) { // check for a reexport const { name, moduleName } = stmt.value.value; if (moduleName) { let /** @type {?} */ reexports = this.reexports.get(moduleName); if (!reexports) { reexports = []; this.reexports.set(moduleName, reexports); } reexports.push({ name: /** @type {?} */ ((name)), as: stmt.name }); return null; } } if (stmt.hasModifier(StmtModifier.Exported)) { ctx.print(stmt, `export `); } if (stmt.hasModifier(StmtModifier.Final)) { ctx.print(stmt, `const`); } else { ctx.print(stmt, `var`); } ctx.print(stmt, ` ${stmt.name}`); this._printColonType(stmt.type, ctx); ctx.print(stmt, ` = `); stmt.value.visitExpression(this, ctx); ctx.println(stmt, `;`); return null; } /** * @param {?} ast * @param {?} ctx * @return {?} */ visitCastExpr(ast, ctx) { ctx.print(ast, `(<`); /** @type {?} */ ((ast.type)).visitType(this, ctx); ctx.print(ast, `>`); ast.value.visitExpression(this, ctx); ctx.print(ast, `)`); return null; } /** * @param {?} ast * @param {?} ctx * @return {?} */ visitInstantiateExpr(ast, ctx) { ctx.print(ast, `new `); this.typeExpression++; ast.classExpr.visitExpression(this, ctx); this.typeExpression--; ctx.print(ast, `(`); this.visitAllExpressions(ast.args, ctx, ','); ctx.print(ast, `)`); return null; } /** * @param {?} stmt * @param {?} ctx * @return {?} */ visitDeclareClassStmt(stmt, ctx) { ctx.pushClass(stmt); if (stmt.hasModifier(StmtModifier.Exported)) { ctx.print(stmt, `export `); } ctx.print(stmt, `class ${stmt.name}`); if (stmt.parent != null) { ctx.print(stmt, ` extends `); this.typeExpression++; stmt.parent.visitExpression(this, ctx); this.typeExpression--; } ctx.println(stmt, ` {`); ctx.incIndent(); stmt.fields.forEach((field) => this._visitClassField(field, ctx)); if (stmt.constructorMethod != null) { this._visitClassConstructor(stmt, ctx); } stmt.getters.forEach((getter) => this._visitClassGetter(getter, ctx)); stmt.methods.forEach((method) => this._visitClassMethod(method, ctx)); ctx.decIndent(); ctx.println(stmt, `}`); ctx.popClass(); return null; } /** * @param {?} field * @param {?} ctx * @return {?} */ _visitClassField(field, ctx) { if (field.hasModifier(StmtModifier.Private)) { // comment out as a workaround for #10967 ctx.print(null, `/*private*/ `); } ctx.print(null, field.name); this._printColonType(field.type, ctx); ctx.println(null, `;`); } /** * @param {?} getter * @param {?} ctx * @return {?} */ _visitClassGetter(getter, ctx) { if (getter.hasModifier(StmtModifier.Private)) { ctx.print(null, `private `); } ctx.print(null, `get ${getter.name}()`); this._printColonType(getter.type, ctx); ctx.println(null, ` {`); ctx.incIndent(); this.visitAllStatements(getter.body, ctx); ctx.decIndent(); ctx.println(null, `}`); } /** * @param {?} stmt * @param {?} ctx * @return {?} */ _visitClassConstructor(stmt, ctx) { ctx.print(stmt, `constructor(`); this._visitParams(stmt.constructorMethod.params, ctx); ctx.println(stmt, `) {`); ctx.incIndent(); this.visitAllStatements(stmt.constructorMethod.body, ctx); ctx.decIndent(); ctx.println(stmt, `}`); } /** * @param {?} method * @param {?} ctx * @return {?} */ _visitClassMethod(method, ctx) { if (method.hasModifier(StmtModifier.Private)) { ctx.print(null, `private `); } ctx.print(null, `${method.name}(`); this._visitParams(method.params, ctx); ctx.print(null, `)`); this._printColonType(method.type, ctx, 'void'); ctx.println(null, ` {`); ctx.incIndent(); this.visitAllStatements(method.body, ctx); ctx.decIndent(); ctx.println(null, `}`); } /** * @param {?} ast * @param {?} ctx * @return {?} */ visitFunctionExpr(ast, ctx) { ctx.print(ast, `(`); this._visitParams(ast.params, ctx); ctx.print(ast, `)`); this._printColonType(ast.type, ctx, 'void'); ctx.println(ast, ` => {`); ctx.incIndent(); this.visitAllStatements(ast.statements, ctx); ctx.decIndent(); ctx.print(ast, `}`); return null; } /** * @param {?} stmt * @param {?} ctx * @return {?} */ visitDeclareFunctionStmt(stmt, ctx) { if (stmt.hasModifier(StmtModifier.Exported)) { ctx.print(stmt, `export `); } ctx.print(stmt, `function ${stmt.name}(`); this._visitParams(stmt.params, ctx); ctx.print(stmt, `)`); this._printColonType(stmt.type, ctx, 'void'); ctx.println(stmt, ` {`); ctx.incIndent(); this.visitAllStatements(stmt.statements, ctx); ctx.decIndent(); ctx.println(stmt, `}`); return null; } /** * @param {?} stmt * @param {?} ctx * @return {?} */ visitTryCatchStmt(stmt, ctx) { ctx.println(stmt, `try {`); ctx.incIndent(); this.visitAllStatements(stmt.bodyStmts, ctx); ctx.decIndent(); ctx.println(stmt, `} catch (${CATCH_ERROR_VAR$1.name}) {`); ctx.incIndent(); const /** @type {?} */ catchStmts = [/** @type {?} */ (CATCH_STACK_VAR$1.set(CATCH_ERROR_VAR$1.prop('stack', null)).toDeclStmt(null, [ StmtModifier.Final ]))].concat(stmt.catchStmts); this.visitAllStatements(catchStmts, ctx); ctx.decIndent(); ctx.println(stmt, `}`); return null; } /** * @param {?} type * @param {?} ctx * @return {?} */ visitBuiltintType(type, ctx) { let /** @type {?} */ typeStr; switch (type.name) { case BuiltinTypeName.Bool: typeStr = 'boolean'; break; case BuiltinTypeName.Dynamic: typeStr = 'any'; break; case BuiltinTypeName.Function: typeStr = 'Function'; break; case BuiltinTypeName.Number: typeStr = 'number'; break; case BuiltinTypeName.Int: typeStr = 'number'; break; case BuiltinTypeName.String: typeStr = 'string'; break; default: throw new Error(`Unsupported builtin type ${type.name}`); } ctx.print(null, typeStr); return null; } /** * @param {?} ast * @param {?} ctx * @return {?} */ visitExpressionType(ast, ctx) { ast.value.visitExpression(this, ctx); return null; } /** * @param {?} type * @param {?} ctx * @return {?} */ visitArrayType(type, ctx) { this.visitType(type.of, ctx); ctx.print(null, `[]`); return null; } /** * @param {?} type * @param {?} ctx * @return {?} */ visitMapType(type, ctx) { ctx.print(null, `{[key: string]:`); this.visitType(type.valueType, ctx); ctx.print(null, `}`); return null; } /** * @param {?} method * @return {?} */ getBuiltinMethodName(method) { let /** @type {?} */ name; switch (method) { case BuiltinMethod.ConcatArray: name = 'concat'; break; case BuiltinMethod.SubscribeObservable: name = 'subscribe'; break; case BuiltinMethod.Bind: name = 'bind'; break; default: throw new Error(`Unknown builtin method: ${method}`); } return name; } /** * @param {?} params * @param {?} ctx * @return {?} */ _visitParams(params, ctx) { this.visitAllObjects(param => { ctx.print(null, param.name); this._printColonType(param.type, ctx); }, params, ctx, ','); } /** * @param {?} value * @param {?} typeParams * @param {?} ctx * @return {?} */ _visitIdentifier(value, typeParams, ctx) { const { name, moduleName } = value; if (this.referenceFilter && this.referenceFilter(value)) { ctx.print(null, '(null as any)'); return; } if (moduleName) { let /** @type {?} */ prefix = this.importsWithPrefixes.get(moduleName); if (prefix == null) { prefix = `i${this.importsWithPrefixes.size}`; this.importsWithPrefixes.set(moduleName, prefix); } ctx.print(null, `${prefix}.`); } ctx.print(null, /** @type {?} */ ((name))); if (this.typeExpression > 0) { // If we are in a type expression that refers to a generic type then supply // the required type parameters. If there were not enough type parameters // supplied, supply any as the type. Outside a type expression the reference // should not supply type parameters and be treated as a simple value reference // to the constructor function itself. const /** @type {?} */ suppliedParameters = typeParams || []; if (suppliedParameters.length > 0) { ctx.print(null, `<`); this.visitAllObjects(type => type.visitType(this, ctx), /** @type {?} */ ((typeParams)), ctx, ','); ctx.print(null, `>`); } } } /** * @param {?} type * @param {?} ctx * @param {?=} defaultType * @return {?} */ _printColonType(type, ctx, defaultType) { if (type !== INFERRED_TYPE) { ctx.print(null, ':'); this.visitType(type, ctx, defaultType); } } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * Resolve a `Type` for {\@link Pipe}. * * This interface can be overridden by the application developer to create custom behavior. * * See {\@link Compiler} */ class PipeResolver { /** * @param {?} _reflector */ constructor(_reflector) { this._reflector = _reflector; } /** * @param {?} type * @return {?} */ isPipe(type) { const /** @type {?} */ typeMetadata = this._reflector.annotations(resolveForwardRef(type)); return typeMetadata && typeMetadata.some(createPipe.isTypeOf); } /** * Return {\@link Pipe} for a given `Type`. * @param {?} type * @param {?=} throwIfNotFound * @return {?} */ resolve(type, throwIfNotFound = true) { const /** @type {?} */ metas = this._reflector.annotations(resolveForwardRef(type)); if (metas) { const /** @type {?} */ annotation = findLast(metas, createPipe.isTypeOf); if (annotation) { return annotation; } } if (throwIfNotFound) { throw new Error(`No Pipe decorator found on ${stringify(type)}`); } return null; } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * Map from tagName|propertyName SecurityContext. Properties applying to all tags use '*'. */ const SECURITY_SCHEMA = {}; /** * @param {?} ctx * @param {?} specs * @return {?} */ function registerContext(ctx, specs) { for (const /** @type {?} */ spec of specs) SECURITY_SCHEMA[spec.toLowerCase()] = ctx; } // Case is insignificant below, all element and attribute names are lower-cased for lookup. registerContext(SecurityContext.HTML, [ 'iframe|srcdoc', '*|innerHTML', '*|outerHTML', ]); registerContext(SecurityContext.STYLE, ['*|style']); // NB: no SCRIPT contexts here, they are never allowed due to the parser stripping them. registerContext(SecurityContext.URL, [ '*|formAction', 'area|href', 'area|ping', 'audio|src', 'a|href', 'a|ping', 'blockquote|cite', 'body|background', 'del|cite', 'form|action', 'img|src', 'img|srcset', 'input|src', 'ins|cite', 'q|cite', 'source|src', 'source|srcset', 'track|src', 'video|poster', 'video|src', ]); registerContext(SecurityContext.RESOURCE_URL, [ 'applet|code', 'applet|codebase', 'base|href', 'embed|src', 'frame|src', 'head|profile', 'html|manifest', 'iframe|src', 'link|href', 'media|src', 'object|codebase', 'object|data', 'script|src', ]); /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @abstract */ class ElementSchemaRegistry { } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ const BOOLEAN = 'boolean'; const NUMBER = 'number'; const STRING = 'string'; const OBJECT = 'object'; /** * This array represents the DOM schema. It encodes inheritance, properties, and events. * * ## Overview * * Each line represents one kind of element. The `element_inheritance` and properties are joined * using `element_inheritance|properties` syntax. * * ## Element Inheritance * * The `element_inheritance` can be further subdivided as `element1,element2,...^parentElement`. * Here the individual elements are separated by `,` (commas). Every element in the list * has identical properties. * * An `element` may inherit additional properties from `parentElement` If no `^parentElement` is * specified then `""` (blank) element is assumed. * * NOTE: The blank element inherits from root `[Element]` element, the super element of all * elements. * * NOTE an element prefix such as `:svg:` has no special meaning to the schema. * * ## Properties * * Each element has a set of properties separated by `,` (commas). Each property can be prefixed * by a special character designating its type: * * - (no prefix): property is a string. * - `*`: property represents an event. * - `!`: property is a boolean. * - `#`: property is a number. * - `%`: property is an object. * * ## Query * * The class creates an internal squas representation which allows to easily answer the query of * if a given property exist on a given element. * * NOTE: We don't yet support querying for types or events. * NOTE: This schema is auto extracted from `schema_extractor.ts` located in the test folder, * see dom_element_schema_registry_spec.ts */ const SCHEMA = [ '[Element]|textContent,%classList,className,id,innerHTML,*beforecopy,*beforecut,*beforepaste,*copy,*cut,*paste,*search,*selectstart,*webkitfullscreenchange,*webkitfullscreenerror,*wheel,outerHTML,#scrollLeft,#scrollTop,slot' + ',*message,*mozfullscreenchange,*mozfullscreenerror,*mozpointerlockchange,*mozpointerlockerror,*webglcontextcreationerror,*webglcontextlost,*webglcontextrestored', '[HTMLElement]^[Element]|accessKey,contentEditable,dir,!draggable,!hidden,innerText,lang,*abort,*auxclick,*blur,*cancel,*canplay,*canplaythrough,*change,*click,*close,*contextmenu,*cuechange,*dblclick,*drag,*dragend,*dragenter,*dragleave,*dragover,*dragstart,*drop,*durationchange,*emptied,*ended,*error,*focus,*gotpointercapture,*input,*invalid,*keydown,*keypress,*keyup,*load,*loadeddata,*loadedmetadata,*loadstart,*lostpointercapture,*mousedown,*mouseenter,*mouseleave,*mousemove,*mouseout,*mouseover,*mouseup,*mousewheel,*pause,*play,*playing,*pointercancel,*pointerdown,*pointerenter,*pointerleave,*pointermove,*pointerout,*pointerover,*pointerup,*progress,*ratechange,*reset,*resize,*scroll,*seeked,*seeking,*select,*show,*stalled,*submit,*suspend,*timeupdate,*toggle,*volumechange,*waiting,outerText,!spellcheck,%style,#tabIndex,title,!translate', 'abbr,address,article,aside,b,bdi,bdo,cite,code,dd,dfn,dt,em,figcaption,figure,footer,header,i,kbd,main,mark,nav,noscript,rb,rp,rt,rtc,ruby,s,samp,section,small,strong,sub,sup,u,var,wbr^[HTMLElement]|accessKey,contentEditable,dir,!draggable,!hidden,innerText,lang,*abort,*auxclick,*blur,*cancel,*canplay,*canplaythrough,*change,*click,*close,*contextmenu,*cuechange,*dblclick,*drag,*dragend,*dragenter,*dragleave,*dragover,*dragstart,*drop,*durationchange,*emptied,*ended,*error,*focus,*gotpointercapture,*input,*invalid,*keydown,*keypress,*keyup,*load,*loadeddata,*loadedmetadata,*loadstart,*lostpointercapture,*mousedown,*mouseenter,*mouseleave,*mousemove,*mouseout,*mouseover,*mouseup,*mousewheel,*pause,*play,*playing,*pointercancel,*pointerdown,*pointerenter,*pointerleave,*pointermove,*pointerout,*pointerover,*pointerup,*progress,*ratechange,*reset,*resize,*scroll,*seeked,*seeking,*select,*show,*stalled,*submit,*suspend,*timeupdate,*toggle,*volumechange,*waiting,outerText,!spellcheck,%style,#tabIndex,title,!translate', 'media^[HTMLElement]|!autoplay,!controls,%controlsList,%crossOrigin,#currentTime,!defaultMuted,#defaultPlaybackRate,!disableRemotePlayback,!loop,!muted,*encrypted,*waitingforkey,#playbackRate,preload,src,%srcObject,#volume', ':svg:^[HTMLElement]|*abort,*auxclick,*blur,*cancel,*canplay,*canplaythrough,*change,*click,*close,*contextmenu,*cuechange,*dblclick,*drag,*dragend,*dragenter,*dragleave,*dragover,*dragstart,*drop,*durationchange,*emptied,*ended,*error,*focus,*gotpointercapture,*input,*invalid,*keydown,*keypress,*keyup,*load,*loadeddata,*loadedmetadata,*loadstart,*lostpointercapture,*mousedown,*mouseenter,*mouseleave,*mousemove,*mouseout,*mouseover,*mouseup,*mousewheel,*pause,*play,*playing,*pointercancel,*pointerdown,*pointerenter,*pointerleave,*pointermove,*pointerout,*pointerover,*pointerup,*progress,*ratechange,*reset,*resize,*scroll,*seeked,*seeking,*select,*show,*stalled,*submit,*suspend,*timeupdate,*toggle,*volumechange,*waiting,%style,#tabIndex', ':svg:graphics^:svg:|', ':svg:animation^:svg:|*begin,*end,*repeat', ':svg:geometry^:svg:|', ':svg:componentTransferFunction^:svg:|', ':svg:gradient^:svg:|', ':svg:textContent^:svg:graphics|', ':svg:textPositioning^:svg:textContent|', 'a^[HTMLElement]|charset,coords,download,hash,host,hostname,href,hreflang,name,password,pathname,ping,port,protocol,referrerPolicy,rel,rev,search,shape,target,text,type,username', 'area^[HTMLElement]|alt,coords,download,hash,host,hostname,href,!noHref,password,pathname,ping,port,protocol,referrerPolicy,rel,search,shape,target,username', 'audio^media|', 'br^[HTMLElement]|clear', 'base^[HTMLElement]|href,target', 'body^[HTMLElement]|aLink,background,bgColor,link,*beforeunload,*blur,*error,*focus,*hashchange,*languagechange,*load,*message,*offline,*online,*pagehide,*pageshow,*popstate,*rejectionhandled,*resize,*scroll,*storage,*unhandledrejection,*unload,text,vLink', 'button^[HTMLElement]|!autofocus,!disabled,formAction,formEnctype,formMethod,!formNoValidate,formTarget,name,type,value', 'canvas^[HTMLElement]|#height,#width', 'content^[HTMLElement]|select', 'dl^[HTMLElement]|!compact', 'datalist^[HTMLElement]|', 'details^[HTMLElement]|!open', 'dialog^[HTMLElement]|!open,returnValue', 'dir^[HTMLElement]|!compact', 'div^[HTMLElement]|align', 'embed^[HTMLElement]|align,height,name,src,type,width', 'fieldset^[HTMLElement]|!disabled,name', 'font^[HTMLElement]|color,face,size', 'form^[HTMLElement]|acceptCharset,action,autocomplete,encoding,enctype,method,name,!noValidate,target', 'frame^[HTMLElement]|frameBorder,longDesc,marginHeight,marginWidth,name,!noResize,scrolling,src', 'frameset^[HTMLElement]|cols,*beforeunload,*blur,*error,*focus,*hashchange,*languagechange,*load,*message,*offline,*online,*pagehide,*pageshow,*popstate,*rejectionhandled,*resize,*scroll,*storage,*unhandledrejection,*unload,rows', 'hr^[HTMLElement]|align,color,!noShade,size,width', 'head^[HTMLElement]|', 'h1,h2,h3,h4,h5,h6^[HTMLElement]|align', 'html^[HTMLElement]|version', 'iframe^[HTMLElement]|align,!allowFullscreen,frameBorder,height,longDesc,marginHeight,marginWidth,name,referrerPolicy,%sandbox,scrolling,src,srcdoc,width', 'img^[HTMLElement]|align,alt,border,%crossOrigin,#height,#hspace,!isMap,longDesc,lowsrc,name,referrerPolicy,sizes,src,srcset,useMap,#vspace,#width', 'input^[HTMLElement]|accept,align,alt,autocapitalize,autocomplete,!autofocus,!checked,!defaultChecked,defaultValue,dirName,!disabled,%files,formAction,formEnctype,formMethod,!formNoValidate,formTarget,#height,!incremental,!indeterminate,max,#maxLength,min,#minLength,!multiple,name,pattern,placeholder,!readOnly,!required,selectionDirection,#selectionEnd,#selectionStart,#size,src,step,type,useMap,value,%valueAsDate,#valueAsNumber,#width', 'li^[HTMLElement]|type,#value', 'label^[HTMLElement]|htmlFor', 'legend^[HTMLElement]|align', 'link^[HTMLElement]|as,charset,%crossOrigin,!disabled,href,hreflang,integrity,media,referrerPolicy,rel,%relList,rev,%sizes,target,type', 'map^[HTMLElement]|name', 'marquee^[HTMLElement]|behavior,bgColor,direction,height,#hspace,#loop,#scrollAmount,#scrollDelay,!trueSpeed,#vspace,width', 'menu^[HTMLElement]|!compact', 'meta^[HTMLElement]|content,httpEquiv,name,scheme', 'meter^[HTMLElement]|#high,#low,#max,#min,#optimum,#value', 'ins,del^[HTMLElement]|cite,dateTime', 'ol^[HTMLElement]|!compact,!reversed,#start,type', 'object^[HTMLElement]|align,archive,border,code,codeBase,codeType,data,!declare,height,#hspace,name,standby,type,useMap,#vspace,width', 'optgroup^[HTMLElement]|!disabled,label', 'option^[HTMLElement]|!defaultSelected,!disabled,label,!selected,text,value', 'output^[HTMLElement]|defaultValue,%htmlFor,name,value', 'p^[HTMLElement]|align', 'param^[HTMLElement]|name,type,value,valueType', 'picture^[HTMLElement]|', 'pre^[HTMLElement]|#width', 'progress^[HTMLElement]|#max,#value', 'q,blockquote,cite^[HTMLElement]|', 'script^[HTMLElement]|!async,charset,%crossOrigin,!defer,event,htmlFor,integrity,src,text,type', 'select^[HTMLElement]|!autofocus,!disabled,#length,!multiple,name,!required,#selectedIndex,#size,value', 'shadow^[HTMLElement]|', 'slot^[HTMLElement]|name', 'source^[HTMLElement]|media,sizes,src,srcset,type', 'span^[HTMLElement]|', 'style^[HTMLElement]|!disabled,media,type', 'caption^[HTMLElement]|align', 'th,td^[HTMLElement]|abbr,align,axis,bgColor,ch,chOff,#colSpan,headers,height,!noWrap,#rowSpan,scope,vAlign,width', 'col,colgroup^[HTMLElement]|align,ch,chOff,#span,vAlign,width', 'table^[HTMLElement]|align,bgColor,border,%caption,cellPadding,cellSpacing,frame,rules,summary,%tFoot,%tHead,width', 'tr^[HTMLElement]|align,bgColor,ch,chOff,vAlign', 'tfoot,thead,tbody^[HTMLElement]|align,ch,chOff,vAlign', 'template^[HTMLElement]|', 'textarea^[HTMLElement]|autocapitalize,!autofocus,#cols,defaultValue,dirName,!disabled,#maxLength,#minLength,name,placeholder,!readOnly,!required,#rows,selectionDirection,#selectionEnd,#selectionStart,value,wrap', 'title^[HTMLElement]|text', 'track^[HTMLElement]|!default,kind,label,src,srclang', 'ul^[HTMLElement]|!compact,type', 'unknown^[HTMLElement]|', 'video^media|#height,poster,#width', ':svg:a^:svg:graphics|', ':svg:animate^:svg:animation|', ':svg:animateMotion^:svg:animation|', ':svg:animateTransform^:svg:animation|', ':svg:circle^:svg:geometry|', ':svg:clipPath^:svg:graphics|', ':svg:defs^:svg:graphics|', ':svg:desc^:svg:|', ':svg:discard^:svg:|', ':svg:ellipse^:svg:geometry|', ':svg:feBlend^:svg:|', ':svg:feColorMatrix^:svg:|', ':svg:feComponentTransfer^:svg:|', ':svg:feComposite^:svg:|', ':svg:feConvolveMatrix^:svg:|', ':svg:feDiffuseLighting^:svg:|', ':svg:feDisplacementMap^:svg:|', ':svg:feDistantLight^:svg:|', ':svg:feDropShadow^:svg:|', ':svg:feFlood^:svg:|', ':svg:feFuncA^:svg:componentTransferFunction|', ':svg:feFuncB^:svg:componentTransferFunction|', ':svg:feFuncG^:svg:componentTransferFunction|', ':svg:feFuncR^:svg:componentTransferFunction|', ':svg:feGaussianBlur^:svg:|', ':svg:feImage^:svg:|', ':svg:feMerge^:svg:|', ':svg:feMergeNode^:svg:|', ':svg:feMorphology^:svg:|', ':svg:feOffset^:svg:|', ':svg:fePointLight^:svg:|', ':svg:feSpecularLighting^:svg:|', ':svg:feSpotLight^:svg:|', ':svg:feTile^:svg:|', ':svg:feTurbulence^:svg:|', ':svg:filter^:svg:|', ':svg:foreignObject^:svg:graphics|', ':svg:g^:svg:graphics|', ':svg:image^:svg:graphics|', ':svg:line^:svg:geometry|', ':svg:linearGradient^:svg:gradient|', ':svg:mpath^:svg:|', ':svg:marker^:svg:|', ':svg:mask^:svg:|', ':svg:metadata^:svg:|', ':svg:path^:svg:geometry|', ':svg:pattern^:svg:|', ':svg:polygon^:svg:geometry|', ':svg:polyline^:svg:geometry|', ':svg:radialGradient^:svg:gradient|', ':svg:rect^:svg:geometry|', ':svg:svg^:svg:graphics|#currentScale,#zoomAndPan', ':svg:script^:svg:|type', ':svg:set^:svg:animation|', ':svg:stop^:svg:|', ':svg:style^:svg:|!disabled,media,title,type', ':svg:switch^:svg:graphics|', ':svg:symbol^:svg:|', ':svg:tspan^:svg:textPositioning|', ':svg:text^:svg:textPositioning|', ':svg:textPath^:svg:textContent|', ':svg:title^:svg:|', ':svg:use^:svg:graphics|', ':svg:view^:svg:|#zoomAndPan', 'data^[HTMLElement]|value', 'keygen^[HTMLElement]|!autofocus,challenge,!disabled,form,keytype,name', 'menuitem^[HTMLElement]|type,label,icon,!disabled,!checked,radiogroup,!default', 'summary^[HTMLElement]|', 'time^[HTMLElement]|dateTime', ':svg:cursor^:svg:|', ]; const _ATTR_TO_PROP = { 'class': 'className', 'for': 'htmlFor', 'formaction': 'formAction', 'innerHtml': 'innerHTML', 'readonly': 'readOnly', 'tabindex': 'tabIndex', }; class DomElementSchemaRegistry extends ElementSchemaRegistry { constructor() { super(); this._schema = {}; SCHEMA.forEach(encodedType => { const /** @type {?} */ type = {}; const [strType, strProperties] = encodedType.split('|'); const /** @type {?} */ properties = strProperties.split(','); const [typeNames, superName] = strType.split('^'); typeNames.split(',').forEach(tag => this._schema[tag.toLowerCase()] = type); const /** @type {?} */ superType = superName && this._schema[superName.toLowerCase()]; if (superType) { Object.keys(superType).forEach((prop) => { type[prop] = superType[prop]; }); } properties.forEach((property) => { if (property.length > 0) { switch (property[0]) { case '*': // We don't yet support events. // If ever allowing to bind to events, GO THROUGH A SECURITY REVIEW, allowing events // will // almost certainly introduce bad XSS vulnerabilities. // type[property.substring(1)] = EVENT; break; case '!': type[property.substring(1)] = BOOLEAN; break; case '#': type[property.substring(1)] = NUMBER; break; case '%': type[property.substring(1)] = OBJECT; break; default: type[property] = STRING; } } }); }); } /** * @param {?} tagName * @param {?} propName * @param {?} schemaMetas * @return {?} */ hasProperty(tagName, propName, schemaMetas) { if (schemaMetas.some((schema) => schema.name === NO_ERRORS_SCHEMA.name)) { return true; } if (tagName.indexOf('-') > -1) { if (isNgContainer(tagName) || isNgContent(tagName)) { return false; } if (schemaMetas.some((schema) => schema.name === CUSTOM_ELEMENTS_SCHEMA.name)) { // Can't tell now as we don't know which properties a custom element will get // once it is instantiated return true; } } const /** @type {?} */ elementProperties = this._schema[tagName.toLowerCase()] || this._schema['unknown']; return !!elementProperties[propName]; } /** * @param {?} tagName * @param {?} schemaMetas * @return {?} */ hasElement(tagName, schemaMetas) { if (schemaMetas.some((schema) => schema.name === NO_ERRORS_SCHEMA.name)) { return true; } if (tagName.indexOf('-') > -1) { if (isNgContainer(tagName) || isNgContent(tagName)) { return true; } if (schemaMetas.some((schema) => schema.name === CUSTOM_ELEMENTS_SCHEMA.name)) { // Allow any custom elements return true; } } return !!this._schema[tagName.toLowerCase()]; } /** * securityContext returns the security context for the given property on the given DOM tag. * * Tag and property name are statically known and cannot change at runtime, i.e. it is not * possible to bind a value into a changing attribute or tag name. * * The filtering is white list based. All attributes in the schema above are assumed to have the * 'NONE' security context, i.e. that they are safe inert string values. Only specific well known * attack vectors are assigned their appropriate context. * @param {?} tagName * @param {?} propName * @param {?} isAttribute * @return {?} */ securityContext(tagName, propName, isAttribute) { if (isAttribute) { // NB: For security purposes, use the mapped property name, not the attribute name. propName = this.getMappedPropName(propName); } // Make sure comparisons are case insensitive, so that case differences between attribute and // property names do not have a security impact. tagName = tagName.toLowerCase(); propName = propName.toLowerCase(); let /** @type {?} */ ctx = SECURITY_SCHEMA[tagName + '|' + propName]; if (ctx) { return ctx; } ctx = SECURITY_SCHEMA['*|' + propName]; return ctx ? ctx : SecurityContext.NONE; } /** * @param {?} propName * @return {?} */ getMappedPropName(propName) { return _ATTR_TO_PROP[propName] || propName; } /** * @return {?} */ getDefaultComponentElementName() { return 'ng-component'; } /** * @param {?} name * @return {?} */ validateProperty(name) { if (name.toLowerCase().startsWith('on')) { const /** @type {?} */ msg = `Binding to event property '${name}' is disallowed for security reasons, ` + `please use (${name.slice(2)})=...` + `\nIf '${name}' is a directive input, make sure the directive is imported by the` + ` current module.`; return { error: true, msg: msg }; } else { return { error: false }; } } /** * @param {?} name * @return {?} */ validateAttribute(name) { if (name.toLowerCase().startsWith('on')) { const /** @type {?} */ msg = `Binding to event attribute '${name}' is disallowed for security reasons, ` + `please use (${name.slice(2)})=...`; return { error: true, msg: msg }; } else { return { error: false }; } } /** * @return {?} */ allKnownElementNames() { return Object.keys(this._schema); } /** * @param {?} propName * @return {?} */ normalizeAnimationStyleProperty(propName) { return dashCaseToCamelCase(propName); } /** * @param {?} camelCaseProp * @param {?} userProvidedProp * @param {?} val * @return {?} */ normalizeAnimationStyleValue(camelCaseProp, userProvidedProp, val) { let /** @type {?} */ unit = ''; const /** @type {?} */ strVal = val.toString().trim(); let /** @type {?} */ errorMsg = /** @type {?} */ ((null)); if (_isPixelDimensionStyle(camelCaseProp) && val !== 0 && val !== '0') { if (typeof val === 'number') { unit = 'px'; } else { const /** @type {?} */ valAndSuffixMatch = val.match(/^[+-]?[\d\.]+([a-z]*)$/); if (valAndSuffixMatch && valAndSuffixMatch[1].length == 0) { errorMsg = `Please provide a CSS unit value for ${userProvidedProp}:${val}`; } } } return { error: errorMsg, value: strVal + unit }; } } /** * @param {?} prop * @return {?} */ function _isPixelDimensionStyle(prop) { switch (prop) { case 'width': case 'height': case 'minWidth': case 'minHeight': case 'maxWidth': case 'maxHeight': case 'left': case 'top': case 'bottom': case 'right': case 'fontSize': case 'outlineWidth': case 'outlineOffset': case 'paddingTop': case 'paddingLeft': case 'paddingBottom': case 'paddingRight': case 'marginTop': case 'marginLeft': case 'marginBottom': case 'marginRight': case 'borderRadius': case 'borderWidth': case 'borderTopWidth': case 'borderLeftWidth': case 'borderRightWidth': case 'borderBottomWidth': case 'textIndent': return true; default: return false; } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * This file is a port of shadowCSS from webcomponents.js to TypeScript. * * Please make sure to keep to edits in sync with the source file. * * Source: * https://github.com/webcomponents/webcomponentsjs/blob/4efecd7e0e/src/ShadowCSS/ShadowCSS.js * * The original file level comment is reproduced below */ /* This is a limited shim for ShadowDOM css styling. https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/shadow/index.html#styles The intention here is to support only the styling features which can be relatively simply implemented. The goal is to allow users to avoid the most obvious pitfalls and do so without compromising performance significantly. For ShadowDOM styling that's not covered here, a set of best practices can be provided that should allow users to accomplish more complex styling. The following is a list of specific ShadowDOM styling features and a brief discussion of the approach used to shim. Shimmed features: * :host, :host-context: ShadowDOM allows styling of the shadowRoot's host element using the :host rule. To shim this feature, the :host styles are reformatted and prefixed with a given scope name and promoted to a document level stylesheet. For example, given a scope name of .foo, a rule like this: :host { background: red; } } becomes: .foo { background: red; } * encapsulation: Styles defined within ShadowDOM, apply only to dom inside the ShadowDOM. Polymer uses one of two techniques to implement this feature. By default, rules are prefixed with the host element tag name as a descendant selector. This ensures styling does not leak out of the 'top' of the element's ShadowDOM. For example, div { font-weight: bold; } becomes: x-foo div { font-weight: bold; } becomes: Alternatively, if WebComponents.ShadowCSS.strictStyling is set to true then selectors are scoped by adding an attribute selector suffix to each simple selector that contains the host element tag name. Each element in the element's ShadowDOM template is also given the scope attribute. Thus, these rules match only elements that have the scope attribute. For example, given a scope name of x-foo, a rule like this: div { font-weight: bold; } becomes: div[x-foo] { font-weight: bold; } Note that elements that are dynamically added to a scope must have the scope selector added to them manually. * upper/lower bound encapsulation: Styles which are defined outside a shadowRoot should not cross the ShadowDOM boundary and should not apply inside a shadowRoot. This styling behavior is not emulated. Some possible ways to do this that were rejected due to complexity and/or performance concerns include: (1) reset every possible property for every possible selector for a given scope name; (2) re-implement css in javascript. As an alternative, users should make sure to use selectors specific to the scope in which they are working. * ::distributed: This behavior is not emulated. It's often not necessary to style the contents of a specific insertion point and instead, descendants of the host element can be styled selectively. Users can also create an extra node around an insertion point and style that node's contents via descendent selectors. For example, with a shadowRoot like this: <style> ::content(div) { background: red; } </style> <content></content> could become: <style> / *@polyfill .content-container div * / ::content(div) { background: red; } </style> <div class="content-container"> <content></content> </div> Note the use of @polyfill in the comment above a ShadowDOM specific style declaration. This is a directive to the styling shim to use the selector in comments in lieu of the next selector when running under polyfill. */ class ShadowCss { constructor() { this.strictStyling = true; } /** * @param {?} cssText * @param {?} selector * @param {?=} hostSelector * @return {?} */ shimCssText(cssText, selector, hostSelector = '') { const /** @type {?} */ commentsWithHash = extractCommentsWithHash(cssText); cssText = stripComments(cssText); cssText = this._insertDirectives(cssText); const /** @type {?} */ scopedCssText = this._scopeCssText(cssText, selector, hostSelector); return [scopedCssText, ...commentsWithHash].join('\n'); } /** * @param {?} cssText * @return {?} */ _insertDirectives(cssText) { cssText = this._insertPolyfillDirectivesInCssText(cssText); return this._insertPolyfillRulesInCssText(cssText); } /** * @param {?} cssText * @return {?} */ _insertPolyfillDirectivesInCssText(cssText) { // Difference with webcomponents.js: does not handle comments return cssText.replace(_cssContentNextSelectorRe, function (...m) { return m[2] + '{'; }); } /** * @param {?} cssText * @return {?} */ _insertPolyfillRulesInCssText(cssText) { // Difference with webcomponents.js: does not handle comments return cssText.replace(_cssContentRuleRe, (...m) => { const /** @type {?} */ rule = m[0].replace(m[1], '').replace(m[2], ''); return m[4] + rule; }); } /** * @param {?} cssText * @param {?} scopeSelector * @param {?} hostSelector * @return {?} */ _scopeCssText(cssText, scopeSelector, hostSelector) { const /** @type {?} */ unscopedRules = this._extractUnscopedRulesFromCssText(cssText); // replace :host and :host-context -shadowcsshost and -shadowcsshost respectively cssText = this._insertPolyfillHostInCssText(cssText); cssText = this._convertColonHost(cssText); cssText = this._convertColonHostContext(cssText); cssText = this._convertShadowDOMSelectors(cssText); if (scopeSelector) { cssText = this._scopeSelectors(cssText, scopeSelector, hostSelector); } cssText = cssText + '\n' + unscopedRules; return cssText.trim(); } /** * @param {?} cssText * @return {?} */ _extractUnscopedRulesFromCssText(cssText) { // Difference with webcomponents.js: does not handle comments let /** @type {?} */ r = ''; let /** @type {?} */ m; _cssContentUnscopedRuleRe.lastIndex = 0; while ((m = _cssContentUnscopedRuleRe.exec(cssText)) !== null) { const /** @type {?} */ rule = m[0].replace(m[2], '').replace(m[1], m[4]); r += rule + '\n\n'; } return r; } /** * @param {?} cssText * @return {?} */ _convertColonHost(cssText) { return this._convertColonRule(cssText, _cssColonHostRe, this._colonHostPartReplacer); } /** * @param {?} cssText * @return {?} */ _convertColonHostContext(cssText) { return this._convertColonRule(cssText, _cssColonHostContextRe, this._colonHostContextPartReplacer); } /** * @param {?} cssText * @param {?} regExp * @param {?} partReplacer * @return {?} */ _convertColonRule(cssText, regExp, partReplacer) { // m[1] = :host(-context), m[2] = contents of (), m[3] rest of rule return cssText.replace(regExp, function (...m) { if (m[2]) { const /** @type {?} */ parts = m[2].split(','); const /** @type {?} */ r = []; for (let /** @type {?} */ i = 0; i < parts.length; i++) { const /** @type {?} */ p = parts[i].trim(); if (!p) break; r.push(partReplacer(_polyfillHostNoCombinator, p, m[3])); } return r.join(','); } else { return _polyfillHostNoCombinator + m[3]; } }); } /** * @param {?} host * @param {?} part * @param {?} suffix * @return {?} */ _colonHostContextPartReplacer(host, part, suffix) { if (part.indexOf(_polyfillHost) > -1) { return this._colonHostPartReplacer(host, part, suffix); } else { return host + part + suffix + ', ' + part + ' ' + host + suffix; } } /** * @param {?} host * @param {?} part * @param {?} suffix * @return {?} */ _colonHostPartReplacer(host, part, suffix) { return host + part.replace(_polyfillHost, '') + suffix; } /** * @param {?} cssText * @return {?} */ _convertShadowDOMSelectors(cssText) { return _shadowDOMSelectorsRe.reduce((result, pattern) => result.replace(pattern, ' '), cssText); } /** * @param {?} cssText * @param {?} scopeSelector * @param {?} hostSelector * @return {?} */ _scopeSelectors(cssText, scopeSelector, hostSelector) { return processRules(cssText, (rule) => { let /** @type {?} */ selector = rule.selector; let /** @type {?} */ content = rule.content; if (rule.selector[0] != '@') { selector = this._scopeSelector(rule.selector, scopeSelector, hostSelector, this.strictStyling); } else if (rule.selector.startsWith('@media') || rule.selector.startsWith('@supports') || rule.selector.startsWith('@page') || rule.selector.startsWith('@document')) { content = this._scopeSelectors(rule.content, scopeSelector, hostSelector); } return new CssRule(selector, content); }); } /** * @param {?} selector * @param {?} scopeSelector * @param {?} hostSelector * @param {?} strict * @return {?} */ _scopeSelector(selector, scopeSelector, hostSelector, strict) { return selector.split(',') .map(part => part.trim().split(_shadowDeepSelectors)) .map((deepParts) => { const [shallowPart, ...otherParts] = deepParts; const /** @type {?} */ applyScope = (shallowPart) => { if (this._selectorNeedsScoping(shallowPart, scopeSelector)) { return strict ? this._applyStrictSelectorScope(shallowPart, scopeSelector, hostSelector) : this._applySelectorScope(shallowPart, scopeSelector, hostSelector); } else { return shallowPart; } }; return [applyScope(shallowPart), ...otherParts].join(' '); }) .join(', '); } /** * @param {?} selector * @param {?} scopeSelector * @return {?} */ _selectorNeedsScoping(selector, scopeSelector) { const /** @type {?} */ re = this._makeScopeMatcher(scopeSelector); return !re.test(selector); } /** * @param {?} scopeSelector * @return {?} */ _makeScopeMatcher(scopeSelector) { const /** @type {?} */ lre = /\[/g; const /** @type {?} */ rre = /\]/g; scopeSelector = scopeSelector.replace(lre, '\\[').replace(rre, '\\]'); return new RegExp('^(' + scopeSelector + ')' + _selectorReSuffix, 'm'); } /** * @param {?} selector * @param {?} scopeSelector * @param {?} hostSelector * @return {?} */ _applySelectorScope(selector, scopeSelector, hostSelector) { // Difference from webcomponents.js: scopeSelector could not be an array return this._applySimpleSelectorScope(selector, scopeSelector, hostSelector); } /** * @param {?} selector * @param {?} scopeSelector * @param {?} hostSelector * @return {?} */ _applySimpleSelectorScope(selector, scopeSelector, hostSelector) { // In Android browser, the lastIndex is not reset when the regex is used in String.replace() _polyfillHostRe.lastIndex = 0; if (_polyfillHostRe.test(selector)) { const /** @type {?} */ replaceBy = this.strictStyling ? `[${hostSelector}]` : scopeSelector; return selector .replace(_polyfillHostNoCombinatorRe, (hnc, selector) => { return selector.replace(/([^:]*)(:*)(.*)/, (_, before, colon, after) => { return before + replaceBy + colon + after; }); }) .replace(_polyfillHostRe, replaceBy + ' '); } return scopeSelector + ' ' + selector; } /** * @param {?} selector * @param {?} scopeSelector * @param {?} hostSelector * @return {?} */ _applyStrictSelectorScope(selector, scopeSelector, hostSelector) { const /** @type {?} */ isRe = /\[is=([^\]]*)\]/g; scopeSelector = scopeSelector.replace(isRe, (_, ...parts) => parts[0]); const /** @type {?} */ attrName = '[' + scopeSelector + ']'; const /** @type {?} */ _scopeSelectorPart = (p) => { let /** @type {?} */ scopedP = p.trim(); if (!scopedP) { return ''; } if (p.indexOf(_polyfillHostNoCombinator) > -1) { scopedP = this._applySimpleSelectorScope(p, scopeSelector, hostSelector); } else { // remove :host since it should be unnecessary const /** @type {?} */ t = p.replace(_polyfillHostRe, ''); if (t.length > 0) { const /** @type {?} */ matches = t.match(/([^:]*)(:*)(.*)/); if (matches) { scopedP = matches[1] + attrName + matches[2] + matches[3]; } } } return scopedP; }; const /** @type {?} */ safeContent = new SafeSelector(selector); selector = safeContent.content(); let /** @type {?} */ scopedSelector = ''; let /** @type {?} */ startIndex = 0; let /** @type {?} */ res; const /** @type {?} */ sep = /( |>|\+|~(?!=))\s*/g; // If a selector appears before :host it should not be shimmed as it // matches on ancestor elements and not on elements in the host's shadow // `:host-context(div)` is transformed to // `-shadowcsshost-no-combinatordiv, div -shadowcsshost-no-combinator` // the `div` is not part of the component in the 2nd selectors and should not be scoped. // Historically `component-tag:host` was matching the component so we also want to preserve // this behavior to avoid breaking legacy apps (it should not match). // The behavior should be: // - `tag:host` -> `tag[h]` (this is to avoid breaking legacy apps, should not match anything) // - `tag :host` -> `tag [h]` (`tag` is not scoped because it's considered part of a // `:host-context(tag)`) const /** @type {?} */ hasHost = selector.indexOf(_polyfillHostNoCombinator) > -1; // Only scope parts after the first `-shadowcsshost-no-combinator` when it is present let /** @type {?} */ shouldScope = !hasHost; while ((res = sep.exec(selector)) !== null) { const /** @type {?} */ separator = res[1]; const /** @type {?} */ part = selector.slice(startIndex, res.index).trim(); shouldScope = shouldScope || part.indexOf(_polyfillHostNoCombinator) > -1; const /** @type {?} */ scopedPart = shouldScope ? _scopeSelectorPart(part) : part; scopedSelector += `${scopedPart} ${separator} `; startIndex = sep.lastIndex; } const /** @type {?} */ part = selector.substring(startIndex); shouldScope = shouldScope || part.indexOf(_polyfillHostNoCombinator) > -1; scopedSelector += shouldScope ? _scopeSelectorPart(part) : part; // replace the placeholders with their original values return safeContent.restore(scopedSelector); } /** * @param {?} selector * @return {?} */ _insertPolyfillHostInCssText(selector) { return selector.replace(_colonHostContextRe, _polyfillHostContext) .replace(_colonHostRe, _polyfillHost); } } class SafeSelector { /** * @param {?} selector */ constructor(selector) { this.placeholders = []; this.index = 0; // Replaces attribute selectors with placeholders. // The WS in [attr="va lue"] would otherwise be interpreted as a selector separator. selector = selector.replace(/(\[[^\]]*\])/g, (_, keep) => { const /** @type {?} */ replaceBy = `__ph-${this.index}__`; this.placeholders.push(keep); this.index++; return replaceBy; }); // Replaces the expression in `:nth-child(2n + 1)` with a placeholder. // WS and "+" would otherwise be interpreted as selector separators. this._content = selector.replace(/(:nth-[-\w]+)(\([^)]+\))/g, (_, pseudo, exp) => { const /** @type {?} */ replaceBy = `__ph-${this.index}__`; this.placeholders.push(exp); this.index++; return pseudo + replaceBy; }); } /** * @param {?} content * @return {?} */ restore(content) { return content.replace(/__ph-(\d+)__/g, (ph, index) => this.placeholders[+index]); } /** * @return {?} */ content() { return this._content; } } const _cssContentNextSelectorRe = /polyfill-next-selector[^}]*content:[\s]*?(['"])(.*?)\1[;\s]*}([^{]*?){/gim; const _cssContentRuleRe = /(polyfill-rule)[^}]*(content:[\s]*(['"])(.*?)\3)[;\s]*[^}]*}/gim; const _cssContentUnscopedRuleRe = /(polyfill-unscoped-rule)[^}]*(content:[\s]*(['"])(.*?)\3)[;\s]*[^}]*}/gim; const _polyfillHost = '-shadowcsshost'; // note: :host-context pre-processed to -shadowcsshostcontext. const _polyfillHostContext = '-shadowcsscontext'; const _parenSuffix = ')(?:\\((' + '(?:\\([^)(]*\\)|[^)(]*)+?' + ')\\))?([^,{]*)'; const _cssColonHostRe = new RegExp('(' + _polyfillHost + _parenSuffix, 'gim'); const _cssColonHostContextRe = new RegExp('(' + _polyfillHostContext + _parenSuffix, 'gim'); const _polyfillHostNoCombinator = _polyfillHost + '-no-combinator'; const _polyfillHostNoCombinatorRe = /-shadowcsshost-no-combinator([^\s]*)/; const _shadowDOMSelectorsRe = [ /::shadow/g, /::content/g, /\/shadow-deep\//g, /\/shadow\//g, ]; // The deep combinator is deprecated in the CSS spec // Support for `>>>`, `deep`, `::ng-deep` is then also deprecated and will be removed in the future. // see https://github.com/angular/angular/pull/17677 const _shadowDeepSelectors = /(?:>>>)|(?:\/deep\/)|(?:::ng-deep)/g; const _selectorReSuffix = '([>\\s~+\[.,{:][\\s\\S]*)?$'; const _polyfillHostRe = /-shadowcsshost/gim; const _colonHostRe = /:host/gim; const _colonHostContextRe = /:host-context/gim; const _commentRe = /\/\*\s*[\s\S]*?\*\//g; /** * @param {?} input * @return {?} */ function stripComments(input) { return input.replace(_commentRe, ''); } const _commentWithHashRe = /\/\*\s*#\s*source(Mapping)?URL=[\s\S]+?\*\//g; /** * @param {?} input * @return {?} */ function extractCommentsWithHash(input) { return input.match(_commentWithHashRe) || []; } const _ruleRe = /(\s*)([^;\{\}]+?)(\s*)((?:{%BLOCK%}?\s*;?)|(?:\s*;))/g; const _curlyRe = /([{}])/g; const OPEN_CURLY = '{'; const CLOSE_CURLY = '}'; const BLOCK_PLACEHOLDER = '%BLOCK%'; class CssRule { /** * @param {?} selector * @param {?} content */ constructor(selector, content) { this.selector = selector; this.content = content; } } /** * @param {?} input * @param {?} ruleCallback * @return {?} */ function processRules(input, ruleCallback) { const /** @type {?} */ inputWithEscapedBlocks = escapeBlocks(input); let /** @type {?} */ nextBlockIndex = 0; return inputWithEscapedBlocks.escapedString.replace(_ruleRe, function (...m) { const /** @type {?} */ selector = m[2]; let /** @type {?} */ content = ''; let /** @type {?} */ suffix = m[4]; let /** @type {?} */ contentPrefix = ''; if (suffix && suffix.startsWith('{' + BLOCK_PLACEHOLDER)) { content = inputWithEscapedBlocks.blocks[nextBlockIndex++]; suffix = suffix.substring(BLOCK_PLACEHOLDER.length + 1); contentPrefix = '{'; } const /** @type {?} */ rule = ruleCallback(new CssRule(selector, content)); return `${m[1]}${rule.selector}${m[3]}${contentPrefix}${rule.content}${suffix}`; }); } class StringWithEscapedBlocks { /** * @param {?} escapedString * @param {?} blocks */ constructor(escapedString, blocks) { this.escapedString = escapedString; this.blocks = blocks; } } /** * @param {?} input * @return {?} */ function escapeBlocks(input) { const /** @type {?} */ inputParts = input.split(_curlyRe); const /** @type {?} */ resultParts = []; const /** @type {?} */ escapedBlocks = []; let /** @type {?} */ bracketCount = 0; let /** @type {?} */ currentBlockParts = []; for (let /** @type {?} */ partIndex = 0; partIndex < inputParts.length; partIndex++) { const /** @type {?} */ part = inputParts[partIndex]; if (part == CLOSE_CURLY) { bracketCount--; } if (bracketCount > 0) { currentBlockParts.push(part); } else { if (currentBlockParts.length > 0) { escapedBlocks.push(currentBlockParts.join('')); resultParts.push(BLOCK_PLACEHOLDER); currentBlockParts = []; } resultParts.push(part); } if (part == OPEN_CURLY) { bracketCount++; } } if (currentBlockParts.length > 0) { escapedBlocks.push(currentBlockParts.join('')); resultParts.push(BLOCK_PLACEHOLDER); } return new StringWithEscapedBlocks(resultParts.join(''), escapedBlocks); } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ const COMPONENT_VARIABLE = '%COMP%'; const HOST_ATTR = `_nghost-${COMPONENT_VARIABLE}`; const CONTENT_ATTR = `_ngcontent-${COMPONENT_VARIABLE}`; class StylesCompileDependency { /** * @param {?} name * @param {?} moduleUrl * @param {?} setValue */ constructor(name, moduleUrl, setValue) { this.name = name; this.moduleUrl = moduleUrl; this.setValue = setValue; } } class CompiledStylesheet { /** * @param {?} outputCtx * @param {?} stylesVar * @param {?} dependencies * @param {?} isShimmed * @param {?} meta */ constructor(outputCtx, stylesVar, dependencies, isShimmed, meta) { this.outputCtx = outputCtx; this.stylesVar = stylesVar; this.dependencies = dependencies; this.isShimmed = isShimmed; this.meta = meta; } } class StyleCompiler { /** * @param {?} _urlResolver */ constructor(_urlResolver) { this._urlResolver = _urlResolver; this._shadowCss = new ShadowCss(); } /** * @param {?} outputCtx * @param {?} comp * @return {?} */ compileComponent(outputCtx, comp) { const /** @type {?} */ template = /** @type {?} */ ((comp.template)); return this._compileStyles(outputCtx, comp, new CompileStylesheetMetadata({ styles: template.styles, styleUrls: template.styleUrls, moduleUrl: identifierModuleUrl(comp.type) }), this.needsStyleShim(comp), true); } /** * @param {?} outputCtx * @param {?} comp * @param {?} stylesheet * @param {?=} shim * @return {?} */ compileStyles(outputCtx, comp, stylesheet, shim = this.needsStyleShim(comp)) { return this._compileStyles(outputCtx, comp, stylesheet, shim, false); } /** * @param {?} comp * @return {?} */ needsStyleShim(comp) { return /** @type {?} */ ((comp.template)).encapsulation === ViewEncapsulation.Emulated; } /** * @param {?} outputCtx * @param {?} comp * @param {?} stylesheet * @param {?} shim * @param {?} isComponentStylesheet * @return {?} */ _compileStyles(outputCtx, comp, stylesheet, shim, isComponentStylesheet) { const /** @type {?} */ styleExpressions = stylesheet.styles.map(plainStyle => literal(this._shimIfNeeded(plainStyle, shim))); const /** @type {?} */ dependencies = []; stylesheet.styleUrls.forEach((styleUrl) => { const /** @type {?} */ exprIndex = styleExpressions.length; // Note: This placeholder will be filled later. styleExpressions.push(/** @type {?} */ ((null))); dependencies.push(new StylesCompileDependency(getStylesVarName(null), styleUrl, (value) => styleExpressions[exprIndex] = outputCtx.importExpr(value))); }); // styles variable contains plain strings and arrays of other styles arrays (recursive), // so we set its type to dynamic. const /** @type {?} */ stylesVar = getStylesVarName(isComponentStylesheet ? comp : null); const /** @type {?} */ stmt = variable(stylesVar) .set(literalArr(styleExpressions, new ArrayType(DYNAMIC_TYPE, [TypeModifier.Const]))) .toDeclStmt(null, isComponentStylesheet ? [StmtModifier.Final] : [ StmtModifier.Final, StmtModifier.Exported ]); outputCtx.statements.push(stmt); return new CompiledStylesheet(outputCtx, stylesVar, dependencies, shim, stylesheet); } /** * @param {?} style * @param {?} shim * @return {?} */ _shimIfNeeded(style, shim) { return shim ? this._shadowCss.shimCssText(style, CONTENT_ATTR, HOST_ATTR) : style; } } /** * @param {?} component * @return {?} */ function getStylesVarName(component) { let /** @type {?} */ result = `styles`; if (component) { result += `_${identifierName(component.type)}`; } return result; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ const PRESERVE_WS_ATTR_NAME = 'ngPreserveWhitespaces'; const SKIP_WS_TRIM_TAGS = new Set(['pre', 'template', 'textarea', 'script', 'style']); // Equivalent to \s with \u00a0 (non-breaking space) excluded. // Based on https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp const WS_CHARS = ' \f\n\r\t\v\u1680\u180e\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff'; const NO_WS_REGEXP = new RegExp(`[^${WS_CHARS}]`); const WS_REPLACE_REGEXP = new RegExp(`[${WS_CHARS}]{2,}`, 'g'); /** * @param {?} attrs * @return {?} */ function hasPreserveWhitespacesAttr(attrs) { return attrs.some((attr) => attr.name === PRESERVE_WS_ATTR_NAME); } /** * Angular Dart introduced &ngsp; as a placeholder for non-removable space, see: * https://github.com/dart-lang/angular/blob/0bb611387d29d65b5af7f9d2515ab571fd3fbee4/_tests/test/compiler/preserve_whitespace_test.dart#L25-L32 * In Angular Dart &ngsp; is converted to the 0xE500 PUA (Private Use Areas) unicode character * and later on replaced by a space. We are re-implementing the same idea here. * @param {?} value * @return {?} */ function replaceNgsp(value) { // lexer is replacing the &ngsp; pseudo-entity with NGSP_UNICODE return value.replace(new RegExp(NGSP_UNICODE, 'g'), ' '); } /** * This visitor can walk HTML parse tree and remove / trim text nodes using the following rules: * - consider spaces, tabs and new lines as whitespace characters; * - drop text nodes consisting of whitespace characters only; * - for all other text nodes replace consecutive whitespace characters with one space; * - convert &ngsp; pseudo-entity to a single space; * * Removal and trimming of whitespaces have positive performance impact (less code to generate * while compiling templates, faster view creation). At the same time it can be "destructive" * in some cases (whitespaces can influence layout). Because of the potential of breaking layout * this visitor is not activated by default in Angular 5 and people need to explicitly opt-in for * whitespace removal. The default option for whitespace removal will be revisited in Angular 6 * and might be changed to "on" by default. */ class WhitespaceVisitor { /** * @param {?} element * @param {?} context * @return {?} */ visitElement(element, context) { if (SKIP_WS_TRIM_TAGS.has(element.name) || hasPreserveWhitespacesAttr(element.attrs)) { // don't descent into elements where we need to preserve whitespaces // but still visit all attributes to eliminate one used as a market to preserve WS return new Element(element.name, visitAll(this, element.attrs), element.children, element.sourceSpan, element.startSourceSpan, element.endSourceSpan); } return new Element(element.name, element.attrs, visitAll(this, element.children), element.sourceSpan, element.startSourceSpan, element.endSourceSpan); } /** * @param {?} attribute * @param {?} context * @return {?} */ visitAttribute(attribute, context) { return attribute.name !== PRESERVE_WS_ATTR_NAME ? attribute : null; } /** * @param {?} text * @param {?} context * @return {?} */ visitText(text, context) { const /** @type {?} */ isNotBlank = text.value.match(NO_WS_REGEXP); if (isNotBlank) { return new Text(replaceNgsp(text.value).replace(WS_REPLACE_REGEXP, ' '), text.sourceSpan); } return null; } /** * @param {?} comment * @param {?} context * @return {?} */ visitComment(comment, context) { return comment; } /** * @param {?} expansion * @param {?} context * @return {?} */ visitExpansion(expansion, context) { return expansion; } /** * @param {?} expansionCase * @param {?} context * @return {?} */ visitExpansionCase(expansionCase, context) { return expansionCase; } } /** * @param {?} htmlAstWithErrors * @return {?} */ function removeWhitespaces(htmlAstWithErrors) { return new ParseTreeResult(visitAll(new WhitespaceVisitor(), htmlAstWithErrors.rootNodes), htmlAstWithErrors.errors); } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ // http://cldr.unicode.org/index/cldr-spec/plural-rules const PLURAL_CASES = ['zero', 'one', 'two', 'few', 'many', 'other']; /** * Expands special forms into elements. * * For example, * * ``` * { messages.length, plural, * =0 {zero} * =1 {one} * other {more than one} * } * ``` * * will be expanded into * * ``` * <ng-container [ngPlural]="messages.length"> * <ng-template ngPluralCase="=0">zero</ng-template> * <ng-template ngPluralCase="=1">one</ng-template> * <ng-template ngPluralCase="other">more than one</ng-template> * </ng-container> * ``` * @param {?} nodes * @return {?} */ function expandNodes(nodes) { const /** @type {?} */ expander = new _Expander(); return new ExpansionResult(visitAll(expander, nodes), expander.isExpanded, expander.errors); } class ExpansionResult { /** * @param {?} nodes * @param {?} expanded * @param {?} errors */ constructor(nodes, expanded, errors) { this.nodes = nodes; this.expanded = expanded; this.errors = errors; } } class ExpansionError extends ParseError { /** * @param {?} span * @param {?} errorMsg */ constructor(span, errorMsg) { super(span, errorMsg); } } /** * Expand expansion forms (plural, select) to directives * * \@internal */ class _Expander { constructor() { this.isExpanded = false; this.errors = []; } /** * @param {?} element * @param {?} context * @return {?} */ visitElement(element, context) { return new Element(element.name, element.attrs, visitAll(this, element.children), element.sourceSpan, element.startSourceSpan, element.endSourceSpan); } /** * @param {?} attribute * @param {?} context * @return {?} */ visitAttribute(attribute, context) { return attribute; } /** * @param {?} text * @param {?} context * @return {?} */ visitText(text, context) { return text; } /** * @param {?} comment * @param {?} context * @return {?} */ visitComment(comment, context) { return comment; } /** * @param {?} icu * @param {?} context * @return {?} */ visitExpansion(icu, context) { this.isExpanded = true; return icu.type == 'plural' ? _expandPluralForm(icu, this.errors) : _expandDefaultForm(icu, this.errors); } /** * @param {?} icuCase * @param {?} context * @return {?} */ visitExpansionCase(icuCase, context) { throw new Error('Should not be reached'); } } /** * @param {?} ast * @param {?} errors * @return {?} */ function _expandPluralForm(ast, errors) { const /** @type {?} */ children = ast.cases.map(c => { if (PLURAL_CASES.indexOf(c.value) == -1 && !c.value.match(/^=\d+$/)) { errors.push(new ExpansionError(c.valueSourceSpan, `Plural cases should be "=<number>" or one of ${PLURAL_CASES.join(", ")}`)); } const /** @type {?} */ expansionResult = expandNodes(c.expression); errors.push(...expansionResult.errors); return new Element(`ng-template`, [new Attribute$1('ngPluralCase', `${c.value}`, c.valueSourceSpan)], expansionResult.nodes, c.sourceSpan, c.sourceSpan, c.sourceSpan); }); const /** @type {?} */ switchAttr = new Attribute$1('[ngPlural]', ast.switchValue, ast.switchValueSourceSpan); return new Element('ng-container', [switchAttr], children, ast.sourceSpan, ast.sourceSpan, ast.sourceSpan); } /** * @param {?} ast * @param {?} errors * @return {?} */ function _expandDefaultForm(ast, errors) { const /** @type {?} */ children = ast.cases.map(c => { const /** @type {?} */ expansionResult = expandNodes(c.expression); errors.push(...expansionResult.errors); if (c.value === 'other') { // other is the default case when no values match return new Element(`ng-template`, [new Attribute$1('ngSwitchDefault', '', c.valueSourceSpan)], expansionResult.nodes, c.sourceSpan, c.sourceSpan, c.sourceSpan); } return new Element(`ng-template`, [new Attribute$1('ngSwitchCase', `${c.value}`, c.valueSourceSpan)], expansionResult.nodes, c.sourceSpan, c.sourceSpan, c.sourceSpan); }); const /** @type {?} */ switchAttr = new Attribute$1('[ngSwitch]', ast.switchValue, ast.switchValueSourceSpan); return new Element('ng-container', [switchAttr], children, ast.sourceSpan, ast.sourceSpan, ast.sourceSpan); } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ const PROPERTY_PARTS_SEPARATOR = '.'; const ATTRIBUTE_PREFIX = 'attr'; const CLASS_PREFIX = 'class'; const STYLE_PREFIX = 'style'; const ANIMATE_PROP_PREFIX = 'animate-'; /** @enum {number} */ const BoundPropertyType = { DEFAULT: 0, LITERAL_ATTR: 1, ANIMATION: 2, }; BoundPropertyType[BoundPropertyType.DEFAULT] = "DEFAULT"; BoundPropertyType[BoundPropertyType.LITERAL_ATTR] = "LITERAL_ATTR"; BoundPropertyType[BoundPropertyType.ANIMATION] = "ANIMATION"; /** * Represents a parsed property. */ class BoundProperty { /** * @param {?} name * @param {?} expression * @param {?} type * @param {?} sourceSpan */ constructor(name, expression, type, sourceSpan) { this.name = name; this.expression = expression; this.type = type; this.sourceSpan = sourceSpan; this.isLiteral = this.type === BoundPropertyType.LITERAL_ATTR; this.isAnimation = this.type === BoundPropertyType.ANIMATION; } } /** * Parses bindings in templates and in the directive host area. */ class BindingParser { /** * @param {?} _exprParser * @param {?} _interpolationConfig * @param {?} _schemaRegistry * @param {?} pipes * @param {?} _targetErrors */ constructor(_exprParser, _interpolationConfig, _schemaRegistry, pipes, _targetErrors) { this._exprParser = _exprParser; this._interpolationConfig = _interpolationConfig; this._schemaRegistry = _schemaRegistry; this._targetErrors = _targetErrors; this.pipesByName = new Map(); this._usedPipes = new Map(); pipes.forEach(pipe => this.pipesByName.set(pipe.name, pipe)); } /** * @return {?} */ getUsedPipes() { return Array.from(this._usedPipes.values()); } /** * @param {?} dirMeta * @param {?} elementSelector * @param {?} sourceSpan * @return {?} */ createDirectiveHostPropertyAsts(dirMeta, elementSelector, sourceSpan) { if (dirMeta.hostProperties) { const /** @type {?} */ boundProps = []; Object.keys(dirMeta.hostProperties).forEach(propName => { const /** @type {?} */ expression = dirMeta.hostProperties[propName]; if (typeof expression === 'string') { this.parsePropertyBinding(propName, expression, true, sourceSpan, [], boundProps); } else { this._reportError(`Value of the host property binding "${propName}" needs to be a string representing an expression but got "${expression}" (${typeof expression})`, sourceSpan); } }); return boundProps.map((prop) => this.createElementPropertyAst(elementSelector, prop)); } return null; } /** * @param {?} dirMeta * @param {?} sourceSpan * @return {?} */ createDirectiveHostEventAsts(dirMeta, sourceSpan) { if (dirMeta.hostListeners) { const /** @type {?} */ targetEventAsts = []; Object.keys(dirMeta.hostListeners).forEach(propName => { const /** @type {?} */ expression = dirMeta.hostListeners[propName]; if (typeof expression === 'string') { this.parseEvent(propName, expression, sourceSpan, [], targetEventAsts); } else { this._reportError(`Value of the host listener "${propName}" needs to be a string representing an expression but got "${expression}" (${typeof expression})`, sourceSpan); } }); return targetEventAsts; } return null; } /** * @param {?} value * @param {?} sourceSpan * @return {?} */ parseInterpolation(value, sourceSpan) { const /** @type {?} */ sourceInfo = sourceSpan.start.toString(); try { const /** @type {?} */ ast = /** @type {?} */ ((this._exprParser.parseInterpolation(value, sourceInfo, this._interpolationConfig))); if (ast) this._reportExpressionParserErrors(ast.errors, sourceSpan); this._checkPipes(ast, sourceSpan); return ast; } catch (/** @type {?} */ e) { this._reportError(`${e}`, sourceSpan); return this._exprParser.wrapLiteralPrimitive('ERROR', sourceInfo); } } /** * @param {?} prefixToken * @param {?} value * @param {?} sourceSpan * @param {?} targetMatchableAttrs * @param {?} targetProps * @param {?} targetVars * @return {?} */ parseInlineTemplateBinding(prefixToken, value, sourceSpan, targetMatchableAttrs, targetProps, targetVars) { const /** @type {?} */ bindings = this._parseTemplateBindings(prefixToken, value, sourceSpan); for (let /** @type {?} */ i = 0; i < bindings.length; i++) { const /** @type {?} */ binding = bindings[i]; if (binding.keyIsVar) { targetVars.push(new VariableAst(binding.key, binding.name, sourceSpan)); } else if (binding.expression) { this._parsePropertyAst(binding.key, binding.expression, sourceSpan, targetMatchableAttrs, targetProps); } else { targetMatchableAttrs.push([binding.key, '']); this.parseLiteralAttr(binding.key, null, sourceSpan, targetMatchableAttrs, targetProps); } } } /** * @param {?} prefixToken * @param {?} value * @param {?} sourceSpan * @return {?} */ _parseTemplateBindings(prefixToken, value, sourceSpan) { const /** @type {?} */ sourceInfo = sourceSpan.start.toString(); try { const /** @type {?} */ bindingsResult = this._exprParser.parseTemplateBindings(prefixToken, value, sourceInfo); this._reportExpressionParserErrors(bindingsResult.errors, sourceSpan); bindingsResult.templateBindings.forEach((binding) => { if (binding.expression) { this._checkPipes(binding.expression, sourceSpan); } }); bindingsResult.warnings.forEach((warning) => { this._reportError(warning, sourceSpan, ParseErrorLevel.WARNING); }); return bindingsResult.templateBindings; } catch (/** @type {?} */ e) { this._reportError(`${e}`, sourceSpan); return []; } } /** * @param {?} name * @param {?} value * @param {?} sourceSpan * @param {?} targetMatchableAttrs * @param {?} targetProps * @return {?} */ parseLiteralAttr(name, value, sourceSpan, targetMatchableAttrs, targetProps) { if (_isAnimationLabel(name)) { name = name.substring(1); if (value) { this._reportError(`Assigning animation triggers via @prop="exp" attributes with an expression is invalid.` + ` Use property bindings (e.g. [@prop]="exp") or use an attribute without a value (e.g. @prop) instead.`, sourceSpan, ParseErrorLevel.ERROR); } this._parseAnimation(name, value, sourceSpan, targetMatchableAttrs, targetProps); } else { targetProps.push(new BoundProperty(name, this._exprParser.wrapLiteralPrimitive(value, ''), BoundPropertyType.LITERAL_ATTR, sourceSpan)); } } /** * @param {?} name * @param {?} expression * @param {?} isHost * @param {?} sourceSpan * @param {?} targetMatchableAttrs * @param {?} targetProps * @return {?} */ parsePropertyBinding(name, expression, isHost, sourceSpan, targetMatchableAttrs, targetProps) { let /** @type {?} */ isAnimationProp = false; if (name.startsWith(ANIMATE_PROP_PREFIX)) { isAnimationProp = true; name = name.substring(ANIMATE_PROP_PREFIX.length); } else if (_isAnimationLabel(name)) { isAnimationProp = true; name = name.substring(1); } if (isAnimationProp) { this._parseAnimation(name, expression, sourceSpan, targetMatchableAttrs, targetProps); } else { this._parsePropertyAst(name, this._parseBinding(expression, isHost, sourceSpan), sourceSpan, targetMatchableAttrs, targetProps); } } /** * @param {?} name * @param {?} value * @param {?} sourceSpan * @param {?} targetMatchableAttrs * @param {?} targetProps * @return {?} */ parsePropertyInterpolation(name, value, sourceSpan, targetMatchableAttrs, targetProps) { const /** @type {?} */ expr = this.parseInterpolation(value, sourceSpan); if (expr) { this._parsePropertyAst(name, expr, sourceSpan, targetMatchableAttrs, targetProps); return true; } return false; } /** * @param {?} name * @param {?} ast * @param {?} sourceSpan * @param {?} targetMatchableAttrs * @param {?} targetProps * @return {?} */ _parsePropertyAst(name, ast, sourceSpan, targetMatchableAttrs, targetProps) { targetMatchableAttrs.push([name, /** @type {?} */ ((ast.source))]); targetProps.push(new BoundProperty(name, ast, BoundPropertyType.DEFAULT, sourceSpan)); } /** * @param {?} name * @param {?} expression * @param {?} sourceSpan * @param {?} targetMatchableAttrs * @param {?} targetProps * @return {?} */ _parseAnimation(name, expression, sourceSpan, targetMatchableAttrs, targetProps) { // This will occur when a @trigger is not paired with an expression. // For animations it is valid to not have an expression since */void // states will be applied by angular when the element is attached/detached const /** @type {?} */ ast = this._parseBinding(expression || 'undefined', false, sourceSpan); targetMatchableAttrs.push([name, /** @type {?} */ ((ast.source))]); targetProps.push(new BoundProperty(name, ast, BoundPropertyType.ANIMATION, sourceSpan)); } /** * @param {?} value * @param {?} isHostBinding * @param {?} sourceSpan * @return {?} */ _parseBinding(value, isHostBinding, sourceSpan) { const /** @type {?} */ sourceInfo = sourceSpan.start.toString(); try { const /** @type {?} */ ast = isHostBinding ? this._exprParser.parseSimpleBinding(value, sourceInfo, this._interpolationConfig) : this._exprParser.parseBinding(value, sourceInfo, this._interpolationConfig); if (ast) this._reportExpressionParserErrors(ast.errors, sourceSpan); this._checkPipes(ast, sourceSpan); return ast; } catch (/** @type {?} */ e) { this._reportError(`${e}`, sourceSpan); return this._exprParser.wrapLiteralPrimitive('ERROR', sourceInfo); } } /** * @param {?} elementSelector * @param {?} boundProp * @return {?} */ createElementPropertyAst(elementSelector, boundProp) { if (boundProp.isAnimation) { return new BoundElementPropertyAst(boundProp.name, PropertyBindingType.Animation, SecurityContext.NONE, boundProp.expression, null, boundProp.sourceSpan); } let /** @type {?} */ unit = null; let /** @type {?} */ bindingType = /** @type {?} */ ((undefined)); let /** @type {?} */ boundPropertyName = null; const /** @type {?} */ parts = boundProp.name.split(PROPERTY_PARTS_SEPARATOR); let /** @type {?} */ securityContexts = /** @type {?} */ ((undefined)); // Check check for special cases (prefix style, attr, class) if (parts.length > 1) { if (parts[0] == ATTRIBUTE_PREFIX) { boundPropertyName = parts[1]; this._validatePropertyOrAttributeName(boundPropertyName, boundProp.sourceSpan, true); securityContexts = calcPossibleSecurityContexts(this._schemaRegistry, elementSelector, boundPropertyName, true); const /** @type {?} */ nsSeparatorIdx = boundPropertyName.indexOf(':'); if (nsSeparatorIdx > -1) { const /** @type {?} */ ns = boundPropertyName.substring(0, nsSeparatorIdx); const /** @type {?} */ name = boundPropertyName.substring(nsSeparatorIdx + 1); boundPropertyName = mergeNsAndName(ns, name); } bindingType = PropertyBindingType.Attribute; } else if (parts[0] == CLASS_PREFIX) { boundPropertyName = parts[1]; bindingType = PropertyBindingType.Class; securityContexts = [SecurityContext.NONE]; } else if (parts[0] == STYLE_PREFIX) { unit = parts.length > 2 ? parts[2] : null; boundPropertyName = parts[1]; bindingType = PropertyBindingType.Style; securityContexts = [SecurityContext.STYLE]; } } // If not a special case, use the full property name if (boundPropertyName === null) { boundPropertyName = this._schemaRegistry.getMappedPropName(boundProp.name); securityContexts = calcPossibleSecurityContexts(this._schemaRegistry, elementSelector, boundPropertyName, false); bindingType = PropertyBindingType.Property; this._validatePropertyOrAttributeName(boundPropertyName, boundProp.sourceSpan, false); } return new BoundElementPropertyAst(boundPropertyName, bindingType, securityContexts[0], boundProp.expression, unit, boundProp.sourceSpan); } /** * @param {?} name * @param {?} expression * @param {?} sourceSpan * @param {?} targetMatchableAttrs * @param {?} targetEvents * @return {?} */ parseEvent(name, expression, sourceSpan, targetMatchableAttrs, targetEvents) { if (_isAnimationLabel(name)) { name = name.substr(1); this._parseAnimationEvent(name, expression, sourceSpan, targetEvents); } else { this._parseEvent(name, expression, sourceSpan, targetMatchableAttrs, targetEvents); } } /** * @param {?} name * @param {?} expression * @param {?} sourceSpan * @param {?} targetEvents * @return {?} */ _parseAnimationEvent(name, expression, sourceSpan, targetEvents) { const /** @type {?} */ matches = splitAtPeriod(name, [name, '']); const /** @type {?} */ eventName = matches[0]; const /** @type {?} */ phase = matches[1].toLowerCase(); if (phase) { switch (phase) { case 'start': case 'done': const /** @type {?} */ ast = this._parseAction(expression, sourceSpan); targetEvents.push(new BoundEventAst(eventName, null, phase, ast, sourceSpan)); break; default: this._reportError(`The provided animation output phase value "${phase}" for "@${eventName}" is not supported (use start or done)`, sourceSpan); break; } } else { this._reportError(`The animation trigger output event (@${eventName}) is missing its phase value name (start or done are currently supported)`, sourceSpan); } } /** * @param {?} name * @param {?} expression * @param {?} sourceSpan * @param {?} targetMatchableAttrs * @param {?} targetEvents * @return {?} */ _parseEvent(name, expression, sourceSpan, targetMatchableAttrs, targetEvents) { // long format: 'target: eventName' const [target, eventName] = splitAtColon(name, [/** @type {?} */ ((null)), name]); const /** @type {?} */ ast = this._parseAction(expression, sourceSpan); targetMatchableAttrs.push([/** @type {?} */ ((name)), /** @type {?} */ ((ast.source))]); targetEvents.push(new BoundEventAst(eventName, target, null, ast, sourceSpan)); // Don't detect directives for event names for now, // so don't add the event name to the matchableAttrs } /** * @param {?} value * @param {?} sourceSpan * @return {?} */ _parseAction(value, sourceSpan) { const /** @type {?} */ sourceInfo = sourceSpan.start.toString(); try { const /** @type {?} */ ast = this._exprParser.parseAction(value, sourceInfo, this._interpolationConfig); if (ast) { this._reportExpressionParserErrors(ast.errors, sourceSpan); } if (!ast || ast.ast instanceof EmptyExpr) { this._reportError(`Empty expressions are not allowed`, sourceSpan); return this._exprParser.wrapLiteralPrimitive('ERROR', sourceInfo); } this._checkPipes(ast, sourceSpan); return ast; } catch (/** @type {?} */ e) { this._reportError(`${e}`, sourceSpan); return this._exprParser.wrapLiteralPrimitive('ERROR', sourceInfo); } } /** * @param {?} message * @param {?} sourceSpan * @param {?=} level * @return {?} */ _reportError(message, sourceSpan, level = ParseErrorLevel.ERROR) { this._targetErrors.push(new ParseError(sourceSpan, message, level)); } /** * @param {?} errors * @param {?} sourceSpan * @return {?} */ _reportExpressionParserErrors(errors, sourceSpan) { for (const /** @type {?} */ error of errors) { this._reportError(error.message, sourceSpan); } } /** * @param {?} ast * @param {?} sourceSpan * @return {?} */ _checkPipes(ast, sourceSpan) { if (ast) { const /** @type {?} */ collector = new PipeCollector(); ast.visit(collector); collector.pipes.forEach((ast, pipeName) => { const /** @type {?} */ pipeMeta = this.pipesByName.get(pipeName); if (!pipeMeta) { this._reportError(`The pipe '${pipeName}' could not be found`, new ParseSourceSpan(sourceSpan.start.moveBy(ast.span.start), sourceSpan.start.moveBy(ast.span.end))); } else { this._usedPipes.set(pipeName, pipeMeta); } }); } } /** * @param {?} propName the name of the property / attribute * @param {?} sourceSpan * @param {?} isAttr true when binding to an attribute * @return {?} */ _validatePropertyOrAttributeName(propName, sourceSpan, isAttr) { const /** @type {?} */ report = isAttr ? this._schemaRegistry.validateAttribute(propName) : this._schemaRegistry.validateProperty(propName); if (report.error) { this._reportError(/** @type {?} */ ((report.msg)), sourceSpan, ParseErrorLevel.ERROR); } } } class PipeCollector extends RecursiveAstVisitor { constructor() { super(...arguments); this.pipes = new Map(); } /** * @param {?} ast * @param {?} context * @return {?} */ visitPipe(ast, context) { this.pipes.set(ast.name, ast); ast.exp.visit(this); this.visitAll(ast.args, context); return null; } } /** * @param {?} name * @return {?} */ function _isAnimationLabel(name) { return name[0] == '@'; } /** * @param {?} registry * @param {?} selector * @param {?} propName * @param {?} isAttribute * @return {?} */ function calcPossibleSecurityContexts(registry, selector, propName, isAttribute) { const /** @type {?} */ ctxs = []; CssSelector.parse(selector).forEach((selector) => { const /** @type {?} */ elementNames = selector.element ? [selector.element] : registry.allKnownElementNames(); const /** @type {?} */ notElementNames = new Set(selector.notSelectors.filter(selector => selector.isElementSelector()) .map((selector) => selector.element)); const /** @type {?} */ possibleElementNames = elementNames.filter(elementName => !notElementNames.has(elementName)); ctxs.push(...possibleElementNames.map(elementName => registry.securityContext(elementName, propName, isAttribute))); }); return ctxs.length === 0 ? [SecurityContext.NONE] : Array.from(new Set(ctxs)).sort(); } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ const BIND_NAME_REGEXP = /^(?:(?:(?:(bind-)|(let-)|(ref-|#)|(on-)|(bindon-)|(@))(.+))|\[\(([^\)]+)\)\]|\[([^\]]+)\]|\(([^\)]+)\))$/; // Group 1 = "bind-" const KW_BIND_IDX = 1; // Group 2 = "let-" const KW_LET_IDX = 2; // Group 3 = "ref-/#" const KW_REF_IDX = 3; // Group 4 = "on-" const KW_ON_IDX = 4; // Group 5 = "bindon-" const KW_BINDON_IDX = 5; // Group 6 = "@" const KW_AT_IDX = 6; // Group 7 = the identifier after "bind-", "let-", "ref-/#", "on-", "bindon-" or "@" const IDENT_KW_IDX = 7; // Group 8 = identifier inside [()] const IDENT_BANANA_BOX_IDX = 8; // Group 9 = identifier inside [] const IDENT_PROPERTY_IDX = 9; // Group 10 = identifier inside () const IDENT_EVENT_IDX = 10; // deprecated in 4.x const TEMPLATE_ELEMENT = 'template'; // deprecated in 4.x const TEMPLATE_ATTR = 'template'; const TEMPLATE_ATTR_PREFIX = '*'; const CLASS_ATTR = 'class'; const TEXT_CSS_SELECTOR = CssSelector.parse('*')[0]; const TEMPLATE_ELEMENT_DEPRECATION_WARNING = 'The <template> element is deprecated. Use <ng-template> instead'; const TEMPLATE_ATTR_DEPRECATION_WARNING = 'The template attribute is deprecated. Use an ng-template element instead.'; let warningCounts = {}; /** * @param {?} warnings * @return {?} */ function warnOnlyOnce(warnings) { return (error) => { if (warnings.indexOf(error.msg) !== -1) { warningCounts[error.msg] = (warningCounts[error.msg] || 0) + 1; return warningCounts[error.msg] <= 1; } return true; }; } class TemplateParseError extends ParseError { /** * @param {?} message * @param {?} span * @param {?} level */ constructor(message, span, level) { super(span, message, level); } } class TemplateParseResult { /** * @param {?=} templateAst * @param {?=} usedPipes * @param {?=} errors */ constructor(templateAst, usedPipes, errors) { this.templateAst = templateAst; this.usedPipes = usedPipes; this.errors = errors; } } class TemplateParser { /** * @param {?} _config * @param {?} _reflector * @param {?} _exprParser * @param {?} _schemaRegistry * @param {?} _htmlParser * @param {?} _console * @param {?} transforms */ constructor(_config, _reflector, _exprParser, _schemaRegistry, _htmlParser, _console, transforms) { this._config = _config; this._reflector = _reflector; this._exprParser = _exprParser; this._schemaRegistry = _schemaRegistry; this._htmlParser = _htmlParser; this._console = _console; this.transforms = transforms; } /** * @param {?} component * @param {?} template * @param {?} directives * @param {?} pipes * @param {?} schemas * @param {?} templateUrl * @param {?} preserveWhitespaces * @return {?} */ parse(component, template, directives, pipes, schemas, templateUrl, preserveWhitespaces) { const /** @type {?} */ result = this.tryParse(component, template, directives, pipes, schemas, templateUrl, preserveWhitespaces); const /** @type {?} */ warnings = /** @type {?} */ ((result.errors)).filter(error => error.level === ParseErrorLevel.WARNING).filter(warnOnlyOnce([TEMPLATE_ATTR_DEPRECATION_WARNING, TEMPLATE_ELEMENT_DEPRECATION_WARNING])); const /** @type {?} */ errors = /** @type {?} */ ((result.errors)).filter(error => error.level === ParseErrorLevel.ERROR); if (warnings.length > 0) { this._console.warn(`Template parse warnings:\n${warnings.join('\n')}`); } if (errors.length > 0) { const /** @type {?} */ errorString = errors.join('\n'); throw syntaxError(`Template parse errors:\n${errorString}`, errors); } return { template: /** @type {?} */ ((result.templateAst)), pipes: /** @type {?} */ ((result.usedPipes)) }; } /** * @param {?} component * @param {?} template * @param {?} directives * @param {?} pipes * @param {?} schemas * @param {?} templateUrl * @param {?} preserveWhitespaces * @return {?} */ tryParse(component, template, directives, pipes, schemas, templateUrl, preserveWhitespaces) { let /** @type {?} */ htmlParseResult = typeof template === 'string' ? /** @type {?} */ ((this._htmlParser)).parse(template, templateUrl, true, this.getInterpolationConfig(component)) : template; if (!preserveWhitespaces) { htmlParseResult = removeWhitespaces(htmlParseResult); } return this.tryParseHtml(this.expandHtml(htmlParseResult), component, directives, pipes, schemas); } /** * @param {?} htmlAstWithErrors * @param {?} component * @param {?} directives * @param {?} pipes * @param {?} schemas * @return {?} */ tryParseHtml(htmlAstWithErrors, component, directives, pipes, schemas) { let /** @type {?} */ result; const /** @type {?} */ errors = htmlAstWithErrors.errors; const /** @type {?} */ usedPipes = []; if (htmlAstWithErrors.rootNodes.length > 0) { const /** @type {?} */ uniqDirectives = removeSummaryDuplicates(directives); const /** @type {?} */ uniqPipes = removeSummaryDuplicates(pipes); const /** @type {?} */ providerViewContext = new ProviderViewContext(this._reflector, component); let /** @type {?} */ interpolationConfig = /** @type {?} */ ((undefined)); if (component.template && component.template.interpolation) { interpolationConfig = { start: component.template.interpolation[0], end: component.template.interpolation[1] }; } const /** @type {?} */ bindingParser = new BindingParser(this._exprParser, /** @type {?} */ ((interpolationConfig)), this._schemaRegistry, uniqPipes, errors); const /** @type {?} */ parseVisitor = new TemplateParseVisitor(this._reflector, this._config, providerViewContext, uniqDirectives, bindingParser, this._schemaRegistry, schemas, errors); result = visitAll(parseVisitor, htmlAstWithErrors.rootNodes, EMPTY_ELEMENT_CONTEXT); errors.push(...providerViewContext.errors); usedPipes.push(...bindingParser.getUsedPipes()); } else { result = []; } this._assertNoReferenceDuplicationOnTemplate(result, errors); if (errors.length > 0) { return new TemplateParseResult(result, usedPipes, errors); } if (this.transforms) { this.transforms.forEach((transform) => { result = templateVisitAll(transform, result); }); } return new TemplateParseResult(result, usedPipes, errors); } /** * @param {?} htmlAstWithErrors * @param {?=} forced * @return {?} */ expandHtml(htmlAstWithErrors, forced = false) { const /** @type {?} */ errors = htmlAstWithErrors.errors; if (errors.length == 0 || forced) { // Transform ICU messages to angular directives const /** @type {?} */ expandedHtmlAst = expandNodes(htmlAstWithErrors.rootNodes); errors.push(...expandedHtmlAst.errors); htmlAstWithErrors = new ParseTreeResult(expandedHtmlAst.nodes, errors); } return htmlAstWithErrors; } /** * @param {?} component * @return {?} */ getInterpolationConfig(component) { if (component.template) { return InterpolationConfig.fromArray(component.template.interpolation); } return undefined; } /** * \@internal * @param {?} result * @param {?} errors * @return {?} */ _assertNoReferenceDuplicationOnTemplate(result, errors) { const /** @type {?} */ existingReferences = []; result.filter(element => !!(/** @type {?} */ (element)).references) .forEach(element => (/** @type {?} */ (element)).references.forEach((reference) => { const /** @type {?} */ name = reference.name; if (existingReferences.indexOf(name) < 0) { existingReferences.push(name); } else { const /** @type {?} */ error = new TemplateParseError(`Reference "#${name}" is defined several times`, reference.sourceSpan, ParseErrorLevel.ERROR); errors.push(error); } })); } } class TemplateParseVisitor { /** * @param {?} reflector * @param {?} config * @param {?} providerViewContext * @param {?} directives * @param {?} _bindingParser * @param {?} _schemaRegistry * @param {?} _schemas * @param {?} _targetErrors */ constructor(reflector, config, providerViewContext, directives, _bindingParser, _schemaRegistry, _schemas, _targetErrors) { this.reflector = reflector; this.config = config; this.providerViewContext = providerViewContext; this._bindingParser = _bindingParser; this._schemaRegistry = _schemaRegistry; this._schemas = _schemas; this._targetErrors = _targetErrors; this.selectorMatcher = new SelectorMatcher(); this.directivesIndex = new Map(); this.ngContentCount = 0; // Note: queries start with id 1 so we can use the number in a Bloom filter! this.contentQueryStartId = providerViewContext.component.viewQueries.length + 1; directives.forEach((directive, index) => { const /** @type {?} */ selector = CssSelector.parse(/** @type {?} */ ((directive.selector))); this.selectorMatcher.addSelectables(selector, directive); this.directivesIndex.set(directive, index); }); } /** * @param {?} expansion * @param {?} context * @return {?} */ visitExpansion(expansion, context) { return null; } /** * @param {?} expansionCase * @param {?} context * @return {?} */ visitExpansionCase(expansionCase, context) { return null; } /** * @param {?} text * @param {?} parent * @return {?} */ visitText(text, parent) { const /** @type {?} */ ngContentIndex = /** @type {?} */ ((parent.findNgContentIndex(TEXT_CSS_SELECTOR))); const /** @type {?} */ valueNoNgsp = replaceNgsp(text.value); const /** @type {?} */ expr = this._bindingParser.parseInterpolation(valueNoNgsp, /** @type {?} */ ((text.sourceSpan))); return expr ? new BoundTextAst(expr, ngContentIndex, /** @type {?} */ ((text.sourceSpan))) : new TextAst(valueNoNgsp, ngContentIndex, /** @type {?} */ ((text.sourceSpan))); } /** * @param {?} attribute * @param {?} context * @return {?} */ visitAttribute(attribute, context) { return new AttrAst(attribute.name, attribute.value, attribute.sourceSpan); } /** * @param {?} comment * @param {?} context * @return {?} */ visitComment(comment, context) { return null; } /** * @param {?} element * @param {?} parent * @return {?} */ visitElement(element, parent) { const /** @type {?} */ queryStartIndex = this.contentQueryStartId; const /** @type {?} */ nodeName = element.name; const /** @type {?} */ preparsedElement = preparseElement(element); if (preparsedElement.type === PreparsedElementType.SCRIPT || preparsedElement.type === PreparsedElementType.STYLE) { // Skipping <script> for security reasons // Skipping <style> as we already processed them // in the StyleCompiler return null; } if (preparsedElement.type === PreparsedElementType.STYLESHEET && isStyleUrlResolvable(preparsedElement.hrefAttr)) { // Skipping stylesheets with either relative urls or package scheme as we already processed // them in the StyleCompiler return null; } const /** @type {?} */ matchableAttrs = []; const /** @type {?} */ elementOrDirectiveProps = []; const /** @type {?} */ elementOrDirectiveRefs = []; const /** @type {?} */ elementVars = []; const /** @type {?} */ events = []; const /** @type {?} */ templateElementOrDirectiveProps = []; const /** @type {?} */ templateMatchableAttrs = []; const /** @type {?} */ templateElementVars = []; let /** @type {?} */ hasInlineTemplates = false; const /** @type {?} */ attrs = []; const /** @type {?} */ isTemplateElement = isTemplate(element, this.config.enableLegacyTemplate, (m, span) => this._reportError(m, span, ParseErrorLevel.WARNING)); element.attrs.forEach(attr => { const /** @type {?} */ hasBinding = this._parseAttr(isTemplateElement, attr, matchableAttrs, elementOrDirectiveProps, events, elementOrDirectiveRefs, elementVars); let /** @type {?} */ templateBindingsSource; let /** @type {?} */ prefixToken; let /** @type {?} */ normalizedName = this._normalizeAttributeName(attr.name); if (this.config.enableLegacyTemplate && normalizedName == TEMPLATE_ATTR) { this._reportError(TEMPLATE_ATTR_DEPRECATION_WARNING, attr.sourceSpan, ParseErrorLevel.WARNING); templateBindingsSource = attr.value; } else if (normalizedName.startsWith(TEMPLATE_ATTR_PREFIX)) { templateBindingsSource = attr.value; prefixToken = normalizedName.substring(TEMPLATE_ATTR_PREFIX.length) + ':'; } const /** @type {?} */ hasTemplateBinding = templateBindingsSource != null; if (hasTemplateBinding) { if (hasInlineTemplates) { this._reportError(`Can't have multiple template bindings on one element. Use only one attribute named 'template' or prefixed with *`, attr.sourceSpan); } hasInlineTemplates = true; this._bindingParser.parseInlineTemplateBinding(/** @type {?} */ ((prefixToken)), /** @type {?} */ ((templateBindingsSource)), attr.sourceSpan, templateMatchableAttrs, templateElementOrDirectiveProps, templateElementVars); } if (!hasBinding && !hasTemplateBinding) { // don't include the bindings as attributes as well in the AST attrs.push(this.visitAttribute(attr, null)); matchableAttrs.push([attr.name, attr.value]); } }); const /** @type {?} */ elementCssSelector = createElementCssSelector(nodeName, matchableAttrs); const { directives: directiveMetas, matchElement } = this._parseDirectives(this.selectorMatcher, elementCssSelector); const /** @type {?} */ references = []; const /** @type {?} */ boundDirectivePropNames = new Set(); const /** @type {?} */ directiveAsts = this._createDirectiveAsts(isTemplateElement, element.name, directiveMetas, elementOrDirectiveProps, elementOrDirectiveRefs, /** @type {?} */ ((element.sourceSpan)), references, boundDirectivePropNames); const /** @type {?} */ elementProps = this._createElementPropertyAsts(element.name, elementOrDirectiveProps, boundDirectivePropNames); const /** @type {?} */ isViewRoot = parent.isTemplateElement || hasInlineTemplates; const /** @type {?} */ providerContext = new ProviderElementContext(this.providerViewContext, /** @type {?} */ ((parent.providerContext)), isViewRoot, directiveAsts, attrs, references, isTemplateElement, queryStartIndex, /** @type {?} */ ((element.sourceSpan))); const /** @type {?} */ children = visitAll(preparsedElement.nonBindable ? NON_BINDABLE_VISITOR : this, element.children, ElementContext.create(isTemplateElement, directiveAsts, isTemplateElement ? /** @type {?} */ ((parent.providerContext)) : providerContext)); providerContext.afterElement(); // Override the actual selector when the `ngProjectAs` attribute is provided const /** @type {?} */ projectionSelector = preparsedElement.projectAs != null ? CssSelector.parse(preparsedElement.projectAs)[0] : elementCssSelector; const /** @type {?} */ ngContentIndex = /** @type {?} */ ((parent.findNgContentIndex(projectionSelector))); let /** @type {?} */ parsedElement; if (preparsedElement.type === PreparsedElementType.NG_CONTENT) { if (element.children && !element.children.every(_isEmptyTextNode)) { this._reportError(`<ng-content> element cannot have content.`, /** @type {?} */ ((element.sourceSpan))); } parsedElement = new NgContentAst(this.ngContentCount++, hasInlineTemplates ? /** @type {?} */ ((null)) : ngContentIndex, /** @type {?} */ ((element.sourceSpan))); } else if (isTemplateElement) { this._assertAllEventsPublishedByDirectives(directiveAsts, events); this._assertNoComponentsNorElementBindingsOnTemplate(directiveAsts, elementProps, /** @type {?} */ ((element.sourceSpan))); parsedElement = new EmbeddedTemplateAst(attrs, events, references, elementVars, providerContext.transformedDirectiveAsts, providerContext.transformProviders, providerContext.transformedHasViewContainer, providerContext.queryMatches, children, hasInlineTemplates ? /** @type {?} */ ((null)) : ngContentIndex, /** @type {?} */ ((element.sourceSpan))); } else { this._assertElementExists(matchElement, element); this._assertOnlyOneComponent(directiveAsts, /** @type {?} */ ((element.sourceSpan))); const /** @type {?} */ ngContentIndex = hasInlineTemplates ? null : parent.findNgContentIndex(projectionSelector); parsedElement = new ElementAst(nodeName, attrs, elementProps, events, references, providerContext.transformedDirectiveAsts, providerContext.transformProviders, providerContext.transformedHasViewContainer, providerContext.queryMatches, children, hasInlineTemplates ? null : ngContentIndex, element.sourceSpan, element.endSourceSpan || null); } if (hasInlineTemplates) { const /** @type {?} */ templateQueryStartIndex = this.contentQueryStartId; const /** @type {?} */ templateSelector = createElementCssSelector(TEMPLATE_ELEMENT, templateMatchableAttrs); const { directives: templateDirectiveMetas } = this._parseDirectives(this.selectorMatcher, templateSelector); const /** @type {?} */ templateBoundDirectivePropNames = new Set(); const /** @type {?} */ templateDirectiveAsts = this._createDirectiveAsts(true, element.name, templateDirectiveMetas, templateElementOrDirectiveProps, [], /** @type {?} */ ((element.sourceSpan)), [], templateBoundDirectivePropNames); const /** @type {?} */ templateElementProps = this._createElementPropertyAsts(element.name, templateElementOrDirectiveProps, templateBoundDirectivePropNames); this._assertNoComponentsNorElementBindingsOnTemplate(templateDirectiveAsts, templateElementProps, /** @type {?} */ ((element.sourceSpan))); const /** @type {?} */ templateProviderContext = new ProviderElementContext(this.providerViewContext, /** @type {?} */ ((parent.providerContext)), parent.isTemplateElement, templateDirectiveAsts, [], [], true, templateQueryStartIndex, /** @type {?} */ ((element.sourceSpan))); templateProviderContext.afterElement(); parsedElement = new EmbeddedTemplateAst([], [], [], templateElementVars, templateProviderContext.transformedDirectiveAsts, templateProviderContext.transformProviders, templateProviderContext.transformedHasViewContainer, templateProviderContext.queryMatches, [parsedElement], ngContentIndex, /** @type {?} */ ((element.sourceSpan))); } return parsedElement; } /** * @param {?} isTemplateElement * @param {?} attr * @param {?} targetMatchableAttrs * @param {?} targetProps * @param {?} targetEvents * @param {?} targetRefs * @param {?} targetVars * @return {?} */ _parseAttr(isTemplateElement, attr, targetMatchableAttrs, targetProps, targetEvents, targetRefs, targetVars) { const /** @type {?} */ name = this._normalizeAttributeName(attr.name); const /** @type {?} */ value = attr.value; const /** @type {?} */ srcSpan = attr.sourceSpan; const /** @type {?} */ bindParts = name.match(BIND_NAME_REGEXP); let /** @type {?} */ hasBinding = false; if (bindParts !== null) { hasBinding = true; if (bindParts[KW_BIND_IDX] != null) { this._bindingParser.parsePropertyBinding(bindParts[IDENT_KW_IDX], value, false, srcSpan, targetMatchableAttrs, targetProps); } else if (bindParts[KW_LET_IDX]) { if (isTemplateElement) { const /** @type {?} */ identifier = bindParts[IDENT_KW_IDX]; this._parseVariable(identifier, value, srcSpan, targetVars); } else { this._reportError(`"let-" is only supported on ng-template elements.`, srcSpan); } } else if (bindParts[KW_REF_IDX]) { const /** @type {?} */ identifier = bindParts[IDENT_KW_IDX]; this._parseReference(identifier, value, srcSpan, targetRefs); } else if (bindParts[KW_ON_IDX]) { this._bindingParser.parseEvent(bindParts[IDENT_KW_IDX], value, srcSpan, targetMatchableAttrs, targetEvents); } else if (bindParts[KW_BINDON_IDX]) { this._bindingParser.parsePropertyBinding(bindParts[IDENT_KW_IDX], value, false, srcSpan, targetMatchableAttrs, targetProps); this._parseAssignmentEvent(bindParts[IDENT_KW_IDX], value, srcSpan, targetMatchableAttrs, targetEvents); } else if (bindParts[KW_AT_IDX]) { this._bindingParser.parseLiteralAttr(name, value, srcSpan, targetMatchableAttrs, targetProps); } else if (bindParts[IDENT_BANANA_BOX_IDX]) { this._bindingParser.parsePropertyBinding(bindParts[IDENT_BANANA_BOX_IDX], value, false, srcSpan, targetMatchableAttrs, targetProps); this._parseAssignmentEvent(bindParts[IDENT_BANANA_BOX_IDX], value, srcSpan, targetMatchableAttrs, targetEvents); } else if (bindParts[IDENT_PROPERTY_IDX]) { this._bindingParser.parsePropertyBinding(bindParts[IDENT_PROPERTY_IDX], value, false, srcSpan, targetMatchableAttrs, targetProps); } else if (bindParts[IDENT_EVENT_IDX]) { this._bindingParser.parseEvent(bindParts[IDENT_EVENT_IDX], value, srcSpan, targetMatchableAttrs, targetEvents); } } else { hasBinding = this._bindingParser.parsePropertyInterpolation(name, value, srcSpan, targetMatchableAttrs, targetProps); } if (!hasBinding) { this._bindingParser.parseLiteralAttr(name, value, srcSpan, targetMatchableAttrs, targetProps); } return hasBinding; } /** * @param {?} attrName * @return {?} */ _normalizeAttributeName(attrName) { return /^data-/i.test(attrName) ? attrName.substring(5) : attrName; } /** * @param {?} identifier * @param {?} value * @param {?} sourceSpan * @param {?} targetVars * @return {?} */ _parseVariable(identifier, value, sourceSpan, targetVars) { if (identifier.indexOf('-') > -1) { this._reportError(`"-" is not allowed in variable names`, sourceSpan); } targetVars.push(new VariableAst(identifier, value, sourceSpan)); } /** * @param {?} identifier * @param {?} value * @param {?} sourceSpan * @param {?} targetRefs * @return {?} */ _parseReference(identifier, value, sourceSpan, targetRefs) { if (identifier.indexOf('-') > -1) { this._reportError(`"-" is not allowed in reference names`, sourceSpan); } targetRefs.push(new ElementOrDirectiveRef(identifier, value, sourceSpan)); } /** * @param {?} name * @param {?} expression * @param {?} sourceSpan * @param {?} targetMatchableAttrs * @param {?} targetEvents * @return {?} */ _parseAssignmentEvent(name, expression, sourceSpan, targetMatchableAttrs, targetEvents) { this._bindingParser.parseEvent(`${name}Change`, `${expression}=$event`, sourceSpan, targetMatchableAttrs, targetEvents); } /** * @param {?} selectorMatcher * @param {?} elementCssSelector * @return {?} */ _parseDirectives(selectorMatcher, elementCssSelector) { // Need to sort the directives so that we get consistent results throughout, // as selectorMatcher uses Maps inside. // Also deduplicate directives as they might match more than one time! const /** @type {?} */ directives = new Array(this.directivesIndex.size); // Whether any directive selector matches on the element name let /** @type {?} */ matchElement = false; selectorMatcher.match(elementCssSelector, (selector, directive) => { directives[/** @type {?} */ ((this.directivesIndex.get(directive)))] = directive; matchElement = matchElement || selector.hasElementSelector(); }); return { directives: directives.filter(dir => !!dir), matchElement, }; } /** * @param {?} isTemplateElement * @param {?} elementName * @param {?} directives * @param {?} props * @param {?} elementOrDirectiveRefs * @param {?} elementSourceSpan * @param {?} targetReferences * @param {?} targetBoundDirectivePropNames * @return {?} */ _createDirectiveAsts(isTemplateElement, elementName, directives, props, elementOrDirectiveRefs, elementSourceSpan, targetReferences, targetBoundDirectivePropNames) { const /** @type {?} */ matchedReferences = new Set(); let /** @type {?} */ component = /** @type {?} */ ((null)); const /** @type {?} */ directiveAsts = directives.map((directive) => { const /** @type {?} */ sourceSpan = new ParseSourceSpan(elementSourceSpan.start, elementSourceSpan.end, `Directive ${identifierName(directive.type)}`); if (directive.isComponent) { component = directive; } const /** @type {?} */ directiveProperties = []; let /** @type {?} */ hostProperties = /** @type {?} */ ((this._bindingParser.createDirectiveHostPropertyAsts(directive, elementName, sourceSpan))); // Note: We need to check the host properties here as well, // as we don't know the element name in the DirectiveWrapperCompiler yet. hostProperties = this._checkPropertiesInSchema(elementName, hostProperties); const /** @type {?} */ hostEvents = /** @type {?} */ ((this._bindingParser.createDirectiveHostEventAsts(directive, sourceSpan))); this._createDirectivePropertyAsts(directive.inputs, props, directiveProperties, targetBoundDirectivePropNames); elementOrDirectiveRefs.forEach((elOrDirRef) => { if ((elOrDirRef.value.length === 0 && directive.isComponent) || (elOrDirRef.isReferenceToDirective(directive))) { targetReferences.push(new ReferenceAst(elOrDirRef.name, createTokenForReference(directive.type.reference), elOrDirRef.sourceSpan)); matchedReferences.add(elOrDirRef.name); } }); const /** @type {?} */ contentQueryStartId = this.contentQueryStartId; this.contentQueryStartId += directive.queries.length; return new DirectiveAst(directive, directiveProperties, hostProperties, hostEvents, contentQueryStartId, sourceSpan); }); elementOrDirectiveRefs.forEach((elOrDirRef) => { if (elOrDirRef.value.length > 0) { if (!matchedReferences.has(elOrDirRef.name)) { this._reportError(`There is no directive with "exportAs" set to "${elOrDirRef.value}"`, elOrDirRef.sourceSpan); } } else if (!component) { let /** @type {?} */ refToken = /** @type {?} */ ((null)); if (isTemplateElement) { refToken = createTokenForExternalReference(this.reflector, Identifiers.TemplateRef); } targetReferences.push(new ReferenceAst(elOrDirRef.name, refToken, elOrDirRef.sourceSpan)); } }); return directiveAsts; } /** * @param {?} directiveProperties * @param {?} boundProps * @param {?} targetBoundDirectiveProps * @param {?} targetBoundDirectivePropNames * @return {?} */ _createDirectivePropertyAsts(directiveProperties, boundProps, targetBoundDirectiveProps, targetBoundDirectivePropNames) { if (directiveProperties) { const /** @type {?} */ boundPropsByName = new Map(); boundProps.forEach(boundProp => { const /** @type {?} */ prevValue = boundPropsByName.get(boundProp.name); if (!prevValue || prevValue.isLiteral) { // give [a]="b" a higher precedence than a="b" on the same element boundPropsByName.set(boundProp.name, boundProp); } }); Object.keys(directiveProperties).forEach(dirProp => { const /** @type {?} */ elProp = directiveProperties[dirProp]; const /** @type {?} */ boundProp = boundPropsByName.get(elProp); // Bindings are optional, so this binding only needs to be set up if an expression is given. if (boundProp) { targetBoundDirectivePropNames.add(boundProp.name); if (!isEmptyExpression(boundProp.expression)) { targetBoundDirectiveProps.push(new BoundDirectivePropertyAst(dirProp, boundProp.name, boundProp.expression, boundProp.sourceSpan)); } } }); } } /** * @param {?} elementName * @param {?} props * @param {?} boundDirectivePropNames * @return {?} */ _createElementPropertyAsts(elementName, props, boundDirectivePropNames) { const /** @type {?} */ boundElementProps = []; props.forEach((prop) => { if (!prop.isLiteral && !boundDirectivePropNames.has(prop.name)) { boundElementProps.push(this._bindingParser.createElementPropertyAst(elementName, prop)); } }); return this._checkPropertiesInSchema(elementName, boundElementProps); } /** * @param {?} directives * @return {?} */ _findComponentDirectives(directives) { return directives.filter(directive => directive.directive.isComponent); } /** * @param {?} directives * @return {?} */ _findComponentDirectiveNames(directives) { return this._findComponentDirectives(directives) .map(directive => /** @type {?} */ ((identifierName(directive.directive.type)))); } /** * @param {?} directives * @param {?} sourceSpan * @return {?} */ _assertOnlyOneComponent(directives, sourceSpan) { const /** @type {?} */ componentTypeNames = this._findComponentDirectiveNames(directives); if (componentTypeNames.length > 1) { this._reportError(`More than one component matched on this element.\n` + `Make sure that only one component's selector can match a given element.\n` + `Conflicting components: ${componentTypeNames.join(',')}`, sourceSpan); } } /** * Make sure that non-angular tags conform to the schemas. * * Note: An element is considered an angular tag when at least one directive selector matches the * tag name. * * @param {?} matchElement Whether any directive has matched on the tag name * @param {?} element the html element * @return {?} */ _assertElementExists(matchElement, element) { const /** @type {?} */ elName = element.name.replace(/^:xhtml:/, ''); if (!matchElement && !this._schemaRegistry.hasElement(elName, this._schemas)) { let /** @type {?} */ errorMsg = `'${elName}' is not a known element:\n`; errorMsg += `1. If '${elName}' is an Angular component, then verify that it is part of this module.\n`; if (elName.indexOf('-') > -1) { errorMsg += `2. If '${elName}' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.`; } else { errorMsg += `2. To allow any element add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component.`; } this._reportError(errorMsg, /** @type {?} */ ((element.sourceSpan))); } } /** * @param {?} directives * @param {?} elementProps * @param {?} sourceSpan * @return {?} */ _assertNoComponentsNorElementBindingsOnTemplate(directives, elementProps, sourceSpan) { const /** @type {?} */ componentTypeNames = this._findComponentDirectiveNames(directives); if (componentTypeNames.length > 0) { this._reportError(`Components on an embedded template: ${componentTypeNames.join(',')}`, sourceSpan); } elementProps.forEach(prop => { this._reportError(`Property binding ${prop.name} not used by any directive on an embedded template. Make sure that the property name is spelled correctly and all directives are listed in the "@NgModule.declarations".`, sourceSpan); }); } /** * @param {?} directives * @param {?} events * @return {?} */ _assertAllEventsPublishedByDirectives(directives, events) { const /** @type {?} */ allDirectiveEvents = new Set(); directives.forEach(directive => { Object.keys(directive.directive.outputs).forEach(k => { const /** @type {?} */ eventName = directive.directive.outputs[k]; allDirectiveEvents.add(eventName); }); }); events.forEach(event => { if (event.target != null || !allDirectiveEvents.has(event.name)) { this._reportError(`Event binding ${event.fullName} not emitted by any directive on an embedded template. Make sure that the event name is spelled correctly and all directives are listed in the "@NgModule.declarations".`, event.sourceSpan); } }); } /** * @param {?} elementName * @param {?} boundProps * @return {?} */ _checkPropertiesInSchema(elementName, boundProps) { // Note: We can't filter out empty expressions before this method, // as we still want to validate them! return boundProps.filter((boundProp) => { if (boundProp.type === PropertyBindingType.Property && !this._schemaRegistry.hasProperty(elementName, boundProp.name, this._schemas)) { let /** @type {?} */ errorMsg = `Can't bind to '${boundProp.name}' since it isn't a known property of '${elementName}'.`; if (elementName.startsWith('ng-')) { errorMsg += `\n1. If '${boundProp.name}' is an Angular directive, then add 'CommonModule' to the '@NgModule.imports' of this component.` + `\n2. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component.`; } else if (elementName.indexOf('-') > -1) { errorMsg += `\n1. If '${elementName}' is an Angular component and it has '${boundProp.name}' input, then verify that it is part of this module.` + `\n2. If '${elementName}' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.` + `\n3. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component.`; } this._reportError(errorMsg, boundProp.sourceSpan); } return !isEmptyExpression(boundProp.value); }); } /** * @param {?} message * @param {?} sourceSpan * @param {?=} level * @return {?} */ _reportError(message, sourceSpan, level = ParseErrorLevel.ERROR) { this._targetErrors.push(new ParseError(sourceSpan, message, level)); } } class NonBindableVisitor { /** * @param {?} ast * @param {?} parent * @return {?} */ visitElement(ast, parent) { const /** @type {?} */ preparsedElement = preparseElement(ast); if (preparsedElement.type === PreparsedElementType.SCRIPT || preparsedElement.type === PreparsedElementType.STYLE || preparsedElement.type === PreparsedElementType.STYLESHEET) { // Skipping <script> for security reasons // Skipping <style> and stylesheets as we already processed them // in the StyleCompiler return null; } const /** @type {?} */ attrNameAndValues = ast.attrs.map((attr) => [attr.name, attr.value]); const /** @type {?} */ selector = createElementCssSelector(ast.name, attrNameAndValues); const /** @type {?} */ ngContentIndex = parent.findNgContentIndex(selector); const /** @type {?} */ children = visitAll(this, ast.children, EMPTY_ELEMENT_CONTEXT); return new ElementAst(ast.name, visitAll(this, ast.attrs), [], [], [], [], [], false, [], children, ngContentIndex, ast.sourceSpan, ast.endSourceSpan); } /** * @param {?} comment * @param {?} context * @return {?} */ visitComment(comment, context) { return null; } /** * @param {?} attribute * @param {?} context * @return {?} */ visitAttribute(attribute, context) { return new AttrAst(attribute.name, attribute.value, attribute.sourceSpan); } /** * @param {?} text * @param {?} parent * @return {?} */ visitText(text, parent) { const /** @type {?} */ ngContentIndex = /** @type {?} */ ((parent.findNgContentIndex(TEXT_CSS_SELECTOR))); return new TextAst(text.value, ngContentIndex, /** @type {?} */ ((text.sourceSpan))); } /** * @param {?} expansion * @param {?} context * @return {?} */ visitExpansion(expansion, context) { return expansion; } /** * @param {?} expansionCase * @param {?} context * @return {?} */ visitExpansionCase(expansionCase, context) { return expansionCase; } } /** * A reference to an element or directive in a template. E.g., the reference in this template: * * <div #myMenu="coolMenu"> * * would be {name: 'myMenu', value: 'coolMenu', sourceSpan: ...} */ class ElementOrDirectiveRef { /** * @param {?} name * @param {?} value * @param {?} sourceSpan */ constructor(name, value, sourceSpan) { this.name = name; this.value = value; this.sourceSpan = sourceSpan; } /** * Gets whether this is a reference to the given directive. * @param {?} directive * @return {?} */ isReferenceToDirective(directive) { return splitExportAs(directive.exportAs).indexOf(this.value) !== -1; } } /** * Splits a raw, potentially comma-delimted `exportAs` value into an array of names. * @param {?} exportAs * @return {?} */ function splitExportAs(exportAs) { return exportAs ? exportAs.split(',').map(e => e.trim()) : []; } /** * @param {?} classAttrValue * @return {?} */ function splitClasses(classAttrValue) { return classAttrValue.trim().split(/\s+/g); } class ElementContext { /** * @param {?} isTemplateElement * @param {?} _ngContentIndexMatcher * @param {?} _wildcardNgContentIndex * @param {?} providerContext */ constructor(isTemplateElement, _ngContentIndexMatcher, _wildcardNgContentIndex, providerContext) { this.isTemplateElement = isTemplateElement; this._ngContentIndexMatcher = _ngContentIndexMatcher; this._wildcardNgContentIndex = _wildcardNgContentIndex; this.providerContext = providerContext; } /** * @param {?} isTemplateElement * @param {?} directives * @param {?} providerContext * @return {?} */ static create(isTemplateElement, directives, providerContext) { const /** @type {?} */ matcher = new SelectorMatcher(); let /** @type {?} */ wildcardNgContentIndex = /** @type {?} */ ((null)); const /** @type {?} */ component = directives.find(directive => directive.directive.isComponent); if (component) { const /** @type {?} */ ngContentSelectors = /** @type {?} */ ((component.directive.template)).ngContentSelectors; for (let /** @type {?} */ i = 0; i < ngContentSelectors.length; i++) { const /** @type {?} */ selector = ngContentSelectors[i]; if (selector === '*') { wildcardNgContentIndex = i; } else { matcher.addSelectables(CssSelector.parse(ngContentSelectors[i]), i); } } } return new ElementContext(isTemplateElement, matcher, wildcardNgContentIndex, providerContext); } /** * @param {?} selector * @return {?} */ findNgContentIndex(selector) { const /** @type {?} */ ngContentIndices = []; this._ngContentIndexMatcher.match(selector, (selector, ngContentIndex) => { ngContentIndices.push(ngContentIndex); }); ngContentIndices.sort(); if (this._wildcardNgContentIndex != null) { ngContentIndices.push(this._wildcardNgContentIndex); } return ngContentIndices.length > 0 ? ngContentIndices[0] : null; } } /** * @param {?} elementName * @param {?} attributes * @return {?} */ function createElementCssSelector(elementName, attributes) { const /** @type {?} */ cssSelector = new CssSelector(); const /** @type {?} */ elNameNoNs = splitNsName(elementName)[1]; cssSelector.setElement(elNameNoNs); for (let /** @type {?} */ i = 0; i < attributes.length; i++) { const /** @type {?} */ attrName = attributes[i][0]; const /** @type {?} */ attrNameNoNs = splitNsName(attrName)[1]; const /** @type {?} */ attrValue = attributes[i][1]; cssSelector.addAttribute(attrNameNoNs, attrValue); if (attrName.toLowerCase() == CLASS_ATTR) { const /** @type {?} */ classes = splitClasses(attrValue); classes.forEach(className => cssSelector.addClassName(className)); } } return cssSelector; } const EMPTY_ELEMENT_CONTEXT = new ElementContext(true, new SelectorMatcher(), null, null); const NON_BINDABLE_VISITOR = new NonBindableVisitor(); /** * @param {?} node * @return {?} */ function _isEmptyTextNode(node) { return node instanceof Text && node.value.trim().length == 0; } /** * @template T * @param {?} items * @return {?} */ function removeSummaryDuplicates(items) { const /** @type {?} */ map = new Map(); items.forEach((item) => { if (!map.get(item.type.reference)) { map.set(item.type.reference, item); } }); return Array.from(map.values()); } /** * @param {?} ast * @return {?} */ function isEmptyExpression(ast) { if (ast instanceof ASTWithSource) { ast = ast.ast; } return ast instanceof EmptyExpr; } /** * @param {?} el * @param {?} enableLegacyTemplate * @param {?} reportDeprecation * @return {?} */ function isTemplate(el, enableLegacyTemplate, reportDeprecation) { if (isNgTemplate(el.name)) return true; const /** @type {?} */ tagNoNs = splitNsName(el.name)[1]; // `<template>` is HTML and case insensitive if (tagNoNs.toLowerCase() === TEMPLATE_ELEMENT) { if (enableLegacyTemplate && tagNoNs.toLowerCase() === TEMPLATE_ELEMENT) { reportDeprecation(TEMPLATE_ELEMENT_DEPRECATION_WARNING, /** @type {?} */ ((el.sourceSpan))); return true; } } return false; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ class EventHandlerVars { } EventHandlerVars.event = variable('$event'); /** * @record */ class ConvertActionBindingResult { /** * @param {?} stmts * @param {?} allowDefault */ constructor(stmts, allowDefault) { this.stmts = stmts; this.allowDefault = allowDefault; } } /** * Converts the given expression AST into an executable output AST, assuming the expression is * used in an action binding (e.g. an event handler). * @param {?} localResolver * @param {?} implicitReceiver * @param {?} action * @param {?} bindingId * @return {?} */ function convertActionBinding(localResolver, implicitReceiver, action, bindingId) { if (!localResolver) { localResolver = new DefaultLocalResolver(); } const /** @type {?} */ actionWithoutBuiltins = convertPropertyBindingBuiltins({ createLiteralArrayConverter: (argCount) => { // Note: no caching for literal arrays in actions. return (args) => literalArr(args); }, createLiteralMapConverter: (keys) => { // Note: no caching for literal maps in actions. return (values) => { const /** @type {?} */ entries = keys.map((k, i) => ({ key: k.key, value: values[i], quoted: k.quoted, })); return literalMap(entries); }; }, createPipeConverter: (name) => { throw new Error(`Illegal State: Actions are not allowed to contain pipes. Pipe: ${name}`); } }, action); const /** @type {?} */ visitor = new _AstToIrVisitor(localResolver, implicitReceiver, bindingId); const /** @type {?} */ actionStmts = []; flattenStatements(actionWithoutBuiltins.visit(visitor, _Mode.Statement), actionStmts); prependTemporaryDecls(visitor.temporaryCount, bindingId, actionStmts); const /** @type {?} */ lastIndex = actionStmts.length - 1; let /** @type {?} */ preventDefaultVar = /** @type {?} */ ((null)); if (lastIndex >= 0) { const /** @type {?} */ lastStatement = actionStmts[lastIndex]; const /** @type {?} */ returnExpr = convertStmtIntoExpression(lastStatement); if (returnExpr) { // Note: We need to cast the result of the method call to dynamic, // as it might be a void method! preventDefaultVar = createPreventDefaultVar(bindingId); actionStmts[lastIndex] = preventDefaultVar.set(returnExpr.cast(DYNAMIC_TYPE).notIdentical(literal(false))) .toDeclStmt(null, [StmtModifier.Final]); } } return new ConvertActionBindingResult(actionStmts, preventDefaultVar); } /** * @record */ /** * @record */ /** * @param {?} converterFactory * @param {?} ast * @return {?} */ function convertPropertyBindingBuiltins(converterFactory, ast) { return convertBuiltins(converterFactory, ast); } class ConvertPropertyBindingResult { /** * @param {?} stmts * @param {?} currValExpr */ constructor(stmts, currValExpr) { this.stmts = stmts; this.currValExpr = currValExpr; } } /** @enum {number} */ const BindingForm = { // The general form of binding expression, supports all expressions. General: 0, // Try to generate a simple binding (no temporaries or statements) // otherise generate a general binding TrySimple: 1, }; BindingForm[BindingForm.General] = "General"; BindingForm[BindingForm.TrySimple] = "TrySimple"; /** * Converts the given expression AST into an executable output AST, assuming the expression * is used in property binding. The expression has to be preprocessed via * `convertPropertyBindingBuiltins`. * @param {?} localResolver * @param {?} implicitReceiver * @param {?} expressionWithoutBuiltins * @param {?} bindingId * @param {?} form * @return {?} */ function convertPropertyBinding(localResolver, implicitReceiver, expressionWithoutBuiltins, bindingId, form) { if (!localResolver) { localResolver = new DefaultLocalResolver(); } const /** @type {?} */ currValExpr = createCurrValueExpr(bindingId); const /** @type {?} */ stmts = []; const /** @type {?} */ visitor = new _AstToIrVisitor(localResolver, implicitReceiver, bindingId); const /** @type {?} */ outputExpr = expressionWithoutBuiltins.visit(visitor, _Mode.Expression); if (visitor.temporaryCount) { for (let /** @type {?} */ i = 0; i < visitor.temporaryCount; i++) { stmts.push(temporaryDeclaration(bindingId, i)); } } else if (form == BindingForm.TrySimple) { return new ConvertPropertyBindingResult([], outputExpr); } stmts.push(currValExpr.set(outputExpr).toDeclStmt(DYNAMIC_TYPE, [StmtModifier.Final])); return new ConvertPropertyBindingResult(stmts, currValExpr); } /** * @param {?} converterFactory * @param {?} ast * @return {?} */ function convertBuiltins(converterFactory, ast) { const /** @type {?} */ visitor = new _BuiltinAstConverter(converterFactory); return ast.visit(visitor); } /** * @param {?} bindingId * @param {?} temporaryNumber * @return {?} */ function temporaryName(bindingId, temporaryNumber) { return `tmp_${bindingId}_${temporaryNumber}`; } /** * @param {?} bindingId * @param {?} temporaryNumber * @return {?} */ function temporaryDeclaration(bindingId, temporaryNumber) { return new DeclareVarStmt(temporaryName(bindingId, temporaryNumber), NULL_EXPR); } /** * @param {?} temporaryCount * @param {?} bindingId * @param {?} statements * @return {?} */ function prependTemporaryDecls(temporaryCount, bindingId, statements) { for (let /** @type {?} */ i = temporaryCount - 1; i >= 0; i--) { statements.unshift(temporaryDeclaration(bindingId, i)); } } /** @enum {number} */ const _Mode = { Statement: 0, Expression: 1, }; _Mode[_Mode.Statement] = "Statement"; _Mode[_Mode.Expression] = "Expression"; /** * @param {?} mode * @param {?} ast * @return {?} */ function ensureStatementMode(mode, ast) { if (mode !== _Mode.Statement) { throw new Error(`Expected a statement, but saw ${ast}`); } } /** * @param {?} mode * @param {?} ast * @return {?} */ function ensureExpressionMode(mode, ast) { if (mode !== _Mode.Expression) { throw new Error(`Expected an expression, but saw ${ast}`); } } /** * @param {?} mode * @param {?} expr * @return {?} */ function convertToStatementIfNeeded(mode, expr) { if (mode === _Mode.Statement) { return expr.toStmt(); } else { return expr; } } class _BuiltinAstConverter extends AstTransformer { /** * @param {?} _converterFactory */ constructor(_converterFactory) { super(); this._converterFactory = _converterFactory; } /** * @param {?} ast * @param {?} context * @return {?} */ visitPipe(ast, context) { const /** @type {?} */ args = [ast.exp, ...ast.args].map(ast => ast.visit(this, context)); return new BuiltinFunctionCall(ast.span, args, this._converterFactory.createPipeConverter(ast.name, args.length)); } /** * @param {?} ast * @param {?} context * @return {?} */ visitLiteralArray(ast, context) { const /** @type {?} */ args = ast.expressions.map(ast => ast.visit(this, context)); return new BuiltinFunctionCall(ast.span, args, this._converterFactory.createLiteralArrayConverter(ast.expressions.length)); } /** * @param {?} ast * @param {?} context * @return {?} */ visitLiteralMap(ast, context) { const /** @type {?} */ args = ast.values.map(ast => ast.visit(this, context)); return new BuiltinFunctionCall(ast.span, args, this._converterFactory.createLiteralMapConverter(ast.keys)); } } class _AstToIrVisitor { /** * @param {?} _localResolver * @param {?} _implicitReceiver * @param {?} bindingId */ constructor(_localResolver, _implicitReceiver, bindingId) { this._localResolver = _localResolver; this._implicitReceiver = _implicitReceiver; this.bindingId = bindingId; this._nodeMap = new Map(); this._resultMap = new Map(); this._currentTemporary = 0; this.temporaryCount = 0; } /** * @param {?} ast * @param {?} mode * @return {?} */ visitBinary(ast, mode) { let /** @type {?} */ op; switch (ast.operation) { case '+': op = BinaryOperator.Plus; break; case '-': op = BinaryOperator.Minus; break; case '*': op = BinaryOperator.Multiply; break; case '/': op = BinaryOperator.Divide; break; case '%': op = BinaryOperator.Modulo; break; case '&&': op = BinaryOperator.And; break; case '||': op = BinaryOperator.Or; break; case '==': op = BinaryOperator.Equals; break; case '!=': op = BinaryOperator.NotEquals; break; case '===': op = BinaryOperator.Identical; break; case '!==': op = BinaryOperator.NotIdentical; break; case '<': op = BinaryOperator.Lower; break; case '>': op = BinaryOperator.Bigger; break; case '<=': op = BinaryOperator.LowerEquals; break; case '>=': op = BinaryOperator.BiggerEquals; break; default: throw new Error(`Unsupported operation ${ast.operation}`); } return convertToStatementIfNeeded(mode, new BinaryOperatorExpr(op, this._visit(ast.left, _Mode.Expression), this._visit(ast.right, _Mode.Expression))); } /** * @param {?} ast * @param {?} mode * @return {?} */ visitChain(ast, mode) { ensureStatementMode(mode, ast); return this.visitAll(ast.expressions, mode); } /** * @param {?} ast * @param {?} mode * @return {?} */ visitConditional(ast, mode) { const /** @type {?} */ value = this._visit(ast.condition, _Mode.Expression); return convertToStatementIfNeeded(mode, value.conditional(this._visit(ast.trueExp, _Mode.Expression), this._visit(ast.falseExp, _Mode.Expression))); } /** * @param {?} ast * @param {?} mode * @return {?} */ visitPipe(ast, mode) { throw new Error(`Illegal state: Pipes should have been converted into functions. Pipe: ${ast.name}`); } /** * @param {?} ast * @param {?} mode * @return {?} */ visitFunctionCall(ast, mode) { const /** @type {?} */ convertedArgs = this.visitAll(ast.args, _Mode.Expression); let /** @type {?} */ fnResult; if (ast instanceof BuiltinFunctionCall) { fnResult = ast.converter(convertedArgs); } else { fnResult = this._visit(/** @type {?} */ ((ast.target)), _Mode.Expression).callFn(convertedArgs); } return convertToStatementIfNeeded(mode, fnResult); } /** * @param {?} ast * @param {?} mode * @return {?} */ visitImplicitReceiver(ast, mode) { ensureExpressionMode(mode, ast); return this._implicitReceiver; } /** * @param {?} ast * @param {?} mode * @return {?} */ visitInterpolation(ast, mode) { ensureExpressionMode(mode, ast); const /** @type {?} */ args = [literal(ast.expressions.length)]; for (let /** @type {?} */ i = 0; i < ast.strings.length - 1; i++) { args.push(literal(ast.strings[i])); args.push(this._visit(ast.expressions[i], _Mode.Expression)); } args.push(literal(ast.strings[ast.strings.length - 1])); return ast.expressions.length <= 9 ? importExpr(Identifiers.inlineInterpolate).callFn(args) : importExpr(Identifiers.interpolate).callFn([args[0], literalArr(args.slice(1))]); } /** * @param {?} ast * @param {?} mode * @return {?} */ visitKeyedRead(ast, mode) { const /** @type {?} */ leftMostSafe = this.leftMostSafeNode(ast); if (leftMostSafe) { return this.convertSafeAccess(ast, leftMostSafe, mode); } else { return convertToStatementIfNeeded(mode, this._visit(ast.obj, _Mode.Expression).key(this._visit(ast.key, _Mode.Expression))); } } /** * @param {?} ast * @param {?} mode * @return {?} */ visitKeyedWrite(ast, mode) { const /** @type {?} */ obj = this._visit(ast.obj, _Mode.Expression); const /** @type {?} */ key = this._visit(ast.key, _Mode.Expression); const /** @type {?} */ value = this._visit(ast.value, _Mode.Expression); return convertToStatementIfNeeded(mode, obj.key(key).set(value)); } /** * @param {?} ast * @param {?} mode * @return {?} */ visitLiteralArray(ast, mode) { throw new Error(`Illegal State: literal arrays should have been converted into functions`); } /** * @param {?} ast * @param {?} mode * @return {?} */ visitLiteralMap(ast, mode) { throw new Error(`Illegal State: literal maps should have been converted into functions`); } /** * @param {?} ast * @param {?} mode * @return {?} */ visitLiteralPrimitive(ast, mode) { // For literal values of null, undefined, true, or false allow type inteference // to infer the type. const /** @type {?} */ type = ast.value === null || ast.value === undefined || ast.value === true || ast.value === true ? INFERRED_TYPE : undefined; return convertToStatementIfNeeded(mode, literal(ast.value, type)); } /** * @param {?} name * @return {?} */ _getLocal(name) { return this._localResolver.getLocal(name); } /** * @param {?} ast * @param {?} mode * @return {?} */ visitMethodCall(ast, mode) { if (ast.receiver instanceof ImplicitReceiver && ast.name == '$any') { const /** @type {?} */ args = /** @type {?} */ (this.visitAll(ast.args, _Mode.Expression)); if (args.length != 1) { throw new Error(`Invalid call to $any, expected 1 argument but received ${args.length || 'none'}`); } return (/** @type {?} */ (args[0])).cast(DYNAMIC_TYPE); } const /** @type {?} */ leftMostSafe = this.leftMostSafeNode(ast); if (leftMostSafe) { return this.convertSafeAccess(ast, leftMostSafe, mode); } else { const /** @type {?} */ args = this.visitAll(ast.args, _Mode.Expression); let /** @type {?} */ result = null; const /** @type {?} */ receiver = this._visit(ast.receiver, _Mode.Expression); if (receiver === this._implicitReceiver) { const /** @type {?} */ varExpr = this._getLocal(ast.name); if (varExpr) { result = varExpr.callFn(args); } } if (result == null) { result = receiver.callMethod(ast.name, args); } return convertToStatementIfNeeded(mode, result); } } /** * @param {?} ast * @param {?} mode * @return {?} */ visitPrefixNot(ast, mode) { return convertToStatementIfNeeded(mode, not(this._visit(ast.expression, _Mode.Expression))); } /** * @param {?} ast * @param {?} mode * @return {?} */ visitNonNullAssert(ast, mode) { return convertToStatementIfNeeded(mode, assertNotNull(this._visit(ast.expression, _Mode.Expression))); } /** * @param {?} ast * @param {?} mode * @return {?} */ visitPropertyRead(ast, mode) { const /** @type {?} */ leftMostSafe = this.leftMostSafeNode(ast); if (leftMostSafe) { return this.convertSafeAccess(ast, leftMostSafe, mode); } else { let /** @type {?} */ result = null; const /** @type {?} */ receiver = this._visit(ast.receiver, _Mode.Expression); if (receiver === this._implicitReceiver) { result = this._getLocal(ast.name); } if (result == null) { result = receiver.prop(ast.name); } return convertToStatementIfNeeded(mode, result); } } /** * @param {?} ast * @param {?} mode * @return {?} */ visitPropertyWrite(ast, mode) { const /** @type {?} */ receiver = this._visit(ast.receiver, _Mode.Expression); if (receiver === this._implicitReceiver) { const /** @type {?} */ varExpr = this._getLocal(ast.name); if (varExpr) { throw new Error('Cannot assign to a reference or variable!'); } } return convertToStatementIfNeeded(mode, receiver.prop(ast.name).set(this._visit(ast.value, _Mode.Expression))); } /** * @param {?} ast * @param {?} mode * @return {?} */ visitSafePropertyRead(ast, mode) { return this.convertSafeAccess(ast, this.leftMostSafeNode(ast), mode); } /** * @param {?} ast * @param {?} mode * @return {?} */ visitSafeMethodCall(ast, mode) { return this.convertSafeAccess(ast, this.leftMostSafeNode(ast), mode); } /** * @param {?} asts * @param {?} mode * @return {?} */ visitAll(asts, mode) { return asts.map(ast => this._visit(ast, mode)); } /** * @param {?} ast * @param {?} mode * @return {?} */ visitQuote(ast, mode) { throw new Error(`Quotes are not supported for evaluation! Statement: ${ast.uninterpretedExpression} located at ${ast.location}`); } /** * @param {?} ast * @param {?} mode * @return {?} */ _visit(ast, mode) { const /** @type {?} */ result = this._resultMap.get(ast); if (result) return result; return (this._nodeMap.get(ast) || ast).visit(this, mode); } /** * @param {?} ast * @param {?} leftMostSafe * @param {?} mode * @return {?} */ convertSafeAccess(ast, leftMostSafe, mode) { // If the expression contains a safe access node on the left it needs to be converted to // an expression that guards the access to the member by checking the receiver for blank. As // execution proceeds from left to right, the left most part of the expression must be guarded // first but, because member access is left associative, the right side of the expression is at // the top of the AST. The desired result requires lifting a copy of the the left part of the // expression up to test it for blank before generating the unguarded version. // Consider, for example the following expression: a?.b.c?.d.e // This results in the ast: // . // / \ // ?. e // / \ // . d // / \ // ?. c // / \ // a b // The following tree should be generated: // // /---- ? ----\ // / | \ // a /--- ? ---\ null // / | \ // . . null // / \ / \ // . c . e // / \ / \ // a b , d // / \ // . c // / \ // a b // // Notice that the first guard condition is the left hand of the left most safe access node // which comes in as leftMostSafe to this routine. let /** @type {?} */ guardedExpression = this._visit(leftMostSafe.receiver, _Mode.Expression); let /** @type {?} */ temporary = /** @type {?} */ ((undefined)); if (this.needsTemporary(leftMostSafe.receiver)) { // If the expression has method calls or pipes then we need to save the result into a // temporary variable to avoid calling stateful or impure code more than once. temporary = this.allocateTemporary(); // Preserve the result in the temporary variable guardedExpression = temporary.set(guardedExpression); // Ensure all further references to the guarded expression refer to the temporary instead. this._resultMap.set(leftMostSafe.receiver, temporary); } const /** @type {?} */ condition = guardedExpression.isBlank(); // Convert the ast to an unguarded access to the receiver's member. The map will substitute // leftMostNode with its unguarded version in the call to `this.visit()`. if (leftMostSafe instanceof SafeMethodCall) { this._nodeMap.set(leftMostSafe, new MethodCall(leftMostSafe.span, leftMostSafe.receiver, leftMostSafe.name, leftMostSafe.args)); } else { this._nodeMap.set(leftMostSafe, new PropertyRead(leftMostSafe.span, leftMostSafe.receiver, leftMostSafe.name)); } // Recursively convert the node now without the guarded member access. const /** @type {?} */ access = this._visit(ast, _Mode.Expression); // Remove the mapping. This is not strictly required as the converter only traverses each node // once but is safer if the conversion is changed to traverse the nodes more than once. this._nodeMap.delete(leftMostSafe); // If we allocated a temporary, release it. if (temporary) { this.releaseTemporary(temporary); } // Produce the conditional return convertToStatementIfNeeded(mode, condition.conditional(literal(null), access)); } /** * @param {?} ast * @return {?} */ leftMostSafeNode(ast) { const /** @type {?} */ visit = (visitor, ast) => { return (this._nodeMap.get(ast) || ast).visit(visitor); }; return ast.visit({ /** * @param {?} ast * @return {?} */ visitBinary(ast) { return null; }, /** * @param {?} ast * @return {?} */ visitChain(ast) { return null; }, /** * @param {?} ast * @return {?} */ visitConditional(ast) { return null; }, /** * @param {?} ast * @return {?} */ visitFunctionCall(ast) { return null; }, /** * @param {?} ast * @return {?} */ visitImplicitReceiver(ast) { return null; }, /** * @param {?} ast * @return {?} */ visitInterpolation(ast) { return null; }, /** * @param {?} ast * @return {?} */ visitKeyedRead(ast) { return visit(this, ast.obj); }, /** * @param {?} ast * @return {?} */ visitKeyedWrite(ast) { return null; }, /** * @param {?} ast * @return {?} */ visitLiteralArray(ast) { return null; }, /** * @param {?} ast * @return {?} */ visitLiteralMap(ast) { return null; }, /** * @param {?} ast * @return {?} */ visitLiteralPrimitive(ast) { return null; }, /** * @param {?} ast * @return {?} */ visitMethodCall(ast) { return visit(this, ast.receiver); }, /** * @param {?} ast * @return {?} */ visitPipe(ast) { return null; }, /** * @param {?} ast * @return {?} */ visitPrefixNot(ast) { return null; }, /** * @param {?} ast * @return {?} */ visitNonNullAssert(ast) { return null; }, /** * @param {?} ast * @return {?} */ visitPropertyRead(ast) { return visit(this, ast.receiver); }, /** * @param {?} ast * @return {?} */ visitPropertyWrite(ast) { return null; }, /** * @param {?} ast * @return {?} */ visitQuote(ast) { return null; }, /** * @param {?} ast * @return {?} */ visitSafeMethodCall(ast) { return visit(this, ast.receiver) || ast; }, /** * @param {?} ast * @return {?} */ visitSafePropertyRead(ast) { return visit(this, ast.receiver) || ast; } }); } /** * @param {?} ast * @return {?} */ needsTemporary(ast) { const /** @type {?} */ visit = (visitor, ast) => { return ast && (this._nodeMap.get(ast) || ast).visit(visitor); }; const /** @type {?} */ visitSome = (visitor, ast) => { return ast.some(ast => visit(visitor, ast)); }; return ast.visit({ /** * @param {?} ast * @return {?} */ visitBinary(ast) { return visit(this, ast.left) || visit(this, ast.right); }, /** * @param {?} ast * @return {?} */ visitChain(ast) { return false; }, /** * @param {?} ast * @return {?} */ visitConditional(ast) { return visit(this, ast.condition) || visit(this, ast.trueExp) || visit(this, ast.falseExp); }, /** * @param {?} ast * @return {?} */ visitFunctionCall(ast) { return true; }, /** * @param {?} ast * @return {?} */ visitImplicitReceiver(ast) { return false; }, /** * @param {?} ast * @return {?} */ visitInterpolation(ast) { return visitSome(this, ast.expressions); }, /** * @param {?} ast * @return {?} */ visitKeyedRead(ast) { return false; }, /** * @param {?} ast * @return {?} */ visitKeyedWrite(ast) { return false; }, /** * @param {?} ast * @return {?} */ visitLiteralArray(ast) { return true; }, /** * @param {?} ast * @return {?} */ visitLiteralMap(ast) { return true; }, /** * @param {?} ast * @return {?} */ visitLiteralPrimitive(ast) { return false; }, /** * @param {?} ast * @return {?} */ visitMethodCall(ast) { return true; }, /** * @param {?} ast * @return {?} */ visitPipe(ast) { return true; }, /** * @param {?} ast * @return {?} */ visitPrefixNot(ast) { return visit(this, ast.expression); }, /** * @param {?} ast * @return {?} */ visitNonNullAssert(ast) { return visit(this, ast.expression); }, /** * @param {?} ast * @return {?} */ visitPropertyRead(ast) { return false; }, /** * @param {?} ast * @return {?} */ visitPropertyWrite(ast) { return false; }, /** * @param {?} ast * @return {?} */ visitQuote(ast) { return false; }, /** * @param {?} ast * @return {?} */ visitSafeMethodCall(ast) { return true; }, /** * @param {?} ast * @return {?} */ visitSafePropertyRead(ast) { return false; } }); } /** * @return {?} */ allocateTemporary() { const /** @type {?} */ tempNumber = this._currentTemporary++; this.temporaryCount = Math.max(this._currentTemporary, this.temporaryCount); return new ReadVarExpr(temporaryName(this.bindingId, tempNumber)); } /** * @param {?} temporary * @return {?} */ releaseTemporary(temporary) { this._currentTemporary--; if (temporary.name != temporaryName(this.bindingId, this._currentTemporary)) { throw new Error(`Temporary ${temporary.name} released out of order`); } } } /** * @param {?} arg * @param {?} output * @return {?} */ function flattenStatements(arg, output) { if (Array.isArray(arg)) { (/** @type {?} */ (arg)).forEach((entry) => flattenStatements(entry, output)); } else { output.push(arg); } } class DefaultLocalResolver { /** * @param {?} name * @return {?} */ getLocal(name) { if (name === EventHandlerVars.event.name) { return EventHandlerVars.event; } return null; } } /** * @param {?} bindingId * @return {?} */ function createCurrValueExpr(bindingId) { return variable(`currVal_${bindingId}`); // fix syntax highlighting: ` } /** * @param {?} bindingId * @return {?} */ function createPreventDefaultVar(bindingId) { return variable(`pd_${bindingId}`); } /** * @param {?} stmt * @return {?} */ function convertStmtIntoExpression(stmt) { if (stmt instanceof ExpressionStatement) { return stmt.expr; } else if (stmt instanceof ReturnStatement) { return stmt.value; } return null; } class BuiltinFunctionCall extends FunctionCall { /** * @param {?} span * @param {?} args * @param {?} converter */ constructor(span, args, converter) { super(span, null, args); this.args = args; this.converter = converter; } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * Generates code that is used to type check templates. */ class TypeCheckCompiler { /** * @param {?} options * @param {?} reflector */ constructor(options, reflector) { this.options = options; this.reflector = reflector; } /** * Important notes: * - This must not produce new `import` statements, but only refer to types outside * of the file via the variables provided via externalReferenceVars. * This allows Typescript to reuse the old program's structure as no imports have changed. * - This must not produce any exports, as this would pollute the .d.ts file * and also violate the point above. * @param {?} componentId * @param {?} component * @param {?} template * @param {?} usedPipes * @param {?} externalReferenceVars * @param {?} ctx * @return {?} */ compileComponent(componentId, component, template, usedPipes, externalReferenceVars, ctx) { const /** @type {?} */ pipes = new Map(); usedPipes.forEach(p => pipes.set(p.name, p.type.reference)); let /** @type {?} */ embeddedViewCount = 0; const /** @type {?} */ viewBuilderFactory = (parent, guards) => { const /** @type {?} */ embeddedViewIndex = embeddedViewCount++; return new ViewBuilder(this.options, this.reflector, externalReferenceVars, parent, component.type.reference, component.isHost, embeddedViewIndex, pipes, guards, ctx, viewBuilderFactory); }; const /** @type {?} */ visitor = viewBuilderFactory(null, []); visitor.visitAll([], template); return visitor.build(componentId); } } const DYNAMIC_VAR_NAME = '_any'; class TypeCheckLocalResolver { /** * @param {?} name * @return {?} */ getLocal(name) { if (name === EventHandlerVars.event.name) { // References to the event should not be type-checked. // TODO(chuckj): determine a better type for the event. return variable(DYNAMIC_VAR_NAME); } return null; } } const defaultResolver = new TypeCheckLocalResolver(); class ViewBuilder { /** * @param {?} options * @param {?} reflector * @param {?} externalReferenceVars * @param {?} parent * @param {?} component * @param {?} isHostComponent * @param {?} embeddedViewIndex * @param {?} pipes * @param {?} guards * @param {?} ctx * @param {?} viewBuilderFactory */ constructor(options, reflector, externalReferenceVars, parent, component, isHostComponent, embeddedViewIndex, pipes, guards, ctx, viewBuilderFactory) { this.options = options; this.reflector = reflector; this.externalReferenceVars = externalReferenceVars; this.parent = parent; this.component = component; this.isHostComponent = isHostComponent; this.embeddedViewIndex = embeddedViewIndex; this.pipes = pipes; this.guards = guards; this.ctx = ctx; this.viewBuilderFactory = viewBuilderFactory; this.refOutputVars = new Map(); this.variables = []; this.children = []; this.updates = []; this.actions = []; } /** * @param {?} type * @return {?} */ getOutputVar(type) { let /** @type {?} */ varName; if (type === this.component && this.isHostComponent) { varName = DYNAMIC_VAR_NAME; } else if (type instanceof StaticSymbol) { varName = this.externalReferenceVars.get(type); } else { varName = DYNAMIC_VAR_NAME; } if (!varName) { throw new Error(`Illegal State: referring to a type without a variable ${JSON.stringify(type)}`); } return varName; } /** * @param {?} ast * @return {?} */ getTypeGuardExpressions(ast) { const /** @type {?} */ result = [...this.guards]; for (let /** @type {?} */ directive of ast.directives) { for (let /** @type {?} */ input of directive.inputs) { const /** @type {?} */ guard = directive.directive.guards[input.directiveName]; if (guard) { const /** @type {?} */ useIf = guard === 'UseIf'; result.push({ guard, useIf, expression: /** @type {?} */ ({ context: this.component, value: input.value }) }); } } } return result; } /** * @param {?} variables * @param {?} astNodes * @return {?} */ visitAll(variables, astNodes) { this.variables = variables; templateVisitAll(this, astNodes); } /** * @param {?} componentId * @param {?=} targetStatements * @return {?} */ build(componentId, targetStatements = []) { this.children.forEach((child) => child.build(componentId, targetStatements)); let /** @type {?} */ viewStmts = [variable(DYNAMIC_VAR_NAME).set(NULL_EXPR).toDeclStmt(DYNAMIC_TYPE)]; let /** @type {?} */ bindingCount = 0; this.updates.forEach((expression) => { const { sourceSpan, context, value } = this.preprocessUpdateExpression(expression); const /** @type {?} */ bindingId = `${bindingCount++}`; const /** @type {?} */ nameResolver = context === this.component ? this : defaultResolver; const { stmts, currValExpr } = convertPropertyBinding(nameResolver, variable(this.getOutputVar(context)), value, bindingId, BindingForm.General); stmts.push(new ExpressionStatement(currValExpr)); viewStmts.push(...stmts.map((stmt) => applySourceSpanToStatementIfNeeded(stmt, sourceSpan))); }); this.actions.forEach(({ sourceSpan, context, value }) => { const /** @type {?} */ bindingId = `${bindingCount++}`; const /** @type {?} */ nameResolver = context === this.component ? this : defaultResolver; const { stmts } = convertActionBinding(nameResolver, variable(this.getOutputVar(context)), value, bindingId); viewStmts.push(...stmts.map((stmt) => applySourceSpanToStatementIfNeeded(stmt, sourceSpan))); }); if (this.guards.length) { let /** @type {?} */ guardExpression = undefined; for (const /** @type {?} */ guard of this.guards) { const { context, value } = this.preprocessUpdateExpression(guard.expression); const /** @type {?} */ bindingId = `${bindingCount++}`; const /** @type {?} */ nameResolver = context === this.component ? this : defaultResolver; // We only support support simple expressions and ignore others as they // are unlikely to affect type narrowing. const { stmts, currValExpr } = convertPropertyBinding(nameResolver, variable(this.getOutputVar(context)), value, bindingId, BindingForm.TrySimple); if (stmts.length == 0) { const /** @type {?} */ guardClause = guard.useIf ? currValExpr : this.ctx.importExpr(guard.guard).callFn([currValExpr]); guardExpression = guardExpression ? guardExpression.and(guardClause) : guardClause; } } if (guardExpression) { viewStmts = [new IfStmt(guardExpression, viewStmts)]; } } const /** @type {?} */ viewName = `_View_${componentId}_${this.embeddedViewIndex}`; const /** @type {?} */ viewFactory = new DeclareFunctionStmt(viewName, [], viewStmts); targetStatements.push(viewFactory); return targetStatements; } /** * @param {?} ast * @param {?} context * @return {?} */ visitBoundText(ast, context) { const /** @type {?} */ astWithSource = /** @type {?} */ (ast.value); const /** @type {?} */ inter = /** @type {?} */ (astWithSource.ast); inter.expressions.forEach((expr) => this.updates.push({ context: this.component, value: expr, sourceSpan: ast.sourceSpan })); } /** * @param {?} ast * @param {?} context * @return {?} */ visitEmbeddedTemplate(ast, context) { this.visitElementOrTemplate(ast); // Note: The old view compiler used to use an `any` type // for the context in any embedded view. // We keep this behaivor behind a flag for now. if (this.options.fullTemplateTypeCheck) { // Find any applicable type guards. For example, NgIf has a type guard on ngIf // (see NgIf.ngIfTypeGuard) that can be used to indicate that a template is only // stamped out if ngIf is truthy so any bindings in the template can assume that, // if a nullable type is used for ngIf, that expression is not null or undefined. const /** @type {?} */ guards = this.getTypeGuardExpressions(ast); const /** @type {?} */ childVisitor = this.viewBuilderFactory(this, guards); this.children.push(childVisitor); childVisitor.visitAll(ast.variables, ast.children); } } /** * @param {?} ast * @param {?} context * @return {?} */ visitElement(ast, context) { this.visitElementOrTemplate(ast); let /** @type {?} */ inputDefs = []; let /** @type {?} */ updateRendererExpressions = []; let /** @type {?} */ outputDefs = []; ast.inputs.forEach((inputAst) => { this.updates.push({ context: this.component, value: inputAst.value, sourceSpan: inputAst.sourceSpan }); }); templateVisitAll(this, ast.children); } /** * @param {?} ast * @return {?} */ visitElementOrTemplate(ast) { ast.directives.forEach((dirAst) => { this.visitDirective(dirAst); }); ast.references.forEach((ref) => { let /** @type {?} */ outputVarType = /** @type {?} */ ((null)); // Note: The old view compiler used to use an `any` type // for directives exposed via `exportAs`. // We keep this behaivor behind a flag for now. if (ref.value && ref.value.identifier && this.options.fullTemplateTypeCheck) { outputVarType = ref.value.identifier.reference; } else { outputVarType = BuiltinTypeName.Dynamic; } this.refOutputVars.set(ref.name, outputVarType); }); ast.outputs.forEach((outputAst) => { this.actions.push({ context: this.component, value: outputAst.handler, sourceSpan: outputAst.sourceSpan }); }); } /** * @param {?} dirAst * @return {?} */ visitDirective(dirAst) { const /** @type {?} */ dirType = dirAst.directive.type.reference; dirAst.inputs.forEach((input) => this.updates.push({ context: this.component, value: input.value, sourceSpan: input.sourceSpan })); // Note: The old view compiler used to use an `any` type // for expressions in host properties / events. // We keep this behaivor behind a flag for now. if (this.options.fullTemplateTypeCheck) { dirAst.hostProperties.forEach((inputAst) => this.updates.push({ context: dirType, value: inputAst.value, sourceSpan: inputAst.sourceSpan })); dirAst.hostEvents.forEach((hostEventAst) => this.actions.push({ context: dirType, value: hostEventAst.handler, sourceSpan: hostEventAst.sourceSpan })); } } /** * @param {?} name * @return {?} */ getLocal(name) { if (name == EventHandlerVars.event.name) { return variable(this.getOutputVar(BuiltinTypeName.Dynamic)); } for (let /** @type {?} */ currBuilder = this; currBuilder; currBuilder = currBuilder.parent) { let /** @type {?} */ outputVarType; // check references outputVarType = currBuilder.refOutputVars.get(name); if (outputVarType == null) { // check variables const /** @type {?} */ varAst = currBuilder.variables.find((varAst) => varAst.name === name); if (varAst) { outputVarType = BuiltinTypeName.Dynamic; } } if (outputVarType != null) { return variable(this.getOutputVar(outputVarType)); } } return null; } /** * @param {?} name * @return {?} */ pipeOutputVar(name) { const /** @type {?} */ pipe = this.pipes.get(name); if (!pipe) { throw new Error(`Illegal State: Could not find pipe ${name} in template of ${this.component}`); } return this.getOutputVar(pipe); } /** * @param {?} expression * @return {?} */ preprocessUpdateExpression(expression) { return { sourceSpan: expression.sourceSpan, context: expression.context, value: convertPropertyBindingBuiltins({ createLiteralArrayConverter: (argCount) => (args) => { const /** @type {?} */ arr = literalArr(args); // Note: The old view compiler used to use an `any` type // for arrays. return this.options.fullTemplateTypeCheck ? arr : arr.cast(DYNAMIC_TYPE); }, createLiteralMapConverter: (keys) => (values) => { const /** @type {?} */ entries = keys.map((k, i) => ({ key: k.key, value: values[i], quoted: k.quoted, })); const /** @type {?} */ map = literalMap(entries); // Note: The old view compiler used to use an `any` type // for maps. return this.options.fullTemplateTypeCheck ? map : map.cast(DYNAMIC_TYPE); }, createPipeConverter: (name, argCount) => (args) => { // Note: The old view compiler used to use an `any` type // for pipes. const /** @type {?} */ pipeExpr = this.options.fullTemplateTypeCheck ? variable(this.pipeOutputVar(name)) : variable(this.getOutputVar(BuiltinTypeName.Dynamic)); return pipeExpr.callMethod('transform', args); }, }, expression.value) }; } /** * @param {?} ast * @param {?} context * @return {?} */ visitNgContent(ast, context) { } /** * @param {?} ast * @param {?} context * @return {?} */ visitText(ast, context) { } /** * @param {?} ast * @param {?} context * @return {?} */ visitDirectiveProperty(ast, context) { } /** * @param {?} ast * @param {?} context * @return {?} */ visitReference(ast, context) { } /** * @param {?} ast * @param {?} context * @return {?} */ visitVariable(ast, context) { } /** * @param {?} ast * @param {?} context * @return {?} */ visitEvent(ast, context) { } /** * @param {?} ast * @param {?} context * @return {?} */ visitElementProperty(ast, context) { } /** * @param {?} ast * @param {?} context * @return {?} */ visitAttr(ast, context) { } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ const CLASS_ATTR$1 = 'class'; const STYLE_ATTR = 'style'; const IMPLICIT_TEMPLATE_VAR = '\$implicit'; class ViewCompileResult { /** * @param {?} viewClassVar * @param {?} rendererTypeVar */ constructor(viewClassVar, rendererTypeVar) { this.viewClassVar = viewClassVar; this.rendererTypeVar = rendererTypeVar; } } class ViewCompiler { /** * @param {?} _reflector */ constructor(_reflector) { this._reflector = _reflector; } /** * @param {?} outputCtx * @param {?} component * @param {?} template * @param {?} styles * @param {?} usedPipes * @return {?} */ compileComponent(outputCtx, component, template, styles, usedPipes) { let /** @type {?} */ embeddedViewCount = 0; const /** @type {?} */ staticQueryIds = findStaticQueryIds(template); let /** @type {?} */ renderComponentVarName = /** @type {?} */ ((undefined)); if (!component.isHost) { const /** @type {?} */ template = /** @type {?} */ ((component.template)); const /** @type {?} */ customRenderData = []; if (template.animations && template.animations.length) { customRenderData.push(new LiteralMapEntry('animation', convertValueToOutputAst(outputCtx, template.animations), true)); } const /** @type {?} */ renderComponentVar = variable(rendererTypeName(component.type.reference)); renderComponentVarName = /** @type {?} */ ((renderComponentVar.name)); outputCtx.statements.push(renderComponentVar .set(importExpr(Identifiers.createRendererType2).callFn([new LiteralMapExpr([ new LiteralMapEntry('encapsulation', literal(template.encapsulation), false), new LiteralMapEntry('styles', styles, false), new LiteralMapEntry('data', new LiteralMapExpr(customRenderData), false) ])])) .toDeclStmt(importType(Identifiers.RendererType2), [StmtModifier.Final, StmtModifier.Exported])); } const /** @type {?} */ viewBuilderFactory = (parent) => { const /** @type {?} */ embeddedViewIndex = embeddedViewCount++; return new ViewBuilder$1(this._reflector, outputCtx, parent, component, embeddedViewIndex, usedPipes, staticQueryIds, viewBuilderFactory); }; const /** @type {?} */ visitor = viewBuilderFactory(null); visitor.visitAll([], template); outputCtx.statements.push(...visitor.build()); return new ViewCompileResult(visitor.viewName, renderComponentVarName); } } const LOG_VAR$1 = variable('_l'); const VIEW_VAR = variable('_v'); const CHECK_VAR = variable('_ck'); const COMP_VAR = variable('_co'); const EVENT_NAME_VAR = variable('en'); const ALLOW_DEFAULT_VAR = variable(`ad`); class ViewBuilder$1 { /** * @param {?} reflector * @param {?} outputCtx * @param {?} parent * @param {?} component * @param {?} embeddedViewIndex * @param {?} usedPipes * @param {?} staticQueryIds * @param {?} viewBuilderFactory */ constructor(reflector, outputCtx, parent, component, embeddedViewIndex, usedPipes, staticQueryIds, viewBuilderFactory) { this.reflector = reflector; this.outputCtx = outputCtx; this.parent = parent; this.component = component; this.embeddedViewIndex = embeddedViewIndex; this.usedPipes = usedPipes; this.staticQueryIds = staticQueryIds; this.viewBuilderFactory = viewBuilderFactory; this.nodes = []; this.purePipeNodeIndices = Object.create(null); this.refNodeIndices = Object.create(null); this.variables = []; this.children = []; // TODO(tbosch): The old view compiler used to use an `any` type // for the context in any embedded view. We keep this behaivor for now // to be able to introduce the new view compiler without too many errors. this.compType = this.embeddedViewIndex > 0 ? DYNAMIC_TYPE : /** @type {?} */ ((expressionType(outputCtx.importExpr(this.component.type.reference)))); this.viewName = viewClassName(this.component.type.reference, this.embeddedViewIndex); } /** * @param {?} variables * @param {?} astNodes * @return {?} */ visitAll(variables, astNodes) { this.variables = variables; // create the pipes for the pure pipes immediately, so that we know their indices. if (!this.parent) { this.usedPipes.forEach((pipe) => { if (pipe.pure) { this.purePipeNodeIndices[pipe.name] = this._createPipe(null, pipe); } }); } if (!this.parent) { const /** @type {?} */ queryIds = staticViewQueryIds(this.staticQueryIds); this.component.viewQueries.forEach((query, queryIndex) => { // Note: queries start with id 1 so we can use the number in a Bloom filter! const /** @type {?} */ queryId = queryIndex + 1; const /** @type {?} */ bindingType = query.first ? 0 /* First */ : 1; const /** @type {?} */ flags = 134217728 /* TypeViewQuery */ | calcStaticDynamicQueryFlags(queryIds, queryId, query.first); this.nodes.push(() => ({ sourceSpan: null, nodeFlags: flags, nodeDef: importExpr(Identifiers.queryDef).callFn([ literal(flags), literal(queryId), new LiteralMapExpr([new LiteralMapEntry(query.propertyName, literal(bindingType), false)]) ]) })); }); } templateVisitAll(this, astNodes); if (this.parent && (astNodes.length === 0 || needsAdditionalRootNode(astNodes))) { // if the view is an embedded view, then we need to add an additional root node in some cases this.nodes.push(() => ({ sourceSpan: null, nodeFlags: 1 /* TypeElement */, nodeDef: importExpr(Identifiers.anchorDef).callFn([ literal(0 /* None */), NULL_EXPR, NULL_EXPR, literal(0) ]) })); } } /** * @param {?=} targetStatements * @return {?} */ build(targetStatements = []) { this.children.forEach((child) => child.build(targetStatements)); const { updateRendererStmts, updateDirectivesStmts, nodeDefExprs } = this._createNodeExpressions(); const /** @type {?} */ updateRendererFn = this._createUpdateFn(updateRendererStmts); const /** @type {?} */ updateDirectivesFn = this._createUpdateFn(updateDirectivesStmts); let /** @type {?} */ viewFlags = 0; if (!this.parent && this.component.changeDetection === ChangeDetectionStrategy.OnPush) { viewFlags |= 2 /* OnPush */; } const /** @type {?} */ viewFactory = new DeclareFunctionStmt(this.viewName, [new FnParam(/** @type {?} */ ((LOG_VAR$1.name)))], [new ReturnStatement(importExpr(Identifiers.viewDef).callFn([ literal(viewFlags), literalArr(nodeDefExprs), updateDirectivesFn, updateRendererFn, ]))], importType(Identifiers.ViewDefinition), this.embeddedViewIndex === 0 ? [StmtModifier.Exported] : []); targetStatements.push(viewFactory); return targetStatements; } /** * @param {?} updateStmts * @return {?} */ _createUpdateFn(updateStmts) { let /** @type {?} */ updateFn; if (updateStmts.length > 0) { const /** @type {?} */ preStmts = []; if (!this.component.isHost && findReadVarNames(updateStmts).has(/** @type {?} */ ((COMP_VAR.name)))) { preStmts.push(COMP_VAR.set(VIEW_VAR.prop('component')).toDeclStmt(this.compType)); } updateFn = fn([ new FnParam(/** @type {?} */ ((CHECK_VAR.name)), INFERRED_TYPE), new FnParam(/** @type {?} */ ((VIEW_VAR.name)), INFERRED_TYPE) ], [...preStmts, ...updateStmts], INFERRED_TYPE); } else { updateFn = NULL_EXPR; } return updateFn; } /** * @param {?} ast * @param {?} context * @return {?} */ visitNgContent(ast, context) { // ngContentDef(ngContentIndex: number, index: number): NodeDef; this.nodes.push(() => ({ sourceSpan: ast.sourceSpan, nodeFlags: 8 /* TypeNgContent */, nodeDef: importExpr(Identifiers.ngContentDef).callFn([ literal(ast.ngContentIndex), literal(ast.index) ]) })); } /** * @param {?} ast * @param {?} context * @return {?} */ visitText(ast, context) { // Static text nodes have no check function const /** @type {?} */ checkIndex = -1; this.nodes.push(() => ({ sourceSpan: ast.sourceSpan, nodeFlags: 2 /* TypeText */, nodeDef: importExpr(Identifiers.textDef).callFn([ literal(checkIndex), literal(ast.ngContentIndex), literalArr([literal(ast.value)]), ]) })); } /** * @param {?} ast * @param {?} context * @return {?} */ visitBoundText(ast, context) { const /** @type {?} */ nodeIndex = this.nodes.length; // reserve the space in the nodeDefs array this.nodes.push(/** @type {?} */ ((null))); const /** @type {?} */ astWithSource = /** @type {?} */ (ast.value); const /** @type {?} */ inter = /** @type {?} */ (astWithSource.ast); const /** @type {?} */ updateRendererExpressions = inter.expressions.map((expr, bindingIndex) => this._preprocessUpdateExpression({ nodeIndex, bindingIndex, sourceSpan: ast.sourceSpan, context: COMP_VAR, value: expr })); // Check index is the same as the node index during compilation // They might only differ at runtime const /** @type {?} */ checkIndex = nodeIndex; this.nodes[nodeIndex] = () => ({ sourceSpan: ast.sourceSpan, nodeFlags: 2 /* TypeText */, nodeDef: importExpr(Identifiers.textDef).callFn([ literal(checkIndex), literal(ast.ngContentIndex), literalArr(inter.strings.map(s => literal(s))), ]), updateRenderer: updateRendererExpressions }); } /** * @param {?} ast * @param {?} context * @return {?} */ visitEmbeddedTemplate(ast, context) { const /** @type {?} */ nodeIndex = this.nodes.length; // reserve the space in the nodeDefs array this.nodes.push(/** @type {?} */ ((null))); const { flags, queryMatchesExpr, hostEvents } = this._visitElementOrTemplate(nodeIndex, ast); const /** @type {?} */ childVisitor = this.viewBuilderFactory(this); this.children.push(childVisitor); childVisitor.visitAll(ast.variables, ast.children); const /** @type {?} */ childCount = this.nodes.length - nodeIndex - 1; // anchorDef( // flags: NodeFlags, matchedQueries: [string, QueryValueType][], ngContentIndex: number, // childCount: number, handleEventFn?: ElementHandleEventFn, templateFactory?: // ViewDefinitionFactory): NodeDef; this.nodes[nodeIndex] = () => ({ sourceSpan: ast.sourceSpan, nodeFlags: 1 /* TypeElement */ | flags, nodeDef: importExpr(Identifiers.anchorDef).callFn([ literal(flags), queryMatchesExpr, literal(ast.ngContentIndex), literal(childCount), this._createElementHandleEventFn(nodeIndex, hostEvents), variable(childVisitor.viewName), ]) }); } /** * @param {?} ast * @param {?} context * @return {?} */ visitElement(ast, context) { const /** @type {?} */ nodeIndex = this.nodes.length; // reserve the space in the nodeDefs array so we can add children this.nodes.push(/** @type {?} */ ((null))); // Using a null element name creates an anchor. const /** @type {?} */ elName = isNgContainer(ast.name) ? null : ast.name; const { flags, usedEvents, queryMatchesExpr, hostBindings: dirHostBindings, hostEvents } = this._visitElementOrTemplate(nodeIndex, ast); let /** @type {?} */ inputDefs = []; let /** @type {?} */ updateRendererExpressions = []; let /** @type {?} */ outputDefs = []; if (elName) { const /** @type {?} */ hostBindings = ast.inputs .map((inputAst) => ({ context: /** @type {?} */ (COMP_VAR), inputAst, dirAst: /** @type {?} */ (null), })) .concat(dirHostBindings); if (hostBindings.length) { updateRendererExpressions = hostBindings.map((hostBinding, bindingIndex) => this._preprocessUpdateExpression({ context: hostBinding.context, nodeIndex, bindingIndex, sourceSpan: hostBinding.inputAst.sourceSpan, value: hostBinding.inputAst.value })); inputDefs = hostBindings.map(hostBinding => elementBindingDef(hostBinding.inputAst, hostBinding.dirAst)); } outputDefs = usedEvents.map(([target, eventName]) => literalArr([literal(target), literal(eventName)])); } templateVisitAll(this, ast.children); const /** @type {?} */ childCount = this.nodes.length - nodeIndex - 1; const /** @type {?} */ compAst = ast.directives.find(dirAst => dirAst.directive.isComponent); let /** @type {?} */ compRendererType = /** @type {?} */ (NULL_EXPR); let /** @type {?} */ compView = /** @type {?} */ (NULL_EXPR); if (compAst) { compView = this.outputCtx.importExpr(compAst.directive.componentViewType); compRendererType = this.outputCtx.importExpr(compAst.directive.rendererType); } // Check index is the same as the node index during compilation // They might only differ at runtime const /** @type {?} */ checkIndex = nodeIndex; this.nodes[nodeIndex] = () => ({ sourceSpan: ast.sourceSpan, nodeFlags: 1 /* TypeElement */ | flags, nodeDef: importExpr(Identifiers.elementDef).callFn([ literal(checkIndex), literal(flags), queryMatchesExpr, literal(ast.ngContentIndex), literal(childCount), literal(elName), elName ? fixedAttrsDef(ast) : NULL_EXPR, inputDefs.length ? literalArr(inputDefs) : NULL_EXPR, outputDefs.length ? literalArr(outputDefs) : NULL_EXPR, this._createElementHandleEventFn(nodeIndex, hostEvents), compView, compRendererType, ]), updateRenderer: updateRendererExpressions }); } /** * @param {?} nodeIndex * @param {?} ast * @return {?} */ _visitElementOrTemplate(nodeIndex, ast) { let /** @type {?} */ flags = 0; if (ast.hasViewContainer) { flags |= 16777216 /* EmbeddedViews */; } const /** @type {?} */ usedEvents = new Map(); ast.outputs.forEach((event) => { const { name, target } = elementEventNameAndTarget(event, null); usedEvents.set(elementEventFullName(target, name), [target, name]); }); ast.directives.forEach((dirAst) => { dirAst.hostEvents.forEach((event) => { const { name, target } = elementEventNameAndTarget(event, dirAst); usedEvents.set(elementEventFullName(target, name), [target, name]); }); }); const /** @type {?} */ hostBindings = []; const /** @type {?} */ hostEvents = []; this._visitComponentFactoryResolverProvider(ast.directives); ast.providers.forEach((providerAst, providerIndex) => { let /** @type {?} */ dirAst = /** @type {?} */ ((undefined)); let /** @type {?} */ dirIndex = /** @type {?} */ ((undefined)); ast.directives.forEach((localDirAst, i) => { if (localDirAst.directive.type.reference === tokenReference(providerAst.token)) { dirAst = localDirAst; dirIndex = i; } }); if (dirAst) { const { hostBindings: dirHostBindings, hostEvents: dirHostEvents } = this._visitDirective(providerAst, dirAst, dirIndex, nodeIndex, ast.references, ast.queryMatches, usedEvents, /** @type {?} */ ((this.staticQueryIds.get(/** @type {?} */ (ast))))); hostBindings.push(...dirHostBindings); hostEvents.push(...dirHostEvents); } else { this._visitProvider(providerAst, ast.queryMatches); } }); let /** @type {?} */ queryMatchExprs = []; ast.queryMatches.forEach((match) => { let /** @type {?} */ valueType = /** @type {?} */ ((undefined)); if (tokenReference(match.value) === this.reflector.resolveExternalReference(Identifiers.ElementRef)) { valueType = 0 /* ElementRef */; } else if (tokenReference(match.value) === this.reflector.resolveExternalReference(Identifiers.ViewContainerRef)) { valueType = 3 /* ViewContainerRef */; } else if (tokenReference(match.value) === this.reflector.resolveExternalReference(Identifiers.TemplateRef)) { valueType = 2 /* TemplateRef */; } if (valueType != null) { queryMatchExprs.push(literalArr([literal(match.queryId), literal(valueType)])); } }); ast.references.forEach((ref) => { let /** @type {?} */ valueType = /** @type {?} */ ((undefined)); if (!ref.value) { valueType = 1 /* RenderElement */; } else if (tokenReference(ref.value) === this.reflector.resolveExternalReference(Identifiers.TemplateRef)) { valueType = 2 /* TemplateRef */; } if (valueType != null) { this.refNodeIndices[ref.name] = nodeIndex; queryMatchExprs.push(literalArr([literal(ref.name), literal(valueType)])); } }); ast.outputs.forEach((outputAst) => { hostEvents.push({ context: COMP_VAR, eventAst: outputAst, dirAst: /** @type {?} */ ((null)) }); }); return { flags, usedEvents: Array.from(usedEvents.values()), queryMatchesExpr: queryMatchExprs.length ? literalArr(queryMatchExprs) : NULL_EXPR, hostBindings, hostEvents: hostEvents }; } /** * @param {?} providerAst * @param {?} dirAst * @param {?} directiveIndex * @param {?} elementNodeIndex * @param {?} refs * @param {?} queryMatches * @param {?} usedEvents * @param {?} queryIds * @return {?} */ _visitDirective(providerAst, dirAst, directiveIndex, elementNodeIndex, refs, queryMatches, usedEvents, queryIds) { const /** @type {?} */ nodeIndex = this.nodes.length; // reserve the space in the nodeDefs array so we can add children this.nodes.push(/** @type {?} */ ((null))); dirAst.directive.queries.forEach((query, queryIndex) => { const /** @type {?} */ queryId = dirAst.contentQueryStartId + queryIndex; const /** @type {?} */ flags = 67108864 /* TypeContentQuery */ | calcStaticDynamicQueryFlags(queryIds, queryId, query.first); const /** @type {?} */ bindingType = query.first ? 0 /* First */ : 1; this.nodes.push(() => ({ sourceSpan: dirAst.sourceSpan, nodeFlags: flags, nodeDef: importExpr(Identifiers.queryDef).callFn([ literal(flags), literal(queryId), new LiteralMapExpr([new LiteralMapEntry(query.propertyName, literal(bindingType), false)]) ]), })); }); // Note: the operation below might also create new nodeDefs, // but we don't want them to be a child of a directive, // as they might be a provider/pipe on their own. // I.e. we only allow queries as children of directives nodes. const /** @type {?} */ childCount = this.nodes.length - nodeIndex - 1; let { flags, queryMatchExprs, providerExpr, depsExpr } = this._visitProviderOrDirective(providerAst, queryMatches); refs.forEach((ref) => { if (ref.value && tokenReference(ref.value) === tokenReference(providerAst.token)) { this.refNodeIndices[ref.name] = nodeIndex; queryMatchExprs.push(literalArr([literal(ref.name), literal(4 /* Provider */)])); } }); if (dirAst.directive.isComponent) { flags |= 32768 /* Component */; } const /** @type {?} */ inputDefs = dirAst.inputs.map((inputAst, inputIndex) => { const /** @type {?} */ mapValue = literalArr([literal(inputIndex), literal(inputAst.directiveName)]); // Note: it's important to not quote the key so that we can capture renames by minifiers! return new LiteralMapEntry(inputAst.directiveName, mapValue, false); }); const /** @type {?} */ outputDefs = []; const /** @type {?} */ dirMeta = dirAst.directive; Object.keys(dirMeta.outputs).forEach((propName) => { const /** @type {?} */ eventName = dirMeta.outputs[propName]; if (usedEvents.has(eventName)) { // Note: it's important to not quote the key so that we can capture renames by minifiers! outputDefs.push(new LiteralMapEntry(propName, literal(eventName), false)); } }); let /** @type {?} */ updateDirectiveExpressions = []; if (dirAst.inputs.length || (flags & (262144 /* DoCheck */ | 65536 /* OnInit */)) > 0) { updateDirectiveExpressions = dirAst.inputs.map((input, bindingIndex) => this._preprocessUpdateExpression({ nodeIndex, bindingIndex, sourceSpan: input.sourceSpan, context: COMP_VAR, value: input.value })); } const /** @type {?} */ dirContextExpr = importExpr(Identifiers.nodeValue).callFn([VIEW_VAR, literal(nodeIndex)]); const /** @type {?} */ hostBindings = dirAst.hostProperties.map((inputAst) => ({ context: dirContextExpr, dirAst, inputAst, })); const /** @type {?} */ hostEvents = dirAst.hostEvents.map((hostEventAst) => ({ context: dirContextExpr, eventAst: hostEventAst, dirAst, })); // Check index is the same as the node index during compilation // They might only differ at runtime const /** @type {?} */ checkIndex = nodeIndex; this.nodes[nodeIndex] = () => ({ sourceSpan: dirAst.sourceSpan, nodeFlags: 16384 /* TypeDirective */ | flags, nodeDef: importExpr(Identifiers.directiveDef).callFn([ literal(checkIndex), literal(flags), queryMatchExprs.length ? literalArr(queryMatchExprs) : NULL_EXPR, literal(childCount), providerExpr, depsExpr, inputDefs.length ? new LiteralMapExpr(inputDefs) : NULL_EXPR, outputDefs.length ? new LiteralMapExpr(outputDefs) : NULL_EXPR, ]), updateDirectives: updateDirectiveExpressions, directive: dirAst.directive.type, }); return { hostBindings, hostEvents }; } /** * @param {?} providerAst * @param {?} queryMatches * @return {?} */ _visitProvider(providerAst, queryMatches) { this._addProviderNode(this._visitProviderOrDirective(providerAst, queryMatches)); } /** * @param {?} directives * @return {?} */ _visitComponentFactoryResolverProvider(directives) { const /** @type {?} */ componentDirMeta = directives.find(dirAst => dirAst.directive.isComponent); if (componentDirMeta && componentDirMeta.directive.entryComponents.length) { const { providerExpr, depsExpr, flags, tokenExpr } = componentFactoryResolverProviderDef(this.reflector, this.outputCtx, 8192 /* PrivateProvider */, componentDirMeta.directive.entryComponents); this._addProviderNode({ providerExpr, depsExpr, flags, tokenExpr, queryMatchExprs: [], sourceSpan: componentDirMeta.sourceSpan }); } } /** * @param {?} data * @return {?} */ _addProviderNode(data) { const /** @type {?} */ nodeIndex = this.nodes.length; // providerDef( // flags: NodeFlags, matchedQueries: [string, QueryValueType][], token:any, // value: any, deps: ([DepFlags, any] | any)[]): NodeDef; this.nodes.push(() => ({ sourceSpan: data.sourceSpan, nodeFlags: data.flags, nodeDef: importExpr(Identifiers.providerDef).callFn([ literal(data.flags), data.queryMatchExprs.length ? literalArr(data.queryMatchExprs) : NULL_EXPR, data.tokenExpr, data.providerExpr, data.depsExpr ]) })); } /** * @param {?} providerAst * @param {?} queryMatches * @return {?} */ _visitProviderOrDirective(providerAst, queryMatches) { let /** @type {?} */ flags = 0; let /** @type {?} */ queryMatchExprs = []; queryMatches.forEach((match) => { if (tokenReference(match.value) === tokenReference(providerAst.token)) { queryMatchExprs.push(literalArr([literal(match.queryId), literal(4 /* Provider */)])); } }); const { providerExpr, depsExpr, flags: providerFlags, tokenExpr } = providerDef(this.outputCtx, providerAst); return { flags: flags | providerFlags, queryMatchExprs, providerExpr, depsExpr, tokenExpr, sourceSpan: providerAst.sourceSpan }; } /** * @param {?} name * @return {?} */ getLocal(name) { if (name == EventHandlerVars.event.name) { return EventHandlerVars.event; } let /** @type {?} */ currViewExpr = VIEW_VAR; for (let /** @type {?} */ currBuilder = this; currBuilder; currBuilder = currBuilder.parent, currViewExpr = currViewExpr.prop('parent').cast(DYNAMIC_TYPE)) { // check references const /** @type {?} */ refNodeIndex = currBuilder.refNodeIndices[name]; if (refNodeIndex != null) { return importExpr(Identifiers.nodeValue).callFn([currViewExpr, literal(refNodeIndex)]); } // check variables const /** @type {?} */ varAst = currBuilder.variables.find((varAst) => varAst.name === name); if (varAst) { const /** @type {?} */ varValue = varAst.value || IMPLICIT_TEMPLATE_VAR; return currViewExpr.prop('context').prop(varValue); } } return null; } /** * @param {?} sourceSpan * @param {?} argCount * @return {?} */ _createLiteralArrayConverter(sourceSpan, argCount) { if (argCount === 0) { const /** @type {?} */ valueExpr = importExpr(Identifiers.EMPTY_ARRAY); return () => valueExpr; } const /** @type {?} */ checkIndex = this.nodes.length; this.nodes.push(() => ({ sourceSpan, nodeFlags: 32 /* TypePureArray */, nodeDef: importExpr(Identifiers.pureArrayDef).callFn([ literal(checkIndex), literal(argCount), ]) })); return (args) => callCheckStmt(checkIndex, args); } /** * @param {?} sourceSpan * @param {?} keys * @return {?} */ _createLiteralMapConverter(sourceSpan, keys) { if (keys.length === 0) { const /** @type {?} */ valueExpr = importExpr(Identifiers.EMPTY_MAP); return () => valueExpr; } const /** @type {?} */ map = literalMap(keys.map((e, i) => (Object.assign({}, e, { value: literal(i) })))); const /** @type {?} */ checkIndex = this.nodes.length; this.nodes.push(() => ({ sourceSpan, nodeFlags: 64 /* TypePureObject */, nodeDef: importExpr(Identifiers.pureObjectDef).callFn([ literal(checkIndex), map, ]) })); return (args) => callCheckStmt(checkIndex, args); } /** * @param {?} expression * @param {?} name * @param {?} argCount * @return {?} */ _createPipeConverter(expression, name, argCount) { const /** @type {?} */ pipe = /** @type {?} */ ((this.usedPipes.find((pipeSummary) => pipeSummary.name === name))); if (pipe.pure) { const /** @type {?} */ checkIndex = this.nodes.length; this.nodes.push(() => ({ sourceSpan: expression.sourceSpan, nodeFlags: 128 /* TypePurePipe */, nodeDef: importExpr(Identifiers.purePipeDef).callFn([ literal(checkIndex), literal(argCount), ]) })); // find underlying pipe in the component view let /** @type {?} */ compViewExpr = VIEW_VAR; let /** @type {?} */ compBuilder = this; while (compBuilder.parent) { compBuilder = compBuilder.parent; compViewExpr = compViewExpr.prop('parent').cast(DYNAMIC_TYPE); } const /** @type {?} */ pipeNodeIndex = compBuilder.purePipeNodeIndices[name]; const /** @type {?} */ pipeValueExpr = importExpr(Identifiers.nodeValue).callFn([compViewExpr, literal(pipeNodeIndex)]); return (args) => callUnwrapValue(expression.nodeIndex, expression.bindingIndex, callCheckStmt(checkIndex, [pipeValueExpr].concat(args))); } else { const /** @type {?} */ nodeIndex = this._createPipe(expression.sourceSpan, pipe); const /** @type {?} */ nodeValueExpr = importExpr(Identifiers.nodeValue).callFn([VIEW_VAR, literal(nodeIndex)]); return (args) => callUnwrapValue(expression.nodeIndex, expression.bindingIndex, nodeValueExpr.callMethod('transform', args)); } } /** * @param {?} sourceSpan * @param {?} pipe * @return {?} */ _createPipe(sourceSpan, pipe) { const /** @type {?} */ nodeIndex = this.nodes.length; let /** @type {?} */ flags = 0; pipe.type.lifecycleHooks.forEach((lifecycleHook) => { // for pipes, we only support ngOnDestroy if (lifecycleHook === LifecycleHooks.OnDestroy) { flags |= lifecycleHookToNodeFlag(lifecycleHook); } }); const /** @type {?} */ depExprs = pipe.type.diDeps.map((diDep) => depDef(this.outputCtx, diDep)); // function pipeDef( // flags: NodeFlags, ctor: any, deps: ([DepFlags, any] | any)[]): NodeDef this.nodes.push(() => ({ sourceSpan, nodeFlags: 16 /* TypePipe */, nodeDef: importExpr(Identifiers.pipeDef).callFn([ literal(flags), this.outputCtx.importExpr(pipe.type.reference), literalArr(depExprs) ]) })); return nodeIndex; } /** * For the AST in `UpdateExpression.value`: * - create nodes for pipes, literal arrays and, literal maps, * - update the AST to replace pipes, literal arrays and, literal maps with calls to check fn. * * WARNING: This might create new nodeDefs (for pipes and literal arrays and literal maps)! * @param {?} expression * @return {?} */ _preprocessUpdateExpression(expression) { return { nodeIndex: expression.nodeIndex, bindingIndex: expression.bindingIndex, sourceSpan: expression.sourceSpan, context: expression.context, value: convertPropertyBindingBuiltins({ createLiteralArrayConverter: (argCount) => this._createLiteralArrayConverter(expression.sourceSpan, argCount), createLiteralMapConverter: (keys) => this._createLiteralMapConverter(expression.sourceSpan, keys), createPipeConverter: (name, argCount) => this._createPipeConverter(expression, name, argCount) }, expression.value) }; } /** * @return {?} */ _createNodeExpressions() { const /** @type {?} */ self = this; let /** @type {?} */ updateBindingCount = 0; const /** @type {?} */ updateRendererStmts = []; const /** @type {?} */ updateDirectivesStmts = []; const /** @type {?} */ nodeDefExprs = this.nodes.map((factory, nodeIndex) => { const { nodeDef, nodeFlags, updateDirectives, updateRenderer, sourceSpan } = factory(); if (updateRenderer) { updateRendererStmts.push(...createUpdateStatements(nodeIndex, sourceSpan, updateRenderer, false)); } if (updateDirectives) { updateDirectivesStmts.push(...createUpdateStatements(nodeIndex, sourceSpan, updateDirectives, (nodeFlags & (262144 /* DoCheck */ | 65536 /* OnInit */)) > 0)); } // We use a comma expression to call the log function before // the nodeDef function, but still use the result of the nodeDef function // as the value. // Note: We only add the logger to elements / text nodes, // so we don't generate too much code. const /** @type {?} */ logWithNodeDef = nodeFlags & 3 /* CatRenderNode */ ? new CommaExpr([LOG_VAR$1.callFn([]).callFn([]), nodeDef]) : nodeDef; return applySourceSpanToExpressionIfNeeded(logWithNodeDef, sourceSpan); }); return { updateRendererStmts, updateDirectivesStmts, nodeDefExprs }; /** * @param {?} nodeIndex * @param {?} sourceSpan * @param {?} expressions * @param {?} allowEmptyExprs * @return {?} */ function createUpdateStatements(nodeIndex, sourceSpan, expressions, allowEmptyExprs) { const /** @type {?} */ updateStmts = []; const /** @type {?} */ exprs = expressions.map(({ sourceSpan, context, value }) => { const /** @type {?} */ bindingId = `${updateBindingCount++}`; const /** @type {?} */ nameResolver = context === COMP_VAR ? self : null; const { stmts, currValExpr } = convertPropertyBinding(nameResolver, context, value, bindingId, BindingForm.General); updateStmts.push(...stmts.map((stmt) => applySourceSpanToStatementIfNeeded(stmt, sourceSpan))); return applySourceSpanToExpressionIfNeeded(currValExpr, sourceSpan); }); if (expressions.length || allowEmptyExprs) { updateStmts.push(applySourceSpanToStatementIfNeeded(callCheckStmt(nodeIndex, exprs).toStmt(), sourceSpan)); } return updateStmts; } } /** * @param {?} nodeIndex * @param {?} handlers * @return {?} */ _createElementHandleEventFn(nodeIndex, handlers) { const /** @type {?} */ handleEventStmts = []; let /** @type {?} */ handleEventBindingCount = 0; handlers.forEach(({ context, eventAst, dirAst }) => { const /** @type {?} */ bindingId = `${handleEventBindingCount++}`; const /** @type {?} */ nameResolver = context === COMP_VAR ? this : null; const { stmts, allowDefault } = convertActionBinding(nameResolver, context, eventAst.handler, bindingId); const /** @type {?} */ trueStmts = stmts; if (allowDefault) { trueStmts.push(ALLOW_DEFAULT_VAR.set(allowDefault.and(ALLOW_DEFAULT_VAR)).toStmt()); } const { target: eventTarget, name: eventName } = elementEventNameAndTarget(eventAst, dirAst); const /** @type {?} */ fullEventName = elementEventFullName(eventTarget, eventName); handleEventStmts.push(applySourceSpanToStatementIfNeeded(new IfStmt(literal(fullEventName).identical(EVENT_NAME_VAR), trueStmts), eventAst.sourceSpan)); }); let /** @type {?} */ handleEventFn; if (handleEventStmts.length > 0) { const /** @type {?} */ preStmts = [ALLOW_DEFAULT_VAR.set(literal(true)).toDeclStmt(BOOL_TYPE)]; if (!this.component.isHost && findReadVarNames(handleEventStmts).has(/** @type {?} */ ((COMP_VAR.name)))) { preStmts.push(COMP_VAR.set(VIEW_VAR.prop('component')).toDeclStmt(this.compType)); } handleEventFn = fn([ new FnParam(/** @type {?} */ ((VIEW_VAR.name)), INFERRED_TYPE), new FnParam(/** @type {?} */ ((EVENT_NAME_VAR.name)), INFERRED_TYPE), new FnParam(/** @type {?} */ ((EventHandlerVars.event.name)), INFERRED_TYPE) ], [...preStmts, ...handleEventStmts, new ReturnStatement(ALLOW_DEFAULT_VAR)], INFERRED_TYPE); } else { handleEventFn = NULL_EXPR; } return handleEventFn; } /** * @param {?} ast * @param {?} context * @return {?} */ visitDirective(ast, context) { } /** * @param {?} ast * @param {?} context * @return {?} */ visitDirectiveProperty(ast, context) { } /** * @param {?} ast * @param {?} context * @return {?} */ visitReference(ast, context) { } /** * @param {?} ast * @param {?} context * @return {?} */ visitVariable(ast, context) { } /** * @param {?} ast * @param {?} context * @return {?} */ visitEvent(ast, context) { } /** * @param {?} ast * @param {?} context * @return {?} */ visitElementProperty(ast, context) { } /** * @param {?} ast * @param {?} context * @return {?} */ visitAttr(ast, context) { } } /** * @param {?} astNodes * @return {?} */ function needsAdditionalRootNode(astNodes) { const /** @type {?} */ lastAstNode = astNodes[astNodes.length - 1]; if (lastAstNode instanceof EmbeddedTemplateAst) { return lastAstNode.hasViewContainer; } if (lastAstNode instanceof ElementAst) { if (isNgContainer(lastAstNode.name) && lastAstNode.children.length) { return needsAdditionalRootNode(lastAstNode.children); } return lastAstNode.hasViewContainer; } return lastAstNode instanceof NgContentAst; } /** * @param {?} inputAst * @param {?} dirAst * @return {?} */ function elementBindingDef(inputAst, dirAst) { switch (inputAst.type) { case PropertyBindingType.Attribute: return literalArr([ literal(1 /* TypeElementAttribute */), literal(inputAst.name), literal(inputAst.securityContext) ]); case PropertyBindingType.Property: return literalArr([ literal(8 /* TypeProperty */), literal(inputAst.name), literal(inputAst.securityContext) ]); case PropertyBindingType.Animation: const /** @type {?} */ bindingType = 8 /* TypeProperty */ | (dirAst && dirAst.directive.isComponent ? 32 /* SyntheticHostProperty */ : 16 /* SyntheticProperty */); return literalArr([ literal(bindingType), literal('@' + inputAst.name), literal(inputAst.securityContext) ]); case PropertyBindingType.Class: return literalArr([literal(2 /* TypeElementClass */), literal(inputAst.name), NULL_EXPR]); case PropertyBindingType.Style: return literalArr([ literal(4 /* TypeElementStyle */), literal(inputAst.name), literal(inputAst.unit) ]); } } /** * @param {?} elementAst * @return {?} */ function fixedAttrsDef(elementAst) { const /** @type {?} */ mapResult = Object.create(null); elementAst.attrs.forEach(attrAst => { mapResult[attrAst.name] = attrAst.value; }); elementAst.directives.forEach(dirAst => { Object.keys(dirAst.directive.hostAttributes).forEach(name => { const /** @type {?} */ value = dirAst.directive.hostAttributes[name]; const /** @type {?} */ prevValue = mapResult[name]; mapResult[name] = prevValue != null ? mergeAttributeValue(name, prevValue, value) : value; }); }); // Note: We need to sort to get a defined output order // for tests and for caching generated artifacts... return literalArr(Object.keys(mapResult).sort().map((attrName) => literalArr([literal(attrName), literal(mapResult[attrName])]))); } /** * @param {?} attrName * @param {?} attrValue1 * @param {?} attrValue2 * @return {?} */ function mergeAttributeValue(attrName, attrValue1, attrValue2) { if (attrName == CLASS_ATTR$1 || attrName == STYLE_ATTR) { return `${attrValue1} ${attrValue2}`; } else { return attrValue2; } } /** * @param {?} nodeIndex * @param {?} exprs * @return {?} */ function callCheckStmt(nodeIndex, exprs) { if (exprs.length > 10) { return CHECK_VAR.callFn([VIEW_VAR, literal(nodeIndex), literal(1 /* Dynamic */), literalArr(exprs)]); } else { return CHECK_VAR.callFn([VIEW_VAR, literal(nodeIndex), literal(0 /* Inline */), ...exprs]); } } /** * @param {?} nodeIndex * @param {?} bindingIdx * @param {?} expr * @return {?} */ function callUnwrapValue(nodeIndex, bindingIdx, expr) { return importExpr(Identifiers.unwrapValue).callFn([ VIEW_VAR, literal(nodeIndex), literal(bindingIdx), expr ]); } /** * @param {?} nodes * @param {?=} result * @return {?} */ function findStaticQueryIds(nodes, result = new Map()) { nodes.forEach((node) => { const /** @type {?} */ staticQueryIds = new Set(); const /** @type {?} */ dynamicQueryIds = new Set(); let /** @type {?} */ queryMatches = /** @type {?} */ ((undefined)); if (node instanceof ElementAst) { findStaticQueryIds(node.children, result); node.children.forEach((child) => { const /** @type {?} */ childData = /** @type {?} */ ((result.get(child))); childData.staticQueryIds.forEach(queryId => staticQueryIds.add(queryId)); childData.dynamicQueryIds.forEach(queryId => dynamicQueryIds.add(queryId)); }); queryMatches = node.queryMatches; } else if (node instanceof EmbeddedTemplateAst) { findStaticQueryIds(node.children, result); node.children.forEach((child) => { const /** @type {?} */ childData = /** @type {?} */ ((result.get(child))); childData.staticQueryIds.forEach(queryId => dynamicQueryIds.add(queryId)); childData.dynamicQueryIds.forEach(queryId => dynamicQueryIds.add(queryId)); }); queryMatches = node.queryMatches; } if (queryMatches) { queryMatches.forEach((match) => staticQueryIds.add(match.queryId)); } dynamicQueryIds.forEach(queryId => staticQueryIds.delete(queryId)); result.set(node, { staticQueryIds, dynamicQueryIds }); }); return result; } /** * @param {?} nodeStaticQueryIds * @return {?} */ function staticViewQueryIds(nodeStaticQueryIds) { const /** @type {?} */ staticQueryIds = new Set(); const /** @type {?} */ dynamicQueryIds = new Set(); Array.from(nodeStaticQueryIds.values()).forEach((entry) => { entry.staticQueryIds.forEach(queryId => staticQueryIds.add(queryId)); entry.dynamicQueryIds.forEach(queryId => dynamicQueryIds.add(queryId)); }); dynamicQueryIds.forEach(queryId => staticQueryIds.delete(queryId)); return { staticQueryIds, dynamicQueryIds }; } /** * @param {?} eventAst * @param {?} dirAst * @return {?} */ function elementEventNameAndTarget(eventAst, dirAst) { if (eventAst.isAnimation) { return { name: `@${eventAst.name}.${eventAst.phase}`, target: dirAst && dirAst.directive.isComponent ? 'component' : null }; } else { return eventAst; } } /** * @param {?} queryIds * @param {?} queryId * @param {?} isFirst * @return {?} */ function calcStaticDynamicQueryFlags(queryIds, queryId, isFirst) { let /** @type {?} */ flags = 0; // Note: We only make queries static that query for a single item. // This is because of backwards compatibility with the old view compiler... if (isFirst && (queryIds.staticQueryIds.has(queryId) || !queryIds.dynamicQueryIds.has(queryId))) { flags |= 268435456 /* StaticQuery */; } else { flags |= 536870912 /* DynamicQuery */; } return flags; } /** * @param {?} target * @param {?} name * @return {?} */ function elementEventFullName(target, name) { return target ? `${target}:${name}` : name; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * A container for message extracted from the templates. */ class MessageBundle { /** * @param {?} _htmlParser * @param {?} _implicitTags * @param {?} _implicitAttrs * @param {?=} _locale */ constructor(_htmlParser, _implicitTags, _implicitAttrs, _locale = null) { this._htmlParser = _htmlParser; this._implicitTags = _implicitTags; this._implicitAttrs = _implicitAttrs; this._locale = _locale; this._messages = []; } /** * @param {?} html * @param {?} url * @param {?} interpolationConfig * @return {?} */ updateFromTemplate(html, url, interpolationConfig) { const /** @type {?} */ htmlParserResult = this._htmlParser.parse(html, url, true, interpolationConfig); if (htmlParserResult.errors.length) { return htmlParserResult.errors; } const /** @type {?} */ i18nParserResult = extractMessages(htmlParserResult.rootNodes, interpolationConfig, this._implicitTags, this._implicitAttrs); if (i18nParserResult.errors.length) { return i18nParserResult.errors; } this._messages.push(...i18nParserResult.messages); return []; } /** * @return {?} */ getMessages() { return this._messages; } /** * @param {?} serializer * @param {?=} filterSources * @return {?} */ write(serializer, filterSources) { const /** @type {?} */ messages = {}; const /** @type {?} */ mapperVisitor = new MapPlaceholderNames(); // Deduplicate messages based on their ID this._messages.forEach(message => { const /** @type {?} */ id = serializer.digest(message); if (!messages.hasOwnProperty(id)) { messages[id] = message; } else { messages[id].sources.push(...message.sources); } }); // Transform placeholder names using the serializer mapping const /** @type {?} */ msgList = Object.keys(messages).map(id => { const /** @type {?} */ mapper = serializer.createNameMapper(messages[id]); const /** @type {?} */ src = messages[id]; const /** @type {?} */ nodes = mapper ? mapperVisitor.convert(src.nodes, mapper) : src.nodes; let /** @type {?} */ transformedMessage = new Message(nodes, {}, {}, src.meaning, src.description, id); transformedMessage.sources = src.sources; if (filterSources) { transformedMessage.sources.forEach((source) => source.filePath = filterSources(source.filePath)); } return transformedMessage; }); return serializer.write(msgList, this._locale); } } class MapPlaceholderNames extends CloneVisitor { /** * @param {?} nodes * @param {?} mapper * @return {?} */ convert(nodes, mapper) { return mapper ? nodes.map(n => n.visit(this, mapper)) : nodes; } /** * @param {?} ph * @param {?} mapper * @return {?} */ visitTagPlaceholder(ph, mapper) { const /** @type {?} */ startName = /** @type {?} */ ((mapper.toPublicName(ph.startName))); const /** @type {?} */ closeName = ph.closeName ? /** @type {?} */ ((mapper.toPublicName(ph.closeName))) : ph.closeName; const /** @type {?} */ children = ph.children.map(n => n.visit(this, mapper)); return new TagPlaceholder(ph.tag, ph.attrs, startName, closeName, children, ph.isVoid, ph.sourceSpan); } /** * @param {?} ph * @param {?} mapper * @return {?} */ visitPlaceholder(ph, mapper) { return new Placeholder(ph.value, /** @type {?} */ ((mapper.toPublicName(ph.name))), ph.sourceSpan); } /** * @param {?} ph * @param {?} mapper * @return {?} */ visitIcuPlaceholder(ph, mapper) { return new IcuPlaceholder(ph.value, /** @type {?} */ ((mapper.toPublicName(ph.name))), ph.sourceSpan); } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ class GeneratedFile { /** * @param {?} srcFileUrl * @param {?} genFileUrl * @param {?} sourceOrStmts */ constructor(srcFileUrl, genFileUrl, sourceOrStmts) { this.srcFileUrl = srcFileUrl; this.genFileUrl = genFileUrl; if (typeof sourceOrStmts === 'string') { this.source = sourceOrStmts; this.stmts = null; } else { this.source = null; this.stmts = sourceOrStmts; } } /** * @param {?} other * @return {?} */ isEquivalent(other) { if (this.genFileUrl !== other.genFileUrl) { return false; } if (this.source) { return this.source === other.source; } if (other.stmts == null) { return false; } // Note: the constructor guarantees that if this.source is not filled, // then this.stmts is. return areAllEquivalent(/** @type {?} */ ((this.stmts)), /** @type {?} */ ((other.stmts))); } } /** * @param {?} file * @param {?=} preamble * @return {?} */ function toTypeScript(file, preamble = '') { if (!file.stmts) { throw new Error(`Illegal state: No stmts present on GeneratedFile ${file.genFileUrl}`); } return new TypeScriptEmitter().emitStatements(file.genFileUrl, file.stmts, preamble); } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @record */ /** * @param {?} moduleMeta * @param {?} reflector * @return {?} */ function listLazyRoutes(moduleMeta, reflector) { const /** @type {?} */ allLazyRoutes = []; for (const { provider, module } of moduleMeta.transitiveModule.providers) { if (tokenReference(provider.token) === reflector.ROUTES) { const /** @type {?} */ loadChildren = _collectLoadChildren(provider.useValue); for (const /** @type {?} */ route of loadChildren) { allLazyRoutes.push(parseLazyRoute(route, reflector, module.reference)); } } } return allLazyRoutes; } /** * @param {?} routes * @param {?=} target * @return {?} */ function _collectLoadChildren(routes, target = []) { if (typeof routes === 'string') { target.push(routes); } else if (Array.isArray(routes)) { for (const /** @type {?} */ route of routes) { _collectLoadChildren(route, target); } } else if (routes.loadChildren) { _collectLoadChildren(routes.loadChildren, target); } else if (routes.children) { _collectLoadChildren(routes.children, target); } return target; } /** * @param {?} route * @param {?} reflector * @param {?=} module * @return {?} */ function parseLazyRoute(route, reflector, module) { const [routePath, routeName] = route.split('#'); const /** @type {?} */ referencedModule = reflector.resolveExternalReference({ moduleName: routePath, name: routeName, }, module ? module.filePath : undefined); return { route: route, module: module || referencedModule, referencedModule }; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ class ResolvedStaticSymbol { /** * @param {?} symbol * @param {?} metadata */ constructor(symbol, metadata) { this.symbol = symbol; this.metadata = metadata; } } /** * The host of the SymbolResolverHost disconnects the implementation from TypeScript / other * language * services and from underlying file systems. * @record */ const SUPPORTED_SCHEMA_VERSION = 4; /** * This class is responsible for loading metadata per symbol, * and normalizing references between symbols. * * Internally, it only uses symbols without members, * and deduces the values for symbols with members based * on these symbols. */ class StaticSymbolResolver { /** * @param {?} host * @param {?} staticSymbolCache * @param {?} summaryResolver * @param {?=} errorRecorder */ constructor(host, staticSymbolCache, summaryResolver, errorRecorder) { this.host = host; this.staticSymbolCache = staticSymbolCache; this.summaryResolver = summaryResolver; this.errorRecorder = errorRecorder; this.metadataCache = new Map(); this.resolvedSymbols = new Map(); this.resolvedFilePaths = new Set(); this.importAs = new Map(); this.symbolResourcePaths = new Map(); this.symbolFromFile = new Map(); this.knownFileNameToModuleNames = new Map(); } /** * @param {?} staticSymbol * @return {?} */ resolveSymbol(staticSymbol) { if (staticSymbol.members.length > 0) { return /** @type {?} */ ((this._resolveSymbolMembers(staticSymbol))); } // Note: always ask for a summary first, // as we might have read shallow metadata via a .d.ts file // for the symbol. const /** @type {?} */ resultFromSummary = /** @type {?} */ ((this._resolveSymbolFromSummary(staticSymbol))); if (resultFromSummary) { return resultFromSummary; } const /** @type {?} */ resultFromCache = this.resolvedSymbols.get(staticSymbol); if (resultFromCache) { return resultFromCache; } // Note: Some users use libraries that were not compiled with ngc, i.e. they don't // have summaries, only .d.ts files. So we always need to check both, the summary // and metadata. this._createSymbolsOf(staticSymbol.filePath); return /** @type {?} */ ((this.resolvedSymbols.get(staticSymbol))); } /** * getImportAs produces a symbol that can be used to import the given symbol. * The import might be different than the symbol if the symbol is exported from * a library with a summary; in which case we want to import the symbol from the * ngfactory re-export instead of directly to avoid introducing a direct dependency * on an otherwise indirect dependency. * * @param {?} staticSymbol the symbol for which to generate a import symbol * @param {?=} useSummaries * @return {?} */ getImportAs(staticSymbol, useSummaries = true) { if (staticSymbol.members.length) { const /** @type {?} */ baseSymbol = this.getStaticSymbol(staticSymbol.filePath, staticSymbol.name); const /** @type {?} */ baseImportAs = this.getImportAs(baseSymbol, useSummaries); return baseImportAs ? this.getStaticSymbol(baseImportAs.filePath, baseImportAs.name, staticSymbol.members) : null; } const /** @type {?} */ summarizedFileName = stripSummaryForJitFileSuffix(staticSymbol.filePath); if (summarizedFileName !== staticSymbol.filePath) { const /** @type {?} */ summarizedName = stripSummaryForJitNameSuffix(staticSymbol.name); const /** @type {?} */ baseSymbol = this.getStaticSymbol(summarizedFileName, summarizedName, staticSymbol.members); const /** @type {?} */ baseImportAs = this.getImportAs(baseSymbol, useSummaries); return baseImportAs ? this.getStaticSymbol(summaryForJitFileName(baseImportAs.filePath), summaryForJitName(baseImportAs.name), baseSymbol.members) : null; } let /** @type {?} */ result = (useSummaries && this.summaryResolver.getImportAs(staticSymbol)) || null; if (!result) { result = /** @type {?} */ ((this.importAs.get(staticSymbol))); } return result; } /** * getResourcePath produces the path to the original location of the symbol and should * be used to determine the relative location of resource references recorded in * symbol metadata. * @param {?} staticSymbol * @return {?} */ getResourcePath(staticSymbol) { return this.symbolResourcePaths.get(staticSymbol) || staticSymbol.filePath; } /** * getTypeArity returns the number of generic type parameters the given symbol * has. If the symbol is not a type the result is null. * @param {?} staticSymbol * @return {?} */ getTypeArity(staticSymbol) { // If the file is a factory/ngsummary file, don't resolve the symbol as doing so would // cause the metadata for an factory/ngsummary file to be loaded which doesn't exist. // All references to generated classes must include the correct arity whenever // generating code. if (isGeneratedFile(staticSymbol.filePath)) { return null; } let /** @type {?} */ resolvedSymbol = unwrapResolvedMetadata(this.resolveSymbol(staticSymbol)); while (resolvedSymbol && resolvedSymbol.metadata instanceof StaticSymbol) { resolvedSymbol = unwrapResolvedMetadata(this.resolveSymbol(resolvedSymbol.metadata)); } return (resolvedSymbol && resolvedSymbol.metadata && resolvedSymbol.metadata.arity) || null; } /** * @param {?} filePath * @return {?} */ getKnownModuleName(filePath) { return this.knownFileNameToModuleNames.get(filePath) || null; } /** * @param {?} sourceSymbol * @param {?} targetSymbol * @return {?} */ recordImportAs(sourceSymbol, targetSymbol) { sourceSymbol.assertNoMembers(); targetSymbol.assertNoMembers(); this.importAs.set(sourceSymbol, targetSymbol); } /** * @param {?} fileName * @param {?} moduleName * @return {?} */ recordModuleNameForFileName(fileName, moduleName) { this.knownFileNameToModuleNames.set(fileName, moduleName); } /** * Invalidate all information derived from the given file. * * @param {?} fileName the file to invalidate * @return {?} */ invalidateFile(fileName) { this.metadataCache.delete(fileName); this.resolvedFilePaths.delete(fileName); const /** @type {?} */ symbols = this.symbolFromFile.get(fileName); if (symbols) { this.symbolFromFile.delete(fileName); for (const /** @type {?} */ symbol of symbols) { this.resolvedSymbols.delete(symbol); this.importAs.delete(symbol); this.symbolResourcePaths.delete(symbol); } } } /** * @template T * @param {?} cb * @return {?} */ ignoreErrorsFor(cb) { const /** @type {?} */ recorder = this.errorRecorder; this.errorRecorder = () => { }; try { return cb(); } finally { this.errorRecorder = recorder; } } /** * @param {?} staticSymbol * @return {?} */ _resolveSymbolMembers(staticSymbol) { const /** @type {?} */ members = staticSymbol.members; const /** @type {?} */ baseResolvedSymbol = this.resolveSymbol(this.getStaticSymbol(staticSymbol.filePath, staticSymbol.name)); if (!baseResolvedSymbol) { return null; } let /** @type {?} */ baseMetadata = unwrapResolvedMetadata(baseResolvedSymbol.metadata); if (baseMetadata instanceof StaticSymbol) { return new ResolvedStaticSymbol(staticSymbol, this.getStaticSymbol(baseMetadata.filePath, baseMetadata.name, members)); } else if (baseMetadata && baseMetadata.__symbolic === 'class') { if (baseMetadata.statics && members.length === 1) { return new ResolvedStaticSymbol(staticSymbol, baseMetadata.statics[members[0]]); } } else { let /** @type {?} */ value = baseMetadata; for (let /** @type {?} */ i = 0; i < members.length && value; i++) { value = value[members[i]]; } return new ResolvedStaticSymbol(staticSymbol, value); } return null; } /** * @param {?} staticSymbol * @return {?} */ _resolveSymbolFromSummary(staticSymbol) { const /** @type {?} */ summary = this.summaryResolver.resolveSummary(staticSymbol); return summary ? new ResolvedStaticSymbol(staticSymbol, summary.metadata) : null; } /** * getStaticSymbol produces a Type whose metadata is known but whose implementation is not loaded. * All types passed to the StaticResolver should be pseudo-types returned by this method. * * @param {?} declarationFile the absolute path of the file where the symbol is declared * @param {?} name the name of the type. * @param {?=} members a symbol for a static member of the named type * @return {?} */ getStaticSymbol(declarationFile, name, members) { return this.staticSymbolCache.get(declarationFile, name, members); } /** * hasDecorators checks a file's metadata for the presense of decorators without evalutating the * metadata. * * @param {?} filePath the absolute path to examine for decorators. * @return {?} true if any class in the file has a decorator. */ hasDecorators(filePath) { const /** @type {?} */ metadata = this.getModuleMetadata(filePath); if (metadata['metadata']) { return Object.keys(metadata['metadata']).some((metadataKey) => { const /** @type {?} */ entry = metadata['metadata'][metadataKey]; return entry && entry.__symbolic === 'class' && entry.decorators; }); } return false; } /** * @param {?} filePath * @return {?} */ getSymbolsOf(filePath) { const /** @type {?} */ summarySymbols = this.summaryResolver.getSymbolsOf(filePath); if (summarySymbols) { return summarySymbols; } // Note: Some users use libraries that were not compiled with ngc, i.e. they don't // have summaries, only .d.ts files, but `summaryResolver.isLibraryFile` returns true. this._createSymbolsOf(filePath); const /** @type {?} */ metadataSymbols = []; this.resolvedSymbols.forEach((resolvedSymbol) => { if (resolvedSymbol.symbol.filePath === filePath) { metadataSymbols.push(resolvedSymbol.symbol); } }); return metadataSymbols; } /** * @param {?} filePath * @return {?} */ _createSymbolsOf(filePath) { if (this.resolvedFilePaths.has(filePath)) { return; } this.resolvedFilePaths.add(filePath); const /** @type {?} */ resolvedSymbols = []; const /** @type {?} */ metadata = this.getModuleMetadata(filePath); if (metadata['importAs']) { // Index bundle indices should use the importAs module name defined // in the bundle. this.knownFileNameToModuleNames.set(filePath, metadata['importAs']); } // handle the symbols in one of the re-export location if (metadata['exports']) { for (const /** @type {?} */ moduleExport of metadata['exports']) { // handle the symbols in the list of explicitly re-exported symbols. if (moduleExport.export) { moduleExport.export.forEach((exportSymbol) => { let /** @type {?} */ symbolName; if (typeof exportSymbol === 'string') { symbolName = exportSymbol; } else { symbolName = exportSymbol.as; } symbolName = unescapeIdentifier(symbolName); let /** @type {?} */ symName = symbolName; if (typeof exportSymbol !== 'string') { symName = unescapeIdentifier(exportSymbol.name); } const /** @type {?} */ resolvedModule = this.resolveModule(moduleExport.from, filePath); if (resolvedModule) { const /** @type {?} */ targetSymbol = this.getStaticSymbol(resolvedModule, symName); const /** @type {?} */ sourceSymbol = this.getStaticSymbol(filePath, symbolName); resolvedSymbols.push(this.createExport(sourceSymbol, targetSymbol)); } }); } else { // handle the symbols via export * directives. const /** @type {?} */ resolvedModule = this.resolveModule(moduleExport.from, filePath); if (resolvedModule) { const /** @type {?} */ nestedExports = this.getSymbolsOf(resolvedModule); nestedExports.forEach((targetSymbol) => { const /** @type {?} */ sourceSymbol = this.getStaticSymbol(filePath, targetSymbol.name); resolvedSymbols.push(this.createExport(sourceSymbol, targetSymbol)); }); } } } } // handle the actual metadata. Has to be after the exports // as there migth be collisions in the names, and we want the symbols // of the current module to win ofter reexports. if (metadata['metadata']) { // handle direct declarations of the symbol const /** @type {?} */ topLevelSymbolNames = new Set(Object.keys(metadata['metadata']).map(unescapeIdentifier)); const /** @type {?} */ origins = metadata['origins'] || {}; Object.keys(metadata['metadata']).forEach((metadataKey) => { const /** @type {?} */ symbolMeta = metadata['metadata'][metadataKey]; const /** @type {?} */ name = unescapeIdentifier(metadataKey); const /** @type {?} */ symbol = this.getStaticSymbol(filePath, name); const /** @type {?} */ origin = origins.hasOwnProperty(metadataKey) && origins[metadataKey]; if (origin) { // If the symbol is from a bundled index, use the declaration location of the // symbol so relative references (such as './my.html') will be calculated // correctly. const /** @type {?} */ originFilePath = this.resolveModule(origin, filePath); if (!originFilePath) { this.reportError(new Error(`Couldn't resolve original symbol for ${origin} from ${filePath}`)); } else { this.symbolResourcePaths.set(symbol, originFilePath); } } resolvedSymbols.push(this.createResolvedSymbol(symbol, filePath, topLevelSymbolNames, symbolMeta)); }); } resolvedSymbols.forEach((resolvedSymbol) => this.resolvedSymbols.set(resolvedSymbol.symbol, resolvedSymbol)); this.symbolFromFile.set(filePath, resolvedSymbols.map(resolvedSymbol => resolvedSymbol.symbol)); } /** * @param {?} sourceSymbol * @param {?} topLevelPath * @param {?} topLevelSymbolNames * @param {?} metadata * @return {?} */ createResolvedSymbol(sourceSymbol, topLevelPath, topLevelSymbolNames, metadata) { // For classes that don't have Angular summaries / metadata, // we only keep their arity, but nothing else // (e.g. their constructor parameters). // We do this to prevent introducing deep imports // as we didn't generate .ngfactory.ts files with proper reexports. if (this.summaryResolver.isLibraryFile(sourceSymbol.filePath) && metadata && metadata['__symbolic'] === 'class') { const /** @type {?} */ transformedMeta = { __symbolic: 'class', arity: metadata.arity }; return new ResolvedStaticSymbol(sourceSymbol, transformedMeta); } let /** @type {?} */ _originalFileMemo; const /** @type {?} */ getOriginalName = () => { if (!_originalFileMemo) { // Guess what hte original file name is from the reference. If it has a `.d.ts` extension // replace it with `.ts`. If it already has `.ts` just leave it in place. If it doesn't have // .ts or .d.ts, append `.ts'. Also, if it is in `node_modules`, trim the `node_module` // location as it is not important to finding the file. _originalFileMemo = this.host.getOutputName(topLevelPath.replace(/((\.ts)|(\.d\.ts)|)$/, '.ts') .replace(/^.*node_modules[/\\]/, '')); } return _originalFileMemo; }; const /** @type {?} */ self = this; class ReferenceTransformer extends ValueTransformer { /** * @param {?} map * @param {?} functionParams * @return {?} */ visitStringMap(map, functionParams) { const /** @type {?} */ symbolic = map['__symbolic']; if (symbolic === 'function') { const /** @type {?} */ oldLen = functionParams.length; functionParams.push(...(map['parameters'] || [])); const /** @type {?} */ result = super.visitStringMap(map, functionParams); functionParams.length = oldLen; return result; } else if (symbolic === 'reference') { const /** @type {?} */ module = map['module']; const /** @type {?} */ name = map['name'] ? unescapeIdentifier(map['name']) : map['name']; if (!name) { return null; } let /** @type {?} */ filePath; if (module) { filePath = /** @type {?} */ ((self.resolveModule(module, sourceSymbol.filePath))); if (!filePath) { return { __symbolic: 'error', message: `Could not resolve ${module} relative to ${sourceSymbol.filePath}.`, line: map["line"], character: map["character"], fileName: getOriginalName() }; } return { __symbolic: 'resolved', symbol: self.getStaticSymbol(filePath, name), line: map["line"], character: map["character"], fileName: getOriginalName() }; } else if (functionParams.indexOf(name) >= 0) { // reference to a function parameter return { __symbolic: 'reference', name: name }; } else { if (topLevelSymbolNames.has(name)) { return self.getStaticSymbol(topLevelPath, name); } // ambient value null; } } else if (symbolic === 'error') { return Object.assign({}, map, { fileName: getOriginalName() }); } else { return super.visitStringMap(map, functionParams); } } } const /** @type {?} */ transformedMeta = visitValue(metadata, new ReferenceTransformer(), []); let /** @type {?} */ unwrappedTransformedMeta = unwrapResolvedMetadata(transformedMeta); if (unwrappedTransformedMeta instanceof StaticSymbol) { return this.createExport(sourceSymbol, unwrappedTransformedMeta); } return new ResolvedStaticSymbol(sourceSymbol, transformedMeta); } /** * @param {?} sourceSymbol * @param {?} targetSymbol * @return {?} */ createExport(sourceSymbol, targetSymbol) { sourceSymbol.assertNoMembers(); targetSymbol.assertNoMembers(); if (this.summaryResolver.isLibraryFile(sourceSymbol.filePath) && this.summaryResolver.isLibraryFile(targetSymbol.filePath)) { // This case is for an ng library importing symbols from a plain ts library // transitively. // Note: We rely on the fact that we discover symbols in the direction // from source files to library files this.importAs.set(targetSymbol, this.getImportAs(sourceSymbol) || sourceSymbol); } return new ResolvedStaticSymbol(sourceSymbol, targetSymbol); } /** * @param {?} error * @param {?=} context * @param {?=} path * @return {?} */ reportError(error, context, path) { if (this.errorRecorder) { this.errorRecorder(error, (context && context.filePath) || path); } else { throw error; } } /** * @param {?} module an absolute path to a module file. * @return {?} */ getModuleMetadata(module) { let /** @type {?} */ moduleMetadata = this.metadataCache.get(module); if (!moduleMetadata) { const /** @type {?} */ moduleMetadatas = this.host.getMetadataFor(module); if (moduleMetadatas) { let /** @type {?} */ maxVersion = -1; moduleMetadatas.forEach((md) => { if (md && md['version'] > maxVersion) { maxVersion = md['version']; moduleMetadata = md; } }); } if (!moduleMetadata) { moduleMetadata = { __symbolic: 'module', version: SUPPORTED_SCHEMA_VERSION, module: module, metadata: {} }; } if (moduleMetadata['version'] != SUPPORTED_SCHEMA_VERSION) { const /** @type {?} */ errorMessage = moduleMetadata['version'] == 2 ? `Unsupported metadata version ${moduleMetadata['version']} for module ${module}. This module should be compiled with a newer version of ngc` : `Metadata version mismatch for module ${module}, found version ${moduleMetadata['version']}, expected ${SUPPORTED_SCHEMA_VERSION}`; this.reportError(new Error(errorMessage)); } this.metadataCache.set(module, moduleMetadata); } return moduleMetadata; } /** * @param {?} module * @param {?} symbolName * @param {?=} containingFile * @return {?} */ getSymbolByModule(module, symbolName, containingFile) { const /** @type {?} */ filePath = this.resolveModule(module, containingFile); if (!filePath) { this.reportError(new Error(`Could not resolve module ${module}${containingFile ? ' relative to ' + containingFile : ''}`)); return this.getStaticSymbol(`ERROR:${module}`, symbolName); } return this.getStaticSymbol(filePath, symbolName); } /** * @param {?} module * @param {?=} containingFile * @return {?} */ resolveModule(module, containingFile) { try { return this.host.moduleNameToFileName(module, containingFile); } catch (/** @type {?} */ e) { console.error(`Could not resolve module '${module}' relative to file ${containingFile}`); this.reportError(e, undefined, containingFile); } return null; } } /** * @param {?} identifier * @return {?} */ function unescapeIdentifier(identifier) { return identifier.startsWith('___') ? identifier.substr(1) : identifier; } /** * @param {?} metadata * @return {?} */ function unwrapResolvedMetadata(metadata) { if (metadata && metadata.__symbolic === 'resolved') { return metadata.symbol; } return metadata; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @param {?} srcFileName * @param {?} forJitCtx * @param {?} summaryResolver * @param {?} symbolResolver * @param {?} symbols * @param {?} types * @return {?} */ function serializeSummaries(srcFileName, forJitCtx, summaryResolver, symbolResolver, symbols, types) { const /** @type {?} */ toJsonSerializer = new ToJsonSerializer(symbolResolver, summaryResolver, srcFileName); // for symbols, we use everything except for the class metadata itself // (we keep the statics though), as the class metadata is contained in the // CompileTypeSummary. symbols.forEach((resolvedSymbol) => toJsonSerializer.addSummary({ symbol: resolvedSymbol.symbol, metadata: resolvedSymbol.metadata })); // Add type summaries. types.forEach(({ summary, metadata }) => { toJsonSerializer.addSummary({ symbol: summary.type.reference, metadata: undefined, type: summary }); }); const { json, exportAs } = toJsonSerializer.serialize(); if (forJitCtx) { const /** @type {?} */ forJitSerializer = new ForJitSerializer(forJitCtx, symbolResolver, summaryResolver); types.forEach(({ summary, metadata }) => { forJitSerializer.addSourceType(summary, metadata); }); toJsonSerializer.unprocessedSymbolSummariesBySymbol.forEach((summary) => { if (summaryResolver.isLibraryFile(summary.symbol.filePath) && summary.type) { forJitSerializer.addLibType(summary.type); } }); forJitSerializer.serialize(exportAs); } return { json, exportAs }; } /** * @param {?} symbolCache * @param {?} summaryResolver * @param {?} libraryFileName * @param {?} json * @return {?} */ function deserializeSummaries(symbolCache, summaryResolver, libraryFileName, json) { const /** @type {?} */ deserializer = new FromJsonDeserializer(symbolCache, summaryResolver); return deserializer.deserialize(libraryFileName, json); } /** * @param {?} outputCtx * @param {?} reference * @return {?} */ function createForJitStub(outputCtx, reference) { return createSummaryForJitFunction(outputCtx, reference, NULL_EXPR); } /** * @param {?} outputCtx * @param {?} reference * @param {?} value * @return {?} */ function createSummaryForJitFunction(outputCtx, reference, value) { const /** @type {?} */ fnName = summaryForJitName(reference.name); outputCtx.statements.push(fn([], [new ReturnStatement(value)], new ArrayType(DYNAMIC_TYPE)).toDeclStmt(fnName, [ StmtModifier.Final, StmtModifier.Exported ])); } class ToJsonSerializer extends ValueTransformer { /** * @param {?} symbolResolver * @param {?} summaryResolver * @param {?} srcFileName */ constructor(symbolResolver, summaryResolver, srcFileName) { super(); this.symbolResolver = symbolResolver; this.summaryResolver = summaryResolver; this.srcFileName = srcFileName; this.symbols = []; this.indexBySymbol = new Map(); this.reexportedBy = new Map(); this.processedSummaryBySymbol = new Map(); this.processedSummaries = []; this.unprocessedSymbolSummariesBySymbol = new Map(); this.moduleName = symbolResolver.getKnownModuleName(srcFileName); } /** * @param {?} summary * @return {?} */ addSummary(summary) { let /** @type {?} */ unprocessedSummary = this.unprocessedSymbolSummariesBySymbol.get(summary.symbol); let /** @type {?} */ processedSummary = this.processedSummaryBySymbol.get(summary.symbol); if (!unprocessedSummary) { unprocessedSummary = { symbol: summary.symbol, metadata: undefined }; this.unprocessedSymbolSummariesBySymbol.set(summary.symbol, unprocessedSummary); processedSummary = { symbol: this.processValue(summary.symbol, 0 /* None */) }; this.processedSummaries.push(processedSummary); this.processedSummaryBySymbol.set(summary.symbol, processedSummary); } if (!unprocessedSummary.metadata && summary.metadata) { let /** @type {?} */ metadata = summary.metadata || {}; if (metadata.__symbolic === 'class') { // For classes, we keep everything except their class decorators. // We need to keep e.g. the ctor args, method names, method decorators // so that the class can be extended in another compilation unit. // We don't keep the class decorators as // 1) they refer to data // that should not cause a rebuild of downstream compilation units // (e.g. inline templates of @Component, or @NgModule.declarations) // 2) their data is already captured in TypeSummaries, e.g. DirectiveSummary. const /** @type {?} */ clone = {}; Object.keys(metadata).forEach((propName) => { if (propName !== 'decorators') { clone[propName] = metadata[propName]; } }); metadata = clone; } else if (isCall(metadata)) { if (!isFunctionCall(metadata) && !isMethodCallOnVariable(metadata)) { // Don't store complex calls as we won't be able to simplify them anyways later on. metadata = { __symbolic: 'error', message: 'Complex function calls are not supported.', }; } } // Note: We need to keep storing ctor calls for e.g. // `export const x = new InjectionToken(...)` unprocessedSummary.metadata = metadata; processedSummary.metadata = this.processValue(metadata, 1 /* ResolveValue */); if (metadata instanceof StaticSymbol && this.summaryResolver.isLibraryFile(metadata.filePath)) { const /** @type {?} */ declarationSymbol = this.symbols[/** @type {?} */ ((this.indexBySymbol.get(metadata)))]; if (!isLoweredSymbol(declarationSymbol.name)) { // Note: symbols that were introduced during codegen in the user file can have a reexport // if a user used `export *`. However, we can't rely on this as tsickle will change // `export *` into named exports, using only the information from the typechecker. // As we introduce the new symbols after typecheck, Tsickle does not know about them, // and omits them when expanding `export *`. // So we have to keep reexporting these symbols manually via .ngfactory files. this.reexportedBy.set(declarationSymbol, summary.symbol); } } } if (!unprocessedSummary.type && summary.type) { unprocessedSummary.type = summary.type; // Note: We don't add the summaries of all referenced symbols as for the ResolvedSymbols, // as the type summaries already contain the transitive data that they require // (in a minimal way). processedSummary.type = this.processValue(summary.type, 0 /* None */); // except for reexported directives / pipes, so we need to store // their summaries explicitly. if (summary.type.summaryKind === CompileSummaryKind.NgModule) { const /** @type {?} */ ngModuleSummary = /** @type {?} */ (summary.type); ngModuleSummary.exportedDirectives.concat(ngModuleSummary.exportedPipes).forEach((id) => { const /** @type {?} */ symbol = id.reference; if (this.summaryResolver.isLibraryFile(symbol.filePath) && !this.unprocessedSymbolSummariesBySymbol.has(symbol)) { const /** @type {?} */ summary = this.summaryResolver.resolveSummary(symbol); if (summary) { this.addSummary(summary); } } }); } } } /** * @return {?} */ serialize() { const /** @type {?} */ exportAs = []; const /** @type {?} */ json = JSON.stringify({ moduleName: this.moduleName, summaries: this.processedSummaries, symbols: this.symbols.map((symbol, index) => { symbol.assertNoMembers(); let /** @type {?} */ importAs = /** @type {?} */ ((undefined)); if (this.summaryResolver.isLibraryFile(symbol.filePath)) { const /** @type {?} */ reexportSymbol = this.reexportedBy.get(symbol); if (reexportSymbol) { importAs = /** @type {?} */ ((this.indexBySymbol.get(reexportSymbol))); } else { const /** @type {?} */ summary = this.unprocessedSymbolSummariesBySymbol.get(symbol); if (!summary || !summary.metadata || summary.metadata.__symbolic !== 'interface') { importAs = `${symbol.name}_${index}`; exportAs.push({ symbol, exportAs: importAs }); } } } return { __symbol: index, name: symbol.name, filePath: this.summaryResolver.toSummaryFileName(symbol.filePath, this.srcFileName), importAs: importAs }; }) }); return { json, exportAs }; } /** * @param {?} value * @param {?} flags * @return {?} */ processValue(value, flags) { return visitValue(value, this, flags); } /** * @param {?} value * @param {?} context * @return {?} */ visitOther(value, context) { if (value instanceof StaticSymbol) { let /** @type {?} */ baseSymbol = this.symbolResolver.getStaticSymbol(value.filePath, value.name); const /** @type {?} */ index = this.visitStaticSymbol(baseSymbol, context); return { __symbol: index, members: value.members }; } } /** * Returns null if the options.resolveValue is true, and the summary for the symbol * resolved to a type or could not be resolved. * @param {?} baseSymbol * @param {?} flags * @return {?} */ visitStaticSymbol(baseSymbol, flags) { let /** @type {?} */ index = this.indexBySymbol.get(baseSymbol); let /** @type {?} */ summary = null; if (flags & 1 /* ResolveValue */ && this.summaryResolver.isLibraryFile(baseSymbol.filePath)) { if (this.unprocessedSymbolSummariesBySymbol.has(baseSymbol)) { // the summary for this symbol was already added // -> nothing to do. return /** @type {?} */ ((index)); } summary = this.loadSummary(baseSymbol); if (summary && summary.metadata instanceof StaticSymbol) { // The summary is a reexport index = this.visitStaticSymbol(summary.metadata, flags); // reset the summary as it is just a reexport, so we don't want to store it. summary = null; } } else if (index != null) { // Note: == on purpose to compare with undefined! // No summary and the symbol is already added -> nothing to do. return index; } // Note: == on purpose to compare with undefined! if (index == null) { index = this.symbols.length; this.symbols.push(baseSymbol); } this.indexBySymbol.set(baseSymbol, index); if (summary) { this.addSummary(summary); } return index; } /** * @param {?} symbol * @return {?} */ loadSummary(symbol) { let /** @type {?} */ summary = this.summaryResolver.resolveSummary(symbol); if (!summary) { // some symbols might originate from a plain typescript library // that just exported .d.ts and .metadata.json files, i.e. where no summary // files were created. const /** @type {?} */ resolvedSymbol = this.symbolResolver.resolveSymbol(symbol); if (resolvedSymbol) { summary = { symbol: resolvedSymbol.symbol, metadata: resolvedSymbol.metadata }; } } return summary; } } class ForJitSerializer { /** * @param {?} outputCtx * @param {?} symbolResolver * @param {?} summaryResolver */ constructor(outputCtx, symbolResolver, summaryResolver) { this.outputCtx = outputCtx; this.symbolResolver = symbolResolver; this.summaryResolver = summaryResolver; this.data = []; } /** * @param {?} summary * @param {?} metadata * @return {?} */ addSourceType(summary, metadata) { this.data.push({ summary, metadata, isLibrary: false }); } /** * @param {?} summary * @return {?} */ addLibType(summary) { this.data.push({ summary, metadata: null, isLibrary: true }); } /** * @param {?} exportAsArr * @return {?} */ serialize(exportAsArr) { const /** @type {?} */ exportAsBySymbol = new Map(); for (const { symbol, exportAs } of exportAsArr) { exportAsBySymbol.set(symbol, exportAs); } const /** @type {?} */ ngModuleSymbols = new Set(); for (const { summary, metadata, isLibrary } of this.data) { if (summary.summaryKind === CompileSummaryKind.NgModule) { // collect the symbols that refer to NgModule classes. // Note: we can't just rely on `summary.type.summaryKind` to determine this as // we don't add the summaries of all referenced symbols when we serialize type summaries. // See serializeSummaries for details. ngModuleSymbols.add(summary.type.reference); const /** @type {?} */ modSummary = /** @type {?} */ (summary); for (const /** @type {?} */ mod of modSummary.modules) { ngModuleSymbols.add(mod.reference); } } if (!isLibrary) { const /** @type {?} */ fnName = summaryForJitName(summary.type.reference.name); createSummaryForJitFunction(this.outputCtx, summary.type.reference, this.serializeSummaryWithDeps(summary, /** @type {?} */ ((metadata)))); } } ngModuleSymbols.forEach((ngModuleSymbol) => { if (this.summaryResolver.isLibraryFile(ngModuleSymbol.filePath)) { let /** @type {?} */ exportAs = exportAsBySymbol.get(ngModuleSymbol) || ngModuleSymbol.name; const /** @type {?} */ jitExportAsName = summaryForJitName(exportAs); this.outputCtx.statements.push(variable(jitExportAsName) .set(this.serializeSummaryRef(ngModuleSymbol)) .toDeclStmt(null, [StmtModifier.Exported])); } }); } /** * @param {?} summary * @param {?} metadata * @return {?} */ serializeSummaryWithDeps(summary, metadata) { const /** @type {?} */ expressions = [this.serializeSummary(summary)]; let /** @type {?} */ providers = []; if (metadata instanceof CompileNgModuleMetadata) { expressions.push(... // For directives / pipes, we only add the declared ones, // and rely on transitively importing NgModules to get the transitive // summaries. metadata.declaredDirectives.concat(metadata.declaredPipes) .map(type => type.reference) .concat(metadata.transitiveModule.modules.map(type => type.reference) .filter(ref => ref !== metadata.type.reference)) .map((ref) => this.serializeSummaryRef(ref))); // Note: We don't use `NgModuleSummary.providers`, as that one is transitive, // and we already have transitive modules. providers = metadata.providers; } else if (summary.summaryKind === CompileSummaryKind.Directive) { const /** @type {?} */ dirSummary = /** @type {?} */ (summary); providers = dirSummary.providers.concat(dirSummary.viewProviders); } // Note: We can't just refer to the `ngsummary.ts` files for `useClass` providers (as we do for // declaredDirectives / declaredPipes), as we allow // providers without ctor arguments to skip the `@Injectable` decorator, // i.e. we didn't generate .ngsummary.ts files for these. expressions.push(...providers.filter(provider => !!provider.useClass).map(provider => this.serializeSummary(/** @type {?} */ ({ summaryKind: CompileSummaryKind.Injectable, type: provider.useClass })))); return literalArr(expressions); } /** * @param {?} typeSymbol * @return {?} */ serializeSummaryRef(typeSymbol) { const /** @type {?} */ jitImportedSymbol = this.symbolResolver.getStaticSymbol(summaryForJitFileName(typeSymbol.filePath), summaryForJitName(typeSymbol.name)); return this.outputCtx.importExpr(jitImportedSymbol); } /** * @param {?} data * @return {?} */ serializeSummary(data) { const /** @type {?} */ outputCtx = this.outputCtx; class Transformer { /** * @param {?} arr * @param {?} context * @return {?} */ visitArray(arr, context) { return literalArr(arr.map(entry => visitValue(entry, this, context))); } /** * @param {?} map * @param {?} context * @return {?} */ visitStringMap(map, context) { return new LiteralMapExpr(Object.keys(map).map((key) => new LiteralMapEntry(key, visitValue(map[key], this, context), false))); } /** * @param {?} value * @param {?} context * @return {?} */ visitPrimitive(value, context) { return literal(value); } /** * @param {?} value * @param {?} context * @return {?} */ visitOther(value, context) { if (value instanceof StaticSymbol) { return outputCtx.importExpr(value); } else { throw new Error(`Illegal State: Encountered value ${value}`); } } } return visitValue(data, new Transformer(), null); } } class FromJsonDeserializer extends ValueTransformer { /** * @param {?} symbolCache * @param {?} summaryResolver */ constructor(symbolCache, summaryResolver) { super(); this.symbolCache = symbolCache; this.summaryResolver = summaryResolver; } /** * @param {?} libraryFileName * @param {?} json * @return {?} */ deserialize(libraryFileName, json) { const /** @type {?} */ data = JSON.parse(json); const /** @type {?} */ allImportAs = []; this.symbols = data.symbols.map((serializedSymbol) => this.symbolCache.get(this.summaryResolver.fromSummaryFileName(serializedSymbol.filePath, libraryFileName), serializedSymbol.name)); data.symbols.forEach((serializedSymbol, index) => { const /** @type {?} */ symbol = this.symbols[index]; const /** @type {?} */ importAs = serializedSymbol.importAs; if (typeof importAs === 'number') { allImportAs.push({ symbol, importAs: this.symbols[importAs] }); } else if (typeof importAs === 'string') { allImportAs.push({ symbol, importAs: this.symbolCache.get(ngfactoryFilePath(libraryFileName), importAs) }); } }); const /** @type {?} */ summaries = /** @type {?} */ (visitValue(data.summaries, this, null)); return { moduleName: data.moduleName, summaries, importAs: allImportAs }; } /** * @param {?} map * @param {?} context * @return {?} */ visitStringMap(map, context) { if ('__symbol' in map) { const /** @type {?} */ baseSymbol = this.symbols[map['__symbol']]; const /** @type {?} */ members = map['members']; return members.length ? this.symbolCache.get(baseSymbol.filePath, baseSymbol.name, members) : baseSymbol; } else { return super.visitStringMap(map, context); } } } /** * @param {?} metadata * @return {?} */ function isCall(metadata) { return metadata && metadata.__symbolic === 'call'; } /** * @param {?} metadata * @return {?} */ function isFunctionCall(metadata) { return isCall(metadata) && unwrapResolvedMetadata(metadata.expression) instanceof StaticSymbol; } /** * @param {?} metadata * @return {?} */ function isMethodCallOnVariable(metadata) { return isCall(metadata) && metadata.expression && metadata.expression.__symbolic === 'select' && unwrapResolvedMetadata(metadata.expression.expression) instanceof StaticSymbol; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** @enum {number} */ const StubEmitFlags = { Basic: 1, TypeCheck: 2, All: 3, }; StubEmitFlags[StubEmitFlags.Basic] = "Basic"; StubEmitFlags[StubEmitFlags.TypeCheck] = "TypeCheck"; StubEmitFlags[StubEmitFlags.All] = "All"; class AotCompiler { /** * @param {?} _config * @param {?} _options * @param {?} _host * @param {?} _reflector * @param {?} _metadataResolver * @param {?} _templateParser * @param {?} _styleCompiler * @param {?} _viewCompiler * @param {?} _typeCheckCompiler * @param {?} _ngModuleCompiler * @param {?} _outputEmitter * @param {?} _summaryResolver * @param {?} _symbolResolver */ constructor(_config, _options, _host, _reflector, _metadataResolver, _templateParser, _styleCompiler, _viewCompiler, _typeCheckCompiler, _ngModuleCompiler, _outputEmitter, _summaryResolver, _symbolResolver) { this._config = _config; this._options = _options; this._host = _host; this._reflector = _reflector; this._metadataResolver = _metadataResolver; this._templateParser = _templateParser; this._styleCompiler = _styleCompiler; this._viewCompiler = _viewCompiler; this._typeCheckCompiler = _typeCheckCompiler; this._ngModuleCompiler = _ngModuleCompiler; this._outputEmitter = _outputEmitter; this._summaryResolver = _summaryResolver; this._symbolResolver = _symbolResolver; this._templateAstCache = new Map(); this._analyzedFiles = new Map(); } /** * @return {?} */ clearCache() { this._metadataResolver.clearCache(); } /** * @param {?} rootFiles * @return {?} */ analyzeModulesSync(rootFiles) { const /** @type {?} */ analyzeResult = analyzeAndValidateNgModules(rootFiles, this._host, this._symbolResolver, this._metadataResolver); analyzeResult.ngModules.forEach(ngModule => this._metadataResolver.loadNgModuleDirectiveAndPipeMetadata(ngModule.type.reference, true)); return analyzeResult; } /** * @param {?} rootFiles * @return {?} */ analyzeModulesAsync(rootFiles) { const /** @type {?} */ analyzeResult = analyzeAndValidateNgModules(rootFiles, this._host, this._symbolResolver, this._metadataResolver); return Promise .all(analyzeResult.ngModules.map(ngModule => this._metadataResolver.loadNgModuleDirectiveAndPipeMetadata(ngModule.type.reference, false))) .then(() => analyzeResult); } /** * @param {?} fileName * @return {?} */ _analyzeFile(fileName) { let /** @type {?} */ analyzedFile = this._analyzedFiles.get(fileName); if (!analyzedFile) { analyzedFile = analyzeFile(this._host, this._symbolResolver, this._metadataResolver, fileName); this._analyzedFiles.set(fileName, analyzedFile); } return analyzedFile; } /** * @param {?} fileName * @return {?} */ findGeneratedFileNames(fileName) { const /** @type {?} */ genFileNames = []; const /** @type {?} */ file = this._analyzeFile(fileName); // Make sure we create a .ngfactory if we have a injectable/directive/pipe/NgModule // or a reference to a non source file. // Note: This is overestimating the required .ngfactory files as the real calculation is harder. // Only do this for StubEmitFlags.Basic, as adding a type check block // does not change this file (as we generate type check blocks based on NgModules). if (this._options.allowEmptyCodegenFiles || file.directives.length || file.pipes.length || file.injectables.length || file.ngModules.length || file.exportsNonSourceFiles) { genFileNames.push(ngfactoryFilePath(file.fileName, true)); if (this._options.enableSummariesForJit) { genFileNames.push(summaryForJitFileName(file.fileName, true)); } } const /** @type {?} */ fileSuffix = normalizeGenFileSuffix(splitTypescriptSuffix(file.fileName, true)[1]); file.directives.forEach((dirSymbol) => { const /** @type {?} */ compMeta = /** @type {?} */ ((this._metadataResolver.getNonNormalizedDirectiveMetadata(dirSymbol))).metadata; if (!compMeta.isComponent) { return; } /** @type {?} */ (( // Note: compMeta is a component and therefore template is non null. compMeta.template)).styleUrls.forEach((styleUrl) => { const /** @type {?} */ normalizedUrl = this._host.resourceNameToFileName(styleUrl, file.fileName); if (!normalizedUrl) { throw syntaxError(`Couldn't resolve resource ${styleUrl} relative to ${file.fileName}`); } const /** @type {?} */ needsShim = (/** @type {?} */ ((compMeta.template)).encapsulation || this._config.defaultEncapsulation) === ViewEncapsulation.Emulated; genFileNames.push(_stylesModuleUrl(normalizedUrl, needsShim, fileSuffix)); if (this._options.allowEmptyCodegenFiles) { genFileNames.push(_stylesModuleUrl(normalizedUrl, !needsShim, fileSuffix)); } }); }); return genFileNames; } /** * @param {?} genFileName * @param {?=} originalFileName * @return {?} */ emitBasicStub(genFileName, originalFileName) { const /** @type {?} */ outputCtx = this._createOutputContext(genFileName); if (genFileName.endsWith('.ngfactory.ts')) { if (!originalFileName) { throw new Error(`Assertion error: require the original file for .ngfactory.ts stubs. File: ${genFileName}`); } const /** @type {?} */ originalFile = this._analyzeFile(originalFileName); this._createNgFactoryStub(outputCtx, originalFile, StubEmitFlags.Basic); } else if (genFileName.endsWith('.ngsummary.ts')) { if (this._options.enableSummariesForJit) { if (!originalFileName) { throw new Error(`Assertion error: require the original file for .ngsummary.ts stubs. File: ${genFileName}`); } const /** @type {?} */ originalFile = this._analyzeFile(originalFileName); _createEmptyStub(outputCtx); originalFile.ngModules.forEach(ngModule => { // create exports that user code can reference createForJitStub(outputCtx, ngModule.type.reference); }); } } else if (genFileName.endsWith('.ngstyle.ts')) { _createEmptyStub(outputCtx); } // Note: for the stubs, we don't need a property srcFileUrl, // as lateron in emitAllImpls we will create the proper GeneratedFiles with the // correct srcFileUrl. // This is good as e.g. for .ngstyle.ts files we can't derive // the url of components based on the genFileUrl. return this._codegenSourceModule('unknown', outputCtx); } /** * @param {?} genFileName * @param {?} originalFileName * @return {?} */ emitTypeCheckStub(genFileName, originalFileName) { const /** @type {?} */ originalFile = this._analyzeFile(originalFileName); const /** @type {?} */ outputCtx = this._createOutputContext(genFileName); if (genFileName.endsWith('.ngfactory.ts')) { this._createNgFactoryStub(outputCtx, originalFile, StubEmitFlags.TypeCheck); } return outputCtx.statements.length > 0 ? this._codegenSourceModule(originalFile.fileName, outputCtx) : null; } /** * @param {?} fileNames * @return {?} */ loadFilesAsync(fileNames) { const /** @type {?} */ files = fileNames.map(fileName => this._analyzeFile(fileName)); const /** @type {?} */ loadingPromises = []; files.forEach(file => file.ngModules.forEach(ngModule => loadingPromises.push(this._metadataResolver.loadNgModuleDirectiveAndPipeMetadata(ngModule.type.reference, false)))); return Promise.all(loadingPromises).then(_ => mergeAndValidateNgFiles(files)); } /** * @param {?} fileNames * @return {?} */ loadFilesSync(fileNames) { const /** @type {?} */ files = fileNames.map(fileName => this._analyzeFile(fileName)); files.forEach(file => file.ngModules.forEach(ngModule => this._metadataResolver.loadNgModuleDirectiveAndPipeMetadata(ngModule.type.reference, true))); return mergeAndValidateNgFiles(files); } /** * @param {?} outputCtx * @param {?} file * @param {?} emitFlags * @return {?} */ _createNgFactoryStub(outputCtx, file, emitFlags) { let /** @type {?} */ componentId = 0; file.ngModules.forEach((ngModuleMeta, ngModuleIndex) => { // Note: the code below needs to executed for StubEmitFlags.Basic and StubEmitFlags.TypeCheck, // so we don't change the .ngfactory file too much when adding the typecheck block. // create exports that user code can reference this._ngModuleCompiler.createStub(outputCtx, ngModuleMeta.type.reference); // add references to the symbols from the metadata. // These can be used by the type check block for components, // and they also cause TypeScript to include these files into the program too, // which will make them part of the analyzedFiles. const /** @type {?} */ externalReferences = [ // Add references that are available from all the modules and imports. ...ngModuleMeta.transitiveModule.directives.map(d => d.reference), ...ngModuleMeta.transitiveModule.pipes.map(d => d.reference), ...ngModuleMeta.importedModules.map(m => m.type.reference), ...ngModuleMeta.exportedModules.map(m => m.type.reference), // Add references that might be inserted by the template compiler. ...this._externalIdentifierReferences([Identifiers.TemplateRef, Identifiers.ElementRef]), ]; const /** @type {?} */ externalReferenceVars = new Map(); externalReferences.forEach((ref, typeIndex) => { externalReferenceVars.set(ref, `_decl${ngModuleIndex}_${typeIndex}`); }); externalReferenceVars.forEach((varName, reference) => { outputCtx.statements.push(variable(varName) .set(NULL_EXPR.cast(DYNAMIC_TYPE)) .toDeclStmt(expressionType(outputCtx.importExpr(reference, /* typeParams */ null, /* useSummaries */ /* useSummaries */ false)))); }); if (emitFlags & StubEmitFlags.TypeCheck) { // add the typecheck block for all components of the NgModule ngModuleMeta.declaredDirectives.forEach((dirId) => { const /** @type {?} */ compMeta = this._metadataResolver.getDirectiveMetadata(dirId.reference); if (!compMeta.isComponent) { return; } componentId++; this._createTypeCheckBlock(outputCtx, `${compMeta.type.reference.name}_Host_${componentId}`, ngModuleMeta, this._metadataResolver.getHostComponentMetadata(compMeta), [compMeta.type], externalReferenceVars); this._createTypeCheckBlock(outputCtx, `${compMeta.type.reference.name}_${componentId}`, ngModuleMeta, compMeta, ngModuleMeta.transitiveModule.directives, externalReferenceVars); }); } }); if (outputCtx.statements.length === 0) { _createEmptyStub(outputCtx); } } /** * @param {?} references * @return {?} */ _externalIdentifierReferences(references) { const /** @type {?} */ result = []; for (let /** @type {?} */ reference of references) { const /** @type {?} */ token = createTokenForExternalReference(this._reflector, reference); if (token.identifier) { result.push(token.identifier.reference); } } return result; } /** * @param {?} ctx * @param {?} componentId * @param {?} moduleMeta * @param {?} compMeta * @param {?} directives * @param {?} externalReferenceVars * @return {?} */ _createTypeCheckBlock(ctx, componentId, moduleMeta, compMeta, directives, externalReferenceVars) { const { template: parsedTemplate, pipes: usedPipes } = this._parseTemplate(compMeta, moduleMeta, directives); ctx.statements.push(...this._typeCheckCompiler.compileComponent(componentId, compMeta, parsedTemplate, usedPipes, externalReferenceVars, ctx)); } /** * @param {?} analyzeResult * @param {?} locale * @return {?} */ emitMessageBundle(analyzeResult, locale) { const /** @type {?} */ errors = []; const /** @type {?} */ htmlParser = new HtmlParser(); // TODO(vicb): implicit tags & attributes const /** @type {?} */ messageBundle = new MessageBundle(htmlParser, [], {}, locale); analyzeResult.files.forEach(file => { const /** @type {?} */ compMetas = []; file.directives.forEach(directiveType => { const /** @type {?} */ dirMeta = this._metadataResolver.getDirectiveMetadata(directiveType); if (dirMeta && dirMeta.isComponent) { compMetas.push(dirMeta); } }); compMetas.forEach(compMeta => { const /** @type {?} */ html = /** @type {?} */ ((/** @type {?} */ ((compMeta.template)).template)); const /** @type {?} */ interpolationConfig = InterpolationConfig.fromArray(/** @type {?} */ ((compMeta.template)).interpolation); errors.push(.../** @type {?} */ ((messageBundle.updateFromTemplate(html, file.fileName, interpolationConfig)))); }); }); if (errors.length) { throw new Error(errors.map(e => e.toString()).join('\n')); } return messageBundle; } /** * @param {?} analyzeResult * @return {?} */ emitAllImpls(analyzeResult) { const { ngModuleByPipeOrDirective, files } = analyzeResult; const /** @type {?} */ sourceModules = files.map(file => this._compileImplFile(file.fileName, ngModuleByPipeOrDirective, file.directives, file.pipes, file.ngModules, file.injectables)); return flatten(sourceModules); } /** * @param {?} srcFileUrl * @param {?} ngModuleByPipeOrDirective * @param {?} directives * @param {?} pipes * @param {?} ngModules * @param {?} injectables * @return {?} */ _compileImplFile(srcFileUrl, ngModuleByPipeOrDirective, directives, pipes, ngModules, injectables) { const /** @type {?} */ fileSuffix = normalizeGenFileSuffix(splitTypescriptSuffix(srcFileUrl, true)[1]); const /** @type {?} */ generatedFiles = []; const /** @type {?} */ outputCtx = this._createOutputContext(ngfactoryFilePath(srcFileUrl, true)); generatedFiles.push(...this._createSummary(srcFileUrl, directives, pipes, ngModules, injectables, outputCtx)); // compile all ng modules ngModules.forEach((ngModuleMeta) => this._compileModule(outputCtx, ngModuleMeta)); // compile components directives.forEach((dirType) => { const /** @type {?} */ compMeta = this._metadataResolver.getDirectiveMetadata(/** @type {?} */ (dirType)); if (!compMeta.isComponent) { return; } const /** @type {?} */ ngModule = ngModuleByPipeOrDirective.get(dirType); if (!ngModule) { throw new Error(`Internal Error: cannot determine the module for component ${identifierName(compMeta.type)}!`); } // compile styles const /** @type {?} */ componentStylesheet = this._styleCompiler.compileComponent(outputCtx, compMeta); /** @type {?} */ (( // Note: compMeta is a component and therefore template is non null. compMeta.template)).externalStylesheets.forEach((stylesheetMeta) => { // Note: fill non shim and shim style files as they might // be shared by component with and without ViewEncapsulation. const /** @type {?} */ shim = this._styleCompiler.needsStyleShim(compMeta); generatedFiles.push(this._codegenStyles(srcFileUrl, compMeta, stylesheetMeta, shim, fileSuffix)); if (this._options.allowEmptyCodegenFiles) { generatedFiles.push(this._codegenStyles(srcFileUrl, compMeta, stylesheetMeta, !shim, fileSuffix)); } }); // compile components const /** @type {?} */ compViewVars = this._compileComponent(outputCtx, compMeta, ngModule, ngModule.transitiveModule.directives, componentStylesheet, fileSuffix); this._compileComponentFactory(outputCtx, compMeta, ngModule, fileSuffix); }); if (outputCtx.statements.length > 0 || this._options.allowEmptyCodegenFiles) { const /** @type {?} */ srcModule = this._codegenSourceModule(srcFileUrl, outputCtx); generatedFiles.unshift(srcModule); } return generatedFiles; } /** * @param {?} srcFileName * @param {?} directives * @param {?} pipes * @param {?} ngModules * @param {?} injectables * @param {?} ngFactoryCtx * @return {?} */ _createSummary(srcFileName, directives, pipes, ngModules, injectables, ngFactoryCtx) { const /** @type {?} */ symbolSummaries = this._symbolResolver.getSymbolsOf(srcFileName) .map(symbol => this._symbolResolver.resolveSymbol(symbol)); const /** @type {?} */ typeData = [ ...ngModules.map(meta => ({ summary: /** @type {?} */ ((this._metadataResolver.getNgModuleSummary(meta.type.reference))), metadata: /** @type {?} */ ((this._metadataResolver.getNgModuleMetadata(meta.type.reference))) })), ...directives.map(ref => ({ summary: /** @type {?} */ ((this._metadataResolver.getDirectiveSummary(ref))), metadata: /** @type {?} */ ((this._metadataResolver.getDirectiveMetadata(ref))) })), ...pipes.map(ref => ({ summary: /** @type {?} */ ((this._metadataResolver.getPipeSummary(ref))), metadata: /** @type {?} */ ((this._metadataResolver.getPipeMetadata(ref))) })), ...injectables.map(ref => ({ summary: /** @type {?} */ ((this._metadataResolver.getInjectableSummary(ref))), metadata: /** @type {?} */ ((this._metadataResolver.getInjectableSummary(ref))).type })) ]; const /** @type {?} */ forJitOutputCtx = this._options.enableSummariesForJit ? this._createOutputContext(summaryForJitFileName(srcFileName, true)) : null; const { json, exportAs } = serializeSummaries(srcFileName, forJitOutputCtx, this._summaryResolver, this._symbolResolver, symbolSummaries, typeData); exportAs.forEach((entry) => { ngFactoryCtx.statements.push(variable(entry.exportAs).set(ngFactoryCtx.importExpr(entry.symbol)).toDeclStmt(null, [ StmtModifier.Exported ])); }); const /** @type {?} */ summaryJson = new GeneratedFile(srcFileName, summaryFileName(srcFileName), json); const /** @type {?} */ result = [summaryJson]; if (forJitOutputCtx) { result.push(this._codegenSourceModule(srcFileName, forJitOutputCtx)); } return result; } /** * @param {?} outputCtx * @param {?} ngModule * @return {?} */ _compileModule(outputCtx, ngModule) { const /** @type {?} */ providers = []; if (this._options.locale) { const /** @type {?} */ normalizedLocale = this._options.locale.replace(/_/g, '-'); providers.push({ token: createTokenForExternalReference(this._reflector, Identifiers.LOCALE_ID), useValue: normalizedLocale, }); } if (this._options.i18nFormat) { providers.push({ token: createTokenForExternalReference(this._reflector, Identifiers.TRANSLATIONS_FORMAT), useValue: this._options.i18nFormat }); } this._ngModuleCompiler.compile(outputCtx, ngModule, providers); } /** * @param {?} outputCtx * @param {?} compMeta * @param {?} ngModule * @param {?} fileSuffix * @return {?} */ _compileComponentFactory(outputCtx, compMeta, ngModule, fileSuffix) { const /** @type {?} */ hostMeta = this._metadataResolver.getHostComponentMetadata(compMeta); const /** @type {?} */ hostViewFactoryVar = this._compileComponent(outputCtx, hostMeta, ngModule, [compMeta.type], null, fileSuffix) .viewClassVar; const /** @type {?} */ compFactoryVar = componentFactoryName(compMeta.type.reference); const /** @type {?} */ inputsExprs = []; for (let /** @type {?} */ propName in compMeta.inputs) { const /** @type {?} */ templateName = compMeta.inputs[propName]; // Don't quote so that the key gets minified... inputsExprs.push(new LiteralMapEntry(propName, literal(templateName), false)); } const /** @type {?} */ outputsExprs = []; for (let /** @type {?} */ propName in compMeta.outputs) { const /** @type {?} */ templateName = compMeta.outputs[propName]; // Don't quote so that the key gets minified... outputsExprs.push(new LiteralMapEntry(propName, literal(templateName), false)); } outputCtx.statements.push(variable(compFactoryVar) .set(importExpr(Identifiers.createComponentFactory).callFn([ literal(compMeta.selector), outputCtx.importExpr(compMeta.type.reference), variable(hostViewFactoryVar), new LiteralMapExpr(inputsExprs), new LiteralMapExpr(outputsExprs), literalArr(/** @type {?} */ ((compMeta.template)).ngContentSelectors.map(selector => literal(selector))) ])) .toDeclStmt(importType(Identifiers.ComponentFactory, [/** @type {?} */ ((expressionType(outputCtx.importExpr(compMeta.type.reference))))], [TypeModifier.Const]), [StmtModifier.Final, StmtModifier.Exported])); } /** * @param {?} outputCtx * @param {?} compMeta * @param {?} ngModule * @param {?} directiveIdentifiers * @param {?} componentStyles * @param {?} fileSuffix * @return {?} */ _compileComponent(outputCtx, compMeta, ngModule, directiveIdentifiers, componentStyles, fileSuffix) { const { template: parsedTemplate, pipes: usedPipes } = this._parseTemplate(compMeta, ngModule, directiveIdentifiers); const /** @type {?} */ stylesExpr = componentStyles ? variable(componentStyles.stylesVar) : literalArr([]); const /** @type {?} */ viewResult = this._viewCompiler.compileComponent(outputCtx, compMeta, parsedTemplate, stylesExpr, usedPipes); if (componentStyles) { _resolveStyleStatements(this._symbolResolver, componentStyles, this._styleCompiler.needsStyleShim(compMeta), fileSuffix); } return viewResult; } /** * @param {?} compMeta * @param {?} ngModule * @param {?} directiveIdentifiers * @return {?} */ _parseTemplate(compMeta, ngModule, directiveIdentifiers) { if (this._templateAstCache.has(compMeta.type.reference)) { return /** @type {?} */ ((this._templateAstCache.get(compMeta.type.reference))); } const /** @type {?} */ preserveWhitespaces = /** @type {?} */ ((/** @type {?} */ ((compMeta)).template)).preserveWhitespaces; const /** @type {?} */ directives = directiveIdentifiers.map(dir => this._metadataResolver.getDirectiveSummary(dir.reference)); const /** @type {?} */ pipes = ngModule.transitiveModule.pipes.map(pipe => this._metadataResolver.getPipeSummary(pipe.reference)); const /** @type {?} */ result = this._templateParser.parse(compMeta, /** @type {?} */ ((/** @type {?} */ ((compMeta.template)).htmlAst)), directives, pipes, ngModule.schemas, templateSourceUrl(ngModule.type, compMeta, /** @type {?} */ ((compMeta.template))), preserveWhitespaces); this._templateAstCache.set(compMeta.type.reference, result); return result; } /** * @param {?} genFilePath * @return {?} */ _createOutputContext(genFilePath) { const /** @type {?} */ importExpr$$1 = (symbol, typeParams = null, useSummaries = true) => { if (!(symbol instanceof StaticSymbol)) { throw new Error(`Internal error: unknown identifier ${JSON.stringify(symbol)}`); } const /** @type {?} */ arity = this._symbolResolver.getTypeArity(symbol) || 0; const { filePath, name, members } = this._symbolResolver.getImportAs(symbol, useSummaries) || symbol; const /** @type {?} */ importModule = this._fileNameToModuleName(filePath, genFilePath); // It should be good enough to compare filePath to genFilePath and if they are equal // there is a self reference. However, ngfactory files generate to .ts but their // symbols have .d.ts so a simple compare is insufficient. They should be canonical // and is tracked by #17705. const /** @type {?} */ selfReference = this._fileNameToModuleName(genFilePath, genFilePath); const /** @type {?} */ moduleName = importModule === selfReference ? null : importModule; // If we are in a type expression that refers to a generic type then supply // the required type parameters. If there were not enough type parameters // supplied, supply any as the type. Outside a type expression the reference // should not supply type parameters and be treated as a simple value reference // to the constructor function itself. const /** @type {?} */ suppliedTypeParams = typeParams || []; const /** @type {?} */ missingTypeParamsCount = arity - suppliedTypeParams.length; const /** @type {?} */ allTypeParams = suppliedTypeParams.concat(new Array(missingTypeParamsCount).fill(DYNAMIC_TYPE)); return members.reduce((expr, memberName) => expr.prop(memberName), /** @type {?} */ (importExpr(new ExternalReference(moduleName, name, null), allTypeParams))); }; return { statements: [], genFilePath, importExpr: importExpr$$1 }; } /** * @param {?} importedFilePath * @param {?} containingFilePath * @return {?} */ _fileNameToModuleName(importedFilePath, containingFilePath) { return this._summaryResolver.getKnownModuleName(importedFilePath) || this._symbolResolver.getKnownModuleName(importedFilePath) || this._host.fileNameToModuleName(importedFilePath, containingFilePath); } /** * @param {?} srcFileUrl * @param {?} compMeta * @param {?} stylesheetMetadata * @param {?} isShimmed * @param {?} fileSuffix * @return {?} */ _codegenStyles(srcFileUrl, compMeta, stylesheetMetadata, isShimmed, fileSuffix) { const /** @type {?} */ outputCtx = this._createOutputContext(_stylesModuleUrl(/** @type {?} */ ((stylesheetMetadata.moduleUrl)), isShimmed, fileSuffix)); const /** @type {?} */ compiledStylesheet = this._styleCompiler.compileStyles(outputCtx, compMeta, stylesheetMetadata, isShimmed); _resolveStyleStatements(this._symbolResolver, compiledStylesheet, isShimmed, fileSuffix); return this._codegenSourceModule(srcFileUrl, outputCtx); } /** * @param {?} srcFileUrl * @param {?} ctx * @return {?} */ _codegenSourceModule(srcFileUrl, ctx) { return new GeneratedFile(srcFileUrl, ctx.genFilePath, ctx.statements); } /** * @param {?=} entryRoute * @param {?=} analyzedModules * @return {?} */ listLazyRoutes(entryRoute, analyzedModules) { const /** @type {?} */ self = this; if (entryRoute) { const /** @type {?} */ symbol = parseLazyRoute(entryRoute, this._reflector).referencedModule; return visitLazyRoute(symbol); } else if (analyzedModules) { const /** @type {?} */ allLazyRoutes = []; for (const /** @type {?} */ ngModule of analyzedModules.ngModules) { const /** @type {?} */ lazyRoutes = listLazyRoutes(ngModule, this._reflector); for (const /** @type {?} */ lazyRoute of lazyRoutes) { allLazyRoutes.push(lazyRoute); } } return allLazyRoutes; } else { throw new Error(`Either route or analyzedModules has to be specified!`); } /** * @param {?} symbol * @param {?=} seenRoutes * @param {?=} allLazyRoutes * @return {?} */ function visitLazyRoute(symbol, seenRoutes = new Set(), allLazyRoutes = []) { // Support pointing to default exports, but stop recursing there, // as the StaticReflector does not yet support default exports. if (seenRoutes.has(symbol) || !symbol.name) { return allLazyRoutes; } seenRoutes.add(symbol); const /** @type {?} */ lazyRoutes = listLazyRoutes(/** @type {?} */ ((self._metadataResolver.getNgModuleMetadata(symbol, true))), self._reflector); for (const /** @type {?} */ lazyRoute of lazyRoutes) { allLazyRoutes.push(lazyRoute); visitLazyRoute(lazyRoute.referencedModule, seenRoutes, allLazyRoutes); } return allLazyRoutes; } } } /** * @param {?} outputCtx * @return {?} */ function _createEmptyStub(outputCtx) { // Note: We need to produce at least one import statement so that // TypeScript knows that the file is an es6 module. Otherwise our generated // exports / imports won't be emitted properly by TypeScript. outputCtx.statements.push(importExpr(Identifiers.ComponentFactory).toStmt()); } /** * @param {?} symbolResolver * @param {?} compileResult * @param {?} needsShim * @param {?} fileSuffix * @return {?} */ function _resolveStyleStatements(symbolResolver, compileResult, needsShim, fileSuffix) { compileResult.dependencies.forEach((dep) => { dep.setValue(symbolResolver.getStaticSymbol(_stylesModuleUrl(dep.moduleUrl, needsShim, fileSuffix), dep.name)); }); } /** * @param {?} stylesheetUrl * @param {?} shim * @param {?} suffix * @return {?} */ function _stylesModuleUrl(stylesheetUrl, shim, suffix) { return `${stylesheetUrl}${shim ? '.shim' : ''}.ngstyle${suffix}`; } /** * @record */ /** * @record */ /** * @record */ /** * @param {?} fileNames * @param {?} host * @param {?} staticSymbolResolver * @param {?} metadataResolver * @return {?} */ function analyzeNgModules(fileNames, host, staticSymbolResolver, metadataResolver) { const /** @type {?} */ files = _analyzeFilesIncludingNonProgramFiles(fileNames, host, staticSymbolResolver, metadataResolver); return mergeAnalyzedFiles(files); } /** * @param {?} fileNames * @param {?} host * @param {?} staticSymbolResolver * @param {?} metadataResolver * @return {?} */ function analyzeAndValidateNgModules(fileNames, host, staticSymbolResolver, metadataResolver) { return validateAnalyzedModules(analyzeNgModules(fileNames, host, staticSymbolResolver, metadataResolver)); } /** * @param {?} analyzedModules * @return {?} */ function validateAnalyzedModules(analyzedModules) { if (analyzedModules.symbolsMissingModule && analyzedModules.symbolsMissingModule.length) { const /** @type {?} */ messages = analyzedModules.symbolsMissingModule.map(s => `Cannot determine the module for class ${s.name} in ${s.filePath}! Add ${s.name} to the NgModule to fix it.`); throw syntaxError(messages.join('\n')); } return analyzedModules; } /** * @param {?} fileNames * @param {?} host * @param {?} staticSymbolResolver * @param {?} metadataResolver * @return {?} */ function _analyzeFilesIncludingNonProgramFiles(fileNames, host, staticSymbolResolver, metadataResolver) { const /** @type {?} */ seenFiles = new Set(); const /** @type {?} */ files = []; const /** @type {?} */ visitFile = (fileName) => { if (seenFiles.has(fileName) || !host.isSourceFile(fileName)) { return false; } seenFiles.add(fileName); const /** @type {?} */ analyzedFile = analyzeFile(host, staticSymbolResolver, metadataResolver, fileName); files.push(analyzedFile); analyzedFile.ngModules.forEach(ngModule => { ngModule.transitiveModule.modules.forEach(modMeta => visitFile(modMeta.reference.filePath)); }); }; fileNames.forEach((fileName) => visitFile(fileName)); return files; } /** * @param {?} host * @param {?} staticSymbolResolver * @param {?} metadataResolver * @param {?} fileName * @return {?} */ function analyzeFile(host, staticSymbolResolver, metadataResolver, fileName) { const /** @type {?} */ directives = []; const /** @type {?} */ pipes = []; const /** @type {?} */ injectables = []; const /** @type {?} */ ngModules = []; const /** @type {?} */ hasDecorators = staticSymbolResolver.hasDecorators(fileName); let /** @type {?} */ exportsNonSourceFiles = false; // Don't analyze .d.ts files that have no decorators as a shortcut // to speed up the analysis. This prevents us from // resolving the references in these files. // Note: exportsNonSourceFiles is only needed when compiling with summaries, // which is not the case when .d.ts files are treated as input files. if (!fileName.endsWith('.d.ts') || hasDecorators) { staticSymbolResolver.getSymbolsOf(fileName).forEach((symbol) => { const /** @type {?} */ resolvedSymbol = staticSymbolResolver.resolveSymbol(symbol); const /** @type {?} */ symbolMeta = resolvedSymbol.metadata; if (!symbolMeta || symbolMeta.__symbolic === 'error') { return; } let /** @type {?} */ isNgSymbol = false; if (symbolMeta.__symbolic === 'class') { if (metadataResolver.isDirective(symbol)) { isNgSymbol = true; directives.push(symbol); } else if (metadataResolver.isPipe(symbol)) { isNgSymbol = true; pipes.push(symbol); } else if (metadataResolver.isNgModule(symbol)) { const /** @type {?} */ ngModule = metadataResolver.getNgModuleMetadata(symbol, false); if (ngModule) { isNgSymbol = true; ngModules.push(ngModule); } } else if (metadataResolver.isInjectable(symbol)) { isNgSymbol = true; injectables.push(symbol); } } if (!isNgSymbol) { exportsNonSourceFiles = exportsNonSourceFiles || isValueExportingNonSourceFile(host, symbolMeta); } }); } return { fileName, directives, pipes, ngModules, injectables, exportsNonSourceFiles, }; } /** * @param {?} host * @param {?} metadata * @return {?} */ function isValueExportingNonSourceFile(host, metadata) { let /** @type {?} */ exportsNonSourceFiles = false; class Visitor { /** * @param {?} arr * @param {?} context * @return {?} */ visitArray(arr, context) { arr.forEach(v => visitValue(v, this, context)); } /** * @param {?} map * @param {?} context * @return {?} */ visitStringMap(map, context) { Object.keys(map).forEach((key) => visitValue(map[key], this, context)); } /** * @param {?} value * @param {?} context * @return {?} */ visitPrimitive(value, context) { } /** * @param {?} value * @param {?} context * @return {?} */ visitOther(value, context) { if (value instanceof StaticSymbol && !host.isSourceFile(value.filePath)) { exportsNonSourceFiles = true; } } } visitValue(metadata, new Visitor(), null); return exportsNonSourceFiles; } /** * @param {?} analyzedFiles * @return {?} */ function mergeAnalyzedFiles(analyzedFiles) { const /** @type {?} */ allNgModules = []; const /** @type {?} */ ngModuleByPipeOrDirective = new Map(); const /** @type {?} */ allPipesAndDirectives = new Set(); analyzedFiles.forEach(af => { af.ngModules.forEach(ngModule => { allNgModules.push(ngModule); ngModule.declaredDirectives.forEach(d => ngModuleByPipeOrDirective.set(d.reference, ngModule)); ngModule.declaredPipes.forEach(p => ngModuleByPipeOrDirective.set(p.reference, ngModule)); }); af.directives.forEach(d => allPipesAndDirectives.add(d)); af.pipes.forEach(p => allPipesAndDirectives.add(p)); }); const /** @type {?} */ symbolsMissingModule = []; allPipesAndDirectives.forEach(ref => { if (!ngModuleByPipeOrDirective.has(ref)) { symbolsMissingModule.push(ref); } }); return { ngModules: allNgModules, ngModuleByPipeOrDirective, symbolsMissingModule, files: analyzedFiles }; } /** * @param {?} files * @return {?} */ function mergeAndValidateNgFiles(files) { return validateAnalyzedModules(mergeAnalyzedFiles(files)); } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @record */ /** * @record */ const FORMATTED_MESSAGE = 'ngFormattedMessage'; /** * @param {?} level * @return {?} */ function indentStr(level) { if (level <= 0) return ''; if (level < 6) return ['', ' ', ' ', ' ', ' ', ' '][level]; const /** @type {?} */ half = indentStr(Math.floor(level / 2)); return half + half + (level % 2 === 1 ? ' ' : ''); } /** * @param {?} chain * @param {?=} indent * @return {?} */ function formatChain(chain, indent = 0) { if (!chain) return ''; const /** @type {?} */ position = chain.position ? `${chain.position.fileName}(${chain.position.line + 1},${chain.position.column + 1})` : ''; const /** @type {?} */ prefix = position && indent === 0 ? `${position}: ` : ''; const /** @type {?} */ postfix = position && indent !== 0 ? ` at ${position}` : ''; const /** @type {?} */ message = `${prefix}${chain.message}${postfix}`; return `${indentStr(indent)}${message}${(chain.next && ('\n' + formatChain(chain.next, indent + 2))) || ''}`; } /** * @param {?} chain * @return {?} */ function formattedError(chain) { const /** @type {?} */ message = formatChain(chain) + '.'; const /** @type {?} */ error = /** @type {?} */ (syntaxError(message)); (/** @type {?} */ (error))[FORMATTED_MESSAGE] = true; error.chain = chain; error.position = chain.position; return error; } /** * @param {?} error * @return {?} */ function isFormattedError(error) { return !!(/** @type {?} */ (error))[FORMATTED_MESSAGE]; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ const ANGULAR_CORE = '@angular/core'; const ANGULAR_ROUTER = '@angular/router'; const HIDDEN_KEY = /^\$.*\$$/; const IGNORE = { __symbolic: 'ignore' }; const USE_VALUE = 'useValue'; const PROVIDE = 'provide'; const REFERENCE_SET = new Set([USE_VALUE, 'useFactory', 'data']); const TYPEGUARD_POSTFIX = 'TypeGuard'; const USE_IF = 'UseIf'; /** * @param {?} value * @return {?} */ function shouldIgnore(value) { return value && value.__symbolic == 'ignore'; } /** * A static reflector implements enough of the Reflector API that is necessary to compile * templates statically. */ class StaticReflector { /** * @param {?} summaryResolver * @param {?} symbolResolver * @param {?=} knownMetadataClasses * @param {?=} knownMetadataFunctions * @param {?=} errorRecorder */ constructor(summaryResolver, symbolResolver, knownMetadataClasses = [], knownMetadataFunctions = [], errorRecorder) { this.summaryResolver = summaryResolver; this.symbolResolver = symbolResolver; this.errorRecorder = errorRecorder; this.annotationCache = new Map(); this.propertyCache = new Map(); this.parameterCache = new Map(); this.methodCache = new Map(); this.staticCache = new Map(); this.conversionMap = new Map(); this.resolvedExternalReferences = new Map(); this.annotationForParentClassWithSummaryKind = new Map(); this.initializeConversionMap(); knownMetadataClasses.forEach((kc) => this._registerDecoratorOrConstructor(this.getStaticSymbol(kc.filePath, kc.name), kc.ctor)); knownMetadataFunctions.forEach((kf) => this._registerFunction(this.getStaticSymbol(kf.filePath, kf.name), kf.fn)); this.annotationForParentClassWithSummaryKind.set(CompileSummaryKind.Directive, [createDirective, createComponent]); this.annotationForParentClassWithSummaryKind.set(CompileSummaryKind.Pipe, [createPipe]); this.annotationForParentClassWithSummaryKind.set(CompileSummaryKind.NgModule, [createNgModule]); this.annotationForParentClassWithSummaryKind.set(CompileSummaryKind.Injectable, [createInjectable, createPipe, createDirective, createComponent, createNgModule]); } /** * @param {?} typeOrFunc * @return {?} */ componentModuleUrl(typeOrFunc) { const /** @type {?} */ staticSymbol = this.findSymbolDeclaration(typeOrFunc); return this.symbolResolver.getResourcePath(staticSymbol); } /** * @param {?} ref * @param {?=} containingFile * @return {?} */ resolveExternalReference(ref, containingFile) { let /** @type {?} */ key = undefined; if (!containingFile) { key = `${ref.moduleName}:${ref.name}`; const /** @type {?} */ declarationSymbol = this.resolvedExternalReferences.get(key); if (declarationSymbol) return declarationSymbol; } const /** @type {?} */ refSymbol = this.symbolResolver.getSymbolByModule(/** @type {?} */ ((ref.moduleName)), /** @type {?} */ ((ref.name)), containingFile); const /** @type {?} */ declarationSymbol = this.findSymbolDeclaration(refSymbol); if (!containingFile) { this.symbolResolver.recordModuleNameForFileName(refSymbol.filePath, /** @type {?} */ ((ref.moduleName))); this.symbolResolver.recordImportAs(declarationSymbol, refSymbol); } if (key) { this.resolvedExternalReferences.set(key, declarationSymbol); } return declarationSymbol; } /** * @param {?} moduleUrl * @param {?} name * @param {?=} containingFile * @return {?} */ findDeclaration(moduleUrl, name, containingFile) { return this.findSymbolDeclaration(this.symbolResolver.getSymbolByModule(moduleUrl, name, containingFile)); } /** * @param {?} moduleUrl * @param {?} name * @return {?} */ tryFindDeclaration(moduleUrl, name) { return this.symbolResolver.ignoreErrorsFor(() => this.findDeclaration(moduleUrl, name)); } /** * @param {?} symbol * @return {?} */ findSymbolDeclaration(symbol) { const /** @type {?} */ resolvedSymbol = this.symbolResolver.resolveSymbol(symbol); if (resolvedSymbol) { let /** @type {?} */ resolvedMetadata = resolvedSymbol.metadata; if (resolvedMetadata && resolvedMetadata.__symbolic === 'resolved') { resolvedMetadata = resolvedMetadata.symbol; } if (resolvedMetadata instanceof StaticSymbol) { return this.findSymbolDeclaration(resolvedSymbol.metadata); } } return symbol; } /** * @param {?} type * @return {?} */ annotations(type) { let /** @type {?} */ annotations = this.annotationCache.get(type); if (!annotations) { annotations = []; const /** @type {?} */ classMetadata = this.getTypeMetadata(type); const /** @type {?} */ parentType = this.findParentType(type, classMetadata); if (parentType) { const /** @type {?} */ parentAnnotations = this.annotations(parentType); annotations.push(...parentAnnotations); } let /** @type {?} */ ownAnnotations = []; if (classMetadata['decorators']) { ownAnnotations = this.simplify(type, classMetadata['decorators']); annotations.push(...ownAnnotations); } if (parentType && !this.summaryResolver.isLibraryFile(type.filePath) && this.summaryResolver.isLibraryFile(parentType.filePath)) { const /** @type {?} */ summary = this.summaryResolver.resolveSummary(parentType); if (summary && summary.type) { const /** @type {?} */ requiredAnnotationTypes = /** @type {?} */ ((this.annotationForParentClassWithSummaryKind.get(/** @type {?} */ ((summary.type.summaryKind))))); const /** @type {?} */ typeHasRequiredAnnotation = requiredAnnotationTypes.some((requiredType) => ownAnnotations.some(ann => requiredType.isTypeOf(ann))); if (!typeHasRequiredAnnotation) { this.reportError(formatMetadataError(metadataError(`Class ${type.name} in ${type.filePath} extends from a ${CompileSummaryKind[(/** @type {?} */ ((summary.type.summaryKind)))]} in another compilation unit without duplicating the decorator`, undefined, `Please add a ${requiredAnnotationTypes.map((type) => type.ngMetadataName).join(' or ')} decorator to the class`), type), type); } } } this.annotationCache.set(type, annotations.filter(ann => !!ann)); } return annotations; } /** * @param {?} type * @return {?} */ propMetadata(type) { let /** @type {?} */ propMetadata = this.propertyCache.get(type); if (!propMetadata) { const /** @type {?} */ classMetadata = this.getTypeMetadata(type); propMetadata = {}; const /** @type {?} */ parentType = this.findParentType(type, classMetadata); if (parentType) { const /** @type {?} */ parentPropMetadata = this.propMetadata(parentType); Object.keys(parentPropMetadata).forEach((parentProp) => { /** @type {?} */ ((propMetadata))[parentProp] = parentPropMetadata[parentProp]; }); } const /** @type {?} */ members = classMetadata['members'] || {}; Object.keys(members).forEach((propName) => { const /** @type {?} */ propData = members[propName]; const /** @type {?} */ prop = (/** @type {?} */ (propData)) .find(a => a['__symbolic'] == 'property' || a['__symbolic'] == 'method'); const /** @type {?} */ decorators = []; if (/** @type {?} */ ((propMetadata))[propName]) { decorators.push(.../** @type {?} */ ((propMetadata))[propName]); } /** @type {?} */ ((propMetadata))[propName] = decorators; if (prop && prop['decorators']) { decorators.push(...this.simplify(type, prop['decorators'])); } }); this.propertyCache.set(type, propMetadata); } return propMetadata; } /** * @param {?} type * @return {?} */ parameters(type) { if (!(type instanceof StaticSymbol)) { this.reportError(new Error(`parameters received ${JSON.stringify(type)} which is not a StaticSymbol`), type); return []; } try { let /** @type {?} */ parameters = this.parameterCache.get(type); if (!parameters) { const /** @type {?} */ classMetadata = this.getTypeMetadata(type); const /** @type {?} */ parentType = this.findParentType(type, classMetadata); const /** @type {?} */ members = classMetadata ? classMetadata['members'] : null; const /** @type {?} */ ctorData = members ? members['__ctor__'] : null; if (ctorData) { const /** @type {?} */ ctor = (/** @type {?} */ (ctorData)).find(a => a['__symbolic'] == 'constructor'); const /** @type {?} */ rawParameterTypes = /** @type {?} */ (ctor['parameters']) || []; const /** @type {?} */ parameterDecorators = /** @type {?} */ (this.simplify(type, ctor['parameterDecorators'] || [])); parameters = []; rawParameterTypes.forEach((rawParamType, index) => { const /** @type {?} */ nestedResult = []; const /** @type {?} */ paramType = this.trySimplify(type, rawParamType); if (paramType) nestedResult.push(paramType); const /** @type {?} */ decorators = parameterDecorators ? parameterDecorators[index] : null; if (decorators) { nestedResult.push(...decorators); } /** @type {?} */ ((parameters)).push(nestedResult); }); } else if (parentType) { parameters = this.parameters(parentType); } if (!parameters) { parameters = []; } this.parameterCache.set(type, parameters); } return parameters; } catch (/** @type {?} */ e) { console.error(`Failed on type ${JSON.stringify(type)} with error ${e}`); throw e; } } /** * @param {?} type * @return {?} */ _methodNames(type) { let /** @type {?} */ methodNames = this.methodCache.get(type); if (!methodNames) { const /** @type {?} */ classMetadata = this.getTypeMetadata(type); methodNames = {}; const /** @type {?} */ parentType = this.findParentType(type, classMetadata); if (parentType) { const /** @type {?} */ parentMethodNames = this._methodNames(parentType); Object.keys(parentMethodNames).forEach((parentProp) => { /** @type {?} */ ((methodNames))[parentProp] = parentMethodNames[parentProp]; }); } const /** @type {?} */ members = classMetadata['members'] || {}; Object.keys(members).forEach((propName) => { const /** @type {?} */ propData = members[propName]; const /** @type {?} */ isMethod = (/** @type {?} */ (propData)).some(a => a['__symbolic'] == 'method'); /** @type {?} */ ((methodNames))[propName] = /** @type {?} */ ((methodNames))[propName] || isMethod; }); this.methodCache.set(type, methodNames); } return methodNames; } /** * @param {?} type * @return {?} */ _staticMembers(type) { let /** @type {?} */ staticMembers = this.staticCache.get(type); if (!staticMembers) { const /** @type {?} */ classMetadata = this.getTypeMetadata(type); const /** @type {?} */ staticMemberData = classMetadata['statics'] || {}; staticMembers = Object.keys(staticMemberData); this.staticCache.set(type, staticMembers); } return staticMembers; } /** * @param {?} type * @param {?} classMetadata * @return {?} */ findParentType(type, classMetadata) { const /** @type {?} */ parentType = this.trySimplify(type, classMetadata['extends']); if (parentType instanceof StaticSymbol) { return parentType; } } /** * @param {?} type * @param {?} lcProperty * @return {?} */ hasLifecycleHook(type, lcProperty) { if (!(type instanceof StaticSymbol)) { this.reportError(new Error(`hasLifecycleHook received ${JSON.stringify(type)} which is not a StaticSymbol`), type); } try { return !!this._methodNames(type)[lcProperty]; } catch (/** @type {?} */ e) { console.error(`Failed on type ${JSON.stringify(type)} with error ${e}`); throw e; } } /** * @param {?} type * @return {?} */ guards(type) { if (!(type instanceof StaticSymbol)) { this.reportError(new Error(`guards received ${JSON.stringify(type)} which is not a StaticSymbol`), type); return {}; } const /** @type {?} */ staticMembers = this._staticMembers(type); const /** @type {?} */ result = {}; for (let /** @type {?} */ name of staticMembers) { if (name.endsWith(TYPEGUARD_POSTFIX)) { let /** @type {?} */ property = name.substr(0, name.length - TYPEGUARD_POSTFIX.length); let /** @type {?} */ value; if (property.endsWith(USE_IF)) { property = name.substr(0, property.length - USE_IF.length); value = USE_IF; } else { value = this.getStaticSymbol(type.filePath, type.name, [name]); } result[property] = value; } } return result; } /** * @param {?} type * @param {?} ctor * @return {?} */ _registerDecoratorOrConstructor(type, ctor) { this.conversionMap.set(type, (context, args) => new ctor(...args)); } /** * @param {?} type * @param {?} fn * @return {?} */ _registerFunction(type, fn) { this.conversionMap.set(type, (context, args) => fn.apply(undefined, args)); } /** * @return {?} */ initializeConversionMap() { this.injectionToken = this.findDeclaration(ANGULAR_CORE, 'InjectionToken'); this.opaqueToken = this.findDeclaration(ANGULAR_CORE, 'OpaqueToken'); this.ROUTES = this.tryFindDeclaration(ANGULAR_ROUTER, 'ROUTES'); this.ANALYZE_FOR_ENTRY_COMPONENTS = this.findDeclaration(ANGULAR_CORE, 'ANALYZE_FOR_ENTRY_COMPONENTS'); this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Host'), createHost); this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Injectable'), createInjectable); this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Self'), createSelf); this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'SkipSelf'), createSkipSelf); this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Inject'), createInject); this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Optional'), createOptional); this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Attribute'), createAttribute); this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'ContentChild'), createContentChild); this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'ContentChildren'), createContentChildren); this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'ViewChild'), createViewChild); this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'ViewChildren'), createViewChildren); this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Input'), createInput); this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Output'), createOutput); this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Pipe'), createPipe); this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'HostBinding'), createHostBinding); this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'HostListener'), createHostListener); this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Directive'), createDirective); this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Component'), createComponent); this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'NgModule'), createNgModule); // Note: Some metadata classes can be used directly with Provider.deps. this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Host'), createHost); this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Self'), createSelf); this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'SkipSelf'), createSkipSelf); this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Optional'), createOptional); } /** * getStaticSymbol produces a Type whose metadata is known but whose implementation is not loaded. * All types passed to the StaticResolver should be pseudo-types returned by this method. * * @param {?} declarationFile the absolute path of the file where the symbol is declared * @param {?} name the name of the type. * @param {?=} members * @return {?} */ getStaticSymbol(declarationFile, name, members) { return this.symbolResolver.getStaticSymbol(declarationFile, name, members); } /** * Simplify but discard any errors * @param {?} context * @param {?} value * @return {?} */ trySimplify(context, value) { const /** @type {?} */ originalRecorder = this.errorRecorder; this.errorRecorder = (error, fileName) => { }; const /** @type {?} */ result = this.simplify(context, value); this.errorRecorder = originalRecorder; return result; } /** * \@internal * @param {?} context * @param {?} value * @return {?} */ simplify(context, value) { const /** @type {?} */ self = this; let /** @type {?} */ scope = BindingScope.empty; const /** @type {?} */ calling = new Map(); const /** @type {?} */ rootContext = context; /** * @param {?} context * @param {?} value * @param {?} depth * @param {?} references * @return {?} */ function simplifyInContext(context, value, depth, references) { /** * @param {?} staticSymbol * @return {?} */ function resolveReferenceValue(staticSymbol) { const /** @type {?} */ resolvedSymbol = self.symbolResolver.resolveSymbol(staticSymbol); return resolvedSymbol ? resolvedSymbol.metadata : null; } /** * @param {?} value * @return {?} */ function simplifyEagerly(value) { return simplifyInContext(context, value, depth, 0); } /** * @param {?} value * @return {?} */ function simplifyLazily(value) { return simplifyInContext(context, value, depth, references + 1); } /** * @param {?} nestedContext * @param {?} value * @return {?} */ function simplifyNested(nestedContext, value) { if (nestedContext === context) { // If the context hasn't changed let the exception propagate unmodified. return simplifyInContext(nestedContext, value, depth + 1, references); } try { return simplifyInContext(nestedContext, value, depth + 1, references); } catch (/** @type {?} */ e) { if (isMetadataError(e)) { // Propagate the message text up but add a message to the chain that explains how we got // here. // e.chain implies e.symbol const /** @type {?} */ summaryMsg = e.chain ? 'references \'' + /** @type {?} */ ((e.symbol)).name + '\'' : errorSummary(e); const /** @type {?} */ summary = `'${nestedContext.name}' ${summaryMsg}`; const /** @type {?} */ chain = { message: summary, position: e.position, next: e.chain }; // TODO(chuckj): retrieve the position information indirectly from the collectors node // map if the metadata is from a .ts file. self.error({ message: e.message, advise: e.advise, context: e.context, chain, symbol: nestedContext }, context); } else { // It is probably an internal error. throw e; } } } /** * @param {?} functionSymbol * @param {?} targetFunction * @param {?} args * @param {?} targetExpression * @return {?} */ function simplifyCall(functionSymbol, targetFunction, args, targetExpression) { if (targetFunction && targetFunction['__symbolic'] == 'function') { if (calling.get(functionSymbol)) { self.error({ message: 'Recursion is not supported', summary: `called '${functionSymbol.name}' recursively`, value: targetFunction }, functionSymbol); } try { const /** @type {?} */ value = targetFunction['value']; if (value && (depth != 0 || value.__symbolic != 'error')) { const /** @type {?} */ parameters = targetFunction['parameters']; const /** @type {?} */ defaults = targetFunction.defaults; args = args.map(arg => simplifyNested(context, arg)) .map(arg => shouldIgnore(arg) ? undefined : arg); if (defaults && defaults.length > args.length) { args.push(...defaults.slice(args.length).map((value) => simplify(value))); } calling.set(functionSymbol, true); const /** @type {?} */ functionScope = BindingScope.build(); for (let /** @type {?} */ i = 0; i < parameters.length; i++) { functionScope.define(parameters[i], args[i]); } const /** @type {?} */ oldScope = scope; let /** @type {?} */ result; try { scope = functionScope.done(); result = simplifyNested(functionSymbol, value); } finally { scope = oldScope; } return result; } } finally { calling.delete(functionSymbol); } } if (depth === 0) { // If depth is 0 we are evaluating the top level expression that is describing element // decorator. In this case, it is a decorator we don't understand, such as a custom // non-angular decorator, and we should just ignore it. return IGNORE; } let /** @type {?} */ position = undefined; if (targetExpression && targetExpression.__symbolic == 'resolved') { const /** @type {?} */ line = targetExpression.line; const /** @type {?} */ character = targetExpression.character; const /** @type {?} */ fileName = targetExpression.fileName; if (fileName != null && line != null && character != null) { position = { fileName, line, column: character }; } } self.error({ message: FUNCTION_CALL_NOT_SUPPORTED, context: functionSymbol, value: targetFunction, position }, context); } /** * @param {?} expression * @return {?} */ function simplify(expression) { if (isPrimitive(expression)) { return expression; } if (expression instanceof Array) { const /** @type {?} */ result = []; for (const /** @type {?} */ item of (/** @type {?} */ (expression))) { // Check for a spread expression if (item && item.__symbolic === 'spread') { // We call with references as 0 because we require the actual value and cannot // tolerate a reference here. const /** @type {?} */ spreadArray = simplifyEagerly(item.expression); if (Array.isArray(spreadArray)) { for (const /** @type {?} */ spreadItem of spreadArray) { result.push(spreadItem); } continue; } } const /** @type {?} */ value = simplify(item); if (shouldIgnore(value)) { continue; } result.push(value); } return result; } if (expression instanceof StaticSymbol) { // Stop simplification at builtin symbols or if we are in a reference context and // the symbol doesn't have members. if (expression === self.injectionToken || self.conversionMap.has(expression) || (references > 0 && !expression.members.length)) { return expression; } else { const /** @type {?} */ staticSymbol = expression; const /** @type {?} */ declarationValue = resolveReferenceValue(staticSymbol); if (declarationValue != null) { return simplifyNested(staticSymbol, declarationValue); } else { return staticSymbol; } } } if (expression) { if (expression['__symbolic']) { let /** @type {?} */ staticSymbol; switch (expression['__symbolic']) { case 'binop': let /** @type {?} */ left = simplify(expression['left']); if (shouldIgnore(left)) return left; let /** @type {?} */ right = simplify(expression['right']); if (shouldIgnore(right)) return right; switch (expression['operator']) { case '&&': return left && right; case '||': return left || right; case '|': return left | right; case '^': return left ^ right; case '&': return left & right; case '==': return left == right; case '!=': return left != right; case '===': return left === right; case '!==': return left !== right; case '<': return left < right; case '>': return left > right; case '<=': return left <= right; case '>=': return left >= right; case '<<': return left << right; case '>>': return left >> right; case '+': return left + right; case '-': return left - right; case '*': return left * right; case '/': return left / right; case '%': return left % right; } return null; case 'if': let /** @type {?} */ condition = simplify(expression['condition']); return condition ? simplify(expression['thenExpression']) : simplify(expression['elseExpression']); case 'pre': let /** @type {?} */ operand = simplify(expression['operand']); if (shouldIgnore(operand)) return operand; switch (expression['operator']) { case '+': return operand; case '-': return -operand; case '!': return !operand; case '~': return ~operand; } return null; case 'index': let /** @type {?} */ indexTarget = simplifyEagerly(expression['expression']); let /** @type {?} */ index = simplifyEagerly(expression['index']); if (indexTarget && isPrimitive(index)) return indexTarget[index]; return null; case 'select': const /** @type {?} */ member = expression['member']; let /** @type {?} */ selectContext = context; let /** @type {?} */ selectTarget = simplify(expression['expression']); if (selectTarget instanceof StaticSymbol) { const /** @type {?} */ members = selectTarget.members.concat(member); selectContext = self.getStaticSymbol(selectTarget.filePath, selectTarget.name, members); const /** @type {?} */ declarationValue = resolveReferenceValue(selectContext); if (declarationValue != null) { return simplifyNested(selectContext, declarationValue); } else { return selectContext; } } if (selectTarget && isPrimitive(member)) return simplifyNested(selectContext, selectTarget[member]); return null; case 'reference': // Note: This only has to deal with variable references, as symbol references have // been converted into 'resolved' // in the StaticSymbolResolver. const /** @type {?} */ name = expression['name']; const /** @type {?} */ localValue = scope.resolve(name); if (localValue != BindingScope.missing) { return localValue; } break; case 'resolved': try { return simplify(expression.symbol); } catch (/** @type {?} */ e) { // If an error is reported evaluating the symbol record the position of the // reference in the error so it can // be reported in the error message generated from the exception. if (isMetadataError(e) && expression.fileName != null && expression.line != null && expression.character != null) { e.position = { fileName: expression.fileName, line: expression.line, column: expression.character }; } throw e; } case 'class': return context; case 'function': return context; case 'new': case 'call': // Determine if the function is a built-in conversion staticSymbol = simplifyInContext(context, expression['expression'], depth + 1, /* references */ 0); if (staticSymbol instanceof StaticSymbol) { if (staticSymbol === self.injectionToken || staticSymbol === self.opaqueToken) { // if somebody calls new InjectionToken, don't create an InjectionToken, // but rather return the symbol to which the InjectionToken is assigned to. // OpaqueToken is supported too as it is required by the language service to // support v4 and prior versions of Angular. return context; } const /** @type {?} */ argExpressions = expression['arguments'] || []; let /** @type {?} */ converter = self.conversionMap.get(staticSymbol); if (converter) { const /** @type {?} */ args = argExpressions.map(arg => simplifyNested(context, arg)) .map(arg => shouldIgnore(arg) ? undefined : arg); return converter(context, args); } else { // Determine if the function is one we can simplify. const /** @type {?} */ targetFunction = resolveReferenceValue(staticSymbol); return simplifyCall(staticSymbol, targetFunction, argExpressions, expression['expression']); } } return IGNORE; case 'error': let /** @type {?} */ message = expression.message; if (expression['line'] != null) { self.error({ message, context: expression.context, value: expression, position: { fileName: expression['fileName'], line: expression['line'], column: expression['character'] } }, context); } else { self.error({ message, context: expression.context }, context); } return IGNORE; case 'ignore': return expression; } return null; } return mapStringMap(expression, (value, name) => { if (REFERENCE_SET.has(name)) { if (name === USE_VALUE && PROVIDE in expression) { // If this is a provider expression, check for special tokens that need the value // during analysis. const /** @type {?} */ provide = simplify(expression.provide); if (provide === self.ROUTES || provide == self.ANALYZE_FOR_ENTRY_COMPONENTS) { return simplify(value); } } return simplifyLazily(value); } return simplify(value); }); } return IGNORE; } return simplify(value); } let /** @type {?} */ result; try { result = simplifyInContext(context, value, 0, 0); } catch (/** @type {?} */ e) { if (this.errorRecorder) { this.reportError(e, context); } else { throw formatMetadataError(e, context); } } if (shouldIgnore(result)) { return undefined; } return result; } /** * @param {?} type * @return {?} */ getTypeMetadata(type) { const /** @type {?} */ resolvedSymbol = this.symbolResolver.resolveSymbol(type); return resolvedSymbol && resolvedSymbol.metadata ? resolvedSymbol.metadata : { __symbolic: 'class' }; } /** * @param {?} error * @param {?} context * @param {?=} path * @return {?} */ reportError(error, context, path) { if (this.errorRecorder) { this.errorRecorder(formatMetadataError(error, context), (context && context.filePath) || path); } else { throw error; } } /** * @param {?} __0 * @param {?} reportingContext * @return {?} */ error({ message, summary, advise, position, context, value, symbol, chain }, reportingContext) { this.reportError(metadataError(message, summary, advise, position, symbol, context, chain), reportingContext); } } const METADATA_ERROR = 'ngMetadataError'; /** * @param {?} message * @param {?=} summary * @param {?=} advise * @param {?=} position * @param {?=} symbol * @param {?=} context * @param {?=} chain * @return {?} */ function metadataError(message, summary, advise, position, symbol, context, chain) { const /** @type {?} */ error = /** @type {?} */ (syntaxError(message)); (/** @type {?} */ (error))[METADATA_ERROR] = true; if (advise) error.advise = advise; if (position) error.position = position; if (summary) error.summary = summary; if (context) error.context = context; if (chain) error.chain = chain; if (symbol) error.symbol = symbol; return error; } /** * @param {?} error * @return {?} */ function isMetadataError(error) { return !!(/** @type {?} */ (error))[METADATA_ERROR]; } const REFERENCE_TO_NONEXPORTED_CLASS = 'Reference to non-exported class'; const VARIABLE_NOT_INITIALIZED = 'Variable not initialized'; const DESTRUCTURE_NOT_SUPPORTED = 'Destructuring not supported'; const COULD_NOT_RESOLVE_TYPE = 'Could not resolve type'; const FUNCTION_CALL_NOT_SUPPORTED = 'Function call not supported'; const REFERENCE_TO_LOCAL_SYMBOL = 'Reference to a local symbol'; const LAMBDA_NOT_SUPPORTED = 'Lambda not supported'; /** * @param {?} message * @param {?} context * @return {?} */ function expandedMessage(message, context) { switch (message) { case REFERENCE_TO_NONEXPORTED_CLASS: if (context && context.className) { return `References to a non-exported class are not supported in decorators but ${context.className} was referenced.`; } break; case VARIABLE_NOT_INITIALIZED: return 'Only initialized variables and constants can be referenced in decorators because the value of this variable is needed by the template compiler'; case DESTRUCTURE_NOT_SUPPORTED: return 'Referencing an exported destructured variable or constant is not supported in decorators and this value is needed by the template compiler'; case COULD_NOT_RESOLVE_TYPE: if (context && context.typeName) { return `Could not resolve type ${context.typeName}`; } break; case FUNCTION_CALL_NOT_SUPPORTED: if (context && context.name) { return `Function calls are not supported in decorators but '${context.name}' was called`; } return 'Function calls are not supported in decorators'; case REFERENCE_TO_LOCAL_SYMBOL: if (context && context.name) { return `Reference to a local (non-exported) symbols are not supported in decorators but '${context.name}' was referenced`; } break; case LAMBDA_NOT_SUPPORTED: return `Function expressions are not supported in decorators`; } return message; } /** * @param {?} message * @param {?} context * @return {?} */ function messageAdvise(message, context) { switch (message) { case REFERENCE_TO_NONEXPORTED_CLASS: if (context && context.className) { return `Consider exporting '${context.className}'`; } break; case DESTRUCTURE_NOT_SUPPORTED: return 'Consider simplifying to avoid destructuring'; case REFERENCE_TO_LOCAL_SYMBOL: if (context && context.name) { return `Consider exporting '${context.name}'`; } break; case LAMBDA_NOT_SUPPORTED: return `Consider changing the function expression into an exported function`; } return undefined; } /** * @param {?} error * @return {?} */ function errorSummary(error) { if (error.summary) { return error.summary; } switch (error.message) { case REFERENCE_TO_NONEXPORTED_CLASS: if (error.context && error.context.className) { return `references non-exported class ${error.context.className}`; } break; case VARIABLE_NOT_INITIALIZED: return 'is not initialized'; case DESTRUCTURE_NOT_SUPPORTED: return 'is a destructured variable'; case COULD_NOT_RESOLVE_TYPE: return 'could not be resolved'; case FUNCTION_CALL_NOT_SUPPORTED: if (error.context && error.context.name) { return `calls '${error.context.name}'`; } return `calls a function`; case REFERENCE_TO_LOCAL_SYMBOL: if (error.context && error.context.name) { return `references local variable ${error.context.name}`; } return `references a local variable`; } return 'contains the error'; } /** * @param {?} input * @param {?} transform * @return {?} */ function mapStringMap(input, transform) { if (!input) return {}; const /** @type {?} */ result = {}; Object.keys(input).forEach((key) => { const /** @type {?} */ value = transform(input[key], key); if (!shouldIgnore(value)) { if (HIDDEN_KEY.test(key)) { Object.defineProperty(result, key, { enumerable: false, configurable: true, value: value }); } else { result[key] = value; } } }); return result; } /** * @param {?} o * @return {?} */ function isPrimitive(o) { return o === null || (typeof o !== 'function' && typeof o !== 'object'); } /** * @abstract */ class BindingScope { /** * @return {?} */ static build() { const /** @type {?} */ current = new Map(); return { define: function (name, value) { current.set(name, value); return this; }, done: function () { return current.size > 0 ? new PopulatedScope(current) : BindingScope.empty; } }; } } BindingScope.missing = {}; BindingScope.empty = { resolve: name => BindingScope.missing }; class PopulatedScope extends BindingScope { /** * @param {?} bindings */ constructor(bindings) { super(); this.bindings = bindings; } /** * @param {?} name * @return {?} */ resolve(name) { return this.bindings.has(name) ? this.bindings.get(name) : BindingScope.missing; } } /** * @param {?} chain * @param {?} advise * @return {?} */ function formatMetadataMessageChain(chain, advise) { const /** @type {?} */ expanded = expandedMessage(chain.message, chain.context); const /** @type {?} */ nesting = chain.symbol ? ` in '${chain.symbol.name}'` : ''; const /** @type {?} */ message = `${expanded}${nesting}`; const /** @type {?} */ position = chain.position; const /** @type {?} */ next = chain.next ? formatMetadataMessageChain(chain.next, advise) : advise ? { message: advise } : undefined; return { message, position, next }; } /** * @param {?} e * @param {?} context * @return {?} */ function formatMetadataError(e, context) { if (isMetadataError(e)) { // Produce a formatted version of the and leaving enough information in the original error // to recover the formatting information to eventually produce a diagnostic error message. const /** @type {?} */ position = e.position; const /** @type {?} */ chain = { message: `Error during template compile of '${context.name}'`, position: position, next: { message: e.message, next: e.chain, context: e.context, symbol: e.symbol } }; const /** @type {?} */ advise = e.advise || messageAdvise(e.message, e.context); return formattedError(formatMetadataMessageChain(chain, advise)); } return e; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @record */ class AotSummaryResolver { /** * @param {?} host * @param {?} staticSymbolCache */ constructor(host, staticSymbolCache) { this.host = host; this.staticSymbolCache = staticSymbolCache; this.summaryCache = new Map(); this.loadedFilePaths = new Map(); this.importAs = new Map(); this.knownFileNameToModuleNames = new Map(); } /** * @param {?} filePath * @return {?} */ isLibraryFile(filePath) { // Note: We need to strip the .ngfactory. file path, // so this method also works for generated files // (for which host.isSourceFile will always return false). return !this.host.isSourceFile(stripGeneratedFileSuffix(filePath)); } /** * @param {?} filePath * @param {?} referringSrcFileName * @return {?} */ toSummaryFileName(filePath, referringSrcFileName) { return this.host.toSummaryFileName(filePath, referringSrcFileName); } /** * @param {?} fileName * @param {?} referringLibFileName * @return {?} */ fromSummaryFileName(fileName, referringLibFileName) { return this.host.fromSummaryFileName(fileName, referringLibFileName); } /** * @param {?} staticSymbol * @return {?} */ resolveSummary(staticSymbol) { const /** @type {?} */ rootSymbol = staticSymbol.members.length ? this.staticSymbolCache.get(staticSymbol.filePath, staticSymbol.name) : staticSymbol; let /** @type {?} */ summary = this.summaryCache.get(rootSymbol); if (!summary) { this._loadSummaryFile(staticSymbol.filePath); summary = /** @type {?} */ ((this.summaryCache.get(staticSymbol))); } return (rootSymbol === staticSymbol && summary) || null; } /** * @param {?} filePath * @return {?} */ getSymbolsOf(filePath) { if (this._loadSummaryFile(filePath)) { return Array.from(this.summaryCache.keys()).filter((symbol) => symbol.filePath === filePath); } return null; } /** * @param {?} staticSymbol * @return {?} */ getImportAs(staticSymbol) { staticSymbol.assertNoMembers(); return /** @type {?} */ ((this.importAs.get(staticSymbol))); } /** * Converts a file path to a module name that can be used as an `import`. * @param {?} importedFilePath * @return {?} */ getKnownModuleName(importedFilePath) { return this.knownFileNameToModuleNames.get(importedFilePath) || null; } /** * @param {?} summary * @return {?} */ addSummary(summary) { this.summaryCache.set(summary.symbol, summary); } /** * @param {?} filePath * @return {?} */ _loadSummaryFile(filePath) { let /** @type {?} */ hasSummary = this.loadedFilePaths.get(filePath); if (hasSummary != null) { return hasSummary; } let /** @type {?} */ json = null; if (this.isLibraryFile(filePath)) { const /** @type {?} */ summaryFilePath = summaryFileName(filePath); try { json = this.host.loadSummary(summaryFilePath); } catch (/** @type {?} */ e) { console.error(`Error loading summary file ${summaryFilePath}`); throw e; } } hasSummary = json != null; this.loadedFilePaths.set(filePath, hasSummary); if (json) { const { moduleName, summaries, importAs } = deserializeSummaries(this.staticSymbolCache, this, filePath, json); summaries.forEach((summary) => this.summaryCache.set(summary.symbol, summary)); if (moduleName) { this.knownFileNameToModuleNames.set(filePath, moduleName); } importAs.forEach((importAs) => { this.importAs.set(importAs.symbol, importAs.importAs); }); } return hasSummary; } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @param {?} host * @return {?} */ function createAotUrlResolver(host) { return { resolve: (basePath, url) => { const /** @type {?} */ filePath = host.resourceNameToFileName(url, basePath); if (!filePath) { throw syntaxError(`Couldn't resolve resource ${url} from ${basePath}`); } return filePath; } }; } /** * Creates a new AotCompiler based on options and a host. * @param {?} compilerHost * @param {?} options * @param {?=} errorCollector * @return {?} */ function createAotCompiler(compilerHost, options, errorCollector) { let /** @type {?} */ translations = options.translations || ''; const /** @type {?} */ urlResolver = createAotUrlResolver(compilerHost); const /** @type {?} */ symbolCache = new StaticSymbolCache(); const /** @type {?} */ summaryResolver = new AotSummaryResolver(compilerHost, symbolCache); const /** @type {?} */ symbolResolver = new StaticSymbolResolver(compilerHost, symbolCache, summaryResolver); const /** @type {?} */ staticReflector = new StaticReflector(summaryResolver, symbolResolver, [], [], errorCollector); const /** @type {?} */ htmlParser = new I18NHtmlParser(new HtmlParser(), translations, options.i18nFormat, options.missingTranslation, console); const /** @type {?} */ config = new CompilerConfig({ defaultEncapsulation: ViewEncapsulation.Emulated, useJit: false, enableLegacyTemplate: options.enableLegacyTemplate === true, missingTranslation: options.missingTranslation, preserveWhitespaces: options.preserveWhitespaces, strictInjectionParameters: options.strictInjectionParameters, }); const /** @type {?} */ normalizer = new DirectiveNormalizer({ get: (url) => compilerHost.loadResource(url) }, urlResolver, htmlParser, config); const /** @type {?} */ expressionParser = new Parser(new Lexer()); const /** @type {?} */ elementSchemaRegistry = new DomElementSchemaRegistry(); const /** @type {?} */ tmplParser = new TemplateParser(config, staticReflector, expressionParser, elementSchemaRegistry, htmlParser, console, []); const /** @type {?} */ resolver = new CompileMetadataResolver(config, htmlParser, new NgModuleResolver(staticReflector), new DirectiveResolver(staticReflector), new PipeResolver(staticReflector), summaryResolver, elementSchemaRegistry, normalizer, console, symbolCache, staticReflector, errorCollector); // TODO(vicb): do not pass options.i18nFormat here const /** @type {?} */ viewCompiler = new ViewCompiler(staticReflector); const /** @type {?} */ typeCheckCompiler = new TypeCheckCompiler(options, staticReflector); const /** @type {?} */ compiler = new AotCompiler(config, options, compilerHost, staticReflector, resolver, tmplParser, new StyleCompiler(urlResolver), viewCompiler, typeCheckCompiler, new NgModuleCompiler(staticReflector), new TypeScriptEmitter(), summaryResolver, symbolResolver); return { compiler, reflector: staticReflector }; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @record * @template T */ /** * @abstract * @template T */ class SummaryResolver { } class JitSummaryResolver { constructor() { this._summaries = new Map(); } /** * @return {?} */ isLibraryFile() { return false; } /** * @param {?} fileName * @return {?} */ toSummaryFileName(fileName) { return fileName; } /** * @param {?} fileName * @return {?} */ fromSummaryFileName(fileName) { return fileName; } /** * @param {?} reference * @return {?} */ resolveSummary(reference) { return this._summaries.get(reference) || null; } /** * @return {?} */ getSymbolsOf() { return []; } /** * @param {?} reference * @return {?} */ getImportAs(reference) { return reference; } /** * @param {?} fileName * @return {?} */ getKnownModuleName(fileName) { return null; } /** * @param {?} summary * @return {?} */ addSummary(summary) { this._summaries.set(summary.symbol, summary); } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @param {?} statements * @param {?} reflector * @return {?} */ function interpretStatements(statements, reflector) { const /** @type {?} */ ctx = new _ExecutionContext(null, null, null, new Map()); const /** @type {?} */ visitor = new StatementInterpreter(reflector); visitor.visitAllStatements(statements, ctx); const /** @type {?} */ result = {}; ctx.exports.forEach((exportName) => { result[exportName] = ctx.vars.get(exportName); }); return result; } /** * @param {?} varNames * @param {?} varValues * @param {?} statements * @param {?} ctx * @param {?} visitor * @return {?} */ function _executeFunctionStatements(varNames, varValues, statements, ctx, visitor) { const /** @type {?} */ childCtx = ctx.createChildWihtLocalVars(); for (let /** @type {?} */ i = 0; i < varNames.length; i++) { childCtx.vars.set(varNames[i], varValues[i]); } const /** @type {?} */ result = visitor.visitAllStatements(statements, childCtx); return result ? result.value : null; } class _ExecutionContext { /** * @param {?} parent * @param {?} instance * @param {?} className * @param {?} vars */ constructor(parent, instance, className, vars) { this.parent = parent; this.instance = instance; this.className = className; this.vars = vars; this.exports = []; } /** * @return {?} */ createChildWihtLocalVars() { return new _ExecutionContext(this, this.instance, this.className, new Map()); } } class ReturnValue { /** * @param {?} value */ constructor(value) { this.value = value; } } /** * @param {?} _classStmt * @param {?} _ctx * @param {?} _visitor * @return {?} */ function createDynamicClass(_classStmt, _ctx, _visitor) { const /** @type {?} */ propertyDescriptors = {}; _classStmt.getters.forEach((getter) => { // Note: use `function` instead of arrow function to capture `this` propertyDescriptors[getter.name] = { configurable: false, get: function () { const /** @type {?} */ instanceCtx = new _ExecutionContext(_ctx, this, _classStmt.name, _ctx.vars); return _executeFunctionStatements([], [], getter.body, instanceCtx, _visitor); } }; }); _classStmt.methods.forEach(function (method) { const /** @type {?} */ paramNames = method.params.map(param => param.name); // Note: use `function` instead of arrow function to capture `this` propertyDescriptors[/** @type {?} */ ((method.name))] = { writable: false, configurable: false, value: function (...args) { const /** @type {?} */ instanceCtx = new _ExecutionContext(_ctx, this, _classStmt.name, _ctx.vars); return _executeFunctionStatements(paramNames, args, method.body, instanceCtx, _visitor); } }; }); const /** @type {?} */ ctorParamNames = _classStmt.constructorMethod.params.map(param => param.name); // Note: use `function` instead of arrow function to capture `this` const /** @type {?} */ ctor = function (...args) { const /** @type {?} */ instanceCtx = new _ExecutionContext(_ctx, this, _classStmt.name, _ctx.vars); _classStmt.fields.forEach((field) => { this[field.name] = undefined; }); _executeFunctionStatements(ctorParamNames, args, _classStmt.constructorMethod.body, instanceCtx, _visitor); }; const /** @type {?} */ superClass = _classStmt.parent ? _classStmt.parent.visitExpression(_visitor, _ctx) : Object; ctor.prototype = Object.create(superClass.prototype, propertyDescriptors); return ctor; } class StatementInterpreter { /** * @param {?} reflector */ constructor(reflector) { this.reflector = reflector; } /** * @param {?} ast * @return {?} */ debugAst(ast) { return debugOutputAstAsTypeScript(ast); } /** * @param {?} stmt * @param {?} ctx * @return {?} */ visitDeclareVarStmt(stmt, ctx) { ctx.vars.set(stmt.name, stmt.value.visitExpression(this, ctx)); if (stmt.hasModifier(StmtModifier.Exported)) { ctx.exports.push(stmt.name); } return null; } /** * @param {?} expr * @param {?} ctx * @return {?} */ visitWriteVarExpr(expr, ctx) { const /** @type {?} */ value = expr.value.visitExpression(this, ctx); let /** @type {?} */ currCtx = ctx; while (currCtx != null) { if (currCtx.vars.has(expr.name)) { currCtx.vars.set(expr.name, value); return value; } currCtx = /** @type {?} */ ((currCtx.parent)); } throw new Error(`Not declared variable ${expr.name}`); } /** * @param {?} ast * @param {?} ctx * @return {?} */ visitReadVarExpr(ast, ctx) { let /** @type {?} */ varName = /** @type {?} */ ((ast.name)); if (ast.builtin != null) { switch (ast.builtin) { case BuiltinVar.Super: return ctx.instance.__proto__; case BuiltinVar.This: return ctx.instance; case BuiltinVar.CatchError: varName = CATCH_ERROR_VAR$2; break; case BuiltinVar.CatchStack: varName = CATCH_STACK_VAR$2; break; default: throw new Error(`Unknown builtin variable ${ast.builtin}`); } } let /** @type {?} */ currCtx = ctx; while (currCtx != null) { if (currCtx.vars.has(varName)) { return currCtx.vars.get(varName); } currCtx = /** @type {?} */ ((currCtx.parent)); } throw new Error(`Not declared variable ${varName}`); } /** * @param {?} expr * @param {?} ctx * @return {?} */ visitWriteKeyExpr(expr, ctx) { const /** @type {?} */ receiver = expr.receiver.visitExpression(this, ctx); const /** @type {?} */ index = expr.index.visitExpression(this, ctx); const /** @type {?} */ value = expr.value.visitExpression(this, ctx); receiver[index] = value; return value; } /** * @param {?} expr * @param {?} ctx * @return {?} */ visitWritePropExpr(expr, ctx) { const /** @type {?} */ receiver = expr.receiver.visitExpression(this, ctx); const /** @type {?} */ value = expr.value.visitExpression(this, ctx); receiver[expr.name] = value; return value; } /** * @param {?} expr * @param {?} ctx * @return {?} */ visitInvokeMethodExpr(expr, ctx) { const /** @type {?} */ receiver = expr.receiver.visitExpression(this, ctx); const /** @type {?} */ args = this.visitAllExpressions(expr.args, ctx); let /** @type {?} */ result; if (expr.builtin != null) { switch (expr.builtin) { case BuiltinMethod.ConcatArray: result = receiver.concat(...args); break; case BuiltinMethod.SubscribeObservable: result = receiver.subscribe({ next: args[0] }); break; case BuiltinMethod.Bind: result = receiver.bind(...args); break; default: throw new Error(`Unknown builtin method ${expr.builtin}`); } } else { result = receiver[/** @type {?} */ ((expr.name))].apply(receiver, args); } return result; } /** * @param {?} stmt * @param {?} ctx * @return {?} */ visitInvokeFunctionExpr(stmt, ctx) { const /** @type {?} */ args = this.visitAllExpressions(stmt.args, ctx); const /** @type {?} */ fnExpr = stmt.fn; if (fnExpr instanceof ReadVarExpr && fnExpr.builtin === BuiltinVar.Super) { ctx.instance.constructor.prototype.constructor.apply(ctx.instance, args); return null; } else { const /** @type {?} */ fn$$1 = stmt.fn.visitExpression(this, ctx); return fn$$1.apply(null, args); } } /** * @param {?} stmt * @param {?} ctx * @return {?} */ visitReturnStmt(stmt, ctx) { return new ReturnValue(stmt.value.visitExpression(this, ctx)); } /** * @param {?} stmt * @param {?} ctx * @return {?} */ visitDeclareClassStmt(stmt, ctx) { const /** @type {?} */ clazz = createDynamicClass(stmt, ctx, this); ctx.vars.set(stmt.name, clazz); if (stmt.hasModifier(StmtModifier.Exported)) { ctx.exports.push(stmt.name); } return null; } /** * @param {?} stmt * @param {?} ctx * @return {?} */ visitExpressionStmt(stmt, ctx) { return stmt.expr.visitExpression(this, ctx); } /** * @param {?} stmt * @param {?} ctx * @return {?} */ visitIfStmt(stmt, ctx) { const /** @type {?} */ condition = stmt.condition.visitExpression(this, ctx); if (condition) { return this.visitAllStatements(stmt.trueCase, ctx); } else if (stmt.falseCase != null) { return this.visitAllStatements(stmt.falseCase, ctx); } return null; } /** * @param {?} stmt * @param {?} ctx * @return {?} */ visitTryCatchStmt(stmt, ctx) { try { return this.visitAllStatements(stmt.bodyStmts, ctx); } catch (/** @type {?} */ e) { const /** @type {?} */ childCtx = ctx.createChildWihtLocalVars(); childCtx.vars.set(CATCH_ERROR_VAR$2, e); childCtx.vars.set(CATCH_STACK_VAR$2, e.stack); return this.visitAllStatements(stmt.catchStmts, childCtx); } } /** * @param {?} stmt * @param {?} ctx * @return {?} */ visitThrowStmt(stmt, ctx) { throw stmt.error.visitExpression(this, ctx); } /** * @param {?} stmt * @param {?=} context * @return {?} */ visitCommentStmt(stmt, context) { return null; } /** * @param {?} ast * @param {?} ctx * @return {?} */ visitInstantiateExpr(ast, ctx) { const /** @type {?} */ args = this.visitAllExpressions(ast.args, ctx); const /** @type {?} */ clazz = ast.classExpr.visitExpression(this, ctx); return new clazz(...args); } /** * @param {?} ast * @param {?} ctx * @return {?} */ visitLiteralExpr(ast, ctx) { return ast.value; } /** * @param {?} ast * @param {?} ctx * @return {?} */ visitExternalExpr(ast, ctx) { return this.reflector.resolveExternalReference(ast.value); } /** * @param {?} ast * @param {?} ctx * @return {?} */ visitConditionalExpr(ast, ctx) { if (ast.condition.visitExpression(this, ctx)) { return ast.trueCase.visitExpression(this, ctx); } else if (ast.falseCase != null) { return ast.falseCase.visitExpression(this, ctx); } return null; } /** * @param {?} ast * @param {?} ctx * @return {?} */ visitNotExpr(ast, ctx) { return !ast.condition.visitExpression(this, ctx); } /** * @param {?} ast * @param {?} ctx * @return {?} */ visitAssertNotNullExpr(ast, ctx) { return ast.condition.visitExpression(this, ctx); } /** * @param {?} ast * @param {?} ctx * @return {?} */ visitCastExpr(ast, ctx) { return ast.value.visitExpression(this, ctx); } /** * @param {?} ast * @param {?} ctx * @return {?} */ visitFunctionExpr(ast, ctx) { const /** @type {?} */ paramNames = ast.params.map((param) => param.name); return _declareFn(paramNames, ast.statements, ctx, this); } /** * @param {?} stmt * @param {?} ctx * @return {?} */ visitDeclareFunctionStmt(stmt, ctx) { const /** @type {?} */ paramNames = stmt.params.map((param) => param.name); ctx.vars.set(stmt.name, _declareFn(paramNames, stmt.statements, ctx, this)); if (stmt.hasModifier(StmtModifier.Exported)) { ctx.exports.push(stmt.name); } return null; } /** * @param {?} ast * @param {?} ctx * @return {?} */ visitBinaryOperatorExpr(ast, ctx) { const /** @type {?} */ lhs = () => ast.lhs.visitExpression(this, ctx); const /** @type {?} */ rhs = () => ast.rhs.visitExpression(this, ctx); switch (ast.operator) { case BinaryOperator.Equals: return lhs() == rhs(); case BinaryOperator.Identical: return lhs() === rhs(); case BinaryOperator.NotEquals: return lhs() != rhs(); case BinaryOperator.NotIdentical: return lhs() !== rhs(); case BinaryOperator.And: return lhs() && rhs(); case BinaryOperator.Or: return lhs() || rhs(); case BinaryOperator.Plus: return lhs() + rhs(); case BinaryOperator.Minus: return lhs() - rhs(); case BinaryOperator.Divide: return lhs() / rhs(); case BinaryOperator.Multiply: return lhs() * rhs(); case BinaryOperator.Modulo: return lhs() % rhs(); case BinaryOperator.Lower: return lhs() < rhs(); case BinaryOperator.LowerEquals: return lhs() <= rhs(); case BinaryOperator.Bigger: return lhs() > rhs(); case BinaryOperator.BiggerEquals: return lhs() >= rhs(); default: throw new Error(`Unknown operator ${ast.operator}`); } } /** * @param {?} ast * @param {?} ctx * @return {?} */ visitReadPropExpr(ast, ctx) { let /** @type {?} */ result; const /** @type {?} */ receiver = ast.receiver.visitExpression(this, ctx); result = receiver[ast.name]; return result; } /** * @param {?} ast * @param {?} ctx * @return {?} */ visitReadKeyExpr(ast, ctx) { const /** @type {?} */ receiver = ast.receiver.visitExpression(this, ctx); const /** @type {?} */ prop = ast.index.visitExpression(this, ctx); return receiver[prop]; } /** * @param {?} ast * @param {?} ctx * @return {?} */ visitLiteralArrayExpr(ast, ctx) { return this.visitAllExpressions(ast.entries, ctx); } /** * @param {?} ast * @param {?} ctx * @return {?} */ visitLiteralMapExpr(ast, ctx) { const /** @type {?} */ result = {}; ast.entries.forEach(entry => result[entry.key] = entry.value.visitExpression(this, ctx)); return result; } /** * @param {?} ast * @param {?} context * @return {?} */ visitCommaExpr(ast, context) { const /** @type {?} */ values = this.visitAllExpressions(ast.parts, context); return values[values.length - 1]; } /** * @param {?} expressions * @param {?} ctx * @return {?} */ visitAllExpressions(expressions, ctx) { return expressions.map((expr) => expr.visitExpression(this, ctx)); } /** * @param {?} statements * @param {?} ctx * @return {?} */ visitAllStatements(statements, ctx) { for (let /** @type {?} */ i = 0; i < statements.length; i++) { const /** @type {?} */ stmt = statements[i]; const /** @type {?} */ val = stmt.visitStatement(this, ctx); if (val instanceof ReturnValue) { return val; } } return null; } } /** * @param {?} varNames * @param {?} statements * @param {?} ctx * @param {?} visitor * @return {?} */ function _declareFn(varNames, statements, ctx, visitor) { return (...args) => _executeFunctionStatements(varNames, args, statements, ctx, visitor); } const CATCH_ERROR_VAR$2 = 'error'; const CATCH_STACK_VAR$2 = 'stack'; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @abstract */ class AbstractJsEmitterVisitor extends AbstractEmitterVisitor { constructor() { super(false); } /** * @param {?} stmt * @param {?} ctx * @return {?} */ visitDeclareClassStmt(stmt, ctx) { ctx.pushClass(stmt); this._visitClassConstructor(stmt, ctx); if (stmt.parent != null) { ctx.print(stmt, `${stmt.name}.prototype = Object.create(`); stmt.parent.visitExpression(this, ctx); ctx.println(stmt, `.prototype);`); } stmt.getters.forEach((getter) => this._visitClassGetter(stmt, getter, ctx)); stmt.methods.forEach((method) => this._visitClassMethod(stmt, method, ctx)); ctx.popClass(); return null; } /** * @param {?} stmt * @param {?} ctx * @return {?} */ _visitClassConstructor(stmt, ctx) { ctx.print(stmt, `function ${stmt.name}(`); if (stmt.constructorMethod != null) { this._visitParams(stmt.constructorMethod.params, ctx); } ctx.println(stmt, `) {`); ctx.incIndent(); if (stmt.constructorMethod != null) { if (stmt.constructorMethod.body.length > 0) { ctx.println(stmt, `var self = this;`); this.visitAllStatements(stmt.constructorMethod.body, ctx); } } ctx.decIndent(); ctx.println(stmt, `}`); } /** * @param {?} stmt * @param {?} getter * @param {?} ctx * @return {?} */ _visitClassGetter(stmt, getter, ctx) { ctx.println(stmt, `Object.defineProperty(${stmt.name}.prototype, '${getter.name}', { get: function() {`); ctx.incIndent(); if (getter.body.length > 0) { ctx.println(stmt, `var self = this;`); this.visitAllStatements(getter.body, ctx); } ctx.decIndent(); ctx.println(stmt, `}});`); } /** * @param {?} stmt * @param {?} method * @param {?} ctx * @return {?} */ _visitClassMethod(stmt, method, ctx) { ctx.print(stmt, `${stmt.name}.prototype.${method.name} = function(`); this._visitParams(method.params, ctx); ctx.println(stmt, `) {`); ctx.incIndent(); if (method.body.length > 0) { ctx.println(stmt, `var self = this;`); this.visitAllStatements(method.body, ctx); } ctx.decIndent(); ctx.println(stmt, `};`); } /** * @param {?} ast * @param {?} ctx * @return {?} */ visitReadVarExpr(ast, ctx) { if (ast.builtin === BuiltinVar.This) { ctx.print(ast, 'self'); } else if (ast.builtin === BuiltinVar.Super) { throw new Error(`'super' needs to be handled at a parent ast node, not at the variable level!`); } else { super.visitReadVarExpr(ast, ctx); } return null; } /** * @param {?} stmt * @param {?} ctx * @return {?} */ visitDeclareVarStmt(stmt, ctx) { ctx.print(stmt, `var ${stmt.name} = `); stmt.value.visitExpression(this, ctx); ctx.println(stmt, `;`); return null; } /** * @param {?} ast * @param {?} ctx * @return {?} */ visitCastExpr(ast, ctx) { ast.value.visitExpression(this, ctx); return null; } /** * @param {?} expr * @param {?} ctx * @return {?} */ visitInvokeFunctionExpr(expr, ctx) { const /** @type {?} */ fnExpr = expr.fn; if (fnExpr instanceof ReadVarExpr && fnExpr.builtin === BuiltinVar.Super) { /** @type {?} */ ((/** @type {?} */ ((ctx.currentClass)).parent)).visitExpression(this, ctx); ctx.print(expr, `.call(this`); if (expr.args.length > 0) { ctx.print(expr, `, `); this.visitAllExpressions(expr.args, ctx, ','); } ctx.print(expr, `)`); } else { super.visitInvokeFunctionExpr(expr, ctx); } return null; } /** * @param {?} ast * @param {?} ctx * @return {?} */ visitFunctionExpr(ast, ctx) { ctx.print(ast, `function(`); this._visitParams(ast.params, ctx); ctx.println(ast, `) {`); ctx.incIndent(); this.visitAllStatements(ast.statements, ctx); ctx.decIndent(); ctx.print(ast, `}`); return null; } /** * @param {?} stmt * @param {?} ctx * @return {?} */ visitDeclareFunctionStmt(stmt, ctx) { ctx.print(stmt, `function ${stmt.name}(`); this._visitParams(stmt.params, ctx); ctx.println(stmt, `) {`); ctx.incIndent(); this.visitAllStatements(stmt.statements, ctx); ctx.decIndent(); ctx.println(stmt, `}`); return null; } /** * @param {?} stmt * @param {?} ctx * @return {?} */ visitTryCatchStmt(stmt, ctx) { ctx.println(stmt, `try {`); ctx.incIndent(); this.visitAllStatements(stmt.bodyStmts, ctx); ctx.decIndent(); ctx.println(stmt, `} catch (${CATCH_ERROR_VAR$1.name}) {`); ctx.incIndent(); const /** @type {?} */ catchStmts = [/** @type {?} */ (CATCH_STACK_VAR$1.set(CATCH_ERROR_VAR$1.prop('stack')).toDeclStmt(null, [ StmtModifier.Final ]))].concat(stmt.catchStmts); this.visitAllStatements(catchStmts, ctx); ctx.decIndent(); ctx.println(stmt, `}`); return null; } /** * @param {?} params * @param {?} ctx * @return {?} */ _visitParams(params, ctx) { this.visitAllObjects(param => ctx.print(null, param.name), params, ctx, ','); } /** * @param {?} method * @return {?} */ getBuiltinMethodName(method) { let /** @type {?} */ name; switch (method) { case BuiltinMethod.ConcatArray: name = 'concat'; break; case BuiltinMethod.SubscribeObservable: name = 'subscribe'; break; case BuiltinMethod.Bind: name = 'bind'; break; default: throw new Error(`Unknown builtin method: ${method}`); } return name; } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @param {?} sourceUrl * @param {?} ctx * @param {?} vars * @param {?} createSourceMap * @return {?} */ function evalExpression(sourceUrl, ctx, vars, createSourceMap) { let /** @type {?} */ fnBody = `${ctx.toSource()}\n//# sourceURL=${sourceUrl}`; const /** @type {?} */ fnArgNames = []; const /** @type {?} */ fnArgValues = []; for (const /** @type {?} */ argName in vars) { fnArgNames.push(argName); fnArgValues.push(vars[argName]); } if (createSourceMap) { // using `new Function(...)` generates a header, 1 line of no arguments, 2 lines otherwise // E.g. ``` // function anonymous(a,b,c // /**/) { ... }``` // We don't want to hard code this fact, so we auto detect it via an empty function first. const /** @type {?} */ emptyFn = new Function(...fnArgNames.concat('return null;')).toString(); const /** @type {?} */ headerLines = emptyFn.slice(0, emptyFn.indexOf('return null;')).split('\n').length - 1; fnBody += `\n${ctx.toSourceMapGenerator(sourceUrl, headerLines).toJsComment()}`; } return new Function(...fnArgNames.concat(fnBody))(...fnArgValues); } /** * @param {?} sourceUrl * @param {?} statements * @param {?} reflector * @param {?} createSourceMaps * @return {?} */ function jitStatements(sourceUrl, statements, reflector, createSourceMaps) { const /** @type {?} */ converter = new JitEmitterVisitor(reflector); const /** @type {?} */ ctx = EmitterVisitorContext.createRoot(); converter.visitAllStatements(statements, ctx); converter.createReturnStmt(ctx); return evalExpression(sourceUrl, ctx, converter.getArgs(), createSourceMaps); } class JitEmitterVisitor extends AbstractJsEmitterVisitor { /** * @param {?} reflector */ constructor(reflector) { super(); this.reflector = reflector; this._evalArgNames = []; this._evalArgValues = []; this._evalExportedVars = []; } /** * @param {?} ctx * @return {?} */ createReturnStmt(ctx) { const /** @type {?} */ stmt = new ReturnStatement(new LiteralMapExpr(this._evalExportedVars.map(resultVar => new LiteralMapEntry(resultVar, variable(resultVar), false)))); stmt.visitStatement(this, ctx); } /** * @return {?} */ getArgs() { const /** @type {?} */ result = {}; for (let /** @type {?} */ i = 0; i < this._evalArgNames.length; i++) { result[this._evalArgNames[i]] = this._evalArgValues[i]; } return result; } /** * @param {?} ast * @param {?} ctx * @return {?} */ visitExternalExpr(ast, ctx) { const /** @type {?} */ value = this.reflector.resolveExternalReference(ast.value); let /** @type {?} */ id = this._evalArgValues.indexOf(value); if (id === -1) { id = this._evalArgValues.length; this._evalArgValues.push(value); const /** @type {?} */ name = identifierName({ reference: value }) || 'val'; this._evalArgNames.push(`jit_${name}_${id}`); } ctx.print(ast, this._evalArgNames[id]); return null; } /** * @param {?} stmt * @param {?} ctx * @return {?} */ visitDeclareVarStmt(stmt, ctx) { if (stmt.hasModifier(StmtModifier.Exported)) { this._evalExportedVars.push(stmt.name); } return super.visitDeclareVarStmt(stmt, ctx); } /** * @param {?} stmt * @param {?} ctx * @return {?} */ visitDeclareFunctionStmt(stmt, ctx) { if (stmt.hasModifier(StmtModifier.Exported)) { this._evalExportedVars.push(stmt.name); } return super.visitDeclareFunctionStmt(stmt, ctx); } /** * @param {?} stmt * @param {?} ctx * @return {?} */ visitDeclareClassStmt(stmt, ctx) { if (stmt.hasModifier(StmtModifier.Exported)) { this._evalExportedVars.push(stmt.name); } return super.visitDeclareClassStmt(stmt, ctx); } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @record */ /** * An internal module of the Angular compiler that begins with component types, * extracts templates, and eventually produces a compiled version of the component * ready for linking into an application. * * \@security When compiling templates at runtime, you must ensure that the entire template comes * from a trusted source. Attacker-controlled data introduced by a template could expose your * application to XSS risks. For more detail, see the [Security Guide](http://g.co/ng/security). */ class JitCompiler { /** * @param {?} _metadataResolver * @param {?} _templateParser * @param {?} _styleCompiler * @param {?} _viewCompiler * @param {?} _ngModuleCompiler * @param {?} _summaryResolver * @param {?} _reflector * @param {?} _compilerConfig * @param {?} _console * @param {?} getExtraNgModuleProviders */ constructor(_metadataResolver, _templateParser, _styleCompiler, _viewCompiler, _ngModuleCompiler, _summaryResolver, _reflector, _compilerConfig, _console, getExtraNgModuleProviders) { this._metadataResolver = _metadataResolver; this._templateParser = _templateParser; this._styleCompiler = _styleCompiler; this._viewCompiler = _viewCompiler; this._ngModuleCompiler = _ngModuleCompiler; this._summaryResolver = _summaryResolver; this._reflector = _reflector; this._compilerConfig = _compilerConfig; this._console = _console; this.getExtraNgModuleProviders = getExtraNgModuleProviders; this._compiledTemplateCache = new Map(); this._compiledHostTemplateCache = new Map(); this._compiledDirectiveWrapperCache = new Map(); this._compiledNgModuleCache = new Map(); this._sharedStylesheetCount = 0; this._addedAotSummaries = new Set(); } /** * @param {?} moduleType * @return {?} */ compileModuleSync(moduleType) { return SyncAsync.assertSync(this._compileModuleAndComponents(moduleType, true)); } /** * @param {?} moduleType * @return {?} */ compileModuleAsync(moduleType) { return Promise.resolve(this._compileModuleAndComponents(moduleType, false)); } /** * @param {?} moduleType * @return {?} */ compileModuleAndAllComponentsSync(moduleType) { return SyncAsync.assertSync(this._compileModuleAndAllComponents(moduleType, true)); } /** * @param {?} moduleType * @return {?} */ compileModuleAndAllComponentsAsync(moduleType) { return Promise.resolve(this._compileModuleAndAllComponents(moduleType, false)); } /** * @param {?} component * @return {?} */ getComponentFactory(component) { const /** @type {?} */ summary = this._metadataResolver.getDirectiveSummary(component); return /** @type {?} */ (summary.componentFactory); } /** * @param {?} summaries * @return {?} */ loadAotSummaries(summaries) { this.clearCache(); this._addAotSummaries(summaries); } /** * @param {?} fn * @return {?} */ _addAotSummaries(fn$$1) { if (this._addedAotSummaries.has(fn$$1)) { return; } this._addedAotSummaries.add(fn$$1); const /** @type {?} */ summaries = fn$$1(); for (let /** @type {?} */ i = 0; i < summaries.length; i++) { const /** @type {?} */ entry = summaries[i]; if (typeof entry === 'function') { this._addAotSummaries(entry); } else { const /** @type {?} */ summary = /** @type {?} */ (entry); this._summaryResolver.addSummary({ symbol: summary.type.reference, metadata: null, type: summary }); } } } /** * @param {?} ref * @return {?} */ hasAotSummary(ref) { return !!this._summaryResolver.resolveSummary(ref); } /** * @param {?} ids * @return {?} */ _filterJitIdentifiers(ids) { return ids.map(mod => mod.reference).filter((ref) => !this.hasAotSummary(ref)); } /** * @param {?} moduleType * @param {?} isSync * @return {?} */ _compileModuleAndComponents(moduleType, isSync) { return SyncAsync.then(this._loadModules(moduleType, isSync), () => { this._compileComponents(moduleType, null); return this._compileModule(moduleType); }); } /** * @param {?} moduleType * @param {?} isSync * @return {?} */ _compileModuleAndAllComponents(moduleType, isSync) { return SyncAsync.then(this._loadModules(moduleType, isSync), () => { const /** @type {?} */ componentFactories = []; this._compileComponents(moduleType, componentFactories); return { ngModuleFactory: this._compileModule(moduleType), componentFactories: componentFactories }; }); } /** * @param {?} mainModule * @param {?} isSync * @return {?} */ _loadModules(mainModule, isSync) { const /** @type {?} */ loading = []; const /** @type {?} */ mainNgModule = /** @type {?} */ ((this._metadataResolver.getNgModuleMetadata(mainModule))); // Note: for runtime compilation, we want to transitively compile all modules, // so we also need to load the declared directives / pipes for all nested modules. this._filterJitIdentifiers(mainNgModule.transitiveModule.modules).forEach((nestedNgModule) => { // getNgModuleMetadata only returns null if the value passed in is not an NgModule const /** @type {?} */ moduleMeta = /** @type {?} */ ((this._metadataResolver.getNgModuleMetadata(nestedNgModule))); this._filterJitIdentifiers(moduleMeta.declaredDirectives).forEach((ref) => { const /** @type {?} */ promise = this._metadataResolver.loadDirectiveMetadata(moduleMeta.type.reference, ref, isSync); if (promise) { loading.push(promise); } }); this._filterJitIdentifiers(moduleMeta.declaredPipes) .forEach((ref) => this._metadataResolver.getOrLoadPipeMetadata(ref)); }); return SyncAsync.all(loading); } /** * @param {?} moduleType * @return {?} */ _compileModule(moduleType) { let /** @type {?} */ ngModuleFactory = /** @type {?} */ ((this._compiledNgModuleCache.get(moduleType))); if (!ngModuleFactory) { const /** @type {?} */ moduleMeta = /** @type {?} */ ((this._metadataResolver.getNgModuleMetadata(moduleType))); // Always provide a bound Compiler const /** @type {?} */ extraProviders = this.getExtraNgModuleProviders(moduleMeta.type.reference); const /** @type {?} */ outputCtx = createOutputContext(); const /** @type {?} */ compileResult = this._ngModuleCompiler.compile(outputCtx, moduleMeta, extraProviders); ngModuleFactory = this._interpretOrJit(ngModuleJitUrl(moduleMeta), outputCtx.statements)[compileResult.ngModuleFactoryVar]; this._compiledNgModuleCache.set(moduleMeta.type.reference, ngModuleFactory); } return ngModuleFactory; } /** * \@internal * @param {?} mainModule * @param {?} allComponentFactories * @return {?} */ _compileComponents(mainModule, allComponentFactories) { const /** @type {?} */ ngModule = /** @type {?} */ ((this._metadataResolver.getNgModuleMetadata(mainModule))); const /** @type {?} */ moduleByJitDirective = new Map(); const /** @type {?} */ templates = new Set(); const /** @type {?} */ transJitModules = this._filterJitIdentifiers(ngModule.transitiveModule.modules); transJitModules.forEach((localMod) => { const /** @type {?} */ localModuleMeta = /** @type {?} */ ((this._metadataResolver.getNgModuleMetadata(localMod))); this._filterJitIdentifiers(localModuleMeta.declaredDirectives).forEach((dirRef) => { moduleByJitDirective.set(dirRef, localModuleMeta); const /** @type {?} */ dirMeta = this._metadataResolver.getDirectiveMetadata(dirRef); if (dirMeta.isComponent) { templates.add(this._createCompiledTemplate(dirMeta, localModuleMeta)); if (allComponentFactories) { const /** @type {?} */ template = this._createCompiledHostTemplate(dirMeta.type.reference, localModuleMeta); templates.add(template); allComponentFactories.push(/** @type {?} */ (dirMeta.componentFactory)); } } }); }); transJitModules.forEach((localMod) => { const /** @type {?} */ localModuleMeta = /** @type {?} */ ((this._metadataResolver.getNgModuleMetadata(localMod))); this._filterJitIdentifiers(localModuleMeta.declaredDirectives).forEach((dirRef) => { const /** @type {?} */ dirMeta = this._metadataResolver.getDirectiveMetadata(dirRef); if (dirMeta.isComponent) { dirMeta.entryComponents.forEach((entryComponentType) => { const /** @type {?} */ moduleMeta = /** @type {?} */ ((moduleByJitDirective.get(entryComponentType.componentType))); templates.add(this._createCompiledHostTemplate(entryComponentType.componentType, moduleMeta)); }); } }); localModuleMeta.entryComponents.forEach((entryComponentType) => { if (!this.hasAotSummary(entryComponentType.componentType.reference)) { const /** @type {?} */ moduleMeta = /** @type {?} */ ((moduleByJitDirective.get(entryComponentType.componentType))); templates.add(this._createCompiledHostTemplate(entryComponentType.componentType, moduleMeta)); } }); }); templates.forEach((template) => this._compileTemplate(template)); } /** * @param {?} type * @return {?} */ clearCacheFor(type) { this._compiledNgModuleCache.delete(type); this._metadataResolver.clearCacheFor(type); this._compiledHostTemplateCache.delete(type); const /** @type {?} */ compiledTemplate = this._compiledTemplateCache.get(type); if (compiledTemplate) { this._compiledTemplateCache.delete(type); } } /** * @return {?} */ clearCache() { // Note: don't clear the _addedAotSummaries, as they don't change! this._metadataResolver.clearCache(); this._compiledTemplateCache.clear(); this._compiledHostTemplateCache.clear(); this._compiledNgModuleCache.clear(); } /** * @param {?} compType * @param {?} ngModule * @return {?} */ _createCompiledHostTemplate(compType, ngModule) { if (!ngModule) { throw new Error(`Component ${stringify(compType)} is not part of any NgModule or the module has not been imported into your module.`); } let /** @type {?} */ compiledTemplate = this._compiledHostTemplateCache.get(compType); if (!compiledTemplate) { const /** @type {?} */ compMeta = this._metadataResolver.getDirectiveMetadata(compType); assertComponent(compMeta); const /** @type {?} */ hostMeta = this._metadataResolver.getHostComponentMetadata(compMeta, (/** @type {?} */ (compMeta.componentFactory)).viewDefFactory); compiledTemplate = new CompiledTemplate(true, compMeta.type, hostMeta, ngModule, [compMeta.type]); this._compiledHostTemplateCache.set(compType, compiledTemplate); } return compiledTemplate; } /** * @param {?} compMeta * @param {?} ngModule * @return {?} */ _createCompiledTemplate(compMeta, ngModule) { let /** @type {?} */ compiledTemplate = this._compiledTemplateCache.get(compMeta.type.reference); if (!compiledTemplate) { assertComponent(compMeta); compiledTemplate = new CompiledTemplate(false, compMeta.type, compMeta, ngModule, ngModule.transitiveModule.directives); this._compiledTemplateCache.set(compMeta.type.reference, compiledTemplate); } return compiledTemplate; } /** * @param {?} template * @return {?} */ _compileTemplate(template) { if (template.isCompiled) { return; } const /** @type {?} */ compMeta = template.compMeta; const /** @type {?} */ externalStylesheetsByModuleUrl = new Map(); const /** @type {?} */ outputContext = createOutputContext(); const /** @type {?} */ componentStylesheet = this._styleCompiler.compileComponent(outputContext, compMeta); /** @type {?} */ ((compMeta.template)).externalStylesheets.forEach((stylesheetMeta) => { const /** @type {?} */ compiledStylesheet = this._styleCompiler.compileStyles(createOutputContext(), compMeta, stylesheetMeta); externalStylesheetsByModuleUrl.set(/** @type {?} */ ((stylesheetMeta.moduleUrl)), compiledStylesheet); }); this._resolveStylesCompileResult(componentStylesheet, externalStylesheetsByModuleUrl); const /** @type {?} */ pipes = template.ngModule.transitiveModule.pipes.map(pipe => this._metadataResolver.getPipeSummary(pipe.reference)); const { template: parsedTemplate, pipes: usedPipes } = this._parseTemplate(compMeta, template.ngModule, template.directives); const /** @type {?} */ compileResult = this._viewCompiler.compileComponent(outputContext, compMeta, parsedTemplate, variable(componentStylesheet.stylesVar), usedPipes); const /** @type {?} */ evalResult = this._interpretOrJit(templateJitUrl(template.ngModule.type, template.compMeta), outputContext.statements); const /** @type {?} */ viewClass = evalResult[compileResult.viewClassVar]; const /** @type {?} */ rendererType = evalResult[compileResult.rendererTypeVar]; template.compiled(viewClass, rendererType); } /** * @param {?} compMeta * @param {?} ngModule * @param {?} directiveIdentifiers * @return {?} */ _parseTemplate(compMeta, ngModule, directiveIdentifiers) { // Note: ! is ok here as components always have a template. const /** @type {?} */ preserveWhitespaces = /** @type {?} */ ((compMeta.template)).preserveWhitespaces; const /** @type {?} */ directives = directiveIdentifiers.map(dir => this._metadataResolver.getDirectiveSummary(dir.reference)); const /** @type {?} */ pipes = ngModule.transitiveModule.pipes.map(pipe => this._metadataResolver.getPipeSummary(pipe.reference)); return this._templateParser.parse(compMeta, /** @type {?} */ ((/** @type {?} */ ((compMeta.template)).htmlAst)), directives, pipes, ngModule.schemas, templateSourceUrl(ngModule.type, compMeta, /** @type {?} */ ((compMeta.template))), preserveWhitespaces); } /** * @param {?} result * @param {?} externalStylesheetsByModuleUrl * @return {?} */ _resolveStylesCompileResult(result, externalStylesheetsByModuleUrl) { result.dependencies.forEach((dep, i) => { const /** @type {?} */ nestedCompileResult = /** @type {?} */ ((externalStylesheetsByModuleUrl.get(dep.moduleUrl))); const /** @type {?} */ nestedStylesArr = this._resolveAndEvalStylesCompileResult(nestedCompileResult, externalStylesheetsByModuleUrl); dep.setValue(nestedStylesArr); }); } /** * @param {?} result * @param {?} externalStylesheetsByModuleUrl * @return {?} */ _resolveAndEvalStylesCompileResult(result, externalStylesheetsByModuleUrl) { this._resolveStylesCompileResult(result, externalStylesheetsByModuleUrl); return this._interpretOrJit(sharedStylesheetJitUrl(result.meta, this._sharedStylesheetCount++), result.outputCtx.statements)[result.stylesVar]; } /** * @param {?} sourceUrl * @param {?} statements * @return {?} */ _interpretOrJit(sourceUrl, statements) { if (!this._compilerConfig.useJit) { return interpretStatements(statements, this._reflector); } else { return jitStatements(sourceUrl, statements, this._reflector, this._compilerConfig.jitDevMode); } } } class CompiledTemplate { /** * @param {?} isHost * @param {?} compType * @param {?} compMeta * @param {?} ngModule * @param {?} directives */ constructor(isHost, compType, compMeta, ngModule, directives) { this.isHost = isHost; this.compType = compType; this.compMeta = compMeta; this.ngModule = ngModule; this.directives = directives; this._viewClass = /** @type {?} */ ((null)); this.isCompiled = false; } /** * @param {?} viewClass * @param {?} rendererType * @return {?} */ compiled(viewClass, rendererType) { this._viewClass = viewClass; (/** @type {?} */ (this.compMeta.componentViewType)).setDelegate(viewClass); for (let /** @type {?} */ prop in rendererType) { (/** @type {?} */ (this.compMeta.rendererType))[prop] = rendererType[prop]; } this.isCompiled = true; } } /** * @param {?} meta * @return {?} */ function assertComponent(meta) { if (!meta.isComponent) { throw new Error(`Could not compile '${identifierName(meta.type)}' because it is not a component.`); } } /** * @return {?} */ function createOutputContext() { const /** @type {?} */ importExpr$$1 = (symbol) => importExpr({ name: identifierName(symbol), moduleName: null, runtime: symbol }); return { statements: [], genFilePath: '', importExpr: importExpr$$1 }; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * Provides access to reflection data about symbols that the compiler needs. * @abstract */ class CompileReflector { } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * Create a {\@link UrlResolver} with no package prefix. * @return {?} */ function createUrlResolverWithoutPackagePrefix() { return new UrlResolver(); } /** * @return {?} */ function createOfflineCompileUrlResolver() { return new UrlResolver('.'); } /** * @record */ const UrlResolver = class UrlResolverImpl { /** * @param {?=} _packagePrefix */ constructor(_packagePrefix = null) { this._packagePrefix = _packagePrefix; } /** * Resolves the `url` given the `baseUrl`: * - when the `url` is null, the `baseUrl` is returned, * - if `url` is relative ('path/to/here', './path/to/here'), the resolved url is a combination of * `baseUrl` and `url`, * - if `url` is absolute (it has a scheme: 'http://', 'https://' or start with '/'), the `url` is * returned as is (ignoring the `baseUrl`) * @param {?} baseUrl * @param {?} url * @return {?} */ resolve(baseUrl, url) { let /** @type {?} */ resolvedUrl = url; if (baseUrl != null && baseUrl.length > 0) { resolvedUrl = _resolveUrl(baseUrl, resolvedUrl); } const /** @type {?} */ resolvedParts = _split(resolvedUrl); let /** @type {?} */ prefix = this._packagePrefix; if (prefix != null && resolvedParts != null && resolvedParts[_ComponentIndex.Scheme] == 'package') { let /** @type {?} */ path = resolvedParts[_ComponentIndex.Path]; prefix = prefix.replace(/\/+$/, ''); path = path.replace(/^\/+/, ''); return `${prefix}/${path}`; } return resolvedUrl; } }; /** * Extract the scheme of a URL. * @param {?} url * @return {?} */ function getUrlScheme(url) { const /** @type {?} */ match = _split(url); return (match && match[_ComponentIndex.Scheme]) || ''; } /** * Builds a URI string from already-encoded parts. * * No encoding is performed. Any component may be omitted as either null or * undefined. * * @param {?=} opt_scheme The scheme such as 'http'. * @param {?=} opt_userInfo The user name before the '\@'. * @param {?=} opt_domain The domain such as 'www.google.com', already * URI-encoded. * @param {?=} opt_port The port number. * @param {?=} opt_path The path, already URI-encoded. If it is not * empty, it must begin with a slash. * @param {?=} opt_queryData The URI-encoded query data. * @param {?=} opt_fragment The URI-encoded fragment identifier. * @return {?} The fully combined URI. */ function _buildFromEncodedParts(opt_scheme, opt_userInfo, opt_domain, opt_port, opt_path, opt_queryData, opt_fragment) { const /** @type {?} */ out = []; if (opt_scheme != null) { out.push(opt_scheme + ':'); } if (opt_domain != null) { out.push('//'); if (opt_userInfo != null) { out.push(opt_userInfo + '@'); } out.push(opt_domain); if (opt_port != null) { out.push(':' + opt_port); } } if (opt_path != null) { out.push(opt_path); } if (opt_queryData != null) { out.push('?' + opt_queryData); } if (opt_fragment != null) { out.push('#' + opt_fragment); } return out.join(''); } /** * A regular expression for breaking a URI into its component parts. * * {\@link http://www.gbiv.com/protocols/uri/rfc/rfc3986.html#RFC2234} says * As the "first-match-wins" algorithm is identical to the "greedy" * disambiguation method used by POSIX regular expressions, it is natural and * commonplace to use a regular expression for parsing the potential five * components of a URI reference. * * The following line is the regular expression for breaking-down a * well-formed URI reference into its components. * * <pre> * ^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))? * 12 3 4 5 6 7 8 9 * </pre> * * The numbers in the second line above are only to assist readability; they * indicate the reference points for each subexpression (i.e., each paired * parenthesis). We refer to the value matched for subexpression <n> as $<n>. * For example, matching the above expression to * <pre> * http://www.ics.uci.edu/pub/ietf/uri/#Related * </pre> * results in the following subexpression matches: * <pre> * $1 = http: * $2 = http * $3 = //www.ics.uci.edu * $4 = www.ics.uci.edu * $5 = /pub/ietf/uri/ * $6 = <undefined> * $7 = <undefined> * $8 = #Related * $9 = Related * </pre> * where <undefined> indicates that the component is not present, as is the * case for the query component in the above example. Therefore, we can * determine the value of the five components as * <pre> * scheme = $2 * authority = $4 * path = $5 * query = $7 * fragment = $9 * </pre> * * The regular expression has been modified slightly to expose the * userInfo, domain, and port separately from the authority. * The modified version yields * <pre> * $1 = http scheme * $2 = <undefined> userInfo -\ * $3 = www.ics.uci.edu domain | authority * $4 = <undefined> port -/ * $5 = /pub/ietf/uri/ path * $6 = <undefined> query without ? * $7 = Related fragment without # * </pre> * \@internal */ const _splitRe = new RegExp('^' + '(?:' + '([^:/?#.]+)' + // scheme - ignore special characters ':)?' + '(?://' + '(?:([^/?#]*)@)?' + // userInfo '([\\w\\d\\-\\u0100-\\uffff.%]*)' + // domain - restrict to letters, '(?::([0-9]+))?' + // port ')?' + '([^?#]+)?' + // path '(?:\\?([^#]*))?' + // query '(?:#(.*))?' + // fragment '$'); /** @enum {number} */ const _ComponentIndex = { Scheme: 1, UserInfo: 2, Domain: 3, Port: 4, Path: 5, QueryData: 6, Fragment: 7, }; _ComponentIndex[_ComponentIndex.Scheme] = "Scheme"; _ComponentIndex[_ComponentIndex.UserInfo] = "UserInfo"; _ComponentIndex[_ComponentIndex.Domain] = "Domain"; _ComponentIndex[_ComponentIndex.Port] = "Port"; _ComponentIndex[_ComponentIndex.Path] = "Path"; _ComponentIndex[_ComponentIndex.QueryData] = "QueryData"; _ComponentIndex[_ComponentIndex.Fragment] = "Fragment"; /** * Splits a URI into its component parts. * * Each component can be accessed via the component indices; for example: * <pre> * goog.uri.utils.split(someStr)[goog.uri.utils.CompontentIndex.QUERY_DATA]; * </pre> * * @param {?} uri The URI string to examine. * @return {?} Each component still URI-encoded. * Each component that is present will contain the encoded value, whereas * components that are not present will be undefined or empty, depending * on the browser's regular expression implementation. Never null, since * arbitrary strings may still look like path names. */ function _split(uri) { return /** @type {?} */ ((uri.match(_splitRe))); } /** * Removes dot segments in given path component, as described in * RFC 3986, section 5.2.4. * * @param {?} path A non-empty path component. * @return {?} Path component with removed dot segments. */ function _removeDotSegments(path) { if (path == '/') return '/'; const /** @type {?} */ leadingSlash = path[0] == '/' ? '/' : ''; const /** @type {?} */ trailingSlash = path[path.length - 1] === '/' ? '/' : ''; const /** @type {?} */ segments = path.split('/'); const /** @type {?} */ out = []; let /** @type {?} */ up = 0; for (let /** @type {?} */ pos = 0; pos < segments.length; pos++) { const /** @type {?} */ segment = segments[pos]; switch (segment) { case '': case '.': break; case '..': if (out.length > 0) { out.pop(); } else { up++; } break; default: out.push(segment); } } if (leadingSlash == '') { while (up-- > 0) { out.unshift('..'); } if (out.length === 0) out.push('.'); } return leadingSlash + out.join('/') + trailingSlash; } /** * Takes an array of the parts from split and canonicalizes the path part * and then joins all the parts. * @param {?} parts * @return {?} */ function _joinAndCanonicalizePath(parts) { let /** @type {?} */ path = parts[_ComponentIndex.Path]; path = path == null ? '' : _removeDotSegments(path); parts[_ComponentIndex.Path] = path; return _buildFromEncodedParts(parts[_ComponentIndex.Scheme], parts[_ComponentIndex.UserInfo], parts[_ComponentIndex.Domain], parts[_ComponentIndex.Port], path, parts[_ComponentIndex.QueryData], parts[_ComponentIndex.Fragment]); } /** * Resolves a URL. * @param {?} base The URL acting as the base URL. * @param {?} url * @return {?} */ function _resolveUrl(base, url) { const /** @type {?} */ parts = _split(encodeURI(url)); const /** @type {?} */ baseParts = _split(base); if (parts[_ComponentIndex.Scheme] != null) { return _joinAndCanonicalizePath(parts); } else { parts[_ComponentIndex.Scheme] = baseParts[_ComponentIndex.Scheme]; } for (let /** @type {?} */ i = _ComponentIndex.Scheme; i <= _ComponentIndex.Port; i++) { if (parts[i] == null) { parts[i] = baseParts[i]; } } if (parts[_ComponentIndex.Path][0] == '/') { return _joinAndCanonicalizePath(parts); } let /** @type {?} */ path = baseParts[_ComponentIndex.Path]; if (path == null) path = '/'; const /** @type {?} */ index = path.lastIndexOf('/'); path = path.substring(0, index + 1) + parts[_ComponentIndex.Path]; parts[_ComponentIndex.Path] = path; return _joinAndCanonicalizePath(parts); } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * An interface for retrieving documents by URL that the compiler uses * to load templates. */ class ResourceLoader { /** * @param {?} url * @return {?} */ get(url) { return ''; } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * The host of the Extractor disconnects the implementation from TypeScript / other language * services and from underlying file systems. * @record */ class Extractor { /** * @param {?} host * @param {?} staticSymbolResolver * @param {?} messageBundle * @param {?} metadataResolver */ constructor(host, staticSymbolResolver, messageBundle, metadataResolver) { this.host = host; this.staticSymbolResolver = staticSymbolResolver; this.messageBundle = messageBundle; this.metadataResolver = metadataResolver; } /** * @param {?} rootFiles * @return {?} */ extract(rootFiles) { const { files, ngModules } = analyzeAndValidateNgModules(rootFiles, this.host, this.staticSymbolResolver, this.metadataResolver); return Promise .all(ngModules.map(ngModule => this.metadataResolver.loadNgModuleDirectiveAndPipeMetadata(ngModule.type.reference, false))) .then(() => { const /** @type {?} */ errors = []; files.forEach(file => { const /** @type {?} */ compMetas = []; file.directives.forEach(directiveType => { const /** @type {?} */ dirMeta = this.metadataResolver.getDirectiveMetadata(directiveType); if (dirMeta && dirMeta.isComponent) { compMetas.push(dirMeta); } }); compMetas.forEach(compMeta => { const /** @type {?} */ html = /** @type {?} */ ((/** @type {?} */ ((compMeta.template)).template)); const /** @type {?} */ interpolationConfig = InterpolationConfig.fromArray(/** @type {?} */ ((compMeta.template)).interpolation); errors.push(.../** @type {?} */ ((this.messageBundle.updateFromTemplate(html, file.fileName, interpolationConfig)))); }); }); if (errors.length) { throw new Error(errors.map(e => e.toString()).join('\n')); } return this.messageBundle; }); } /** * @param {?} host * @param {?} locale * @return {?} */ static create(host, locale) { const /** @type {?} */ htmlParser = new HtmlParser(); const /** @type {?} */ urlResolver = createAotUrlResolver(host); const /** @type {?} */ symbolCache = new StaticSymbolCache(); const /** @type {?} */ summaryResolver = new AotSummaryResolver(host, symbolCache); const /** @type {?} */ staticSymbolResolver = new StaticSymbolResolver(host, symbolCache, summaryResolver); const /** @type {?} */ staticReflector = new StaticReflector(summaryResolver, staticSymbolResolver); const /** @type {?} */ config = new CompilerConfig({ defaultEncapsulation: ViewEncapsulation.Emulated, useJit: false }); const /** @type {?} */ normalizer = new DirectiveNormalizer({ get: (url) => host.loadResource(url) }, urlResolver, htmlParser, config); const /** @type {?} */ elementSchemaRegistry = new DomElementSchemaRegistry(); const /** @type {?} */ resolver = new CompileMetadataResolver(config, htmlParser, new NgModuleResolver(staticReflector), new DirectiveResolver(staticReflector), new PipeResolver(staticReflector), summaryResolver, elementSchemaRegistry, normalizer, console, symbolCache, staticReflector); // TODO(vicb): implicit tags & attributes const /** @type {?} */ messageBundle = new MessageBundle(htmlParser, [], {}, locale); const /** @type {?} */ extractor = new Extractor(host, staticSymbolResolver, messageBundle, resolver); return { extractor, staticReflector }; } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ // This file only reexports content of the `src` folder. Keep it that way. /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @module * @description * Entry point for all public APIs of this package. */ // This file only reexports content of the `src` folder. Keep it that way. /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ // This file is not used to build this module. It is only used during editing // by the TypeScript language service and during build for verification. `ngc` // replaces this file with production index.ts when it rewrites private symbol // names. //# sourceMappingURL=compiler.js.map /***/ }), /***/ "./node_modules/@angular/core/esm2015/core.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); /* WEBPACK VAR INJECTION */(function(global) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createPlatform", function() { return createPlatform; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "assertPlatform", function() { return assertPlatform; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "destroyPlatform", function() { return destroyPlatform; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getPlatform", function() { return getPlatform; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PlatformRef", function() { return PlatformRef; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ApplicationRef", function() { return ApplicationRef; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "enableProdMode", function() { return enableProdMode; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isDevMode", function() { return isDevMode; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createPlatformFactory", function() { return createPlatformFactory; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgProbeToken", function() { return NgProbeToken; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "APP_ID", function() { return APP_ID; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PACKAGE_ROOT_URL", function() { return PACKAGE_ROOT_URL; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PLATFORM_INITIALIZER", function() { return PLATFORM_INITIALIZER; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PLATFORM_ID", function() { return PLATFORM_ID; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "APP_BOOTSTRAP_LISTENER", function() { return APP_BOOTSTRAP_LISTENER; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "APP_INITIALIZER", function() { return APP_INITIALIZER; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ApplicationInitStatus", function() { return ApplicationInitStatus; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DebugElement", function() { return DebugElement; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DebugNode", function() { return DebugNode; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "asNativeElements", function() { return asNativeElements; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getDebugNode", function() { return getDebugNode; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Testability", function() { return Testability; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TestabilityRegistry", function() { return TestabilityRegistry; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setTestabilityGetter", function() { return setTestabilityGetter; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TRANSLATIONS", function() { return TRANSLATIONS; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TRANSLATIONS_FORMAT", function() { return TRANSLATIONS_FORMAT; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LOCALE_ID", function() { return LOCALE_ID; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MissingTranslationStrategy", function() { return MissingTranslationStrategy; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ApplicationModule", function() { return ApplicationModule; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "wtfCreateScope", function() { return wtfCreateScope; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "wtfLeave", function() { return wtfLeave; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "wtfStartTimeRange", function() { return wtfStartTimeRange; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "wtfEndTimeRange", function() { return wtfEndTimeRange; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Type", function() { return Type; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EventEmitter", function() { return EventEmitter; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ErrorHandler", function() { return ErrorHandler; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Sanitizer", function() { return Sanitizer; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SecurityContext", function() { return SecurityContext; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ANALYZE_FOR_ENTRY_COMPONENTS", function() { return ANALYZE_FOR_ENTRY_COMPONENTS; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Attribute", function() { return Attribute; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ContentChild", function() { return ContentChild; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ContentChildren", function() { return ContentChildren; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Query", function() { return Query; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ViewChild", function() { return ViewChild; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ViewChildren", function() { return ViewChildren; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Component", function() { return Component; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Directive", function() { return Directive; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HostBinding", function() { return HostBinding; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HostListener", function() { return HostListener; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Input", function() { return Input; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Output", function() { return Output; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Pipe", function() { return Pipe; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CUSTOM_ELEMENTS_SCHEMA", function() { return CUSTOM_ELEMENTS_SCHEMA; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NO_ERRORS_SCHEMA", function() { return NO_ERRORS_SCHEMA; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgModule", function() { return NgModule; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ViewEncapsulation", function() { return ViewEncapsulation; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Version", function() { return Version; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "VERSION", function() { return VERSION; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "forwardRef", function() { return forwardRef; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "resolveForwardRef", function() { return resolveForwardRef; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Injector", function() { return Injector; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ReflectiveInjector", function() { return ReflectiveInjector; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ResolvedReflectiveFactory", function() { return ResolvedReflectiveFactory; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ReflectiveKey", function() { return ReflectiveKey; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "InjectionToken", function() { return InjectionToken; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Inject", function() { return Inject; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Optional", function() { return Optional; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Injectable", function() { return Injectable; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Self", function() { return Self; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SkipSelf", function() { return SkipSelf; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Host", function() { return Host; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgZone", function() { return NgZone; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RenderComponentType", function() { return RenderComponentType; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Renderer", function() { return Renderer; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Renderer2", function() { return Renderer2; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RendererFactory2", function() { return RendererFactory2; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RendererStyleFlags2", function() { return RendererStyleFlags2; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RootRenderer", function() { return RootRenderer; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "COMPILER_OPTIONS", function() { return COMPILER_OPTIONS; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Compiler", function() { return Compiler; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CompilerFactory", function() { return CompilerFactory; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ModuleWithComponentFactories", function() { return ModuleWithComponentFactories; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ComponentFactory", function() { return ComponentFactory; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ComponentRef", function() { return ComponentRef; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ComponentFactoryResolver", function() { return ComponentFactoryResolver; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ElementRef", function() { return ElementRef; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgModuleFactory", function() { return NgModuleFactory; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgModuleRef", function() { return NgModuleRef; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgModuleFactoryLoader", function() { return NgModuleFactoryLoader; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getModuleFactory", function() { return getModuleFactory; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QueryList", function() { return QueryList; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SystemJsNgModuleLoader", function() { return SystemJsNgModuleLoader; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SystemJsNgModuleLoaderConfig", function() { return SystemJsNgModuleLoaderConfig; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TemplateRef", function() { return TemplateRef; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ViewContainerRef", function() { return ViewContainerRef; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EmbeddedViewRef", function() { return EmbeddedViewRef; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ViewRef", function() { return ViewRef; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ChangeDetectionStrategy", function() { return ChangeDetectionStrategy; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ChangeDetectorRef", function() { return ChangeDetectorRef; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DefaultIterableDiffer", function() { return DefaultIterableDiffer; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "IterableDiffers", function() { return IterableDiffers; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "KeyValueDiffers", function() { return KeyValueDiffers; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SimpleChange", function() { return SimpleChange; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "WrappedValue", function() { return WrappedValue; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "platformCore", function() { return platformCore; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵALLOW_MULTIPLE_PLATFORMS", function() { return ALLOW_MULTIPLE_PLATFORMS; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵAPP_ID_RANDOM_PROVIDER", function() { return APP_ID_RANDOM_PROVIDER; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵdevModeEqual", function() { return devModeEqual; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵisListLikeIterable", function() { return isListLikeIterable; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵChangeDetectorStatus", function() { return ChangeDetectorStatus; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵisDefaultChangeDetectionStrategy", function() { return isDefaultChangeDetectionStrategy; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵConsole", function() { return Console; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵComponentFactory", function() { return ComponentFactory; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵCodegenComponentFactoryResolver", function() { return CodegenComponentFactoryResolver; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵReflectionCapabilities", function() { return ReflectionCapabilities; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵRenderDebugInfo", function() { return RenderDebugInfo; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵglobal", function() { return _global; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵlooseIdentical", function() { return looseIdentical; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵstringify", function() { return stringify; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵmakeDecorator", function() { return makeDecorator; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵisObservable", function() { return isObservable; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵisPromise", function() { return isPromise; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵclearOverrides", function() { return clearOverrides; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵoverrideComponentView", function() { return overrideComponentView; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵoverrideProvider", function() { return overrideProvider; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵNOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR", function() { return NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵdefineComponent", function() { return defineComponent; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵdetectChanges", function() { return detectChanges; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵrenderComponent", function() { return renderComponent; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵC", function() { return containerStart; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵD", function() { return directive; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵE", function() { return elementStart; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵT", function() { return text; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵV", function() { return viewStart; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵb", function() { return bind; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵb1", function() { return bind1; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵc", function() { return containerEnd; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵcR", function() { return containerRefreshStart; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵcr", function() { return containerRefreshEnd; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵe", function() { return elementEnd; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵp", function() { return elementProperty; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵs", function() { return elementStyle; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵt", function() { return textBinding; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵv", function() { return viewEnd; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵregisterModuleFactory", function() { return registerModuleFactory; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵEMPTY_ARRAY", function() { return EMPTY_ARRAY; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵEMPTY_MAP", function() { return EMPTY_MAP; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵand", function() { return anchorDef; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵccf", function() { return createComponentFactory; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵcmf", function() { return createNgModuleFactory; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵcrt", function() { return createRendererType2; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵdid", function() { return directiveDef; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵeld", function() { return elementDef; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵelementEventFullName", function() { return elementEventFullName; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵgetComponentViewDefinitionFactory", function() { return getComponentViewDefinitionFactory; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵinlineInterpolate", function() { return inlineInterpolate; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵinterpolate", function() { return interpolate; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵmod", function() { return moduleDef; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵmpd", function() { return moduleProvideDef; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵncd", function() { return ngContentDef; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵnov", function() { return nodeValue; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵpid", function() { return pipeDef; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵprd", function() { return providerDef; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵpad", function() { return pureArrayDef; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵpod", function() { return pureObjectDef; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵppd", function() { return purePipeDef; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵqud", function() { return queryDef; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵted", function() { return textDef; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵunv", function() { return unwrapValue; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵvid", function() { return viewDef; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AUTO_STYLE", function() { return AUTO_STYLE; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "trigger", function() { return trigger$$1; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "animate", function() { return animate$$1; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "group", function() { return group$$1; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "sequence", function() { return sequence$$1; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "style", function() { return style$$1; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "state", function() { return state$$1; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "keyframes", function() { return keyframes$$1; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "transition", function() { return transition$$1; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵbf", function() { return animate$1; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵbg", function() { return group$1; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵbk", function() { return keyframes$1; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵbh", function() { return sequence$1; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵbj", function() { return state$1; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵbi", function() { return style$1; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵbl", function() { return transition$1; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵbe", function() { return trigger$1; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵn", function() { return _iterableDiffersFactory; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵo", function() { return _keyValueDiffersFactory; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵq", function() { return _localeFactory; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵi", function() { return _appIdRandomProviderFactory; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵj", function() { return defaultIterableDiffers; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵk", function() { return defaultKeyValueDiffers; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵl", function() { return DefaultIterableDifferFactory; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵm", function() { return DefaultKeyValueDifferFactory; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵf", function() { return ReflectiveInjector_; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵg", function() { return ReflectiveDependency; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵh", function() { return resolveReflectiveProviders; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵr", function() { return wtfEnabled; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵw", function() { return createScope$1; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵu", function() { return detectWTF; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵz", function() { return endTimeRange; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵx", function() { return leave; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵy", function() { return startTimeRange; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵbc", function() { return stringify$1; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵa", function() { return makeParamDecorator; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵd", function() { return makePropDecorator; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵba", function() { return _def; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵbb", function() { return DebugContext; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_rxjs_Observable__ = __webpack_require__("./node_modules/rxjs/_esm2015/Observable.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_rxjs_observable_merge__ = __webpack_require__("./node_modules/rxjs/_esm2015/observable/merge.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_rxjs_operator_share__ = __webpack_require__("./node_modules/rxjs/_esm2015/operator/share.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_rxjs_Subject__ = __webpack_require__("./node_modules/rxjs/_esm2015/Subject.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_rxjs_Subscription__ = __webpack_require__("./node_modules/rxjs/_esm2015/Subscription.js"); /** * @license Angular v5.2.10 * (c) 2010-2018 Google, Inc. https://angular.io/ * License: MIT */ /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * Creates a token that can be used in a DI Provider. * * Use an `InjectionToken` whenever the type you are injecting is not reified (does not have a * runtime representation) such as when injecting an interface, callable type, array or * parametrized type. * * `InjectionToken` is parameterized on `T` which is the type of object which will be returned by * the `Injector`. This provides additional level of type safety. * * ``` * interface MyInterface {...} * var myInterface = injector.get(new InjectionToken<MyInterface>('SomeToken')); * // myInterface is inferred to be MyInterface. * ``` * * ### Example * * {\@example core/di/ts/injector_spec.ts region='InjectionToken'} * * \@stable * @template T */ class InjectionToken { /** * @param {?} _desc */ constructor(_desc) { this._desc = _desc; /** * \@internal */ this.ngMetadataName = 'InjectionToken'; } /** * @return {?} */ toString() { return `InjectionToken ${this._desc}`; } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * An interface implemented by all Angular type decorators, which allows them to be used as ES7 * decorators as well as * Angular DSL syntax. * * ES7 syntax: * * ``` * \@ng.Component({...}) * class MyClass {...} * ``` * \@stable * @record */ const ANNOTATIONS = '__annotations__'; const PARAMETERS = '__paramaters__'; const PROP_METADATA = '__prop__metadata__'; /** * @suppress {globalThis} * @param {?} name * @param {?=} props * @param {?=} parentClass * @param {?=} chainFn * @return {?} */ function makeDecorator(name, props, parentClass, chainFn) { const /** @type {?} */ metaCtor = makeMetadataCtor(props); /** * @param {?} objOrType * @return {?} */ function DecoratorFactory(objOrType) { if (this instanceof DecoratorFactory) { metaCtor.call(this, objOrType); return this; } const /** @type {?} */ annotationInstance = new (/** @type {?} */ (DecoratorFactory))(objOrType); const /** @type {?} */ TypeDecorator = /** @type {?} */ (function TypeDecorator(cls) { // Use of Object.defineProperty is important since it creates non-enumerable property which // prevents the property is copied during subclassing. const /** @type {?} */ annotations = cls.hasOwnProperty(ANNOTATIONS) ? (/** @type {?} */ (cls))[ANNOTATIONS] : Object.defineProperty(cls, ANNOTATIONS, { value: [] })[ANNOTATIONS]; annotations.push(annotationInstance); return cls; }); if (chainFn) chainFn(TypeDecorator); return TypeDecorator; } if (parentClass) { DecoratorFactory.prototype = Object.create(parentClass.prototype); } DecoratorFactory.prototype.ngMetadataName = name; (/** @type {?} */ (DecoratorFactory)).annotationCls = DecoratorFactory; return /** @type {?} */ (DecoratorFactory); } /** * @param {?=} props * @return {?} */ function makeMetadataCtor(props) { return function ctor(...args) { if (props) { const /** @type {?} */ values = props(...args); for (const /** @type {?} */ propName in values) { this[propName] = values[propName]; } } }; } /** * @param {?} name * @param {?=} props * @param {?=} parentClass * @return {?} */ function makeParamDecorator(name, props, parentClass) { const /** @type {?} */ metaCtor = makeMetadataCtor(props); /** * @param {...?} args * @return {?} */ function ParamDecoratorFactory(...args) { if (this instanceof ParamDecoratorFactory) { metaCtor.apply(this, args); return this; } const /** @type {?} */ annotationInstance = new (/** @type {?} */ (ParamDecoratorFactory))(...args); (/** @type {?} */ (ParamDecorator)).annotation = annotationInstance; return ParamDecorator; /** * @param {?} cls * @param {?} unusedKey * @param {?} index * @return {?} */ function ParamDecorator(cls, unusedKey, index) { // Use of Object.defineProperty is important since it creates non-enumerable property which // prevents the property is copied during subclassing. const /** @type {?} */ parameters = cls.hasOwnProperty(PARAMETERS) ? (/** @type {?} */ (cls))[PARAMETERS] : Object.defineProperty(cls, PARAMETERS, { value: [] })[PARAMETERS]; // there might be gaps if some in between parameters do not have annotations. // we pad with nulls. while (parameters.length <= index) { parameters.push(null); } (parameters[index] = parameters[index] || []).push(annotationInstance); return cls; } } if (parentClass) { ParamDecoratorFactory.prototype = Object.create(parentClass.prototype); } ParamDecoratorFactory.prototype.ngMetadataName = name; (/** @type {?} */ (ParamDecoratorFactory)).annotationCls = ParamDecoratorFactory; return ParamDecoratorFactory; } /** * @param {?} name * @param {?=} props * @param {?=} parentClass * @return {?} */ function makePropDecorator(name, props, parentClass) { const /** @type {?} */ metaCtor = makeMetadataCtor(props); /** * @param {...?} args * @return {?} */ function PropDecoratorFactory(...args) { if (this instanceof PropDecoratorFactory) { metaCtor.apply(this, args); return this; } const /** @type {?} */ decoratorInstance = new (/** @type {?} */ (PropDecoratorFactory))(...args); return function PropDecorator(target, name) { const /** @type {?} */ constructor = target.constructor; // Use of Object.defineProperty is important since it creates non-enumerable property which // prevents the property is copied during subclassing. const /** @type {?} */ meta = constructor.hasOwnProperty(PROP_METADATA) ? (/** @type {?} */ (constructor))[PROP_METADATA] : Object.defineProperty(constructor, PROP_METADATA, { value: {} })[PROP_METADATA]; meta[name] = meta.hasOwnProperty(name) && meta[name] || []; meta[name].unshift(decoratorInstance); }; } if (parentClass) { PropDecoratorFactory.prototype = Object.create(parentClass.prototype); } PropDecoratorFactory.prototype.ngMetadataName = name; (/** @type {?} */ (PropDecoratorFactory)).annotationCls = PropDecoratorFactory; return PropDecoratorFactory; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * This token can be used to create a virtual provider that will populate the * `entryComponents` fields of components and ng modules based on its `useValue`. * All components that are referenced in the `useValue` value (either directly * or in a nested array or map) will be added to the `entryComponents` property. * * ### Example * The following example shows how the router can populate the `entryComponents` * field of an NgModule based on the router configuration which refers * to components. * * ```typescript * // helper function inside the router * function provideRoutes(routes) { * return [ * {provide: ROUTES, useValue: routes}, * {provide: ANALYZE_FOR_ENTRY_COMPONENTS, useValue: routes, multi: true} * ]; * } * * // user code * let routes = [ * {path: '/root', component: RootComp}, * {path: '/teams', component: TeamsComp} * ]; * * \@NgModule({ * providers: [provideRoutes(routes)] * }) * class ModuleWithRoutes {} * ``` * * \@experimental */ const ANALYZE_FOR_ENTRY_COMPONENTS = new InjectionToken('AnalyzeForEntryComponents'); /** * Type of the Attribute decorator / constructor function. * * \@stable * @record */ /** * Attribute decorator and metadata. * * \@stable * \@Annotation */ const Attribute = makeParamDecorator('Attribute', (attributeName) => ({ attributeName })); /** * Base class for query metadata. * * See {\@link ContentChildren}, {\@link ContentChild}, {\@link ViewChildren}, {\@link ViewChild} for * more information. * * \@stable * @abstract */ class Query { } /** * Type of the ContentChildren decorator / constructor function. * * See {\@link ContentChildren}. * * \@stable * @record */ /** * ContentChildren decorator and metadata. * * \@stable * \@Annotation */ const ContentChildren = makePropDecorator('ContentChildren', (selector, data = {}) => (Object.assign({ selector, first: false, isViewQuery: false, descendants: false }, data)), Query); /** * Type of the ContentChild decorator / constructor function. * * * \@stable * @record */ /** * ContentChild decorator and metadata. * * \@stable * \@Annotation */ const ContentChild = makePropDecorator('ContentChild', (selector, data = {}) => (Object.assign({ selector, first: true, isViewQuery: false, descendants: true }, data)), Query); /** * Type of the ViewChildren decorator / constructor function. * * See {\@link ViewChildren}. * * \@stable * @record */ /** * ViewChildren decorator and metadata. * * \@stable * \@Annotation */ const ViewChildren = makePropDecorator('ViewChildren', (selector, data = {}) => (Object.assign({ selector, first: false, isViewQuery: true, descendants: true }, data)), Query); /** * Type of the ViewChild decorator / constructor function. * * See {\@link ViewChild} * * \@stable * @record */ /** * ViewChild decorator and metadata. * * \@stable * \@Annotation */ const ViewChild = makePropDecorator('ViewChild', (selector, data) => (Object.assign({ selector, first: true, isViewQuery: true, descendants: true }, data)), Query); /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** @enum {number} */ const ChangeDetectionStrategy = { /** * `OnPush` means that the change detector's mode will be initially set to `CheckOnce`. */ OnPush: 0, /** * `Default` means that the change detector's mode will be initially set to `CheckAlways`. */ Default: 1, }; ChangeDetectionStrategy[ChangeDetectionStrategy.OnPush] = "OnPush"; ChangeDetectionStrategy[ChangeDetectionStrategy.Default] = "Default"; /** @enum {number} */ const ChangeDetectorStatus = { /** * `CheckOnce` means that after calling detectChanges the mode of the change detector * will become `Checked`. */ CheckOnce: 0, /** * `Checked` means that the change detector should be skipped until its mode changes to * `CheckOnce`. */ Checked: 1, /** * `CheckAlways` means that after calling detectChanges the mode of the change detector * will remain `CheckAlways`. */ CheckAlways: 2, /** * `Detached` means that the change detector sub tree is not a part of the main tree and * should be skipped. */ Detached: 3, /** * `Errored` means that the change detector encountered an error checking a binding * or calling a directive lifecycle method and is now in an inconsistent state. Change * detectors in this state will no longer detect changes. */ Errored: 4, /** * `Destroyed` means that the change detector is destroyed. */ Destroyed: 5, }; ChangeDetectorStatus[ChangeDetectorStatus.CheckOnce] = "CheckOnce"; ChangeDetectorStatus[ChangeDetectorStatus.Checked] = "Checked"; ChangeDetectorStatus[ChangeDetectorStatus.CheckAlways] = "CheckAlways"; ChangeDetectorStatus[ChangeDetectorStatus.Detached] = "Detached"; ChangeDetectorStatus[ChangeDetectorStatus.Errored] = "Errored"; ChangeDetectorStatus[ChangeDetectorStatus.Destroyed] = "Destroyed"; /** * @param {?} changeDetectionStrategy * @return {?} */ function isDefaultChangeDetectionStrategy(changeDetectionStrategy) { return changeDetectionStrategy == null || changeDetectionStrategy === ChangeDetectionStrategy.Default; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * Type of the Directive decorator / constructor function. * * \@stable * @record */ /** * Directive decorator and metadata. * * \@stable * \@Annotation */ const Directive = makeDecorator('Directive', (dir = {}) => dir); /** * Type of the Component decorator / constructor function. * * \@stable * @record */ /** * Component decorator and metadata. * * \@stable * \@Annotation */ const Component = makeDecorator('Component', (c = {}) => (Object.assign({ changeDetection: ChangeDetectionStrategy.Default }, c)), Directive); /** * Type of the Pipe decorator / constructor function. * * \@stable * @record */ /** * Pipe decorator and metadata. * * \@stable * \@Annotation */ const Pipe = makeDecorator('Pipe', (p) => (Object.assign({ pure: true }, p))); /** * Type of the Input decorator / constructor function. * * \@stable * @record */ /** * Input decorator and metadata. * * \@stable * \@Annotation */ const Input = makePropDecorator('Input', (bindingPropertyName) => ({ bindingPropertyName })); /** * Type of the Output decorator / constructor function. * * \@stable * @record */ /** * Output decorator and metadata. * * \@stable * \@Annotation */ const Output = makePropDecorator('Output', (bindingPropertyName) => ({ bindingPropertyName })); /** * Type of the HostBinding decorator / constructor function. * * \@stable * @record */ /** * HostBinding decorator and metadata. * * \@stable * \@Annotation */ const HostBinding = makePropDecorator('HostBinding', (hostPropertyName) => ({ hostPropertyName })); /** * Type of the HostListener decorator / constructor function. * * \@stable * @record */ /** * HostListener decorator and metadata. * * \@stable * \@Annotation */ const HostListener = makePropDecorator('HostListener', (eventName, args) => ({ eventName, args })); /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * A wrapper around a module that also includes the providers. * * \@stable * @record */ /** * Interface for schema definitions in \@NgModules. * * \@experimental * @record */ /** * Defines a schema that will allow: * - any non-Angular elements with a `-` in their name, * - any properties on elements with a `-` in their name which is the common rule for custom * elements. * * \@stable */ const CUSTOM_ELEMENTS_SCHEMA = { name: 'custom-elements' }; /** * Defines a schema that will allow any property on any element. * * \@experimental */ const NO_ERRORS_SCHEMA = { name: 'no-errors-schema' }; /** * Type of the NgModule decorator / constructor function. * * \@stable * @record */ /** * NgModule decorator and metadata. * * \@stable * \@Annotation */ const NgModule = makeDecorator('NgModule', (ngModule) => ngModule); /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** @enum {number} */ const ViewEncapsulation = { /** * Emulate `Native` scoping of styles by adding an attribute containing surrogate id to the Host * Element and pre-processing the style rules provided via {@link Component#styles styles} or * {@link Component#styleUrls styleUrls}, and adding the new Host Element attribute to all * selectors. * * This is the default option. */ Emulated: 0, /** * Use the native encapsulation mechanism of the renderer. * * For the DOM this means using [Shadow DOM](https://w3c.github.io/webcomponents/spec/shadow/) and * creating a ShadowRoot for Component's Host Element. */ Native: 1, /** * Don't provide any template or style encapsulation. */ None: 2, }; ViewEncapsulation[ViewEncapsulation.Emulated] = "Emulated"; ViewEncapsulation[ViewEncapsulation.Native] = "Native"; ViewEncapsulation[ViewEncapsulation.None] = "None"; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * \@whatItDoes Represents the version of Angular * * \@stable */ class Version { /** * @param {?} full */ constructor(full) { this.full = full; this.major = full.split('.')[0]; this.minor = full.split('.')[1]; this.patch = full.split('.').slice(2).join('.'); } } /** * \@stable */ const VERSION = new Version('5.2.10'); /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * Type of the Inject decorator / constructor function. * * \@stable * @record */ /** * Inject decorator and metadata. * * \@stable * \@Annotation */ const Inject = makeParamDecorator('Inject', (token) => ({ token })); /** * Type of the Optional decorator / constructor function. * * \@stable * @record */ /** * Optional decorator and metadata. * * \@stable * \@Annotation */ const Optional = makeParamDecorator('Optional'); /** * Type of the Injectable decorator / constructor function. * * \@stable * @record */ /** * Injectable decorator and metadata. * * \@stable * \@Annotation */ const Injectable = makeDecorator('Injectable'); /** * Type of the Self decorator / constructor function. * * \@stable * @record */ /** * Self decorator and metadata. * * \@stable * \@Annotation */ const Self = makeParamDecorator('Self'); /** * Type of the SkipSelf decorator / constructor function. * * \@stable * @record */ /** * SkipSelf decorator and metadata. * * \@stable * \@Annotation */ const SkipSelf = makeParamDecorator('SkipSelf'); /** * Type of the Host decorator / constructor function. * * \@stable * @record */ /** * Host decorator and metadata. * * \@stable * \@Annotation */ const Host = makeParamDecorator('Host'); /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ const __window = typeof window !== 'undefined' && window; const __self = typeof self !== 'undefined' && typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope && self; const __global = typeof global !== 'undefined' && global; const _global = __window || __global || __self; const promise = Promise.resolve(0); let _symbolIterator = null; /** * @return {?} */ function getSymbolIterator() { if (!_symbolIterator) { const /** @type {?} */ Symbol = _global['Symbol']; if (Symbol && Symbol.iterator) { _symbolIterator = Symbol.iterator; } else { // es6-shim specific logic const /** @type {?} */ keys = Object.getOwnPropertyNames(Map.prototype); for (let /** @type {?} */ i = 0; i < keys.length; ++i) { const /** @type {?} */ key = keys[i]; if (key !== 'entries' && key !== 'size' && (/** @type {?} */ (Map)).prototype[key] === Map.prototype['entries']) { _symbolIterator = key; } } } } return _symbolIterator; } /** * @param {?} fn * @return {?} */ function scheduleMicroTask(fn) { if (typeof Zone === 'undefined') { // use promise to schedule microTask instead of use Zone promise.then(() => { fn && fn.apply(null, null); }); } else { Zone.current.scheduleMicroTask('scheduleMicrotask', fn); } } /** * @param {?} a * @param {?} b * @return {?} */ function looseIdentical(a, b) { return a === b || typeof a === 'number' && typeof b === 'number' && isNaN(a) && isNaN(b); } /** * @param {?} token * @return {?} */ function stringify(token) { if (typeof token === 'string') { return token; } if (token instanceof Array) { return '[' + token.map(stringify).join(', ') + ']'; } if (token == null) { return '' + token; } if (token.overriddenName) { return `${token.overriddenName}`; } if (token.name) { return `${token.name}`; } const /** @type {?} */ res = token.toString(); if (res == null) { return '' + res; } const /** @type {?} */ newLineIndex = res.indexOf('\n'); return newLineIndex === -1 ? res : res.substring(0, newLineIndex); } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * An interface that a function passed into {\@link forwardRef} has to implement. * * ### Example * * {\@example core/di/ts/forward_ref/forward_ref_spec.ts region='forward_ref_fn'} * \@experimental * @record */ /** * Allows to refer to references which are not yet defined. * * For instance, `forwardRef` is used when the `token` which we need to refer to for the purposes of * DI is declared, * but not yet defined. It is also used when the `token` which we use when creating a query is not * yet defined. * * ### Example * {\@example core/di/ts/forward_ref/forward_ref_spec.ts region='forward_ref'} * \@experimental * @param {?} forwardRefFn * @return {?} */ function forwardRef(forwardRefFn) { (/** @type {?} */ (forwardRefFn)).__forward_ref__ = forwardRef; (/** @type {?} */ (forwardRefFn)).toString = function () { return stringify(this()); }; return (/** @type {?} */ (/** @type {?} */ (forwardRefFn))); } /** * Lazily retrieves the reference value from a forwardRef. * * Acts as the identity function when given a non-forward-ref value. * * ### Example ([live demo](http://plnkr.co/edit/GU72mJrk1fiodChcmiDR?p=preview)) * * {\@example core/di/ts/forward_ref/forward_ref_spec.ts region='resolve_forward_ref'} * * See: {\@link forwardRef} * \@experimental * @param {?} type * @return {?} */ function resolveForwardRef(type) { if (typeof type === 'function' && type.hasOwnProperty('__forward_ref__') && type.__forward_ref__ === forwardRef) { return (/** @type {?} */ (type))(); } else { return type; } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ const SOURCE = '__source'; const _THROW_IF_NOT_FOUND = new Object(); const THROW_IF_NOT_FOUND = _THROW_IF_NOT_FOUND; class _NullInjector { /** * @param {?} token * @param {?=} notFoundValue * @return {?} */ get(token, notFoundValue = _THROW_IF_NOT_FOUND) { if (notFoundValue === _THROW_IF_NOT_FOUND) { throw new Error(`NullInjectorError: No provider for ${stringify(token)}!`); } return notFoundValue; } } /** * \@whatItDoes Injector interface * \@howToUse * ``` * const injector: Injector = ...; * injector.get(...); * ``` * * \@description * For more details, see the {\@linkDocs guide/dependency-injection "Dependency Injection Guide"}. * * ### Example * * {\@example core/di/ts/injector_spec.ts region='Injector'} * * `Injector` returns itself when given `Injector` as a token: * {\@example core/di/ts/injector_spec.ts region='injectInjector'} * * \@stable * @abstract */ class Injector { /** * Create a new Injector which is configure using `StaticProvider`s. * * ### Example * * {\@example core/di/ts/provider_spec.ts region='ConstructorProvider'} * @param {?} options * @param {?=} parent * @return {?} */ static create(options, parent) { if (Array.isArray(options)) { return new StaticInjector(options, parent); } else { return new StaticInjector(options.providers, options.parent, options.name || null); } } } Injector.THROW_IF_NOT_FOUND = _THROW_IF_NOT_FOUND; Injector.NULL = new _NullInjector(); const IDENT = function (value) { return value; }; const EMPTY = /** @type {?} */ ([]); const CIRCULAR = IDENT; const MULTI_PROVIDER_FN = function () { return Array.prototype.slice.call(arguments); }; const GET_PROPERTY_NAME = /** @type {?} */ ({}); const ɵ2 = GET_PROPERTY_NAME; const USE_VALUE = getClosureSafeProperty({ provide: String, useValue: ɵ2 }); const NG_TOKEN_PATH = 'ngTokenPath'; const NG_TEMP_TOKEN_PATH = 'ngTempTokenPath'; const NULL_INJECTOR = Injector.NULL; const NEW_LINE = /\n/gm; const NO_NEW_LINE = 'ɵ'; class StaticInjector { /** * @param {?} providers * @param {?=} parent * @param {?=} source */ constructor(providers, parent = NULL_INJECTOR, source = null) { this.parent = parent; this.source = source; const /** @type {?} */ records = this._records = new Map(); records.set(Injector, /** @type {?} */ ({ token: Injector, fn: IDENT, deps: EMPTY, value: this, useNew: false })); recursivelyProcessProviders(records, providers); } /** * @param {?} token * @param {?=} notFoundValue * @return {?} */ get(token, notFoundValue) { const /** @type {?} */ record = this._records.get(token); try { return tryResolveToken(token, record, this._records, this.parent, notFoundValue); } catch (/** @type {?} */ e) { const /** @type {?} */ tokenPath = e[NG_TEMP_TOKEN_PATH]; if (token[SOURCE]) { tokenPath.unshift(token[SOURCE]); } e.message = formatError('\n' + e.message, tokenPath, this.source); e[NG_TOKEN_PATH] = tokenPath; e[NG_TEMP_TOKEN_PATH] = null; throw e; } } /** * @return {?} */ toString() { const /** @type {?} */ tokens = /** @type {?} */ ([]), /** @type {?} */ records = this._records; records.forEach((v, token) => tokens.push(stringify(token))); return `StaticInjector[${tokens.join(', ')}]`; } } /** * @param {?} provider * @return {?} */ function resolveProvider(provider) { const /** @type {?} */ deps = computeDeps(provider); let /** @type {?} */ fn = IDENT; let /** @type {?} */ value = EMPTY; let /** @type {?} */ useNew = false; let /** @type {?} */ provide = resolveForwardRef(provider.provide); if (USE_VALUE in provider) { // We need to use USE_VALUE in provider since provider.useValue could be defined as undefined. value = (/** @type {?} */ (provider)).useValue; } else if ((/** @type {?} */ (provider)).useFactory) { fn = (/** @type {?} */ (provider)).useFactory; } else if ((/** @type {?} */ (provider)).useExisting) { // Just use IDENT } else if ((/** @type {?} */ (provider)).useClass) { useNew = true; fn = resolveForwardRef((/** @type {?} */ (provider)).useClass); } else if (typeof provide == 'function') { useNew = true; fn = provide; } else { throw staticError('StaticProvider does not have [useValue|useFactory|useExisting|useClass] or [provide] is not newable', provider); } return { deps, fn, useNew, value }; } /** * @param {?} token * @return {?} */ function multiProviderMixError(token) { return staticError('Cannot mix multi providers and regular providers', token); } /** * @param {?} records * @param {?} provider * @return {?} */ function recursivelyProcessProviders(records, provider) { if (provider) { provider = resolveForwardRef(provider); if (provider instanceof Array) { // if we have an array recurse into the array for (let /** @type {?} */ i = 0; i < provider.length; i++) { recursivelyProcessProviders(records, provider[i]); } } else if (typeof provider === 'function') { // Functions were supported in ReflectiveInjector, but are not here. For safety give useful // error messages throw staticError('Function/Class not supported', provider); } else if (provider && typeof provider === 'object' && provider.provide) { // At this point we have what looks like a provider: {provide: ?, ....} let /** @type {?} */ token = resolveForwardRef(provider.provide); const /** @type {?} */ resolvedProvider = resolveProvider(provider); if (provider.multi === true) { // This is a multi provider. let /** @type {?} */ multiProvider = records.get(token); if (multiProvider) { if (multiProvider.fn !== MULTI_PROVIDER_FN) { throw multiProviderMixError(token); } } else { // Create a placeholder factory which will look up the constituents of the multi provider. records.set(token, multiProvider = /** @type {?} */ ({ token: provider.provide, deps: [], useNew: false, fn: MULTI_PROVIDER_FN, value: EMPTY })); } // Treat the provider as the token. token = provider; multiProvider.deps.push({ token, options: 6 /* Default */ }); } const /** @type {?} */ record = records.get(token); if (record && record.fn == MULTI_PROVIDER_FN) { throw multiProviderMixError(token); } records.set(token, resolvedProvider); } else { throw staticError('Unexpected provider', provider); } } } /** * @param {?} token * @param {?} record * @param {?} records * @param {?} parent * @param {?} notFoundValue * @return {?} */ function tryResolveToken(token, record, records, parent, notFoundValue) { try { return resolveToken(token, record, records, parent, notFoundValue); } catch (/** @type {?} */ e) { // ensure that 'e' is of type Error. if (!(e instanceof Error)) { e = new Error(e); } const /** @type {?} */ path = e[NG_TEMP_TOKEN_PATH] = e[NG_TEMP_TOKEN_PATH] || []; path.unshift(token); if (record && record.value == CIRCULAR) { // Reset the Circular flag. record.value = EMPTY; } throw e; } } /** * @param {?} token * @param {?} record * @param {?} records * @param {?} parent * @param {?} notFoundValue * @return {?} */ function resolveToken(token, record, records, parent, notFoundValue) { let /** @type {?} */ value; if (record) { // If we don't have a record, this implies that we don't own the provider hence don't know how // to resolve it. value = record.value; if (value == CIRCULAR) { throw Error(NO_NEW_LINE + 'Circular dependency'); } else if (value === EMPTY) { record.value = CIRCULAR; let /** @type {?} */ obj = undefined; let /** @type {?} */ useNew = record.useNew; let /** @type {?} */ fn = record.fn; let /** @type {?} */ depRecords = record.deps; let /** @type {?} */ deps = EMPTY; if (depRecords.length) { deps = []; for (let /** @type {?} */ i = 0; i < depRecords.length; i++) { const /** @type {?} */ depRecord = depRecords[i]; const /** @type {?} */ options = depRecord.options; const /** @type {?} */ childRecord = options & 2 /* CheckSelf */ ? records.get(depRecord.token) : undefined; deps.push(tryResolveToken( // Current Token to resolve depRecord.token, childRecord, records, // If we don't know how to resolve dependency and we should not check parent for it, // than pass in Null injector. !childRecord && !(options & 4 /* CheckParent */) ? NULL_INJECTOR : parent, options & 1 /* Optional */ ? null : Injector.THROW_IF_NOT_FOUND)); } } record.value = value = useNew ? new (/** @type {?} */ (fn))(...deps) : fn.apply(obj, deps); } } else { value = parent.get(token, notFoundValue); } return value; } /** * @param {?} provider * @return {?} */ function computeDeps(provider) { let /** @type {?} */ deps = EMPTY; const /** @type {?} */ providerDeps = (/** @type {?} */ (provider)).deps; if (providerDeps && providerDeps.length) { deps = []; for (let /** @type {?} */ i = 0; i < providerDeps.length; i++) { let /** @type {?} */ options = 6; let /** @type {?} */ token = resolveForwardRef(providerDeps[i]); if (token instanceof Array) { for (let /** @type {?} */ j = 0, /** @type {?} */ annotations = token; j < annotations.length; j++) { const /** @type {?} */ annotation = annotations[j]; if (annotation instanceof Optional || annotation == Optional) { options = options | 1 /* Optional */; } else if (annotation instanceof SkipSelf || annotation == SkipSelf) { options = options & ~2 /* CheckSelf */; } else if (annotation instanceof Self || annotation == Self) { options = options & ~4 /* CheckParent */; } else if (annotation instanceof Inject) { token = (/** @type {?} */ (annotation)).token; } else { token = resolveForwardRef(annotation); } } } deps.push({ token, options }); } } else if ((/** @type {?} */ (provider)).useExisting) { const /** @type {?} */ token = resolveForwardRef((/** @type {?} */ (provider)).useExisting); deps = [{ token, options: 6 /* Default */ }]; } else if (!providerDeps && !(USE_VALUE in provider)) { // useValue & useExisting are the only ones which are exempt from deps all others need it. throw staticError('\'deps\' required', provider); } return deps; } /** * @param {?} text * @param {?} obj * @param {?=} source * @return {?} */ function formatError(text, obj, source = null) { text = text && text.charAt(0) === '\n' && text.charAt(1) == NO_NEW_LINE ? text.substr(2) : text; let /** @type {?} */ context = stringify(obj); if (obj instanceof Array) { context = obj.map(stringify).join(' -> '); } else if (typeof obj === 'object') { let /** @type {?} */ parts = /** @type {?} */ ([]); for (let /** @type {?} */ key in obj) { if (obj.hasOwnProperty(key)) { let /** @type {?} */ value = obj[key]; parts.push(key + ':' + (typeof value === 'string' ? JSON.stringify(value) : stringify(value))); } } context = `{${parts.join(', ')}}`; } return `StaticInjectorError${source ? '(' + source + ')' : ''}[${context}]: ${text.replace(NEW_LINE, '\n ')}`; } /** * @param {?} text * @param {?} obj * @return {?} */ function staticError(text, obj) { return new Error(formatError(text, obj)); } /** * @template T * @param {?} objWithPropertyToExtract * @return {?} */ function getClosureSafeProperty(objWithPropertyToExtract) { for (let /** @type {?} */ key in objWithPropertyToExtract) { if (objWithPropertyToExtract[key] === GET_PROPERTY_NAME) { return key; } } throw Error('!prop'); } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ const ERROR_DEBUG_CONTEXT = 'ngDebugContext'; const ERROR_ORIGINAL_ERROR = 'ngOriginalError'; const ERROR_LOGGER = 'ngErrorLogger'; /** * @param {?} error * @return {?} */ /** * @param {?} error * @return {?} */ function getDebugContext(error) { return (/** @type {?} */ (error))[ERROR_DEBUG_CONTEXT]; } /** * @param {?} error * @return {?} */ function getOriginalError(error) { return (/** @type {?} */ (error))[ERROR_ORIGINAL_ERROR]; } /** * @param {?} error * @return {?} */ function getErrorLogger(error) { return (/** @type {?} */ (error))[ERROR_LOGGER] || defaultErrorLogger; } /** * @param {?} console * @param {...?} values * @return {?} */ function defaultErrorLogger(console, ...values) { (/** @type {?} */ (console.error))(...values); } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * \@whatItDoes Provides a hook for centralized exception handling. * * \@description * * The default implementation of `ErrorHandler` prints error messages to the `console`. To * intercept error handling, write a custom exception handler that replaces this default as * appropriate for your app. * * ### Example * * ``` * class MyErrorHandler implements ErrorHandler { * handleError(error) { * // do something with the exception * } * } * * \@NgModule({ * providers: [{provide: ErrorHandler, useClass: MyErrorHandler}] * }) * class MyModule {} * ``` * * \@stable */ class ErrorHandler { constructor() { /** * \@internal */ this._console = console; } /** * @param {?} error * @return {?} */ handleError(error) { const /** @type {?} */ originalError = this._findOriginalError(error); const /** @type {?} */ context = this._findContext(error); // Note: Browser consoles show the place from where console.error was called. // We can use this to give users additional information about the error. const /** @type {?} */ errorLogger = getErrorLogger(error); errorLogger(this._console, `ERROR`, error); if (originalError) { errorLogger(this._console, `ORIGINAL ERROR`, originalError); } if (context) { errorLogger(this._console, 'ERROR CONTEXT', context); } } /** * \@internal * @param {?} error * @return {?} */ _findContext(error) { if (error) { return getDebugContext(error) ? getDebugContext(error) : this._findContext(getOriginalError(error)); } return null; } /** * \@internal * @param {?} error * @return {?} */ _findOriginalError(error) { let /** @type {?} */ e = getOriginalError(error); while (e && getOriginalError(e)) { e = getOriginalError(e); } return e; } } /** * @param {?} message * @param {?} originalError * @return {?} */ function wrappedError(message, originalError) { const /** @type {?} */ msg = `${message} caused by: ${originalError instanceof Error ? originalError.message : originalError}`; const /** @type {?} */ error = Error(msg); (/** @type {?} */ (error))[ERROR_ORIGINAL_ERROR] = originalError; return error; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @param {?} keys * @return {?} */ function findFirstClosedCycle(keys) { const /** @type {?} */ res = []; for (let /** @type {?} */ i = 0; i < keys.length; ++i) { if (res.indexOf(keys[i]) > -1) { res.push(keys[i]); return res; } res.push(keys[i]); } return res; } /** * @param {?} keys * @return {?} */ function constructResolvingPath(keys) { if (keys.length > 1) { const /** @type {?} */ reversed = findFirstClosedCycle(keys.slice().reverse()); const /** @type {?} */ tokenStrs = reversed.map(k => stringify(k.token)); return ' (' + tokenStrs.join(' -> ') + ')'; } return ''; } /** * @record */ /** * @param {?} injector * @param {?} key * @param {?} constructResolvingMessage * @param {?=} originalError * @return {?} */ function injectionError(injector, key, constructResolvingMessage, originalError) { const /** @type {?} */ keys = [key]; const /** @type {?} */ errMsg = constructResolvingMessage(keys); const /** @type {?} */ error = /** @type {?} */ ((originalError ? wrappedError(errMsg, originalError) : Error(errMsg))); error.addKey = addKey; error.keys = keys; error.injectors = [injector]; error.constructResolvingMessage = constructResolvingMessage; (/** @type {?} */ (error))[ERROR_ORIGINAL_ERROR] = originalError; return error; } /** * @this {?} * @param {?} injector * @param {?} key * @return {?} */ function addKey(injector, key) { this.injectors.push(injector); this.keys.push(key); // Note: This updated message won't be reflected in the `.stack` property this.message = this.constructResolvingMessage(this.keys); } /** * Thrown when trying to retrieve a dependency by key from {\@link Injector}, but the * {\@link Injector} does not have a {\@link Provider} for the given key. * * ### Example ([live demo](http://plnkr.co/edit/vq8D3FRB9aGbnWJqtEPE?p=preview)) * * ```typescript * class A { * constructor(b:B) {} * } * * expect(() => Injector.resolveAndCreate([A])).toThrowError(); * ``` * @param {?} injector * @param {?} key * @return {?} */ function noProviderError(injector, key) { return injectionError(injector, key, function (keys) { const /** @type {?} */ first = stringify(keys[0].token); return `No provider for ${first}!${constructResolvingPath(keys)}`; }); } /** * Thrown when dependencies form a cycle. * * ### Example ([live demo](http://plnkr.co/edit/wYQdNos0Tzql3ei1EV9j?p=info)) * * ```typescript * var injector = Injector.resolveAndCreate([ * {provide: "one", useFactory: (two) => "two", deps: [[new Inject("two")]]}, * {provide: "two", useFactory: (one) => "one", deps: [[new Inject("one")]]} * ]); * * expect(() => injector.get("one")).toThrowError(); * ``` * * Retrieving `A` or `B` throws a `CyclicDependencyError` as the graph above cannot be constructed. * @param {?} injector * @param {?} key * @return {?} */ function cyclicDependencyError(injector, key) { return injectionError(injector, key, function (keys) { return `Cannot instantiate cyclic dependency!${constructResolvingPath(keys)}`; }); } /** * Thrown when a constructing type returns with an Error. * * The `InstantiationError` class contains the original error plus the dependency graph which caused * this object to be instantiated. * * ### Example ([live demo](http://plnkr.co/edit/7aWYdcqTQsP0eNqEdUAf?p=preview)) * * ```typescript * class A { * constructor() { * throw new Error('message'); * } * } * * var injector = Injector.resolveAndCreate([A]); * try { * injector.get(A); * } catch (e) { * expect(e instanceof InstantiationError).toBe(true); * expect(e.originalException.message).toEqual("message"); * expect(e.originalStack).toBeDefined(); * } * ``` * @param {?} injector * @param {?} originalException * @param {?} originalStack * @param {?} key * @return {?} */ function instantiationError(injector, originalException, originalStack, key) { return injectionError(injector, key, function (keys) { const /** @type {?} */ first = stringify(keys[0].token); return `${originalException.message}: Error during instantiation of ${first}!${constructResolvingPath(keys)}.`; }, originalException); } /** * Thrown when an object other then {\@link Provider} (or `Type`) is passed to {\@link Injector} * creation. * * ### Example ([live demo](http://plnkr.co/edit/YatCFbPAMCL0JSSQ4mvH?p=preview)) * * ```typescript * expect(() => Injector.resolveAndCreate(["not a type"])).toThrowError(); * ``` * @param {?} provider * @return {?} */ function invalidProviderError(provider) { return Error(`Invalid provider - only instances of Provider and Type are allowed, got: ${provider}`); } /** * Thrown when the class has no annotation information. * * Lack of annotation information prevents the {\@link Injector} from determining which dependencies * need to be injected into the constructor. * * ### Example ([live demo](http://plnkr.co/edit/rHnZtlNS7vJOPQ6pcVkm?p=preview)) * * ```typescript * class A { * constructor(b) {} * } * * expect(() => Injector.resolveAndCreate([A])).toThrowError(); * ``` * * This error is also thrown when the class not marked with {\@link Injectable} has parameter types. * * ```typescript * class B {} * * class A { * constructor(b:B) {} // no information about the parameter types of A is available at runtime. * } * * expect(() => Injector.resolveAndCreate([A,B])).toThrowError(); * ``` * \@stable * @param {?} typeOrFunc * @param {?} params * @return {?} */ function noAnnotationError(typeOrFunc, params) { const /** @type {?} */ signature = []; for (let /** @type {?} */ i = 0, /** @type {?} */ ii = params.length; i < ii; i++) { const /** @type {?} */ parameter = params[i]; if (!parameter || parameter.length == 0) { signature.push('?'); } else { signature.push(parameter.map(stringify).join(' ')); } } return Error('Cannot resolve all parameters for \'' + stringify(typeOrFunc) + '\'(' + signature.join(', ') + '). ' + 'Make sure that all the parameters are decorated with Inject or have valid type annotations and that \'' + stringify(typeOrFunc) + '\' is decorated with Injectable.'); } /** * Thrown when getting an object by index. * * ### Example ([live demo](http://plnkr.co/edit/bRs0SX2OTQiJzqvjgl8P?p=preview)) * * ```typescript * class A {} * * var injector = Injector.resolveAndCreate([A]); * * expect(() => injector.getAt(100)).toThrowError(); * ``` * \@stable * @param {?} index * @return {?} */ function outOfBoundsError(index) { return Error(`Index ${index} is out-of-bounds.`); } /** * Thrown when a multi provider and a regular provider are bound to the same token. * * ### Example * * ```typescript * expect(() => Injector.resolveAndCreate([ * { provide: "Strings", useValue: "string1", multi: true}, * { provide: "Strings", useValue: "string2", multi: false} * ])).toThrowError(); * ``` * @param {?} provider1 * @param {?} provider2 * @return {?} */ function mixingMultiProvidersWithRegularProvidersError(provider1, provider2) { return Error(`Cannot mix multi providers and regular providers, got: ${provider1} ${provider2}`); } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * A unique object used for retrieving items from the {\@link ReflectiveInjector}. * * Keys have: * - a system-wide unique `id`. * - a `token`. * * `Key` is used internally by {\@link ReflectiveInjector} because its system-wide unique `id` allows * the * injector to store created objects in a more efficient way. * * `Key` should not be created directly. {\@link ReflectiveInjector} creates keys automatically when * resolving * providers. * @deprecated No replacement */ class ReflectiveKey { /** * Private * @param {?} token * @param {?} id */ constructor(token, id) { this.token = token; this.id = id; if (!token) { throw new Error('Token must be defined!'); } this.displayName = stringify(this.token); } /** * Retrieves a `Key` for a token. * @param {?} token * @return {?} */ static get(token) { return _globalKeyRegistry.get(resolveForwardRef(token)); } /** * @return {?} the number of keys registered in the system. */ static get numberOfKeys() { return _globalKeyRegistry.numberOfKeys; } } class KeyRegistry { constructor() { this._allKeys = new Map(); } /** * @param {?} token * @return {?} */ get(token) { if (token instanceof ReflectiveKey) return token; if (this._allKeys.has(token)) { return /** @type {?} */ ((this._allKeys.get(token))); } const /** @type {?} */ newKey = new ReflectiveKey(token, ReflectiveKey.numberOfKeys); this._allKeys.set(token, newKey); return newKey; } /** * @return {?} */ get numberOfKeys() { return this._allKeys.size; } } const _globalKeyRegistry = new KeyRegistry(); /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * \@whatItDoes Represents a type that a Component or other object is instances of. * * \@description * * An example of a `Type` is `MyCustomComponent` class, which in JavaScript is be represented by * the `MyCustomComponent` constructor function. * * \@stable */ const Type = Function; /** * @param {?} v * @return {?} */ function isType(v) { return typeof v === 'function'; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * Attention: These regex has to hold even if the code is minified! */ const DELEGATE_CTOR = /^function\s+\S+\(\)\s*{[\s\S]+\.apply\(this,\s*arguments\)/; const INHERITED_CLASS = /^class\s+[A-Za-z\d$_]*\s*extends\s+[A-Za-z\d$_]+\s*{/; const INHERITED_CLASS_WITH_CTOR = /^class\s+[A-Za-z\d$_]*\s*extends\s+[A-Za-z\d$_]+\s*{[\s\S]*constructor\s*\(/; class ReflectionCapabilities { /** * @param {?=} reflect */ constructor(reflect) { this._reflect = reflect || _global['Reflect']; } /** * @return {?} */ isReflectionEnabled() { return true; } /** * @template T * @param {?} t * @return {?} */ factory(t) { return (...args) => new t(...args); } /** * \@internal * @param {?} paramTypes * @param {?} paramAnnotations * @return {?} */ _zipTypesAndAnnotations(paramTypes, paramAnnotations) { let /** @type {?} */ result; if (typeof paramTypes === 'undefined') { result = new Array(paramAnnotations.length); } else { result = new Array(paramTypes.length); } for (let /** @type {?} */ i = 0; i < result.length; i++) { // TS outputs Object for parameters without types, while Traceur omits // the annotations. For now we preserve the Traceur behavior to aid // migration, but this can be revisited. if (typeof paramTypes === 'undefined') { result[i] = []; } else if (paramTypes[i] != Object) { result[i] = [paramTypes[i]]; } else { result[i] = []; } if (paramAnnotations && paramAnnotations[i] != null) { result[i] = result[i].concat(paramAnnotations[i]); } } return result; } /** * @param {?} type * @param {?} parentCtor * @return {?} */ _ownParameters(type, parentCtor) { const /** @type {?} */ typeStr = type.toString(); // If we have no decorators, we only have function.length as metadata. // In that case, to detect whether a child class declared an own constructor or not, // we need to look inside of that constructor to check whether it is // just calling the parent. // This also helps to work around for https://github.com/Microsoft/TypeScript/issues/12439 // that sets 'design:paramtypes' to [] // if a class inherits from another class but has no ctor declared itself. if (DELEGATE_CTOR.exec(typeStr) || (INHERITED_CLASS.exec(typeStr) && !INHERITED_CLASS_WITH_CTOR.exec(typeStr))) { return null; } // Prefer the direct API. if ((/** @type {?} */ (type)).parameters && (/** @type {?} */ (type)).parameters !== parentCtor.parameters) { return (/** @type {?} */ (type)).parameters; } // API of tsickle for lowering decorators to properties on the class. const /** @type {?} */ tsickleCtorParams = (/** @type {?} */ (type)).ctorParameters; if (tsickleCtorParams && tsickleCtorParams !== parentCtor.ctorParameters) { // Newer tsickle uses a function closure // Retain the non-function case for compatibility with older tsickle const /** @type {?} */ ctorParameters = typeof tsickleCtorParams === 'function' ? tsickleCtorParams() : tsickleCtorParams; const /** @type {?} */ paramTypes = ctorParameters.map((ctorParam) => ctorParam && ctorParam.type); const /** @type {?} */ paramAnnotations = ctorParameters.map((ctorParam) => ctorParam && convertTsickleDecoratorIntoMetadata(ctorParam.decorators)); return this._zipTypesAndAnnotations(paramTypes, paramAnnotations); } // API for metadata created by invoking the decorators. const /** @type {?} */ paramAnnotations = type.hasOwnProperty(PARAMETERS) && (/** @type {?} */ (type))[PARAMETERS]; const /** @type {?} */ paramTypes = this._reflect && this._reflect.getOwnMetadata && this._reflect.getOwnMetadata('design:paramtypes', type); if (paramTypes || paramAnnotations) { return this._zipTypesAndAnnotations(paramTypes, paramAnnotations); } // If a class has no decorators, at least create metadata // based on function.length. // Note: We know that this is a real constructor as we checked // the content of the constructor above. return new Array((/** @type {?} */ (type.length))).fill(undefined); } /** * @param {?} type * @return {?} */ parameters(type) { // Note: only report metadata if we have at least one class decorator // to stay in sync with the static reflector. if (!isType(type)) { return []; } const /** @type {?} */ parentCtor = getParentCtor(type); let /** @type {?} */ parameters = this._ownParameters(type, parentCtor); if (!parameters && parentCtor !== Object) { parameters = this.parameters(parentCtor); } return parameters || []; } /** * @param {?} typeOrFunc * @param {?} parentCtor * @return {?} */ _ownAnnotations(typeOrFunc, parentCtor) { // Prefer the direct API. if ((/** @type {?} */ (typeOrFunc)).annotations && (/** @type {?} */ (typeOrFunc)).annotations !== parentCtor.annotations) { let /** @type {?} */ annotations = (/** @type {?} */ (typeOrFunc)).annotations; if (typeof annotations === 'function' && annotations.annotations) { annotations = annotations.annotations; } return annotations; } // API of tsickle for lowering decorators to properties on the class. if ((/** @type {?} */ (typeOrFunc)).decorators && (/** @type {?} */ (typeOrFunc)).decorators !== parentCtor.decorators) { return convertTsickleDecoratorIntoMetadata((/** @type {?} */ (typeOrFunc)).decorators); } // API for metadata created by invoking the decorators. if (typeOrFunc.hasOwnProperty(ANNOTATIONS)) { return (/** @type {?} */ (typeOrFunc))[ANNOTATIONS]; } return null; } /** * @param {?} typeOrFunc * @return {?} */ annotations(typeOrFunc) { if (!isType(typeOrFunc)) { return []; } const /** @type {?} */ parentCtor = getParentCtor(typeOrFunc); const /** @type {?} */ ownAnnotations = this._ownAnnotations(typeOrFunc, parentCtor) || []; const /** @type {?} */ parentAnnotations = parentCtor !== Object ? this.annotations(parentCtor) : []; return parentAnnotations.concat(ownAnnotations); } /** * @param {?} typeOrFunc * @param {?} parentCtor * @return {?} */ _ownPropMetadata(typeOrFunc, parentCtor) { // Prefer the direct API. if ((/** @type {?} */ (typeOrFunc)).propMetadata && (/** @type {?} */ (typeOrFunc)).propMetadata !== parentCtor.propMetadata) { let /** @type {?} */ propMetadata = (/** @type {?} */ (typeOrFunc)).propMetadata; if (typeof propMetadata === 'function' && propMetadata.propMetadata) { propMetadata = propMetadata.propMetadata; } return propMetadata; } // API of tsickle for lowering decorators to properties on the class. if ((/** @type {?} */ (typeOrFunc)).propDecorators && (/** @type {?} */ (typeOrFunc)).propDecorators !== parentCtor.propDecorators) { const /** @type {?} */ propDecorators = (/** @type {?} */ (typeOrFunc)).propDecorators; const /** @type {?} */ propMetadata = /** @type {?} */ ({}); Object.keys(propDecorators).forEach(prop => { propMetadata[prop] = convertTsickleDecoratorIntoMetadata(propDecorators[prop]); }); return propMetadata; } // API for metadata created by invoking the decorators. if (typeOrFunc.hasOwnProperty(PROP_METADATA)) { return (/** @type {?} */ (typeOrFunc))[PROP_METADATA]; } return null; } /** * @param {?} typeOrFunc * @return {?} */ propMetadata(typeOrFunc) { if (!isType(typeOrFunc)) { return {}; } const /** @type {?} */ parentCtor = getParentCtor(typeOrFunc); const /** @type {?} */ propMetadata = {}; if (parentCtor !== Object) { const /** @type {?} */ parentPropMetadata = this.propMetadata(parentCtor); Object.keys(parentPropMetadata).forEach((propName) => { propMetadata[propName] = parentPropMetadata[propName]; }); } const /** @type {?} */ ownPropMetadata = this._ownPropMetadata(typeOrFunc, parentCtor); if (ownPropMetadata) { Object.keys(ownPropMetadata).forEach((propName) => { const /** @type {?} */ decorators = []; if (propMetadata.hasOwnProperty(propName)) { decorators.push(...propMetadata[propName]); } decorators.push(...ownPropMetadata[propName]); propMetadata[propName] = decorators; }); } return propMetadata; } /** * @param {?} type * @param {?} lcProperty * @return {?} */ hasLifecycleHook(type, lcProperty) { return type instanceof Type && lcProperty in type.prototype; } /** * @param {?} type * @return {?} */ guards(type) { return {}; } /** * @param {?} name * @return {?} */ getter(name) { return /** @type {?} */ (new Function('o', 'return o.' + name + ';')); } /** * @param {?} name * @return {?} */ setter(name) { return /** @type {?} */ (new Function('o', 'v', 'return o.' + name + ' = v;')); } /** * @param {?} name * @return {?} */ method(name) { const /** @type {?} */ functionBody = `if (!o.${name}) throw new Error('"${name}" is undefined'); return o.${name}.apply(o, args);`; return /** @type {?} */ (new Function('o', 'args', functionBody)); } /** * @param {?} type * @return {?} */ importUri(type) { // StaticSymbol if (typeof type === 'object' && type['filePath']) { return type['filePath']; } // Runtime type return `./${stringify(type)}`; } /** * @param {?} type * @return {?} */ resourceUri(type) { return `./${stringify(type)}`; } /** * @param {?} name * @param {?} moduleUrl * @param {?} members * @param {?} runtime * @return {?} */ resolveIdentifier(name, moduleUrl, members, runtime) { return runtime; } /** * @param {?} enumIdentifier * @param {?} name * @return {?} */ resolveEnum(enumIdentifier, name) { return enumIdentifier[name]; } } /** * @param {?} decoratorInvocations * @return {?} */ function convertTsickleDecoratorIntoMetadata(decoratorInvocations) { if (!decoratorInvocations) { return []; } return decoratorInvocations.map(decoratorInvocation => { const /** @type {?} */ decoratorType = decoratorInvocation.type; const /** @type {?} */ annotationCls = decoratorType.annotationCls; const /** @type {?} */ annotationArgs = decoratorInvocation.args ? decoratorInvocation.args : []; return new annotationCls(...annotationArgs); }); } /** * @param {?} ctor * @return {?} */ function getParentCtor(ctor) { const /** @type {?} */ parentProto = ctor.prototype ? Object.getPrototypeOf(ctor.prototype) : null; const /** @type {?} */ parentCtor = parentProto ? parentProto.constructor : null; // Note: We always use `Object` as the null value // to simplify checking later on. return parentCtor || Object; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * Provides access to reflection data about symbols. Used internally by Angular * to power dependency injection and compilation. */ class Reflector { /** * @param {?} reflectionCapabilities */ constructor(reflectionCapabilities) { this.reflectionCapabilities = reflectionCapabilities; } /** * @param {?} caps * @return {?} */ updateCapabilities(caps) { this.reflectionCapabilities = caps; } /** * @param {?} type * @return {?} */ factory(type) { return this.reflectionCapabilities.factory(type); } /** * @param {?} typeOrFunc * @return {?} */ parameters(typeOrFunc) { return this.reflectionCapabilities.parameters(typeOrFunc); } /** * @param {?} typeOrFunc * @return {?} */ annotations(typeOrFunc) { return this.reflectionCapabilities.annotations(typeOrFunc); } /** * @param {?} typeOrFunc * @return {?} */ propMetadata(typeOrFunc) { return this.reflectionCapabilities.propMetadata(typeOrFunc); } /** * @param {?} type * @param {?} lcProperty * @return {?} */ hasLifecycleHook(type, lcProperty) { return this.reflectionCapabilities.hasLifecycleHook(type, lcProperty); } /** * @param {?} name * @return {?} */ getter(name) { return this.reflectionCapabilities.getter(name); } /** * @param {?} name * @return {?} */ setter(name) { return this.reflectionCapabilities.setter(name); } /** * @param {?} name * @return {?} */ method(name) { return this.reflectionCapabilities.method(name); } /** * @param {?} type * @return {?} */ importUri(type) { return this.reflectionCapabilities.importUri(type); } /** * @param {?} type * @return {?} */ resourceUri(type) { return this.reflectionCapabilities.resourceUri(type); } /** * @param {?} name * @param {?} moduleUrl * @param {?} members * @param {?} runtime * @return {?} */ resolveIdentifier(name, moduleUrl, members, runtime) { return this.reflectionCapabilities.resolveIdentifier(name, moduleUrl, members, runtime); } /** * @param {?} identifier * @param {?} name * @return {?} */ resolveEnum(identifier, name) { return this.reflectionCapabilities.resolveEnum(identifier, name); } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * The {\@link Reflector} used internally in Angular to access metadata * about symbols. */ const reflector = new Reflector(new ReflectionCapabilities()); /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * `Dependency` is used by the framework to extend DI. * This is internal to Angular and should not be used directly. */ class ReflectiveDependency { /** * @param {?} key * @param {?} optional * @param {?} visibility */ constructor(key, optional, visibility) { this.key = key; this.optional = optional; this.visibility = visibility; } /** * @param {?} key * @return {?} */ static fromKey(key) { return new ReflectiveDependency(key, false, null); } } const _EMPTY_LIST = []; /** * An internal resolved representation of a {\@link Provider} used by the {\@link Injector}. * * It is usually created automatically by `Injector.resolveAndCreate`. * * It can be created manually, as follows: * * ### Example ([live demo](http://plnkr.co/edit/RfEnhh8kUEI0G3qsnIeT?p%3Dpreview&p=preview)) * * ```typescript * var resolvedProviders = Injector.resolve([{ provide: 'message', useValue: 'Hello' }]); * var injector = Injector.fromResolvedProviders(resolvedProviders); * * expect(injector.get('message')).toEqual('Hello'); * ``` * * \@experimental * @record */ class ResolvedReflectiveProvider_ { /** * @param {?} key * @param {?} resolvedFactories * @param {?} multiProvider */ constructor(key, resolvedFactories, multiProvider) { this.key = key; this.resolvedFactories = resolvedFactories; this.multiProvider = multiProvider; this.resolvedFactory = this.resolvedFactories[0]; } } /** * An internal resolved representation of a factory function created by resolving {\@link * Provider}. * \@experimental */ class ResolvedReflectiveFactory { /** * @param {?} factory * @param {?} dependencies */ constructor(factory, dependencies) { this.factory = factory; this.dependencies = dependencies; } } /** * Resolve a single provider. * @param {?} provider * @return {?} */ function resolveReflectiveFactory(provider) { let /** @type {?} */ factoryFn; let /** @type {?} */ resolvedDeps; if (provider.useClass) { const /** @type {?} */ useClass = resolveForwardRef(provider.useClass); factoryFn = reflector.factory(useClass); resolvedDeps = _dependenciesFor(useClass); } else if (provider.useExisting) { factoryFn = (aliasInstance) => aliasInstance; resolvedDeps = [ReflectiveDependency.fromKey(ReflectiveKey.get(provider.useExisting))]; } else if (provider.useFactory) { factoryFn = provider.useFactory; resolvedDeps = constructDependencies(provider.useFactory, provider.deps); } else { factoryFn = () => provider.useValue; resolvedDeps = _EMPTY_LIST; } return new ResolvedReflectiveFactory(factoryFn, resolvedDeps); } /** * Converts the {\@link Provider} into {\@link ResolvedProvider}. * * {\@link Injector} internally only uses {\@link ResolvedProvider}, {\@link Provider} contains * convenience provider syntax. * @param {?} provider * @return {?} */ function resolveReflectiveProvider(provider) { return new ResolvedReflectiveProvider_(ReflectiveKey.get(provider.provide), [resolveReflectiveFactory(provider)], provider.multi || false); } /** * Resolve a list of Providers. * @param {?} providers * @return {?} */ function resolveReflectiveProviders(providers) { const /** @type {?} */ normalized = _normalizeProviders(providers, []); const /** @type {?} */ resolved = normalized.map(resolveReflectiveProvider); const /** @type {?} */ resolvedProviderMap = mergeResolvedReflectiveProviders(resolved, new Map()); return Array.from(resolvedProviderMap.values()); } /** * Merges a list of ResolvedProviders into a list where * each key is contained exactly once and multi providers * have been merged. * @param {?} providers * @param {?} normalizedProvidersMap * @return {?} */ function mergeResolvedReflectiveProviders(providers, normalizedProvidersMap) { for (let /** @type {?} */ i = 0; i < providers.length; i++) { const /** @type {?} */ provider = providers[i]; const /** @type {?} */ existing = normalizedProvidersMap.get(provider.key.id); if (existing) { if (provider.multiProvider !== existing.multiProvider) { throw mixingMultiProvidersWithRegularProvidersError(existing, provider); } if (provider.multiProvider) { for (let /** @type {?} */ j = 0; j < provider.resolvedFactories.length; j++) { existing.resolvedFactories.push(provider.resolvedFactories[j]); } } else { normalizedProvidersMap.set(provider.key.id, provider); } } else { let /** @type {?} */ resolvedProvider; if (provider.multiProvider) { resolvedProvider = new ResolvedReflectiveProvider_(provider.key, provider.resolvedFactories.slice(), provider.multiProvider); } else { resolvedProvider = provider; } normalizedProvidersMap.set(provider.key.id, resolvedProvider); } } return normalizedProvidersMap; } /** * @param {?} providers * @param {?} res * @return {?} */ function _normalizeProviders(providers, res) { providers.forEach(b => { if (b instanceof Type) { res.push({ provide: b, useClass: b }); } else if (b && typeof b == 'object' && (/** @type {?} */ (b)).provide !== undefined) { res.push(/** @type {?} */ (b)); } else if (b instanceof Array) { _normalizeProviders(b, res); } else { throw invalidProviderError(b); } }); return res; } /** * @param {?} typeOrFunc * @param {?=} dependencies * @return {?} */ function constructDependencies(typeOrFunc, dependencies) { if (!dependencies) { return _dependenciesFor(typeOrFunc); } else { const /** @type {?} */ params = dependencies.map(t => [t]); return dependencies.map(t => _extractToken(typeOrFunc, t, params)); } } /** * @param {?} typeOrFunc * @return {?} */ function _dependenciesFor(typeOrFunc) { const /** @type {?} */ params = reflector.parameters(typeOrFunc); if (!params) return []; if (params.some(p => p == null)) { throw noAnnotationError(typeOrFunc, params); } return params.map(p => _extractToken(typeOrFunc, p, params)); } /** * @param {?} typeOrFunc * @param {?} metadata * @param {?} params * @return {?} */ function _extractToken(typeOrFunc, metadata, params) { let /** @type {?} */ token = null; let /** @type {?} */ optional = false; if (!Array.isArray(metadata)) { if (metadata instanceof Inject) { return _createDependency(metadata.token, optional, null); } else { return _createDependency(metadata, optional, null); } } let /** @type {?} */ visibility = null; for (let /** @type {?} */ i = 0; i < metadata.length; ++i) { const /** @type {?} */ paramMetadata = metadata[i]; if (paramMetadata instanceof Type) { token = paramMetadata; } else if (paramMetadata instanceof Inject) { token = paramMetadata.token; } else if (paramMetadata instanceof Optional) { optional = true; } else if (paramMetadata instanceof Self || paramMetadata instanceof SkipSelf) { visibility = paramMetadata; } else if (paramMetadata instanceof InjectionToken) { token = paramMetadata; } } token = resolveForwardRef(token); if (token != null) { return _createDependency(token, optional, visibility); } else { throw noAnnotationError(typeOrFunc, params); } } /** * @param {?} token * @param {?} optional * @param {?} visibility * @return {?} */ function _createDependency(token, optional, visibility) { return new ReflectiveDependency(ReflectiveKey.get(token), optional, visibility); } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ // Threshold for the dynamic version const UNDEFINED = new Object(); /** * A ReflectiveDependency injection container used for instantiating objects and resolving * dependencies. * * An `Injector` is a replacement for a `new` operator, which can automatically resolve the * constructor dependencies. * * In typical use, application code asks for the dependencies in the constructor and they are * resolved by the `Injector`. * * ### Example ([live demo](http://plnkr.co/edit/jzjec0?p=preview)) * * The following example creates an `Injector` configured to create `Engine` and `Car`. * * ```typescript * \@Injectable() * class Engine { * } * * \@Injectable() * class Car { * constructor(public engine:Engine) {} * } * * var injector = ReflectiveInjector.resolveAndCreate([Car, Engine]); * var car = injector.get(Car); * expect(car instanceof Car).toBe(true); * expect(car.engine instanceof Engine).toBe(true); * ``` * * Notice, we don't use the `new` operator because we explicitly want to have the `Injector` * resolve all of the object's dependencies automatically. * * @deprecated from v5 - slow and brings in a lot of code, Use `Injector.create` instead. * @abstract */ class ReflectiveInjector { /** * Turns an array of provider definitions into an array of resolved providers. * * A resolution is a process of flattening multiple nested arrays and converting individual * providers into an array of {\@link ResolvedReflectiveProvider}s. * * ### Example ([live demo](http://plnkr.co/edit/AiXTHi?p=preview)) * * ```typescript * \@Injectable() * class Engine { * } * * \@Injectable() * class Car { * constructor(public engine:Engine) {} * } * * var providers = ReflectiveInjector.resolve([Car, [[Engine]]]); * * expect(providers.length).toEqual(2); * * expect(providers[0] instanceof ResolvedReflectiveProvider).toBe(true); * expect(providers[0].key.displayName).toBe("Car"); * expect(providers[0].dependencies.length).toEqual(1); * expect(providers[0].factory).toBeDefined(); * * expect(providers[1].key.displayName).toBe("Engine"); * }); * ``` * * See {\@link ReflectiveInjector#fromResolvedProviders fromResolvedProviders} for more info. * @param {?} providers * @return {?} */ static resolve(providers) { return resolveReflectiveProviders(providers); } /** * Resolves an array of providers and creates an injector from those providers. * * The passed-in providers can be an array of `Type`, {\@link Provider}, * or a recursive array of more providers. * * ### Example ([live demo](http://plnkr.co/edit/ePOccA?p=preview)) * * ```typescript * \@Injectable() * class Engine { * } * * \@Injectable() * class Car { * constructor(public engine:Engine) {} * } * * var injector = ReflectiveInjector.resolveAndCreate([Car, Engine]); * expect(injector.get(Car) instanceof Car).toBe(true); * ``` * * This function is slower than the corresponding `fromResolvedProviders` * because it needs to resolve the passed-in providers first. * See {\@link ReflectiveInjector#resolve resolve} and * {\@link ReflectiveInjector#fromResolvedProviders fromResolvedProviders}. * @param {?} providers * @param {?=} parent * @return {?} */ static resolveAndCreate(providers, parent) { const /** @type {?} */ ResolvedReflectiveProviders = ReflectiveInjector.resolve(providers); return ReflectiveInjector.fromResolvedProviders(ResolvedReflectiveProviders, parent); } /** * Creates an injector from previously resolved providers. * * This API is the recommended way to construct injectors in performance-sensitive parts. * * ### Example ([live demo](http://plnkr.co/edit/KrSMci?p=preview)) * * ```typescript * \@Injectable() * class Engine { * } * * \@Injectable() * class Car { * constructor(public engine:Engine) {} * } * * var providers = ReflectiveInjector.resolve([Car, Engine]); * var injector = ReflectiveInjector.fromResolvedProviders(providers); * expect(injector.get(Car) instanceof Car).toBe(true); * ``` * \@experimental * @param {?} providers * @param {?=} parent * @return {?} */ static fromResolvedProviders(providers, parent) { return new ReflectiveInjector_(providers, parent); } } class ReflectiveInjector_ { /** * Private * @param {?} _providers * @param {?=} _parent */ constructor(_providers, _parent) { /** * \@internal */ this._constructionCounter = 0; this._providers = _providers; this.parent = _parent || null; const /** @type {?} */ len = _providers.length; this.keyIds = new Array(len); this.objs = new Array(len); for (let /** @type {?} */ i = 0; i < len; i++) { this.keyIds[i] = _providers[i].key.id; this.objs[i] = UNDEFINED; } } /** * @param {?} token * @param {?=} notFoundValue * @return {?} */ get(token, notFoundValue = THROW_IF_NOT_FOUND) { return this._getByKey(ReflectiveKey.get(token), null, notFoundValue); } /** * @param {?} providers * @return {?} */ resolveAndCreateChild(providers) { const /** @type {?} */ ResolvedReflectiveProviders = ReflectiveInjector.resolve(providers); return this.createChildFromResolved(ResolvedReflectiveProviders); } /** * @param {?} providers * @return {?} */ createChildFromResolved(providers) { const /** @type {?} */ inj = new ReflectiveInjector_(providers); (/** @type {?} */ (inj)).parent = this; return inj; } /** * @param {?} provider * @return {?} */ resolveAndInstantiate(provider) { return this.instantiateResolved(ReflectiveInjector.resolve([provider])[0]); } /** * @param {?} provider * @return {?} */ instantiateResolved(provider) { return this._instantiateProvider(provider); } /** * @param {?} index * @return {?} */ getProviderAtIndex(index) { if (index < 0 || index >= this._providers.length) { throw outOfBoundsError(index); } return this._providers[index]; } /** * \@internal * @param {?} provider * @return {?} */ _new(provider) { if (this._constructionCounter++ > this._getMaxNumberOfObjects()) { throw cyclicDependencyError(this, provider.key); } return this._instantiateProvider(provider); } /** * @return {?} */ _getMaxNumberOfObjects() { return this.objs.length; } /** * @param {?} provider * @return {?} */ _instantiateProvider(provider) { if (provider.multiProvider) { const /** @type {?} */ res = new Array(provider.resolvedFactories.length); for (let /** @type {?} */ i = 0; i < provider.resolvedFactories.length; ++i) { res[i] = this._instantiate(provider, provider.resolvedFactories[i]); } return res; } else { return this._instantiate(provider, provider.resolvedFactories[0]); } } /** * @param {?} provider * @param {?} ResolvedReflectiveFactory * @return {?} */ _instantiate(provider, ResolvedReflectiveFactory$$1) { const /** @type {?} */ factory = ResolvedReflectiveFactory$$1.factory; let /** @type {?} */ deps; try { deps = ResolvedReflectiveFactory$$1.dependencies.map(dep => this._getByReflectiveDependency(dep)); } catch (/** @type {?} */ e) { if (e.addKey) { e.addKey(this, provider.key); } throw e; } let /** @type {?} */ obj; try { obj = factory(...deps); } catch (/** @type {?} */ e) { throw instantiationError(this, e, e.stack, provider.key); } return obj; } /** * @param {?} dep * @return {?} */ _getByReflectiveDependency(dep) { return this._getByKey(dep.key, dep.visibility, dep.optional ? null : THROW_IF_NOT_FOUND); } /** * @param {?} key * @param {?} visibility * @param {?} notFoundValue * @return {?} */ _getByKey(key, visibility, notFoundValue) { if (key === ReflectiveInjector_.INJECTOR_KEY) { return this; } if (visibility instanceof Self) { return this._getByKeySelf(key, notFoundValue); } else { return this._getByKeyDefault(key, notFoundValue, visibility); } } /** * @param {?} keyId * @return {?} */ _getObjByKeyId(keyId) { for (let /** @type {?} */ i = 0; i < this.keyIds.length; i++) { if (this.keyIds[i] === keyId) { if (this.objs[i] === UNDEFINED) { this.objs[i] = this._new(this._providers[i]); } return this.objs[i]; } } return UNDEFINED; } /** * \@internal * @param {?} key * @param {?} notFoundValue * @return {?} */ _throwOrNull(key, notFoundValue) { if (notFoundValue !== THROW_IF_NOT_FOUND) { return notFoundValue; } else { throw noProviderError(this, key); } } /** * \@internal * @param {?} key * @param {?} notFoundValue * @return {?} */ _getByKeySelf(key, notFoundValue) { const /** @type {?} */ obj = this._getObjByKeyId(key.id); return (obj !== UNDEFINED) ? obj : this._throwOrNull(key, notFoundValue); } /** * \@internal * @param {?} key * @param {?} notFoundValue * @param {?} visibility * @return {?} */ _getByKeyDefault(key, notFoundValue, visibility) { let /** @type {?} */ inj; if (visibility instanceof SkipSelf) { inj = this.parent; } else { inj = this; } while (inj instanceof ReflectiveInjector_) { const /** @type {?} */ inj_ = /** @type {?} */ (inj); const /** @type {?} */ obj = inj_._getObjByKeyId(key.id); if (obj !== UNDEFINED) return obj; inj = inj_.parent; } if (inj !== null) { return inj.get(key.token, notFoundValue); } else { return this._throwOrNull(key, notFoundValue); } } /** * @return {?} */ get displayName() { const /** @type {?} */ providers = _mapProviders(this, (b) => ' "' + b.key.displayName + '" ') .join(', '); return `ReflectiveInjector(providers: [${providers}])`; } /** * @return {?} */ toString() { return this.displayName; } } ReflectiveInjector_.INJECTOR_KEY = ReflectiveKey.get(Injector); /** * @param {?} injector * @param {?} fn * @return {?} */ function _mapProviders(injector, fn) { const /** @type {?} */ res = new Array(injector._providers.length); for (let /** @type {?} */ i = 0; i < injector._providers.length; ++i) { res[i] = fn(injector.getProviderAtIndex(i)); } return res; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @module * @description * The `di` module provides dependency injection container services. */ /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * Determine if the argument is shaped like a Promise * @param {?} obj * @return {?} */ function isPromise(obj) { // allow any Promise/A+ compliant thenable. // It's up to the caller to ensure that obj.then conforms to the spec return !!obj && typeof obj.then === 'function'; } /** * Determine if the argument is an Observable * @param {?} obj * @return {?} */ function isObservable(obj) { // TODO: use Symbol.observable when https://github.com/ReactiveX/rxjs/issues/2415 will be resolved return !!obj && typeof obj.subscribe === 'function'; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * A function that will be executed when an application is initialized. * \@experimental */ const APP_INITIALIZER = new InjectionToken('Application Initializer'); /** * A class that reflects the state of running {\@link APP_INITIALIZER}s. * * \@experimental */ class ApplicationInitStatus { /** * @param {?} appInits */ constructor(appInits) { this.appInits = appInits; this.initialized = false; this.done = false; this.donePromise = new Promise((res, rej) => { this.resolve = res; this.reject = rej; }); } /** * \@internal * @return {?} */ runInitializers() { if (this.initialized) { return; } const /** @type {?} */ asyncInitPromises = []; const /** @type {?} */ complete = () => { (/** @type {?} */ (this)).done = true; this.resolve(); }; if (this.appInits) { for (let /** @type {?} */ i = 0; i < this.appInits.length; i++) { const /** @type {?} */ initResult = this.appInits[i](); if (isPromise(initResult)) { asyncInitPromises.push(initResult); } } } Promise.all(asyncInitPromises).then(() => { complete(); }).catch(e => { this.reject(e); }); if (asyncInitPromises.length === 0) { complete(); } this.initialized = true; } } ApplicationInitStatus.decorators = [ { type: Injectable }, ]; /** @nocollapse */ ApplicationInitStatus.ctorParameters = () => [ { type: Array, decorators: [{ type: Inject, args: [APP_INITIALIZER,] }, { type: Optional },] }, ]; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * A DI Token representing a unique string id assigned to the application by Angular and used * primarily for prefixing application attributes and CSS styles when * {\@link ViewEncapsulation#Emulated ViewEncapsulation.Emulated} is being used. * * If you need to avoid randomly generated value to be used as an application id, you can provide * a custom value via a DI provider <!-- TODO: provider --> configuring the root {\@link Injector} * using this token. * \@experimental */ const APP_ID = new InjectionToken('AppId'); /** * @return {?} */ function _appIdRandomProviderFactory() { return `${_randomChar()}${_randomChar()}${_randomChar()}`; } /** * Providers that will generate a random APP_ID_TOKEN. * \@experimental */ const APP_ID_RANDOM_PROVIDER = { provide: APP_ID, useFactory: _appIdRandomProviderFactory, deps: /** @type {?} */ ([]), }; /** * @return {?} */ function _randomChar() { return String.fromCharCode(97 + Math.floor(Math.random() * 25)); } /** * A function that will be executed when a platform is initialized. * \@experimental */ const PLATFORM_INITIALIZER = new InjectionToken('Platform Initializer'); /** * A token that indicates an opaque platform id. * \@experimental */ const PLATFORM_ID = new InjectionToken('Platform ID'); /** * All callbacks provided via this token will be called for every component that is bootstrapped. * Signature of the callback: * * `(componentRef: ComponentRef) => void`. * * \@experimental */ const APP_BOOTSTRAP_LISTENER = new InjectionToken('appBootstrapListener'); /** * A token which indicates the root directory of the application * \@experimental */ const PACKAGE_ROOT_URL = new InjectionToken('Application Packages Root URL'); /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ class Console { /** * @param {?} message * @return {?} */ log(message) { // tslint:disable-next-line:no-console console.log(message); } /** * @param {?} message * @return {?} */ warn(message) { // tslint:disable-next-line:no-console console.warn(message); } } Console.decorators = [ { type: Injectable }, ]; /** @nocollapse */ Console.ctorParameters = () => []; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * Combination of NgModuleFactory and ComponentFactorys. * * \@experimental * @template T */ class ModuleWithComponentFactories { /** * @param {?} ngModuleFactory * @param {?} componentFactories */ constructor(ngModuleFactory, componentFactories) { this.ngModuleFactory = ngModuleFactory; this.componentFactories = componentFactories; } } /** * @return {?} */ function _throwError() { throw new Error(`Runtime compiler is not loaded`); } /** * Low-level service for running the angular compiler during runtime * to create {\@link ComponentFactory}s, which * can later be used to create and render a Component instance. * * Each `\@NgModule` provides an own `Compiler` to its injector, * that will use the directives/pipes of the ng module for compilation * of components. * \@stable */ class Compiler { /** * Compiles the given NgModule and all of its components. All templates of the components listed * in `entryComponents` have to be inlined. * @template T * @param {?} moduleType * @return {?} */ compileModuleSync(moduleType) { throw _throwError(); } /** * Compiles the given NgModule and all of its components * @template T * @param {?} moduleType * @return {?} */ compileModuleAsync(moduleType) { throw _throwError(); } /** * Same as {\@link #compileModuleSync} but also creates ComponentFactories for all components. * @template T * @param {?} moduleType * @return {?} */ compileModuleAndAllComponentsSync(moduleType) { throw _throwError(); } /** * Same as {\@link #compileModuleAsync} but also creates ComponentFactories for all components. * @template T * @param {?} moduleType * @return {?} */ compileModuleAndAllComponentsAsync(moduleType) { throw _throwError(); } /** * Clears all caches. * @return {?} */ clearCache() { } /** * Clears the cache for the given component/ngModule. * @param {?} type * @return {?} */ clearCacheFor(type) { } } Compiler.decorators = [ { type: Injectable }, ]; /** @nocollapse */ Compiler.ctorParameters = () => []; /** * Token to provide CompilerOptions in the platform injector. * * \@experimental */ const COMPILER_OPTIONS = new InjectionToken('compilerOptions'); /** * A factory for creating a Compiler * * \@experimental * @abstract */ class CompilerFactory { } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * Represents an instance of a Component created via a {\@link ComponentFactory}. * * `ComponentRef` provides access to the Component Instance as well other objects related to this * Component Instance and allows you to destroy the Component Instance via the {\@link #destroy} * method. * \@stable * @abstract * @template C */ class ComponentRef { } /** * \@stable * @abstract * @template C */ class ComponentFactory { } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @param {?} component * @return {?} */ function noComponentFactoryError(component) { const /** @type {?} */ error = Error(`No component factory found for ${stringify(component)}. Did you add it to @NgModule.entryComponents?`); (/** @type {?} */ (error))[ERROR_COMPONENT] = component; return error; } const ERROR_COMPONENT = 'ngComponent'; /** * @param {?} error * @return {?} */ class _NullComponentFactoryResolver { /** * @template T * @param {?} component * @return {?} */ resolveComponentFactory(component) { throw noComponentFactoryError(component); } } /** * \@stable * @abstract */ class ComponentFactoryResolver { } ComponentFactoryResolver.NULL = new _NullComponentFactoryResolver(); class CodegenComponentFactoryResolver { /** * @param {?} factories * @param {?} _parent * @param {?} _ngModule */ constructor(factories, _parent, _ngModule) { this._parent = _parent; this._ngModule = _ngModule; this._factories = new Map(); for (let /** @type {?} */ i = 0; i < factories.length; i++) { const /** @type {?} */ factory = factories[i]; this._factories.set(factory.componentType, factory); } } /** * @template T * @param {?} component * @return {?} */ resolveComponentFactory(component) { let /** @type {?} */ factory = this._factories.get(component); if (!factory && this._parent) { factory = this._parent.resolveComponentFactory(component); } if (!factory) { throw noComponentFactoryError(component); } return new ComponentFactoryBoundToModule(factory, this._ngModule); } } /** * @template C */ class ComponentFactoryBoundToModule extends ComponentFactory { /** * @param {?} factory * @param {?} ngModule */ constructor(factory, ngModule) { super(); this.factory = factory; this.ngModule = ngModule; this.selector = factory.selector; this.componentType = factory.componentType; this.ngContentSelectors = factory.ngContentSelectors; this.inputs = factory.inputs; this.outputs = factory.outputs; } /** * @param {?} injector * @param {?=} projectableNodes * @param {?=} rootSelectorOrNode * @param {?=} ngModule * @return {?} */ create(injector, projectableNodes, rootSelectorOrNode, ngModule) { return this.factory.create(injector, projectableNodes, rootSelectorOrNode, ngModule || this.ngModule); } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * Represents an instance of an NgModule created via a {\@link NgModuleFactory}. * * `NgModuleRef` provides access to the NgModule Instance as well other objects related to this * NgModule Instance. * * \@stable * @abstract * @template T */ class NgModuleRef { } /** * @record * @template T */ /** * \@experimental * @abstract * @template T */ class NgModuleFactory { } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * A scope function for the Web Tracing Framework (WTF). * * \@experimental * @record */ /** * @record */ /** * @record */ let trace; let events; /** * @return {?} */ function detectWTF() { const /** @type {?} */ wtf = (/** @type {?} */ (_global /** TODO #9100 */) /** TODO #9100 */)['wtf']; if (wtf) { trace = wtf['trace']; if (trace) { events = trace['events']; return true; } } return false; } /** * @param {?} signature * @param {?=} flags * @return {?} */ function createScope$1(signature, flags = null) { return events.createScope(signature, flags); } /** * @template T * @param {?} scope * @param {?=} returnValue * @return {?} */ function leave(scope, returnValue) { trace.leaveScope(scope, returnValue); return returnValue; } /** * @param {?} rangeType * @param {?} action * @return {?} */ function startTimeRange(rangeType, action) { return trace.beginTimeRange(rangeType, action); } /** * @param {?} range * @return {?} */ function endTimeRange(range) { trace.endTimeRange(range); } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * True if WTF is enabled. */ const wtfEnabled = detectWTF(); /** * @param {?=} arg0 * @param {?=} arg1 * @return {?} */ function noopScope(arg0, arg1) { return null; } /** * Create trace scope. * * Scopes must be strictly nested and are analogous to stack frames, but * do not have to follow the stack frames. Instead it is recommended that they follow logical * nesting. You may want to use * [Event * Signatures](http://google.github.io/tracing-framework/instrumenting-code.html#custom-events) * as they are defined in WTF. * * Used to mark scope entry. The return value is used to leave the scope. * * var myScope = wtfCreateScope('MyClass#myMethod(ascii someVal)'); * * someMethod() { * var s = myScope('Foo'); // 'Foo' gets stored in tracing UI * // DO SOME WORK HERE * return wtfLeave(s, 123); // Return value 123 * } * * Note, adding try-finally block around the work to ensure that `wtfLeave` gets called can * negatively impact the performance of your application. For this reason we recommend that * you don't add them to ensure that `wtfLeave` gets called. In production `wtfLeave` is a noop and * so try-finally block has no value. When debugging perf issues, skipping `wtfLeave`, do to * exception, will produce incorrect trace, but presence of exception signifies logic error which * needs to be fixed before the app should be profiled. Add try-finally only when you expect that * an exception is expected during normal execution while profiling. * * \@experimental */ const wtfCreateScope = wtfEnabled ? createScope$1 : (signature, flags) => noopScope; /** * Used to mark end of Scope. * * - `scope` to end. * - `returnValue` (optional) to be passed to the WTF. * * Returns the `returnValue for easy chaining. * \@experimental */ const wtfLeave = wtfEnabled ? leave : (s, r) => r; /** * Used to mark Async start. Async are similar to scope but they don't have to be strictly nested. * The return value is used in the call to [endAsync]. Async ranges only work if WTF has been * enabled. * * someMethod() { * var s = wtfStartTimeRange('HTTP:GET', 'some.url'); * var future = new Future.delay(5).then((_) { * wtfEndTimeRange(s); * }); * } * \@experimental */ const wtfStartTimeRange = wtfEnabled ? startTimeRange : (rangeType, action) => null; /** * Ends a async time range operation. * [range] is the return value from [wtfStartTimeRange] Async ranges only work if WTF has been * enabled. * \@experimental */ const wtfEndTimeRange = wtfEnabled ? endTimeRange : (r) => null; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * Use by directives and components to emit custom Events. * * ### Examples * * In the following example, `Zippy` alternatively emits `open` and `close` events when its * title gets clicked: * * ``` * \@Component({ * selector: 'zippy', * template: ` * <div class="zippy"> * <div (click)="toggle()">Toggle</div> * <div [hidden]="!visible"> * <ng-content></ng-content> * </div> * </div>`}) * export class Zippy { * visible: boolean = true; * \@Output() open: EventEmitter<any> = new EventEmitter(); * \@Output() close: EventEmitter<any> = new EventEmitter(); * * toggle() { * this.visible = !this.visible; * if (this.visible) { * this.open.emit(null); * } else { * this.close.emit(null); * } * } * } * ``` * * The events payload can be accessed by the parameter `$event` on the components output event * handler: * * ``` * <zippy (open)="onOpen($event)" (close)="onClose($event)"></zippy> * ``` * * Uses Rx.Observable but provides an adapter to make it work as specified here: * https://github.com/jhusain/observable-spec * * Once a reference implementation of the spec is available, switch to it. * \@stable * @template T */ class EventEmitter extends __WEBPACK_IMPORTED_MODULE_3_rxjs_Subject__["Subject"] { /** * Creates an instance of {\@link EventEmitter}, which depending on `isAsync`, * delivers events synchronously or asynchronously. * * @param {?=} isAsync By default, events are delivered synchronously (default value: `false`). * Set to `true` for asynchronous event delivery. */ constructor(isAsync = false) { super(); this.__isAsync = isAsync; } /** * @param {?=} value * @return {?} */ emit(value) { super.next(value); } /** * @param {?=} generatorOrNext * @param {?=} error * @param {?=} complete * @return {?} */ subscribe(generatorOrNext, error, complete) { let /** @type {?} */ schedulerFn; let /** @type {?} */ errorFn = (err) => null; let /** @type {?} */ completeFn = () => null; if (generatorOrNext && typeof generatorOrNext === 'object') { schedulerFn = this.__isAsync ? (value) => { setTimeout(() => generatorOrNext.next(value)); } : (value) => { generatorOrNext.next(value); }; if (generatorOrNext.error) { errorFn = this.__isAsync ? (err) => { setTimeout(() => generatorOrNext.error(err)); } : (err) => { generatorOrNext.error(err); }; } if (generatorOrNext.complete) { completeFn = this.__isAsync ? () => { setTimeout(() => generatorOrNext.complete()); } : () => { generatorOrNext.complete(); }; } } else { schedulerFn = this.__isAsync ? (value) => { setTimeout(() => generatorOrNext(value)); } : (value) => { generatorOrNext(value); }; if (error) { errorFn = this.__isAsync ? (err) => { setTimeout(() => error(err)); } : (err) => { error(err); }; } if (complete) { completeFn = this.__isAsync ? () => { setTimeout(() => complete()); } : () => { complete(); }; } } const /** @type {?} */ sink = super.subscribe(schedulerFn, errorFn, completeFn); if (generatorOrNext instanceof __WEBPACK_IMPORTED_MODULE_4_rxjs_Subscription__["a" /* Subscription */]) { generatorOrNext.add(sink); } return sink; } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * An injectable service for executing work inside or outside of the Angular zone. * * The most common use of this service is to optimize performance when starting a work consisting of * one or more asynchronous tasks that don't require UI updates or error handling to be handled by * Angular. Such tasks can be kicked off via {\@link #runOutsideAngular} and if needed, these tasks * can reenter the Angular zone via {\@link #run}. * * <!-- TODO: add/fix links to: * - docs explaining zones and the use of zones in Angular and change-detection * - link to runOutsideAngular/run (throughout this file!) * --> * * ### Example * * ``` * import {Component, NgZone} from '\@angular/core'; * import {NgIf} from '\@angular/common'; * * \@Component({ * selector: 'ng-zone-demo', * template: ` * <h2>Demo: NgZone</h2> * * <p>Progress: {{progress}}%</p> * <p *ngIf="progress >= 100">Done processing {{label}} of Angular zone!</p> * * <button (click)="processWithinAngularZone()">Process within Angular zone</button> * <button (click)="processOutsideOfAngularZone()">Process outside of Angular zone</button> * `, * }) * export class NgZoneDemo { * progress: number = 0; * label: string; * * constructor(private _ngZone: NgZone) {} * * // Loop inside the Angular zone * // so the UI DOES refresh after each setTimeout cycle * processWithinAngularZone() { * this.label = 'inside'; * this.progress = 0; * this._increaseProgress(() => console.log('Inside Done!')); * } * * // Loop outside of the Angular zone * // so the UI DOES NOT refresh after each setTimeout cycle * processOutsideOfAngularZone() { * this.label = 'outside'; * this.progress = 0; * this._ngZone.runOutsideAngular(() => { * this._increaseProgress(() => { * // reenter the Angular zone and display done * this._ngZone.run(() => { console.log('Outside Done!'); }); * }); * }); * } * * _increaseProgress(doneCallback: () => void) { * this.progress += 1; * console.log(`Current progress: ${this.progress}%`); * * if (this.progress < 100) { * window.setTimeout(() => this._increaseProgress(doneCallback), 10); * } else { * doneCallback(); * } * } * } * ``` * * \@experimental */ class NgZone { /** * @param {?} __0 */ constructor({ enableLongStackTrace = false }) { this.hasPendingMicrotasks = false; this.hasPendingMacrotasks = false; /** * Whether there are no outstanding microtasks or macrotasks. */ this.isStable = true; /** * Notifies when code enters Angular Zone. This gets fired first on VM Turn. */ this.onUnstable = new EventEmitter(false); /** * Notifies when there is no more microtasks enqueued in the current VM Turn. * This is a hint for Angular to do change detection, which may enqueue more microtasks. * For this reason this event can fire multiple times per VM Turn. */ this.onMicrotaskEmpty = new EventEmitter(false); /** * Notifies when the last `onMicrotaskEmpty` has run and there are no more microtasks, which * implies we are about to relinquish VM turn. * This event gets called just once. */ this.onStable = new EventEmitter(false); /** * Notifies that an error has been delivered. */ this.onError = new EventEmitter(false); if (typeof Zone == 'undefined') { throw new Error(`In this configuration Angular requires Zone.js`); } Zone.assertZonePatched(); const /** @type {?} */ self = /** @type {?} */ ((this)); self._nesting = 0; self._outer = self._inner = Zone.current; if ((/** @type {?} */ (Zone))['wtfZoneSpec']) { self._inner = self._inner.fork((/** @type {?} */ (Zone))['wtfZoneSpec']); } if (enableLongStackTrace && (/** @type {?} */ (Zone))['longStackTraceZoneSpec']) { self._inner = self._inner.fork((/** @type {?} */ (Zone))['longStackTraceZoneSpec']); } forkInnerZoneWithAngularBehavior(self); } /** * @return {?} */ static isInAngularZone() { return Zone.current.get('isAngularZone') === true; } /** * @return {?} */ static assertInAngularZone() { if (!NgZone.isInAngularZone()) { throw new Error('Expected to be in Angular Zone, but it is not!'); } } /** * @return {?} */ static assertNotInAngularZone() { if (NgZone.isInAngularZone()) { throw new Error('Expected to not be in Angular Zone, but it is!'); } } /** * Executes the `fn` function synchronously within the Angular zone and returns value returned by * the function. * * Running functions via `run` allows you to reenter Angular zone from a task that was executed * outside of the Angular zone (typically started via {\@link #runOutsideAngular}). * * Any future tasks or microtasks scheduled from within this function will continue executing from * within the Angular zone. * * If a synchronous error happens it will be rethrown and not reported via `onError`. * @template T * @param {?} fn * @param {?=} applyThis * @param {?=} applyArgs * @return {?} */ run(fn, applyThis, applyArgs) { return /** @type {?} */ ((/** @type {?} */ ((this)))._inner.run(fn, applyThis, applyArgs)); } /** * Executes the `fn` function synchronously within the Angular zone as a task and returns value * returned by the function. * * Running functions via `run` allows you to reenter Angular zone from a task that was executed * outside of the Angular zone (typically started via {\@link #runOutsideAngular}). * * Any future tasks or microtasks scheduled from within this function will continue executing from * within the Angular zone. * * If a synchronous error happens it will be rethrown and not reported via `onError`. * @template T * @param {?} fn * @param {?=} applyThis * @param {?=} applyArgs * @param {?=} name * @return {?} */ runTask(fn, applyThis, applyArgs, name) { const /** @type {?} */ zone = (/** @type {?} */ ((this)))._inner; const /** @type {?} */ task = zone.scheduleEventTask('NgZoneEvent: ' + name, fn, EMPTY_PAYLOAD, noop, noop); try { return /** @type {?} */ (zone.runTask(task, applyThis, applyArgs)); } finally { zone.cancelTask(task); } } /** * Same as `run`, except that synchronous errors are caught and forwarded via `onError` and not * rethrown. * @template T * @param {?} fn * @param {?=} applyThis * @param {?=} applyArgs * @return {?} */ runGuarded(fn, applyThis, applyArgs) { return /** @type {?} */ ((/** @type {?} */ ((this)))._inner.runGuarded(fn, applyThis, applyArgs)); } /** * Executes the `fn` function synchronously in Angular's parent zone and returns value returned by * the function. * * Running functions via {\@link #runOutsideAngular} allows you to escape Angular's zone and do * work that * doesn't trigger Angular change-detection or is subject to Angular's error handling. * * Any future tasks or microtasks scheduled from within this function will continue executing from * outside of the Angular zone. * * Use {\@link #run} to reenter the Angular zone and do work that updates the application model. * @template T * @param {?} fn * @return {?} */ runOutsideAngular(fn) { return /** @type {?} */ ((/** @type {?} */ ((this)))._outer.run(fn)); } } /** * @return {?} */ function noop() { } const EMPTY_PAYLOAD = {}; /** * @param {?} zone * @return {?} */ function checkStable(zone) { if (zone._nesting == 0 && !zone.hasPendingMicrotasks && !zone.isStable) { try { zone._nesting++; zone.onMicrotaskEmpty.emit(null); } finally { zone._nesting--; if (!zone.hasPendingMicrotasks) { try { zone.runOutsideAngular(() => zone.onStable.emit(null)); } finally { zone.isStable = true; } } } } } /** * @param {?} zone * @return {?} */ function forkInnerZoneWithAngularBehavior(zone) { zone._inner = zone._inner.fork({ name: 'angular', properties: /** @type {?} */ ({ 'isAngularZone': true }), onInvokeTask: (delegate, current, target, task, applyThis, applyArgs) => { try { onEnter(zone); return delegate.invokeTask(target, task, applyThis, applyArgs); } finally { onLeave(zone); } }, onInvoke: (delegate, current, target, callback, applyThis, applyArgs, source) => { try { onEnter(zone); return delegate.invoke(target, callback, applyThis, applyArgs, source); } finally { onLeave(zone); } }, onHasTask: (delegate, current, target, hasTaskState) => { delegate.hasTask(target, hasTaskState); if (current === target) { // We are only interested in hasTask events which originate from our zone // (A child hasTask event is not interesting to us) if (hasTaskState.change == 'microTask') { zone.hasPendingMicrotasks = hasTaskState.microTask; checkStable(zone); } else if (hasTaskState.change == 'macroTask') { zone.hasPendingMacrotasks = hasTaskState.macroTask; } } }, onHandleError: (delegate, current, target, error) => { delegate.handleError(target, error); zone.runOutsideAngular(() => zone.onError.emit(error)); return false; } }); } /** * @param {?} zone * @return {?} */ function onEnter(zone) { zone._nesting++; if (zone.isStable) { zone.isStable = false; zone.onUnstable.emit(null); } } /** * @param {?} zone * @return {?} */ function onLeave(zone) { zone._nesting--; checkStable(zone); } /** * Provides a noop implementation of `NgZone` which does nothing. This zone requires explicit calls * to framework to perform rendering. */ class NoopNgZone { constructor() { this.hasPendingMicrotasks = false; this.hasPendingMacrotasks = false; this.isStable = true; this.onUnstable = new EventEmitter(); this.onMicrotaskEmpty = new EventEmitter(); this.onStable = new EventEmitter(); this.onError = new EventEmitter(); } /** * @param {?} fn * @return {?} */ run(fn) { return fn(); } /** * @param {?} fn * @return {?} */ runGuarded(fn) { return fn(); } /** * @param {?} fn * @return {?} */ runOutsideAngular(fn) { return fn(); } /** * @template T * @param {?} fn * @return {?} */ runTask(fn) { return fn(); } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * The Testability service provides testing hooks that can be accessed from * the browser and by services such as Protractor. Each bootstrapped Angular * application on the page will have an instance of Testability. * \@experimental */ class Testability { /** * @param {?} _ngZone */ constructor(_ngZone) { this._ngZone = _ngZone; /** * \@internal */ this._pendingCount = 0; /** * \@internal */ this._isZoneStable = true; /** * Whether any work was done since the last 'whenStable' callback. This is * useful to detect if this could have potentially destabilized another * component while it is stabilizing. * \@internal */ this._didWork = false; /** * \@internal */ this._callbacks = []; this._watchAngularEvents(); } /** * \@internal * @return {?} */ _watchAngularEvents() { this._ngZone.onUnstable.subscribe({ next: () => { this._didWork = true; this._isZoneStable = false; } }); this._ngZone.runOutsideAngular(() => { this._ngZone.onStable.subscribe({ next: () => { NgZone.assertNotInAngularZone(); scheduleMicroTask(() => { this._isZoneStable = true; this._runCallbacksIfReady(); }); } }); }); } /** * Increases the number of pending request * @return {?} */ increasePendingRequestCount() { this._pendingCount += 1; this._didWork = true; return this._pendingCount; } /** * Decreases the number of pending request * @return {?} */ decreasePendingRequestCount() { this._pendingCount -= 1; if (this._pendingCount < 0) { throw new Error('pending async requests below zero'); } this._runCallbacksIfReady(); return this._pendingCount; } /** * Whether an associated application is stable * @return {?} */ isStable() { return this._isZoneStable && this._pendingCount == 0 && !this._ngZone.hasPendingMacrotasks; } /** * \@internal * @return {?} */ _runCallbacksIfReady() { if (this.isStable()) { // Schedules the call backs in a new frame so that it is always async. scheduleMicroTask(() => { while (this._callbacks.length !== 0) { (/** @type {?} */ ((this._callbacks.pop())))(this._didWork); } this._didWork = false; }); } else { // Not Ready this._didWork = true; } } /** * Run callback when the application is stable * @param {?} callback function to be called after the application is stable * @return {?} */ whenStable(callback) { this._callbacks.push(callback); this._runCallbacksIfReady(); } /** * Get the number of pending requests * @return {?} */ getPendingRequestCount() { return this._pendingCount; } /** * Find providers by name * @param {?} using The root element to search from * @param {?} provider The name of binding variable * @param {?} exactMatch Whether using exactMatch * @return {?} */ findProviders(using, provider, exactMatch) { // TODO(juliemr): implement. return []; } } Testability.decorators = [ { type: Injectable }, ]; /** @nocollapse */ Testability.ctorParameters = () => [ { type: NgZone, }, ]; /** * A global registry of {\@link Testability} instances for specific elements. * \@experimental */ class TestabilityRegistry { constructor() { /** * \@internal */ this._applications = new Map(); _testabilityGetter.addToWindow(this); } /** * Registers an application with a testability hook so that it can be tracked * @param {?} token token of application, root element * @param {?} testability Testability hook * @return {?} */ registerApplication(token, testability) { this._applications.set(token, testability); } /** * Unregisters an application. * @param {?} token token of application, root element * @return {?} */ unregisterApplication(token) { this._applications.delete(token); } /** * Unregisters all applications * @return {?} */ unregisterAllApplications() { this._applications.clear(); } /** * Get a testability hook associated with the application * @param {?} elem root element * @return {?} */ getTestability(elem) { return this._applications.get(elem) || null; } /** * Get all registered testabilities * @return {?} */ getAllTestabilities() { return Array.from(this._applications.values()); } /** * Get all registered applications(root elements) * @return {?} */ getAllRootElements() { return Array.from(this._applications.keys()); } /** * Find testability of a node in the Tree * @param {?} elem node * @param {?=} findInAncestors whether finding testability in ancestors if testability was not found in * current node * @return {?} */ findTestabilityInTree(elem, findInAncestors = true) { return _testabilityGetter.findTestabilityInTree(this, elem, findInAncestors); } } TestabilityRegistry.decorators = [ { type: Injectable }, ]; /** @nocollapse */ TestabilityRegistry.ctorParameters = () => []; /** * Adapter interface for retrieving the `Testability` service associated for a * particular context. * * \@experimental Testability apis are primarily intended to be used by e2e test tool vendors like * the Protractor team. * @record */ class _NoopGetTestability { /** * @param {?} registry * @return {?} */ addToWindow(registry) { } /** * @param {?} registry * @param {?} elem * @param {?} findInAncestors * @return {?} */ findTestabilityInTree(registry, elem, findInAncestors) { return null; } } /** * Set the {\@link GetTestability} implementation used by the Angular testing framework. * \@experimental * @param {?} getter * @return {?} */ function setTestabilityGetter(getter) { _testabilityGetter = getter; } let _testabilityGetter = new _NoopGetTestability(); /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ let _devMode = true; let _runModeLocked = false; let _platform; const ALLOW_MULTIPLE_PLATFORMS = new InjectionToken('AllowMultipleToken'); /** * Disable Angular's development mode, which turns off assertions and other * checks within the framework. * * One important assertion this disables verifies that a change detection pass * does not result in additional changes to any bindings (also known as * unidirectional data flow). * * \@stable * @return {?} */ function enableProdMode() { if (_runModeLocked) { throw new Error('Cannot enable prod mode after platform setup.'); } _devMode = false; } /** * Returns whether Angular is in development mode. After called once, * the value is locked and won't change any more. * * By default, this is true, unless a user calls `enableProdMode` before calling this. * * \@experimental APIs related to application bootstrap are currently under review. * @return {?} */ function isDevMode() { _runModeLocked = true; return _devMode; } /** * A token for third-party components that can register themselves with NgProbe. * * \@experimental */ class NgProbeToken { /** * @param {?} name * @param {?} token */ constructor(name, token) { this.name = name; this.token = token; } } /** * Creates a platform. * Platforms have to be eagerly created via this function. * * \@experimental APIs related to application bootstrap are currently under review. * @param {?} injector * @return {?} */ function createPlatform(injector) { if (_platform && !_platform.destroyed && !_platform.injector.get(ALLOW_MULTIPLE_PLATFORMS, false)) { throw new Error('There can be only one platform. Destroy the previous one to create a new one.'); } _platform = injector.get(PlatformRef); const /** @type {?} */ inits = injector.get(PLATFORM_INITIALIZER, null); if (inits) inits.forEach((init) => init()); return _platform; } /** * Creates a factory for a platform * * \@experimental APIs related to application bootstrap are currently under review. * @param {?} parentPlatformFactory * @param {?} name * @param {?=} providers * @return {?} */ function createPlatformFactory(parentPlatformFactory, name, providers = []) { const /** @type {?} */ desc = `Platform: ${name}`; const /** @type {?} */ marker = new InjectionToken(desc); return (extraProviders = []) => { let /** @type {?} */ platform = getPlatform(); if (!platform || platform.injector.get(ALLOW_MULTIPLE_PLATFORMS, false)) { if (parentPlatformFactory) { parentPlatformFactory(providers.concat(extraProviders).concat({ provide: marker, useValue: true })); } else { const /** @type {?} */ injectedProviders = providers.concat(extraProviders).concat({ provide: marker, useValue: true }); createPlatform(Injector.create({ providers: injectedProviders, name: desc })); } } return assertPlatform(marker); }; } /** * Checks that there currently is a platform which contains the given token as a provider. * * \@experimental APIs related to application bootstrap are currently under review. * @param {?} requiredToken * @return {?} */ function assertPlatform(requiredToken) { const /** @type {?} */ platform = getPlatform(); if (!platform) { throw new Error('No platform exists!'); } if (!platform.injector.get(requiredToken, null)) { throw new Error('A platform with a different configuration has been created. Please destroy it first.'); } return platform; } /** * Destroy the existing platform. * * \@experimental APIs related to application bootstrap are currently under review. * @return {?} */ function destroyPlatform() { if (_platform && !_platform.destroyed) { _platform.destroy(); } } /** * Returns the current platform. * * \@experimental APIs related to application bootstrap are currently under review. * @return {?} */ function getPlatform() { return _platform && !_platform.destroyed ? _platform : null; } /** * Provides additional options to the bootstraping process. * * \@stable * @record */ /** * The Angular platform is the entry point for Angular on a web page. Each page * has exactly one platform, and services (such as reflection) which are common * to every Angular application running on the page are bound in its scope. * * A page's platform is initialized implicitly when a platform is created via a platform factory * (e.g. {\@link platformBrowser}), or explicitly by calling the {\@link createPlatform} function. * * \@stable */ class PlatformRef { /** * \@internal * @param {?} _injector */ constructor(_injector) { this._injector = _injector; this._modules = []; this._destroyListeners = []; this._destroyed = false; } /** * Creates an instance of an `\@NgModule` for the given platform * for offline compilation. * * ## Simple Example * * ```typescript * my_module.ts: * * \@NgModule({ * imports: [BrowserModule] * }) * class MyModule {} * * main.ts: * import {MyModuleNgFactory} from './my_module.ngfactory'; * import {platformBrowser} from '\@angular/platform-browser'; * * let moduleRef = platformBrowser().bootstrapModuleFactory(MyModuleNgFactory); * ``` * * \@experimental APIs related to application bootstrap are currently under review. * @template M * @param {?} moduleFactory * @param {?=} options * @return {?} */ bootstrapModuleFactory(moduleFactory, options) { // Note: We need to create the NgZone _before_ we instantiate the module, // as instantiating the module creates some providers eagerly. // So we create a mini parent injector that just contains the new NgZone and // pass that as parent to the NgModuleFactory. const /** @type {?} */ ngZoneOption = options ? options.ngZone : undefined; const /** @type {?} */ ngZone = getNgZone(ngZoneOption); const /** @type {?} */ providers = [{ provide: NgZone, useValue: ngZone }]; // Attention: Don't use ApplicationRef.run here, // as we want to be sure that all possible constructor calls are inside `ngZone.run`! return ngZone.run(() => { const /** @type {?} */ ngZoneInjector = Injector.create({ providers: providers, parent: this.injector, name: moduleFactory.moduleType.name }); const /** @type {?} */ moduleRef = /** @type {?} */ (moduleFactory.create(ngZoneInjector)); const /** @type {?} */ exceptionHandler = moduleRef.injector.get(ErrorHandler, null); if (!exceptionHandler) { throw new Error('No ErrorHandler. Is platform module (BrowserModule) included?'); } moduleRef.onDestroy(() => remove(this._modules, moduleRef)); /** @type {?} */ ((ngZone)).runOutsideAngular(() => /** @type {?} */ ((ngZone)).onError.subscribe({ next: (error) => { exceptionHandler.handleError(error); } })); return _callAndReportToErrorHandler(exceptionHandler, /** @type {?} */ ((ngZone)), () => { const /** @type {?} */ initStatus = moduleRef.injector.get(ApplicationInitStatus); initStatus.runInitializers(); return initStatus.donePromise.then(() => { this._moduleDoBootstrap(moduleRef); return moduleRef; }); }); }); } /** * Creates an instance of an `\@NgModule` for a given platform using the given runtime compiler. * * ## Simple Example * * ```typescript * \@NgModule({ * imports: [BrowserModule] * }) * class MyModule {} * * let moduleRef = platformBrowser().bootstrapModule(MyModule); * ``` * \@stable * @template M * @param {?} moduleType * @param {?=} compilerOptions * @return {?} */ bootstrapModule(moduleType, compilerOptions = []) { const /** @type {?} */ compilerFactory = this.injector.get(CompilerFactory); const /** @type {?} */ options = optionsReducer({}, compilerOptions); const /** @type {?} */ compiler = compilerFactory.createCompiler([options]); return compiler.compileModuleAsync(moduleType) .then((moduleFactory) => this.bootstrapModuleFactory(moduleFactory, options)); } /** * @param {?} moduleRef * @return {?} */ _moduleDoBootstrap(moduleRef) { const /** @type {?} */ appRef = /** @type {?} */ (moduleRef.injector.get(ApplicationRef)); if (moduleRef._bootstrapComponents.length > 0) { moduleRef._bootstrapComponents.forEach(f => appRef.bootstrap(f)); } else if (moduleRef.instance.ngDoBootstrap) { moduleRef.instance.ngDoBootstrap(appRef); } else { throw new Error(`The module ${stringify(moduleRef.instance.constructor)} was bootstrapped, but it does not declare "@NgModule.bootstrap" components nor a "ngDoBootstrap" method. ` + `Please define one of these.`); } this._modules.push(moduleRef); } /** * Register a listener to be called when the platform is disposed. * @param {?} callback * @return {?} */ onDestroy(callback) { this._destroyListeners.push(callback); } /** * Retrieve the platform {\@link Injector}, which is the parent injector for * every Angular application on the page and provides singleton providers. * @return {?} */ get injector() { return this._injector; } /** * Destroy the Angular platform and all Angular applications on the page. * @return {?} */ destroy() { if (this._destroyed) { throw new Error('The platform has already been destroyed!'); } this._modules.slice().forEach(module => module.destroy()); this._destroyListeners.forEach(listener => listener()); this._destroyed = true; } /** * @return {?} */ get destroyed() { return this._destroyed; } } PlatformRef.decorators = [ { type: Injectable }, ]; /** @nocollapse */ PlatformRef.ctorParameters = () => [ { type: Injector, }, ]; /** * @param {?=} ngZoneOption * @return {?} */ function getNgZone(ngZoneOption) { let /** @type {?} */ ngZone; if (ngZoneOption === 'noop') { ngZone = new NoopNgZone(); } else { ngZone = (ngZoneOption === 'zone.js' ? undefined : ngZoneOption) || new NgZone({ enableLongStackTrace: isDevMode() }); } return ngZone; } /** * @param {?} errorHandler * @param {?} ngZone * @param {?} callback * @return {?} */ function _callAndReportToErrorHandler(errorHandler, ngZone, callback) { try { const /** @type {?} */ result = callback(); if (isPromise(result)) { return result.catch((e) => { ngZone.runOutsideAngular(() => errorHandler.handleError(e)); // rethrow as the exception handler might not do it throw e; }); } return result; } catch (/** @type {?} */ e) { ngZone.runOutsideAngular(() => errorHandler.handleError(e)); // rethrow as the exception handler might not do it throw e; } } /** * @template T * @param {?} dst * @param {?} objs * @return {?} */ function optionsReducer(dst, objs) { if (Array.isArray(objs)) { dst = objs.reduce(optionsReducer, dst); } else { dst = Object.assign({}, dst, (/** @type {?} */ (objs))); } return dst; } /** * A reference to an Angular application running on a page. * * \@stable */ class ApplicationRef { /** * \@internal * @param {?} _zone * @param {?} _console * @param {?} _injector * @param {?} _exceptionHandler * @param {?} _componentFactoryResolver * @param {?} _initStatus */ constructor(_zone, _console, _injector, _exceptionHandler, _componentFactoryResolver, _initStatus) { this._zone = _zone; this._console = _console; this._injector = _injector; this._exceptionHandler = _exceptionHandler; this._componentFactoryResolver = _componentFactoryResolver; this._initStatus = _initStatus; this._bootstrapListeners = []; this._views = []; this._runningTick = false; this._enforceNoNewChanges = false; this._stable = true; /** * Get a list of component types registered to this application. * This list is populated even before the component is created. */ this.componentTypes = []; /** * Get a list of components registered to this application. */ this.components = []; this._enforceNoNewChanges = isDevMode(); this._zone.onMicrotaskEmpty.subscribe({ next: () => { this._zone.run(() => { this.tick(); }); } }); const /** @type {?} */ isCurrentlyStable = new __WEBPACK_IMPORTED_MODULE_0_rxjs_Observable__["a" /* Observable */]((observer) => { this._stable = this._zone.isStable && !this._zone.hasPendingMacrotasks && !this._zone.hasPendingMicrotasks; this._zone.runOutsideAngular(() => { observer.next(this._stable); observer.complete(); }); }); const /** @type {?} */ isStable = new __WEBPACK_IMPORTED_MODULE_0_rxjs_Observable__["a" /* Observable */]((observer) => { // Create the subscription to onStable outside the Angular Zone so that // the callback is run outside the Angular Zone. let /** @type {?} */ stableSub; this._zone.runOutsideAngular(() => { stableSub = this._zone.onStable.subscribe(() => { NgZone.assertNotInAngularZone(); // Check whether there are no pending macro/micro tasks in the next tick // to allow for NgZone to update the state. scheduleMicroTask(() => { if (!this._stable && !this._zone.hasPendingMacrotasks && !this._zone.hasPendingMicrotasks) { this._stable = true; observer.next(true); } }); }); }); const /** @type {?} */ unstableSub = this._zone.onUnstable.subscribe(() => { NgZone.assertInAngularZone(); if (this._stable) { this._stable = false; this._zone.runOutsideAngular(() => { observer.next(false); }); } }); return () => { stableSub.unsubscribe(); unstableSub.unsubscribe(); }; }); (/** @type {?} */ (this)).isStable = Object(__WEBPACK_IMPORTED_MODULE_1_rxjs_observable_merge__["a" /* merge */])(isCurrentlyStable, __WEBPACK_IMPORTED_MODULE_2_rxjs_operator_share__["a" /* share */].call(isStable)); } /** * Bootstrap a new component at the root level of the application. * * ### Bootstrap process * * When bootstrapping a new root component into an application, Angular mounts the * specified application component onto DOM elements identified by the [componentType]'s * selector and kicks off automatic change detection to finish initializing the component. * * Optionally, a component can be mounted onto a DOM element that does not match the * [componentType]'s selector. * * ### Example * {\@example core/ts/platform/platform.ts region='longform'} * @template C * @param {?} componentOrFactory * @param {?=} rootSelectorOrNode * @return {?} */ bootstrap(componentOrFactory, rootSelectorOrNode) { if (!this._initStatus.done) { throw new Error('Cannot bootstrap as there are still asynchronous initializers running. Bootstrap components in the `ngDoBootstrap` method of the root module.'); } let /** @type {?} */ componentFactory; if (componentOrFactory instanceof ComponentFactory) { componentFactory = componentOrFactory; } else { componentFactory = /** @type {?} */ ((this._componentFactoryResolver.resolveComponentFactory(componentOrFactory))); } this.componentTypes.push(componentFactory.componentType); // Create a factory associated with the current module if it's not bound to some other const /** @type {?} */ ngModule = componentFactory instanceof ComponentFactoryBoundToModule ? null : this._injector.get(NgModuleRef); const /** @type {?} */ selectorOrNode = rootSelectorOrNode || componentFactory.selector; const /** @type {?} */ compRef = componentFactory.create(Injector.NULL, [], selectorOrNode, ngModule); compRef.onDestroy(() => { this._unloadComponent(compRef); }); const /** @type {?} */ testability = compRef.injector.get(Testability, null); if (testability) { compRef.injector.get(TestabilityRegistry) .registerApplication(compRef.location.nativeElement, testability); } this._loadComponent(compRef); if (isDevMode()) { this._console.log(`Angular is running in the development mode. Call enableProdMode() to enable the production mode.`); } return compRef; } /** * Invoke this method to explicitly process change detection and its side-effects. * * In development mode, `tick()` also performs a second change detection cycle to ensure that no * further changes are detected. If additional changes are picked up during this second cycle, * bindings in the app have side-effects that cannot be resolved in a single change detection * pass. * In this case, Angular throws an error, since an Angular application can only have one change * detection pass during which all change detection must complete. * @return {?} */ tick() { if (this._runningTick) { throw new Error('ApplicationRef.tick is called recursively'); } const /** @type {?} */ scope = ApplicationRef._tickScope(); try { this._runningTick = true; this._views.forEach((view) => view.detectChanges()); if (this._enforceNoNewChanges) { this._views.forEach((view) => view.checkNoChanges()); } } catch (/** @type {?} */ e) { // Attention: Don't rethrow as it could cancel subscriptions to Observables! this._zone.runOutsideAngular(() => this._exceptionHandler.handleError(e)); } finally { this._runningTick = false; wtfLeave(scope); } } /** * Attaches a view so that it will be dirty checked. * The view will be automatically detached when it is destroyed. * This will throw if the view is already attached to a ViewContainer. * @param {?} viewRef * @return {?} */ attachView(viewRef) { const /** @type {?} */ view = (/** @type {?} */ (viewRef)); this._views.push(view); view.attachToAppRef(this); } /** * Detaches a view from dirty checking again. * @param {?} viewRef * @return {?} */ detachView(viewRef) { const /** @type {?} */ view = (/** @type {?} */ (viewRef)); remove(this._views, view); view.detachFromAppRef(); } /** * @param {?} componentRef * @return {?} */ _loadComponent(componentRef) { this.attachView(componentRef.hostView); this.tick(); this.components.push(componentRef); // Get the listeners lazily to prevent DI cycles. const /** @type {?} */ listeners = this._injector.get(APP_BOOTSTRAP_LISTENER, []).concat(this._bootstrapListeners); listeners.forEach((listener) => listener(componentRef)); } /** * @param {?} componentRef * @return {?} */ _unloadComponent(componentRef) { this.detachView(componentRef.hostView); remove(this.components, componentRef); } /** * \@internal * @return {?} */ ngOnDestroy() { // TODO(alxhub): Dispose of the NgZone. this._views.slice().forEach((view) => view.destroy()); } /** * Returns the number of attached views. * @return {?} */ get viewCount() { return this._views.length; } } /** * \@internal */ ApplicationRef._tickScope = wtfCreateScope('ApplicationRef#tick()'); ApplicationRef.decorators = [ { type: Injectable }, ]; /** @nocollapse */ ApplicationRef.ctorParameters = () => [ { type: NgZone, }, { type: Console, }, { type: Injector, }, { type: ErrorHandler, }, { type: ComponentFactoryResolver, }, { type: ApplicationInitStatus, }, ]; /** * @template T * @param {?} list * @param {?} el * @return {?} */ function remove(list, el) { const /** @type {?} */ index = list.indexOf(el); if (index > -1) { list.splice(index, 1); } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @deprecated Use `RendererType2` (and `Renderer2`) instead. */ class RenderComponentType { /** * @param {?} id * @param {?} templateUrl * @param {?} slotCount * @param {?} encapsulation * @param {?} styles * @param {?} animations */ constructor(id, templateUrl, slotCount, encapsulation, styles, animations) { this.id = id; this.templateUrl = templateUrl; this.slotCount = slotCount; this.encapsulation = encapsulation; this.styles = styles; this.animations = animations; } } /** * @deprecated Debug info is handeled internally in the view engine now. * @abstract */ class RenderDebugInfo { } /** * @deprecated Use the `Renderer2` instead. * @record */ /** * @deprecated Use the `Renderer2` instead. * @abstract */ class Renderer { } const Renderer2Interceptor = new InjectionToken('Renderer2Interceptor'); /** * Injectable service that provides a low-level interface for modifying the UI. * * Use this service to bypass Angular's templating and make custom UI changes that can't be * expressed declaratively. For example if you need to set a property or an attribute whose name is * not statically known, use {\@link Renderer#setElementProperty setElementProperty} or * {\@link Renderer#setElementAttribute setElementAttribute} respectively. * * If you are implementing a custom renderer, you must implement this interface. * * The default Renderer implementation is `DomRenderer`. Also available is `WebWorkerRenderer`. * * @deprecated Use `RendererFactory2` instead. * @abstract */ class RootRenderer { } /** * \@experimental * @record */ /** * \@experimental * @abstract */ class RendererFactory2 { } /** @enum {number} */ const RendererStyleFlags2 = { Important: 1, DashCase: 2, }; RendererStyleFlags2[RendererStyleFlags2.Important] = "Important"; RendererStyleFlags2[RendererStyleFlags2.DashCase] = "DashCase"; /** * \@experimental * @abstract */ class Renderer2 { } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * A wrapper around a native element inside of a View. * * An `ElementRef` is backed by a render-specific element. In the browser, this is usually a DOM * element. * * \@security Permitting direct access to the DOM can make your application more vulnerable to * XSS attacks. Carefully review any use of `ElementRef` in your code. For more detail, see the * [Security Guide](http://g.co/ng/security). * * \@stable */ class ElementRef { /** * @param {?} nativeElement */ constructor(nativeElement) { this.nativeElement = nativeElement; } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * Used to load ng module factories. * \@stable * @abstract */ class NgModuleFactoryLoader { } let moduleFactories = new Map(); /** * Registers a loaded module. Should only be called from generated NgModuleFactory code. * \@experimental * @param {?} id * @param {?} factory * @return {?} */ function registerModuleFactory(id, factory) { const /** @type {?} */ existing = moduleFactories.get(id); if (existing) { throw new Error(`Duplicate module registered for ${id} - ${existing.moduleType.name} vs ${factory.moduleType.name}`); } moduleFactories.set(id, factory); } /** * @return {?} */ /** * Returns the NgModuleFactory with the given id, if it exists and has been loaded. * Factories for modules that do not specify an `id` cannot be retrieved. Throws if the module * cannot be found. * \@experimental * @param {?} id * @return {?} */ function getModuleFactory(id) { const /** @type {?} */ factory = moduleFactories.get(id); if (!factory) throw new Error(`No module with ID ${id} loaded`); return factory; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * An unmodifiable list of items that Angular keeps up to date when the state * of the application changes. * * The type of object that {\@link ViewChildren}, {\@link ContentChildren}, and {\@link QueryList} * provide. * * Implements an iterable interface, therefore it can be used in both ES6 * javascript `for (var i of items)` loops as well as in Angular templates with * `*ngFor="let i of myList"`. * * Changes can be observed by subscribing to the changes `Observable`. * * NOTE: In the future this class will implement an `Observable` interface. * * ### Example ([live demo](http://plnkr.co/edit/RX8sJnQYl9FWuSCWme5z?p=preview)) * ```typescript * \@Component({...}) * class Container { * \@ViewChildren(Item) items:QueryList<Item>; * } * ``` * \@stable * @template T */ class QueryList { constructor() { this.dirty = true; this._results = []; this.changes = new EventEmitter(); this.length = 0; } /** * See * [Array.map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map) * @template U * @param {?} fn * @return {?} */ map(fn) { return this._results.map(fn); } /** * See * [Array.filter](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter) * @param {?} fn * @return {?} */ filter(fn) { return this._results.filter(fn); } /** * See * [Array.find](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find) * @param {?} fn * @return {?} */ find(fn) { return this._results.find(fn); } /** * See * [Array.reduce](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce) * @template U * @param {?} fn * @param {?} init * @return {?} */ reduce(fn, init) { return this._results.reduce(fn, init); } /** * See * [Array.forEach](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach) * @param {?} fn * @return {?} */ forEach(fn) { this._results.forEach(fn); } /** * See * [Array.some](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some) * @param {?} fn * @return {?} */ some(fn) { return this._results.some(fn); } /** * @return {?} */ toArray() { return this._results.slice(); } /** * @return {?} */ [getSymbolIterator()]() { return (/** @type {?} */ (this._results))[getSymbolIterator()](); } /** * @return {?} */ toString() { return this._results.toString(); } /** * @param {?} res * @return {?} */ reset(res) { this._results = flatten(res); (/** @type {?} */ (this)).dirty = false; (/** @type {?} */ (this)).length = this._results.length; (/** @type {?} */ (this)).last = this._results[this.length - 1]; (/** @type {?} */ (this)).first = this._results[0]; } /** * @return {?} */ notifyOnChanges() { (/** @type {?} */ (this.changes)).emit(this); } /** * internal * @return {?} */ setDirty() { (/** @type {?} */ (this)).dirty = true; } /** * internal * @return {?} */ destroy() { (/** @type {?} */ (this.changes)).complete(); (/** @type {?} */ (this.changes)).unsubscribe(); } } /** * @template T * @param {?} list * @return {?} */ function flatten(list) { return list.reduce((flat, item) => { const /** @type {?} */ flatItem = Array.isArray(item) ? flatten(item) : item; return (/** @type {?} */ (flat)).concat(flatItem); }, []); } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ const _SEPARATOR = '#'; const FACTORY_CLASS_SUFFIX = 'NgFactory'; /** * Configuration for SystemJsNgModuleLoader. * token. * * \@experimental * @abstract */ class SystemJsNgModuleLoaderConfig { } const DEFAULT_CONFIG = { factoryPathPrefix: '', factoryPathSuffix: '.ngfactory', }; /** * NgModuleFactoryLoader that uses SystemJS to load NgModuleFactory * \@experimental */ class SystemJsNgModuleLoader { /** * @param {?} _compiler * @param {?=} config */ constructor(_compiler, config) { this._compiler = _compiler; this._config = config || DEFAULT_CONFIG; } /** * @param {?} path * @return {?} */ load(path) { const /** @type {?} */ offlineMode = this._compiler instanceof Compiler; return offlineMode ? this.loadFactory(path) : this.loadAndCompile(path); } /** * @param {?} path * @return {?} */ loadAndCompile(path) { let [module, exportName] = path.split(_SEPARATOR); if (exportName === undefined) { exportName = 'default'; } return __webpack_require__("./src/$$_lazy_route_resource lazy recursive")(module) .then((module) => module[exportName]) .then((type) => checkNotEmpty(type, module, exportName)) .then((type) => this._compiler.compileModuleAsync(type)); } /** * @param {?} path * @return {?} */ loadFactory(path) { let [module, exportName] = path.split(_SEPARATOR); let /** @type {?} */ factoryClassSuffix = FACTORY_CLASS_SUFFIX; if (exportName === undefined) { exportName = 'default'; factoryClassSuffix = ''; } return __webpack_require__("./src/$$_lazy_route_resource lazy recursive")(this._config.factoryPathPrefix + module + this._config.factoryPathSuffix) .then((module) => module[exportName + factoryClassSuffix]) .then((factory) => checkNotEmpty(factory, module, exportName)); } } SystemJsNgModuleLoader.decorators = [ { type: Injectable }, ]; /** @nocollapse */ SystemJsNgModuleLoader.ctorParameters = () => [ { type: Compiler, }, { type: SystemJsNgModuleLoaderConfig, decorators: [{ type: Optional },] }, ]; /** * @param {?} value * @param {?} modulePath * @param {?} exportName * @return {?} */ function checkNotEmpty(value, modulePath, exportName) { if (!value) { throw new Error(`Cannot find '${exportName}' in '${modulePath}'`); } return value; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * Represents an Embedded Template that can be used to instantiate Embedded Views. * * You can access a `TemplateRef`, in two ways. Via a directive placed on a `<ng-template>` element * (or directive prefixed with `*`) and have the `TemplateRef` for this Embedded View injected into * the constructor of the directive using the `TemplateRef` Token. Alternatively you can query for * the `TemplateRef` from a Component or a Directive via {\@link Query}. * * To instantiate Embedded Views based on a Template, use {\@link ViewContainerRef# * createEmbeddedView}, which will create the View and attach it to the View Container. * \@stable * @abstract * @template C */ class TemplateRef { } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * Represents a container where one or more Views can be attached. * * The container can contain two kinds of Views. Host Views, created by instantiating a * {\@link Component} via {\@link #createComponent}, and Embedded Views, created by instantiating an * {\@link TemplateRef Embedded Template} via {\@link #createEmbeddedView}. * * The location of the View Container within the containing View is specified by the Anchor * `element`. Each View Container can have only one Anchor Element and each Anchor Element can only * have a single View Container. * * Root elements of Views attached to this container become siblings of the Anchor Element in * the Rendered View. * * To access a `ViewContainerRef` of an Element, you can either place a {\@link Directive} injected * with `ViewContainerRef` on the Element, or you obtain it via a {\@link ViewChild} query. * \@stable * @abstract */ class ViewContainerRef { } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * \@stable * @abstract */ class ChangeDetectorRef { } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * \@stable * @abstract */ class ViewRef extends ChangeDetectorRef { } /** * Represents an Angular View. * * <!-- TODO: move the next two paragraphs to the dev guide --> * A View is a fundamental building block of the application UI. It is the smallest grouping of * Elements which are created and destroyed together. * * Properties of elements in a View can change, but the structure (number and order) of elements in * a View cannot. Changing the structure of Elements can only be done by inserting, moving or * removing nested Views via a {\@link ViewContainerRef}. Each View can contain many View Containers. * <!-- /TODO --> * * ### Example * * Given this template... * * ``` * Count: {{items.length}} * <ul> * <li *ngFor="let item of items">{{item}}</li> * </ul> * ``` * * We have two {\@link TemplateRef}s: * * Outer {\@link TemplateRef}: * ``` * Count: {{items.length}} * <ul> * <ng-template ngFor let-item [ngForOf]="items"></ng-template> * </ul> * ``` * * Inner {\@link TemplateRef}: * ``` * <li>{{item}}</li> * ``` * * Notice that the original template is broken down into two separate {\@link TemplateRef}s. * * The outer/inner {\@link TemplateRef}s are then assembled into views like so: * * ``` * <!-- ViewRef: outer-0 --> * Count: 2 * <ul> * <ng-template view-container-ref></ng-template> * <!-- ViewRef: inner-1 --><li>first</li><!-- /ViewRef: inner-1 --> * <!-- ViewRef: inner-2 --><li>second</li><!-- /ViewRef: inner-2 --> * </ul> * <!-- /ViewRef: outer-0 --> * ``` * \@experimental * @abstract * @template C */ class EmbeddedViewRef extends ViewRef { } /** * @record */ /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ class EventListener { /** * @param {?} name * @param {?} callback */ constructor(name, callback) { this.name = name; this.callback = callback; } } /** * \@experimental All debugging apis are currently experimental. */ class DebugNode { /** * @param {?} nativeNode * @param {?} parent * @param {?} _debugContext */ constructor(nativeNode, parent, _debugContext) { this._debugContext = _debugContext; this.nativeNode = nativeNode; if (parent && parent instanceof DebugElement) { parent.addChild(this); } else { this.parent = null; } this.listeners = []; } /** * @return {?} */ get injector() { return this._debugContext.injector; } /** * @return {?} */ get componentInstance() { return this._debugContext.component; } /** * @return {?} */ get context() { return this._debugContext.context; } /** * @return {?} */ get references() { return this._debugContext.references; } /** * @return {?} */ get providerTokens() { return this._debugContext.providerTokens; } } /** * \@experimental All debugging apis are currently experimental. */ class DebugElement extends DebugNode { /** * @param {?} nativeNode * @param {?} parent * @param {?} _debugContext */ constructor(nativeNode, parent, _debugContext) { super(nativeNode, parent, _debugContext); this.properties = {}; this.attributes = {}; this.classes = {}; this.styles = {}; this.childNodes = []; this.nativeElement = nativeNode; } /** * @param {?} child * @return {?} */ addChild(child) { if (child) { this.childNodes.push(child); child.parent = this; } } /** * @param {?} child * @return {?} */ removeChild(child) { const /** @type {?} */ childIndex = this.childNodes.indexOf(child); if (childIndex !== -1) { child.parent = null; this.childNodes.splice(childIndex, 1); } } /** * @param {?} child * @param {?} newChildren * @return {?} */ insertChildrenAfter(child, newChildren) { const /** @type {?} */ siblingIndex = this.childNodes.indexOf(child); if (siblingIndex !== -1) { this.childNodes.splice(siblingIndex + 1, 0, ...newChildren); newChildren.forEach(c => { if (c.parent) { c.parent.removeChild(c); } c.parent = this; }); } } /** * @param {?} refChild * @param {?} newChild * @return {?} */ insertBefore(refChild, newChild) { const /** @type {?} */ refIndex = this.childNodes.indexOf(refChild); if (refIndex === -1) { this.addChild(newChild); } else { if (newChild.parent) { newChild.parent.removeChild(newChild); } newChild.parent = this; this.childNodes.splice(refIndex, 0, newChild); } } /** * @param {?} predicate * @return {?} */ query(predicate) { const /** @type {?} */ results = this.queryAll(predicate); return results[0] || null; } /** * @param {?} predicate * @return {?} */ queryAll(predicate) { const /** @type {?} */ matches = []; _queryElementChildren(this, predicate, matches); return matches; } /** * @param {?} predicate * @return {?} */ queryAllNodes(predicate) { const /** @type {?} */ matches = []; _queryNodeChildren(this, predicate, matches); return matches; } /** * @return {?} */ get children() { return /** @type {?} */ (this.childNodes.filter((node) => node instanceof DebugElement)); } /** * @param {?} eventName * @param {?} eventObj * @return {?} */ triggerEventHandler(eventName, eventObj) { this.listeners.forEach((listener) => { if (listener.name == eventName) { listener.callback(eventObj); } }); } } /** * \@experimental * @param {?} debugEls * @return {?} */ function asNativeElements(debugEls) { return debugEls.map((el) => el.nativeElement); } /** * @param {?} element * @param {?} predicate * @param {?} matches * @return {?} */ function _queryElementChildren(element, predicate, matches) { element.childNodes.forEach(node => { if (node instanceof DebugElement) { if (predicate(node)) { matches.push(node); } _queryElementChildren(node, predicate, matches); } }); } /** * @param {?} parentNode * @param {?} predicate * @param {?} matches * @return {?} */ function _queryNodeChildren(parentNode, predicate, matches) { if (parentNode instanceof DebugElement) { parentNode.childNodes.forEach(node => { if (predicate(node)) { matches.push(node); } if (node instanceof DebugElement) { _queryNodeChildren(node, predicate, matches); } }); } } // Need to keep the nodes in a global Map so that multiple angular apps are supported. const _nativeNodeToDebugNode = new Map(); /** * \@experimental * @param {?} nativeNode * @return {?} */ function getDebugNode(nativeNode) { return _nativeNodeToDebugNode.get(nativeNode) || null; } /** * @return {?} */ /** * @param {?} node * @return {?} */ function indexDebugNode(node) { _nativeNodeToDebugNode.set(node.nativeNode, node); } /** * @param {?} node * @return {?} */ function removeDebugNodeFromIndex(node) { _nativeNodeToDebugNode.delete(node.nativeNode); } /** * A boolean-valued function over a value, possibly including context information * regarding that value's position in an array. * * \@experimental All debugging apis are currently experimental. * @record * @template T */ /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @param {?} a * @param {?} b * @return {?} */ function devModeEqual(a, b) { const /** @type {?} */ isListLikeIterableA = isListLikeIterable(a); const /** @type {?} */ isListLikeIterableB = isListLikeIterable(b); if (isListLikeIterableA && isListLikeIterableB) { return areIterablesEqual(a, b, devModeEqual); } else { const /** @type {?} */ isAObject = a && (typeof a === 'object' || typeof a === 'function'); const /** @type {?} */ isBObject = b && (typeof b === 'object' || typeof b === 'function'); if (!isListLikeIterableA && isAObject && !isListLikeIterableB && isBObject) { return true; } else { return looseIdentical(a, b); } } } /** * Indicates that the result of a {\@link Pipe} transformation has changed even though the * reference has not changed. * * Wrapped values are unwrapped automatically during the change detection, and the unwrapped value * is stored. * * Example: * * ``` * if (this._latestValue === this._latestReturnedValue) { * return this._latestReturnedValue; * } else { * this._latestReturnedValue = this._latestValue; * return WrappedValue.wrap(this._latestValue); // this will force update * } * ``` * \@stable */ class WrappedValue { /** * @param {?} value */ constructor(value) { this.wrapped = value; } /** * Creates a wrapped value. * @param {?} value * @return {?} */ static wrap(value) { return new WrappedValue(value); } /** * Returns the underlying value of a wrapped value. * Returns the given `value` when it is not wrapped. * * @param {?} value * @return {?} */ static unwrap(value) { return WrappedValue.isWrapped(value) ? value.wrapped : value; } /** * Returns true if `value` is a wrapped value. * @param {?} value * @return {?} */ static isWrapped(value) { return value instanceof WrappedValue; } } /** * Represents a basic change from a previous to a new value. * \@stable */ class SimpleChange { /** * @param {?} previousValue * @param {?} currentValue * @param {?} firstChange */ constructor(previousValue, currentValue, firstChange) { this.previousValue = previousValue; this.currentValue = currentValue; this.firstChange = firstChange; } /** * Check whether the new value is the first value assigned. * @return {?} */ isFirstChange() { return this.firstChange; } } /** * @param {?} obj * @return {?} */ function isListLikeIterable(obj) { if (!isJsObject(obj)) return false; return Array.isArray(obj) || (!(obj instanceof Map) && // JS Map are iterables but return entries as [k, v] // JS Map are iterables but return entries as [k, v] getSymbolIterator() in obj); // JS Iterable have a Symbol.iterator prop } /** * @param {?} a * @param {?} b * @param {?} comparator * @return {?} */ function areIterablesEqual(a, b, comparator) { const /** @type {?} */ iterator1 = a[getSymbolIterator()](); const /** @type {?} */ iterator2 = b[getSymbolIterator()](); while (true) { const /** @type {?} */ item1 = iterator1.next(); const /** @type {?} */ item2 = iterator2.next(); if (item1.done && item2.done) return true; if (item1.done || item2.done) return false; if (!comparator(item1.value, item2.value)) return false; } } /** * @param {?} obj * @param {?} fn * @return {?} */ function iterateListLike(obj, fn) { if (Array.isArray(obj)) { for (let /** @type {?} */ i = 0; i < obj.length; i++) { fn(obj[i]); } } else { const /** @type {?} */ iterator = obj[getSymbolIterator()](); let /** @type {?} */ item; while (!((item = iterator.next()).done)) { fn(item.value); } } } /** * @param {?} o * @return {?} */ function isJsObject(o) { return o !== null && (typeof o === 'function' || typeof o === 'object'); } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ class DefaultIterableDifferFactory { constructor() { } /** * @param {?} obj * @return {?} */ supports(obj) { return isListLikeIterable(obj); } /** * @template V * @param {?=} trackByFn * @return {?} */ create(trackByFn) { return new DefaultIterableDiffer(trackByFn); } } const trackByIdentity = (index, item) => item; /** * @deprecated v4.0.0 - Should not be part of public API. * @template V */ class DefaultIterableDiffer { /** * @param {?=} trackByFn */ constructor(trackByFn) { this.length = 0; this._linkedRecords = null; this._unlinkedRecords = null; this._previousItHead = null; this._itHead = null; this._itTail = null; this._additionsHead = null; this._additionsTail = null; this._movesHead = null; this._movesTail = null; this._removalsHead = null; this._removalsTail = null; this._identityChangesHead = null; this._identityChangesTail = null; this._trackByFn = trackByFn || trackByIdentity; } /** * @param {?} fn * @return {?} */ forEachItem(fn) { let /** @type {?} */ record; for (record = this._itHead; record !== null; record = record._next) { fn(record); } } /** * @param {?} fn * @return {?} */ forEachOperation(fn) { let /** @type {?} */ nextIt = this._itHead; let /** @type {?} */ nextRemove = this._removalsHead; let /** @type {?} */ addRemoveOffset = 0; let /** @type {?} */ moveOffsets = null; while (nextIt || nextRemove) { // Figure out which is the next record to process // Order: remove, add, move const /** @type {?} */ record = !nextRemove || nextIt && /** @type {?} */ ((nextIt.currentIndex)) < getPreviousIndex(nextRemove, addRemoveOffset, moveOffsets) ? /** @type {?} */ ((nextIt)) : nextRemove; const /** @type {?} */ adjPreviousIndex = getPreviousIndex(record, addRemoveOffset, moveOffsets); const /** @type {?} */ currentIndex = record.currentIndex; // consume the item, and adjust the addRemoveOffset and update moveDistance if necessary if (record === nextRemove) { addRemoveOffset--; nextRemove = nextRemove._nextRemoved; } else { nextIt = /** @type {?} */ ((nextIt))._next; if (record.previousIndex == null) { addRemoveOffset++; } else { // INVARIANT: currentIndex < previousIndex if (!moveOffsets) moveOffsets = []; const /** @type {?} */ localMovePreviousIndex = adjPreviousIndex - addRemoveOffset; const /** @type {?} */ localCurrentIndex = /** @type {?} */ ((currentIndex)) - addRemoveOffset; if (localMovePreviousIndex != localCurrentIndex) { for (let /** @type {?} */ i = 0; i < localMovePreviousIndex; i++) { const /** @type {?} */ offset = i < moveOffsets.length ? moveOffsets[i] : (moveOffsets[i] = 0); const /** @type {?} */ index = offset + i; if (localCurrentIndex <= index && index < localMovePreviousIndex) { moveOffsets[i] = offset + 1; } } const /** @type {?} */ previousIndex = record.previousIndex; moveOffsets[previousIndex] = localCurrentIndex - localMovePreviousIndex; } } } if (adjPreviousIndex !== currentIndex) { fn(record, adjPreviousIndex, currentIndex); } } } /** * @param {?} fn * @return {?} */ forEachPreviousItem(fn) { let /** @type {?} */ record; for (record = this._previousItHead; record !== null; record = record._nextPrevious) { fn(record); } } /** * @param {?} fn * @return {?} */ forEachAddedItem(fn) { let /** @type {?} */ record; for (record = this._additionsHead; record !== null; record = record._nextAdded) { fn(record); } } /** * @param {?} fn * @return {?} */ forEachMovedItem(fn) { let /** @type {?} */ record; for (record = this._movesHead; record !== null; record = record._nextMoved) { fn(record); } } /** * @param {?} fn * @return {?} */ forEachRemovedItem(fn) { let /** @type {?} */ record; for (record = this._removalsHead; record !== null; record = record._nextRemoved) { fn(record); } } /** * @param {?} fn * @return {?} */ forEachIdentityChange(fn) { let /** @type {?} */ record; for (record = this._identityChangesHead; record !== null; record = record._nextIdentityChange) { fn(record); } } /** * @param {?} collection * @return {?} */ diff(collection) { if (collection == null) collection = []; if (!isListLikeIterable(collection)) { throw new Error(`Error trying to diff '${stringify(collection)}'. Only arrays and iterables are allowed`); } if (this.check(collection)) { return this; } else { return null; } } /** * @return {?} */ onDestroy() { } /** * @param {?} collection * @return {?} */ check(collection) { this._reset(); let /** @type {?} */ record = this._itHead; let /** @type {?} */ mayBeDirty = false; let /** @type {?} */ index; let /** @type {?} */ item; let /** @type {?} */ itemTrackBy; if (Array.isArray(collection)) { (/** @type {?} */ (this)).length = collection.length; for (let /** @type {?} */ index = 0; index < this.length; index++) { item = collection[index]; itemTrackBy = this._trackByFn(index, item); if (record === null || !looseIdentical(record.trackById, itemTrackBy)) { record = this._mismatch(record, item, itemTrackBy, index); mayBeDirty = true; } else { if (mayBeDirty) { // TODO(misko): can we limit this to duplicates only? record = this._verifyReinsertion(record, item, itemTrackBy, index); } if (!looseIdentical(record.item, item)) this._addIdentityChange(record, item); } record = record._next; } } else { index = 0; iterateListLike(collection, (item) => { itemTrackBy = this._trackByFn(index, item); if (record === null || !looseIdentical(record.trackById, itemTrackBy)) { record = this._mismatch(record, item, itemTrackBy, index); mayBeDirty = true; } else { if (mayBeDirty) { // TODO(misko): can we limit this to duplicates only? record = this._verifyReinsertion(record, item, itemTrackBy, index); } if (!looseIdentical(record.item, item)) this._addIdentityChange(record, item); } record = record._next; index++; }); (/** @type {?} */ (this)).length = index; } this._truncate(record); (/** @type {?} */ (this)).collection = collection; return this.isDirty; } /** * @return {?} */ get isDirty() { return this._additionsHead !== null || this._movesHead !== null || this._removalsHead !== null || this._identityChangesHead !== null; } /** * Reset the state of the change objects to show no changes. This means set previousKey to * currentKey, and clear all of the queues (additions, moves, removals). * Set the previousIndexes of moved and added items to their currentIndexes * Reset the list of additions, moves and removals * * \@internal * @return {?} */ _reset() { if (this.isDirty) { let /** @type {?} */ record; let /** @type {?} */ nextRecord; for (record = this._previousItHead = this._itHead; record !== null; record = record._next) { record._nextPrevious = record._next; } for (record = this._additionsHead; record !== null; record = record._nextAdded) { record.previousIndex = record.currentIndex; } this._additionsHead = this._additionsTail = null; for (record = this._movesHead; record !== null; record = nextRecord) { record.previousIndex = record.currentIndex; nextRecord = record._nextMoved; } this._movesHead = this._movesTail = null; this._removalsHead = this._removalsTail = null; this._identityChangesHead = this._identityChangesTail = null; // TODO(vicb): when assert gets supported // assert(!this.isDirty); } } /** * This is the core function which handles differences between collections. * * - `record` is the record which we saw at this position last time. If null then it is a new * item. * - `item` is the current item in the collection * - `index` is the position of the item in the collection * * \@internal * @param {?} record * @param {?} item * @param {?} itemTrackBy * @param {?} index * @return {?} */ _mismatch(record, item, itemTrackBy, index) { // The previous record after which we will append the current one. let /** @type {?} */ previousRecord; if (record === null) { previousRecord = this._itTail; } else { previousRecord = record._prev; // Remove the record from the collection since we know it does not match the item. this._remove(record); } // Attempt to see if we have seen the item before. record = this._linkedRecords === null ? null : this._linkedRecords.get(itemTrackBy, index); if (record !== null) { // We have seen this before, we need to move it forward in the collection. // But first we need to check if identity changed, so we can update in view if necessary if (!looseIdentical(record.item, item)) this._addIdentityChange(record, item); this._moveAfter(record, previousRecord, index); } else { // Never seen it, check evicted list. record = this._unlinkedRecords === null ? null : this._unlinkedRecords.get(itemTrackBy, null); if (record !== null) { // It is an item which we have evicted earlier: reinsert it back into the list. // But first we need to check if identity changed, so we can update in view if necessary if (!looseIdentical(record.item, item)) this._addIdentityChange(record, item); this._reinsertAfter(record, previousRecord, index); } else { // It is a new item: add it. record = this._addAfter(new IterableChangeRecord_(item, itemTrackBy), previousRecord, index); } } return record; } /** * This check is only needed if an array contains duplicates. (Short circuit of nothing dirty) * * Use case: `[a, a]` => `[b, a, a]` * * If we did not have this check then the insertion of `b` would: * 1) evict first `a` * 2) insert `b` at `0` index. * 3) leave `a` at index `1` as is. <-- this is wrong! * 3) reinsert `a` at index 2. <-- this is wrong! * * The correct behavior is: * 1) evict first `a` * 2) insert `b` at `0` index. * 3) reinsert `a` at index 1. * 3) move `a` at from `1` to `2`. * * * Double check that we have not evicted a duplicate item. We need to check if the item type may * have already been removed: * The insertion of b will evict the first 'a'. If we don't reinsert it now it will be reinserted * at the end. Which will show up as the two 'a's switching position. This is incorrect, since a * better way to think of it is as insert of 'b' rather then switch 'a' with 'b' and then add 'a' * at the end. * * \@internal * @param {?} record * @param {?} item * @param {?} itemTrackBy * @param {?} index * @return {?} */ _verifyReinsertion(record, item, itemTrackBy, index) { let /** @type {?} */ reinsertRecord = this._unlinkedRecords === null ? null : this._unlinkedRecords.get(itemTrackBy, null); if (reinsertRecord !== null) { record = this._reinsertAfter(reinsertRecord, /** @type {?} */ ((record._prev)), index); } else if (record.currentIndex != index) { record.currentIndex = index; this._addToMoves(record, index); } return record; } /** * Get rid of any excess {\@link IterableChangeRecord_}s from the previous collection * * - `record` The first excess {\@link IterableChangeRecord_}. * * \@internal * @param {?} record * @return {?} */ _truncate(record) { // Anything after that needs to be removed; while (record !== null) { const /** @type {?} */ nextRecord = record._next; this._addToRemovals(this._unlink(record)); record = nextRecord; } if (this._unlinkedRecords !== null) { this._unlinkedRecords.clear(); } if (this._additionsTail !== null) { this._additionsTail._nextAdded = null; } if (this._movesTail !== null) { this._movesTail._nextMoved = null; } if (this._itTail !== null) { this._itTail._next = null; } if (this._removalsTail !== null) { this._removalsTail._nextRemoved = null; } if (this._identityChangesTail !== null) { this._identityChangesTail._nextIdentityChange = null; } } /** * \@internal * @param {?} record * @param {?} prevRecord * @param {?} index * @return {?} */ _reinsertAfter(record, prevRecord, index) { if (this._unlinkedRecords !== null) { this._unlinkedRecords.remove(record); } const /** @type {?} */ prev = record._prevRemoved; const /** @type {?} */ next = record._nextRemoved; if (prev === null) { this._removalsHead = next; } else { prev._nextRemoved = next; } if (next === null) { this._removalsTail = prev; } else { next._prevRemoved = prev; } this._insertAfter(record, prevRecord, index); this._addToMoves(record, index); return record; } /** * \@internal * @param {?} record * @param {?} prevRecord * @param {?} index * @return {?} */ _moveAfter(record, prevRecord, index) { this._unlink(record); this._insertAfter(record, prevRecord, index); this._addToMoves(record, index); return record; } /** * \@internal * @param {?} record * @param {?} prevRecord * @param {?} index * @return {?} */ _addAfter(record, prevRecord, index) { this._insertAfter(record, prevRecord, index); if (this._additionsTail === null) { // TODO(vicb): // assert(this._additionsHead === null); this._additionsTail = this._additionsHead = record; } else { // TODO(vicb): // assert(_additionsTail._nextAdded === null); // assert(record._nextAdded === null); this._additionsTail = this._additionsTail._nextAdded = record; } return record; } /** * \@internal * @param {?} record * @param {?} prevRecord * @param {?} index * @return {?} */ _insertAfter(record, prevRecord, index) { // TODO(vicb): // assert(record != prevRecord); // assert(record._next === null); // assert(record._prev === null); const /** @type {?} */ next = prevRecord === null ? this._itHead : prevRecord._next; // TODO(vicb): // assert(next != record); // assert(prevRecord != record); record._next = next; record._prev = prevRecord; if (next === null) { this._itTail = record; } else { next._prev = record; } if (prevRecord === null) { this._itHead = record; } else { prevRecord._next = record; } if (this._linkedRecords === null) { this._linkedRecords = new _DuplicateMap(); } this._linkedRecords.put(record); record.currentIndex = index; return record; } /** * \@internal * @param {?} record * @return {?} */ _remove(record) { return this._addToRemovals(this._unlink(record)); } /** * \@internal * @param {?} record * @return {?} */ _unlink(record) { if (this._linkedRecords !== null) { this._linkedRecords.remove(record); } const /** @type {?} */ prev = record._prev; const /** @type {?} */ next = record._next; // TODO(vicb): // assert((record._prev = null) === null); // assert((record._next = null) === null); if (prev === null) { this._itHead = next; } else { prev._next = next; } if (next === null) { this._itTail = prev; } else { next._prev = prev; } return record; } /** * \@internal * @param {?} record * @param {?} toIndex * @return {?} */ _addToMoves(record, toIndex) { // TODO(vicb): // assert(record._nextMoved === null); if (record.previousIndex === toIndex) { return record; } if (this._movesTail === null) { // TODO(vicb): // assert(_movesHead === null); this._movesTail = this._movesHead = record; } else { // TODO(vicb): // assert(_movesTail._nextMoved === null); this._movesTail = this._movesTail._nextMoved = record; } return record; } /** * @param {?} record * @return {?} */ _addToRemovals(record) { if (this._unlinkedRecords === null) { this._unlinkedRecords = new _DuplicateMap(); } this._unlinkedRecords.put(record); record.currentIndex = null; record._nextRemoved = null; if (this._removalsTail === null) { // TODO(vicb): // assert(_removalsHead === null); this._removalsTail = this._removalsHead = record; record._prevRemoved = null; } else { // TODO(vicb): // assert(_removalsTail._nextRemoved === null); // assert(record._nextRemoved === null); record._prevRemoved = this._removalsTail; this._removalsTail = this._removalsTail._nextRemoved = record; } return record; } /** * \@internal * @param {?} record * @param {?} item * @return {?} */ _addIdentityChange(record, item) { record.item = item; if (this._identityChangesTail === null) { this._identityChangesTail = this._identityChangesHead = record; } else { this._identityChangesTail = this._identityChangesTail._nextIdentityChange = record; } return record; } } /** * \@stable * @template V */ class IterableChangeRecord_ { /** * @param {?} item * @param {?} trackById */ constructor(item, trackById) { this.item = item; this.trackById = trackById; this.currentIndex = null; this.previousIndex = null; /** * \@internal */ this._nextPrevious = null; /** * \@internal */ this._prev = null; /** * \@internal */ this._next = null; /** * \@internal */ this._prevDup = null; /** * \@internal */ this._nextDup = null; /** * \@internal */ this._prevRemoved = null; /** * \@internal */ this._nextRemoved = null; /** * \@internal */ this._nextAdded = null; /** * \@internal */ this._nextMoved = null; /** * \@internal */ this._nextIdentityChange = null; } } /** * @template V */ class _DuplicateItemRecordList { constructor() { /** * \@internal */ this._head = null; /** * \@internal */ this._tail = null; } /** * Append the record to the list of duplicates. * * Note: by design all records in the list of duplicates hold the same value in record.item. * @param {?} record * @return {?} */ add(record) { if (this._head === null) { this._head = this._tail = record; record._nextDup = null; record._prevDup = null; } else { /** @type {?} */ (( // TODO(vicb): // assert(record.item == _head.item || // record.item is num && record.item.isNaN && _head.item is num && _head.item.isNaN); this._tail))._nextDup = record; record._prevDup = this._tail; record._nextDup = null; this._tail = record; } } /** * @param {?} trackById * @param {?} atOrAfterIndex * @return {?} */ get(trackById, atOrAfterIndex) { let /** @type {?} */ record; for (record = this._head; record !== null; record = record._nextDup) { if ((atOrAfterIndex === null || atOrAfterIndex <= /** @type {?} */ ((record.currentIndex))) && looseIdentical(record.trackById, trackById)) { return record; } } return null; } /** * Remove one {\@link IterableChangeRecord_} from the list of duplicates. * * Returns whether the list of duplicates is empty. * @param {?} record * @return {?} */ remove(record) { // TODO(vicb): // assert(() { // // verify that the record being removed is in the list. // for (IterableChangeRecord_ cursor = _head; cursor != null; cursor = cursor._nextDup) { // if (identical(cursor, record)) return true; // } // return false; //}); const /** @type {?} */ prev = record._prevDup; const /** @type {?} */ next = record._nextDup; if (prev === null) { this._head = next; } else { prev._nextDup = next; } if (next === null) { this._tail = prev; } else { next._prevDup = prev; } return this._head === null; } } /** * @template V */ class _DuplicateMap { constructor() { this.map = new Map(); } /** * @param {?} record * @return {?} */ put(record) { const /** @type {?} */ key = record.trackById; let /** @type {?} */ duplicates = this.map.get(key); if (!duplicates) { duplicates = new _DuplicateItemRecordList(); this.map.set(key, duplicates); } duplicates.add(record); } /** * Retrieve the `value` using key. Because the IterableChangeRecord_ value may be one which we * have already iterated over, we use the `atOrAfterIndex` to pretend it is not there. * * Use case: `[a, b, c, a, a]` if we are at index `3` which is the second `a` then asking if we * have any more `a`s needs to return the second `a`. * @param {?} trackById * @param {?} atOrAfterIndex * @return {?} */ get(trackById, atOrAfterIndex) { const /** @type {?} */ key = trackById; const /** @type {?} */ recordList = this.map.get(key); return recordList ? recordList.get(trackById, atOrAfterIndex) : null; } /** * Removes a {\@link IterableChangeRecord_} from the list of duplicates. * * The list of duplicates also is removed from the map if it gets empty. * @param {?} record * @return {?} */ remove(record) { const /** @type {?} */ key = record.trackById; const /** @type {?} */ recordList = /** @type {?} */ ((this.map.get(key))); // Remove the list of duplicates when it gets empty if (recordList.remove(record)) { this.map.delete(key); } return record; } /** * @return {?} */ get isEmpty() { return this.map.size === 0; } /** * @return {?} */ clear() { this.map.clear(); } } /** * @param {?} item * @param {?} addRemoveOffset * @param {?} moveOffsets * @return {?} */ function getPreviousIndex(item, addRemoveOffset, moveOffsets) { const /** @type {?} */ previousIndex = item.previousIndex; if (previousIndex === null) return previousIndex; let /** @type {?} */ moveOffset = 0; if (moveOffsets && previousIndex < moveOffsets.length) { moveOffset = moveOffsets[previousIndex]; } return previousIndex + addRemoveOffset + moveOffset; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @template K, V */ class DefaultKeyValueDifferFactory { constructor() { } /** * @param {?} obj * @return {?} */ supports(obj) { return obj instanceof Map || isJsObject(obj); } /** * @template K, V * @return {?} */ create() { return new DefaultKeyValueDiffer(); } } /** * @template K, V */ class DefaultKeyValueDiffer { constructor() { this._records = new Map(); this._mapHead = null; this._appendAfter = null; this._previousMapHead = null; this._changesHead = null; this._changesTail = null; this._additionsHead = null; this._additionsTail = null; this._removalsHead = null; this._removalsTail = null; } /** * @return {?} */ get isDirty() { return this._additionsHead !== null || this._changesHead !== null || this._removalsHead !== null; } /** * @param {?} fn * @return {?} */ forEachItem(fn) { let /** @type {?} */ record; for (record = this._mapHead; record !== null; record = record._next) { fn(record); } } /** * @param {?} fn * @return {?} */ forEachPreviousItem(fn) { let /** @type {?} */ record; for (record = this._previousMapHead; record !== null; record = record._nextPrevious) { fn(record); } } /** * @param {?} fn * @return {?} */ forEachChangedItem(fn) { let /** @type {?} */ record; for (record = this._changesHead; record !== null; record = record._nextChanged) { fn(record); } } /** * @param {?} fn * @return {?} */ forEachAddedItem(fn) { let /** @type {?} */ record; for (record = this._additionsHead; record !== null; record = record._nextAdded) { fn(record); } } /** * @param {?} fn * @return {?} */ forEachRemovedItem(fn) { let /** @type {?} */ record; for (record = this._removalsHead; record !== null; record = record._nextRemoved) { fn(record); } } /** * @param {?=} map * @return {?} */ diff(map) { if (!map) { map = new Map(); } else if (!(map instanceof Map || isJsObject(map))) { throw new Error(`Error trying to diff '${stringify(map)}'. Only maps and objects are allowed`); } return this.check(map) ? this : null; } /** * @return {?} */ onDestroy() { } /** * Check the current state of the map vs the previous. * The algorithm is optimised for when the keys do no change. * @param {?} map * @return {?} */ check(map) { this._reset(); let /** @type {?} */ insertBefore = this._mapHead; this._appendAfter = null; this._forEach(map, (value, key) => { if (insertBefore && insertBefore.key === key) { this._maybeAddToChanges(insertBefore, value); this._appendAfter = insertBefore; insertBefore = insertBefore._next; } else { const /** @type {?} */ record = this._getOrCreateRecordForKey(key, value); insertBefore = this._insertBeforeOrAppend(insertBefore, record); } }); // Items remaining at the end of the list have been deleted if (insertBefore) { if (insertBefore._prev) { insertBefore._prev._next = null; } this._removalsHead = insertBefore; for (let /** @type {?} */ record = insertBefore; record !== null; record = record._nextRemoved) { if (record === this._mapHead) { this._mapHead = null; } this._records.delete(record.key); record._nextRemoved = record._next; record.previousValue = record.currentValue; record.currentValue = null; record._prev = null; record._next = null; } } // Make sure tails have no next records from previous runs if (this._changesTail) this._changesTail._nextChanged = null; if (this._additionsTail) this._additionsTail._nextAdded = null; return this.isDirty; } /** * Inserts a record before `before` or append at the end of the list when `before` is null. * * Notes: * - This method appends at `this._appendAfter`, * - This method updates `this._appendAfter`, * - The return value is the new value for the insertion pointer. * @param {?} before * @param {?} record * @return {?} */ _insertBeforeOrAppend(before, record) { if (before) { const /** @type {?} */ prev = before._prev; record._next = before; record._prev = prev; before._prev = record; if (prev) { prev._next = record; } if (before === this._mapHead) { this._mapHead = record; } this._appendAfter = before; return before; } if (this._appendAfter) { this._appendAfter._next = record; record._prev = this._appendAfter; } else { this._mapHead = record; } this._appendAfter = record; return null; } /** * @param {?} key * @param {?} value * @return {?} */ _getOrCreateRecordForKey(key, value) { if (this._records.has(key)) { const /** @type {?} */ record = /** @type {?} */ ((this._records.get(key))); this._maybeAddToChanges(record, value); const /** @type {?} */ prev = record._prev; const /** @type {?} */ next = record._next; if (prev) { prev._next = next; } if (next) { next._prev = prev; } record._next = null; record._prev = null; return record; } const /** @type {?} */ record = new KeyValueChangeRecord_(key); this._records.set(key, record); record.currentValue = value; this._addToAdditions(record); return record; } /** * \@internal * @return {?} */ _reset() { if (this.isDirty) { let /** @type {?} */ record; // let `_previousMapHead` contain the state of the map before the changes this._previousMapHead = this._mapHead; for (record = this._previousMapHead; record !== null; record = record._next) { record._nextPrevious = record._next; } // Update `record.previousValue` with the value of the item before the changes // We need to update all changed items (that's those which have been added and changed) for (record = this._changesHead; record !== null; record = record._nextChanged) { record.previousValue = record.currentValue; } for (record = this._additionsHead; record != null; record = record._nextAdded) { record.previousValue = record.currentValue; } this._changesHead = this._changesTail = null; this._additionsHead = this._additionsTail = null; this._removalsHead = null; } } /** * @param {?} record * @param {?} newValue * @return {?} */ _maybeAddToChanges(record, newValue) { if (!looseIdentical(newValue, record.currentValue)) { record.previousValue = record.currentValue; record.currentValue = newValue; this._addToChanges(record); } } /** * @param {?} record * @return {?} */ _addToAdditions(record) { if (this._additionsHead === null) { this._additionsHead = this._additionsTail = record; } else { /** @type {?} */ ((this._additionsTail))._nextAdded = record; this._additionsTail = record; } } /** * @param {?} record * @return {?} */ _addToChanges(record) { if (this._changesHead === null) { this._changesHead = this._changesTail = record; } else { /** @type {?} */ ((this._changesTail))._nextChanged = record; this._changesTail = record; } } /** * \@internal * @template K, V * @param {?} obj * @param {?} fn * @return {?} */ _forEach(obj, fn) { if (obj instanceof Map) { obj.forEach(fn); } else { Object.keys(obj).forEach(k => fn(obj[k], k)); } } } /** * \@stable * @template K, V */ class KeyValueChangeRecord_ { /** * @param {?} key */ constructor(key) { this.key = key; this.previousValue = null; this.currentValue = null; /** * \@internal */ this._nextPrevious = null; /** * \@internal */ this._next = null; /** * \@internal */ this._prev = null; /** * \@internal */ this._nextAdded = null; /** * \@internal */ this._nextRemoved = null; /** * \@internal */ this._nextChanged = null; } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * A strategy for tracking changes over time to an iterable. Used by {\@link NgForOf} to * respond to changes in an iterable by effecting equivalent changes in the DOM. * * \@stable * @record * @template V */ /** * An object describing the changes in the `Iterable` collection since last time * `IterableDiffer#diff()` was invoked. * * \@stable * @record * @template V */ /** * Record representing the item change information. * * \@stable * @record * @template V */ /** * @deprecated v4.0.0 - Use IterableChangeRecord instead. * @record * @template V */ /** * An optional function passed into {\@link NgForOf} that defines how to track * items in an iterable (e.g. fby index or id) * * \@stable * @record * @template T */ /** * Provides a factory for {\@link IterableDiffer}. * * \@stable * @record */ /** * A repository of different iterable diffing strategies used by NgFor, NgClass, and others. * \@stable */ class IterableDiffers { /** * @param {?} factories */ constructor(factories) { this.factories = factories; } /** * @param {?} factories * @param {?=} parent * @return {?} */ static create(factories, parent) { if (parent != null) { const /** @type {?} */ copied = parent.factories.slice(); factories = factories.concat(copied); return new IterableDiffers(factories); } else { return new IterableDiffers(factories); } } /** * Takes an array of {\@link IterableDifferFactory} and returns a provider used to extend the * inherited {\@link IterableDiffers} instance with the provided factories and return a new * {\@link IterableDiffers} instance. * * The following example shows how to extend an existing list of factories, * which will only be applied to the injector for this component and its children. * This step is all that's required to make a new {\@link IterableDiffer} available. * * ### Example * * ``` * \@Component({ * viewProviders: [ * IterableDiffers.extend([new ImmutableListDiffer()]) * ] * }) * ``` * @param {?} factories * @return {?} */ static extend(factories) { return { provide: IterableDiffers, useFactory: (parent) => { if (!parent) { // Typically would occur when calling IterableDiffers.extend inside of dependencies passed // to // bootstrap(), which would override default pipes instead of extending them. throw new Error('Cannot extend IterableDiffers without a parent injector'); } return IterableDiffers.create(factories, parent); }, // Dependency technically isn't optional, but we can provide a better error message this way. deps: [[IterableDiffers, new SkipSelf(), new Optional()]] }; } /** * @param {?} iterable * @return {?} */ find(iterable) { const /** @type {?} */ factory = this.factories.find(f => f.supports(iterable)); if (factory != null) { return factory; } else { throw new Error(`Cannot find a differ supporting object '${iterable}' of type '${getTypeNameForDebugging(iterable)}'`); } } } /** * @param {?} type * @return {?} */ function getTypeNameForDebugging(type) { return type['name'] || typeof type; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * A differ that tracks changes made to an object over time. * * \@stable * @record * @template K, V */ /** * An object describing the changes in the `Map` or `{[k:string]: string}` since last time * `KeyValueDiffer#diff()` was invoked. * * \@stable * @record * @template K, V */ /** * Record representing the item change information. * * \@stable * @record * @template K, V */ /** * Provides a factory for {\@link KeyValueDiffer}. * * \@stable * @record */ /** * A repository of different Map diffing strategies used by NgClass, NgStyle, and others. * \@stable */ class KeyValueDiffers { /** * @param {?} factories */ constructor(factories) { this.factories = factories; } /** * @template S * @param {?} factories * @param {?=} parent * @return {?} */ static create(factories, parent) { if (parent) { const /** @type {?} */ copied = parent.factories.slice(); factories = factories.concat(copied); } return new KeyValueDiffers(factories); } /** * Takes an array of {\@link KeyValueDifferFactory} and returns a provider used to extend the * inherited {\@link KeyValueDiffers} instance with the provided factories and return a new * {\@link KeyValueDiffers} instance. * * The following example shows how to extend an existing list of factories, * which will only be applied to the injector for this component and its children. * This step is all that's required to make a new {\@link KeyValueDiffer} available. * * ### Example * * ``` * \@Component({ * viewProviders: [ * KeyValueDiffers.extend([new ImmutableMapDiffer()]) * ] * }) * ``` * @template S * @param {?} factories * @return {?} */ static extend(factories) { return { provide: KeyValueDiffers, useFactory: (parent) => { if (!parent) { // Typically would occur when calling KeyValueDiffers.extend inside of dependencies passed // to bootstrap(), which would override default pipes instead of extending them. throw new Error('Cannot extend KeyValueDiffers without a parent injector'); } return KeyValueDiffers.create(factories, parent); }, // Dependency technically isn't optional, but we can provide a better error message this way. deps: [[KeyValueDiffers, new SkipSelf(), new Optional()]] }; } /** * @param {?} kv * @return {?} */ find(kv) { const /** @type {?} */ factory = this.factories.find(f => f.supports(kv)); if (factory) { return factory; } throw new Error(`Cannot find a differ supporting object '${kv}'`); } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * Structural diffing for `Object`s and `Map`s. */ const keyValDiff = [new DefaultKeyValueDifferFactory()]; /** * Structural diffing for `Iterable` types such as `Array`s. */ const iterableDiff = [new DefaultIterableDifferFactory()]; const defaultIterableDiffers = new IterableDiffers(iterableDiff); const defaultKeyValueDiffers = new KeyValueDiffers(keyValDiff); /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ const _CORE_PLATFORM_PROVIDERS = [ // Set a default platform name for platforms that don't set it explicitly. { provide: PLATFORM_ID, useValue: 'unknown' }, { provide: PlatformRef, deps: [Injector] }, { provide: TestabilityRegistry, deps: [] }, { provide: Console, deps: [] }, ]; /** * This platform has to be included in any other platform * * \@experimental */ const platformCore = createPlatformFactory(null, 'core', _CORE_PLATFORM_PROVIDERS); /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * Provide this token to set the locale of your application. * It is used for i18n extraction, by i18n pipes (DatePipe, I18nPluralPipe, CurrencyPipe, * DecimalPipe and PercentPipe) and by ICU expressions. * * See the {\@linkDocs guide/i18n#setting-up-locale i18n guide} for more information. * * ### Example * * ```typescript * import { LOCALE_ID } from '\@angular/core'; * import { platformBrowserDynamic } from '\@angular/platform-browser-dynamic'; * import { AppModule } from './app/app.module'; * * platformBrowserDynamic().bootstrapModule(AppModule, { * providers: [{provide: LOCALE_ID, useValue: 'en-US' }] * }); * ``` * * \@experimental i18n support is experimental. */ const LOCALE_ID = new InjectionToken('LocaleId'); /** * Use this token at bootstrap to provide the content of your translation file (`xtb`, * `xlf` or `xlf2`) when you want to translate your application in another language. * * See the {\@linkDocs guide/i18n#merge i18n guide} for more information. * * ### Example * * ```typescript * import { TRANSLATIONS } from '\@angular/core'; * import { platformBrowserDynamic } from '\@angular/platform-browser-dynamic'; * import { AppModule } from './app/app.module'; * * // content of your translation file * const translations = '....'; * * platformBrowserDynamic().bootstrapModule(AppModule, { * providers: [{provide: TRANSLATIONS, useValue: translations }] * }); * ``` * * \@experimental i18n support is experimental. */ const TRANSLATIONS = new InjectionToken('Translations'); /** * Provide this token at bootstrap to set the format of your {\@link TRANSLATIONS}: `xtb`, * `xlf` or `xlf2`. * * See the {\@linkDocs guide/i18n#merge i18n guide} for more information. * * ### Example * * ```typescript * import { TRANSLATIONS_FORMAT } from '\@angular/core'; * import { platformBrowserDynamic } from '\@angular/platform-browser-dynamic'; * import { AppModule } from './app/app.module'; * * platformBrowserDynamic().bootstrapModule(AppModule, { * providers: [{provide: TRANSLATIONS_FORMAT, useValue: 'xlf' }] * }); * ``` * * \@experimental i18n support is experimental. */ const TRANSLATIONS_FORMAT = new InjectionToken('TranslationsFormat'); /** @enum {number} */ const MissingTranslationStrategy = { Error: 0, Warning: 1, Ignore: 2, }; MissingTranslationStrategy[MissingTranslationStrategy.Error] = "Error"; MissingTranslationStrategy[MissingTranslationStrategy.Warning] = "Warning"; MissingTranslationStrategy[MissingTranslationStrategy.Ignore] = "Ignore"; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @return {?} */ function _iterableDiffersFactory() { return defaultIterableDiffers; } /** * @return {?} */ function _keyValueDiffersFactory() { return defaultKeyValueDiffers; } /** * @param {?=} locale * @return {?} */ function _localeFactory(locale) { return locale || 'en-US'; } /** * This module includes the providers of \@angular/core that are needed * to bootstrap components via `ApplicationRef`. * * \@experimental */ class ApplicationModule { /** * @param {?} appRef */ constructor(appRef) { } } ApplicationModule.decorators = [ { type: NgModule, args: [{ providers: [ ApplicationRef, ApplicationInitStatus, Compiler, APP_ID_RANDOM_PROVIDER, { provide: IterableDiffers, useFactory: _iterableDiffersFactory }, { provide: KeyValueDiffers, useFactory: _keyValueDiffersFactory }, { provide: LOCALE_ID, useFactory: _localeFactory, deps: [[new Inject(LOCALE_ID), new Optional(), new SkipSelf()]] }, ] },] }, ]; /** @nocollapse */ ApplicationModule.ctorParameters = () => [ { type: ApplicationRef, }, ]; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** @enum {number} */ const SecurityContext = { NONE: 0, HTML: 1, STYLE: 2, SCRIPT: 3, URL: 4, RESOURCE_URL: 5, }; SecurityContext[SecurityContext.NONE] = "NONE"; SecurityContext[SecurityContext.HTML] = "HTML"; SecurityContext[SecurityContext.STYLE] = "STYLE"; SecurityContext[SecurityContext.SCRIPT] = "SCRIPT"; SecurityContext[SecurityContext.URL] = "URL"; SecurityContext[SecurityContext.RESOURCE_URL] = "RESOURCE_URL"; /** * Sanitizer is used by the views to sanitize potentially dangerous values. * * \@stable * @abstract */ class Sanitizer { } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ // unsupported: template constraints. /** * Factory for ViewDefinitions/NgModuleDefinitions. * We use a function so we can reexeute it in case an error happens and use the given logger * function to log the error from the definition of the node, which is shown in all browser * logs. * @record * @template D */ /** * Function to call console.error at the right source location. This is an indirection * via another function as browser will log the location that actually called * `console.error`. * @record */ // unsupported: template constraints. /** * @record * @template DF */ /** * @record */ /** * @record */ /** * @record */ /** * @record */ /** * @record */ /** * @record */ /** * @record */ /** * A node definition in the view. * * Note: We use one type for all nodes so that loops that loop over all nodes * of a ViewDefinition stay monomorphic! * @record */ /** * @record */ /** * @record */ /** * @record */ /** * @record */ /** * @record */ /** * @record */ /** * @record */ /** * @record */ /** * @record */ /** * @record */ /** * @record */ /** * @record */ /** * View instance data. * Attention: Adding fields to this is performance sensitive! * @record */ /** * @param {?} view * @param {?} priorInitState * @param {?} newInitState * @return {?} */ function shiftInitState(view, priorInitState, newInitState) { // Only update the InitState if we are currently in the prior state. // For example, only move into CallingInit if we are in BeforeInit. Only // move into CallingContentInit if we are in CallingInit. Normally this will // always be true because of how checkCycle is called in checkAndUpdateView. // However, if checkAndUpdateView is called recursively or if an exception is // thrown while checkAndUpdateView is running, checkAndUpdateView starts over // from the beginning. This ensures the state is monotonically increasing, // terminating in the AfterInit state, which ensures the Init methods are called // at least once and only once. const /** @type {?} */ state = view.state; const /** @type {?} */ initState = state & 1792; if (initState === priorInitState) { view.state = (state & ~1792 /* InitState_Mask */) | newInitState; view.initIndex = -1; return true; } return initState === newInitState; } /** * @param {?} view * @param {?} initState * @param {?} index * @return {?} */ function shouldCallLifecycleInitHook(view, initState, index) { if ((view.state & 1792 /* InitState_Mask */) === initState && view.initIndex <= index) { view.initIndex = index + 1; return true; } return false; } /** * @record */ /** * Node instance data. * * We have a separate type per NodeType to save memory * (TextData | ElementData | ProviderData | PureExpressionData | QueryList<any>) * * To keep our code monomorphic, * we prohibit using `NodeData` directly but enforce the use of accessors (`asElementData`, ...). * This way, no usage site can get a `NodeData` from view.nodes and then use it for different * purposes. */ /** * Data for an instantiated NodeType.Text. * * Attention: Adding fields to this is performance sensitive! * @record */ /** * Accessor for view.nodes, enforcing that every usage site stays monomorphic. * @param {?} view * @param {?} index * @return {?} */ function asTextData(view, index) { return /** @type {?} */ (view.nodes[index]); } /** * Data for an instantiated NodeType.Element. * * Attention: Adding fields to this is performance sensitive! * @record */ /** * @record */ /** * @record */ /** * Accessor for view.nodes, enforcing that every usage site stays monomorphic. * @param {?} view * @param {?} index * @return {?} */ function asElementData(view, index) { return /** @type {?} */ (view.nodes[index]); } /** * Data for an instantiated NodeType.Provider. * * Attention: Adding fields to this is performance sensitive! * @record */ /** * Accessor for view.nodes, enforcing that every usage site stays monomorphic. * @param {?} view * @param {?} index * @return {?} */ function asProviderData(view, index) { return /** @type {?} */ (view.nodes[index]); } /** * Data for an instantiated NodeType.PureExpression. * * Attention: Adding fields to this is performance sensitive! * @record */ /** * Accessor for view.nodes, enforcing that every usage site stays monomorphic. * @param {?} view * @param {?} index * @return {?} */ function asPureExpressionData(view, index) { return /** @type {?} */ (view.nodes[index]); } /** * Accessor for view.nodes, enforcing that every usage site stays monomorphic. * @param {?} view * @param {?} index * @return {?} */ function asQueryList(view, index) { return /** @type {?} */ (view.nodes[index]); } /** * @record */ /** * @abstract */ class DebugContext { } /** * @record */ /** * This object is used to prevent cycles in the source files and to have a place where * debug mode can hook it. It is lazily filled when `isDevMode` is known. */ const Services = { setCurrentNode: /** @type {?} */ ((undefined)), createRootView: /** @type {?} */ ((undefined)), createEmbeddedView: /** @type {?} */ ((undefined)), createComponentView: /** @type {?} */ ((undefined)), createNgModuleRef: /** @type {?} */ ((undefined)), overrideProvider: /** @type {?} */ ((undefined)), overrideComponentView: /** @type {?} */ ((undefined)), clearOverrides: /** @type {?} */ ((undefined)), checkAndUpdateView: /** @type {?} */ ((undefined)), checkNoChangesView: /** @type {?} */ ((undefined)), destroyView: /** @type {?} */ ((undefined)), resolveDep: /** @type {?} */ ((undefined)), createDebugContext: /** @type {?} */ ((undefined)), handleEvent: /** @type {?} */ ((undefined)), updateDirectives: /** @type {?} */ ((undefined)), updateRenderer: /** @type {?} */ ((undefined)), dirtyParentQueries: /** @type {?} */ ((undefined)), }; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @param {?} context * @param {?} oldValue * @param {?} currValue * @param {?} isFirstCheck * @return {?} */ function expressionChangedAfterItHasBeenCheckedError(context, oldValue, currValue, isFirstCheck) { let /** @type {?} */ msg = `ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value: '${oldValue}'. Current value: '${currValue}'.`; if (isFirstCheck) { msg += ` It seems like the view has been created after its parent and its children have been dirty checked.` + ` Has it been created in a change detection hook ?`; } return viewDebugError(msg, context); } /** * @param {?} err * @param {?} context * @return {?} */ function viewWrappedDebugError(err, context) { if (!(err instanceof Error)) { // errors that are not Error instances don't have a stack, // so it is ok to wrap them into a new Error object... err = new Error(err.toString()); } _addDebugContext(err, context); return err; } /** * @param {?} msg * @param {?} context * @return {?} */ function viewDebugError(msg, context) { const /** @type {?} */ err = new Error(msg); _addDebugContext(err, context); return err; } /** * @param {?} err * @param {?} context * @return {?} */ function _addDebugContext(err, context) { (/** @type {?} */ (err))[ERROR_DEBUG_CONTEXT] = context; (/** @type {?} */ (err))[ERROR_LOGGER] = context.logError.bind(context); } /** * @param {?} err * @return {?} */ function isViewDebugError(err) { return !!getDebugContext(err); } /** * @param {?} action * @return {?} */ function viewDestroyedError(action) { return new Error(`ViewDestroyedError: Attempt to use a destroyed view: ${action}`); } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ const NOOP = () => { }; const _tokenKeyCache = new Map(); /** * @param {?} token * @return {?} */ function tokenKey(token) { let /** @type {?} */ key = _tokenKeyCache.get(token); if (!key) { key = stringify(token) + '_' + _tokenKeyCache.size; _tokenKeyCache.set(token, key); } return key; } /** * @param {?} view * @param {?} nodeIdx * @param {?} bindingIdx * @param {?} value * @return {?} */ function unwrapValue(view, nodeIdx, bindingIdx, value) { if (WrappedValue.isWrapped(value)) { value = WrappedValue.unwrap(value); const /** @type {?} */ globalBindingIdx = view.def.nodes[nodeIdx].bindingIndex + bindingIdx; const /** @type {?} */ oldValue = WrappedValue.unwrap(view.oldValues[globalBindingIdx]); view.oldValues[globalBindingIdx] = new WrappedValue(oldValue); } return value; } const UNDEFINED_RENDERER_TYPE_ID = '$$undefined'; const EMPTY_RENDERER_TYPE_ID = '$$empty'; /** * @param {?} values * @return {?} */ function createRendererType2(values) { return { id: UNDEFINED_RENDERER_TYPE_ID, styles: values.styles, encapsulation: values.encapsulation, data: values.data }; } let _renderCompCount = 0; /** * @param {?=} type * @return {?} */ function resolveRendererType2(type) { if (type && type.id === UNDEFINED_RENDERER_TYPE_ID) { // first time we see this RendererType2. Initialize it... const /** @type {?} */ isFilled = ((type.encapsulation != null && type.encapsulation !== ViewEncapsulation.None) || type.styles.length || Object.keys(type.data).length); if (isFilled) { type.id = `c${_renderCompCount++}`; } else { type.id = EMPTY_RENDERER_TYPE_ID; } } if (type && type.id === EMPTY_RENDERER_TYPE_ID) { type = null; } return type || null; } /** * @param {?} view * @param {?} def * @param {?} bindingIdx * @param {?} value * @return {?} */ function checkBinding(view, def, bindingIdx, value) { const /** @type {?} */ oldValues = view.oldValues; if ((view.state & 2 /* FirstCheck */) || !looseIdentical(oldValues[def.bindingIndex + bindingIdx], value)) { return true; } return false; } /** * @param {?} view * @param {?} def * @param {?} bindingIdx * @param {?} value * @return {?} */ function checkAndUpdateBinding(view, def, bindingIdx, value) { if (checkBinding(view, def, bindingIdx, value)) { view.oldValues[def.bindingIndex + bindingIdx] = value; return true; } return false; } /** * @param {?} view * @param {?} def * @param {?} bindingIdx * @param {?} value * @return {?} */ function checkBindingNoChanges(view, def, bindingIdx, value) { const /** @type {?} */ oldValue = view.oldValues[def.bindingIndex + bindingIdx]; if ((view.state & 1 /* BeforeFirstCheck */) || !devModeEqual(oldValue, value)) { const /** @type {?} */ bindingName = def.bindings[bindingIdx].name; throw expressionChangedAfterItHasBeenCheckedError(Services.createDebugContext(view, def.nodeIndex), `${bindingName}: ${oldValue}`, `${bindingName}: ${value}`, (view.state & 1 /* BeforeFirstCheck */) !== 0); } } /** * @param {?} view * @return {?} */ function markParentViewsForCheck(view) { let /** @type {?} */ currView = view; while (currView) { if (currView.def.flags & 2 /* OnPush */) { currView.state |= 8 /* ChecksEnabled */; } currView = currView.viewContainerParent || currView.parent; } } /** * @param {?} view * @param {?} endView * @return {?} */ function markParentViewsForCheckProjectedViews(view, endView) { let /** @type {?} */ currView = view; while (currView && currView !== endView) { currView.state |= 64 /* CheckProjectedViews */; currView = currView.viewContainerParent || currView.parent; } } /** * @param {?} view * @param {?} nodeIndex * @param {?} eventName * @param {?} event * @return {?} */ function dispatchEvent(view, nodeIndex, eventName, event) { try { const /** @type {?} */ nodeDef = view.def.nodes[nodeIndex]; const /** @type {?} */ startView = nodeDef.flags & 33554432 /* ComponentView */ ? asElementData(view, nodeIndex).componentView : view; markParentViewsForCheck(startView); return Services.handleEvent(view, nodeIndex, eventName, event); } catch (/** @type {?} */ e) { // Attention: Don't rethrow, as it would cancel Observable subscriptions! view.root.errorHandler.handleError(e); } } /** * @param {?} view * @return {?} */ function declaredViewContainer(view) { if (view.parent) { const /** @type {?} */ parentView = view.parent; return asElementData(parentView, /** @type {?} */ ((view.parentNodeDef)).nodeIndex); } return null; } /** * for component views, this is the host element. * for embedded views, this is the index of the parent node * that contains the view container. * @param {?} view * @return {?} */ function viewParentEl(view) { const /** @type {?} */ parentView = view.parent; if (parentView) { return /** @type {?} */ ((view.parentNodeDef)).parent; } else { return null; } } /** * @param {?} view * @param {?} def * @return {?} */ function renderNode(view, def) { switch (def.flags & 201347067 /* Types */) { case 1 /* TypeElement */: return asElementData(view, def.nodeIndex).renderElement; case 2 /* TypeText */: return asTextData(view, def.nodeIndex).renderText; } } /** * @param {?} target * @param {?} name * @return {?} */ function elementEventFullName(target, name) { return target ? `${target}:${name}` : name; } /** * @param {?} view * @return {?} */ function isComponentView(view) { return !!view.parent && !!(/** @type {?} */ ((view.parentNodeDef)).flags & 32768 /* Component */); } /** * @param {?} view * @return {?} */ function isEmbeddedView(view) { return !!view.parent && !(/** @type {?} */ ((view.parentNodeDef)).flags & 32768 /* Component */); } /** * @param {?} queryId * @return {?} */ function filterQueryId(queryId) { return 1 << (queryId % 32); } /** * @param {?} matchedQueriesDsl * @return {?} */ function splitMatchedQueriesDsl(matchedQueriesDsl) { const /** @type {?} */ matchedQueries = {}; let /** @type {?} */ matchedQueryIds = 0; const /** @type {?} */ references = {}; if (matchedQueriesDsl) { matchedQueriesDsl.forEach(([queryId, valueType]) => { if (typeof queryId === 'number') { matchedQueries[queryId] = valueType; matchedQueryIds |= filterQueryId(queryId); } else { references[queryId] = valueType; } }); } return { matchedQueries, references, matchedQueryIds }; } /** * @param {?} deps * @param {?=} sourceName * @return {?} */ function splitDepsDsl(deps, sourceName) { return deps.map(value => { let /** @type {?} */ token; let /** @type {?} */ flags; if (Array.isArray(value)) { [flags, token] = value; } else { flags = 0 /* None */; token = value; } if (token && (typeof token === 'function' || typeof token === 'object') && sourceName) { Object.defineProperty(token, SOURCE, { value: sourceName, configurable: true }); } return { flags, token, tokenKey: tokenKey(token) }; }); } /** * @param {?} view * @param {?} renderHost * @param {?} def * @return {?} */ function getParentRenderElement(view, renderHost, def) { let /** @type {?} */ renderParent = def.renderParent; if (renderParent) { if ((renderParent.flags & 1 /* TypeElement */) === 0 || (renderParent.flags & 33554432 /* ComponentView */) === 0 || (/** @type {?} */ ((renderParent.element)).componentRendererType && /** @type {?} */ ((/** @type {?} */ ((renderParent.element)).componentRendererType)).encapsulation === ViewEncapsulation.Native)) { // only children of non components, or children of components with native encapsulation should // be attached. return asElementData(view, /** @type {?} */ ((def.renderParent)).nodeIndex).renderElement; } } else { return renderHost; } } const DEFINITION_CACHE = new WeakMap(); /** * @template D * @param {?} factory * @return {?} */ function resolveDefinition(factory) { let /** @type {?} */ value = /** @type {?} */ (((DEFINITION_CACHE.get(factory)))); if (!value) { value = factory(() => NOOP); value.factory = factory; DEFINITION_CACHE.set(factory, value); } return value; } /** * @param {?} view * @return {?} */ function rootRenderNodes(view) { const /** @type {?} */ renderNodes = []; visitRootRenderNodes(view, 0 /* Collect */, undefined, undefined, renderNodes); return renderNodes; } /** * @param {?} view * @param {?} action * @param {?} parentNode * @param {?} nextSibling * @param {?=} target * @return {?} */ function visitRootRenderNodes(view, action, parentNode, nextSibling, target) { // We need to re-compute the parent node in case the nodes have been moved around manually if (action === 3 /* RemoveChild */) { parentNode = view.renderer.parentNode(renderNode(view, /** @type {?} */ ((view.def.lastRenderRootNode)))); } visitSiblingRenderNodes(view, action, 0, view.def.nodes.length - 1, parentNode, nextSibling, target); } /** * @param {?} view * @param {?} action * @param {?} startIndex * @param {?} endIndex * @param {?} parentNode * @param {?} nextSibling * @param {?=} target * @return {?} */ function visitSiblingRenderNodes(view, action, startIndex, endIndex, parentNode, nextSibling, target) { for (let /** @type {?} */ i = startIndex; i <= endIndex; i++) { const /** @type {?} */ nodeDef = view.def.nodes[i]; if (nodeDef.flags & (1 /* TypeElement */ | 2 /* TypeText */ | 8 /* TypeNgContent */)) { visitRenderNode(view, nodeDef, action, parentNode, nextSibling, target); } // jump to next sibling i += nodeDef.childCount; } } /** * @param {?} view * @param {?} ngContentIndex * @param {?} action * @param {?} parentNode * @param {?} nextSibling * @param {?=} target * @return {?} */ function visitProjectedRenderNodes(view, ngContentIndex, action, parentNode, nextSibling, target) { let /** @type {?} */ compView = view; while (compView && !isComponentView(compView)) { compView = compView.parent; } const /** @type {?} */ hostView = /** @type {?} */ ((compView)).parent; const /** @type {?} */ hostElDef = viewParentEl(/** @type {?} */ ((compView))); const /** @type {?} */ startIndex = /** @type {?} */ ((hostElDef)).nodeIndex + 1; const /** @type {?} */ endIndex = /** @type {?} */ ((hostElDef)).nodeIndex + /** @type {?} */ ((hostElDef)).childCount; for (let /** @type {?} */ i = startIndex; i <= endIndex; i++) { const /** @type {?} */ nodeDef = /** @type {?} */ ((hostView)).def.nodes[i]; if (nodeDef.ngContentIndex === ngContentIndex) { visitRenderNode(/** @type {?} */ ((hostView)), nodeDef, action, parentNode, nextSibling, target); } // jump to next sibling i += nodeDef.childCount; } if (!/** @type {?} */ ((hostView)).parent) { // a root view const /** @type {?} */ projectedNodes = view.root.projectableNodes[ngContentIndex]; if (projectedNodes) { for (let /** @type {?} */ i = 0; i < projectedNodes.length; i++) { execRenderNodeAction(view, projectedNodes[i], action, parentNode, nextSibling, target); } } } } /** * @param {?} view * @param {?} nodeDef * @param {?} action * @param {?} parentNode * @param {?} nextSibling * @param {?=} target * @return {?} */ function visitRenderNode(view, nodeDef, action, parentNode, nextSibling, target) { if (nodeDef.flags & 8 /* TypeNgContent */) { visitProjectedRenderNodes(view, /** @type {?} */ ((nodeDef.ngContent)).index, action, parentNode, nextSibling, target); } else { const /** @type {?} */ rn = renderNode(view, nodeDef); if (action === 3 /* RemoveChild */ && (nodeDef.flags & 33554432 /* ComponentView */) && (nodeDef.bindingFlags & 48 /* CatSyntheticProperty */)) { // Note: we might need to do both actions. if (nodeDef.bindingFlags & (16 /* SyntheticProperty */)) { execRenderNodeAction(view, rn, action, parentNode, nextSibling, target); } if (nodeDef.bindingFlags & (32 /* SyntheticHostProperty */)) { const /** @type {?} */ compView = asElementData(view, nodeDef.nodeIndex).componentView; execRenderNodeAction(compView, rn, action, parentNode, nextSibling, target); } } else { execRenderNodeAction(view, rn, action, parentNode, nextSibling, target); } if (nodeDef.flags & 16777216 /* EmbeddedViews */) { const /** @type {?} */ embeddedViews = /** @type {?} */ ((asElementData(view, nodeDef.nodeIndex).viewContainer))._embeddedViews; for (let /** @type {?} */ k = 0; k < embeddedViews.length; k++) { visitRootRenderNodes(embeddedViews[k], action, parentNode, nextSibling, target); } } if (nodeDef.flags & 1 /* TypeElement */ && !/** @type {?} */ ((nodeDef.element)).name) { visitSiblingRenderNodes(view, action, nodeDef.nodeIndex + 1, nodeDef.nodeIndex + nodeDef.childCount, parentNode, nextSibling, target); } } } /** * @param {?} view * @param {?} renderNode * @param {?} action * @param {?} parentNode * @param {?} nextSibling * @param {?=} target * @return {?} */ function execRenderNodeAction(view, renderNode, action, parentNode, nextSibling, target) { const /** @type {?} */ renderer = view.renderer; switch (action) { case 1 /* AppendChild */: renderer.appendChild(parentNode, renderNode); break; case 2 /* InsertBefore */: renderer.insertBefore(parentNode, renderNode, nextSibling); break; case 3 /* RemoveChild */: renderer.removeChild(parentNode, renderNode); break; case 0 /* Collect */: /** @type {?} */ ((target)).push(renderNode); break; } } const NS_PREFIX_RE = /^:([^:]+):(.+)$/; /** * @param {?} name * @return {?} */ function splitNamespace(name) { if (name[0] === ':') { const /** @type {?} */ match = /** @type {?} */ ((name.match(NS_PREFIX_RE))); return [match[1], match[2]]; } return ['', name]; } /** * @param {?} bindings * @return {?} */ function calcBindingFlags(bindings) { let /** @type {?} */ flags = 0; for (let /** @type {?} */ i = 0; i < bindings.length; i++) { flags |= bindings[i].flags; } return flags; } /** * @param {?} valueCount * @param {?} constAndInterp * @return {?} */ function interpolate(valueCount, constAndInterp) { let /** @type {?} */ result = ''; for (let /** @type {?} */ i = 0; i < valueCount * 2; i = i + 2) { result = result + constAndInterp[i] + _toStringWithNull(constAndInterp[i + 1]); } return result + constAndInterp[valueCount * 2]; } /** * @param {?} valueCount * @param {?} c0 * @param {?} a1 * @param {?} c1 * @param {?=} a2 * @param {?=} c2 * @param {?=} a3 * @param {?=} c3 * @param {?=} a4 * @param {?=} c4 * @param {?=} a5 * @param {?=} c5 * @param {?=} a6 * @param {?=} c6 * @param {?=} a7 * @param {?=} c7 * @param {?=} a8 * @param {?=} c8 * @param {?=} a9 * @param {?=} c9 * @return {?} */ function inlineInterpolate(valueCount, c0, a1, c1, a2, c2, a3, c3, a4, c4, a5, c5, a6, c6, a7, c7, a8, c8, a9, c9) { switch (valueCount) { case 1: return c0 + _toStringWithNull(a1) + c1; case 2: return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2; case 3: return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) + c3; case 4: return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) + c3 + _toStringWithNull(a4) + c4; case 5: return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) + c3 + _toStringWithNull(a4) + c4 + _toStringWithNull(a5) + c5; case 6: return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) + c3 + _toStringWithNull(a4) + c4 + _toStringWithNull(a5) + c5 + _toStringWithNull(a6) + c6; case 7: return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) + c3 + _toStringWithNull(a4) + c4 + _toStringWithNull(a5) + c5 + _toStringWithNull(a6) + c6 + _toStringWithNull(a7) + c7; case 8: return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) + c3 + _toStringWithNull(a4) + c4 + _toStringWithNull(a5) + c5 + _toStringWithNull(a6) + c6 + _toStringWithNull(a7) + c7 + _toStringWithNull(a8) + c8; case 9: return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) + c3 + _toStringWithNull(a4) + c4 + _toStringWithNull(a5) + c5 + _toStringWithNull(a6) + c6 + _toStringWithNull(a7) + c7 + _toStringWithNull(a8) + c8 + _toStringWithNull(a9) + c9; default: throw new Error(`Does not support more than 9 expressions`); } } /** * @param {?} v * @return {?} */ function _toStringWithNull(v) { return v != null ? v.toString() : ''; } const EMPTY_ARRAY = []; const EMPTY_MAP = {}; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @param {?} flags * @param {?} matchedQueriesDsl * @param {?} ngContentIndex * @param {?} childCount * @param {?=} handleEvent * @param {?=} templateFactory * @return {?} */ function anchorDef(flags, matchedQueriesDsl, ngContentIndex, childCount, handleEvent, templateFactory) { flags |= 1 /* TypeElement */; const { matchedQueries, references, matchedQueryIds } = splitMatchedQueriesDsl(matchedQueriesDsl); const /** @type {?} */ template = templateFactory ? resolveDefinition(templateFactory) : null; return { // will bet set by the view definition nodeIndex: -1, parent: null, renderParent: null, bindingIndex: -1, outputIndex: -1, // regular values flags, checkIndex: -1, childFlags: 0, directChildFlags: 0, childMatchedQueries: 0, matchedQueries, matchedQueryIds, references, ngContentIndex, childCount, bindings: [], bindingFlags: 0, outputs: [], element: { ns: null, name: null, attrs: null, template, componentProvider: null, componentView: null, componentRendererType: null, publicProviders: null, allProviders: null, handleEvent: handleEvent || NOOP }, provider: null, text: null, query: null, ngContent: null }; } /** * @param {?} checkIndex * @param {?} flags * @param {?} matchedQueriesDsl * @param {?} ngContentIndex * @param {?} childCount * @param {?} namespaceAndName * @param {?=} fixedAttrs * @param {?=} bindings * @param {?=} outputs * @param {?=} handleEvent * @param {?=} componentView * @param {?=} componentRendererType * @return {?} */ function elementDef(checkIndex, flags, matchedQueriesDsl, ngContentIndex, childCount, namespaceAndName, fixedAttrs = [], bindings, outputs, handleEvent, componentView, componentRendererType) { if (!handleEvent) { handleEvent = NOOP; } const { matchedQueries, references, matchedQueryIds } = splitMatchedQueriesDsl(matchedQueriesDsl); let /** @type {?} */ ns = /** @type {?} */ ((null)); let /** @type {?} */ name = /** @type {?} */ ((null)); if (namespaceAndName) { [ns, name] = splitNamespace(namespaceAndName); } bindings = bindings || []; const /** @type {?} */ bindingDefs = new Array(bindings.length); for (let /** @type {?} */ i = 0; i < bindings.length; i++) { const [bindingFlags, namespaceAndName, suffixOrSecurityContext] = bindings[i]; const [ns, name] = splitNamespace(namespaceAndName); let /** @type {?} */ securityContext = /** @type {?} */ ((undefined)); let /** @type {?} */ suffix = /** @type {?} */ ((undefined)); switch (bindingFlags & 15 /* Types */) { case 4 /* TypeElementStyle */: suffix = /** @type {?} */ (suffixOrSecurityContext); break; case 1 /* TypeElementAttribute */: case 8 /* TypeProperty */: securityContext = /** @type {?} */ (suffixOrSecurityContext); break; } bindingDefs[i] = { flags: bindingFlags, ns, name, nonMinifiedName: name, securityContext, suffix }; } outputs = outputs || []; const /** @type {?} */ outputDefs = new Array(outputs.length); for (let /** @type {?} */ i = 0; i < outputs.length; i++) { const [target, eventName] = outputs[i]; outputDefs[i] = { type: 0 /* ElementOutput */, target: /** @type {?} */ (target), eventName, propName: null }; } fixedAttrs = fixedAttrs || []; const /** @type {?} */ attrs = /** @type {?} */ (fixedAttrs.map(([namespaceAndName, value]) => { const [ns, name] = splitNamespace(namespaceAndName); return [ns, name, value]; })); componentRendererType = resolveRendererType2(componentRendererType); if (componentView) { flags |= 33554432 /* ComponentView */; } flags |= 1 /* TypeElement */; return { // will bet set by the view definition nodeIndex: -1, parent: null, renderParent: null, bindingIndex: -1, outputIndex: -1, // regular values checkIndex, flags, childFlags: 0, directChildFlags: 0, childMatchedQueries: 0, matchedQueries, matchedQueryIds, references, ngContentIndex, childCount, bindings: bindingDefs, bindingFlags: calcBindingFlags(bindingDefs), outputs: outputDefs, element: { ns, name, attrs, template: null, // will bet set by the view definition componentProvider: null, componentView: componentView || null, componentRendererType: componentRendererType, publicProviders: null, allProviders: null, handleEvent: handleEvent || NOOP, }, provider: null, text: null, query: null, ngContent: null }; } /** * @param {?} view * @param {?} renderHost * @param {?} def * @return {?} */ function createElement(view, renderHost, def) { const /** @type {?} */ elDef = /** @type {?} */ ((def.element)); const /** @type {?} */ rootSelectorOrNode = view.root.selectorOrNode; const /** @type {?} */ renderer = view.renderer; let /** @type {?} */ el; if (view.parent || !rootSelectorOrNode) { if (elDef.name) { el = renderer.createElement(elDef.name, elDef.ns); } else { el = renderer.createComment(''); } const /** @type {?} */ parentEl = getParentRenderElement(view, renderHost, def); if (parentEl) { renderer.appendChild(parentEl, el); } } else { el = renderer.selectRootElement(rootSelectorOrNode); } if (elDef.attrs) { for (let /** @type {?} */ i = 0; i < elDef.attrs.length; i++) { const [ns, name, value] = elDef.attrs[i]; renderer.setAttribute(el, name, value, ns); } } return el; } /** * @param {?} view * @param {?} compView * @param {?} def * @param {?} el * @return {?} */ function listenToElementOutputs(view, compView, def, el) { for (let /** @type {?} */ i = 0; i < def.outputs.length; i++) { const /** @type {?} */ output = def.outputs[i]; const /** @type {?} */ handleEventClosure = renderEventHandlerClosure(view, def.nodeIndex, elementEventFullName(output.target, output.eventName)); let /** @type {?} */ listenTarget = output.target; let /** @type {?} */ listenerView = view; if (output.target === 'component') { listenTarget = null; listenerView = compView; } const /** @type {?} */ disposable = /** @type {?} */ (listenerView.renderer.listen(listenTarget || el, output.eventName, handleEventClosure)); /** @type {?} */ ((view.disposables))[def.outputIndex + i] = disposable; } } /** * @param {?} view * @param {?} index * @param {?} eventName * @return {?} */ function renderEventHandlerClosure(view, index, eventName) { return (event) => dispatchEvent(view, index, eventName, event); } /** * @param {?} view * @param {?} def * @param {?} v0 * @param {?} v1 * @param {?} v2 * @param {?} v3 * @param {?} v4 * @param {?} v5 * @param {?} v6 * @param {?} v7 * @param {?} v8 * @param {?} v9 * @return {?} */ function checkAndUpdateElementInline(view, def, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) { const /** @type {?} */ bindLen = def.bindings.length; let /** @type {?} */ changed = false; if (bindLen > 0 && checkAndUpdateElementValue(view, def, 0, v0)) changed = true; if (bindLen > 1 && checkAndUpdateElementValue(view, def, 1, v1)) changed = true; if (bindLen > 2 && checkAndUpdateElementValue(view, def, 2, v2)) changed = true; if (bindLen > 3 && checkAndUpdateElementValue(view, def, 3, v3)) changed = true; if (bindLen > 4 && checkAndUpdateElementValue(view, def, 4, v4)) changed = true; if (bindLen > 5 && checkAndUpdateElementValue(view, def, 5, v5)) changed = true; if (bindLen > 6 && checkAndUpdateElementValue(view, def, 6, v6)) changed = true; if (bindLen > 7 && checkAndUpdateElementValue(view, def, 7, v7)) changed = true; if (bindLen > 8 && checkAndUpdateElementValue(view, def, 8, v8)) changed = true; if (bindLen > 9 && checkAndUpdateElementValue(view, def, 9, v9)) changed = true; return changed; } /** * @param {?} view * @param {?} def * @param {?} values * @return {?} */ function checkAndUpdateElementDynamic(view, def, values) { let /** @type {?} */ changed = false; for (let /** @type {?} */ i = 0; i < values.length; i++) { if (checkAndUpdateElementValue(view, def, i, values[i])) changed = true; } return changed; } /** * @param {?} view * @param {?} def * @param {?} bindingIdx * @param {?} value * @return {?} */ function checkAndUpdateElementValue(view, def, bindingIdx, value) { if (!checkAndUpdateBinding(view, def, bindingIdx, value)) { return false; } const /** @type {?} */ binding = def.bindings[bindingIdx]; const /** @type {?} */ elData = asElementData(view, def.nodeIndex); const /** @type {?} */ renderNode$$1 = elData.renderElement; const /** @type {?} */ name = /** @type {?} */ ((binding.name)); switch (binding.flags & 15 /* Types */) { case 1 /* TypeElementAttribute */: setElementAttribute(view, binding, renderNode$$1, binding.ns, name, value); break; case 2 /* TypeElementClass */: setElementClass(view, renderNode$$1, name, value); break; case 4 /* TypeElementStyle */: setElementStyle(view, binding, renderNode$$1, name, value); break; case 8 /* TypeProperty */: const /** @type {?} */ bindView = (def.flags & 33554432 /* ComponentView */ && binding.flags & 32 /* SyntheticHostProperty */) ? elData.componentView : view; setElementProperty(bindView, binding, renderNode$$1, name, value); break; } return true; } /** * @param {?} view * @param {?} binding * @param {?} renderNode * @param {?} ns * @param {?} name * @param {?} value * @return {?} */ function setElementAttribute(view, binding, renderNode$$1, ns, name, value) { const /** @type {?} */ securityContext = binding.securityContext; let /** @type {?} */ renderValue = securityContext ? view.root.sanitizer.sanitize(securityContext, value) : value; renderValue = renderValue != null ? renderValue.toString() : null; const /** @type {?} */ renderer = view.renderer; if (value != null) { renderer.setAttribute(renderNode$$1, name, renderValue, ns); } else { renderer.removeAttribute(renderNode$$1, name, ns); } } /** * @param {?} view * @param {?} renderNode * @param {?} name * @param {?} value * @return {?} */ function setElementClass(view, renderNode$$1, name, value) { const /** @type {?} */ renderer = view.renderer; if (value) { renderer.addClass(renderNode$$1, name); } else { renderer.removeClass(renderNode$$1, name); } } /** * @param {?} view * @param {?} binding * @param {?} renderNode * @param {?} name * @param {?} value * @return {?} */ function setElementStyle(view, binding, renderNode$$1, name, value) { let /** @type {?} */ renderValue = view.root.sanitizer.sanitize(SecurityContext.STYLE, /** @type {?} */ (value)); if (renderValue != null) { renderValue = renderValue.toString(); const /** @type {?} */ unit = binding.suffix; if (unit != null) { renderValue = renderValue + unit; } } else { renderValue = null; } const /** @type {?} */ renderer = view.renderer; if (renderValue != null) { renderer.setStyle(renderNode$$1, name, renderValue); } else { renderer.removeStyle(renderNode$$1, name); } } /** * @param {?} view * @param {?} binding * @param {?} renderNode * @param {?} name * @param {?} value * @return {?} */ function setElementProperty(view, binding, renderNode$$1, name, value) { const /** @type {?} */ securityContext = binding.securityContext; let /** @type {?} */ renderValue = securityContext ? view.root.sanitizer.sanitize(securityContext, value) : value; view.renderer.setProperty(renderNode$$1, name, renderValue); } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ const UNDEFINED_VALUE = new Object(); const InjectorRefTokenKey$1 = tokenKey(Injector); const NgModuleRefTokenKey = tokenKey(NgModuleRef); /** * @param {?} flags * @param {?} token * @param {?} value * @param {?} deps * @return {?} */ function moduleProvideDef(flags, token, value, deps) { // Need to resolve forwardRefs as e.g. for `useValue` we // lowered the expression and then stopped evaluating it, // i.e. also didn't unwrap it. value = resolveForwardRef(value); const /** @type {?} */ depDefs = splitDepsDsl(deps, stringify(token)); return { // will bet set by the module definition index: -1, deps: depDefs, flags, token, value }; } /** * @param {?} providers * @return {?} */ function moduleDef(providers) { const /** @type {?} */ providersByKey = {}; for (let /** @type {?} */ i = 0; i < providers.length; i++) { const /** @type {?} */ provider = providers[i]; provider.index = i; providersByKey[tokenKey(provider.token)] = provider; } return { // Will be filled later... factory: null, providersByKey, providers }; } /** * @param {?} data * @return {?} */ function initNgModule(data) { const /** @type {?} */ def = data._def; const /** @type {?} */ providers = data._providers = new Array(def.providers.length); for (let /** @type {?} */ i = 0; i < def.providers.length; i++) { const /** @type {?} */ provDef = def.providers[i]; if (!(provDef.flags & 4096 /* LazyProvider */)) { providers[i] = _createProviderInstance$1(data, provDef); } } } /** * @param {?} data * @param {?} depDef * @param {?=} notFoundValue * @return {?} */ function resolveNgModuleDep(data, depDef, notFoundValue = Injector.THROW_IF_NOT_FOUND) { if (depDef.flags & 8 /* Value */) { return depDef.token; } if (depDef.flags & 2 /* Optional */) { notFoundValue = null; } if (depDef.flags & 1 /* SkipSelf */) { return data._parent.get(depDef.token, notFoundValue); } const /** @type {?} */ tokenKey$$1 = depDef.tokenKey; switch (tokenKey$$1) { case InjectorRefTokenKey$1: case NgModuleRefTokenKey: return data; } const /** @type {?} */ providerDef = data._def.providersByKey[tokenKey$$1]; if (providerDef) { let /** @type {?} */ providerInstance = data._providers[providerDef.index]; if (providerInstance === undefined) { providerInstance = data._providers[providerDef.index] = _createProviderInstance$1(data, providerDef); } return providerInstance === UNDEFINED_VALUE ? undefined : providerInstance; } return data._parent.get(depDef.token, notFoundValue); } /** * @param {?} ngModule * @param {?} providerDef * @return {?} */ function _createProviderInstance$1(ngModule, providerDef) { let /** @type {?} */ injectable; switch (providerDef.flags & 201347067 /* Types */) { case 512 /* TypeClassProvider */: injectable = _createClass(ngModule, providerDef.value, providerDef.deps); break; case 1024 /* TypeFactoryProvider */: injectable = _callFactory(ngModule, providerDef.value, providerDef.deps); break; case 2048 /* TypeUseExistingProvider */: injectable = resolveNgModuleDep(ngModule, providerDef.deps[0]); break; case 256 /* TypeValueProvider */: injectable = providerDef.value; break; } return injectable === undefined ? UNDEFINED_VALUE : injectable; } /** * @param {?} ngModule * @param {?} ctor * @param {?} deps * @return {?} */ function _createClass(ngModule, ctor, deps) { const /** @type {?} */ len = deps.length; switch (len) { case 0: return new ctor(); case 1: return new ctor(resolveNgModuleDep(ngModule, deps[0])); case 2: return new ctor(resolveNgModuleDep(ngModule, deps[0]), resolveNgModuleDep(ngModule, deps[1])); case 3: return new ctor(resolveNgModuleDep(ngModule, deps[0]), resolveNgModuleDep(ngModule, deps[1]), resolveNgModuleDep(ngModule, deps[2])); default: const /** @type {?} */ depValues = new Array(len); for (let /** @type {?} */ i = 0; i < len; i++) { depValues[i] = resolveNgModuleDep(ngModule, deps[i]); } return new ctor(...depValues); } } /** * @param {?} ngModule * @param {?} factory * @param {?} deps * @return {?} */ function _callFactory(ngModule, factory, deps) { const /** @type {?} */ len = deps.length; switch (len) { case 0: return factory(); case 1: return factory(resolveNgModuleDep(ngModule, deps[0])); case 2: return factory(resolveNgModuleDep(ngModule, deps[0]), resolveNgModuleDep(ngModule, deps[1])); case 3: return factory(resolveNgModuleDep(ngModule, deps[0]), resolveNgModuleDep(ngModule, deps[1]), resolveNgModuleDep(ngModule, deps[2])); default: const /** @type {?} */ depValues = Array(len); for (let /** @type {?} */ i = 0; i < len; i++) { depValues[i] = resolveNgModuleDep(ngModule, deps[i]); } return factory(...depValues); } } /** * @param {?} ngModule * @param {?} lifecycles * @return {?} */ function callNgModuleLifecycle(ngModule, lifecycles) { const /** @type {?} */ def = ngModule._def; for (let /** @type {?} */ i = 0; i < def.providers.length; i++) { const /** @type {?} */ provDef = def.providers[i]; if (provDef.flags & 131072 /* OnDestroy */) { const /** @type {?} */ instance = ngModule._providers[i]; if (instance && instance !== UNDEFINED_VALUE) { instance.ngOnDestroy(); } } } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @param {?} parentView * @param {?} elementData * @param {?} viewIndex * @param {?} view * @return {?} */ function attachEmbeddedView(parentView, elementData, viewIndex, view) { let /** @type {?} */ embeddedViews = /** @type {?} */ ((elementData.viewContainer))._embeddedViews; if (viewIndex === null || viewIndex === undefined) { viewIndex = embeddedViews.length; } view.viewContainerParent = parentView; addToArray(embeddedViews, /** @type {?} */ ((viewIndex)), view); attachProjectedView(elementData, view); Services.dirtyParentQueries(view); const /** @type {?} */ prevView = /** @type {?} */ ((viewIndex)) > 0 ? embeddedViews[/** @type {?} */ ((viewIndex)) - 1] : null; renderAttachEmbeddedView(elementData, prevView, view); } /** * @param {?} vcElementData * @param {?} view * @return {?} */ function attachProjectedView(vcElementData, view) { const /** @type {?} */ dvcElementData = declaredViewContainer(view); if (!dvcElementData || dvcElementData === vcElementData || view.state & 16 /* IsProjectedView */) { return; } // Note: For performance reasons, we // - add a view to template._projectedViews only 1x throughout its lifetime, // and remove it not until the view is destroyed. // (hard, as when a parent view is attached/detached we would need to attach/detach all // nested projected views as well, even accross component boundaries). // - don't track the insertion order of views in the projected views array // (hard, as when the views of the same template are inserted different view containers) view.state |= 16 /* IsProjectedView */; let /** @type {?} */ projectedViews = dvcElementData.template._projectedViews; if (!projectedViews) { projectedViews = dvcElementData.template._projectedViews = []; } projectedViews.push(view); // Note: we are changing the NodeDef here as we cannot calculate // the fact whether a template is used for projection during compilation. markNodeAsProjectedTemplate(/** @type {?} */ ((view.parent)).def, /** @type {?} */ ((view.parentNodeDef))); } /** * @param {?} viewDef * @param {?} nodeDef * @return {?} */ function markNodeAsProjectedTemplate(viewDef, nodeDef) { if (nodeDef.flags & 4 /* ProjectedTemplate */) { return; } viewDef.nodeFlags |= 4 /* ProjectedTemplate */; nodeDef.flags |= 4 /* ProjectedTemplate */; let /** @type {?} */ parentNodeDef = nodeDef.parent; while (parentNodeDef) { parentNodeDef.childFlags |= 4 /* ProjectedTemplate */; parentNodeDef = parentNodeDef.parent; } } /** * @param {?} elementData * @param {?=} viewIndex * @return {?} */ function detachEmbeddedView(elementData, viewIndex) { const /** @type {?} */ embeddedViews = /** @type {?} */ ((elementData.viewContainer))._embeddedViews; if (viewIndex == null || viewIndex >= embeddedViews.length) { viewIndex = embeddedViews.length - 1; } if (viewIndex < 0) { return null; } const /** @type {?} */ view = embeddedViews[viewIndex]; view.viewContainerParent = null; removeFromArray(embeddedViews, viewIndex); // See attachProjectedView for why we don't update projectedViews here. Services.dirtyParentQueries(view); renderDetachView(view); return view; } /** * @param {?} view * @return {?} */ function detachProjectedView(view) { if (!(view.state & 16 /* IsProjectedView */)) { return; } const /** @type {?} */ dvcElementData = declaredViewContainer(view); if (dvcElementData) { const /** @type {?} */ projectedViews = dvcElementData.template._projectedViews; if (projectedViews) { removeFromArray(projectedViews, projectedViews.indexOf(view)); Services.dirtyParentQueries(view); } } } /** * @param {?} elementData * @param {?} oldViewIndex * @param {?} newViewIndex * @return {?} */ function moveEmbeddedView(elementData, oldViewIndex, newViewIndex) { const /** @type {?} */ embeddedViews = /** @type {?} */ ((elementData.viewContainer))._embeddedViews; const /** @type {?} */ view = embeddedViews[oldViewIndex]; removeFromArray(embeddedViews, oldViewIndex); if (newViewIndex == null) { newViewIndex = embeddedViews.length; } addToArray(embeddedViews, newViewIndex, view); // Note: Don't need to change projectedViews as the order in there // as always invalid... Services.dirtyParentQueries(view); renderDetachView(view); const /** @type {?} */ prevView = newViewIndex > 0 ? embeddedViews[newViewIndex - 1] : null; renderAttachEmbeddedView(elementData, prevView, view); return view; } /** * @param {?} elementData * @param {?} prevView * @param {?} view * @return {?} */ function renderAttachEmbeddedView(elementData, prevView, view) { const /** @type {?} */ prevRenderNode = prevView ? renderNode(prevView, /** @type {?} */ ((prevView.def.lastRenderRootNode))) : elementData.renderElement; const /** @type {?} */ parentNode = view.renderer.parentNode(prevRenderNode); const /** @type {?} */ nextSibling = view.renderer.nextSibling(prevRenderNode); // Note: We can't check if `nextSibling` is present, as on WebWorkers it will always be! // However, browsers automatically do `appendChild` when there is no `nextSibling`. visitRootRenderNodes(view, 2 /* InsertBefore */, parentNode, nextSibling, undefined); } /** * @param {?} view * @return {?} */ function renderDetachView(view) { visitRootRenderNodes(view, 3 /* RemoveChild */, null, null, undefined); } /** * @param {?} arr * @param {?} index * @param {?} value * @return {?} */ function addToArray(arr, index, value) { // perf: array.push is faster than array.splice! if (index >= arr.length) { arr.push(value); } else { arr.splice(index, 0, value); } } /** * @param {?} arr * @param {?} index * @return {?} */ function removeFromArray(arr, index) { // perf: array.pop is faster than array.splice! if (index >= arr.length - 1) { arr.pop(); } else { arr.splice(index, 1); } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ const EMPTY_CONTEXT = new Object(); /** * @param {?} selector * @param {?} componentType * @param {?} viewDefFactory * @param {?} inputs * @param {?} outputs * @param {?} ngContentSelectors * @return {?} */ function createComponentFactory(selector, componentType, viewDefFactory, inputs, outputs, ngContentSelectors) { return new ComponentFactory_(selector, componentType, viewDefFactory, inputs, outputs, ngContentSelectors); } /** * @param {?} componentFactory * @return {?} */ function getComponentViewDefinitionFactory(componentFactory) { return (/** @type {?} */ (componentFactory)).viewDefFactory; } class ComponentFactory_ extends ComponentFactory { /** * @param {?} selector * @param {?} componentType * @param {?} viewDefFactory * @param {?} _inputs * @param {?} _outputs * @param {?} ngContentSelectors */ constructor(selector, componentType, viewDefFactory, _inputs, _outputs, ngContentSelectors) { // Attention: this ctor is called as top level function. // Putting any logic in here will destroy closure tree shaking! super(); this.selector = selector; this.componentType = componentType; this._inputs = _inputs; this._outputs = _outputs; this.ngContentSelectors = ngContentSelectors; this.viewDefFactory = viewDefFactory; } /** * @return {?} */ get inputs() { const /** @type {?} */ inputsArr = []; const /** @type {?} */ inputs = /** @type {?} */ ((this._inputs)); for (let /** @type {?} */ propName in inputs) { const /** @type {?} */ templateName = inputs[propName]; inputsArr.push({ propName, templateName }); } return inputsArr; } /** * @return {?} */ get outputs() { const /** @type {?} */ outputsArr = []; for (let /** @type {?} */ propName in this._outputs) { const /** @type {?} */ templateName = this._outputs[propName]; outputsArr.push({ propName, templateName }); } return outputsArr; } /** * Creates a new component. * @param {?} injector * @param {?=} projectableNodes * @param {?=} rootSelectorOrNode * @param {?=} ngModule * @return {?} */ create(injector, projectableNodes, rootSelectorOrNode, ngModule) { if (!ngModule) { throw new Error('ngModule should be provided'); } const /** @type {?} */ viewDef = resolveDefinition(this.viewDefFactory); const /** @type {?} */ componentNodeIndex = /** @type {?} */ ((/** @type {?} */ ((viewDef.nodes[0].element)).componentProvider)).nodeIndex; const /** @type {?} */ view = Services.createRootView(injector, projectableNodes || [], rootSelectorOrNode, viewDef, ngModule, EMPTY_CONTEXT); const /** @type {?} */ component = asProviderData(view, componentNodeIndex).instance; if (rootSelectorOrNode) { view.renderer.setAttribute(asElementData(view, 0).renderElement, 'ng-version', VERSION.full); } return new ComponentRef_(view, new ViewRef_(view), component); } } class ComponentRef_ extends ComponentRef { /** * @param {?} _view * @param {?} _viewRef * @param {?} _component */ constructor(_view, _viewRef, _component) { super(); this._view = _view; this._viewRef = _viewRef; this._component = _component; this._elDef = this._view.def.nodes[0]; this.hostView = _viewRef; this.changeDetectorRef = _viewRef; this.instance = _component; } /** * @return {?} */ get location() { return new ElementRef(asElementData(this._view, this._elDef.nodeIndex).renderElement); } /** * @return {?} */ get injector() { return new Injector_(this._view, this._elDef); } /** * @return {?} */ get componentType() { return /** @type {?} */ (this._component.constructor); } /** * @return {?} */ destroy() { this._viewRef.destroy(); } /** * @param {?} callback * @return {?} */ onDestroy(callback) { this._viewRef.onDestroy(callback); } } /** * @param {?} view * @param {?} elDef * @param {?} elData * @return {?} */ function createViewContainerData(view, elDef, elData) { return new ViewContainerRef_(view, elDef, elData); } class ViewContainerRef_ { /** * @param {?} _view * @param {?} _elDef * @param {?} _data */ constructor(_view, _elDef, _data) { this._view = _view; this._elDef = _elDef; this._data = _data; /** * \@internal */ this._embeddedViews = []; } /** * @return {?} */ get element() { return new ElementRef(this._data.renderElement); } /** * @return {?} */ get injector() { return new Injector_(this._view, this._elDef); } /** * @return {?} */ get parentInjector() { let /** @type {?} */ view = this._view; let /** @type {?} */ elDef = this._elDef.parent; while (!elDef && view) { elDef = viewParentEl(view); view = /** @type {?} */ ((view.parent)); } return view ? new Injector_(view, elDef) : new Injector_(this._view, null); } /** * @return {?} */ clear() { const /** @type {?} */ len = this._embeddedViews.length; for (let /** @type {?} */ i = len - 1; i >= 0; i--) { const /** @type {?} */ view = /** @type {?} */ ((detachEmbeddedView(this._data, i))); Services.destroyView(view); } } /** * @param {?} index * @return {?} */ get(index) { const /** @type {?} */ view = this._embeddedViews[index]; if (view) { const /** @type {?} */ ref = new ViewRef_(view); ref.attachToViewContainerRef(this); return ref; } return null; } /** * @return {?} */ get length() { return this._embeddedViews.length; } /** * @template C * @param {?} templateRef * @param {?=} context * @param {?=} index * @return {?} */ createEmbeddedView(templateRef, context, index) { const /** @type {?} */ viewRef = templateRef.createEmbeddedView(context || /** @type {?} */ ({})); this.insert(viewRef, index); return viewRef; } /** * @template C * @param {?} componentFactory * @param {?=} index * @param {?=} injector * @param {?=} projectableNodes * @param {?=} ngModuleRef * @return {?} */ createComponent(componentFactory, index, injector, projectableNodes, ngModuleRef) { const /** @type {?} */ contextInjector = injector || this.parentInjector; if (!ngModuleRef && !(componentFactory instanceof ComponentFactoryBoundToModule)) { ngModuleRef = contextInjector.get(NgModuleRef); } const /** @type {?} */ componentRef = componentFactory.create(contextInjector, projectableNodes, undefined, ngModuleRef); this.insert(componentRef.hostView, index); return componentRef; } /** * @param {?} viewRef * @param {?=} index * @return {?} */ insert(viewRef, index) { if (viewRef.destroyed) { throw new Error('Cannot insert a destroyed View in a ViewContainer!'); } const /** @type {?} */ viewRef_ = /** @type {?} */ (viewRef); const /** @type {?} */ viewData = viewRef_._view; attachEmbeddedView(this._view, this._data, index, viewData); viewRef_.attachToViewContainerRef(this); return viewRef; } /** * @param {?} viewRef * @param {?} currentIndex * @return {?} */ move(viewRef, currentIndex) { if (viewRef.destroyed) { throw new Error('Cannot move a destroyed View in a ViewContainer!'); } const /** @type {?} */ previousIndex = this._embeddedViews.indexOf(viewRef._view); moveEmbeddedView(this._data, previousIndex, currentIndex); return viewRef; } /** * @param {?} viewRef * @return {?} */ indexOf(viewRef) { return this._embeddedViews.indexOf((/** @type {?} */ (viewRef))._view); } /** * @param {?=} index * @return {?} */ remove(index) { const /** @type {?} */ viewData = detachEmbeddedView(this._data, index); if (viewData) { Services.destroyView(viewData); } } /** * @param {?=} index * @return {?} */ detach(index) { const /** @type {?} */ view = detachEmbeddedView(this._data, index); return view ? new ViewRef_(view) : null; } } /** * @param {?} view * @return {?} */ function createChangeDetectorRef(view) { return new ViewRef_(view); } class ViewRef_ { /** * @param {?} _view */ constructor(_view) { this._view = _view; this._viewContainerRef = null; this._appRef = null; } /** * @return {?} */ get rootNodes() { return rootRenderNodes(this._view); } /** * @return {?} */ get context() { return this._view.context; } /** * @return {?} */ get destroyed() { return (this._view.state & 128 /* Destroyed */) !== 0; } /** * @return {?} */ markForCheck() { markParentViewsForCheck(this._view); } /** * @return {?} */ detach() { this._view.state &= ~4 /* Attached */; } /** * @return {?} */ detectChanges() { const /** @type {?} */ fs = this._view.root.rendererFactory; if (fs.begin) { fs.begin(); } try { Services.checkAndUpdateView(this._view); } finally { if (fs.end) { fs.end(); } } } /** * @return {?} */ checkNoChanges() { Services.checkNoChangesView(this._view); } /** * @return {?} */ reattach() { this._view.state |= 4 /* Attached */; } /** * @param {?} callback * @return {?} */ onDestroy(callback) { if (!this._view.disposables) { this._view.disposables = []; } this._view.disposables.push(/** @type {?} */ (callback)); } /** * @return {?} */ destroy() { if (this._appRef) { this._appRef.detachView(this); } else if (this._viewContainerRef) { this._viewContainerRef.detach(this._viewContainerRef.indexOf(this)); } Services.destroyView(this._view); } /** * @return {?} */ detachFromAppRef() { this._appRef = null; renderDetachView(this._view); Services.dirtyParentQueries(this._view); } /** * @param {?} appRef * @return {?} */ attachToAppRef(appRef) { if (this._viewContainerRef) { throw new Error('This view is already attached to a ViewContainer!'); } this._appRef = appRef; } /** * @param {?} vcRef * @return {?} */ attachToViewContainerRef(vcRef) { if (this._appRef) { throw new Error('This view is already attached directly to the ApplicationRef!'); } this._viewContainerRef = vcRef; } } /** * @param {?} view * @param {?} def * @return {?} */ function createTemplateData(view, def) { return new TemplateRef_(view, def); } class TemplateRef_ extends TemplateRef { /** * @param {?} _parentView * @param {?} _def */ constructor(_parentView, _def) { super(); this._parentView = _parentView; this._def = _def; } /** * @param {?} context * @return {?} */ createEmbeddedView(context) { return new ViewRef_(Services.createEmbeddedView(this._parentView, this._def, /** @type {?} */ ((/** @type {?} */ ((this._def.element)).template)), context)); } /** * @return {?} */ get elementRef() { return new ElementRef(asElementData(this._parentView, this._def.nodeIndex).renderElement); } } /** * @param {?} view * @param {?} elDef * @return {?} */ function createInjector(view, elDef) { return new Injector_(view, elDef); } class Injector_ { /** * @param {?} view * @param {?} elDef */ constructor(view, elDef) { this.view = view; this.elDef = elDef; } /** * @param {?} token * @param {?=} notFoundValue * @return {?} */ get(token, notFoundValue = Injector.THROW_IF_NOT_FOUND) { const /** @type {?} */ allowPrivateServices = this.elDef ? (this.elDef.flags & 33554432 /* ComponentView */) !== 0 : false; return Services.resolveDep(this.view, this.elDef, allowPrivateServices, { flags: 0 /* None */, token, tokenKey: tokenKey(token) }, notFoundValue); } } /** * @param {?} view * @param {?} index * @return {?} */ function nodeValue(view, index) { const /** @type {?} */ def = view.def.nodes[index]; if (def.flags & 1 /* TypeElement */) { const /** @type {?} */ elData = asElementData(view, def.nodeIndex); return /** @type {?} */ ((def.element)).template ? elData.template : elData.renderElement; } else if (def.flags & 2 /* TypeText */) { return asTextData(view, def.nodeIndex).renderText; } else if (def.flags & (20224 /* CatProvider */ | 16 /* TypePipe */)) { return asProviderData(view, def.nodeIndex).instance; } throw new Error(`Illegal state: read nodeValue for node index ${index}`); } /** * @param {?} view * @return {?} */ function createRendererV1(view) { return new RendererAdapter(view.renderer); } class RendererAdapter { /** * @param {?} delegate */ constructor(delegate) { this.delegate = delegate; } /** * @param {?} selectorOrNode * @return {?} */ selectRootElement(selectorOrNode) { return this.delegate.selectRootElement(selectorOrNode); } /** * @param {?} parent * @param {?} namespaceAndName * @return {?} */ createElement(parent, namespaceAndName) { const [ns, name] = splitNamespace(namespaceAndName); const /** @type {?} */ el = this.delegate.createElement(name, ns); if (parent) { this.delegate.appendChild(parent, el); } return el; } /** * @param {?} hostElement * @return {?} */ createViewRoot(hostElement) { return hostElement; } /** * @param {?} parentElement * @return {?} */ createTemplateAnchor(parentElement) { const /** @type {?} */ comment = this.delegate.createComment(''); if (parentElement) { this.delegate.appendChild(parentElement, comment); } return comment; } /** * @param {?} parentElement * @param {?} value * @return {?} */ createText(parentElement, value) { const /** @type {?} */ node = this.delegate.createText(value); if (parentElement) { this.delegate.appendChild(parentElement, node); } return node; } /** * @param {?} parentElement * @param {?} nodes * @return {?} */ projectNodes(parentElement, nodes) { for (let /** @type {?} */ i = 0; i < nodes.length; i++) { this.delegate.appendChild(parentElement, nodes[i]); } } /** * @param {?} node * @param {?} viewRootNodes * @return {?} */ attachViewAfter(node, viewRootNodes) { const /** @type {?} */ parentElement = this.delegate.parentNode(node); const /** @type {?} */ nextSibling = this.delegate.nextSibling(node); for (let /** @type {?} */ i = 0; i < viewRootNodes.length; i++) { this.delegate.insertBefore(parentElement, viewRootNodes[i], nextSibling); } } /** * @param {?} viewRootNodes * @return {?} */ detachView(viewRootNodes) { for (let /** @type {?} */ i = 0; i < viewRootNodes.length; i++) { const /** @type {?} */ node = viewRootNodes[i]; const /** @type {?} */ parentElement = this.delegate.parentNode(node); this.delegate.removeChild(parentElement, node); } } /** * @param {?} hostElement * @param {?} viewAllNodes * @return {?} */ destroyView(hostElement, viewAllNodes) { for (let /** @type {?} */ i = 0; i < viewAllNodes.length; i++) { /** @type {?} */ ((this.delegate.destroyNode))(viewAllNodes[i]); } } /** * @param {?} renderElement * @param {?} name * @param {?} callback * @return {?} */ listen(renderElement, name, callback) { return this.delegate.listen(renderElement, name, /** @type {?} */ (callback)); } /** * @param {?} target * @param {?} name * @param {?} callback * @return {?} */ listenGlobal(target, name, callback) { return this.delegate.listen(target, name, /** @type {?} */ (callback)); } /** * @param {?} renderElement * @param {?} propertyName * @param {?} propertyValue * @return {?} */ setElementProperty(renderElement, propertyName, propertyValue) { this.delegate.setProperty(renderElement, propertyName, propertyValue); } /** * @param {?} renderElement * @param {?} namespaceAndName * @param {?} attributeValue * @return {?} */ setElementAttribute(renderElement, namespaceAndName, attributeValue) { const [ns, name] = splitNamespace(namespaceAndName); if (attributeValue != null) { this.delegate.setAttribute(renderElement, name, attributeValue, ns); } else { this.delegate.removeAttribute(renderElement, name, ns); } } /** * @param {?} renderElement * @param {?} propertyName * @param {?} propertyValue * @return {?} */ setBindingDebugInfo(renderElement, propertyName, propertyValue) { } /** * @param {?} renderElement * @param {?} className * @param {?} isAdd * @return {?} */ setElementClass(renderElement, className, isAdd) { if (isAdd) { this.delegate.addClass(renderElement, className); } else { this.delegate.removeClass(renderElement, className); } } /** * @param {?} renderElement * @param {?} styleName * @param {?} styleValue * @return {?} */ setElementStyle(renderElement, styleName, styleValue) { if (styleValue != null) { this.delegate.setStyle(renderElement, styleName, styleValue); } else { this.delegate.removeStyle(renderElement, styleName); } } /** * @param {?} renderElement * @param {?} methodName * @param {?} args * @return {?} */ invokeElementMethod(renderElement, methodName, args) { (/** @type {?} */ (renderElement))[methodName].apply(renderElement, args); } /** * @param {?} renderNode * @param {?} text * @return {?} */ setText(renderNode$$1, text) { this.delegate.setValue(renderNode$$1, text); } /** * @return {?} */ animate() { throw new Error('Renderer.animate is no longer supported!'); } } /** * @param {?} moduleType * @param {?} parent * @param {?} bootstrapComponents * @param {?} def * @return {?} */ function createNgModuleRef(moduleType, parent, bootstrapComponents, def) { return new NgModuleRef_(moduleType, parent, bootstrapComponents, def); } class NgModuleRef_ { /** * @param {?} _moduleType * @param {?} _parent * @param {?} _bootstrapComponents * @param {?} _def */ constructor(_moduleType, _parent, _bootstrapComponents, _def) { this._moduleType = _moduleType; this._parent = _parent; this._bootstrapComponents = _bootstrapComponents; this._def = _def; this._destroyListeners = []; this._destroyed = false; this.injector = this; initNgModule(this); } /** * @param {?} token * @param {?=} notFoundValue * @return {?} */ get(token, notFoundValue = Injector.THROW_IF_NOT_FOUND) { return resolveNgModuleDep(this, { token: token, tokenKey: tokenKey(token), flags: 0 /* None */ }, notFoundValue); } /** * @return {?} */ get instance() { return this.get(this._moduleType); } /** * @return {?} */ get componentFactoryResolver() { return this.get(ComponentFactoryResolver); } /** * @return {?} */ destroy() { if (this._destroyed) { throw new Error(`The ng module ${stringify(this.instance.constructor)} has already been destroyed.`); } this._destroyed = true; callNgModuleLifecycle(this, 131072 /* OnDestroy */); this._destroyListeners.forEach((listener) => listener()); } /** * @param {?} callback * @return {?} */ onDestroy(callback) { this._destroyListeners.push(callback); } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ const RendererV1TokenKey = tokenKey(Renderer); const Renderer2TokenKey = tokenKey(Renderer2); const ElementRefTokenKey = tokenKey(ElementRef); const ViewContainerRefTokenKey = tokenKey(ViewContainerRef); const TemplateRefTokenKey = tokenKey(TemplateRef); const ChangeDetectorRefTokenKey = tokenKey(ChangeDetectorRef); const InjectorRefTokenKey = tokenKey(Injector); /** * @param {?} checkIndex * @param {?} flags * @param {?} matchedQueries * @param {?} childCount * @param {?} ctor * @param {?} deps * @param {?=} props * @param {?=} outputs * @return {?} */ function directiveDef(checkIndex, flags, matchedQueries, childCount, ctor, deps, props, outputs) { const /** @type {?} */ bindings = []; if (props) { for (let /** @type {?} */ prop in props) { const [bindingIndex, nonMinifiedName] = props[prop]; bindings[bindingIndex] = { flags: 8 /* TypeProperty */, name: prop, nonMinifiedName, ns: null, securityContext: null, suffix: null }; } } const /** @type {?} */ outputDefs = []; if (outputs) { for (let /** @type {?} */ propName in outputs) { outputDefs.push({ type: 1 /* DirectiveOutput */, propName, target: null, eventName: outputs[propName] }); } } flags |= 16384 /* TypeDirective */; return _def(checkIndex, flags, matchedQueries, childCount, ctor, ctor, deps, bindings, outputDefs); } /** * @param {?} flags * @param {?} ctor * @param {?} deps * @return {?} */ function pipeDef(flags, ctor, deps) { flags |= 16 /* TypePipe */; return _def(-1, flags, null, 0, ctor, ctor, deps); } /** * @param {?} flags * @param {?} matchedQueries * @param {?} token * @param {?} value * @param {?} deps * @return {?} */ function providerDef(flags, matchedQueries, token, value, deps) { return _def(-1, flags, matchedQueries, 0, token, value, deps); } /** * @param {?} checkIndex * @param {?} flags * @param {?} matchedQueriesDsl * @param {?} childCount * @param {?} token * @param {?} value * @param {?} deps * @param {?=} bindings * @param {?=} outputs * @return {?} */ function _def(checkIndex, flags, matchedQueriesDsl, childCount, token, value, deps, bindings, outputs) { const { matchedQueries, references, matchedQueryIds } = splitMatchedQueriesDsl(matchedQueriesDsl); if (!outputs) { outputs = []; } if (!bindings) { bindings = []; } // Need to resolve forwardRefs as e.g. for `useValue` we // lowered the expression and then stopped evaluating it, // i.e. also didn't unwrap it. value = resolveForwardRef(value); const /** @type {?} */ depDefs = splitDepsDsl(deps, stringify(token)); return { // will bet set by the view definition nodeIndex: -1, parent: null, renderParent: null, bindingIndex: -1, outputIndex: -1, // regular values checkIndex, flags, childFlags: 0, directChildFlags: 0, childMatchedQueries: 0, matchedQueries, matchedQueryIds, references, ngContentIndex: -1, childCount, bindings, bindingFlags: calcBindingFlags(bindings), outputs, element: null, provider: { token, value, deps: depDefs }, text: null, query: null, ngContent: null }; } /** * @param {?} view * @param {?} def * @return {?} */ function createProviderInstance(view, def) { return _createProviderInstance(view, def); } /** * @param {?} view * @param {?} def * @return {?} */ function createPipeInstance(view, def) { // deps are looked up from component. let /** @type {?} */ compView = view; while (compView.parent && !isComponentView(compView)) { compView = compView.parent; } // pipes can see the private services of the component const /** @type {?} */ allowPrivateServices = true; // pipes are always eager and classes! return createClass(/** @type {?} */ ((compView.parent)), /** @type {?} */ ((viewParentEl(compView))), allowPrivateServices, /** @type {?} */ ((def.provider)).value, /** @type {?} */ ((def.provider)).deps); } /** * @param {?} view * @param {?} def * @return {?} */ function createDirectiveInstance(view, def) { // components can see other private services, other directives can't. const /** @type {?} */ allowPrivateServices = (def.flags & 32768 /* Component */) > 0; // directives are always eager and classes! const /** @type {?} */ instance = createClass(view, /** @type {?} */ ((def.parent)), allowPrivateServices, /** @type {?} */ ((def.provider)).value, /** @type {?} */ ((def.provider)).deps); if (def.outputs.length) { for (let /** @type {?} */ i = 0; i < def.outputs.length; i++) { const /** @type {?} */ output = def.outputs[i]; const /** @type {?} */ subscription = instance[/** @type {?} */ ((output.propName))].subscribe(eventHandlerClosure(view, /** @type {?} */ ((def.parent)).nodeIndex, output.eventName)); /** @type {?} */ ((view.disposables))[def.outputIndex + i] = subscription.unsubscribe.bind(subscription); } } return instance; } /** * @param {?} view * @param {?} index * @param {?} eventName * @return {?} */ function eventHandlerClosure(view, index, eventName) { return (event) => dispatchEvent(view, index, eventName, event); } /** * @param {?} view * @param {?} def * @param {?} v0 * @param {?} v1 * @param {?} v2 * @param {?} v3 * @param {?} v4 * @param {?} v5 * @param {?} v6 * @param {?} v7 * @param {?} v8 * @param {?} v9 * @return {?} */ function checkAndUpdateDirectiveInline(view, def, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) { const /** @type {?} */ providerData = asProviderData(view, def.nodeIndex); const /** @type {?} */ directive = providerData.instance; let /** @type {?} */ changed = false; let /** @type {?} */ changes = /** @type {?} */ ((undefined)); const /** @type {?} */ bindLen = def.bindings.length; if (bindLen > 0 && checkBinding(view, def, 0, v0)) { changed = true; changes = updateProp(view, providerData, def, 0, v0, changes); } if (bindLen > 1 && checkBinding(view, def, 1, v1)) { changed = true; changes = updateProp(view, providerData, def, 1, v1, changes); } if (bindLen > 2 && checkBinding(view, def, 2, v2)) { changed = true; changes = updateProp(view, providerData, def, 2, v2, changes); } if (bindLen > 3 && checkBinding(view, def, 3, v3)) { changed = true; changes = updateProp(view, providerData, def, 3, v3, changes); } if (bindLen > 4 && checkBinding(view, def, 4, v4)) { changed = true; changes = updateProp(view, providerData, def, 4, v4, changes); } if (bindLen > 5 && checkBinding(view, def, 5, v5)) { changed = true; changes = updateProp(view, providerData, def, 5, v5, changes); } if (bindLen > 6 && checkBinding(view, def, 6, v6)) { changed = true; changes = updateProp(view, providerData, def, 6, v6, changes); } if (bindLen > 7 && checkBinding(view, def, 7, v7)) { changed = true; changes = updateProp(view, providerData, def, 7, v7, changes); } if (bindLen > 8 && checkBinding(view, def, 8, v8)) { changed = true; changes = updateProp(view, providerData, def, 8, v8, changes); } if (bindLen > 9 && checkBinding(view, def, 9, v9)) { changed = true; changes = updateProp(view, providerData, def, 9, v9, changes); } if (changes) { directive.ngOnChanges(changes); } if ((def.flags & 65536 /* OnInit */) && shouldCallLifecycleInitHook(view, 256 /* InitState_CallingOnInit */, def.nodeIndex)) { directive.ngOnInit(); } if (def.flags & 262144 /* DoCheck */) { directive.ngDoCheck(); } return changed; } /** * @param {?} view * @param {?} def * @param {?} values * @return {?} */ function checkAndUpdateDirectiveDynamic(view, def, values) { const /** @type {?} */ providerData = asProviderData(view, def.nodeIndex); const /** @type {?} */ directive = providerData.instance; let /** @type {?} */ changed = false; let /** @type {?} */ changes = /** @type {?} */ ((undefined)); for (let /** @type {?} */ i = 0; i < values.length; i++) { if (checkBinding(view, def, i, values[i])) { changed = true; changes = updateProp(view, providerData, def, i, values[i], changes); } } if (changes) { directive.ngOnChanges(changes); } if ((def.flags & 65536 /* OnInit */) && shouldCallLifecycleInitHook(view, 256 /* InitState_CallingOnInit */, def.nodeIndex)) { directive.ngOnInit(); } if (def.flags & 262144 /* DoCheck */) { directive.ngDoCheck(); } return changed; } /** * @param {?} view * @param {?} def * @return {?} */ function _createProviderInstance(view, def) { // private services can see other private services const /** @type {?} */ allowPrivateServices = (def.flags & 8192 /* PrivateProvider */) > 0; const /** @type {?} */ providerDef = def.provider; switch (def.flags & 201347067 /* Types */) { case 512 /* TypeClassProvider */: return createClass(view, /** @type {?} */ ((def.parent)), allowPrivateServices, /** @type {?} */ ((providerDef)).value, /** @type {?} */ ((providerDef)).deps); case 1024 /* TypeFactoryProvider */: return callFactory(view, /** @type {?} */ ((def.parent)), allowPrivateServices, /** @type {?} */ ((providerDef)).value, /** @type {?} */ ((providerDef)).deps); case 2048 /* TypeUseExistingProvider */: return resolveDep(view, /** @type {?} */ ((def.parent)), allowPrivateServices, /** @type {?} */ ((providerDef)).deps[0]); case 256 /* TypeValueProvider */: return /** @type {?} */ ((providerDef)).value; } } /** * @param {?} view * @param {?} elDef * @param {?} allowPrivateServices * @param {?} ctor * @param {?} deps * @return {?} */ function createClass(view, elDef, allowPrivateServices, ctor, deps) { const /** @type {?} */ len = deps.length; switch (len) { case 0: return new ctor(); case 1: return new ctor(resolveDep(view, elDef, allowPrivateServices, deps[0])); case 2: return new ctor(resolveDep(view, elDef, allowPrivateServices, deps[0]), resolveDep(view, elDef, allowPrivateServices, deps[1])); case 3: return new ctor(resolveDep(view, elDef, allowPrivateServices, deps[0]), resolveDep(view, elDef, allowPrivateServices, deps[1]), resolveDep(view, elDef, allowPrivateServices, deps[2])); default: const /** @type {?} */ depValues = new Array(len); for (let /** @type {?} */ i = 0; i < len; i++) { depValues[i] = resolveDep(view, elDef, allowPrivateServices, deps[i]); } return new ctor(...depValues); } } /** * @param {?} view * @param {?} elDef * @param {?} allowPrivateServices * @param {?} factory * @param {?} deps * @return {?} */ function callFactory(view, elDef, allowPrivateServices, factory, deps) { const /** @type {?} */ len = deps.length; switch (len) { case 0: return factory(); case 1: return factory(resolveDep(view, elDef, allowPrivateServices, deps[0])); case 2: return factory(resolveDep(view, elDef, allowPrivateServices, deps[0]), resolveDep(view, elDef, allowPrivateServices, deps[1])); case 3: return factory(resolveDep(view, elDef, allowPrivateServices, deps[0]), resolveDep(view, elDef, allowPrivateServices, deps[1]), resolveDep(view, elDef, allowPrivateServices, deps[2])); default: const /** @type {?} */ depValues = Array(len); for (let /** @type {?} */ i = 0; i < len; i++) { depValues[i] = resolveDep(view, elDef, allowPrivateServices, deps[i]); } return factory(...depValues); } } // This default value is when checking the hierarchy for a token. // // It means both: // - the token is not provided by the current injector, // - only the element injectors should be checked (ie do not check module injectors // // mod1 // / // el1 mod2 // \ / // el2 // // When requesting el2.injector.get(token), we should check in the following order and return the // first found value: // - el2.injector.get(token, default) // - el1.injector.get(token, NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR) -> do not check the module // - mod2.injector.get(token, default) const NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR = {}; /** * @param {?} view * @param {?} elDef * @param {?} allowPrivateServices * @param {?} depDef * @param {?=} notFoundValue * @return {?} */ function resolveDep(view, elDef, allowPrivateServices, depDef, notFoundValue = Injector.THROW_IF_NOT_FOUND) { if (depDef.flags & 8 /* Value */) { return depDef.token; } const /** @type {?} */ startView = view; if (depDef.flags & 2 /* Optional */) { notFoundValue = null; } const /** @type {?} */ tokenKey$$1 = depDef.tokenKey; if (tokenKey$$1 === ChangeDetectorRefTokenKey) { // directives on the same element as a component should be able to control the change detector // of that component as well. allowPrivateServices = !!(elDef && /** @type {?} */ ((elDef.element)).componentView); } if (elDef && (depDef.flags & 1 /* SkipSelf */)) { allowPrivateServices = false; elDef = /** @type {?} */ ((elDef.parent)); } while (view) { if (elDef) { switch (tokenKey$$1) { case RendererV1TokenKey: { const /** @type {?} */ compView = findCompView(view, elDef, allowPrivateServices); return createRendererV1(compView); } case Renderer2TokenKey: { const /** @type {?} */ compView = findCompView(view, elDef, allowPrivateServices); return compView.renderer; } case ElementRefTokenKey: return new ElementRef(asElementData(view, elDef.nodeIndex).renderElement); case ViewContainerRefTokenKey: return asElementData(view, elDef.nodeIndex).viewContainer; case TemplateRefTokenKey: { if (/** @type {?} */ ((elDef.element)).template) { return asElementData(view, elDef.nodeIndex).template; } break; } case ChangeDetectorRefTokenKey: { let /** @type {?} */ cdView = findCompView(view, elDef, allowPrivateServices); return createChangeDetectorRef(cdView); } case InjectorRefTokenKey: return createInjector(view, elDef); default: const /** @type {?} */ providerDef = /** @type {?} */ (((allowPrivateServices ? /** @type {?} */ ((elDef.element)).allProviders : /** @type {?} */ ((elDef.element)).publicProviders)))[tokenKey$$1]; if (providerDef) { let /** @type {?} */ providerData = asProviderData(view, providerDef.nodeIndex); if (!providerData) { providerData = { instance: _createProviderInstance(view, providerDef) }; view.nodes[providerDef.nodeIndex] = /** @type {?} */ (providerData); } return providerData.instance; } } } allowPrivateServices = isComponentView(view); elDef = /** @type {?} */ ((viewParentEl(view))); view = /** @type {?} */ ((view.parent)); } const /** @type {?} */ value = startView.root.injector.get(depDef.token, NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR); if (value !== NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR || notFoundValue === NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR) { // Return the value from the root element injector when // - it provides it // (value !== NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR) // - the module injector should not be checked // (notFoundValue === NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR) return value; } return startView.root.ngModule.injector.get(depDef.token, notFoundValue); } /** * @param {?} view * @param {?} elDef * @param {?} allowPrivateServices * @return {?} */ function findCompView(view, elDef, allowPrivateServices) { let /** @type {?} */ compView; if (allowPrivateServices) { compView = asElementData(view, elDef.nodeIndex).componentView; } else { compView = view; while (compView.parent && !isComponentView(compView)) { compView = compView.parent; } } return compView; } /** * @param {?} view * @param {?} providerData * @param {?} def * @param {?} bindingIdx * @param {?} value * @param {?} changes * @return {?} */ function updateProp(view, providerData, def, bindingIdx, value, changes) { if (def.flags & 32768 /* Component */) { const /** @type {?} */ compView = asElementData(view, /** @type {?} */ ((def.parent)).nodeIndex).componentView; if (compView.def.flags & 2 /* OnPush */) { compView.state |= 8 /* ChecksEnabled */; } } const /** @type {?} */ binding = def.bindings[bindingIdx]; const /** @type {?} */ propName = /** @type {?} */ ((binding.name)); // Note: This is still safe with Closure Compiler as // the user passed in the property name as an object has to `providerDef`, // so Closure Compiler will have renamed the property correctly already. providerData.instance[propName] = value; if (def.flags & 524288 /* OnChanges */) { changes = changes || {}; const /** @type {?} */ oldValue = WrappedValue.unwrap(view.oldValues[def.bindingIndex + bindingIdx]); const /** @type {?} */ binding = def.bindings[bindingIdx]; changes[/** @type {?} */ ((binding.nonMinifiedName))] = new SimpleChange(oldValue, value, (view.state & 2 /* FirstCheck */) !== 0); } view.oldValues[def.bindingIndex + bindingIdx] = value; return changes; } /** * @param {?} view * @param {?} lifecycles * @return {?} */ function callLifecycleHooksChildrenFirst(view, lifecycles) { if (!(view.def.nodeFlags & lifecycles)) { return; } const /** @type {?} */ nodes = view.def.nodes; let /** @type {?} */ initIndex = 0; for (let /** @type {?} */ i = 0; i < nodes.length; i++) { const /** @type {?} */ nodeDef = nodes[i]; let /** @type {?} */ parent = nodeDef.parent; if (!parent && nodeDef.flags & lifecycles) { // matching root node (e.g. a pipe) callProviderLifecycles(view, i, nodeDef.flags & lifecycles, initIndex++); } if ((nodeDef.childFlags & lifecycles) === 0) { // no child matches one of the lifecycles i += nodeDef.childCount; } while (parent && (parent.flags & 1 /* TypeElement */) && i === parent.nodeIndex + parent.childCount) { // last child of an element if (parent.directChildFlags & lifecycles) { initIndex = callElementProvidersLifecycles(view, parent, lifecycles, initIndex); } parent = parent.parent; } } } /** * @param {?} view * @param {?} elDef * @param {?} lifecycles * @param {?} initIndex * @return {?} */ function callElementProvidersLifecycles(view, elDef, lifecycles, initIndex) { for (let /** @type {?} */ i = elDef.nodeIndex + 1; i <= elDef.nodeIndex + elDef.childCount; i++) { const /** @type {?} */ nodeDef = view.def.nodes[i]; if (nodeDef.flags & lifecycles) { callProviderLifecycles(view, i, nodeDef.flags & lifecycles, initIndex++); } // only visit direct children i += nodeDef.childCount; } return initIndex; } /** * @param {?} view * @param {?} index * @param {?} lifecycles * @param {?} initIndex * @return {?} */ function callProviderLifecycles(view, index, lifecycles, initIndex) { const /** @type {?} */ providerData = asProviderData(view, index); if (!providerData) { return; } const /** @type {?} */ provider = providerData.instance; if (!provider) { return; } Services.setCurrentNode(view, index); if (lifecycles & 1048576 /* AfterContentInit */ && shouldCallLifecycleInitHook(view, 512 /* InitState_CallingAfterContentInit */, initIndex)) { provider.ngAfterContentInit(); } if (lifecycles & 2097152 /* AfterContentChecked */) { provider.ngAfterContentChecked(); } if (lifecycles & 4194304 /* AfterViewInit */ && shouldCallLifecycleInitHook(view, 768 /* InitState_CallingAfterViewInit */, initIndex)) { provider.ngAfterViewInit(); } if (lifecycles & 8388608 /* AfterViewChecked */) { provider.ngAfterViewChecked(); } if (lifecycles & 131072 /* OnDestroy */) { provider.ngOnDestroy(); } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @param {?} flags * @param {?} id * @param {?} bindings * @return {?} */ function queryDef(flags, id, bindings) { let /** @type {?} */ bindingDefs = []; for (let /** @type {?} */ propName in bindings) { const /** @type {?} */ bindingType = bindings[propName]; bindingDefs.push({ propName, bindingType }); } return { // will bet set by the view definition nodeIndex: -1, parent: null, renderParent: null, bindingIndex: -1, outputIndex: -1, // regular values // TODO(vicb): check checkIndex: -1, flags, childFlags: 0, directChildFlags: 0, childMatchedQueries: 0, ngContentIndex: -1, matchedQueries: {}, matchedQueryIds: 0, references: {}, childCount: 0, bindings: [], bindingFlags: 0, outputs: [], element: null, provider: null, text: null, query: { id, filterId: filterQueryId(id), bindings: bindingDefs }, ngContent: null }; } /** * @return {?} */ function createQuery() { return new QueryList(); } /** * @param {?} view * @return {?} */ function dirtyParentQueries(view) { const /** @type {?} */ queryIds = view.def.nodeMatchedQueries; while (view.parent && isEmbeddedView(view)) { let /** @type {?} */ tplDef = /** @type {?} */ ((view.parentNodeDef)); view = view.parent; // content queries const /** @type {?} */ end = tplDef.nodeIndex + tplDef.childCount; for (let /** @type {?} */ i = 0; i <= end; i++) { const /** @type {?} */ nodeDef = view.def.nodes[i]; if ((nodeDef.flags & 67108864 /* TypeContentQuery */) && (nodeDef.flags & 536870912 /* DynamicQuery */) && (/** @type {?} */ ((nodeDef.query)).filterId & queryIds) === /** @type {?} */ ((nodeDef.query)).filterId) { asQueryList(view, i).setDirty(); } if ((nodeDef.flags & 1 /* TypeElement */ && i + nodeDef.childCount < tplDef.nodeIndex) || !(nodeDef.childFlags & 67108864 /* TypeContentQuery */) || !(nodeDef.childFlags & 536870912 /* DynamicQuery */)) { // skip elements that don't contain the template element or no query. i += nodeDef.childCount; } } } // view queries if (view.def.nodeFlags & 134217728 /* TypeViewQuery */) { for (let /** @type {?} */ i = 0; i < view.def.nodes.length; i++) { const /** @type {?} */ nodeDef = view.def.nodes[i]; if ((nodeDef.flags & 134217728 /* TypeViewQuery */) && (nodeDef.flags & 536870912 /* DynamicQuery */)) { asQueryList(view, i).setDirty(); } // only visit the root nodes i += nodeDef.childCount; } } } /** * @param {?} view * @param {?} nodeDef * @return {?} */ function checkAndUpdateQuery(view, nodeDef) { const /** @type {?} */ queryList = asQueryList(view, nodeDef.nodeIndex); if (!queryList.dirty) { return; } let /** @type {?} */ directiveInstance; let /** @type {?} */ newValues = /** @type {?} */ ((undefined)); if (nodeDef.flags & 67108864 /* TypeContentQuery */) { const /** @type {?} */ elementDef = /** @type {?} */ ((/** @type {?} */ ((nodeDef.parent)).parent)); newValues = calcQueryValues(view, elementDef.nodeIndex, elementDef.nodeIndex + elementDef.childCount, /** @type {?} */ ((nodeDef.query)), []); directiveInstance = asProviderData(view, /** @type {?} */ ((nodeDef.parent)).nodeIndex).instance; } else if (nodeDef.flags & 134217728 /* TypeViewQuery */) { newValues = calcQueryValues(view, 0, view.def.nodes.length - 1, /** @type {?} */ ((nodeDef.query)), []); directiveInstance = view.component; } queryList.reset(newValues); const /** @type {?} */ bindings = /** @type {?} */ ((nodeDef.query)).bindings; let /** @type {?} */ notify = false; for (let /** @type {?} */ i = 0; i < bindings.length; i++) { const /** @type {?} */ binding = bindings[i]; let /** @type {?} */ boundValue; switch (binding.bindingType) { case 0 /* First */: boundValue = queryList.first; break; case 1 /* All */: boundValue = queryList; notify = true; break; } directiveInstance[binding.propName] = boundValue; } if (notify) { queryList.notifyOnChanges(); } } /** * @param {?} view * @param {?} startIndex * @param {?} endIndex * @param {?} queryDef * @param {?} values * @return {?} */ function calcQueryValues(view, startIndex, endIndex, queryDef, values) { for (let /** @type {?} */ i = startIndex; i <= endIndex; i++) { const /** @type {?} */ nodeDef = view.def.nodes[i]; const /** @type {?} */ valueType = nodeDef.matchedQueries[queryDef.id]; if (valueType != null) { values.push(getQueryValue(view, nodeDef, valueType)); } if (nodeDef.flags & 1 /* TypeElement */ && /** @type {?} */ ((nodeDef.element)).template && (/** @type {?} */ ((/** @type {?} */ ((nodeDef.element)).template)).nodeMatchedQueries & queryDef.filterId) === queryDef.filterId) { const /** @type {?} */ elementData = asElementData(view, i); // check embedded views that were attached at the place of their template, // but process child nodes first if some match the query (see issue #16568) if ((nodeDef.childMatchedQueries & queryDef.filterId) === queryDef.filterId) { calcQueryValues(view, i + 1, i + nodeDef.childCount, queryDef, values); i += nodeDef.childCount; } if (nodeDef.flags & 16777216 /* EmbeddedViews */) { const /** @type {?} */ embeddedViews = /** @type {?} */ ((elementData.viewContainer))._embeddedViews; for (let /** @type {?} */ k = 0; k < embeddedViews.length; k++) { const /** @type {?} */ embeddedView = embeddedViews[k]; const /** @type {?} */ dvc = declaredViewContainer(embeddedView); if (dvc && dvc === elementData) { calcQueryValues(embeddedView, 0, embeddedView.def.nodes.length - 1, queryDef, values); } } } const /** @type {?} */ projectedViews = elementData.template._projectedViews; if (projectedViews) { for (let /** @type {?} */ k = 0; k < projectedViews.length; k++) { const /** @type {?} */ projectedView = projectedViews[k]; calcQueryValues(projectedView, 0, projectedView.def.nodes.length - 1, queryDef, values); } } } if ((nodeDef.childMatchedQueries & queryDef.filterId) !== queryDef.filterId) { // if no child matches the query, skip the children. i += nodeDef.childCount; } } return values; } /** * @param {?} view * @param {?} nodeDef * @param {?} queryValueType * @return {?} */ function getQueryValue(view, nodeDef, queryValueType) { if (queryValueType != null) { // a match switch (queryValueType) { case 1 /* RenderElement */: return asElementData(view, nodeDef.nodeIndex).renderElement; case 0 /* ElementRef */: return new ElementRef(asElementData(view, nodeDef.nodeIndex).renderElement); case 2 /* TemplateRef */: return asElementData(view, nodeDef.nodeIndex).template; case 3 /* ViewContainerRef */: return asElementData(view, nodeDef.nodeIndex).viewContainer; case 4 /* Provider */: return asProviderData(view, nodeDef.nodeIndex).instance; } } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @param {?} ngContentIndex * @param {?} index * @return {?} */ function ngContentDef(ngContentIndex, index) { return { // will bet set by the view definition nodeIndex: -1, parent: null, renderParent: null, bindingIndex: -1, outputIndex: -1, // regular values checkIndex: -1, flags: 8 /* TypeNgContent */, childFlags: 0, directChildFlags: 0, childMatchedQueries: 0, matchedQueries: {}, matchedQueryIds: 0, references: {}, ngContentIndex, childCount: 0, bindings: [], bindingFlags: 0, outputs: [], element: null, provider: null, text: null, query: null, ngContent: { index } }; } /** * @param {?} view * @param {?} renderHost * @param {?} def * @return {?} */ function appendNgContent(view, renderHost, def) { const /** @type {?} */ parentEl = getParentRenderElement(view, renderHost, def); if (!parentEl) { // Nothing to do if there is no parent element. return; } const /** @type {?} */ ngContentIndex = /** @type {?} */ ((def.ngContent)).index; visitProjectedRenderNodes(view, ngContentIndex, 1 /* AppendChild */, parentEl, null, undefined); } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @param {?} checkIndex * @param {?} argCount * @return {?} */ function purePipeDef(checkIndex, argCount) { // argCount + 1 to include the pipe as first arg return _pureExpressionDef(128 /* TypePurePipe */, checkIndex, new Array(argCount + 1)); } /** * @param {?} checkIndex * @param {?} argCount * @return {?} */ function pureArrayDef(checkIndex, argCount) { return _pureExpressionDef(32 /* TypePureArray */, checkIndex, new Array(argCount)); } /** * @param {?} checkIndex * @param {?} propToIndex * @return {?} */ function pureObjectDef(checkIndex, propToIndex) { const /** @type {?} */ keys = Object.keys(propToIndex); const /** @type {?} */ nbKeys = keys.length; const /** @type {?} */ propertyNames = new Array(nbKeys); for (let /** @type {?} */ i = 0; i < nbKeys; i++) { const /** @type {?} */ key = keys[i]; const /** @type {?} */ index = propToIndex[key]; propertyNames[index] = key; } return _pureExpressionDef(64 /* TypePureObject */, checkIndex, propertyNames); } /** * @param {?} flags * @param {?} checkIndex * @param {?} propertyNames * @return {?} */ function _pureExpressionDef(flags, checkIndex, propertyNames) { const /** @type {?} */ bindings = new Array(propertyNames.length); for (let /** @type {?} */ i = 0; i < propertyNames.length; i++) { const /** @type {?} */ prop = propertyNames[i]; bindings[i] = { flags: 8 /* TypeProperty */, name: prop, ns: null, nonMinifiedName: prop, securityContext: null, suffix: null }; } return { // will bet set by the view definition nodeIndex: -1, parent: null, renderParent: null, bindingIndex: -1, outputIndex: -1, // regular values checkIndex, flags, childFlags: 0, directChildFlags: 0, childMatchedQueries: 0, matchedQueries: {}, matchedQueryIds: 0, references: {}, ngContentIndex: -1, childCount: 0, bindings, bindingFlags: calcBindingFlags(bindings), outputs: [], element: null, provider: null, text: null, query: null, ngContent: null }; } /** * @param {?} view * @param {?} def * @return {?} */ function createPureExpression(view, def) { return { value: undefined }; } /** * @param {?} view * @param {?} def * @param {?} v0 * @param {?} v1 * @param {?} v2 * @param {?} v3 * @param {?} v4 * @param {?} v5 * @param {?} v6 * @param {?} v7 * @param {?} v8 * @param {?} v9 * @return {?} */ function checkAndUpdatePureExpressionInline(view, def, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) { const /** @type {?} */ bindings = def.bindings; let /** @type {?} */ changed = false; const /** @type {?} */ bindLen = bindings.length; if (bindLen > 0 && checkAndUpdateBinding(view, def, 0, v0)) changed = true; if (bindLen > 1 && checkAndUpdateBinding(view, def, 1, v1)) changed = true; if (bindLen > 2 && checkAndUpdateBinding(view, def, 2, v2)) changed = true; if (bindLen > 3 && checkAndUpdateBinding(view, def, 3, v3)) changed = true; if (bindLen > 4 && checkAndUpdateBinding(view, def, 4, v4)) changed = true; if (bindLen > 5 && checkAndUpdateBinding(view, def, 5, v5)) changed = true; if (bindLen > 6 && checkAndUpdateBinding(view, def, 6, v6)) changed = true; if (bindLen > 7 && checkAndUpdateBinding(view, def, 7, v7)) changed = true; if (bindLen > 8 && checkAndUpdateBinding(view, def, 8, v8)) changed = true; if (bindLen > 9 && checkAndUpdateBinding(view, def, 9, v9)) changed = true; if (changed) { const /** @type {?} */ data = asPureExpressionData(view, def.nodeIndex); let /** @type {?} */ value; switch (def.flags & 201347067 /* Types */) { case 32 /* TypePureArray */: value = new Array(bindings.length); if (bindLen > 0) value[0] = v0; if (bindLen > 1) value[1] = v1; if (bindLen > 2) value[2] = v2; if (bindLen > 3) value[3] = v3; if (bindLen > 4) value[4] = v4; if (bindLen > 5) value[5] = v5; if (bindLen > 6) value[6] = v6; if (bindLen > 7) value[7] = v7; if (bindLen > 8) value[8] = v8; if (bindLen > 9) value[9] = v9; break; case 64 /* TypePureObject */: value = {}; if (bindLen > 0) value[/** @type {?} */ ((bindings[0].name))] = v0; if (bindLen > 1) value[/** @type {?} */ ((bindings[1].name))] = v1; if (bindLen > 2) value[/** @type {?} */ ((bindings[2].name))] = v2; if (bindLen > 3) value[/** @type {?} */ ((bindings[3].name))] = v3; if (bindLen > 4) value[/** @type {?} */ ((bindings[4].name))] = v4; if (bindLen > 5) value[/** @type {?} */ ((bindings[5].name))] = v5; if (bindLen > 6) value[/** @type {?} */ ((bindings[6].name))] = v6; if (bindLen > 7) value[/** @type {?} */ ((bindings[7].name))] = v7; if (bindLen > 8) value[/** @type {?} */ ((bindings[8].name))] = v8; if (bindLen > 9) value[/** @type {?} */ ((bindings[9].name))] = v9; break; case 128 /* TypePurePipe */: const /** @type {?} */ pipe = v0; switch (bindLen) { case 1: value = pipe.transform(v0); break; case 2: value = pipe.transform(v1); break; case 3: value = pipe.transform(v1, v2); break; case 4: value = pipe.transform(v1, v2, v3); break; case 5: value = pipe.transform(v1, v2, v3, v4); break; case 6: value = pipe.transform(v1, v2, v3, v4, v5); break; case 7: value = pipe.transform(v1, v2, v3, v4, v5, v6); break; case 8: value = pipe.transform(v1, v2, v3, v4, v5, v6, v7); break; case 9: value = pipe.transform(v1, v2, v3, v4, v5, v6, v7, v8); break; case 10: value = pipe.transform(v1, v2, v3, v4, v5, v6, v7, v8, v9); break; } break; } data.value = value; } return changed; } /** * @param {?} view * @param {?} def * @param {?} values * @return {?} */ function checkAndUpdatePureExpressionDynamic(view, def, values) { const /** @type {?} */ bindings = def.bindings; let /** @type {?} */ changed = false; for (let /** @type {?} */ i = 0; i < values.length; i++) { // Note: We need to loop over all values, so that // the old values are updates as well! if (checkAndUpdateBinding(view, def, i, values[i])) { changed = true; } } if (changed) { const /** @type {?} */ data = asPureExpressionData(view, def.nodeIndex); let /** @type {?} */ value; switch (def.flags & 201347067 /* Types */) { case 32 /* TypePureArray */: value = values; break; case 64 /* TypePureObject */: value = {}; for (let /** @type {?} */ i = 0; i < values.length; i++) { value[/** @type {?} */ ((bindings[i].name))] = values[i]; } break; case 128 /* TypePurePipe */: const /** @type {?} */ pipe = values[0]; const /** @type {?} */ params = values.slice(1); value = (/** @type {?} */ (pipe.transform))(...params); break; } data.value = value; } return changed; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @param {?} checkIndex * @param {?} ngContentIndex * @param {?} staticText * @return {?} */ function textDef(checkIndex, ngContentIndex, staticText) { const /** @type {?} */ bindings = new Array(staticText.length - 1); for (let /** @type {?} */ i = 1; i < staticText.length; i++) { bindings[i - 1] = { flags: 8 /* TypeProperty */, name: null, ns: null, nonMinifiedName: null, securityContext: null, suffix: staticText[i], }; } return { // will bet set by the view definition nodeIndex: -1, parent: null, renderParent: null, bindingIndex: -1, outputIndex: -1, // regular values checkIndex, flags: 2 /* TypeText */, childFlags: 0, directChildFlags: 0, childMatchedQueries: 0, matchedQueries: {}, matchedQueryIds: 0, references: {}, ngContentIndex, childCount: 0, bindings, bindingFlags: 8 /* TypeProperty */, outputs: [], element: null, provider: null, text: { prefix: staticText[0] }, query: null, ngContent: null, }; } /** * @param {?} view * @param {?} renderHost * @param {?} def * @return {?} */ function createText(view, renderHost, def) { let /** @type {?} */ renderNode$$1; const /** @type {?} */ renderer = view.renderer; renderNode$$1 = renderer.createText(/** @type {?} */ ((def.text)).prefix); const /** @type {?} */ parentEl = getParentRenderElement(view, renderHost, def); if (parentEl) { renderer.appendChild(parentEl, renderNode$$1); } return { renderText: renderNode$$1 }; } /** * @param {?} view * @param {?} def * @param {?} v0 * @param {?} v1 * @param {?} v2 * @param {?} v3 * @param {?} v4 * @param {?} v5 * @param {?} v6 * @param {?} v7 * @param {?} v8 * @param {?} v9 * @return {?} */ function checkAndUpdateTextInline(view, def, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) { let /** @type {?} */ changed = false; const /** @type {?} */ bindings = def.bindings; const /** @type {?} */ bindLen = bindings.length; if (bindLen > 0 && checkAndUpdateBinding(view, def, 0, v0)) changed = true; if (bindLen > 1 && checkAndUpdateBinding(view, def, 1, v1)) changed = true; if (bindLen > 2 && checkAndUpdateBinding(view, def, 2, v2)) changed = true; if (bindLen > 3 && checkAndUpdateBinding(view, def, 3, v3)) changed = true; if (bindLen > 4 && checkAndUpdateBinding(view, def, 4, v4)) changed = true; if (bindLen > 5 && checkAndUpdateBinding(view, def, 5, v5)) changed = true; if (bindLen > 6 && checkAndUpdateBinding(view, def, 6, v6)) changed = true; if (bindLen > 7 && checkAndUpdateBinding(view, def, 7, v7)) changed = true; if (bindLen > 8 && checkAndUpdateBinding(view, def, 8, v8)) changed = true; if (bindLen > 9 && checkAndUpdateBinding(view, def, 9, v9)) changed = true; if (changed) { let /** @type {?} */ value = /** @type {?} */ ((def.text)).prefix; if (bindLen > 0) value += _addInterpolationPart(v0, bindings[0]); if (bindLen > 1) value += _addInterpolationPart(v1, bindings[1]); if (bindLen > 2) value += _addInterpolationPart(v2, bindings[2]); if (bindLen > 3) value += _addInterpolationPart(v3, bindings[3]); if (bindLen > 4) value += _addInterpolationPart(v4, bindings[4]); if (bindLen > 5) value += _addInterpolationPart(v5, bindings[5]); if (bindLen > 6) value += _addInterpolationPart(v6, bindings[6]); if (bindLen > 7) value += _addInterpolationPart(v7, bindings[7]); if (bindLen > 8) value += _addInterpolationPart(v8, bindings[8]); if (bindLen > 9) value += _addInterpolationPart(v9, bindings[9]); const /** @type {?} */ renderNode$$1 = asTextData(view, def.nodeIndex).renderText; view.renderer.setValue(renderNode$$1, value); } return changed; } /** * @param {?} view * @param {?} def * @param {?} values * @return {?} */ function checkAndUpdateTextDynamic(view, def, values) { const /** @type {?} */ bindings = def.bindings; let /** @type {?} */ changed = false; for (let /** @type {?} */ i = 0; i < values.length; i++) { // Note: We need to loop over all values, so that // the old values are updates as well! if (checkAndUpdateBinding(view, def, i, values[i])) { changed = true; } } if (changed) { let /** @type {?} */ value = ''; for (let /** @type {?} */ i = 0; i < values.length; i++) { value = value + _addInterpolationPart(values[i], bindings[i]); } value = /** @type {?} */ ((def.text)).prefix + value; const /** @type {?} */ renderNode$$1 = asTextData(view, def.nodeIndex).renderText; view.renderer.setValue(renderNode$$1, value); } return changed; } /** * @param {?} value * @param {?} binding * @return {?} */ function _addInterpolationPart(value, binding) { const /** @type {?} */ valueStr = value != null ? value.toString() : ''; return valueStr + binding.suffix; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @param {?} flags * @param {?} nodes * @param {?=} updateDirectives * @param {?=} updateRenderer * @return {?} */ function viewDef(flags, nodes, updateDirectives, updateRenderer) { // clone nodes and set auto calculated values let /** @type {?} */ viewBindingCount = 0; let /** @type {?} */ viewDisposableCount = 0; let /** @type {?} */ viewNodeFlags = 0; let /** @type {?} */ viewRootNodeFlags = 0; let /** @type {?} */ viewMatchedQueries = 0; let /** @type {?} */ currentParent = null; let /** @type {?} */ currentRenderParent = null; let /** @type {?} */ currentElementHasPublicProviders = false; let /** @type {?} */ currentElementHasPrivateProviders = false; let /** @type {?} */ lastRenderRootNode = null; for (let /** @type {?} */ i = 0; i < nodes.length; i++) { const /** @type {?} */ node = nodes[i]; node.nodeIndex = i; node.parent = currentParent; node.bindingIndex = viewBindingCount; node.outputIndex = viewDisposableCount; node.renderParent = currentRenderParent; viewNodeFlags |= node.flags; viewMatchedQueries |= node.matchedQueryIds; if (node.element) { const /** @type {?} */ elDef = node.element; elDef.publicProviders = currentParent ? /** @type {?} */ ((currentParent.element)).publicProviders : Object.create(null); elDef.allProviders = elDef.publicProviders; // Note: We assume that all providers of an element are before any child element! currentElementHasPublicProviders = false; currentElementHasPrivateProviders = false; if (node.element.template) { viewMatchedQueries |= node.element.template.nodeMatchedQueries; } } validateNode(currentParent, node, nodes.length); viewBindingCount += node.bindings.length; viewDisposableCount += node.outputs.length; if (!currentRenderParent && (node.flags & 3 /* CatRenderNode */)) { lastRenderRootNode = node; } if (node.flags & 20224 /* CatProvider */) { if (!currentElementHasPublicProviders) { currentElementHasPublicProviders = true; /** @type {?} */ ((/** @type {?} */ ((currentParent)).element)).publicProviders = Object.create(/** @type {?} */ ((/** @type {?} */ ((currentParent)).element)).publicProviders); /** @type {?} */ ((/** @type {?} */ ((currentParent)).element)).allProviders = /** @type {?} */ ((/** @type {?} */ ((currentParent)).element)).publicProviders; } const /** @type {?} */ isPrivateService = (node.flags & 8192 /* PrivateProvider */) !== 0; const /** @type {?} */ isComponent = (node.flags & 32768 /* Component */) !== 0; if (!isPrivateService || isComponent) { /** @type {?} */ ((/** @type {?} */ ((/** @type {?} */ ((currentParent)).element)).publicProviders))[tokenKey(/** @type {?} */ ((node.provider)).token)] = node; } else { if (!currentElementHasPrivateProviders) { currentElementHasPrivateProviders = true; /** @type {?} */ ((/** @type {?} */ ((currentParent)).element)).allProviders = Object.create(/** @type {?} */ ((/** @type {?} */ ((currentParent)).element)).publicProviders); } /** @type {?} */ ((/** @type {?} */ ((/** @type {?} */ ((currentParent)).element)).allProviders))[tokenKey(/** @type {?} */ ((node.provider)).token)] = node; } if (isComponent) { /** @type {?} */ ((/** @type {?} */ ((currentParent)).element)).componentProvider = node; } } if (currentParent) { currentParent.childFlags |= node.flags; currentParent.directChildFlags |= node.flags; currentParent.childMatchedQueries |= node.matchedQueryIds; if (node.element && node.element.template) { currentParent.childMatchedQueries |= node.element.template.nodeMatchedQueries; } } else { viewRootNodeFlags |= node.flags; } if (node.childCount > 0) { currentParent = node; if (!isNgContainer(node)) { currentRenderParent = node; } } else { // When the current node has no children, check if it is the last children of its parent. // When it is, propagate the flags up. // The loop is required because an element could be the last transitive children of several // elements. We loop to either the root or the highest opened element (= with remaining // children) while (currentParent && i === currentParent.nodeIndex + currentParent.childCount) { const /** @type {?} */ newParent = currentParent.parent; if (newParent) { newParent.childFlags |= currentParent.childFlags; newParent.childMatchedQueries |= currentParent.childMatchedQueries; } currentParent = newParent; // We also need to update the render parent & account for ng-container if (currentParent && isNgContainer(currentParent)) { currentRenderParent = currentParent.renderParent; } else { currentRenderParent = currentParent; } } } } const /** @type {?} */ handleEvent = (view, nodeIndex, eventName, event) => /** @type {?} */ ((/** @type {?} */ ((nodes[nodeIndex].element)).handleEvent))(view, eventName, event); return { // Will be filled later... factory: null, nodeFlags: viewNodeFlags, rootNodeFlags: viewRootNodeFlags, nodeMatchedQueries: viewMatchedQueries, flags, nodes: nodes, updateDirectives: updateDirectives || NOOP, updateRenderer: updateRenderer || NOOP, handleEvent, bindingCount: viewBindingCount, outputCount: viewDisposableCount, lastRenderRootNode }; } /** * @param {?} node * @return {?} */ function isNgContainer(node) { return (node.flags & 1 /* TypeElement */) !== 0 && /** @type {?} */ ((node.element)).name === null; } /** * @param {?} parent * @param {?} node * @param {?} nodeCount * @return {?} */ function validateNode(parent, node, nodeCount) { const /** @type {?} */ template = node.element && node.element.template; if (template) { if (!template.lastRenderRootNode) { throw new Error(`Illegal State: Embedded templates without nodes are not allowed!`); } if (template.lastRenderRootNode && template.lastRenderRootNode.flags & 16777216 /* EmbeddedViews */) { throw new Error(`Illegal State: Last root node of a template can't have embedded views, at index ${node.nodeIndex}!`); } } if (node.flags & 20224 /* CatProvider */) { const /** @type {?} */ parentFlags = parent ? parent.flags : 0; if ((parentFlags & 1 /* TypeElement */) === 0) { throw new Error(`Illegal State: StaticProvider/Directive nodes need to be children of elements or anchors, at index ${node.nodeIndex}!`); } } if (node.query) { if (node.flags & 67108864 /* TypeContentQuery */ && (!parent || (parent.flags & 16384 /* TypeDirective */) === 0)) { throw new Error(`Illegal State: Content Query nodes need to be children of directives, at index ${node.nodeIndex}!`); } if (node.flags & 134217728 /* TypeViewQuery */ && parent) { throw new Error(`Illegal State: View Query nodes have to be top level nodes, at index ${node.nodeIndex}!`); } } if (node.childCount) { const /** @type {?} */ parentEnd = parent ? parent.nodeIndex + parent.childCount : nodeCount - 1; if (node.nodeIndex <= parentEnd && node.nodeIndex + node.childCount > parentEnd) { throw new Error(`Illegal State: childCount of node leads outside of parent, at index ${node.nodeIndex}!`); } } } /** * @param {?} parent * @param {?} anchorDef * @param {?} viewDef * @param {?=} context * @return {?} */ function createEmbeddedView(parent, anchorDef$$1, viewDef, context) { // embedded views are seen as siblings to the anchor, so we need // to get the parent of the anchor and use it as parentIndex. const /** @type {?} */ view = createView(parent.root, parent.renderer, parent, anchorDef$$1, viewDef); initView(view, parent.component, context); createViewNodes(view); return view; } /** * @param {?} root * @param {?} def * @param {?=} context * @return {?} */ function createRootView(root, def, context) { const /** @type {?} */ view = createView(root, root.renderer, null, null, def); initView(view, context, context); createViewNodes(view); return view; } /** * @param {?} parentView * @param {?} nodeDef * @param {?} viewDef * @param {?} hostElement * @return {?} */ function createComponentView(parentView, nodeDef, viewDef, hostElement) { const /** @type {?} */ rendererType = /** @type {?} */ ((nodeDef.element)).componentRendererType; let /** @type {?} */ compRenderer; if (!rendererType) { compRenderer = parentView.root.renderer; } else { compRenderer = parentView.root.rendererFactory.createRenderer(hostElement, rendererType); } return createView(parentView.root, compRenderer, parentView, /** @type {?} */ ((nodeDef.element)).componentProvider, viewDef); } /** * @param {?} root * @param {?} renderer * @param {?} parent * @param {?} parentNodeDef * @param {?} def * @return {?} */ function createView(root, renderer, parent, parentNodeDef, def) { const /** @type {?} */ nodes = new Array(def.nodes.length); const /** @type {?} */ disposables = def.outputCount ? new Array(def.outputCount) : null; const /** @type {?} */ view = { def, parent, viewContainerParent: null, parentNodeDef, context: null, component: null, nodes, state: 13 /* CatInit */, root, renderer, oldValues: new Array(def.bindingCount), disposables, initIndex: -1 }; return view; } /** * @param {?} view * @param {?} component * @param {?} context * @return {?} */ function initView(view, component, context) { view.component = component; view.context = context; } /** * @param {?} view * @return {?} */ function createViewNodes(view) { let /** @type {?} */ renderHost; if (isComponentView(view)) { const /** @type {?} */ hostDef = view.parentNodeDef; renderHost = asElementData(/** @type {?} */ ((view.parent)), /** @type {?} */ ((/** @type {?} */ ((hostDef)).parent)).nodeIndex).renderElement; } const /** @type {?} */ def = view.def; const /** @type {?} */ nodes = view.nodes; for (let /** @type {?} */ i = 0; i < def.nodes.length; i++) { const /** @type {?} */ nodeDef = def.nodes[i]; Services.setCurrentNode(view, i); let /** @type {?} */ nodeData; switch (nodeDef.flags & 201347067 /* Types */) { case 1 /* TypeElement */: const /** @type {?} */ el = /** @type {?} */ (createElement(view, renderHost, nodeDef)); let /** @type {?} */ componentView = /** @type {?} */ ((undefined)); if (nodeDef.flags & 33554432 /* ComponentView */) { const /** @type {?} */ compViewDef = resolveDefinition(/** @type {?} */ ((/** @type {?} */ ((nodeDef.element)).componentView))); componentView = Services.createComponentView(view, nodeDef, compViewDef, el); } listenToElementOutputs(view, componentView, nodeDef, el); nodeData = /** @type {?} */ ({ renderElement: el, componentView, viewContainer: null, template: /** @type {?} */ ((nodeDef.element)).template ? createTemplateData(view, nodeDef) : undefined }); if (nodeDef.flags & 16777216 /* EmbeddedViews */) { nodeData.viewContainer = createViewContainerData(view, nodeDef, nodeData); } break; case 2 /* TypeText */: nodeData = /** @type {?} */ (createText(view, renderHost, nodeDef)); break; case 512 /* TypeClassProvider */: case 1024 /* TypeFactoryProvider */: case 2048 /* TypeUseExistingProvider */: case 256 /* TypeValueProvider */: { nodeData = nodes[i]; if (!nodeData && !(nodeDef.flags & 4096 /* LazyProvider */)) { const /** @type {?} */ instance = createProviderInstance(view, nodeDef); nodeData = /** @type {?} */ ({ instance }); } break; } case 16 /* TypePipe */: { const /** @type {?} */ instance = createPipeInstance(view, nodeDef); nodeData = /** @type {?} */ ({ instance }); break; } case 16384 /* TypeDirective */: { nodeData = nodes[i]; if (!nodeData) { const /** @type {?} */ instance = createDirectiveInstance(view, nodeDef); nodeData = /** @type {?} */ ({ instance }); } if (nodeDef.flags & 32768 /* Component */) { const /** @type {?} */ compView = asElementData(view, /** @type {?} */ ((nodeDef.parent)).nodeIndex).componentView; initView(compView, nodeData.instance, nodeData.instance); } break; } case 32 /* TypePureArray */: case 64 /* TypePureObject */: case 128 /* TypePurePipe */: nodeData = /** @type {?} */ (createPureExpression(view, nodeDef)); break; case 67108864 /* TypeContentQuery */: case 134217728 /* TypeViewQuery */: nodeData = /** @type {?} */ (createQuery()); break; case 8 /* TypeNgContent */: appendNgContent(view, renderHost, nodeDef); // no runtime data needed for NgContent... nodeData = undefined; break; } nodes[i] = nodeData; } // Create the ViewData.nodes of component views after we created everything else, // so that e.g. ng-content works execComponentViewsAction(view, ViewAction.CreateViewNodes); // fill static content and view queries execQueriesAction(view, 67108864 /* TypeContentQuery */ | 134217728 /* TypeViewQuery */, 268435456 /* StaticQuery */, 0 /* CheckAndUpdate */); } /** * @param {?} view * @return {?} */ function checkNoChangesView(view) { markProjectedViewsForCheck(view); Services.updateDirectives(view, 1 /* CheckNoChanges */); execEmbeddedViewsAction(view, ViewAction.CheckNoChanges); Services.updateRenderer(view, 1 /* CheckNoChanges */); execComponentViewsAction(view, ViewAction.CheckNoChanges); // Note: We don't check queries for changes as we didn't do this in v2.x. // TODO(tbosch): investigate if we can enable the check again in v5.x with a nicer error message. view.state &= ~(64 /* CheckProjectedViews */ | 32 /* CheckProjectedView */); } /** * @param {?} view * @return {?} */ function checkAndUpdateView(view) { if (view.state & 1 /* BeforeFirstCheck */) { view.state &= ~1 /* BeforeFirstCheck */; view.state |= 2 /* FirstCheck */; } else { view.state &= ~2 /* FirstCheck */; } shiftInitState(view, 0 /* InitState_BeforeInit */, 256 /* InitState_CallingOnInit */); markProjectedViewsForCheck(view); Services.updateDirectives(view, 0 /* CheckAndUpdate */); execEmbeddedViewsAction(view, ViewAction.CheckAndUpdate); execQueriesAction(view, 67108864 /* TypeContentQuery */, 536870912 /* DynamicQuery */, 0 /* CheckAndUpdate */); let /** @type {?} */ callInit = shiftInitState(view, 256 /* InitState_CallingOnInit */, 512 /* InitState_CallingAfterContentInit */); callLifecycleHooksChildrenFirst(view, 2097152 /* AfterContentChecked */ | (callInit ? 1048576 /* AfterContentInit */ : 0)); Services.updateRenderer(view, 0 /* CheckAndUpdate */); execComponentViewsAction(view, ViewAction.CheckAndUpdate); execQueriesAction(view, 134217728 /* TypeViewQuery */, 536870912 /* DynamicQuery */, 0 /* CheckAndUpdate */); callInit = shiftInitState(view, 512 /* InitState_CallingAfterContentInit */, 768 /* InitState_CallingAfterViewInit */); callLifecycleHooksChildrenFirst(view, 8388608 /* AfterViewChecked */ | (callInit ? 4194304 /* AfterViewInit */ : 0)); if (view.def.flags & 2 /* OnPush */) { view.state &= ~8 /* ChecksEnabled */; } view.state &= ~(64 /* CheckProjectedViews */ | 32 /* CheckProjectedView */); shiftInitState(view, 768 /* InitState_CallingAfterViewInit */, 1024 /* InitState_AfterInit */); } /** * @param {?} view * @param {?} nodeDef * @param {?} argStyle * @param {?=} v0 * @param {?=} v1 * @param {?=} v2 * @param {?=} v3 * @param {?=} v4 * @param {?=} v5 * @param {?=} v6 * @param {?=} v7 * @param {?=} v8 * @param {?=} v9 * @return {?} */ function checkAndUpdateNode(view, nodeDef, argStyle, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) { if (argStyle === 0 /* Inline */) { return checkAndUpdateNodeInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9); } else { return checkAndUpdateNodeDynamic(view, nodeDef, v0); } } /** * @param {?} view * @return {?} */ function markProjectedViewsForCheck(view) { const /** @type {?} */ def = view.def; if (!(def.nodeFlags & 4 /* ProjectedTemplate */)) { return; } for (let /** @type {?} */ i = 0; i < def.nodes.length; i++) { const /** @type {?} */ nodeDef = def.nodes[i]; if (nodeDef.flags & 4 /* ProjectedTemplate */) { const /** @type {?} */ projectedViews = asElementData(view, i).template._projectedViews; if (projectedViews) { for (let /** @type {?} */ i = 0; i < projectedViews.length; i++) { const /** @type {?} */ projectedView = projectedViews[i]; projectedView.state |= 32 /* CheckProjectedView */; markParentViewsForCheckProjectedViews(projectedView, view); } } } else if ((nodeDef.childFlags & 4 /* ProjectedTemplate */) === 0) { // a parent with leafs // no child is a component, // then skip the children i += nodeDef.childCount; } } } /** * @param {?} view * @param {?} nodeDef * @param {?=} v0 * @param {?=} v1 * @param {?=} v2 * @param {?=} v3 * @param {?=} v4 * @param {?=} v5 * @param {?=} v6 * @param {?=} v7 * @param {?=} v8 * @param {?=} v9 * @return {?} */ function checkAndUpdateNodeInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) { switch (nodeDef.flags & 201347067 /* Types */) { case 1 /* TypeElement */: return checkAndUpdateElementInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9); case 2 /* TypeText */: return checkAndUpdateTextInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9); case 16384 /* TypeDirective */: return checkAndUpdateDirectiveInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9); case 32 /* TypePureArray */: case 64 /* TypePureObject */: case 128 /* TypePurePipe */: return checkAndUpdatePureExpressionInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9); default: throw 'unreachable'; } } /** * @param {?} view * @param {?} nodeDef * @param {?} values * @return {?} */ function checkAndUpdateNodeDynamic(view, nodeDef, values) { switch (nodeDef.flags & 201347067 /* Types */) { case 1 /* TypeElement */: return checkAndUpdateElementDynamic(view, nodeDef, values); case 2 /* TypeText */: return checkAndUpdateTextDynamic(view, nodeDef, values); case 16384 /* TypeDirective */: return checkAndUpdateDirectiveDynamic(view, nodeDef, values); case 32 /* TypePureArray */: case 64 /* TypePureObject */: case 128 /* TypePurePipe */: return checkAndUpdatePureExpressionDynamic(view, nodeDef, values); default: throw 'unreachable'; } } /** * @param {?} view * @param {?} nodeDef * @param {?} argStyle * @param {?=} v0 * @param {?=} v1 * @param {?=} v2 * @param {?=} v3 * @param {?=} v4 * @param {?=} v5 * @param {?=} v6 * @param {?=} v7 * @param {?=} v8 * @param {?=} v9 * @return {?} */ function checkNoChangesNode(view, nodeDef, argStyle, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) { if (argStyle === 0 /* Inline */) { checkNoChangesNodeInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9); } else { checkNoChangesNodeDynamic(view, nodeDef, v0); } // Returning false is ok here as we would have thrown in case of a change. return false; } /** * @param {?} view * @param {?} nodeDef * @param {?} v0 * @param {?} v1 * @param {?} v2 * @param {?} v3 * @param {?} v4 * @param {?} v5 * @param {?} v6 * @param {?} v7 * @param {?} v8 * @param {?} v9 * @return {?} */ function checkNoChangesNodeInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) { const /** @type {?} */ bindLen = nodeDef.bindings.length; if (bindLen > 0) checkBindingNoChanges(view, nodeDef, 0, v0); if (bindLen > 1) checkBindingNoChanges(view, nodeDef, 1, v1); if (bindLen > 2) checkBindingNoChanges(view, nodeDef, 2, v2); if (bindLen > 3) checkBindingNoChanges(view, nodeDef, 3, v3); if (bindLen > 4) checkBindingNoChanges(view, nodeDef, 4, v4); if (bindLen > 5) checkBindingNoChanges(view, nodeDef, 5, v5); if (bindLen > 6) checkBindingNoChanges(view, nodeDef, 6, v6); if (bindLen > 7) checkBindingNoChanges(view, nodeDef, 7, v7); if (bindLen > 8) checkBindingNoChanges(view, nodeDef, 8, v8); if (bindLen > 9) checkBindingNoChanges(view, nodeDef, 9, v9); } /** * @param {?} view * @param {?} nodeDef * @param {?} values * @return {?} */ function checkNoChangesNodeDynamic(view, nodeDef, values) { for (let /** @type {?} */ i = 0; i < values.length; i++) { checkBindingNoChanges(view, nodeDef, i, values[i]); } } /** * Workaround https://github.com/angular/tsickle/issues/497 * @suppress {misplacedTypeAnnotation} * @param {?} view * @param {?} nodeDef * @return {?} */ function checkNoChangesQuery(view, nodeDef) { const /** @type {?} */ queryList = asQueryList(view, nodeDef.nodeIndex); if (queryList.dirty) { throw expressionChangedAfterItHasBeenCheckedError(Services.createDebugContext(view, nodeDef.nodeIndex), `Query ${(/** @type {?} */ ((nodeDef.query))).id} not dirty`, `Query ${(/** @type {?} */ ((nodeDef.query))).id} dirty`, (view.state & 1 /* BeforeFirstCheck */) !== 0); } } /** * @param {?} view * @return {?} */ function destroyView(view) { if (view.state & 128 /* Destroyed */) { return; } execEmbeddedViewsAction(view, ViewAction.Destroy); execComponentViewsAction(view, ViewAction.Destroy); callLifecycleHooksChildrenFirst(view, 131072 /* OnDestroy */); if (view.disposables) { for (let /** @type {?} */ i = 0; i < view.disposables.length; i++) { view.disposables[i](); } } detachProjectedView(view); if (view.renderer.destroyNode) { destroyViewNodes(view); } if (isComponentView(view)) { view.renderer.destroy(); } view.state |= 128 /* Destroyed */; } /** * @param {?} view * @return {?} */ function destroyViewNodes(view) { const /** @type {?} */ len = view.def.nodes.length; for (let /** @type {?} */ i = 0; i < len; i++) { const /** @type {?} */ def = view.def.nodes[i]; if (def.flags & 1 /* TypeElement */) { /** @type {?} */ ((view.renderer.destroyNode))(asElementData(view, i).renderElement); } else if (def.flags & 2 /* TypeText */) { /** @type {?} */ ((view.renderer.destroyNode))(asTextData(view, i).renderText); } else if (def.flags & 67108864 /* TypeContentQuery */ || def.flags & 134217728 /* TypeViewQuery */) { asQueryList(view, i).destroy(); } } } /** @enum {number} */ const ViewAction = { CreateViewNodes: 0, CheckNoChanges: 1, CheckNoChangesProjectedViews: 2, CheckAndUpdate: 3, CheckAndUpdateProjectedViews: 4, Destroy: 5, }; ViewAction[ViewAction.CreateViewNodes] = "CreateViewNodes"; ViewAction[ViewAction.CheckNoChanges] = "CheckNoChanges"; ViewAction[ViewAction.CheckNoChangesProjectedViews] = "CheckNoChangesProjectedViews"; ViewAction[ViewAction.CheckAndUpdate] = "CheckAndUpdate"; ViewAction[ViewAction.CheckAndUpdateProjectedViews] = "CheckAndUpdateProjectedViews"; ViewAction[ViewAction.Destroy] = "Destroy"; /** * @param {?} view * @param {?} action * @return {?} */ function execComponentViewsAction(view, action) { const /** @type {?} */ def = view.def; if (!(def.nodeFlags & 33554432 /* ComponentView */)) { return; } for (let /** @type {?} */ i = 0; i < def.nodes.length; i++) { const /** @type {?} */ nodeDef = def.nodes[i]; if (nodeDef.flags & 33554432 /* ComponentView */) { // a leaf callViewAction(asElementData(view, i).componentView, action); } else if ((nodeDef.childFlags & 33554432 /* ComponentView */) === 0) { // a parent with leafs // no child is a component, // then skip the children i += nodeDef.childCount; } } } /** * @param {?} view * @param {?} action * @return {?} */ function execEmbeddedViewsAction(view, action) { const /** @type {?} */ def = view.def; if (!(def.nodeFlags & 16777216 /* EmbeddedViews */)) { return; } for (let /** @type {?} */ i = 0; i < def.nodes.length; i++) { const /** @type {?} */ nodeDef = def.nodes[i]; if (nodeDef.flags & 16777216 /* EmbeddedViews */) { // a leaf const /** @type {?} */ embeddedViews = /** @type {?} */ ((asElementData(view, i).viewContainer))._embeddedViews; for (let /** @type {?} */ k = 0; k < embeddedViews.length; k++) { callViewAction(embeddedViews[k], action); } } else if ((nodeDef.childFlags & 16777216 /* EmbeddedViews */) === 0) { // a parent with leafs // no child is a component, // then skip the children i += nodeDef.childCount; } } } /** * @param {?} view * @param {?} action * @return {?} */ function callViewAction(view, action) { const /** @type {?} */ viewState = view.state; switch (action) { case ViewAction.CheckNoChanges: if ((viewState & 128 /* Destroyed */) === 0) { if ((viewState & 12 /* CatDetectChanges */) === 12 /* CatDetectChanges */) { checkNoChangesView(view); } else if (viewState & 64 /* CheckProjectedViews */) { execProjectedViewsAction(view, ViewAction.CheckNoChangesProjectedViews); } } break; case ViewAction.CheckNoChangesProjectedViews: if ((viewState & 128 /* Destroyed */) === 0) { if (viewState & 32 /* CheckProjectedView */) { checkNoChangesView(view); } else if (viewState & 64 /* CheckProjectedViews */) { execProjectedViewsAction(view, action); } } break; case ViewAction.CheckAndUpdate: if ((viewState & 128 /* Destroyed */) === 0) { if ((viewState & 12 /* CatDetectChanges */) === 12 /* CatDetectChanges */) { checkAndUpdateView(view); } else if (viewState & 64 /* CheckProjectedViews */) { execProjectedViewsAction(view, ViewAction.CheckAndUpdateProjectedViews); } } break; case ViewAction.CheckAndUpdateProjectedViews: if ((viewState & 128 /* Destroyed */) === 0) { if (viewState & 32 /* CheckProjectedView */) { checkAndUpdateView(view); } else if (viewState & 64 /* CheckProjectedViews */) { execProjectedViewsAction(view, action); } } break; case ViewAction.Destroy: // Note: destroyView recurses over all views, // so we don't need to special case projected views here. destroyView(view); break; case ViewAction.CreateViewNodes: createViewNodes(view); break; } } /** * @param {?} view * @param {?} action * @return {?} */ function execProjectedViewsAction(view, action) { execEmbeddedViewsAction(view, action); execComponentViewsAction(view, action); } /** * @param {?} view * @param {?} queryFlags * @param {?} staticDynamicQueryFlag * @param {?} checkType * @return {?} */ function execQueriesAction(view, queryFlags, staticDynamicQueryFlag, checkType) { if (!(view.def.nodeFlags & queryFlags) || !(view.def.nodeFlags & staticDynamicQueryFlag)) { return; } const /** @type {?} */ nodeCount = view.def.nodes.length; for (let /** @type {?} */ i = 0; i < nodeCount; i++) { const /** @type {?} */ nodeDef = view.def.nodes[i]; if ((nodeDef.flags & queryFlags) && (nodeDef.flags & staticDynamicQueryFlag)) { Services.setCurrentNode(view, nodeDef.nodeIndex); switch (checkType) { case 0 /* CheckAndUpdate */: checkAndUpdateQuery(view, nodeDef); break; case 1 /* CheckNoChanges */: checkNoChangesQuery(view, nodeDef); break; } } if (!(nodeDef.childFlags & queryFlags) || !(nodeDef.childFlags & staticDynamicQueryFlag)) { // no child has a matching query // then skip the children i += nodeDef.childCount; } } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ let initialized = false; /** * @return {?} */ function initServicesIfNeeded() { if (initialized) { return; } initialized = true; const /** @type {?} */ services = isDevMode() ? createDebugServices() : createProdServices(); Services.setCurrentNode = services.setCurrentNode; Services.createRootView = services.createRootView; Services.createEmbeddedView = services.createEmbeddedView; Services.createComponentView = services.createComponentView; Services.createNgModuleRef = services.createNgModuleRef; Services.overrideProvider = services.overrideProvider; Services.overrideComponentView = services.overrideComponentView; Services.clearOverrides = services.clearOverrides; Services.checkAndUpdateView = services.checkAndUpdateView; Services.checkNoChangesView = services.checkNoChangesView; Services.destroyView = services.destroyView; Services.resolveDep = resolveDep; Services.createDebugContext = services.createDebugContext; Services.handleEvent = services.handleEvent; Services.updateDirectives = services.updateDirectives; Services.updateRenderer = services.updateRenderer; Services.dirtyParentQueries = dirtyParentQueries; } /** * @return {?} */ function createProdServices() { return { setCurrentNode: () => { }, createRootView: createProdRootView, createEmbeddedView: createEmbeddedView, createComponentView: createComponentView, createNgModuleRef: createNgModuleRef, overrideProvider: NOOP, overrideComponentView: NOOP, clearOverrides: NOOP, checkAndUpdateView: checkAndUpdateView, checkNoChangesView: checkNoChangesView, destroyView: destroyView, createDebugContext: (view, nodeIndex) => new DebugContext_(view, nodeIndex), handleEvent: (view, nodeIndex, eventName, event) => view.def.handleEvent(view, nodeIndex, eventName, event), updateDirectives: (view, checkType) => view.def.updateDirectives(checkType === 0 /* CheckAndUpdate */ ? prodCheckAndUpdateNode : prodCheckNoChangesNode, view), updateRenderer: (view, checkType) => view.def.updateRenderer(checkType === 0 /* CheckAndUpdate */ ? prodCheckAndUpdateNode : prodCheckNoChangesNode, view), }; } /** * @return {?} */ function createDebugServices() { return { setCurrentNode: debugSetCurrentNode, createRootView: debugCreateRootView, createEmbeddedView: debugCreateEmbeddedView, createComponentView: debugCreateComponentView, createNgModuleRef: debugCreateNgModuleRef, overrideProvider: debugOverrideProvider, overrideComponentView: debugOverrideComponentView, clearOverrides: debugClearOverrides, checkAndUpdateView: debugCheckAndUpdateView, checkNoChangesView: debugCheckNoChangesView, destroyView: debugDestroyView, createDebugContext: (view, nodeIndex) => new DebugContext_(view, nodeIndex), handleEvent: debugHandleEvent, updateDirectives: debugUpdateDirectives, updateRenderer: debugUpdateRenderer, }; } /** * @param {?} elInjector * @param {?} projectableNodes * @param {?} rootSelectorOrNode * @param {?} def * @param {?} ngModule * @param {?=} context * @return {?} */ function createProdRootView(elInjector, projectableNodes, rootSelectorOrNode, def, ngModule, context) { const /** @type {?} */ rendererFactory = ngModule.injector.get(RendererFactory2); return createRootView(createRootData(elInjector, ngModule, rendererFactory, projectableNodes, rootSelectorOrNode), def, context); } /** * @param {?} elInjector * @param {?} projectableNodes * @param {?} rootSelectorOrNode * @param {?} def * @param {?} ngModule * @param {?=} context * @return {?} */ function debugCreateRootView(elInjector, projectableNodes, rootSelectorOrNode, def, ngModule, context) { const /** @type {?} */ rendererFactory = ngModule.injector.get(RendererFactory2); const /** @type {?} */ root = createRootData(elInjector, ngModule, new DebugRendererFactory2(rendererFactory), projectableNodes, rootSelectorOrNode); const /** @type {?} */ defWithOverride = applyProviderOverridesToView(def); return callWithDebugContext(DebugAction.create, createRootView, null, [root, defWithOverride, context]); } /** * @param {?} elInjector * @param {?} ngModule * @param {?} rendererFactory * @param {?} projectableNodes * @param {?} rootSelectorOrNode * @return {?} */ function createRootData(elInjector, ngModule, rendererFactory, projectableNodes, rootSelectorOrNode) { const /** @type {?} */ sanitizer = ngModule.injector.get(Sanitizer); const /** @type {?} */ errorHandler = ngModule.injector.get(ErrorHandler); const /** @type {?} */ renderer = rendererFactory.createRenderer(null, null); return { ngModule, injector: elInjector, projectableNodes, selectorOrNode: rootSelectorOrNode, sanitizer, rendererFactory, renderer, errorHandler }; } /** * @param {?} parentView * @param {?} anchorDef * @param {?} viewDef * @param {?=} context * @return {?} */ function debugCreateEmbeddedView(parentView, anchorDef, viewDef$$1, context) { const /** @type {?} */ defWithOverride = applyProviderOverridesToView(viewDef$$1); return callWithDebugContext(DebugAction.create, createEmbeddedView, null, [parentView, anchorDef, defWithOverride, context]); } /** * @param {?} parentView * @param {?} nodeDef * @param {?} viewDef * @param {?} hostElement * @return {?} */ function debugCreateComponentView(parentView, nodeDef, viewDef$$1, hostElement) { const /** @type {?} */ overrideComponentView = viewDefOverrides.get(/** @type {?} */ ((/** @type {?} */ ((/** @type {?} */ ((nodeDef.element)).componentProvider)).provider)).token); if (overrideComponentView) { viewDef$$1 = overrideComponentView; } else { viewDef$$1 = applyProviderOverridesToView(viewDef$$1); } return callWithDebugContext(DebugAction.create, createComponentView, null, [parentView, nodeDef, viewDef$$1, hostElement]); } /** * @param {?} moduleType * @param {?} parentInjector * @param {?} bootstrapComponents * @param {?} def * @return {?} */ function debugCreateNgModuleRef(moduleType, parentInjector, bootstrapComponents, def) { const /** @type {?} */ defWithOverride = applyProviderOverridesToNgModule(def); return createNgModuleRef(moduleType, parentInjector, bootstrapComponents, defWithOverride); } const providerOverrides = new Map(); const viewDefOverrides = new Map(); /** * @param {?} override * @return {?} */ function debugOverrideProvider(override) { providerOverrides.set(override.token, override); } /** * @param {?} comp * @param {?} compFactory * @return {?} */ function debugOverrideComponentView(comp, compFactory) { const /** @type {?} */ hostViewDef = resolveDefinition(getComponentViewDefinitionFactory(compFactory)); const /** @type {?} */ compViewDef = resolveDefinition(/** @type {?} */ ((/** @type {?} */ ((hostViewDef.nodes[0].element)).componentView))); viewDefOverrides.set(comp, compViewDef); } /** * @return {?} */ function debugClearOverrides() { providerOverrides.clear(); viewDefOverrides.clear(); } /** * @param {?} def * @return {?} */ function applyProviderOverridesToView(def) { if (providerOverrides.size === 0) { return def; } const /** @type {?} */ elementIndicesWithOverwrittenProviders = findElementIndicesWithOverwrittenProviders(def); if (elementIndicesWithOverwrittenProviders.length === 0) { return def; } // clone the whole view definition, // as it maintains references between the nodes that are hard to update. def = /** @type {?} */ ((def.factory))(() => NOOP); for (let /** @type {?} */ i = 0; i < elementIndicesWithOverwrittenProviders.length; i++) { applyProviderOverridesToElement(def, elementIndicesWithOverwrittenProviders[i]); } return def; /** * @param {?} def * @return {?} */ function findElementIndicesWithOverwrittenProviders(def) { const /** @type {?} */ elIndicesWithOverwrittenProviders = []; let /** @type {?} */ lastElementDef = null; for (let /** @type {?} */ i = 0; i < def.nodes.length; i++) { const /** @type {?} */ nodeDef = def.nodes[i]; if (nodeDef.flags & 1 /* TypeElement */) { lastElementDef = nodeDef; } if (lastElementDef && nodeDef.flags & 3840 /* CatProviderNoDirective */ && providerOverrides.has(/** @type {?} */ ((nodeDef.provider)).token)) { elIndicesWithOverwrittenProviders.push(/** @type {?} */ ((lastElementDef)).nodeIndex); lastElementDef = null; } } return elIndicesWithOverwrittenProviders; } /** * @param {?} viewDef * @param {?} elIndex * @return {?} */ function applyProviderOverridesToElement(viewDef$$1, elIndex) { for (let /** @type {?} */ i = elIndex + 1; i < viewDef$$1.nodes.length; i++) { const /** @type {?} */ nodeDef = viewDef$$1.nodes[i]; if (nodeDef.flags & 1 /* TypeElement */) { // stop at the next element return; } if (nodeDef.flags & 3840 /* CatProviderNoDirective */) { const /** @type {?} */ provider = /** @type {?} */ ((nodeDef.provider)); const /** @type {?} */ override = providerOverrides.get(provider.token); if (override) { nodeDef.flags = (nodeDef.flags & ~3840 /* CatProviderNoDirective */) | override.flags; provider.deps = splitDepsDsl(override.deps); provider.value = override.value; } } } } } /** * @param {?} def * @return {?} */ function applyProviderOverridesToNgModule(def) { const { hasOverrides, hasDeprecatedOverrides } = calcHasOverrides(def); if (!hasOverrides) { return def; } // clone the whole view definition, // as it maintains references between the nodes that are hard to update. def = /** @type {?} */ ((def.factory))(() => NOOP); applyProviderOverrides(def); return def; /** * @param {?} def * @return {?} */ function calcHasOverrides(def) { let /** @type {?} */ hasOverrides = false; let /** @type {?} */ hasDeprecatedOverrides = false; if (providerOverrides.size === 0) { return { hasOverrides, hasDeprecatedOverrides }; } def.providers.forEach(node => { const /** @type {?} */ override = providerOverrides.get(node.token); if ((node.flags & 3840 /* CatProviderNoDirective */) && override) { hasOverrides = true; hasDeprecatedOverrides = hasDeprecatedOverrides || override.deprecatedBehavior; } }); return { hasOverrides, hasDeprecatedOverrides }; } /** * @param {?} def * @return {?} */ function applyProviderOverrides(def) { for (let /** @type {?} */ i = 0; i < def.providers.length; i++) { const /** @type {?} */ provider = def.providers[i]; if (hasDeprecatedOverrides) { // We had a bug where me made // all providers lazy. Keep this logic behind a flag // for migrating existing users. provider.flags |= 4096 /* LazyProvider */; } const /** @type {?} */ override = providerOverrides.get(provider.token); if (override) { provider.flags = (provider.flags & ~3840 /* CatProviderNoDirective */) | override.flags; provider.deps = splitDepsDsl(override.deps); provider.value = override.value; } } } } /** * @param {?} view * @param {?} checkIndex * @param {?} argStyle * @param {?=} v0 * @param {?=} v1 * @param {?=} v2 * @param {?=} v3 * @param {?=} v4 * @param {?=} v5 * @param {?=} v6 * @param {?=} v7 * @param {?=} v8 * @param {?=} v9 * @return {?} */ function prodCheckAndUpdateNode(view, checkIndex, argStyle, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) { const /** @type {?} */ nodeDef = view.def.nodes[checkIndex]; checkAndUpdateNode(view, nodeDef, argStyle, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9); return (nodeDef.flags & 224 /* CatPureExpression */) ? asPureExpressionData(view, checkIndex).value : undefined; } /** * @param {?} view * @param {?} checkIndex * @param {?} argStyle * @param {?=} v0 * @param {?=} v1 * @param {?=} v2 * @param {?=} v3 * @param {?=} v4 * @param {?=} v5 * @param {?=} v6 * @param {?=} v7 * @param {?=} v8 * @param {?=} v9 * @return {?} */ function prodCheckNoChangesNode(view, checkIndex, argStyle, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) { const /** @type {?} */ nodeDef = view.def.nodes[checkIndex]; checkNoChangesNode(view, nodeDef, argStyle, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9); return (nodeDef.flags & 224 /* CatPureExpression */) ? asPureExpressionData(view, checkIndex).value : undefined; } /** * @param {?} view * @return {?} */ function debugCheckAndUpdateView(view) { return callWithDebugContext(DebugAction.detectChanges, checkAndUpdateView, null, [view]); } /** * @param {?} view * @return {?} */ function debugCheckNoChangesView(view) { return callWithDebugContext(DebugAction.checkNoChanges, checkNoChangesView, null, [view]); } /** * @param {?} view * @return {?} */ function debugDestroyView(view) { return callWithDebugContext(DebugAction.destroy, destroyView, null, [view]); } /** @enum {number} */ const DebugAction = { create: 0, detectChanges: 1, checkNoChanges: 2, destroy: 3, handleEvent: 4, }; DebugAction[DebugAction.create] = "create"; DebugAction[DebugAction.detectChanges] = "detectChanges"; DebugAction[DebugAction.checkNoChanges] = "checkNoChanges"; DebugAction[DebugAction.destroy] = "destroy"; DebugAction[DebugAction.handleEvent] = "handleEvent"; let _currentAction; let _currentView; let _currentNodeIndex; /** * @param {?} view * @param {?} nodeIndex * @return {?} */ function debugSetCurrentNode(view, nodeIndex) { _currentView = view; _currentNodeIndex = nodeIndex; } /** * @param {?} view * @param {?} nodeIndex * @param {?} eventName * @param {?} event * @return {?} */ function debugHandleEvent(view, nodeIndex, eventName, event) { debugSetCurrentNode(view, nodeIndex); return callWithDebugContext(DebugAction.handleEvent, view.def.handleEvent, null, [view, nodeIndex, eventName, event]); } /** * @param {?} view * @param {?} checkType * @return {?} */ function debugUpdateDirectives(view, checkType) { if (view.state & 128 /* Destroyed */) { throw viewDestroyedError(DebugAction[_currentAction]); } debugSetCurrentNode(view, nextDirectiveWithBinding(view, 0)); return view.def.updateDirectives(debugCheckDirectivesFn, view); /** * @param {?} view * @param {?} nodeIndex * @param {?} argStyle * @param {...?} values * @return {?} */ function debugCheckDirectivesFn(view, nodeIndex, argStyle, ...values) { const /** @type {?} */ nodeDef = view.def.nodes[nodeIndex]; if (checkType === 0 /* CheckAndUpdate */) { debugCheckAndUpdateNode(view, nodeDef, argStyle, values); } else { debugCheckNoChangesNode(view, nodeDef, argStyle, values); } if (nodeDef.flags & 16384 /* TypeDirective */) { debugSetCurrentNode(view, nextDirectiveWithBinding(view, nodeIndex)); } return (nodeDef.flags & 224 /* CatPureExpression */) ? asPureExpressionData(view, nodeDef.nodeIndex).value : undefined; } } /** * @param {?} view * @param {?} checkType * @return {?} */ function debugUpdateRenderer(view, checkType) { if (view.state & 128 /* Destroyed */) { throw viewDestroyedError(DebugAction[_currentAction]); } debugSetCurrentNode(view, nextRenderNodeWithBinding(view, 0)); return view.def.updateRenderer(debugCheckRenderNodeFn, view); /** * @param {?} view * @param {?} nodeIndex * @param {?} argStyle * @param {...?} values * @return {?} */ function debugCheckRenderNodeFn(view, nodeIndex, argStyle, ...values) { const /** @type {?} */ nodeDef = view.def.nodes[nodeIndex]; if (checkType === 0 /* CheckAndUpdate */) { debugCheckAndUpdateNode(view, nodeDef, argStyle, values); } else { debugCheckNoChangesNode(view, nodeDef, argStyle, values); } if (nodeDef.flags & 3 /* CatRenderNode */) { debugSetCurrentNode(view, nextRenderNodeWithBinding(view, nodeIndex)); } return (nodeDef.flags & 224 /* CatPureExpression */) ? asPureExpressionData(view, nodeDef.nodeIndex).value : undefined; } } /** * @param {?} view * @param {?} nodeDef * @param {?} argStyle * @param {?} givenValues * @return {?} */ function debugCheckAndUpdateNode(view, nodeDef, argStyle, givenValues) { const /** @type {?} */ changed = (/** @type {?} */ (checkAndUpdateNode))(view, nodeDef, argStyle, ...givenValues); if (changed) { const /** @type {?} */ values = argStyle === 1 /* Dynamic */ ? givenValues[0] : givenValues; if (nodeDef.flags & 16384 /* TypeDirective */) { const /** @type {?} */ bindingValues = {}; for (let /** @type {?} */ i = 0; i < nodeDef.bindings.length; i++) { const /** @type {?} */ binding = nodeDef.bindings[i]; const /** @type {?} */ value = values[i]; if (binding.flags & 8 /* TypeProperty */) { bindingValues[normalizeDebugBindingName(/** @type {?} */ ((binding.nonMinifiedName)))] = normalizeDebugBindingValue(value); } } const /** @type {?} */ elDef = /** @type {?} */ ((nodeDef.parent)); const /** @type {?} */ el = asElementData(view, elDef.nodeIndex).renderElement; if (!/** @type {?} */ ((elDef.element)).name) { // a comment. view.renderer.setValue(el, `bindings=${JSON.stringify(bindingValues, null, 2)}`); } else { // a regular element. for (let /** @type {?} */ attr in bindingValues) { const /** @type {?} */ value = bindingValues[attr]; if (value != null) { view.renderer.setAttribute(el, attr, value); } else { view.renderer.removeAttribute(el, attr); } } } } } } /** * @param {?} view * @param {?} nodeDef * @param {?} argStyle * @param {?} values * @return {?} */ function debugCheckNoChangesNode(view, nodeDef, argStyle, values) { (/** @type {?} */ (checkNoChangesNode))(view, nodeDef, argStyle, ...values); } /** * @param {?} name * @return {?} */ function normalizeDebugBindingName(name) { // Attribute names with `$` (eg `x-y$`) are valid per spec, but unsupported by some browsers name = camelCaseToDashCase(name.replace(/[$@]/g, '_')); return `ng-reflect-${name}`; } const CAMEL_CASE_REGEXP = /([A-Z])/g; /** * @param {?} input * @return {?} */ function camelCaseToDashCase(input) { return input.replace(CAMEL_CASE_REGEXP, (...m) => '-' + m[1].toLowerCase()); } /** * @param {?} value * @return {?} */ function normalizeDebugBindingValue(value) { try { // Limit the size of the value as otherwise the DOM just gets polluted. return value != null ? value.toString().slice(0, 30) : value; } catch (/** @type {?} */ e) { return '[ERROR] Exception while trying to serialize the value'; } } /** * @param {?} view * @param {?} nodeIndex * @return {?} */ function nextDirectiveWithBinding(view, nodeIndex) { for (let /** @type {?} */ i = nodeIndex; i < view.def.nodes.length; i++) { const /** @type {?} */ nodeDef = view.def.nodes[i]; if (nodeDef.flags & 16384 /* TypeDirective */ && nodeDef.bindings && nodeDef.bindings.length) { return i; } } return null; } /** * @param {?} view * @param {?} nodeIndex * @return {?} */ function nextRenderNodeWithBinding(view, nodeIndex) { for (let /** @type {?} */ i = nodeIndex; i < view.def.nodes.length; i++) { const /** @type {?} */ nodeDef = view.def.nodes[i]; if ((nodeDef.flags & 3 /* CatRenderNode */) && nodeDef.bindings && nodeDef.bindings.length) { return i; } } return null; } class DebugContext_ { /** * @param {?} view * @param {?} nodeIndex */ constructor(view, nodeIndex) { this.view = view; this.nodeIndex = nodeIndex; if (nodeIndex == null) { this.nodeIndex = nodeIndex = 0; } this.nodeDef = view.def.nodes[nodeIndex]; let /** @type {?} */ elDef = this.nodeDef; let /** @type {?} */ elView = view; while (elDef && (elDef.flags & 1 /* TypeElement */) === 0) { elDef = /** @type {?} */ ((elDef.parent)); } if (!elDef) { while (!elDef && elView) { elDef = /** @type {?} */ ((viewParentEl(elView))); elView = /** @type {?} */ ((elView.parent)); } } this.elDef = elDef; this.elView = elView; } /** * @return {?} */ get elOrCompView() { // Has to be done lazily as we use the DebugContext also during creation of elements... return asElementData(this.elView, this.elDef.nodeIndex).componentView || this.view; } /** * @return {?} */ get injector() { return createInjector(this.elView, this.elDef); } /** * @return {?} */ get component() { return this.elOrCompView.component; } /** * @return {?} */ get context() { return this.elOrCompView.context; } /** * @return {?} */ get providerTokens() { const /** @type {?} */ tokens = []; if (this.elDef) { for (let /** @type {?} */ i = this.elDef.nodeIndex + 1; i <= this.elDef.nodeIndex + this.elDef.childCount; i++) { const /** @type {?} */ childDef = this.elView.def.nodes[i]; if (childDef.flags & 20224 /* CatProvider */) { tokens.push(/** @type {?} */ ((childDef.provider)).token); } i += childDef.childCount; } } return tokens; } /** * @return {?} */ get references() { const /** @type {?} */ references = {}; if (this.elDef) { collectReferences(this.elView, this.elDef, references); for (let /** @type {?} */ i = this.elDef.nodeIndex + 1; i <= this.elDef.nodeIndex + this.elDef.childCount; i++) { const /** @type {?} */ childDef = this.elView.def.nodes[i]; if (childDef.flags & 20224 /* CatProvider */) { collectReferences(this.elView, childDef, references); } i += childDef.childCount; } } return references; } /** * @return {?} */ get componentRenderElement() { const /** @type {?} */ elData = findHostElement(this.elOrCompView); return elData ? elData.renderElement : undefined; } /** * @return {?} */ get renderNode() { return this.nodeDef.flags & 2 /* TypeText */ ? renderNode(this.view, this.nodeDef) : renderNode(this.elView, this.elDef); } /** * @param {?} console * @param {...?} values * @return {?} */ logError(console, ...values) { let /** @type {?} */ logViewDef; let /** @type {?} */ logNodeIndex; if (this.nodeDef.flags & 2 /* TypeText */) { logViewDef = this.view.def; logNodeIndex = this.nodeDef.nodeIndex; } else { logViewDef = this.elView.def; logNodeIndex = this.elDef.nodeIndex; } // Note: we only generate a log function for text and element nodes // to make the generated code as small as possible. const /** @type {?} */ renderNodeIndex = getRenderNodeIndex(logViewDef, logNodeIndex); let /** @type {?} */ currRenderNodeIndex = -1; let /** @type {?} */ nodeLogger = () => { currRenderNodeIndex++; if (currRenderNodeIndex === renderNodeIndex) { return console.error.bind(console, ...values); } else { return NOOP; } }; /** @type {?} */ ((logViewDef.factory))(nodeLogger); if (currRenderNodeIndex < renderNodeIndex) { console.error('Illegal state: the ViewDefinitionFactory did not call the logger!'); (/** @type {?} */ (console.error))(...values); } } } /** * @param {?} viewDef * @param {?} nodeIndex * @return {?} */ function getRenderNodeIndex(viewDef$$1, nodeIndex) { let /** @type {?} */ renderNodeIndex = -1; for (let /** @type {?} */ i = 0; i <= nodeIndex; i++) { const /** @type {?} */ nodeDef = viewDef$$1.nodes[i]; if (nodeDef.flags & 3 /* CatRenderNode */) { renderNodeIndex++; } } return renderNodeIndex; } /** * @param {?} view * @return {?} */ function findHostElement(view) { while (view && !isComponentView(view)) { view = /** @type {?} */ ((view.parent)); } if (view.parent) { return asElementData(view.parent, /** @type {?} */ ((viewParentEl(view))).nodeIndex); } return null; } /** * @param {?} view * @param {?} nodeDef * @param {?} references * @return {?} */ function collectReferences(view, nodeDef, references) { for (let /** @type {?} */ refName in nodeDef.references) { references[refName] = getQueryValue(view, nodeDef, nodeDef.references[refName]); } } /** * @param {?} action * @param {?} fn * @param {?} self * @param {?} args * @return {?} */ function callWithDebugContext(action, fn, self, args) { const /** @type {?} */ oldAction = _currentAction; const /** @type {?} */ oldView = _currentView; const /** @type {?} */ oldNodeIndex = _currentNodeIndex; try { _currentAction = action; const /** @type {?} */ result = fn.apply(self, args); _currentView = oldView; _currentNodeIndex = oldNodeIndex; _currentAction = oldAction; return result; } catch (/** @type {?} */ e) { if (isViewDebugError(e) || !_currentView) { throw e; } throw viewWrappedDebugError(e, /** @type {?} */ ((getCurrentDebugContext()))); } } /** * @return {?} */ function getCurrentDebugContext() { return _currentView ? new DebugContext_(_currentView, _currentNodeIndex) : null; } class DebugRendererFactory2 { /** * @param {?} delegate */ constructor(delegate) { this.delegate = delegate; } /** * @param {?} element * @param {?} renderData * @return {?} */ createRenderer(element, renderData) { return new DebugRenderer2(this.delegate.createRenderer(element, renderData)); } /** * @return {?} */ begin() { if (this.delegate.begin) { this.delegate.begin(); } } /** * @return {?} */ end() { if (this.delegate.end) { this.delegate.end(); } } /** * @return {?} */ whenRenderingDone() { if (this.delegate.whenRenderingDone) { return this.delegate.whenRenderingDone(); } return Promise.resolve(null); } } class DebugRenderer2 { /** * @param {?} delegate */ constructor(delegate) { this.delegate = delegate; this.data = this.delegate.data; } /** * @param {?} node * @return {?} */ destroyNode(node) { removeDebugNodeFromIndex(/** @type {?} */ ((getDebugNode(node)))); if (this.delegate.destroyNode) { this.delegate.destroyNode(node); } } /** * @return {?} */ destroy() { this.delegate.destroy(); } /** * @param {?} name * @param {?=} namespace * @return {?} */ createElement(name, namespace) { const /** @type {?} */ el = this.delegate.createElement(name, namespace); const /** @type {?} */ debugCtx = getCurrentDebugContext(); if (debugCtx) { const /** @type {?} */ debugEl = new DebugElement(el, null, debugCtx); debugEl.name = name; indexDebugNode(debugEl); } return el; } /** * @param {?} value * @return {?} */ createComment(value) { const /** @type {?} */ comment = this.delegate.createComment(value); const /** @type {?} */ debugCtx = getCurrentDebugContext(); if (debugCtx) { indexDebugNode(new DebugNode(comment, null, debugCtx)); } return comment; } /** * @param {?} value * @return {?} */ createText(value) { const /** @type {?} */ text = this.delegate.createText(value); const /** @type {?} */ debugCtx = getCurrentDebugContext(); if (debugCtx) { indexDebugNode(new DebugNode(text, null, debugCtx)); } return text; } /** * @param {?} parent * @param {?} newChild * @return {?} */ appendChild(parent, newChild) { const /** @type {?} */ debugEl = getDebugNode(parent); const /** @type {?} */ debugChildEl = getDebugNode(newChild); if (debugEl && debugChildEl && debugEl instanceof DebugElement) { debugEl.addChild(debugChildEl); } this.delegate.appendChild(parent, newChild); } /** * @param {?} parent * @param {?} newChild * @param {?} refChild * @return {?} */ insertBefore(parent, newChild, refChild) { const /** @type {?} */ debugEl = getDebugNode(parent); const /** @type {?} */ debugChildEl = getDebugNode(newChild); const /** @type {?} */ debugRefEl = /** @type {?} */ ((getDebugNode(refChild))); if (debugEl && debugChildEl && debugEl instanceof DebugElement) { debugEl.insertBefore(debugRefEl, debugChildEl); } this.delegate.insertBefore(parent, newChild, refChild); } /** * @param {?} parent * @param {?} oldChild * @return {?} */ removeChild(parent, oldChild) { const /** @type {?} */ debugEl = getDebugNode(parent); const /** @type {?} */ debugChildEl = getDebugNode(oldChild); if (debugEl && debugChildEl && debugEl instanceof DebugElement) { debugEl.removeChild(debugChildEl); } this.delegate.removeChild(parent, oldChild); } /** * @param {?} selectorOrNode * @return {?} */ selectRootElement(selectorOrNode) { const /** @type {?} */ el = this.delegate.selectRootElement(selectorOrNode); const /** @type {?} */ debugCtx = getCurrentDebugContext(); if (debugCtx) { indexDebugNode(new DebugElement(el, null, debugCtx)); } return el; } /** * @param {?} el * @param {?} name * @param {?} value * @param {?=} namespace * @return {?} */ setAttribute(el, name, value, namespace) { const /** @type {?} */ debugEl = getDebugNode(el); if (debugEl && debugEl instanceof DebugElement) { const /** @type {?} */ fullName = namespace ? namespace + ':' + name : name; debugEl.attributes[fullName] = value; } this.delegate.setAttribute(el, name, value, namespace); } /** * @param {?} el * @param {?} name * @param {?=} namespace * @return {?} */ removeAttribute(el, name, namespace) { const /** @type {?} */ debugEl = getDebugNode(el); if (debugEl && debugEl instanceof DebugElement) { const /** @type {?} */ fullName = namespace ? namespace + ':' + name : name; debugEl.attributes[fullName] = null; } this.delegate.removeAttribute(el, name, namespace); } /** * @param {?} el * @param {?} name * @return {?} */ addClass(el, name) { const /** @type {?} */ debugEl = getDebugNode(el); if (debugEl && debugEl instanceof DebugElement) { debugEl.classes[name] = true; } this.delegate.addClass(el, name); } /** * @param {?} el * @param {?} name * @return {?} */ removeClass(el, name) { const /** @type {?} */ debugEl = getDebugNode(el); if (debugEl && debugEl instanceof DebugElement) { debugEl.classes[name] = false; } this.delegate.removeClass(el, name); } /** * @param {?} el * @param {?} style * @param {?} value * @param {?} flags * @return {?} */ setStyle(el, style, value, flags) { const /** @type {?} */ debugEl = getDebugNode(el); if (debugEl && debugEl instanceof DebugElement) { debugEl.styles[style] = value; } this.delegate.setStyle(el, style, value, flags); } /** * @param {?} el * @param {?} style * @param {?} flags * @return {?} */ removeStyle(el, style, flags) { const /** @type {?} */ debugEl = getDebugNode(el); if (debugEl && debugEl instanceof DebugElement) { debugEl.styles[style] = null; } this.delegate.removeStyle(el, style, flags); } /** * @param {?} el * @param {?} name * @param {?} value * @return {?} */ setProperty(el, name, value) { const /** @type {?} */ debugEl = getDebugNode(el); if (debugEl && debugEl instanceof DebugElement) { debugEl.properties[name] = value; } this.delegate.setProperty(el, name, value); } /** * @param {?} target * @param {?} eventName * @param {?} callback * @return {?} */ listen(target, eventName, callback) { if (typeof target !== 'string') { const /** @type {?} */ debugEl = getDebugNode(target); if (debugEl) { debugEl.listeners.push(new EventListener(eventName, callback)); } } return this.delegate.listen(target, eventName, callback); } /** * @param {?} node * @return {?} */ parentNode(node) { return this.delegate.parentNode(node); } /** * @param {?} node * @return {?} */ nextSibling(node) { return this.delegate.nextSibling(node); } /** * @param {?} node * @param {?} value * @return {?} */ setValue(node, value) { return this.delegate.setValue(node, value); } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @param {?} override * @return {?} */ function overrideProvider(override) { initServicesIfNeeded(); return Services.overrideProvider(override); } /** * @param {?} comp * @param {?} componentFactory * @return {?} */ function overrideComponentView(comp, componentFactory) { initServicesIfNeeded(); return Services.overrideComponentView(comp, componentFactory); } /** * @return {?} */ function clearOverrides() { initServicesIfNeeded(); return Services.clearOverrides(); } /** * @param {?} ngModuleType * @param {?} bootstrapComponents * @param {?} defFactory * @return {?} */ function createNgModuleFactory(ngModuleType, bootstrapComponents, defFactory) { return new NgModuleFactory_(ngModuleType, bootstrapComponents, defFactory); } class NgModuleFactory_ extends NgModuleFactory { /** * @param {?} moduleType * @param {?} _bootstrapComponents * @param {?} _ngModuleDefFactory */ constructor(moduleType, _bootstrapComponents, _ngModuleDefFactory) { // Attention: this ctor is called as top level function. // Putting any logic in here will destroy closure tree shaking! super(); this.moduleType = moduleType; this._bootstrapComponents = _bootstrapComponents; this._ngModuleDefFactory = _ngModuleDefFactory; } /** * @param {?} parentInjector * @return {?} */ create(parentInjector) { initServicesIfNeeded(); const /** @type {?} */ def = resolveDefinition(this._ngModuleDefFactory); return Services.createNgModuleRef(this.moduleType, parentInjector || Injector.NULL, this._bootstrapComponents, def); } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ // The functions in this file verify that the assumptions we are making // about state in an instruction are correct before implementing any logic. // They are meant only to be called in dev mode as sanity checks. /** * Stringifies values such that strings are wrapped in explicit quotation marks and * other types are stringified normally. Used in error messages (e.g. assertThrow) * to make it clear that certain values are of the string type when comparing. * * e.g. `expected "3" to be 3` is easier to understand than `expected 3 to be 3`. * * @param {?} value The value to be stringified * @return {?} The stringified value */ function stringifyValueForError(value) { return typeof value === 'string' ? `"${value}"` : '' + value; } /** * @param {?} actual * @param {?} name * @return {?} */ /** * @template T * @param {?} actual * @param {?} expected * @param {?} name * @param {?=} serializer * @return {?} */ function assertEqual(actual, expected, name, serializer) { (actual != expected) && assertThrow(actual, expected, name, '==', serializer); } /** * @template T * @param {?} actual * @param {?} expected * @param {?} name * @return {?} */ function assertLessThan(actual, expected, name) { (actual < expected) && assertThrow(actual, expected, name, '>'); } /** * @template T * @param {?} actual * @param {?} name * @return {?} */ function assertNotNull(actual, name) { assertNotEqual(actual, null, name); } /** * @template T * @param {?} actual * @param {?} expected * @param {?} name * @return {?} */ function assertNotEqual(actual, expected, name) { (actual == expected) && assertThrow(actual, expected, name, '!='); } /** * Throws an error with a message constructed from the arguments. * * @template T * @param {?} actual The actual value (e.g. 3) * @param {?} expected The expected value (e.g. 5) * @param {?} name The name of the value being checked (e.g. attrs.length) * @param {?} operator The comparison operator (e.g. <, >, ==) * @param {?=} serializer Function that maps a value to its display value * @return {?} */ function assertThrow(actual, expected, name, operator, serializer = stringifyValueForError) { throw new Error(`ASSERT: expected ${name} ${operator} ${serializer(expected)} but was ${serializer(actual)}!`); } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ if (typeof ngDevMode == 'undefined') { if (typeof window != 'undefined') (/** @type {?} */ (window)).ngDevMode = true; if (typeof self != 'undefined') (/** @type {?} */ (self)).ngDevMode = true; if (typeof global != 'undefined') (/** @type {?} */ (global)).ngDevMode = true; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @param {?} node * @param {?} type * @return {?} */ function assertNodeType(node, type) { assertNotEqual(node, null, 'node'); assertEqual(node.flags & 3 /* TYPE_MASK */, type, 'Node.type', typeSerializer); } /** * @param {?} node * @param {...?} types * @return {?} */ /** * @param {?} type * @return {?} */ function typeSerializer(type) { if (type == 1 /* Projection */) return 'Projection'; if (type == 0 /* Container */) return 'Container'; if (type == 2 /* View */) return 'View'; if (type == 3 /* Element */) return 'Element'; return '??? ' + type + ' ???'; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * Finds the closest DOM node above a given container in the hierarchy. * * This is necessary to add or remove elements from the DOM when a view * is added or removed from the container. e.g. parent.removeChild(...) * * @param {?} containerNode The container node whose parent must be found * @return {?} Closest DOM node above the container */ function findNativeParent(containerNode) { let /** @type {?} */ container = containerNode; while (container) { ngDevMode && assertNodeType(container, 0 /* Container */); const /** @type {?} */ renderParent = container.data.renderParent; if (renderParent !== null) { return renderParent.native; } const /** @type {?} */ viewOrElement = /** @type {?} */ ((container.parent)); ngDevMode && assertNotNull(viewOrElement, 'container.parent'); if ((viewOrElement.flags & 3 /* TYPE_MASK */) === 3 /* Element */) { // we are an LElement, which means we are past the last LContainer. // This means than we have not been projected so just ignore. return null; } ngDevMode && assertNodeType(viewOrElement, 2 /* View */); container = (/** @type {?} */ (viewOrElement)).parent; } return null; } /** * Finds the DOM element before which a certain view should be inserting its * child elements. * * If the view has a next (e.g. for loop), elements should be inserted before * the next view's first child element. Otherwise, the container's comment * anchor is the marker. * * @param {?} index The index of the view to check * @param {?} state ContainerState of the parent container * @param {?} native Comment anchor for container * @return {?} The DOM element for which the view should insert elements */ function findBeforeNode(index, state, native) { const /** @type {?} */ views = state.views; // Find the node to insert in front of return index + 1 < views.length ? (/** @type {?} */ (views[index + 1].child)).native : native; } /** * @param {?} container * @param {?} rootNode * @param {?} insertMode * @param {?=} beforeNode * @return {?} */ function addRemoveViewFromContainer(container, rootNode, insertMode, beforeNode) { ngDevMode && assertNodeType(container, 0 /* Container */); ngDevMode && assertNodeType(rootNode, 2 /* View */); const /** @type {?} */ parent = findNativeParent(container); let /** @type {?} */ node = rootNode.child; if (parent) { while (node) { const /** @type {?} */ type = node.flags & 3; let /** @type {?} */ nextNode = null; const /** @type {?} */ renderer = container.view.renderer; const /** @type {?} */ isFnRenderer = (/** @type {?} */ (renderer)).listen; if (type === 3 /* Element */) { insertMode ? (isFnRenderer ? /** @type {?} */ (((/** @type {?} */ (renderer)) .insertBefore))(parent, /** @type {?} */ ((node.native)), /** @type {?} */ (beforeNode)) : parent.insertBefore(/** @type {?} */ ((node.native)), /** @type {?} */ (beforeNode), true)) : (isFnRenderer ? /** @type {?} */ (((/** @type {?} */ (renderer)) .removeChild))(/** @type {?} */ (parent), /** @type {?} */ ((node.native))) : parent.removeChild(/** @type {?} */ ((node.native)))); nextNode = node.next; } else if (type === 0 /* Container */) { // if we get to a container, it must be a root node of a view because we are only // propagating down into child views / containers and not child elements const /** @type {?} */ childContainerData = (/** @type {?} */ (node)).data; insertMode ? (isFnRenderer ? /** @type {?} */ (((/** @type {?} */ (renderer)) .appendChild))(/** @type {?} */ (parent), /** @type {?} */ ((node.native))) : parent.appendChild(/** @type {?} */ ((node.native)))) : (isFnRenderer ? /** @type {?} */ (((/** @type {?} */ (renderer)) .removeChild))(/** @type {?} */ (parent), /** @type {?} */ ((node.native))) : parent.removeChild(/** @type {?} */ ((node.native)))); nextNode = childContainerData.views.length ? childContainerData.views[0].child : null; } else if (type === 1 /* Projection */) { nextNode = (/** @type {?} */ (node)).data[0]; } else { nextNode = (/** @type {?} */ (node)).child; } if (nextNode === null) { while (node && !node.next) { node = node.parent; if (node === rootNode) node = null; } node = node && node.next; } else { node = nextNode; } } } } /** * Traverses the tree of component views and containers to remove listeners and * call onDestroy callbacks. * * Notes: * - Because it's used for onDestroy calls, it needs to be bottom-up. * - Must process containers instead of their views to avoid splicing * when views are destroyed and re-added. * - Using a while loop because it's faster than recursion * - Destroy only called on movement to sibling or movement to parent (laterally or up) * * \@param rootView The view to destroy * @param {?} rootView * @return {?} */ function destroyViewTree(rootView) { let /** @type {?} */ viewOrContainerState = rootView; while (viewOrContainerState) { let /** @type {?} */ next = null; if (viewOrContainerState.views && viewOrContainerState.views.length) { next = viewOrContainerState.views[0].data; } else if (viewOrContainerState.child) { next = viewOrContainerState.child; } else if (viewOrContainerState.next) { cleanUpView(/** @type {?} */ (viewOrContainerState)); next = viewOrContainerState.next; } if (next == null) { while (viewOrContainerState && !/** @type {?} */ ((viewOrContainerState)).next) { cleanUpView(/** @type {?} */ (viewOrContainerState)); viewOrContainerState = getParentState(viewOrContainerState, rootView); } cleanUpView(/** @type {?} */ (viewOrContainerState) || rootView); next = viewOrContainerState && viewOrContainerState.next; } viewOrContainerState = next; } } /** * Inserts a view into a container. * * This adds the view to the container's array of active views in the correct * position. It also adds the view's elements to the DOM if the container isn't a * root node of another view (in that case, the view's elements will be added when * the container's parent view is added later). * * @param {?} container The container into which the view should be inserted * @param {?} newView The view to insert * @param {?} index The index at which to insert the view * @return {?} The inserted view */ function insertView(container, newView, index) { const /** @type {?} */ state = container.data; const /** @type {?} */ views = state.views; if (index > 0) { // This is a new view, we need to add it to the children. setViewNext(views[index - 1], newView); } if (index < views.length && views[index].data.id !== newView.data.id) { // View ID change replace the view. setViewNext(newView, views[index]); views.splice(index, 0, newView); } else if (index >= views.length) { views.push(newView); } if (state.nextIndex <= index) { state.nextIndex++; } // If the container's renderParent is null, we know that it is a root node of its own parent view // and we should wait until that parent processes its nodes (otherwise, we will insert this view's // nodes twice - once now and once when its parent inserts its views). if (container.data.renderParent !== null) { addRemoveViewFromContainer(container, newView, true, findBeforeNode(index, state, container.native)); } // Notify query that view has been inserted container.query && container.query.insertView(container, newView, index); return newView; } /** * Removes a view from a container. * * This method splices the view from the container's array of active views. It also * removes the view's elements from the DOM and conducts cleanup (e.g. removing * listeners, calling onDestroys). * * @param {?} container The container from which to remove a view * @param {?} removeIndex The index of the view to remove * @return {?} The removed view */ function removeView(container, removeIndex) { const /** @type {?} */ views = container.data.views; const /** @type {?} */ viewNode = views[removeIndex]; if (removeIndex > 0) { setViewNext(views[removeIndex - 1], viewNode.next); } views.splice(removeIndex, 1); destroyViewTree(viewNode.data); addRemoveViewFromContainer(container, viewNode, false); // Notify query that view has been removed container.query && container.query.removeView(container, viewNode, removeIndex); return viewNode; } /** * Sets a next on the view node, so views in for loops can easily jump from * one view to the next to add/remove elements. Also adds the ViewState (view.data) * to the view tree for easy traversal when cleaning up the view. * * @param {?} view The view to set up * @param {?} next The view's new next * @return {?} */ function setViewNext(view, next) { view.next = next; view.data.next = next ? next.data : null; } /** * Determines which ViewOrContainerState to jump to when traversing back up the * tree in destroyViewTree. * * Normally, the view's parent ViewState should be checked, but in the case of * embedded views, the container (which is the view node's parent, but not the * ViewState's parent) needs to be checked for a possible next property. * * @param {?} state The ViewOrContainerState for which we need a parent state * @param {?} rootView The rootView, so we don't propagate too far up the view tree * @return {?} The correct parent ViewOrContainerState */ function getParentState(state, rootView) { let /** @type {?} */ node; if ((node = /** @type {?} */ (((/** @type {?} */ (state)))).node) && (node.flags & 3 /* TYPE_MASK */) === 2 /* View */) { // if it's an embedded view, the state needs to go up to the container, in case the // container has a next return /** @type {?} */ (((node.parent)).data); } else { // otherwise, use parent view for containers or component views return state.parent === rootView ? null : state.parent; } } /** * Removes all listeners and call all onDestroys in a given view. * * @param {?} viewState The ViewState of the view to clean up * @return {?} */ function cleanUpView(viewState) { if (!viewState.cleanup) return; const /** @type {?} */ cleanup = /** @type {?} */ ((viewState.cleanup)); for (let /** @type {?} */ i = 0; i < cleanup.length - 1; i += 2) { if (typeof cleanup[i] === 'string') { /** @type {?} */ ((cleanup))[i + 1].removeEventListener(cleanup[i], cleanup[i + 2], cleanup[i + 3]); i += 2; } else { cleanup[i].call(cleanup[i + 1]); } } viewState.cleanup = null; } /** * Appends the provided child element to the provided parent, if appropriate. * * If the parent is a view, the element will be appended as part of viewEnd(), so * the element should not be appended now. Similarly, if the child is a content child * of a parent component, the child will be appended to the right position later by * the content projection system. Otherwise, append normally. * * @param {?} parent The parent to which to append the child * @param {?} child The child that should be appended * @param {?} currentView The current view's ViewState * @return {?} Whether or not the child was appended */ function appendChild(parent, child, currentView) { // Only add native child element to parent element if the parent element is regular Element. // If parent is: // - Regular element => add child // - Component host element => // - Current View, and parent view same => content => don't add -> parent component will // re-project if needed. // - Current View, and parent view different => view => add Child // - View element => View's get added separately. if (child !== null && (parent.flags & 3 /* TYPE_MASK */) === 3 /* Element */ && (parent.view !== currentView /* Crossing View Boundaries, it is Component, but add Element of View */ || parent.data === null /* Regular Element. */)) { // We only add element if not in View or not projected. const /** @type {?} */ renderer = currentView.renderer; (/** @type {?} */ (renderer)).listen ? /** @type {?} */ (((/** @type {?} */ (renderer)).appendChild))(/** @type {?} */ (((parent.native))), child) : /** @type {?} */ ((parent.native)).appendChild(child); return true; } return false; } /** * Inserts the provided node before the correct element in the DOM, if appropriate. * * If the parent is a view, the element will be inserted as part of viewEnd(), so * the element should not be inserted now. Similarly, if the child is a content child * of a parent component, the child will be inserted to the right position later by * the content projection system. Otherwise, insertBefore normally. * * @param {?} node Node to insert * @param {?} currentView The current view's ViewState * @return {?} */ function insertChild(node, currentView) { const /** @type {?} */ parent = /** @type {?} */ ((node.parent)); // Only add child element to parent element if the parent element is regular Element. // If parent is: // - Normal element => add child // - Component element => // - Current View, and parent view same => content don't add -> parent component will // re-project if needed. // - Current View, and parent view different => view => add Child // - View element => View's get added separately. if ((parent.flags & 3 /* TYPE_MASK */) === 3 /* Element */ && (parent.view !== currentView /* Crossing View Boundaries, its Component, but add Element of View */ || parent.data === null /* Regular Element. */)) { // We only add element if not in View or not projected. let /** @type {?} */ sibling = node.next; let /** @type {?} */ nativeSibling = null; while (sibling && (nativeSibling = sibling.native) === null) { sibling = sibling.next; } const /** @type {?} */ renderer = currentView.renderer; (/** @type {?} */ (renderer)).listen ? /** @type {?} */ (((/** @type {?} */ (renderer)) .insertBefore))(/** @type {?} */ ((parent.native)), /** @type {?} */ ((node.native)), nativeSibling) : /** @type {?} */ ((parent.native)).insertBefore(/** @type {?} */ ((node.native)), nativeSibling, false); } } /** * Appends a projected node to the DOM, or in the case of a projected container, * appends the nodes from all of the container's active views to the DOM. Also stores the * node in the given projectedNodes array. * * @param {?} projectedNodes Array to store the projected node * @param {?} node The node to process * @param {?} currentParent The last parent element to be processed * @param {?} currentView The current view's ViewState * @return {?} */ /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * A utility function to match an Ivy node static data against a simple CSS selector * * @param {?} lNodeStaticData * @param {?} selector * @return {?} true if node matches the selector. */ /** * @param {?} lNodeStaticData * @param {?} selector * @return {?} */ /** * @param {?} lNodeStaticData * @param {?} selector * @return {?} */ /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * Must use this method for CD (instead of === ) since NaN !== NaN * @param {?} a * @param {?} b * @return {?} */ function isDifferent(a, b) { // NaN is the only value that is not equal to itself so the first // test checks if both a and b are not NaN return !(a !== a && b !== b) && a !== b; } /** * @param {?} value * @return {?} */ function stringify$1(value) { if (typeof value == 'function') return value.name || value; if (typeof value == 'string') return value; if (value == null) return ''; return '' + value; } /** * Function that throws a "not implemented" error so it's clear certain * behaviors/methods aren't yet ready. * * @return {?} Not implemented error */ /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * If a directive is diPublic, bloomAdd sets a property on the instance with this constant as * the key and the directive's unique ID as the value. This allows us to map directives to their * bloom filter bit for DI. */ const NG_ELEMENT_ID = '__NG_ELEMENT_ID__'; /** * The number of slots in each bloom filter (used by DI). The larger this number, the fewer * directives that will share slots, and thus, the fewer false positives when checking for * the existence of a directive. */ const BLOOM_SIZE = 128; /** * Registers this directive as present in its node's injector by flipping the directive's * corresponding bit in the injector's bloom filter. * * @param {?} injector The node injector in which the directive should be registered * @param {?} type The directive to register * @return {?} */ /** * Creates (or gets an existing) injector for a given element or container. * * @param {?} node for which an injector should be retrieved / created. * @return {?} Node injector */ /** * Constructs an injection error with the given text and token. * * @param {?} text The text of the error * @param {?} token The token associated with the error * @return {?} The error that was created */ function createInjectionError(text, token) { return new Error(`ElementInjector: ${text} [${stringify$1(token)}]`); } /** * Makes a directive public to the DI system by adding it to an injector's bloom filter. * * @param {?} di The node injector in which a directive will be added * @param {?} def The definition of the directive to be made public * @return {?} */ /** * Searches for an instance of the given directive type up the injector tree and returns * that instance if found. * * Specifically, it gets the bloom filter bit associated with the directive (see bloomHashBit), * checks that bit against the bloom filter structure to identify an injector that might have * the directive (see bloomFindPossibleInjector), then searches the directives on that injector * for a match. * * If not found, it will propagate up to the next parent injector until the token * is found or the top is reached. * * @template T * @param {?} di Node injector where the search should start * @param {?} token The directive type to search for * @param {?=} flags Injection flags (e.g. CheckParent) * @return {?} The instance found */ /** * Given a directive type, this function returns the bit in an injector's bloom filter * that should be used to determine whether or not the directive is present. * * When the directive was added to the bloom filter, it was given a unique ID that can be * retrieved on the class. Since there are only BLOOM_SIZE slots per bloom filter, the directive's * ID must be modulo-ed by BLOOM_SIZE to get the correct bloom bit (directives share slots after * BLOOM_SIZE is reached). * * @param {?} type The directive type * @return {?} The bloom bit to check for the directive */ function bloomHashBit(type) { let /** @type {?} */ id = (/** @type {?} */ (type))[NG_ELEMENT_ID]; return typeof id === 'number' ? id % BLOOM_SIZE : null; } /** * Finds the closest injector that might have a certain directive. * * Each directive corresponds to a bit in an injector's bloom filter. Given the bloom bit to * check and a starting injector, this function traverses up injectors until it finds an * injector that contains a 1 for that bit in its bloom filter. A 1 indicates that the * injector may have that directive. It only *may* have the directive because directives begin * to share bloom filter bits after the BLOOM_SIZE is reached, and it could correspond to a * different directive sharing the bit. * * Note: We can skip checking further injectors up the tree if an injector's cbf structure * has a 0 for that bloom bit. Since cbf contains the merged value of all the parent * injectors, a 0 in the bloom bit indicates that the parents definitely do not contain * the directive and do not need to be checked. * * @param {?} startInjector * @param {?} bloomBit The bit to check in each injector's bloom filter * @return {?} An injector that might have the directive */ function bloomFindPossibleInjector(startInjector, bloomBit) { // Create a mask that targets the specific bit associated with the directive we're looking for. // JS bit operations are 32 bits, so this will be a number between 2^0 and 2^31, corresponding // to bit positions 0 - 31 in a 32 bit integer. const /** @type {?} */ mask = 1 << bloomBit; // Traverse up the injector tree until we find a potential match or until we know there *isn't* a // match. let /** @type {?} */ injector = startInjector; while (injector) { // Our bloom filter size is 128 bits, which is four 32-bit bloom filter buckets: // bf0 = [0 - 31], bf1 = [32 - 63], bf2 = [64 - 95], bf3 = [96 - 127] // Get the bloom filter value from the appropriate bucket based on the directive's bloomBit. let /** @type {?} */ value = bloomBit < 64 ? (bloomBit < 32 ? injector.bf0 : injector.bf1) : (bloomBit < 96 ? injector.bf2 : injector.bf3); // If the bloom filter value has the bit corresponding to the directive's bloomBit flipped on, // this injector is a potential match. if ((value & mask) === mask) { return injector; } // If the current injector does not have the directive, check the bloom filters for the ancestor // injectors (cbf0 - cbf3). These filters capture *all* ancestor injectors. value = bloomBit < 64 ? (bloomBit < 32 ? injector.cbf0 : injector.cbf1) : (bloomBit < 96 ? injector.cbf2 : injector.cbf3); // If the ancestor bloom filter value has the bit corresponding to the directive, traverse up to // find the specific injector. If the ancestor bloom filter does not have the bit, we can abort. injector = (value & mask) ? injector.parent : null; } return null; } /** * Creates an ElementRef for a given node injector and stores it on the injector. * Or, if the ElementRef already exists, retrieves the existing ElementRef. * * @param {?} di The node injector where we should store a created ElementRef * @return {?} The ElementRef instance to use */ /** * Creates a TemplateRef and stores it on the injector. Or, if the TemplateRef already * exists, retrieves the existing TemplateRef. * * @template T * @param {?} di The node injector where we should store a created TemplateRef * @return {?} The TemplateRef instance to use */ /** * Creates a ViewContainerRef and stores it on the injector. Or, if the ViewContainerRef * already exists, retrieves the existing ViewContainerRef. * * @param {?} di * @return {?} The ViewContainerRef instance to use */ /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * A predicate which determines if a given element/directive should be included in the query * @record * @template T */ /** * @param {?} query * @return {?} */ /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** @enum {number} */ const RendererStyleFlags3 = { Important: 1, DashCase: 2, }; RendererStyleFlags3[RendererStyleFlags3.Important] = "Important"; RendererStyleFlags3[RendererStyleFlags3.DashCase] = "DashCase"; /** * Object Oriented style of API needed to create elements and text nodes. * * This is the native browser API style, e.g. operations are methods on individual objects * like HTMLElement. With this style, no additional code is needed as a facade * (reducing payload size). * * @record */ /** * Procedural style of API needed to create elements and text nodes. * * In non-native browser environments (e.g. platforms such as web-workers), this is the * facade that enables element manipulation. This also facilitates backwards compatibility * with Renderer2. * @record */ /** * @record */ const domRendererFactory3 = { createRenderer: (hostElement, rendererType) => { return document; } }; /** * Subset of API needed for appending elements and text nodes. * @record */ /** * Subset of API needed for writing attributes, properties, and setting up * listeners on Element. * @record */ /** * @record */ /** * @record */ /** * @record */ /** * @record */ /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * Directive (D) sets a property on all component instances using this constant as a key and the * component's host node (LElement) as the value. This is used in methods like detectChanges to * facilitate jumping from an instance to the host node. */ const NG_HOST_SYMBOL = '__ngHostLNode__'; /** * This property gets set before entering a template. * * This renderer can be one of two varieties of Renderer3: * * - ObjectedOrientedRenderer3 * * This is the native browser API style, e.g. operations are methods on individual objects * like HTMLElement. With this style, no additional code is needed as a facade (reducing payload * size). * * - ProceduralRenderer3 * * In non-native browser environments (e.g. platforms such as web-workers), this is the facade * that enables element manipulation. This also facilitates backwards compatibility with * Renderer2. */ let renderer; let rendererFactory; /** * Used to set the parent property when nodes are created. */ let previousOrParentNode; /** * If `isParent` is: * - `true`: then `previousOrParentNode` points to a parent node. * - `false`: then `previousOrParentNode` points to previous node (sibling). */ let isParent; /** * The current template's static data (shared between all templates of a * given type). * * Each node's static data is stored at the same index that it's stored * in the data array. Any nodes that do not have static data store a null * value to avoid a sparse array. */ let ngStaticData; /** * State of the current view being processed. */ let currentView; // The initialization has to be after the `let`, otherwise `createViewState` can't see `let`. currentView = createViewState(/** @type {?} */ ((null)), /** @type {?} */ ((null)), []); let currentQuery; /** * This property gets set before entering a template. */ let creationMode; /** * An array of nodes (text, element, container, etc), their bindings, and * any local variables that need to be stored between invocations. */ let data; /** * Points to the next binding index to read or write to. */ let bindingIndex; /** * When a view is destroyed, listeners need to be released * and onDestroy callbacks need to be called. This cleanup array * stores both listener data (in chunks of 4) and onDestroy data * (in chunks of 2), as they'll be processed at the same time. * * If it's a listener being stored: * 1st index is: event name to remove * 2nd index is: native element * 3rd index is: listener function * 4th index is: useCapture boolean * * If it's an onDestroy function: * 1st index is: onDestroy function * 2nd index is: context for function */ let cleanup; /** * Index in the data array at which view hooks begin to be stored. */ let viewHookStartIndex; /** * Swap the current state with a new state. * * For performance reasons we store the state in the top level of the module. * This way we minimize the number of properties to read. Whenever a new view * is entered we have to store the state for later, and when the view is * exited the state has to be restored * * @param {?} newViewState New state to become active * @param {?} host Element to which the View is a child of * @return {?} the previous state; */ function enterView(newViewState, host) { const /** @type {?} */ oldViewState = currentView; data = newViewState.data; bindingIndex = newViewState.bindingStartIndex || 0; ngStaticData = newViewState.ngStaticData; creationMode = newViewState.creationMode; viewHookStartIndex = newViewState.viewHookStartIndex; cleanup = newViewState.cleanup; renderer = newViewState.renderer; if (host != null) { previousOrParentNode = host; isParent = true; } currentView = newViewState; return /** @type {?} */ ((oldViewState)); } /** * Used in lieu of enterView to make it clear when we are exiting a child view. This makes * the direction of traversal (up or down the view tree) a bit clearer. * @param {?} newViewState * @return {?} */ function leaveView(newViewState) { executeViewHooks(); enterView(newViewState, null); } /** * @param {?} viewId * @param {?} renderer * @param {?} ngStaticData * @return {?} */ function createViewState(viewId, renderer, ngStaticData) { const /** @type {?} */ newView = { parent: currentView, id: viewId, // -1 for component views node: /** @type {?} */ ((null)), // until we initialize it in createNode. data: [], ngStaticData: ngStaticData, cleanup: null, renderer: renderer, child: null, tail: null, next: null, bindingStartIndex: null, creationMode: true, viewHookStartIndex: null }; return newView; } /** * @param {?} index * @param {?} type * @param {?} native * @param {?=} state * @return {?} */ function createLNode(index, type, native, state) { const /** @type {?} */ parent = isParent ? previousOrParentNode : previousOrParentNode && /** @type {?} */ (previousOrParentNode.parent); let /** @type {?} */ query = (isParent ? currentQuery : previousOrParentNode && previousOrParentNode.query) || parent && parent.query && parent.query.child(); const /** @type {?} */ isState = state != null; const /** @type {?} */ node = { flags: type, native: /** @type {?} */ (native), view: currentView, parent: /** @type {?} */ (parent), child: null, next: null, nodeInjector: parent ? parent.nodeInjector : null, data: isState ? /** @type {?} */ (state) : null, query: query, staticData: null }; if ((type & 2 /* ViewOrElement */) === 2 /* ViewOrElement */ && isState) { // Bit of a hack to bust through the readonly because there is a circular dep between // ViewState and LNode. ngDevMode && assertEqual((/** @type {?} */ (state)).node, null, 'viewState.node'); (/** @type {?} */ ((state))).node = node; } if (index != null) { // We are Element or Container ngDevMode && assertEqual(data.length, index, 'data.length not in sequence'); data[index] = node; // Every node adds a value to the static data array to avoid a sparse array if (index >= ngStaticData.length) { ngStaticData[index] = null; } else { node.staticData = /** @type {?} */ (ngStaticData[index]); } // Now link ourselves into the tree. if (isParent) { currentQuery = null; if (previousOrParentNode.view === currentView || (previousOrParentNode.flags & 3 /* TYPE_MASK */) === 2 /* View */) { // We are in the same view, which means we are adding content node to the parent View. ngDevMode && assertEqual(previousOrParentNode.child, null, 'previousNode.child'); previousOrParentNode.child = node; } else { // We are adding component view, so we don't link parent node child to this node. } } else if (previousOrParentNode) { ngDevMode && assertEqual(previousOrParentNode.next, null, 'previousNode.next'); previousOrParentNode.next = node; } } previousOrParentNode = node; isParent = true; return node; } /** * Resets the application state. * @return {?} */ function resetApplicationState() { isParent = false; previousOrParentNode = /** @type {?} */ ((null)); } /** * * @template T * @param {?} hostNode * @param {?} template Template function with the instructions. * @param {?} context to pass into the template. * @param {?} providedRendererFactory * @param {?} host Existing node to render into. * @return {?} */ /** * @template T * @param {?} node * @param {?} viewState * @param {?} componentOrContext * @param {?=} template * @return {?} */ function renderComponentOrTemplate(node, viewState, componentOrContext, template) { const /** @type {?} */ oldView = enterView(viewState, node); try { if (rendererFactory.begin) { rendererFactory.begin(); } if (template) { ngStaticData = template.ngStaticData || (template.ngStaticData = /** @type {?} */ ([])); template(/** @type {?} */ ((componentOrContext)), creationMode); } else { // Element was stored at 0 and directive was stored at 1 in renderComponent // so to refresh the component, r() needs to be called with (1, 0) (/** @type {?} */ (componentOrContext.constructor)).ngComponentDef.r(1, 0); } } finally { if (rendererFactory.end) { rendererFactory.end(); } viewState.creationMode = false; leaveView(oldView); } } /** * @return {?} */ /** * Makes a directive public to the DI system by adding it to an injector's bloom filter. * * @param {?} def The definition of the directive to be made public * @return {?} */ /** * Searches for an instance of the given directive type up the injector tree and returns * that instance if found. * * If not found, it will propagate up to the next parent injector until the token * is found or the top is reached. * * Usage example (in factory function): * * class SomeDirective { * constructor(directive: DirectiveA) {} * * static ngDirectiveDef = defineDirective({ * type: SomeDirective, * factory: () => new SomeDirective(inject(DirectiveA)) * }); * } * * @template T * @param {?} token The directive type to search for * @param {?=} flags Injection flags (e.g. CheckParent) * @return {?} The instance found */ /** * Creates an ElementRef and stores it on the injector. * Or, if the ElementRef already exists, retrieves the existing ElementRef. * * @return {?} The ElementRef instance to use */ /** * Creates a TemplateRef and stores it on the injector. Or, if the TemplateRef already * exists, retrieves the existing TemplateRef. * * @template T * @return {?} The TemplateRef instance to use */ /** * Creates a ViewContainerRef and stores it on the injector. Or, if the ViewContainerRef * already exists, retrieves the existing ViewContainerRef. * * @return {?} The ViewContainerRef instance to use */ /** * Create DOM element. The instruction must later be followed by `elementEnd()` call. * * @param {?} index Index of the element in the data array * @param {?=} nameOrComponentDef Name of the DOM Node or `ComponentDef`. * @param {?=} attrs Statically bound set of attributes to be written into the DOM element on creation. * @param {?=} localName A name under which a given element is exported. * * Attributes are passed as an array of strings where elements with an even index hold an attribute * name and elements with an odd index hold an attribute value, ex.: * ['id', 'warning5', 'class', 'alert'] * @return {?} */ function elementStart(index, nameOrComponentDef, attrs, localName) { let /** @type {?} */ node; let /** @type {?} */ native; if (nameOrComponentDef == null) { // native node retrieval - used for exporting elements as tpl local variables (<div #foo>) const /** @type {?} */ node = /** @type {?} */ ((data[index])); native = node && (/** @type {?} */ (node)).native; } else { ngDevMode && assertEqual(currentView.bindingStartIndex, null, 'bindingStartIndex'); const /** @type {?} */ isHostElement = typeof nameOrComponentDef !== 'string'; const /** @type {?} */ name = isHostElement ? (/** @type {?} */ (nameOrComponentDef)).tag : /** @type {?} */ (nameOrComponentDef); if (name === null) { // TODO: future support for nameless components. throw 'for now name is required'; } else { native = renderer.createElement(name); let /** @type {?} */ componentView = null; if (isHostElement) { const /** @type {?} */ ngStaticData = getTemplateStatic((/** @type {?} */ (nameOrComponentDef)).template); componentView = addToViewTree(createViewState(-1, rendererFactory.createRenderer(native, (/** @type {?} */ (nameOrComponentDef)).rendererType), ngStaticData)); } // Only component views should be added to the view tree directly. Embedded views are // accessed through their containers because they may be removed / re-added later. node = createLNode(index, 3 /* Element */, native, componentView); if (node.staticData == null) { ngDevMode && assertDataInRange(index - 1); node.staticData = ngStaticData[index] = createNodeStatic(name, attrs || null, null, localName || null); } if (attrs) setUpAttributes(native, attrs); appendChild(/** @type {?} */ ((node.parent)), native, currentView); } } return native; } /** * Gets static data from a template function or creates a new static * data array if it doesn't already exist. * * @param {?} template The template from which to get static data * @return {?} NgStaticData */ function getTemplateStatic(template) { return template.ngStaticData || (template.ngStaticData = /** @type {?} */ ([])); } /** * @param {?} native * @param {?} attrs * @return {?} */ function setUpAttributes(native, attrs) { ngDevMode && assertEqual(attrs.length % 2, 0, 'attrs.length % 2'); const /** @type {?} */ isProceduralRenderer = (/** @type {?} */ (renderer)).setAttribute; for (let /** @type {?} */ i = 0; i < attrs.length; i += 2) { isProceduralRenderer ? /** @type {?} */ (((/** @type {?} */ (renderer)).setAttribute))(native, attrs[i], attrs[i | 1]) : native.setAttribute(attrs[i], attrs[i | 1]); } } /** * @param {?} text * @param {?} token * @return {?} */ function createError(text, token) { return new Error(`Renderer: ${text} [${stringify$1(token)}]`); } /** * Locates the host native element, used for bootstrapping existing nodes into rendering pipeline. * * @param {?} factory * @param {?} elementOrSelector Render element or CSS selector to locate the element. * @return {?} */ function locateHostElement(factory, elementOrSelector) { ngDevMode && assertDataInRange(-1); rendererFactory = factory; const /** @type {?} */ defaultRenderer = factory.createRenderer(null, null); const /** @type {?} */ rNode = typeof elementOrSelector === 'string' ? ((/** @type {?} */ (defaultRenderer)).selectRootElement ? (/** @type {?} */ (defaultRenderer)).selectRootElement(elementOrSelector) : /** @type {?} */ (((/** @type {?} */ (defaultRenderer)).querySelector))(elementOrSelector)) : elementOrSelector; if (ngDevMode && !rNode) { if (typeof elementOrSelector === 'string') { throw createError('Host node with selector not found:', elementOrSelector); } else { throw createError('Host node is required:', elementOrSelector); } } return rNode; } /** * Creates the host LNode.. * * @param {?} rNode Render host element. * @param {?} def * @return {?} */ function hostElement(rNode, def) { resetApplicationState(); createLNode(0, 3 /* Element */, rNode, createViewState(-1, renderer, getTemplateStatic(def.template))); } /** * Adds an event listener to the current node. * * If an output exists on one of the node's directives, it also subscribes to the output * and saves the subscription for later cleanup. * * @param {?} eventName Name of the event * @param {?} listener The function to be called when event emits * @param {?=} useCapture Whether or not to use capture in event listener. * @return {?} */ /** * Mark the end of the element. * @return {?} */ function elementEnd() { if (isParent) { isParent = false; } else { ngDevMode && assertHasParent(); previousOrParentNode = /** @type {?} */ ((previousOrParentNode.parent)); } ngDevMode && assertNodeType(previousOrParentNode, 3 /* Element */); const /** @type {?} */ query = previousOrParentNode.query; query && query.addNode(previousOrParentNode); } /** * Update an attribute on an Element. This is used with a `bind` instruction. * * @param {?} index The index of the element to update in the data array * @param {?} attrName Name of attribute. Because it is going to DOM, this is not subject to * renaming as port of minification. * @param {?} value Value to write. This value will go through stringification. * @return {?} */ /** * Update a property on an Element. * * If the property name also exists as an input property on one of the element's directives, * the component property will be set instead of the element property. This check must * be conducted at runtime so child components that add new \@Inputs don't have to be re-compiled. * * @template T * @param {?} index The index of the element to update in the data array * @param {?} propName Name of property. Because it is going to DOM, this is not subject to * renaming as part of minification. * @param {?} value New value to write. * @return {?} */ function elementProperty(index, propName, value) { if (value === NO_CHANGE) return; const /** @type {?} */ node = /** @type {?} */ (data[index]); let /** @type {?} */ staticData = /** @type {?} */ ((node.staticData)); // if staticData.inputs is undefined, a listener has created output staticData, but inputs haven't // yet been checked if (staticData.inputs === undefined) { // mark inputs as checked staticData.inputs = null; staticData = generatePropertyAliases(node.flags, staticData, true); } const /** @type {?} */ inputData = staticData.inputs; let /** @type {?} */ dataValue; if (inputData && (dataValue = inputData[propName])) { setInputsForProperty(dataValue, value); } else { const /** @type {?} */ native = node.native; (/** @type {?} */ (renderer)).setProperty ? (/** @type {?} */ (renderer)).setProperty(native, propName, value) : native.setProperty ? native.setProperty(propName, value) : (/** @type {?} */ (native))[propName] = value; } } /** * Constructs a LNodeStatic object from the arguments. * * @param {?} tagName * @param {?} attrs * @param {?} containerStatic * @param {?} localName * @return {?} the LNodeStatic object */ function createNodeStatic(tagName, attrs, containerStatic, localName) { return { tagName: tagName, attrs: attrs, localNames: localName ? [localName, -1] : null, initialInputs: undefined, inputs: undefined, outputs: undefined, containerStatic: containerStatic }; } /** * Given a list of directive indices and minified input names, sets the * input properties on the corresponding directives. * @param {?} inputs * @param {?} value * @return {?} */ function setInputsForProperty(inputs, value) { for (let /** @type {?} */ i = 0; i < inputs.length; i += 2) { ngDevMode && assertDataInRange(/** @type {?} */ (inputs[i])); data[/** @type {?} */ (inputs[i])][inputs[i | 1]] = value; } } /** * This function consolidates all the inputs or outputs defined by directives * on this node into one object and stores it in ngStaticData so it can * be shared between all templates of this type. * * @param {?} flags * @param {?} data * @param {?=} isInputData * @return {?} */ function generatePropertyAliases(flags, data, isInputData = false) { const /** @type {?} */ start = flags >> 12; const /** @type {?} */ size = (flags & 4092 /* SIZE_MASK */) >> 2; for (let /** @type {?} */ i = start, /** @type {?} */ ii = start + size; i < ii; i++) { const /** @type {?} */ directiveDef = /** @type {?} */ (((ngStaticData))[i]); const /** @type {?} */ propertyAliasMap = isInputData ? directiveDef.inputs : directiveDef.outputs; for (let /** @type {?} */ publicName in propertyAliasMap) { if (propertyAliasMap.hasOwnProperty(publicName)) { const /** @type {?} */ internalName = propertyAliasMap[publicName]; const /** @type {?} */ staticDirData = isInputData ? (data.inputs || (data.inputs = {})) : (data.outputs || (data.outputs = {})); const /** @type {?} */ hasProperty = staticDirData.hasOwnProperty(publicName); hasProperty ? staticDirData[publicName].push(i, internalName) : (staticDirData[publicName] = [i, internalName]); } } } return data; } /** * Add or remove a class in a classList. * * This instruction is meant to handle the [class.foo]="exp" case * * @template T * @param {?} index The index of the element to update in the data array * @param {?} className Name of class to toggle. Because it is going to DOM, this is not subject to * renaming as part of minification. * @param {?} value A value indicating if a given class should be added or removed. * @return {?} */ /** * Update a given style on an Element. * * @template T * @param {?} index Index of the element to change in the data array * @param {?} styleName Name of property. Because it is going to DOM this is not subject to * renaming as part of minification. * @param {?} value New value to write (null to remove). * @param {?=} suffix Suffix to add to style's value (optional). * @return {?} */ function elementStyle(index, styleName, value, suffix) { if (value !== NO_CHANGE) { const /** @type {?} */ lElement = /** @type {?} */ (data[index]); if (value == null) { (/** @type {?} */ (renderer)).removeStyle ? (/** @type {?} */ (renderer)) .removeStyle(lElement.native, styleName, RendererStyleFlags3.DashCase) : lElement.native.style.removeProperty(styleName); } else { (/** @type {?} */ (renderer)).setStyle ? (/** @type {?} */ (renderer)) .setStyle(lElement.native, styleName, suffix ? stringify$1(value) + suffix : stringify$1(value), RendererStyleFlags3.DashCase) : lElement.native.style.setProperty(styleName, suffix ? stringify$1(value) + suffix : stringify$1(value)); } } } /** * Create static text node * * @param {?} index Index of the node in the data array. * @param {?=} value Value to write. This value will be stringified. * If value is not provided than the actual creation of the text node is delayed. * @return {?} */ function text(index, value) { ngDevMode && assertEqual(currentView.bindingStartIndex, null, 'bindingStartIndex'); const /** @type {?} */ textNode = value != null ? ((/** @type {?} */ (renderer)).createText ? (/** @type {?} */ (renderer)).createText(stringify$1(value)) : /** @type {?} */ (((/** @type {?} */ (renderer)).createTextNode))(stringify$1(value))) : null; const /** @type {?} */ node = createLNode(index, 3 /* Element */, textNode); // Text nodes are self closing. isParent = false; appendChild(/** @type {?} */ ((node.parent)), textNode, currentView); } /** * Create text node with binding * Bindings should be handled externally with the proper bind(1-8) method * * @template T * @param {?} index Index of the node in the data array. * @param {?} value Stringified value to write. * @return {?} */ function textBinding(index, value) { // TODO(misko): I don't think index < nodes.length check is needed here. let /** @type {?} */ existingNode = index < data.length && /** @type {?} */ (data[index]); if (existingNode && existingNode.native) { // If DOM node exists and value changed, update textContent value !== NO_CHANGE && ((/** @type {?} */ (renderer)).setValue ? (/** @type {?} */ (renderer)).setValue(existingNode.native, stringify$1(value)) : existingNode.native.textContent = stringify$1(value)); } else if (existingNode) { // Node was created but DOM node creation was delayed. Create and append now. existingNode.native = ((/** @type {?} */ (renderer)).createText ? (/** @type {?} */ (renderer)).createText(stringify$1(value)) : /** @type {?} */ (((/** @type {?} */ (renderer)).createTextNode))(stringify$1(value))); insertChild(existingNode, currentView); } else { text(index, value); } } /** * @template T * @param {?} index * @param {?=} directive * @param {?=} directiveDef * @param {?=} localName * @return {?} */ function directive(index, directive, directiveDef, localName) { let /** @type {?} */ instance; if (directive == null) { // return existing ngDevMode && assertDataInRange(index); instance = data[index]; } else { ngDevMode && assertEqual(currentView.bindingStartIndex, null, 'bindingStartIndex'); ngDevMode && assertPreviousIsParent(); let /** @type {?} */ flags = /** @type {?} */ ((previousOrParentNode)).flags; let /** @type {?} */ size = flags & 4092; if (size === 0) { flags = (index << 12 /* INDX_SHIFT */) | 4 /* SIZE_SKIP */ | flags & 3 /* TYPE_MASK */; } else { flags += 4 /* SIZE_SKIP */; } /** @type {?} */ ((previousOrParentNode)).flags = flags; ngDevMode && assertDataInRange(index - 1); Object.defineProperty(directive, NG_HOST_SYMBOL, { enumerable: false, value: previousOrParentNode }); data[index] = instance = directive; if (index >= ngStaticData.length) { ngStaticData[index] = /** @type {?} */ ((directiveDef)); if (localName) { ngDevMode && assertNotNull(previousOrParentNode.staticData, 'previousOrParentNode.staticData'); const /** @type {?} */ nodeStaticData = /** @type {?} */ ((/** @type {?} */ ((previousOrParentNode)).staticData)); (nodeStaticData.localNames || (nodeStaticData.localNames = [])).push(localName, index); } } const /** @type {?} */ diPublic = /** @type {?} */ ((directiveDef)).diPublic; if (diPublic) { diPublic(/** @type {?} */ ((directiveDef))); } const /** @type {?} */ staticData = /** @type {?} */ ((previousOrParentNode.staticData)); if (staticData && staticData.attrs) { setInputsFromAttrs(instance, /** @type {?} */ ((directiveDef)).inputs, staticData); } } return instance; } /** * Sets initial input properties on directive instances from attribute data * * @template T * @param {?} instance Instance of the directive on which to set the initial inputs * @param {?} inputs The list of inputs from the directive def * @param {?} staticData The static data for this node * @return {?} */ function setInputsFromAttrs(instance, inputs, staticData) { const /** @type {?} */ directiveIndex = ((previousOrParentNode.flags & 4092 /* SIZE_MASK */) >> 2 /* SIZE_SHIFT */) - 1; let /** @type {?} */ initialInputData = /** @type {?} */ (staticData.initialInputs); if (initialInputData === undefined || directiveIndex >= initialInputData.length) { initialInputData = generateInitialInputs(directiveIndex, inputs, staticData); } const /** @type {?} */ initialInputs = initialInputData[directiveIndex]; if (initialInputs) { for (let /** @type {?} */ i = 0; i < initialInputs.length; i += 2) { (/** @type {?} */ (instance))[initialInputs[i]] = initialInputs[i | 1]; } } } /** * Generates initialInputData for a node and stores it in the template's static storage * so subsequent template invocations don't have to recalculate it. * * initialInputData is an array containing values that need to be set as input properties * for directives on this node, but only once on creation. We need this array to support * the case where you set an \@Input property of a directive using attribute-like syntax. * e.g. if you have a `name` \@Input, you can set it once like this: * * <my-component name="Bess"></my-component> * * @param {?} directiveIndex Index to store the initial input data * @param {?} inputs The list of inputs from the directive def * @param {?} staticData The static data on this node * @return {?} */ function generateInitialInputs(directiveIndex, inputs, staticData) { const /** @type {?} */ initialInputData = staticData.initialInputs || (staticData.initialInputs = []); initialInputData[directiveIndex] = null; const /** @type {?} */ attrs = /** @type {?} */ ((staticData.attrs)); for (let /** @type {?} */ i = 0; i < attrs.length; i += 2) { const /** @type {?} */ attrName = attrs[i]; const /** @type {?} */ minifiedInputName = inputs[attrName]; if (minifiedInputName !== undefined) { const /** @type {?} */ inputsToStore = initialInputData[directiveIndex] || (initialInputData[directiveIndex] = []); inputsToStore.push(minifiedInputName, attrs[i | 1]); } } return initialInputData; } /** * @param {?} lifecycle * @param {?=} self * @param {?=} method * @return {?} */ /** * Iterates over view hook functions and calls them. * @return {?} */ function executeViewHooks() { if (viewHookStartIndex == null) return; // Instead of using splice to remove init hooks after their first run (expensive), we // shift over the AFTER_CHECKED hooks as we call them and truncate once at the end. let /** @type {?} */ checkIndex = /** @type {?} */ (viewHookStartIndex); let /** @type {?} */ writeIndex = checkIndex; while (checkIndex < data.length) { // Call lifecycle hook with its context data[checkIndex + 1].call(data[checkIndex + 2]); if (data[checkIndex] === 16 /* AFTER_VIEW_CHECKED */) { // We know if the writeIndex falls behind that there is an init that needs to // be overwritten. if (writeIndex < checkIndex) { data[writeIndex] = data[checkIndex]; data[writeIndex + 1] = data[checkIndex + 1]; data[writeIndex + 2] = data[checkIndex + 2]; } writeIndex += 3; } checkIndex += 3; } // Truncate once at the writeIndex data.length = writeIndex; } /** * Creates an LContainer. * * Only `LView`s can go into `LContainer`. * * @param {?} index The index of the container in the data array * @param {?=} template Optional inline template * @param {?=} tagName The name of the container element, if applicable * @param {?=} attrs The attrs attached to the container, if applicable * @param {?=} localName * @return {?} */ function containerStart(index, template, tagName, attrs, localName) { ngDevMode && assertEqual(currentView.bindingStartIndex, null, 'bindingStartIndex'); // If the direct parent of the container is a view, its views (including its comment) // will need to be added through insertView() when its parent view is being inserted. // For now, it is marked "headless" so we know to append its views later. let /** @type {?} */ comment = renderer.createComment(ngDevMode ? 'container' : ''); let /** @type {?} */ renderParent = null; const /** @type {?} */ currentParent = isParent ? previousOrParentNode : /** @type {?} */ ((previousOrParentNode.parent)); ngDevMode && assertNotEqual(currentParent, null, 'currentParent'); if (appendChild(currentParent, comment, currentView)) { // we are adding to an Element which is either: // - Not a component (will not be re-projected, just added) // - View of the Component renderParent = /** @type {?} */ (currentParent); } const /** @type {?} */ node = createLNode(index, 0 /* Container */, comment, /** @type {?} */ ({ views: [], nextIndex: 0, renderParent, template: template == null ? null : template, next: null, parent: currentView })); if (node.staticData == null) { node.staticData = ngStaticData[index] = createNodeStatic(tagName || null, attrs || null, [], localName || null); } // Containers are added to the current view tree instead of their embedded views // because views can be removed and re-inserted. addToViewTree(node.data); } /** * @return {?} */ function containerEnd() { if (isParent) { isParent = false; } else { ngDevMode && assertHasParent(); previousOrParentNode = /** @type {?} */ ((previousOrParentNode.parent)); } ngDevMode && assertNodeType(previousOrParentNode, 0 /* Container */); const /** @type {?} */ query = previousOrParentNode.query; query && query.addNode(previousOrParentNode); } /** * Sets a container up to receive views. * * @param {?} index The index of the container in the data array * @return {?} */ function containerRefreshStart(index) { ngDevMode && assertDataInRange(index); previousOrParentNode = /** @type {?} */ (data[index]); ngDevMode && assertNodeType(previousOrParentNode, 0 /* Container */); isParent = true; (/** @type {?} */ (previousOrParentNode)).data.nextIndex = 0; } /** * Marks the end of the LContainer. * * Marking the end of ViewContainer is the time when to child Views get inserted or removed. * @return {?} */ function containerRefreshEnd() { if (isParent) { isParent = false; } else { ngDevMode && assertNodeType(previousOrParentNode, 2 /* View */); ngDevMode && assertHasParent(); previousOrParentNode = /** @type {?} */ ((previousOrParentNode.parent)); } ngDevMode && assertNodeType(previousOrParentNode, 0 /* Container */); const /** @type {?} */ container = /** @type {?} */ (previousOrParentNode); ngDevMode && assertNodeType(container, 0 /* Container */); const /** @type {?} */ nextIndex = container.data.nextIndex; while (nextIndex < container.data.views.length) { // remove extra view. removeView(container, nextIndex); } } /** * Creates an LView. * * @param {?} viewBlockId The ID of this view * @return {?} Whether or not this view is in creation mode */ function viewStart(viewBlockId) { const /** @type {?} */ container = /** @type {?} */ ((isParent ? previousOrParentNode : /** @type {?} */ ((previousOrParentNode.parent)))); ngDevMode && assertNodeType(container, 0 /* Container */); const /** @type {?} */ containerState = container.data; const /** @type {?} */ views = containerState.views; const /** @type {?} */ existingView = !creationMode && containerState.nextIndex < views.length && views[containerState.nextIndex]; let /** @type {?} */ viewUpdateMode = existingView && viewBlockId === (/** @type {?} */ (existingView)).data.id; if (viewUpdateMode) { previousOrParentNode = views[containerState.nextIndex++]; ngDevMode && assertNodeType(previousOrParentNode, 2 /* View */); isParent = true; enterView((/** @type {?} */ (existingView)).data, /** @type {?} */ (previousOrParentNode)); } else { // When we create a new View, we always reset the state of the instructions. const /** @type {?} */ newViewState = createViewState(viewBlockId, renderer, initViewStaticData(viewBlockId, container)); enterView(newViewState, createLNode(null, 2 /* View */, null, newViewState)); containerState.nextIndex++; } return !viewUpdateMode; } /** * Initialize the static data for the active view. * * Each embedded view needs to set the global ngStaticData variable to the static data for * that view. Otherwise, the view's static data for a particular node would overwrite * the staticdata for a node in the view above it with the same index (since it's in the * same template). * * @param {?} viewIndex The index of the view's static data in containerStatic * @param {?} parent The parent container in which to look for the view's static data * @return {?} NgStaticData */ function initViewStaticData(viewIndex, parent) { ngDevMode && assertNodeType(parent, 0 /* Container */); const /** @type {?} */ containerStatic = (/** @type {?} */ (((parent)).staticData)).containerStatic; if (viewIndex >= containerStatic.length || containerStatic[viewIndex] == null) { containerStatic[viewIndex] = []; } return containerStatic[viewIndex]; } /** * Marks the end of the LView. * @return {?} */ function viewEnd() { isParent = false; const /** @type {?} */ viewNode = previousOrParentNode = /** @type {?} */ (currentView.node); const /** @type {?} */ container = /** @type {?} */ (previousOrParentNode.parent); ngDevMode && assertNodeType(viewNode, 2 /* View */); ngDevMode && assertNodeType(container, 0 /* Container */); const /** @type {?} */ containerState = container.data; const /** @type {?} */ previousView = containerState.nextIndex <= containerState.views.length ? /** @type {?} */ (containerState.views[containerState.nextIndex - 1]) : null; const /** @type {?} */ viewIdChanged = previousView == null ? true : previousView.data.id !== viewNode.data.id; if (viewIdChanged) { insertView(container, viewNode, containerState.nextIndex - 1); currentView.creationMode = false; } leaveView(/** @type {?} */ ((/** @type {?} */ ((currentView)).parent))); ngDevMode && assertEqual(isParent, false, 'isParent'); ngDevMode && assertNodeType(previousOrParentNode, 2 /* View */); } /** * Refreshes the component view. * * In other words, enters the component's view and processes it to update bindings, queries, etc. * * @param directiveIndex * @param elementIndex * @param template */ const componentRefresh = function (directiveIndex, elementIndex, template) { ngDevMode && assertDataInRange(elementIndex); const /** @type {?} */ element = /** @type {?} */ (((data))[elementIndex]); ngDevMode && assertNodeType(element, 3 /* Element */); ngDevMode && assertNotEqual(element.data, null, 'isComponent'); ngDevMode && assertDataInRange(directiveIndex); const /** @type {?} */ hostView = /** @type {?} */ ((element.data)); ngDevMode && assertNotEqual(hostView, null, 'hostView'); const /** @type {?} */ directive = data[directiveIndex]; const /** @type {?} */ oldView = enterView(hostView, element); try { template(directive, creationMode); } finally { hostView.creationMode = false; leaveView(oldView); } }; /** * Instruction to distribute projectable nodes among <ng-content> occurrences in a given template. * It takes all the selectors from the entire component's template and decides where * each projected node belongs (it re-distributes nodes among "buckets" where each "bucket" is * backed by a selector). * * @param {?=} selectors * @return {?} */ /** * Inserts previously re-distributed projected nodes. This instruction must be preceded by a call * to the projectionDef instruction. * * @param {?} nodeIndex * @param {?} localIndex - index under which distribution of projected nodes was memorized * @param {?=} selectorIndex - 0 means <ng-content> without any selector * @return {?} */ /** * Adds a ViewState or a ContainerState to the end of the current view tree. * * This structure will be used to traverse through nested views to remove listeners * and call onDestroy callbacks. * * @template T * @param {?} state The ViewState or ContainerState to add to the view tree * @return {?} The state passed in */ function addToViewTree(state) { currentView.tail ? (currentView.tail.next = state) : (currentView.child = state); currentView.tail = state; return state; } /** * A special value which designates that a value has not changed. */ const NO_CHANGE = /** @type {?} */ ({}); /** * Create interpolation bindings with variable number of arguments. * * If any of the arguments change, then the interpolation is concatenated * and causes an update. * * @param {?} values an array of values to diff. * @return {?} */ /** * Create a single value binding without interpolation. * * @template T * @param {?} value Value to diff * @return {?} */ function bind(value) { let /** @type {?} */ different; if (different = creationMode) { if (typeof currentView.bindingStartIndex !== 'number') { bindingIndex = currentView.bindingStartIndex = data.length; } data[bindingIndex++] = value; } else { if (different = value !== NO_CHANGE && isDifferent(data[bindingIndex], value)) { data[bindingIndex] = value; } bindingIndex++; } return different ? value : NO_CHANGE; } /** * Create an interpolation bindings with 1 arguments. * * @param {?} prefix static value used for concatenation only. * @param {?} value value checked for change. * @param {?} suffix static value used for concatenation only. * @return {?} */ function bind1(prefix, value, suffix) { return bind(value) === NO_CHANGE ? NO_CHANGE : prefix + stringify$1(value) + suffix; } /** * Create an interpolation bindings with 2 arguments. * * @param {?} prefix * @param {?} v0 value checked for change * @param {?} i0 * @param {?} v1 value checked for change * @param {?} suffix * @return {?} */ /** * Create an interpolation bindings with 3 arguments. * * @param {?} prefix * @param {?} v0 * @param {?} i0 * @param {?} v1 * @param {?} i1 * @param {?} v2 * @param {?} suffix * @return {?} */ /** * Create an interpolation binding with 4 arguments. * * @param {?} prefix * @param {?} v0 * @param {?} i0 * @param {?} v1 * @param {?} i1 * @param {?} v2 * @param {?} i2 * @param {?} v3 * @param {?} suffix * @return {?} */ /** * Create an interpolation binding with 5 arguments. * * @param {?} prefix * @param {?} v0 * @param {?} i0 * @param {?} v1 * @param {?} i1 * @param {?} v2 * @param {?} i2 * @param {?} v3 * @param {?} i3 * @param {?} v4 * @param {?} suffix * @return {?} */ /** * Create an interpolation binding with 6 arguments. * * @param {?} prefix * @param {?} v0 * @param {?} i0 * @param {?} v1 * @param {?} i1 * @param {?} v2 * @param {?} i2 * @param {?} v3 * @param {?} i3 * @param {?} v4 * @param {?} i4 * @param {?} v5 * @param {?} suffix * @return {?} */ /** * Create an interpolation binding with 7 arguments. * * @param {?} prefix * @param {?} v0 * @param {?} i0 * @param {?} v1 * @param {?} i1 * @param {?} v2 * @param {?} i2 * @param {?} v3 * @param {?} i3 * @param {?} v4 * @param {?} i4 * @param {?} v5 * @param {?} i5 * @param {?} v6 * @param {?} suffix * @return {?} */ /** * Create an interpolation binding with 8 arguments. * * @param {?} prefix * @param {?} v0 * @param {?} i0 * @param {?} v1 * @param {?} i1 * @param {?} v2 * @param {?} i2 * @param {?} v3 * @param {?} i3 * @param {?} v4 * @param {?} i4 * @param {?} v5 * @param {?} i5 * @param {?} v6 * @param {?} i6 * @param {?} v7 * @param {?} suffix * @return {?} */ /** * @template T * @param {?} index * @param {?=} value * @return {?} */ /** * @template T * @param {?} predicate * @param {?=} descend * @param {?=} read * @return {?} */ /** * @return {?} */ function assertPreviousIsParent() { assertEqual(isParent, true, 'isParent'); } /** * @return {?} */ function assertHasParent() { assertNotEqual(previousOrParentNode.parent, null, 'isParent'); } /** * @param {?} index * @param {?=} arr * @return {?} */ function assertDataInRange(index, arr) { if (arr == null) arr = data; assertLessThan(arr ? arr.length : 0, index, 'data.length'); } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * Options that control how the component should be bootstrapped. * @record */ /** * Bootstraps a component, then creates and returns a `ComponentRef` for that component. * * @template T * @param {?} componentType Component to bootstrap * @param {?} opts * @return {?} */ // TODO: A hack to not pull in the NullInjector from @angular/core. /** * Bootstraps a Component into an existing host element and returns an instance * of the component. * * @template T * @param {?} componentType Component to bootstrap * @param {?=} opts * @return {?} */ function renderComponent(componentType, opts = {}) { const /** @type {?} */ rendererFactory = opts.rendererFactory || domRendererFactory3; const /** @type {?} */ componentDef = componentType.ngComponentDef; let /** @type {?} */ component; const /** @type {?} */ hostNode = locateHostElement(rendererFactory, opts.host || componentDef.tag); const /** @type {?} */ oldView = enterView(createViewState(-1, rendererFactory.createRenderer(hostNode, componentDef.rendererType), []), /** @type {?} */ ((null))); try { // Create element node at index 0 in data array hostElement(hostNode, componentDef); // Create directive instance with n() and store at index 1 in data array (el is 0) component = directive(1, componentDef.n(), componentDef); } finally { leaveView(oldView); } opts.features && opts.features.forEach((feature) => feature(component, componentDef)); detectChanges(component); return component; } /** * @template T * @param {?} component * @return {?} */ function detectChanges(component) { ngDevMode && assertNotNull(component, 'component'); const /** @type {?} */ hostNode = /** @type {?} */ ((/** @type {?} */ (component))[NG_HOST_SYMBOL]); if (ngDevMode && !hostNode) { createError('Not a directive instance', component); } ngDevMode && assertNotNull(hostNode.data, 'hostNode.data'); renderComponentOrTemplate(hostNode, hostNode.view, component); isDirty = false; } let isDirty = false; /** * @template T * @param {?} component * @param {?=} scheduler * @return {?} */ /** * @template T * @param {?} component * @return {?} */ /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * Create a component definition object. * * * # Example * ``` * class MyDirective { * // Generated by Angular Template Compiler * // [Symbol] syntax will not be supported by TypeScript until v2.7 * static [COMPONENT_DEF_SYMBOL] = defineComponent({ * ... * }); * } * ``` * @template T * @param {?} componentDefinition * @return {?} */ function defineComponent(componentDefinition) { const /** @type {?} */ def = /** @type {?} */ ({ type: componentDefinition.type, diPublic: null, n: componentDefinition.factory, tag: (/** @type {?} */ (componentDefinition)).tag || /** @type {?} */ ((null)), template: (/** @type {?} */ (componentDefinition)).template || /** @type {?} */ ((null)), r: componentDefinition.refresh || function (d, e) { componentRefresh(d, e, componentDefinition.template); }, h: componentDefinition.hostBindings || noop$1, inputs: invertObject(componentDefinition.inputs), outputs: invertObject(componentDefinition.outputs), methods: invertObject(componentDefinition.methods), rendererType: resolveRendererType2(componentDefinition.rendererType) || null, }); const /** @type {?} */ feature = componentDefinition.features; feature && feature.forEach((fn) => fn(def)); return def; } /** * @template T * @param {?} definition * @return {?} */ /** * @template T * @param {?} definition * @return {?} */ const EMPTY$1 = {}; /** * @return {?} */ function noop$1() { } /** * Swaps the keys and values of an object. * @param {?} obj * @return {?} */ function invertObject(obj) { if (obj == null) return EMPTY$1; const /** @type {?} */ newObj = {}; for (let /** @type {?} */ minifiedKey in obj) { newObj[obj[minifiedKey]] = minifiedKey; } return newObj; } /** * Create a directive definition object. * * # Example * ``` * class MyDirective { * // Generated by Angular Template Compiler * // [Symbol] syntax will not be supported by TypeScript until v2.7 * static [DIRECTIVE_DEF_SYMBOL] = defineDirective({ * ... * }); * } * ``` */ /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ // clang-format on /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license * @record */ /** * \@experimental Animation support is experimental. */ /** * \@experimental Animation support is experimental. * @record */ /** * Metadata representing the entry of animations. Instances of this interface are provided via the * animation DSL when the {\@link trigger trigger animation function} is called. * * \@experimental Animation support is experimental. * @record */ /** * Metadata representing the entry of animations. Instances of this interface are provided via the * animation DSL when the {\@link state state animation function} is called. * * \@experimental Animation support is experimental. * @record */ /** * Metadata representing the entry of animations. Instances of this interface are provided via the * animation DSL when the {\@link transition transition animation function} is called. * * \@experimental Animation support is experimental. * @record */ /** * \@experimental Animation support is experimental. * @record */ /** * \@experimental Animation support is experimental. * @record */ /** * Metadata representing the entry of animations. Instances of this interface are provided via the * animation DSL when the {\@link keyframes keyframes animation function} is called. * * \@experimental Animation support is experimental. * @record */ /** * Metadata representing the entry of animations. Instances of this interface are provided via the * animation DSL when the {\@link style style animation function} is called. * * \@experimental Animation support is experimental. * @record */ /** * Metadata representing the entry of animations. Instances of this interface are provided via the * animation DSL when the {\@link animate animate animation function} is called. * * \@experimental Animation support is experimental. * @record */ /** * Metadata representing the entry of animations. Instances of this interface are provided via the * animation DSL when the {\@link animateChild animateChild animation function} is called. * * \@experimental Animation support is experimental. * @record */ /** * Metadata representing the entry of animations. Instances of this interface are provided via the * animation DSL when the {\@link useAnimation useAnimation animation function} is called. * * \@experimental Animation support is experimental. * @record */ /** * Metadata representing the entry of animations. Instances of this interface are provided via the * animation DSL when the {\@link sequence sequence animation function} is called. * * \@experimental Animation support is experimental. * @record */ /** * Metadata representing the entry of animations. Instances of this interface are provided via the * animation DSL when the {\@link group group animation function} is called. * * \@experimental Animation support is experimental. * @record */ /** * Metadata representing the entry of animations. Instances of this interface are provided via the * animation DSL when the {\@link stagger stagger animation function} is called. * * \@experimental Animation support is experimental. * @record */ /** * `trigger` is an animation-specific function that is designed to be used inside of Angular's * animation DSL language. If this information is new, please navigate to the * {\@link Component#animations component animations metadata page} to gain a better * understanding of how animations in Angular are used. * * `trigger` Creates an animation trigger which will a list of {\@link state state} and * {\@link transition transition} entries that will be evaluated when the expression * bound to the trigger changes. * * Triggers are registered within the component annotation data under the * {\@link Component#animations animations section}. An animation trigger can be placed on an element * within a template by referencing the name of the trigger followed by the expression value that * the * trigger is bound to (in the form of `[\@triggerName]="expression"`. * * Animation trigger bindings strigify values and then match the previous and current values against * any linked transitions. If a boolean value is provided into the trigger binding then it will both * be represented as `1` or `true` and `0` or `false` for a true and false boolean values * respectively. * * ### Usage * * `trigger` will create an animation trigger reference based on the provided `name` value. The * provided `animation` value is expected to be an array consisting of {\@link state state} and * {\@link transition transition} declarations. * * ```typescript * \@Component({ * selector: 'my-component', * templateUrl: 'my-component-tpl.html', * animations: [ * trigger("myAnimationTrigger", [ * state(...), * state(...), * transition(...), * transition(...) * ]) * ] * }) * class MyComponent { * myStatusExp = "something"; * } * ``` * * The template associated with this component will make use of the `myAnimationTrigger` animation * trigger by binding to an element within its template code. * * ```html * <!-- somewhere inside of my-component-tpl.html --> * <div [\@myAnimationTrigger]="myStatusExp">...</div> * ``` * * ## Disable Animations * A special animation control binding called `\@.disabled` can be placed on an element which will * then disable animations for any inner animation triggers situated within the element as well as * any animations on the element itself. * * When true, the `\@.disabled` binding will prevent all animations from rendering. The example * below shows how to use this feature: * * ```ts * \@Component({ * selector: 'my-component', * template: ` * <div [\@.disabled]="isDisabled"> * <div [\@childAnimation]="exp"></div> * </div> * `, * animations: [ * trigger("childAnimation", [ * // ... * ]) * ] * }) * class MyComponent { * isDisabled = true; * exp = '...'; * } * ``` * * The `\@childAnimation` trigger will not animate because `\@.disabled` prevents it from happening * (when true). * * Note that `\@.disabled` will only disable all animations (this means any animations running on * the same element will also be disabled). * * ### Disabling Animations Application-wide * When an area of the template is set to have animations disabled, **all** inner components will * also have their animations disabled as well. This means that all animations for an angular * application can be disabled by placing a host binding set on `\@.disabled` on the topmost Angular * component. * * ```ts * import {Component, HostBinding} from '\@angular/core'; * * \@Component({ * selector: 'app-component', * templateUrl: 'app.component.html', * }) * class AppComponent { * \@HostBinding('\@.disabled') * public animationsDisabled = true; * } * ``` * * ### What about animations that us `query()` and `animateChild()`? * Despite inner animations being disabled, a parent animation can {\@link query query} for inner * elements located in disabled areas of the template and still animate them as it sees fit. This is * also the case for when a sub animation is queried by a parent and then later animated using {\@link * animateChild animateChild}. * * \@experimental Animation support is experimental. * @param {?} name * @param {?} definitions * @return {?} */ function trigger$1(name, definitions) { return { type: 7 /* Trigger */, name, definitions, options: {} }; } /** * `animate` is an animation-specific function that is designed to be used inside of Angular's * animation DSL language. If this information is new, please navigate to the {\@link * Component#animations component animations metadata page} to gain a better understanding of * how animations in Angular are used. * * `animate` specifies an animation step that will apply the provided `styles` data for a given * amount of time based on the provided `timing` expression value. Calls to `animate` are expected * to be used within {\@link sequence an animation sequence}, {\@link group group}, or {\@link * transition transition}. * * ### Usage * * The `animate` function accepts two input parameters: `timing` and `styles`: * * - `timing` is a string based value that can be a combination of a duration with optional delay * and easing values. The format for the expression breaks down to `duration delay easing` * (therefore a value such as `1s 100ms ease-out` will be parse itself into `duration=1000, * delay=100, easing=ease-out`. If a numeric value is provided then that will be used as the * `duration` value in millisecond form. * - `styles` is the style input data which can either be a call to {\@link style style} or {\@link * keyframes keyframes}. If left empty then the styles from the destination state will be collected * and used (this is useful when describing an animation step that will complete an animation by * {\@link transition#the-final-animate-call animating to the final state}). * * ```typescript * // various functions for specifying timing data * animate(500, style(...)) * animate("1s", style(...)) * animate("100ms 0.5s", style(...)) * animate("5s ease", style(...)) * animate("5s 10ms cubic-bezier(.17,.67,.88,.1)", style(...)) * * // either style() of keyframes() can be used * animate(500, style({ background: "red" })) * animate(500, keyframes([ * style({ background: "blue" })), * style({ background: "red" })) * ]) * ``` * * {\@example core/animation/ts/dsl/animation_example.ts region='Component'} * * \@experimental Animation support is experimental. * @param {?} timings * @param {?=} styles * @return {?} */ function animate$1(timings, styles = null) { return { type: 4 /* Animate */, styles, timings }; } /** * `group` is an animation-specific function that is designed to be used inside of Angular's * animation DSL language. If this information is new, please navigate to the {\@link * Component#animations component animations metadata page} to gain a better understanding of * how animations in Angular are used. * * `group` specifies a list of animation steps that are all run in parallel. Grouped animations are * useful when a series of styles must be animated/closed off at different starting/ending times. * * The `group` function can either be used within a {\@link sequence sequence} or a {\@link transition * transition} and it will only continue to the next instruction once all of the inner animation * steps have completed. * * ### Usage * * The `steps` data that is passed into the `group` animation function can either consist of {\@link * style style} or {\@link animate animate} function calls. Each call to `style()` or `animate()` * within a group will be executed instantly (use {\@link keyframes keyframes} or a {\@link * animate#usage animate() with a delay value} to offset styles to be applied at a later time). * * ```typescript * group([ * animate("1s", { background: "black" })) * animate("2s", { color: "white" })) * ]) * ``` * * {\@example core/animation/ts/dsl/animation_example.ts region='Component'} * * \@experimental Animation support is experimental. * @param {?} steps * @param {?=} options * @return {?} */ function group$1(steps, options = null) { return { type: 3 /* Group */, steps, options }; } /** * `sequence` is an animation-specific function that is designed to be used inside of Angular's * animation DSL language. If this information is new, please navigate to the {\@link * Component#animations component animations metadata page} to gain a better understanding of * how animations in Angular are used. * * `sequence` Specifies a list of animation steps that are run one by one. (`sequence` is used by * default when an array is passed as animation data into {\@link transition transition}.) * * The `sequence` function can either be used within a {\@link group group} or a {\@link transition * transition} and it will only continue to the next instruction once each of the inner animation * steps have completed. * * To perform animation styling in parallel with other animation steps then have a look at the * {\@link group group} animation function. * * ### Usage * * The `steps` data that is passed into the `sequence` animation function can either consist of * {\@link style style} or {\@link animate animate} function calls. A call to `style()` will apply the * provided styling data immediately while a call to `animate()` will apply its styling data over a * given time depending on its timing data. * * ```typescript * sequence([ * style({ opacity: 0 })), * animate("1s", { opacity: 1 })) * ]) * ``` * * {\@example core/animation/ts/dsl/animation_example.ts region='Component'} * * \@experimental Animation support is experimental. * @param {?} steps * @param {?=} options * @return {?} */ function sequence$1(steps, options = null) { return { type: 2 /* Sequence */, steps, options }; } /** * `style` is an animation-specific function that is designed to be used inside of Angular's * animation DSL language. If this information is new, please navigate to the {\@link * Component#animations component animations metadata page} to gain a better understanding of * how animations in Angular are used. * * `style` declares a key/value object containing CSS properties/styles that can then be used for * {\@link state animation states}, within an {\@link sequence animation sequence}, or as styling data * for both {\@link animate animate} and {\@link keyframes keyframes}. * * ### Usage * * `style` takes in a key/value string map as data and expects one or more CSS property/value pairs * to be defined. * * ```typescript * // string values are used for css properties * style({ background: "red", color: "blue" }) * * // numerical (pixel) values are also supported * style({ width: 100, height: 0 }) * ``` * * #### Auto-styles (using `*`) * * When an asterix (`*`) character is used as a value then it will be detected from the element * being animated and applied as animation data when the animation starts. * * This feature proves useful for a state depending on layout and/or environment factors; in such * cases the styles are calculated just before the animation starts. * * ```typescript * // the steps below will animate from 0 to the * // actual height of the element * style({ height: 0 }), * animate("1s", style({ height: "*" })) * ``` * * {\@example core/animation/ts/dsl/animation_example.ts region='Component'} * * \@experimental Animation support is experimental. * @param {?} tokens * @return {?} */ function style$1(tokens) { return { type: 6 /* Style */, styles: tokens, offset: null }; } /** * `state` is an animation-specific function that is designed to be used inside of Angular's * animation DSL language. If this information is new, please navigate to the {\@link * Component#animations component animations metadata page} to gain a better understanding of * how animations in Angular are used. * * `state` declares an animation state within the given trigger. When a state is active within a * component then its associated styles will persist on the element that the trigger is attached to * (even when the animation ends). * * To animate between states, have a look at the animation {\@link transition transition} DSL * function. To register states to an animation trigger please have a look at the {\@link trigger * trigger} function. * * #### The `void` state * * The `void` state value is a reserved word that angular uses to determine when the element is not * apart of the application anymore (e.g. when an `ngIf` evaluates to false then the state of the * associated element is void). * * #### The `*` (default) state * * The `*` state (when styled) is a fallback state that will be used if the state that is being * animated is not declared within the trigger. * * ### Usage * * `state` will declare an animation state with its associated styles * within the given trigger. * * - `stateNameExpr` can be one or more state names separated by commas. * - `styles` refers to the {\@link style styling data} that will be persisted on the element once * the state has been reached. * * ```typescript * // "void" is a reserved name for a state and is used to represent * // the state in which an element is detached from from the application. * state("void", style({ height: 0 })) * * // user-defined states * state("closed", style({ height: 0 })) * state("open, visible", style({ height: "*" })) * ``` * * {\@example core/animation/ts/dsl/animation_example.ts region='Component'} * * \@experimental Animation support is experimental. * @param {?} name * @param {?} styles * @param {?=} options * @return {?} */ function state$1(name, styles, options) { return { type: 0 /* State */, name, styles, options }; } /** * `keyframes` is an animation-specific function that is designed to be used inside of Angular's * animation DSL language. If this information is new, please navigate to the {\@link * Component#animations component animations metadata page} to gain a better understanding of * how animations in Angular are used. * * `keyframes` specifies a collection of {\@link style style} entries each optionally characterized * by an `offset` value. * * ### Usage * * The `keyframes` animation function is designed to be used alongside the {\@link animate animate} * animation function. Instead of applying animations from where they are currently to their * destination, keyframes can describe how each style entry is applied and at what point within the * animation arc (much like CSS Keyframe Animations do). * * For each `style()` entry an `offset` value can be set. Doing so allows to specifiy at what * percentage of the animate time the styles will be applied. * * ```typescript * // the provided offset values describe when each backgroundColor value is applied. * animate("5s", keyframes([ * style({ backgroundColor: "red", offset: 0 }), * style({ backgroundColor: "blue", offset: 0.2 }), * style({ backgroundColor: "orange", offset: 0.3 }), * style({ backgroundColor: "black", offset: 1 }) * ])) * ``` * * Alternatively, if there are no `offset` values used within the style entries then the offsets * will be calculated automatically. * * ```typescript * animate("5s", keyframes([ * style({ backgroundColor: "red" }) // offset = 0 * style({ backgroundColor: "blue" }) // offset = 0.33 * style({ backgroundColor: "orange" }) // offset = 0.66 * style({ backgroundColor: "black" }) // offset = 1 * ])) * ``` * * {\@example core/animation/ts/dsl/animation_example.ts region='Component'} * * \@experimental Animation support is experimental. * @param {?} steps * @return {?} */ function keyframes$1(steps) { return { type: 5 /* Keyframes */, steps }; } /** * `transition` is an animation-specific function that is designed to be used inside of Angular's * animation DSL language. If this information is new, please navigate to the {\@link * Component#animations component animations metadata page} to gain a better understanding of * how animations in Angular are used. * * `transition` declares the {\@link sequence sequence of animation steps} that will be run when the * provided `stateChangeExpr` value is satisfied. The `stateChangeExpr` consists of a `state1 => * state2` which consists of two known states (use an asterix (`*`) to refer to a dynamic starting * and/or ending state). * * A function can also be provided as the `stateChangeExpr` argument for a transition and this * function will be executed each time a state change occurs. If the value returned within the * function is true then the associated animation will be run. * * Animation transitions are placed within an {\@link trigger animation trigger}. For an transition * to animate to a state value and persist its styles then one or more {\@link state animation * states} is expected to be defined. * * ### Usage * * An animation transition is kicked off the `stateChangeExpr` predicate evaluates to true based on * what the previous state is and what the current state has become. In other words, if a transition * is defined that matches the old/current state criteria then the associated animation will be * triggered. * * ```typescript * // all transition/state changes are defined within an animation trigger * trigger("myAnimationTrigger", [ * // if a state is defined then its styles will be persisted when the * // animation has fully completed itself * state("on", style({ background: "green" })), * state("off", style({ background: "grey" })), * * // a transition animation that will be kicked off when the state value * // bound to "myAnimationTrigger" changes from "on" to "off" * transition("on => off", animate(500)), * * // it is also possible to do run the same animation for both directions * transition("on <=> off", animate(500)), * * // or to define multiple states pairs separated by commas * transition("on => off, off => void", animate(500)), * * // this is a catch-all state change for when an element is inserted into * // the page and the destination state is unknown * transition("void => *", [ * style({ opacity: 0 }), * animate(500) * ]), * * // this will capture a state change between any states * transition("* => *", animate("1s 0s")), * * // you can also go full out and include a function * transition((fromState, toState) => { * // when `true` then it will allow the animation below to be invoked * return fromState == "off" && toState == "on"; * }, animate("1s 0s")) * ]) * ``` * * The template associated with this component will make use of the `myAnimationTrigger` animation * trigger by binding to an element within its template code. * * ```html * <!-- somewhere inside of my-component-tpl.html --> * <div [\@myAnimationTrigger]="myStatusExp">...</div> * ``` * * #### The final `animate` call * * If the final step within the transition steps is a call to `animate()` that **only** uses a * timing value with **no style data** then it will be automatically used as the final animation arc * for the element to animate itself to the final state. This involves an automatic mix of * adding/removing CSS styles so that the element will be in the exact state it should be for the * applied state to be presented correctly. * * ``` * // start off by hiding the element, but make sure that it animates properly to whatever state * // is currently active for "myAnimationTrigger" * transition("void => *", [ * style({ opacity: 0 }), * animate(500) * ]) * ``` * * ### Using :enter and :leave * * Given that enter (insertion) and leave (removal) animations are so common, the `transition` * function accepts both `:enter` and `:leave` values which are aliases for the `void => *` and `* * => void` state changes. * * ``` * transition(":enter", [ * style({ opacity: 0 }), * animate(500, style({ opacity: 1 })) * ]), * transition(":leave", [ * animate(500, style({ opacity: 0 })) * ]) * ``` * * ### Boolean values * if a trigger binding value is a boolean value then it can be matched using a transition * expression that compares `true` and `false` or `1` and `0`. * * ``` * // in the template * <div [\@openClose]="open ? true : false">...</div> * * // in the component metadata * trigger('openClose', [ * state('true', style({ height: '*' })), * state('false', style({ height: '0px' })), * transition('false <=> true', animate(500)) * ]) * ``` * * ### Using :increment and :decrement * In addition to the :enter and :leave transition aliases, the :increment and :decrement aliases * can be used to kick off a transition when a numeric value has increased or decreased in value. * * ``` * import {group, animate, query, transition, style, trigger} from '\@angular/animations'; * import {Component} from '\@angular/core'; * * \@Component({ * selector: 'banner-carousel-component', * styles: [` * .banner-container { * position:relative; * height:500px; * overflow:hidden; * } * .banner-container > .banner { * position:absolute; * left:0; * top:0; * font-size:200px; * line-height:500px; * font-weight:bold; * text-align:center; * width:100%; * } * `], * template: ` * <button (click)="previous()">Previous</button> * <button (click)="next()">Next</button> * <hr> * <div [\@bannerAnimation]="selectedIndex" class="banner-container"> * <div class="banner" *ngFor="let banner of banners"> {{ banner }} </div> * </div> * `, * animations: [ * trigger('bannerAnimation', [ * transition(":increment", group([ * query(':enter', [ * style({ left: '100%' }), * animate('0.5s ease-out', style('*')) * ]), * query(':leave', [ * animate('0.5s ease-out', style({ left: '-100%' })) * ]) * ])), * transition(":decrement", group([ * query(':enter', [ * style({ left: '-100%' }), * animate('0.5s ease-out', style('*')) * ]), * query(':leave', [ * animate('0.5s ease-out', style({ left: '100%' })) * ]) * ])) * ]) * ] * }) * class BannerCarouselComponent { * allBanners: string[] = ['1', '2', '3', '4']; * selectedIndex: number = 0; * * get banners() { * return [this.allBanners[this.selectedIndex]]; * } * * previous() { * this.selectedIndex = Math.max(this.selectedIndex - 1, 0); * } * * next() { * this.selectedIndex = Math.min(this.selectedIndex + 1, this.allBanners.length - 1); * } * } * ``` * * {\@example core/animation/ts/dsl/animation_example.ts region='Component'} * * \@experimental Animation support is experimental. * @param {?} stateChangeExpr * @param {?} steps * @param {?=} options * @return {?} */ function transition$1(stateChangeExpr, steps, options = null) { return { type: 1 /* Transition */, expr: stateChangeExpr, animation: steps, options }; } /** * `animation` is an animation-specific function that is designed to be used inside of Angular's * animation DSL language. * * `var myAnimation = animation(...)` is designed to produce a reusable animation that can be later * invoked in another animation or sequence. Reusable animations are designed to make use of * animation parameters and the produced animation can be used via the `useAnimation` method. * * ``` * var fadeAnimation = animation([ * style({ opacity: '{{ start }}' }), * animate('{{ time }}', * style({ opacity: '{{ end }}'})) * ], { params: { time: '1000ms', start: 0, end: 1 }}); * ``` * * If parameters are attached to an animation then they act as **default parameter values**. When an * animation is invoked via `useAnimation` then parameter values are allowed to be passed in * directly. If any of the passed in parameter values are missing then the default values will be * used. * * ``` * useAnimation(fadeAnimation, { * params: { * time: '2s', * start: 1, * end: 0 * } * }) * ``` * * If one or more parameter values are missing before animated then an error will be thrown. * * \@experimental Animation support is experimental. * @param {?} steps * @param {?=} options * @return {?} */ /** * `animateChild` is an animation-specific function that is designed to be used inside of Angular's * animation DSL language. It works by allowing a queried element to execute its own * animation within the animation sequence. * * Each time an animation is triggered in angular, the parent animation * will always get priority and any child animations will be blocked. In order * for a child animation to run, the parent animation must query each of the elements * containing child animations and then allow the animations to run using `animateChild`. * * The example HTML code below shows both parent and child elements that have animation * triggers that will execute at the same time. * * ```html * <!-- parent-child.component.html --> * <button (click)="exp =! exp">Toggle</button> * <hr> * * <div [\@parentAnimation]="exp"> * <header>Hello</header> * <div [\@childAnimation]="exp"> * one * </div> * <div [\@childAnimation]="exp"> * two * </div> * <div [\@childAnimation]="exp"> * three * </div> * </div> * ``` * * Now when the `exp` value changes to true, only the `parentAnimation` animation will animate * because it has priority. However, using `query` and `animateChild` each of the inner animations * can also fire: * * ```ts * // parent-child.component.ts * import {trigger, transition, animate, style, query, animateChild} from '\@angular/animations'; * \@Component({ * selector: 'parent-child-component', * animations: [ * trigger('parentAnimation', [ * transition('false => true', [ * query('header', [ * style({ opacity: 0 }), * animate(500, style({ opacity: 1 })) * ]), * query('\@childAnimation', [ * animateChild() * ]) * ]) * ]), * trigger('childAnimation', [ * transition('false => true', [ * style({ opacity: 0 }), * animate(500, style({ opacity: 1 })) * ]) * ]) * ] * }) * class ParentChildCmp { * exp: boolean = false; * } * ``` * * In the animation code above, when the `parentAnimation` transition kicks off it first queries to * find the header element and fades it in. It then finds each of the sub elements that contain the * `\@childAnimation` trigger and then allows for their animations to fire. * * This example can be further extended by using stagger: * * ```ts * query('\@childAnimation', stagger(100, [ * animateChild() * ])) * ``` * * Now each of the sub animations start off with respect to the `100ms` staggering step. * * ## The first frame of child animations * When sub animations are executed using `animateChild` the animation engine will always apply the * first frame of every sub animation immediately at the start of the animation sequence. This way * the parent animation does not need to set any initial styling data on the sub elements before the * sub animations kick off. * * In the example above the first frame of the `childAnimation`'s `false => true` transition * consists of a style of `opacity: 0`. This is applied immediately when the `parentAnimation` * animation transition sequence starts. Only then when the `\@childAnimation` is queried and called * with `animateChild` will it then animate to its destination of `opacity: 1`. * * Note that this feature designed to be used alongside {\@link query query()} and it will only work * with animations that are assigned using the Angular animation DSL (this means that CSS keyframes * and transitions are not handled by this API). * * \@experimental Animation support is experimental. * @param {?=} options * @return {?} */ /** * `useAnimation` is an animation-specific function that is designed to be used inside of Angular's * animation DSL language. It is used to kick off a reusable animation that is created using {\@link * animation animation()}. * * \@experimental Animation support is experimental. * @param {?} animation * @param {?=} options * @return {?} */ /** * `query` is an animation-specific function that is designed to be used inside of Angular's * animation DSL language. * * query() is used to find one or more inner elements within the current element that is * being animated within the sequence. The provided animation steps are applied * to the queried element (by default, an array is provided, then this will be * treated as an animation sequence). * * ### Usage * * query() is designed to collect mutiple elements and works internally by using * `element.querySelectorAll`. An additional options object can be provided which * can be used to limit the total amount of items to be collected. * * ```js * query('div', [ * animate(...), * animate(...) * ], { limit: 1 }) * ``` * * query(), by default, will throw an error when zero items are found. If a query * has the `optional` flag set to true then this error will be ignored. * * ```js * query('.some-element-that-may-not-be-there', [ * animate(...), * animate(...) * ], { optional: true }) * ``` * * ### Special Selector Values * * The selector value within a query can collect elements that contain angular-specific * characteristics * using special pseudo-selectors tokens. * * These include: * * - Querying for newly inserted/removed elements using `query(":enter")`/`query(":leave")` * - Querying all currently animating elements using `query(":animating")` * - Querying elements that contain an animation trigger using `query("\@triggerName")` * - Querying all elements that contain an animation triggers using `query("\@*")` * - Including the current element into the animation sequence using `query(":self")` * * * Each of these pseudo-selector tokens can be merged together into a combined query selector * string: * * ``` * query(':self, .record:enter, .record:leave, \@subTrigger', [...]) * ``` * * ### Demo * * ``` * \@Component({ * selector: 'inner', * template: ` * <div [\@queryAnimation]="exp"> * <h1>Title</h1> * <div class="content"> * Blah blah blah * </div> * </div> * `, * animations: [ * trigger('queryAnimation', [ * transition('* => goAnimate', [ * // hide the inner elements * query('h1', style({ opacity: 0 })), * query('.content', style({ opacity: 0 })), * * // animate the inner elements in, one by one * query('h1', animate(1000, style({ opacity: 1 })), * query('.content', animate(1000, style({ opacity: 1 })), * ]) * ]) * ] * }) * class Cmp { * exp = ''; * * goAnimate() { * this.exp = 'goAnimate'; * } * } * ``` * * \@experimental Animation support is experimental. * @param {?} selector * @param {?} animation * @param {?=} options * @return {?} */ /** * `stagger` is an animation-specific function that is designed to be used inside of Angular's * animation DSL language. It is designed to be used inside of an animation {\@link query query()} * and works by issuing a timing gap between after each queried item is animated. * * ### Usage * * In the example below there is a container element that wraps a list of items stamped out * by an ngFor. The container element contains an animation trigger that will later be set * to query for each of the inner items. * * ```html * <!-- list.component.html --> * <button (click)="toggle()">Show / Hide Items</button> * <hr /> * <div [\@listAnimation]="items.length"> * <div *ngFor="let item of items"> * {{ item }} * </div> * </div> * ``` * * The component code for this looks as such: * * ```ts * import {trigger, transition, style, animate, query, stagger} from '\@angular/animations'; * \@Component({ * templateUrl: 'list.component.html', * animations: [ * trigger('listAnimation', [ * //... * ]) * ] * }) * class ListComponent { * items = []; * * showItems() { * this.items = [0,1,2,3,4]; * } * * hideItems() { * this.items = []; * } * * toggle() { * this.items.length ? this.hideItems() : this.showItems(); * } * } * ``` * * And now for the animation trigger code: * * ```ts * trigger('listAnimation', [ * transition('* => *', [ // each time the binding value changes * query(':leave', [ * stagger(100, [ * animate('0.5s', style({ opacity: 0 })) * ]) * ]), * query(':enter', [ * style({ opacity: 0 }), * stagger(100, [ * animate('0.5s', style({ opacity: 1 })) * ]) * ]) * ]) * ]) * ``` * * Now each time the items are added/removed then either the opacity * fade-in animation will run or each removed item will be faded out. * When either of these animations occur then a stagger effect will be * applied after each item's animation is started. * * \@experimental Animation support is experimental. * @param {?} timings * @param {?} animation * @return {?} */ /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @deprecated This symbol has moved. Please Import from \@angular/animations instead! */ const AUTO_STYLE = '*'; /** * @deprecated This symbol has moved. Please Import from \@angular/animations instead! * @record */ /** * @deprecated This symbol has moved. Please Import from \@angular/animations instead! * @record */ /** * @deprecated This symbol has moved. Please Import from \@angular/animations instead! * @record */ /** * @deprecated This symbol has moved. Please Import from \@angular/animations instead! * @record */ /** * @deprecated This symbol has moved. Please Import from \@angular/animations instead! * @record */ /** * @deprecated This symbol has moved. Please Import from \@angular/animations instead! * @record */ /** * @deprecated This symbol has moved. Please Import from \@angular/animations instead! * @record */ /** * @deprecated This symbol has moved. Please Import from \@angular/animations instead! * @record */ /** * @deprecated This symbol has moved. Please Import from \@angular/animations instead! * @record */ /** * @deprecated This symbol has moved. Please Import from \@angular/animations instead! * @param {?} name * @param {?} definitions * @return {?} */ function trigger$$1(name, definitions) { return trigger$1(name, definitions); } /** * @deprecated This symbol has moved. Please Import from \@angular/animations instead! * @param {?} timings * @param {?=} styles * @return {?} */ function animate$$1(timings, styles) { return animate$1(timings, styles); } /** * @deprecated This symbol has moved. Please Import from \@angular/animations instead! * @param {?} steps * @return {?} */ function group$$1(steps) { return group$1(steps); } /** * @deprecated This symbol has moved. Please Import from \@angular/animations instead! * @param {?} steps * @return {?} */ function sequence$$1(steps) { return sequence$1(steps); } /** * @deprecated This symbol has moved. Please Import from \@angular/animations instead! * @param {?} tokens * @return {?} */ function style$$1(tokens) { return style$1(tokens); } /** * @deprecated This symbol has moved. Please Import from \@angular/animations instead! * @param {?} name * @param {?} styles * @return {?} */ function state$$1(name, styles) { return state$1(name, styles); } /** * @deprecated This symbol has moved. Please Import from \@angular/animations instead! * @param {?} steps * @return {?} */ function keyframes$$1(steps) { return keyframes$1(steps); } /** * @deprecated This symbol has moved. Please Import from \@angular/animations instead! * @param {?} stateChangeExpr * @param {?} steps * @return {?} */ function transition$$1(stateChangeExpr, steps) { return transition$1(stateChangeExpr, steps); } /** * @deprecated This has been renamed to `AnimationEvent`. Please import it from \@angular/animations. * @record */ /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @module * @description * Entry point from which you should import all public core APIs. */ /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @module * @description * Entry point for all public APIs of this package. */ // This file only reexports content of the `src` folder. Keep it that way. /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * Generated bundle index. Do not edit. */ //# sourceMappingURL=core.js.map /* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__("./node_modules/webpack/buildin/global.js"))) /***/ }), /***/ "./node_modules/@angular/forms/esm2015/forms.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AbstractControlDirective", function() { return AbstractControlDirective; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AbstractFormGroupDirective", function() { return AbstractFormGroupDirective; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CheckboxControlValueAccessor", function() { return CheckboxControlValueAccessor; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ControlContainer", function() { return ControlContainer; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NG_VALUE_ACCESSOR", function() { return NG_VALUE_ACCESSOR; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "COMPOSITION_BUFFER_MODE", function() { return COMPOSITION_BUFFER_MODE; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DefaultValueAccessor", function() { return DefaultValueAccessor; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgControl", function() { return NgControl; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgControlStatus", function() { return NgControlStatus; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgControlStatusGroup", function() { return NgControlStatusGroup; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgForm", function() { return NgForm; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgModel", function() { return NgModel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgModelGroup", function() { return NgModelGroup; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RadioControlValueAccessor", function() { return RadioControlValueAccessor; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FormControlDirective", function() { return FormControlDirective; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FormControlName", function() { return FormControlName; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FormGroupDirective", function() { return FormGroupDirective; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FormArrayName", function() { return FormArrayName; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FormGroupName", function() { return FormGroupName; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgSelectOption", function() { return NgSelectOption; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SelectControlValueAccessor", function() { return SelectControlValueAccessor; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SelectMultipleControlValueAccessor", function() { return SelectMultipleControlValueAccessor; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CheckboxRequiredValidator", function() { return CheckboxRequiredValidator; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EmailValidator", function() { return EmailValidator; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MaxLengthValidator", function() { return MaxLengthValidator; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MinLengthValidator", function() { return MinLengthValidator; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PatternValidator", function() { return PatternValidator; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RequiredValidator", function() { return RequiredValidator; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FormBuilder", function() { return FormBuilder; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AbstractControl", function() { return AbstractControl; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FormArray", function() { return FormArray; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FormControl", function() { return FormControl; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FormGroup", function() { return FormGroup; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NG_ASYNC_VALIDATORS", function() { return NG_ASYNC_VALIDATORS; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NG_VALIDATORS", function() { return NG_VALIDATORS; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Validators", function() { return Validators; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "VERSION", function() { return VERSION; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FormsModule", function() { return FormsModule; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ReactiveFormsModule", function() { return ReactiveFormsModule; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵba", function() { return InternalFormsSharedModule; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵz", function() { return REACTIVE_DRIVEN_DIRECTIVES; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵx", function() { return SHARED_FORM_DIRECTIVES; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵy", function() { return TEMPLATE_DRIVEN_DIRECTIVES; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵa", function() { return CHECKBOX_VALUE_ACCESSOR; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵb", function() { return DEFAULT_VALUE_ACCESSOR; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵc", function() { return AbstractControlStatus; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵd", function() { return ngControlStatusHost; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵe", function() { return formDirectiveProvider; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵf", function() { return formControlBinding; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵg", function() { return modelGroupProvider; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵbf", function() { return NgNoValidate; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵbb", function() { return NUMBER_VALUE_ACCESSOR; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵbc", function() { return NumberValueAccessor; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵh", function() { return RADIO_VALUE_ACCESSOR; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵi", function() { return RadioControlRegistry; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵbd", function() { return RANGE_VALUE_ACCESSOR; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵbe", function() { return RangeValueAccessor; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵj", function() { return formControlBinding$1; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵk", function() { return controlNameBinding; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵl", function() { return formDirectiveProvider$1; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵn", function() { return formArrayNameProvider; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵm", function() { return formGroupNameProvider; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵo", function() { return SELECT_VALUE_ACCESSOR; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵq", function() { return NgSelectMultipleOption; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵp", function() { return SELECT_MULTIPLE_VALUE_ACCESSOR; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵs", function() { return CHECKBOX_REQUIRED_VALIDATOR; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵt", function() { return EMAIL_VALIDATOR; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵv", function() { return MAX_LENGTH_VALIDATOR; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵu", function() { return MIN_LENGTH_VALIDATOR; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵw", function() { return PATTERN_VALIDATOR; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵr", function() { return REQUIRED_VALIDATOR; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_rxjs_observable_forkJoin__ = __webpack_require__("./node_modules/rxjs/_esm2015/observable/forkJoin.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_rxjs_observable_fromPromise__ = __webpack_require__("./node_modules/rxjs/_esm2015/observable/fromPromise.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_rxjs_operator_map__ = __webpack_require__("./node_modules/rxjs/_esm2015/operator/map.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__angular_platform_browser__ = __webpack_require__("./node_modules/@angular/platform-browser/esm2015/platform-browser.js"); /** * @license Angular v5.2.10 * (c) 2010-2018 Google, Inc. https://angular.io/ * License: MIT */ /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * Base class for control directives. * * Only used internally in the forms module. * * \@stable * @abstract */ class AbstractControlDirective { /** * The value of the control. * @return {?} */ get value() { return this.control ? this.control.value : null; } /** * A control is `valid` when its `status === VALID`. * * In order to have this status, the control must have passed all its * validation checks. * @return {?} */ get valid() { return this.control ? this.control.valid : null; } /** * A control is `invalid` when its `status === INVALID`. * * In order to have this status, the control must have failed * at least one of its validation checks. * @return {?} */ get invalid() { return this.control ? this.control.invalid : null; } /** * A control is `pending` when its `status === PENDING`. * * In order to have this status, the control must be in the * middle of conducting a validation check. * @return {?} */ get pending() { return this.control ? this.control.pending : null; } /** * A control is `disabled` when its `status === DISABLED`. * * Disabled controls are exempt from validation checks and * are not included in the aggregate value of their ancestor * controls. * @return {?} */ get disabled() { return this.control ? this.control.disabled : null; } /** * A control is `enabled` as long as its `status !== DISABLED`. * * In other words, it has a status of `VALID`, `INVALID`, or * `PENDING`. * @return {?} */ get enabled() { return this.control ? this.control.enabled : null; } /** * Returns any errors generated by failing validation. If there * are no errors, it will return null. * @return {?} */ get errors() { return this.control ? this.control.errors : null; } /** * A control is `pristine` if the user has not yet changed * the value in the UI. * * Note that programmatic changes to a control's value will * *not* mark it dirty. * @return {?} */ get pristine() { return this.control ? this.control.pristine : null; } /** * A control is `dirty` if the user has changed the value * in the UI. * * Note that programmatic changes to a control's value will * *not* mark it dirty. * @return {?} */ get dirty() { return this.control ? this.control.dirty : null; } /** * A control is marked `touched` once the user has triggered * a `blur` event on it. * @return {?} */ get touched() { return this.control ? this.control.touched : null; } /** * @return {?} */ get status() { return this.control ? this.control.status : null; } /** * A control is `untouched` if the user has not yet triggered * a `blur` event on it. * @return {?} */ get untouched() { return this.control ? this.control.untouched : null; } /** * Emits an event every time the validation status of the control * is re-calculated. * @return {?} */ get statusChanges() { return this.control ? this.control.statusChanges : null; } /** * Emits an event every time the value of the control changes, in * the UI or programmatically. * @return {?} */ get valueChanges() { return this.control ? this.control.valueChanges : null; } /** * Returns an array that represents the path from the top-level form * to this control. Each index is the string name of the control on * that level. * @return {?} */ get path() { return null; } /** * Resets the form control. This means by default: * * * it is marked as `pristine` * * it is marked as `untouched` * * value is set to null * * For more information, see {\@link AbstractControl}. * @param {?=} value * @return {?} */ reset(value = undefined) { if (this.control) this.control.reset(value); } /** * Returns true if the control with the given path has the error specified. Otherwise * returns false. * * If no path is given, it checks for the error on the present control. * @param {?} errorCode * @param {?=} path * @return {?} */ hasError(errorCode, path) { return this.control ? this.control.hasError(errorCode, path) : false; } /** * Returns error data if the control with the given path has the error specified. Otherwise * returns null or undefined. * * If no path is given, it checks for the error on the present control. * @param {?} errorCode * @param {?=} path * @return {?} */ getError(errorCode, path) { return this.control ? this.control.getError(errorCode, path) : null; } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * A directive that contains multiple {\@link NgControl}s. * * Only used by the forms module. * * \@stable * @abstract */ class ControlContainer extends AbstractControlDirective { /** * Get the form to which this container belongs. * @return {?} */ get formDirective() { return null; } /** * Get the path to this container. * @return {?} */ get path() { return null; } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @param {?} value * @return {?} */ function isEmptyInputValue(value) { // we don't check for string here so it also works with arrays return value == null || value.length === 0; } /** * Providers for validators to be used for {\@link FormControl}s in a form. * * Provide this using `multi: true` to add validators. * * ### Example * * ```typescript * \@Directive({ * selector: '[custom-validator]', * providers: [{provide: NG_VALIDATORS, useExisting: CustomValidatorDirective, multi: true}] * }) * class CustomValidatorDirective implements Validator { * validate(control: AbstractControl): ValidationErrors | null { * return {"custom": true}; * } * } * ``` * * \@stable */ const NG_VALIDATORS = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["InjectionToken"]('NgValidators'); /** * Providers for asynchronous validators to be used for {\@link FormControl}s * in a form. * * Provide this using `multi: true` to add validators. * * See {\@link NG_VALIDATORS} for more details. * * \@stable */ const NG_ASYNC_VALIDATORS = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["InjectionToken"]('NgAsyncValidators'); const EMAIL_REGEXP = /^(?=.{1,254}$)(?=.{1,64}@)[-!#$%&'*+/0-9=?A-Z^_`a-z{|}~]+(\.[-!#$%&'*+/0-9=?A-Z^_`a-z{|}~]+)*@[A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?(\.[A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?)*$/; /** * Provides a set of validators used by form controls. * * A validator is a function that processes a {\@link FormControl} or collection of * controls and returns a map of errors. A null map means that validation has passed. * * ### Example * * ```typescript * var loginControl = new FormControl("", Validators.required) * ``` * * \@stable */ class Validators { /** * Validator that requires controls to have a value greater than a number. * `min()` exists only as a function, not as a directive. For example, * `control = new FormControl('', Validators.min(3));`. * @param {?} min * @return {?} */ static min(min) { return (control) => { if (isEmptyInputValue(control.value) || isEmptyInputValue(min)) { return null; // don't validate empty values to allow optional controls } const /** @type {?} */ value = parseFloat(control.value); // Controls with NaN values after parsing should be treated as not having a // minimum, per the HTML forms spec: https://www.w3.org/TR/html5/forms.html#attr-input-min return !isNaN(value) && value < min ? { 'min': { 'min': min, 'actual': control.value } } : null; }; } /** * Validator that requires controls to have a value less than a number. * `max()` exists only as a function, not as a directive. For example, * `control = new FormControl('', Validators.max(15));`. * @param {?} max * @return {?} */ static max(max) { return (control) => { if (isEmptyInputValue(control.value) || isEmptyInputValue(max)) { return null; // don't validate empty values to allow optional controls } const /** @type {?} */ value = parseFloat(control.value); // Controls with NaN values after parsing should be treated as not having a // maximum, per the HTML forms spec: https://www.w3.org/TR/html5/forms.html#attr-input-max return !isNaN(value) && value > max ? { 'max': { 'max': max, 'actual': control.value } } : null; }; } /** * Validator that requires controls to have a non-empty value. * @param {?} control * @return {?} */ static required(control) { return isEmptyInputValue(control.value) ? { 'required': true } : null; } /** * Validator that requires control value to be true. * @param {?} control * @return {?} */ static requiredTrue(control) { return control.value === true ? null : { 'required': true }; } /** * Validator that performs email validation. * @param {?} control * @return {?} */ static email(control) { return EMAIL_REGEXP.test(control.value) ? null : { 'email': true }; } /** * Validator that requires controls to have a value of a minimum length. * @param {?} minLength * @return {?} */ static minLength(minLength) { return (control) => { if (isEmptyInputValue(control.value)) { return null; // don't validate empty values to allow optional controls } const /** @type {?} */ length = control.value ? control.value.length : 0; return length < minLength ? { 'minlength': { 'requiredLength': minLength, 'actualLength': length } } : null; }; } /** * Validator that requires controls to have a value of a maximum length. * @param {?} maxLength * @return {?} */ static maxLength(maxLength) { return (control) => { const /** @type {?} */ length = control.value ? control.value.length : 0; return length > maxLength ? { 'maxlength': { 'requiredLength': maxLength, 'actualLength': length } } : null; }; } /** * Validator that requires a control to match a regex to its value. * @param {?} pattern * @return {?} */ static pattern(pattern) { if (!pattern) return Validators.nullValidator; let /** @type {?} */ regex; let /** @type {?} */ regexStr; if (typeof pattern === 'string') { regexStr = ''; if (pattern.charAt(0) !== '^') regexStr += '^'; regexStr += pattern; if (pattern.charAt(pattern.length - 1) !== '$') regexStr += '$'; regex = new RegExp(regexStr); } else { regexStr = pattern.toString(); regex = pattern; } return (control) => { if (isEmptyInputValue(control.value)) { return null; // don't validate empty values to allow optional controls } const /** @type {?} */ value = control.value; return regex.test(value) ? null : { 'pattern': { 'requiredPattern': regexStr, 'actualValue': value } }; }; } /** * No-op validator. * @param {?} c * @return {?} */ static nullValidator(c) { return null; } /** * @param {?} validators * @return {?} */ static compose(validators) { if (!validators) return null; const /** @type {?} */ presentValidators = /** @type {?} */ (validators.filter(isPresent)); if (presentValidators.length == 0) return null; return function (control) { return _mergeErrors(_executeValidators(control, presentValidators)); }; } /** * @param {?} validators * @return {?} */ static composeAsync(validators) { if (!validators) return null; const /** @type {?} */ presentValidators = /** @type {?} */ (validators.filter(isPresent)); if (presentValidators.length == 0) return null; return function (control) { const /** @type {?} */ observables = _executeAsyncValidators(control, presentValidators).map(toObservable); return __WEBPACK_IMPORTED_MODULE_3_rxjs_operator_map__["a" /* map */].call(Object(__WEBPACK_IMPORTED_MODULE_1_rxjs_observable_forkJoin__["a" /* forkJoin */])(observables), _mergeErrors); }; } } /** * @param {?} o * @return {?} */ function isPresent(o) { return o != null; } /** * @param {?} r * @return {?} */ function toObservable(r) { const /** @type {?} */ obs = Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["ɵisPromise"])(r) ? Object(__WEBPACK_IMPORTED_MODULE_2_rxjs_observable_fromPromise__["a" /* fromPromise */])(r) : r; if (!(Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["ɵisObservable"])(obs))) { throw new Error(`Expected validator to return Promise or Observable.`); } return obs; } /** * @param {?} control * @param {?} validators * @return {?} */ function _executeValidators(control, validators) { return validators.map(v => v(control)); } /** * @param {?} control * @param {?} validators * @return {?} */ function _executeAsyncValidators(control, validators) { return validators.map(v => v(control)); } /** * @param {?} arrayOfErrors * @return {?} */ function _mergeErrors(arrayOfErrors) { const /** @type {?} */ res = arrayOfErrors.reduce((res, errors) => { return errors != null ? Object.assign({}, /** @type {?} */ ((res)), errors) : /** @type {?} */ ((res)); }, {}); return Object.keys(res).length === 0 ? null : res; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * A `ControlValueAccessor` acts as a bridge between the Angular forms API and a * native element in the DOM. * * Implement this interface if you want to create a custom form control directive * that integrates with Angular forms. * * \@stable * @record */ /** * Used to provide a {\@link ControlValueAccessor} for form controls. * * See {\@link DefaultValueAccessor} for how to implement one. * \@stable */ const NG_VALUE_ACCESSOR = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["InjectionToken"]('NgValueAccessor'); /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ const CHECKBOX_VALUE_ACCESSOR = { provide: NG_VALUE_ACCESSOR, useExisting: Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["forwardRef"])(() => CheckboxControlValueAccessor), multi: true, }; /** * The accessor for writing a value and listening to changes on a checkbox input element. * * ### Example * ``` * <input type="checkbox" name="rememberLogin" ngModel> * ``` * * \@stable */ class CheckboxControlValueAccessor { /** * @param {?} _renderer * @param {?} _elementRef */ constructor(_renderer, _elementRef) { this._renderer = _renderer; this._elementRef = _elementRef; this.onChange = (_) => { }; this.onTouched = () => { }; } /** * @param {?} value * @return {?} */ writeValue(value) { this._renderer.setProperty(this._elementRef.nativeElement, 'checked', value); } /** * @param {?} fn * @return {?} */ registerOnChange(fn) { this.onChange = fn; } /** * @param {?} fn * @return {?} */ registerOnTouched(fn) { this.onTouched = fn; } /** * @param {?} isDisabled * @return {?} */ setDisabledState(isDisabled) { this._renderer.setProperty(this._elementRef.nativeElement, 'disabled', isDisabled); } } CheckboxControlValueAccessor.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: 'input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]', host: { '(change)': 'onChange($event.target.checked)', '(blur)': 'onTouched()' }, providers: [CHECKBOX_VALUE_ACCESSOR] },] }, ]; /** @nocollapse */ CheckboxControlValueAccessor.ctorParameters = () => [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Renderer2"], }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ElementRef"], }, ]; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ const DEFAULT_VALUE_ACCESSOR = { provide: NG_VALUE_ACCESSOR, useExisting: Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["forwardRef"])(() => DefaultValueAccessor), multi: true }; /** * We must check whether the agent is Android because composition events * behave differently between iOS and Android. * @return {?} */ function _isAndroid() { const /** @type {?} */ userAgent = Object(__WEBPACK_IMPORTED_MODULE_4__angular_platform_browser__["ɵgetDOM"])() ? Object(__WEBPACK_IMPORTED_MODULE_4__angular_platform_browser__["ɵgetDOM"])().getUserAgent() : ''; return /android (\d+)/.test(userAgent.toLowerCase()); } /** * Turn this mode on if you want form directives to buffer IME input until compositionend * \@experimental */ const COMPOSITION_BUFFER_MODE = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["InjectionToken"]('CompositionEventMode'); /** * The default accessor for writing a value and listening to changes that is used by the * {\@link NgModel}, {\@link FormControlDirective}, and {\@link FormControlName} directives. * * ### Example * ``` * <input type="text" name="searchQuery" ngModel> * ``` * * \@stable */ class DefaultValueAccessor { /** * @param {?} _renderer * @param {?} _elementRef * @param {?} _compositionMode */ constructor(_renderer, _elementRef, _compositionMode) { this._renderer = _renderer; this._elementRef = _elementRef; this._compositionMode = _compositionMode; this.onChange = (_) => { }; this.onTouched = () => { }; /** * Whether the user is creating a composition string (IME events). */ this._composing = false; if (this._compositionMode == null) { this._compositionMode = !_isAndroid(); } } /** * @param {?} value * @return {?} */ writeValue(value) { const /** @type {?} */ normalizedValue = value == null ? '' : value; this._renderer.setProperty(this._elementRef.nativeElement, 'value', normalizedValue); } /** * @param {?} fn * @return {?} */ registerOnChange(fn) { this.onChange = fn; } /** * @param {?} fn * @return {?} */ registerOnTouched(fn) { this.onTouched = fn; } /** * @param {?} isDisabled * @return {?} */ setDisabledState(isDisabled) { this._renderer.setProperty(this._elementRef.nativeElement, 'disabled', isDisabled); } /** * \@internal * @param {?} value * @return {?} */ _handleInput(value) { if (!this._compositionMode || (this._compositionMode && !this._composing)) { this.onChange(value); } } /** * \@internal * @return {?} */ _compositionStart() { this._composing = true; } /** * \@internal * @param {?} value * @return {?} */ _compositionEnd(value) { this._composing = false; this._compositionMode && this.onChange(value); } } DefaultValueAccessor.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: 'input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]', // TODO: vsavkin replace the above selector with the one below it once // https://github.com/angular/angular/issues/3011 is implemented // selector: '[ngModel],[formControl],[formControlName]', host: { '(input)': '$any(this)._handleInput($event.target.value)', '(blur)': 'onTouched()', '(compositionstart)': '$any(this)._compositionStart()', '(compositionend)': '$any(this)._compositionEnd($event.target.value)' }, providers: [DEFAULT_VALUE_ACCESSOR] },] }, ]; /** @nocollapse */ DefaultValueAccessor.ctorParameters = () => [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Renderer2"], }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ElementRef"], }, { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Optional"] }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Inject"], args: [COMPOSITION_BUFFER_MODE,] },] }, ]; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @param {?} validator * @return {?} */ function normalizeValidator(validator) { if ((/** @type {?} */ (validator)).validate) { return (c) => (/** @type {?} */ (validator)).validate(c); } else { return /** @type {?} */ (validator); } } /** * @param {?} validator * @return {?} */ function normalizeAsyncValidator(validator) { if ((/** @type {?} */ (validator)).validate) { return (c) => (/** @type {?} */ (validator)).validate(c); } else { return /** @type {?} */ (validator); } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ const NUMBER_VALUE_ACCESSOR = { provide: NG_VALUE_ACCESSOR, useExisting: Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["forwardRef"])(() => NumberValueAccessor), multi: true }; /** * The accessor for writing a number value and listening to changes that is used by the * {\@link NgModel}, {\@link FormControlDirective}, and {\@link FormControlName} directives. * * ### Example * ``` * <input type="number" [(ngModel)]="age"> * ``` */ class NumberValueAccessor { /** * @param {?} _renderer * @param {?} _elementRef */ constructor(_renderer, _elementRef) { this._renderer = _renderer; this._elementRef = _elementRef; this.onChange = (_) => { }; this.onTouched = () => { }; } /** * @param {?} value * @return {?} */ writeValue(value) { // The value needs to be normalized for IE9, otherwise it is set to 'null' when null const /** @type {?} */ normalizedValue = value == null ? '' : value; this._renderer.setProperty(this._elementRef.nativeElement, 'value', normalizedValue); } /** * @param {?} fn * @return {?} */ registerOnChange(fn) { this.onChange = (value) => { fn(value == '' ? null : parseFloat(value)); }; } /** * @param {?} fn * @return {?} */ registerOnTouched(fn) { this.onTouched = fn; } /** * @param {?} isDisabled * @return {?} */ setDisabledState(isDisabled) { this._renderer.setProperty(this._elementRef.nativeElement, 'disabled', isDisabled); } } NumberValueAccessor.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: 'input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]', host: { '(change)': 'onChange($event.target.value)', '(input)': 'onChange($event.target.value)', '(blur)': 'onTouched()' }, providers: [NUMBER_VALUE_ACCESSOR] },] }, ]; /** @nocollapse */ NumberValueAccessor.ctorParameters = () => [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Renderer2"], }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ElementRef"], }, ]; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @return {?} */ function unimplemented() { throw new Error('unimplemented'); } /** * A base class that all control directive extend. * It binds a {\@link FormControl} object to a DOM element. * * Used internally by Angular forms. * * \@stable * @abstract */ class NgControl extends AbstractControlDirective { constructor() { super(...arguments); /** * \@internal */ this._parent = null; this.name = null; this.valueAccessor = null; /** * \@internal */ this._rawValidators = []; /** * \@internal */ this._rawAsyncValidators = []; } /** * @return {?} */ get validator() { return /** @type {?} */ (unimplemented()); } /** * @return {?} */ get asyncValidator() { return /** @type {?} */ (unimplemented()); } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ const RADIO_VALUE_ACCESSOR = { provide: NG_VALUE_ACCESSOR, useExisting: Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["forwardRef"])(() => RadioControlValueAccessor), multi: true }; /** * Internal class used by Angular to uncheck radio buttons with the matching name. */ class RadioControlRegistry { constructor() { this._accessors = []; } /** * @param {?} control * @param {?} accessor * @return {?} */ add(control, accessor) { this._accessors.push([control, accessor]); } /** * @param {?} accessor * @return {?} */ remove(accessor) { for (let /** @type {?} */ i = this._accessors.length - 1; i >= 0; --i) { if (this._accessors[i][1] === accessor) { this._accessors.splice(i, 1); return; } } } /** * @param {?} accessor * @return {?} */ select(accessor) { this._accessors.forEach((c) => { if (this._isSameGroup(c, accessor) && c[1] !== accessor) { c[1].fireUncheck(accessor.value); } }); } /** * @param {?} controlPair * @param {?} accessor * @return {?} */ _isSameGroup(controlPair, accessor) { if (!controlPair[0].control) return false; return controlPair[0]._parent === accessor._control._parent && controlPair[1].name === accessor.name; } } RadioControlRegistry.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Injectable"] }, ]; /** @nocollapse */ RadioControlRegistry.ctorParameters = () => []; /** * \@whatItDoes Writes radio control values and listens to radio control changes. * * Used by {\@link NgModel}, {\@link FormControlDirective}, and {\@link FormControlName} * to keep the view synced with the {\@link FormControl} model. * * \@howToUse * * If you have imported the {\@link FormsModule} or the {\@link ReactiveFormsModule}, this * value accessor will be active on any radio control that has a form directive. You do * **not** need to add a special selector to activate it. * * ### How to use radio buttons with form directives * * To use radio buttons in a template-driven form, you'll want to ensure that radio buttons * in the same group have the same `name` attribute. Radio buttons with different `name` * attributes do not affect each other. * * {\@example forms/ts/radioButtons/radio_button_example.ts region='TemplateDriven'} * * When using radio buttons in a reactive form, radio buttons in the same group should have the * same `formControlName`. You can also add a `name` attribute, but it's optional. * * {\@example forms/ts/reactiveRadioButtons/reactive_radio_button_example.ts region='Reactive'} * * * **npm package**: `\@angular/forms` * * \@stable */ class RadioControlValueAccessor { /** * @param {?} _renderer * @param {?} _elementRef * @param {?} _registry * @param {?} _injector */ constructor(_renderer, _elementRef, _registry, _injector) { this._renderer = _renderer; this._elementRef = _elementRef; this._registry = _registry; this._injector = _injector; this.onChange = () => { }; this.onTouched = () => { }; } /** * @return {?} */ ngOnInit() { this._control = this._injector.get(NgControl); this._checkName(); this._registry.add(this._control, this); } /** * @return {?} */ ngOnDestroy() { this._registry.remove(this); } /** * @param {?} value * @return {?} */ writeValue(value) { this._state = value === this.value; this._renderer.setProperty(this._elementRef.nativeElement, 'checked', this._state); } /** * @param {?} fn * @return {?} */ registerOnChange(fn) { this._fn = fn; this.onChange = () => { fn(this.value); this._registry.select(this); }; } /** * @param {?} value * @return {?} */ fireUncheck(value) { this.writeValue(value); } /** * @param {?} fn * @return {?} */ registerOnTouched(fn) { this.onTouched = fn; } /** * @param {?} isDisabled * @return {?} */ setDisabledState(isDisabled) { this._renderer.setProperty(this._elementRef.nativeElement, 'disabled', isDisabled); } /** * @return {?} */ _checkName() { if (this.name && this.formControlName && this.name !== this.formControlName) { this._throwNameError(); } if (!this.name && this.formControlName) this.name = this.formControlName; } /** * @return {?} */ _throwNameError() { throw new Error(` If you define both a name and a formControlName attribute on your radio button, their values must match. Ex: <input type="radio" formControlName="food" name="food"> `); } } RadioControlValueAccessor.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: 'input[type=radio][formControlName],input[type=radio][formControl],input[type=radio][ngModel]', host: { '(change)': 'onChange()', '(blur)': 'onTouched()' }, providers: [RADIO_VALUE_ACCESSOR] },] }, ]; /** @nocollapse */ RadioControlValueAccessor.ctorParameters = () => [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Renderer2"], }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ElementRef"], }, { type: RadioControlRegistry, }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Injector"], }, ]; RadioControlValueAccessor.propDecorators = { "name": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "formControlName": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "value": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], }; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ const RANGE_VALUE_ACCESSOR = { provide: NG_VALUE_ACCESSOR, useExisting: Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["forwardRef"])(() => RangeValueAccessor), multi: true }; /** * The accessor for writing a range value and listening to changes that is used by the * {\@link NgModel}, {\@link FormControlDirective}, and {\@link FormControlName} directives. * * ### Example * ``` * <input type="range" [(ngModel)]="age" > * ``` */ class RangeValueAccessor { /** * @param {?} _renderer * @param {?} _elementRef */ constructor(_renderer, _elementRef) { this._renderer = _renderer; this._elementRef = _elementRef; this.onChange = (_) => { }; this.onTouched = () => { }; } /** * @param {?} value * @return {?} */ writeValue(value) { this._renderer.setProperty(this._elementRef.nativeElement, 'value', parseFloat(value)); } /** * @param {?} fn * @return {?} */ registerOnChange(fn) { this.onChange = (value) => { fn(value == '' ? null : parseFloat(value)); }; } /** * @param {?} fn * @return {?} */ registerOnTouched(fn) { this.onTouched = fn; } /** * @param {?} isDisabled * @return {?} */ setDisabledState(isDisabled) { this._renderer.setProperty(this._elementRef.nativeElement, 'disabled', isDisabled); } } RangeValueAccessor.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: 'input[type=range][formControlName],input[type=range][formControl],input[type=range][ngModel]', host: { '(change)': 'onChange($event.target.value)', '(input)': 'onChange($event.target.value)', '(blur)': 'onTouched()' }, providers: [RANGE_VALUE_ACCESSOR] },] }, ]; /** @nocollapse */ RangeValueAccessor.ctorParameters = () => [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Renderer2"], }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ElementRef"], }, ]; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ const SELECT_VALUE_ACCESSOR = { provide: NG_VALUE_ACCESSOR, useExisting: Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["forwardRef"])(() => SelectControlValueAccessor), multi: true }; /** * @param {?} id * @param {?} value * @return {?} */ function _buildValueString(id, value) { if (id == null) return `${value}`; if (value && typeof value === 'object') value = 'Object'; return `${id}: ${value}`.slice(0, 50); } /** * @param {?} valueString * @return {?} */ function _extractId(valueString) { return valueString.split(':')[0]; } /** * \@whatItDoes Writes values and listens to changes on a select element. * * Used by {\@link NgModel}, {\@link FormControlDirective}, and {\@link FormControlName} * to keep the view synced with the {\@link FormControl} model. * * \@howToUse * * If you have imported the {\@link FormsModule} or the {\@link ReactiveFormsModule}, this * value accessor will be active on any select control that has a form directive. You do * **not** need to add a special selector to activate it. * * ### How to use select controls with form directives * * To use a select in a template-driven form, simply add an `ngModel` and a `name` * attribute to the main `<select>` tag. * * If your option values are simple strings, you can bind to the normal `value` property * on the option. If your option values happen to be objects (and you'd like to save the * selection in your form as an object), use `ngValue` instead: * * {\@example forms/ts/selectControl/select_control_example.ts region='Component'} * * In reactive forms, you'll also want to add your form directive (`formControlName` or * `formControl`) on the main `<select>` tag. Like in the former example, you have the * choice of binding to the `value` or `ngValue` property on the select's options. * * {\@example forms/ts/reactiveSelectControl/reactive_select_control_example.ts region='Component'} * * ### Caveat: Option selection * * Angular uses object identity to select option. It's possible for the identities of items * to change while the data does not. This can happen, for example, if the items are produced * from an RPC to the server, and that RPC is re-run. Even if the data hasn't changed, the * second response will produce objects with different identities. * * To customize the default option comparison algorithm, `<select>` supports `compareWith` input. * `compareWith` takes a **function** which has two arguments: `option1` and `option2`. * If `compareWith` is given, Angular selects option by the return value of the function. * * #### Syntax * * ``` * <select [compareWith]="compareFn" [(ngModel)]="selectedCountries"> * <option *ngFor="let country of countries" [ngValue]="country"> * {{country.name}} * </option> * </select> * * compareFn(c1: Country, c2: Country): boolean { * return c1 && c2 ? c1.id === c2.id : c1 === c2; * } * ``` * * Note: We listen to the 'change' event because 'input' events aren't fired * for selects in Firefox and IE: * https://bugzilla.mozilla.org/show_bug.cgi?id=1024350 * https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/4660045/ * * * **npm package**: `\@angular/forms` * * \@stable */ class SelectControlValueAccessor { /** * @param {?} _renderer * @param {?} _elementRef */ constructor(_renderer, _elementRef) { this._renderer = _renderer; this._elementRef = _elementRef; /** * \@internal */ this._optionMap = new Map(); /** * \@internal */ this._idCounter = 0; this.onChange = (_) => { }; this.onTouched = () => { }; this._compareWith = __WEBPACK_IMPORTED_MODULE_0__angular_core__["ɵlooseIdentical"]; } /** * @param {?} fn * @return {?} */ set compareWith(fn) { if (typeof fn !== 'function') { throw new Error(`compareWith must be a function, but received ${JSON.stringify(fn)}`); } this._compareWith = fn; } /** * @param {?} value * @return {?} */ writeValue(value) { this.value = value; const /** @type {?} */ id = this._getOptionId(value); if (id == null) { this._renderer.setProperty(this._elementRef.nativeElement, 'selectedIndex', -1); } const /** @type {?} */ valueString = _buildValueString(id, value); this._renderer.setProperty(this._elementRef.nativeElement, 'value', valueString); } /** * @param {?} fn * @return {?} */ registerOnChange(fn) { this.onChange = (valueString) => { this.value = this._getOptionValue(valueString); fn(this.value); }; } /** * @param {?} fn * @return {?} */ registerOnTouched(fn) { this.onTouched = fn; } /** * @param {?} isDisabled * @return {?} */ setDisabledState(isDisabled) { this._renderer.setProperty(this._elementRef.nativeElement, 'disabled', isDisabled); } /** * \@internal * @return {?} */ _registerOption() { return (this._idCounter++).toString(); } /** * \@internal * @param {?} value * @return {?} */ _getOptionId(value) { for (const /** @type {?} */ id of Array.from(this._optionMap.keys())) { if (this._compareWith(this._optionMap.get(id), value)) return id; } return null; } /** * \@internal * @param {?} valueString * @return {?} */ _getOptionValue(valueString) { const /** @type {?} */ id = _extractId(valueString); return this._optionMap.has(id) ? this._optionMap.get(id) : valueString; } } SelectControlValueAccessor.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: 'select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]', host: { '(change)': 'onChange($event.target.value)', '(blur)': 'onTouched()' }, providers: [SELECT_VALUE_ACCESSOR] },] }, ]; /** @nocollapse */ SelectControlValueAccessor.ctorParameters = () => [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Renderer2"], }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ElementRef"], }, ]; SelectControlValueAccessor.propDecorators = { "compareWith": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], }; /** * \@whatItDoes Marks `<option>` as dynamic, so Angular can be notified when options change. * * \@howToUse * * See docs for {\@link SelectControlValueAccessor} for usage examples. * * \@stable */ class NgSelectOption { /** * @param {?} _element * @param {?} _renderer * @param {?} _select */ constructor(_element, _renderer, _select) { this._element = _element; this._renderer = _renderer; this._select = _select; if (this._select) this.id = this._select._registerOption(); } /** * @param {?} value * @return {?} */ set ngValue(value) { if (this._select == null) return; this._select._optionMap.set(this.id, value); this._setElementValue(_buildValueString(this.id, value)); this._select.writeValue(this._select.value); } /** * @param {?} value * @return {?} */ set value(value) { this._setElementValue(value); if (this._select) this._select.writeValue(this._select.value); } /** * \@internal * @param {?} value * @return {?} */ _setElementValue(value) { this._renderer.setProperty(this._element.nativeElement, 'value', value); } /** * @return {?} */ ngOnDestroy() { if (this._select) { this._select._optionMap.delete(this.id); this._select.writeValue(this._select.value); } } } NgSelectOption.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: 'option' },] }, ]; /** @nocollapse */ NgSelectOption.ctorParameters = () => [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ElementRef"], }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Renderer2"], }, { type: SelectControlValueAccessor, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Optional"] }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Host"] },] }, ]; NgSelectOption.propDecorators = { "ngValue": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"], args: ['ngValue',] },], "value": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"], args: ['value',] },], }; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ const SELECT_MULTIPLE_VALUE_ACCESSOR = { provide: NG_VALUE_ACCESSOR, useExisting: Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["forwardRef"])(() => SelectMultipleControlValueAccessor), multi: true }; /** * @param {?} id * @param {?} value * @return {?} */ function _buildValueString$1(id, value) { if (id == null) return `${value}`; if (typeof value === 'string') value = `'${value}'`; if (value && typeof value === 'object') value = 'Object'; return `${id}: ${value}`.slice(0, 50); } /** * @param {?} valueString * @return {?} */ function _extractId$1(valueString) { return valueString.split(':')[0]; } /** * The accessor for writing a value and listening to changes on a select element. * * ### Caveat: Options selection * * Angular uses object identity to select options. It's possible for the identities of items * to change while the data does not. This can happen, for example, if the items are produced * from an RPC to the server, and that RPC is re-run. Even if the data hasn't changed, the * second response will produce objects with different identities. * * To customize the default option comparison algorithm, `<select multiple>` supports `compareWith` * input. `compareWith` takes a **function** which has two arguments: `option1` and `option2`. * If `compareWith` is given, Angular selects options by the return value of the function. * * #### Syntax * * ``` * <select multiple [compareWith]="compareFn" [(ngModel)]="selectedCountries"> * <option *ngFor="let country of countries" [ngValue]="country"> * {{country.name}} * </option> * </select> * * compareFn(c1: Country, c2: Country): boolean { * return c1 && c2 ? c1.id === c2.id : c1 === c2; * } * ``` * * \@stable */ class SelectMultipleControlValueAccessor { /** * @param {?} _renderer * @param {?} _elementRef */ constructor(_renderer, _elementRef) { this._renderer = _renderer; this._elementRef = _elementRef; /** * \@internal */ this._optionMap = new Map(); /** * \@internal */ this._idCounter = 0; this.onChange = (_) => { }; this.onTouched = () => { }; this._compareWith = __WEBPACK_IMPORTED_MODULE_0__angular_core__["ɵlooseIdentical"]; } /** * @param {?} fn * @return {?} */ set compareWith(fn) { if (typeof fn !== 'function') { throw new Error(`compareWith must be a function, but received ${JSON.stringify(fn)}`); } this._compareWith = fn; } /** * @param {?} value * @return {?} */ writeValue(value) { this.value = value; let /** @type {?} */ optionSelectedStateSetter; if (Array.isArray(value)) { // convert values to ids const /** @type {?} */ ids = value.map((v) => this._getOptionId(v)); optionSelectedStateSetter = (opt, o) => { opt._setSelected(ids.indexOf(o.toString()) > -1); }; } else { optionSelectedStateSetter = (opt, o) => { opt._setSelected(false); }; } this._optionMap.forEach(optionSelectedStateSetter); } /** * @param {?} fn * @return {?} */ registerOnChange(fn) { this.onChange = (_) => { const /** @type {?} */ selected = []; if (_.hasOwnProperty('selectedOptions')) { const /** @type {?} */ options = _.selectedOptions; for (let /** @type {?} */ i = 0; i < options.length; i++) { const /** @type {?} */ opt = options.item(i); const /** @type {?} */ val = this._getOptionValue(opt.value); selected.push(val); } } else { const /** @type {?} */ options = /** @type {?} */ (_.options); for (let /** @type {?} */ i = 0; i < options.length; i++) { const /** @type {?} */ opt = options.item(i); if (opt.selected) { const /** @type {?} */ val = this._getOptionValue(opt.value); selected.push(val); } } } this.value = selected; fn(selected); }; } /** * @param {?} fn * @return {?} */ registerOnTouched(fn) { this.onTouched = fn; } /** * @param {?} isDisabled * @return {?} */ setDisabledState(isDisabled) { this._renderer.setProperty(this._elementRef.nativeElement, 'disabled', isDisabled); } /** * \@internal * @param {?} value * @return {?} */ _registerOption(value) { const /** @type {?} */ id = (this._idCounter++).toString(); this._optionMap.set(id, value); return id; } /** * \@internal * @param {?} value * @return {?} */ _getOptionId(value) { for (const /** @type {?} */ id of Array.from(this._optionMap.keys())) { if (this._compareWith(/** @type {?} */ ((this._optionMap.get(id)))._value, value)) return id; } return null; } /** * \@internal * @param {?} valueString * @return {?} */ _getOptionValue(valueString) { const /** @type {?} */ id = _extractId$1(valueString); return this._optionMap.has(id) ? /** @type {?} */ ((this._optionMap.get(id)))._value : valueString; } } SelectMultipleControlValueAccessor.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: 'select[multiple][formControlName],select[multiple][formControl],select[multiple][ngModel]', host: { '(change)': 'onChange($event.target)', '(blur)': 'onTouched()' }, providers: [SELECT_MULTIPLE_VALUE_ACCESSOR] },] }, ]; /** @nocollapse */ SelectMultipleControlValueAccessor.ctorParameters = () => [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Renderer2"], }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ElementRef"], }, ]; SelectMultipleControlValueAccessor.propDecorators = { "compareWith": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], }; /** * Marks `<option>` as dynamic, so Angular can be notified when options change. * * ### Example * * ``` * <select multiple name="city" ngModel> * <option *ngFor="let c of cities" [value]="c"></option> * </select> * ``` */ class NgSelectMultipleOption { /** * @param {?} _element * @param {?} _renderer * @param {?} _select */ constructor(_element, _renderer, _select) { this._element = _element; this._renderer = _renderer; this._select = _select; if (this._select) { this.id = this._select._registerOption(this); } } /** * @param {?} value * @return {?} */ set ngValue(value) { if (this._select == null) return; this._value = value; this._setElementValue(_buildValueString$1(this.id, value)); this._select.writeValue(this._select.value); } /** * @param {?} value * @return {?} */ set value(value) { if (this._select) { this._value = value; this._setElementValue(_buildValueString$1(this.id, value)); this._select.writeValue(this._select.value); } else { this._setElementValue(value); } } /** * \@internal * @param {?} value * @return {?} */ _setElementValue(value) { this._renderer.setProperty(this._element.nativeElement, 'value', value); } /** * \@internal * @param {?} selected * @return {?} */ _setSelected(selected) { this._renderer.setProperty(this._element.nativeElement, 'selected', selected); } /** * @return {?} */ ngOnDestroy() { if (this._select) { this._select._optionMap.delete(this.id); this._select.writeValue(this._select.value); } } } NgSelectMultipleOption.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: 'option' },] }, ]; /** @nocollapse */ NgSelectMultipleOption.ctorParameters = () => [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ElementRef"], }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Renderer2"], }, { type: SelectMultipleControlValueAccessor, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Optional"] }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Host"] },] }, ]; NgSelectMultipleOption.propDecorators = { "ngValue": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"], args: ['ngValue',] },], "value": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"], args: ['value',] },], }; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @param {?} name * @param {?} parent * @return {?} */ function controlPath(name, parent) { return [.../** @type {?} */ ((parent.path)), name]; } /** * @param {?} control * @param {?} dir * @return {?} */ function setUpControl(control, dir) { if (!control) _throwError(dir, 'Cannot find control with'); if (!dir.valueAccessor) _throwError(dir, 'No value accessor for form control with'); control.validator = Validators.compose([/** @type {?} */ ((control.validator)), dir.validator]); control.asyncValidator = Validators.composeAsync([/** @type {?} */ ((control.asyncValidator)), dir.asyncValidator]); /** @type {?} */ ((dir.valueAccessor)).writeValue(control.value); setUpViewChangePipeline(control, dir); setUpModelChangePipeline(control, dir); setUpBlurPipeline(control, dir); if (/** @type {?} */ ((dir.valueAccessor)).setDisabledState) { control.registerOnDisabledChange((isDisabled) => { /** @type {?} */ ((/** @type {?} */ ((dir.valueAccessor)).setDisabledState))(isDisabled); }); } // re-run validation when validator binding changes, e.g. minlength=3 -> minlength=4 dir._rawValidators.forEach((validator) => { if ((/** @type {?} */ (validator)).registerOnValidatorChange) /** @type {?} */ (((/** @type {?} */ (validator)).registerOnValidatorChange))(() => control.updateValueAndValidity()); }); dir._rawAsyncValidators.forEach((validator) => { if ((/** @type {?} */ (validator)).registerOnValidatorChange) /** @type {?} */ (((/** @type {?} */ (validator)).registerOnValidatorChange))(() => control.updateValueAndValidity()); }); } /** * @param {?} control * @param {?} dir * @return {?} */ function cleanUpControl(control, dir) { /** @type {?} */ ((dir.valueAccessor)).registerOnChange(() => _noControlError(dir)); /** @type {?} */ ((dir.valueAccessor)).registerOnTouched(() => _noControlError(dir)); dir._rawValidators.forEach((validator) => { if (validator.registerOnValidatorChange) { validator.registerOnValidatorChange(null); } }); dir._rawAsyncValidators.forEach((validator) => { if (validator.registerOnValidatorChange) { validator.registerOnValidatorChange(null); } }); if (control) control._clearChangeFns(); } /** * @param {?} control * @param {?} dir * @return {?} */ function setUpViewChangePipeline(control, dir) { /** @type {?} */ ((dir.valueAccessor)).registerOnChange((newValue) => { control._pendingValue = newValue; control._pendingChange = true; control._pendingDirty = true; if (control.updateOn === 'change') updateControl(control, dir); }); } /** * @param {?} control * @param {?} dir * @return {?} */ function setUpBlurPipeline(control, dir) { /** @type {?} */ ((dir.valueAccessor)).registerOnTouched(() => { control._pendingTouched = true; if (control.updateOn === 'blur' && control._pendingChange) updateControl(control, dir); if (control.updateOn !== 'submit') control.markAsTouched(); }); } /** * @param {?} control * @param {?} dir * @return {?} */ function updateControl(control, dir) { dir.viewToModelUpdate(control._pendingValue); if (control._pendingDirty) control.markAsDirty(); control.setValue(control._pendingValue, { emitModelToViewChange: false }); control._pendingChange = false; } /** * @param {?} control * @param {?} dir * @return {?} */ function setUpModelChangePipeline(control, dir) { control.registerOnChange((newValue, emitModelEvent) => { /** @type {?} */ (( // control -> view dir.valueAccessor)).writeValue(newValue); // control -> ngModel if (emitModelEvent) dir.viewToModelUpdate(newValue); }); } /** * @param {?} control * @param {?} dir * @return {?} */ function setUpFormContainer(control, dir) { if (control == null) _throwError(dir, 'Cannot find control with'); control.validator = Validators.compose([control.validator, dir.validator]); control.asyncValidator = Validators.composeAsync([control.asyncValidator, dir.asyncValidator]); } /** * @param {?} dir * @return {?} */ function _noControlError(dir) { return _throwError(dir, 'There is no FormControl instance attached to form control element with'); } /** * @param {?} dir * @param {?} message * @return {?} */ function _throwError(dir, message) { let /** @type {?} */ messageEnd; if (/** @type {?} */ ((dir.path)).length > 1) { messageEnd = `path: '${(/** @type {?} */ ((dir.path))).join(' -> ')}'`; } else if (/** @type {?} */ ((dir.path))[0]) { messageEnd = `name: '${dir.path}'`; } else { messageEnd = 'unspecified name attribute'; } throw new Error(`${message} ${messageEnd}`); } /** * @param {?} validators * @return {?} */ function composeValidators(validators) { return validators != null ? Validators.compose(validators.map(normalizeValidator)) : null; } /** * @param {?} validators * @return {?} */ function composeAsyncValidators(validators) { return validators != null ? Validators.composeAsync(validators.map(normalizeAsyncValidator)) : null; } /** * @param {?} changes * @param {?} viewModel * @return {?} */ function isPropertyUpdated(changes, viewModel) { if (!changes.hasOwnProperty('model')) return false; const /** @type {?} */ change = changes['model']; if (change.isFirstChange()) return true; return !Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["ɵlooseIdentical"])(viewModel, change.currentValue); } const BUILTIN_ACCESSORS = [ CheckboxControlValueAccessor, RangeValueAccessor, NumberValueAccessor, SelectControlValueAccessor, SelectMultipleControlValueAccessor, RadioControlValueAccessor, ]; /** * @param {?} valueAccessor * @return {?} */ function isBuiltInAccessor(valueAccessor) { return BUILTIN_ACCESSORS.some(a => valueAccessor.constructor === a); } /** * @param {?} form * @param {?} directives * @return {?} */ function syncPendingControls(form, directives) { form._syncPendingControls(); directives.forEach(dir => { const /** @type {?} */ control = /** @type {?} */ (dir.control); if (control.updateOn === 'submit' && control._pendingChange) { dir.viewToModelUpdate(control._pendingValue); control._pendingChange = false; } }); } /** * @param {?} dir * @param {?} valueAccessors * @return {?} */ function selectValueAccessor(dir, valueAccessors) { if (!valueAccessors) return null; if (!Array.isArray(valueAccessors)) _throwError(dir, 'Value accessor was not provided as an array for form control with'); let /** @type {?} */ defaultAccessor = undefined; let /** @type {?} */ builtinAccessor = undefined; let /** @type {?} */ customAccessor = undefined; valueAccessors.forEach((v) => { if (v.constructor === DefaultValueAccessor) { defaultAccessor = v; } else if (isBuiltInAccessor(v)) { if (builtinAccessor) _throwError(dir, 'More than one built-in value accessor matches form control with'); builtinAccessor = v; } else { if (customAccessor) _throwError(dir, 'More than one custom value accessor matches form control with'); customAccessor = v; } }); if (customAccessor) return customAccessor; if (builtinAccessor) return builtinAccessor; if (defaultAccessor) return defaultAccessor; _throwError(dir, 'No valid value accessor for form control with'); return null; } /** * @template T * @param {?} list * @param {?} el * @return {?} */ function removeDir(list, el) { const /** @type {?} */ index = list.indexOf(el); if (index > -1) list.splice(index, 1); } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * This is a base class for code shared between {\@link NgModelGroup} and {\@link FormGroupName}. * * \@stable */ class AbstractFormGroupDirective extends ControlContainer { /** * @return {?} */ ngOnInit() { this._checkParentType(); /** @type {?} */ ((this.formDirective)).addFormGroup(this); } /** * @return {?} */ ngOnDestroy() { if (this.formDirective) { this.formDirective.removeFormGroup(this); } } /** * Get the {\@link FormGroup} backing this binding. * @return {?} */ get control() { return /** @type {?} */ ((this.formDirective)).getFormGroup(this); } /** * Get the path to this control group. * @return {?} */ get path() { return controlPath(this.name, this._parent); } /** * Get the {\@link Form} to which this group belongs. * @return {?} */ get formDirective() { return this._parent ? this._parent.formDirective : null; } /** * @return {?} */ get validator() { return composeValidators(this._validators); } /** * @return {?} */ get asyncValidator() { return composeAsyncValidators(this._asyncValidators); } /** * \@internal * @return {?} */ _checkParentType() { } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ class AbstractControlStatus { /** * @param {?} cd */ constructor(cd) { this._cd = cd; } /** * @return {?} */ get ngClassUntouched() { return this._cd.control ? this._cd.control.untouched : false; } /** * @return {?} */ get ngClassTouched() { return this._cd.control ? this._cd.control.touched : false; } /** * @return {?} */ get ngClassPristine() { return this._cd.control ? this._cd.control.pristine : false; } /** * @return {?} */ get ngClassDirty() { return this._cd.control ? this._cd.control.dirty : false; } /** * @return {?} */ get ngClassValid() { return this._cd.control ? this._cd.control.valid : false; } /** * @return {?} */ get ngClassInvalid() { return this._cd.control ? this._cd.control.invalid : false; } /** * @return {?} */ get ngClassPending() { return this._cd.control ? this._cd.control.pending : false; } } const ngControlStatusHost = { '[class.ng-untouched]': 'ngClassUntouched', '[class.ng-touched]': 'ngClassTouched', '[class.ng-pristine]': 'ngClassPristine', '[class.ng-dirty]': 'ngClassDirty', '[class.ng-valid]': 'ngClassValid', '[class.ng-invalid]': 'ngClassInvalid', '[class.ng-pending]': 'ngClassPending', }; /** * Directive automatically applied to Angular form controls that sets CSS classes * based on control status. The following classes are applied as the properties * become true: * * * ng-valid * * ng-invalid * * ng-pending * * ng-pristine * * ng-dirty * * ng-untouched * * ng-touched * * \@stable */ class NgControlStatus extends AbstractControlStatus { /** * @param {?} cd */ constructor(cd) { super(cd); } } NgControlStatus.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: '[formControlName],[ngModel],[formControl]', host: ngControlStatusHost },] }, ]; /** @nocollapse */ NgControlStatus.ctorParameters = () => [ { type: NgControl, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Self"] },] }, ]; /** * Directive automatically applied to Angular form groups that sets CSS classes * based on control status (valid/invalid/dirty/etc). * * \@stable */ class NgControlStatusGroup extends AbstractControlStatus { /** * @param {?} cd */ constructor(cd) { super(cd); } } NgControlStatusGroup.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: '[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]', host: ngControlStatusHost },] }, ]; /** @nocollapse */ NgControlStatusGroup.ctorParameters = () => [ { type: ControlContainer, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Self"] },] }, ]; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * Indicates that a FormControl is valid, i.e. that no errors exist in the input value. */ const VALID = 'VALID'; /** * Indicates that a FormControl is invalid, i.e. that an error exists in the input value. */ const INVALID = 'INVALID'; /** * Indicates that a FormControl is pending, i.e. that async validation is occurring and * errors are not yet available for the input value. */ const PENDING = 'PENDING'; /** * Indicates that a FormControl is disabled, i.e. that the control is exempt from ancestor * calculations of validity or value. */ const DISABLED = 'DISABLED'; /** * @param {?} control * @param {?} path * @param {?} delimiter * @return {?} */ function _find(control, path, delimiter) { if (path == null) return null; if (!(path instanceof Array)) { path = (/** @type {?} */ (path)).split(delimiter); } if (path instanceof Array && (path.length === 0)) return null; return (/** @type {?} */ (path)).reduce((v, name) => { if (v instanceof FormGroup) { return v.controls[name] || null; } if (v instanceof FormArray) { return v.at(/** @type {?} */ (name)) || null; } return null; }, control); } /** * @param {?=} validatorOrOpts * @return {?} */ function coerceToValidator(validatorOrOpts) { const /** @type {?} */ validator = /** @type {?} */ ((isOptionsObj(validatorOrOpts) ? (/** @type {?} */ (validatorOrOpts)).validators : validatorOrOpts)); return Array.isArray(validator) ? composeValidators(validator) : validator || null; } /** * @param {?=} asyncValidator * @param {?=} validatorOrOpts * @return {?} */ function coerceToAsyncValidator(asyncValidator, validatorOrOpts) { const /** @type {?} */ origAsyncValidator = /** @type {?} */ ((isOptionsObj(validatorOrOpts) ? (/** @type {?} */ (validatorOrOpts)).asyncValidators : asyncValidator)); return Array.isArray(origAsyncValidator) ? composeAsyncValidators(origAsyncValidator) : origAsyncValidator || null; } /** * @record */ /** * @param {?=} validatorOrOpts * @return {?} */ function isOptionsObj(validatorOrOpts) { return validatorOrOpts != null && !Array.isArray(validatorOrOpts) && typeof validatorOrOpts === 'object'; } /** * \@whatItDoes This is the base class for {\@link FormControl}, {\@link FormGroup}, and * {\@link FormArray}. * * It provides some of the shared behavior that all controls and groups of controls have, like * running validators, calculating status, and resetting state. It also defines the properties * that are shared between all sub-classes, like `value`, `valid`, and `dirty`. It shouldn't be * instantiated directly. * * \@stable * @abstract */ class AbstractControl { /** * @param {?} validator * @param {?} asyncValidator */ constructor(validator, asyncValidator) { this.validator = validator; this.asyncValidator = asyncValidator; /** * \@internal */ this._onCollectionChange = () => { }; /** * A control is `pristine` if the user has not yet changed * the value in the UI. * * Note that programmatic changes to a control's value will * *not* mark it dirty. */ this.pristine = true; /** * A control is marked `touched` once the user has triggered * a `blur` event on it. */ this.touched = false; /** * \@internal */ this._onDisabledChange = []; } /** * The parent control. * @return {?} */ get parent() { return this._parent; } /** * A control is `valid` when its `status === VALID`. * * In order to have this status, the control must have passed all its * validation checks. * @return {?} */ get valid() { return this.status === VALID; } /** * A control is `invalid` when its `status === INVALID`. * * In order to have this status, the control must have failed * at least one of its validation checks. * @return {?} */ get invalid() { return this.status === INVALID; } /** * A control is `pending` when its `status === PENDING`. * * In order to have this status, the control must be in the * middle of conducting a validation check. * @return {?} */ get pending() { return this.status == PENDING; } /** * A control is `disabled` when its `status === DISABLED`. * * Disabled controls are exempt from validation checks and * are not included in the aggregate value of their ancestor * controls. * @return {?} */ get disabled() { return this.status === DISABLED; } /** * A control is `enabled` as long as its `status !== DISABLED`. * * In other words, it has a status of `VALID`, `INVALID`, or * `PENDING`. * @return {?} */ get enabled() { return this.status !== DISABLED; } /** * A control is `dirty` if the user has changed the value * in the UI. * * Note that programmatic changes to a control's value will * *not* mark it dirty. * @return {?} */ get dirty() { return !this.pristine; } /** * A control is `untouched` if the user has not yet triggered * a `blur` event on it. * @return {?} */ get untouched() { return !this.touched; } /** * Returns the update strategy of the `AbstractControl` (i.e. * the event on which the control will update itself). * Possible values: `'change'` (default) | `'blur'` | `'submit'` * @return {?} */ get updateOn() { return this._updateOn ? this._updateOn : (this.parent ? this.parent.updateOn : 'change'); } /** * Sets the synchronous validators that are active on this control. Calling * this will overwrite any existing sync validators. * @param {?} newValidator * @return {?} */ setValidators(newValidator) { this.validator = coerceToValidator(newValidator); } /** * Sets the async validators that are active on this control. Calling this * will overwrite any existing async validators. * @param {?} newValidator * @return {?} */ setAsyncValidators(newValidator) { this.asyncValidator = coerceToAsyncValidator(newValidator); } /** * Empties out the sync validator list. * @return {?} */ clearValidators() { this.validator = null; } /** * Empties out the async validator list. * @return {?} */ clearAsyncValidators() { this.asyncValidator = null; } /** * Marks the control as `touched`. * * This will also mark all direct ancestors as `touched` to maintain * the model. * @param {?=} opts * @return {?} */ markAsTouched(opts = {}) { (/** @type {?} */ (this)).touched = true; if (this._parent && !opts.onlySelf) { this._parent.markAsTouched(opts); } } /** * Marks the control as `untouched`. * * If the control has any children, it will also mark all children as `untouched` * to maintain the model, and re-calculate the `touched` status of all parent * controls. * @param {?=} opts * @return {?} */ markAsUntouched(opts = {}) { (/** @type {?} */ (this)).touched = false; this._pendingTouched = false; this._forEachChild((control) => { control.markAsUntouched({ onlySelf: true }); }); if (this._parent && !opts.onlySelf) { this._parent._updateTouched(opts); } } /** * Marks the control as `dirty`. * * This will also mark all direct ancestors as `dirty` to maintain * the model. * @param {?=} opts * @return {?} */ markAsDirty(opts = {}) { (/** @type {?} */ (this)).pristine = false; if (this._parent && !opts.onlySelf) { this._parent.markAsDirty(opts); } } /** * Marks the control as `pristine`. * * If the control has any children, it will also mark all children as `pristine` * to maintain the model, and re-calculate the `pristine` status of all parent * controls. * @param {?=} opts * @return {?} */ markAsPristine(opts = {}) { (/** @type {?} */ (this)).pristine = true; this._pendingDirty = false; this._forEachChild((control) => { control.markAsPristine({ onlySelf: true }); }); if (this._parent && !opts.onlySelf) { this._parent._updatePristine(opts); } } /** * Marks the control as `pending`. * @param {?=} opts * @return {?} */ markAsPending(opts = {}) { (/** @type {?} */ (this)).status = PENDING; if (this._parent && !opts.onlySelf) { this._parent.markAsPending(opts); } } /** * Disables the control. This means the control will be exempt from validation checks and * excluded from the aggregate value of any parent. Its status is `DISABLED`. * * If the control has children, all children will be disabled to maintain the model. * @param {?=} opts * @return {?} */ disable(opts = {}) { (/** @type {?} */ (this)).status = DISABLED; (/** @type {?} */ (this)).errors = null; this._forEachChild((control) => { control.disable(Object.assign({}, opts, { onlySelf: true })); }); this._updateValue(); if (opts.emitEvent !== false) { (/** @type {?} */ (this.valueChanges)).emit(this.value); (/** @type {?} */ (this.statusChanges)).emit(this.status); } this._updateAncestors(opts); this._onDisabledChange.forEach((changeFn) => changeFn(true)); } /** * Enables the control. This means the control will be included in validation checks and * the aggregate value of its parent. Its status is re-calculated based on its value and * its validators. * * If the control has children, all children will be enabled. * @param {?=} opts * @return {?} */ enable(opts = {}) { (/** @type {?} */ (this)).status = VALID; this._forEachChild((control) => { control.enable(Object.assign({}, opts, { onlySelf: true })); }); this.updateValueAndValidity({ onlySelf: true, emitEvent: opts.emitEvent }); this._updateAncestors(opts); this._onDisabledChange.forEach((changeFn) => changeFn(false)); } /** * @param {?} opts * @return {?} */ _updateAncestors(opts) { if (this._parent && !opts.onlySelf) { this._parent.updateValueAndValidity(opts); this._parent._updatePristine(); this._parent._updateTouched(); } } /** * @param {?} parent * @return {?} */ setParent(parent) { this._parent = parent; } /** * Re-calculates the value and validation status of the control. * * By default, it will also update the value and validity of its ancestors. * @param {?=} opts * @return {?} */ updateValueAndValidity(opts = {}) { this._setInitialStatus(); this._updateValue(); if (this.enabled) { this._cancelExistingSubscription(); (/** @type {?} */ (this)).errors = this._runValidator(); (/** @type {?} */ (this)).status = this._calculateStatus(); if (this.status === VALID || this.status === PENDING) { this._runAsyncValidator(opts.emitEvent); } } if (opts.emitEvent !== false) { (/** @type {?} */ (this.valueChanges)).emit(this.value); (/** @type {?} */ (this.statusChanges)).emit(this.status); } if (this._parent && !opts.onlySelf) { this._parent.updateValueAndValidity(opts); } } /** * \@internal * @param {?=} opts * @return {?} */ _updateTreeValidity(opts = { emitEvent: true }) { this._forEachChild((ctrl) => ctrl._updateTreeValidity(opts)); this.updateValueAndValidity({ onlySelf: true, emitEvent: opts.emitEvent }); } /** * @return {?} */ _setInitialStatus() { (/** @type {?} */ (this)).status = this._allControlsDisabled() ? DISABLED : VALID; } /** * @return {?} */ _runValidator() { return this.validator ? this.validator(this) : null; } /** * @param {?=} emitEvent * @return {?} */ _runAsyncValidator(emitEvent) { if (this.asyncValidator) { (/** @type {?} */ (this)).status = PENDING; const /** @type {?} */ obs = toObservable(this.asyncValidator(this)); this._asyncValidationSubscription = obs.subscribe((errors) => this.setErrors(errors, { emitEvent })); } } /** * @return {?} */ _cancelExistingSubscription() { if (this._asyncValidationSubscription) { this._asyncValidationSubscription.unsubscribe(); } } /** * Sets errors on a form control. * * This is used when validations are run manually by the user, rather than automatically. * * Calling `setErrors` will also update the validity of the parent control. * * ### Example * * ``` * const login = new FormControl("someLogin"); * login.setErrors({ * "notUnique": true * }); * * expect(login.valid).toEqual(false); * expect(login.errors).toEqual({"notUnique": true}); * * login.setValue("someOtherLogin"); * * expect(login.valid).toEqual(true); * ``` * @param {?} errors * @param {?=} opts * @return {?} */ setErrors(errors, opts = {}) { (/** @type {?} */ (this)).errors = errors; this._updateControlsErrors(opts.emitEvent !== false); } /** * Retrieves a child control given the control's name or path. * * Paths can be passed in as an array or a string delimited by a dot. * * To get a control nested within a `person` sub-group: * * * `this.form.get('person.name');` * * -OR- * * * `this.form.get(['person', 'name']);` * @param {?} path * @return {?} */ get(path) { return _find(this, path, '.'); } /** * Returns error data if the control with the given path has the error specified. Otherwise * returns null or undefined. * * If no path is given, it checks for the error on the present control. * @param {?} errorCode * @param {?=} path * @return {?} */ getError(errorCode, path) { const /** @type {?} */ control = path ? this.get(path) : this; return control && control.errors ? control.errors[errorCode] : null; } /** * Returns true if the control with the given path has the error specified. Otherwise * returns false. * * If no path is given, it checks for the error on the present control. * @param {?} errorCode * @param {?=} path * @return {?} */ hasError(errorCode, path) { return !!this.getError(errorCode, path); } /** * Retrieves the top-level ancestor of this control. * @return {?} */ get root() { let /** @type {?} */ x = this; while (x._parent) { x = x._parent; } return x; } /** * \@internal * @param {?} emitEvent * @return {?} */ _updateControlsErrors(emitEvent) { (/** @type {?} */ (this)).status = this._calculateStatus(); if (emitEvent) { (/** @type {?} */ (this.statusChanges)).emit(this.status); } if (this._parent) { this._parent._updateControlsErrors(emitEvent); } } /** * \@internal * @return {?} */ _initObservables() { (/** @type {?} */ (this)).valueChanges = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); (/** @type {?} */ (this)).statusChanges = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); } /** * @return {?} */ _calculateStatus() { if (this._allControlsDisabled()) return DISABLED; if (this.errors) return INVALID; if (this._anyControlsHaveStatus(PENDING)) return PENDING; if (this._anyControlsHaveStatus(INVALID)) return INVALID; return VALID; } /** * \@internal * @param {?} status * @return {?} */ _anyControlsHaveStatus(status) { return this._anyControls((control) => control.status === status); } /** * \@internal * @return {?} */ _anyControlsDirty() { return this._anyControls((control) => control.dirty); } /** * \@internal * @return {?} */ _anyControlsTouched() { return this._anyControls((control) => control.touched); } /** * \@internal * @param {?=} opts * @return {?} */ _updatePristine(opts = {}) { (/** @type {?} */ (this)).pristine = !this._anyControlsDirty(); if (this._parent && !opts.onlySelf) { this._parent._updatePristine(opts); } } /** * \@internal * @param {?=} opts * @return {?} */ _updateTouched(opts = {}) { (/** @type {?} */ (this)).touched = this._anyControlsTouched(); if (this._parent && !opts.onlySelf) { this._parent._updateTouched(opts); } } /** * \@internal * @param {?} formState * @return {?} */ _isBoxedValue(formState) { return typeof formState === 'object' && formState !== null && Object.keys(formState).length === 2 && 'value' in formState && 'disabled' in formState; } /** * \@internal * @param {?} fn * @return {?} */ _registerOnCollectionChange(fn) { this._onCollectionChange = fn; } /** * \@internal * @param {?=} opts * @return {?} */ _setUpdateStrategy(opts) { if (isOptionsObj(opts) && (/** @type {?} */ (opts)).updateOn != null) { this._updateOn = /** @type {?} */ (((/** @type {?} */ (opts)).updateOn)); } } } /** * \@whatItDoes Tracks the value and validation status of an individual form control. * * It is one of the three fundamental building blocks of Angular forms, along with * {\@link FormGroup} and {\@link FormArray}. * * \@howToUse * * When instantiating a {\@link FormControl}, you can pass in an initial value as the * first argument. Example: * * ```ts * const ctrl = new FormControl('some value'); * console.log(ctrl.value); // 'some value' * ``` * * You can also initialize the control with a form state object on instantiation, * which includes both the value and whether or not the control is disabled. * You can't use the value key without the disabled key; both are required * to use this way of initialization. * * ```ts * const ctrl = new FormControl({value: 'n/a', disabled: true}); * console.log(ctrl.value); // 'n/a' * console.log(ctrl.status); // 'DISABLED' * ``` * * The second {\@link FormControl} argument can accept one of three things: * * a sync validator function * * an array of sync validator functions * * an options object containing validator and/or async validator functions * * Example of a single sync validator function: * * ```ts * const ctrl = new FormControl('', Validators.required); * console.log(ctrl.value); // '' * console.log(ctrl.status); // 'INVALID' * ``` * * Example using options object: * * ```ts * const ctrl = new FormControl('', { * validators: Validators.required, * asyncValidators: myAsyncValidator * }); * ``` * * The options object can also be used to define when the control should update. * By default, the value and validity of a control updates whenever the value * changes. You can configure it to update on the blur event instead by setting * the `updateOn` option to `'blur'`. * * ```ts * const c = new FormControl('', { updateOn: 'blur' }); * ``` * * You can also set `updateOn` to `'submit'`, which will delay value and validity * updates until the parent form of the control fires a submit event. * * See its superclass, {\@link AbstractControl}, for more properties and methods. * * * **npm package**: `\@angular/forms` * * \@stable */ class FormControl extends AbstractControl { /** * @param {?=} formState * @param {?=} validatorOrOpts * @param {?=} asyncValidator */ constructor(formState = null, validatorOrOpts, asyncValidator) { super(coerceToValidator(validatorOrOpts), coerceToAsyncValidator(asyncValidator, validatorOrOpts)); /** * \@internal */ this._onChange = []; this._applyFormState(formState); this._setUpdateStrategy(validatorOrOpts); this.updateValueAndValidity({ onlySelf: true, emitEvent: false }); this._initObservables(); } /** * Set the value of the form control to `value`. * * If `onlySelf` is `true`, this change will only affect the validation of this `FormControl` * and not its parent component. This defaults to false. * * If `emitEvent` is `true`, this * change will cause a `valueChanges` event on the `FormControl` to be emitted. This defaults * to true (as it falls through to `updateValueAndValidity`). * * If `emitModelToViewChange` is `true`, the view will be notified about the new value * via an `onChange` event. This is the default behavior if `emitModelToViewChange` is not * specified. * * If `emitViewToModelChange` is `true`, an ngModelChange event will be fired to update the * model. This is the default behavior if `emitViewToModelChange` is not specified. * @param {?} value * @param {?=} options * @return {?} */ setValue(value, options = {}) { (/** @type {?} */ (this)).value = this._pendingValue = value; if (this._onChange.length && options.emitModelToViewChange !== false) { this._onChange.forEach((changeFn) => changeFn(this.value, options.emitViewToModelChange !== false)); } this.updateValueAndValidity(options); } /** * Patches the value of a control. * * This function is functionally the same as {\@link FormControl#setValue setValue} at this level. * It exists for symmetry with {\@link FormGroup#patchValue patchValue} on `FormGroups` and * `FormArrays`, where it does behave differently. * @param {?} value * @param {?=} options * @return {?} */ patchValue(value, options = {}) { this.setValue(value, options); } /** * Resets the form control. This means by default: * * * it is marked as `pristine` * * it is marked as `untouched` * * value is set to null * * You can also reset to a specific form state by passing through a standalone * value or a form state object that contains both a value and a disabled state * (these are the only two properties that cannot be calculated). * * Ex: * * ```ts * this.control.reset('Nancy'); * * console.log(this.control.value); // 'Nancy' * ``` * * OR * * ``` * this.control.reset({value: 'Nancy', disabled: true}); * * console.log(this.control.value); // 'Nancy' * console.log(this.control.status); // 'DISABLED' * ``` * @param {?=} formState * @param {?=} options * @return {?} */ reset(formState = null, options = {}) { this._applyFormState(formState); this.markAsPristine(options); this.markAsUntouched(options); this.setValue(this.value, options); this._pendingChange = false; } /** * \@internal * @return {?} */ _updateValue() { } /** * \@internal * @param {?} condition * @return {?} */ _anyControls(condition) { return false; } /** * \@internal * @return {?} */ _allControlsDisabled() { return this.disabled; } /** * Register a listener for change events. * @param {?} fn * @return {?} */ registerOnChange(fn) { this._onChange.push(fn); } /** * \@internal * @return {?} */ _clearChangeFns() { this._onChange = []; this._onDisabledChange = []; this._onCollectionChange = () => { }; } /** * Register a listener for disabled events. * @param {?} fn * @return {?} */ registerOnDisabledChange(fn) { this._onDisabledChange.push(fn); } /** * \@internal * @param {?} cb * @return {?} */ _forEachChild(cb) { } /** * \@internal * @return {?} */ _syncPendingControls() { if (this.updateOn === 'submit') { if (this._pendingDirty) this.markAsDirty(); if (this._pendingTouched) this.markAsTouched(); if (this._pendingChange) { this.setValue(this._pendingValue, { onlySelf: true, emitModelToViewChange: false }); return true; } } return false; } /** * @param {?} formState * @return {?} */ _applyFormState(formState) { if (this._isBoxedValue(formState)) { (/** @type {?} */ (this)).value = this._pendingValue = formState.value; formState.disabled ? this.disable({ onlySelf: true, emitEvent: false }) : this.enable({ onlySelf: true, emitEvent: false }); } else { (/** @type {?} */ (this)).value = this._pendingValue = formState; } } } /** * \@whatItDoes Tracks the value and validity state of a group of {\@link FormControl} * instances. * * A `FormGroup` aggregates the values of each child {\@link FormControl} into one object, * with each control name as the key. It calculates its status by reducing the statuses * of its children. For example, if one of the controls in a group is invalid, the entire * group becomes invalid. * * `FormGroup` is one of the three fundamental building blocks used to define forms in Angular, * along with {\@link FormControl} and {\@link FormArray}. * * \@howToUse * * When instantiating a {\@link FormGroup}, pass in a collection of child controls as the first * argument. The key for each child will be the name under which it is registered. * * ### Example * * ``` * const form = new FormGroup({ * first: new FormControl('Nancy', Validators.minLength(2)), * last: new FormControl('Drew'), * }); * * console.log(form.value); // {first: 'Nancy', last; 'Drew'} * console.log(form.status); // 'VALID' * ``` * * You can also include group-level validators as the second arg, or group-level async * validators as the third arg. These come in handy when you want to perform validation * that considers the value of more than one child control. * * ### Example * * ``` * const form = new FormGroup({ * password: new FormControl('', Validators.minLength(2)), * passwordConfirm: new FormControl('', Validators.minLength(2)), * }, passwordMatchValidator); * * * function passwordMatchValidator(g: FormGroup) { * return g.get('password').value === g.get('passwordConfirm').value * ? null : {'mismatch': true}; * } * ``` * * Like {\@link FormControl} instances, you can alternatively choose to pass in * validators and async validators as part of an options object. * * ``` * const form = new FormGroup({ * password: new FormControl('') * passwordConfirm: new FormControl('') * }, {validators: passwordMatchValidator, asyncValidators: otherValidator}); * ``` * * The options object can also be used to set a default value for each child * control's `updateOn` property. If you set `updateOn` to `'blur'` at the * group level, all child controls will default to 'blur', unless the child * has explicitly specified a different `updateOn` value. * * ```ts * const c = new FormGroup({ * one: new FormControl() * }, {updateOn: 'blur'}); * ``` * * * **npm package**: `\@angular/forms` * * \@stable */ class FormGroup extends AbstractControl { /** * @param {?} controls * @param {?=} validatorOrOpts * @param {?=} asyncValidator */ constructor(controls, validatorOrOpts, asyncValidator) { super(coerceToValidator(validatorOrOpts), coerceToAsyncValidator(asyncValidator, validatorOrOpts)); this.controls = controls; this._initObservables(); this._setUpdateStrategy(validatorOrOpts); this._setUpControls(); this.updateValueAndValidity({ onlySelf: true, emitEvent: false }); } /** * Registers a control with the group's list of controls. * * This method does not update the value or validity of the control, so for most cases you'll want * to use {\@link FormGroup#addControl addControl} instead. * @param {?} name * @param {?} control * @return {?} */ registerControl(name, control) { if (this.controls[name]) return this.controls[name]; this.controls[name] = control; control.setParent(this); control._registerOnCollectionChange(this._onCollectionChange); return control; } /** * Add a control to this group. * @param {?} name * @param {?} control * @return {?} */ addControl(name, control) { this.registerControl(name, control); this.updateValueAndValidity(); this._onCollectionChange(); } /** * Remove a control from this group. * @param {?} name * @return {?} */ removeControl(name) { if (this.controls[name]) this.controls[name]._registerOnCollectionChange(() => { }); delete (this.controls[name]); this.updateValueAndValidity(); this._onCollectionChange(); } /** * Replace an existing control. * @param {?} name * @param {?} control * @return {?} */ setControl(name, control) { if (this.controls[name]) this.controls[name]._registerOnCollectionChange(() => { }); delete (this.controls[name]); if (control) this.registerControl(name, control); this.updateValueAndValidity(); this._onCollectionChange(); } /** * Check whether there is an enabled control with the given name in the group. * * It will return false for disabled controls. If you'd like to check for existence in the group * only, use {\@link AbstractControl#get get} instead. * @param {?} controlName * @return {?} */ contains(controlName) { return this.controls.hasOwnProperty(controlName) && this.controls[controlName].enabled; } /** * Sets the value of the {\@link FormGroup}. It accepts an object that matches * the structure of the group, with control names as keys. * * This method performs strict checks, so it will throw an error if you try * to set the value of a control that doesn't exist or if you exclude the * value of a control. * * ### Example * * ``` * const form = new FormGroup({ * first: new FormControl(), * last: new FormControl() * }); * console.log(form.value); // {first: null, last: null} * * form.setValue({first: 'Nancy', last: 'Drew'}); * console.log(form.value); // {first: 'Nancy', last: 'Drew'} * * ``` * @param {?} value * @param {?=} options * @return {?} */ setValue(value, options = {}) { this._checkAllValuesPresent(value); Object.keys(value).forEach(name => { this._throwIfControlMissing(name); this.controls[name].setValue(value[name], { onlySelf: true, emitEvent: options.emitEvent }); }); this.updateValueAndValidity(options); } /** * Patches the value of the {\@link FormGroup}. It accepts an object with control * names as keys, and will do its best to match the values to the correct controls * in the group. * * It accepts both super-sets and sub-sets of the group without throwing an error. * * ### Example * * ``` * const form = new FormGroup({ * first: new FormControl(), * last: new FormControl() * }); * console.log(form.value); // {first: null, last: null} * * form.patchValue({first: 'Nancy'}); * console.log(form.value); // {first: 'Nancy', last: null} * * ``` * @param {?} value * @param {?=} options * @return {?} */ patchValue(value, options = {}) { Object.keys(value).forEach(name => { if (this.controls[name]) { this.controls[name].patchValue(value[name], { onlySelf: true, emitEvent: options.emitEvent }); } }); this.updateValueAndValidity(options); } /** * Resets the {\@link FormGroup}. This means by default: * * * The group and all descendants are marked `pristine` * * The group and all descendants are marked `untouched` * * The value of all descendants will be null or null maps * * You can also reset to a specific form state by passing in a map of states * that matches the structure of your form, with control names as keys. The state * can be a standalone value or a form state object with both a value and a disabled * status. * * ### Example * * ```ts * this.form.reset({first: 'name', last: 'last name'}); * * console.log(this.form.value); // {first: 'name', last: 'last name'} * ``` * * - OR - * * ``` * this.form.reset({ * first: {value: 'name', disabled: true}, * last: 'last' * }); * * console.log(this.form.value); // {first: 'name', last: 'last name'} * console.log(this.form.get('first').status); // 'DISABLED' * ``` * @param {?=} value * @param {?=} options * @return {?} */ reset(value = {}, options = {}) { this._forEachChild((control, name) => { control.reset(value[name], { onlySelf: true, emitEvent: options.emitEvent }); }); this.updateValueAndValidity(options); this._updatePristine(options); this._updateTouched(options); } /** * The aggregate value of the {\@link FormGroup}, including any disabled controls. * * If you'd like to include all values regardless of disabled status, use this method. * Otherwise, the `value` property is the best way to get the value of the group. * @return {?} */ getRawValue() { return this._reduceChildren({}, (acc, control, name) => { acc[name] = control instanceof FormControl ? control.value : (/** @type {?} */ (control)).getRawValue(); return acc; }); } /** * \@internal * @return {?} */ _syncPendingControls() { let /** @type {?} */ subtreeUpdated = this._reduceChildren(false, (updated, child) => { return child._syncPendingControls() ? true : updated; }); if (subtreeUpdated) this.updateValueAndValidity({ onlySelf: true }); return subtreeUpdated; } /** * \@internal * @param {?} name * @return {?} */ _throwIfControlMissing(name) { if (!Object.keys(this.controls).length) { throw new Error(` There are no form controls registered with this group yet. If you're using ngModel, you may want to check next tick (e.g. use setTimeout). `); } if (!this.controls[name]) { throw new Error(`Cannot find form control with name: ${name}.`); } } /** * \@internal * @param {?} cb * @return {?} */ _forEachChild(cb) { Object.keys(this.controls).forEach(k => cb(this.controls[k], k)); } /** * \@internal * @return {?} */ _setUpControls() { this._forEachChild((control) => { control.setParent(this); control._registerOnCollectionChange(this._onCollectionChange); }); } /** * \@internal * @return {?} */ _updateValue() { (/** @type {?} */ (this)).value = this._reduceValue(); } /** * \@internal * @param {?} condition * @return {?} */ _anyControls(condition) { let /** @type {?} */ res = false; this._forEachChild((control, name) => { res = res || (this.contains(name) && condition(control)); }); return res; } /** * \@internal * @return {?} */ _reduceValue() { return this._reduceChildren({}, (acc, control, name) => { if (control.enabled || this.disabled) { acc[name] = control.value; } return acc; }); } /** * \@internal * @param {?} initValue * @param {?} fn * @return {?} */ _reduceChildren(initValue, fn) { let /** @type {?} */ res = initValue; this._forEachChild((control, name) => { res = fn(res, control, name); }); return res; } /** * \@internal * @return {?} */ _allControlsDisabled() { for (const /** @type {?} */ controlName of Object.keys(this.controls)) { if (this.controls[controlName].enabled) { return false; } } return Object.keys(this.controls).length > 0 || this.disabled; } /** * \@internal * @param {?} value * @return {?} */ _checkAllValuesPresent(value) { this._forEachChild((control, name) => { if (value[name] === undefined) { throw new Error(`Must supply a value for form control with name: '${name}'.`); } }); } } /** * \@whatItDoes Tracks the value and validity state of an array of {\@link FormControl}, * {\@link FormGroup} or {\@link FormArray} instances. * * A `FormArray` aggregates the values of each child {\@link FormControl} into an array. * It calculates its status by reducing the statuses of its children. For example, if one of * the controls in a `FormArray` is invalid, the entire array becomes invalid. * * `FormArray` is one of the three fundamental building blocks used to define forms in Angular, * along with {\@link FormControl} and {\@link FormGroup}. * * \@howToUse * * When instantiating a {\@link FormArray}, pass in an array of child controls as the first * argument. * * ### Example * * ``` * const arr = new FormArray([ * new FormControl('Nancy', Validators.minLength(2)), * new FormControl('Drew'), * ]); * * console.log(arr.value); // ['Nancy', 'Drew'] * console.log(arr.status); // 'VALID' * ``` * * You can also include array-level validators and async validators. These come in handy * when you want to perform validation that considers the value of more than one child * control. * * The two types of validators can be passed in separately as the second and third arg * respectively, or together as part of an options object. * * ``` * const arr = new FormArray([ * new FormControl('Nancy'), * new FormControl('Drew') * ], {validators: myValidator, asyncValidators: myAsyncValidator}); * ``` * * The options object can also be used to set a default value for each child * control's `updateOn` property. If you set `updateOn` to `'blur'` at the * array level, all child controls will default to 'blur', unless the child * has explicitly specified a different `updateOn` value. * * ```ts * const c = new FormArray([ * new FormControl() * ], {updateOn: 'blur'}); * ``` * * ### Adding or removing controls * * To change the controls in the array, use the `push`, `insert`, or `removeAt` methods * in `FormArray` itself. These methods ensure the controls are properly tracked in the * form's hierarchy. Do not modify the array of `AbstractControl`s used to instantiate * the `FormArray` directly, as that will result in strange and unexpected behavior such * as broken change detection. * * * **npm package**: `\@angular/forms` * * \@stable */ class FormArray extends AbstractControl { /** * @param {?} controls * @param {?=} validatorOrOpts * @param {?=} asyncValidator */ constructor(controls, validatorOrOpts, asyncValidator) { super(coerceToValidator(validatorOrOpts), coerceToAsyncValidator(asyncValidator, validatorOrOpts)); this.controls = controls; this._initObservables(); this._setUpdateStrategy(validatorOrOpts); this._setUpControls(); this.updateValueAndValidity({ onlySelf: true, emitEvent: false }); } /** * Get the {\@link AbstractControl} at the given `index` in the array. * @param {?} index * @return {?} */ at(index) { return this.controls[index]; } /** * Insert a new {\@link AbstractControl} at the end of the array. * @param {?} control * @return {?} */ push(control) { this.controls.push(control); this._registerControl(control); this.updateValueAndValidity(); this._onCollectionChange(); } /** * Insert a new {\@link AbstractControl} at the given `index` in the array. * @param {?} index * @param {?} control * @return {?} */ insert(index, control) { this.controls.splice(index, 0, control); this._registerControl(control); this.updateValueAndValidity(); } /** * Remove the control at the given `index` in the array. * @param {?} index * @return {?} */ removeAt(index) { if (this.controls[index]) this.controls[index]._registerOnCollectionChange(() => { }); this.controls.splice(index, 1); this.updateValueAndValidity(); } /** * Replace an existing control. * @param {?} index * @param {?} control * @return {?} */ setControl(index, control) { if (this.controls[index]) this.controls[index]._registerOnCollectionChange(() => { }); this.controls.splice(index, 1); if (control) { this.controls.splice(index, 0, control); this._registerControl(control); } this.updateValueAndValidity(); this._onCollectionChange(); } /** * Length of the control array. * @return {?} */ get length() { return this.controls.length; } /** * Sets the value of the {\@link FormArray}. It accepts an array that matches * the structure of the control. * * This method performs strict checks, so it will throw an error if you try * to set the value of a control that doesn't exist or if you exclude the * value of a control. * * ### Example * * ``` * const arr = new FormArray([ * new FormControl(), * new FormControl() * ]); * console.log(arr.value); // [null, null] * * arr.setValue(['Nancy', 'Drew']); * console.log(arr.value); // ['Nancy', 'Drew'] * ``` * @param {?} value * @param {?=} options * @return {?} */ setValue(value, options = {}) { this._checkAllValuesPresent(value); value.forEach((newValue, index) => { this._throwIfControlMissing(index); this.at(index).setValue(newValue, { onlySelf: true, emitEvent: options.emitEvent }); }); this.updateValueAndValidity(options); } /** * Patches the value of the {\@link FormArray}. It accepts an array that matches the * structure of the control, and will do its best to match the values to the correct * controls in the group. * * It accepts both super-sets and sub-sets of the array without throwing an error. * * ### Example * * ``` * const arr = new FormArray([ * new FormControl(), * new FormControl() * ]); * console.log(arr.value); // [null, null] * * arr.patchValue(['Nancy']); * console.log(arr.value); // ['Nancy', null] * ``` * @param {?} value * @param {?=} options * @return {?} */ patchValue(value, options = {}) { value.forEach((newValue, index) => { if (this.at(index)) { this.at(index).patchValue(newValue, { onlySelf: true, emitEvent: options.emitEvent }); } }); this.updateValueAndValidity(options); } /** * Resets the {\@link FormArray}. This means by default: * * * The array and all descendants are marked `pristine` * * The array and all descendants are marked `untouched` * * The value of all descendants will be null or null maps * * You can also reset to a specific form state by passing in an array of states * that matches the structure of the control. The state can be a standalone value * or a form state object with both a value and a disabled status. * * ### Example * * ```ts * this.arr.reset(['name', 'last name']); * * console.log(this.arr.value); // ['name', 'last name'] * ``` * * - OR - * * ``` * this.arr.reset([ * {value: 'name', disabled: true}, * 'last' * ]); * * console.log(this.arr.value); // ['name', 'last name'] * console.log(this.arr.get(0).status); // 'DISABLED' * ``` * @param {?=} value * @param {?=} options * @return {?} */ reset(value = [], options = {}) { this._forEachChild((control, index) => { control.reset(value[index], { onlySelf: true, emitEvent: options.emitEvent }); }); this.updateValueAndValidity(options); this._updatePristine(options); this._updateTouched(options); } /** * The aggregate value of the array, including any disabled controls. * * If you'd like to include all values regardless of disabled status, use this method. * Otherwise, the `value` property is the best way to get the value of the array. * @return {?} */ getRawValue() { return this.controls.map((control) => { return control instanceof FormControl ? control.value : (/** @type {?} */ (control)).getRawValue(); }); } /** * \@internal * @return {?} */ _syncPendingControls() { let /** @type {?} */ subtreeUpdated = this.controls.reduce((updated, child) => { return child._syncPendingControls() ? true : updated; }, false); if (subtreeUpdated) this.updateValueAndValidity({ onlySelf: true }); return subtreeUpdated; } /** * \@internal * @param {?} index * @return {?} */ _throwIfControlMissing(index) { if (!this.controls.length) { throw new Error(` There are no form controls registered with this array yet. If you're using ngModel, you may want to check next tick (e.g. use setTimeout). `); } if (!this.at(index)) { throw new Error(`Cannot find form control at index ${index}`); } } /** * \@internal * @param {?} cb * @return {?} */ _forEachChild(cb) { this.controls.forEach((control, index) => { cb(control, index); }); } /** * \@internal * @return {?} */ _updateValue() { (/** @type {?} */ (this)).value = this.controls.filter((control) => control.enabled || this.disabled) .map((control) => control.value); } /** * \@internal * @param {?} condition * @return {?} */ _anyControls(condition) { return this.controls.some((control) => control.enabled && condition(control)); } /** * \@internal * @return {?} */ _setUpControls() { this._forEachChild((control) => this._registerControl(control)); } /** * \@internal * @param {?} value * @return {?} */ _checkAllValuesPresent(value) { this._forEachChild((control, i) => { if (value[i] === undefined) { throw new Error(`Must supply a value for form control at index: ${i}.`); } }); } /** * \@internal * @return {?} */ _allControlsDisabled() { for (const /** @type {?} */ control of this.controls) { if (control.enabled) return false; } return this.controls.length > 0 || this.disabled; } /** * @param {?} control * @return {?} */ _registerControl(control) { control.setParent(this); control._registerOnCollectionChange(this._onCollectionChange); } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ const formDirectiveProvider = { provide: ControlContainer, useExisting: Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["forwardRef"])(() => NgForm) }; const resolvedPromise = Promise.resolve(null); /** * \@whatItDoes Creates a top-level {\@link FormGroup} instance and binds it to a form * to track aggregate form value and validation status. * * \@howToUse * * As soon as you import the `FormsModule`, this directive becomes active by default on * all `<form>` tags. You don't need to add a special selector. * * You can export the directive into a local template variable using `ngForm` as the key * (ex: `#myForm="ngForm"`). This is optional, but useful. Many properties from the underlying * {\@link FormGroup} instance are duplicated on the directive itself, so a reference to it * will give you access to the aggregate value and validity status of the form, as well as * user interaction properties like `dirty` and `touched`. * * To register child controls with the form, you'll want to use {\@link NgModel} with a * `name` attribute. You can also use {\@link NgModelGroup} if you'd like to create * sub-groups within the form. * * You can listen to the directive's `ngSubmit` event to be notified when the user has * triggered a form submission. The `ngSubmit` event will be emitted with the original form * submission event. * * In template driven forms, all `<form>` tags are automatically tagged as `NgForm`. * If you want to import the `FormsModule` but skip its usage in some forms, * for example, to use native HTML5 validation, you can add `ngNoForm` and the `<form>` * tags won't create an `NgForm` directive. In reactive forms, using `ngNoForm` is * unnecessary because the `<form>` tags are inert. In that case, you would * refrain from using the `formGroup` directive. * * {\@example forms/ts/simpleForm/simple_form_example.ts region='Component'} * * * **npm package**: `\@angular/forms` * * * **NgModule**: `FormsModule` * * \@stable */ class NgForm extends ControlContainer { /** * @param {?} validators * @param {?} asyncValidators */ constructor(validators, asyncValidators) { super(); this.submitted = false; this._directives = []; this.ngSubmit = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); this.form = new FormGroup({}, composeValidators(validators), composeAsyncValidators(asyncValidators)); } /** * @return {?} */ ngAfterViewInit() { this._setUpdateStrategy(); } /** * @return {?} */ get formDirective() { return this; } /** * @return {?} */ get control() { return this.form; } /** * @return {?} */ get path() { return []; } /** * @return {?} */ get controls() { return this.form.controls; } /** * @param {?} dir * @return {?} */ addControl(dir) { resolvedPromise.then(() => { const /** @type {?} */ container = this._findContainer(dir.path); (/** @type {?} */ (dir)).control = /** @type {?} */ (container.registerControl(dir.name, dir.control)); setUpControl(dir.control, dir); dir.control.updateValueAndValidity({ emitEvent: false }); this._directives.push(dir); }); } /** * @param {?} dir * @return {?} */ getControl(dir) { return /** @type {?} */ (this.form.get(dir.path)); } /** * @param {?} dir * @return {?} */ removeControl(dir) { resolvedPromise.then(() => { const /** @type {?} */ container = this._findContainer(dir.path); if (container) { container.removeControl(dir.name); } removeDir(this._directives, dir); }); } /** * @param {?} dir * @return {?} */ addFormGroup(dir) { resolvedPromise.then(() => { const /** @type {?} */ container = this._findContainer(dir.path); const /** @type {?} */ group = new FormGroup({}); setUpFormContainer(group, dir); container.registerControl(dir.name, group); group.updateValueAndValidity({ emitEvent: false }); }); } /** * @param {?} dir * @return {?} */ removeFormGroup(dir) { resolvedPromise.then(() => { const /** @type {?} */ container = this._findContainer(dir.path); if (container) { container.removeControl(dir.name); } }); } /** * @param {?} dir * @return {?} */ getFormGroup(dir) { return /** @type {?} */ (this.form.get(dir.path)); } /** * @param {?} dir * @param {?} value * @return {?} */ updateModel(dir, value) { resolvedPromise.then(() => { const /** @type {?} */ ctrl = /** @type {?} */ (this.form.get(/** @type {?} */ ((dir.path)))); ctrl.setValue(value); }); } /** * @param {?} value * @return {?} */ setValue(value) { this.control.setValue(value); } /** * @param {?} $event * @return {?} */ onSubmit($event) { (/** @type {?} */ (this)).submitted = true; syncPendingControls(this.form, this._directives); this.ngSubmit.emit($event); return false; } /** * @return {?} */ onReset() { this.resetForm(); } /** * @param {?=} value * @return {?} */ resetForm(value = undefined) { this.form.reset(value); (/** @type {?} */ (this)).submitted = false; } /** * @return {?} */ _setUpdateStrategy() { if (this.options && this.options.updateOn != null) { this.form._updateOn = this.options.updateOn; } } /** * \@internal * @param {?} path * @return {?} */ _findContainer(path) { path.pop(); return path.length ? /** @type {?} */ (this.form.get(path)) : this.form; } } NgForm.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: 'form:not([ngNoForm]):not([formGroup]),ngForm,[ngForm]', providers: [formDirectiveProvider], host: { '(submit)': 'onSubmit($event)', '(reset)': 'onReset()' }, outputs: ['ngSubmit'], exportAs: 'ngForm' },] }, ]; /** @nocollapse */ NgForm.ctorParameters = () => [ { type: Array, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Optional"] }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Self"] }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Inject"], args: [NG_VALIDATORS,] },] }, { type: Array, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Optional"] }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Self"] }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Inject"], args: [NG_ASYNC_VALIDATORS,] },] }, ]; NgForm.propDecorators = { "options": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"], args: ['ngFormOptions',] },], }; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ const FormErrorExamples = { formControlName: ` <div [formGroup]="myGroup"> <input formControlName="firstName"> </div> In your class: this.myGroup = new FormGroup({ firstName: new FormControl() });`, formGroupName: ` <div [formGroup]="myGroup"> <div formGroupName="person"> <input formControlName="firstName"> </div> </div> In your class: this.myGroup = new FormGroup({ person: new FormGroup({ firstName: new FormControl() }) });`, formArrayName: ` <div [formGroup]="myGroup"> <div formArrayName="cities"> <div *ngFor="let city of cityArray.controls; index as i"> <input [formControlName]="i"> </div> </div> </div> In your class: this.cityArray = new FormArray([new FormControl('SF')]); this.myGroup = new FormGroup({ cities: this.cityArray });`, ngModelGroup: ` <form> <div ngModelGroup="person"> <input [(ngModel)]="person.name" name="firstName"> </div> </form>`, ngModelWithFormGroup: ` <div [formGroup]="myGroup"> <input formControlName="firstName"> <input [(ngModel)]="showMoreControls" [ngModelOptions]="{standalone: true}"> </div> ` }; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ class TemplateDrivenErrors { /** * @return {?} */ static modelParentException() { throw new Error(` ngModel cannot be used to register form controls with a parent formGroup directive. Try using formGroup's partner directive "formControlName" instead. Example: ${FormErrorExamples.formControlName} Or, if you'd like to avoid registering this form control, indicate that it's standalone in ngModelOptions: Example: ${FormErrorExamples.ngModelWithFormGroup}`); } /** * @return {?} */ static formGroupNameException() { throw new Error(` ngModel cannot be used to register form controls with a parent formGroupName or formArrayName directive. Option 1: Use formControlName instead of ngModel (reactive strategy): ${FormErrorExamples.formGroupName} Option 2: Update ngModel's parent be ngModelGroup (template-driven strategy): ${FormErrorExamples.ngModelGroup}`); } /** * @return {?} */ static missingNameException() { throw new Error(`If ngModel is used within a form tag, either the name attribute must be set or the form control must be defined as 'standalone' in ngModelOptions. Example 1: <input [(ngModel)]="person.firstName" name="first"> Example 2: <input [(ngModel)]="person.firstName" [ngModelOptions]="{standalone: true}">`); } /** * @return {?} */ static modelGroupParentException() { throw new Error(` ngModelGroup cannot be used with a parent formGroup directive. Option 1: Use formGroupName instead of ngModelGroup (reactive strategy): ${FormErrorExamples.formGroupName} Option 2: Use a regular form tag instead of the formGroup directive (template-driven strategy): ${FormErrorExamples.ngModelGroup}`); } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ const modelGroupProvider = { provide: ControlContainer, useExisting: Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["forwardRef"])(() => NgModelGroup) }; /** * \@whatItDoes Creates and binds a {\@link FormGroup} instance to a DOM element. * * \@howToUse * * This directive can only be used as a child of {\@link NgForm} (or in other words, * within `<form>` tags). * * Use this directive if you'd like to create a sub-group within a form. This can * come in handy if you want to validate a sub-group of your form separately from * the rest of your form, or if some values in your domain model make more sense to * consume together in a nested object. * * Pass in the name you'd like this sub-group to have and it will become the key * for the sub-group in the form's full value. You can also export the directive into * a local template variable using `ngModelGroup` (ex: `#myGroup="ngModelGroup"`). * * {\@example forms/ts/ngModelGroup/ng_model_group_example.ts region='Component'} * * * **npm package**: `\@angular/forms` * * * **NgModule**: `FormsModule` * * \@stable */ class NgModelGroup extends AbstractFormGroupDirective { /** * @param {?} parent * @param {?} validators * @param {?} asyncValidators */ constructor(parent, validators, asyncValidators) { super(); this._parent = parent; this._validators = validators; this._asyncValidators = asyncValidators; } /** * \@internal * @return {?} */ _checkParentType() { if (!(this._parent instanceof NgModelGroup) && !(this._parent instanceof NgForm)) { TemplateDrivenErrors.modelGroupParentException(); } } } NgModelGroup.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: '[ngModelGroup]', providers: [modelGroupProvider], exportAs: 'ngModelGroup' },] }, ]; /** @nocollapse */ NgModelGroup.ctorParameters = () => [ { type: ControlContainer, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Host"] }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["SkipSelf"] },] }, { type: Array, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Optional"] }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Self"] }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Inject"], args: [NG_VALIDATORS,] },] }, { type: Array, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Optional"] }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Self"] }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Inject"], args: [NG_ASYNC_VALIDATORS,] },] }, ]; NgModelGroup.propDecorators = { "name": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"], args: ['ngModelGroup',] },], }; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ const formControlBinding = { provide: NgControl, useExisting: Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["forwardRef"])(() => NgModel) }; /** * `ngModel` forces an additional change detection run when its inputs change: * E.g.: * ``` * <div>{{myModel.valid}}</div> * <input [(ngModel)]="myValue" #myModel="ngModel"> * ``` * I.e. `ngModel` can export itself on the element and then be used in the template. * Normally, this would result in expressions before the `input` that use the exported directive * to have and old value as they have been * dirty checked before. As this is a very common case for `ngModel`, we added this second change * detection run. * * Notes: * - this is just one extra run no matter how many `ngModel` have been changed. * - this is a general problem when using `exportAs` for directives! */ const resolvedPromise$1 = Promise.resolve(null); /** * \@whatItDoes Creates a {\@link FormControl} instance from a domain model and binds it * to a form control element. * * The {\@link FormControl} instance will track the value, user interaction, and * validation status of the control and keep the view synced with the model. If used * within a parent form, the directive will also register itself with the form as a child * control. * * \@howToUse * * This directive can be used by itself or as part of a larger form. All you need is the * `ngModel` selector to activate it. * * It accepts a domain model as an optional {\@link Input}. If you have a one-way binding * to `ngModel` with `[]` syntax, changing the value of the domain model in the component * class will set the value in the view. If you have a two-way binding with `[()]` syntax * (also known as 'banana-box syntax'), the value in the UI will always be synced back to * the domain model in your class as well. * * If you wish to inspect the properties of the associated {\@link FormControl} (like * validity state), you can also export the directive into a local template variable using * `ngModel` as the key (ex: `#myVar="ngModel"`). You can then access the control using the * directive's `control` property, but most properties you'll need (like `valid` and `dirty`) * will fall through to the control anyway, so you can access them directly. You can see a * full list of properties directly available in {\@link AbstractControlDirective}. * * The following is an example of a simple standalone control using `ngModel`: * * {\@example forms/ts/simpleNgModel/simple_ng_model_example.ts region='Component'} * * When using the `ngModel` within `<form>` tags, you'll also need to supply a `name` attribute * so that the control can be registered with the parent form under that name. * * It's worth noting that in the context of a parent form, you often can skip one-way or * two-way binding because the parent form will sync the value for you. You can access * its properties by exporting it into a local template variable using `ngForm` (ex: * `#f="ngForm"`). Then you can pass it where it needs to go on submit. * * If you do need to populate initial values into your form, using a one-way binding for * `ngModel` tends to be sufficient as long as you use the exported form's value rather * than the domain model's value on submit. * * Take a look at an example of using `ngModel` within a form: * * {\@example forms/ts/simpleForm/simple_form_example.ts region='Component'} * * To see `ngModel` examples with different form control types, see: * * * Radio buttons: {\@link RadioControlValueAccessor} * * Selects: {\@link SelectControlValueAccessor} * * **npm package**: `\@angular/forms` * * **NgModule**: `FormsModule` * * \@stable */ class NgModel extends NgControl { /** * @param {?} parent * @param {?} validators * @param {?} asyncValidators * @param {?} valueAccessors */ constructor(parent, validators, asyncValidators, valueAccessors) { super(); this.control = new FormControl(); /** * \@internal */ this._registered = false; this.update = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); this._parent = parent; this._rawValidators = validators || []; this._rawAsyncValidators = asyncValidators || []; this.valueAccessor = selectValueAccessor(this, valueAccessors); } /** * @param {?} changes * @return {?} */ ngOnChanges(changes) { this._checkForErrors(); if (!this._registered) this._setUpControl(); if ('isDisabled' in changes) { this._updateDisabled(changes); } if (isPropertyUpdated(changes, this.viewModel)) { this._updateValue(this.model); this.viewModel = this.model; } } /** * @return {?} */ ngOnDestroy() { this.formDirective && this.formDirective.removeControl(this); } /** * @return {?} */ get path() { return this._parent ? controlPath(this.name, this._parent) : [this.name]; } /** * @return {?} */ get formDirective() { return this._parent ? this._parent.formDirective : null; } /** * @return {?} */ get validator() { return composeValidators(this._rawValidators); } /** * @return {?} */ get asyncValidator() { return composeAsyncValidators(this._rawAsyncValidators); } /** * @param {?} newValue * @return {?} */ viewToModelUpdate(newValue) { this.viewModel = newValue; this.update.emit(newValue); } /** * @return {?} */ _setUpControl() { this._setUpdateStrategy(); this._isStandalone() ? this._setUpStandalone() : this.formDirective.addControl(this); this._registered = true; } /** * @return {?} */ _setUpdateStrategy() { if (this.options && this.options.updateOn != null) { this.control._updateOn = this.options.updateOn; } } /** * @return {?} */ _isStandalone() { return !this._parent || !!(this.options && this.options.standalone); } /** * @return {?} */ _setUpStandalone() { setUpControl(this.control, this); this.control.updateValueAndValidity({ emitEvent: false }); } /** * @return {?} */ _checkForErrors() { if (!this._isStandalone()) { this._checkParentType(); } this._checkName(); } /** * @return {?} */ _checkParentType() { if (!(this._parent instanceof NgModelGroup) && this._parent instanceof AbstractFormGroupDirective) { TemplateDrivenErrors.formGroupNameException(); } else if (!(this._parent instanceof NgModelGroup) && !(this._parent instanceof NgForm)) { TemplateDrivenErrors.modelParentException(); } } /** * @return {?} */ _checkName() { if (this.options && this.options.name) this.name = this.options.name; if (!this._isStandalone() && !this.name) { TemplateDrivenErrors.missingNameException(); } } /** * @param {?} value * @return {?} */ _updateValue(value) { resolvedPromise$1.then(() => { this.control.setValue(value, { emitViewToModelChange: false }); }); } /** * @param {?} changes * @return {?} */ _updateDisabled(changes) { const /** @type {?} */ disabledValue = changes['isDisabled'].currentValue; const /** @type {?} */ isDisabled = disabledValue === '' || (disabledValue && disabledValue !== 'false'); resolvedPromise$1.then(() => { if (isDisabled && !this.control.disabled) { this.control.disable(); } else if (!isDisabled && this.control.disabled) { this.control.enable(); } }); } } NgModel.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: '[ngModel]:not([formControlName]):not([formControl])', providers: [formControlBinding], exportAs: 'ngModel' },] }, ]; /** @nocollapse */ NgModel.ctorParameters = () => [ { type: ControlContainer, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Optional"] }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Host"] },] }, { type: Array, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Optional"] }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Self"] }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Inject"], args: [NG_VALIDATORS,] },] }, { type: Array, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Optional"] }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Self"] }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Inject"], args: [NG_ASYNC_VALIDATORS,] },] }, { type: Array, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Optional"] }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Self"] }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Inject"], args: [NG_VALUE_ACCESSOR,] },] }, ]; NgModel.propDecorators = { "name": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "isDisabled": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"], args: ['disabled',] },], "model": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"], args: ['ngModel',] },], "options": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"], args: ['ngModelOptions',] },], "update": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"], args: ['ngModelChange',] },], }; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ class ReactiveErrors { /** * @return {?} */ static controlParentException() { throw new Error(`formControlName must be used with a parent formGroup directive. You'll want to add a formGroup directive and pass it an existing FormGroup instance (you can create one in your class). Example: ${FormErrorExamples.formControlName}`); } /** * @return {?} */ static ngModelGroupException() { throw new Error(`formControlName cannot be used with an ngModelGroup parent. It is only compatible with parents that also have a "form" prefix: formGroupName, formArrayName, or formGroup. Option 1: Update the parent to be formGroupName (reactive form strategy) ${FormErrorExamples.formGroupName} Option 2: Use ngModel instead of formControlName (template-driven strategy) ${FormErrorExamples.ngModelGroup}`); } /** * @return {?} */ static missingFormException() { throw new Error(`formGroup expects a FormGroup instance. Please pass one in. Example: ${FormErrorExamples.formControlName}`); } /** * @return {?} */ static groupParentException() { throw new Error(`formGroupName must be used with a parent formGroup directive. You'll want to add a formGroup directive and pass it an existing FormGroup instance (you can create one in your class). Example: ${FormErrorExamples.formGroupName}`); } /** * @return {?} */ static arrayParentException() { throw new Error(`formArrayName must be used with a parent formGroup directive. You'll want to add a formGroup directive and pass it an existing FormGroup instance (you can create one in your class). Example: ${FormErrorExamples.formArrayName}`); } /** * @return {?} */ static disabledAttrWarning() { console.warn(` It looks like you're using the disabled attribute with a reactive form directive. If you set disabled to true when you set up this control in your component class, the disabled attribute will actually be set in the DOM for you. We recommend using this approach to avoid 'changed after checked' errors. Example: form = new FormGroup({ first: new FormControl({value: 'Nancy', disabled: true}, Validators.required), last: new FormControl('Drew', Validators.required) }); `); } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ const formControlBinding$1 = { provide: NgControl, useExisting: Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["forwardRef"])(() => FormControlDirective) }; /** * \@whatItDoes Syncs a standalone {\@link FormControl} instance to a form control element. * * In other words, this directive ensures that any values written to the {\@link FormControl} * instance programmatically will be written to the DOM element (model -> view). Conversely, * any values written to the DOM element through user input will be reflected in the * {\@link FormControl} instance (view -> model). * * \@howToUse * * Use this directive if you'd like to create and manage a {\@link FormControl} instance directly. * Simply create a {\@link FormControl}, save it to your component class, and pass it into the * {\@link FormControlDirective}. * * This directive is designed to be used as a standalone control. Unlike {\@link FormControlName}, * it does not require that your {\@link FormControl} instance be part of any parent * {\@link FormGroup}, and it won't be registered to any {\@link FormGroupDirective} that * exists above it. * * **Get the value**: the `value` property is always synced and available on the * {\@link FormControl} instance. See a full list of available properties in * {\@link AbstractControl}. * * **Set the value**: You can pass in an initial value when instantiating the {\@link FormControl}, * or you can set it programmatically later using {\@link AbstractControl#setValue setValue} or * {\@link AbstractControl#patchValue patchValue}. * * **Listen to value**: If you want to listen to changes in the value of the control, you can * subscribe to the {\@link AbstractControl#valueChanges valueChanges} event. You can also listen to * {\@link AbstractControl#statusChanges statusChanges} to be notified when the validation status is * re-calculated. * * ### Example * * {\@example forms/ts/simpleFormControl/simple_form_control_example.ts region='Component'} * * * **npm package**: `\@angular/forms` * * * **NgModule**: `ReactiveFormsModule` * * \@stable */ class FormControlDirective extends NgControl { /** * @param {?} validators * @param {?} asyncValidators * @param {?} valueAccessors */ constructor(validators, asyncValidators, valueAccessors) { super(); this.update = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); this._rawValidators = validators || []; this._rawAsyncValidators = asyncValidators || []; this.valueAccessor = selectValueAccessor(this, valueAccessors); } /** * @param {?} isDisabled * @return {?} */ set isDisabled(isDisabled) { ReactiveErrors.disabledAttrWarning(); } /** * @param {?} changes * @return {?} */ ngOnChanges(changes) { if (this._isControlChanged(changes)) { setUpControl(this.form, this); if (this.control.disabled && /** @type {?} */ ((this.valueAccessor)).setDisabledState) { /** @type {?} */ ((/** @type {?} */ ((this.valueAccessor)).setDisabledState))(true); } this.form.updateValueAndValidity({ emitEvent: false }); } if (isPropertyUpdated(changes, this.viewModel)) { this.form.setValue(this.model); this.viewModel = this.model; } } /** * @return {?} */ get path() { return []; } /** * @return {?} */ get validator() { return composeValidators(this._rawValidators); } /** * @return {?} */ get asyncValidator() { return composeAsyncValidators(this._rawAsyncValidators); } /** * @return {?} */ get control() { return this.form; } /** * @param {?} newValue * @return {?} */ viewToModelUpdate(newValue) { this.viewModel = newValue; this.update.emit(newValue); } /** * @param {?} changes * @return {?} */ _isControlChanged(changes) { return changes.hasOwnProperty('form'); } } FormControlDirective.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: '[formControl]', providers: [formControlBinding$1], exportAs: 'ngForm' },] }, ]; /** @nocollapse */ FormControlDirective.ctorParameters = () => [ { type: Array, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Optional"] }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Self"] }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Inject"], args: [NG_VALIDATORS,] },] }, { type: Array, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Optional"] }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Self"] }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Inject"], args: [NG_ASYNC_VALIDATORS,] },] }, { type: Array, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Optional"] }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Self"] }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Inject"], args: [NG_VALUE_ACCESSOR,] },] }, ]; FormControlDirective.propDecorators = { "form": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"], args: ['formControl',] },], "model": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"], args: ['ngModel',] },], "update": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"], args: ['ngModelChange',] },], "isDisabled": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"], args: ['disabled',] },], }; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ const formDirectiveProvider$1 = { provide: ControlContainer, useExisting: Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["forwardRef"])(() => FormGroupDirective) }; /** * \@whatItDoes Binds an existing {\@link FormGroup} to a DOM element. * * \@howToUse * * This directive accepts an existing {\@link FormGroup} instance. It will then use this * {\@link FormGroup} instance to match any child {\@link FormControl}, {\@link FormGroup}, * and {\@link FormArray} instances to child {\@link FormControlName}, {\@link FormGroupName}, * and {\@link FormArrayName} directives. * * **Set value**: You can set the form's initial value when instantiating the * {\@link FormGroup}, or you can set it programmatically later using the {\@link FormGroup}'s * {\@link AbstractControl#setValue setValue} or {\@link AbstractControl#patchValue patchValue} * methods. * * **Listen to value**: If you want to listen to changes in the value of the form, you can subscribe * to the {\@link FormGroup}'s {\@link AbstractControl#valueChanges valueChanges} event. You can also * listen to its {\@link AbstractControl#statusChanges statusChanges} event to be notified when the * validation status is re-calculated. * * Furthermore, you can listen to the directive's `ngSubmit` event to be notified when the user has * triggered a form submission. The `ngSubmit` event will be emitted with the original form * submission event. * * ### Example * * In this example, we create form controls for first name and last name. * * {\@example forms/ts/simpleFormGroup/simple_form_group_example.ts region='Component'} * * **npm package**: `\@angular/forms` * * **NgModule**: {\@link ReactiveFormsModule} * * \@stable */ class FormGroupDirective extends ControlContainer { /** * @param {?} _validators * @param {?} _asyncValidators */ constructor(_validators, _asyncValidators) { super(); this._validators = _validators; this._asyncValidators = _asyncValidators; this.submitted = false; this.directives = []; this.form = /** @type {?} */ ((null)); this.ngSubmit = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); } /** * @param {?} changes * @return {?} */ ngOnChanges(changes) { this._checkFormPresent(); if (changes.hasOwnProperty('form')) { this._updateValidators(); this._updateDomValue(); this._updateRegistrations(); } } /** * @return {?} */ get formDirective() { return this; } /** * @return {?} */ get control() { return this.form; } /** * @return {?} */ get path() { return []; } /** * @param {?} dir * @return {?} */ addControl(dir) { const /** @type {?} */ ctrl = this.form.get(dir.path); setUpControl(ctrl, dir); ctrl.updateValueAndValidity({ emitEvent: false }); this.directives.push(dir); return ctrl; } /** * @param {?} dir * @return {?} */ getControl(dir) { return /** @type {?} */ (this.form.get(dir.path)); } /** * @param {?} dir * @return {?} */ removeControl(dir) { removeDir(this.directives, dir); } /** * @param {?} dir * @return {?} */ addFormGroup(dir) { const /** @type {?} */ ctrl = this.form.get(dir.path); setUpFormContainer(ctrl, dir); ctrl.updateValueAndValidity({ emitEvent: false }); } /** * @param {?} dir * @return {?} */ removeFormGroup(dir) { } /** * @param {?} dir * @return {?} */ getFormGroup(dir) { return /** @type {?} */ (this.form.get(dir.path)); } /** * @param {?} dir * @return {?} */ addFormArray(dir) { const /** @type {?} */ ctrl = this.form.get(dir.path); setUpFormContainer(ctrl, dir); ctrl.updateValueAndValidity({ emitEvent: false }); } /** * @param {?} dir * @return {?} */ removeFormArray(dir) { } /** * @param {?} dir * @return {?} */ getFormArray(dir) { return /** @type {?} */ (this.form.get(dir.path)); } /** * @param {?} dir * @param {?} value * @return {?} */ updateModel(dir, value) { const /** @type {?} */ ctrl = /** @type {?} */ (this.form.get(dir.path)); ctrl.setValue(value); } /** * @param {?} $event * @return {?} */ onSubmit($event) { (/** @type {?} */ (this)).submitted = true; syncPendingControls(this.form, this.directives); this.ngSubmit.emit($event); return false; } /** * @return {?} */ onReset() { this.resetForm(); } /** * @param {?=} value * @return {?} */ resetForm(value = undefined) { this.form.reset(value); (/** @type {?} */ (this)).submitted = false; } /** * \@internal * @return {?} */ _updateDomValue() { this.directives.forEach(dir => { const /** @type {?} */ newCtrl = this.form.get(dir.path); if (dir.control !== newCtrl) { cleanUpControl(dir.control, dir); if (newCtrl) setUpControl(newCtrl, dir); (/** @type {?} */ (dir)).control = newCtrl; } }); this.form._updateTreeValidity({ emitEvent: false }); } /** * @return {?} */ _updateRegistrations() { this.form._registerOnCollectionChange(() => this._updateDomValue()); if (this._oldForm) this._oldForm._registerOnCollectionChange(() => { }); this._oldForm = this.form; } /** * @return {?} */ _updateValidators() { const /** @type {?} */ sync = composeValidators(this._validators); this.form.validator = Validators.compose([/** @type {?} */ ((this.form.validator)), /** @type {?} */ ((sync))]); const /** @type {?} */ async = composeAsyncValidators(this._asyncValidators); this.form.asyncValidator = Validators.composeAsync([/** @type {?} */ ((this.form.asyncValidator)), /** @type {?} */ ((async))]); } /** * @return {?} */ _checkFormPresent() { if (!this.form) { ReactiveErrors.missingFormException(); } } } FormGroupDirective.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: '[formGroup]', providers: [formDirectiveProvider$1], host: { '(submit)': 'onSubmit($event)', '(reset)': 'onReset()' }, exportAs: 'ngForm' },] }, ]; /** @nocollapse */ FormGroupDirective.ctorParameters = () => [ { type: Array, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Optional"] }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Self"] }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Inject"], args: [NG_VALIDATORS,] },] }, { type: Array, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Optional"] }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Self"] }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Inject"], args: [NG_ASYNC_VALIDATORS,] },] }, ]; FormGroupDirective.propDecorators = { "form": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"], args: ['formGroup',] },], "ngSubmit": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"] },], }; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ const formGroupNameProvider = { provide: ControlContainer, useExisting: Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["forwardRef"])(() => FormGroupName) }; /** * \@whatItDoes Syncs a nested {\@link FormGroup} to a DOM element. * * \@howToUse * * This directive can only be used with a parent {\@link FormGroupDirective} (selector: * `[formGroup]`). * * It accepts the string name of the nested {\@link FormGroup} you want to link, and * will look for a {\@link FormGroup} registered with that name in the parent * {\@link FormGroup} instance you passed into {\@link FormGroupDirective}. * * Nested form groups can come in handy when you want to validate a sub-group of a * form separately from the rest or when you'd like to group the values of certain * controls into their own nested object. * * **Access the group**: You can access the associated {\@link FormGroup} using the * {\@link AbstractControl#get get} method. Ex: `this.form.get('name')`. * * You can also access individual controls within the group using dot syntax. * Ex: `this.form.get('name.first')` * * **Get the value**: the `value` property is always synced and available on the * {\@link FormGroup}. See a full list of available properties in {\@link AbstractControl}. * * **Set the value**: You can set an initial value for each child control when instantiating * the {\@link FormGroup}, or you can set it programmatically later using * {\@link AbstractControl#setValue setValue} or {\@link AbstractControl#patchValue patchValue}. * * **Listen to value**: If you want to listen to changes in the value of the group, you can * subscribe to the {\@link AbstractControl#valueChanges valueChanges} event. You can also listen to * {\@link AbstractControl#statusChanges statusChanges} to be notified when the validation status is * re-calculated. * * ### Example * * {\@example forms/ts/nestedFormGroup/nested_form_group_example.ts region='Component'} * * * **npm package**: `\@angular/forms` * * * **NgModule**: `ReactiveFormsModule` * * \@stable */ class FormGroupName extends AbstractFormGroupDirective { /** * @param {?} parent * @param {?} validators * @param {?} asyncValidators */ constructor(parent, validators, asyncValidators) { super(); this._parent = parent; this._validators = validators; this._asyncValidators = asyncValidators; } /** * \@internal * @return {?} */ _checkParentType() { if (_hasInvalidParent(this._parent)) { ReactiveErrors.groupParentException(); } } } FormGroupName.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: '[formGroupName]', providers: [formGroupNameProvider] },] }, ]; /** @nocollapse */ FormGroupName.ctorParameters = () => [ { type: ControlContainer, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Optional"] }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Host"] }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["SkipSelf"] },] }, { type: Array, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Optional"] }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Self"] }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Inject"], args: [NG_VALIDATORS,] },] }, { type: Array, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Optional"] }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Self"] }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Inject"], args: [NG_ASYNC_VALIDATORS,] },] }, ]; FormGroupName.propDecorators = { "name": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"], args: ['formGroupName',] },], }; const formArrayNameProvider = { provide: ControlContainer, useExisting: Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["forwardRef"])(() => FormArrayName) }; /** * \@whatItDoes Syncs a nested {\@link FormArray} to a DOM element. * * \@howToUse * * This directive is designed to be used with a parent {\@link FormGroupDirective} (selector: * `[formGroup]`). * * It accepts the string name of the nested {\@link FormArray} you want to link, and * will look for a {\@link FormArray} registered with that name in the parent * {\@link FormGroup} instance you passed into {\@link FormGroupDirective}. * * Nested form arrays can come in handy when you have a group of form controls but * you're not sure how many there will be. Form arrays allow you to create new * form controls dynamically. * * **Access the array**: You can access the associated {\@link FormArray} using the * {\@link AbstractControl#get get} method on the parent {\@link FormGroup}. * Ex: `this.form.get('cities')`. * * **Get the value**: the `value` property is always synced and available on the * {\@link FormArray}. See a full list of available properties in {\@link AbstractControl}. * * **Set the value**: You can set an initial value for each child control when instantiating * the {\@link FormArray}, or you can set the value programmatically later using the * {\@link FormArray}'s {\@link AbstractControl#setValue setValue} or * {\@link AbstractControl#patchValue patchValue} methods. * * **Listen to value**: If you want to listen to changes in the value of the array, you can * subscribe to the {\@link FormArray}'s {\@link AbstractControl#valueChanges valueChanges} event. * You can also listen to its {\@link AbstractControl#statusChanges statusChanges} event to be * notified when the validation status is re-calculated. * * **Add new controls**: You can add new controls to the {\@link FormArray} dynamically by calling * its {\@link FormArray#push push} method. * Ex: `this.form.get('cities').push(new FormControl());` * * ### Example * * {\@example forms/ts/nestedFormArray/nested_form_array_example.ts region='Component'} * * * **npm package**: `\@angular/forms` * * * **NgModule**: `ReactiveFormsModule` * * \@stable */ class FormArrayName extends ControlContainer { /** * @param {?} parent * @param {?} validators * @param {?} asyncValidators */ constructor(parent, validators, asyncValidators) { super(); this._parent = parent; this._validators = validators; this._asyncValidators = asyncValidators; } /** * @return {?} */ ngOnInit() { this._checkParentType(); /** @type {?} */ ((this.formDirective)).addFormArray(this); } /** * @return {?} */ ngOnDestroy() { if (this.formDirective) { this.formDirective.removeFormArray(this); } } /** * @return {?} */ get control() { return /** @type {?} */ ((this.formDirective)).getFormArray(this); } /** * @return {?} */ get formDirective() { return this._parent ? /** @type {?} */ (this._parent.formDirective) : null; } /** * @return {?} */ get path() { return controlPath(this.name, this._parent); } /** * @return {?} */ get validator() { return composeValidators(this._validators); } /** * @return {?} */ get asyncValidator() { return composeAsyncValidators(this._asyncValidators); } /** * @return {?} */ _checkParentType() { if (_hasInvalidParent(this._parent)) { ReactiveErrors.arrayParentException(); } } } FormArrayName.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: '[formArrayName]', providers: [formArrayNameProvider] },] }, ]; /** @nocollapse */ FormArrayName.ctorParameters = () => [ { type: ControlContainer, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Optional"] }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Host"] }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["SkipSelf"] },] }, { type: Array, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Optional"] }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Self"] }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Inject"], args: [NG_VALIDATORS,] },] }, { type: Array, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Optional"] }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Self"] }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Inject"], args: [NG_ASYNC_VALIDATORS,] },] }, ]; FormArrayName.propDecorators = { "name": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"], args: ['formArrayName',] },], }; /** * @param {?} parent * @return {?} */ function _hasInvalidParent(parent) { return !(parent instanceof FormGroupName) && !(parent instanceof FormGroupDirective) && !(parent instanceof FormArrayName); } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ const controlNameBinding = { provide: NgControl, useExisting: Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["forwardRef"])(() => FormControlName) }; /** * \@whatItDoes Syncs a {\@link FormControl} in an existing {\@link FormGroup} to a form control * element by name. * * In other words, this directive ensures that any values written to the {\@link FormControl} * instance programmatically will be written to the DOM element (model -> view). Conversely, * any values written to the DOM element through user input will be reflected in the * {\@link FormControl} instance (view -> model). * * \@howToUse * * This directive is designed to be used with a parent {\@link FormGroupDirective} (selector: * `[formGroup]`). * * It accepts the string name of the {\@link FormControl} instance you want to * link, and will look for a {\@link FormControl} registered with that name in the * closest {\@link FormGroup} or {\@link FormArray} above it. * * **Access the control**: You can access the {\@link FormControl} associated with * this directive by using the {\@link AbstractControl#get get} method. * Ex: `this.form.get('first');` * * **Get value**: the `value` property is always synced and available on the {\@link FormControl}. * See a full list of available properties in {\@link AbstractControl}. * * **Set value**: You can set an initial value for the control when instantiating the * {\@link FormControl}, or you can set it programmatically later using * {\@link AbstractControl#setValue setValue} or {\@link AbstractControl#patchValue patchValue}. * * **Listen to value**: If you want to listen to changes in the value of the control, you can * subscribe to the {\@link AbstractControl#valueChanges valueChanges} event. You can also listen to * {\@link AbstractControl#statusChanges statusChanges} to be notified when the validation status is * re-calculated. * * ### Example * * In this example, we create form controls for first name and last name. * * {\@example forms/ts/simpleFormGroup/simple_form_group_example.ts region='Component'} * * To see `formControlName` examples with different form control types, see: * * * Radio buttons: {\@link RadioControlValueAccessor} * * Selects: {\@link SelectControlValueAccessor} * * **npm package**: `\@angular/forms` * * **NgModule**: {\@link ReactiveFormsModule} * * \@stable */ class FormControlName extends NgControl { /** * @param {?} parent * @param {?} validators * @param {?} asyncValidators * @param {?} valueAccessors */ constructor(parent, validators, asyncValidators, valueAccessors) { super(); this._added = false; this.update = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); this._parent = parent; this._rawValidators = validators || []; this._rawAsyncValidators = asyncValidators || []; this.valueAccessor = selectValueAccessor(this, valueAccessors); } /** * @param {?} isDisabled * @return {?} */ set isDisabled(isDisabled) { ReactiveErrors.disabledAttrWarning(); } /** * @param {?} changes * @return {?} */ ngOnChanges(changes) { if (!this._added) this._setUpControl(); if (isPropertyUpdated(changes, this.viewModel)) { this.viewModel = this.model; this.formDirective.updateModel(this, this.model); } } /** * @return {?} */ ngOnDestroy() { if (this.formDirective) { this.formDirective.removeControl(this); } } /** * @param {?} newValue * @return {?} */ viewToModelUpdate(newValue) { this.viewModel = newValue; this.update.emit(newValue); } /** * @return {?} */ get path() { return controlPath(this.name, /** @type {?} */ ((this._parent))); } /** * @return {?} */ get formDirective() { return this._parent ? this._parent.formDirective : null; } /** * @return {?} */ get validator() { return composeValidators(this._rawValidators); } /** * @return {?} */ get asyncValidator() { return /** @type {?} */ ((composeAsyncValidators(this._rawAsyncValidators))); } /** * @return {?} */ _checkParentType() { if (!(this._parent instanceof FormGroupName) && this._parent instanceof AbstractFormGroupDirective) { ReactiveErrors.ngModelGroupException(); } else if (!(this._parent instanceof FormGroupName) && !(this._parent instanceof FormGroupDirective) && !(this._parent instanceof FormArrayName)) { ReactiveErrors.controlParentException(); } } /** * @return {?} */ _setUpControl() { this._checkParentType(); (/** @type {?} */ (this)).control = this.formDirective.addControl(this); if (this.control.disabled && /** @type {?} */ ((this.valueAccessor)).setDisabledState) { /** @type {?} */ ((/** @type {?} */ ((this.valueAccessor)).setDisabledState))(true); } this._added = true; } } FormControlName.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: '[formControlName]', providers: [controlNameBinding] },] }, ]; /** @nocollapse */ FormControlName.ctorParameters = () => [ { type: ControlContainer, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Optional"] }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Host"] }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["SkipSelf"] },] }, { type: Array, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Optional"] }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Self"] }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Inject"], args: [NG_VALIDATORS,] },] }, { type: Array, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Optional"] }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Self"] }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Inject"], args: [NG_ASYNC_VALIDATORS,] },] }, { type: Array, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Optional"] }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Self"] }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Inject"], args: [NG_VALUE_ACCESSOR,] },] }, ]; FormControlName.propDecorators = { "name": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"], args: ['formControlName',] },], "model": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"], args: ['ngModel',] },], "update": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"], args: ['ngModelChange',] },], "isDisabled": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"], args: ['disabled',] },], }; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * An interface that can be implemented by classes that can act as validators. * * ## Usage * * ```typescript * \@Directive({ * selector: '[custom-validator]', * providers: [{provide: NG_VALIDATORS, useExisting: CustomValidatorDirective, multi: true}] * }) * class CustomValidatorDirective implements Validator { * validate(c: Control): {[key: string]: any} { * return {"custom": true}; * } * } * ``` * * \@stable * @record */ /** * \@experimental * @record */ const REQUIRED_VALIDATOR = { provide: NG_VALIDATORS, useExisting: Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["forwardRef"])(() => RequiredValidator), multi: true }; const CHECKBOX_REQUIRED_VALIDATOR = { provide: NG_VALIDATORS, useExisting: Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["forwardRef"])(() => CheckboxRequiredValidator), multi: true }; /** * A Directive that adds the `required` validator to any controls marked with the * `required` attribute, via the {\@link NG_VALIDATORS} binding. * * ### Example * * ``` * <input name="fullName" ngModel required> * ``` * * \@stable */ class RequiredValidator { /** * @return {?} */ get required() { return this._required; } /** * @param {?} value * @return {?} */ set required(value) { this._required = value != null && value !== false && `${value}` !== 'false'; if (this._onChange) this._onChange(); } /** * @param {?} c * @return {?} */ validate(c) { return this.required ? Validators.required(c) : null; } /** * @param {?} fn * @return {?} */ registerOnValidatorChange(fn) { this._onChange = fn; } } RequiredValidator.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: ':not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]', providers: [REQUIRED_VALIDATOR], host: { '[attr.required]': 'required ? "" : null' } },] }, ]; /** @nocollapse */ RequiredValidator.ctorParameters = () => []; RequiredValidator.propDecorators = { "required": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], }; /** * A Directive that adds the `required` validator to checkbox controls marked with the * `required` attribute, via the {\@link NG_VALIDATORS} binding. * * ### Example * * ``` * <input type="checkbox" name="active" ngModel required> * ``` * * \@experimental */ class CheckboxRequiredValidator extends RequiredValidator { /** * @param {?} c * @return {?} */ validate(c) { return this.required ? Validators.requiredTrue(c) : null; } } CheckboxRequiredValidator.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: 'input[type=checkbox][required][formControlName],input[type=checkbox][required][formControl],input[type=checkbox][required][ngModel]', providers: [CHECKBOX_REQUIRED_VALIDATOR], host: { '[attr.required]': 'required ? "" : null' } },] }, ]; /** @nocollapse */ CheckboxRequiredValidator.ctorParameters = () => []; /** * Provider which adds {\@link EmailValidator} to {\@link NG_VALIDATORS}. */ const EMAIL_VALIDATOR = { provide: NG_VALIDATORS, useExisting: Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["forwardRef"])(() => EmailValidator), multi: true }; /** * A Directive that adds the `email` validator to controls marked with the * `email` attribute, via the {\@link NG_VALIDATORS} binding. * * ### Example * * ``` * <input type="email" name="email" ngModel email> * <input type="email" name="email" ngModel email="true"> * <input type="email" name="email" ngModel [email]="true"> * ``` * * \@experimental */ class EmailValidator { /** * @param {?} value * @return {?} */ set email(value) { this._enabled = value === '' || value === true || value === 'true'; if (this._onChange) this._onChange(); } /** * @param {?} c * @return {?} */ validate(c) { return this._enabled ? Validators.email(c) : null; } /** * @param {?} fn * @return {?} */ registerOnValidatorChange(fn) { this._onChange = fn; } } EmailValidator.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: '[email][formControlName],[email][formControl],[email][ngModel]', providers: [EMAIL_VALIDATOR] },] }, ]; /** @nocollapse */ EmailValidator.ctorParameters = () => []; EmailValidator.propDecorators = { "email": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], }; /** * \@stable * @record */ /** * \@stable * @record */ /** * Provider which adds {\@link MinLengthValidator} to {\@link NG_VALIDATORS}. * * ## Example: * * {\@example common/forms/ts/validators/validators.ts region='min'} */ const MIN_LENGTH_VALIDATOR = { provide: NG_VALIDATORS, useExisting: Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["forwardRef"])(() => MinLengthValidator), multi: true }; /** * A directive which installs the {\@link MinLengthValidator} for any `formControlName`, * `formControl`, or control with `ngModel` that also has a `minlength` attribute. * * \@stable */ class MinLengthValidator { /** * @param {?} changes * @return {?} */ ngOnChanges(changes) { if ('minlength' in changes) { this._createValidator(); if (this._onChange) this._onChange(); } } /** * @param {?} c * @return {?} */ validate(c) { return this.minlength == null ? null : this._validator(c); } /** * @param {?} fn * @return {?} */ registerOnValidatorChange(fn) { this._onChange = fn; } /** * @return {?} */ _createValidator() { this._validator = Validators.minLength(parseInt(this.minlength, 10)); } } MinLengthValidator.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: '[minlength][formControlName],[minlength][formControl],[minlength][ngModel]', providers: [MIN_LENGTH_VALIDATOR], host: { '[attr.minlength]': 'minlength ? minlength : null' } },] }, ]; /** @nocollapse */ MinLengthValidator.ctorParameters = () => []; MinLengthValidator.propDecorators = { "minlength": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], }; /** * Provider which adds {\@link MaxLengthValidator} to {\@link NG_VALIDATORS}. * * ## Example: * * {\@example common/forms/ts/validators/validators.ts region='max'} */ const MAX_LENGTH_VALIDATOR = { provide: NG_VALIDATORS, useExisting: Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["forwardRef"])(() => MaxLengthValidator), multi: true }; /** * A directive which installs the {\@link MaxLengthValidator} for any `formControlName, * `formControl`, * or control with `ngModel` that also has a `maxlength` attribute. * * \@stable */ class MaxLengthValidator { /** * @param {?} changes * @return {?} */ ngOnChanges(changes) { if ('maxlength' in changes) { this._createValidator(); if (this._onChange) this._onChange(); } } /** * @param {?} c * @return {?} */ validate(c) { return this.maxlength != null ? this._validator(c) : null; } /** * @param {?} fn * @return {?} */ registerOnValidatorChange(fn) { this._onChange = fn; } /** * @return {?} */ _createValidator() { this._validator = Validators.maxLength(parseInt(this.maxlength, 10)); } } MaxLengthValidator.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: '[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]', providers: [MAX_LENGTH_VALIDATOR], host: { '[attr.maxlength]': 'maxlength ? maxlength : null' } },] }, ]; /** @nocollapse */ MaxLengthValidator.ctorParameters = () => []; MaxLengthValidator.propDecorators = { "maxlength": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], }; const PATTERN_VALIDATOR = { provide: NG_VALIDATORS, useExisting: Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["forwardRef"])(() => PatternValidator), multi: true }; /** * A Directive that adds the `pattern` validator to any controls marked with the * `pattern` attribute, via the {\@link NG_VALIDATORS} binding. Uses attribute value * as the regex to validate Control value against. Follows pattern attribute * semantics; i.e. regex must match entire Control value. * * ### Example * * ``` * <input [name]="fullName" pattern="[a-zA-Z ]*" ngModel> * ``` * \@stable */ class PatternValidator { /** * @param {?} changes * @return {?} */ ngOnChanges(changes) { if ('pattern' in changes) { this._createValidator(); if (this._onChange) this._onChange(); } } /** * @param {?} c * @return {?} */ validate(c) { return this._validator(c); } /** * @param {?} fn * @return {?} */ registerOnValidatorChange(fn) { this._onChange = fn; } /** * @return {?} */ _createValidator() { this._validator = Validators.pattern(this.pattern); } } PatternValidator.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: '[pattern][formControlName],[pattern][formControl],[pattern][ngModel]', providers: [PATTERN_VALIDATOR], host: { '[attr.pattern]': 'pattern ? pattern : null' } },] }, ]; /** @nocollapse */ PatternValidator.ctorParameters = () => []; PatternValidator.propDecorators = { "pattern": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], }; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * \@whatItDoes Creates an {\@link AbstractControl} from a user-specified configuration. * * It is essentially syntactic sugar that shortens the `new FormGroup()`, * `new FormControl()`, and `new FormArray()` boilerplate that can build up in larger * forms. * * \@howToUse * * To use, inject `FormBuilder` into your component class. You can then call its methods * directly. * * {\@example forms/ts/formBuilder/form_builder_example.ts region='Component'} * * * **npm package**: `\@angular/forms` * * * **NgModule**: {\@link ReactiveFormsModule} * * \@stable */ class FormBuilder { /** * Construct a new {\@link FormGroup} with the given map of configuration. * Valid keys for the `extra` parameter map are `validator` and `asyncValidator`. * * See the {\@link FormGroup} constructor for more details. * @param {?} controlsConfig * @param {?=} extra * @return {?} */ group(controlsConfig, extra = null) { const /** @type {?} */ controls = this._reduceControls(controlsConfig); const /** @type {?} */ validator = extra != null ? extra['validator'] : null; const /** @type {?} */ asyncValidator = extra != null ? extra['asyncValidator'] : null; return new FormGroup(controls, validator, asyncValidator); } /** * Construct a new {\@link FormControl} with the given `formState`,`validator`, and * `asyncValidator`. * * `formState` can either be a standalone value for the form control or an object * that contains both a value and a disabled status. * * @param {?} formState * @param {?=} validator * @param {?=} asyncValidator * @return {?} */ control(formState, validator, asyncValidator) { return new FormControl(formState, validator, asyncValidator); } /** * Construct a {\@link FormArray} from the given `controlsConfig` array of * configuration, with the given optional `validator` and `asyncValidator`. * @param {?} controlsConfig * @param {?=} validator * @param {?=} asyncValidator * @return {?} */ array(controlsConfig, validator, asyncValidator) { const /** @type {?} */ controls = controlsConfig.map(c => this._createControl(c)); return new FormArray(controls, validator, asyncValidator); } /** * \@internal * @param {?} controlsConfig * @return {?} */ _reduceControls(controlsConfig) { const /** @type {?} */ controls = {}; Object.keys(controlsConfig).forEach(controlName => { controls[controlName] = this._createControl(controlsConfig[controlName]); }); return controls; } /** * \@internal * @param {?} controlConfig * @return {?} */ _createControl(controlConfig) { if (controlConfig instanceof FormControl || controlConfig instanceof FormGroup || controlConfig instanceof FormArray) { return controlConfig; } else if (Array.isArray(controlConfig)) { const /** @type {?} */ value = controlConfig[0]; const /** @type {?} */ validator = controlConfig.length > 1 ? controlConfig[1] : null; const /** @type {?} */ asyncValidator = controlConfig.length > 2 ? controlConfig[2] : null; return this.control(value, validator, asyncValidator); } else { return this.control(controlConfig); } } } FormBuilder.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Injectable"] }, ]; /** @nocollapse */ FormBuilder.ctorParameters = () => []; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * \@stable */ const VERSION = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["Version"]('5.2.10'); /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * \@whatItDoes Adds `novalidate` attribute to all forms by default. * * `novalidate` is used to disable browser's native form validation. * * If you want to use native validation with Angular forms, just add `ngNativeValidate` attribute: * * ``` * <form ngNativeValidate></form> * ``` * * \@experimental */ class NgNoValidate { } NgNoValidate.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: 'form:not([ngNoForm]):not([ngNativeValidate])', host: { 'novalidate': '' }, },] }, ]; /** @nocollapse */ NgNoValidate.ctorParameters = () => []; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ const SHARED_FORM_DIRECTIVES = [ NgNoValidate, NgSelectOption, NgSelectMultipleOption, DefaultValueAccessor, NumberValueAccessor, RangeValueAccessor, CheckboxControlValueAccessor, SelectControlValueAccessor, SelectMultipleControlValueAccessor, RadioControlValueAccessor, NgControlStatus, NgControlStatusGroup, RequiredValidator, MinLengthValidator, MaxLengthValidator, PatternValidator, CheckboxRequiredValidator, EmailValidator, ]; const TEMPLATE_DRIVEN_DIRECTIVES = [NgModel, NgModelGroup, NgForm]; const REACTIVE_DRIVEN_DIRECTIVES = [FormControlDirective, FormGroupDirective, FormControlName, FormGroupName, FormArrayName]; /** * Internal module used for sharing directives between FormsModule and ReactiveFormsModule */ class InternalFormsSharedModule { } InternalFormsSharedModule.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["NgModule"], args: [{ declarations: SHARED_FORM_DIRECTIVES, exports: SHARED_FORM_DIRECTIVES, },] }, ]; /** @nocollapse */ InternalFormsSharedModule.ctorParameters = () => []; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * The ng module for forms. * \@stable */ class FormsModule { } FormsModule.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["NgModule"], args: [{ declarations: TEMPLATE_DRIVEN_DIRECTIVES, providers: [RadioControlRegistry], exports: [InternalFormsSharedModule, TEMPLATE_DRIVEN_DIRECTIVES] },] }, ]; /** @nocollapse */ FormsModule.ctorParameters = () => []; /** * The ng module for reactive forms. * \@stable */ class ReactiveFormsModule { } ReactiveFormsModule.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["NgModule"], args: [{ declarations: [REACTIVE_DRIVEN_DIRECTIVES], providers: [FormBuilder, RadioControlRegistry], exports: [InternalFormsSharedModule, REACTIVE_DRIVEN_DIRECTIVES] },] }, ]; /** @nocollapse */ ReactiveFormsModule.ctorParameters = () => []; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @module * @description * Entry point for all public APIs of this package. */ // This file only reexports content of the `src` folder. Keep it that way. /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * Generated bundle index. Do not edit. */ //# sourceMappingURL=forms.js.map /***/ }), /***/ "./node_modules/@angular/platform-browser-dynamic/esm2015/platform-browser-dynamic.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export VERSION */ /* unused harmony export JitCompilerFactory */ /* unused harmony export RESOURCE_CACHE_PROVIDER */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return platformBrowserDynamic; }); /* unused harmony export ɵCompilerImpl */ /* unused harmony export ɵplatformCoreDynamic */ /* unused harmony export ɵINTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS */ /* unused harmony export ɵResourceLoaderImpl */ /* unused harmony export ɵa */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_compiler__ = __webpack_require__("./node_modules/@angular/compiler/esm2015/compiler.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_core__ = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__angular_common__ = __webpack_require__("./node_modules/@angular/common/esm2015/common.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__angular_platform_browser__ = __webpack_require__("./node_modules/@angular/platform-browser/esm2015/platform-browser.js"); /** * @license Angular v5.2.10 * (c) 2010-2018 Google, Inc. https://angular.io/ * License: MIT */ /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ const MODULE_SUFFIX = ''; const builtinExternalReferences = createBuiltinExternalReferencesMap(); class JitReflector { constructor() { this.builtinExternalReferences = new Map(); this.reflectionCapabilities = new __WEBPACK_IMPORTED_MODULE_1__angular_core__["ɵReflectionCapabilities"](); } /** * @param {?} type * @param {?} cmpMetadata * @return {?} */ componentModuleUrl(type, cmpMetadata) { const /** @type {?} */ moduleId = cmpMetadata.moduleId; if (typeof moduleId === 'string') { const /** @type {?} */ scheme = Object(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["z" /* getUrlScheme */])(moduleId); return scheme ? moduleId : `package:${moduleId}${MODULE_SUFFIX}`; } else if (moduleId !== null && moduleId !== void 0) { throw Object(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["A" /* syntaxError */])(`moduleId should be a string in "${Object(__WEBPACK_IMPORTED_MODULE_1__angular_core__["ɵstringify"])(type)}". See https://goo.gl/wIDDiL for more information.\n` + `If you're using Webpack you should inline the template and the styles, see https://goo.gl/X2J8zc.`); } return `./${Object(__WEBPACK_IMPORTED_MODULE_1__angular_core__["ɵstringify"])(type)}`; } /** * @param {?} typeOrFunc * @return {?} */ parameters(typeOrFunc) { return this.reflectionCapabilities.parameters(typeOrFunc); } /** * @param {?} typeOrFunc * @return {?} */ annotations(typeOrFunc) { return this.reflectionCapabilities.annotations(typeOrFunc); } /** * @param {?} typeOrFunc * @return {?} */ propMetadata(typeOrFunc) { return this.reflectionCapabilities.propMetadata(typeOrFunc); } /** * @param {?} type * @param {?} lcProperty * @return {?} */ hasLifecycleHook(type, lcProperty) { return this.reflectionCapabilities.hasLifecycleHook(type, lcProperty); } /** * @param {?} type * @return {?} */ guards(type) { return this.reflectionCapabilities.guards(type); } /** * @param {?} ref * @return {?} */ resolveExternalReference(ref) { return builtinExternalReferences.get(ref) || ref.runtime; } } /** * @return {?} */ function createBuiltinExternalReferencesMap() { const /** @type {?} */ map = new Map(); map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].ANALYZE_FOR_ENTRY_COMPONENTS, __WEBPACK_IMPORTED_MODULE_1__angular_core__["ANALYZE_FOR_ENTRY_COMPONENTS"]); map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].ElementRef, __WEBPACK_IMPORTED_MODULE_1__angular_core__["ElementRef"]); map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].NgModuleRef, __WEBPACK_IMPORTED_MODULE_1__angular_core__["NgModuleRef"]); map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].ViewContainerRef, __WEBPACK_IMPORTED_MODULE_1__angular_core__["ViewContainerRef"]); map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].ChangeDetectorRef, __WEBPACK_IMPORTED_MODULE_1__angular_core__["ChangeDetectorRef"]); map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].QueryList, __WEBPACK_IMPORTED_MODULE_1__angular_core__["QueryList"]); map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].TemplateRef, __WEBPACK_IMPORTED_MODULE_1__angular_core__["TemplateRef"]); map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].CodegenComponentFactoryResolver, __WEBPACK_IMPORTED_MODULE_1__angular_core__["ɵCodegenComponentFactoryResolver"]); map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].ComponentFactoryResolver, __WEBPACK_IMPORTED_MODULE_1__angular_core__["ComponentFactoryResolver"]); map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].ComponentFactory, __WEBPACK_IMPORTED_MODULE_1__angular_core__["ComponentFactory"]); map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].ComponentRef, __WEBPACK_IMPORTED_MODULE_1__angular_core__["ComponentRef"]); map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].NgModuleFactory, __WEBPACK_IMPORTED_MODULE_1__angular_core__["NgModuleFactory"]); map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].createModuleFactory, __WEBPACK_IMPORTED_MODULE_1__angular_core__["ɵcmf"]); map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].moduleDef, __WEBPACK_IMPORTED_MODULE_1__angular_core__["ɵmod"]); map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].moduleProviderDef, __WEBPACK_IMPORTED_MODULE_1__angular_core__["ɵmpd"]); map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].RegisterModuleFactoryFn, __WEBPACK_IMPORTED_MODULE_1__angular_core__["ɵregisterModuleFactory"]); map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].Injector, __WEBPACK_IMPORTED_MODULE_1__angular_core__["Injector"]); map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].ViewEncapsulation, __WEBPACK_IMPORTED_MODULE_1__angular_core__["ViewEncapsulation"]); map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].ChangeDetectionStrategy, __WEBPACK_IMPORTED_MODULE_1__angular_core__["ChangeDetectionStrategy"]); map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].SecurityContext, __WEBPACK_IMPORTED_MODULE_1__angular_core__["SecurityContext"]); map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].LOCALE_ID, __WEBPACK_IMPORTED_MODULE_1__angular_core__["LOCALE_ID"]); map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].TRANSLATIONS_FORMAT, __WEBPACK_IMPORTED_MODULE_1__angular_core__["TRANSLATIONS_FORMAT"]); map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].inlineInterpolate, __WEBPACK_IMPORTED_MODULE_1__angular_core__["ɵinlineInterpolate"]); map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].interpolate, __WEBPACK_IMPORTED_MODULE_1__angular_core__["ɵinterpolate"]); map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].EMPTY_ARRAY, __WEBPACK_IMPORTED_MODULE_1__angular_core__["ɵEMPTY_ARRAY"]); map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].EMPTY_MAP, __WEBPACK_IMPORTED_MODULE_1__angular_core__["ɵEMPTY_MAP"]); map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].Renderer, __WEBPACK_IMPORTED_MODULE_1__angular_core__["Renderer"]); map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].viewDef, __WEBPACK_IMPORTED_MODULE_1__angular_core__["ɵvid"]); map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].elementDef, __WEBPACK_IMPORTED_MODULE_1__angular_core__["ɵeld"]); map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].anchorDef, __WEBPACK_IMPORTED_MODULE_1__angular_core__["ɵand"]); map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].textDef, __WEBPACK_IMPORTED_MODULE_1__angular_core__["ɵted"]); map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].directiveDef, __WEBPACK_IMPORTED_MODULE_1__angular_core__["ɵdid"]); map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].providerDef, __WEBPACK_IMPORTED_MODULE_1__angular_core__["ɵprd"]); map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].queryDef, __WEBPACK_IMPORTED_MODULE_1__angular_core__["ɵqud"]); map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].pureArrayDef, __WEBPACK_IMPORTED_MODULE_1__angular_core__["ɵpad"]); map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].pureObjectDef, __WEBPACK_IMPORTED_MODULE_1__angular_core__["ɵpod"]); map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].purePipeDef, __WEBPACK_IMPORTED_MODULE_1__angular_core__["ɵppd"]); map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].pipeDef, __WEBPACK_IMPORTED_MODULE_1__angular_core__["ɵpid"]); map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].nodeValue, __WEBPACK_IMPORTED_MODULE_1__angular_core__["ɵnov"]); map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].ngContentDef, __WEBPACK_IMPORTED_MODULE_1__angular_core__["ɵncd"]); map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].unwrapValue, __WEBPACK_IMPORTED_MODULE_1__angular_core__["ɵunv"]); map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].createRendererType2, __WEBPACK_IMPORTED_MODULE_1__angular_core__["ɵcrt"]); map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].createComponentFactory, __WEBPACK_IMPORTED_MODULE_1__angular_core__["ɵccf"]); return map; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ const ERROR_COLLECTOR_TOKEN = new __WEBPACK_IMPORTED_MODULE_1__angular_core__["InjectionToken"]('ErrorCollector'); /** * A default provider for {\@link PACKAGE_ROOT_URL} that maps to '/'. */ const DEFAULT_PACKAGE_URL_PROVIDER = { provide: __WEBPACK_IMPORTED_MODULE_1__angular_core__["PACKAGE_ROOT_URL"], useValue: '/' }; const _NO_RESOURCE_LOADER = { /** * @param {?} url * @return {?} */ get(url) { throw new Error(`No ResourceLoader implementation has been provided. Can't read the url "${url}"`); } }; const baseHtmlParser = new __WEBPACK_IMPORTED_MODULE_1__angular_core__["InjectionToken"]('HtmlParser'); class CompilerImpl { /** * @param {?} injector * @param {?} _metadataResolver * @param {?} templateParser * @param {?} styleCompiler * @param {?} viewCompiler * @param {?} ngModuleCompiler * @param {?} summaryResolver * @param {?} compileReflector * @param {?} compilerConfig * @param {?} console */ constructor(injector, _metadataResolver, templateParser, styleCompiler, viewCompiler, ngModuleCompiler, summaryResolver, compileReflector, compilerConfig, console) { this._metadataResolver = _metadataResolver; this._delegate = new __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["k" /* JitCompiler */](_metadataResolver, templateParser, styleCompiler, viewCompiler, ngModuleCompiler, summaryResolver, compileReflector, compilerConfig, console, this.getExtraNgModuleProviders.bind(this)); this.injector = injector; } /** * @return {?} */ getExtraNgModuleProviders() { return [this._metadataResolver.getProviderMetadata(new __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["r" /* ProviderMeta */](__WEBPACK_IMPORTED_MODULE_1__angular_core__["Compiler"], { useValue: this }))]; } /** * @template T * @param {?} moduleType * @return {?} */ compileModuleSync(moduleType) { return /** @type {?} */ (this._delegate.compileModuleSync(moduleType)); } /** * @template T * @param {?} moduleType * @return {?} */ compileModuleAsync(moduleType) { return /** @type {?} */ (this._delegate.compileModuleAsync(moduleType)); } /** * @template T * @param {?} moduleType * @return {?} */ compileModuleAndAllComponentsSync(moduleType) { const /** @type {?} */ result = this._delegate.compileModuleAndAllComponentsSync(moduleType); return { ngModuleFactory: /** @type {?} */ (result.ngModuleFactory), componentFactories: /** @type {?} */ (result.componentFactories), }; } /** * @template T * @param {?} moduleType * @return {?} */ compileModuleAndAllComponentsAsync(moduleType) { return this._delegate.compileModuleAndAllComponentsAsync(moduleType) .then((result) => ({ ngModuleFactory: /** @type {?} */ (result.ngModuleFactory), componentFactories: /** @type {?} */ (result.componentFactories), })); } /** * @param {?} summaries * @return {?} */ loadAotSummaries(summaries) { this._delegate.loadAotSummaries(summaries); } /** * @param {?} ref * @return {?} */ hasAotSummary(ref) { return this._delegate.hasAotSummary(ref); } /** * @template T * @param {?} component * @return {?} */ getComponentFactory(component) { return /** @type {?} */ (this._delegate.getComponentFactory(component)); } /** * @return {?} */ clearCache() { this._delegate.clearCache(); } /** * @param {?} type * @return {?} */ clearCacheFor(type) { this._delegate.clearCacheFor(type); } } /** * A set of providers that provide `JitCompiler` and its dependencies to use for * template compilation. */ const COMPILER_PROVIDERS = /** @type {?} */ ([ { provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["b" /* CompileReflector */], useValue: new JitReflector() }, { provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["s" /* ResourceLoader */], useValue: _NO_RESOURCE_LOADER }, { provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["l" /* JitSummaryResolver */], deps: [] }, { provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["v" /* SummaryResolver */], useExisting: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["l" /* JitSummaryResolver */] }, { provide: __WEBPACK_IMPORTED_MODULE_1__angular_core__["ɵConsole"], deps: [] }, { provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["m" /* Lexer */], deps: [] }, { provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["p" /* Parser */], deps: [__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["m" /* Lexer */]] }, { provide: baseHtmlParser, useClass: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["h" /* HtmlParser */], deps: [], }, { provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["i" /* I18NHtmlParser */], useFactory: (parser, translations, format, config, console) => { translations = translations || ''; const /** @type {?} */ missingTranslation = translations ? /** @type {?} */ ((config.missingTranslation)) : __WEBPACK_IMPORTED_MODULE_1__angular_core__["MissingTranslationStrategy"].Ignore; return new __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["i" /* I18NHtmlParser */](parser, translations, format, missingTranslation, console); }, deps: [ baseHtmlParser, [new __WEBPACK_IMPORTED_MODULE_1__angular_core__["Optional"](), new __WEBPACK_IMPORTED_MODULE_1__angular_core__["Inject"](__WEBPACK_IMPORTED_MODULE_1__angular_core__["TRANSLATIONS"])], [new __WEBPACK_IMPORTED_MODULE_1__angular_core__["Optional"](), new __WEBPACK_IMPORTED_MODULE_1__angular_core__["Inject"](__WEBPACK_IMPORTED_MODULE_1__angular_core__["TRANSLATIONS_FORMAT"])], [__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["c" /* CompilerConfig */]], [__WEBPACK_IMPORTED_MODULE_1__angular_core__["ɵConsole"]], ] }, { provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["h" /* HtmlParser */], useExisting: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["i" /* I18NHtmlParser */], }, { provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["w" /* TemplateParser */], deps: [__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["c" /* CompilerConfig */], __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["b" /* CompileReflector */], __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["p" /* Parser */], __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["g" /* ElementSchemaRegistry */], __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["i" /* I18NHtmlParser */], __WEBPACK_IMPORTED_MODULE_1__angular_core__["ɵConsole"]] }, { provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["d" /* DirectiveNormalizer */], deps: [__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["s" /* ResourceLoader */], __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["x" /* UrlResolver */], __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["h" /* HtmlParser */], __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["c" /* CompilerConfig */]] }, { provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["a" /* CompileMetadataResolver */], deps: [__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["c" /* CompilerConfig */], __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["h" /* HtmlParser */], __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["o" /* NgModuleResolver */], __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["e" /* DirectiveResolver */], __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["q" /* PipeResolver */], __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["v" /* SummaryResolver */], __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["g" /* ElementSchemaRegistry */], __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["d" /* DirectiveNormalizer */], __WEBPACK_IMPORTED_MODULE_1__angular_core__["ɵConsole"], [__WEBPACK_IMPORTED_MODULE_1__angular_core__["Optional"], __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["t" /* StaticSymbolCache */]], __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["b" /* CompileReflector */], [__WEBPACK_IMPORTED_MODULE_1__angular_core__["Optional"], ERROR_COLLECTOR_TOKEN]] }, DEFAULT_PACKAGE_URL_PROVIDER, { provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["u" /* StyleCompiler */], deps: [__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["x" /* UrlResolver */]] }, { provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["y" /* ViewCompiler */], deps: [__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["b" /* CompileReflector */]] }, { provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["n" /* NgModuleCompiler */], deps: [__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["b" /* CompileReflector */]] }, { provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["c" /* CompilerConfig */], useValue: new __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["c" /* CompilerConfig */]() }, { provide: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Compiler"], useClass: CompilerImpl, deps: [__WEBPACK_IMPORTED_MODULE_1__angular_core__["Injector"], __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["a" /* CompileMetadataResolver */], __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["w" /* TemplateParser */], __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["u" /* StyleCompiler */], __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["y" /* ViewCompiler */], __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["n" /* NgModuleCompiler */], __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["v" /* SummaryResolver */], __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["b" /* CompileReflector */], __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["c" /* CompilerConfig */], __WEBPACK_IMPORTED_MODULE_1__angular_core__["ɵConsole"]] }, { provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["f" /* DomElementSchemaRegistry */], deps: [] }, { provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["g" /* ElementSchemaRegistry */], useExisting: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["f" /* DomElementSchemaRegistry */] }, { provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["x" /* UrlResolver */], deps: [__WEBPACK_IMPORTED_MODULE_1__angular_core__["PACKAGE_ROOT_URL"]] }, { provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["e" /* DirectiveResolver */], deps: [__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["b" /* CompileReflector */]] }, { provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["q" /* PipeResolver */], deps: [__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["b" /* CompileReflector */]] }, { provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["o" /* NgModuleResolver */], deps: [__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["b" /* CompileReflector */]] }, ]); /** * \@experimental */ class JitCompilerFactory { /** * @param {?} defaultOptions */ constructor(defaultOptions) { const /** @type {?} */ compilerOptions = { useJit: true, defaultEncapsulation: __WEBPACK_IMPORTED_MODULE_1__angular_core__["ViewEncapsulation"].Emulated, missingTranslation: __WEBPACK_IMPORTED_MODULE_1__angular_core__["MissingTranslationStrategy"].Warning, enableLegacyTemplate: false, }; this._defaultOptions = [compilerOptions, ...defaultOptions]; } /** * @param {?=} options * @return {?} */ createCompiler(options = []) { const /** @type {?} */ opts = _mergeOptions(this._defaultOptions.concat(options)); const /** @type {?} */ injector = __WEBPACK_IMPORTED_MODULE_1__angular_core__["Injector"].create([ COMPILER_PROVIDERS, { provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["c" /* CompilerConfig */], useFactory: () => { return new __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["c" /* CompilerConfig */]({ // let explicit values from the compiler options overwrite options // from the app providers useJit: opts.useJit, jitDevMode: Object(__WEBPACK_IMPORTED_MODULE_1__angular_core__["isDevMode"])(), // let explicit values from the compiler options overwrite options // from the app providers defaultEncapsulation: opts.defaultEncapsulation, missingTranslation: opts.missingTranslation, enableLegacyTemplate: opts.enableLegacyTemplate, preserveWhitespaces: opts.preserveWhitespaces, }); }, deps: [] }, /** @type {?} */ ((opts.providers)) ]); return injector.get(__WEBPACK_IMPORTED_MODULE_1__angular_core__["Compiler"]); } } /** * @param {?} optionsArr * @return {?} */ function _mergeOptions(optionsArr) { return { useJit: _lastDefined(optionsArr.map(options => options.useJit)), defaultEncapsulation: _lastDefined(optionsArr.map(options => options.defaultEncapsulation)), providers: _mergeArrays(optionsArr.map(options => /** @type {?} */ ((options.providers)))), missingTranslation: _lastDefined(optionsArr.map(options => options.missingTranslation)), enableLegacyTemplate: _lastDefined(optionsArr.map(options => options.enableLegacyTemplate)), preserveWhitespaces: _lastDefined(optionsArr.map(options => options.preserveWhitespaces)), }; } /** * @template T * @param {?} args * @return {?} */ function _lastDefined(args) { for (let /** @type {?} */ i = args.length - 1; i >= 0; i--) { if (args[i] !== undefined) { return args[i]; } } return undefined; } /** * @param {?} parts * @return {?} */ function _mergeArrays(parts) { const /** @type {?} */ result = []; parts.forEach((part) => part && result.push(...part)); return result; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * A platform that included corePlatform and the compiler. * * \@experimental */ const platformCoreDynamic = Object(__WEBPACK_IMPORTED_MODULE_1__angular_core__["createPlatformFactory"])(__WEBPACK_IMPORTED_MODULE_1__angular_core__["platformCore"], 'coreDynamic', [ { provide: __WEBPACK_IMPORTED_MODULE_1__angular_core__["COMPILER_OPTIONS"], useValue: {}, multi: true }, { provide: __WEBPACK_IMPORTED_MODULE_1__angular_core__["CompilerFactory"], useClass: JitCompilerFactory, deps: [__WEBPACK_IMPORTED_MODULE_1__angular_core__["COMPILER_OPTIONS"]] }, ]); /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ class ResourceLoaderImpl extends __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["s" /* ResourceLoader */] { /** * @param {?} url * @return {?} */ get(url) { let /** @type {?} */ resolve; let /** @type {?} */ reject; const /** @type {?} */ promise = new Promise((res, rej) => { resolve = res; reject = rej; }); const /** @type {?} */ xhr = new XMLHttpRequest(); xhr.open('GET', url, true); xhr.responseType = 'text'; xhr.onload = function () { // responseText is the old-school way of retrieving response (supported by IE8 & 9) // response/responseType properties were introduced in ResourceLoader Level2 spec (supported // by IE10) const /** @type {?} */ response = xhr.response || xhr.responseText; // normalize IE9 bug (http://bugs.jquery.com/ticket/1450) let /** @type {?} */ status = xhr.status === 1223 ? 204 : xhr.status; // fix status code when it is 0 (0 status is undocumented). // Occurs when accessing file resources or on Android 4.1 stock browser // while retrieving files from application cache. if (status === 0) { status = response ? 200 : 0; } if (200 <= status && status <= 300) { resolve(response); } else { reject(`Failed to load ${url}`); } }; xhr.onerror = function () { reject(`Failed to load ${url}`); }; xhr.send(); return promise; } } ResourceLoaderImpl.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Injectable"] }, ]; /** @nocollapse */ ResourceLoaderImpl.ctorParameters = () => []; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ const INTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS = [ __WEBPACK_IMPORTED_MODULE_3__angular_platform_browser__["ɵINTERNAL_BROWSER_PLATFORM_PROVIDERS"], { provide: __WEBPACK_IMPORTED_MODULE_1__angular_core__["COMPILER_OPTIONS"], useValue: { providers: [{ provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["s" /* ResourceLoader */], useClass: ResourceLoaderImpl, deps: [] }] }, multi: true }, { provide: __WEBPACK_IMPORTED_MODULE_1__angular_core__["PLATFORM_ID"], useValue: __WEBPACK_IMPORTED_MODULE_2__angular_common__["ɵPLATFORM_BROWSER_ID"] }, ]; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * An implementation of ResourceLoader that uses a template cache to avoid doing an actual * ResourceLoader. * * The template cache needs to be built and loaded into window.$templateCache * via a separate mechanism. */ class CachedResourceLoader extends __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["s" /* ResourceLoader */] { constructor() { super(); this._cache = (/** @type {?} */ (__WEBPACK_IMPORTED_MODULE_1__angular_core__["ɵglobal"])).$templateCache; if (this._cache == null) { throw new Error('CachedResourceLoader: Template cache was not found in $templateCache.'); } } /** * @param {?} url * @return {?} */ get(url) { if (this._cache.hasOwnProperty(url)) { return Promise.resolve(this._cache[url]); } else { return /** @type {?} */ (Promise.reject('CachedResourceLoader: Did not find cached template for ' + url)); } } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * \@stable */ const VERSION = new __WEBPACK_IMPORTED_MODULE_1__angular_core__["Version"]('5.2.10'); /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * \@experimental */ const RESOURCE_CACHE_PROVIDER = [{ provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["s" /* ResourceLoader */], useClass: CachedResourceLoader, deps: [] }]; /** * \@stable */ const platformBrowserDynamic = Object(__WEBPACK_IMPORTED_MODULE_1__angular_core__["createPlatformFactory"])(platformCoreDynamic, 'browserDynamic', INTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS); /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @module * @description * Entry point for all public APIs of this package. */ // This file only reexports content of the `src` folder. Keep it that way. /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * Generated bundle index. Do not edit. */ //# sourceMappingURL=platform-browser-dynamic.js.map /***/ }), /***/ "./node_modules/@angular/platform-browser/esm2015/animations.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return BrowserAnimationsModule; }); /* unused harmony export NoopAnimationsModule */ /* unused harmony export ɵBrowserAnimationBuilder */ /* unused harmony export ɵBrowserAnimationFactory */ /* unused harmony export ɵAnimationRenderer */ /* unused harmony export ɵAnimationRendererFactory */ /* unused harmony export ɵa */ /* unused harmony export ɵf */ /* unused harmony export ɵg */ /* unused harmony export ɵb */ /* unused harmony export ɵd */ /* unused harmony export ɵe */ /* unused harmony export ɵc */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_platform_browser__ = __webpack_require__("./node_modules/@angular/platform-browser/esm2015/platform-browser.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__angular_animations__ = __webpack_require__("./node_modules/@angular/animations/esm2015/animations.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__angular_animations_browser__ = __webpack_require__("./node_modules/@angular/animations/esm2015/browser.js"); /** * @license Angular v5.2.10 * (c) 2010-2018 Google, Inc. https://angular.io/ * License: MIT */ /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ class BrowserAnimationBuilder extends __WEBPACK_IMPORTED_MODULE_2__angular_animations__["AnimationBuilder"] { /** * @param {?} rootRenderer * @param {?} doc */ constructor(rootRenderer, doc) { super(); this._nextAnimationId = 0; const /** @type {?} */ typeData = /** @type {?} */ ({ id: '0', encapsulation: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ViewEncapsulation"].None, styles: [], data: { animation: [] } }); this._renderer = /** @type {?} */ (rootRenderer.createRenderer(doc.body, typeData)); } /** * @param {?} animation * @return {?} */ build(animation) { const /** @type {?} */ id = this._nextAnimationId.toString(); this._nextAnimationId++; const /** @type {?} */ entry = Array.isArray(animation) ? Object(__WEBPACK_IMPORTED_MODULE_2__angular_animations__["sequence"])(animation) : animation; issueAnimationCommand(this._renderer, null, id, 'register', [entry]); return new BrowserAnimationFactory(id, this._renderer); } } BrowserAnimationBuilder.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Injectable"] }, ]; /** @nocollapse */ BrowserAnimationBuilder.ctorParameters = () => [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["RendererFactory2"], }, { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Inject"], args: [__WEBPACK_IMPORTED_MODULE_1__angular_platform_browser__["DOCUMENT"],] },] }, ]; class BrowserAnimationFactory extends __WEBPACK_IMPORTED_MODULE_2__angular_animations__["AnimationFactory"] { /** * @param {?} _id * @param {?} _renderer */ constructor(_id, _renderer) { super(); this._id = _id; this._renderer = _renderer; } /** * @param {?} element * @param {?=} options * @return {?} */ create(element, options) { return new RendererAnimationPlayer(this._id, element, options || {}, this._renderer); } } class RendererAnimationPlayer { /** * @param {?} id * @param {?} element * @param {?} options * @param {?} _renderer */ constructor(id, element, options, _renderer) { this.id = id; this.element = element; this._renderer = _renderer; this.parentPlayer = null; this._started = false; this.totalTime = 0; this._command('create', options); } /** * @param {?} eventName * @param {?} callback * @return {?} */ _listen(eventName, callback) { return this._renderer.listen(this.element, `@@${this.id}:${eventName}`, callback); } /** * @param {?} command * @param {...?} args * @return {?} */ _command(command, ...args) { return issueAnimationCommand(this._renderer, this.element, this.id, command, args); } /** * @param {?} fn * @return {?} */ onDone(fn) { this._listen('done', fn); } /** * @param {?} fn * @return {?} */ onStart(fn) { this._listen('start', fn); } /** * @param {?} fn * @return {?} */ onDestroy(fn) { this._listen('destroy', fn); } /** * @return {?} */ init() { this._command('init'); } /** * @return {?} */ hasStarted() { return this._started; } /** * @return {?} */ play() { this._command('play'); this._started = true; } /** * @return {?} */ pause() { this._command('pause'); } /** * @return {?} */ restart() { this._command('restart'); } /** * @return {?} */ finish() { this._command('finish'); } /** * @return {?} */ destroy() { this._command('destroy'); } /** * @return {?} */ reset() { this._command('reset'); } /** * @param {?} p * @return {?} */ setPosition(p) { this._command('setPosition', p); } /** * @return {?} */ getPosition() { return 0; } } /** * @param {?} renderer * @param {?} element * @param {?} id * @param {?} command * @param {?} args * @return {?} */ function issueAnimationCommand(renderer, element, id, command, args) { return renderer.setProperty(element, `@@${id}:${command}`, args); } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ const ANIMATION_PREFIX = '@'; const DISABLE_ANIMATIONS_FLAG = '@.disabled'; class AnimationRendererFactory { /** * @param {?} delegate * @param {?} engine * @param {?} _zone */ constructor(delegate, engine, _zone) { this.delegate = delegate; this.engine = engine; this._zone = _zone; this._currentId = 0; this._microtaskId = 1; this._animationCallbacksBuffer = []; this._rendererCache = new Map(); this._cdRecurDepth = 0; this.promise = Promise.resolve(0); engine.onRemovalComplete = (element, delegate) => { // Note: if an component element has a leave animation, and the component // a host leave animation, the view engine will call `removeChild` for the parent // component renderer as well as for the child component renderer. // Therefore, we need to check if we already removed the element. if (delegate && delegate.parentNode(element)) { delegate.removeChild(element.parentNode, element); } }; } /** * @param {?} hostElement * @param {?} type * @return {?} */ createRenderer(hostElement, type) { const /** @type {?} */ EMPTY_NAMESPACE_ID = ''; // cache the delegates to find out which cached delegate can // be used by which cached renderer const /** @type {?} */ delegate = this.delegate.createRenderer(hostElement, type); if (!hostElement || !type || !type.data || !type.data['animation']) { let /** @type {?} */ renderer = this._rendererCache.get(delegate); if (!renderer) { renderer = new BaseAnimationRenderer(EMPTY_NAMESPACE_ID, delegate, this.engine); // only cache this result when the base renderer is used this._rendererCache.set(delegate, renderer); } return renderer; } const /** @type {?} */ componentId = type.id; const /** @type {?} */ namespaceId = type.id + '-' + this._currentId; this._currentId++; this.engine.register(namespaceId, hostElement); const /** @type {?} */ animationTriggers = /** @type {?} */ (type.data['animation']); animationTriggers.forEach(trigger => this.engine.registerTrigger(componentId, namespaceId, hostElement, trigger.name, trigger)); return new AnimationRenderer(this, namespaceId, delegate, this.engine); } /** * @return {?} */ begin() { this._cdRecurDepth++; if (this.delegate.begin) { this.delegate.begin(); } } /** * @return {?} */ _scheduleCountTask() { // always use promise to schedule microtask instead of use Zone this.promise.then(() => { this._microtaskId++; }); } /** * @param {?} count * @param {?} fn * @param {?} data * @return {?} */ scheduleListenerCallback(count, fn, data) { if (count >= 0 && count < this._microtaskId) { this._zone.run(() => fn(data)); return; } if (this._animationCallbacksBuffer.length == 0) { Promise.resolve(null).then(() => { this._zone.run(() => { this._animationCallbacksBuffer.forEach(tuple => { const [fn, data] = tuple; fn(data); }); this._animationCallbacksBuffer = []; }); }); } this._animationCallbacksBuffer.push([fn, data]); } /** * @return {?} */ end() { this._cdRecurDepth--; // this is to prevent animations from running twice when an inner // component does CD when a parent component insted has inserted it if (this._cdRecurDepth == 0) { this._zone.runOutsideAngular(() => { this._scheduleCountTask(); this.engine.flush(this._microtaskId); }); } if (this.delegate.end) { this.delegate.end(); } } /** * @return {?} */ whenRenderingDone() { return this.engine.whenRenderingDone(); } } AnimationRendererFactory.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Injectable"] }, ]; /** @nocollapse */ AnimationRendererFactory.ctorParameters = () => [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["RendererFactory2"], }, { type: __WEBPACK_IMPORTED_MODULE_3__angular_animations_browser__["b" /* ɵAnimationEngine */], }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["NgZone"], }, ]; class BaseAnimationRenderer { /** * @param {?} namespaceId * @param {?} delegate * @param {?} engine */ constructor(namespaceId, delegate, engine) { this.namespaceId = namespaceId; this.delegate = delegate; this.engine = engine; this.destroyNode = this.delegate.destroyNode ? (n) => /** @type {?} */ ((delegate.destroyNode))(n) : null; } /** * @return {?} */ get data() { return this.delegate.data; } /** * @return {?} */ destroy() { this.engine.destroy(this.namespaceId, this.delegate); this.delegate.destroy(); } /** * @param {?} name * @param {?=} namespace * @return {?} */ createElement(name, namespace) { return this.delegate.createElement(name, namespace); } /** * @param {?} value * @return {?} */ createComment(value) { return this.delegate.createComment(value); } /** * @param {?} value * @return {?} */ createText(value) { return this.delegate.createText(value); } /** * @param {?} parent * @param {?} newChild * @return {?} */ appendChild(parent, newChild) { this.delegate.appendChild(parent, newChild); this.engine.onInsert(this.namespaceId, newChild, parent, false); } /** * @param {?} parent * @param {?} newChild * @param {?} refChild * @return {?} */ insertBefore(parent, newChild, refChild) { this.delegate.insertBefore(parent, newChild, refChild); this.engine.onInsert(this.namespaceId, newChild, parent, true); } /** * @param {?} parent * @param {?} oldChild * @return {?} */ removeChild(parent, oldChild) { this.engine.onRemove(this.namespaceId, oldChild, this.delegate); } /** * @param {?} selectorOrNode * @return {?} */ selectRootElement(selectorOrNode) { return this.delegate.selectRootElement(selectorOrNode); } /** * @param {?} node * @return {?} */ parentNode(node) { return this.delegate.parentNode(node); } /** * @param {?} node * @return {?} */ nextSibling(node) { return this.delegate.nextSibling(node); } /** * @param {?} el * @param {?} name * @param {?} value * @param {?=} namespace * @return {?} */ setAttribute(el, name, value, namespace) { this.delegate.setAttribute(el, name, value, namespace); } /** * @param {?} el * @param {?} name * @param {?=} namespace * @return {?} */ removeAttribute(el, name, namespace) { this.delegate.removeAttribute(el, name, namespace); } /** * @param {?} el * @param {?} name * @return {?} */ addClass(el, name) { this.delegate.addClass(el, name); } /** * @param {?} el * @param {?} name * @return {?} */ removeClass(el, name) { this.delegate.removeClass(el, name); } /** * @param {?} el * @param {?} style * @param {?} value * @param {?=} flags * @return {?} */ setStyle(el, style, value, flags) { this.delegate.setStyle(el, style, value, flags); } /** * @param {?} el * @param {?} style * @param {?=} flags * @return {?} */ removeStyle(el, style, flags) { this.delegate.removeStyle(el, style, flags); } /** * @param {?} el * @param {?} name * @param {?} value * @return {?} */ setProperty(el, name, value) { if (name.charAt(0) == ANIMATION_PREFIX && name == DISABLE_ANIMATIONS_FLAG) { this.disableAnimations(el, !!value); } else { this.delegate.setProperty(el, name, value); } } /** * @param {?} node * @param {?} value * @return {?} */ setValue(node, value) { this.delegate.setValue(node, value); } /** * @param {?} target * @param {?} eventName * @param {?} callback * @return {?} */ listen(target, eventName, callback) { return this.delegate.listen(target, eventName, callback); } /** * @param {?} element * @param {?} value * @return {?} */ disableAnimations(element, value) { this.engine.disableAnimations(element, value); } } class AnimationRenderer extends BaseAnimationRenderer { /** * @param {?} factory * @param {?} namespaceId * @param {?} delegate * @param {?} engine */ constructor(factory, namespaceId, delegate, engine) { super(namespaceId, delegate, engine); this.factory = factory; this.namespaceId = namespaceId; } /** * @param {?} el * @param {?} name * @param {?} value * @return {?} */ setProperty(el, name, value) { if (name.charAt(0) == ANIMATION_PREFIX) { if (name.charAt(1) == '.' && name == DISABLE_ANIMATIONS_FLAG) { value = value === undefined ? true : !!value; this.disableAnimations(el, /** @type {?} */ (value)); } else { this.engine.process(this.namespaceId, el, name.substr(1), value); } } else { this.delegate.setProperty(el, name, value); } } /** * @param {?} target * @param {?} eventName * @param {?} callback * @return {?} */ listen(target, eventName, callback) { if (eventName.charAt(0) == ANIMATION_PREFIX) { const /** @type {?} */ element = resolveElementFromTarget(target); let /** @type {?} */ name = eventName.substr(1); let /** @type {?} */ phase = ''; // @listener.phase is for trigger animation callbacks // @@listener is for animation builder callbacks if (name.charAt(0) != ANIMATION_PREFIX) { [name, phase] = parseTriggerCallbackName(name); } return this.engine.listen(this.namespaceId, element, name, phase, event => { const /** @type {?} */ countId = (/** @type {?} */ (event))['_data'] || -1; this.factory.scheduleListenerCallback(countId, callback, event); }); } return this.delegate.listen(target, eventName, callback); } } /** * @param {?} target * @return {?} */ function resolveElementFromTarget(target) { switch (target) { case 'body': return document.body; case 'document': return document; case 'window': return window; default: return target; } } /** * @param {?} triggerName * @return {?} */ function parseTriggerCallbackName(triggerName) { const /** @type {?} */ dotIndex = triggerName.indexOf('.'); const /** @type {?} */ trigger = triggerName.substring(0, dotIndex); const /** @type {?} */ phase = triggerName.substr(dotIndex + 1); return [trigger, phase]; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ class InjectableAnimationEngine extends __WEBPACK_IMPORTED_MODULE_3__angular_animations_browser__["b" /* ɵAnimationEngine */] { /** * @param {?} driver * @param {?} normalizer */ constructor(driver, normalizer) { super(driver, normalizer); } } InjectableAnimationEngine.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Injectable"] }, ]; /** @nocollapse */ InjectableAnimationEngine.ctorParameters = () => [ { type: __WEBPACK_IMPORTED_MODULE_3__angular_animations_browser__["a" /* AnimationDriver */], }, { type: __WEBPACK_IMPORTED_MODULE_3__angular_animations_browser__["c" /* ɵAnimationStyleNormalizer */], }, ]; /** * @return {?} */ function instantiateSupportedAnimationDriver() { if (Object(__WEBPACK_IMPORTED_MODULE_3__angular_animations_browser__["g" /* ɵsupportsWebAnimations */])()) { return new __WEBPACK_IMPORTED_MODULE_3__angular_animations_browser__["e" /* ɵWebAnimationsDriver */](); } return new __WEBPACK_IMPORTED_MODULE_3__angular_animations_browser__["d" /* ɵNoopAnimationDriver */](); } /** * @return {?} */ function instantiateDefaultStyleNormalizer() { return new __WEBPACK_IMPORTED_MODULE_3__angular_animations_browser__["f" /* ɵWebAnimationsStyleNormalizer */](); } /** * @param {?} renderer * @param {?} engine * @param {?} zone * @return {?} */ function instantiateRendererFactory(renderer, engine, zone) { return new AnimationRendererFactory(renderer, engine, zone); } const SHARED_ANIMATION_PROVIDERS = [ { provide: __WEBPACK_IMPORTED_MODULE_2__angular_animations__["AnimationBuilder"], useClass: BrowserAnimationBuilder }, { provide: __WEBPACK_IMPORTED_MODULE_3__angular_animations_browser__["c" /* ɵAnimationStyleNormalizer */], useFactory: instantiateDefaultStyleNormalizer }, { provide: __WEBPACK_IMPORTED_MODULE_3__angular_animations_browser__["b" /* ɵAnimationEngine */], useClass: InjectableAnimationEngine }, { provide: __WEBPACK_IMPORTED_MODULE_0__angular_core__["RendererFactory2"], useFactory: instantiateRendererFactory, deps: [__WEBPACK_IMPORTED_MODULE_1__angular_platform_browser__["ɵDomRendererFactory2"], __WEBPACK_IMPORTED_MODULE_3__angular_animations_browser__["b" /* ɵAnimationEngine */], __WEBPACK_IMPORTED_MODULE_0__angular_core__["NgZone"]] } ]; /** * Separate providers from the actual module so that we can do a local modification in Google3 to * include them in the BrowserModule. */ const BROWSER_ANIMATIONS_PROVIDERS = [ { provide: __WEBPACK_IMPORTED_MODULE_3__angular_animations_browser__["a" /* AnimationDriver */], useFactory: instantiateSupportedAnimationDriver }, ...SHARED_ANIMATION_PROVIDERS ]; /** * Separate providers from the actual module so that we can do a local modification in Google3 to * include them in the BrowserTestingModule. */ const BROWSER_NOOP_ANIMATIONS_PROVIDERS = [{ provide: __WEBPACK_IMPORTED_MODULE_3__angular_animations_browser__["a" /* AnimationDriver */], useClass: __WEBPACK_IMPORTED_MODULE_3__angular_animations_browser__["d" /* ɵNoopAnimationDriver */] }, ...SHARED_ANIMATION_PROVIDERS]; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * \@experimental Animation support is experimental. */ class BrowserAnimationsModule { } BrowserAnimationsModule.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["NgModule"], args: [{ exports: [__WEBPACK_IMPORTED_MODULE_1__angular_platform_browser__["BrowserModule"]], providers: BROWSER_ANIMATIONS_PROVIDERS, },] }, ]; /** @nocollapse */ BrowserAnimationsModule.ctorParameters = () => []; /** * \@experimental Animation support is experimental. */ class NoopAnimationsModule { } NoopAnimationsModule.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["NgModule"], args: [{ exports: [__WEBPACK_IMPORTED_MODULE_1__angular_platform_browser__["BrowserModule"]], providers: BROWSER_NOOP_ANIMATIONS_PROVIDERS, },] }, ]; /** @nocollapse */ NoopAnimationsModule.ctorParameters = () => []; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @module * @description * Entry point for all public APIs of this package. */ /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * Generated bundle index. Do not edit. */ //# sourceMappingURL=animations.js.map /***/ }), /***/ "./node_modules/@angular/platform-browser/esm2015/platform-browser.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BrowserModule", function() { return BrowserModule; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "platformBrowser", function() { return platformBrowser; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Meta", function() { return Meta; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Title", function() { return Title; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "disableDebugTools", function() { return disableDebugTools; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "enableDebugTools", function() { return enableDebugTools; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BrowserTransferStateModule", function() { return BrowserTransferStateModule; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TransferState", function() { return TransferState; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "makeStateKey", function() { return makeStateKey; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "By", function() { return By; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DOCUMENT", function() { return DOCUMENT$1; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EVENT_MANAGER_PLUGINS", function() { return EVENT_MANAGER_PLUGINS; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EventManager", function() { return EventManager; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HAMMER_GESTURE_CONFIG", function() { return HAMMER_GESTURE_CONFIG; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HammerGestureConfig", function() { return HammerGestureConfig; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DomSanitizer", function() { return DomSanitizer; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "VERSION", function() { return VERSION; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵBROWSER_SANITIZATION_PROVIDERS", function() { return BROWSER_SANITIZATION_PROVIDERS; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵINTERNAL_BROWSER_PLATFORM_PROVIDERS", function() { return INTERNAL_BROWSER_PLATFORM_PROVIDERS; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵinitDomAdapter", function() { return initDomAdapter; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵBrowserDomAdapter", function() { return BrowserDomAdapter; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵBrowserPlatformLocation", function() { return BrowserPlatformLocation; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵTRANSITION_ID", function() { return TRANSITION_ID; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵBrowserGetTestability", function() { return BrowserGetTestability; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵescapeHtml", function() { return escapeHtml; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵELEMENT_PROBE_PROVIDERS", function() { return ELEMENT_PROBE_PROVIDERS; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵDomAdapter", function() { return DomAdapter; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵgetDOM", function() { return getDOM; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵsetRootDomAdapter", function() { return setRootDomAdapter; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵDomRendererFactory2", function() { return DomRendererFactory2; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵNAMESPACE_URIS", function() { return NAMESPACE_URIS; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵflattenStyles", function() { return flattenStyles; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵshimContentAttribute", function() { return shimContentAttribute; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵshimHostAttribute", function() { return shimHostAttribute; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵDomEventsPlugin", function() { return DomEventsPlugin; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵHammerGesturesPlugin", function() { return HammerGesturesPlugin; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵKeyEventsPlugin", function() { return KeyEventsPlugin; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵDomSharedStylesHost", function() { return DomSharedStylesHost; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵSharedStylesHost", function() { return SharedStylesHost; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵb", function() { return _document; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵa", function() { return errorHandler; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵi", function() { return GenericBrowserDomAdapter; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵg", function() { return SERVER_TRANSITION_PROVIDERS; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵf", function() { return appInitializerFactory; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵc", function() { return initTransferState; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵh", function() { return _createNgProbe; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵd", function() { return EventManagerPlugin; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵe", function() { return DomSanitizerImpl; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_common__ = __webpack_require__("./node_modules/@angular/common/esm2015/common.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_core__ = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); /** * @license Angular v5.2.10 * (c) 2010-2018 Google, Inc. https://angular.io/ * License: MIT */ /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ let _DOM = /** @type {?} */ ((null)); /** * @return {?} */ function getDOM() { return _DOM; } /** * @param {?} adapter * @return {?} */ /** * @param {?} adapter * @return {?} */ function setRootDomAdapter(adapter) { if (!_DOM) { _DOM = adapter; } } /** * Provides DOM operations in an environment-agnostic way. * * \@security Tread carefully! Interacting with the DOM directly is dangerous and * can introduce XSS risks. * @abstract */ class DomAdapter { constructor() { this.resourceLoaderType = /** @type {?} */ ((null)); } /** * Maps attribute names to their corresponding property names for cases * where attribute name doesn't match property name. * @return {?} */ get attrToPropMap() { return this._attrToPropMap; } /** * @param {?} value * @return {?} */ set attrToPropMap(value) { this._attrToPropMap = value; } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * Provides DOM operations in any browser environment. * * \@security Tread carefully! Interacting with the DOM directly is dangerous and * can introduce XSS risks. * @abstract */ class GenericBrowserDomAdapter extends DomAdapter { constructor() { super(); this._animationPrefix = null; this._transitionEnd = null; try { const /** @type {?} */ element = this.createElement('div', document); if (this.getStyle(element, 'animationName') != null) { this._animationPrefix = ''; } else { const /** @type {?} */ domPrefixes = ['Webkit', 'Moz', 'O', 'ms']; for (let /** @type {?} */ i = 0; i < domPrefixes.length; i++) { if (this.getStyle(element, domPrefixes[i] + 'AnimationName') != null) { this._animationPrefix = '-' + domPrefixes[i].toLowerCase() + '-'; break; } } } const /** @type {?} */ transEndEventNames = { WebkitTransition: 'webkitTransitionEnd', MozTransition: 'transitionend', OTransition: 'oTransitionEnd otransitionend', transition: 'transitionend' }; Object.keys(transEndEventNames).forEach((key) => { if (this.getStyle(element, key) != null) { this._transitionEnd = transEndEventNames[key]; } }); } catch (/** @type {?} */ e) { this._animationPrefix = null; this._transitionEnd = null; } } /** * @param {?} el * @return {?} */ getDistributedNodes(el) { return (/** @type {?} */ (el)).getDistributedNodes(); } /** * @param {?} el * @param {?} baseUrl * @param {?} href * @return {?} */ resolveAndSetHref(el, baseUrl, href) { el.href = href == null ? baseUrl : baseUrl + '/../' + href; } /** * @return {?} */ supportsDOMEvents() { return true; } /** * @return {?} */ supportsNativeShadowDOM() { return typeof (/** @type {?} */ (document.body)).createShadowRoot === 'function'; } /** * @return {?} */ getAnimationPrefix() { return this._animationPrefix ? this._animationPrefix : ''; } /** * @return {?} */ getTransitionEnd() { return this._transitionEnd ? this._transitionEnd : ''; } /** * @return {?} */ supportsAnimation() { return this._animationPrefix != null && this._transitionEnd != null; } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ const _attrToPropMap = { 'class': 'className', 'innerHtml': 'innerHTML', 'readonly': 'readOnly', 'tabindex': 'tabIndex', }; const DOM_KEY_LOCATION_NUMPAD = 3; // Map to convert some key or keyIdentifier values to what will be returned by getEventKey const _keyMap = { // The following values are here for cross-browser compatibility and to match the W3C standard // cf http://www.w3.org/TR/DOM-Level-3-Events-key/ '\b': 'Backspace', '\t': 'Tab', '\x7F': 'Delete', '\x1B': 'Escape', 'Del': 'Delete', 'Esc': 'Escape', 'Left': 'ArrowLeft', 'Right': 'ArrowRight', 'Up': 'ArrowUp', 'Down': 'ArrowDown', 'Menu': 'ContextMenu', 'Scroll': 'ScrollLock', 'Win': 'OS' }; // There is a bug in Chrome for numeric keypad keys: // https://code.google.com/p/chromium/issues/detail?id=155654 // 1, 2, 3 ... are reported as A, B, C ... const _chromeNumKeyPadMap = { 'A': '1', 'B': '2', 'C': '3', 'D': '4', 'E': '5', 'F': '6', 'G': '7', 'H': '8', 'I': '9', 'J': '*', 'K': '+', 'M': '-', 'N': '.', 'O': '/', '\x60': '0', '\x90': 'NumLock' }; let nodeContains; if (__WEBPACK_IMPORTED_MODULE_1__angular_core__["ɵglobal"]['Node']) { nodeContains = __WEBPACK_IMPORTED_MODULE_1__angular_core__["ɵglobal"]['Node'].prototype.contains || function (node) { return !!(this.compareDocumentPosition(node) & 16); }; } /** * A `DomAdapter` powered by full browser DOM APIs. * * \@security Tread carefully! Interacting with the DOM directly is dangerous and * can introduce XSS risks. */ class BrowserDomAdapter extends GenericBrowserDomAdapter { /** * @param {?} templateHtml * @return {?} */ parse(templateHtml) { throw new Error('parse not implemented'); } /** * @return {?} */ static makeCurrent() { setRootDomAdapter(new BrowserDomAdapter()); } /** * @param {?} element * @param {?} name * @return {?} */ hasProperty(element, name) { return name in element; } /** * @param {?} el * @param {?} name * @param {?} value * @return {?} */ setProperty(el, name, value) { (/** @type {?} */ (el))[name] = value; } /** * @param {?} el * @param {?} name * @return {?} */ getProperty(el, name) { return (/** @type {?} */ (el))[name]; } /** * @param {?} el * @param {?} methodName * @param {?} args * @return {?} */ invoke(el, methodName, args) { (/** @type {?} */ (el))[methodName](...args); } /** * @param {?} error * @return {?} */ logError(error) { if (window.console) { if (console.error) { console.error(error); } else { console.log(error); } } } /** * @param {?} error * @return {?} */ log(error) { if (window.console) { window.console.log && window.console.log(error); } } /** * @param {?} error * @return {?} */ logGroup(error) { if (window.console) { window.console.group && window.console.group(error); } } /** * @return {?} */ logGroupEnd() { if (window.console) { window.console.groupEnd && window.console.groupEnd(); } } /** * @return {?} */ get attrToPropMap() { return _attrToPropMap; } /** * @param {?} nodeA * @param {?} nodeB * @return {?} */ contains(nodeA, nodeB) { return nodeContains.call(nodeA, nodeB); } /** * @param {?} el * @param {?} selector * @return {?} */ querySelector(el, selector) { return el.querySelector(selector); } /** * @param {?} el * @param {?} selector * @return {?} */ querySelectorAll(el, selector) { return el.querySelectorAll(selector); } /** * @param {?} el * @param {?} evt * @param {?} listener * @return {?} */ on(el, evt, listener) { el.addEventListener(evt, listener, false); } /** * @param {?} el * @param {?} evt * @param {?} listener * @return {?} */ onAndCancel(el, evt, listener) { el.addEventListener(evt, listener, false); // Needed to follow Dart's subscription semantic, until fix of // https://code.google.com/p/dart/issues/detail?id=17406 return () => { el.removeEventListener(evt, listener, false); }; } /** * @param {?} el * @param {?} evt * @return {?} */ dispatchEvent(el, evt) { el.dispatchEvent(evt); } /** * @param {?} eventType * @return {?} */ createMouseEvent(eventType) { const /** @type {?} */ evt = this.getDefaultDocument().createEvent('MouseEvent'); evt.initEvent(eventType, true, true); return evt; } /** * @param {?} eventType * @return {?} */ createEvent(eventType) { const /** @type {?} */ evt = this.getDefaultDocument().createEvent('Event'); evt.initEvent(eventType, true, true); return evt; } /** * @param {?} evt * @return {?} */ preventDefault(evt) { evt.preventDefault(); evt.returnValue = false; } /** * @param {?} evt * @return {?} */ isPrevented(evt) { return evt.defaultPrevented || evt.returnValue != null && !evt.returnValue; } /** * @param {?} el * @return {?} */ getInnerHTML(el) { return el.innerHTML; } /** * @param {?} el * @return {?} */ getTemplateContent(el) { return 'content' in el && this.isTemplateElement(el) ? (/** @type {?} */ (el)).content : null; } /** * @param {?} el * @return {?} */ getOuterHTML(el) { return el.outerHTML; } /** * @param {?} node * @return {?} */ nodeName(node) { return node.nodeName; } /** * @param {?} node * @return {?} */ nodeValue(node) { return node.nodeValue; } /** * @param {?} node * @return {?} */ type(node) { return node.type; } /** * @param {?} node * @return {?} */ content(node) { if (this.hasProperty(node, 'content')) { return (/** @type {?} */ (node)).content; } else { return node; } } /** * @param {?} el * @return {?} */ firstChild(el) { return el.firstChild; } /** * @param {?} el * @return {?} */ nextSibling(el) { return el.nextSibling; } /** * @param {?} el * @return {?} */ parentElement(el) { return el.parentNode; } /** * @param {?} el * @return {?} */ childNodes(el) { return el.childNodes; } /** * @param {?} el * @return {?} */ childNodesAsList(el) { const /** @type {?} */ childNodes = el.childNodes; const /** @type {?} */ res = new Array(childNodes.length); for (let /** @type {?} */ i = 0; i < childNodes.length; i++) { res[i] = childNodes[i]; } return res; } /** * @param {?} el * @return {?} */ clearNodes(el) { while (el.firstChild) { el.removeChild(el.firstChild); } } /** * @param {?} el * @param {?} node * @return {?} */ appendChild(el, node) { el.appendChild(node); } /** * @param {?} el * @param {?} node * @return {?} */ removeChild(el, node) { el.removeChild(node); } /** * @param {?} el * @param {?} newChild * @param {?} oldChild * @return {?} */ replaceChild(el, newChild, oldChild) { el.replaceChild(newChild, oldChild); } /** * @param {?} node * @return {?} */ remove(node) { if (node.parentNode) { node.parentNode.removeChild(node); } return node; } /** * @param {?} parent * @param {?} ref * @param {?} node * @return {?} */ insertBefore(parent, ref, node) { parent.insertBefore(node, ref); } /** * @param {?} parent * @param {?} ref * @param {?} nodes * @return {?} */ insertAllBefore(parent, ref, nodes) { nodes.forEach((n) => parent.insertBefore(n, ref)); } /** * @param {?} parent * @param {?} ref * @param {?} node * @return {?} */ insertAfter(parent, ref, node) { parent.insertBefore(node, ref.nextSibling); } /** * @param {?} el * @param {?} value * @return {?} */ setInnerHTML(el, value) { el.innerHTML = value; } /** * @param {?} el * @return {?} */ getText(el) { return el.textContent; } /** * @param {?} el * @param {?} value * @return {?} */ setText(el, value) { el.textContent = value; } /** * @param {?} el * @return {?} */ getValue(el) { return el.value; } /** * @param {?} el * @param {?} value * @return {?} */ setValue(el, value) { el.value = value; } /** * @param {?} el * @return {?} */ getChecked(el) { return el.checked; } /** * @param {?} el * @param {?} value * @return {?} */ setChecked(el, value) { el.checked = value; } /** * @param {?} text * @return {?} */ createComment(text) { return this.getDefaultDocument().createComment(text); } /** * @param {?} html * @return {?} */ createTemplate(html) { const /** @type {?} */ t = this.getDefaultDocument().createElement('template'); t.innerHTML = html; return t; } /** * @param {?} tagName * @param {?=} doc * @return {?} */ createElement(tagName, doc) { doc = doc || this.getDefaultDocument(); return doc.createElement(tagName); } /** * @param {?} ns * @param {?} tagName * @param {?=} doc * @return {?} */ createElementNS(ns, tagName, doc) { doc = doc || this.getDefaultDocument(); return doc.createElementNS(ns, tagName); } /** * @param {?} text * @param {?=} doc * @return {?} */ createTextNode(text, doc) { doc = doc || this.getDefaultDocument(); return doc.createTextNode(text); } /** * @param {?} attrName * @param {?} attrValue * @param {?=} doc * @return {?} */ createScriptTag(attrName, attrValue, doc) { doc = doc || this.getDefaultDocument(); const /** @type {?} */ el = /** @type {?} */ (doc.createElement('SCRIPT')); el.setAttribute(attrName, attrValue); return el; } /** * @param {?} css * @param {?=} doc * @return {?} */ createStyleElement(css, doc) { doc = doc || this.getDefaultDocument(); const /** @type {?} */ style = /** @type {?} */ (doc.createElement('style')); this.appendChild(style, this.createTextNode(css, doc)); return style; } /** * @param {?} el * @return {?} */ createShadowRoot(el) { return (/** @type {?} */ (el)).createShadowRoot(); } /** * @param {?} el * @return {?} */ getShadowRoot(el) { return (/** @type {?} */ (el)).shadowRoot; } /** * @param {?} el * @return {?} */ getHost(el) { return (/** @type {?} */ (el)).host; } /** * @param {?} node * @return {?} */ clone(node) { return node.cloneNode(true); } /** * @param {?} element * @param {?} name * @return {?} */ getElementsByClassName(element, name) { return element.getElementsByClassName(name); } /** * @param {?} element * @param {?} name * @return {?} */ getElementsByTagName(element, name) { return element.getElementsByTagName(name); } /** * @param {?} element * @return {?} */ classList(element) { return Array.prototype.slice.call(element.classList, 0); } /** * @param {?} element * @param {?} className * @return {?} */ addClass(element, className) { element.classList.add(className); } /** * @param {?} element * @param {?} className * @return {?} */ removeClass(element, className) { element.classList.remove(className); } /** * @param {?} element * @param {?} className * @return {?} */ hasClass(element, className) { return element.classList.contains(className); } /** * @param {?} element * @param {?} styleName * @param {?} styleValue * @return {?} */ setStyle(element, styleName, styleValue) { element.style[styleName] = styleValue; } /** * @param {?} element * @param {?} stylename * @return {?} */ removeStyle(element, stylename) { // IE requires '' instead of null // see https://github.com/angular/angular/issues/7916 element.style[stylename] = ''; } /** * @param {?} element * @param {?} stylename * @return {?} */ getStyle(element, stylename) { return element.style[stylename]; } /** * @param {?} element * @param {?} styleName * @param {?=} styleValue * @return {?} */ hasStyle(element, styleName, styleValue) { const /** @type {?} */ value = this.getStyle(element, styleName) || ''; return styleValue ? value == styleValue : value.length > 0; } /** * @param {?} element * @return {?} */ tagName(element) { return element.tagName; } /** * @param {?} element * @return {?} */ attributeMap(element) { const /** @type {?} */ res = new Map(); const /** @type {?} */ elAttrs = element.attributes; for (let /** @type {?} */ i = 0; i < elAttrs.length; i++) { const /** @type {?} */ attrib = elAttrs.item(i); res.set(attrib.name, attrib.value); } return res; } /** * @param {?} element * @param {?} attribute * @return {?} */ hasAttribute(element, attribute) { return element.hasAttribute(attribute); } /** * @param {?} element * @param {?} ns * @param {?} attribute * @return {?} */ hasAttributeNS(element, ns, attribute) { return element.hasAttributeNS(ns, attribute); } /** * @param {?} element * @param {?} attribute * @return {?} */ getAttribute(element, attribute) { return element.getAttribute(attribute); } /** * @param {?} element * @param {?} ns * @param {?} name * @return {?} */ getAttributeNS(element, ns, name) { return element.getAttributeNS(ns, name); } /** * @param {?} element * @param {?} name * @param {?} value * @return {?} */ setAttribute(element, name, value) { element.setAttribute(name, value); } /** * @param {?} element * @param {?} ns * @param {?} name * @param {?} value * @return {?} */ setAttributeNS(element, ns, name, value) { element.setAttributeNS(ns, name, value); } /** * @param {?} element * @param {?} attribute * @return {?} */ removeAttribute(element, attribute) { element.removeAttribute(attribute); } /** * @param {?} element * @param {?} ns * @param {?} name * @return {?} */ removeAttributeNS(element, ns, name) { element.removeAttributeNS(ns, name); } /** * @param {?} el * @return {?} */ templateAwareRoot(el) { return this.isTemplateElement(el) ? this.content(el) : el; } /** * @return {?} */ createHtmlDocument() { return document.implementation.createHTMLDocument('fakeTitle'); } /** * @return {?} */ getDefaultDocument() { return document; } /** * @param {?} el * @return {?} */ getBoundingClientRect(el) { try { return el.getBoundingClientRect(); } catch (/** @type {?} */ e) { return { top: 0, bottom: 0, left: 0, right: 0, width: 0, height: 0 }; } } /** * @param {?} doc * @return {?} */ getTitle(doc) { return doc.title; } /** * @param {?} doc * @param {?} newTitle * @return {?} */ setTitle(doc, newTitle) { doc.title = newTitle || ''; } /** * @param {?} n * @param {?} selector * @return {?} */ elementMatches(n, selector) { if (this.isElementNode(n)) { return n.matches && n.matches(selector) || n.msMatchesSelector && n.msMatchesSelector(selector) || n.webkitMatchesSelector && n.webkitMatchesSelector(selector); } return false; } /** * @param {?} el * @return {?} */ isTemplateElement(el) { return this.isElementNode(el) && el.nodeName === 'TEMPLATE'; } /** * @param {?} node * @return {?} */ isTextNode(node) { return node.nodeType === Node.TEXT_NODE; } /** * @param {?} node * @return {?} */ isCommentNode(node) { return node.nodeType === Node.COMMENT_NODE; } /** * @param {?} node * @return {?} */ isElementNode(node) { return node.nodeType === Node.ELEMENT_NODE; } /** * @param {?} node * @return {?} */ hasShadowRoot(node) { return node.shadowRoot != null && node instanceof HTMLElement; } /** * @param {?} node * @return {?} */ isShadowRoot(node) { return node instanceof DocumentFragment; } /** * @param {?} node * @return {?} */ importIntoDoc(node) { return document.importNode(this.templateAwareRoot(node), true); } /** * @param {?} node * @return {?} */ adoptNode(node) { return document.adoptNode(node); } /** * @param {?} el * @return {?} */ getHref(el) { return /** @type {?} */ ((el.getAttribute('href'))); } /** * @param {?} event * @return {?} */ getEventKey(event) { let /** @type {?} */ key = event.key; if (key == null) { key = event.keyIdentifier; // keyIdentifier is defined in the old draft of DOM Level 3 Events implemented by Chrome and // Safari cf // http://www.w3.org/TR/2007/WD-DOM-Level-3-Events-20071221/events.html#Events-KeyboardEvents-Interfaces if (key == null) { return 'Unidentified'; } if (key.startsWith('U+')) { key = String.fromCharCode(parseInt(key.substring(2), 16)); if (event.location === DOM_KEY_LOCATION_NUMPAD && _chromeNumKeyPadMap.hasOwnProperty(key)) { // There is a bug in Chrome for numeric keypad keys: // https://code.google.com/p/chromium/issues/detail?id=155654 // 1, 2, 3 ... are reported as A, B, C ... key = (/** @type {?} */ (_chromeNumKeyPadMap))[key]; } } } return _keyMap[key] || key; } /** * @param {?} doc * @param {?} target * @return {?} */ getGlobalEventTarget(doc, target) { if (target === 'window') { return window; } if (target === 'document') { return doc; } if (target === 'body') { return doc.body; } return null; } /** * @return {?} */ getHistory() { return window.history; } /** * @return {?} */ getLocation() { return window.location; } /** * @param {?} doc * @return {?} */ getBaseHref(doc) { const /** @type {?} */ href = getBaseElementHref(); return href == null ? null : relativePath(href); } /** * @return {?} */ resetBaseElement() { baseElement = null; } /** * @return {?} */ getUserAgent() { return window.navigator.userAgent; } /** * @param {?} element * @param {?} name * @param {?} value * @return {?} */ setData(element, name, value) { this.setAttribute(element, 'data-' + name, value); } /** * @param {?} element * @param {?} name * @return {?} */ getData(element, name) { return this.getAttribute(element, 'data-' + name); } /** * @param {?} element * @return {?} */ getComputedStyle(element) { return getComputedStyle(element); } /** * @return {?} */ supportsWebAnimation() { return typeof (/** @type {?} */ (Element)).prototype['animate'] === 'function'; } /** * @return {?} */ performanceNow() { // performance.now() is not available in all browsers, see // http://caniuse.com/#search=performance.now return window.performance && window.performance.now ? window.performance.now() : new Date().getTime(); } /** * @return {?} */ supportsCookies() { return true; } /** * @param {?} name * @return {?} */ getCookie(name) { return Object(__WEBPACK_IMPORTED_MODULE_0__angular_common__["ɵparseCookieValue"])(document.cookie, name); } /** * @param {?} name * @param {?} value * @return {?} */ setCookie(name, value) { // document.cookie is magical, assigning into it assigns/overrides one cookie value, but does // not clear other cookies. document.cookie = encodeURIComponent(name) + '=' + encodeURIComponent(value); } } let baseElement = null; /** * @return {?} */ function getBaseElementHref() { if (!baseElement) { baseElement = /** @type {?} */ ((document.querySelector('base'))); if (!baseElement) { return null; } } return baseElement.getAttribute('href'); } // based on urlUtils.js in AngularJS 1 let urlParsingNode; /** * @param {?} url * @return {?} */ function relativePath(url) { if (!urlParsingNode) { urlParsingNode = document.createElement('a'); } urlParsingNode.setAttribute('href', url); return (urlParsingNode.pathname.charAt(0) === '/') ? urlParsingNode.pathname : '/' + urlParsingNode.pathname; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * A DI Token representing the main rendering context. In a browser this is the DOM Document. * * Note: Document might not be available in the Application Context when Application and Rendering * Contexts are not the same (e.g. when running the application into a Web Worker). * * @deprecated import from `\@angular/common` instead. */ const DOCUMENT$1 = __WEBPACK_IMPORTED_MODULE_0__angular_common__["DOCUMENT"]; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @return {?} */ function supportsState() { return !!window.history.pushState; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * `PlatformLocation` encapsulates all of the direct calls to platform APIs. * This class should not be used directly by an application developer. Instead, use * {\@link Location}. */ class BrowserPlatformLocation extends __WEBPACK_IMPORTED_MODULE_0__angular_common__["PlatformLocation"] { /** * @param {?} _doc */ constructor(_doc) { super(); this._doc = _doc; this._init(); } /** * \@internal * @return {?} */ _init() { (/** @type {?} */ (this)).location = getDOM().getLocation(); this._history = getDOM().getHistory(); } /** * @return {?} */ getBaseHrefFromDOM() { return /** @type {?} */ ((getDOM().getBaseHref(this._doc))); } /** * @param {?} fn * @return {?} */ onPopState(fn) { getDOM().getGlobalEventTarget(this._doc, 'window').addEventListener('popstate', fn, false); } /** * @param {?} fn * @return {?} */ onHashChange(fn) { getDOM().getGlobalEventTarget(this._doc, 'window').addEventListener('hashchange', fn, false); } /** * @return {?} */ get pathname() { return this.location.pathname; } /** * @return {?} */ get search() { return this.location.search; } /** * @return {?} */ get hash() { return this.location.hash; } /** * @param {?} newPath * @return {?} */ set pathname(newPath) { this.location.pathname = newPath; } /** * @param {?} state * @param {?} title * @param {?} url * @return {?} */ pushState(state, title, url) { if (supportsState()) { this._history.pushState(state, title, url); } else { this.location.hash = url; } } /** * @param {?} state * @param {?} title * @param {?} url * @return {?} */ replaceState(state, title, url) { if (supportsState()) { this._history.replaceState(state, title, url); } else { this.location.hash = url; } } /** * @return {?} */ forward() { this._history.forward(); } /** * @return {?} */ back() { this._history.back(); } } BrowserPlatformLocation.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Injectable"] }, ]; /** @nocollapse */ BrowserPlatformLocation.ctorParameters = () => [ { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Inject"], args: [DOCUMENT$1,] },] }, ]; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * A service that can be used to get and add meta tags. * * \@experimental */ class Meta { /** * @param {?} _doc */ constructor(_doc) { this._doc = _doc; this._dom = getDOM(); } /** * @param {?} tag * @param {?=} forceCreation * @return {?} */ addTag(tag, forceCreation = false) { if (!tag) return null; return this._getOrCreateElement(tag, forceCreation); } /** * @param {?} tags * @param {?=} forceCreation * @return {?} */ addTags(tags, forceCreation = false) { if (!tags) return []; return tags.reduce((result, tag) => { if (tag) { result.push(this._getOrCreateElement(tag, forceCreation)); } return result; }, []); } /** * @param {?} attrSelector * @return {?} */ getTag(attrSelector) { if (!attrSelector) return null; return this._dom.querySelector(this._doc, `meta[${attrSelector}]`) || null; } /** * @param {?} attrSelector * @return {?} */ getTags(attrSelector) { if (!attrSelector) return []; const /** @type {?} */ list = this._dom.querySelectorAll(this._doc, `meta[${attrSelector}]`); return list ? [].slice.call(list) : []; } /** * @param {?} tag * @param {?=} selector * @return {?} */ updateTag(tag, selector) { if (!tag) return null; selector = selector || this._parseSelector(tag); const /** @type {?} */ meta = /** @type {?} */ ((this.getTag(selector))); if (meta) { return this._setMetaElementAttributes(tag, meta); } return this._getOrCreateElement(tag, true); } /** * @param {?} attrSelector * @return {?} */ removeTag(attrSelector) { this.removeTagElement(/** @type {?} */ ((this.getTag(attrSelector)))); } /** * @param {?} meta * @return {?} */ removeTagElement(meta) { if (meta) { this._dom.remove(meta); } } /** * @param {?} meta * @param {?=} forceCreation * @return {?} */ _getOrCreateElement(meta, forceCreation = false) { if (!forceCreation) { const /** @type {?} */ selector = this._parseSelector(meta); const /** @type {?} */ elem = /** @type {?} */ ((this.getTag(selector))); // It's allowed to have multiple elements with the same name so it's not enough to // just check that element with the same name already present on the page. We also need to // check if element has tag attributes if (elem && this._containsAttributes(meta, elem)) return elem; } const /** @type {?} */ element = /** @type {?} */ (this._dom.createElement('meta')); this._setMetaElementAttributes(meta, element); const /** @type {?} */ head = this._dom.getElementsByTagName(this._doc, 'head')[0]; this._dom.appendChild(head, element); return element; } /** * @param {?} tag * @param {?} el * @return {?} */ _setMetaElementAttributes(tag, el) { Object.keys(tag).forEach((prop) => this._dom.setAttribute(el, prop, tag[prop])); return el; } /** * @param {?} tag * @return {?} */ _parseSelector(tag) { const /** @type {?} */ attr = tag.name ? 'name' : 'property'; return `${attr}="${tag[attr]}"`; } /** * @param {?} tag * @param {?} elem * @return {?} */ _containsAttributes(tag, elem) { return Object.keys(tag).every((key) => this._dom.getAttribute(elem, key) === tag[key]); } } Meta.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Injectable"] }, ]; /** @nocollapse */ Meta.ctorParameters = () => [ { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Inject"], args: [DOCUMENT$1,] },] }, ]; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * An id that identifies a particular application being bootstrapped, that should * match across the client/server boundary. */ const TRANSITION_ID = new __WEBPACK_IMPORTED_MODULE_1__angular_core__["InjectionToken"]('TRANSITION_ID'); /** * @param {?} transitionId * @param {?} document * @param {?} injector * @return {?} */ function appInitializerFactory(transitionId, document, injector) { return () => { // Wait for all application initializers to be completed before removing the styles set by // the server. injector.get(__WEBPACK_IMPORTED_MODULE_1__angular_core__["ApplicationInitStatus"]).donePromise.then(() => { const /** @type {?} */ dom = getDOM(); const /** @type {?} */ styles = Array.prototype.slice.apply(dom.querySelectorAll(document, `style[ng-transition]`)); styles.filter(el => dom.getAttribute(el, 'ng-transition') === transitionId) .forEach(el => dom.remove(el)); }); }; } const SERVER_TRANSITION_PROVIDERS = [ { provide: __WEBPACK_IMPORTED_MODULE_1__angular_core__["APP_INITIALIZER"], useFactory: appInitializerFactory, deps: [TRANSITION_ID, DOCUMENT$1, __WEBPACK_IMPORTED_MODULE_1__angular_core__["Injector"]], multi: true }, ]; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ class BrowserGetTestability { /** * @return {?} */ static init() { Object(__WEBPACK_IMPORTED_MODULE_1__angular_core__["setTestabilityGetter"])(new BrowserGetTestability()); } /** * @param {?} registry * @return {?} */ addToWindow(registry) { __WEBPACK_IMPORTED_MODULE_1__angular_core__["ɵglobal"]['getAngularTestability'] = (elem, findInAncestors = true) => { const /** @type {?} */ testability = registry.findTestabilityInTree(elem, findInAncestors); if (testability == null) { throw new Error('Could not find testability for element.'); } return testability; }; __WEBPACK_IMPORTED_MODULE_1__angular_core__["ɵglobal"]['getAllAngularTestabilities'] = () => registry.getAllTestabilities(); __WEBPACK_IMPORTED_MODULE_1__angular_core__["ɵglobal"]['getAllAngularRootElements'] = () => registry.getAllRootElements(); const /** @type {?} */ whenAllStable = (callback /** TODO #9100 */) => { const /** @type {?} */ testabilities = __WEBPACK_IMPORTED_MODULE_1__angular_core__["ɵglobal"]['getAllAngularTestabilities'](); let /** @type {?} */ count = testabilities.length; let /** @type {?} */ didWork = false; const /** @type {?} */ decrement = function (didWork_ /** TODO #9100 */) { didWork = didWork || didWork_; count--; if (count == 0) { callback(didWork); } }; testabilities.forEach(function (testability /** TODO #9100 */) { testability.whenStable(decrement); }); }; if (!__WEBPACK_IMPORTED_MODULE_1__angular_core__["ɵglobal"]['frameworkStabilizers']) { __WEBPACK_IMPORTED_MODULE_1__angular_core__["ɵglobal"]['frameworkStabilizers'] = []; } __WEBPACK_IMPORTED_MODULE_1__angular_core__["ɵglobal"]['frameworkStabilizers'].push(whenAllStable); } /** * @param {?} registry * @param {?} elem * @param {?} findInAncestors * @return {?} */ findTestabilityInTree(registry, elem, findInAncestors) { if (elem == null) { return null; } const /** @type {?} */ t = registry.getTestability(elem); if (t != null) { return t; } else if (!findInAncestors) { return null; } if (getDOM().isShadowRoot(elem)) { return this.findTestabilityInTree(registry, getDOM().getHost(elem), true); } return this.findTestabilityInTree(registry, getDOM().parentElement(elem), true); } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * A service that can be used to get and set the title of a current HTML document. * * Since an Angular application can't be bootstrapped on the entire HTML document (`<html>` tag) * it is not possible to bind to the `text` property of the `HTMLTitleElement` elements * (representing the `<title>` tag). Instead, this service can be used to set and get the current * title value. * * \@experimental */ class Title { /** * @param {?} _doc */ constructor(_doc) { this._doc = _doc; } /** * Get the title of the current HTML document. * @return {?} */ getTitle() { return getDOM().getTitle(this._doc); } /** * Set the title of the current HTML document. * @param {?} newTitle * @return {?} */ setTitle(newTitle) { getDOM().setTitle(this._doc, newTitle); } } Title.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Injectable"] }, ]; /** @nocollapse */ Title.ctorParameters = () => [ { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Inject"], args: [DOCUMENT$1,] },] }, ]; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @param {?} input * @return {?} */ /** * @param {?} input * @return {?} */ /** * Exports the value under a given `name` in the global property `ng`. For example `ng.probe` if * `name` is `'probe'`. * @param {?} name Name under which it will be exported. Keep in mind this will be a property of the * global `ng` object. * @param {?} value The value to export. * @return {?} */ function exportNgVar(name, value) { if (typeof COMPILED === 'undefined' || !COMPILED) { // Note: we can't export `ng` when using closure enhanced optimization as: // - closure declares globals itself for minified names, which sometimes clobber our `ng` global // - we can't declare a closure extern as the namespace `ng` is already used within Google // for typings for angularJS (via `goog.provide('ng....')`). const /** @type {?} */ ng = __WEBPACK_IMPORTED_MODULE_1__angular_core__["ɵglobal"]['ng'] = (/** @type {?} */ (__WEBPACK_IMPORTED_MODULE_1__angular_core__["ɵglobal"]['ng'])) || {}; ng[name] = value; } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ const CORE_TOKENS = { 'ApplicationRef': __WEBPACK_IMPORTED_MODULE_1__angular_core__["ApplicationRef"], 'NgZone': __WEBPACK_IMPORTED_MODULE_1__angular_core__["NgZone"], }; const INSPECT_GLOBAL_NAME = 'probe'; const CORE_TOKENS_GLOBAL_NAME = 'coreTokens'; /** * Returns a {\@link DebugElement} for the given native DOM element, or * null if the given native element does not have an Angular view associated * with it. * @param {?} element * @return {?} */ function inspectNativeElement(element) { return Object(__WEBPACK_IMPORTED_MODULE_1__angular_core__["getDebugNode"])(element); } /** * @param {?} coreTokens * @return {?} */ function _createNgProbe(coreTokens) { exportNgVar(INSPECT_GLOBAL_NAME, inspectNativeElement); exportNgVar(CORE_TOKENS_GLOBAL_NAME, Object.assign({}, CORE_TOKENS, _ngProbeTokensToMap(coreTokens || []))); return () => inspectNativeElement; } /** * @param {?} tokens * @return {?} */ function _ngProbeTokensToMap(tokens) { return tokens.reduce((prev, t) => (prev[t.name] = t.token, prev), {}); } /** * Providers which support debugging Angular applications (e.g. via `ng.probe`). */ const ELEMENT_PROBE_PROVIDERS = [ { provide: __WEBPACK_IMPORTED_MODULE_1__angular_core__["APP_INITIALIZER"], useFactory: _createNgProbe, deps: [ [__WEBPACK_IMPORTED_MODULE_1__angular_core__["NgProbeToken"], new __WEBPACK_IMPORTED_MODULE_1__angular_core__["Optional"]()], ], multi: true, }, ]; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * \@stable */ const EVENT_MANAGER_PLUGINS = new __WEBPACK_IMPORTED_MODULE_1__angular_core__["InjectionToken"]('EventManagerPlugins'); /** * \@stable */ class EventManager { /** * @param {?} plugins * @param {?} _zone */ constructor(plugins, _zone) { this._zone = _zone; this._eventNameToPlugin = new Map(); plugins.forEach(p => p.manager = this); this._plugins = plugins.slice().reverse(); } /** * @param {?} element * @param {?} eventName * @param {?} handler * @return {?} */ addEventListener(element, eventName, handler) { const /** @type {?} */ plugin = this._findPluginFor(eventName); return plugin.addEventListener(element, eventName, handler); } /** * @param {?} target * @param {?} eventName * @param {?} handler * @return {?} */ addGlobalEventListener(target, eventName, handler) { const /** @type {?} */ plugin = this._findPluginFor(eventName); return plugin.addGlobalEventListener(target, eventName, handler); } /** * @return {?} */ getZone() { return this._zone; } /** * \@internal * @param {?} eventName * @return {?} */ _findPluginFor(eventName) { const /** @type {?} */ plugin = this._eventNameToPlugin.get(eventName); if (plugin) { return plugin; } const /** @type {?} */ plugins = this._plugins; for (let /** @type {?} */ i = 0; i < plugins.length; i++) { const /** @type {?} */ plugin = plugins[i]; if (plugin.supports(eventName)) { this._eventNameToPlugin.set(eventName, plugin); return plugin; } } throw new Error(`No event manager plugin found for event ${eventName}`); } } EventManager.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Injectable"] }, ]; /** @nocollapse */ EventManager.ctorParameters = () => [ { type: Array, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Inject"], args: [EVENT_MANAGER_PLUGINS,] },] }, { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["NgZone"], }, ]; /** * @abstract */ class EventManagerPlugin { /** * @param {?} _doc */ constructor(_doc) { this._doc = _doc; } /** * @param {?} element * @param {?} eventName * @param {?} handler * @return {?} */ addGlobalEventListener(element, eventName, handler) { const /** @type {?} */ target = getDOM().getGlobalEventTarget(this._doc, element); if (!target) { throw new Error(`Unsupported event target ${target} for event ${eventName}`); } return this.addEventListener(target, eventName, handler); } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ class SharedStylesHost { constructor() { /** * \@internal */ this._stylesSet = new Set(); } /** * @param {?} styles * @return {?} */ addStyles(styles) { const /** @type {?} */ additions = new Set(); styles.forEach(style => { if (!this._stylesSet.has(style)) { this._stylesSet.add(style); additions.add(style); } }); this.onStylesAdded(additions); } /** * @param {?} additions * @return {?} */ onStylesAdded(additions) { } /** * @return {?} */ getAllStyles() { return Array.from(this._stylesSet); } } SharedStylesHost.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Injectable"] }, ]; /** @nocollapse */ SharedStylesHost.ctorParameters = () => []; class DomSharedStylesHost extends SharedStylesHost { /** * @param {?} _doc */ constructor(_doc) { super(); this._doc = _doc; this._hostNodes = new Set(); this._styleNodes = new Set(); this._hostNodes.add(_doc.head); } /** * @param {?} styles * @param {?} host * @return {?} */ _addStylesToHost(styles, host) { styles.forEach((style) => { const /** @type {?} */ styleEl = this._doc.createElement('style'); styleEl.textContent = style; this._styleNodes.add(host.appendChild(styleEl)); }); } /** * @param {?} hostNode * @return {?} */ addHost(hostNode) { this._addStylesToHost(this._stylesSet, hostNode); this._hostNodes.add(hostNode); } /** * @param {?} hostNode * @return {?} */ removeHost(hostNode) { this._hostNodes.delete(hostNode); } /** * @param {?} additions * @return {?} */ onStylesAdded(additions) { this._hostNodes.forEach(hostNode => this._addStylesToHost(additions, hostNode)); } /** * @return {?} */ ngOnDestroy() { this._styleNodes.forEach(styleNode => getDOM().remove(styleNode)); } } DomSharedStylesHost.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Injectable"] }, ]; /** @nocollapse */ DomSharedStylesHost.ctorParameters = () => [ { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Inject"], args: [DOCUMENT$1,] },] }, ]; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ const NAMESPACE_URIS = { 'svg': 'http://www.w3.org/2000/svg', 'xhtml': 'http://www.w3.org/1999/xhtml', 'xlink': 'http://www.w3.org/1999/xlink', 'xml': 'http://www.w3.org/XML/1998/namespace', 'xmlns': 'http://www.w3.org/2000/xmlns/', }; const COMPONENT_REGEX = /%COMP%/g; const COMPONENT_VARIABLE = '%COMP%'; const HOST_ATTR = `_nghost-${COMPONENT_VARIABLE}`; const CONTENT_ATTR = `_ngcontent-${COMPONENT_VARIABLE}`; /** * @param {?} componentShortId * @return {?} */ function shimContentAttribute(componentShortId) { return CONTENT_ATTR.replace(COMPONENT_REGEX, componentShortId); } /** * @param {?} componentShortId * @return {?} */ function shimHostAttribute(componentShortId) { return HOST_ATTR.replace(COMPONENT_REGEX, componentShortId); } /** * @param {?} compId * @param {?} styles * @param {?} target * @return {?} */ function flattenStyles(compId, styles, target) { for (let /** @type {?} */ i = 0; i < styles.length; i++) { let /** @type {?} */ style = styles[i]; if (Array.isArray(style)) { flattenStyles(compId, style, target); } else { style = style.replace(COMPONENT_REGEX, compId); target.push(style); } } return target; } /** * @param {?} eventHandler * @return {?} */ function decoratePreventDefault(eventHandler) { return (event) => { const /** @type {?} */ allowDefaultBehavior = eventHandler(event); if (allowDefaultBehavior === false) { // TODO(tbosch): move preventDefault into event plugins... event.preventDefault(); event.returnValue = false; } }; } class DomRendererFactory2 { /** * @param {?} eventManager * @param {?} sharedStylesHost */ constructor(eventManager, sharedStylesHost) { this.eventManager = eventManager; this.sharedStylesHost = sharedStylesHost; this.rendererByCompId = new Map(); this.defaultRenderer = new DefaultDomRenderer2(eventManager); } /** * @param {?} element * @param {?} type * @return {?} */ createRenderer(element, type) { if (!element || !type) { return this.defaultRenderer; } switch (type.encapsulation) { case __WEBPACK_IMPORTED_MODULE_1__angular_core__["ViewEncapsulation"].Emulated: { let /** @type {?} */ renderer = this.rendererByCompId.get(type.id); if (!renderer) { renderer = new EmulatedEncapsulationDomRenderer2(this.eventManager, this.sharedStylesHost, type); this.rendererByCompId.set(type.id, renderer); } (/** @type {?} */ (renderer)).applyToHost(element); return renderer; } case __WEBPACK_IMPORTED_MODULE_1__angular_core__["ViewEncapsulation"].Native: return new ShadowDomRenderer(this.eventManager, this.sharedStylesHost, element, type); default: { if (!this.rendererByCompId.has(type.id)) { const /** @type {?} */ styles = flattenStyles(type.id, type.styles, []); this.sharedStylesHost.addStyles(styles); this.rendererByCompId.set(type.id, this.defaultRenderer); } return this.defaultRenderer; } } } /** * @return {?} */ begin() { } /** * @return {?} */ end() { } } DomRendererFactory2.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Injectable"] }, ]; /** @nocollapse */ DomRendererFactory2.ctorParameters = () => [ { type: EventManager, }, { type: DomSharedStylesHost, }, ]; class DefaultDomRenderer2 { /** * @param {?} eventManager */ constructor(eventManager) { this.eventManager = eventManager; this.data = Object.create(null); } /** * @return {?} */ destroy() { } /** * @param {?} name * @param {?=} namespace * @return {?} */ createElement(name, namespace) { if (namespace) { return document.createElementNS(NAMESPACE_URIS[namespace], name); } return document.createElement(name); } /** * @param {?} value * @return {?} */ createComment(value) { return document.createComment(value); } /** * @param {?} value * @return {?} */ createText(value) { return document.createTextNode(value); } /** * @param {?} parent * @param {?} newChild * @return {?} */ appendChild(parent, newChild) { parent.appendChild(newChild); } /** * @param {?} parent * @param {?} newChild * @param {?} refChild * @return {?} */ insertBefore(parent, newChild, refChild) { if (parent) { parent.insertBefore(newChild, refChild); } } /** * @param {?} parent * @param {?} oldChild * @return {?} */ removeChild(parent, oldChild) { if (parent) { parent.removeChild(oldChild); } } /** * @param {?} selectorOrNode * @return {?} */ selectRootElement(selectorOrNode) { let /** @type {?} */ el = typeof selectorOrNode === 'string' ? document.querySelector(selectorOrNode) : selectorOrNode; if (!el) { throw new Error(`The selector "${selectorOrNode}" did not match any elements`); } el.textContent = ''; return el; } /** * @param {?} node * @return {?} */ parentNode(node) { return node.parentNode; } /** * @param {?} node * @return {?} */ nextSibling(node) { return node.nextSibling; } /** * @param {?} el * @param {?} name * @param {?} value * @param {?=} namespace * @return {?} */ setAttribute(el, name, value, namespace) { if (namespace) { name = `${namespace}:${name}`; const /** @type {?} */ namespaceUri = NAMESPACE_URIS[namespace]; if (namespaceUri) { el.setAttributeNS(namespaceUri, name, value); } else { el.setAttribute(name, value); } } else { el.setAttribute(name, value); } } /** * @param {?} el * @param {?} name * @param {?=} namespace * @return {?} */ removeAttribute(el, name, namespace) { if (namespace) { const /** @type {?} */ namespaceUri = NAMESPACE_URIS[namespace]; if (namespaceUri) { el.removeAttributeNS(namespaceUri, name); } else { el.removeAttribute(`${namespace}:${name}`); } } else { el.removeAttribute(name); } } /** * @param {?} el * @param {?} name * @return {?} */ addClass(el, name) { el.classList.add(name); } /** * @param {?} el * @param {?} name * @return {?} */ removeClass(el, name) { el.classList.remove(name); } /** * @param {?} el * @param {?} style * @param {?} value * @param {?} flags * @return {?} */ setStyle(el, style, value, flags) { if (flags & __WEBPACK_IMPORTED_MODULE_1__angular_core__["RendererStyleFlags2"].DashCase) { el.style.setProperty(style, value, !!(flags & __WEBPACK_IMPORTED_MODULE_1__angular_core__["RendererStyleFlags2"].Important) ? 'important' : ''); } else { el.style[style] = value; } } /** * @param {?} el * @param {?} style * @param {?} flags * @return {?} */ removeStyle(el, style, flags) { if (flags & __WEBPACK_IMPORTED_MODULE_1__angular_core__["RendererStyleFlags2"].DashCase) { el.style.removeProperty(style); } else { // IE requires '' instead of null // see https://github.com/angular/angular/issues/7916 el.style[style] = ''; } } /** * @param {?} el * @param {?} name * @param {?} value * @return {?} */ setProperty(el, name, value) { checkNoSyntheticProp(name, 'property'); el[name] = value; } /** * @param {?} node * @param {?} value * @return {?} */ setValue(node, value) { node.nodeValue = value; } /** * @param {?} target * @param {?} event * @param {?} callback * @return {?} */ listen(target, event, callback) { checkNoSyntheticProp(event, 'listener'); if (typeof target === 'string') { return /** @type {?} */ (this.eventManager.addGlobalEventListener(target, event, decoratePreventDefault(callback))); } return /** @type {?} */ ((this.eventManager.addEventListener(target, event, decoratePreventDefault(callback)))); } } const AT_CHARCODE = '@'.charCodeAt(0); /** * @param {?} name * @param {?} nameKind * @return {?} */ function checkNoSyntheticProp(name, nameKind) { if (name.charCodeAt(0) === AT_CHARCODE) { throw new Error(`Found the synthetic ${nameKind} ${name}. Please include either "BrowserAnimationsModule" or "NoopAnimationsModule" in your application.`); } } class EmulatedEncapsulationDomRenderer2 extends DefaultDomRenderer2 { /** * @param {?} eventManager * @param {?} sharedStylesHost * @param {?} component */ constructor(eventManager, sharedStylesHost, component) { super(eventManager); this.component = component; const /** @type {?} */ styles = flattenStyles(component.id, component.styles, []); sharedStylesHost.addStyles(styles); this.contentAttr = shimContentAttribute(component.id); this.hostAttr = shimHostAttribute(component.id); } /** * @param {?} element * @return {?} */ applyToHost(element) { super.setAttribute(element, this.hostAttr, ''); } /** * @param {?} parent * @param {?} name * @return {?} */ createElement(parent, name) { const /** @type {?} */ el = super.createElement(parent, name); super.setAttribute(el, this.contentAttr, ''); return el; } } class ShadowDomRenderer extends DefaultDomRenderer2 { /** * @param {?} eventManager * @param {?} sharedStylesHost * @param {?} hostEl * @param {?} component */ constructor(eventManager, sharedStylesHost, hostEl, component) { super(eventManager); this.sharedStylesHost = sharedStylesHost; this.hostEl = hostEl; this.component = component; this.shadowRoot = (/** @type {?} */ (hostEl)).createShadowRoot(); this.sharedStylesHost.addHost(this.shadowRoot); const /** @type {?} */ styles = flattenStyles(component.id, component.styles, []); for (let /** @type {?} */ i = 0; i < styles.length; i++) { const /** @type {?} */ styleEl = document.createElement('style'); styleEl.textContent = styles[i]; this.shadowRoot.appendChild(styleEl); } } /** * @param {?} node * @return {?} */ nodeOrShadowRoot(node) { return node === this.hostEl ? this.shadowRoot : node; } /** * @return {?} */ destroy() { this.sharedStylesHost.removeHost(this.shadowRoot); } /** * @param {?} parent * @param {?} newChild * @return {?} */ appendChild(parent, newChild) { return super.appendChild(this.nodeOrShadowRoot(parent), newChild); } /** * @param {?} parent * @param {?} newChild * @param {?} refChild * @return {?} */ insertBefore(parent, newChild, refChild) { return super.insertBefore(this.nodeOrShadowRoot(parent), newChild, refChild); } /** * @param {?} parent * @param {?} oldChild * @return {?} */ removeChild(parent, oldChild) { return super.removeChild(this.nodeOrShadowRoot(parent), oldChild); } /** * @param {?} node * @return {?} */ parentNode(node) { return this.nodeOrShadowRoot(super.parentNode(this.nodeOrShadowRoot(node))); } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ const ɵ0 = function (v) { return '__zone_symbol__' + v; }; /** * Detect if Zone is present. If it is then use simple zone aware 'addEventListener' * since Angular can do much more * efficient bookkeeping than Zone can, because we have additional information. This speeds up * addEventListener by 3x. */ const __symbol__ = (typeof Zone !== 'undefined') && (/** @type {?} */ (Zone))['__symbol__'] || ɵ0; const ADD_EVENT_LISTENER = __symbol__('addEventListener'); const REMOVE_EVENT_LISTENER = __symbol__('removeEventListener'); const symbolNames = {}; const FALSE = 'FALSE'; const ANGULAR = 'ANGULAR'; const NATIVE_ADD_LISTENER = 'addEventListener'; const NATIVE_REMOVE_LISTENER = 'removeEventListener'; // use the same symbol string which is used in zone.js const stopSymbol = '__zone_symbol__propagationStopped'; const stopMethodSymbol = '__zone_symbol__stopImmediatePropagation'; const blackListedEvents = (typeof Zone !== 'undefined') && (/** @type {?} */ (Zone))[__symbol__('BLACK_LISTED_EVENTS')]; let blackListedMap; if (blackListedEvents) { blackListedMap = {}; blackListedEvents.forEach(eventName => { blackListedMap[eventName] = eventName; }); } const isBlackListedEvent = function (eventName) { if (!blackListedMap) { return false; } return blackListedMap.hasOwnProperty(eventName); }; // a global listener to handle all dom event, // so we do not need to create a closure everytime const globalListener = function (event) { const /** @type {?} */ symbolName = symbolNames[event.type]; if (!symbolName) { return; } const /** @type {?} */ taskDatas = this[symbolName]; if (!taskDatas) { return; } const /** @type {?} */ args = [event]; if (taskDatas.length === 1) { // if taskDatas only have one element, just invoke it const /** @type {?} */ taskData = taskDatas[0]; if (taskData.zone !== Zone.current) { // only use Zone.run when Zone.current not equals to stored zone return taskData.zone.run(taskData.handler, this, args); } else { return taskData.handler.apply(this, args); } } else { // copy tasks as a snapshot to avoid event handlers remove // itself or others const /** @type {?} */ copiedTasks = taskDatas.slice(); for (let /** @type {?} */ i = 0; i < copiedTasks.length; i++) { // if other listener call event.stopImmediatePropagation // just break if ((/** @type {?} */ (event))[stopSymbol] === true) { break; } const /** @type {?} */ taskData = copiedTasks[i]; if (taskData.zone !== Zone.current) { // only use Zone.run when Zone.current not equals to stored zone taskData.zone.run(taskData.handler, this, args); } else { taskData.handler.apply(this, args); } } } }; class DomEventsPlugin extends EventManagerPlugin { /** * @param {?} doc * @param {?} ngZone */ constructor(doc, ngZone) { super(doc); this.ngZone = ngZone; this.patchEvent(); } /** * @return {?} */ patchEvent() { if (!Event || !Event.prototype) { return; } if ((/** @type {?} */ (Event.prototype))[stopMethodSymbol]) { // already patched by zone.js return; } const /** @type {?} */ delegate = (/** @type {?} */ (Event.prototype))[stopMethodSymbol] = Event.prototype.stopImmediatePropagation; Event.prototype.stopImmediatePropagation = function () { if (this) { this[stopSymbol] = true; } // should call native delegate in case // in some enviroment part of the application // will not use the patched Event delegate && delegate.apply(this, arguments); }; } /** * @param {?} eventName * @return {?} */ supports(eventName) { return true; } /** * @param {?} element * @param {?} eventName * @param {?} handler * @return {?} */ addEventListener(element, eventName, handler) { /** * This code is about to add a listener to the DOM. If Zone.js is present, than * `addEventListener` has been patched. The patched code adds overhead in both * memory and speed (3x slower) than native. For this reason if we detect that * Zone.js is present we use a simple version of zone aware addEventListener instead. * The result is faster registration and the zone will be restored. * But ZoneSpec.onScheduleTask, ZoneSpec.onInvokeTask, ZoneSpec.onCancelTask * will not be invoked * We also do manual zone restoration in element.ts renderEventHandlerClosure method. * * NOTE: it is possible that the element is from different iframe, and so we * have to check before we execute the method. */ const /** @type {?} */ self = this; const /** @type {?} */ zoneJsLoaded = element[ADD_EVENT_LISTENER]; let /** @type {?} */ callback = /** @type {?} */ (handler); // if zonejs is loaded and current zone is not ngZone // we keep Zone.current on target for later restoration. if (zoneJsLoaded && (!__WEBPACK_IMPORTED_MODULE_1__angular_core__["NgZone"].isInAngularZone() || isBlackListedEvent(eventName))) { let /** @type {?} */ symbolName = symbolNames[eventName]; if (!symbolName) { symbolName = symbolNames[eventName] = __symbol__(ANGULAR + eventName + FALSE); } let /** @type {?} */ taskDatas = (/** @type {?} */ (element))[symbolName]; const /** @type {?} */ globalListenerRegistered = taskDatas && taskDatas.length > 0; if (!taskDatas) { taskDatas = (/** @type {?} */ (element))[symbolName] = []; } const /** @type {?} */ zone = isBlackListedEvent(eventName) ? Zone.root : Zone.current; if (taskDatas.length === 0) { taskDatas.push({ zone: zone, handler: callback }); } else { let /** @type {?} */ callbackRegistered = false; for (let /** @type {?} */ i = 0; i < taskDatas.length; i++) { if (taskDatas[i].handler === callback) { callbackRegistered = true; break; } } if (!callbackRegistered) { taskDatas.push({ zone: zone, handler: callback }); } } if (!globalListenerRegistered) { element[ADD_EVENT_LISTENER](eventName, globalListener, false); } } else { element[NATIVE_ADD_LISTENER](eventName, callback, false); } return () => this.removeEventListener(element, eventName, callback); } /** * @param {?} target * @param {?} eventName * @param {?} callback * @return {?} */ removeEventListener(target, eventName, callback) { let /** @type {?} */ underlyingRemove = target[REMOVE_EVENT_LISTENER]; // zone.js not loaded, use native removeEventListener if (!underlyingRemove) { return target[NATIVE_REMOVE_LISTENER].apply(target, [eventName, callback, false]); } let /** @type {?} */ symbolName = symbolNames[eventName]; let /** @type {?} */ taskDatas = symbolName && target[symbolName]; if (!taskDatas) { // addEventListener not using patched version // just call native removeEventListener return target[NATIVE_REMOVE_LISTENER].apply(target, [eventName, callback, false]); } // fix issue 20532, should be able to remove // listener which was added inside of ngZone let /** @type {?} */ found = false; for (let /** @type {?} */ i = 0; i < taskDatas.length; i++) { // remove listener from taskDatas if the callback equals if (taskDatas[i].handler === callback) { found = true; taskDatas.splice(i, 1); break; } } if (found) { if (taskDatas.length === 0) { // all listeners are removed, we can remove the globalListener from target underlyingRemove.apply(target, [eventName, globalListener, false]); } } else { // not found in taskDatas, the callback may be added inside of ngZone // use native remove listener to remove the calback target[NATIVE_REMOVE_LISTENER].apply(target, [eventName, callback, false]); } } } DomEventsPlugin.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Injectable"] }, ]; /** @nocollapse */ DomEventsPlugin.ctorParameters = () => [ { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Inject"], args: [DOCUMENT$1,] },] }, { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["NgZone"], }, ]; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ const EVENT_NAMES = { // pan 'pan': true, 'panstart': true, 'panmove': true, 'panend': true, 'pancancel': true, 'panleft': true, 'panright': true, 'panup': true, 'pandown': true, // pinch 'pinch': true, 'pinchstart': true, 'pinchmove': true, 'pinchend': true, 'pinchcancel': true, 'pinchin': true, 'pinchout': true, // press 'press': true, 'pressup': true, // rotate 'rotate': true, 'rotatestart': true, 'rotatemove': true, 'rotateend': true, 'rotatecancel': true, // swipe 'swipe': true, 'swipeleft': true, 'swiperight': true, 'swipeup': true, 'swipedown': true, // tap 'tap': true, }; /** * A DI token that you can use to provide{\@link HammerGestureConfig} to Angular. Use it to configure * Hammer gestures. * * \@experimental */ const HAMMER_GESTURE_CONFIG = new __WEBPACK_IMPORTED_MODULE_1__angular_core__["InjectionToken"]('HammerGestureConfig'); /** * @record */ /** * \@experimental */ class HammerGestureConfig { constructor() { this.events = []; this.overrides = {}; } /** * @param {?} element * @return {?} */ buildHammer(element) { const /** @type {?} */ mc = new Hammer(element); mc.get('pinch').set({ enable: true }); mc.get('rotate').set({ enable: true }); for (const /** @type {?} */ eventName in this.overrides) { mc.get(eventName).set(this.overrides[eventName]); } return mc; } } HammerGestureConfig.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Injectable"] }, ]; /** @nocollapse */ HammerGestureConfig.ctorParameters = () => []; class HammerGesturesPlugin extends EventManagerPlugin { /** * @param {?} doc * @param {?} _config */ constructor(doc, _config) { super(doc); this._config = _config; } /** * @param {?} eventName * @return {?} */ supports(eventName) { if (!EVENT_NAMES.hasOwnProperty(eventName.toLowerCase()) && !this.isCustomEvent(eventName)) { return false; } if (!(/** @type {?} */ (window)).Hammer) { throw new Error(`Hammer.js is not loaded, can not bind ${eventName} event`); } return true; } /** * @param {?} element * @param {?} eventName * @param {?} handler * @return {?} */ addEventListener(element, eventName, handler) { const /** @type {?} */ zone = this.manager.getZone(); eventName = eventName.toLowerCase(); return zone.runOutsideAngular(() => { // Creating the manager bind events, must be done outside of angular const /** @type {?} */ mc = this._config.buildHammer(element); const /** @type {?} */ callback = function (eventObj) { zone.runGuarded(function () { handler(eventObj); }); }; mc.on(eventName, callback); return () => mc.off(eventName, callback); }); } /** * @param {?} eventName * @return {?} */ isCustomEvent(eventName) { return this._config.events.indexOf(eventName) > -1; } } HammerGesturesPlugin.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Injectable"] }, ]; /** @nocollapse */ HammerGesturesPlugin.ctorParameters = () => [ { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Inject"], args: [DOCUMENT$1,] },] }, { type: HammerGestureConfig, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Inject"], args: [HAMMER_GESTURE_CONFIG,] },] }, ]; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ const MODIFIER_KEYS = ['alt', 'control', 'meta', 'shift']; const ɵ0$1 = (event) => event.altKey; const ɵ1$1 = (event) => event.ctrlKey; const ɵ2$1 = (event) => event.metaKey; const ɵ3 = (event) => event.shiftKey; const MODIFIER_KEY_GETTERS = { 'alt': ɵ0$1, 'control': ɵ1$1, 'meta': ɵ2$1, 'shift': ɵ3 }; /** * \@experimental */ class KeyEventsPlugin extends EventManagerPlugin { /** * @param {?} doc */ constructor(doc) { super(doc); } /** * @param {?} eventName * @return {?} */ supports(eventName) { return KeyEventsPlugin.parseEventName(eventName) != null; } /** * @param {?} element * @param {?} eventName * @param {?} handler * @return {?} */ addEventListener(element, eventName, handler) { const /** @type {?} */ parsedEvent = /** @type {?} */ ((KeyEventsPlugin.parseEventName(eventName))); const /** @type {?} */ outsideHandler = KeyEventsPlugin.eventCallback(parsedEvent['fullKey'], handler, this.manager.getZone()); return this.manager.getZone().runOutsideAngular(() => { return getDOM().onAndCancel(element, parsedEvent['domEventName'], outsideHandler); }); } /** * @param {?} eventName * @return {?} */ static parseEventName(eventName) { const /** @type {?} */ parts = eventName.toLowerCase().split('.'); const /** @type {?} */ domEventName = parts.shift(); if ((parts.length === 0) || !(domEventName === 'keydown' || domEventName === 'keyup')) { return null; } const /** @type {?} */ key = KeyEventsPlugin._normalizeKey(/** @type {?} */ ((parts.pop()))); let /** @type {?} */ fullKey = ''; MODIFIER_KEYS.forEach(modifierName => { const /** @type {?} */ index = parts.indexOf(modifierName); if (index > -1) { parts.splice(index, 1); fullKey += modifierName + '.'; } }); fullKey += key; if (parts.length != 0 || key.length === 0) { // returning null instead of throwing to let another plugin process the event return null; } const /** @type {?} */ result = {}; result['domEventName'] = domEventName; result['fullKey'] = fullKey; return result; } /** * @param {?} event * @return {?} */ static getEventFullKey(event) { let /** @type {?} */ fullKey = ''; let /** @type {?} */ key = getDOM().getEventKey(event); key = key.toLowerCase(); if (key === ' ') { key = 'space'; // for readability } else if (key === '.') { key = 'dot'; // because '.' is used as a separator in event names } MODIFIER_KEYS.forEach(modifierName => { if (modifierName != key) { const /** @type {?} */ modifierGetter = MODIFIER_KEY_GETTERS[modifierName]; if (modifierGetter(event)) { fullKey += modifierName + '.'; } } }); fullKey += key; return fullKey; } /** * @param {?} fullKey * @param {?} handler * @param {?} zone * @return {?} */ static eventCallback(fullKey, handler, zone) { return (event /** TODO #9100 */) => { if (KeyEventsPlugin.getEventFullKey(event) === fullKey) { zone.runGuarded(() => handler(event)); } }; } /** * \@internal * @param {?} keyName * @return {?} */ static _normalizeKey(keyName) { // TODO: switch to a Map if the mapping grows too much switch (keyName) { case 'esc': return 'escape'; default: return keyName; } } } KeyEventsPlugin.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Injectable"] }, ]; /** @nocollapse */ KeyEventsPlugin.ctorParameters = () => [ { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Inject"], args: [DOCUMENT$1,] },] }, ]; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * This helper class is used to get hold of an inert tree of DOM elements containing dirty HTML * that needs sanitizing. * Depending upon browser support we must use one of three strategies for doing this. * Support: Safari 10.x -> XHR strategy * Support: Firefox -> DomParser strategy * Default: InertDocument strategy */ class InertBodyHelper { /** * @param {?} defaultDoc * @param {?} DOM */ constructor(defaultDoc, DOM) { this.defaultDoc = defaultDoc; this.DOM = DOM; const /** @type {?} */ inertDocument = this.DOM.createHtmlDocument(); this.inertBodyElement = inertDocument.body; if (this.inertBodyElement == null) { // usually there should be only one body element in the document, but IE doesn't have any, so // we need to create one. const /** @type {?} */ inertHtml = this.DOM.createElement('html', inertDocument); this.inertBodyElement = this.DOM.createElement('body', inertDocument); this.DOM.appendChild(inertHtml, this.inertBodyElement); this.DOM.appendChild(inertDocument, inertHtml); } this.DOM.setInnerHTML(this.inertBodyElement, '<svg><g onload="this.parentNode.remove()"></g></svg>'); if (this.inertBodyElement.querySelector && !this.inertBodyElement.querySelector('svg')) { // We just hit the Safari 10.1 bug - which allows JS to run inside the SVG G element // so use the XHR strategy. this.getInertBodyElement = this.getInertBodyElement_XHR; return; } this.DOM.setInnerHTML(this.inertBodyElement, '<svg><p><style><img src="</style><img src=x onerror=alert(1)//">'); if (this.inertBodyElement.querySelector && this.inertBodyElement.querySelector('svg img')) { // We just hit the Firefox bug - which prevents the inner img JS from being sanitized // so use the DOMParser strategy, if it is available. // If the DOMParser is not available then we are not in Firefox (Server/WebWorker?) so we // fall through to the default strategy below. if (isDOMParserAvailable()) { this.getInertBodyElement = this.getInertBodyElement_DOMParser; return; } } // None of the bugs were hit so it is safe for us to use the default InertDocument strategy this.getInertBodyElement = this.getInertBodyElement_InertDocument; } /** * Use XHR to create and fill an inert body element (on Safari 10.1) * See * https://github.com/cure53/DOMPurify/blob/a992d3a75031cb8bb032e5ea8399ba972bdf9a65/src/purify.js#L439-L449 * @param {?} html * @return {?} */ getInertBodyElement_XHR(html) { // We add these extra elements to ensure that the rest of the content is parsed as expected // e.g. leading whitespace is maintained and tags like `<meta>` do not get hoisted to the // `<head>` tag. html = '<body><remove></remove>' + html + '</body>'; try { html = encodeURI(html); } catch (/** @type {?} */ e) { return null; } const /** @type {?} */ xhr = new XMLHttpRequest(); xhr.responseType = 'document'; xhr.open('GET', 'data:text/html;charset=utf-8,' + html, false); xhr.send(null); const /** @type {?} */ body = xhr.response.body; body.removeChild(/** @type {?} */ ((body.firstChild))); return body; } /** * Use DOMParser to create and fill an inert body element (on Firefox) * See https://github.com/cure53/DOMPurify/releases/tag/0.6.7 * * @param {?} html * @return {?} */ getInertBodyElement_DOMParser(html) { // We add these extra elements to ensure that the rest of the content is parsed as expected // e.g. leading whitespace is maintained and tags like `<meta>` do not get hoisted to the // `<head>` tag. html = '<body><remove></remove>' + html + '</body>'; try { const /** @type {?} */ body = /** @type {?} */ (new (/** @type {?} */ (window)) .DOMParser() .parseFromString(html, 'text/html') .body); body.removeChild(/** @type {?} */ ((body.firstChild))); return body; } catch (/** @type {?} */ e) { return null; } } /** * Use an HTML5 `template` element, if supported, or an inert body element created via * `createHtmlDocument` to create and fill an inert DOM element. * This is the default sane strategy to use if the browser does not require one of the specialised * strategies above. * @param {?} html * @return {?} */ getInertBodyElement_InertDocument(html) { // Prefer using <template> element if supported. const /** @type {?} */ templateEl = this.DOM.createElement('template'); if ('content' in templateEl) { this.DOM.setInnerHTML(templateEl, html); return templateEl; } this.DOM.setInnerHTML(this.inertBodyElement, html); // Support: IE 9-11 only // strip custom-namespaced attributes on IE<=11 if (this.defaultDoc.documentMode) { this.stripCustomNsAttrs(this.inertBodyElement); } return this.inertBodyElement; } /** * When IE9-11 comes across an unknown namespaced attribute e.g. 'xlink:foo' it adds 'xmlns:ns1' * attribute to declare ns1 namespace and prefixes the attribute with 'ns1' (e.g. * 'ns1:xlink:foo'). * * This is undesirable since we don't want to allow any of these custom attributes. This method * strips them all. * @param {?} el * @return {?} */ stripCustomNsAttrs(el) { this.DOM.attributeMap(el).forEach((_, attrName) => { if (attrName === 'xmlns:ns1' || attrName.indexOf('ns1:') === 0) { this.DOM.removeAttribute(el, attrName); } }); for (const /** @type {?} */ n of this.DOM.childNodesAsList(el)) { if (this.DOM.isElementNode(n)) this.stripCustomNsAttrs(/** @type {?} */ (n)); } } } /** * We need to determine whether the DOMParser exists in the global context. * The try-catch is because, on some browsers, trying to access this property * on window can actually throw an error. * * @suppress {uselessCode} * @return {?} */ function isDOMParserAvailable() { try { return !!(/** @type {?} */ (window)).DOMParser; } catch (/** @type {?} */ e) { return false; } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * A pattern that recognizes a commonly useful subset of URLs that are safe. * * This regular expression matches a subset of URLs that will not cause script * execution if used in URL context within a HTML document. Specifically, this * regular expression matches if (comment from here on and regex copied from * Soy's EscapingConventions): * (1) Either a protocol in a whitelist (http, https, mailto or ftp). * (2) or no protocol. A protocol must be followed by a colon. The below * allows that by allowing colons only after one of the characters [/?#]. * A colon after a hash (#) must be in the fragment. * Otherwise, a colon after a (?) must be in a query. * Otherwise, a colon after a single solidus (/) must be in a path. * Otherwise, a colon after a double solidus (//) must be in the authority * (before port). * * The pattern disallows &, used in HTML entity declarations before * one of the characters in [/?#]. This disallows HTML entities used in the * protocol name, which should never happen, e.g. "http" for "http". * It also disallows HTML entities in the first path part of a relative path, * e.g. "foo<bar/baz". Our existing escaping functions should not produce * that. More importantly, it disallows masking of a colon, * e.g. "javascript:...". * * This regular expression was taken from the Closure sanitization library. */ const SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi; /** * A pattern that matches safe data URLs. Only matches image, video and audio types. */ const DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+\/]+=*$/i; /** * @param {?} url * @return {?} */ function sanitizeUrl(url) { url = String(url); if (url.match(SAFE_URL_PATTERN) || url.match(DATA_URL_PATTERN)) return url; if (Object(__WEBPACK_IMPORTED_MODULE_1__angular_core__["isDevMode"])()) { getDOM().log(`WARNING: sanitizing unsafe URL value ${url} (see http://g.co/ng/security#xss)`); } return 'unsafe:' + url; } /** * @param {?} srcset * @return {?} */ function sanitizeSrcset(srcset) { srcset = String(srcset); return srcset.split(',').map((srcset) => sanitizeUrl(srcset.trim())).join(', '); } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @param {?} tags * @return {?} */ function tagSet(tags) { const /** @type {?} */ res = {}; for (const /** @type {?} */ t of tags.split(',')) res[t] = true; return res; } /** * @param {...?} sets * @return {?} */ function merge(...sets) { const /** @type {?} */ res = {}; for (const /** @type {?} */ s of sets) { for (const /** @type {?} */ v in s) { if (s.hasOwnProperty(v)) res[v] = true; } } return res; } // Good source of info about elements and attributes // http://dev.w3.org/html5/spec/Overview.html#semantics // http://simon.html5.org/html-elements // Safe Void Elements - HTML5 // http://dev.w3.org/html5/spec/Overview.html#void-elements const VOID_ELEMENTS = tagSet('area,br,col,hr,img,wbr'); // Elements that you can, intentionally, leave open (and which close themselves) // http://dev.w3.org/html5/spec/Overview.html#optional-tags const OPTIONAL_END_TAG_BLOCK_ELEMENTS = tagSet('colgroup,dd,dt,li,p,tbody,td,tfoot,th,thead,tr'); const OPTIONAL_END_TAG_INLINE_ELEMENTS = tagSet('rp,rt'); const OPTIONAL_END_TAG_ELEMENTS = merge(OPTIONAL_END_TAG_INLINE_ELEMENTS, OPTIONAL_END_TAG_BLOCK_ELEMENTS); // Safe Block Elements - HTML5 const BLOCK_ELEMENTS = merge(OPTIONAL_END_TAG_BLOCK_ELEMENTS, tagSet('address,article,' + 'aside,blockquote,caption,center,del,details,dialog,dir,div,dl,figure,figcaption,footer,h1,h2,h3,h4,h5,' + 'h6,header,hgroup,hr,ins,main,map,menu,nav,ol,pre,section,summary,table,ul')); // Inline Elements - HTML5 const INLINE_ELEMENTS = merge(OPTIONAL_END_TAG_INLINE_ELEMENTS, tagSet('a,abbr,acronym,audio,b,' + 'bdi,bdo,big,br,cite,code,del,dfn,em,font,i,img,ins,kbd,label,map,mark,picture,q,ruby,rp,rt,s,' + 'samp,small,source,span,strike,strong,sub,sup,time,track,tt,u,var,video')); const VALID_ELEMENTS = merge(VOID_ELEMENTS, BLOCK_ELEMENTS, INLINE_ELEMENTS, OPTIONAL_END_TAG_ELEMENTS); // Attributes that have href and hence need to be sanitized const URI_ATTRS = tagSet('background,cite,href,itemtype,longdesc,poster,src,xlink:href'); // Attributes that have special href set hence need to be sanitized const SRCSET_ATTRS = tagSet('srcset'); const HTML_ATTRS = tagSet('abbr,accesskey,align,alt,autoplay,axis,bgcolor,border,cellpadding,cellspacing,class,clear,color,cols,colspan,' + 'compact,controls,coords,datetime,default,dir,download,face,headers,height,hidden,hreflang,hspace,' + 'ismap,itemscope,itemprop,kind,label,lang,language,loop,media,muted,nohref,nowrap,open,preload,rel,rev,role,rows,rowspan,rules,' + 'scope,scrolling,shape,size,sizes,span,srclang,start,summary,tabindex,target,title,translate,type,usemap,' + 'valign,value,vspace,width'); // NB: This currently consciously doesn't support SVG. SVG sanitization has had several security // issues in the past, so it seems safer to leave it out if possible. If support for binding SVG via // innerHTML is required, SVG attributes should be added here. // NB: Sanitization does not allow <form> elements or other active elements (<button> etc). Those // can be sanitized, but they increase security surface area without a legitimate use case, so they // are left out here. const VALID_ATTRS = merge(URI_ATTRS, SRCSET_ATTRS, HTML_ATTRS); /** * SanitizingHtmlSerializer serializes a DOM fragment, stripping out any unsafe elements and unsafe * attributes. */ class SanitizingHtmlSerializer { constructor() { this.sanitizedSomething = false; this.buf = []; this.DOM = getDOM(); } /** * @param {?} el * @return {?} */ sanitizeChildren(el) { // This cannot use a TreeWalker, as it has to run on Angular's various DOM adapters. // However this code never accesses properties off of `document` before deleting its contents // again, so it shouldn't be vulnerable to DOM clobbering. let /** @type {?} */ current = /** @type {?} */ ((this.DOM.firstChild(el))); while (current) { if (this.DOM.isElementNode(current)) { this.startElement(/** @type {?} */ (current)); } else if (this.DOM.isTextNode(current)) { this.chars(/** @type {?} */ ((this.DOM.nodeValue(current)))); } else { // Strip non-element, non-text nodes. this.sanitizedSomething = true; } if (this.DOM.firstChild(current)) { current = /** @type {?} */ ((this.DOM.firstChild(current))); continue; } while (current) { // Leaving the element. Walk up and to the right, closing tags as we go. if (this.DOM.isElementNode(current)) { this.endElement(/** @type {?} */ (current)); } let /** @type {?} */ next = this.checkClobberedElement(current, /** @type {?} */ ((this.DOM.nextSibling(current)))); if (next) { current = next; break; } current = this.checkClobberedElement(current, /** @type {?} */ ((this.DOM.parentElement(current)))); } } return this.buf.join(''); } /** * @param {?} element * @return {?} */ startElement(element) { const /** @type {?} */ tagName = this.DOM.nodeName(element).toLowerCase(); if (!VALID_ELEMENTS.hasOwnProperty(tagName)) { this.sanitizedSomething = true; return; } this.buf.push('<'); this.buf.push(tagName); this.DOM.attributeMap(element).forEach((value, attrName) => { const /** @type {?} */ lower = attrName.toLowerCase(); if (!VALID_ATTRS.hasOwnProperty(lower)) { this.sanitizedSomething = true; return; } // TODO(martinprobst): Special case image URIs for data:image/... if (URI_ATTRS[lower]) value = sanitizeUrl(value); if (SRCSET_ATTRS[lower]) value = sanitizeSrcset(value); this.buf.push(' '); this.buf.push(attrName); this.buf.push('="'); this.buf.push(encodeEntities(value)); this.buf.push('"'); }); this.buf.push('>'); } /** * @param {?} current * @return {?} */ endElement(current) { const /** @type {?} */ tagName = this.DOM.nodeName(current).toLowerCase(); if (VALID_ELEMENTS.hasOwnProperty(tagName) && !VOID_ELEMENTS.hasOwnProperty(tagName)) { this.buf.push('</'); this.buf.push(tagName); this.buf.push('>'); } } /** * @param {?} chars * @return {?} */ chars(chars) { this.buf.push(encodeEntities(chars)); } /** * @param {?} node * @param {?} nextNode * @return {?} */ checkClobberedElement(node, nextNode) { if (nextNode && this.DOM.contains(node, nextNode)) { throw new Error(`Failed to sanitize html because the element is clobbered: ${this.DOM.getOuterHTML(node)}`); } return nextNode; } } // Regular Expressions for parsing tags and attributes const SURROGATE_PAIR_REGEXP = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g; // ! to ~ is the ASCII range. const NON_ALPHANUMERIC_REGEXP = /([^\#-~ |!])/g; /** * Escapes all potentially dangerous characters, so that the * resulting string can be safely inserted into attribute or * element text. * @param {?} value * @return {?} */ function encodeEntities(value) { return value.replace(/&/g, '&') .replace(SURROGATE_PAIR_REGEXP, function (match) { const /** @type {?} */ hi = match.charCodeAt(0); const /** @type {?} */ low = match.charCodeAt(1); return '&#' + (((hi - 0xD800) * 0x400) + (low - 0xDC00) + 0x10000) + ';'; }) .replace(NON_ALPHANUMERIC_REGEXP, function (match) { return '&#' + match.charCodeAt(0) + ';'; }) .replace(/</g, '<') .replace(/>/g, '>'); } let inertBodyHelper; /** * Sanitizes the given unsafe, untrusted HTML fragment, and returns HTML text that is safe to add to * the DOM in a browser environment. * @param {?} defaultDoc * @param {?} unsafeHtmlInput * @return {?} */ function sanitizeHtml(defaultDoc, unsafeHtmlInput) { const /** @type {?} */ DOM = getDOM(); let /** @type {?} */ inertBodyElement = null; try { inertBodyHelper = inertBodyHelper || new InertBodyHelper(defaultDoc, DOM); // Make sure unsafeHtml is actually a string (TypeScript types are not enforced at runtime). let /** @type {?} */ unsafeHtml = unsafeHtmlInput ? String(unsafeHtmlInput) : ''; inertBodyElement = inertBodyHelper.getInertBodyElement(unsafeHtml); // mXSS protection. Repeatedly parse the document to make sure it stabilizes, so that a browser // trying to auto-correct incorrect HTML cannot cause formerly inert HTML to become dangerous. let /** @type {?} */ mXSSAttempts = 5; let /** @type {?} */ parsedHtml = unsafeHtml; do { if (mXSSAttempts === 0) { throw new Error('Failed to sanitize html because the input is unstable'); } mXSSAttempts--; unsafeHtml = parsedHtml; parsedHtml = DOM.getInnerHTML(inertBodyElement); inertBodyElement = inertBodyHelper.getInertBodyElement(unsafeHtml); } while (unsafeHtml !== parsedHtml); const /** @type {?} */ sanitizer = new SanitizingHtmlSerializer(); const /** @type {?} */ safeHtml = sanitizer.sanitizeChildren(DOM.getTemplateContent(inertBodyElement) || inertBodyElement); if (Object(__WEBPACK_IMPORTED_MODULE_1__angular_core__["isDevMode"])() && sanitizer.sanitizedSomething) { DOM.log('WARNING: sanitizing HTML stripped some content (see http://g.co/ng/security#xss).'); } return safeHtml; } finally { // In case anything goes wrong, clear out inertElement to reset the entire DOM structure. if (inertBodyElement) { const /** @type {?} */ parent = DOM.getTemplateContent(inertBodyElement) || inertBodyElement; for (const /** @type {?} */ child of DOM.childNodesAsList(parent)) { DOM.removeChild(parent, child); } } } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * Regular expression for safe style values. * * Quotes (" and ') are allowed, but a check must be done elsewhere to ensure they're balanced. * * ',' allows multiple values to be assigned to the same property (e.g. background-attachment or * font-family) and hence could allow multiple values to get injected, but that should pose no risk * of XSS. * * The function expression checks only for XSS safety, not for CSS validity. * * This regular expression was taken from the Closure sanitization library, and augmented for * transformation values. */ const VALUES = '[-,."\'%_!# a-zA-Z0-9]+'; const TRANSFORMATION_FNS = '(?:matrix|translate|scale|rotate|skew|perspective)(?:X|Y|3d)?'; const COLOR_FNS = '(?:rgb|hsl)a?'; const GRADIENTS = '(?:repeating-)?(?:linear|radial)-gradient'; const CSS3_FNS = '(?:calc|attr)'; const FN_ARGS = '\\([-0-9.%, #a-zA-Z]+\\)'; const SAFE_STYLE_VALUE = new RegExp(`^(${VALUES}|` + `(?:${TRANSFORMATION_FNS}|${COLOR_FNS}|${GRADIENTS}|${CSS3_FNS})` + `${FN_ARGS})$`, 'g'); /** * Matches a `url(...)` value with an arbitrary argument as long as it does * not contain parentheses. * * The URL value still needs to be sanitized separately. * * `url(...)` values are a very common use case, e.g. for `background-image`. With carefully crafted * CSS style rules, it is possible to construct an information leak with `url` values in CSS, e.g. * by observing whether scroll bars are displayed, or character ranges used by a font face * definition. * * Angular only allows binding CSS values (as opposed to entire CSS rules), so it is unlikely that * binding a URL value without further cooperation from the page will cause an information leak, and * if so, it is just a leak, not a full blown XSS vulnerability. * * Given the common use case, low likelihood of attack vector, and low impact of an attack, this * code is permissive and allows URLs that sanitize otherwise. */ const URL_RE = /^url\(([^)]+)\)$/; /** * Checks that quotes (" and ') are properly balanced inside a string. Assumes * that neither escape (\) nor any other character that could result in * breaking out of a string parsing context are allowed; * see http://www.w3.org/TR/css3-syntax/#string-token-diagram. * * This code was taken from the Closure sanitization library. * @param {?} value * @return {?} */ function hasBalancedQuotes(value) { let /** @type {?} */ outsideSingle = true; let /** @type {?} */ outsideDouble = true; for (let /** @type {?} */ i = 0; i < value.length; i++) { const /** @type {?} */ c = value.charAt(i); if (c === '\'' && outsideDouble) { outsideSingle = !outsideSingle; } else if (c === '"' && outsideSingle) { outsideDouble = !outsideDouble; } } return outsideSingle && outsideDouble; } /** * Sanitizes the given untrusted CSS style property value (i.e. not an entire object, just a single * value) and returns a value that is safe to use in a browser environment. * @param {?} value * @return {?} */ function sanitizeStyle(value) { value = String(value).trim(); // Make sure it's actually a string. if (!value) return ''; // Single url(...) values are supported, but only for URLs that sanitize cleanly. See above for // reasoning behind this. const /** @type {?} */ urlMatch = value.match(URL_RE); if ((urlMatch && sanitizeUrl(urlMatch[1]) === urlMatch[1]) || value.match(SAFE_STYLE_VALUE) && hasBalancedQuotes(value)) { return value; // Safe style values. } if (Object(__WEBPACK_IMPORTED_MODULE_1__angular_core__["isDevMode"])()) { getDOM().log(`WARNING: sanitizing unsafe style value ${value} (see http://g.co/ng/security#xss).`); } return 'unsafe'; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * Marker interface for a value that's safe to use in a particular context. * * \@stable * @record */ /** * Marker interface for a value that's safe to use as HTML. * * \@stable * @record */ /** * Marker interface for a value that's safe to use as style (CSS). * * \@stable * @record */ /** * Marker interface for a value that's safe to use as JavaScript. * * \@stable * @record */ /** * Marker interface for a value that's safe to use as a URL linking to a document. * * \@stable * @record */ /** * Marker interface for a value that's safe to use as a URL to load executable code from. * * \@stable * @record */ /** * DomSanitizer helps preventing Cross Site Scripting Security bugs (XSS) by sanitizing * values to be safe to use in the different DOM contexts. * * For example, when binding a URL in an `<a [href]="someValue">` hyperlink, `someValue` will be * sanitized so that an attacker cannot inject e.g. a `javascript:` URL that would execute code on * the website. * * In specific situations, it might be necessary to disable sanitization, for example if the * application genuinely needs to produce a `javascript:` style link with a dynamic value in it. * Users can bypass security by constructing a value with one of the `bypassSecurityTrust...` * methods, and then binding to that value from the template. * * These situations should be very rare, and extraordinary care must be taken to avoid creating a * Cross Site Scripting (XSS) security bug! * * When using `bypassSecurityTrust...`, make sure to call the method as early as possible and as * close as possible to the source of the value, to make it easy to verify no security bug is * created by its use. * * It is not required (and not recommended) to bypass security if the value is safe, e.g. a URL that * does not start with a suspicious protocol, or an HTML snippet that does not contain dangerous * code. The sanitizer leaves safe values intact. * * \@security Calling any of the `bypassSecurityTrust...` APIs disables Angular's built-in * sanitization for the value passed in. Carefully check and audit all values and code paths going * into this call. Make sure any user data is appropriately escaped for this security context. * For more detail, see the [Security Guide](http://g.co/ng/security). * * \@stable * @abstract */ class DomSanitizer { } class DomSanitizerImpl extends DomSanitizer { /** * @param {?} _doc */ constructor(_doc) { super(); this._doc = _doc; } /** * @param {?} ctx * @param {?} value * @return {?} */ sanitize(ctx, value) { if (value == null) return null; switch (ctx) { case __WEBPACK_IMPORTED_MODULE_1__angular_core__["SecurityContext"].NONE: return /** @type {?} */ (value); case __WEBPACK_IMPORTED_MODULE_1__angular_core__["SecurityContext"].HTML: if (value instanceof SafeHtmlImpl) return value.changingThisBreaksApplicationSecurity; this.checkNotSafeValue(value, 'HTML'); return sanitizeHtml(this._doc, String(value)); case __WEBPACK_IMPORTED_MODULE_1__angular_core__["SecurityContext"].STYLE: if (value instanceof SafeStyleImpl) return value.changingThisBreaksApplicationSecurity; this.checkNotSafeValue(value, 'Style'); return sanitizeStyle(/** @type {?} */ (value)); case __WEBPACK_IMPORTED_MODULE_1__angular_core__["SecurityContext"].SCRIPT: if (value instanceof SafeScriptImpl) return value.changingThisBreaksApplicationSecurity; this.checkNotSafeValue(value, 'Script'); throw new Error('unsafe value used in a script context'); case __WEBPACK_IMPORTED_MODULE_1__angular_core__["SecurityContext"].URL: if (value instanceof SafeResourceUrlImpl || value instanceof SafeUrlImpl) { // Allow resource URLs in URL contexts, they are strictly more trusted. return value.changingThisBreaksApplicationSecurity; } this.checkNotSafeValue(value, 'URL'); return sanitizeUrl(String(value)); case __WEBPACK_IMPORTED_MODULE_1__angular_core__["SecurityContext"].RESOURCE_URL: if (value instanceof SafeResourceUrlImpl) { return value.changingThisBreaksApplicationSecurity; } this.checkNotSafeValue(value, 'ResourceURL'); throw new Error('unsafe value used in a resource URL context (see http://g.co/ng/security#xss)'); default: throw new Error(`Unexpected SecurityContext ${ctx} (see http://g.co/ng/security#xss)`); } } /** * @param {?} value * @param {?} expectedType * @return {?} */ checkNotSafeValue(value, expectedType) { if (value instanceof SafeValueImpl) { throw new Error(`Required a safe ${expectedType}, got a ${value.getTypeName()} ` + `(see http://g.co/ng/security#xss)`); } } /** * @param {?} value * @return {?} */ bypassSecurityTrustHtml(value) { return new SafeHtmlImpl(value); } /** * @param {?} value * @return {?} */ bypassSecurityTrustStyle(value) { return new SafeStyleImpl(value); } /** * @param {?} value * @return {?} */ bypassSecurityTrustScript(value) { return new SafeScriptImpl(value); } /** * @param {?} value * @return {?} */ bypassSecurityTrustUrl(value) { return new SafeUrlImpl(value); } /** * @param {?} value * @return {?} */ bypassSecurityTrustResourceUrl(value) { return new SafeResourceUrlImpl(value); } } DomSanitizerImpl.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Injectable"] }, ]; /** @nocollapse */ DomSanitizerImpl.ctorParameters = () => [ { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Inject"], args: [DOCUMENT$1,] },] }, ]; /** * @abstract */ class SafeValueImpl { /** * @param {?} changingThisBreaksApplicationSecurity */ constructor(changingThisBreaksApplicationSecurity) { // empty this.changingThisBreaksApplicationSecurity = changingThisBreaksApplicationSecurity; } /** * @return {?} */ toString() { return `SafeValue must use [property]=binding: ${this.changingThisBreaksApplicationSecurity}` + ` (see http://g.co/ng/security#xss)`; } } class SafeHtmlImpl extends SafeValueImpl { /** * @return {?} */ getTypeName() { return 'HTML'; } } class SafeStyleImpl extends SafeValueImpl { /** * @return {?} */ getTypeName() { return 'Style'; } } class SafeScriptImpl extends SafeValueImpl { /** * @return {?} */ getTypeName() { return 'Script'; } } class SafeUrlImpl extends SafeValueImpl { /** * @return {?} */ getTypeName() { return 'URL'; } } class SafeResourceUrlImpl extends SafeValueImpl { /** * @return {?} */ getTypeName() { return 'ResourceURL'; } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ const INTERNAL_BROWSER_PLATFORM_PROVIDERS = [ { provide: __WEBPACK_IMPORTED_MODULE_1__angular_core__["PLATFORM_ID"], useValue: __WEBPACK_IMPORTED_MODULE_0__angular_common__["ɵPLATFORM_BROWSER_ID"] }, { provide: __WEBPACK_IMPORTED_MODULE_1__angular_core__["PLATFORM_INITIALIZER"], useValue: initDomAdapter, multi: true }, { provide: __WEBPACK_IMPORTED_MODULE_0__angular_common__["PlatformLocation"], useClass: BrowserPlatformLocation, deps: [DOCUMENT$1] }, { provide: DOCUMENT$1, useFactory: _document, deps: [] }, ]; /** * \@security Replacing built-in sanitization providers exposes the application to XSS risks. * Attacker-controlled data introduced by an unsanitized provider could expose your * application to XSS risks. For more detail, see the [Security Guide](http://g.co/ng/security). * \@experimental */ const BROWSER_SANITIZATION_PROVIDERS = [ { provide: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Sanitizer"], useExisting: DomSanitizer }, { provide: DomSanitizer, useClass: DomSanitizerImpl, deps: [DOCUMENT$1] }, ]; /** * \@stable */ const platformBrowser = Object(__WEBPACK_IMPORTED_MODULE_1__angular_core__["createPlatformFactory"])(__WEBPACK_IMPORTED_MODULE_1__angular_core__["platformCore"], 'browser', INTERNAL_BROWSER_PLATFORM_PROVIDERS); /** * @return {?} */ function initDomAdapter() { BrowserDomAdapter.makeCurrent(); BrowserGetTestability.init(); } /** * @return {?} */ function errorHandler() { return new __WEBPACK_IMPORTED_MODULE_1__angular_core__["ErrorHandler"](); } /** * @return {?} */ function _document() { return document; } /** * The ng module for the browser. * * \@stable */ class BrowserModule { /** * @param {?} parentModule */ constructor(parentModule) { if (parentModule) { throw new Error(`BrowserModule has already been loaded. If you need access to common directives such as NgIf and NgFor from a lazy loaded module, import CommonModule instead.`); } } /** * Configures a browser-based application to transition from a server-rendered app, if * one is present on the page. The specified parameters must include an application id, * which must match between the client and server applications. * * \@experimental * @param {?} params * @return {?} */ static withServerTransition(params) { return { ngModule: BrowserModule, providers: [ { provide: __WEBPACK_IMPORTED_MODULE_1__angular_core__["APP_ID"], useValue: params.appId }, { provide: TRANSITION_ID, useExisting: __WEBPACK_IMPORTED_MODULE_1__angular_core__["APP_ID"] }, SERVER_TRANSITION_PROVIDERS, ], }; } } BrowserModule.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["NgModule"], args: [{ providers: [ BROWSER_SANITIZATION_PROVIDERS, { provide: __WEBPACK_IMPORTED_MODULE_1__angular_core__["ErrorHandler"], useFactory: errorHandler, deps: [] }, { provide: EVENT_MANAGER_PLUGINS, useClass: DomEventsPlugin, multi: true }, { provide: EVENT_MANAGER_PLUGINS, useClass: KeyEventsPlugin, multi: true }, { provide: EVENT_MANAGER_PLUGINS, useClass: HammerGesturesPlugin, multi: true }, { provide: HAMMER_GESTURE_CONFIG, useClass: HammerGestureConfig }, DomRendererFactory2, { provide: __WEBPACK_IMPORTED_MODULE_1__angular_core__["RendererFactory2"], useExisting: DomRendererFactory2 }, { provide: SharedStylesHost, useExisting: DomSharedStylesHost }, DomSharedStylesHost, __WEBPACK_IMPORTED_MODULE_1__angular_core__["Testability"], EventManager, ELEMENT_PROBE_PROVIDERS, Meta, Title, ], exports: [__WEBPACK_IMPORTED_MODULE_0__angular_common__["CommonModule"], __WEBPACK_IMPORTED_MODULE_1__angular_core__["ApplicationModule"]] },] }, ]; /** @nocollapse */ BrowserModule.ctorParameters = () => [ { type: BrowserModule, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Optional"] }, { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["SkipSelf"] },] }, ]; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ const win = typeof window !== 'undefined' && window || /** @type {?} */ ({}); /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ class ChangeDetectionPerfRecord { /** * @param {?} msPerTick * @param {?} numTicks */ constructor(msPerTick, numTicks) { this.msPerTick = msPerTick; this.numTicks = numTicks; } } /** * Entry point for all Angular profiling-related debug tools. This object * corresponds to the `ng.profiler` in the dev console. */ class AngularProfiler { /** * @param {?} ref */ constructor(ref) { this.appRef = ref.injector.get(__WEBPACK_IMPORTED_MODULE_1__angular_core__["ApplicationRef"]); } /** * Exercises change detection in a loop and then prints the average amount of * time in milliseconds how long a single round of change detection takes for * the current state of the UI. It runs a minimum of 5 rounds for a minimum * of 500 milliseconds. * * Optionally, a user may pass a `config` parameter containing a map of * options. Supported options are: * * `record` (boolean) - causes the profiler to record a CPU profile while * it exercises the change detector. Example: * * ``` * ng.profiler.timeChangeDetection({record: true}) * ``` * @param {?} config * @return {?} */ timeChangeDetection(config) { const /** @type {?} */ record = config && config['record']; const /** @type {?} */ profileName = 'Change Detection'; // Profiler is not available in Android browsers, nor in IE 9 without dev tools opened const /** @type {?} */ isProfilerAvailable = win.console.profile != null; if (record && isProfilerAvailable) { win.console.profile(profileName); } const /** @type {?} */ start = getDOM().performanceNow(); let /** @type {?} */ numTicks = 0; while (numTicks < 5 || (getDOM().performanceNow() - start) < 500) { this.appRef.tick(); numTicks++; } const /** @type {?} */ end = getDOM().performanceNow(); if (record && isProfilerAvailable) { // need to cast to <any> because type checker thinks there's no argument // while in fact there is: // // https://developer.mozilla.org/en-US/docs/Web/API/Console/profileEnd (/** @type {?} */ (win.console.profileEnd))(profileName); } const /** @type {?} */ msPerTick = (end - start) / numTicks; win.console.log(`ran ${numTicks} change detection cycles`); win.console.log(`${msPerTick.toFixed(2)} ms per check`); return new ChangeDetectionPerfRecord(msPerTick, numTicks); } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ const PROFILER_GLOBAL_NAME = 'profiler'; /** * Enabled Angular debug tools that are accessible via your browser's * developer console. * * Usage: * * 1. Open developer console (e.g. in Chrome Ctrl + Shift + j) * 1. Type `ng.` (usually the console will show auto-complete suggestion) * 1. Try the change detection profiler `ng.profiler.timeChangeDetection()` * then hit Enter. * * \@experimental All debugging apis are currently experimental. * @template T * @param {?} ref * @return {?} */ function enableDebugTools(ref) { exportNgVar(PROFILER_GLOBAL_NAME, new AngularProfiler(ref)); return ref; } /** * Disables Angular tools. * * \@experimental All debugging apis are currently experimental. * @return {?} */ function disableDebugTools() { exportNgVar(PROFILER_GLOBAL_NAME, null); } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @param {?} text * @return {?} */ function escapeHtml(text) { const /** @type {?} */ escapedText = { '&': '&a;', '"': '&q;', '\'': '&s;', '<': '&l;', '>': '&g;', }; return text.replace(/[&"'<>]/g, s => escapedText[s]); } /** * @param {?} text * @return {?} */ function unescapeHtml(text) { const /** @type {?} */ unescapedText = { '&a;': '&', '&q;': '"', '&s;': '\'', '&l;': '<', '&g;': '>', }; return text.replace(/&[^;]+;/g, s => unescapedText[s]); } /** * Create a `StateKey<T>` that can be used to store value of type T with `TransferState`. * * Example: * * ``` * const COUNTER_KEY = makeStateKey<number>('counter'); * let value = 10; * * transferState.set(COUNTER_KEY, value); * ``` * * \@experimental * @template T * @param {?} key * @return {?} */ function makeStateKey(key) { return /** @type {?} */ (key); } /** * A key value store that is transferred from the application on the server side to the application * on the client side. * * `TransferState` will be available as an injectable token. To use it import * `ServerTransferStateModule` on the server and `BrowserTransferStateModule` on the client. * * The values in the store are serialized/deserialized using JSON.stringify/JSON.parse. So only * boolean, number, string, null and non-class objects will be serialized and deserialzied in a * non-lossy manner. * * \@experimental */ class TransferState { constructor() { this.store = {}; this.onSerializeCallbacks = {}; } /** * \@internal * @param {?} initState * @return {?} */ static init(initState) { const /** @type {?} */ transferState = new TransferState(); transferState.store = initState; return transferState; } /** * Get the value corresponding to a key. Return `defaultValue` if key is not found. * @template T * @param {?} key * @param {?} defaultValue * @return {?} */ get(key, defaultValue) { return this.store[key] !== undefined ? /** @type {?} */ (this.store[key]) : defaultValue; } /** * Set the value corresponding to a key. * @template T * @param {?} key * @param {?} value * @return {?} */ set(key, value) { this.store[key] = value; } /** * Remove a key from the store. * @template T * @param {?} key * @return {?} */ remove(key) { delete this.store[key]; } /** * Test whether a key exists in the store. * @template T * @param {?} key * @return {?} */ hasKey(key) { return this.store.hasOwnProperty(key); } /** * Register a callback to provide the value for a key when `toJson` is called. * @template T * @param {?} key * @param {?} callback * @return {?} */ onSerialize(key, callback) { this.onSerializeCallbacks[key] = callback; } /** * Serialize the current state of the store to JSON. * @return {?} */ toJson() { // Call the onSerialize callbacks and put those values into the store. for (const /** @type {?} */ key in this.onSerializeCallbacks) { if (this.onSerializeCallbacks.hasOwnProperty(key)) { try { this.store[key] = this.onSerializeCallbacks[key](); } catch (/** @type {?} */ e) { console.warn('Exception in onSerialize callback: ', e); } } } return JSON.stringify(this.store); } } TransferState.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Injectable"] }, ]; /** @nocollapse */ TransferState.ctorParameters = () => []; /** * @param {?} doc * @param {?} appId * @return {?} */ function initTransferState(doc, appId) { // Locate the script tag with the JSON data transferred from the server. // The id of the script tag is set to the Angular appId + 'state'. const /** @type {?} */ script = doc.getElementById(appId + '-state'); let /** @type {?} */ initialState = {}; if (script && script.textContent) { try { initialState = JSON.parse(unescapeHtml(script.textContent)); } catch (/** @type {?} */ e) { console.warn('Exception while restoring TransferState for app ' + appId, e); } } return TransferState.init(initialState); } /** * NgModule to install on the client side while using the `TransferState` to transfer state from * server to client. * * \@experimental */ class BrowserTransferStateModule { } BrowserTransferStateModule.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["NgModule"], args: [{ providers: [{ provide: TransferState, useFactory: initTransferState, deps: [DOCUMENT$1, __WEBPACK_IMPORTED_MODULE_1__angular_core__["APP_ID"]] }], },] }, ]; /** @nocollapse */ BrowserTransferStateModule.ctorParameters = () => []; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * Predicates for use with {\@link DebugElement}'s query functions. * * \@experimental All debugging apis are currently experimental. */ class By { /** * Match all elements. * * ## Example * * {\@example platform-browser/dom/debug/ts/by/by.ts region='by_all'} * @return {?} */ static all() { return (debugElement) => true; } /** * Match elements by the given CSS selector. * * ## Example * * {\@example platform-browser/dom/debug/ts/by/by.ts region='by_css'} * @param {?} selector * @return {?} */ static css(selector) { return (debugElement) => { return debugElement.nativeElement != null ? getDOM().elementMatches(debugElement.nativeElement, selector) : false; }; } /** * Match elements that have the given directive present. * * ## Example * * {\@example platform-browser/dom/debug/ts/by/by.ts region='by_directive'} * @param {?} type * @return {?} */ static directive(type) { return (debugElement) => /** @type {?} */ ((debugElement.providerTokens)).indexOf(type) !== -1; } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * \@stable */ const VERSION = new __WEBPACK_IMPORTED_MODULE_1__angular_core__["Version"]('5.2.10'); /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @module * @description * Entry point for all public APIs of this package. */ // This file only reexports content of the `src` folder. Keep it that way. /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * Generated bundle index. Do not edit. */ //# sourceMappingURL=platform-browser.js.map /***/ }), /***/ "./node_modules/@angular/router/esm2015/router.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export RouterLink */ /* unused harmony export RouterLinkWithHref */ /* unused harmony export RouterLinkActive */ /* unused harmony export RouterOutlet */ /* unused harmony export ActivationEnd */ /* unused harmony export ActivationStart */ /* unused harmony export ChildActivationEnd */ /* unused harmony export ChildActivationStart */ /* unused harmony export GuardsCheckEnd */ /* unused harmony export GuardsCheckStart */ /* unused harmony export NavigationCancel */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return NavigationEnd; }); /* unused harmony export NavigationError */ /* unused harmony export NavigationStart */ /* unused harmony export ResolveEnd */ /* unused harmony export ResolveStart */ /* unused harmony export RouteConfigLoadEnd */ /* unused harmony export RouteConfigLoadStart */ /* unused harmony export RouterEvent */ /* unused harmony export RoutesRecognized */ /* unused harmony export RouteReuseStrategy */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return Router; }); /* unused harmony export ROUTES */ /* unused harmony export ROUTER_CONFIGURATION */ /* unused harmony export ROUTER_INITIALIZER */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return RouterModule; }); /* unused harmony export provideRoutes */ /* unused harmony export ChildrenOutletContexts */ /* unused harmony export OutletContext */ /* unused harmony export NoPreloading */ /* unused harmony export PreloadAllModules */ /* unused harmony export PreloadingStrategy */ /* unused harmony export RouterPreloader */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ActivatedRoute; }); /* unused harmony export ActivatedRouteSnapshot */ /* unused harmony export RouterState */ /* unused harmony export RouterStateSnapshot */ /* unused harmony export PRIMARY_OUTLET */ /* unused harmony export convertToParamMap */ /* unused harmony export UrlHandlingStrategy */ /* unused harmony export DefaultUrlSerializer */ /* unused harmony export UrlSegment */ /* unused harmony export UrlSegmentGroup */ /* unused harmony export UrlSerializer */ /* unused harmony export UrlTree */ /* unused harmony export VERSION */ /* unused harmony export ɵROUTER_PROVIDERS */ /* unused harmony export ɵflatten */ /* unused harmony export ɵa */ /* unused harmony export ɵg */ /* unused harmony export ɵh */ /* unused harmony export ɵi */ /* unused harmony export ɵd */ /* unused harmony export ɵc */ /* unused harmony export ɵj */ /* unused harmony export ɵf */ /* unused harmony export ɵb */ /* unused harmony export ɵe */ /* unused harmony export ɵk */ /* unused harmony export ɵl */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_common__ = __webpack_require__("./node_modules/@angular/common/esm2015/common.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_core__ = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_rxjs_BehaviorSubject__ = __webpack_require__("./node_modules/rxjs/_esm2015/BehaviorSubject.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_rxjs_Subject__ = __webpack_require__("./node_modules/rxjs/_esm2015/Subject.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_rxjs_observable_of__ = __webpack_require__("./node_modules/rxjs/_esm2015/observable/of.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_rxjs_operator_concatMap__ = __webpack_require__("./node_modules/rxjs/_esm2015/operator/concatMap.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_rxjs_operator_map__ = __webpack_require__("./node_modules/rxjs/_esm2015/operator/map.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7_rxjs_operator_mergeMap__ = __webpack_require__("./node_modules/rxjs/_esm2015/operator/mergeMap.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8_rxjs_Observable__ = __webpack_require__("./node_modules/rxjs/_esm2015/Observable.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_9_rxjs_observable_from__ = __webpack_require__("./node_modules/rxjs/_esm2015/observable/from.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_10_rxjs_operator_catch__ = __webpack_require__("./node_modules/rxjs/_esm2015/operator/catch.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_11_rxjs_operator_concatAll__ = __webpack_require__("./node_modules/rxjs/_esm2015/operator/concatAll.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_12_rxjs_operator_first__ = __webpack_require__("./node_modules/rxjs/_esm2015/operator/first.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_13_rxjs_util_EmptyError__ = __webpack_require__("./node_modules/rxjs/_esm2015/util/EmptyError.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_14_rxjs_observable_fromPromise__ = __webpack_require__("./node_modules/rxjs/_esm2015/observable/fromPromise.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_15_rxjs_operator_every__ = __webpack_require__("./node_modules/rxjs/_esm2015/operator/every.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_16_rxjs_operator_last__ = __webpack_require__("./node_modules/rxjs/_esm2015/operator/last.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_17_rxjs_operator_mergeAll__ = __webpack_require__("./node_modules/rxjs/_esm2015/operator/mergeAll.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_18_rxjs_operator_reduce__ = __webpack_require__("./node_modules/rxjs/_esm2015/operator/reduce.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_19__angular_platform_browser__ = __webpack_require__("./node_modules/@angular/platform-browser/esm2015/platform-browser.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_20_rxjs_operator_filter__ = __webpack_require__("./node_modules/rxjs/_esm2015/operator/filter.js"); /** * @license Angular v5.2.10 * (c) 2010-2018 Google, Inc. https://angular.io/ * License: MIT */ /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * \@whatItDoes Base for events the Router goes through, as opposed to events tied to a specific * Route. `RouterEvent`s will only be fired one time for any given navigation. * * Example: * * ``` * class MyService { * constructor(public router: Router, logger: Logger) { * router.events.filter(e => e instanceof RouterEvent).subscribe(e => { * logger.log(e.id, e.url); * }); * } * } * ``` * * \@experimental */ class RouterEvent { /** * @param {?} id * @param {?} url */ constructor(id, url) { this.id = id; this.url = url; } } /** * \@whatItDoes Represents an event triggered when a navigation starts. * * \@stable */ class NavigationStart extends RouterEvent { /** * \@docsNotRequired * @return {?} */ toString() { return `NavigationStart(id: ${this.id}, url: '${this.url}')`; } } /** * \@whatItDoes Represents an event triggered when a navigation ends successfully. * * \@stable */ class NavigationEnd extends RouterEvent { /** * @param {?} id * @param {?} url * @param {?} urlAfterRedirects */ constructor(/** @docsNotRequired */ /** @docsNotRequired */ id, /** @docsNotRequired */ /** @docsNotRequired */ url, urlAfterRedirects) { super(id, url); this.urlAfterRedirects = urlAfterRedirects; } /** * \@docsNotRequired * @return {?} */ toString() { return `NavigationEnd(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}')`; } } /** * \@whatItDoes Represents an event triggered when a navigation is canceled. * * \@stable */ class NavigationCancel extends RouterEvent { /** * @param {?} id * @param {?} url * @param {?} reason */ constructor(/** @docsNotRequired */ /** @docsNotRequired */ id, /** @docsNotRequired */ /** @docsNotRequired */ url, reason) { super(id, url); this.reason = reason; } /** * \@docsNotRequired * @return {?} */ toString() { return `NavigationCancel(id: ${this.id}, url: '${this.url}')`; } } /** * \@whatItDoes Represents an event triggered when a navigation fails due to an unexpected error. * * \@stable */ class NavigationError extends RouterEvent { /** * @param {?} id * @param {?} url * @param {?} error */ constructor(/** @docsNotRequired */ /** @docsNotRequired */ id, /** @docsNotRequired */ /** @docsNotRequired */ url, error) { super(id, url); this.error = error; } /** * \@docsNotRequired * @return {?} */ toString() { return `NavigationError(id: ${this.id}, url: '${this.url}', error: ${this.error})`; } } /** * \@whatItDoes Represents an event triggered when routes are recognized. * * \@stable */ class RoutesRecognized extends RouterEvent { /** * @param {?} id * @param {?} url * @param {?} urlAfterRedirects * @param {?} state */ constructor(/** @docsNotRequired */ /** @docsNotRequired */ id, /** @docsNotRequired */ /** @docsNotRequired */ url, urlAfterRedirects, state) { super(id, url); this.urlAfterRedirects = urlAfterRedirects; this.state = state; } /** * \@docsNotRequired * @return {?} */ toString() { return `RoutesRecognized(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}', state: ${this.state})`; } } /** * \@whatItDoes Represents the start of the Guard phase of routing. * * \@experimental */ class GuardsCheckStart extends RouterEvent { /** * @param {?} id * @param {?} url * @param {?} urlAfterRedirects * @param {?} state */ constructor(/** @docsNotRequired */ /** @docsNotRequired */ id, /** @docsNotRequired */ /** @docsNotRequired */ url, urlAfterRedirects, state) { super(id, url); this.urlAfterRedirects = urlAfterRedirects; this.state = state; } /** * @return {?} */ toString() { return `GuardsCheckStart(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}', state: ${this.state})`; } } /** * \@whatItDoes Represents the end of the Guard phase of routing. * * \@experimental */ class GuardsCheckEnd extends RouterEvent { /** * @param {?} id * @param {?} url * @param {?} urlAfterRedirects * @param {?} state * @param {?} shouldActivate */ constructor(/** @docsNotRequired */ /** @docsNotRequired */ id, /** @docsNotRequired */ /** @docsNotRequired */ url, urlAfterRedirects, state, shouldActivate) { super(id, url); this.urlAfterRedirects = urlAfterRedirects; this.state = state; this.shouldActivate = shouldActivate; } /** * @return {?} */ toString() { return `GuardsCheckEnd(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}', state: ${this.state}, shouldActivate: ${this.shouldActivate})`; } } /** * \@whatItDoes Represents the start of the Resolve phase of routing. The timing of this * event may change, thus it's experimental. In the current iteration it will run * in the "resolve" phase whether there's things to resolve or not. In the future this * behavior may change to only run when there are things to be resolved. * * \@experimental */ class ResolveStart extends RouterEvent { /** * @param {?} id * @param {?} url * @param {?} urlAfterRedirects * @param {?} state */ constructor(/** @docsNotRequired */ /** @docsNotRequired */ id, /** @docsNotRequired */ /** @docsNotRequired */ url, urlAfterRedirects, state) { super(id, url); this.urlAfterRedirects = urlAfterRedirects; this.state = state; } /** * @return {?} */ toString() { return `ResolveStart(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}', state: ${this.state})`; } } /** * \@whatItDoes Represents the end of the Resolve phase of routing. See note on * {\@link ResolveStart} for use of this experimental API. * * \@experimental */ class ResolveEnd extends RouterEvent { /** * @param {?} id * @param {?} url * @param {?} urlAfterRedirects * @param {?} state */ constructor(/** @docsNotRequired */ /** @docsNotRequired */ id, /** @docsNotRequired */ /** @docsNotRequired */ url, urlAfterRedirects, state) { super(id, url); this.urlAfterRedirects = urlAfterRedirects; this.state = state; } /** * @return {?} */ toString() { return `ResolveEnd(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}', state: ${this.state})`; } } /** * \@whatItDoes Represents an event triggered before lazy loading a route config. * * \@experimental */ class RouteConfigLoadStart { /** * @param {?} route */ constructor(route) { this.route = route; } /** * @return {?} */ toString() { return `RouteConfigLoadStart(path: ${this.route.path})`; } } /** * \@whatItDoes Represents an event triggered when a route has been lazy loaded. * * \@experimental */ class RouteConfigLoadEnd { /** * @param {?} route */ constructor(route) { this.route = route; } /** * @return {?} */ toString() { return `RouteConfigLoadEnd(path: ${this.route.path})`; } } /** * \@whatItDoes Represents the start of end of the Resolve phase of routing. See note on * {\@link ChildActivationEnd} for use of this experimental API. * * \@experimental */ class ChildActivationStart { /** * @param {?} snapshot */ constructor(snapshot) { this.snapshot = snapshot; } /** * @return {?} */ toString() { const /** @type {?} */ path = this.snapshot.routeConfig && this.snapshot.routeConfig.path || ''; return `ChildActivationStart(path: '${path}')`; } } /** * \@whatItDoes Represents the start of end of the Resolve phase of routing. See note on * {\@link ChildActivationStart} for use of this experimental API. * * \@experimental */ class ChildActivationEnd { /** * @param {?} snapshot */ constructor(snapshot) { this.snapshot = snapshot; } /** * @return {?} */ toString() { const /** @type {?} */ path = this.snapshot.routeConfig && this.snapshot.routeConfig.path || ''; return `ChildActivationEnd(path: '${path}')`; } } /** * \@whatItDoes Represents the start of end of the Resolve phase of routing. See note on * {\@link ActivationEnd} for use of this experimental API. * * \@experimental */ class ActivationStart { /** * @param {?} snapshot */ constructor(snapshot) { this.snapshot = snapshot; } /** * @return {?} */ toString() { const /** @type {?} */ path = this.snapshot.routeConfig && this.snapshot.routeConfig.path || ''; return `ActivationStart(path: '${path}')`; } } /** * \@whatItDoes Represents the start of end of the Resolve phase of routing. See note on * {\@link ActivationStart} for use of this experimental API. * * \@experimental */ class ActivationEnd { /** * @param {?} snapshot */ constructor(snapshot) { this.snapshot = snapshot; } /** * @return {?} */ toString() { const /** @type {?} */ path = this.snapshot.routeConfig && this.snapshot.routeConfig.path || ''; return `ActivationEnd(path: '${path}')`; } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * \@whatItDoes Name of the primary outlet. * * \@stable */ const PRIMARY_OUTLET = 'primary'; /** * Matrix and Query parameters. * * `ParamMap` makes it easier to work with parameters as they could have either a single value or * multiple value. Because this should be known by the user, calling `get` or `getAll` returns the * correct type (either `string` or `string[]`). * * The API is inspired by the URLSearchParams interface. * see https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams * * \@stable * @record */ class ParamsAsMap { /** * @param {?} params */ constructor(params) { this.params = params || {}; } /** * @param {?} name * @return {?} */ has(name) { return this.params.hasOwnProperty(name); } /** * @param {?} name * @return {?} */ get(name) { if (this.has(name)) { const /** @type {?} */ v = this.params[name]; return Array.isArray(v) ? v[0] : v; } return null; } /** * @param {?} name * @return {?} */ getAll(name) { if (this.has(name)) { const /** @type {?} */ v = this.params[name]; return Array.isArray(v) ? v : [v]; } return []; } /** * @return {?} */ get keys() { return Object.keys(this.params); } } /** * Convert a {\@link Params} instance to a {\@link ParamMap}. * * \@stable * @param {?} params * @return {?} */ function convertToParamMap(params) { return new ParamsAsMap(params); } const NAVIGATION_CANCELING_ERROR = 'ngNavigationCancelingError'; /** * @param {?} message * @return {?} */ function navigationCancelingError(message) { const /** @type {?} */ error = Error('NavigationCancelingError: ' + message); (/** @type {?} */ (error))[NAVIGATION_CANCELING_ERROR] = true; return error; } /** * @param {?} error * @return {?} */ function isNavigationCancelingError(error) { return error && (/** @type {?} */ (error))[NAVIGATION_CANCELING_ERROR]; } /** * @param {?} segments * @param {?} segmentGroup * @param {?} route * @return {?} */ function defaultUrlMatcher(segments, segmentGroup, route) { const /** @type {?} */ parts = /** @type {?} */ ((route.path)).split('/'); if (parts.length > segments.length) { // The actual URL is shorter than the config, no match return null; } if (route.pathMatch === 'full' && (segmentGroup.hasChildren() || parts.length < segments.length)) { // The config is longer than the actual URL but we are looking for a full match, return null return null; } const /** @type {?} */ posParams = {}; // Check each config part against the actual URL for (let /** @type {?} */ index = 0; index < parts.length; index++) { const /** @type {?} */ part = parts[index]; const /** @type {?} */ segment = segments[index]; const /** @type {?} */ isParameter = part.startsWith(':'); if (isParameter) { posParams[part.substring(1)] = segment; } else if (part !== segment.path) { // The actual URL part does not match the config, no match return null; } } return { consumed: segments.slice(0, parts.length), posParams }; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * See {\@link Routes} for more details. * \@stable * @record */ class LoadedRouterConfig { /** * @param {?} routes * @param {?} module */ constructor(routes, module) { this.routes = routes; this.module = module; } } /** * @param {?} config * @param {?=} parentPath * @return {?} */ function validateConfig(config, parentPath = '') { // forEach doesn't iterate undefined values for (let /** @type {?} */ i = 0; i < config.length; i++) { const /** @type {?} */ route = config[i]; const /** @type {?} */ fullPath = getFullPath(parentPath, route); validateNode(route, fullPath); } } /** * @param {?} route * @param {?} fullPath * @return {?} */ function validateNode(route, fullPath) { if (!route) { throw new Error(` Invalid configuration of route '${fullPath}': Encountered undefined route. The reason might be an extra comma. Example: const routes: Routes = [ { path: '', redirectTo: '/dashboard', pathMatch: 'full' }, { path: 'dashboard', component: DashboardComponent },, << two commas { path: 'detail/:id', component: HeroDetailComponent } ]; `); } if (Array.isArray(route)) { throw new Error(`Invalid configuration of route '${fullPath}': Array cannot be specified`); } if (!route.component && (route.outlet && route.outlet !== PRIMARY_OUTLET)) { throw new Error(`Invalid configuration of route '${fullPath}': a componentless route cannot have a named outlet set`); } if (route.redirectTo && route.children) { throw new Error(`Invalid configuration of route '${fullPath}': redirectTo and children cannot be used together`); } if (route.redirectTo && route.loadChildren) { throw new Error(`Invalid configuration of route '${fullPath}': redirectTo and loadChildren cannot be used together`); } if (route.children && route.loadChildren) { throw new Error(`Invalid configuration of route '${fullPath}': children and loadChildren cannot be used together`); } if (route.redirectTo && route.component) { throw new Error(`Invalid configuration of route '${fullPath}': redirectTo and component cannot be used together`); } if (route.path && route.matcher) { throw new Error(`Invalid configuration of route '${fullPath}': path and matcher cannot be used together`); } if (route.redirectTo === void 0 && !route.component && !route.children && !route.loadChildren) { throw new Error(`Invalid configuration of route '${fullPath}'. One of the following must be provided: component, redirectTo, children or loadChildren`); } if (route.path === void 0 && route.matcher === void 0) { throw new Error(`Invalid configuration of route '${fullPath}': routes must have either a path or a matcher specified`); } if (typeof route.path === 'string' && route.path.charAt(0) === '/') { throw new Error(`Invalid configuration of route '${fullPath}': path cannot start with a slash`); } if (route.path === '' && route.redirectTo !== void 0 && route.pathMatch === void 0) { const /** @type {?} */ exp = `The default value of 'pathMatch' is 'prefix', but often the intent is to use 'full'.`; throw new Error(`Invalid configuration of route '{path: "${fullPath}", redirectTo: "${route.redirectTo}"}': please provide 'pathMatch'. ${exp}`); } if (route.pathMatch !== void 0 && route.pathMatch !== 'full' && route.pathMatch !== 'prefix') { throw new Error(`Invalid configuration of route '${fullPath}': pathMatch can only be set to 'prefix' or 'full'`); } if (route.children) { validateConfig(route.children, fullPath); } } /** * @param {?} parentPath * @param {?} currentRoute * @return {?} */ function getFullPath(parentPath, currentRoute) { if (!currentRoute) { return parentPath; } if (!parentPath && !currentRoute.path) { return ''; } else if (parentPath && !currentRoute.path) { return `${parentPath}/`; } else if (!parentPath && currentRoute.path) { return currentRoute.path; } else { return `${parentPath}/${currentRoute.path}`; } } /** * @param {?} r * @return {?} */ function copyConfig(r) { const /** @type {?} */ children = r.children && r.children.map(copyConfig); return children ? Object.assign({}, r, { children }) : Object.assign({}, r); } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @param {?} a * @param {?} b * @return {?} */ function shallowEqualArrays(a, b) { if (a.length !== b.length) return false; for (let /** @type {?} */ i = 0; i < a.length; ++i) { if (!shallowEqual(a[i], b[i])) return false; } return true; } /** * @param {?} a * @param {?} b * @return {?} */ function shallowEqual(a, b) { const /** @type {?} */ k1 = Object.keys(a); const /** @type {?} */ k2 = Object.keys(b); if (k1.length != k2.length) { return false; } let /** @type {?} */ key; for (let /** @type {?} */ i = 0; i < k1.length; i++) { key = k1[i]; if (a[key] !== b[key]) { return false; } } return true; } /** * Flattens single-level nested arrays. * @template T * @param {?} arr * @return {?} */ function flatten(arr) { return Array.prototype.concat.apply([], arr); } /** * Return the last element of an array. * @template T * @param {?} a * @return {?} */ function last$1(a) { return a.length > 0 ? a[a.length - 1] : null; } /** * Verifys all booleans in an array are `true`. * @param {?} bools * @return {?} */ /** * @template K, V * @param {?} map * @param {?} callback * @return {?} */ function forEach(map$$1, callback) { for (const /** @type {?} */ prop in map$$1) { if (map$$1.hasOwnProperty(prop)) { callback(map$$1[prop], prop); } } } /** * @template A, B * @param {?} obj * @param {?} fn * @return {?} */ function waitForMap(obj, fn) { if (Object.keys(obj).length === 0) { return Object(__WEBPACK_IMPORTED_MODULE_4_rxjs_observable_of__["a" /* of */])({}); } const /** @type {?} */ waitHead = []; const /** @type {?} */ waitTail = []; const /** @type {?} */ res = {}; forEach(obj, (a, k) => { const /** @type {?} */ mapped = __WEBPACK_IMPORTED_MODULE_6_rxjs_operator_map__["a" /* map */].call(fn(k, a), (r) => res[k] = r); if (k === PRIMARY_OUTLET) { waitHead.push(mapped); } else { waitTail.push(mapped); } }); const /** @type {?} */ concat$ = __WEBPACK_IMPORTED_MODULE_11_rxjs_operator_concatAll__["a" /* concatAll */].call(Object(__WEBPACK_IMPORTED_MODULE_4_rxjs_observable_of__["a" /* of */])(...waitHead, ...waitTail)); const /** @type {?} */ last$ = __WEBPACK_IMPORTED_MODULE_16_rxjs_operator_last__["a" /* last */].call(concat$); return __WEBPACK_IMPORTED_MODULE_6_rxjs_operator_map__["a" /* map */].call(last$, () => res); } /** * ANDs Observables by merging all input observables, reducing to an Observable verifying all * input Observables return `true`. * @param {?} observables * @return {?} */ function andObservables(observables) { const /** @type {?} */ merged$ = __WEBPACK_IMPORTED_MODULE_17_rxjs_operator_mergeAll__["a" /* mergeAll */].call(observables); return __WEBPACK_IMPORTED_MODULE_15_rxjs_operator_every__["a" /* every */].call(merged$, (result) => result === true); } /** * @template T * @param {?} value * @return {?} */ function wrapIntoObservable(value) { if (Object(__WEBPACK_IMPORTED_MODULE_1__angular_core__["ɵisObservable"])(value)) { return value; } if (Object(__WEBPACK_IMPORTED_MODULE_1__angular_core__["ɵisPromise"])(value)) { // Use `Promise.resolve()` to wrap promise-like instances. // Required ie when a Resolver returns a AngularJS `$q` promise to correctly trigger the // change detection. return Object(__WEBPACK_IMPORTED_MODULE_14_rxjs_observable_fromPromise__["a" /* fromPromise */])(Promise.resolve(value)); } return Object(__WEBPACK_IMPORTED_MODULE_4_rxjs_observable_of__["a" /* of */])(/** @type {?} */ (value)); } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @return {?} */ function createEmptyUrlTree() { return new UrlTree(new UrlSegmentGroup([], {}), {}, null); } /** * @param {?} container * @param {?} containee * @param {?} exact * @return {?} */ function containsTree(container, containee, exact) { if (exact) { return equalQueryParams(container.queryParams, containee.queryParams) && equalSegmentGroups(container.root, containee.root); } return containsQueryParams(container.queryParams, containee.queryParams) && containsSegmentGroup(container.root, containee.root); } /** * @param {?} container * @param {?} containee * @return {?} */ function equalQueryParams(container, containee) { return shallowEqual(container, containee); } /** * @param {?} container * @param {?} containee * @return {?} */ function equalSegmentGroups(container, containee) { if (!equalPath(container.segments, containee.segments)) return false; if (container.numberOfChildren !== containee.numberOfChildren) return false; for (const /** @type {?} */ c in containee.children) { if (!container.children[c]) return false; if (!equalSegmentGroups(container.children[c], containee.children[c])) return false; } return true; } /** * @param {?} container * @param {?} containee * @return {?} */ function containsQueryParams(container, containee) { return Object.keys(containee).length <= Object.keys(container).length && Object.keys(containee).every(key => containee[key] === container[key]); } /** * @param {?} container * @param {?} containee * @return {?} */ function containsSegmentGroup(container, containee) { return containsSegmentGroupHelper(container, containee, containee.segments); } /** * @param {?} container * @param {?} containee * @param {?} containeePaths * @return {?} */ function containsSegmentGroupHelper(container, containee, containeePaths) { if (container.segments.length > containeePaths.length) { const /** @type {?} */ current = container.segments.slice(0, containeePaths.length); if (!equalPath(current, containeePaths)) return false; if (containee.hasChildren()) return false; return true; } else if (container.segments.length === containeePaths.length) { if (!equalPath(container.segments, containeePaths)) return false; for (const /** @type {?} */ c in containee.children) { if (!container.children[c]) return false; if (!containsSegmentGroup(container.children[c], containee.children[c])) return false; } return true; } else { const /** @type {?} */ current = containeePaths.slice(0, container.segments.length); const /** @type {?} */ next = containeePaths.slice(container.segments.length); if (!equalPath(container.segments, current)) return false; if (!container.children[PRIMARY_OUTLET]) return false; return containsSegmentGroupHelper(container.children[PRIMARY_OUTLET], containee, next); } } /** * \@whatItDoes Represents the parsed URL. * * \@howToUse * * ``` * \@Component({templateUrl:'template.html'}) * class MyComponent { * constructor(router: Router) { * const tree: UrlTree = * router.parseUrl('/team/33/(user/victor//support:help)?debug=true#fragment'); * const f = tree.fragment; // return 'fragment' * const q = tree.queryParams; // returns {debug: 'true'} * const g: UrlSegmentGroup = tree.root.children[PRIMARY_OUTLET]; * const s: UrlSegment[] = g.segments; // returns 2 segments 'team' and '33' * g.children[PRIMARY_OUTLET].segments; // returns 2 segments 'user' and 'victor' * g.children['support'].segments; // return 1 segment 'help' * } * } * ``` * * \@description * * Since a router state is a tree, and the URL is nothing but a serialized state, the URL is a * serialized tree. * UrlTree is a data structure that provides a lot of affordances in dealing with URLs * * \@stable */ class UrlTree { /** * \@internal * @param {?} root * @param {?} queryParams * @param {?} fragment */ constructor(root, queryParams, fragment) { this.root = root; this.queryParams = queryParams; this.fragment = fragment; } /** * @return {?} */ get queryParamMap() { if (!this._queryParamMap) { this._queryParamMap = convertToParamMap(this.queryParams); } return this._queryParamMap; } /** * \@docsNotRequired * @return {?} */ toString() { return DEFAULT_SERIALIZER.serialize(this); } } /** * \@whatItDoes Represents the parsed URL segment group. * * See {\@link UrlTree} for more information. * * \@stable */ class UrlSegmentGroup { /** * @param {?} segments * @param {?} children */ constructor(segments, children) { this.segments = segments; this.children = children; /** * The parent node in the url tree */ this.parent = null; forEach(children, (v, k) => v.parent = this); } /** * Whether the segment has child segments * @return {?} */ hasChildren() { return this.numberOfChildren > 0; } /** * Number of child segments * @return {?} */ get numberOfChildren() { return Object.keys(this.children).length; } /** * \@docsNotRequired * @return {?} */ toString() { return serializePaths(this); } } /** * \@whatItDoes Represents a single URL segment. * * \@howToUse * * ``` * \@Component({templateUrl:'template.html'}) * class MyComponent { * constructor(router: Router) { * const tree: UrlTree = router.parseUrl('/team;id=33'); * const g: UrlSegmentGroup = tree.root.children[PRIMARY_OUTLET]; * const s: UrlSegment[] = g.segments; * s[0].path; // returns 'team' * s[0].parameters; // returns {id: 33} * } * } * ``` * * \@description * * A UrlSegment is a part of a URL between the two slashes. It contains a path and the matrix * parameters associated with the segment. * * \@stable */ class UrlSegment { /** * @param {?} path * @param {?} parameters */ constructor(path, parameters) { this.path = path; this.parameters = parameters; } /** * @return {?} */ get parameterMap() { if (!this._parameterMap) { this._parameterMap = convertToParamMap(this.parameters); } return this._parameterMap; } /** * \@docsNotRequired * @return {?} */ toString() { return serializePath(this); } } /** * @param {?} as * @param {?} bs * @return {?} */ function equalSegments(as, bs) { return equalPath(as, bs) && as.every((a, i) => shallowEqual(a.parameters, bs[i].parameters)); } /** * @param {?} as * @param {?} bs * @return {?} */ function equalPath(as, bs) { if (as.length !== bs.length) return false; return as.every((a, i) => a.path === bs[i].path); } /** * @template T * @param {?} segment * @param {?} fn * @return {?} */ function mapChildrenIntoArray(segment, fn) { let /** @type {?} */ res = []; forEach(segment.children, (child, childOutlet) => { if (childOutlet === PRIMARY_OUTLET) { res = res.concat(fn(child, childOutlet)); } }); forEach(segment.children, (child, childOutlet) => { if (childOutlet !== PRIMARY_OUTLET) { res = res.concat(fn(child, childOutlet)); } }); return res; } /** * \@whatItDoes Serializes and deserializes a URL string into a URL tree. * * \@description The url serialization strategy is customizable. You can * make all URLs case insensitive by providing a custom UrlSerializer. * * See {\@link DefaultUrlSerializer} for an example of a URL serializer. * * \@stable * @abstract */ class UrlSerializer { } /** * \@whatItDoes A default implementation of the {\@link UrlSerializer}. * * \@description * * Example URLs: * * ``` * /inbox/33(popup:compose) * /inbox/33;open=true/messages/44 * ``` * * DefaultUrlSerializer uses parentheses to serialize secondary segments (e.g., popup:compose), the * colon syntax to specify the outlet, and the ';parameter=value' syntax (e.g., open=true) to * specify route specific parameters. * * \@stable */ class DefaultUrlSerializer { /** * Parses a url into a {\@link UrlTree} * @param {?} url * @return {?} */ parse(url) { const /** @type {?} */ p = new UrlParser(url); return new UrlTree(p.parseRootSegment(), p.parseQueryParams(), p.parseFragment()); } /** * Converts a {\@link UrlTree} into a url * @param {?} tree * @return {?} */ serialize(tree) { const /** @type {?} */ segment = `/${serializeSegment(tree.root, true)}`; const /** @type {?} */ query = serializeQueryParams(tree.queryParams); const /** @type {?} */ fragment = typeof tree.fragment === `string` ? `#${encodeUriFragment((/** @type {?} */ ((tree.fragment))))}` : ''; return `${segment}${query}${fragment}`; } } const DEFAULT_SERIALIZER = new DefaultUrlSerializer(); /** * @param {?} segment * @return {?} */ function serializePaths(segment) { return segment.segments.map(p => serializePath(p)).join('/'); } /** * @param {?} segment * @param {?} root * @return {?} */ function serializeSegment(segment, root) { if (!segment.hasChildren()) { return serializePaths(segment); } if (root) { const /** @type {?} */ primary = segment.children[PRIMARY_OUTLET] ? serializeSegment(segment.children[PRIMARY_OUTLET], false) : ''; const /** @type {?} */ children = []; forEach(segment.children, (v, k) => { if (k !== PRIMARY_OUTLET) { children.push(`${k}:${serializeSegment(v, false)}`); } }); return children.length > 0 ? `${primary}(${children.join('//')})` : primary; } else { const /** @type {?} */ children = mapChildrenIntoArray(segment, (v, k) => { if (k === PRIMARY_OUTLET) { return [serializeSegment(segment.children[PRIMARY_OUTLET], false)]; } return [`${k}:${serializeSegment(v, false)}`]; }); return `${serializePaths(segment)}/(${children.join('//')})`; } } /** * Encodes a URI string with the default encoding. This function will only ever be called from * `encodeUriQuery` or `encodeUriSegment` as it's the base set of encodings to be used. We need * a custom encoding because encodeURIComponent is too aggressive and encodes stuff that doesn't * have to be encoded per https://url.spec.whatwg.org. * @param {?} s * @return {?} */ function encodeUriString(s) { return encodeURIComponent(s) .replace(/%40/g, '@') .replace(/%3A/gi, ':') .replace(/%24/g, '$') .replace(/%2C/gi, ','); } /** * This function should be used to encode both keys and values in a query string key/value. In * the following URL, you need to call encodeUriQuery on "k" and "v": * * http://www.site.org/html;mk=mv?k=v#f * @param {?} s * @return {?} */ function encodeUriQuery(s) { return encodeUriString(s).replace(/%3B/gi, ';'); } /** * This function should be used to encode a URL fragment. In the following URL, you need to call * encodeUriFragment on "f": * * http://www.site.org/html;mk=mv?k=v#f * @param {?} s * @return {?} */ function encodeUriFragment(s) { return encodeURI(s); } /** * This function should be run on any URI segment as well as the key and value in a key/value * pair for matrix params. In the following URL, you need to call encodeUriSegment on "html", * "mk", and "mv": * * http://www.site.org/html;mk=mv?k=v#f * @param {?} s * @return {?} */ function encodeUriSegment(s) { return encodeUriString(s).replace(/\(/g, '%28').replace(/\)/g, '%29').replace(/%26/gi, '&'); } /** * @param {?} s * @return {?} */ function decode(s) { return decodeURIComponent(s); } /** * @param {?} s * @return {?} */ function decodeQuery(s) { return decode(s.replace(/\+/g, '%20')); } /** * @param {?} path * @return {?} */ function serializePath(path) { return `${encodeUriSegment(path.path)}${serializeMatrixParams(path.parameters)}`; } /** * @param {?} params * @return {?} */ function serializeMatrixParams(params) { return Object.keys(params) .map(key => `;${encodeUriSegment(key)}=${encodeUriSegment(params[key])}`) .join(''); } /** * @param {?} params * @return {?} */ function serializeQueryParams(params) { const /** @type {?} */ strParams = Object.keys(params).map((name) => { const /** @type {?} */ value = params[name]; return Array.isArray(value) ? value.map(v => `${encodeUriQuery(name)}=${encodeUriQuery(v)}`).join('&') : `${encodeUriQuery(name)}=${encodeUriQuery(value)}`; }); return strParams.length ? `?${strParams.join("&")}` : ''; } const SEGMENT_RE = /^[^\/()?;=&#]+/; /** * @param {?} str * @return {?} */ function matchSegments(str) { const /** @type {?} */ match = str.match(SEGMENT_RE); return match ? match[0] : ''; } const QUERY_PARAM_RE = /^[^=?&#]+/; /** * @param {?} str * @return {?} */ function matchQueryParams(str) { const /** @type {?} */ match = str.match(QUERY_PARAM_RE); return match ? match[0] : ''; } const QUERY_PARAM_VALUE_RE = /^[^?&#]+/; /** * @param {?} str * @return {?} */ function matchUrlQueryParamValue(str) { const /** @type {?} */ match = str.match(QUERY_PARAM_VALUE_RE); return match ? match[0] : ''; } class UrlParser { /** * @param {?} url */ constructor(url) { this.url = url; this.remaining = url; } /** * @return {?} */ parseRootSegment() { this.consumeOptional('/'); if (this.remaining === '' || this.peekStartsWith('?') || this.peekStartsWith('#')) { return new UrlSegmentGroup([], {}); } // The root segment group never has segments return new UrlSegmentGroup([], this.parseChildren()); } /** * @return {?} */ parseQueryParams() { const /** @type {?} */ params = {}; if (this.consumeOptional('?')) { do { this.parseQueryParam(params); } while (this.consumeOptional('&')); } return params; } /** * @return {?} */ parseFragment() { return this.consumeOptional('#') ? decodeURIComponent(this.remaining) : null; } /** * @return {?} */ parseChildren() { if (this.remaining === '') { return {}; } this.consumeOptional('/'); const /** @type {?} */ segments = []; if (!this.peekStartsWith('(')) { segments.push(this.parseSegment()); } while (this.peekStartsWith('/') && !this.peekStartsWith('//') && !this.peekStartsWith('/(')) { this.capture('/'); segments.push(this.parseSegment()); } let /** @type {?} */ children = {}; if (this.peekStartsWith('/(')) { this.capture('/'); children = this.parseParens(true); } let /** @type {?} */ res = {}; if (this.peekStartsWith('(')) { res = this.parseParens(false); } if (segments.length > 0 || Object.keys(children).length > 0) { res[PRIMARY_OUTLET] = new UrlSegmentGroup(segments, children); } return res; } /** * @return {?} */ parseSegment() { const /** @type {?} */ path = matchSegments(this.remaining); if (path === '' && this.peekStartsWith(';')) { throw new Error(`Empty path url segment cannot have parameters: '${this.remaining}'.`); } this.capture(path); return new UrlSegment(decode(path), this.parseMatrixParams()); } /** * @return {?} */ parseMatrixParams() { const /** @type {?} */ params = {}; while (this.consumeOptional(';')) { this.parseParam(params); } return params; } /** * @param {?} params * @return {?} */ parseParam(params) { const /** @type {?} */ key = matchSegments(this.remaining); if (!key) { return; } this.capture(key); let /** @type {?} */ value = ''; if (this.consumeOptional('=')) { const /** @type {?} */ valueMatch = matchSegments(this.remaining); if (valueMatch) { value = valueMatch; this.capture(value); } } params[decode(key)] = decode(value); } /** * @param {?} params * @return {?} */ parseQueryParam(params) { const /** @type {?} */ key = matchQueryParams(this.remaining); if (!key) { return; } this.capture(key); let /** @type {?} */ value = ''; if (this.consumeOptional('=')) { const /** @type {?} */ valueMatch = matchUrlQueryParamValue(this.remaining); if (valueMatch) { value = valueMatch; this.capture(value); } } const /** @type {?} */ decodedKey = decodeQuery(key); const /** @type {?} */ decodedVal = decodeQuery(value); if (params.hasOwnProperty(decodedKey)) { // Append to existing values let /** @type {?} */ currentVal = params[decodedKey]; if (!Array.isArray(currentVal)) { currentVal = [currentVal]; params[decodedKey] = currentVal; } currentVal.push(decodedVal); } else { // Create a new value params[decodedKey] = decodedVal; } } /** * @param {?} allowPrimary * @return {?} */ parseParens(allowPrimary) { const /** @type {?} */ segments = {}; this.capture('('); while (!this.consumeOptional(')') && this.remaining.length > 0) { const /** @type {?} */ path = matchSegments(this.remaining); const /** @type {?} */ next = this.remaining[path.length]; // if is is not one of these characters, then the segment was unescaped // or the group was not closed if (next !== '/' && next !== ')' && next !== ';') { throw new Error(`Cannot parse url '${this.url}'`); } let /** @type {?} */ outletName = /** @type {?} */ ((undefined)); if (path.indexOf(':') > -1) { outletName = path.substr(0, path.indexOf(':')); this.capture(outletName); this.capture(':'); } else if (allowPrimary) { outletName = PRIMARY_OUTLET; } const /** @type {?} */ children = this.parseChildren(); segments[outletName] = Object.keys(children).length === 1 ? children[PRIMARY_OUTLET] : new UrlSegmentGroup([], children); this.consumeOptional('//'); } return segments; } /** * @param {?} str * @return {?} */ peekStartsWith(str) { return this.remaining.startsWith(str); } /** * @param {?} str * @return {?} */ consumeOptional(str) { if (this.peekStartsWith(str)) { this.remaining = this.remaining.substring(str.length); return true; } return false; } /** * @param {?} str * @return {?} */ capture(str) { if (!this.consumeOptional(str)) { throw new Error(`Expected "${str}".`); } } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ class NoMatch { /** * @param {?=} segmentGroup */ constructor(segmentGroup) { this.segmentGroup = segmentGroup || null; } } class AbsoluteRedirect { /** * @param {?} urlTree */ constructor(urlTree) { this.urlTree = urlTree; } } /** * @param {?} segmentGroup * @return {?} */ function noMatch(segmentGroup) { return new __WEBPACK_IMPORTED_MODULE_8_rxjs_Observable__["a" /* Observable */]((obs) => obs.error(new NoMatch(segmentGroup))); } /** * @param {?} newTree * @return {?} */ function absoluteRedirect(newTree) { return new __WEBPACK_IMPORTED_MODULE_8_rxjs_Observable__["a" /* Observable */]((obs) => obs.error(new AbsoluteRedirect(newTree))); } /** * @param {?} redirectTo * @return {?} */ function namedOutletsRedirect(redirectTo) { return new __WEBPACK_IMPORTED_MODULE_8_rxjs_Observable__["a" /* Observable */]((obs) => obs.error(new Error(`Only absolute redirects can have named outlets. redirectTo: '${redirectTo}'`))); } /** * @param {?} route * @return {?} */ function canLoadFails(route) { return new __WEBPACK_IMPORTED_MODULE_8_rxjs_Observable__["a" /* Observable */]((obs) => obs.error(navigationCancelingError(`Cannot load children because the guard of the route "path: '${route.path}'" returned false`))); } /** * Returns the `UrlTree` with the redirection applied. * * Lazy modules are loaded along the way. * @param {?} moduleInjector * @param {?} configLoader * @param {?} urlSerializer * @param {?} urlTree * @param {?} config * @return {?} */ function applyRedirects(moduleInjector, configLoader, urlSerializer, urlTree, config) { return new ApplyRedirects(moduleInjector, configLoader, urlSerializer, urlTree, config).apply(); } class ApplyRedirects { /** * @param {?} moduleInjector * @param {?} configLoader * @param {?} urlSerializer * @param {?} urlTree * @param {?} config */ constructor(moduleInjector, configLoader, urlSerializer, urlTree, config) { this.configLoader = configLoader; this.urlSerializer = urlSerializer; this.urlTree = urlTree; this.config = config; this.allowRedirects = true; this.ngModule = moduleInjector.get(__WEBPACK_IMPORTED_MODULE_1__angular_core__["NgModuleRef"]); } /** * @return {?} */ apply() { const /** @type {?} */ expanded$ = this.expandSegmentGroup(this.ngModule, this.config, this.urlTree.root, PRIMARY_OUTLET); const /** @type {?} */ urlTrees$ = __WEBPACK_IMPORTED_MODULE_6_rxjs_operator_map__["a" /* map */].call(expanded$, (rootSegmentGroup) => this.createUrlTree(rootSegmentGroup, this.urlTree.queryParams, /** @type {?} */ ((this.urlTree.fragment)))); return __WEBPACK_IMPORTED_MODULE_10_rxjs_operator_catch__["a" /* _catch */].call(urlTrees$, (e) => { if (e instanceof AbsoluteRedirect) { // after an absolute redirect we do not apply any more redirects! this.allowRedirects = false; // we need to run matching, so we can fetch all lazy-loaded modules return this.match(e.urlTree); } if (e instanceof NoMatch) { throw this.noMatchError(e); } throw e; }); } /** * @param {?} tree * @return {?} */ match(tree) { const /** @type {?} */ expanded$ = this.expandSegmentGroup(this.ngModule, this.config, tree.root, PRIMARY_OUTLET); const /** @type {?} */ mapped$ = __WEBPACK_IMPORTED_MODULE_6_rxjs_operator_map__["a" /* map */].call(expanded$, (rootSegmentGroup) => this.createUrlTree(rootSegmentGroup, tree.queryParams, /** @type {?} */ ((tree.fragment)))); return __WEBPACK_IMPORTED_MODULE_10_rxjs_operator_catch__["a" /* _catch */].call(mapped$, (e) => { if (e instanceof NoMatch) { throw this.noMatchError(e); } throw e; }); } /** * @param {?} e * @return {?} */ noMatchError(e) { return new Error(`Cannot match any routes. URL Segment: '${e.segmentGroup}'`); } /** * @param {?} rootCandidate * @param {?} queryParams * @param {?} fragment * @return {?} */ createUrlTree(rootCandidate, queryParams, fragment) { const /** @type {?} */ root = rootCandidate.segments.length > 0 ? new UrlSegmentGroup([], { [PRIMARY_OUTLET]: rootCandidate }) : rootCandidate; return new UrlTree(root, queryParams, fragment); } /** * @param {?} ngModule * @param {?} routes * @param {?} segmentGroup * @param {?} outlet * @return {?} */ expandSegmentGroup(ngModule, routes, segmentGroup, outlet) { if (segmentGroup.segments.length === 0 && segmentGroup.hasChildren()) { return __WEBPACK_IMPORTED_MODULE_6_rxjs_operator_map__["a" /* map */].call(this.expandChildren(ngModule, routes, segmentGroup), (children) => new UrlSegmentGroup([], children)); } return this.expandSegment(ngModule, segmentGroup, routes, segmentGroup.segments, outlet, true); } /** * @param {?} ngModule * @param {?} routes * @param {?} segmentGroup * @return {?} */ expandChildren(ngModule, routes, segmentGroup) { return waitForMap(segmentGroup.children, (childOutlet, child) => this.expandSegmentGroup(ngModule, routes, child, childOutlet)); } /** * @param {?} ngModule * @param {?} segmentGroup * @param {?} routes * @param {?} segments * @param {?} outlet * @param {?} allowRedirects * @return {?} */ expandSegment(ngModule, segmentGroup, routes, segments, outlet, allowRedirects) { const /** @type {?} */ routes$ = Object(__WEBPACK_IMPORTED_MODULE_4_rxjs_observable_of__["a" /* of */])(...routes); const /** @type {?} */ processedRoutes$ = __WEBPACK_IMPORTED_MODULE_6_rxjs_operator_map__["a" /* map */].call(routes$, (r) => { const /** @type {?} */ expanded$ = this.expandSegmentAgainstRoute(ngModule, segmentGroup, routes, r, segments, outlet, allowRedirects); return __WEBPACK_IMPORTED_MODULE_10_rxjs_operator_catch__["a" /* _catch */].call(expanded$, (e) => { if (e instanceof NoMatch) { return Object(__WEBPACK_IMPORTED_MODULE_4_rxjs_observable_of__["a" /* of */])(null); } throw e; }); }); const /** @type {?} */ concattedProcessedRoutes$ = __WEBPACK_IMPORTED_MODULE_11_rxjs_operator_concatAll__["a" /* concatAll */].call(processedRoutes$); const /** @type {?} */ first$ = __WEBPACK_IMPORTED_MODULE_12_rxjs_operator_first__["a" /* first */].call(concattedProcessedRoutes$, (s) => !!s); return __WEBPACK_IMPORTED_MODULE_10_rxjs_operator_catch__["a" /* _catch */].call(first$, (e, _) => { if (e instanceof __WEBPACK_IMPORTED_MODULE_13_rxjs_util_EmptyError__["a" /* EmptyError */] || e.name === 'EmptyError') { if (this.noLeftoversInUrl(segmentGroup, segments, outlet)) { return Object(__WEBPACK_IMPORTED_MODULE_4_rxjs_observable_of__["a" /* of */])(new UrlSegmentGroup([], {})); } throw new NoMatch(segmentGroup); } throw e; }); } /** * @param {?} segmentGroup * @param {?} segments * @param {?} outlet * @return {?} */ noLeftoversInUrl(segmentGroup, segments, outlet) { return segments.length === 0 && !segmentGroup.children[outlet]; } /** * @param {?} ngModule * @param {?} segmentGroup * @param {?} routes * @param {?} route * @param {?} paths * @param {?} outlet * @param {?} allowRedirects * @return {?} */ expandSegmentAgainstRoute(ngModule, segmentGroup, routes, route, paths, outlet, allowRedirects) { if (getOutlet(route) !== outlet) { return noMatch(segmentGroup); } if (route.redirectTo === undefined) { return this.matchSegmentAgainstRoute(ngModule, segmentGroup, route, paths); } if (allowRedirects && this.allowRedirects) { return this.expandSegmentAgainstRouteUsingRedirect(ngModule, segmentGroup, routes, route, paths, outlet); } return noMatch(segmentGroup); } /** * @param {?} ngModule * @param {?} segmentGroup * @param {?} routes * @param {?} route * @param {?} segments * @param {?} outlet * @return {?} */ expandSegmentAgainstRouteUsingRedirect(ngModule, segmentGroup, routes, route, segments, outlet) { if (route.path === '**') { return this.expandWildCardWithParamsAgainstRouteUsingRedirect(ngModule, routes, route, outlet); } return this.expandRegularSegmentAgainstRouteUsingRedirect(ngModule, segmentGroup, routes, route, segments, outlet); } /** * @param {?} ngModule * @param {?} routes * @param {?} route * @param {?} outlet * @return {?} */ expandWildCardWithParamsAgainstRouteUsingRedirect(ngModule, routes, route, outlet) { const /** @type {?} */ newTree = this.applyRedirectCommands([], /** @type {?} */ ((route.redirectTo)), {}); if (/** @type {?} */ ((route.redirectTo)).startsWith('/')) { return absoluteRedirect(newTree); } return __WEBPACK_IMPORTED_MODULE_7_rxjs_operator_mergeMap__["a" /* mergeMap */].call(this.lineralizeSegments(route, newTree), (newSegments) => { const /** @type {?} */ group = new UrlSegmentGroup(newSegments, {}); return this.expandSegment(ngModule, group, routes, newSegments, outlet, false); }); } /** * @param {?} ngModule * @param {?} segmentGroup * @param {?} routes * @param {?} route * @param {?} segments * @param {?} outlet * @return {?} */ expandRegularSegmentAgainstRouteUsingRedirect(ngModule, segmentGroup, routes, route, segments, outlet) { const { matched, consumedSegments, lastChild, positionalParamSegments } = match(segmentGroup, route, segments); if (!matched) return noMatch(segmentGroup); const /** @type {?} */ newTree = this.applyRedirectCommands(consumedSegments, /** @type {?} */ ((route.redirectTo)), /** @type {?} */ (positionalParamSegments)); if (/** @type {?} */ ((route.redirectTo)).startsWith('/')) { return absoluteRedirect(newTree); } return __WEBPACK_IMPORTED_MODULE_7_rxjs_operator_mergeMap__["a" /* mergeMap */].call(this.lineralizeSegments(route, newTree), (newSegments) => { return this.expandSegment(ngModule, segmentGroup, routes, newSegments.concat(segments.slice(lastChild)), outlet, false); }); } /** * @param {?} ngModule * @param {?} rawSegmentGroup * @param {?} route * @param {?} segments * @return {?} */ matchSegmentAgainstRoute(ngModule, rawSegmentGroup, route, segments) { if (route.path === '**') { if (route.loadChildren) { return __WEBPACK_IMPORTED_MODULE_6_rxjs_operator_map__["a" /* map */].call(this.configLoader.load(ngModule.injector, route), (cfg) => { route._loadedConfig = cfg; return new UrlSegmentGroup(segments, {}); }); } return Object(__WEBPACK_IMPORTED_MODULE_4_rxjs_observable_of__["a" /* of */])(new UrlSegmentGroup(segments, {})); } const { matched, consumedSegments, lastChild } = match(rawSegmentGroup, route, segments); if (!matched) return noMatch(rawSegmentGroup); const /** @type {?} */ rawSlicedSegments = segments.slice(lastChild); const /** @type {?} */ childConfig$ = this.getChildConfig(ngModule, route); return __WEBPACK_IMPORTED_MODULE_7_rxjs_operator_mergeMap__["a" /* mergeMap */].call(childConfig$, (routerConfig) => { const /** @type {?} */ childModule = routerConfig.module; const /** @type {?} */ childConfig = routerConfig.routes; const { segmentGroup, slicedSegments } = split(rawSegmentGroup, consumedSegments, rawSlicedSegments, childConfig); if (slicedSegments.length === 0 && segmentGroup.hasChildren()) { const /** @type {?} */ expanded$ = this.expandChildren(childModule, childConfig, segmentGroup); return __WEBPACK_IMPORTED_MODULE_6_rxjs_operator_map__["a" /* map */].call(expanded$, (children) => new UrlSegmentGroup(consumedSegments, children)); } if (childConfig.length === 0 && slicedSegments.length === 0) { return Object(__WEBPACK_IMPORTED_MODULE_4_rxjs_observable_of__["a" /* of */])(new UrlSegmentGroup(consumedSegments, {})); } const /** @type {?} */ expanded$ = this.expandSegment(childModule, segmentGroup, childConfig, slicedSegments, PRIMARY_OUTLET, true); return __WEBPACK_IMPORTED_MODULE_6_rxjs_operator_map__["a" /* map */].call(expanded$, (cs) => new UrlSegmentGroup(consumedSegments.concat(cs.segments), cs.children)); }); } /** * @param {?} ngModule * @param {?} route * @return {?} */ getChildConfig(ngModule, route) { if (route.children) { // The children belong to the same module return Object(__WEBPACK_IMPORTED_MODULE_4_rxjs_observable_of__["a" /* of */])(new LoadedRouterConfig(route.children, ngModule)); } if (route.loadChildren) { // lazy children belong to the loaded module if (route._loadedConfig !== undefined) { return Object(__WEBPACK_IMPORTED_MODULE_4_rxjs_observable_of__["a" /* of */])(route._loadedConfig); } return __WEBPACK_IMPORTED_MODULE_7_rxjs_operator_mergeMap__["a" /* mergeMap */].call(runCanLoadGuard(ngModule.injector, route), (shouldLoad) => { if (shouldLoad) { return __WEBPACK_IMPORTED_MODULE_6_rxjs_operator_map__["a" /* map */].call(this.configLoader.load(ngModule.injector, route), (cfg) => { route._loadedConfig = cfg; return cfg; }); } return canLoadFails(route); }); } return Object(__WEBPACK_IMPORTED_MODULE_4_rxjs_observable_of__["a" /* of */])(new LoadedRouterConfig([], ngModule)); } /** * @param {?} route * @param {?} urlTree * @return {?} */ lineralizeSegments(route, urlTree) { let /** @type {?} */ res = []; let /** @type {?} */ c = urlTree.root; while (true) { res = res.concat(c.segments); if (c.numberOfChildren === 0) { return Object(__WEBPACK_IMPORTED_MODULE_4_rxjs_observable_of__["a" /* of */])(res); } if (c.numberOfChildren > 1 || !c.children[PRIMARY_OUTLET]) { return namedOutletsRedirect(/** @type {?} */ ((route.redirectTo))); } c = c.children[PRIMARY_OUTLET]; } } /** * @param {?} segments * @param {?} redirectTo * @param {?} posParams * @return {?} */ applyRedirectCommands(segments, redirectTo, posParams) { return this.applyRedirectCreatreUrlTree(redirectTo, this.urlSerializer.parse(redirectTo), segments, posParams); } /** * @param {?} redirectTo * @param {?} urlTree * @param {?} segments * @param {?} posParams * @return {?} */ applyRedirectCreatreUrlTree(redirectTo, urlTree, segments, posParams) { const /** @type {?} */ newRoot = this.createSegmentGroup(redirectTo, urlTree.root, segments, posParams); return new UrlTree(newRoot, this.createQueryParams(urlTree.queryParams, this.urlTree.queryParams), urlTree.fragment); } /** * @param {?} redirectToParams * @param {?} actualParams * @return {?} */ createQueryParams(redirectToParams, actualParams) { const /** @type {?} */ res = {}; forEach(redirectToParams, (v, k) => { const /** @type {?} */ copySourceValue = typeof v === 'string' && v.startsWith(':'); if (copySourceValue) { const /** @type {?} */ sourceName = v.substring(1); res[k] = actualParams[sourceName]; } else { res[k] = v; } }); return res; } /** * @param {?} redirectTo * @param {?} group * @param {?} segments * @param {?} posParams * @return {?} */ createSegmentGroup(redirectTo, group, segments, posParams) { const /** @type {?} */ updatedSegments = this.createSegments(redirectTo, group.segments, segments, posParams); let /** @type {?} */ children = {}; forEach(group.children, (child, name) => { children[name] = this.createSegmentGroup(redirectTo, child, segments, posParams); }); return new UrlSegmentGroup(updatedSegments, children); } /** * @param {?} redirectTo * @param {?} redirectToSegments * @param {?} actualSegments * @param {?} posParams * @return {?} */ createSegments(redirectTo, redirectToSegments, actualSegments, posParams) { return redirectToSegments.map(s => s.path.startsWith(':') ? this.findPosParam(redirectTo, s, posParams) : this.findOrReturn(s, actualSegments)); } /** * @param {?} redirectTo * @param {?} redirectToUrlSegment * @param {?} posParams * @return {?} */ findPosParam(redirectTo, redirectToUrlSegment, posParams) { const /** @type {?} */ pos = posParams[redirectToUrlSegment.path.substring(1)]; if (!pos) throw new Error(`Cannot redirect to '${redirectTo}'. Cannot find '${redirectToUrlSegment.path}'.`); return pos; } /** * @param {?} redirectToUrlSegment * @param {?} actualSegments * @return {?} */ findOrReturn(redirectToUrlSegment, actualSegments) { let /** @type {?} */ idx = 0; for (const /** @type {?} */ s of actualSegments) { if (s.path === redirectToUrlSegment.path) { actualSegments.splice(idx); return s; } idx++; } return redirectToUrlSegment; } } /** * @param {?} moduleInjector * @param {?} route * @return {?} */ function runCanLoadGuard(moduleInjector, route) { const /** @type {?} */ canLoad = route.canLoad; if (!canLoad || canLoad.length === 0) return Object(__WEBPACK_IMPORTED_MODULE_4_rxjs_observable_of__["a" /* of */])(true); const /** @type {?} */ obs = __WEBPACK_IMPORTED_MODULE_6_rxjs_operator_map__["a" /* map */].call(Object(__WEBPACK_IMPORTED_MODULE_9_rxjs_observable_from__["a" /* from */])(canLoad), (injectionToken) => { const /** @type {?} */ guard = moduleInjector.get(injectionToken); return wrapIntoObservable(guard.canLoad ? guard.canLoad(route) : guard(route)); }); return andObservables(obs); } /** * @param {?} segmentGroup * @param {?} route * @param {?} segments * @return {?} */ function match(segmentGroup, route, segments) { if (route.path === '') { if ((route.pathMatch === 'full') && (segmentGroup.hasChildren() || segments.length > 0)) { return { matched: false, consumedSegments: [], lastChild: 0, positionalParamSegments: {} }; } return { matched: true, consumedSegments: [], lastChild: 0, positionalParamSegments: {} }; } const /** @type {?} */ matcher = route.matcher || defaultUrlMatcher; const /** @type {?} */ res = matcher(segments, segmentGroup, route); if (!res) { return { matched: false, consumedSegments: /** @type {?} */ ([]), lastChild: 0, positionalParamSegments: {}, }; } return { matched: true, consumedSegments: /** @type {?} */ ((res.consumed)), lastChild: /** @type {?} */ ((res.consumed.length)), positionalParamSegments: /** @type {?} */ ((res.posParams)), }; } /** * @param {?} segmentGroup * @param {?} consumedSegments * @param {?} slicedSegments * @param {?} config * @return {?} */ function split(segmentGroup, consumedSegments, slicedSegments, config) { if (slicedSegments.length > 0 && containsEmptyPathRedirectsWithNamedOutlets(segmentGroup, slicedSegments, config)) { const /** @type {?} */ s = new UrlSegmentGroup(consumedSegments, createChildrenForEmptySegments(config, new UrlSegmentGroup(slicedSegments, segmentGroup.children))); return { segmentGroup: mergeTrivialChildren(s), slicedSegments: [] }; } if (slicedSegments.length === 0 && containsEmptyPathRedirects(segmentGroup, slicedSegments, config)) { const /** @type {?} */ s = new UrlSegmentGroup(segmentGroup.segments, addEmptySegmentsToChildrenIfNeeded(segmentGroup, slicedSegments, config, segmentGroup.children)); return { segmentGroup: mergeTrivialChildren(s), slicedSegments }; } return { segmentGroup, slicedSegments }; } /** * @param {?} s * @return {?} */ function mergeTrivialChildren(s) { if (s.numberOfChildren === 1 && s.children[PRIMARY_OUTLET]) { const /** @type {?} */ c = s.children[PRIMARY_OUTLET]; return new UrlSegmentGroup(s.segments.concat(c.segments), c.children); } return s; } /** * @param {?} segmentGroup * @param {?} slicedSegments * @param {?} routes * @param {?} children * @return {?} */ function addEmptySegmentsToChildrenIfNeeded(segmentGroup, slicedSegments, routes, children) { const /** @type {?} */ res = {}; for (const /** @type {?} */ r of routes) { if (isEmptyPathRedirect(segmentGroup, slicedSegments, r) && !children[getOutlet(r)]) { res[getOutlet(r)] = new UrlSegmentGroup([], {}); } } return Object.assign({}, children, res); } /** * @param {?} routes * @param {?} primarySegmentGroup * @return {?} */ function createChildrenForEmptySegments(routes, primarySegmentGroup) { const /** @type {?} */ res = {}; res[PRIMARY_OUTLET] = primarySegmentGroup; for (const /** @type {?} */ r of routes) { if (r.path === '' && getOutlet(r) !== PRIMARY_OUTLET) { res[getOutlet(r)] = new UrlSegmentGroup([], {}); } } return res; } /** * @param {?} segmentGroup * @param {?} segments * @param {?} routes * @return {?} */ function containsEmptyPathRedirectsWithNamedOutlets(segmentGroup, segments, routes) { return routes.some(r => isEmptyPathRedirect(segmentGroup, segments, r) && getOutlet(r) !== PRIMARY_OUTLET); } /** * @param {?} segmentGroup * @param {?} segments * @param {?} routes * @return {?} */ function containsEmptyPathRedirects(segmentGroup, segments, routes) { return routes.some(r => isEmptyPathRedirect(segmentGroup, segments, r)); } /** * @param {?} segmentGroup * @param {?} segments * @param {?} r * @return {?} */ function isEmptyPathRedirect(segmentGroup, segments, r) { if ((segmentGroup.hasChildren() || segments.length > 0) && r.pathMatch === 'full') { return false; } return r.path === '' && r.redirectTo !== undefined; } /** * @param {?} route * @return {?} */ function getOutlet(route) { return route.outlet || PRIMARY_OUTLET; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @template T */ class Tree { /** * @param {?} root */ constructor(root) { this._root = root; } /** * @return {?} */ get root() { return this._root.value; } /** * \@internal * @param {?} t * @return {?} */ parent(t) { const /** @type {?} */ p = this.pathFromRoot(t); return p.length > 1 ? p[p.length - 2] : null; } /** * \@internal * @param {?} t * @return {?} */ children(t) { const /** @type {?} */ n = findNode(t, this._root); return n ? n.children.map(t => t.value) : []; } /** * \@internal * @param {?} t * @return {?} */ firstChild(t) { const /** @type {?} */ n = findNode(t, this._root); return n && n.children.length > 0 ? n.children[0].value : null; } /** * \@internal * @param {?} t * @return {?} */ siblings(t) { const /** @type {?} */ p = findPath(t, this._root); if (p.length < 2) return []; const /** @type {?} */ c = p[p.length - 2].children.map(c => c.value); return c.filter(cc => cc !== t); } /** * \@internal * @param {?} t * @return {?} */ pathFromRoot(t) { return findPath(t, this._root).map(s => s.value); } } /** * @template T * @param {?} value * @param {?} node * @return {?} */ function findNode(value, node) { if (value === node.value) return node; for (const /** @type {?} */ child of node.children) { const /** @type {?} */ node = findNode(value, child); if (node) return node; } return null; } /** * @template T * @param {?} value * @param {?} node * @return {?} */ function findPath(value, node) { if (value === node.value) return [node]; for (const /** @type {?} */ child of node.children) { const /** @type {?} */ path = findPath(value, child); if (path.length) { path.unshift(node); return path; } } return []; } /** * @template T */ class TreeNode { /** * @param {?} value * @param {?} children */ constructor(value, children) { this.value = value; this.children = children; } /** * @return {?} */ toString() { return `TreeNode(${this.value})`; } } /** * @template T * @param {?} node * @return {?} */ function nodeChildrenAsMap(node) { const /** @type {?} */ map$$1 = {}; if (node) { node.children.forEach(child => map$$1[child.value.outlet] = child); } return map$$1; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * \@whatItDoes Represents the state of the router. * * \@howToUse * * ``` * \@Component({templateUrl:'template.html'}) * class MyComponent { * constructor(router: Router) { * const state: RouterState = router.routerState; * const root: ActivatedRoute = state.root; * const child = root.firstChild; * const id: Observable<string> = child.params.map(p => p.id); * //... * } * } * ``` * * \@description * RouterState is a tree of activated routes. Every node in this tree knows about the "consumed" URL * segments, the extracted parameters, and the resolved data. * * See {\@link ActivatedRoute} for more information. * * \@stable */ class RouterState extends Tree { /** * \@internal * @param {?} root * @param {?} snapshot */ constructor(root, snapshot) { super(root); this.snapshot = snapshot; setRouterState(/** @type {?} */ (this), root); } /** * @return {?} */ toString() { return this.snapshot.toString(); } } /** * @param {?} urlTree * @param {?} rootComponent * @return {?} */ function createEmptyState(urlTree, rootComponent) { const /** @type {?} */ snapshot = createEmptyStateSnapshot(urlTree, rootComponent); const /** @type {?} */ emptyUrl = new __WEBPACK_IMPORTED_MODULE_2_rxjs_BehaviorSubject__["BehaviorSubject"]([new UrlSegment('', {})]); const /** @type {?} */ emptyParams = new __WEBPACK_IMPORTED_MODULE_2_rxjs_BehaviorSubject__["BehaviorSubject"]({}); const /** @type {?} */ emptyData = new __WEBPACK_IMPORTED_MODULE_2_rxjs_BehaviorSubject__["BehaviorSubject"]({}); const /** @type {?} */ emptyQueryParams = new __WEBPACK_IMPORTED_MODULE_2_rxjs_BehaviorSubject__["BehaviorSubject"]({}); const /** @type {?} */ fragment = new __WEBPACK_IMPORTED_MODULE_2_rxjs_BehaviorSubject__["BehaviorSubject"](''); const /** @type {?} */ activated = new ActivatedRoute(emptyUrl, emptyParams, emptyQueryParams, fragment, emptyData, PRIMARY_OUTLET, rootComponent, snapshot.root); activated.snapshot = snapshot.root; return new RouterState(new TreeNode(activated, []), snapshot); } /** * @param {?} urlTree * @param {?} rootComponent * @return {?} */ function createEmptyStateSnapshot(urlTree, rootComponent) { const /** @type {?} */ emptyParams = {}; const /** @type {?} */ emptyData = {}; const /** @type {?} */ emptyQueryParams = {}; const /** @type {?} */ fragment = ''; const /** @type {?} */ activated = new ActivatedRouteSnapshot([], emptyParams, emptyQueryParams, fragment, emptyData, PRIMARY_OUTLET, rootComponent, null, urlTree.root, -1, {}); return new RouterStateSnapshot('', new TreeNode(activated, [])); } /** * \@whatItDoes Contains the information about a route associated with a component loaded in an * outlet. * An `ActivatedRoute` can also be used to traverse the router state tree. * * \@howToUse * * ``` * \@Component({...}) * class MyComponent { * constructor(route: ActivatedRoute) { * const id: Observable<string> = route.params.map(p => p.id); * const url: Observable<string> = route.url.map(segments => segments.join('')); * // route.data includes both `data` and `resolve` * const user = route.data.map(d => d.user); * } * } * ``` * * \@stable */ class ActivatedRoute { /** * \@internal * @param {?} url * @param {?} params * @param {?} queryParams * @param {?} fragment * @param {?} data * @param {?} outlet * @param {?} component * @param {?} futureSnapshot */ constructor(url, params, queryParams, fragment, data, outlet, component, futureSnapshot) { this.url = url; this.params = params; this.queryParams = queryParams; this.fragment = fragment; this.data = data; this.outlet = outlet; this.component = component; this._futureSnapshot = futureSnapshot; } /** * The configuration used to match this route * @return {?} */ get routeConfig() { return this._futureSnapshot.routeConfig; } /** * The root of the router state * @return {?} */ get root() { return this._routerState.root; } /** * The parent of this route in the router state tree * @return {?} */ get parent() { return this._routerState.parent(this); } /** * The first child of this route in the router state tree * @return {?} */ get firstChild() { return this._routerState.firstChild(this); } /** * The children of this route in the router state tree * @return {?} */ get children() { return this._routerState.children(this); } /** * The path from the root of the router state tree to this route * @return {?} */ get pathFromRoot() { return this._routerState.pathFromRoot(this); } /** * @return {?} */ get paramMap() { if (!this._paramMap) { this._paramMap = __WEBPACK_IMPORTED_MODULE_6_rxjs_operator_map__["a" /* map */].call(this.params, (p) => convertToParamMap(p)); } return this._paramMap; } /** * @return {?} */ get queryParamMap() { if (!this._queryParamMap) { this._queryParamMap = __WEBPACK_IMPORTED_MODULE_6_rxjs_operator_map__["a" /* map */].call(this.queryParams, (p) => convertToParamMap(p)); } return this._queryParamMap; } /** * @return {?} */ toString() { return this.snapshot ? this.snapshot.toString() : `Future(${this._futureSnapshot})`; } } /** * Returns the inherited params, data, and resolve for a given route. * By default, this only inherits values up to the nearest path-less or component-less route. * \@internal * @param {?} route * @param {?=} paramsInheritanceStrategy * @return {?} */ function inheritedParamsDataResolve(route, paramsInheritanceStrategy = 'emptyOnly') { const /** @type {?} */ pathFromRoot = route.pathFromRoot; let /** @type {?} */ inheritingStartingFrom = 0; if (paramsInheritanceStrategy !== 'always') { inheritingStartingFrom = pathFromRoot.length - 1; while (inheritingStartingFrom >= 1) { const /** @type {?} */ current = pathFromRoot[inheritingStartingFrom]; const /** @type {?} */ parent = pathFromRoot[inheritingStartingFrom - 1]; // current route is an empty path => inherits its parent's params and data if (current.routeConfig && current.routeConfig.path === '') { inheritingStartingFrom--; // parent is componentless => current route should inherit its params and data } else if (!parent.component) { inheritingStartingFrom--; } else { break; } } } return flattenInherited(pathFromRoot.slice(inheritingStartingFrom)); } /** * \@internal * @param {?} pathFromRoot * @return {?} */ function flattenInherited(pathFromRoot) { return pathFromRoot.reduce((res, curr) => { const /** @type {?} */ params = Object.assign({}, res.params, curr.params); const /** @type {?} */ data = Object.assign({}, res.data, curr.data); const /** @type {?} */ resolve = Object.assign({}, res.resolve, curr._resolvedData); return { params, data, resolve }; }, /** @type {?} */ ({ params: {}, data: {}, resolve: {} })); } /** * \@whatItDoes Contains the information about a route associated with a component loaded in an * outlet * at a particular moment in time. ActivatedRouteSnapshot can also be used to traverse the router * state tree. * * \@howToUse * * ``` * \@Component({templateUrl:'./my-component.html'}) * class MyComponent { * constructor(route: ActivatedRoute) { * const id: string = route.snapshot.params.id; * const url: string = route.snapshot.url.join(''); * const user = route.snapshot.data.user; * } * } * ``` * * \@stable */ class ActivatedRouteSnapshot { /** * \@internal * @param {?} url * @param {?} params * @param {?} queryParams * @param {?} fragment * @param {?} data * @param {?} outlet * @param {?} component * @param {?} routeConfig * @param {?} urlSegment * @param {?} lastPathIndex * @param {?} resolve */ constructor(url, params, queryParams, fragment, data, outlet, component, routeConfig, urlSegment, lastPathIndex, resolve) { this.url = url; this.params = params; this.queryParams = queryParams; this.fragment = fragment; this.data = data; this.outlet = outlet; this.component = component; this.routeConfig = routeConfig; this._urlSegment = urlSegment; this._lastPathIndex = lastPathIndex; this._resolve = resolve; } /** * The root of the router state * @return {?} */ get root() { return this._routerState.root; } /** * The parent of this route in the router state tree * @return {?} */ get parent() { return this._routerState.parent(this); } /** * The first child of this route in the router state tree * @return {?} */ get firstChild() { return this._routerState.firstChild(this); } /** * The children of this route in the router state tree * @return {?} */ get children() { return this._routerState.children(this); } /** * The path from the root of the router state tree to this route * @return {?} */ get pathFromRoot() { return this._routerState.pathFromRoot(this); } /** * @return {?} */ get paramMap() { if (!this._paramMap) { this._paramMap = convertToParamMap(this.params); } return this._paramMap; } /** * @return {?} */ get queryParamMap() { if (!this._queryParamMap) { this._queryParamMap = convertToParamMap(this.queryParams); } return this._queryParamMap; } /** * @return {?} */ toString() { const /** @type {?} */ url = this.url.map(segment => segment.toString()).join('/'); const /** @type {?} */ matched = this.routeConfig ? this.routeConfig.path : ''; return `Route(url:'${url}', path:'${matched}')`; } } /** * \@whatItDoes Represents the state of the router at a moment in time. * * \@howToUse * * ``` * \@Component({templateUrl:'template.html'}) * class MyComponent { * constructor(router: Router) { * const state: RouterState = router.routerState; * const snapshot: RouterStateSnapshot = state.snapshot; * const root: ActivatedRouteSnapshot = snapshot.root; * const child = root.firstChild; * const id: Observable<string> = child.params.map(p => p.id); * //... * } * } * ``` * * \@description * RouterStateSnapshot is a tree of activated route snapshots. Every node in this tree knows about * the "consumed" URL segments, the extracted parameters, and the resolved data. * * \@stable */ class RouterStateSnapshot extends Tree { /** * \@internal * @param {?} url * @param {?} root */ constructor(url, root) { super(root); this.url = url; setRouterState(/** @type {?} */ (this), root); } /** * @return {?} */ toString() { return serializeNode(this._root); } } /** * @template U, T * @param {?} state * @param {?} node * @return {?} */ function setRouterState(state, node) { node.value._routerState = state; node.children.forEach(c => setRouterState(state, c)); } /** * @param {?} node * @return {?} */ function serializeNode(node) { const /** @type {?} */ c = node.children.length > 0 ? ` { ${node.children.map(serializeNode).join(', ')} } ` : ''; return `${node.value}${c}`; } /** * The expectation is that the activate route is created with the right set of parameters. * So we push new values into the observables only when they are not the initial values. * And we detect that by checking if the snapshot field is set. * @param {?} route * @return {?} */ function advanceActivatedRoute(route) { if (route.snapshot) { const /** @type {?} */ currentSnapshot = route.snapshot; const /** @type {?} */ nextSnapshot = route._futureSnapshot; route.snapshot = nextSnapshot; if (!shallowEqual(currentSnapshot.queryParams, nextSnapshot.queryParams)) { (/** @type {?} */ (route.queryParams)).next(nextSnapshot.queryParams); } if (currentSnapshot.fragment !== nextSnapshot.fragment) { (/** @type {?} */ (route.fragment)).next(nextSnapshot.fragment); } if (!shallowEqual(currentSnapshot.params, nextSnapshot.params)) { (/** @type {?} */ (route.params)).next(nextSnapshot.params); } if (!shallowEqualArrays(currentSnapshot.url, nextSnapshot.url)) { (/** @type {?} */ (route.url)).next(nextSnapshot.url); } if (!shallowEqual(currentSnapshot.data, nextSnapshot.data)) { (/** @type {?} */ (route.data)).next(nextSnapshot.data); } } else { route.snapshot = route._futureSnapshot; // this is for resolved data (/** @type {?} */ (route.data)).next(route._futureSnapshot.data); } } /** * @param {?} a * @param {?} b * @return {?} */ function equalParamsAndUrlSegments(a, b) { const /** @type {?} */ equalUrlParams = shallowEqual(a.params, b.params) && equalSegments(a.url, b.url); const /** @type {?} */ parentsMismatch = !a.parent !== !b.parent; return equalUrlParams && !parentsMismatch && (!a.parent || equalParamsAndUrlSegments(a.parent, /** @type {?} */ ((b.parent)))); } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @param {?} routeReuseStrategy * @param {?} curr * @param {?} prevState * @return {?} */ function createRouterState(routeReuseStrategy, curr, prevState) { const /** @type {?} */ root = createNode(routeReuseStrategy, curr._root, prevState ? prevState._root : undefined); return new RouterState(root, curr); } /** * @param {?} routeReuseStrategy * @param {?} curr * @param {?=} prevState * @return {?} */ function createNode(routeReuseStrategy, curr, prevState) { // reuse an activated route that is currently displayed on the screen if (prevState && routeReuseStrategy.shouldReuseRoute(curr.value, prevState.value.snapshot)) { const /** @type {?} */ value = prevState.value; value._futureSnapshot = curr.value; const /** @type {?} */ children = createOrReuseChildren(routeReuseStrategy, curr, prevState); return new TreeNode(value, children); // retrieve an activated route that is used to be displayed, but is not currently displayed } else if (routeReuseStrategy.retrieve(curr.value)) { const /** @type {?} */ tree = (/** @type {?} */ (routeReuseStrategy.retrieve(curr.value))).route; setFutureSnapshotsOfActivatedRoutes(curr, tree); return tree; } else { const /** @type {?} */ value = createActivatedRoute(curr.value); const /** @type {?} */ children = curr.children.map(c => createNode(routeReuseStrategy, c)); return new TreeNode(value, children); } } /** * @param {?} curr * @param {?} result * @return {?} */ function setFutureSnapshotsOfActivatedRoutes(curr, result) { if (curr.value.routeConfig !== result.value.routeConfig) { throw new Error('Cannot reattach ActivatedRouteSnapshot created from a different route'); } if (curr.children.length !== result.children.length) { throw new Error('Cannot reattach ActivatedRouteSnapshot with a different number of children'); } result.value._futureSnapshot = curr.value; for (let /** @type {?} */ i = 0; i < curr.children.length; ++i) { setFutureSnapshotsOfActivatedRoutes(curr.children[i], result.children[i]); } } /** * @param {?} routeReuseStrategy * @param {?} curr * @param {?} prevState * @return {?} */ function createOrReuseChildren(routeReuseStrategy, curr, prevState) { return curr.children.map(child => { for (const /** @type {?} */ p of prevState.children) { if (routeReuseStrategy.shouldReuseRoute(p.value.snapshot, child.value)) { return createNode(routeReuseStrategy, child, p); } } return createNode(routeReuseStrategy, child); }); } /** * @param {?} c * @return {?} */ function createActivatedRoute(c) { return new ActivatedRoute(new __WEBPACK_IMPORTED_MODULE_2_rxjs_BehaviorSubject__["BehaviorSubject"](c.url), new __WEBPACK_IMPORTED_MODULE_2_rxjs_BehaviorSubject__["BehaviorSubject"](c.params), new __WEBPACK_IMPORTED_MODULE_2_rxjs_BehaviorSubject__["BehaviorSubject"](c.queryParams), new __WEBPACK_IMPORTED_MODULE_2_rxjs_BehaviorSubject__["BehaviorSubject"](c.fragment), new __WEBPACK_IMPORTED_MODULE_2_rxjs_BehaviorSubject__["BehaviorSubject"](c.data), c.outlet, c.component, c); } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @param {?} route * @param {?} urlTree * @param {?} commands * @param {?} queryParams * @param {?} fragment * @return {?} */ function createUrlTree(route, urlTree, commands, queryParams, fragment) { if (commands.length === 0) { return tree(urlTree.root, urlTree.root, urlTree, queryParams, fragment); } const /** @type {?} */ nav = computeNavigation(commands); if (nav.toRoot()) { return tree(urlTree.root, new UrlSegmentGroup([], {}), urlTree, queryParams, fragment); } const /** @type {?} */ startingPosition = findStartingPosition(nav, urlTree, route); const /** @type {?} */ segmentGroup = startingPosition.processChildren ? updateSegmentGroupChildren(startingPosition.segmentGroup, startingPosition.index, nav.commands) : updateSegmentGroup(startingPosition.segmentGroup, startingPosition.index, nav.commands); return tree(startingPosition.segmentGroup, segmentGroup, urlTree, queryParams, fragment); } /** * @param {?} command * @return {?} */ function isMatrixParams(command) { return typeof command === 'object' && command != null && !command.outlets && !command.segmentPath; } /** * @param {?} oldSegmentGroup * @param {?} newSegmentGroup * @param {?} urlTree * @param {?} queryParams * @param {?} fragment * @return {?} */ function tree(oldSegmentGroup, newSegmentGroup, urlTree, queryParams, fragment) { let /** @type {?} */ qp = {}; if (queryParams) { forEach(queryParams, (value, name) => { qp[name] = Array.isArray(value) ? value.map((v) => `${v}`) : `${value}`; }); } if (urlTree.root === oldSegmentGroup) { return new UrlTree(newSegmentGroup, qp, fragment); } return new UrlTree(replaceSegment(urlTree.root, oldSegmentGroup, newSegmentGroup), qp, fragment); } /** * @param {?} current * @param {?} oldSegment * @param {?} newSegment * @return {?} */ function replaceSegment(current, oldSegment, newSegment) { const /** @type {?} */ children = {}; forEach(current.children, (c, outletName) => { if (c === oldSegment) { children[outletName] = newSegment; } else { children[outletName] = replaceSegment(c, oldSegment, newSegment); } }); return new UrlSegmentGroup(current.segments, children); } class Navigation { /** * @param {?} isAbsolute * @param {?} numberOfDoubleDots * @param {?} commands */ constructor(isAbsolute, numberOfDoubleDots, commands) { this.isAbsolute = isAbsolute; this.numberOfDoubleDots = numberOfDoubleDots; this.commands = commands; if (isAbsolute && commands.length > 0 && isMatrixParams(commands[0])) { throw new Error('Root segment cannot have matrix parameters'); } const /** @type {?} */ cmdWithOutlet = commands.find(c => typeof c === 'object' && c != null && c.outlets); if (cmdWithOutlet && cmdWithOutlet !== last$1(commands)) { throw new Error('{outlets:{}} has to be the last command'); } } /** * @return {?} */ toRoot() { return this.isAbsolute && this.commands.length === 1 && this.commands[0] == '/'; } } /** * Transforms commands to a normalized `Navigation` * @param {?} commands * @return {?} */ function computeNavigation(commands) { if ((typeof commands[0] === 'string') && commands.length === 1 && commands[0] === '/') { return new Navigation(true, 0, commands); } let /** @type {?} */ numberOfDoubleDots = 0; let /** @type {?} */ isAbsolute = false; const /** @type {?} */ res = commands.reduce((res, cmd, cmdIdx) => { if (typeof cmd === 'object' && cmd != null) { if (cmd.outlets) { const /** @type {?} */ outlets = {}; forEach(cmd.outlets, (commands, name) => { outlets[name] = typeof commands === 'string' ? commands.split('/') : commands; }); return [...res, { outlets }]; } if (cmd.segmentPath) { return [...res, cmd.segmentPath]; } } if (!(typeof cmd === 'string')) { return [...res, cmd]; } if (cmdIdx === 0) { cmd.split('/').forEach((urlPart, partIndex) => { if (partIndex == 0 && urlPart === '.') { // skip './a' } else if (partIndex == 0 && urlPart === '') { // '/a' isAbsolute = true; } else if (urlPart === '..') { // '../a' numberOfDoubleDots++; } else if (urlPart != '') { res.push(urlPart); } }); return res; } return [...res, cmd]; }, []); return new Navigation(isAbsolute, numberOfDoubleDots, res); } class Position { /** * @param {?} segmentGroup * @param {?} processChildren * @param {?} index */ constructor(segmentGroup, processChildren, index) { this.segmentGroup = segmentGroup; this.processChildren = processChildren; this.index = index; } } /** * @param {?} nav * @param {?} tree * @param {?} route * @return {?} */ function findStartingPosition(nav, tree, route) { if (nav.isAbsolute) { return new Position(tree.root, true, 0); } if (route.snapshot._lastPathIndex === -1) { return new Position(route.snapshot._urlSegment, true, 0); } const /** @type {?} */ modifier = isMatrixParams(nav.commands[0]) ? 0 : 1; const /** @type {?} */ index = route.snapshot._lastPathIndex + modifier; return createPositionApplyingDoubleDots(route.snapshot._urlSegment, index, nav.numberOfDoubleDots); } /** * @param {?} group * @param {?} index * @param {?} numberOfDoubleDots * @return {?} */ function createPositionApplyingDoubleDots(group, index, numberOfDoubleDots) { let /** @type {?} */ g = group; let /** @type {?} */ ci = index; let /** @type {?} */ dd = numberOfDoubleDots; while (dd > ci) { dd -= ci; g = /** @type {?} */ ((g.parent)); if (!g) { throw new Error('Invalid number of \'../\''); } ci = g.segments.length; } return new Position(g, false, ci - dd); } /** * @param {?} command * @return {?} */ function getPath(command) { if (typeof command === 'object' && command != null && command.outlets) { return command.outlets[PRIMARY_OUTLET]; } return `${command}`; } /** * @param {?} commands * @return {?} */ function getOutlets(commands) { if (!(typeof commands[0] === 'object')) return { [PRIMARY_OUTLET]: commands }; if (commands[0].outlets === undefined) return { [PRIMARY_OUTLET]: commands }; return commands[0].outlets; } /** * @param {?} segmentGroup * @param {?} startIndex * @param {?} commands * @return {?} */ function updateSegmentGroup(segmentGroup, startIndex, commands) { if (!segmentGroup) { segmentGroup = new UrlSegmentGroup([], {}); } if (segmentGroup.segments.length === 0 && segmentGroup.hasChildren()) { return updateSegmentGroupChildren(segmentGroup, startIndex, commands); } const /** @type {?} */ m = prefixedWith(segmentGroup, startIndex, commands); const /** @type {?} */ slicedCommands = commands.slice(m.commandIndex); if (m.match && m.pathIndex < segmentGroup.segments.length) { const /** @type {?} */ g = new UrlSegmentGroup(segmentGroup.segments.slice(0, m.pathIndex), {}); g.children[PRIMARY_OUTLET] = new UrlSegmentGroup(segmentGroup.segments.slice(m.pathIndex), segmentGroup.children); return updateSegmentGroupChildren(g, 0, slicedCommands); } else if (m.match && slicedCommands.length === 0) { return new UrlSegmentGroup(segmentGroup.segments, {}); } else if (m.match && !segmentGroup.hasChildren()) { return createNewSegmentGroup(segmentGroup, startIndex, commands); } else if (m.match) { return updateSegmentGroupChildren(segmentGroup, 0, slicedCommands); } else { return createNewSegmentGroup(segmentGroup, startIndex, commands); } } /** * @param {?} segmentGroup * @param {?} startIndex * @param {?} commands * @return {?} */ function updateSegmentGroupChildren(segmentGroup, startIndex, commands) { if (commands.length === 0) { return new UrlSegmentGroup(segmentGroup.segments, {}); } else { const /** @type {?} */ outlets = getOutlets(commands); const /** @type {?} */ children = {}; forEach(outlets, (commands, outlet) => { if (commands !== null) { children[outlet] = updateSegmentGroup(segmentGroup.children[outlet], startIndex, commands); } }); forEach(segmentGroup.children, (child, childOutlet) => { if (outlets[childOutlet] === undefined) { children[childOutlet] = child; } }); return new UrlSegmentGroup(segmentGroup.segments, children); } } /** * @param {?} segmentGroup * @param {?} startIndex * @param {?} commands * @return {?} */ function prefixedWith(segmentGroup, startIndex, commands) { let /** @type {?} */ currentCommandIndex = 0; let /** @type {?} */ currentPathIndex = startIndex; const /** @type {?} */ noMatch = { match: false, pathIndex: 0, commandIndex: 0 }; while (currentPathIndex < segmentGroup.segments.length) { if (currentCommandIndex >= commands.length) return noMatch; const /** @type {?} */ path = segmentGroup.segments[currentPathIndex]; const /** @type {?} */ curr = getPath(commands[currentCommandIndex]); const /** @type {?} */ next = currentCommandIndex < commands.length - 1 ? commands[currentCommandIndex + 1] : null; if (currentPathIndex > 0 && curr === undefined) break; if (curr && next && (typeof next === 'object') && next.outlets === undefined) { if (!compare(curr, next, path)) return noMatch; currentCommandIndex += 2; } else { if (!compare(curr, {}, path)) return noMatch; currentCommandIndex++; } currentPathIndex++; } return { match: true, pathIndex: currentPathIndex, commandIndex: currentCommandIndex }; } /** * @param {?} segmentGroup * @param {?} startIndex * @param {?} commands * @return {?} */ function createNewSegmentGroup(segmentGroup, startIndex, commands) { const /** @type {?} */ paths = segmentGroup.segments.slice(0, startIndex); let /** @type {?} */ i = 0; while (i < commands.length) { if (typeof commands[i] === 'object' && commands[i].outlets !== undefined) { const /** @type {?} */ children = createNewSegmentChildren(commands[i].outlets); return new UrlSegmentGroup(paths, children); } // if we start with an object literal, we need to reuse the path part from the segment if (i === 0 && isMatrixParams(commands[0])) { const /** @type {?} */ p = segmentGroup.segments[startIndex]; paths.push(new UrlSegment(p.path, commands[0])); i++; continue; } const /** @type {?} */ curr = getPath(commands[i]); const /** @type {?} */ next = (i < commands.length - 1) ? commands[i + 1] : null; if (curr && next && isMatrixParams(next)) { paths.push(new UrlSegment(curr, stringify(next))); i += 2; } else { paths.push(new UrlSegment(curr, {})); i++; } } return new UrlSegmentGroup(paths, {}); } /** * @param {?} outlets * @return {?} */ function createNewSegmentChildren(outlets) { const /** @type {?} */ children = {}; forEach(outlets, (commands, outlet) => { if (commands !== null) { children[outlet] = createNewSegmentGroup(new UrlSegmentGroup([], {}), 0, commands); } }); return children; } /** * @param {?} params * @return {?} */ function stringify(params) { const /** @type {?} */ res = {}; forEach(params, (v, k) => res[k] = `${v}`); return res; } /** * @param {?} path * @param {?} params * @param {?} segment * @return {?} */ function compare(path, params, segment) { return path == segment.path && shallowEqual(params, segment.parameters); } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ class CanActivate { /** * @param {?} path */ constructor(path) { this.path = path; this.route = this.path[this.path.length - 1]; } } class CanDeactivate { /** * @param {?} component * @param {?} route */ constructor(component, route) { this.component = component; this.route = route; } } /** * This class bundles the actions involved in preactivation of a route. */ class PreActivation { /** * @param {?} future * @param {?} curr * @param {?} moduleInjector * @param {?=} forwardEvent */ constructor(future, curr, moduleInjector, forwardEvent) { this.future = future; this.curr = curr; this.moduleInjector = moduleInjector; this.forwardEvent = forwardEvent; this.canActivateChecks = []; this.canDeactivateChecks = []; } /** * @param {?} parentContexts * @return {?} */ initialize(parentContexts) { const /** @type {?} */ futureRoot = this.future._root; const /** @type {?} */ currRoot = this.curr ? this.curr._root : null; this.setupChildRouteGuards(futureRoot, currRoot, parentContexts, [futureRoot.value]); } /** * @return {?} */ checkGuards() { if (!this.isDeactivating() && !this.isActivating()) { return Object(__WEBPACK_IMPORTED_MODULE_4_rxjs_observable_of__["a" /* of */])(true); } const /** @type {?} */ canDeactivate$ = this.runCanDeactivateChecks(); return __WEBPACK_IMPORTED_MODULE_7_rxjs_operator_mergeMap__["a" /* mergeMap */].call(canDeactivate$, (canDeactivate) => canDeactivate ? this.runCanActivateChecks() : Object(__WEBPACK_IMPORTED_MODULE_4_rxjs_observable_of__["a" /* of */])(false)); } /** * @param {?} paramsInheritanceStrategy * @return {?} */ resolveData(paramsInheritanceStrategy) { if (!this.isActivating()) return Object(__WEBPACK_IMPORTED_MODULE_4_rxjs_observable_of__["a" /* of */])(null); const /** @type {?} */ checks$ = Object(__WEBPACK_IMPORTED_MODULE_9_rxjs_observable_from__["a" /* from */])(this.canActivateChecks); const /** @type {?} */ runningChecks$ = __WEBPACK_IMPORTED_MODULE_5_rxjs_operator_concatMap__["a" /* concatMap */].call(checks$, (check) => this.runResolve(check.route, paramsInheritanceStrategy)); return __WEBPACK_IMPORTED_MODULE_18_rxjs_operator_reduce__["a" /* reduce */].call(runningChecks$, (_, __) => _); } /** * @return {?} */ isDeactivating() { return this.canDeactivateChecks.length !== 0; } /** * @return {?} */ isActivating() { return this.canActivateChecks.length !== 0; } /** * Iterates over child routes and calls recursive `setupRouteGuards` to get `this` instance in * proper state to run `checkGuards()` method. * @param {?} futureNode * @param {?} currNode * @param {?} contexts * @param {?} futurePath * @return {?} */ setupChildRouteGuards(futureNode, currNode, contexts, futurePath) { const /** @type {?} */ prevChildren = nodeChildrenAsMap(currNode); // Process the children of the future route futureNode.children.forEach(c => { this.setupRouteGuards(c, prevChildren[c.value.outlet], contexts, futurePath.concat([c.value])); delete prevChildren[c.value.outlet]; }); // Process any children left from the current route (not active for the future route) forEach(prevChildren, (v, k) => this.deactivateRouteAndItsChildren(v, /** @type {?} */ ((contexts)).getContext(k))); } /** * Iterates over child routes and calls recursive `setupRouteGuards` to get `this` instance in * proper state to run `checkGuards()` method. * @param {?} futureNode * @param {?} currNode * @param {?} parentContexts * @param {?} futurePath * @return {?} */ setupRouteGuards(futureNode, currNode, parentContexts, futurePath) { const /** @type {?} */ future = futureNode.value; const /** @type {?} */ curr = currNode ? currNode.value : null; const /** @type {?} */ context = parentContexts ? parentContexts.getContext(futureNode.value.outlet) : null; // reusing the node if (curr && future.routeConfig === curr.routeConfig) { const /** @type {?} */ shouldRunGuardsAndResolvers = this.shouldRunGuardsAndResolvers(curr, future, /** @type {?} */ ((future.routeConfig)).runGuardsAndResolvers); if (shouldRunGuardsAndResolvers) { this.canActivateChecks.push(new CanActivate(futurePath)); } else { // we need to set the data future.data = curr.data; future._resolvedData = curr._resolvedData; } // If we have a component, we need to go through an outlet. if (future.component) { this.setupChildRouteGuards(futureNode, currNode, context ? context.children : null, futurePath); // if we have a componentless route, we recurse but keep the same outlet map. } else { this.setupChildRouteGuards(futureNode, currNode, parentContexts, futurePath); } if (shouldRunGuardsAndResolvers) { const /** @type {?} */ outlet = /** @type {?} */ ((/** @type {?} */ ((context)).outlet)); this.canDeactivateChecks.push(new CanDeactivate(outlet.component, curr)); } } else { if (curr) { this.deactivateRouteAndItsChildren(currNode, context); } this.canActivateChecks.push(new CanActivate(futurePath)); // If we have a component, we need to go through an outlet. if (future.component) { this.setupChildRouteGuards(futureNode, null, context ? context.children : null, futurePath); // if we have a componentless route, we recurse but keep the same outlet map. } else { this.setupChildRouteGuards(futureNode, null, parentContexts, futurePath); } } } /** * @param {?} curr * @param {?} future * @param {?} mode * @return {?} */ shouldRunGuardsAndResolvers(curr, future, mode) { switch (mode) { case 'always': return true; case 'paramsOrQueryParamsChange': return !equalParamsAndUrlSegments(curr, future) || !shallowEqual(curr.queryParams, future.queryParams); case 'paramsChange': default: return !equalParamsAndUrlSegments(curr, future); } } /** * @param {?} route * @param {?} context * @return {?} */ deactivateRouteAndItsChildren(route, context) { const /** @type {?} */ children = nodeChildrenAsMap(route); const /** @type {?} */ r = route.value; forEach(children, (node, childName) => { if (!r.component) { this.deactivateRouteAndItsChildren(node, context); } else if (context) { this.deactivateRouteAndItsChildren(node, context.children.getContext(childName)); } else { this.deactivateRouteAndItsChildren(node, null); } }); if (!r.component) { this.canDeactivateChecks.push(new CanDeactivate(null, r)); } else if (context && context.outlet && context.outlet.isActivated) { this.canDeactivateChecks.push(new CanDeactivate(context.outlet.component, r)); } else { this.canDeactivateChecks.push(new CanDeactivate(null, r)); } } /** * @return {?} */ runCanDeactivateChecks() { const /** @type {?} */ checks$ = Object(__WEBPACK_IMPORTED_MODULE_9_rxjs_observable_from__["a" /* from */])(this.canDeactivateChecks); const /** @type {?} */ runningChecks$ = __WEBPACK_IMPORTED_MODULE_7_rxjs_operator_mergeMap__["a" /* mergeMap */].call(checks$, (check) => this.runCanDeactivate(check.component, check.route)); return __WEBPACK_IMPORTED_MODULE_15_rxjs_operator_every__["a" /* every */].call(runningChecks$, (result) => result === true); } /** * @return {?} */ runCanActivateChecks() { const /** @type {?} */ checks$ = Object(__WEBPACK_IMPORTED_MODULE_9_rxjs_observable_from__["a" /* from */])(this.canActivateChecks); const /** @type {?} */ runningChecks$ = __WEBPACK_IMPORTED_MODULE_5_rxjs_operator_concatMap__["a" /* concatMap */].call(checks$, (check) => andObservables(Object(__WEBPACK_IMPORTED_MODULE_9_rxjs_observable_from__["a" /* from */])([ this.fireChildActivationStart(check.route.parent), this.fireActivationStart(check.route), this.runCanActivateChild(check.path), this.runCanActivate(check.route) ]))); return __WEBPACK_IMPORTED_MODULE_15_rxjs_operator_every__["a" /* every */].call(runningChecks$, (result) => result === true); // this.fireChildActivationStart(check.path), } /** * This should fire off `ActivationStart` events for each route being activated at this * level. * In other words, if you're activating `a` and `b` below, `path` will contain the * `ActivatedRouteSnapshot`s for both and we will fire `ActivationStart` for both. Always * return * `true` so checks continue to run. * @param {?} snapshot * @return {?} */ fireActivationStart(snapshot) { if (snapshot !== null && this.forwardEvent) { this.forwardEvent(new ActivationStart(snapshot)); } return Object(__WEBPACK_IMPORTED_MODULE_4_rxjs_observable_of__["a" /* of */])(true); } /** * This should fire off `ChildActivationStart` events for each route being activated at this * level. * In other words, if you're activating `a` and `b` below, `path` will contain the * `ActivatedRouteSnapshot`s for both and we will fire `ChildActivationStart` for both. Always * return * `true` so checks continue to run. * @param {?} snapshot * @return {?} */ fireChildActivationStart(snapshot) { if (snapshot !== null && this.forwardEvent) { this.forwardEvent(new ChildActivationStart(snapshot)); } return Object(__WEBPACK_IMPORTED_MODULE_4_rxjs_observable_of__["a" /* of */])(true); } /** * @param {?} future * @return {?} */ runCanActivate(future) { const /** @type {?} */ canActivate = future.routeConfig ? future.routeConfig.canActivate : null; if (!canActivate || canActivate.length === 0) return Object(__WEBPACK_IMPORTED_MODULE_4_rxjs_observable_of__["a" /* of */])(true); const /** @type {?} */ obs = __WEBPACK_IMPORTED_MODULE_6_rxjs_operator_map__["a" /* map */].call(Object(__WEBPACK_IMPORTED_MODULE_9_rxjs_observable_from__["a" /* from */])(canActivate), (c) => { const /** @type {?} */ guard = this.getToken(c, future); let /** @type {?} */ observable; if (guard.canActivate) { observable = wrapIntoObservable(guard.canActivate(future, this.future)); } else { observable = wrapIntoObservable(guard(future, this.future)); } return __WEBPACK_IMPORTED_MODULE_12_rxjs_operator_first__["a" /* first */].call(observable); }); return andObservables(obs); } /** * @param {?} path * @return {?} */ runCanActivateChild(path) { const /** @type {?} */ future = path[path.length - 1]; const /** @type {?} */ canActivateChildGuards = path.slice(0, path.length - 1) .reverse() .map(p => this.extractCanActivateChild(p)) .filter(_ => _ !== null); return andObservables(__WEBPACK_IMPORTED_MODULE_6_rxjs_operator_map__["a" /* map */].call(Object(__WEBPACK_IMPORTED_MODULE_9_rxjs_observable_from__["a" /* from */])(canActivateChildGuards), (d) => { const /** @type {?} */ obs = __WEBPACK_IMPORTED_MODULE_6_rxjs_operator_map__["a" /* map */].call(Object(__WEBPACK_IMPORTED_MODULE_9_rxjs_observable_from__["a" /* from */])(d.guards), (c) => { const /** @type {?} */ guard = this.getToken(c, d.node); let /** @type {?} */ observable; if (guard.canActivateChild) { observable = wrapIntoObservable(guard.canActivateChild(future, this.future)); } else { observable = wrapIntoObservable(guard(future, this.future)); } return __WEBPACK_IMPORTED_MODULE_12_rxjs_operator_first__["a" /* first */].call(observable); }); return andObservables(obs); })); } /** * @param {?} p * @return {?} */ extractCanActivateChild(p) { const /** @type {?} */ canActivateChild = p.routeConfig ? p.routeConfig.canActivateChild : null; if (!canActivateChild || canActivateChild.length === 0) return null; return { node: p, guards: canActivateChild }; } /** * @param {?} component * @param {?} curr * @return {?} */ runCanDeactivate(component, curr) { const /** @type {?} */ canDeactivate = curr && curr.routeConfig ? curr.routeConfig.canDeactivate : null; if (!canDeactivate || canDeactivate.length === 0) return Object(__WEBPACK_IMPORTED_MODULE_4_rxjs_observable_of__["a" /* of */])(true); const /** @type {?} */ canDeactivate$ = __WEBPACK_IMPORTED_MODULE_7_rxjs_operator_mergeMap__["a" /* mergeMap */].call(Object(__WEBPACK_IMPORTED_MODULE_9_rxjs_observable_from__["a" /* from */])(canDeactivate), (c) => { const /** @type {?} */ guard = this.getToken(c, curr); let /** @type {?} */ observable; if (guard.canDeactivate) { observable = wrapIntoObservable(guard.canDeactivate(component, curr, this.curr, this.future)); } else { observable = wrapIntoObservable(guard(component, curr, this.curr, this.future)); } return __WEBPACK_IMPORTED_MODULE_12_rxjs_operator_first__["a" /* first */].call(observable); }); return __WEBPACK_IMPORTED_MODULE_15_rxjs_operator_every__["a" /* every */].call(canDeactivate$, (result) => result === true); } /** * @param {?} future * @param {?} paramsInheritanceStrategy * @return {?} */ runResolve(future, paramsInheritanceStrategy) { const /** @type {?} */ resolve = future._resolve; return __WEBPACK_IMPORTED_MODULE_6_rxjs_operator_map__["a" /* map */].call(this.resolveNode(resolve, future), (resolvedData) => { future._resolvedData = resolvedData; future.data = Object.assign({}, future.data, inheritedParamsDataResolve(future, paramsInheritanceStrategy).resolve); return null; }); } /** * @param {?} resolve * @param {?} future * @return {?} */ resolveNode(resolve, future) { const /** @type {?} */ keys = Object.keys(resolve); if (keys.length === 0) { return Object(__WEBPACK_IMPORTED_MODULE_4_rxjs_observable_of__["a" /* of */])({}); } if (keys.length === 1) { const /** @type {?} */ key = keys[0]; return __WEBPACK_IMPORTED_MODULE_6_rxjs_operator_map__["a" /* map */].call(this.getResolver(resolve[key], future), (value) => { return { [key]: value }; }); } const /** @type {?} */ data = {}; const /** @type {?} */ runningResolvers$ = __WEBPACK_IMPORTED_MODULE_7_rxjs_operator_mergeMap__["a" /* mergeMap */].call(Object(__WEBPACK_IMPORTED_MODULE_9_rxjs_observable_from__["a" /* from */])(keys), (key) => { return __WEBPACK_IMPORTED_MODULE_6_rxjs_operator_map__["a" /* map */].call(this.getResolver(resolve[key], future), (value) => { data[key] = value; return value; }); }); return __WEBPACK_IMPORTED_MODULE_6_rxjs_operator_map__["a" /* map */].call(__WEBPACK_IMPORTED_MODULE_16_rxjs_operator_last__["a" /* last */].call(runningResolvers$), () => data); } /** * @param {?} injectionToken * @param {?} future * @return {?} */ getResolver(injectionToken, future) { const /** @type {?} */ resolver = this.getToken(injectionToken, future); return resolver.resolve ? wrapIntoObservable(resolver.resolve(future, this.future)) : wrapIntoObservable(resolver(future, this.future)); } /** * @param {?} token * @param {?} snapshot * @return {?} */ getToken(token, snapshot) { const /** @type {?} */ config = closestLoadedConfig(snapshot); const /** @type {?} */ injector = config ? config.module.injector : this.moduleInjector; return injector.get(token); } } /** * @param {?} snapshot * @return {?} */ function closestLoadedConfig(snapshot) { if (!snapshot) return null; for (let /** @type {?} */ s = snapshot.parent; s; s = s.parent) { const /** @type {?} */ route = s.routeConfig; if (route && route._loadedConfig) return route._loadedConfig; } return null; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ class NoMatch$1 { } /** * @param {?} rootComponentType * @param {?} config * @param {?} urlTree * @param {?} url * @param {?=} paramsInheritanceStrategy * @return {?} */ function recognize(rootComponentType, config, urlTree, url, paramsInheritanceStrategy = 'emptyOnly') { return new Recognizer(rootComponentType, config, urlTree, url, paramsInheritanceStrategy) .recognize(); } class Recognizer { /** * @param {?} rootComponentType * @param {?} config * @param {?} urlTree * @param {?} url * @param {?} paramsInheritanceStrategy */ constructor(rootComponentType, config, urlTree, url, paramsInheritanceStrategy) { this.rootComponentType = rootComponentType; this.config = config; this.urlTree = urlTree; this.url = url; this.paramsInheritanceStrategy = paramsInheritanceStrategy; } /** * @return {?} */ recognize() { try { const /** @type {?} */ rootSegmentGroup = split$1(this.urlTree.root, [], [], this.config).segmentGroup; const /** @type {?} */ children = this.processSegmentGroup(this.config, rootSegmentGroup, PRIMARY_OUTLET); const /** @type {?} */ root = new ActivatedRouteSnapshot([], Object.freeze({}), Object.freeze(this.urlTree.queryParams), /** @type {?} */ ((this.urlTree.fragment)), {}, PRIMARY_OUTLET, this.rootComponentType, null, this.urlTree.root, -1, {}); const /** @type {?} */ rootNode = new TreeNode(root, children); const /** @type {?} */ routeState = new RouterStateSnapshot(this.url, rootNode); this.inheritParamsAndData(routeState._root); return Object(__WEBPACK_IMPORTED_MODULE_4_rxjs_observable_of__["a" /* of */])(routeState); } catch (/** @type {?} */ e) { return new __WEBPACK_IMPORTED_MODULE_8_rxjs_Observable__["a" /* Observable */]((obs) => obs.error(e)); } } /** * @param {?} routeNode * @return {?} */ inheritParamsAndData(routeNode) { const /** @type {?} */ route = routeNode.value; const /** @type {?} */ i = inheritedParamsDataResolve(route, this.paramsInheritanceStrategy); route.params = Object.freeze(i.params); route.data = Object.freeze(i.data); routeNode.children.forEach(n => this.inheritParamsAndData(n)); } /** * @param {?} config * @param {?} segmentGroup * @param {?} outlet * @return {?} */ processSegmentGroup(config, segmentGroup, outlet) { if (segmentGroup.segments.length === 0 && segmentGroup.hasChildren()) { return this.processChildren(config, segmentGroup); } return this.processSegment(config, segmentGroup, segmentGroup.segments, outlet); } /** * @param {?} config * @param {?} segmentGroup * @return {?} */ processChildren(config, segmentGroup) { const /** @type {?} */ children = mapChildrenIntoArray(segmentGroup, (child, childOutlet) => this.processSegmentGroup(config, child, childOutlet)); checkOutletNameUniqueness(children); sortActivatedRouteSnapshots(children); return children; } /** * @param {?} config * @param {?} segmentGroup * @param {?} segments * @param {?} outlet * @return {?} */ processSegment(config, segmentGroup, segments, outlet) { for (const /** @type {?} */ r of config) { try { return this.processSegmentAgainstRoute(r, segmentGroup, segments, outlet); } catch (/** @type {?} */ e) { if (!(e instanceof NoMatch$1)) throw e; } } if (this.noLeftoversInUrl(segmentGroup, segments, outlet)) { return []; } throw new NoMatch$1(); } /** * @param {?} segmentGroup * @param {?} segments * @param {?} outlet * @return {?} */ noLeftoversInUrl(segmentGroup, segments, outlet) { return segments.length === 0 && !segmentGroup.children[outlet]; } /** * @param {?} route * @param {?} rawSegment * @param {?} segments * @param {?} outlet * @return {?} */ processSegmentAgainstRoute(route, rawSegment, segments, outlet) { if (route.redirectTo) throw new NoMatch$1(); if ((route.outlet || PRIMARY_OUTLET) !== outlet) throw new NoMatch$1(); let /** @type {?} */ snapshot; let /** @type {?} */ consumedSegments = []; let /** @type {?} */ rawSlicedSegments = []; if (route.path === '**') { const /** @type {?} */ params = segments.length > 0 ? /** @type {?} */ ((last$1(segments))).parameters : {}; snapshot = new ActivatedRouteSnapshot(segments, params, Object.freeze(this.urlTree.queryParams), /** @type {?} */ ((this.urlTree.fragment)), getData(route), outlet, /** @type {?} */ ((route.component)), route, getSourceSegmentGroup(rawSegment), getPathIndexShift(rawSegment) + segments.length, getResolve(route)); } else { const /** @type {?} */ result = match$1(rawSegment, route, segments); consumedSegments = result.consumedSegments; rawSlicedSegments = segments.slice(result.lastChild); snapshot = new ActivatedRouteSnapshot(consumedSegments, result.parameters, Object.freeze(this.urlTree.queryParams), /** @type {?} */ ((this.urlTree.fragment)), getData(route), outlet, /** @type {?} */ ((route.component)), route, getSourceSegmentGroup(rawSegment), getPathIndexShift(rawSegment) + consumedSegments.length, getResolve(route)); } const /** @type {?} */ childConfig = getChildConfig(route); const { segmentGroup, slicedSegments } = split$1(rawSegment, consumedSegments, rawSlicedSegments, childConfig); if (slicedSegments.length === 0 && segmentGroup.hasChildren()) { const /** @type {?} */ children = this.processChildren(childConfig, segmentGroup); return [new TreeNode(snapshot, children)]; } if (childConfig.length === 0 && slicedSegments.length === 0) { return [new TreeNode(snapshot, [])]; } const /** @type {?} */ children = this.processSegment(childConfig, segmentGroup, slicedSegments, PRIMARY_OUTLET); return [new TreeNode(snapshot, children)]; } } /** * @param {?} nodes * @return {?} */ function sortActivatedRouteSnapshots(nodes) { nodes.sort((a, b) => { if (a.value.outlet === PRIMARY_OUTLET) return -1; if (b.value.outlet === PRIMARY_OUTLET) return 1; return a.value.outlet.localeCompare(b.value.outlet); }); } /** * @param {?} route * @return {?} */ function getChildConfig(route) { if (route.children) { return route.children; } if (route.loadChildren) { return /** @type {?} */ ((route._loadedConfig)).routes; } return []; } /** * @param {?} segmentGroup * @param {?} route * @param {?} segments * @return {?} */ function match$1(segmentGroup, route, segments) { if (route.path === '') { if (route.pathMatch === 'full' && (segmentGroup.hasChildren() || segments.length > 0)) { throw new NoMatch$1(); } return { consumedSegments: [], lastChild: 0, parameters: {} }; } const /** @type {?} */ matcher = route.matcher || defaultUrlMatcher; const /** @type {?} */ res = matcher(segments, segmentGroup, route); if (!res) throw new NoMatch$1(); const /** @type {?} */ posParams = {}; forEach(/** @type {?} */ ((res.posParams)), (v, k) => { posParams[k] = v.path; }); const /** @type {?} */ parameters = res.consumed.length > 0 ? Object.assign({}, posParams, res.consumed[res.consumed.length - 1].parameters) : posParams; return { consumedSegments: res.consumed, lastChild: res.consumed.length, parameters }; } /** * @param {?} nodes * @return {?} */ function checkOutletNameUniqueness(nodes) { const /** @type {?} */ names = {}; nodes.forEach(n => { const /** @type {?} */ routeWithSameOutletName = names[n.value.outlet]; if (routeWithSameOutletName) { const /** @type {?} */ p = routeWithSameOutletName.url.map(s => s.toString()).join('/'); const /** @type {?} */ c = n.value.url.map(s => s.toString()).join('/'); throw new Error(`Two segments cannot have the same outlet name: '${p}' and '${c}'.`); } names[n.value.outlet] = n.value; }); } /** * @param {?} segmentGroup * @return {?} */ function getSourceSegmentGroup(segmentGroup) { let /** @type {?} */ s = segmentGroup; while (s._sourceSegment) { s = s._sourceSegment; } return s; } /** * @param {?} segmentGroup * @return {?} */ function getPathIndexShift(segmentGroup) { let /** @type {?} */ s = segmentGroup; let /** @type {?} */ res = (s._segmentIndexShift ? s._segmentIndexShift : 0); while (s._sourceSegment) { s = s._sourceSegment; res += (s._segmentIndexShift ? s._segmentIndexShift : 0); } return res - 1; } /** * @param {?} segmentGroup * @param {?} consumedSegments * @param {?} slicedSegments * @param {?} config * @return {?} */ function split$1(segmentGroup, consumedSegments, slicedSegments, config) { if (slicedSegments.length > 0 && containsEmptyPathMatchesWithNamedOutlets(segmentGroup, slicedSegments, config)) { const /** @type {?} */ s = new UrlSegmentGroup(consumedSegments, createChildrenForEmptyPaths(segmentGroup, consumedSegments, config, new UrlSegmentGroup(slicedSegments, segmentGroup.children))); s._sourceSegment = segmentGroup; s._segmentIndexShift = consumedSegments.length; return { segmentGroup: s, slicedSegments: [] }; } if (slicedSegments.length === 0 && containsEmptyPathMatches(segmentGroup, slicedSegments, config)) { const /** @type {?} */ s = new UrlSegmentGroup(segmentGroup.segments, addEmptyPathsToChildrenIfNeeded(segmentGroup, slicedSegments, config, segmentGroup.children)); s._sourceSegment = segmentGroup; s._segmentIndexShift = consumedSegments.length; return { segmentGroup: s, slicedSegments }; } const /** @type {?} */ s = new UrlSegmentGroup(segmentGroup.segments, segmentGroup.children); s._sourceSegment = segmentGroup; s._segmentIndexShift = consumedSegments.length; return { segmentGroup: s, slicedSegments }; } /** * @param {?} segmentGroup * @param {?} slicedSegments * @param {?} routes * @param {?} children * @return {?} */ function addEmptyPathsToChildrenIfNeeded(segmentGroup, slicedSegments, routes, children) { const /** @type {?} */ res = {}; for (const /** @type {?} */ r of routes) { if (emptyPathMatch(segmentGroup, slicedSegments, r) && !children[getOutlet$1(r)]) { const /** @type {?} */ s = new UrlSegmentGroup([], {}); s._sourceSegment = segmentGroup; s._segmentIndexShift = segmentGroup.segments.length; res[getOutlet$1(r)] = s; } } return Object.assign({}, children, res); } /** * @param {?} segmentGroup * @param {?} consumedSegments * @param {?} routes * @param {?} primarySegment * @return {?} */ function createChildrenForEmptyPaths(segmentGroup, consumedSegments, routes, primarySegment) { const /** @type {?} */ res = {}; res[PRIMARY_OUTLET] = primarySegment; primarySegment._sourceSegment = segmentGroup; primarySegment._segmentIndexShift = consumedSegments.length; for (const /** @type {?} */ r of routes) { if (r.path === '' && getOutlet$1(r) !== PRIMARY_OUTLET) { const /** @type {?} */ s = new UrlSegmentGroup([], {}); s._sourceSegment = segmentGroup; s._segmentIndexShift = consumedSegments.length; res[getOutlet$1(r)] = s; } } return res; } /** * @param {?} segmentGroup * @param {?} slicedSegments * @param {?} routes * @return {?} */ function containsEmptyPathMatchesWithNamedOutlets(segmentGroup, slicedSegments, routes) { return routes.some(r => emptyPathMatch(segmentGroup, slicedSegments, r) && getOutlet$1(r) !== PRIMARY_OUTLET); } /** * @param {?} segmentGroup * @param {?} slicedSegments * @param {?} routes * @return {?} */ function containsEmptyPathMatches(segmentGroup, slicedSegments, routes) { return routes.some(r => emptyPathMatch(segmentGroup, slicedSegments, r)); } /** * @param {?} segmentGroup * @param {?} slicedSegments * @param {?} r * @return {?} */ function emptyPathMatch(segmentGroup, slicedSegments, r) { if ((segmentGroup.hasChildren() || slicedSegments.length > 0) && r.pathMatch === 'full') { return false; } return r.path === '' && r.redirectTo === undefined; } /** * @param {?} route * @return {?} */ function getOutlet$1(route) { return route.outlet || PRIMARY_OUTLET; } /** * @param {?} route * @return {?} */ function getData(route) { return route.data || {}; } /** * @param {?} route * @return {?} */ function getResolve(route) { return route.resolve || {}; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * \@whatItDoes Provides a way to customize when activated routes get reused. * * \@experimental * @abstract */ class RouteReuseStrategy { } /** * Does not detach any subtrees. Reuses routes as long as their route config is the same. */ class DefaultRouteReuseStrategy { /** * @param {?} route * @return {?} */ shouldDetach(route) { return false; } /** * @param {?} route * @param {?} detachedTree * @return {?} */ store(route, detachedTree) { } /** * @param {?} route * @return {?} */ shouldAttach(route) { return false; } /** * @param {?} route * @return {?} */ retrieve(route) { return null; } /** * @param {?} future * @param {?} curr * @return {?} */ shouldReuseRoute(future, curr) { return future.routeConfig === curr.routeConfig; } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * \@docsNotRequired * \@experimental */ const ROUTES = new __WEBPACK_IMPORTED_MODULE_1__angular_core__["InjectionToken"]('ROUTES'); class RouterConfigLoader { /** * @param {?} loader * @param {?} compiler * @param {?=} onLoadStartListener * @param {?=} onLoadEndListener */ constructor(loader, compiler, onLoadStartListener, onLoadEndListener) { this.loader = loader; this.compiler = compiler; this.onLoadStartListener = onLoadStartListener; this.onLoadEndListener = onLoadEndListener; } /** * @param {?} parentInjector * @param {?} route * @return {?} */ load(parentInjector, route) { if (this.onLoadStartListener) { this.onLoadStartListener(route); } const /** @type {?} */ moduleFactory$ = this.loadModuleFactory(/** @type {?} */ ((route.loadChildren))); return __WEBPACK_IMPORTED_MODULE_6_rxjs_operator_map__["a" /* map */].call(moduleFactory$, (factory) => { if (this.onLoadEndListener) { this.onLoadEndListener(route); } const /** @type {?} */ module = factory.create(parentInjector); return new LoadedRouterConfig(flatten(module.injector.get(ROUTES)).map(copyConfig), module); }); } /** * @param {?} loadChildren * @return {?} */ loadModuleFactory(loadChildren) { if (typeof loadChildren === 'string') { return Object(__WEBPACK_IMPORTED_MODULE_14_rxjs_observable_fromPromise__["a" /* fromPromise */])(this.loader.load(loadChildren)); } else { return __WEBPACK_IMPORTED_MODULE_7_rxjs_operator_mergeMap__["a" /* mergeMap */].call(wrapIntoObservable(loadChildren()), (t) => { if (t instanceof __WEBPACK_IMPORTED_MODULE_1__angular_core__["NgModuleFactory"]) { return Object(__WEBPACK_IMPORTED_MODULE_4_rxjs_observable_of__["a" /* of */])(t); } else { return Object(__WEBPACK_IMPORTED_MODULE_14_rxjs_observable_fromPromise__["a" /* fromPromise */])(this.compiler.compileModuleAsync(t)); } }); } } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * \@whatItDoes Provides a way to migrate AngularJS applications to Angular. * * \@experimental * @abstract */ class UrlHandlingStrategy { } /** * \@experimental */ class DefaultUrlHandlingStrategy { /** * @param {?} url * @return {?} */ shouldProcessUrl(url) { return true; } /** * @param {?} url * @return {?} */ extract(url) { return url; } /** * @param {?} newUrlPart * @param {?} wholeUrl * @return {?} */ merge(newUrlPart, wholeUrl) { return newUrlPart; } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * \@whatItDoes Represents the extra options used during navigation. * * \@stable * @record */ /** * @param {?} error * @return {?} */ function defaultErrorHandler(error) { throw error; } /** * \@internal * @param {?} snapshot * @return {?} */ function defaultRouterHook(snapshot) { return /** @type {?} */ (Object(__WEBPACK_IMPORTED_MODULE_4_rxjs_observable_of__["a" /* of */])(null)); } /** * \@whatItDoes Provides the navigation and url manipulation capabilities. * * See {\@link Routes} for more details and examples. * * \@ngModule RouterModule * * \@stable */ class Router { /** * Creates the router service. * @param {?} rootComponentType * @param {?} urlSerializer * @param {?} rootContexts * @param {?} location * @param {?} injector * @param {?} loader * @param {?} compiler * @param {?} config */ constructor(rootComponentType, urlSerializer, rootContexts, location, injector, loader, compiler, config) { this.rootComponentType = rootComponentType; this.urlSerializer = urlSerializer; this.rootContexts = rootContexts; this.location = location; this.config = config; this.navigations = new __WEBPACK_IMPORTED_MODULE_2_rxjs_BehaviorSubject__["BehaviorSubject"](/** @type {?} */ ((null))); this.navigationId = 0; this.events = new __WEBPACK_IMPORTED_MODULE_3_rxjs_Subject__["Subject"](); /** * Error handler that is invoked when a navigation errors. * * See {\@link ErrorHandler} for more information. */ this.errorHandler = defaultErrorHandler; /** * Indicates if at least one navigation happened. */ this.navigated = false; /** * Used by RouterModule. This allows us to * pause the navigation either before preactivation or after it. * \@internal */ this.hooks = { beforePreactivation: defaultRouterHook, afterPreactivation: defaultRouterHook }; /** * Extracts and merges URLs. Used for AngularJS to Angular migrations. */ this.urlHandlingStrategy = new DefaultUrlHandlingStrategy(); this.routeReuseStrategy = new DefaultRouteReuseStrategy(); /** * Define what the router should do if it receives a navigation request to the current URL. * By default, the router will ignore this navigation. However, this prevents features such * as a "refresh" button. Use this option to configure the behavior when navigating to the * current URL. Default is 'ignore'. */ this.onSameUrlNavigation = 'ignore'; /** * Defines how the router merges params, data and resolved data from parent to child * routes. Available options are: * * - `'emptyOnly'`, the default, only inherits parent params for path-less or component-less * routes. * - `'always'`, enables unconditional inheritance of parent params. */ this.paramsInheritanceStrategy = 'emptyOnly'; const /** @type {?} */ onLoadStart = (r) => this.triggerEvent(new RouteConfigLoadStart(r)); const /** @type {?} */ onLoadEnd = (r) => this.triggerEvent(new RouteConfigLoadEnd(r)); this.ngModule = injector.get(__WEBPACK_IMPORTED_MODULE_1__angular_core__["NgModuleRef"]); this.resetConfig(config); this.currentUrlTree = createEmptyUrlTree(); this.rawUrlTree = this.currentUrlTree; this.configLoader = new RouterConfigLoader(loader, compiler, onLoadStart, onLoadEnd); this.routerState = createEmptyState(this.currentUrlTree, this.rootComponentType); this.processNavigations(); } /** * \@internal * TODO: this should be removed once the constructor of the router made internal * @param {?} rootComponentType * @return {?} */ resetRootComponentType(rootComponentType) { this.rootComponentType = rootComponentType; // TODO: vsavkin router 4.0 should make the root component set to null // this will simplify the lifecycle of the router. this.routerState.root.component = this.rootComponentType; } /** * Sets up the location change listener and performs the initial navigation. * @return {?} */ initialNavigation() { this.setUpLocationChangeListener(); if (this.navigationId === 0) { this.navigateByUrl(this.location.path(true), { replaceUrl: true }); } } /** * Sets up the location change listener. * @return {?} */ setUpLocationChangeListener() { // Don't need to use Zone.wrap any more, because zone.js // already patch onPopState, so location change callback will // run into ngZone if (!this.locationSubscription) { this.locationSubscription = /** @type {?} */ (this.location.subscribe((change) => { const /** @type {?} */ rawUrlTree = this.urlSerializer.parse(change['url']); const /** @type {?} */ source = change['type'] === 'popstate' ? 'popstate' : 'hashchange'; setTimeout(() => { this.scheduleNavigation(rawUrlTree, source, { replaceUrl: true }); }, 0); })); } } /** * The current url * @return {?} */ get url() { return this.serializeUrl(this.currentUrlTree); } /** * \@internal * @param {?} e * @return {?} */ triggerEvent(e) { (/** @type {?} */ (this.events)).next(e); } /** * Resets the configuration used for navigation and generating links. * * ### Usage * * ``` * router.resetConfig([ * { path: 'team/:id', component: TeamCmp, children: [ * { path: 'simple', component: SimpleCmp }, * { path: 'user/:name', component: UserCmp } * ]} * ]); * ``` * @param {?} config * @return {?} */ resetConfig(config) { validateConfig(config); this.config = config.map(copyConfig); this.navigated = false; } /** * \@docsNotRequired * @return {?} */ ngOnDestroy() { this.dispose(); } /** * Disposes of the router * @return {?} */ dispose() { if (this.locationSubscription) { this.locationSubscription.unsubscribe(); this.locationSubscription = /** @type {?} */ ((null)); } } /** * Applies an array of commands to the current url tree and creates a new url tree. * * When given an activate route, applies the given commands starting from the route. * When not given a route, applies the given command starting from the root. * * ### Usage * * ``` * // create /team/33/user/11 * router.createUrlTree(['/team', 33, 'user', 11]); * * // create /team/33;expand=true/user/11 * router.createUrlTree(['/team', 33, {expand: true}, 'user', 11]); * * // you can collapse static segments like this (this works only with the first passed-in value): * router.createUrlTree(['/team/33/user', userId]); * * // If the first segment can contain slashes, and you do not want the router to split it, you * // can do the following: * * router.createUrlTree([{segmentPath: '/one/two'}]); * * // create /team/33/(user/11//right:chat) * router.createUrlTree(['/team', 33, {outlets: {primary: 'user/11', right: 'chat'}}]); * * // remove the right secondary node * router.createUrlTree(['/team', 33, {outlets: {primary: 'user/11', right: null}}]); * * // assuming the current url is `/team/33/user/11` and the route points to `user/11` * * // navigate to /team/33/user/11/details * router.createUrlTree(['details'], {relativeTo: route}); * * // navigate to /team/33/user/22 * router.createUrlTree(['../22'], {relativeTo: route}); * * // navigate to /team/44/user/22 * router.createUrlTree(['../../team/44/user/22'], {relativeTo: route}); * ``` * @param {?} commands * @param {?=} navigationExtras * @return {?} */ createUrlTree(commands, navigationExtras = {}) { const { relativeTo, queryParams, fragment, preserveQueryParams, queryParamsHandling, preserveFragment } = navigationExtras; if (Object(__WEBPACK_IMPORTED_MODULE_1__angular_core__["isDevMode"])() && preserveQueryParams && /** @type {?} */ (console) && /** @type {?} */ (console.warn)) { console.warn('preserveQueryParams is deprecated, use queryParamsHandling instead.'); } const /** @type {?} */ a = relativeTo || this.routerState.root; const /** @type {?} */ f = preserveFragment ? this.currentUrlTree.fragment : fragment; let /** @type {?} */ q = null; if (queryParamsHandling) { switch (queryParamsHandling) { case 'merge': q = Object.assign({}, this.currentUrlTree.queryParams, queryParams); break; case 'preserve': q = this.currentUrlTree.queryParams; break; default: q = queryParams || null; } } else { q = preserveQueryParams ? this.currentUrlTree.queryParams : queryParams || null; } if (q !== null) { q = this.removeEmptyProps(q); } return createUrlTree(a, this.currentUrlTree, commands, /** @type {?} */ ((q)), /** @type {?} */ ((f))); } /** * Navigate based on the provided url. This navigation is always absolute. * * Returns a promise that: * - resolves to 'true' when navigation succeeds, * - resolves to 'false' when navigation fails, * - is rejected when an error happens. * * ### Usage * * ``` * router.navigateByUrl("/team/33/user/11"); * * // Navigate without updating the URL * router.navigateByUrl("/team/33/user/11", { skipLocationChange: true }); * ``` * * In opposite to `navigate`, `navigateByUrl` takes a whole URL * and does not apply any delta to the current one. * @param {?} url * @param {?=} extras * @return {?} */ navigateByUrl(url, extras = { skipLocationChange: false }) { const /** @type {?} */ urlTree = url instanceof UrlTree ? url : this.parseUrl(url); const /** @type {?} */ mergedTree = this.urlHandlingStrategy.merge(urlTree, this.rawUrlTree); return this.scheduleNavigation(mergedTree, 'imperative', extras); } /** * Navigate based on the provided array of commands and a starting point. * If no starting route is provided, the navigation is absolute. * * Returns a promise that: * - resolves to 'true' when navigation succeeds, * - resolves to 'false' when navigation fails, * - is rejected when an error happens. * * ### Usage * * ``` * router.navigate(['team', 33, 'user', 11], {relativeTo: route}); * * // Navigate without updating the URL * router.navigate(['team', 33, 'user', 11], {relativeTo: route, skipLocationChange: true}); * ``` * * In opposite to `navigateByUrl`, `navigate` always takes a delta that is applied to the current * URL. * @param {?} commands * @param {?=} extras * @return {?} */ navigate(commands, extras = { skipLocationChange: false }) { validateCommands(commands); return this.navigateByUrl(this.createUrlTree(commands, extras), extras); } /** * Serializes a {\@link UrlTree} into a string * @param {?} url * @return {?} */ serializeUrl(url) { return this.urlSerializer.serialize(url); } /** * Parses a string into a {\@link UrlTree} * @param {?} url * @return {?} */ parseUrl(url) { return this.urlSerializer.parse(url); } /** * Returns whether the url is activated * @param {?} url * @param {?} exact * @return {?} */ isActive(url, exact) { if (url instanceof UrlTree) { return containsTree(this.currentUrlTree, url, exact); } const /** @type {?} */ urlTree = this.urlSerializer.parse(url); return containsTree(this.currentUrlTree, urlTree, exact); } /** * @param {?} params * @return {?} */ removeEmptyProps(params) { return Object.keys(params).reduce((result, key) => { const /** @type {?} */ value = params[key]; if (value !== null && value !== undefined) { result[key] = value; } return result; }, {}); } /** * @return {?} */ processNavigations() { __WEBPACK_IMPORTED_MODULE_5_rxjs_operator_concatMap__["a" /* concatMap */] .call(this.navigations, (nav) => { if (nav) { this.executeScheduledNavigation(nav); // a failed navigation should not stop the router from processing // further navigations => the catch return nav.promise.catch(() => { }); } else { return /** @type {?} */ (Object(__WEBPACK_IMPORTED_MODULE_4_rxjs_observable_of__["a" /* of */])(null)); } }) .subscribe(() => { }); } /** * @param {?} rawUrl * @param {?} source * @param {?} extras * @return {?} */ scheduleNavigation(rawUrl, source, extras) { const /** @type {?} */ lastNavigation = this.navigations.value; // If the user triggers a navigation imperatively (e.g., by using navigateByUrl), // and that navigation results in 'replaceState' that leads to the same URL, // we should skip those. if (lastNavigation && source !== 'imperative' && lastNavigation.source === 'imperative' && lastNavigation.rawUrl.toString() === rawUrl.toString()) { return Promise.resolve(true); // return value is not used } // Because of a bug in IE and Edge, the location class fires two events (popstate and // hashchange) every single time. The second one should be ignored. Otherwise, the URL will // flicker. Handles the case when a popstate was emitted first. if (lastNavigation && source == 'hashchange' && lastNavigation.source === 'popstate' && lastNavigation.rawUrl.toString() === rawUrl.toString()) { return Promise.resolve(true); // return value is not used } // Because of a bug in IE and Edge, the location class fires two events (popstate and // hashchange) every single time. The second one should be ignored. Otherwise, the URL will // flicker. Handles the case when a hashchange was emitted first. if (lastNavigation && source == 'popstate' && lastNavigation.source === 'hashchange' && lastNavigation.rawUrl.toString() === rawUrl.toString()) { return Promise.resolve(true); // return value is not used } let /** @type {?} */ resolve = null; let /** @type {?} */ reject = null; const /** @type {?} */ promise = new Promise((res, rej) => { resolve = res; reject = rej; }); const /** @type {?} */ id = ++this.navigationId; this.navigations.next({ id, source, rawUrl, extras, resolve, reject, promise }); // Make sure that the error is propagated even though `processNavigations` catch // handler does not rethrow return promise.catch((e) => Promise.reject(e)); } /** * @param {?} __0 * @return {?} */ executeScheduledNavigation({ id, rawUrl, extras, resolve, reject }) { const /** @type {?} */ url = this.urlHandlingStrategy.extract(rawUrl); const /** @type {?} */ urlTransition = !this.navigated || url.toString() !== this.currentUrlTree.toString(); if ((this.onSameUrlNavigation === 'reload' ? true : urlTransition) && this.urlHandlingStrategy.shouldProcessUrl(rawUrl)) { (/** @type {?} */ (this.events)).next(new NavigationStart(id, this.serializeUrl(url))); Promise.resolve() .then((_) => this.runNavigate(url, rawUrl, !!extras.skipLocationChange, !!extras.replaceUrl, id, null)) .then(resolve, reject); // we cannot process the current URL, but we could process the previous one => // we need to do some cleanup } else if (urlTransition && this.rawUrlTree && this.urlHandlingStrategy.shouldProcessUrl(this.rawUrlTree)) { (/** @type {?} */ (this.events)).next(new NavigationStart(id, this.serializeUrl(url))); Promise.resolve() .then((_) => this.runNavigate(url, rawUrl, false, false, id, createEmptyState(url, this.rootComponentType).snapshot)) .then(resolve, reject); } else { this.rawUrlTree = rawUrl; resolve(null); } } /** * @param {?} url * @param {?} rawUrl * @param {?} skipLocationChange * @param {?} replaceUrl * @param {?} id * @param {?} precreatedState * @return {?} */ runNavigate(url, rawUrl, skipLocationChange, replaceUrl, id, precreatedState) { if (id !== this.navigationId) { (/** @type {?} */ (this.events)) .next(new NavigationCancel(id, this.serializeUrl(url), `Navigation ID ${id} is not equal to the current navigation id ${this.navigationId}`)); return Promise.resolve(false); } return new Promise((resolvePromise, rejectPromise) => { // create an observable of the url and route state snapshot // this operation do not result in any side effects let /** @type {?} */ urlAndSnapshot$; if (!precreatedState) { const /** @type {?} */ moduleInjector = this.ngModule.injector; const /** @type {?} */ redirectsApplied$ = applyRedirects(moduleInjector, this.configLoader, this.urlSerializer, url, this.config); urlAndSnapshot$ = __WEBPACK_IMPORTED_MODULE_7_rxjs_operator_mergeMap__["a" /* mergeMap */].call(redirectsApplied$, (appliedUrl) => { return __WEBPACK_IMPORTED_MODULE_6_rxjs_operator_map__["a" /* map */].call(recognize(this.rootComponentType, this.config, appliedUrl, this.serializeUrl(appliedUrl), this.paramsInheritanceStrategy), (snapshot) => { (/** @type {?} */ (this.events)) .next(new RoutesRecognized(id, this.serializeUrl(url), this.serializeUrl(appliedUrl), snapshot)); return { appliedUrl, snapshot }; }); }); } else { urlAndSnapshot$ = Object(__WEBPACK_IMPORTED_MODULE_4_rxjs_observable_of__["a" /* of */])({ appliedUrl: url, snapshot: precreatedState }); } const /** @type {?} */ beforePreactivationDone$ = __WEBPACK_IMPORTED_MODULE_7_rxjs_operator_mergeMap__["a" /* mergeMap */].call(urlAndSnapshot$, (p) => { return __WEBPACK_IMPORTED_MODULE_6_rxjs_operator_map__["a" /* map */].call(this.hooks.beforePreactivation(p.snapshot), () => p); }); // run preactivation: guards and data resolvers let /** @type {?} */ preActivation; const /** @type {?} */ preactivationSetup$ = __WEBPACK_IMPORTED_MODULE_6_rxjs_operator_map__["a" /* map */].call(beforePreactivationDone$, ({ appliedUrl, snapshot }) => { const /** @type {?} */ moduleInjector = this.ngModule.injector; preActivation = new PreActivation(snapshot, this.routerState.snapshot, moduleInjector, (evt) => this.triggerEvent(evt)); preActivation.initialize(this.rootContexts); return { appliedUrl, snapshot }; }); const /** @type {?} */ preactivationCheckGuards$ = __WEBPACK_IMPORTED_MODULE_7_rxjs_operator_mergeMap__["a" /* mergeMap */].call(preactivationSetup$, ({ appliedUrl, snapshot }) => { if (this.navigationId !== id) return Object(__WEBPACK_IMPORTED_MODULE_4_rxjs_observable_of__["a" /* of */])(false); this.triggerEvent(new GuardsCheckStart(id, this.serializeUrl(url), appliedUrl, snapshot)); return __WEBPACK_IMPORTED_MODULE_6_rxjs_operator_map__["a" /* map */].call(preActivation.checkGuards(), (shouldActivate) => { this.triggerEvent(new GuardsCheckEnd(id, this.serializeUrl(url), appliedUrl, snapshot, shouldActivate)); return { appliedUrl: appliedUrl, snapshot: snapshot, shouldActivate: shouldActivate }; }); }); const /** @type {?} */ preactivationResolveData$ = __WEBPACK_IMPORTED_MODULE_7_rxjs_operator_mergeMap__["a" /* mergeMap */].call(preactivationCheckGuards$, (p) => { if (this.navigationId !== id) return Object(__WEBPACK_IMPORTED_MODULE_4_rxjs_observable_of__["a" /* of */])(false); if (p.shouldActivate && preActivation.isActivating()) { this.triggerEvent(new ResolveStart(id, this.serializeUrl(url), p.appliedUrl, p.snapshot)); return __WEBPACK_IMPORTED_MODULE_6_rxjs_operator_map__["a" /* map */].call(preActivation.resolveData(this.paramsInheritanceStrategy), () => { this.triggerEvent(new ResolveEnd(id, this.serializeUrl(url), p.appliedUrl, p.snapshot)); return p; }); } else { return Object(__WEBPACK_IMPORTED_MODULE_4_rxjs_observable_of__["a" /* of */])(p); } }); const /** @type {?} */ preactivationDone$ = __WEBPACK_IMPORTED_MODULE_7_rxjs_operator_mergeMap__["a" /* mergeMap */].call(preactivationResolveData$, (p) => { return __WEBPACK_IMPORTED_MODULE_6_rxjs_operator_map__["a" /* map */].call(this.hooks.afterPreactivation(p.snapshot), () => p); }); // create router state // this operation has side effects => route state is being affected const /** @type {?} */ routerState$ = __WEBPACK_IMPORTED_MODULE_6_rxjs_operator_map__["a" /* map */].call(preactivationDone$, ({ appliedUrl, snapshot, shouldActivate }) => { if (shouldActivate) { const /** @type {?} */ state = createRouterState(this.routeReuseStrategy, snapshot, this.routerState); return { appliedUrl, state, shouldActivate }; } else { return { appliedUrl, state: null, shouldActivate }; } }); this.activateRoutes(routerState$, this.routerState, this.currentUrlTree, id, url, rawUrl, skipLocationChange, replaceUrl, resolvePromise, rejectPromise); }); } /** * Performs the logic of activating routes. This is a synchronous process by default. While this * is a private method, it could be overridden to make activation asynchronous. * @param {?} state * @param {?} storedState * @param {?} storedUrl * @param {?} id * @param {?} url * @param {?} rawUrl * @param {?} skipLocationChange * @param {?} replaceUrl * @param {?} resolvePromise * @param {?} rejectPromise * @return {?} */ activateRoutes(state, storedState, storedUrl, id, url, rawUrl, skipLocationChange, replaceUrl, resolvePromise, rejectPromise) { // applied the new router state // this operation has side effects let /** @type {?} */ navigationIsSuccessful; state .forEach(({ appliedUrl, state, shouldActivate }) => { if (!shouldActivate || id !== this.navigationId) { navigationIsSuccessful = false; return; } this.currentUrlTree = appliedUrl; this.rawUrlTree = this.urlHandlingStrategy.merge(this.currentUrlTree, rawUrl); (/** @type {?} */ (this)).routerState = state; if (!skipLocationChange) { const /** @type {?} */ path = this.urlSerializer.serialize(this.rawUrlTree); if (this.location.isCurrentPathEqualTo(path) || replaceUrl) { this.location.replaceState(path); } else { this.location.go(path); } } new ActivateRoutes(this.routeReuseStrategy, state, storedState, (evt) => this.triggerEvent(evt)) .activate(this.rootContexts); navigationIsSuccessful = true; }) .then(() => { if (navigationIsSuccessful) { this.navigated = true; (/** @type {?} */ (this.events)) .next(new NavigationEnd(id, this.serializeUrl(url), this.serializeUrl(this.currentUrlTree))); resolvePromise(true); } else { this.resetUrlToCurrentUrlTree(); (/** @type {?} */ (this.events)) .next(new NavigationCancel(id, this.serializeUrl(url), '')); resolvePromise(false); } }, (e) => { if (isNavigationCancelingError(e)) { this.navigated = true; this.resetStateAndUrl(storedState, storedUrl, rawUrl); (/** @type {?} */ (this.events)) .next(new NavigationCancel(id, this.serializeUrl(url), e.message)); resolvePromise(false); } else { this.resetStateAndUrl(storedState, storedUrl, rawUrl); (/** @type {?} */ (this.events)) .next(new NavigationError(id, this.serializeUrl(url), e)); try { resolvePromise(this.errorHandler(e)); } catch (/** @type {?} */ ee) { rejectPromise(ee); } } }); } /** * @param {?} storedState * @param {?} storedUrl * @param {?} rawUrl * @return {?} */ resetStateAndUrl(storedState, storedUrl, rawUrl) { (/** @type {?} */ (this)).routerState = storedState; this.currentUrlTree = storedUrl; this.rawUrlTree = this.urlHandlingStrategy.merge(this.currentUrlTree, rawUrl); this.resetUrlToCurrentUrlTree(); } /** * @return {?} */ resetUrlToCurrentUrlTree() { this.location.replaceState(this.urlSerializer.serialize(this.rawUrlTree)); } } class ActivateRoutes { /** * @param {?} routeReuseStrategy * @param {?} futureState * @param {?} currState * @param {?} forwardEvent */ constructor(routeReuseStrategy, futureState, currState, forwardEvent) { this.routeReuseStrategy = routeReuseStrategy; this.futureState = futureState; this.currState = currState; this.forwardEvent = forwardEvent; } /** * @param {?} parentContexts * @return {?} */ activate(parentContexts) { const /** @type {?} */ futureRoot = this.futureState._root; const /** @type {?} */ currRoot = this.currState ? this.currState._root : null; this.deactivateChildRoutes(futureRoot, currRoot, parentContexts); advanceActivatedRoute(this.futureState.root); this.activateChildRoutes(futureRoot, currRoot, parentContexts); } /** * @param {?} futureNode * @param {?} currNode * @param {?} contexts * @return {?} */ deactivateChildRoutes(futureNode, currNode, contexts) { const /** @type {?} */ children = nodeChildrenAsMap(currNode); // Recurse on the routes active in the future state to de-activate deeper children futureNode.children.forEach(futureChild => { const /** @type {?} */ childOutletName = futureChild.value.outlet; this.deactivateRoutes(futureChild, children[childOutletName], contexts); delete children[childOutletName]; }); // De-activate the routes that will not be re-used forEach(children, (v, childName) => { this.deactivateRouteAndItsChildren(v, contexts); }); } /** * @param {?} futureNode * @param {?} currNode * @param {?} parentContext * @return {?} */ deactivateRoutes(futureNode, currNode, parentContext) { const /** @type {?} */ future = futureNode.value; const /** @type {?} */ curr = currNode ? currNode.value : null; if (future === curr) { // Reusing the node, check to see if the children need to be de-activated if (future.component) { // If we have a normal route, we need to go through an outlet. const /** @type {?} */ context = parentContext.getContext(future.outlet); if (context) { this.deactivateChildRoutes(futureNode, currNode, context.children); } } else { // if we have a componentless route, we recurse but keep the same outlet map. this.deactivateChildRoutes(futureNode, currNode, parentContext); } } else { if (curr) { // Deactivate the current route which will not be re-used this.deactivateRouteAndItsChildren(currNode, parentContext); } } } /** * @param {?} route * @param {?} parentContexts * @return {?} */ deactivateRouteAndItsChildren(route, parentContexts) { if (this.routeReuseStrategy.shouldDetach(route.value.snapshot)) { this.detachAndStoreRouteSubtree(route, parentContexts); } else { this.deactivateRouteAndOutlet(route, parentContexts); } } /** * @param {?} route * @param {?} parentContexts * @return {?} */ detachAndStoreRouteSubtree(route, parentContexts) { const /** @type {?} */ context = parentContexts.getContext(route.value.outlet); if (context && context.outlet) { const /** @type {?} */ componentRef = context.outlet.detach(); const /** @type {?} */ contexts = context.children.onOutletDeactivated(); this.routeReuseStrategy.store(route.value.snapshot, { componentRef, route, contexts }); } } /** * @param {?} route * @param {?} parentContexts * @return {?} */ deactivateRouteAndOutlet(route, parentContexts) { const /** @type {?} */ context = parentContexts.getContext(route.value.outlet); if (context) { const /** @type {?} */ children = nodeChildrenAsMap(route); const /** @type {?} */ contexts = route.value.component ? context.children : parentContexts; forEach(children, (v, k) => this.deactivateRouteAndItsChildren(v, contexts)); if (context.outlet) { // Destroy the component context.outlet.deactivate(); // Destroy the contexts for all the outlets that were in the component context.children.onOutletDeactivated(); } } } /** * @param {?} futureNode * @param {?} currNode * @param {?} contexts * @return {?} */ activateChildRoutes(futureNode, currNode, contexts) { const /** @type {?} */ children = nodeChildrenAsMap(currNode); futureNode.children.forEach(c => { this.activateRoutes(c, children[c.value.outlet], contexts); this.forwardEvent(new ActivationEnd(c.value.snapshot)); }); if (futureNode.children.length) { this.forwardEvent(new ChildActivationEnd(futureNode.value.snapshot)); } } /** * @param {?} futureNode * @param {?} currNode * @param {?} parentContexts * @return {?} */ activateRoutes(futureNode, currNode, parentContexts) { const /** @type {?} */ future = futureNode.value; const /** @type {?} */ curr = currNode ? currNode.value : null; advanceActivatedRoute(future); // reusing the node if (future === curr) { if (future.component) { // If we have a normal route, we need to go through an outlet. const /** @type {?} */ context = parentContexts.getOrCreateContext(future.outlet); this.activateChildRoutes(futureNode, currNode, context.children); } else { // if we have a componentless route, we recurse but keep the same outlet map. this.activateChildRoutes(futureNode, currNode, parentContexts); } } else { if (future.component) { // if we have a normal route, we need to place the component into the outlet and recurse. const /** @type {?} */ context = parentContexts.getOrCreateContext(future.outlet); if (this.routeReuseStrategy.shouldAttach(future.snapshot)) { const /** @type {?} */ stored = (/** @type {?} */ (this.routeReuseStrategy.retrieve(future.snapshot))); this.routeReuseStrategy.store(future.snapshot, null); context.children.onOutletReAttached(stored.contexts); context.attachRef = stored.componentRef; context.route = stored.route.value; if (context.outlet) { // Attach right away when the outlet has already been instantiated // Otherwise attach from `RouterOutlet.ngOnInit` when it is instantiated context.outlet.attach(stored.componentRef, stored.route.value); } advanceActivatedRouteNodeAndItsChildren(stored.route); } else { const /** @type {?} */ config = parentLoadedConfig(future.snapshot); const /** @type {?} */ cmpFactoryResolver = config ? config.module.componentFactoryResolver : null; context.route = future; context.resolver = cmpFactoryResolver; if (context.outlet) { // Activate the outlet when it has already been instantiated // Otherwise it will get activated from its `ngOnInit` when instantiated context.outlet.activateWith(future, cmpFactoryResolver); } this.activateChildRoutes(futureNode, null, context.children); } } else { // if we have a componentless route, we recurse but keep the same outlet map. this.activateChildRoutes(futureNode, null, parentContexts); } } } } /** * @param {?} node * @return {?} */ function advanceActivatedRouteNodeAndItsChildren(node) { advanceActivatedRoute(node.value); node.children.forEach(advanceActivatedRouteNodeAndItsChildren); } /** * @param {?} snapshot * @return {?} */ function parentLoadedConfig(snapshot) { for (let /** @type {?} */ s = snapshot.parent; s; s = s.parent) { const /** @type {?} */ route = s.routeConfig; if (route && route._loadedConfig) return route._loadedConfig; if (route && route.component) return null; } return null; } /** * @param {?} commands * @return {?} */ function validateCommands(commands) { for (let /** @type {?} */ i = 0; i < commands.length; i++) { const /** @type {?} */ cmd = commands[i]; if (cmd == null) { throw new Error(`The requested path contains ${cmd} segment at index ${i}`); } } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * \@whatItDoes Lets you link to specific parts of your app. * * \@howToUse * * Consider the following route configuration: * `[{ path: 'user/:name', component: UserCmp }]` * * When linking to this `user/:name` route, you can write: * `<a routerLink='/user/bob'>link to user component</a>` * * \@description * * The RouterLink directives let you link to specific parts of your app. * * When the link is static, you can use the directive as follows: * `<a routerLink="/user/bob">link to user component</a>` * * If you use dynamic values to generate the link, you can pass an array of path * segments, followed by the params for each segment. * * For instance `['/team', teamId, 'user', userName, {details: true}]` * means that we want to generate a link to `/team/11/user/bob;details=true`. * * Multiple static segments can be merged into one * (e.g., `['/team/11/user', userName, {details: true}]`). * * The first segment name can be prepended with `/`, `./`, or `../`: * * If the first segment begins with `/`, the router will look up the route from the root of the * app. * * If the first segment begins with `./`, or doesn't begin with a slash, the router will * instead look in the children of the current activated route. * * And if the first segment begins with `../`, the router will go up one level. * * You can set query params and fragment as follows: * * ``` * <a [routerLink]="['/user/bob']" [queryParams]="{debug: true}" fragment="education"> * link to user component * </a> * ``` * RouterLink will use these to generate this link: `/user/bob#education?debug=true`. * * (Deprecated in v4.0.0 use `queryParamsHandling` instead) You can also tell the * directive to preserve the current query params and fragment: * * ``` * <a [routerLink]="['/user/bob']" preserveQueryParams preserveFragment> * link to user component * </a> * ``` * * You can tell the directive to how to handle queryParams, available options are: * - `'merge'`: merge the queryParams into the current queryParams * - `'preserve'`: preserve the current queryParams * - default/`''`: use the queryParams only * * Same options for {\@link NavigationExtras#queryParamsHandling * NavigationExtras#queryParamsHandling}. * * ``` * <a [routerLink]="['/user/bob']" [queryParams]="{debug: true}" queryParamsHandling="merge"> * link to user component * </a> * ``` * * The router link directive always treats the provided input as a delta to the current url. * * For instance, if the current url is `/user/(box//aux:team)`. * * Then the following link `<a [routerLink]="['/user/jim']">Jim</a>` will generate the link * `/user/(jim//aux:team)`. * * See {\@link Router#createUrlTree createUrlTree} for more information. * * \@ngModule RouterModule * * \@stable */ class RouterLink { /** * @param {?} router * @param {?} route * @param {?} tabIndex * @param {?} renderer * @param {?} el */ constructor(router, route, tabIndex, renderer, el) { this.router = router; this.route = route; this.commands = []; if (tabIndex == null) { renderer.setAttribute(el.nativeElement, 'tabindex', '0'); } } /** * @param {?} commands * @return {?} */ set routerLink(commands) { if (commands != null) { this.commands = Array.isArray(commands) ? commands : [commands]; } else { this.commands = []; } } /** * @deprecated 4.0.0 use `queryParamsHandling` instead. * @param {?} value * @return {?} */ set preserveQueryParams(value) { if (Object(__WEBPACK_IMPORTED_MODULE_1__angular_core__["isDevMode"])() && /** @type {?} */ (console) && /** @type {?} */ (console.warn)) { console.warn('preserveQueryParams is deprecated!, use queryParamsHandling instead.'); } this.preserve = value; } /** * @return {?} */ onClick() { const /** @type {?} */ extras = { skipLocationChange: attrBoolValue(this.skipLocationChange), replaceUrl: attrBoolValue(this.replaceUrl), }; this.router.navigateByUrl(this.urlTree, extras); return true; } /** * @return {?} */ get urlTree() { return this.router.createUrlTree(this.commands, { relativeTo: this.route, queryParams: this.queryParams, fragment: this.fragment, preserveQueryParams: attrBoolValue(this.preserve), queryParamsHandling: this.queryParamsHandling, preserveFragment: attrBoolValue(this.preserveFragment), }); } } RouterLink.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Directive"], args: [{ selector: ':not(a)[routerLink]' },] }, ]; /** @nocollapse */ RouterLink.ctorParameters = () => [ { type: Router, }, { type: ActivatedRoute, }, { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Attribute"], args: ['tabindex',] },] }, { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Renderer2"], }, { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["ElementRef"], }, ]; RouterLink.propDecorators = { "queryParams": [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Input"] },], "fragment": [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Input"] },], "queryParamsHandling": [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Input"] },], "preserveFragment": [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Input"] },], "skipLocationChange": [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Input"] },], "replaceUrl": [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Input"] },], "routerLink": [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Input"] },], "preserveQueryParams": [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Input"] },], "onClick": [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["HostListener"], args: ['click',] },], }; /** * \@whatItDoes Lets you link to specific parts of your app. * * See {\@link RouterLink} for more information. * * \@ngModule RouterModule * * \@stable */ class RouterLinkWithHref { /** * @param {?} router * @param {?} route * @param {?} locationStrategy */ constructor(router, route, locationStrategy) { this.router = router; this.route = route; this.locationStrategy = locationStrategy; this.commands = []; this.subscription = router.events.subscribe(s => { if (s instanceof NavigationEnd) { this.updateTargetUrlAndHref(); } }); } /** * @param {?} commands * @return {?} */ set routerLink(commands) { if (commands != null) { this.commands = Array.isArray(commands) ? commands : [commands]; } else { this.commands = []; } } /** * @param {?} value * @return {?} */ set preserveQueryParams(value) { if (Object(__WEBPACK_IMPORTED_MODULE_1__angular_core__["isDevMode"])() && /** @type {?} */ (console) && /** @type {?} */ (console.warn)) { console.warn('preserveQueryParams is deprecated, use queryParamsHandling instead.'); } this.preserve = value; } /** * @param {?} changes * @return {?} */ ngOnChanges(changes) { this.updateTargetUrlAndHref(); } /** * @return {?} */ ngOnDestroy() { this.subscription.unsubscribe(); } /** * @param {?} button * @param {?} ctrlKey * @param {?} metaKey * @param {?} shiftKey * @return {?} */ onClick(button, ctrlKey, metaKey, shiftKey) { if (button !== 0 || ctrlKey || metaKey || shiftKey) { return true; } if (typeof this.target === 'string' && this.target != '_self') { return true; } const /** @type {?} */ extras = { skipLocationChange: attrBoolValue(this.skipLocationChange), replaceUrl: attrBoolValue(this.replaceUrl), }; this.router.navigateByUrl(this.urlTree, extras); return false; } /** * @return {?} */ updateTargetUrlAndHref() { this.href = this.locationStrategy.prepareExternalUrl(this.router.serializeUrl(this.urlTree)); } /** * @return {?} */ get urlTree() { return this.router.createUrlTree(this.commands, { relativeTo: this.route, queryParams: this.queryParams, fragment: this.fragment, preserveQueryParams: attrBoolValue(this.preserve), queryParamsHandling: this.queryParamsHandling, preserveFragment: attrBoolValue(this.preserveFragment), }); } } RouterLinkWithHref.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Directive"], args: [{ selector: 'a[routerLink]' },] }, ]; /** @nocollapse */ RouterLinkWithHref.ctorParameters = () => [ { type: Router, }, { type: ActivatedRoute, }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_common__["LocationStrategy"], }, ]; RouterLinkWithHref.propDecorators = { "target": [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["HostBinding"], args: ['attr.target',] }, { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Input"] },], "queryParams": [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Input"] },], "fragment": [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Input"] },], "queryParamsHandling": [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Input"] },], "preserveFragment": [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Input"] },], "skipLocationChange": [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Input"] },], "replaceUrl": [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Input"] },], "href": [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["HostBinding"] },], "routerLink": [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Input"] },], "preserveQueryParams": [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Input"] },], "onClick": [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["HostListener"], args: ['click', ['$event.button', '$event.ctrlKey', '$event.metaKey', '$event.shiftKey'],] },], }; /** * @param {?} s * @return {?} */ function attrBoolValue(s) { return s === '' || !!s; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * \@whatItDoes Lets you add a CSS class to an element when the link's route becomes active. * * \@howToUse * * ``` * <a routerLink="/user/bob" routerLinkActive="active-link">Bob</a> * ``` * * \@description * * The RouterLinkActive directive lets you add a CSS class to an element when the link's route * becomes active. * * Consider the following example: * * ``` * <a routerLink="/user/bob" routerLinkActive="active-link">Bob</a> * ``` * * When the url is either '/user' or '/user/bob', the active-link class will * be added to the `a` tag. If the url changes, the class will be removed. * * You can set more than one class, as follows: * * ``` * <a routerLink="/user/bob" routerLinkActive="class1 class2">Bob</a> * <a routerLink="/user/bob" [routerLinkActive]="['class1', 'class2']">Bob</a> * ``` * * You can configure RouterLinkActive by passing `exact: true`. This will add the classes * only when the url matches the link exactly. * * ``` * <a routerLink="/user/bob" routerLinkActive="active-link" [routerLinkActiveOptions]="{exact: * true}">Bob</a> * ``` * * You can assign the RouterLinkActive instance to a template variable and directly check * the `isActive` status. * ``` * <a routerLink="/user/bob" routerLinkActive #rla="routerLinkActive"> * Bob {{ rla.isActive ? '(already open)' : ''}} * </a> * ``` * * Finally, you can apply the RouterLinkActive directive to an ancestor of a RouterLink. * * ``` * <div routerLinkActive="active-link" [routerLinkActiveOptions]="{exact: true}"> * <a routerLink="/user/jim">Jim</a> * <a routerLink="/user/bob">Bob</a> * </div> * ``` * * This will set the active-link class on the div tag if the url is either '/user/jim' or * '/user/bob'. * * \@ngModule RouterModule * * \@stable */ class RouterLinkActive { /** * @param {?} router * @param {?} element * @param {?} renderer * @param {?} cdr */ constructor(router, element, renderer, cdr) { this.router = router; this.element = element; this.renderer = renderer; this.cdr = cdr; this.classes = []; this.isActive = false; this.routerLinkActiveOptions = { exact: false }; this.subscription = router.events.subscribe(s => { if (s instanceof NavigationEnd) { this.update(); } }); } /** * @return {?} */ ngAfterContentInit() { this.links.changes.subscribe(_ => this.update()); this.linksWithHrefs.changes.subscribe(_ => this.update()); this.update(); } /** * @param {?} data * @return {?} */ set routerLinkActive(data) { const /** @type {?} */ classes = Array.isArray(data) ? data : data.split(' '); this.classes = classes.filter(c => !!c); } /** * @param {?} changes * @return {?} */ ngOnChanges(changes) { this.update(); } /** * @return {?} */ ngOnDestroy() { this.subscription.unsubscribe(); } /** * @return {?} */ update() { if (!this.links || !this.linksWithHrefs || !this.router.navigated) return; Promise.resolve().then(() => { const /** @type {?} */ hasActiveLinks = this.hasActiveLinks(); if (this.isActive !== hasActiveLinks) { (/** @type {?} */ (this)).isActive = hasActiveLinks; this.classes.forEach((c) => { if (hasActiveLinks) { this.renderer.addClass(this.element.nativeElement, c); } else { this.renderer.removeClass(this.element.nativeElement, c); } }); } }); } /** * @param {?} router * @return {?} */ isLinkActive(router) { return (link) => router.isActive(link.urlTree, this.routerLinkActiveOptions.exact); } /** * @return {?} */ hasActiveLinks() { return this.links.some(this.isLinkActive(this.router)) || this.linksWithHrefs.some(this.isLinkActive(this.router)); } } RouterLinkActive.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Directive"], args: [{ selector: '[routerLinkActive]', exportAs: 'routerLinkActive', },] }, ]; /** @nocollapse */ RouterLinkActive.ctorParameters = () => [ { type: Router, }, { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["ElementRef"], }, { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Renderer2"], }, { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["ChangeDetectorRef"], }, ]; RouterLinkActive.propDecorators = { "links": [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["ContentChildren"], args: [RouterLink, { descendants: true },] },], "linksWithHrefs": [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["ContentChildren"], args: [RouterLinkWithHref, { descendants: true },] },], "routerLinkActiveOptions": [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Input"] },], "routerLinkActive": [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Input"] },], }; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * Store contextual information about a {\@link RouterOutlet} * * \@stable */ class OutletContext { constructor() { this.outlet = null; this.route = null; this.resolver = null; this.children = new ChildrenOutletContexts(); this.attachRef = null; } } /** * Store contextual information about the children (= nested) {\@link RouterOutlet} * * \@stable */ class ChildrenOutletContexts { constructor() { this.contexts = new Map(); } /** * Called when a `RouterOutlet` directive is instantiated * @param {?} childName * @param {?} outlet * @return {?} */ onChildOutletCreated(childName, outlet) { const /** @type {?} */ context = this.getOrCreateContext(childName); context.outlet = outlet; this.contexts.set(childName, context); } /** * Called when a `RouterOutlet` directive is destroyed. * We need to keep the context as the outlet could be destroyed inside a NgIf and might be * re-created later. * @param {?} childName * @return {?} */ onChildOutletDestroyed(childName) { const /** @type {?} */ context = this.getContext(childName); if (context) { context.outlet = null; } } /** * Called when the corresponding route is deactivated during navigation. * Because the component get destroyed, all children outlet are destroyed. * @return {?} */ onOutletDeactivated() { const /** @type {?} */ contexts = this.contexts; this.contexts = new Map(); return contexts; } /** * @param {?} contexts * @return {?} */ onOutletReAttached(contexts) { this.contexts = contexts; } /** * @param {?} childName * @return {?} */ getOrCreateContext(childName) { let /** @type {?} */ context = this.getContext(childName); if (!context) { context = new OutletContext(); this.contexts.set(childName, context); } return context; } /** * @param {?} childName * @return {?} */ getContext(childName) { return this.contexts.get(childName) || null; } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * \@whatItDoes Acts as a placeholder that Angular dynamically fills based on the current router * state. * * \@howToUse * * ``` * <router-outlet></router-outlet> * <router-outlet name='left'></router-outlet> * <router-outlet name='right'></router-outlet> * ``` * * A router outlet will emit an activate event any time a new component is being instantiated, * and a deactivate event when it is being destroyed. * * ``` * <router-outlet * (activate)='onActivate($event)' * (deactivate)='onDeactivate($event)'></router-outlet> * ``` * \@ngModule RouterModule * * \@stable */ class RouterOutlet { /** * @param {?} parentContexts * @param {?} location * @param {?} resolver * @param {?} name * @param {?} changeDetector */ constructor(parentContexts, location, resolver, name, changeDetector) { this.parentContexts = parentContexts; this.location = location; this.resolver = resolver; this.changeDetector = changeDetector; this.activated = null; this._activatedRoute = null; this.activateEvents = new __WEBPACK_IMPORTED_MODULE_1__angular_core__["EventEmitter"](); this.deactivateEvents = new __WEBPACK_IMPORTED_MODULE_1__angular_core__["EventEmitter"](); this.name = name || PRIMARY_OUTLET; parentContexts.onChildOutletCreated(this.name, this); } /** * @return {?} */ ngOnDestroy() { this.parentContexts.onChildOutletDestroyed(this.name); } /** * @return {?} */ ngOnInit() { if (!this.activated) { // If the outlet was not instantiated at the time the route got activated we need to populate // the outlet when it is initialized (ie inside a NgIf) const /** @type {?} */ context = this.parentContexts.getContext(this.name); if (context && context.route) { if (context.attachRef) { // `attachRef` is populated when there is an existing component to mount this.attach(context.attachRef, context.route); } else { // otherwise the component defined in the configuration is created this.activateWith(context.route, context.resolver || null); } } } } /** * @return {?} */ get isActivated() { return !!this.activated; } /** * @return {?} */ get component() { if (!this.activated) throw new Error('Outlet is not activated'); return this.activated.instance; } /** * @return {?} */ get activatedRoute() { if (!this.activated) throw new Error('Outlet is not activated'); return /** @type {?} */ (this._activatedRoute); } /** * @return {?} */ get activatedRouteData() { if (this._activatedRoute) { return this._activatedRoute.snapshot.data; } return {}; } /** * Called when the `RouteReuseStrategy` instructs to detach the subtree * @return {?} */ detach() { if (!this.activated) throw new Error('Outlet is not activated'); this.location.detach(); const /** @type {?} */ cmp = this.activated; this.activated = null; this._activatedRoute = null; return cmp; } /** * Called when the `RouteReuseStrategy` instructs to re-attach a previously detached subtree * @param {?} ref * @param {?} activatedRoute * @return {?} */ attach(ref, activatedRoute) { this.activated = ref; this._activatedRoute = activatedRoute; this.location.insert(ref.hostView); } /** * @return {?} */ deactivate() { if (this.activated) { const /** @type {?} */ c = this.component; this.activated.destroy(); this.activated = null; this._activatedRoute = null; this.deactivateEvents.emit(c); } } /** * @param {?} activatedRoute * @param {?} resolver * @return {?} */ activateWith(activatedRoute, resolver) { if (this.isActivated) { throw new Error('Cannot activate an already activated outlet'); } this._activatedRoute = activatedRoute; const /** @type {?} */ snapshot = activatedRoute._futureSnapshot; const /** @type {?} */ component = /** @type {?} */ (/** @type {?} */ ((snapshot.routeConfig)).component); resolver = resolver || this.resolver; const /** @type {?} */ factory = resolver.resolveComponentFactory(component); const /** @type {?} */ childContexts = this.parentContexts.getOrCreateContext(this.name).children; const /** @type {?} */ injector = new OutletInjector(activatedRoute, childContexts, this.location.injector); this.activated = this.location.createComponent(factory, this.location.length, injector); // Calling `markForCheck` to make sure we will run the change detection when the // `RouterOutlet` is inside a `ChangeDetectionStrategy.OnPush` component. this.changeDetector.markForCheck(); this.activateEvents.emit(this.activated.instance); } } RouterOutlet.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Directive"], args: [{ selector: 'router-outlet', exportAs: 'outlet' },] }, ]; /** @nocollapse */ RouterOutlet.ctorParameters = () => [ { type: ChildrenOutletContexts, }, { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["ViewContainerRef"], }, { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["ComponentFactoryResolver"], }, { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Attribute"], args: ['name',] },] }, { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["ChangeDetectorRef"], }, ]; RouterOutlet.propDecorators = { "activateEvents": [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Output"], args: ['activate',] },], "deactivateEvents": [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Output"], args: ['deactivate',] },], }; class OutletInjector { /** * @param {?} route * @param {?} childContexts * @param {?} parent */ constructor(route, childContexts, parent) { this.route = route; this.childContexts = childContexts; this.parent = parent; } /** * @param {?} token * @param {?=} notFoundValue * @return {?} */ get(token, notFoundValue) { if (token === ActivatedRoute) { return this.route; } if (token === ChildrenOutletContexts) { return this.childContexts; } return this.parent.get(token, notFoundValue); } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** *@license *Copyright Google Inc. All Rights Reserved. * *Use of this source code is governed by an MIT-style license that can be *found in the LICENSE file at https://angular.io/license */ /** * \@whatItDoes Provides a preloading strategy. * * \@experimental * @abstract */ class PreloadingStrategy { } /** * \@whatItDoes Provides a preloading strategy that preloads all modules as quickly as possible. * * \@howToUse * * ``` * RouteModule.forRoot(ROUTES, {preloadingStrategy: PreloadAllModules}) * ``` * * \@experimental */ class PreloadAllModules { /** * @param {?} route * @param {?} fn * @return {?} */ preload(route, fn) { return __WEBPACK_IMPORTED_MODULE_10_rxjs_operator_catch__["a" /* _catch */].call(fn(), () => Object(__WEBPACK_IMPORTED_MODULE_4_rxjs_observable_of__["a" /* of */])(null)); } } /** * \@whatItDoes Provides a preloading strategy that does not preload any modules. * * \@description * * This strategy is enabled by default. * * \@experimental */ class NoPreloading { /** * @param {?} route * @param {?} fn * @return {?} */ preload(route, fn) { return Object(__WEBPACK_IMPORTED_MODULE_4_rxjs_observable_of__["a" /* of */])(null); } } /** * The preloader optimistically loads all router configurations to * make navigations into lazily-loaded sections of the application faster. * * The preloader runs in the background. When the router bootstraps, the preloader * starts listening to all navigation events. After every such event, the preloader * will check if any configurations can be loaded lazily. * * If a route is protected by `canLoad` guards, the preloaded will not load it. * * \@stable */ class RouterPreloader { /** * @param {?} router * @param {?} moduleLoader * @param {?} compiler * @param {?} injector * @param {?} preloadingStrategy */ constructor(router, moduleLoader, compiler, injector, preloadingStrategy) { this.router = router; this.injector = injector; this.preloadingStrategy = preloadingStrategy; const /** @type {?} */ onStartLoad = (r) => router.triggerEvent(new RouteConfigLoadStart(r)); const /** @type {?} */ onEndLoad = (r) => router.triggerEvent(new RouteConfigLoadEnd(r)); this.loader = new RouterConfigLoader(moduleLoader, compiler, onStartLoad, onEndLoad); } /** * @return {?} */ setUpPreloading() { const /** @type {?} */ navigations$ = __WEBPACK_IMPORTED_MODULE_20_rxjs_operator_filter__["a" /* filter */].call(this.router.events, (e) => e instanceof NavigationEnd); this.subscription = __WEBPACK_IMPORTED_MODULE_5_rxjs_operator_concatMap__["a" /* concatMap */].call(navigations$, () => this.preload()).subscribe(() => { }); } /** * @return {?} */ preload() { const /** @type {?} */ ngModule = this.injector.get(__WEBPACK_IMPORTED_MODULE_1__angular_core__["NgModuleRef"]); return this.processRoutes(ngModule, this.router.config); } /** * @return {?} */ ngOnDestroy() { this.subscription.unsubscribe(); } /** * @param {?} ngModule * @param {?} routes * @return {?} */ processRoutes(ngModule, routes) { const /** @type {?} */ res = []; for (const /** @type {?} */ route of routes) { // we already have the config loaded, just recurse if (route.loadChildren && !route.canLoad && route._loadedConfig) { const /** @type {?} */ childConfig = route._loadedConfig; res.push(this.processRoutes(childConfig.module, childConfig.routes)); // no config loaded, fetch the config } else if (route.loadChildren && !route.canLoad) { res.push(this.preloadConfig(ngModule, route)); // recurse into children } else if (route.children) { res.push(this.processRoutes(ngModule, route.children)); } } return __WEBPACK_IMPORTED_MODULE_17_rxjs_operator_mergeAll__["a" /* mergeAll */].call(Object(__WEBPACK_IMPORTED_MODULE_9_rxjs_observable_from__["a" /* from */])(res)); } /** * @param {?} ngModule * @param {?} route * @return {?} */ preloadConfig(ngModule, route) { return this.preloadingStrategy.preload(route, () => { const /** @type {?} */ loaded$ = this.loader.load(ngModule.injector, route); return __WEBPACK_IMPORTED_MODULE_7_rxjs_operator_mergeMap__["a" /* mergeMap */].call(loaded$, (config) => { route._loadedConfig = config; return this.processRoutes(config.module, config.routes); }); }); } } RouterPreloader.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Injectable"] }, ]; /** @nocollapse */ RouterPreloader.ctorParameters = () => [ { type: Router, }, { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["NgModuleFactoryLoader"], }, { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Compiler"], }, { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Injector"], }, { type: PreloadingStrategy, }, ]; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * \@whatItDoes Contains a list of directives * \@stable */ const ROUTER_DIRECTIVES = [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive]; /** * \@whatItDoes Is used in DI to configure the router. * \@stable */ const ROUTER_CONFIGURATION = new __WEBPACK_IMPORTED_MODULE_1__angular_core__["InjectionToken"]('ROUTER_CONFIGURATION'); /** * \@docsNotRequired */ const ROUTER_FORROOT_GUARD = new __WEBPACK_IMPORTED_MODULE_1__angular_core__["InjectionToken"]('ROUTER_FORROOT_GUARD'); const ROUTER_PROVIDERS = [ __WEBPACK_IMPORTED_MODULE_0__angular_common__["Location"], { provide: UrlSerializer, useClass: DefaultUrlSerializer }, { provide: Router, useFactory: setupRouter, deps: [ __WEBPACK_IMPORTED_MODULE_1__angular_core__["ApplicationRef"], UrlSerializer, ChildrenOutletContexts, __WEBPACK_IMPORTED_MODULE_0__angular_common__["Location"], __WEBPACK_IMPORTED_MODULE_1__angular_core__["Injector"], __WEBPACK_IMPORTED_MODULE_1__angular_core__["NgModuleFactoryLoader"], __WEBPACK_IMPORTED_MODULE_1__angular_core__["Compiler"], ROUTES, ROUTER_CONFIGURATION, [UrlHandlingStrategy, new __WEBPACK_IMPORTED_MODULE_1__angular_core__["Optional"]()], [RouteReuseStrategy, new __WEBPACK_IMPORTED_MODULE_1__angular_core__["Optional"]()] ] }, ChildrenOutletContexts, { provide: ActivatedRoute, useFactory: rootRoute, deps: [Router] }, { provide: __WEBPACK_IMPORTED_MODULE_1__angular_core__["NgModuleFactoryLoader"], useClass: __WEBPACK_IMPORTED_MODULE_1__angular_core__["SystemJsNgModuleLoader"] }, RouterPreloader, NoPreloading, PreloadAllModules, { provide: ROUTER_CONFIGURATION, useValue: { enableTracing: false } }, ]; /** * @return {?} */ function routerNgProbeToken() { return new __WEBPACK_IMPORTED_MODULE_1__angular_core__["NgProbeToken"]('Router', Router); } /** * \@whatItDoes Adds router directives and providers. * * \@howToUse * * RouterModule can be imported multiple times: once per lazily-loaded bundle. * Since the router deals with a global shared resource--location, we cannot have * more than one router service active. * * That is why there are two ways to create the module: `RouterModule.forRoot` and * `RouterModule.forChild`. * * * `forRoot` creates a module that contains all the directives, the given routes, and the router * service itself. * * `forChild` creates a module that contains all the directives and the given routes, but does not * include the router service. * * When registered at the root, the module should be used as follows * * ``` * \@NgModule({ * imports: [RouterModule.forRoot(ROUTES)] * }) * class MyNgModule {} * ``` * * For submodules and lazy loaded submodules the module should be used as follows: * * ``` * \@NgModule({ * imports: [RouterModule.forChild(ROUTES)] * }) * class MyNgModule {} * ``` * * \@description * * Managing state transitions is one of the hardest parts of building applications. This is * especially true on the web, where you also need to ensure that the state is reflected in the URL. * In addition, we often want to split applications into multiple bundles and load them on demand. * Doing this transparently is not trivial. * * The Angular router solves these problems. Using the router, you can declaratively specify * application states, manage state transitions while taking care of the URL, and load bundles on * demand. * * [Read this developer guide](https://angular.io/docs/ts/latest/guide/router.html) to get an * overview of how the router should be used. * * \@stable */ class RouterModule { /** * @param {?} guard * @param {?} router */ constructor(guard, router) { } /** * Creates a module with all the router providers and directives. It also optionally sets up an * application listener to perform an initial navigation. * * Options (see {\@link ExtraOptions}): * * `enableTracing` makes the router log all its internal events to the console. * * `useHash` enables the location strategy that uses the URL fragment instead of the history * API. * * `initialNavigation` disables the initial navigation. * * `errorHandler` provides a custom error handler. * * `preloadingStrategy` configures a preloading strategy (see {\@link PreloadAllModules}). * * `onSameUrlNavigation` configures how the router handles navigation to the current URL. See * {\@link ExtraOptions} for more details. * @param {?} routes * @param {?=} config * @return {?} */ static forRoot(routes, config) { return { ngModule: RouterModule, providers: [ ROUTER_PROVIDERS, provideRoutes(routes), { provide: ROUTER_FORROOT_GUARD, useFactory: provideForRootGuard, deps: [[Router, new __WEBPACK_IMPORTED_MODULE_1__angular_core__["Optional"](), new __WEBPACK_IMPORTED_MODULE_1__angular_core__["SkipSelf"]()]] }, { provide: ROUTER_CONFIGURATION, useValue: config ? config : {} }, { provide: __WEBPACK_IMPORTED_MODULE_0__angular_common__["LocationStrategy"], useFactory: provideLocationStrategy, deps: [ __WEBPACK_IMPORTED_MODULE_0__angular_common__["PlatformLocation"], [new __WEBPACK_IMPORTED_MODULE_1__angular_core__["Inject"](__WEBPACK_IMPORTED_MODULE_0__angular_common__["APP_BASE_HREF"]), new __WEBPACK_IMPORTED_MODULE_1__angular_core__["Optional"]()], ROUTER_CONFIGURATION ] }, { provide: PreloadingStrategy, useExisting: config && config.preloadingStrategy ? config.preloadingStrategy : NoPreloading }, { provide: __WEBPACK_IMPORTED_MODULE_1__angular_core__["NgProbeToken"], multi: true, useFactory: routerNgProbeToken }, provideRouterInitializer(), ], }; } /** * Creates a module with all the router directives and a provider registering routes. * @param {?} routes * @return {?} */ static forChild(routes) { return { ngModule: RouterModule, providers: [provideRoutes(routes)] }; } } RouterModule.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["NgModule"], args: [{ declarations: ROUTER_DIRECTIVES, exports: ROUTER_DIRECTIVES },] }, ]; /** @nocollapse */ RouterModule.ctorParameters = () => [ { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Optional"] }, { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Inject"], args: [ROUTER_FORROOT_GUARD,] },] }, { type: Router, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Optional"] },] }, ]; /** * @param {?} platformLocationStrategy * @param {?} baseHref * @param {?=} options * @return {?} */ function provideLocationStrategy(platformLocationStrategy, baseHref, options = {}) { return options.useHash ? new __WEBPACK_IMPORTED_MODULE_0__angular_common__["HashLocationStrategy"](platformLocationStrategy, baseHref) : new __WEBPACK_IMPORTED_MODULE_0__angular_common__["PathLocationStrategy"](platformLocationStrategy, baseHref); } /** * @param {?} router * @return {?} */ function provideForRootGuard(router) { if (router) { throw new Error(`RouterModule.forRoot() called twice. Lazy loaded modules should use RouterModule.forChild() instead.`); } return 'guarded'; } /** * \@whatItDoes Registers routes. * * \@howToUse * * ``` * \@NgModule({ * imports: [RouterModule.forChild(ROUTES)], * providers: [provideRoutes(EXTRA_ROUTES)] * }) * class MyNgModule {} * ``` * * \@stable * @param {?} routes * @return {?} */ function provideRoutes(routes) { return [ { provide: __WEBPACK_IMPORTED_MODULE_1__angular_core__["ANALYZE_FOR_ENTRY_COMPONENTS"], multi: true, useValue: routes }, { provide: ROUTES, multi: true, useValue: routes }, ]; } /** * \@whatItDoes Represents options to configure the router. * * \@stable * @record */ /** * @param {?} ref * @param {?} urlSerializer * @param {?} contexts * @param {?} location * @param {?} injector * @param {?} loader * @param {?} compiler * @param {?} config * @param {?=} opts * @param {?=} urlHandlingStrategy * @param {?=} routeReuseStrategy * @return {?} */ function setupRouter(ref, urlSerializer, contexts, location, injector, loader, compiler, config, opts = {}, urlHandlingStrategy, routeReuseStrategy) { const /** @type {?} */ router = new Router(null, urlSerializer, contexts, location, injector, loader, compiler, flatten(config)); if (urlHandlingStrategy) { router.urlHandlingStrategy = urlHandlingStrategy; } if (routeReuseStrategy) { router.routeReuseStrategy = routeReuseStrategy; } if (opts.errorHandler) { router.errorHandler = opts.errorHandler; } if (opts.enableTracing) { const /** @type {?} */ dom = Object(__WEBPACK_IMPORTED_MODULE_19__angular_platform_browser__["ɵgetDOM"])(); router.events.subscribe(e => { dom.logGroup(`Router Event: ${((/** @type {?} */ (e.constructor))).name}`); dom.log(e.toString()); dom.log(e); dom.logGroupEnd(); }); } if (opts.onSameUrlNavigation) { router.onSameUrlNavigation = opts.onSameUrlNavigation; } if (opts.paramsInheritanceStrategy) { router.paramsInheritanceStrategy = opts.paramsInheritanceStrategy; } return router; } /** * @param {?} router * @return {?} */ function rootRoute(router) { return router.routerState.root; } /** * To initialize the router properly we need to do in two steps: * * We need to start the navigation in a APP_INITIALIZER to block the bootstrap if * a resolver or a guards executes asynchronously. Second, we need to actually run * activation in a BOOTSTRAP_LISTENER. We utilize the afterPreactivation * hook provided by the router to do that. * * The router navigation starts, reaches the point when preactivation is done, and then * pauses. It waits for the hook to be resolved. We then resolve it only in a bootstrap listener. */ class RouterInitializer { /** * @param {?} injector */ constructor(injector) { this.injector = injector; this.initNavigation = false; this.resultOfPreactivationDone = new __WEBPACK_IMPORTED_MODULE_3_rxjs_Subject__["Subject"](); } /** * @return {?} */ appInitializer() { const /** @type {?} */ p = this.injector.get(__WEBPACK_IMPORTED_MODULE_0__angular_common__["LOCATION_INITIALIZED"], Promise.resolve(null)); return p.then(() => { let /** @type {?} */ resolve = /** @type {?} */ ((null)); const /** @type {?} */ res = new Promise(r => resolve = r); const /** @type {?} */ router = this.injector.get(Router); const /** @type {?} */ opts = this.injector.get(ROUTER_CONFIGURATION); if (this.isLegacyDisabled(opts) || this.isLegacyEnabled(opts)) { resolve(true); } else if (opts.initialNavigation === 'disabled') { router.setUpLocationChangeListener(); resolve(true); } else if (opts.initialNavigation === 'enabled') { router.hooks.afterPreactivation = () => { // only the initial navigation should be delayed if (!this.initNavigation) { this.initNavigation = true; resolve(true); return this.resultOfPreactivationDone; // subsequent navigations should not be delayed } else { return /** @type {?} */ (Object(__WEBPACK_IMPORTED_MODULE_4_rxjs_observable_of__["a" /* of */])(null)); } }; router.initialNavigation(); } else { throw new Error(`Invalid initialNavigation options: '${opts.initialNavigation}'`); } return res; }); } /** * @param {?} bootstrappedComponentRef * @return {?} */ bootstrapListener(bootstrappedComponentRef) { const /** @type {?} */ opts = this.injector.get(ROUTER_CONFIGURATION); const /** @type {?} */ preloader = this.injector.get(RouterPreloader); const /** @type {?} */ router = this.injector.get(Router); const /** @type {?} */ ref = this.injector.get(__WEBPACK_IMPORTED_MODULE_1__angular_core__["ApplicationRef"]); if (bootstrappedComponentRef !== ref.components[0]) { return; } if (this.isLegacyEnabled(opts)) { router.initialNavigation(); } else if (this.isLegacyDisabled(opts)) { router.setUpLocationChangeListener(); } preloader.setUpPreloading(); router.resetRootComponentType(ref.componentTypes[0]); this.resultOfPreactivationDone.next(/** @type {?} */ ((null))); this.resultOfPreactivationDone.complete(); } /** * @param {?} opts * @return {?} */ isLegacyEnabled(opts) { return opts.initialNavigation === 'legacy_enabled' || opts.initialNavigation === true || opts.initialNavigation === undefined; } /** * @param {?} opts * @return {?} */ isLegacyDisabled(opts) { return opts.initialNavigation === 'legacy_disabled' || opts.initialNavigation === false; } } RouterInitializer.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Injectable"] }, ]; /** @nocollapse */ RouterInitializer.ctorParameters = () => [ { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Injector"], }, ]; /** * @param {?} r * @return {?} */ function getAppInitializer(r) { return r.appInitializer.bind(r); } /** * @param {?} r * @return {?} */ function getBootstrapListener(r) { return r.bootstrapListener.bind(r); } /** * A token for the router initializer that will be called after the app is bootstrapped. * * \@experimental */ const ROUTER_INITIALIZER = new __WEBPACK_IMPORTED_MODULE_1__angular_core__["InjectionToken"]('Router Initializer'); /** * @return {?} */ function provideRouterInitializer() { return [ RouterInitializer, { provide: __WEBPACK_IMPORTED_MODULE_1__angular_core__["APP_INITIALIZER"], multi: true, useFactory: getAppInitializer, deps: [RouterInitializer] }, { provide: ROUTER_INITIALIZER, useFactory: getBootstrapListener, deps: [RouterInitializer] }, { provide: __WEBPACK_IMPORTED_MODULE_1__angular_core__["APP_BOOTSTRAP_LISTENER"], multi: true, useExisting: ROUTER_INITIALIZER }, ]; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * \@stable */ const VERSION = new __WEBPACK_IMPORTED_MODULE_1__angular_core__["Version"]('5.2.10'); /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @module * @description * Entry point for all public APIs of this package. */ // This file only reexports content of the `src` folder. Keep it that way. /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * Generated bundle index. Do not edit. */ //# sourceMappingURL=router.js.map /***/ }), /***/ "./node_modules/@firebase/analytics/dist/index.esm.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "factory", function() { return factory; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getGlobalVars", function() { return getGlobalVars; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "registerAnalytics", function() { return registerAnalytics; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "resetGlobalVars", function() { return resetGlobalVars; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "settings", function() { return settings; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_tslib__ = __webpack_require__("./node_modules/@firebase/analytics/node_modules/tslib/tslib.es6.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__firebase_app__ = __webpack_require__("./node_modules/@firebase/app/dist/index.cjs.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__firebase_app___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1__firebase_app__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__firebase_installations__ = __webpack_require__("./node_modules/@firebase/analytics/node_modules/@firebase/installations/dist/index.esm.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__firebase_logger__ = __webpack_require__("./node_modules/@firebase/logger/dist/index.esm.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__firebase_util__ = __webpack_require__("./node_modules/@firebase/analytics/node_modules/@firebase/util/dist/index.cjs.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__firebase_util___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4__firebase_util__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__firebase_component__ = __webpack_require__("./node_modules/@firebase/analytics/node_modules/@firebase/component/dist/index.cjs.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__firebase_component___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5__firebase_component__); /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // Key to attach FID to in gtag params. var GA_FID_KEY = 'firebase_id'; var ORIGIN_KEY = 'origin'; var FETCH_TIMEOUT_MILLIS = 60 * 1000; var DYNAMIC_CONFIG_URL = 'https://firebase.googleapis.com/v1alpha/projects/-/apps/{app-id}/webConfig'; var GTAG_URL = 'https://www.googletagmanager.com/gtag/js'; var GtagCommand; (function (GtagCommand) { GtagCommand["EVENT"] = "event"; GtagCommand["SET"] = "set"; GtagCommand["CONFIG"] = "config"; })(GtagCommand || (GtagCommand = {})); /* * Officially recommended event names for gtag.js * Any other string is also allowed. */ var EventName; (function (EventName) { EventName["ADD_SHIPPING_INFO"] = "add_shipping_info"; EventName["ADD_PAYMENT_INFO"] = "add_payment_info"; EventName["ADD_TO_CART"] = "add_to_cart"; EventName["ADD_TO_WISHLIST"] = "add_to_wishlist"; EventName["BEGIN_CHECKOUT"] = "begin_checkout"; /** @deprecated */ EventName["CHECKOUT_PROGRESS"] = "checkout_progress"; EventName["EXCEPTION"] = "exception"; EventName["GENERATE_LEAD"] = "generate_lead"; EventName["LOGIN"] = "login"; EventName["PAGE_VIEW"] = "page_view"; EventName["PURCHASE"] = "purchase"; EventName["REFUND"] = "refund"; EventName["REMOVE_FROM_CART"] = "remove_from_cart"; EventName["SCREEN_VIEW"] = "screen_view"; EventName["SEARCH"] = "search"; EventName["SELECT_CONTENT"] = "select_content"; EventName["SELECT_ITEM"] = "select_item"; EventName["SELECT_PROMOTION"] = "select_promotion"; /** @deprecated */ EventName["SET_CHECKOUT_OPTION"] = "set_checkout_option"; EventName["SHARE"] = "share"; EventName["SIGN_UP"] = "sign_up"; EventName["TIMING_COMPLETE"] = "timing_complete"; EventName["VIEW_CART"] = "view_cart"; EventName["VIEW_ITEM"] = "view_item"; EventName["VIEW_ITEM_LIST"] = "view_item_list"; EventName["VIEW_PROMOTION"] = "view_promotion"; EventName["VIEW_SEARCH_RESULTS"] = "view_search_results"; })(EventName || (EventName = {})); /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Logs an analytics event through the Firebase SDK. * * @param gtagFunction Wrapped gtag function that waits for fid to be set before sending an event * @param eventName Google Analytics event name, choose from standard list or use a custom string. * @param eventParams Analytics event parameters. */ function logEvent(gtagFunction, initializationPromise, eventName, eventParams, options) { return Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["__awaiter"])(this, void 0, void 0, function () { var measurementId, params; return Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["__generator"])(this, function (_a) { switch (_a.label) { case 0: if (!(options && options.global)) return [3 /*break*/, 1]; gtagFunction(GtagCommand.EVENT, eventName, eventParams); return [2 /*return*/]; case 1: return [4 /*yield*/, initializationPromise]; case 2: measurementId = _a.sent(); params = Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["__assign"])(Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["__assign"])({}, eventParams), { 'send_to': measurementId }); gtagFunction(GtagCommand.EVENT, eventName, params); _a.label = 3; case 3: return [2 /*return*/]; } }); }); } /** * Set screen_name parameter for this Google Analytics ID. * * @param gtagFunction Wrapped gtag function that waits for fid to be set before sending an event * @param screenName Screen name string to set. */ function setCurrentScreen(gtagFunction, initializationPromise, screenName, options) { return Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["__awaiter"])(this, void 0, void 0, function () { var measurementId; return Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["__generator"])(this, function (_a) { switch (_a.label) { case 0: if (!(options && options.global)) return [3 /*break*/, 1]; gtagFunction(GtagCommand.SET, { 'screen_name': screenName }); return [2 /*return*/, Promise.resolve()]; case 1: return [4 /*yield*/, initializationPromise]; case 2: measurementId = _a.sent(); gtagFunction(GtagCommand.CONFIG, measurementId, { update: true, 'screen_name': screenName }); _a.label = 3; case 3: return [2 /*return*/]; } }); }); } /** * Set user_id parameter for this Google Analytics ID. * * @param gtagFunction Wrapped gtag function that waits for fid to be set before sending an event * @param id User ID string to set */ function setUserId(gtagFunction, initializationPromise, id, options) { return Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["__awaiter"])(this, void 0, void 0, function () { var measurementId; return Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["__generator"])(this, function (_a) { switch (_a.label) { case 0: if (!(options && options.global)) return [3 /*break*/, 1]; gtagFunction(GtagCommand.SET, { 'user_id': id }); return [2 /*return*/, Promise.resolve()]; case 1: return [4 /*yield*/, initializationPromise]; case 2: measurementId = _a.sent(); gtagFunction(GtagCommand.CONFIG, measurementId, { update: true, 'user_id': id }); _a.label = 3; case 3: return [2 /*return*/]; } }); }); } /** * Set all other user properties other than user_id and screen_name. * * @param gtagFunction Wrapped gtag function that waits for fid to be set before sending an event * @param properties Map of user properties to set */ function setUserProperties(gtagFunction, initializationPromise, properties, options) { return Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["__awaiter"])(this, void 0, void 0, function () { var flatProperties, _i, _a, key, measurementId; return Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["__generator"])(this, function (_b) { switch (_b.label) { case 0: if (!(options && options.global)) return [3 /*break*/, 1]; flatProperties = {}; for (_i = 0, _a = Object.keys(properties); _i < _a.length; _i++) { key = _a[_i]; // use dot notation for merge behavior in gtag.js flatProperties["user_properties." + key] = properties[key]; } gtagFunction(GtagCommand.SET, flatProperties); return [2 /*return*/, Promise.resolve()]; case 1: return [4 /*yield*/, initializationPromise]; case 2: measurementId = _b.sent(); gtagFunction(GtagCommand.CONFIG, measurementId, { update: true, 'user_properties': properties }); _b.label = 3; case 3: return [2 /*return*/]; } }); }); } /** * Set whether collection is enabled for this ID. * * @param enabled If true, collection is enabled for this ID. */ function setAnalyticsCollectionEnabled(initializationPromise, enabled) { return Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["__awaiter"])(this, void 0, void 0, function () { var measurementId; return Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["__generator"])(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, initializationPromise]; case 1: measurementId = _a.sent(); window["ga-disable-" + measurementId] = !enabled; return [2 /*return*/]; } }); }); } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var logger = new __WEBPACK_IMPORTED_MODULE_3__firebase_logger__["Logger"]('@firebase/analytics'); /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Inserts gtag script tag into the page to asynchronously download gtag. * @param dataLayerName Name of datalayer (most often the default, "_dataLayer"). */ function insertScriptTag(dataLayerName) { var script = document.createElement('script'); // We are not providing an analyticsId in the URL because it would trigger a `page_view` // without fid. We will initialize ga-id using gtag (config) command together with fid. script.src = GTAG_URL + "?l=" + dataLayerName; script.async = true; document.head.appendChild(script); } /** * Get reference to, or create, global datalayer. * @param dataLayerName Name of datalayer (most often the default, "_dataLayer"). */ function getOrCreateDataLayer(dataLayerName) { // Check for existing dataLayer and create if needed. var dataLayer = []; if (Array.isArray(window[dataLayerName])) { dataLayer = window[dataLayerName]; } else { window[dataLayerName] = dataLayer; } return dataLayer; } /** * Wrapped gtag logic when gtag is called with 'config' command. * * @param gtagCore Basic gtag function that just appends to dataLayer. * @param initializationPromisesMap Map of appIds to their initialization promises. * @param dynamicConfigPromisesList Array of dynamic config fetch promises. * @param measurementIdToAppId Map of GA measurementIDs to corresponding Firebase appId. * @param measurementId GA Measurement ID to set config for. * @param gtagParams Gtag config params to set. */ function gtagOnConfig(gtagCore, initializationPromisesMap, dynamicConfigPromisesList, measurementIdToAppId, measurementId, gtagParams) { return Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["__awaiter"])(this, void 0, void 0, function () { var correspondingAppId, dynamicConfigResults, foundConfig, e_1; return Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["__generator"])(this, function (_a) { switch (_a.label) { case 0: correspondingAppId = measurementIdToAppId[measurementId]; _a.label = 1; case 1: _a.trys.push([1, 7, , 8]); if (!correspondingAppId) return [3 /*break*/, 3]; return [4 /*yield*/, initializationPromisesMap[correspondingAppId]]; case 2: _a.sent(); return [3 /*break*/, 6]; case 3: return [4 /*yield*/, Promise.all(dynamicConfigPromisesList)]; case 4: dynamicConfigResults = _a.sent(); foundConfig = dynamicConfigResults.find(function (config) { return config.measurementId === measurementId; }); if (!foundConfig) return [3 /*break*/, 6]; return [4 /*yield*/, initializationPromisesMap[foundConfig.appId]]; case 5: _a.sent(); _a.label = 6; case 6: return [3 /*break*/, 8]; case 7: e_1 = _a.sent(); logger.error(e_1); return [3 /*break*/, 8]; case 8: gtagCore(GtagCommand.CONFIG, measurementId, gtagParams); return [2 /*return*/]; } }); }); } /** * Wrapped gtag logic when gtag is called with 'event' command. * * @param gtagCore Basic gtag function that just appends to dataLayer. * @param initializationPromisesMap Map of appIds to their initialization promises. * @param dynamicConfigPromisesList Array of dynamic config fetch promises. * @param measurementId GA Measurement ID to log event to. * @param gtagParams Params to log with this event. */ function gtagOnEvent(gtagCore, initializationPromisesMap, dynamicConfigPromisesList, measurementId, gtagParams) { return Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["__awaiter"])(this, void 0, void 0, function () { var initializationPromisesToWaitFor, gaSendToList, dynamicConfigResults, _loop_1, _i, gaSendToList_1, sendToId, state_1, e_2; return Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["__generator"])(this, function (_a) { switch (_a.label) { case 0: _a.trys.push([0, 4, , 5]); initializationPromisesToWaitFor = []; if (!(gtagParams && gtagParams['send_to'])) return [3 /*break*/, 2]; gaSendToList = gtagParams['send_to']; // Make it an array if is isn't, so it can be dealt with the same way. if (!Array.isArray(gaSendToList)) { gaSendToList = [gaSendToList]; } return [4 /*yield*/, Promise.all(dynamicConfigPromisesList)]; case 1: dynamicConfigResults = _a.sent(); _loop_1 = function (sendToId) { // Any fetched dynamic measurement ID that matches this 'send_to' ID var foundConfig = dynamicConfigResults.find(function (config) { return config.measurementId === sendToId; }); var initializationPromise = foundConfig && initializationPromisesMap[foundConfig.appId]; if (initializationPromise) { initializationPromisesToWaitFor.push(initializationPromise); } else { // Found an item in 'send_to' that is not associated // directly with an FID, possibly a group. Empty this array, // exit the loop early, and let it get populated below. initializationPromisesToWaitFor = []; return "break"; } }; for (_i = 0, gaSendToList_1 = gaSendToList; _i < gaSendToList_1.length; _i++) { sendToId = gaSendToList_1[_i]; state_1 = _loop_1(sendToId); if (state_1 === "break") break; } _a.label = 2; case 2: // This will be unpopulated if there was no 'send_to' field , or // if not all entries in the 'send_to' field could be mapped to // a FID. In these cases, wait on all pending initialization promises. if (initializationPromisesToWaitFor.length === 0) { initializationPromisesToWaitFor = Object.values(initializationPromisesMap); } // Run core gtag function with args after all relevant initialization // promises have been resolved. return [4 /*yield*/, Promise.all(initializationPromisesToWaitFor)]; case 3: // Run core gtag function with args after all relevant initialization // promises have been resolved. _a.sent(); // Workaround for http://b/141370449 - third argument cannot be undefined. gtagCore(GtagCommand.EVENT, measurementId, gtagParams || {}); return [3 /*break*/, 5]; case 4: e_2 = _a.sent(); logger.error(e_2); return [3 /*break*/, 5]; case 5: return [2 /*return*/]; } }); }); } /** * Wraps a standard gtag function with extra code to wait for completion of * relevant initialization promises before sending requests. * * @param gtagCore Basic gtag function that just appends to dataLayer. * @param initializationPromisesMap Map of appIds to their initialization promises. * @param dynamicConfigPromisesList Array of dynamic config fetch promises. * @param measurementIdToAppId Map of GA measurementIDs to corresponding Firebase appId. */ function wrapGtag(gtagCore, /** * Allows wrapped gtag calls to wait on whichever intialization promises are required, * depending on the contents of the gtag params' `send_to` field, if any. */ initializationPromisesMap, /** * Wrapped gtag calls sometimes require all dynamic config fetches to have returned * before determining what initialization promises (which include FIDs) to wait for. */ dynamicConfigPromisesList, /** * Wrapped gtag config calls can narrow down which initialization promise (with FID) * to wait for if the measurementId is already fetched, by getting the corresponding appId, * which is the key for the initialization promises map. */ measurementIdToAppId) { /** * Wrapper around gtag that ensures FID is sent with gtag calls. * @param command Gtag command type. * @param idOrNameOrParams Measurement ID if command is EVENT/CONFIG, params if command is SET. * @param gtagParams Params if event is EVENT/CONFIG. */ function gtagWrapper(command, idOrNameOrParams, gtagParams) { return Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["__awaiter"])(this, void 0, void 0, function () { var e_3; return Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["__generator"])(this, function (_a) { switch (_a.label) { case 0: _a.trys.push([0, 6, , 7]); if (!(command === GtagCommand.EVENT)) return [3 /*break*/, 2]; // If EVENT, second arg must be measurementId. return [4 /*yield*/, gtagOnEvent(gtagCore, initializationPromisesMap, dynamicConfigPromisesList, idOrNameOrParams, gtagParams)]; case 1: // If EVENT, second arg must be measurementId. _a.sent(); return [3 /*break*/, 5]; case 2: if (!(command === GtagCommand.CONFIG)) return [3 /*break*/, 4]; // If CONFIG, second arg must be measurementId. return [4 /*yield*/, gtagOnConfig(gtagCore, initializationPromisesMap, dynamicConfigPromisesList, measurementIdToAppId, idOrNameOrParams, gtagParams)]; case 3: // If CONFIG, second arg must be measurementId. _a.sent(); return [3 /*break*/, 5]; case 4: // If SET, second arg must be params. gtagCore(GtagCommand.SET, idOrNameOrParams); _a.label = 5; case 5: return [3 /*break*/, 7]; case 6: e_3 = _a.sent(); logger.error(e_3); return [3 /*break*/, 7]; case 7: return [2 /*return*/]; } }); }); } return gtagWrapper; } /** * Creates global gtag function or wraps existing one if found. * This wrapped function attaches Firebase instance ID (FID) to gtag 'config' and * 'event' calls that belong to the GAID associated with this Firebase instance. * * @param initializationPromisesMap Map of appIds to their initialization promises. * @param dynamicConfigPromisesList Array of dynamic config fetch promises. * @param measurementIdToAppId Map of GA measurementIDs to corresponding Firebase appId. * @param dataLayerName Name of global GA datalayer array. * @param gtagFunctionName Name of global gtag function ("gtag" if not user-specified). */ function wrapOrCreateGtag(initializationPromisesMap, dynamicConfigPromisesList, measurementIdToAppId, dataLayerName, gtagFunctionName) { // Create a basic core gtag function var gtagCore = function () { var _args = []; for (var _i = 0; _i < arguments.length; _i++) { _args[_i] = arguments[_i]; } // Must push IArguments object, not an array. window[dataLayerName].push(arguments); }; // Replace it with existing one if found if (window[gtagFunctionName] && typeof window[gtagFunctionName] === 'function') { // @ts-ignore gtagCore = window[gtagFunctionName]; } window[gtagFunctionName] = wrapGtag(gtagCore, initializationPromisesMap, dynamicConfigPromisesList, measurementIdToAppId); return { gtagCore: gtagCore, wrappedGtag: window[gtagFunctionName] }; } /** * Returns first script tag in DOM matching our gtag url pattern. */ function findGtagScriptOnPage() { var scriptTags = window.document.getElementsByTagName('script'); for (var _i = 0, _a = Object.values(scriptTags); _i < _a.length; _i++) { var tag = _a[_i]; if (tag.src && tag.src.includes(GTAG_URL)) { return tag; } } return null; } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var _a; var ERRORS = (_a = {}, _a["already-exists" /* ALREADY_EXISTS */] = 'A Firebase Analytics instance with the appId {$id} ' + ' already exists. ' + 'Only one Firebase Analytics instance can be created for each appId.', _a["already-initialized" /* ALREADY_INITIALIZED */] = 'Firebase Analytics has already been initialized.' + 'settings() must be called before initializing any Analytics instance' + 'or it will have no effect.', _a["interop-component-reg-failed" /* INTEROP_COMPONENT_REG_FAILED */] = 'Firebase Analytics Interop Component failed to instantiate: {$reason}', _a["invalid-analytics-context" /* INVALID_ANALYTICS_CONTEXT */] = 'Firebase Analytics is not supported in this environment. ' + 'Wrap initialization of analytics in analytics.isSupported() ' + 'to prevent initialization in unsupported environments. Details: {$errorInfo}', _a["indexeddb-unavailable" /* INDEXEDDB_UNAVAILABLE */] = 'IndexedDB unavailable or restricted in this environment. ' + 'Wrap initialization of analytics in analytics.isSupported() ' + 'to prevent initialization in unsupported environments. Details: {$errorInfo}', _a["fetch-throttle" /* FETCH_THROTTLE */] = 'The config fetch request timed out while in an exponential backoff state.' + ' Unix timestamp in milliseconds when fetch request throttling ends: {$throttleEndTimeMillis}.', _a["config-fetch-failed" /* CONFIG_FETCH_FAILED */] = 'Dynamic config fetch failed: [{$httpStatus}] {$responseMessage}', _a["no-api-key" /* NO_API_KEY */] = 'The "apiKey" field is empty in the local Firebase config. Firebase Analytics requires this field to' + 'contain a valid API key.', _a["no-app-id" /* NO_APP_ID */] = 'The "appId" field is empty in the local Firebase config. Firebase Analytics requires this field to' + 'contain a valid app ID.', _a); var ERROR_FACTORY = new __WEBPACK_IMPORTED_MODULE_4__firebase_util__["ErrorFactory"]('analytics', 'Analytics', ERRORS); /** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Backoff factor for 503 errors, which we want to be conservative about * to avoid overloading servers. Each retry interval will be * BASE_INTERVAL_MILLIS * LONG_RETRY_FACTOR ^ retryCount, so the second one * will be ~30 seconds (with fuzzing). */ var LONG_RETRY_FACTOR = 30; /** * Base wait interval to multiplied by backoffFactor^backoffCount. */ var BASE_INTERVAL_MILLIS = 1000; /** * Stubbable retry data storage class. */ var RetryData = /** @class */ (function () { function RetryData(throttleMetadata, intervalMillis) { if (throttleMetadata === void 0) { throttleMetadata = {}; } if (intervalMillis === void 0) { intervalMillis = BASE_INTERVAL_MILLIS; } this.throttleMetadata = throttleMetadata; this.intervalMillis = intervalMillis; } RetryData.prototype.getThrottleMetadata = function (appId) { return this.throttleMetadata[appId]; }; RetryData.prototype.setThrottleMetadata = function (appId, metadata) { this.throttleMetadata[appId] = metadata; }; RetryData.prototype.deleteThrottleMetadata = function (appId) { delete this.throttleMetadata[appId]; }; return RetryData; }()); var defaultRetryData = new RetryData(); /** * Set GET request headers. * @param apiKey App API key. */ function getHeaders(apiKey) { return new Headers({ Accept: 'application/json', 'x-goog-api-key': apiKey }); } /** * Fetches dynamic config from backend. * @param app Firebase app to fetch config for. */ function fetchDynamicConfig(appFields) { var _a; return Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["__awaiter"])(this, void 0, void 0, function () { var appId, apiKey, request, appUrl, response, errorMessage, jsonResponse, _ignored_1; return Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["__generator"])(this, function (_b) { switch (_b.label) { case 0: appId = appFields.appId, apiKey = appFields.apiKey; request = { method: 'GET', headers: getHeaders(apiKey) }; appUrl = DYNAMIC_CONFIG_URL.replace('{app-id}', appId); return [4 /*yield*/, fetch(appUrl, request)]; case 1: response = _b.sent(); if (!(response.status !== 200 && response.status !== 304)) return [3 /*break*/, 6]; errorMessage = ''; _b.label = 2; case 2: _b.trys.push([2, 4, , 5]); return [4 /*yield*/, response.json()]; case 3: jsonResponse = (_b.sent()); if ((_a = jsonResponse.error) === null || _a === void 0 ? void 0 : _a.message) { errorMessage = jsonResponse.error.message; } return [3 /*break*/, 5]; case 4: _ignored_1 = _b.sent(); return [3 /*break*/, 5]; case 5: throw ERROR_FACTORY.create("config-fetch-failed" /* CONFIG_FETCH_FAILED */, { httpStatus: response.status, responseMessage: errorMessage }); case 6: return [2 /*return*/, response.json()]; } }); }); } /** * Fetches dynamic config from backend, retrying if failed. * @param app Firebase app to fetch config for. */ function fetchDynamicConfigWithRetry(app, // retryData and timeoutMillis are parameterized to allow passing a different value for testing. retryData, timeoutMillis) { if (retryData === void 0) { retryData = defaultRetryData; } return Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["__awaiter"])(this, void 0, void 0, function () { var _a, appId, apiKey, measurementId, throttleMetadata, signal; var _this = this; return Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["__generator"])(this, function (_b) { _a = app.options, appId = _a.appId, apiKey = _a.apiKey, measurementId = _a.measurementId; if (!appId) { throw ERROR_FACTORY.create("no-app-id" /* NO_APP_ID */); } if (!apiKey) { if (measurementId) { return [2 /*return*/, { measurementId: measurementId, appId: appId }]; } throw ERROR_FACTORY.create("no-api-key" /* NO_API_KEY */); } throttleMetadata = retryData.getThrottleMetadata(appId) || { backoffCount: 0, throttleEndTimeMillis: Date.now() }; signal = new AnalyticsAbortSignal(); setTimeout(function () { return Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["__awaiter"])(_this, void 0, void 0, function () { return Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["__generator"])(this, function (_a) { // Note a very low delay, eg < 10ms, can elapse before listeners are initialized. signal.abort(); return [2 /*return*/]; }); }); }, timeoutMillis !== undefined ? timeoutMillis : FETCH_TIMEOUT_MILLIS); return [2 /*return*/, attemptFetchDynamicConfigWithRetry({ appId: appId, apiKey: apiKey, measurementId: measurementId }, throttleMetadata, signal, retryData)]; }); }); } /** * Runs one retry attempt. * @param appFields Necessary app config fields. * @param throttleMetadata Ongoing metadata to determine throttling times. * @param signal Abort signal. */ function attemptFetchDynamicConfigWithRetry(appFields, _a, signal, retryData // for testing ) { var throttleEndTimeMillis = _a.throttleEndTimeMillis, backoffCount = _a.backoffCount; if (retryData === void 0) { retryData = defaultRetryData; } return Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["__awaiter"])(this, void 0, void 0, function () { var appId, measurementId, e_1, response, e_2, backoffMillis, throttleMetadata; return Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["__generator"])(this, function (_b) { switch (_b.label) { case 0: appId = appFields.appId, measurementId = appFields.measurementId; _b.label = 1; case 1: _b.trys.push([1, 3, , 4]); return [4 /*yield*/, setAbortableTimeout(signal, throttleEndTimeMillis)]; case 2: _b.sent(); return [3 /*break*/, 4]; case 3: e_1 = _b.sent(); if (measurementId) { logger.warn("Timed out fetching this Firebase app's measurement ID from the server." + (" Falling back to the measurement ID " + measurementId) + (" provided in the \"measurementId\" field in the local Firebase config. [" + e_1.message + "]")); return [2 /*return*/, { appId: appId, measurementId: measurementId }]; } throw e_1; case 4: _b.trys.push([4, 6, , 7]); return [4 /*yield*/, fetchDynamicConfig(appFields)]; case 5: response = _b.sent(); // Note the SDK only clears throttle state if response is success or non-retriable. retryData.deleteThrottleMetadata(appId); return [2 /*return*/, response]; case 6: e_2 = _b.sent(); if (!isRetriableError(e_2)) { retryData.deleteThrottleMetadata(appId); if (measurementId) { logger.warn("Failed to fetch this Firebase app's measurement ID from the server." + (" Falling back to the measurement ID " + measurementId) + (" provided in the \"measurementId\" field in the local Firebase config. [" + e_2.message + "]")); return [2 /*return*/, { appId: appId, measurementId: measurementId }]; } else { throw e_2; } } backoffMillis = Number(e_2.httpStatus) === 503 ? Object(__WEBPACK_IMPORTED_MODULE_4__firebase_util__["calculateBackoffMillis"])(backoffCount, retryData.intervalMillis, LONG_RETRY_FACTOR) : Object(__WEBPACK_IMPORTED_MODULE_4__firebase_util__["calculateBackoffMillis"])(backoffCount, retryData.intervalMillis); throttleMetadata = { throttleEndTimeMillis: Date.now() + backoffMillis, backoffCount: backoffCount + 1 }; // Persists state. retryData.setThrottleMetadata(appId, throttleMetadata); logger.debug("Calling attemptFetch again in " + backoffMillis + " millis"); return [2 /*return*/, attemptFetchDynamicConfigWithRetry(appFields, throttleMetadata, signal, retryData)]; case 7: return [2 /*return*/]; } }); }); } /** * Supports waiting on a backoff by: * * <ul> * <li>Promisifying setTimeout, so we can set a timeout in our Promise chain</li> * <li>Listening on a signal bus for abort events, just like the Fetch API</li> * <li>Failing in the same way the Fetch API fails, so timing out a live request and a throttled * request appear the same.</li> * </ul> * * <p>Visible for testing. */ function setAbortableTimeout(signal, throttleEndTimeMillis) { return new Promise(function (resolve, reject) { // Derives backoff from given end time, normalizing negative numbers to zero. var backoffMillis = Math.max(throttleEndTimeMillis - Date.now(), 0); var timeout = setTimeout(resolve, backoffMillis); // Adds listener, rather than sets onabort, because signal is a shared object. signal.addEventListener(function () { clearTimeout(timeout); // If the request completes before this timeout, the rejection has no effect. reject(ERROR_FACTORY.create("fetch-throttle" /* FETCH_THROTTLE */, { throttleEndTimeMillis: throttleEndTimeMillis })); }); }); } /** * Returns true if the {@link Error} indicates a fetch request may succeed later. */ function isRetriableError(e) { if (!(e instanceof __WEBPACK_IMPORTED_MODULE_4__firebase_util__["FirebaseError"])) { return false; } // Uses string index defined by ErrorData, which FirebaseError implements. var httpStatus = Number(e['httpStatus']); return (httpStatus === 429 || httpStatus === 500 || httpStatus === 503 || httpStatus === 504); } /** * Shims a minimal AbortSignal (copied from Remote Config). * * <p>AbortController's AbortSignal conveniently decouples fetch timeout logic from other aspects * of networking, such as retries. Firebase doesn't use AbortController enough to justify a * polyfill recommendation, like we do with the Fetch API, but this minimal shim can easily be * swapped out if/when we do. */ var AnalyticsAbortSignal = /** @class */ (function () { function AnalyticsAbortSignal() { this.listeners = []; } AnalyticsAbortSignal.prototype.addEventListener = function (listener) { this.listeners.push(listener); }; AnalyticsAbortSignal.prototype.abort = function () { this.listeners.forEach(function (listener) { return listener(); }); }; return AnalyticsAbortSignal; }()); /** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ function validateIndexedDB() { return Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["__awaiter"])(this, void 0, void 0, function () { var e_1; return Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["__generator"])(this, function (_a) { switch (_a.label) { case 0: if (!!Object(__WEBPACK_IMPORTED_MODULE_4__firebase_util__["isIndexedDBAvailable"])()) return [3 /*break*/, 1]; logger.warn(ERROR_FACTORY.create("indexeddb-unavailable" /* INDEXEDDB_UNAVAILABLE */, { errorInfo: 'IndexedDB is not available in this environment.' }).message); return [2 /*return*/, false]; case 1: _a.trys.push([1, 3, , 4]); return [4 /*yield*/, Object(__WEBPACK_IMPORTED_MODULE_4__firebase_util__["validateIndexedDBOpenable"])()]; case 2: _a.sent(); return [3 /*break*/, 4]; case 3: e_1 = _a.sent(); logger.warn(ERROR_FACTORY.create("indexeddb-unavailable" /* INDEXEDDB_UNAVAILABLE */, { errorInfo: e_1 }).message); return [2 /*return*/, false]; case 4: return [2 /*return*/, true]; } }); }); } /** * Initialize the analytics instance in gtag.js by calling config command with fid. * * NOTE: We combine analytics initialization and setting fid together because we want fid to be * part of the `page_view` event that's sent during the initialization * @param app Firebase app * @param gtagCore The gtag function that's not wrapped. * @param dynamicConfigPromisesList Array of all dynamic config promises. * @param measurementIdToAppId Maps measurementID to appID. * @param installations FirebaseInstallations instance. * * @returns Measurement ID. */ function initializeIds(app, dynamicConfigPromisesList, measurementIdToAppId, installations, gtagCore) { return Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["__awaiter"])(this, void 0, void 0, function () { var dynamicConfigPromise, fidPromise, _a, dynamicConfig, fid, configProperties; var _b; return Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["__generator"])(this, function (_c) { switch (_c.label) { case 0: dynamicConfigPromise = fetchDynamicConfigWithRetry(app); // Once fetched, map measurementIds to appId, for ease of lookup in wrapped gtag function. dynamicConfigPromise .then(function (config) { measurementIdToAppId[config.measurementId] = config.appId; if (app.options.measurementId && config.measurementId !== app.options.measurementId) { logger.warn("The measurement ID in the local Firebase config (" + app.options.measurementId + ")" + (" does not match the measurement ID fetched from the server (" + config.measurementId + ").") + " To ensure analytics events are always sent to the correct Analytics property," + " update the" + " measurement ID field in the local config or remove it from the local config."); } }) .catch(function (e) { return logger.error(e); }); // Add to list to track state of all dynamic config promises. dynamicConfigPromisesList.push(dynamicConfigPromise); fidPromise = validateIndexedDB().then(function (envIsValid) { if (envIsValid) { return installations.getId(); } else { return undefined; } }); return [4 /*yield*/, Promise.all([ dynamicConfigPromise, fidPromise ])]; case 1: _a = _c.sent(), dynamicConfig = _a[0], fid = _a[1]; // This command initializes gtag.js and only needs to be called once for the entire web app, // but since it is idempotent, we can call it multiple times. // We keep it together with other initialization logic for better code structure. // eslint-disable-next-line @typescript-eslint/no-explicit-any gtagCore('js', new Date()); configProperties = (_b = {}, // guard against developers accidentally setting properties with prefix `firebase_` _b[ORIGIN_KEY] = 'firebase', _b.update = true, _b); if (fid != null) { configProperties[GA_FID_KEY] = fid; } // It should be the first config command called on this GA-ID // Initialize this GA-ID and set FID on it using the gtag config API. gtagCore(GtagCommand.CONFIG, dynamicConfig.measurementId, configProperties); return [2 /*return*/, dynamicConfig.measurementId]; } }); }); } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Maps appId to full initialization promise. Wrapped gtag calls must wait on * all or some of these, depending on the call's `send_to` param and the status * of the dynamic config fetches (see below). */ var initializationPromisesMap = {}; /** * List of dynamic config fetch promises. In certain cases, wrapped gtag calls * wait on all these to be complete in order to determine if it can selectively * wait for only certain initialization (FID) promises or if it must wait for all. */ var dynamicConfigPromisesList = []; /** * Maps fetched measurementIds to appId. Populated when the app's dynamic config * fetch completes. If already populated, gtag config calls can use this to * selectively wait for only this app's initialization promise (FID) instead of all * initialization promises. */ var measurementIdToAppId = {}; /** * Name for window global data layer array used by GA: defaults to 'dataLayer'. */ var dataLayerName = 'dataLayer'; /** * Name for window global gtag function used by GA: defaults to 'gtag'. */ var gtagName = 'gtag'; /** * Reproduction of standard gtag function or reference to existing * gtag function on window object. */ var gtagCoreFunction; /** * Wrapper around gtag function that ensures FID is sent with all * relevant event and config calls. */ var wrappedGtagFunction; /** * Flag to ensure page initialization steps (creation or wrapping of * dataLayer and gtag script) are only run once per page load. */ var globalInitDone = false; /** * For testing */ function resetGlobalVars(newGlobalInitDone, newInitializationPromisesMap, newDynamicPromises) { if (newGlobalInitDone === void 0) { newGlobalInitDone = false; } if (newInitializationPromisesMap === void 0) { newInitializationPromisesMap = {}; } if (newDynamicPromises === void 0) { newDynamicPromises = []; } globalInitDone = newGlobalInitDone; initializationPromisesMap = newInitializationPromisesMap; dynamicConfigPromisesList = newDynamicPromises; dataLayerName = 'dataLayer'; gtagName = 'gtag'; } /** * For testing */ function getGlobalVars() { return { initializationPromisesMap: initializationPromisesMap, dynamicConfigPromisesList: dynamicConfigPromisesList }; } /** * This must be run before calling firebase.analytics() or it won't * have any effect. * @param options Custom gtag and dataLayer names. */ function settings(options) { if (globalInitDone) { throw ERROR_FACTORY.create("already-initialized" /* ALREADY_INITIALIZED */); } if (options.dataLayerName) { dataLayerName = options.dataLayerName; } if (options.gtagName) { gtagName = options.gtagName; } } /** * Returns true if no environment mismatch is found. * If environment mismatches are found, throws an INVALID_ANALYTICS_CONTEXT * error that also lists details for each mismatch found. */ function warnOnBrowserContextMismatch() { var mismatchedEnvMessages = []; if (Object(__WEBPACK_IMPORTED_MODULE_4__firebase_util__["isBrowserExtension"])()) { mismatchedEnvMessages.push('This is a browser extension environment.'); } if (!Object(__WEBPACK_IMPORTED_MODULE_4__firebase_util__["areCookiesEnabled"])()) { mismatchedEnvMessages.push('Cookies are not available.'); } if (mismatchedEnvMessages.length > 0) { var details = mismatchedEnvMessages .map(function (message, index) { return "(" + (index + 1) + ") " + message; }) .join(' '); var err = ERROR_FACTORY.create("invalid-analytics-context" /* INVALID_ANALYTICS_CONTEXT */, { errorInfo: details }); logger.warn(err.message); } } function factory(app, installations) { warnOnBrowserContextMismatch(); var appId = app.options.appId; if (!appId) { throw ERROR_FACTORY.create("no-app-id" /* NO_APP_ID */); } if (!app.options.apiKey) { if (app.options.measurementId) { logger.warn("The \"apiKey\" field is empty in the local Firebase config. This is needed to fetch the latest" + (" measurement ID for this Firebase app. Falling back to the measurement ID " + app.options.measurementId) + " provided in the \"measurementId\" field in the local Firebase config."); } else { throw ERROR_FACTORY.create("no-api-key" /* NO_API_KEY */); } } if (initializationPromisesMap[appId] != null) { throw ERROR_FACTORY.create("already-exists" /* ALREADY_EXISTS */, { id: appId }); } if (!globalInitDone) { // Steps here should only be done once per page: creation or wrapping // of dataLayer and global gtag function. // Detect if user has already put the gtag <script> tag on this page. if (!findGtagScriptOnPage()) { insertScriptTag(dataLayerName); } getOrCreateDataLayer(dataLayerName); var _a = wrapOrCreateGtag(initializationPromisesMap, dynamicConfigPromisesList, measurementIdToAppId, dataLayerName, gtagName), wrappedGtag = _a.wrappedGtag, gtagCore = _a.gtagCore; wrappedGtagFunction = wrappedGtag; gtagCoreFunction = gtagCore; globalInitDone = true; } // Async but non-blocking. // This map reflects the completion state of all promises for each appId. initializationPromisesMap[appId] = initializeIds(app, dynamicConfigPromisesList, measurementIdToAppId, installations, gtagCoreFunction); var analyticsInstance = { app: app, // Public methods return void for API simplicity and to better match gtag, // while internal implementations return promises. logEvent: function (eventName, eventParams, options) { logEvent(wrappedGtagFunction, initializationPromisesMap[appId], eventName, eventParams, options).catch(function (e) { return logger.error(e); }); }, setCurrentScreen: function (screenName, options) { setCurrentScreen(wrappedGtagFunction, initializationPromisesMap[appId], screenName, options).catch(function (e) { return logger.error(e); }); }, setUserId: function (id, options) { setUserId(wrappedGtagFunction, initializationPromisesMap[appId], id, options).catch(function (e) { return logger.error(e); }); }, setUserProperties: function (properties, options) { setUserProperties(wrappedGtagFunction, initializationPromisesMap[appId], properties, options).catch(function (e) { return logger.error(e); }); }, setAnalyticsCollectionEnabled: function (enabled) { setAnalyticsCollectionEnabled(initializationPromisesMap[appId], enabled).catch(function (e) { return logger.error(e); }); }, INTERNAL: { delete: function () { delete initializationPromisesMap[appId]; return Promise.resolve(); } } }; return analyticsInstance; } var name = "@firebase/analytics"; var version = "0.6.0"; /** * Type constant for Firebase Analytics. */ var ANALYTICS_TYPE = 'analytics'; function registerAnalytics(instance) { instance.INTERNAL.registerComponent(new __WEBPACK_IMPORTED_MODULE_5__firebase_component__["Component"](ANALYTICS_TYPE, function (container) { // getImmediate for FirebaseApp will always succeed var app = container.getProvider('app').getImmediate(); var installations = container .getProvider('installations') .getImmediate(); return factory(app, installations); }, "PUBLIC" /* PUBLIC */).setServiceProps({ settings: settings, EventName: EventName, isSupported: isSupported })); instance.INTERNAL.registerComponent(new __WEBPACK_IMPORTED_MODULE_5__firebase_component__["Component"]('analytics-internal', internalFactory, "PRIVATE" /* PRIVATE */)); instance.registerVersion(name, version); function internalFactory(container) { try { var analytics = container.getProvider(ANALYTICS_TYPE).getImmediate(); return { logEvent: analytics.logEvent }; } catch (e) { throw ERROR_FACTORY.create("interop-component-reg-failed" /* INTEROP_COMPONENT_REG_FAILED */, { reason: e }); } } } registerAnalytics(__WEBPACK_IMPORTED_MODULE_1__firebase_app___default.a); /** * this is a public static method provided to users that wraps four different checks: * * 1. check if it's not a browser extension environment. * 1. check if cookie is enabled in current browser. * 3. check if IndexedDB is supported by the browser environment. * 4. check if the current browser context is valid for using IndexedDB. * */ function isSupported() { return Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["__awaiter"])(this, void 0, void 0, function () { var isDBOpenable, error_1; return Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["__generator"])(this, function (_a) { switch (_a.label) { case 0: if (Object(__WEBPACK_IMPORTED_MODULE_4__firebase_util__["isBrowserExtension"])()) { return [2 /*return*/, false]; } if (!Object(__WEBPACK_IMPORTED_MODULE_4__firebase_util__["areCookiesEnabled"])()) { return [2 /*return*/, false]; } if (!Object(__WEBPACK_IMPORTED_MODULE_4__firebase_util__["isIndexedDBAvailable"])()) { return [2 /*return*/, false]; } _a.label = 1; case 1: _a.trys.push([1, 3, , 4]); return [4 /*yield*/, Object(__WEBPACK_IMPORTED_MODULE_4__firebase_util__["validateIndexedDBOpenable"])()]; case 2: isDBOpenable = _a.sent(); return [2 /*return*/, isDBOpenable]; case 3: error_1 = _a.sent(); return [2 /*return*/, false]; case 4: return [2 /*return*/]; } }); }); } //# sourceMappingURL=index.esm.js.map /***/ }), /***/ "./node_modules/@firebase/analytics/node_modules/@firebase/component/dist/index.cjs.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, '__esModule', { value: true }); var tslib = __webpack_require__("./node_modules/@firebase/analytics/node_modules/tslib/tslib.es6.js"); var util = __webpack_require__("./node_modules/@firebase/analytics/node_modules/@firebase/util/dist/index.cjs.js"); /** * Component for service name T, e.g. `auth`, `auth-internal` */ var Component = /** @class */ (function () { /** * * @param name The public service name, e.g. app, auth, firestore, database * @param instanceFactory Service factory responsible for creating the public interface * @param type whether the service provided by the component is public or private */ function Component(name, instanceFactory, type) { this.name = name; this.instanceFactory = instanceFactory; this.type = type; this.multipleInstances = false; /** * Properties to be added to the service namespace */ this.serviceProps = {}; this.instantiationMode = "LAZY" /* LAZY */; } Component.prototype.setInstantiationMode = function (mode) { this.instantiationMode = mode; return this; }; Component.prototype.setMultipleInstances = function (multipleInstances) { this.multipleInstances = multipleInstances; return this; }; Component.prototype.setServiceProps = function (props) { this.serviceProps = props; return this; }; return Component; }()); /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var DEFAULT_ENTRY_NAME = '[DEFAULT]'; /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Provider for instance for service name T, e.g. 'auth', 'auth-internal' * NameServiceMapping[T] is an alias for the type of the instance */ var Provider = /** @class */ (function () { function Provider(name, container) { this.name = name; this.container = container; this.component = null; this.instances = new Map(); this.instancesDeferred = new Map(); } /** * @param identifier A provider can provide mulitple instances of a service * if this.component.multipleInstances is true. */ Provider.prototype.get = function (identifier) { if (identifier === void 0) { identifier = DEFAULT_ENTRY_NAME; } // if multipleInstances is not supported, use the default name var normalizedIdentifier = this.normalizeInstanceIdentifier(identifier); if (!this.instancesDeferred.has(normalizedIdentifier)) { var deferred = new util.Deferred(); this.instancesDeferred.set(normalizedIdentifier, deferred); // If the service instance is available, resolve the promise with it immediately try { var instance = this.getOrInitializeService(normalizedIdentifier); if (instance) { deferred.resolve(instance); } } catch (e) { // when the instance factory throws an exception during get(), it should not cause // a fatal error. We just return the unresolved promise in this case. } } return this.instancesDeferred.get(normalizedIdentifier).promise; }; Provider.prototype.getImmediate = function (options) { var _a = tslib.__assign({ identifier: DEFAULT_ENTRY_NAME, optional: false }, options), identifier = _a.identifier, optional = _a.optional; // if multipleInstances is not supported, use the default name var normalizedIdentifier = this.normalizeInstanceIdentifier(identifier); try { var instance = this.getOrInitializeService(normalizedIdentifier); if (!instance) { if (optional) { return null; } throw Error("Service " + this.name + " is not available"); } return instance; } catch (e) { if (optional) { return null; } else { throw e; } } }; Provider.prototype.getComponent = function () { return this.component; }; Provider.prototype.setComponent = function (component) { var e_1, _a; if (component.name !== this.name) { throw Error("Mismatching Component " + component.name + " for Provider " + this.name + "."); } if (this.component) { throw Error("Component for " + this.name + " has already been provided"); } this.component = component; // if the service is eager, initialize the default instance if (isComponentEager(component)) { try { this.getOrInitializeService(DEFAULT_ENTRY_NAME); } catch (e) { // when the instance factory for an eager Component throws an exception during the eager // initialization, it should not cause a fatal error. // TODO: Investigate if we need to make it configurable, because some component may want to cause // a fatal error in this case? } } try { // Create service instances for the pending promises and resolve them // NOTE: if this.multipleInstances is false, only the default instance will be created // and all promises with resolve with it regardless of the identifier. for (var _b = tslib.__values(this.instancesDeferred.entries()), _c = _b.next(); !_c.done; _c = _b.next()) { var _d = tslib.__read(_c.value, 2), instanceIdentifier = _d[0], instanceDeferred = _d[1]; var normalizedIdentifier = this.normalizeInstanceIdentifier(instanceIdentifier); try { // `getOrInitializeService()` should always return a valid instance since a component is guaranteed. use ! to make typescript happy. var instance = this.getOrInitializeService(normalizedIdentifier); instanceDeferred.resolve(instance); } catch (e) { // when the instance factory throws an exception, it should not cause // a fatal error. We just leave the promise unresolved. } } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (_c && !_c.done && (_a = _b.return)) _a.call(_b); } finally { if (e_1) throw e_1.error; } } }; Provider.prototype.clearInstance = function (identifier) { if (identifier === void 0) { identifier = DEFAULT_ENTRY_NAME; } this.instancesDeferred.delete(identifier); this.instances.delete(identifier); }; // app.delete() will call this method on every provider to delete the services // TODO: should we mark the provider as deleted? Provider.prototype.delete = function () { return tslib.__awaiter(this, void 0, void 0, function () { var services; return tslib.__generator(this, function (_a) { switch (_a.label) { case 0: services = Array.from(this.instances.values()); return [4 /*yield*/, Promise.all(tslib.__spread(services .filter(function (service) { return 'INTERNAL' in service; }) // legacy services // eslint-disable-next-line @typescript-eslint/no-explicit-any .map(function (service) { return service.INTERNAL.delete(); }), services .filter(function (service) { return '_delete' in service; }) // modularized services // eslint-disable-next-line @typescript-eslint/no-explicit-any .map(function (service) { return service._delete(); })))]; case 1: _a.sent(); return [2 /*return*/]; } }); }); }; Provider.prototype.isComponentSet = function () { return this.component != null; }; Provider.prototype.getOrInitializeService = function (identifier) { var instance = this.instances.get(identifier); if (!instance && this.component) { instance = this.component.instanceFactory(this.container, normalizeIdentifierForFactory(identifier)); this.instances.set(identifier, instance); } return instance || null; }; Provider.prototype.normalizeInstanceIdentifier = function (identifier) { if (this.component) { return this.component.multipleInstances ? identifier : DEFAULT_ENTRY_NAME; } else { return identifier; // assume multiple instances are supported before the component is provided. } }; return Provider; }()); // undefined should be passed to the service factory for the default instance function normalizeIdentifierForFactory(identifier) { return identifier === DEFAULT_ENTRY_NAME ? undefined : identifier; } function isComponentEager(component) { return component.instantiationMode === "EAGER" /* EAGER */; } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * ComponentContainer that provides Providers for service name T, e.g. `auth`, `auth-internal` */ var ComponentContainer = /** @class */ (function () { function ComponentContainer(name) { this.name = name; this.providers = new Map(); } /** * * @param component Component being added * @param overwrite When a component with the same name has already been registered, * if overwrite is true: overwrite the existing component with the new component and create a new * provider with the new component. It can be useful in tests where you want to use different mocks * for different tests. * if overwrite is false: throw an exception */ ComponentContainer.prototype.addComponent = function (component) { var provider = this.getProvider(component.name); if (provider.isComponentSet()) { throw new Error("Component " + component.name + " has already been registered with " + this.name); } provider.setComponent(component); }; ComponentContainer.prototype.addOrOverwriteComponent = function (component) { var provider = this.getProvider(component.name); if (provider.isComponentSet()) { // delete the existing provider from the container, so we can register the new component this.providers.delete(component.name); } this.addComponent(component); }; /** * getProvider provides a type safe interface where it can only be called with a field name * present in NameServiceMapping interface. * * Firebase SDKs providing services should extend NameServiceMapping interface to register * themselves. */ ComponentContainer.prototype.getProvider = function (name) { if (this.providers.has(name)) { return this.providers.get(name); } // create a Provider for a service that hasn't registered with Firebase var provider = new Provider(name, this); this.providers.set(name, provider); return provider; }; ComponentContainer.prototype.getProviders = function () { return Array.from(this.providers.values()); }; return ComponentContainer; }()); exports.Component = Component; exports.ComponentContainer = ComponentContainer; exports.Provider = Provider; //# sourceMappingURL=index.cjs.js.map /***/ }), /***/ "./node_modules/@firebase/analytics/node_modules/@firebase/installations/dist/index.esm.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export registerInstallations */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__firebase_app__ = __webpack_require__("./node_modules/@firebase/app/dist/index.cjs.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__firebase_app___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__firebase_app__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__firebase_component__ = __webpack_require__("./node_modules/@firebase/analytics/node_modules/@firebase/component/dist/index.cjs.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__firebase_component___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1__firebase_component__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_tslib__ = __webpack_require__("./node_modules/@firebase/analytics/node_modules/tslib/tslib.es6.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__firebase_util__ = __webpack_require__("./node_modules/@firebase/analytics/node_modules/@firebase/util/dist/index.cjs.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__firebase_util___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3__firebase_util__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_idb__ = __webpack_require__("./node_modules/idb/build/idb.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_idb___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_idb__); var name = "@firebase/installations"; var version = "0.4.17"; /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var PENDING_TIMEOUT_MS = 10000; var PACKAGE_VERSION = "w:" + version; var INTERNAL_AUTH_VERSION = 'FIS_v2'; var INSTALLATIONS_API_URL = 'https://firebaseinstallations.googleapis.com/v1'; var TOKEN_EXPIRATION_BUFFER = 60 * 60 * 1000; // One hour var SERVICE = 'installations'; var SERVICE_NAME = 'Installations'; /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var _a; var ERROR_DESCRIPTION_MAP = (_a = {}, _a["missing-app-config-values" /* MISSING_APP_CONFIG_VALUES */] = 'Missing App configuration value: "{$valueName}"', _a["not-registered" /* NOT_REGISTERED */] = 'Firebase Installation is not registered.', _a["installation-not-found" /* INSTALLATION_NOT_FOUND */] = 'Firebase Installation not found.', _a["request-failed" /* REQUEST_FAILED */] = '{$requestName} request failed with error "{$serverCode} {$serverStatus}: {$serverMessage}"', _a["app-offline" /* APP_OFFLINE */] = 'Could not process request. Application offline.', _a["delete-pending-registration" /* DELETE_PENDING_REGISTRATION */] = "Can't delete installation while there is a pending registration request.", _a); var ERROR_FACTORY = new __WEBPACK_IMPORTED_MODULE_3__firebase_util__["ErrorFactory"](SERVICE, SERVICE_NAME, ERROR_DESCRIPTION_MAP); /** Returns true if error is a FirebaseError that is based on an error from the server. */ function isServerError(error) { return (error instanceof __WEBPACK_IMPORTED_MODULE_3__firebase_util__["FirebaseError"] && error.code.includes("request-failed" /* REQUEST_FAILED */)); } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ function getInstallationsEndpoint(_a) { var projectId = _a.projectId; return INSTALLATIONS_API_URL + "/projects/" + projectId + "/installations"; } function extractAuthTokenInfoFromResponse(response) { return { token: response.token, requestStatus: 2 /* COMPLETED */, expiresIn: getExpiresInFromResponseExpiresIn(response.expiresIn), creationTime: Date.now() }; } function getErrorFromResponse(requestName, response) { return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__awaiter"])(this, void 0, void 0, function () { var responseJson, errorData; return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__generator"])(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, response.json()]; case 1: responseJson = _a.sent(); errorData = responseJson.error; return [2 /*return*/, ERROR_FACTORY.create("request-failed" /* REQUEST_FAILED */, { requestName: requestName, serverCode: errorData.code, serverMessage: errorData.message, serverStatus: errorData.status })]; } }); }); } function getHeaders(_a) { var apiKey = _a.apiKey; return new Headers({ 'Content-Type': 'application/json', Accept: 'application/json', 'x-goog-api-key': apiKey }); } function getHeadersWithAuth(appConfig, _a) { var refreshToken = _a.refreshToken; var headers = getHeaders(appConfig); headers.append('Authorization', getAuthorizationHeader(refreshToken)); return headers; } /** * Calls the passed in fetch wrapper and returns the response. * If the returned response has a status of 5xx, re-runs the function once and * returns the response. */ function retryIfServerError(fn) { return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__awaiter"])(this, void 0, void 0, function () { var result; return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__generator"])(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, fn()]; case 1: result = _a.sent(); if (result.status >= 500 && result.status < 600) { // Internal Server Error. Retry request. return [2 /*return*/, fn()]; } return [2 /*return*/, result]; } }); }); } function getExpiresInFromResponseExpiresIn(responseExpiresIn) { // This works because the server will never respond with fractions of a second. return Number(responseExpiresIn.replace('s', '000')); } function getAuthorizationHeader(refreshToken) { return INTERNAL_AUTH_VERSION + " " + refreshToken; } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ function createInstallationRequest(appConfig, _a) { var fid = _a.fid; return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__awaiter"])(this, void 0, void 0, function () { var endpoint, headers, body, request, response, responseValue, registeredInstallationEntry; return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__generator"])(this, function (_b) { switch (_b.label) { case 0: endpoint = getInstallationsEndpoint(appConfig); headers = getHeaders(appConfig); body = { fid: fid, authVersion: INTERNAL_AUTH_VERSION, appId: appConfig.appId, sdkVersion: PACKAGE_VERSION }; request = { method: 'POST', headers: headers, body: JSON.stringify(body) }; return [4 /*yield*/, retryIfServerError(function () { return fetch(endpoint, request); })]; case 1: response = _b.sent(); if (!response.ok) return [3 /*break*/, 3]; return [4 /*yield*/, response.json()]; case 2: responseValue = _b.sent(); registeredInstallationEntry = { fid: responseValue.fid || fid, registrationStatus: 2 /* COMPLETED */, refreshToken: responseValue.refreshToken, authToken: extractAuthTokenInfoFromResponse(responseValue.authToken) }; return [2 /*return*/, registeredInstallationEntry]; case 3: return [4 /*yield*/, getErrorFromResponse('Create Installation', response)]; case 4: throw _b.sent(); } }); }); } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** Returns a promise that resolves after given time passes. */ function sleep(ms) { return new Promise(function (resolve) { setTimeout(resolve, ms); }); } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ function bufferToBase64UrlSafe(array) { var b64 = btoa(String.fromCharCode.apply(String, Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__spread"])(array))); return b64.replace(/\+/g, '-').replace(/\//g, '_'); } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var VALID_FID_PATTERN = /^[cdef][\w-]{21}$/; var INVALID_FID = ''; /** * Generates a new FID using random values from Web Crypto API. * Returns an empty string if FID generation fails for any reason. */ function generateFid() { try { // A valid FID has exactly 22 base64 characters, which is 132 bits, or 16.5 // bytes. our implementation generates a 17 byte array instead. var fidByteArray = new Uint8Array(17); var crypto_1 = self.crypto || self.msCrypto; crypto_1.getRandomValues(fidByteArray); // Replace the first 4 random bits with the constant FID header of 0b0111. fidByteArray[0] = 112 + (fidByteArray[0] % 16); var fid = encode(fidByteArray); return VALID_FID_PATTERN.test(fid) ? fid : INVALID_FID; } catch (_a) { // FID generation errored return INVALID_FID; } } /** Converts a FID Uint8Array to a base64 string representation. */ function encode(fidByteArray) { var b64String = bufferToBase64UrlSafe(fidByteArray); // Remove the 23rd character that was added because of the extra 4 bits at the // end of our 17 byte array, and the '=' padding. return b64String.substr(0, 22); } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** Returns a string key that can be used to identify the app. */ function getKey(appConfig) { return appConfig.appName + "!" + appConfig.appId; } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var fidChangeCallbacks = new Map(); /** * Calls the onIdChange callbacks with the new FID value, and broadcasts the * change to other tabs. */ function fidChanged(appConfig, fid) { var key = getKey(appConfig); callFidChangeCallbacks(key, fid); broadcastFidChange(key, fid); } function addCallback(appConfig, callback) { // Open the broadcast channel if it's not already open, // to be able to listen to change events from other tabs. getBroadcastChannel(); var key = getKey(appConfig); var callbackSet = fidChangeCallbacks.get(key); if (!callbackSet) { callbackSet = new Set(); fidChangeCallbacks.set(key, callbackSet); } callbackSet.add(callback); } function removeCallback(appConfig, callback) { var key = getKey(appConfig); var callbackSet = fidChangeCallbacks.get(key); if (!callbackSet) { return; } callbackSet.delete(callback); if (callbackSet.size === 0) { fidChangeCallbacks.delete(key); } // Close broadcast channel if there are no more callbacks. closeBroadcastChannel(); } function callFidChangeCallbacks(key, fid) { var e_1, _a; var callbacks = fidChangeCallbacks.get(key); if (!callbacks) { return; } try { for (var callbacks_1 = Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__values"])(callbacks), callbacks_1_1 = callbacks_1.next(); !callbacks_1_1.done; callbacks_1_1 = callbacks_1.next()) { var callback = callbacks_1_1.value; callback(fid); } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (callbacks_1_1 && !callbacks_1_1.done && (_a = callbacks_1.return)) _a.call(callbacks_1); } finally { if (e_1) throw e_1.error; } } } function broadcastFidChange(key, fid) { var channel = getBroadcastChannel(); if (channel) { channel.postMessage({ key: key, fid: fid }); } closeBroadcastChannel(); } var broadcastChannel = null; /** Opens and returns a BroadcastChannel if it is supported by the browser. */ function getBroadcastChannel() { if (!broadcastChannel && 'BroadcastChannel' in self) { broadcastChannel = new BroadcastChannel('[Firebase] FID Change'); broadcastChannel.onmessage = function (e) { callFidChangeCallbacks(e.data.key, e.data.fid); }; } return broadcastChannel; } function closeBroadcastChannel() { if (fidChangeCallbacks.size === 0 && broadcastChannel) { broadcastChannel.close(); broadcastChannel = null; } } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var DATABASE_NAME = 'firebase-installations-database'; var DATABASE_VERSION = 1; var OBJECT_STORE_NAME = 'firebase-installations-store'; var dbPromise = null; function getDbPromise() { if (!dbPromise) { dbPromise = Object(__WEBPACK_IMPORTED_MODULE_4_idb__["openDb"])(DATABASE_NAME, DATABASE_VERSION, function (upgradeDB) { // We don't use 'break' in this switch statement, the fall-through // behavior is what we want, because if there are multiple versions between // the old version and the current version, we want ALL the migrations // that correspond to those versions to run, not only the last one. // eslint-disable-next-line default-case switch (upgradeDB.oldVersion) { case 0: upgradeDB.createObjectStore(OBJECT_STORE_NAME); } }); } return dbPromise; } /** Assigns or overwrites the record for the given key with the given value. */ function set(appConfig, value) { return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__awaiter"])(this, void 0, void 0, function () { var key, db, tx, objectStore, oldValue; return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__generator"])(this, function (_a) { switch (_a.label) { case 0: key = getKey(appConfig); return [4 /*yield*/, getDbPromise()]; case 1: db = _a.sent(); tx = db.transaction(OBJECT_STORE_NAME, 'readwrite'); objectStore = tx.objectStore(OBJECT_STORE_NAME); return [4 /*yield*/, objectStore.get(key)]; case 2: oldValue = _a.sent(); return [4 /*yield*/, objectStore.put(value, key)]; case 3: _a.sent(); return [4 /*yield*/, tx.complete]; case 4: _a.sent(); if (!oldValue || oldValue.fid !== value.fid) { fidChanged(appConfig, value.fid); } return [2 /*return*/, value]; } }); }); } /** Removes record(s) from the objectStore that match the given key. */ function remove(appConfig) { return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__awaiter"])(this, void 0, void 0, function () { var key, db, tx; return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__generator"])(this, function (_a) { switch (_a.label) { case 0: key = getKey(appConfig); return [4 /*yield*/, getDbPromise()]; case 1: db = _a.sent(); tx = db.transaction(OBJECT_STORE_NAME, 'readwrite'); return [4 /*yield*/, tx.objectStore(OBJECT_STORE_NAME).delete(key)]; case 2: _a.sent(); return [4 /*yield*/, tx.complete]; case 3: _a.sent(); return [2 /*return*/]; } }); }); } /** * Atomically updates a record with the result of updateFn, which gets * called with the current value. If newValue is undefined, the record is * deleted instead. * @return Updated value */ function update(appConfig, updateFn) { return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__awaiter"])(this, void 0, void 0, function () { var key, db, tx, store, oldValue, newValue; return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__generator"])(this, function (_a) { switch (_a.label) { case 0: key = getKey(appConfig); return [4 /*yield*/, getDbPromise()]; case 1: db = _a.sent(); tx = db.transaction(OBJECT_STORE_NAME, 'readwrite'); store = tx.objectStore(OBJECT_STORE_NAME); return [4 /*yield*/, store.get(key)]; case 2: oldValue = _a.sent(); newValue = updateFn(oldValue); if (!(newValue === undefined)) return [3 /*break*/, 4]; return [4 /*yield*/, store.delete(key)]; case 3: _a.sent(); return [3 /*break*/, 6]; case 4: return [4 /*yield*/, store.put(newValue, key)]; case 5: _a.sent(); _a.label = 6; case 6: return [4 /*yield*/, tx.complete]; case 7: _a.sent(); if (newValue && (!oldValue || oldValue.fid !== newValue.fid)) { fidChanged(appConfig, newValue.fid); } return [2 /*return*/, newValue]; } }); }); } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Updates and returns the InstallationEntry from the database. * Also triggers a registration request if it is necessary and possible. */ function getInstallationEntry(appConfig) { return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__awaiter"])(this, void 0, void 0, function () { var registrationPromise, installationEntry; var _a; return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__generator"])(this, function (_b) { switch (_b.label) { case 0: return [4 /*yield*/, update(appConfig, function (oldEntry) { var installationEntry = updateOrCreateInstallationEntry(oldEntry); var entryWithPromise = triggerRegistrationIfNecessary(appConfig, installationEntry); registrationPromise = entryWithPromise.registrationPromise; return entryWithPromise.installationEntry; })]; case 1: installationEntry = _b.sent(); if (!(installationEntry.fid === INVALID_FID)) return [3 /*break*/, 3]; _a = {}; return [4 /*yield*/, registrationPromise]; case 2: // FID generation failed. Waiting for the FID from the server. return [2 /*return*/, (_a.installationEntry = _b.sent(), _a)]; case 3: return [2 /*return*/, { installationEntry: installationEntry, registrationPromise: registrationPromise }]; } }); }); } /** * Creates a new Installation Entry if one does not exist. * Also clears timed out pending requests. */ function updateOrCreateInstallationEntry(oldEntry) { var entry = oldEntry || { fid: generateFid(), registrationStatus: 0 /* NOT_STARTED */ }; return clearTimedOutRequest(entry); } /** * If the Firebase Installation is not registered yet, this will trigger the * registration and return an InProgressInstallationEntry. * * If registrationPromise does not exist, the installationEntry is guaranteed * to be registered. */ function triggerRegistrationIfNecessary(appConfig, installationEntry) { if (installationEntry.registrationStatus === 0 /* NOT_STARTED */) { if (!navigator.onLine) { // Registration required but app is offline. var registrationPromiseWithError = Promise.reject(ERROR_FACTORY.create("app-offline" /* APP_OFFLINE */)); return { installationEntry: installationEntry, registrationPromise: registrationPromiseWithError }; } // Try registering. Change status to IN_PROGRESS. var inProgressEntry = { fid: installationEntry.fid, registrationStatus: 1 /* IN_PROGRESS */, registrationTime: Date.now() }; var registrationPromise = registerInstallation(appConfig, inProgressEntry); return { installationEntry: inProgressEntry, registrationPromise: registrationPromise }; } else if (installationEntry.registrationStatus === 1 /* IN_PROGRESS */) { return { installationEntry: installationEntry, registrationPromise: waitUntilFidRegistration(appConfig) }; } else { return { installationEntry: installationEntry }; } } /** This will be executed only once for each new Firebase Installation. */ function registerInstallation(appConfig, installationEntry) { return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__awaiter"])(this, void 0, void 0, function () { var registeredInstallationEntry, e_1; return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__generator"])(this, function (_a) { switch (_a.label) { case 0: _a.trys.push([0, 2, , 7]); return [4 /*yield*/, createInstallationRequest(appConfig, installationEntry)]; case 1: registeredInstallationEntry = _a.sent(); return [2 /*return*/, set(appConfig, registeredInstallationEntry)]; case 2: e_1 = _a.sent(); if (!(isServerError(e_1) && e_1.serverCode === 409)) return [3 /*break*/, 4]; // Server returned a "FID can not be used" error. // Generate a new ID next time. return [4 /*yield*/, remove(appConfig)]; case 3: // Server returned a "FID can not be used" error. // Generate a new ID next time. _a.sent(); return [3 /*break*/, 6]; case 4: // Registration failed. Set FID as not registered. return [4 /*yield*/, set(appConfig, { fid: installationEntry.fid, registrationStatus: 0 /* NOT_STARTED */ })]; case 5: // Registration failed. Set FID as not registered. _a.sent(); _a.label = 6; case 6: throw e_1; case 7: return [2 /*return*/]; } }); }); } /** Call if FID registration is pending in another request. */ function waitUntilFidRegistration(appConfig) { return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__awaiter"])(this, void 0, void 0, function () { var entry, _a, installationEntry, registrationPromise; return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__generator"])(this, function (_b) { switch (_b.label) { case 0: return [4 /*yield*/, updateInstallationRequest(appConfig)]; case 1: entry = _b.sent(); _b.label = 2; case 2: if (!(entry.registrationStatus === 1 /* IN_PROGRESS */)) return [3 /*break*/, 5]; // createInstallation request still in progress. return [4 /*yield*/, sleep(100)]; case 3: // createInstallation request still in progress. _b.sent(); return [4 /*yield*/, updateInstallationRequest(appConfig)]; case 4: entry = _b.sent(); return [3 /*break*/, 2]; case 5: if (!(entry.registrationStatus === 0 /* NOT_STARTED */)) return [3 /*break*/, 7]; return [4 /*yield*/, getInstallationEntry(appConfig)]; case 6: _a = _b.sent(), installationEntry = _a.installationEntry, registrationPromise = _a.registrationPromise; if (registrationPromise) { return [2 /*return*/, registrationPromise]; } else { // if there is no registrationPromise, entry is registered. return [2 /*return*/, installationEntry]; } case 7: return [2 /*return*/, entry]; } }); }); } /** * Called only if there is a CreateInstallation request in progress. * * Updates the InstallationEntry in the DB based on the status of the * CreateInstallation request. * * Returns the updated InstallationEntry. */ function updateInstallationRequest(appConfig) { return update(appConfig, function (oldEntry) { if (!oldEntry) { throw ERROR_FACTORY.create("installation-not-found" /* INSTALLATION_NOT_FOUND */); } return clearTimedOutRequest(oldEntry); }); } function clearTimedOutRequest(entry) { if (hasInstallationRequestTimedOut(entry)) { return { fid: entry.fid, registrationStatus: 0 /* NOT_STARTED */ }; } return entry; } function hasInstallationRequestTimedOut(installationEntry) { return (installationEntry.registrationStatus === 1 /* IN_PROGRESS */ && installationEntry.registrationTime + PENDING_TIMEOUT_MS < Date.now()); } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ function generateAuthTokenRequest(_a, installationEntry) { var appConfig = _a.appConfig, platformLoggerProvider = _a.platformLoggerProvider; return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__awaiter"])(this, void 0, void 0, function () { var endpoint, headers, platformLogger, body, request, response, responseValue, completedAuthToken; return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__generator"])(this, function (_b) { switch (_b.label) { case 0: endpoint = getGenerateAuthTokenEndpoint(appConfig, installationEntry); headers = getHeadersWithAuth(appConfig, installationEntry); platformLogger = platformLoggerProvider.getImmediate({ optional: true }); if (platformLogger) { headers.append('x-firebase-client', platformLogger.getPlatformInfoString()); } body = { installation: { sdkVersion: PACKAGE_VERSION } }; request = { method: 'POST', headers: headers, body: JSON.stringify(body) }; return [4 /*yield*/, retryIfServerError(function () { return fetch(endpoint, request); })]; case 1: response = _b.sent(); if (!response.ok) return [3 /*break*/, 3]; return [4 /*yield*/, response.json()]; case 2: responseValue = _b.sent(); completedAuthToken = extractAuthTokenInfoFromResponse(responseValue); return [2 /*return*/, completedAuthToken]; case 3: return [4 /*yield*/, getErrorFromResponse('Generate Auth Token', response)]; case 4: throw _b.sent(); } }); }); } function getGenerateAuthTokenEndpoint(appConfig, _a) { var fid = _a.fid; return getInstallationsEndpoint(appConfig) + "/" + fid + "/authTokens:generate"; } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Returns a valid authentication token for the installation. Generates a new * token if one doesn't exist, is expired or about to expire. * * Should only be called if the Firebase Installation is registered. */ function refreshAuthToken(dependencies, forceRefresh) { if (forceRefresh === void 0) { forceRefresh = false; } return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__awaiter"])(this, void 0, void 0, function () { var tokenPromise, entry, authToken, _a; return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__generator"])(this, function (_b) { switch (_b.label) { case 0: return [4 /*yield*/, update(dependencies.appConfig, function (oldEntry) { if (!isEntryRegistered(oldEntry)) { throw ERROR_FACTORY.create("not-registered" /* NOT_REGISTERED */); } var oldAuthToken = oldEntry.authToken; if (!forceRefresh && isAuthTokenValid(oldAuthToken)) { // There is a valid token in the DB. return oldEntry; } else if (oldAuthToken.requestStatus === 1 /* IN_PROGRESS */) { // There already is a token request in progress. tokenPromise = waitUntilAuthTokenRequest(dependencies, forceRefresh); return oldEntry; } else { // No token or token expired. if (!navigator.onLine) { throw ERROR_FACTORY.create("app-offline" /* APP_OFFLINE */); } var inProgressEntry = makeAuthTokenRequestInProgressEntry(oldEntry); tokenPromise = fetchAuthTokenFromServer(dependencies, inProgressEntry); return inProgressEntry; } })]; case 1: entry = _b.sent(); if (!tokenPromise) return [3 /*break*/, 3]; return [4 /*yield*/, tokenPromise]; case 2: _a = _b.sent(); return [3 /*break*/, 4]; case 3: _a = entry.authToken; _b.label = 4; case 4: authToken = _a; return [2 /*return*/, authToken]; } }); }); } /** * Call only if FID is registered and Auth Token request is in progress. * * Waits until the current pending request finishes. If the request times out, * tries once in this thread as well. */ function waitUntilAuthTokenRequest(dependencies, forceRefresh) { return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__awaiter"])(this, void 0, void 0, function () { var entry, authToken; return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__generator"])(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, updateAuthTokenRequest(dependencies.appConfig)]; case 1: entry = _a.sent(); _a.label = 2; case 2: if (!(entry.authToken.requestStatus === 1 /* IN_PROGRESS */)) return [3 /*break*/, 5]; // generateAuthToken still in progress. return [4 /*yield*/, sleep(100)]; case 3: // generateAuthToken still in progress. _a.sent(); return [4 /*yield*/, updateAuthTokenRequest(dependencies.appConfig)]; case 4: entry = _a.sent(); return [3 /*break*/, 2]; case 5: authToken = entry.authToken; if (authToken.requestStatus === 0 /* NOT_STARTED */) { // The request timed out or failed in a different call. Try again. return [2 /*return*/, refreshAuthToken(dependencies, forceRefresh)]; } else { return [2 /*return*/, authToken]; } } }); }); } /** * Called only if there is a GenerateAuthToken request in progress. * * Updates the InstallationEntry in the DB based on the status of the * GenerateAuthToken request. * * Returns the updated InstallationEntry. */ function updateAuthTokenRequest(appConfig) { return update(appConfig, function (oldEntry) { if (!isEntryRegistered(oldEntry)) { throw ERROR_FACTORY.create("not-registered" /* NOT_REGISTERED */); } var oldAuthToken = oldEntry.authToken; if (hasAuthTokenRequestTimedOut(oldAuthToken)) { return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__assign"])(Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__assign"])({}, oldEntry), { authToken: { requestStatus: 0 /* NOT_STARTED */ } }); } return oldEntry; }); } function fetchAuthTokenFromServer(dependencies, installationEntry) { return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__awaiter"])(this, void 0, void 0, function () { var authToken, updatedInstallationEntry, e_1, updatedInstallationEntry; return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__generator"])(this, function (_a) { switch (_a.label) { case 0: _a.trys.push([0, 3, , 8]); return [4 /*yield*/, generateAuthTokenRequest(dependencies, installationEntry)]; case 1: authToken = _a.sent(); updatedInstallationEntry = Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__assign"])(Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__assign"])({}, installationEntry), { authToken: authToken }); return [4 /*yield*/, set(dependencies.appConfig, updatedInstallationEntry)]; case 2: _a.sent(); return [2 /*return*/, authToken]; case 3: e_1 = _a.sent(); if (!(isServerError(e_1) && (e_1.serverCode === 401 || e_1.serverCode === 404))) return [3 /*break*/, 5]; // Server returned a "FID not found" or a "Invalid authentication" error. // Generate a new ID next time. return [4 /*yield*/, remove(dependencies.appConfig)]; case 4: // Server returned a "FID not found" or a "Invalid authentication" error. // Generate a new ID next time. _a.sent(); return [3 /*break*/, 7]; case 5: updatedInstallationEntry = Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__assign"])(Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__assign"])({}, installationEntry), { authToken: { requestStatus: 0 /* NOT_STARTED */ } }); return [4 /*yield*/, set(dependencies.appConfig, updatedInstallationEntry)]; case 6: _a.sent(); _a.label = 7; case 7: throw e_1; case 8: return [2 /*return*/]; } }); }); } function isEntryRegistered(installationEntry) { return (installationEntry !== undefined && installationEntry.registrationStatus === 2 /* COMPLETED */); } function isAuthTokenValid(authToken) { return (authToken.requestStatus === 2 /* COMPLETED */ && !isAuthTokenExpired(authToken)); } function isAuthTokenExpired(authToken) { var now = Date.now(); return (now < authToken.creationTime || authToken.creationTime + authToken.expiresIn < now + TOKEN_EXPIRATION_BUFFER); } /** Returns an updated InstallationEntry with an InProgressAuthToken. */ function makeAuthTokenRequestInProgressEntry(oldEntry) { var inProgressAuthToken = { requestStatus: 1 /* IN_PROGRESS */, requestTime: Date.now() }; return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__assign"])(Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__assign"])({}, oldEntry), { authToken: inProgressAuthToken }); } function hasAuthTokenRequestTimedOut(authToken) { return (authToken.requestStatus === 1 /* IN_PROGRESS */ && authToken.requestTime + PENDING_TIMEOUT_MS < Date.now()); } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ function getId(dependencies) { return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__awaiter"])(this, void 0, void 0, function () { var _a, installationEntry, registrationPromise; return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__generator"])(this, function (_b) { switch (_b.label) { case 0: return [4 /*yield*/, getInstallationEntry(dependencies.appConfig)]; case 1: _a = _b.sent(), installationEntry = _a.installationEntry, registrationPromise = _a.registrationPromise; if (registrationPromise) { registrationPromise.catch(console.error); } else { // If the installation is already registered, update the authentication // token if needed. refreshAuthToken(dependencies).catch(console.error); } return [2 /*return*/, installationEntry.fid]; } }); }); } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ function getToken(dependencies, forceRefresh) { if (forceRefresh === void 0) { forceRefresh = false; } return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__awaiter"])(this, void 0, void 0, function () { var authToken; return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__generator"])(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, completeInstallationRegistration(dependencies.appConfig)]; case 1: _a.sent(); return [4 /*yield*/, refreshAuthToken(dependencies, forceRefresh)]; case 2: authToken = _a.sent(); return [2 /*return*/, authToken.token]; } }); }); } function completeInstallationRegistration(appConfig) { return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__awaiter"])(this, void 0, void 0, function () { var registrationPromise; return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__generator"])(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, getInstallationEntry(appConfig)]; case 1: registrationPromise = (_a.sent()).registrationPromise; if (!registrationPromise) return [3 /*break*/, 3]; // A createInstallation request is in progress. Wait until it finishes. return [4 /*yield*/, registrationPromise]; case 2: // A createInstallation request is in progress. Wait until it finishes. _a.sent(); _a.label = 3; case 3: return [2 /*return*/]; } }); }); } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ function deleteInstallationRequest(appConfig, installationEntry) { return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__awaiter"])(this, void 0, void 0, function () { var endpoint, headers, request, response; return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__generator"])(this, function (_a) { switch (_a.label) { case 0: endpoint = getDeleteEndpoint(appConfig, installationEntry); headers = getHeadersWithAuth(appConfig, installationEntry); request = { method: 'DELETE', headers: headers }; return [4 /*yield*/, retryIfServerError(function () { return fetch(endpoint, request); })]; case 1: response = _a.sent(); if (!!response.ok) return [3 /*break*/, 3]; return [4 /*yield*/, getErrorFromResponse('Delete Installation', response)]; case 2: throw _a.sent(); case 3: return [2 /*return*/]; } }); }); } function getDeleteEndpoint(appConfig, _a) { var fid = _a.fid; return getInstallationsEndpoint(appConfig) + "/" + fid; } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ function deleteInstallation(dependencies) { return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__awaiter"])(this, void 0, void 0, function () { var appConfig, entry; return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__generator"])(this, function (_a) { switch (_a.label) { case 0: appConfig = dependencies.appConfig; return [4 /*yield*/, update(appConfig, function (oldEntry) { if (oldEntry && oldEntry.registrationStatus === 0 /* NOT_STARTED */) { // Delete the unregistered entry without sending a deleteInstallation request. return undefined; } return oldEntry; })]; case 1: entry = _a.sent(); if (!entry) return [3 /*break*/, 6]; if (!(entry.registrationStatus === 1 /* IN_PROGRESS */)) return [3 /*break*/, 2]; // Can't delete while trying to register. throw ERROR_FACTORY.create("delete-pending-registration" /* DELETE_PENDING_REGISTRATION */); case 2: if (!(entry.registrationStatus === 2 /* COMPLETED */)) return [3 /*break*/, 6]; if (!!navigator.onLine) return [3 /*break*/, 3]; throw ERROR_FACTORY.create("app-offline" /* APP_OFFLINE */); case 3: return [4 /*yield*/, deleteInstallationRequest(appConfig, entry)]; case 4: _a.sent(); return [4 /*yield*/, remove(appConfig)]; case 5: _a.sent(); _a.label = 6; case 6: return [2 /*return*/]; } }); }); } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Sets a new callback that will get called when Installation ID changes. * Returns an unsubscribe function that will remove the callback when called. */ function onIdChange(_a, callback) { var appConfig = _a.appConfig; addCallback(appConfig, callback); return function () { removeCallback(appConfig, callback); }; } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ function extractAppConfig(app) { var e_1, _a; if (!app || !app.options) { throw getMissingValueError('App Configuration'); } if (!app.name) { throw getMissingValueError('App Name'); } // Required app config keys var configKeys = [ 'projectId', 'apiKey', 'appId' ]; try { for (var configKeys_1 = Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__values"])(configKeys), configKeys_1_1 = configKeys_1.next(); !configKeys_1_1.done; configKeys_1_1 = configKeys_1.next()) { var keyName = configKeys_1_1.value; if (!app.options[keyName]) { throw getMissingValueError(keyName); } } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (configKeys_1_1 && !configKeys_1_1.done && (_a = configKeys_1.return)) _a.call(configKeys_1); } finally { if (e_1) throw e_1.error; } } return { appName: app.name, projectId: app.options.projectId, apiKey: app.options.apiKey, appId: app.options.appId }; } function getMissingValueError(valueName) { return ERROR_FACTORY.create("missing-app-config-values" /* MISSING_APP_CONFIG_VALUES */, { valueName: valueName }); } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ function registerInstallations(instance) { var installationsName = 'installations'; instance.INTERNAL.registerComponent(new __WEBPACK_IMPORTED_MODULE_1__firebase_component__["Component"](installationsName, function (container) { var app = container.getProvider('app').getImmediate(); // Throws if app isn't configured properly. var appConfig = extractAppConfig(app); var platformLoggerProvider = container.getProvider('platform-logger'); var dependencies = { appConfig: appConfig, platformLoggerProvider: platformLoggerProvider }; var installations = { app: app, getId: function () { return getId(dependencies); }, getToken: function (forceRefresh) { return getToken(dependencies, forceRefresh); }, delete: function () { return deleteInstallation(dependencies); }, onIdChange: function (callback) { return onIdChange(dependencies, callback); } }; return installations; }, "PUBLIC" /* PUBLIC */)); instance.registerVersion(name, version); } registerInstallations(__WEBPACK_IMPORTED_MODULE_0__firebase_app___default.a); //# sourceMappingURL=index.esm.js.map /***/ }), /***/ "./node_modules/@firebase/analytics/node_modules/@firebase/util/dist/index.cjs.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(global) { Object.defineProperty(exports, '__esModule', { value: true }); var tslib = __webpack_require__("./node_modules/@firebase/analytics/node_modules/tslib/tslib.es6.js"); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * @fileoverview Firebase constants. Some of these (@defines) can be overridden at compile-time. */ var CONSTANTS = { /** * @define {boolean} Whether this is the client Node.js SDK. */ NODE_CLIENT: false, /** * @define {boolean} Whether this is the Admin Node.js SDK. */ NODE_ADMIN: false, /** * Firebase SDK Version */ SDK_VERSION: '${JSCORE_VERSION}' }; /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Throws an error if the provided assertion is falsy */ var assert = function (assertion, message) { if (!assertion) { throw assertionError(message); } }; /** * Returns an Error object suitable for throwing. */ var assertionError = function (message) { return new Error('Firebase Database (' + CONSTANTS.SDK_VERSION + ') INTERNAL ASSERT FAILED: ' + message); }; /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var stringToByteArray = function (str) { // TODO(user): Use native implementations if/when available var out = []; var p = 0; for (var i = 0; i < str.length; i++) { var c = str.charCodeAt(i); if (c < 128) { out[p++] = c; } else if (c < 2048) { out[p++] = (c >> 6) | 192; out[p++] = (c & 63) | 128; } else if ((c & 0xfc00) === 0xd800 && i + 1 < str.length && (str.charCodeAt(i + 1) & 0xfc00) === 0xdc00) { // Surrogate Pair c = 0x10000 + ((c & 0x03ff) << 10) + (str.charCodeAt(++i) & 0x03ff); out[p++] = (c >> 18) | 240; out[p++] = ((c >> 12) & 63) | 128; out[p++] = ((c >> 6) & 63) | 128; out[p++] = (c & 63) | 128; } else { out[p++] = (c >> 12) | 224; out[p++] = ((c >> 6) & 63) | 128; out[p++] = (c & 63) | 128; } } return out; }; /** * Turns an array of numbers into the string given by the concatenation of the * characters to which the numbers correspond. * @param bytes Array of numbers representing characters. * @return Stringification of the array. */ var byteArrayToString = function (bytes) { // TODO(user): Use native implementations if/when available var out = []; var pos = 0, c = 0; while (pos < bytes.length) { var c1 = bytes[pos++]; if (c1 < 128) { out[c++] = String.fromCharCode(c1); } else if (c1 > 191 && c1 < 224) { var c2 = bytes[pos++]; out[c++] = String.fromCharCode(((c1 & 31) << 6) | (c2 & 63)); } else if (c1 > 239 && c1 < 365) { // Surrogate Pair var c2 = bytes[pos++]; var c3 = bytes[pos++]; var c4 = bytes[pos++]; var u = (((c1 & 7) << 18) | ((c2 & 63) << 12) | ((c3 & 63) << 6) | (c4 & 63)) - 0x10000; out[c++] = String.fromCharCode(0xd800 + (u >> 10)); out[c++] = String.fromCharCode(0xdc00 + (u & 1023)); } else { var c2 = bytes[pos++]; var c3 = bytes[pos++]; out[c++] = String.fromCharCode(((c1 & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63)); } } return out.join(''); }; // We define it as an object literal instead of a class because a class compiled down to es5 can't // be treeshaked. https://github.com/rollup/rollup/issues/1691 // Static lookup maps, lazily populated by init_() var base64 = { /** * Maps bytes to characters. */ byteToCharMap_: null, /** * Maps characters to bytes. */ charToByteMap_: null, /** * Maps bytes to websafe characters. * @private */ byteToCharMapWebSafe_: null, /** * Maps websafe characters to bytes. * @private */ charToByteMapWebSafe_: null, /** * Our default alphabet, shared between * ENCODED_VALS and ENCODED_VALS_WEBSAFE */ ENCODED_VALS_BASE: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' + 'abcdefghijklmnopqrstuvwxyz' + '0123456789', /** * Our default alphabet. Value 64 (=) is special; it means "nothing." */ get ENCODED_VALS() { return this.ENCODED_VALS_BASE + '+/='; }, /** * Our websafe alphabet. */ get ENCODED_VALS_WEBSAFE() { return this.ENCODED_VALS_BASE + '-_.'; }, /** * Whether this browser supports the atob and btoa functions. This extension * started at Mozilla but is now implemented by many browsers. We use the * ASSUME_* variables to avoid pulling in the full useragent detection library * but still allowing the standard per-browser compilations. * */ HAS_NATIVE_SUPPORT: typeof atob === 'function', /** * Base64-encode an array of bytes. * * @param input An array of bytes (numbers with * value in [0, 255]) to encode. * @param webSafe Boolean indicating we should use the * alternative alphabet. * @return The base64 encoded string. */ encodeByteArray: function (input, webSafe) { if (!Array.isArray(input)) { throw Error('encodeByteArray takes an array as a parameter'); } this.init_(); var byteToCharMap = webSafe ? this.byteToCharMapWebSafe_ : this.byteToCharMap_; var output = []; for (var i = 0; i < input.length; i += 3) { var byte1 = input[i]; var haveByte2 = i + 1 < input.length; var byte2 = haveByte2 ? input[i + 1] : 0; var haveByte3 = i + 2 < input.length; var byte3 = haveByte3 ? input[i + 2] : 0; var outByte1 = byte1 >> 2; var outByte2 = ((byte1 & 0x03) << 4) | (byte2 >> 4); var outByte3 = ((byte2 & 0x0f) << 2) | (byte3 >> 6); var outByte4 = byte3 & 0x3f; if (!haveByte3) { outByte4 = 64; if (!haveByte2) { outByte3 = 64; } } output.push(byteToCharMap[outByte1], byteToCharMap[outByte2], byteToCharMap[outByte3], byteToCharMap[outByte4]); } return output.join(''); }, /** * Base64-encode a string. * * @param input A string to encode. * @param webSafe If true, we should use the * alternative alphabet. * @return The base64 encoded string. */ encodeString: function (input, webSafe) { // Shortcut for Mozilla browsers that implement // a native base64 encoder in the form of "btoa/atob" if (this.HAS_NATIVE_SUPPORT && !webSafe) { return btoa(input); } return this.encodeByteArray(stringToByteArray(input), webSafe); }, /** * Base64-decode a string. * * @param input to decode. * @param webSafe True if we should use the * alternative alphabet. * @return string representing the decoded value. */ decodeString: function (input, webSafe) { // Shortcut for Mozilla browsers that implement // a native base64 encoder in the form of "btoa/atob" if (this.HAS_NATIVE_SUPPORT && !webSafe) { return atob(input); } return byteArrayToString(this.decodeStringToByteArray(input, webSafe)); }, /** * Base64-decode a string. * * In base-64 decoding, groups of four characters are converted into three * bytes. If the encoder did not apply padding, the input length may not * be a multiple of 4. * * In this case, the last group will have fewer than 4 characters, and * padding will be inferred. If the group has one or two characters, it decodes * to one byte. If the group has three characters, it decodes to two bytes. * * @param input Input to decode. * @param webSafe True if we should use the web-safe alphabet. * @return bytes representing the decoded value. */ decodeStringToByteArray: function (input, webSafe) { this.init_(); var charToByteMap = webSafe ? this.charToByteMapWebSafe_ : this.charToByteMap_; var output = []; for (var i = 0; i < input.length;) { var byte1 = charToByteMap[input.charAt(i++)]; var haveByte2 = i < input.length; var byte2 = haveByte2 ? charToByteMap[input.charAt(i)] : 0; ++i; var haveByte3 = i < input.length; var byte3 = haveByte3 ? charToByteMap[input.charAt(i)] : 64; ++i; var haveByte4 = i < input.length; var byte4 = haveByte4 ? charToByteMap[input.charAt(i)] : 64; ++i; if (byte1 == null || byte2 == null || byte3 == null || byte4 == null) { throw Error(); } var outByte1 = (byte1 << 2) | (byte2 >> 4); output.push(outByte1); if (byte3 !== 64) { var outByte2 = ((byte2 << 4) & 0xf0) | (byte3 >> 2); output.push(outByte2); if (byte4 !== 64) { var outByte3 = ((byte3 << 6) & 0xc0) | byte4; output.push(outByte3); } } } return output; }, /** * Lazy static initialization function. Called before * accessing any of the static map variables. * @private */ init_: function () { if (!this.byteToCharMap_) { this.byteToCharMap_ = {}; this.charToByteMap_ = {}; this.byteToCharMapWebSafe_ = {}; this.charToByteMapWebSafe_ = {}; // We want quick mappings back and forth, so we precompute two maps. for (var i = 0; i < this.ENCODED_VALS.length; i++) { this.byteToCharMap_[i] = this.ENCODED_VALS.charAt(i); this.charToByteMap_[this.byteToCharMap_[i]] = i; this.byteToCharMapWebSafe_[i] = this.ENCODED_VALS_WEBSAFE.charAt(i); this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[i]] = i; // Be forgiving when decoding and correctly decode both encodings. if (i >= this.ENCODED_VALS_BASE.length) { this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(i)] = i; this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(i)] = i; } } } } }; /** * URL-safe base64 encoding */ var base64Encode = function (str) { var utf8Bytes = stringToByteArray(str); return base64.encodeByteArray(utf8Bytes, true); }; /** * URL-safe base64 decoding * * NOTE: DO NOT use the global atob() function - it does NOT support the * base64Url variant encoding. * * @param str To be decoded * @return Decoded result, if possible */ var base64Decode = function (str) { try { return base64.decodeString(str, true); } catch (e) { console.error('base64Decode failed: ', e); } return null; }; /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Do a deep-copy of basic JavaScript Objects or Arrays. */ function deepCopy(value) { return deepExtend(undefined, value); } /** * Copy properties from source to target (recursively allows extension * of Objects and Arrays). Scalar values in the target are over-written. * If target is undefined, an object of the appropriate type will be created * (and returned). * * We recursively copy all child properties of plain Objects in the source- so * that namespace- like dictionaries are merged. * * Note that the target can be a function, in which case the properties in * the source Object are copied onto it as static properties of the Function. */ function deepExtend(target, source) { if (!(source instanceof Object)) { return source; } switch (source.constructor) { case Date: // Treat Dates like scalars; if the target date object had any child // properties - they will be lost! var dateValue = source; return new Date(dateValue.getTime()); case Object: if (target === undefined) { target = {}; } break; case Array: // Always copy the array source and overwrite the target. target = []; break; default: // Not a plain Object - treat it as a scalar. return source; } for (var prop in source) { if (!source.hasOwnProperty(prop)) { continue; } target[prop] = deepExtend(target[prop], source[prop]); } return target; } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var Deferred = /** @class */ (function () { function Deferred() { var _this = this; this.reject = function () { }; this.resolve = function () { }; this.promise = new Promise(function (resolve, reject) { _this.resolve = resolve; _this.reject = reject; }); } /** * Our API internals are not promiseified and cannot because our callback APIs have subtle expectations around * invoking promises inline, which Promises are forbidden to do. This method accepts an optional node-style callback * and returns a node-style callback which will resolve or reject the Deferred's promise. */ Deferred.prototype.wrapCallback = function (callback) { var _this = this; return function (error, value) { if (error) { _this.reject(error); } else { _this.resolve(value); } if (typeof callback === 'function') { // Attaching noop handler just in case developer wasn't expecting // promises _this.promise.catch(function () { }); // Some of our callbacks don't expect a value and our own tests // assert that the parameter length is 1 if (callback.length === 1) { callback(error); } else { callback(error, value); } } }; }; return Deferred; }()); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Returns navigator.userAgent string or '' if it's not defined. * @return user agent string */ function getUA() { if (typeof navigator !== 'undefined' && typeof navigator['userAgent'] === 'string') { return navigator['userAgent']; } else { return ''; } } /** * Detect Cordova / PhoneGap / Ionic frameworks on a mobile device. * * Deliberately does not rely on checking `file://` URLs (as this fails PhoneGap * in the Ripple emulator) nor Cordova `onDeviceReady`, which would normally * wait for a callback. */ function isMobileCordova() { return (typeof window !== 'undefined' && // @ts-ignore Setting up an broadly applicable index signature for Window // just to deal with this case would probably be a bad idea. !!(window['cordova'] || window['phonegap'] || window['PhoneGap']) && /ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(getUA())); } /** * Detect Node.js. * * @return true if Node.js environment is detected. */ // Node detection logic from: https://github.com/iliakan/detect-node/ function isNode() { try { return (Object.prototype.toString.call(global.process) === '[object process]'); } catch (e) { return false; } } /** * Detect Browser Environment */ function isBrowser() { return typeof self === 'object' && self.self === self; } function isBrowserExtension() { var runtime = typeof chrome === 'object' ? chrome.runtime : typeof browser === 'object' ? browser.runtime : undefined; return typeof runtime === 'object' && runtime.id !== undefined; } /** * Detect React Native. * * @return true if ReactNative environment is detected. */ function isReactNative() { return (typeof navigator === 'object' && navigator['product'] === 'ReactNative'); } /** Detects Electron apps. */ function isElectron() { return getUA().indexOf('Electron/') >= 0; } /** Detects Internet Explorer. */ function isIE() { var ua = getUA(); return ua.indexOf('MSIE ') >= 0 || ua.indexOf('Trident/') >= 0; } /** Detects Universal Windows Platform apps. */ function isUWP() { return getUA().indexOf('MSAppHost/') >= 0; } /** * Detect whether the current SDK build is the Node version. * * @return true if it's the Node SDK build. */ function isNodeSdk() { return CONSTANTS.NODE_CLIENT === true || CONSTANTS.NODE_ADMIN === true; } /** Returns true if we are running in Safari. */ function isSafari() { return (!isNode() && navigator.userAgent.includes('Safari') && !navigator.userAgent.includes('Chrome')); } /** * This method checks if indexedDB is supported by current browser/service worker context * @return true if indexedDB is supported by current browser/service worker context */ function isIndexedDBAvailable() { return 'indexedDB' in self && indexedDB != null; } /** * This method validates browser context for indexedDB by opening a dummy indexedDB database and reject * if errors occur during the database open operation. */ function validateIndexedDBOpenable() { return new Promise(function (resolve, reject) { try { var preExist_1 = true; var DB_CHECK_NAME_1 = 'validate-browser-context-for-indexeddb-analytics-module'; var request_1 = window.indexedDB.open(DB_CHECK_NAME_1); request_1.onsuccess = function () { request_1.result.close(); // delete database only when it doesn't pre-exist if (!preExist_1) { window.indexedDB.deleteDatabase(DB_CHECK_NAME_1); } resolve(true); }; request_1.onupgradeneeded = function () { preExist_1 = false; }; request_1.onerror = function () { var _a; reject(((_a = request_1.error) === null || _a === void 0 ? void 0 : _a.message) || ''); }; } catch (error) { reject(error); } }); } /** * * This method checks whether cookie is enabled within current browser * @return true if cookie is enabled within current browser */ function areCookiesEnabled() { if (!navigator || !navigator.cookieEnabled) { return false; } return true; } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var ERROR_NAME = 'FirebaseError'; // Based on code from: // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error#Custom_Error_Types var FirebaseError = /** @class */ (function (_super) { tslib.__extends(FirebaseError, _super); function FirebaseError(code, message) { var _this = _super.call(this, message) || this; _this.code = code; _this.name = ERROR_NAME; // Fix For ES5 // https://github.com/Microsoft/TypeScript-wiki/blob/master/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work Object.setPrototypeOf(_this, FirebaseError.prototype); // Maintains proper stack trace for where our error was thrown. // Only available on V8. if (Error.captureStackTrace) { Error.captureStackTrace(_this, ErrorFactory.prototype.create); } return _this; } return FirebaseError; }(Error)); var ErrorFactory = /** @class */ (function () { function ErrorFactory(service, serviceName, errors) { this.service = service; this.serviceName = serviceName; this.errors = errors; } ErrorFactory.prototype.create = function (code) { var data = []; for (var _i = 1; _i < arguments.length; _i++) { data[_i - 1] = arguments[_i]; } var customData = data[0] || {}; var fullCode = this.service + "/" + code; var template = this.errors[code]; var message = template ? replaceTemplate(template, customData) : 'Error'; // Service Name: Error message (service/code). var fullMessage = this.serviceName + ": " + message + " (" + fullCode + ")."; var error = new FirebaseError(fullCode, fullMessage); // Keys with an underscore at the end of their name are not included in // error.data for some reason. // TODO: Replace with Object.entries when lib is updated to es2017. for (var _a = 0, _b = Object.keys(customData); _a < _b.length; _a++) { var key = _b[_a]; if (key.slice(-1) !== '_') { if (key in error) { console.warn("Overwriting FirebaseError base field \"" + key + "\" can cause unexpected behavior."); } error[key] = customData[key]; } } return error; }; return ErrorFactory; }()); function replaceTemplate(template, data) { return template.replace(PATTERN, function (_, key) { var value = data[key]; return value != null ? String(value) : "<" + key + "?>"; }); } var PATTERN = /\{\$([^}]+)}/g; /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Evaluates a JSON string into a javascript object. * * @param {string} str A string containing JSON. * @return {*} The javascript object representing the specified JSON. */ function jsonEval(str) { return JSON.parse(str); } /** * Returns JSON representing a javascript object. * @param {*} data Javascript object to be stringified. * @return {string} The JSON contents of the object. */ function stringify(data) { return JSON.stringify(data); } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Decodes a Firebase auth. token into constituent parts. * * Notes: * - May return with invalid / incomplete claims if there's no native base64 decoding support. * - Doesn't check if the token is actually valid. */ var decode = function (token) { var header = {}, claims = {}, data = {}, signature = ''; try { var parts = token.split('.'); header = jsonEval(base64Decode(parts[0]) || ''); claims = jsonEval(base64Decode(parts[1]) || ''); signature = parts[2]; data = claims['d'] || {}; delete claims['d']; } catch (e) { } return { header: header, claims: claims, data: data, signature: signature }; }; /** * Decodes a Firebase auth. token and checks the validity of its time-based claims. Will return true if the * token is within the time window authorized by the 'nbf' (not-before) and 'iat' (issued-at) claims. * * Notes: * - May return a false negative if there's no native base64 decoding support. * - Doesn't check if the token is actually valid. */ var isValidTimestamp = function (token) { var claims = decode(token).claims; var now = Math.floor(new Date().getTime() / 1000); var validSince = 0, validUntil = 0; if (typeof claims === 'object') { if (claims.hasOwnProperty('nbf')) { validSince = claims['nbf']; } else if (claims.hasOwnProperty('iat')) { validSince = claims['iat']; } if (claims.hasOwnProperty('exp')) { validUntil = claims['exp']; } else { // token will expire after 24h by default validUntil = validSince + 86400; } } return (!!now && !!validSince && !!validUntil && now >= validSince && now <= validUntil); }; /** * Decodes a Firebase auth. token and returns its issued at time if valid, null otherwise. * * Notes: * - May return null if there's no native base64 decoding support. * - Doesn't check if the token is actually valid. */ var issuedAtTime = function (token) { var claims = decode(token).claims; if (typeof claims === 'object' && claims.hasOwnProperty('iat')) { return claims['iat']; } return null; }; /** * Decodes a Firebase auth. token and checks the validity of its format. Expects a valid issued-at time. * * Notes: * - May return a false negative if there's no native base64 decoding support. * - Doesn't check if the token is actually valid. */ var isValidFormat = function (token) { var decoded = decode(token), claims = decoded.claims; return !!claims && typeof claims === 'object' && claims.hasOwnProperty('iat'); }; /** * Attempts to peer into an auth token and determine if it's an admin auth token by looking at the claims portion. * * Notes: * - May return a false negative if there's no native base64 decoding support. * - Doesn't check if the token is actually valid. */ var isAdmin = function (token) { var claims = decode(token).claims; return typeof claims === 'object' && claims['admin'] === true; }; /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ function contains(obj, key) { return Object.prototype.hasOwnProperty.call(obj, key); } function safeGet(obj, key) { if (Object.prototype.hasOwnProperty.call(obj, key)) { return obj[key]; } else { return undefined; } } function isEmpty(obj) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { return false; } } return true; } function map(obj, fn, contextObj) { var res = {}; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { res[key] = fn.call(contextObj, obj[key], key, obj); } } return res; } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Returns a querystring-formatted string (e.g. &arg=val&arg2=val2) from a * params object (e.g. {arg: 'val', arg2: 'val2'}) * Note: You must prepend it with ? when adding it to a URL. */ function querystring(querystringParams) { var params = []; var _loop_1 = function (key, value) { if (Array.isArray(value)) { value.forEach(function (arrayVal) { params.push(encodeURIComponent(key) + '=' + encodeURIComponent(arrayVal)); }); } else { params.push(encodeURIComponent(key) + '=' + encodeURIComponent(value)); } }; for (var _i = 0, _a = Object.entries(querystringParams); _i < _a.length; _i++) { var _b = _a[_i], key = _b[0], value = _b[1]; _loop_1(key, value); } return params.length ? '&' + params.join('&') : ''; } /** * Decodes a querystring (e.g. ?arg=val&arg2=val2) into a params object * (e.g. {arg: 'val', arg2: 'val2'}) */ function querystringDecode(querystring) { var obj = {}; var tokens = querystring.replace(/^\?/, '').split('&'); tokens.forEach(function (token) { if (token) { var key = token.split('='); obj[key[0]] = key[1]; } }); return obj; } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * @fileoverview SHA-1 cryptographic hash. * Variable names follow the notation in FIPS PUB 180-3: * http://csrc.nist.gov/publications/fips/fips180-3/fips180-3_final.pdf. * * Usage: * var sha1 = new sha1(); * sha1.update(bytes); * var hash = sha1.digest(); * * Performance: * Chrome 23: ~400 Mbit/s * Firefox 16: ~250 Mbit/s * */ /** * SHA-1 cryptographic hash constructor. * * The properties declared here are discussed in the above algorithm document. * @constructor * @final * @struct */ var Sha1 = /** @class */ (function () { function Sha1() { /** * Holds the previous values of accumulated variables a-e in the compress_ * function. * @private */ this.chain_ = []; /** * A buffer holding the partially computed hash result. * @private */ this.buf_ = []; /** * An array of 80 bytes, each a part of the message to be hashed. Referred to * as the message schedule in the docs. * @private */ this.W_ = []; /** * Contains data needed to pad messages less than 64 bytes. * @private */ this.pad_ = []; /** * @private {number} */ this.inbuf_ = 0; /** * @private {number} */ this.total_ = 0; this.blockSize = 512 / 8; this.pad_[0] = 128; for (var i = 1; i < this.blockSize; ++i) { this.pad_[i] = 0; } this.reset(); } Sha1.prototype.reset = function () { this.chain_[0] = 0x67452301; this.chain_[1] = 0xefcdab89; this.chain_[2] = 0x98badcfe; this.chain_[3] = 0x10325476; this.chain_[4] = 0xc3d2e1f0; this.inbuf_ = 0; this.total_ = 0; }; /** * Internal compress helper function. * @param buf Block to compress. * @param offset Offset of the block in the buffer. * @private */ Sha1.prototype.compress_ = function (buf, offset) { if (!offset) { offset = 0; } var W = this.W_; // get 16 big endian words if (typeof buf === 'string') { for (var i = 0; i < 16; i++) { // TODO(user): [bug 8140122] Recent versions of Safari for Mac OS and iOS // have a bug that turns the post-increment ++ operator into pre-increment // during JIT compilation. We have code that depends heavily on SHA-1 for // correctness and which is affected by this bug, so I've removed all uses // of post-increment ++ in which the result value is used. We can revert // this change once the Safari bug // (https://bugs.webkit.org/show_bug.cgi?id=109036) has been fixed and // most clients have been updated. W[i] = (buf.charCodeAt(offset) << 24) | (buf.charCodeAt(offset + 1) << 16) | (buf.charCodeAt(offset + 2) << 8) | buf.charCodeAt(offset + 3); offset += 4; } } else { for (var i = 0; i < 16; i++) { W[i] = (buf[offset] << 24) | (buf[offset + 1] << 16) | (buf[offset + 2] << 8) | buf[offset + 3]; offset += 4; } } // expand to 80 words for (var i = 16; i < 80; i++) { var t = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16]; W[i] = ((t << 1) | (t >>> 31)) & 0xffffffff; } var a = this.chain_[0]; var b = this.chain_[1]; var c = this.chain_[2]; var d = this.chain_[3]; var e = this.chain_[4]; var f, k; // TODO(user): Try to unroll this loop to speed up the computation. for (var i = 0; i < 80; i++) { if (i < 40) { if (i < 20) { f = d ^ (b & (c ^ d)); k = 0x5a827999; } else { f = b ^ c ^ d; k = 0x6ed9eba1; } } else { if (i < 60) { f = (b & c) | (d & (b | c)); k = 0x8f1bbcdc; } else { f = b ^ c ^ d; k = 0xca62c1d6; } } var t = (((a << 5) | (a >>> 27)) + f + e + k + W[i]) & 0xffffffff; e = d; d = c; c = ((b << 30) | (b >>> 2)) & 0xffffffff; b = a; a = t; } this.chain_[0] = (this.chain_[0] + a) & 0xffffffff; this.chain_[1] = (this.chain_[1] + b) & 0xffffffff; this.chain_[2] = (this.chain_[2] + c) & 0xffffffff; this.chain_[3] = (this.chain_[3] + d) & 0xffffffff; this.chain_[4] = (this.chain_[4] + e) & 0xffffffff; }; Sha1.prototype.update = function (bytes, length) { // TODO(johnlenz): tighten the function signature and remove this check if (bytes == null) { return; } if (length === undefined) { length = bytes.length; } var lengthMinusBlock = length - this.blockSize; var n = 0; // Using local instead of member variables gives ~5% speedup on Firefox 16. var buf = this.buf_; var inbuf = this.inbuf_; // The outer while loop should execute at most twice. while (n < length) { // When we have no data in the block to top up, we can directly process the // input buffer (assuming it contains sufficient data). This gives ~25% // speedup on Chrome 23 and ~15% speedup on Firefox 16, but requires that // the data is provided in large chunks (or in multiples of 64 bytes). if (inbuf === 0) { while (n <= lengthMinusBlock) { this.compress_(bytes, n); n += this.blockSize; } } if (typeof bytes === 'string') { while (n < length) { buf[inbuf] = bytes.charCodeAt(n); ++inbuf; ++n; if (inbuf === this.blockSize) { this.compress_(buf); inbuf = 0; // Jump to the outer loop so we use the full-block optimization. break; } } } else { while (n < length) { buf[inbuf] = bytes[n]; ++inbuf; ++n; if (inbuf === this.blockSize) { this.compress_(buf); inbuf = 0; // Jump to the outer loop so we use the full-block optimization. break; } } } } this.inbuf_ = inbuf; this.total_ += length; }; /** @override */ Sha1.prototype.digest = function () { var digest = []; var totalBits = this.total_ * 8; // Add pad 0x80 0x00*. if (this.inbuf_ < 56) { this.update(this.pad_, 56 - this.inbuf_); } else { this.update(this.pad_, this.blockSize - (this.inbuf_ - 56)); } // Add # bits. for (var i = this.blockSize - 1; i >= 56; i--) { this.buf_[i] = totalBits & 255; totalBits /= 256; // Don't use bit-shifting here! } this.compress_(this.buf_); var n = 0; for (var i = 0; i < 5; i++) { for (var j = 24; j >= 0; j -= 8) { digest[n] = (this.chain_[i] >> j) & 255; ++n; } } return digest; }; return Sha1; }()); /** * Helper to make a Subscribe function (just like Promise helps make a * Thenable). * * @param executor Function which can make calls to a single Observer * as a proxy. * @param onNoObservers Callback when count of Observers goes to zero. */ function createSubscribe(executor, onNoObservers) { var proxy = new ObserverProxy(executor, onNoObservers); return proxy.subscribe.bind(proxy); } /** * Implement fan-out for any number of Observers attached via a subscribe * function. */ var ObserverProxy = /** @class */ (function () { /** * @param executor Function which can make calls to a single Observer * as a proxy. * @param onNoObservers Callback when count of Observers goes to zero. */ function ObserverProxy(executor, onNoObservers) { var _this = this; this.observers = []; this.unsubscribes = []; this.observerCount = 0; // Micro-task scheduling by calling task.then(). this.task = Promise.resolve(); this.finalized = false; this.onNoObservers = onNoObservers; // Call the executor asynchronously so subscribers that are called // synchronously after the creation of the subscribe function // can still receive the very first value generated in the executor. this.task .then(function () { executor(_this); }) .catch(function (e) { _this.error(e); }); } ObserverProxy.prototype.next = function (value) { this.forEachObserver(function (observer) { observer.next(value); }); }; ObserverProxy.prototype.error = function (error) { this.forEachObserver(function (observer) { observer.error(error); }); this.close(error); }; ObserverProxy.prototype.complete = function () { this.forEachObserver(function (observer) { observer.complete(); }); this.close(); }; /** * Subscribe function that can be used to add an Observer to the fan-out list. * * - We require that no event is sent to a subscriber sychronously to their * call to subscribe(). */ ObserverProxy.prototype.subscribe = function (nextOrObserver, error, complete) { var _this = this; var observer; if (nextOrObserver === undefined && error === undefined && complete === undefined) { throw new Error('Missing Observer.'); } // Assemble an Observer object when passed as callback functions. if (implementsAnyMethods(nextOrObserver, [ 'next', 'error', 'complete' ])) { observer = nextOrObserver; } else { observer = { next: nextOrObserver, error: error, complete: complete }; } if (observer.next === undefined) { observer.next = noop; } if (observer.error === undefined) { observer.error = noop; } if (observer.complete === undefined) { observer.complete = noop; } var unsub = this.unsubscribeOne.bind(this, this.observers.length); // Attempt to subscribe to a terminated Observable - we // just respond to the Observer with the final error or complete // event. if (this.finalized) { // eslint-disable-next-line @typescript-eslint/no-floating-promises this.task.then(function () { try { if (_this.finalError) { observer.error(_this.finalError); } else { observer.complete(); } } catch (e) { // nothing } return; }); } this.observers.push(observer); return unsub; }; // Unsubscribe is synchronous - we guarantee that no events are sent to // any unsubscribed Observer. ObserverProxy.prototype.unsubscribeOne = function (i) { if (this.observers === undefined || this.observers[i] === undefined) { return; } delete this.observers[i]; this.observerCount -= 1; if (this.observerCount === 0 && this.onNoObservers !== undefined) { this.onNoObservers(this); } }; ObserverProxy.prototype.forEachObserver = function (fn) { if (this.finalized) { // Already closed by previous event....just eat the additional values. return; } // Since sendOne calls asynchronously - there is no chance that // this.observers will become undefined. for (var i = 0; i < this.observers.length; i++) { this.sendOne(i, fn); } }; // Call the Observer via one of it's callback function. We are careful to // confirm that the observe has not been unsubscribed since this asynchronous // function had been queued. ObserverProxy.prototype.sendOne = function (i, fn) { var _this = this; // Execute the callback asynchronously // eslint-disable-next-line @typescript-eslint/no-floating-promises this.task.then(function () { if (_this.observers !== undefined && _this.observers[i] !== undefined) { try { fn(_this.observers[i]); } catch (e) { // Ignore exceptions raised in Observers or missing methods of an // Observer. // Log error to console. b/31404806 if (typeof console !== 'undefined' && console.error) { console.error(e); } } } }); }; ObserverProxy.prototype.close = function (err) { var _this = this; if (this.finalized) { return; } this.finalized = true; if (err !== undefined) { this.finalError = err; } // Proxy is no longer needed - garbage collect references // eslint-disable-next-line @typescript-eslint/no-floating-promises this.task.then(function () { _this.observers = undefined; _this.onNoObservers = undefined; }); }; return ObserverProxy; }()); /** Turn synchronous function into one called asynchronously. */ // eslint-disable-next-line @typescript-eslint/ban-types function async(fn, onError) { return function () { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } Promise.resolve(true) .then(function () { fn.apply(void 0, args); }) .catch(function (error) { if (onError) { onError(error); } }); }; } /** * Return true if the object passed in implements any of the named methods. */ function implementsAnyMethods(obj, methods) { if (typeof obj !== 'object' || obj === null) { return false; } for (var _i = 0, methods_1 = methods; _i < methods_1.length; _i++) { var method = methods_1[_i]; if (method in obj && typeof obj[method] === 'function') { return true; } } return false; } function noop() { // do nothing } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Check to make sure the appropriate number of arguments are provided for a public function. * Throws an error if it fails. * * @param fnName The function name * @param minCount The minimum number of arguments to allow for the function call * @param maxCount The maximum number of argument to allow for the function call * @param argCount The actual number of arguments provided. */ var validateArgCount = function (fnName, minCount, maxCount, argCount) { var argError; if (argCount < minCount) { argError = 'at least ' + minCount; } else if (argCount > maxCount) { argError = maxCount === 0 ? 'none' : 'no more than ' + maxCount; } if (argError) { var error = fnName + ' failed: Was called with ' + argCount + (argCount === 1 ? ' argument.' : ' arguments.') + ' Expects ' + argError + '.'; throw new Error(error); } }; /** * Generates a string to prefix an error message about failed argument validation * * @param fnName The function name * @param argumentNumber The index of the argument * @param optional Whether or not the argument is optional * @return The prefix to add to the error thrown for validation. */ function errorPrefix(fnName, argumentNumber, optional) { var argName = ''; switch (argumentNumber) { case 1: argName = optional ? 'first' : 'First'; break; case 2: argName = optional ? 'second' : 'Second'; break; case 3: argName = optional ? 'third' : 'Third'; break; case 4: argName = optional ? 'fourth' : 'Fourth'; break; default: throw new Error('errorPrefix called with argumentNumber > 4. Need to update it?'); } var error = fnName + ' failed: '; error += argName + ' argument '; return error; } /** * @param fnName * @param argumentNumber * @param namespace * @param optional */ function validateNamespace(fnName, argumentNumber, namespace, optional) { if (optional && !namespace) { return; } if (typeof namespace !== 'string') { //TODO: I should do more validation here. We only allow certain chars in namespaces. throw new Error(errorPrefix(fnName, argumentNumber, optional) + 'must be a valid firebase namespace.'); } } function validateCallback(fnName, argumentNumber, // eslint-disable-next-line @typescript-eslint/ban-types callback, optional) { if (optional && !callback) { return; } if (typeof callback !== 'function') { throw new Error(errorPrefix(fnName, argumentNumber, optional) + 'must be a valid function.'); } } function validateContextObject(fnName, argumentNumber, context, optional) { if (optional && !context) { return; } if (typeof context !== 'object' || context === null) { throw new Error(errorPrefix(fnName, argumentNumber, optional) + 'must be a valid context object.'); } } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // Code originally came from goog.crypt.stringToUtf8ByteArray, but for some reason they // automatically replaced '\r\n' with '\n', and they didn't handle surrogate pairs, // so it's been modified. // Note that not all Unicode characters appear as single characters in JavaScript strings. // fromCharCode returns the UTF-16 encoding of a character - so some Unicode characters // use 2 characters in Javascript. All 4-byte UTF-8 characters begin with a first // character in the range 0xD800 - 0xDBFF (the first character of a so-called surrogate // pair). // See http://www.ecma-international.org/ecma-262/5.1/#sec-15.1.3 /** * @param {string} str * @return {Array} */ var stringToByteArray$1 = function (str) { var out = []; var p = 0; for (var i = 0; i < str.length; i++) { var c = str.charCodeAt(i); // Is this the lead surrogate in a surrogate pair? if (c >= 0xd800 && c <= 0xdbff) { var high = c - 0xd800; // the high 10 bits. i++; assert(i < str.length, 'Surrogate pair missing trail surrogate.'); var low = str.charCodeAt(i) - 0xdc00; // the low 10 bits. c = 0x10000 + (high << 10) + low; } if (c < 128) { out[p++] = c; } else if (c < 2048) { out[p++] = (c >> 6) | 192; out[p++] = (c & 63) | 128; } else if (c < 65536) { out[p++] = (c >> 12) | 224; out[p++] = ((c >> 6) & 63) | 128; out[p++] = (c & 63) | 128; } else { out[p++] = (c >> 18) | 240; out[p++] = ((c >> 12) & 63) | 128; out[p++] = ((c >> 6) & 63) | 128; out[p++] = (c & 63) | 128; } } return out; }; /** * Calculate length without actually converting; useful for doing cheaper validation. * @param {string} str * @return {number} */ var stringLength = function (str) { var p = 0; for (var i = 0; i < str.length; i++) { var c = str.charCodeAt(i); if (c < 128) { p++; } else if (c < 2048) { p += 2; } else if (c >= 0xd800 && c <= 0xdbff) { // Lead surrogate of a surrogate pair. The pair together will take 4 bytes to represent. p += 4; i++; // skip trail surrogate. } else { p += 3; } } return p; }; /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * The amount of milliseconds to exponentially increase. */ var DEFAULT_INTERVAL_MILLIS = 1000; /** * The factor to backoff by. * Should be a number greater than 1. */ var DEFAULT_BACKOFF_FACTOR = 2; /** * The maximum milliseconds to increase to. * * <p>Visible for testing */ var MAX_VALUE_MILLIS = 4 * 60 * 60 * 1000; // Four hours, like iOS and Android. /** * The percentage of backoff time to randomize by. * See * http://go/safe-client-behavior#step-1-determine-the-appropriate-retry-interval-to-handle-spike-traffic * for context. * * <p>Visible for testing */ var RANDOM_FACTOR = 0.5; /** * Based on the backoff method from * https://github.com/google/closure-library/blob/master/closure/goog/math/exponentialbackoff.js. * Extracted here so we don't need to pass metadata and a stateful ExponentialBackoff object around. */ function calculateBackoffMillis(backoffCount, intervalMillis, backoffFactor) { if (intervalMillis === void 0) { intervalMillis = DEFAULT_INTERVAL_MILLIS; } if (backoffFactor === void 0) { backoffFactor = DEFAULT_BACKOFF_FACTOR; } // Calculates an exponentially increasing value. // Deviation: calculates value from count and a constant interval, so we only need to save value // and count to restore state. var currBaseValue = intervalMillis * Math.pow(backoffFactor, backoffCount); // A random "fuzz" to avoid waves of retries. // Deviation: randomFactor is required. var randomWait = Math.round( // A fraction of the backoff value to add/subtract. // Deviation: changes multiplication order to improve readability. RANDOM_FACTOR * currBaseValue * // A random float (rounded to int by Math.round above) in the range [-1, 1]. Determines // if we add or subtract. (Math.random() - 0.5) * 2); // Limits backoff to max to avoid effectively permanent backoff. return Math.min(MAX_VALUE_MILLIS, currBaseValue + randomWait); } exports.CONSTANTS = CONSTANTS; exports.Deferred = Deferred; exports.ErrorFactory = ErrorFactory; exports.FirebaseError = FirebaseError; exports.MAX_VALUE_MILLIS = MAX_VALUE_MILLIS; exports.RANDOM_FACTOR = RANDOM_FACTOR; exports.Sha1 = Sha1; exports.areCookiesEnabled = areCookiesEnabled; exports.assert = assert; exports.assertionError = assertionError; exports.async = async; exports.base64 = base64; exports.base64Decode = base64Decode; exports.base64Encode = base64Encode; exports.calculateBackoffMillis = calculateBackoffMillis; exports.contains = contains; exports.createSubscribe = createSubscribe; exports.decode = decode; exports.deepCopy = deepCopy; exports.deepExtend = deepExtend; exports.errorPrefix = errorPrefix; exports.getUA = getUA; exports.isAdmin = isAdmin; exports.isBrowser = isBrowser; exports.isBrowserExtension = isBrowserExtension; exports.isElectron = isElectron; exports.isEmpty = isEmpty; exports.isIE = isIE; exports.isIndexedDBAvailable = isIndexedDBAvailable; exports.isMobileCordova = isMobileCordova; exports.isNode = isNode; exports.isNodeSdk = isNodeSdk; exports.isReactNative = isReactNative; exports.isSafari = isSafari; exports.isUWP = isUWP; exports.isValidFormat = isValidFormat; exports.isValidTimestamp = isValidTimestamp; exports.issuedAtTime = issuedAtTime; exports.jsonEval = jsonEval; exports.map = map; exports.querystring = querystring; exports.querystringDecode = querystringDecode; exports.safeGet = safeGet; exports.stringLength = stringLength; exports.stringToByteArray = stringToByteArray$1; exports.stringify = stringify; exports.validateArgCount = validateArgCount; exports.validateCallback = validateCallback; exports.validateContextObject = validateContextObject; exports.validateIndexedDBOpenable = validateIndexedDBOpenable; exports.validateNamespace = validateNamespace; //# sourceMappingURL=index.cjs.js.map /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__("./node_modules/webpack/buildin/global.js"))) /***/ }), /***/ "./node_modules/@firebase/analytics/node_modules/tslib/tslib.es6.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); /* harmony export (immutable) */ __webpack_exports__["__extends"] = __extends; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__assign", function() { return __assign; }); /* harmony export (immutable) */ __webpack_exports__["__rest"] = __rest; /* harmony export (immutable) */ __webpack_exports__["__decorate"] = __decorate; /* harmony export (immutable) */ __webpack_exports__["__param"] = __param; /* harmony export (immutable) */ __webpack_exports__["__metadata"] = __metadata; /* harmony export (immutable) */ __webpack_exports__["__awaiter"] = __awaiter; /* harmony export (immutable) */ __webpack_exports__["__generator"] = __generator; /* harmony export (immutable) */ __webpack_exports__["__createBinding"] = __createBinding; /* harmony export (immutable) */ __webpack_exports__["__exportStar"] = __exportStar; /* harmony export (immutable) */ __webpack_exports__["__values"] = __values; /* harmony export (immutable) */ __webpack_exports__["__read"] = __read; /* harmony export (immutable) */ __webpack_exports__["__spread"] = __spread; /* harmony export (immutable) */ __webpack_exports__["__spreadArrays"] = __spreadArrays; /* harmony export (immutable) */ __webpack_exports__["__await"] = __await; /* harmony export (immutable) */ __webpack_exports__["__asyncGenerator"] = __asyncGenerator; /* harmony export (immutable) */ __webpack_exports__["__asyncDelegator"] = __asyncDelegator; /* harmony export (immutable) */ __webpack_exports__["__asyncValues"] = __asyncValues; /* harmony export (immutable) */ __webpack_exports__["__makeTemplateObject"] = __makeTemplateObject; /* harmony export (immutable) */ __webpack_exports__["__importStar"] = __importStar; /* harmony export (immutable) */ __webpack_exports__["__importDefault"] = __importDefault; /* harmony export (immutable) */ __webpack_exports__["__classPrivateFieldGet"] = __classPrivateFieldGet; /* harmony export (immutable) */ __webpack_exports__["__classPrivateFieldSet"] = __classPrivateFieldSet; /*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */ /* global Reflect, Promise */ var extendStatics = function(d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; function __extends(d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); } var __assign = function() { __assign = Object.assign || function __assign(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; } return __assign.apply(this, arguments); } function __rest(s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; } return t; } function __decorate(decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; } function __param(paramIndex, decorator) { return function (target, key) { decorator(target, key, paramIndex); } } function __metadata(metadataKey, metadataValue) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); } function __awaiter(thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); } function __generator(thisArg, body) { var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; function verb(n) { return function (v) { return step([n, v]); }; } function step(op) { if (f) throw new TypeError("Generator is already executing."); while (_) try { if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; if (y = 0, t) op = [op[0] & 2, t.value]; switch (op[0]) { case 0: case 1: t = op; break; case 4: _.label++; return { value: op[1], done: false }; case 5: _.label++; y = op[1]; op = [0]; continue; case 7: op = _.ops.pop(); _.trys.pop(); continue; default: if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } if (t[2]) _.ops.pop(); _.trys.pop(); continue; } op = body.call(thisArg, _); } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } } function __createBinding(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; } function __exportStar(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) exports[p] = m[p]; } function __values(o) { var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; if (m) return m.call(o); if (o && typeof o.length === "number") return { next: function () { if (o && i >= o.length) o = void 0; return { value: o && o[i++], done: !o }; } }; throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); } function __read(o, n) { var m = typeof Symbol === "function" && o[Symbol.iterator]; if (!m) return o; var i = m.call(o), r, ar = [], e; try { while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); } catch (error) { e = { error: error }; } finally { try { if (r && !r.done && (m = i["return"])) m.call(i); } finally { if (e) throw e.error; } } return ar; } function __spread() { for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); return ar; } function __spreadArrays() { for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; for (var r = Array(s), k = 0, i = 0; i < il; i++) for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) r[k] = a[j]; return r; }; function __await(v) { return this instanceof __await ? (this.v = v, this) : new __await(v); } function __asyncGenerator(thisArg, _arguments, generator) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var g = generator.apply(thisArg, _arguments || []), i, q = []; return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } function fulfill(value) { resume("next", value); } function reject(value) { resume("throw", value); } function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } } function __asyncDelegator(o) { var i, p; return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } } function __asyncValues(o) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var m = o[Symbol.asyncIterator], i; return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } } function __makeTemplateObject(cooked, raw) { if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } return cooked; }; function __importStar(mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; result.default = mod; return result; } function __importDefault(mod) { return (mod && mod.__esModule) ? mod : { default: mod }; } function __classPrivateFieldGet(receiver, privateMap) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return privateMap.get(receiver); } function __classPrivateFieldSet(receiver, privateMap, value) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to set private field on non-instance"); } privateMap.set(receiver, value); return value; } /***/ }), /***/ "./node_modules/@firebase/app/dist/index.cjs.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, '__esModule', { value: true }); var tslib = __webpack_require__("./node_modules/@firebase/app/node_modules/tslib/tslib.es6.js"); var util = __webpack_require__("./node_modules/@firebase/app/node_modules/@firebase/util/dist/index.cjs.js"); var component = __webpack_require__("./node_modules/@firebase/app/node_modules/@firebase/component/dist/index.cjs.js"); var logger$1 = __webpack_require__("./node_modules/@firebase/logger/dist/index.esm.js"); /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var _a; var ERRORS = (_a = {}, _a["no-app" /* NO_APP */] = "No Firebase App '{$appName}' has been created - " + 'call Firebase App.initializeApp()', _a["bad-app-name" /* BAD_APP_NAME */] = "Illegal App name: '{$appName}", _a["duplicate-app" /* DUPLICATE_APP */] = "Firebase App named '{$appName}' already exists", _a["app-deleted" /* APP_DELETED */] = "Firebase App named '{$appName}' already deleted", _a["invalid-app-argument" /* INVALID_APP_ARGUMENT */] = 'firebase.{$appName}() takes either no argument or a ' + 'Firebase App instance.', _a["invalid-log-argument" /* INVALID_LOG_ARGUMENT */] = 'First argument to `onLog` must be null or a function.', _a); var ERROR_FACTORY = new util.ErrorFactory('app', 'Firebase', ERRORS); var name$1 = "@firebase/app"; var version = "0.6.11"; var name$2 = "@firebase/analytics"; var name$3 = "@firebase/auth"; var name$4 = "@firebase/database"; var name$5 = "@firebase/functions"; var name$6 = "@firebase/installations"; var name$7 = "@firebase/messaging"; var name$8 = "@firebase/performance"; var name$9 = "@firebase/remote-config"; var name$a = "@firebase/storage"; var name$b = "@firebase/firestore"; var name$c = "firebase-wrapper"; /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var _a$1; var DEFAULT_ENTRY_NAME = '[DEFAULT]'; var PLATFORM_LOG_STRING = (_a$1 = {}, _a$1[name$1] = 'fire-core', _a$1[name$2] = 'fire-analytics', _a$1[name$3] = 'fire-auth', _a$1[name$4] = 'fire-rtdb', _a$1[name$5] = 'fire-fn', _a$1[name$6] = 'fire-iid', _a$1[name$7] = 'fire-fcm', _a$1[name$8] = 'fire-perf', _a$1[name$9] = 'fire-rc', _a$1[name$a] = 'fire-gcs', _a$1[name$b] = 'fire-fst', _a$1['fire-js'] = 'fire-js', _a$1[name$c] = 'fire-js-all', _a$1); /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var logger = new logger$1.Logger('@firebase/app'); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Global context object for a collection of services using * a shared authentication state. */ var FirebaseAppImpl = /** @class */ (function () { function FirebaseAppImpl(options, config, firebase_) { var e_1, _a; var _this = this; this.firebase_ = firebase_; this.isDeleted_ = false; this.name_ = config.name; this.automaticDataCollectionEnabled_ = config.automaticDataCollectionEnabled || false; this.options_ = util.deepCopy(options); this.container = new component.ComponentContainer(config.name); // add itself to container this._addComponent(new component.Component('app', function () { return _this; }, "PUBLIC" /* PUBLIC */)); try { // populate ComponentContainer with existing components for (var _b = tslib.__values(this.firebase_.INTERNAL.components.values()), _c = _b.next(); !_c.done; _c = _b.next()) { var component$1 = _c.value; this._addComponent(component$1); } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (_c && !_c.done && (_a = _b.return)) _a.call(_b); } finally { if (e_1) throw e_1.error; } } } Object.defineProperty(FirebaseAppImpl.prototype, "automaticDataCollectionEnabled", { get: function () { this.checkDestroyed_(); return this.automaticDataCollectionEnabled_; }, set: function (val) { this.checkDestroyed_(); this.automaticDataCollectionEnabled_ = val; }, enumerable: false, configurable: true }); Object.defineProperty(FirebaseAppImpl.prototype, "name", { get: function () { this.checkDestroyed_(); return this.name_; }, enumerable: false, configurable: true }); Object.defineProperty(FirebaseAppImpl.prototype, "options", { get: function () { this.checkDestroyed_(); return this.options_; }, enumerable: false, configurable: true }); FirebaseAppImpl.prototype.delete = function () { var _this = this; return new Promise(function (resolve) { _this.checkDestroyed_(); resolve(); }) .then(function () { _this.firebase_.INTERNAL.removeApp(_this.name_); return Promise.all(_this.container.getProviders().map(function (provider) { return provider.delete(); })); }) .then(function () { _this.isDeleted_ = true; }); }; /** * Return a service instance associated with this app (creating it * on demand), identified by the passed instanceIdentifier. * * NOTE: Currently storage and functions are the only ones that are leveraging this * functionality. They invoke it by calling: * * ```javascript * firebase.app().storage('STORAGE BUCKET ID') * ``` * * The service name is passed to this already * @internal */ FirebaseAppImpl.prototype._getService = function (name, instanceIdentifier) { if (instanceIdentifier === void 0) { instanceIdentifier = DEFAULT_ENTRY_NAME; } this.checkDestroyed_(); // getImmediate will always succeed because _getService is only called for registered components. return this.container.getProvider(name).getImmediate({ identifier: instanceIdentifier }); }; /** * Remove a service instance from the cache, so we will create a new instance for this service * when people try to get this service again. * * NOTE: currently only firestore is using this functionality to support firestore shutdown. * * @param name The service name * @param instanceIdentifier instance identifier in case multiple instances are allowed * @internal */ FirebaseAppImpl.prototype._removeServiceInstance = function (name, instanceIdentifier) { if (instanceIdentifier === void 0) { instanceIdentifier = DEFAULT_ENTRY_NAME; } // eslint-disable-next-line @typescript-eslint/no-explicit-any this.container.getProvider(name).clearInstance(instanceIdentifier); }; /** * @param component the component being added to this app's container */ FirebaseAppImpl.prototype._addComponent = function (component) { try { this.container.addComponent(component); } catch (e) { logger.debug("Component " + component.name + " failed to register with FirebaseApp " + this.name, e); } }; FirebaseAppImpl.prototype._addOrOverwriteComponent = function (component) { this.container.addOrOverwriteComponent(component); }; /** * This function will throw an Error if the App has already been deleted - * use before performing API actions on the App. */ FirebaseAppImpl.prototype.checkDestroyed_ = function () { if (this.isDeleted_) { throw ERROR_FACTORY.create("app-deleted" /* APP_DELETED */, { appName: this.name_ }); } }; return FirebaseAppImpl; }()); // Prevent dead-code elimination of these methods w/o invalid property // copying. (FirebaseAppImpl.prototype.name && FirebaseAppImpl.prototype.options) || FirebaseAppImpl.prototype.delete || console.log('dc'); var version$1 = "7.20.0"; /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Because auth can't share code with other components, we attach the utility functions * in an internal namespace to share code. * This function return a firebase namespace object without * any utility functions, so it can be shared between the regular firebaseNamespace and * the lite version. */ function createFirebaseNamespaceCore(firebaseAppImpl) { var apps = {}; // eslint-disable-next-line @typescript-eslint/no-explicit-any var components = new Map(); // A namespace is a plain JavaScript Object. var namespace = { // Hack to prevent Babel from modifying the object returned // as the firebase namespace. // @ts-ignore __esModule: true, initializeApp: initializeApp, // @ts-ignore app: app, registerVersion: registerVersion, setLogLevel: logger$1.setLogLevel, onLog: onLog, // @ts-ignore apps: null, SDK_VERSION: version$1, INTERNAL: { registerComponent: registerComponent, removeApp: removeApp, components: components, useAsService: useAsService } }; // Inject a circular default export to allow Babel users who were previously // using: // // import firebase from 'firebase'; // which becomes: var firebase = require('firebase').default; // // instead of // // import * as firebase from 'firebase'; // which becomes: var firebase = require('firebase'); // eslint-disable-next-line @typescript-eslint/no-explicit-any namespace['default'] = namespace; // firebase.apps is a read-only getter. Object.defineProperty(namespace, 'apps', { get: getApps }); /** * Called by App.delete() - but before any services associated with the App * are deleted. */ function removeApp(name) { delete apps[name]; } /** * Get the App object for a given name (or DEFAULT). */ function app(name) { name = name || DEFAULT_ENTRY_NAME; if (!util.contains(apps, name)) { throw ERROR_FACTORY.create("no-app" /* NO_APP */, { appName: name }); } return apps[name]; } // @ts-ignore app['App'] = firebaseAppImpl; function initializeApp(options, rawConfig) { if (rawConfig === void 0) { rawConfig = {}; } if (typeof rawConfig !== 'object' || rawConfig === null) { var name_1 = rawConfig; rawConfig = { name: name_1 }; } var config = rawConfig; if (config.name === undefined) { config.name = DEFAULT_ENTRY_NAME; } var name = config.name; if (typeof name !== 'string' || !name) { throw ERROR_FACTORY.create("bad-app-name" /* BAD_APP_NAME */, { appName: String(name) }); } if (util.contains(apps, name)) { throw ERROR_FACTORY.create("duplicate-app" /* DUPLICATE_APP */, { appName: name }); } var app = new firebaseAppImpl(options, config, namespace); apps[name] = app; return app; } /* * Return an array of all the non-deleted FirebaseApps. */ function getApps() { // Make a copy so caller cannot mutate the apps list. return Object.keys(apps).map(function (name) { return apps[name]; }); } function registerComponent(component) { var e_1, _a; var componentName = component.name; if (components.has(componentName)) { logger.debug("There were multiple attempts to register component " + componentName + "."); return component.type === "PUBLIC" /* PUBLIC */ ? // eslint-disable-next-line @typescript-eslint/no-explicit-any namespace[componentName] : null; } components.set(componentName, component); // create service namespace for public components if (component.type === "PUBLIC" /* PUBLIC */) { // The Service namespace is an accessor function ... var serviceNamespace = function (appArg) { if (appArg === void 0) { appArg = app(); } // eslint-disable-next-line @typescript-eslint/no-explicit-any if (typeof appArg[componentName] !== 'function') { // Invalid argument. // This happens in the following case: firebase.storage('gs:/') throw ERROR_FACTORY.create("invalid-app-argument" /* INVALID_APP_ARGUMENT */, { appName: componentName }); } // Forward service instance lookup to the FirebaseApp. // eslint-disable-next-line @typescript-eslint/no-explicit-any return appArg[componentName](); }; // ... and a container for service-level properties. if (component.serviceProps !== undefined) { util.deepExtend(serviceNamespace, component.serviceProps); } // eslint-disable-next-line @typescript-eslint/no-explicit-any namespace[componentName] = serviceNamespace; // Patch the FirebaseAppImpl prototype // eslint-disable-next-line @typescript-eslint/no-explicit-any firebaseAppImpl.prototype[componentName] = // TODO: The eslint disable can be removed and the 'ignoreRestArgs' // option added to the no-explicit-any rule when ESlint releases it. // eslint-disable-next-line @typescript-eslint/no-explicit-any function () { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } var serviceFxn = this._getService.bind(this, componentName); return serviceFxn.apply(this, component.multipleInstances ? args : []); }; } try { // add the component to existing app instances for (var _b = tslib.__values(Object.keys(apps)), _c = _b.next(); !_c.done; _c = _b.next()) { var appName = _c.value; apps[appName]._addComponent(component); } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (_c && !_c.done && (_a = _b.return)) _a.call(_b); } finally { if (e_1) throw e_1.error; } } return component.type === "PUBLIC" /* PUBLIC */ ? // eslint-disable-next-line @typescript-eslint/no-explicit-any namespace[componentName] : null; } function registerVersion(libraryKeyOrName, version, variant) { var _a; // TODO: We can use this check to whitelist strings when/if we set up // a good whitelist system. var library = (_a = PLATFORM_LOG_STRING[libraryKeyOrName]) !== null && _a !== void 0 ? _a : libraryKeyOrName; if (variant) { library += "-" + variant; } var libraryMismatch = library.match(/\s|\//); var versionMismatch = version.match(/\s|\//); if (libraryMismatch || versionMismatch) { var warning = [ "Unable to register library \"" + library + "\" with version \"" + version + "\":" ]; if (libraryMismatch) { warning.push("library name \"" + library + "\" contains illegal characters (whitespace or \"/\")"); } if (libraryMismatch && versionMismatch) { warning.push('and'); } if (versionMismatch) { warning.push("version name \"" + version + "\" contains illegal characters (whitespace or \"/\")"); } logger.warn(warning.join(' ')); return; } registerComponent(new component.Component(library + "-version", function () { return ({ library: library, version: version }); }, "VERSION" /* VERSION */)); } function onLog(logCallback, options) { if (logCallback !== null && typeof logCallback !== 'function') { throw ERROR_FACTORY.create("invalid-log-argument" /* INVALID_LOG_ARGUMENT */, { appName: name }); } logger$1.setUserLogHandler(logCallback, options); } // Map the requested service to a registered service name // (used to map auth to serverAuth service when needed). function useAsService(app, name) { if (name === 'serverAuth') { return null; } var useService = name; return useService; } return namespace; } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Return a firebase namespace object. * * In production, this will be called exactly once and the result * assigned to the 'firebase' global. It may be called multiple times * in unit tests. */ function createFirebaseNamespace() { var namespace = createFirebaseNamespaceCore(FirebaseAppImpl); namespace.INTERNAL = tslib.__assign(tslib.__assign({}, namespace.INTERNAL), { createFirebaseNamespace: createFirebaseNamespace, extendNamespace: extendNamespace, createSubscribe: util.createSubscribe, ErrorFactory: util.ErrorFactory, deepExtend: util.deepExtend }); /** * Patch the top-level firebase namespace with additional properties. * * firebase.INTERNAL.extendNamespace() */ function extendNamespace(props) { util.deepExtend(namespace, props); } return namespace; } var firebase = createFirebaseNamespace(); /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var PlatformLoggerService = /** @class */ (function () { function PlatformLoggerService(container) { this.container = container; } // In initial implementation, this will be called by installations on // auth token refresh, and installations will send this string. PlatformLoggerService.prototype.getPlatformInfoString = function () { var providers = this.container.getProviders(); // Loop through providers and get library/version pairs from any that are // version components. return providers .map(function (provider) { if (isVersionServiceProvider(provider)) { var service = provider.getImmediate(); return service.library + "/" + service.version; } else { return null; } }) .filter(function (logString) { return logString; }) .join(' '); }; return PlatformLoggerService; }()); /** * * @param provider check if this provider provides a VersionService * * NOTE: Using Provider<'app-version'> is a hack to indicate that the provider * provides VersionService. The provider is not necessarily a 'app-version' * provider. */ function isVersionServiceProvider(provider) { var component = provider.getComponent(); return (component === null || component === void 0 ? void 0 : component.type) === "VERSION" /* VERSION */; } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ function registerCoreComponents(firebase, variant) { firebase.INTERNAL.registerComponent(new component.Component('platform-logger', function (container) { return new PlatformLoggerService(container); }, "PRIVATE" /* PRIVATE */)); // Register `app` package. firebase.registerVersion(name$1, version, variant); // Register platform SDK identifier (no version). firebase.registerVersion('fire-js', ''); } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // Firebase Lite detection test // eslint-disable-next-line @typescript-eslint/no-explicit-any if (util.isBrowser() && self.firebase !== undefined) { logger.warn("\n Warning: Firebase is already defined in the global scope. Please make sure\n Firebase library is only loaded once.\n "); // eslint-disable-next-line var sdkVersion = self.firebase.SDK_VERSION; if (sdkVersion && sdkVersion.indexOf('LITE') >= 0) { logger.warn("\n Warning: You are trying to load Firebase while using Firebase Performance standalone script.\n You should load Firebase Performance with this instance of Firebase to avoid loading duplicate code.\n "); } } var initializeApp = firebase.initializeApp; // TODO: This disable can be removed and the 'ignoreRestArgs' option added to // the no-explicit-any rule when ESlint releases it. // eslint-disable-next-line @typescript-eslint/no-explicit-any firebase.initializeApp = function () { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } // Environment check before initializing app // Do the check in initializeApp, so people have a chance to disable it by setting logLevel // in @firebase/logger if (util.isNode()) { logger.warn("\n Warning: This is a browser-targeted Firebase bundle but it appears it is being\n run in a Node environment. If running in a Node environment, make sure you\n are using the bundle specified by the \"main\" field in package.json.\n \n If you are using Webpack, you can specify \"main\" as the first item in\n \"resolve.mainFields\":\n https://webpack.js.org/configuration/resolve/#resolvemainfields\n \n If using Rollup, use the rollup-plugin-node-resolve plugin and specify \"main\"\n as the first item in \"mainFields\", e.g. ['main', 'module'].\n https://github.com/rollup/rollup-plugin-node-resolve\n "); } return initializeApp.apply(undefined, args); }; var firebase$1 = firebase; registerCoreComponents(firebase$1); exports.default = firebase$1; exports.firebase = firebase$1; //# sourceMappingURL=index.cjs.js.map /***/ }), /***/ "./node_modules/@firebase/app/node_modules/@firebase/component/dist/index.cjs.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, '__esModule', { value: true }); var tslib = __webpack_require__("./node_modules/@firebase/app/node_modules/tslib/tslib.es6.js"); var util = __webpack_require__("./node_modules/@firebase/app/node_modules/@firebase/util/dist/index.cjs.js"); /** * Component for service name T, e.g. `auth`, `auth-internal` */ var Component = /** @class */ (function () { /** * * @param name The public service name, e.g. app, auth, firestore, database * @param instanceFactory Service factory responsible for creating the public interface * @param type whether the service provided by the component is public or private */ function Component(name, instanceFactory, type) { this.name = name; this.instanceFactory = instanceFactory; this.type = type; this.multipleInstances = false; /** * Properties to be added to the service namespace */ this.serviceProps = {}; this.instantiationMode = "LAZY" /* LAZY */; } Component.prototype.setInstantiationMode = function (mode) { this.instantiationMode = mode; return this; }; Component.prototype.setMultipleInstances = function (multipleInstances) { this.multipleInstances = multipleInstances; return this; }; Component.prototype.setServiceProps = function (props) { this.serviceProps = props; return this; }; return Component; }()); /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var DEFAULT_ENTRY_NAME = '[DEFAULT]'; /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Provider for instance for service name T, e.g. 'auth', 'auth-internal' * NameServiceMapping[T] is an alias for the type of the instance */ var Provider = /** @class */ (function () { function Provider(name, container) { this.name = name; this.container = container; this.component = null; this.instances = new Map(); this.instancesDeferred = new Map(); } /** * @param identifier A provider can provide mulitple instances of a service * if this.component.multipleInstances is true. */ Provider.prototype.get = function (identifier) { if (identifier === void 0) { identifier = DEFAULT_ENTRY_NAME; } // if multipleInstances is not supported, use the default name var normalizedIdentifier = this.normalizeInstanceIdentifier(identifier); if (!this.instancesDeferred.has(normalizedIdentifier)) { var deferred = new util.Deferred(); this.instancesDeferred.set(normalizedIdentifier, deferred); // If the service instance is available, resolve the promise with it immediately try { var instance = this.getOrInitializeService(normalizedIdentifier); if (instance) { deferred.resolve(instance); } } catch (e) { // when the instance factory throws an exception during get(), it should not cause // a fatal error. We just return the unresolved promise in this case. } } return this.instancesDeferred.get(normalizedIdentifier).promise; }; Provider.prototype.getImmediate = function (options) { var _a = tslib.__assign({ identifier: DEFAULT_ENTRY_NAME, optional: false }, options), identifier = _a.identifier, optional = _a.optional; // if multipleInstances is not supported, use the default name var normalizedIdentifier = this.normalizeInstanceIdentifier(identifier); try { var instance = this.getOrInitializeService(normalizedIdentifier); if (!instance) { if (optional) { return null; } throw Error("Service " + this.name + " is not available"); } return instance; } catch (e) { if (optional) { return null; } else { throw e; } } }; Provider.prototype.getComponent = function () { return this.component; }; Provider.prototype.setComponent = function (component) { var e_1, _a; if (component.name !== this.name) { throw Error("Mismatching Component " + component.name + " for Provider " + this.name + "."); } if (this.component) { throw Error("Component for " + this.name + " has already been provided"); } this.component = component; // if the service is eager, initialize the default instance if (isComponentEager(component)) { try { this.getOrInitializeService(DEFAULT_ENTRY_NAME); } catch (e) { // when the instance factory for an eager Component throws an exception during the eager // initialization, it should not cause a fatal error. // TODO: Investigate if we need to make it configurable, because some component may want to cause // a fatal error in this case? } } try { // Create service instances for the pending promises and resolve them // NOTE: if this.multipleInstances is false, only the default instance will be created // and all promises with resolve with it regardless of the identifier. for (var _b = tslib.__values(this.instancesDeferred.entries()), _c = _b.next(); !_c.done; _c = _b.next()) { var _d = tslib.__read(_c.value, 2), instanceIdentifier = _d[0], instanceDeferred = _d[1]; var normalizedIdentifier = this.normalizeInstanceIdentifier(instanceIdentifier); try { // `getOrInitializeService()` should always return a valid instance since a component is guaranteed. use ! to make typescript happy. var instance = this.getOrInitializeService(normalizedIdentifier); instanceDeferred.resolve(instance); } catch (e) { // when the instance factory throws an exception, it should not cause // a fatal error. We just leave the promise unresolved. } } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (_c && !_c.done && (_a = _b.return)) _a.call(_b); } finally { if (e_1) throw e_1.error; } } }; Provider.prototype.clearInstance = function (identifier) { if (identifier === void 0) { identifier = DEFAULT_ENTRY_NAME; } this.instancesDeferred.delete(identifier); this.instances.delete(identifier); }; // app.delete() will call this method on every provider to delete the services // TODO: should we mark the provider as deleted? Provider.prototype.delete = function () { return tslib.__awaiter(this, void 0, void 0, function () { var services; return tslib.__generator(this, function (_a) { switch (_a.label) { case 0: services = Array.from(this.instances.values()); return [4 /*yield*/, Promise.all(tslib.__spread(services .filter(function (service) { return 'INTERNAL' in service; }) // legacy services // eslint-disable-next-line @typescript-eslint/no-explicit-any .map(function (service) { return service.INTERNAL.delete(); }), services .filter(function (service) { return '_delete' in service; }) // modularized services // eslint-disable-next-line @typescript-eslint/no-explicit-any .map(function (service) { return service._delete(); })))]; case 1: _a.sent(); return [2 /*return*/]; } }); }); }; Provider.prototype.isComponentSet = function () { return this.component != null; }; Provider.prototype.getOrInitializeService = function (identifier) { var instance = this.instances.get(identifier); if (!instance && this.component) { instance = this.component.instanceFactory(this.container, normalizeIdentifierForFactory(identifier)); this.instances.set(identifier, instance); } return instance || null; }; Provider.prototype.normalizeInstanceIdentifier = function (identifier) { if (this.component) { return this.component.multipleInstances ? identifier : DEFAULT_ENTRY_NAME; } else { return identifier; // assume multiple instances are supported before the component is provided. } }; return Provider; }()); // undefined should be passed to the service factory for the default instance function normalizeIdentifierForFactory(identifier) { return identifier === DEFAULT_ENTRY_NAME ? undefined : identifier; } function isComponentEager(component) { return component.instantiationMode === "EAGER" /* EAGER */; } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * ComponentContainer that provides Providers for service name T, e.g. `auth`, `auth-internal` */ var ComponentContainer = /** @class */ (function () { function ComponentContainer(name) { this.name = name; this.providers = new Map(); } /** * * @param component Component being added * @param overwrite When a component with the same name has already been registered, * if overwrite is true: overwrite the existing component with the new component and create a new * provider with the new component. It can be useful in tests where you want to use different mocks * for different tests. * if overwrite is false: throw an exception */ ComponentContainer.prototype.addComponent = function (component) { var provider = this.getProvider(component.name); if (provider.isComponentSet()) { throw new Error("Component " + component.name + " has already been registered with " + this.name); } provider.setComponent(component); }; ComponentContainer.prototype.addOrOverwriteComponent = function (component) { var provider = this.getProvider(component.name); if (provider.isComponentSet()) { // delete the existing provider from the container, so we can register the new component this.providers.delete(component.name); } this.addComponent(component); }; /** * getProvider provides a type safe interface where it can only be called with a field name * present in NameServiceMapping interface. * * Firebase SDKs providing services should extend NameServiceMapping interface to register * themselves. */ ComponentContainer.prototype.getProvider = function (name) { if (this.providers.has(name)) { return this.providers.get(name); } // create a Provider for a service that hasn't registered with Firebase var provider = new Provider(name, this); this.providers.set(name, provider); return provider; }; ComponentContainer.prototype.getProviders = function () { return Array.from(this.providers.values()); }; return ComponentContainer; }()); exports.Component = Component; exports.ComponentContainer = ComponentContainer; exports.Provider = Provider; //# sourceMappingURL=index.cjs.js.map /***/ }), /***/ "./node_modules/@firebase/app/node_modules/@firebase/util/dist/index.cjs.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(global) { Object.defineProperty(exports, '__esModule', { value: true }); var tslib = __webpack_require__("./node_modules/@firebase/app/node_modules/tslib/tslib.es6.js"); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * @fileoverview Firebase constants. Some of these (@defines) can be overridden at compile-time. */ var CONSTANTS = { /** * @define {boolean} Whether this is the client Node.js SDK. */ NODE_CLIENT: false, /** * @define {boolean} Whether this is the Admin Node.js SDK. */ NODE_ADMIN: false, /** * Firebase SDK Version */ SDK_VERSION: '${JSCORE_VERSION}' }; /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Throws an error if the provided assertion is falsy */ var assert = function (assertion, message) { if (!assertion) { throw assertionError(message); } }; /** * Returns an Error object suitable for throwing. */ var assertionError = function (message) { return new Error('Firebase Database (' + CONSTANTS.SDK_VERSION + ') INTERNAL ASSERT FAILED: ' + message); }; /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var stringToByteArray = function (str) { // TODO(user): Use native implementations if/when available var out = []; var p = 0; for (var i = 0; i < str.length; i++) { var c = str.charCodeAt(i); if (c < 128) { out[p++] = c; } else if (c < 2048) { out[p++] = (c >> 6) | 192; out[p++] = (c & 63) | 128; } else if ((c & 0xfc00) === 0xd800 && i + 1 < str.length && (str.charCodeAt(i + 1) & 0xfc00) === 0xdc00) { // Surrogate Pair c = 0x10000 + ((c & 0x03ff) << 10) + (str.charCodeAt(++i) & 0x03ff); out[p++] = (c >> 18) | 240; out[p++] = ((c >> 12) & 63) | 128; out[p++] = ((c >> 6) & 63) | 128; out[p++] = (c & 63) | 128; } else { out[p++] = (c >> 12) | 224; out[p++] = ((c >> 6) & 63) | 128; out[p++] = (c & 63) | 128; } } return out; }; /** * Turns an array of numbers into the string given by the concatenation of the * characters to which the numbers correspond. * @param bytes Array of numbers representing characters. * @return Stringification of the array. */ var byteArrayToString = function (bytes) { // TODO(user): Use native implementations if/when available var out = []; var pos = 0, c = 0; while (pos < bytes.length) { var c1 = bytes[pos++]; if (c1 < 128) { out[c++] = String.fromCharCode(c1); } else if (c1 > 191 && c1 < 224) { var c2 = bytes[pos++]; out[c++] = String.fromCharCode(((c1 & 31) << 6) | (c2 & 63)); } else if (c1 > 239 && c1 < 365) { // Surrogate Pair var c2 = bytes[pos++]; var c3 = bytes[pos++]; var c4 = bytes[pos++]; var u = (((c1 & 7) << 18) | ((c2 & 63) << 12) | ((c3 & 63) << 6) | (c4 & 63)) - 0x10000; out[c++] = String.fromCharCode(0xd800 + (u >> 10)); out[c++] = String.fromCharCode(0xdc00 + (u & 1023)); } else { var c2 = bytes[pos++]; var c3 = bytes[pos++]; out[c++] = String.fromCharCode(((c1 & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63)); } } return out.join(''); }; // We define it as an object literal instead of a class because a class compiled down to es5 can't // be treeshaked. https://github.com/rollup/rollup/issues/1691 // Static lookup maps, lazily populated by init_() var base64 = { /** * Maps bytes to characters. */ byteToCharMap_: null, /** * Maps characters to bytes. */ charToByteMap_: null, /** * Maps bytes to websafe characters. * @private */ byteToCharMapWebSafe_: null, /** * Maps websafe characters to bytes. * @private */ charToByteMapWebSafe_: null, /** * Our default alphabet, shared between * ENCODED_VALS and ENCODED_VALS_WEBSAFE */ ENCODED_VALS_BASE: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' + 'abcdefghijklmnopqrstuvwxyz' + '0123456789', /** * Our default alphabet. Value 64 (=) is special; it means "nothing." */ get ENCODED_VALS() { return this.ENCODED_VALS_BASE + '+/='; }, /** * Our websafe alphabet. */ get ENCODED_VALS_WEBSAFE() { return this.ENCODED_VALS_BASE + '-_.'; }, /** * Whether this browser supports the atob and btoa functions. This extension * started at Mozilla but is now implemented by many browsers. We use the * ASSUME_* variables to avoid pulling in the full useragent detection library * but still allowing the standard per-browser compilations. * */ HAS_NATIVE_SUPPORT: typeof atob === 'function', /** * Base64-encode an array of bytes. * * @param input An array of bytes (numbers with * value in [0, 255]) to encode. * @param webSafe Boolean indicating we should use the * alternative alphabet. * @return The base64 encoded string. */ encodeByteArray: function (input, webSafe) { if (!Array.isArray(input)) { throw Error('encodeByteArray takes an array as a parameter'); } this.init_(); var byteToCharMap = webSafe ? this.byteToCharMapWebSafe_ : this.byteToCharMap_; var output = []; for (var i = 0; i < input.length; i += 3) { var byte1 = input[i]; var haveByte2 = i + 1 < input.length; var byte2 = haveByte2 ? input[i + 1] : 0; var haveByte3 = i + 2 < input.length; var byte3 = haveByte3 ? input[i + 2] : 0; var outByte1 = byte1 >> 2; var outByte2 = ((byte1 & 0x03) << 4) | (byte2 >> 4); var outByte3 = ((byte2 & 0x0f) << 2) | (byte3 >> 6); var outByte4 = byte3 & 0x3f; if (!haveByte3) { outByte4 = 64; if (!haveByte2) { outByte3 = 64; } } output.push(byteToCharMap[outByte1], byteToCharMap[outByte2], byteToCharMap[outByte3], byteToCharMap[outByte4]); } return output.join(''); }, /** * Base64-encode a string. * * @param input A string to encode. * @param webSafe If true, we should use the * alternative alphabet. * @return The base64 encoded string. */ encodeString: function (input, webSafe) { // Shortcut for Mozilla browsers that implement // a native base64 encoder in the form of "btoa/atob" if (this.HAS_NATIVE_SUPPORT && !webSafe) { return btoa(input); } return this.encodeByteArray(stringToByteArray(input), webSafe); }, /** * Base64-decode a string. * * @param input to decode. * @param webSafe True if we should use the * alternative alphabet. * @return string representing the decoded value. */ decodeString: function (input, webSafe) { // Shortcut for Mozilla browsers that implement // a native base64 encoder in the form of "btoa/atob" if (this.HAS_NATIVE_SUPPORT && !webSafe) { return atob(input); } return byteArrayToString(this.decodeStringToByteArray(input, webSafe)); }, /** * Base64-decode a string. * * In base-64 decoding, groups of four characters are converted into three * bytes. If the encoder did not apply padding, the input length may not * be a multiple of 4. * * In this case, the last group will have fewer than 4 characters, and * padding will be inferred. If the group has one or two characters, it decodes * to one byte. If the group has three characters, it decodes to two bytes. * * @param input Input to decode. * @param webSafe True if we should use the web-safe alphabet. * @return bytes representing the decoded value. */ decodeStringToByteArray: function (input, webSafe) { this.init_(); var charToByteMap = webSafe ? this.charToByteMapWebSafe_ : this.charToByteMap_; var output = []; for (var i = 0; i < input.length;) { var byte1 = charToByteMap[input.charAt(i++)]; var haveByte2 = i < input.length; var byte2 = haveByte2 ? charToByteMap[input.charAt(i)] : 0; ++i; var haveByte3 = i < input.length; var byte3 = haveByte3 ? charToByteMap[input.charAt(i)] : 64; ++i; var haveByte4 = i < input.length; var byte4 = haveByte4 ? charToByteMap[input.charAt(i)] : 64; ++i; if (byte1 == null || byte2 == null || byte3 == null || byte4 == null) { throw Error(); } var outByte1 = (byte1 << 2) | (byte2 >> 4); output.push(outByte1); if (byte3 !== 64) { var outByte2 = ((byte2 << 4) & 0xf0) | (byte3 >> 2); output.push(outByte2); if (byte4 !== 64) { var outByte3 = ((byte3 << 6) & 0xc0) | byte4; output.push(outByte3); } } } return output; }, /** * Lazy static initialization function. Called before * accessing any of the static map variables. * @private */ init_: function () { if (!this.byteToCharMap_) { this.byteToCharMap_ = {}; this.charToByteMap_ = {}; this.byteToCharMapWebSafe_ = {}; this.charToByteMapWebSafe_ = {}; // We want quick mappings back and forth, so we precompute two maps. for (var i = 0; i < this.ENCODED_VALS.length; i++) { this.byteToCharMap_[i] = this.ENCODED_VALS.charAt(i); this.charToByteMap_[this.byteToCharMap_[i]] = i; this.byteToCharMapWebSafe_[i] = this.ENCODED_VALS_WEBSAFE.charAt(i); this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[i]] = i; // Be forgiving when decoding and correctly decode both encodings. if (i >= this.ENCODED_VALS_BASE.length) { this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(i)] = i; this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(i)] = i; } } } } }; /** * URL-safe base64 encoding */ var base64Encode = function (str) { var utf8Bytes = stringToByteArray(str); return base64.encodeByteArray(utf8Bytes, true); }; /** * URL-safe base64 decoding * * NOTE: DO NOT use the global atob() function - it does NOT support the * base64Url variant encoding. * * @param str To be decoded * @return Decoded result, if possible */ var base64Decode = function (str) { try { return base64.decodeString(str, true); } catch (e) { console.error('base64Decode failed: ', e); } return null; }; /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Do a deep-copy of basic JavaScript Objects or Arrays. */ function deepCopy(value) { return deepExtend(undefined, value); } /** * Copy properties from source to target (recursively allows extension * of Objects and Arrays). Scalar values in the target are over-written. * If target is undefined, an object of the appropriate type will be created * (and returned). * * We recursively copy all child properties of plain Objects in the source- so * that namespace- like dictionaries are merged. * * Note that the target can be a function, in which case the properties in * the source Object are copied onto it as static properties of the Function. */ function deepExtend(target, source) { if (!(source instanceof Object)) { return source; } switch (source.constructor) { case Date: // Treat Dates like scalars; if the target date object had any child // properties - they will be lost! var dateValue = source; return new Date(dateValue.getTime()); case Object: if (target === undefined) { target = {}; } break; case Array: // Always copy the array source and overwrite the target. target = []; break; default: // Not a plain Object - treat it as a scalar. return source; } for (var prop in source) { if (!source.hasOwnProperty(prop)) { continue; } target[prop] = deepExtend(target[prop], source[prop]); } return target; } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var Deferred = /** @class */ (function () { function Deferred() { var _this = this; this.reject = function () { }; this.resolve = function () { }; this.promise = new Promise(function (resolve, reject) { _this.resolve = resolve; _this.reject = reject; }); } /** * Our API internals are not promiseified and cannot because our callback APIs have subtle expectations around * invoking promises inline, which Promises are forbidden to do. This method accepts an optional node-style callback * and returns a node-style callback which will resolve or reject the Deferred's promise. */ Deferred.prototype.wrapCallback = function (callback) { var _this = this; return function (error, value) { if (error) { _this.reject(error); } else { _this.resolve(value); } if (typeof callback === 'function') { // Attaching noop handler just in case developer wasn't expecting // promises _this.promise.catch(function () { }); // Some of our callbacks don't expect a value and our own tests // assert that the parameter length is 1 if (callback.length === 1) { callback(error); } else { callback(error, value); } } }; }; return Deferred; }()); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Returns navigator.userAgent string or '' if it's not defined. * @return user agent string */ function getUA() { if (typeof navigator !== 'undefined' && typeof navigator['userAgent'] === 'string') { return navigator['userAgent']; } else { return ''; } } /** * Detect Cordova / PhoneGap / Ionic frameworks on a mobile device. * * Deliberately does not rely on checking `file://` URLs (as this fails PhoneGap * in the Ripple emulator) nor Cordova `onDeviceReady`, which would normally * wait for a callback. */ function isMobileCordova() { return (typeof window !== 'undefined' && // @ts-ignore Setting up an broadly applicable index signature for Window // just to deal with this case would probably be a bad idea. !!(window['cordova'] || window['phonegap'] || window['PhoneGap']) && /ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(getUA())); } /** * Detect Node.js. * * @return true if Node.js environment is detected. */ // Node detection logic from: https://github.com/iliakan/detect-node/ function isNode() { try { return (Object.prototype.toString.call(global.process) === '[object process]'); } catch (e) { return false; } } /** * Detect Browser Environment */ function isBrowser() { return typeof self === 'object' && self.self === self; } function isBrowserExtension() { var runtime = typeof chrome === 'object' ? chrome.runtime : typeof browser === 'object' ? browser.runtime : undefined; return typeof runtime === 'object' && runtime.id !== undefined; } /** * Detect React Native. * * @return true if ReactNative environment is detected. */ function isReactNative() { return (typeof navigator === 'object' && navigator['product'] === 'ReactNative'); } /** Detects Electron apps. */ function isElectron() { return getUA().indexOf('Electron/') >= 0; } /** Detects Internet Explorer. */ function isIE() { var ua = getUA(); return ua.indexOf('MSIE ') >= 0 || ua.indexOf('Trident/') >= 0; } /** Detects Universal Windows Platform apps. */ function isUWP() { return getUA().indexOf('MSAppHost/') >= 0; } /** * Detect whether the current SDK build is the Node version. * * @return true if it's the Node SDK build. */ function isNodeSdk() { return CONSTANTS.NODE_CLIENT === true || CONSTANTS.NODE_ADMIN === true; } /** Returns true if we are running in Safari. */ function isSafari() { return (!isNode() && navigator.userAgent.includes('Safari') && !navigator.userAgent.includes('Chrome')); } /** * This method checks if indexedDB is supported by current browser/service worker context * @return true if indexedDB is supported by current browser/service worker context */ function isIndexedDBAvailable() { return 'indexedDB' in self && indexedDB != null; } /** * This method validates browser context for indexedDB by opening a dummy indexedDB database and reject * if errors occur during the database open operation. */ function validateIndexedDBOpenable() { return new Promise(function (resolve, reject) { try { var preExist_1 = true; var DB_CHECK_NAME_1 = 'validate-browser-context-for-indexeddb-analytics-module'; var request_1 = window.indexedDB.open(DB_CHECK_NAME_1); request_1.onsuccess = function () { request_1.result.close(); // delete database only when it doesn't pre-exist if (!preExist_1) { window.indexedDB.deleteDatabase(DB_CHECK_NAME_1); } resolve(true); }; request_1.onupgradeneeded = function () { preExist_1 = false; }; request_1.onerror = function () { var _a; reject(((_a = request_1.error) === null || _a === void 0 ? void 0 : _a.message) || ''); }; } catch (error) { reject(error); } }); } /** * * This method checks whether cookie is enabled within current browser * @return true if cookie is enabled within current browser */ function areCookiesEnabled() { if (!navigator || !navigator.cookieEnabled) { return false; } return true; } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var ERROR_NAME = 'FirebaseError'; // Based on code from: // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error#Custom_Error_Types var FirebaseError = /** @class */ (function (_super) { tslib.__extends(FirebaseError, _super); function FirebaseError(code, message) { var _this = _super.call(this, message) || this; _this.code = code; _this.name = ERROR_NAME; // Fix For ES5 // https://github.com/Microsoft/TypeScript-wiki/blob/master/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work Object.setPrototypeOf(_this, FirebaseError.prototype); // Maintains proper stack trace for where our error was thrown. // Only available on V8. if (Error.captureStackTrace) { Error.captureStackTrace(_this, ErrorFactory.prototype.create); } return _this; } return FirebaseError; }(Error)); var ErrorFactory = /** @class */ (function () { function ErrorFactory(service, serviceName, errors) { this.service = service; this.serviceName = serviceName; this.errors = errors; } ErrorFactory.prototype.create = function (code) { var data = []; for (var _i = 1; _i < arguments.length; _i++) { data[_i - 1] = arguments[_i]; } var customData = data[0] || {}; var fullCode = this.service + "/" + code; var template = this.errors[code]; var message = template ? replaceTemplate(template, customData) : 'Error'; // Service Name: Error message (service/code). var fullMessage = this.serviceName + ": " + message + " (" + fullCode + ")."; var error = new FirebaseError(fullCode, fullMessage); // Keys with an underscore at the end of their name are not included in // error.data for some reason. // TODO: Replace with Object.entries when lib is updated to es2017. for (var _a = 0, _b = Object.keys(customData); _a < _b.length; _a++) { var key = _b[_a]; if (key.slice(-1) !== '_') { if (key in error) { console.warn("Overwriting FirebaseError base field \"" + key + "\" can cause unexpected behavior."); } error[key] = customData[key]; } } return error; }; return ErrorFactory; }()); function replaceTemplate(template, data) { return template.replace(PATTERN, function (_, key) { var value = data[key]; return value != null ? String(value) : "<" + key + "?>"; }); } var PATTERN = /\{\$([^}]+)}/g; /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Evaluates a JSON string into a javascript object. * * @param {string} str A string containing JSON. * @return {*} The javascript object representing the specified JSON. */ function jsonEval(str) { return JSON.parse(str); } /** * Returns JSON representing a javascript object. * @param {*} data Javascript object to be stringified. * @return {string} The JSON contents of the object. */ function stringify(data) { return JSON.stringify(data); } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Decodes a Firebase auth. token into constituent parts. * * Notes: * - May return with invalid / incomplete claims if there's no native base64 decoding support. * - Doesn't check if the token is actually valid. */ var decode = function (token) { var header = {}, claims = {}, data = {}, signature = ''; try { var parts = token.split('.'); header = jsonEval(base64Decode(parts[0]) || ''); claims = jsonEval(base64Decode(parts[1]) || ''); signature = parts[2]; data = claims['d'] || {}; delete claims['d']; } catch (e) { } return { header: header, claims: claims, data: data, signature: signature }; }; /** * Decodes a Firebase auth. token and checks the validity of its time-based claims. Will return true if the * token is within the time window authorized by the 'nbf' (not-before) and 'iat' (issued-at) claims. * * Notes: * - May return a false negative if there's no native base64 decoding support. * - Doesn't check if the token is actually valid. */ var isValidTimestamp = function (token) { var claims = decode(token).claims; var now = Math.floor(new Date().getTime() / 1000); var validSince = 0, validUntil = 0; if (typeof claims === 'object') { if (claims.hasOwnProperty('nbf')) { validSince = claims['nbf']; } else if (claims.hasOwnProperty('iat')) { validSince = claims['iat']; } if (claims.hasOwnProperty('exp')) { validUntil = claims['exp']; } else { // token will expire after 24h by default validUntil = validSince + 86400; } } return (!!now && !!validSince && !!validUntil && now >= validSince && now <= validUntil); }; /** * Decodes a Firebase auth. token and returns its issued at time if valid, null otherwise. * * Notes: * - May return null if there's no native base64 decoding support. * - Doesn't check if the token is actually valid. */ var issuedAtTime = function (token) { var claims = decode(token).claims; if (typeof claims === 'object' && claims.hasOwnProperty('iat')) { return claims['iat']; } return null; }; /** * Decodes a Firebase auth. token and checks the validity of its format. Expects a valid issued-at time. * * Notes: * - May return a false negative if there's no native base64 decoding support. * - Doesn't check if the token is actually valid. */ var isValidFormat = function (token) { var decoded = decode(token), claims = decoded.claims; return !!claims && typeof claims === 'object' && claims.hasOwnProperty('iat'); }; /** * Attempts to peer into an auth token and determine if it's an admin auth token by looking at the claims portion. * * Notes: * - May return a false negative if there's no native base64 decoding support. * - Doesn't check if the token is actually valid. */ var isAdmin = function (token) { var claims = decode(token).claims; return typeof claims === 'object' && claims['admin'] === true; }; /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ function contains(obj, key) { return Object.prototype.hasOwnProperty.call(obj, key); } function safeGet(obj, key) { if (Object.prototype.hasOwnProperty.call(obj, key)) { return obj[key]; } else { return undefined; } } function isEmpty(obj) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { return false; } } return true; } function map(obj, fn, contextObj) { var res = {}; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { res[key] = fn.call(contextObj, obj[key], key, obj); } } return res; } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Returns a querystring-formatted string (e.g. &arg=val&arg2=val2) from a * params object (e.g. {arg: 'val', arg2: 'val2'}) * Note: You must prepend it with ? when adding it to a URL. */ function querystring(querystringParams) { var params = []; var _loop_1 = function (key, value) { if (Array.isArray(value)) { value.forEach(function (arrayVal) { params.push(encodeURIComponent(key) + '=' + encodeURIComponent(arrayVal)); }); } else { params.push(encodeURIComponent(key) + '=' + encodeURIComponent(value)); } }; for (var _i = 0, _a = Object.entries(querystringParams); _i < _a.length; _i++) { var _b = _a[_i], key = _b[0], value = _b[1]; _loop_1(key, value); } return params.length ? '&' + params.join('&') : ''; } /** * Decodes a querystring (e.g. ?arg=val&arg2=val2) into a params object * (e.g. {arg: 'val', arg2: 'val2'}) */ function querystringDecode(querystring) { var obj = {}; var tokens = querystring.replace(/^\?/, '').split('&'); tokens.forEach(function (token) { if (token) { var key = token.split('='); obj[key[0]] = key[1]; } }); return obj; } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * @fileoverview SHA-1 cryptographic hash. * Variable names follow the notation in FIPS PUB 180-3: * http://csrc.nist.gov/publications/fips/fips180-3/fips180-3_final.pdf. * * Usage: * var sha1 = new sha1(); * sha1.update(bytes); * var hash = sha1.digest(); * * Performance: * Chrome 23: ~400 Mbit/s * Firefox 16: ~250 Mbit/s * */ /** * SHA-1 cryptographic hash constructor. * * The properties declared here are discussed in the above algorithm document. * @constructor * @final * @struct */ var Sha1 = /** @class */ (function () { function Sha1() { /** * Holds the previous values of accumulated variables a-e in the compress_ * function. * @private */ this.chain_ = []; /** * A buffer holding the partially computed hash result. * @private */ this.buf_ = []; /** * An array of 80 bytes, each a part of the message to be hashed. Referred to * as the message schedule in the docs. * @private */ this.W_ = []; /** * Contains data needed to pad messages less than 64 bytes. * @private */ this.pad_ = []; /** * @private {number} */ this.inbuf_ = 0; /** * @private {number} */ this.total_ = 0; this.blockSize = 512 / 8; this.pad_[0] = 128; for (var i = 1; i < this.blockSize; ++i) { this.pad_[i] = 0; } this.reset(); } Sha1.prototype.reset = function () { this.chain_[0] = 0x67452301; this.chain_[1] = 0xefcdab89; this.chain_[2] = 0x98badcfe; this.chain_[3] = 0x10325476; this.chain_[4] = 0xc3d2e1f0; this.inbuf_ = 0; this.total_ = 0; }; /** * Internal compress helper function. * @param buf Block to compress. * @param offset Offset of the block in the buffer. * @private */ Sha1.prototype.compress_ = function (buf, offset) { if (!offset) { offset = 0; } var W = this.W_; // get 16 big endian words if (typeof buf === 'string') { for (var i = 0; i < 16; i++) { // TODO(user): [bug 8140122] Recent versions of Safari for Mac OS and iOS // have a bug that turns the post-increment ++ operator into pre-increment // during JIT compilation. We have code that depends heavily on SHA-1 for // correctness and which is affected by this bug, so I've removed all uses // of post-increment ++ in which the result value is used. We can revert // this change once the Safari bug // (https://bugs.webkit.org/show_bug.cgi?id=109036) has been fixed and // most clients have been updated. W[i] = (buf.charCodeAt(offset) << 24) | (buf.charCodeAt(offset + 1) << 16) | (buf.charCodeAt(offset + 2) << 8) | buf.charCodeAt(offset + 3); offset += 4; } } else { for (var i = 0; i < 16; i++) { W[i] = (buf[offset] << 24) | (buf[offset + 1] << 16) | (buf[offset + 2] << 8) | buf[offset + 3]; offset += 4; } } // expand to 80 words for (var i = 16; i < 80; i++) { var t = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16]; W[i] = ((t << 1) | (t >>> 31)) & 0xffffffff; } var a = this.chain_[0]; var b = this.chain_[1]; var c = this.chain_[2]; var d = this.chain_[3]; var e = this.chain_[4]; var f, k; // TODO(user): Try to unroll this loop to speed up the computation. for (var i = 0; i < 80; i++) { if (i < 40) { if (i < 20) { f = d ^ (b & (c ^ d)); k = 0x5a827999; } else { f = b ^ c ^ d; k = 0x6ed9eba1; } } else { if (i < 60) { f = (b & c) | (d & (b | c)); k = 0x8f1bbcdc; } else { f = b ^ c ^ d; k = 0xca62c1d6; } } var t = (((a << 5) | (a >>> 27)) + f + e + k + W[i]) & 0xffffffff; e = d; d = c; c = ((b << 30) | (b >>> 2)) & 0xffffffff; b = a; a = t; } this.chain_[0] = (this.chain_[0] + a) & 0xffffffff; this.chain_[1] = (this.chain_[1] + b) & 0xffffffff; this.chain_[2] = (this.chain_[2] + c) & 0xffffffff; this.chain_[3] = (this.chain_[3] + d) & 0xffffffff; this.chain_[4] = (this.chain_[4] + e) & 0xffffffff; }; Sha1.prototype.update = function (bytes, length) { // TODO(johnlenz): tighten the function signature and remove this check if (bytes == null) { return; } if (length === undefined) { length = bytes.length; } var lengthMinusBlock = length - this.blockSize; var n = 0; // Using local instead of member variables gives ~5% speedup on Firefox 16. var buf = this.buf_; var inbuf = this.inbuf_; // The outer while loop should execute at most twice. while (n < length) { // When we have no data in the block to top up, we can directly process the // input buffer (assuming it contains sufficient data). This gives ~25% // speedup on Chrome 23 and ~15% speedup on Firefox 16, but requires that // the data is provided in large chunks (or in multiples of 64 bytes). if (inbuf === 0) { while (n <= lengthMinusBlock) { this.compress_(bytes, n); n += this.blockSize; } } if (typeof bytes === 'string') { while (n < length) { buf[inbuf] = bytes.charCodeAt(n); ++inbuf; ++n; if (inbuf === this.blockSize) { this.compress_(buf); inbuf = 0; // Jump to the outer loop so we use the full-block optimization. break; } } } else { while (n < length) { buf[inbuf] = bytes[n]; ++inbuf; ++n; if (inbuf === this.blockSize) { this.compress_(buf); inbuf = 0; // Jump to the outer loop so we use the full-block optimization. break; } } } } this.inbuf_ = inbuf; this.total_ += length; }; /** @override */ Sha1.prototype.digest = function () { var digest = []; var totalBits = this.total_ * 8; // Add pad 0x80 0x00*. if (this.inbuf_ < 56) { this.update(this.pad_, 56 - this.inbuf_); } else { this.update(this.pad_, this.blockSize - (this.inbuf_ - 56)); } // Add # bits. for (var i = this.blockSize - 1; i >= 56; i--) { this.buf_[i] = totalBits & 255; totalBits /= 256; // Don't use bit-shifting here! } this.compress_(this.buf_); var n = 0; for (var i = 0; i < 5; i++) { for (var j = 24; j >= 0; j -= 8) { digest[n] = (this.chain_[i] >> j) & 255; ++n; } } return digest; }; return Sha1; }()); /** * Helper to make a Subscribe function (just like Promise helps make a * Thenable). * * @param executor Function which can make calls to a single Observer * as a proxy. * @param onNoObservers Callback when count of Observers goes to zero. */ function createSubscribe(executor, onNoObservers) { var proxy = new ObserverProxy(executor, onNoObservers); return proxy.subscribe.bind(proxy); } /** * Implement fan-out for any number of Observers attached via a subscribe * function. */ var ObserverProxy = /** @class */ (function () { /** * @param executor Function which can make calls to a single Observer * as a proxy. * @param onNoObservers Callback when count of Observers goes to zero. */ function ObserverProxy(executor, onNoObservers) { var _this = this; this.observers = []; this.unsubscribes = []; this.observerCount = 0; // Micro-task scheduling by calling task.then(). this.task = Promise.resolve(); this.finalized = false; this.onNoObservers = onNoObservers; // Call the executor asynchronously so subscribers that are called // synchronously after the creation of the subscribe function // can still receive the very first value generated in the executor. this.task .then(function () { executor(_this); }) .catch(function (e) { _this.error(e); }); } ObserverProxy.prototype.next = function (value) { this.forEachObserver(function (observer) { observer.next(value); }); }; ObserverProxy.prototype.error = function (error) { this.forEachObserver(function (observer) { observer.error(error); }); this.close(error); }; ObserverProxy.prototype.complete = function () { this.forEachObserver(function (observer) { observer.complete(); }); this.close(); }; /** * Subscribe function that can be used to add an Observer to the fan-out list. * * - We require that no event is sent to a subscriber sychronously to their * call to subscribe(). */ ObserverProxy.prototype.subscribe = function (nextOrObserver, error, complete) { var _this = this; var observer; if (nextOrObserver === undefined && error === undefined && complete === undefined) { throw new Error('Missing Observer.'); } // Assemble an Observer object when passed as callback functions. if (implementsAnyMethods(nextOrObserver, [ 'next', 'error', 'complete' ])) { observer = nextOrObserver; } else { observer = { next: nextOrObserver, error: error, complete: complete }; } if (observer.next === undefined) { observer.next = noop; } if (observer.error === undefined) { observer.error = noop; } if (observer.complete === undefined) { observer.complete = noop; } var unsub = this.unsubscribeOne.bind(this, this.observers.length); // Attempt to subscribe to a terminated Observable - we // just respond to the Observer with the final error or complete // event. if (this.finalized) { // eslint-disable-next-line @typescript-eslint/no-floating-promises this.task.then(function () { try { if (_this.finalError) { observer.error(_this.finalError); } else { observer.complete(); } } catch (e) { // nothing } return; }); } this.observers.push(observer); return unsub; }; // Unsubscribe is synchronous - we guarantee that no events are sent to // any unsubscribed Observer. ObserverProxy.prototype.unsubscribeOne = function (i) { if (this.observers === undefined || this.observers[i] === undefined) { return; } delete this.observers[i]; this.observerCount -= 1; if (this.observerCount === 0 && this.onNoObservers !== undefined) { this.onNoObservers(this); } }; ObserverProxy.prototype.forEachObserver = function (fn) { if (this.finalized) { // Already closed by previous event....just eat the additional values. return; } // Since sendOne calls asynchronously - there is no chance that // this.observers will become undefined. for (var i = 0; i < this.observers.length; i++) { this.sendOne(i, fn); } }; // Call the Observer via one of it's callback function. We are careful to // confirm that the observe has not been unsubscribed since this asynchronous // function had been queued. ObserverProxy.prototype.sendOne = function (i, fn) { var _this = this; // Execute the callback asynchronously // eslint-disable-next-line @typescript-eslint/no-floating-promises this.task.then(function () { if (_this.observers !== undefined && _this.observers[i] !== undefined) { try { fn(_this.observers[i]); } catch (e) { // Ignore exceptions raised in Observers or missing methods of an // Observer. // Log error to console. b/31404806 if (typeof console !== 'undefined' && console.error) { console.error(e); } } } }); }; ObserverProxy.prototype.close = function (err) { var _this = this; if (this.finalized) { return; } this.finalized = true; if (err !== undefined) { this.finalError = err; } // Proxy is no longer needed - garbage collect references // eslint-disable-next-line @typescript-eslint/no-floating-promises this.task.then(function () { _this.observers = undefined; _this.onNoObservers = undefined; }); }; return ObserverProxy; }()); /** Turn synchronous function into one called asynchronously. */ // eslint-disable-next-line @typescript-eslint/ban-types function async(fn, onError) { return function () { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } Promise.resolve(true) .then(function () { fn.apply(void 0, args); }) .catch(function (error) { if (onError) { onError(error); } }); }; } /** * Return true if the object passed in implements any of the named methods. */ function implementsAnyMethods(obj, methods) { if (typeof obj !== 'object' || obj === null) { return false; } for (var _i = 0, methods_1 = methods; _i < methods_1.length; _i++) { var method = methods_1[_i]; if (method in obj && typeof obj[method] === 'function') { return true; } } return false; } function noop() { // do nothing } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Check to make sure the appropriate number of arguments are provided for a public function. * Throws an error if it fails. * * @param fnName The function name * @param minCount The minimum number of arguments to allow for the function call * @param maxCount The maximum number of argument to allow for the function call * @param argCount The actual number of arguments provided. */ var validateArgCount = function (fnName, minCount, maxCount, argCount) { var argError; if (argCount < minCount) { argError = 'at least ' + minCount; } else if (argCount > maxCount) { argError = maxCount === 0 ? 'none' : 'no more than ' + maxCount; } if (argError) { var error = fnName + ' failed: Was called with ' + argCount + (argCount === 1 ? ' argument.' : ' arguments.') + ' Expects ' + argError + '.'; throw new Error(error); } }; /** * Generates a string to prefix an error message about failed argument validation * * @param fnName The function name * @param argumentNumber The index of the argument * @param optional Whether or not the argument is optional * @return The prefix to add to the error thrown for validation. */ function errorPrefix(fnName, argumentNumber, optional) { var argName = ''; switch (argumentNumber) { case 1: argName = optional ? 'first' : 'First'; break; case 2: argName = optional ? 'second' : 'Second'; break; case 3: argName = optional ? 'third' : 'Third'; break; case 4: argName = optional ? 'fourth' : 'Fourth'; break; default: throw new Error('errorPrefix called with argumentNumber > 4. Need to update it?'); } var error = fnName + ' failed: '; error += argName + ' argument '; return error; } /** * @param fnName * @param argumentNumber * @param namespace * @param optional */ function validateNamespace(fnName, argumentNumber, namespace, optional) { if (optional && !namespace) { return; } if (typeof namespace !== 'string') { //TODO: I should do more validation here. We only allow certain chars in namespaces. throw new Error(errorPrefix(fnName, argumentNumber, optional) + 'must be a valid firebase namespace.'); } } function validateCallback(fnName, argumentNumber, // eslint-disable-next-line @typescript-eslint/ban-types callback, optional) { if (optional && !callback) { return; } if (typeof callback !== 'function') { throw new Error(errorPrefix(fnName, argumentNumber, optional) + 'must be a valid function.'); } } function validateContextObject(fnName, argumentNumber, context, optional) { if (optional && !context) { return; } if (typeof context !== 'object' || context === null) { throw new Error(errorPrefix(fnName, argumentNumber, optional) + 'must be a valid context object.'); } } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // Code originally came from goog.crypt.stringToUtf8ByteArray, but for some reason they // automatically replaced '\r\n' with '\n', and they didn't handle surrogate pairs, // so it's been modified. // Note that not all Unicode characters appear as single characters in JavaScript strings. // fromCharCode returns the UTF-16 encoding of a character - so some Unicode characters // use 2 characters in Javascript. All 4-byte UTF-8 characters begin with a first // character in the range 0xD800 - 0xDBFF (the first character of a so-called surrogate // pair). // See http://www.ecma-international.org/ecma-262/5.1/#sec-15.1.3 /** * @param {string} str * @return {Array} */ var stringToByteArray$1 = function (str) { var out = []; var p = 0; for (var i = 0; i < str.length; i++) { var c = str.charCodeAt(i); // Is this the lead surrogate in a surrogate pair? if (c >= 0xd800 && c <= 0xdbff) { var high = c - 0xd800; // the high 10 bits. i++; assert(i < str.length, 'Surrogate pair missing trail surrogate.'); var low = str.charCodeAt(i) - 0xdc00; // the low 10 bits. c = 0x10000 + (high << 10) + low; } if (c < 128) { out[p++] = c; } else if (c < 2048) { out[p++] = (c >> 6) | 192; out[p++] = (c & 63) | 128; } else if (c < 65536) { out[p++] = (c >> 12) | 224; out[p++] = ((c >> 6) & 63) | 128; out[p++] = (c & 63) | 128; } else { out[p++] = (c >> 18) | 240; out[p++] = ((c >> 12) & 63) | 128; out[p++] = ((c >> 6) & 63) | 128; out[p++] = (c & 63) | 128; } } return out; }; /** * Calculate length without actually converting; useful for doing cheaper validation. * @param {string} str * @return {number} */ var stringLength = function (str) { var p = 0; for (var i = 0; i < str.length; i++) { var c = str.charCodeAt(i); if (c < 128) { p++; } else if (c < 2048) { p += 2; } else if (c >= 0xd800 && c <= 0xdbff) { // Lead surrogate of a surrogate pair. The pair together will take 4 bytes to represent. p += 4; i++; // skip trail surrogate. } else { p += 3; } } return p; }; /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * The amount of milliseconds to exponentially increase. */ var DEFAULT_INTERVAL_MILLIS = 1000; /** * The factor to backoff by. * Should be a number greater than 1. */ var DEFAULT_BACKOFF_FACTOR = 2; /** * The maximum milliseconds to increase to. * * <p>Visible for testing */ var MAX_VALUE_MILLIS = 4 * 60 * 60 * 1000; // Four hours, like iOS and Android. /** * The percentage of backoff time to randomize by. * See * http://go/safe-client-behavior#step-1-determine-the-appropriate-retry-interval-to-handle-spike-traffic * for context. * * <p>Visible for testing */ var RANDOM_FACTOR = 0.5; /** * Based on the backoff method from * https://github.com/google/closure-library/blob/master/closure/goog/math/exponentialbackoff.js. * Extracted here so we don't need to pass metadata and a stateful ExponentialBackoff object around. */ function calculateBackoffMillis(backoffCount, intervalMillis, backoffFactor) { if (intervalMillis === void 0) { intervalMillis = DEFAULT_INTERVAL_MILLIS; } if (backoffFactor === void 0) { backoffFactor = DEFAULT_BACKOFF_FACTOR; } // Calculates an exponentially increasing value. // Deviation: calculates value from count and a constant interval, so we only need to save value // and count to restore state. var currBaseValue = intervalMillis * Math.pow(backoffFactor, backoffCount); // A random "fuzz" to avoid waves of retries. // Deviation: randomFactor is required. var randomWait = Math.round( // A fraction of the backoff value to add/subtract. // Deviation: changes multiplication order to improve readability. RANDOM_FACTOR * currBaseValue * // A random float (rounded to int by Math.round above) in the range [-1, 1]. Determines // if we add or subtract. (Math.random() - 0.5) * 2); // Limits backoff to max to avoid effectively permanent backoff. return Math.min(MAX_VALUE_MILLIS, currBaseValue + randomWait); } exports.CONSTANTS = CONSTANTS; exports.Deferred = Deferred; exports.ErrorFactory = ErrorFactory; exports.FirebaseError = FirebaseError; exports.MAX_VALUE_MILLIS = MAX_VALUE_MILLIS; exports.RANDOM_FACTOR = RANDOM_FACTOR; exports.Sha1 = Sha1; exports.areCookiesEnabled = areCookiesEnabled; exports.assert = assert; exports.assertionError = assertionError; exports.async = async; exports.base64 = base64; exports.base64Decode = base64Decode; exports.base64Encode = base64Encode; exports.calculateBackoffMillis = calculateBackoffMillis; exports.contains = contains; exports.createSubscribe = createSubscribe; exports.decode = decode; exports.deepCopy = deepCopy; exports.deepExtend = deepExtend; exports.errorPrefix = errorPrefix; exports.getUA = getUA; exports.isAdmin = isAdmin; exports.isBrowser = isBrowser; exports.isBrowserExtension = isBrowserExtension; exports.isElectron = isElectron; exports.isEmpty = isEmpty; exports.isIE = isIE; exports.isIndexedDBAvailable = isIndexedDBAvailable; exports.isMobileCordova = isMobileCordova; exports.isNode = isNode; exports.isNodeSdk = isNodeSdk; exports.isReactNative = isReactNative; exports.isSafari = isSafari; exports.isUWP = isUWP; exports.isValidFormat = isValidFormat; exports.isValidTimestamp = isValidTimestamp; exports.issuedAtTime = issuedAtTime; exports.jsonEval = jsonEval; exports.map = map; exports.querystring = querystring; exports.querystringDecode = querystringDecode; exports.safeGet = safeGet; exports.stringLength = stringLength; exports.stringToByteArray = stringToByteArray$1; exports.stringify = stringify; exports.validateArgCount = validateArgCount; exports.validateCallback = validateCallback; exports.validateContextObject = validateContextObject; exports.validateIndexedDBOpenable = validateIndexedDBOpenable; exports.validateNamespace = validateNamespace; //# sourceMappingURL=index.cjs.js.map /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__("./node_modules/webpack/buildin/global.js"))) /***/ }), /***/ "./node_modules/@firebase/app/node_modules/tslib/tslib.es6.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); /* harmony export (immutable) */ __webpack_exports__["__extends"] = __extends; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__assign", function() { return __assign; }); /* harmony export (immutable) */ __webpack_exports__["__rest"] = __rest; /* harmony export (immutable) */ __webpack_exports__["__decorate"] = __decorate; /* harmony export (immutable) */ __webpack_exports__["__param"] = __param; /* harmony export (immutable) */ __webpack_exports__["__metadata"] = __metadata; /* harmony export (immutable) */ __webpack_exports__["__awaiter"] = __awaiter; /* harmony export (immutable) */ __webpack_exports__["__generator"] = __generator; /* harmony export (immutable) */ __webpack_exports__["__createBinding"] = __createBinding; /* harmony export (immutable) */ __webpack_exports__["__exportStar"] = __exportStar; /* harmony export (immutable) */ __webpack_exports__["__values"] = __values; /* harmony export (immutable) */ __webpack_exports__["__read"] = __read; /* harmony export (immutable) */ __webpack_exports__["__spread"] = __spread; /* harmony export (immutable) */ __webpack_exports__["__spreadArrays"] = __spreadArrays; /* harmony export (immutable) */ __webpack_exports__["__await"] = __await; /* harmony export (immutable) */ __webpack_exports__["__asyncGenerator"] = __asyncGenerator; /* harmony export (immutable) */ __webpack_exports__["__asyncDelegator"] = __asyncDelegator; /* harmony export (immutable) */ __webpack_exports__["__asyncValues"] = __asyncValues; /* harmony export (immutable) */ __webpack_exports__["__makeTemplateObject"] = __makeTemplateObject; /* harmony export (immutable) */ __webpack_exports__["__importStar"] = __importStar; /* harmony export (immutable) */ __webpack_exports__["__importDefault"] = __importDefault; /* harmony export (immutable) */ __webpack_exports__["__classPrivateFieldGet"] = __classPrivateFieldGet; /* harmony export (immutable) */ __webpack_exports__["__classPrivateFieldSet"] = __classPrivateFieldSet; /*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */ /* global Reflect, Promise */ var extendStatics = function(d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; function __extends(d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); } var __assign = function() { __assign = Object.assign || function __assign(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; } return __assign.apply(this, arguments); } function __rest(s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; } return t; } function __decorate(decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; } function __param(paramIndex, decorator) { return function (target, key) { decorator(target, key, paramIndex); } } function __metadata(metadataKey, metadataValue) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); } function __awaiter(thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); } function __generator(thisArg, body) { var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; function verb(n) { return function (v) { return step([n, v]); }; } function step(op) { if (f) throw new TypeError("Generator is already executing."); while (_) try { if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; if (y = 0, t) op = [op[0] & 2, t.value]; switch (op[0]) { case 0: case 1: t = op; break; case 4: _.label++; return { value: op[1], done: false }; case 5: _.label++; y = op[1]; op = [0]; continue; case 7: op = _.ops.pop(); _.trys.pop(); continue; default: if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } if (t[2]) _.ops.pop(); _.trys.pop(); continue; } op = body.call(thisArg, _); } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } } function __createBinding(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; } function __exportStar(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) exports[p] = m[p]; } function __values(o) { var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; if (m) return m.call(o); if (o && typeof o.length === "number") return { next: function () { if (o && i >= o.length) o = void 0; return { value: o && o[i++], done: !o }; } }; throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); } function __read(o, n) { var m = typeof Symbol === "function" && o[Symbol.iterator]; if (!m) return o; var i = m.call(o), r, ar = [], e; try { while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); } catch (error) { e = { error: error }; } finally { try { if (r && !r.done && (m = i["return"])) m.call(i); } finally { if (e) throw e.error; } } return ar; } function __spread() { for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); return ar; } function __spreadArrays() { for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; for (var r = Array(s), k = 0, i = 0; i < il; i++) for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) r[k] = a[j]; return r; }; function __await(v) { return this instanceof __await ? (this.v = v, this) : new __await(v); } function __asyncGenerator(thisArg, _arguments, generator) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var g = generator.apply(thisArg, _arguments || []), i, q = []; return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } function fulfill(value) { resume("next", value); } function reject(value) { resume("throw", value); } function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } } function __asyncDelegator(o) { var i, p; return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } } function __asyncValues(o) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var m = o[Symbol.asyncIterator], i; return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } } function __makeTemplateObject(cooked, raw) { if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } return cooked; }; function __importStar(mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; result.default = mod; return result; } function __importDefault(mod) { return (mod && mod.__esModule) ? mod : { default: mod }; } function __classPrivateFieldGet(receiver, privateMap) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return privateMap.get(receiver); } function __classPrivateFieldSet(receiver, privateMap, value) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to set private field on non-instance"); } privateMap.set(receiver, value); return value; } /***/ }), /***/ "./node_modules/@firebase/auth/dist/auth.js": /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(global) {(function() {var firebase = __webpack_require__("./node_modules/@firebase/app/dist/index.cjs.js").default;/* Copyright The Closure Library Authors. SPDX-License-Identifier: Apache-2.0 */ var k,aa="function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){a!=Array.prototype&&a!=Object.prototype&&(a[b]=c.value)};function ba(a){a=["object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof global&&global,a];for(var b=0;b<a.length;++b){var c=a[b];if(c&&c.Math==Math)return c}return globalThis}var ca=ba(this); function da(a,b){if(b){var c=ca;a=a.split(".");for(var d=0;d<a.length-1;d++){var e=a[d];e in c||(c[e]={});c=c[e]}a=a[a.length-1];d=c[a];b=b(d);b!=d&&null!=b&&aa(c,a,{configurable:!0,writable:!0,value:b})}}function ea(a){var b=0;return function(){return b<a.length?{done:!1,value:a[b++]}:{done:!0}}}function fa(a){var b="undefined"!=typeof Symbol&&Symbol.iterator&&a[Symbol.iterator];return b?b.call(a):{next:ea(a)}} da("Promise",function(a){function b(g){this.b=0;this.c=void 0;this.a=[];var h=this.f();try{g(h.resolve,h.reject)}catch(m){h.reject(m)}}function c(){this.a=null}function d(g){return g instanceof b?g:new b(function(h){h(g)})}if(a)return a;c.prototype.b=function(g){if(null==this.a){this.a=[];var h=this;this.c(function(){h.g()})}this.a.push(g)};var e=ca.setTimeout;c.prototype.c=function(g){e(g,0)};c.prototype.g=function(){for(;this.a&&this.a.length;){var g=this.a;this.a=[];for(var h=0;h<g.length;++h){var m= g[h];g[h]=null;try{m()}catch(p){this.f(p)}}}this.a=null};c.prototype.f=function(g){this.c(function(){throw g;})};b.prototype.f=function(){function g(p){return function(v){m||(m=!0,p.call(h,v))}}var h=this,m=!1;return{resolve:g(this.v),reject:g(this.g)}};b.prototype.v=function(g){if(g===this)this.g(new TypeError("A Promise cannot resolve to itself"));else if(g instanceof b)this.o(g);else{a:switch(typeof g){case "object":var h=null!=g;break a;case "function":h=!0;break a;default:h=!1}h?this.m(g):this.h(g)}}; b.prototype.m=function(g){var h=void 0;try{h=g.then}catch(m){this.g(m);return}"function"==typeof h?this.u(h,g):this.h(g)};b.prototype.g=function(g){this.i(2,g)};b.prototype.h=function(g){this.i(1,g)};b.prototype.i=function(g,h){if(0!=this.b)throw Error("Cannot settle("+g+", "+h+"): Promise already settled in state"+this.b);this.b=g;this.c=h;this.l()};b.prototype.l=function(){if(null!=this.a){for(var g=0;g<this.a.length;++g)f.b(this.a[g]);this.a=null}};var f=new c;b.prototype.o=function(g){var h=this.f(); g.Pa(h.resolve,h.reject)};b.prototype.u=function(g,h){var m=this.f();try{g.call(h,m.resolve,m.reject)}catch(p){m.reject(p)}};b.prototype.then=function(g,h){function m(A,Q){return"function"==typeof A?function(xa){try{p(A(xa))}catch(yd){v(yd)}}:Q}var p,v,B=new b(function(A,Q){p=A;v=Q});this.Pa(m(g,p),m(h,v));return B};b.prototype.catch=function(g){return this.then(void 0,g)};b.prototype.Pa=function(g,h){function m(){switch(p.b){case 1:g(p.c);break;case 2:h(p.c);break;default:throw Error("Unexpected state: "+ p.b);}}var p=this;null==this.a?f.b(m):this.a.push(m)};b.resolve=d;b.reject=function(g){return new b(function(h,m){m(g)})};b.race=function(g){return new b(function(h,m){for(var p=fa(g),v=p.next();!v.done;v=p.next())d(v.value).Pa(h,m)})};b.all=function(g){var h=fa(g),m=h.next();return m.done?d([]):new b(function(p,v){function B(xa){return function(yd){A[xa]=yd;Q--;0==Q&&p(A)}}var A=[],Q=0;do A.push(void 0),Q++,d(m.value).Pa(B(A.length-1),v),m=h.next();while(!m.done)})};return b}); var ha=ha||{},l=this||self,ia=/^[\w+/_-]+[=]{0,2}$/,ja=null;function ka(){} function la(a){var b=typeof a;if("object"==b)if(a){if(a instanceof Array)return"array";if(a instanceof Object)return b;var c=Object.prototype.toString.call(a);if("[object Window]"==c)return"object";if("[object Array]"==c||"number"==typeof a.length&&"undefined"!=typeof a.splice&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("splice"))return"array";if("[object Function]"==c||"undefined"!=typeof a.call&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("call"))return"function"}else return"null"; else if("function"==b&&"undefined"==typeof a.call)return"object";return b}function ma(a){var b=la(a);return"array"==b||"object"==b&&"number"==typeof a.length}function na(a){return"function"==la(a)}function n(a){var b=typeof a;return"object"==b&&null!=a||"function"==b}function oa(a){return Object.prototype.hasOwnProperty.call(a,pa)&&a[pa]||(a[pa]=++qa)}var pa="closure_uid_"+(1E9*Math.random()>>>0),qa=0;function ra(a,b,c){return a.call.apply(a.bind,arguments)} function sa(a,b,c){if(!a)throw Error();if(2<arguments.length){var d=Array.prototype.slice.call(arguments,2);return function(){var e=Array.prototype.slice.call(arguments);Array.prototype.unshift.apply(e,d);return a.apply(b,e)}}return function(){return a.apply(b,arguments)}}function q(a,b,c){Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?q=ra:q=sa;return q.apply(null,arguments)} function ta(a,b){var c=Array.prototype.slice.call(arguments,1);return function(){var d=c.slice();d.push.apply(d,arguments);return a.apply(this,d)}}var ua=Date.now||function(){return+new Date};function r(a,b){function c(){}c.prototype=b.prototype;a.$a=b.prototype;a.prototype=new c;a.prototype.constructor=a};/* Copyright 2017 Google Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ function t(a,b,c){this.code=va+a;this.message=b||wa[a]||"";this.a=c||null}r(t,Error);t.prototype.w=function(){var a={code:this.code,message:this.message};this.a&&(a.serverResponse=this.a);return a};t.prototype.toJSON=function(){return this.w()};function ya(a){var b=a&&a.code;return b?new t(b.substring(va.length),a.message,a.serverResponse):null} var va="auth/",wa={"admin-restricted-operation":"This operation is restricted to administrators only.","argument-error":"","app-not-authorized":"This app, identified by the domain where it's hosted, is not authorized to use Firebase Authentication with the provided API key. Review your key configuration in the Google API console.","app-not-installed":"The requested mobile application corresponding to the identifier (Android package name or iOS bundle ID) provided is not installed on this device.", "captcha-check-failed":"The reCAPTCHA response token provided is either invalid, expired, already used or the domain associated with it does not match the list of whitelisted domains.","code-expired":"The SMS code has expired. Please re-send the verification code to try again.","cordova-not-ready":"Cordova framework is not ready.","cors-unsupported":"This browser is not supported.","credential-already-in-use":"This credential is already associated with a different user account.","custom-token-mismatch":"The custom token corresponds to a different audience.", "requires-recent-login":"This operation is sensitive and requires recent authentication. Log in again before retrying this request.","dynamic-link-not-activated":"Please activate Dynamic Links in the Firebase Console and agree to the terms and conditions.","email-change-needs-verification":"Multi-factor users must always have a verified email.","email-already-in-use":"The email address is already in use by another account.","expired-action-code":"The action code has expired. ","cancelled-popup-request":"This operation has been cancelled due to another conflicting popup being opened.", "internal-error":"An internal error has occurred.","invalid-app-credential":"The phone verification request contains an invalid application verifier. The reCAPTCHA token response is either invalid or expired.","invalid-app-id":"The mobile app identifier is not registed for the current project.","invalid-user-token":"This user's credential isn't valid for this project. This can happen if the user's token has been tampered with, or if the user isn't for the project associated with this API key.","invalid-auth-event":"An internal error has occurred.", "invalid-verification-code":"The SMS verification code used to create the phone auth credential is invalid. Please resend the verification code sms and be sure use the verification code provided by the user.","invalid-continue-uri":"The continue URL provided in the request is invalid.","invalid-cordova-configuration":"The following Cordova plugins must be installed to enable OAuth sign-in: cordova-plugin-buildinfo, cordova-universal-links-plugin, cordova-plugin-browsertab, cordova-plugin-inappbrowser and cordova-plugin-customurlscheme.", "invalid-custom-token":"The custom token format is incorrect. Please check the documentation.","invalid-dynamic-link-domain":"The provided dynamic link domain is not configured or authorized for the current project.","invalid-email":"The email address is badly formatted.","invalid-api-key":"Your API key is invalid, please check you have copied it correctly.","invalid-cert-hash":"The SHA-1 certificate hash provided is invalid.","invalid-credential":"The supplied auth credential is malformed or has expired.", "invalid-message-payload":"The email template corresponding to this action contains invalid characters in its message. Please fix by going to the Auth email templates section in the Firebase Console.","invalid-multi-factor-session":"The request does not contain a valid proof of first factor successful sign-in.","invalid-oauth-provider":"EmailAuthProvider is not supported for this operation. This operation only supports OAuth providers.","invalid-oauth-client-id":"The OAuth client ID provided is either invalid or does not match the specified API key.", "unauthorized-domain":"This domain is not authorized for OAuth operations for your Firebase project. Edit the list of authorized domains from the Firebase console.","invalid-action-code":"The action code is invalid. This can happen if the code is malformed, expired, or has already been used.","wrong-password":"The password is invalid or the user does not have a password.","invalid-persistence-type":"The specified persistence type is invalid. It can only be local, session or none.","invalid-phone-number":"The format of the phone number provided is incorrect. Please enter the phone number in a format that can be parsed into E.164 format. E.164 phone numbers are written in the format [+][country code][subscriber number including area code].", "invalid-provider-id":"The specified provider ID is invalid.","invalid-recipient-email":"The email corresponding to this action failed to send as the provided recipient email address is invalid.","invalid-sender":"The email template corresponding to this action contains an invalid sender email or name. Please fix by going to the Auth email templates section in the Firebase Console.","invalid-verification-id":"The verification ID used to create the phone auth credential is invalid.","invalid-tenant-id":"The Auth instance's tenant ID is invalid.", "multi-factor-info-not-found":"The user does not have a second factor matching the identifier provided.","multi-factor-auth-required":"Proof of ownership of a second factor is required to complete sign-in.","missing-android-pkg-name":"An Android Package Name must be provided if the Android App is required to be installed.","auth-domain-config-required":"Be sure to include authDomain when calling firebase.initializeApp(), by following the instructions in the Firebase console.","missing-app-credential":"The phone verification request is missing an application verifier assertion. A reCAPTCHA response token needs to be provided.", "missing-verification-code":"The phone auth credential was created with an empty SMS verification code.","missing-continue-uri":"A continue URL must be provided in the request.","missing-iframe-start":"An internal error has occurred.","missing-ios-bundle-id":"An iOS Bundle ID must be provided if an App Store ID is provided.","missing-multi-factor-info":"No second factor identifier is provided.","missing-multi-factor-session":"The request is missing proof of first factor successful sign-in.","missing-or-invalid-nonce":"The request does not contain a valid nonce. This can occur if the SHA-256 hash of the provided raw nonce does not match the hashed nonce in the ID token payload.", "missing-phone-number":"To send verification codes, provide a phone number for the recipient.","missing-verification-id":"The phone auth credential was created with an empty verification ID.","app-deleted":"This instance of FirebaseApp has been deleted.","account-exists-with-different-credential":"An account already exists with the same email address but different sign-in credentials. Sign in using a provider associated with this email address.","network-request-failed":"A network error (such as timeout, interrupted connection or unreachable host) has occurred.", "no-auth-event":"An internal error has occurred.","no-such-provider":"User was not linked to an account with the given provider.","null-user":"A null user object was provided as the argument for an operation which requires a non-null user object.","operation-not-allowed":"The given sign-in provider is disabled for this Firebase project. Enable it in the Firebase console, under the sign-in method tab of the Auth section.","operation-not-supported-in-this-environment":'This operation is not supported in the environment this application is running on. "location.protocol" must be http, https or chrome-extension and web storage must be enabled.', "popup-blocked":"Unable to establish a connection with the popup. It may have been blocked by the browser.","popup-closed-by-user":"The popup has been closed by the user before finalizing the operation.","provider-already-linked":"User can only be linked to one identity for the given provider.","quota-exceeded":"The project's quota for this operation has been exceeded.","redirect-cancelled-by-user":"The redirect operation has been cancelled by the user before finalizing.","redirect-operation-pending":"A redirect sign-in operation is already pending.", "rejected-credential":"The request contains malformed or mismatching credentials.","second-factor-already-in-use":"The second factor is already enrolled on this account.","maximum-second-factor-count-exceeded":"The maximum allowed number of second factors on a user has been exceeded.","tenant-id-mismatch":"The provided tenant ID does not match the Auth instance's tenant ID",timeout:"The operation has timed out.","user-token-expired":"The user's credential is no longer valid. The user must sign in again.", "too-many-requests":"We have blocked all requests from this device due to unusual activity. Try again later.","unauthorized-continue-uri":"The domain of the continue URL is not whitelisted. Please whitelist the domain in the Firebase console.","unsupported-first-factor":"Enrolling a second factor or signing in with a multi-factor account requires sign-in with a supported first factor.","unsupported-persistence-type":"The current environment does not support the specified persistence type.","unsupported-tenant-operation":"This operation is not supported in a multi-tenant context.", "unverified-email":"The operation requires a verified email.","user-cancelled":"The user did not grant your application the permissions it requested.","user-not-found":"There is no user record corresponding to this identifier. The user may have been deleted.","user-disabled":"The user account has been disabled by an administrator.","user-mismatch":"The supplied credentials do not correspond to the previously signed in user.","user-signed-out":"","weak-password":"The password must be 6 characters long or more.", "web-storage-unsupported":"This browser is not supported or 3rd party cookies and data may be disabled."};var za={kd:{Sa:"https://staging-identitytoolkit.sandbox.googleapis.com/identitytoolkit/v3/relyingparty/",Ya:"https://staging-securetoken.sandbox.googleapis.com/v1/token",Va:"https://staging-identitytoolkit.sandbox.googleapis.com/v2/",id:"b"},rd:{Sa:"https://www.googleapis.com/identitytoolkit/v3/relyingparty/",Ya:"https://securetoken.googleapis.com/v1/token",Va:"https://identitytoolkit.googleapis.com/v2/",id:"p"},td:{Sa:"https://staging-www.sandbox.googleapis.com/identitytoolkit/v3/relyingparty/", Ya:"https://staging-securetoken.sandbox.googleapis.com/v1/token",Va:"https://staging-identitytoolkit.sandbox.googleapis.com/v2/",id:"s"},ud:{Sa:"https://www-googleapis-test.sandbox.google.com/identitytoolkit/v3/relyingparty/",Ya:"https://test-securetoken.sandbox.googleapis.com/v1/token",Va:"https://test-identitytoolkit.sandbox.googleapis.com/v2/",id:"t"}}; function Aa(a){for(var b in za)if(za[b].id===a)return a=za[b],{firebaseEndpoint:a.Sa,secureTokenEndpoint:a.Ya,identityPlatformEndpoint:a.Va};return null}var Ba;Ba=Aa("__EID__")?"__EID__":void 0;function Ca(a){if(!a)return!1;try{return!!a.$goog_Thenable}catch(b){return!1}};function u(a){if(Error.captureStackTrace)Error.captureStackTrace(this,u);else{var b=Error().stack;b&&(this.stack=b)}a&&(this.message=String(a))}r(u,Error);u.prototype.name="CustomError";function Da(a,b){a=a.split("%s");for(var c="",d=a.length-1,e=0;e<d;e++)c+=a[e]+(e<b.length?b[e]:"%s");u.call(this,c+a[d])}r(Da,u);Da.prototype.name="AssertionError";function Ea(a,b){throw new Da("Failure"+(a?": "+a:""),Array.prototype.slice.call(arguments,1));};function Fa(a,b){this.c=a;this.f=b;this.b=0;this.a=null}Fa.prototype.get=function(){if(0<this.b){this.b--;var a=this.a;this.a=a.next;a.next=null}else a=this.c();return a};function Ga(a,b){a.f(b);100>a.b&&(a.b++,b.next=a.a,a.a=b)};function Ha(){this.b=this.a=null}var Ja=new Fa(function(){return new Ia},function(a){a.reset()});Ha.prototype.add=function(a,b){var c=Ja.get();c.set(a,b);this.b?this.b.next=c:this.a=c;this.b=c};function Ka(){var a=La,b=null;a.a&&(b=a.a,a.a=a.a.next,a.a||(a.b=null),b.next=null);return b}function Ia(){this.next=this.b=this.a=null}Ia.prototype.set=function(a,b){this.a=a;this.b=b;this.next=null};Ia.prototype.reset=function(){this.next=this.b=this.a=null};var Ma=Array.prototype.indexOf?function(a,b){return Array.prototype.indexOf.call(a,b,void 0)}:function(a,b){if("string"===typeof a)return"string"!==typeof b||1!=b.length?-1:a.indexOf(b,0);for(var c=0;c<a.length;c++)if(c in a&&a[c]===b)return c;return-1},w=Array.prototype.forEach?function(a,b,c){Array.prototype.forEach.call(a,b,c)}:function(a,b,c){for(var d=a.length,e="string"===typeof a?a.split(""):a,f=0;f<d;f++)f in e&&b.call(c,e[f],f,a)}; function Na(a,b){for(var c="string"===typeof a?a.split(""):a,d=a.length-1;0<=d;--d)d in c&&b.call(void 0,c[d],d,a)} var Oa=Array.prototype.filter?function(a,b){return Array.prototype.filter.call(a,b,void 0)}:function(a,b){for(var c=a.length,d=[],e=0,f="string"===typeof a?a.split(""):a,g=0;g<c;g++)if(g in f){var h=f[g];b.call(void 0,h,g,a)&&(d[e++]=h)}return d},Pa=Array.prototype.map?function(a,b){return Array.prototype.map.call(a,b,void 0)}:function(a,b){for(var c=a.length,d=Array(c),e="string"===typeof a?a.split(""):a,f=0;f<c;f++)f in e&&(d[f]=b.call(void 0,e[f],f,a));return d},Qa=Array.prototype.some?function(a, b){return Array.prototype.some.call(a,b,void 0)}:function(a,b){for(var c=a.length,d="string"===typeof a?a.split(""):a,e=0;e<c;e++)if(e in d&&b.call(void 0,d[e],e,a))return!0;return!1};function Ra(a){a:{var b=Sa;for(var c=a.length,d="string"===typeof a?a.split(""):a,e=0;e<c;e++)if(e in d&&b.call(void 0,d[e],e,a)){b=e;break a}b=-1}return 0>b?null:"string"===typeof a?a.charAt(b):a[b]}function Ta(a,b){return 0<=Ma(a,b)} function Ua(a,b){b=Ma(a,b);var c;(c=0<=b)&&Array.prototype.splice.call(a,b,1);return c}function Va(a,b){var c=0;Na(a,function(d,e){b.call(void 0,d,e,a)&&1==Array.prototype.splice.call(a,e,1).length&&c++})}function Wa(a){return Array.prototype.concat.apply([],arguments)}function Xa(a){var b=a.length;if(0<b){for(var c=Array(b),d=0;d<b;d++)c[d]=a[d];return c}return[]};var Ya=String.prototype.trim?function(a){return a.trim()}:function(a){return/^[\s\xa0]*([\s\S]*?)[\s\xa0]*$/.exec(a)[1]},Za=/&/g,$a=/</g,ab=/>/g,bb=/"/g,cb=/'/g,db=/\x00/g,eb=/[\x00&<>"']/;function x(a,b){return-1!=a.indexOf(b)}function fb(a,b){return a<b?-1:a>b?1:0};var gb;a:{var hb=l.navigator;if(hb){var ib=hb.userAgent;if(ib){gb=ib;break a}}gb=""}function y(a){return x(gb,a)};function jb(a,b){for(var c in a)b.call(void 0,a[c],c,a)}function kb(a){for(var b in a)return!1;return!0}function lb(a){var b={},c;for(c in a)b[c]=a[c];return b}var mb="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function z(a,b){for(var c,d,e=1;e<arguments.length;e++){d=arguments[e];for(c in d)a[c]=d[c];for(var f=0;f<mb.length;f++)c=mb[f],Object.prototype.hasOwnProperty.call(d,c)&&(a[c]=d[c])}};function nb(a,b){a:{try{var c=a&&a.ownerDocument,d=c&&(c.defaultView||c.parentWindow);d=d||l;if(d.Element&&d.Location){var e=d;break a}}catch(g){}e=null}if(e&&"undefined"!=typeof e[b]&&(!a||!(a instanceof e[b])&&(a instanceof e.Location||a instanceof e.Element))){if(n(a))try{var f=a.constructor.displayName||a.constructor.name||Object.prototype.toString.call(a)}catch(g){f="<object could not be stringified>"}else f=void 0===a?"undefined":null===a?"null":typeof a;Ea("Argument is not a %s (or a non-Element, non-Location mock); got: %s", b,f)}};function ob(a,b){this.a=a===pb&&b||"";this.b=qb}ob.prototype.sa=!0;ob.prototype.ra=function(){return this.a};ob.prototype.toString=function(){return"Const{"+this.a+"}"};function rb(a){if(a instanceof ob&&a.constructor===ob&&a.b===qb)return a.a;Ea("expected object of type Const, got '"+a+"'");return"type_error:Const"}var qb={},pb={},sb=new ob(pb,"");function tb(a,b){this.a=a===ub&&b||"";this.b=vb}tb.prototype.sa=!0;tb.prototype.ra=function(){return this.a.toString()};tb.prototype.toString=function(){return"TrustedResourceUrl{"+this.a+"}"};function wb(a){if(a instanceof tb&&a.constructor===tb&&a.b===vb)return a.a;Ea("expected object of type TrustedResourceUrl, got '"+a+"' of type "+la(a));return"type_error:TrustedResourceUrl"} function xb(a,b){var c=rb(a);if(!yb.test(c))throw Error("Invalid TrustedResourceUrl format: "+c);a=c.replace(zb,function(d,e){if(!Object.prototype.hasOwnProperty.call(b,e))throw Error('Found marker, "'+e+'", in format string, "'+c+'", but no valid label mapping found in args: '+JSON.stringify(b));d=b[e];return d instanceof ob?rb(d):encodeURIComponent(String(d))});return new tb(ub,a)} var zb=/%{(\w+)}/g,yb=/^((https:)?\/\/[0-9a-z.:[\]-]+\/|\/[^/\\]|[^:/\\%]+\/|[^:/\\%]*[?#]|about:blank#)/i,vb={},ub={};function Ab(a,b){this.a=a===Bb&&b||"";this.b=Cb}Ab.prototype.sa=!0;Ab.prototype.ra=function(){return this.a.toString()};Ab.prototype.toString=function(){return"SafeUrl{"+this.a+"}"};function Db(a){if(a instanceof Ab&&a.constructor===Ab&&a.b===Cb)return a.a;Ea("expected object of type SafeUrl, got '"+a+"' of type "+la(a));return"type_error:SafeUrl"}var Eb=/^(?:(?:https?|mailto|ftp):|[^:/?#]*(?:[/?#]|$))/i; function Fb(a){if(a instanceof Ab)return a;a="object"==typeof a&&a.sa?a.ra():String(a);Eb.test(a)||(a="about:invalid#zClosurez");return new Ab(Bb,a)}var Cb={},Bb={};function Gb(){this.a="";this.b=Hb}Gb.prototype.sa=!0;Gb.prototype.ra=function(){return this.a.toString()};Gb.prototype.toString=function(){return"SafeHtml{"+this.a+"}"};function Ib(a){if(a instanceof Gb&&a.constructor===Gb&&a.b===Hb)return a.a;Ea("expected object of type SafeHtml, got '"+a+"' of type "+la(a));return"type_error:SafeHtml"}var Hb={};function Jb(a){var b=new Gb;b.a=a;return b}Jb("<!DOCTYPE html>");var Kb=Jb("");Jb("<br>");function Lb(a){var b=new tb(ub,rb(sb));nb(a,"HTMLIFrameElement");a.src=wb(b).toString()}function Mb(a,b){nb(a,"HTMLScriptElement");a.src=wb(b);if(null===ja)b:{b=l.document;if((b=b.querySelector&&b.querySelector("script[nonce]"))&&(b=b.nonce||b.getAttribute("nonce"))&&ia.test(b)){ja=b;break b}ja=""}b=ja;b&&a.setAttribute("nonce",b)};function Nb(a,b){for(var c=a.split("%s"),d="",e=Array.prototype.slice.call(arguments,1);e.length&&1<c.length;)d+=c.shift()+e.shift();return d+c.join("%s")}function Ob(a){eb.test(a)&&(-1!=a.indexOf("&")&&(a=a.replace(Za,"&")),-1!=a.indexOf("<")&&(a=a.replace($a,"<")),-1!=a.indexOf(">")&&(a=a.replace(ab,">")),-1!=a.indexOf('"')&&(a=a.replace(bb,""")),-1!=a.indexOf("'")&&(a=a.replace(cb,"'")),-1!=a.indexOf("\x00")&&(a=a.replace(db,"�")));return a};function Pb(a){Pb[" "](a);return a}Pb[" "]=ka;function Qb(a,b){var c=Rb;return Object.prototype.hasOwnProperty.call(c,a)?c[a]:c[a]=b(a)};var Sb=y("Opera"),Tb=y("Trident")||y("MSIE"),Ub=y("Edge"),Vb=Ub||Tb,Wb=y("Gecko")&&!(x(gb.toLowerCase(),"webkit")&&!y("Edge"))&&!(y("Trident")||y("MSIE"))&&!y("Edge"),Xb=x(gb.toLowerCase(),"webkit")&&!y("Edge");function Yb(){var a=l.document;return a?a.documentMode:void 0}var Zb; a:{var $b="",ac=function(){var a=gb;if(Wb)return/rv:([^\);]+)(\)|;)/.exec(a);if(Ub)return/Edge\/([\d\.]+)/.exec(a);if(Tb)return/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(a);if(Xb)return/WebKit\/(\S+)/.exec(a);if(Sb)return/(?:Version)[ \/]?(\S+)/.exec(a)}();ac&&($b=ac?ac[1]:"");if(Tb){var bc=Yb();if(null!=bc&&bc>parseFloat($b)){Zb=String(bc);break a}}Zb=$b}var Rb={}; function cc(a){return Qb(a,function(){for(var b=0,c=Ya(String(Zb)).split("."),d=Ya(String(a)).split("."),e=Math.max(c.length,d.length),f=0;0==b&&f<e;f++){var g=c[f]||"",h=d[f]||"";do{g=/(\d*)(\D*)(.*)/.exec(g)||["","","",""];h=/(\d*)(\D*)(.*)/.exec(h)||["","","",""];if(0==g[0].length&&0==h[0].length)break;b=fb(0==g[1].length?0:parseInt(g[1],10),0==h[1].length?0:parseInt(h[1],10))||fb(0==g[2].length,0==h[2].length)||fb(g[2],h[2]);g=g[3];h=h[3]}while(0==b)}return 0<=b})}var dc; dc=l.document&&Tb?Yb():void 0;try{(new self.OffscreenCanvas(0,0)).getContext("2d")}catch(a){}var ec=!Tb||9<=Number(dc);function fc(a){var b=document;return"string"===typeof a?b.getElementById(a):a}function gc(a,b){jb(b,function(c,d){c&&"object"==typeof c&&c.sa&&(c=c.ra());"style"==d?a.style.cssText=c:"class"==d?a.className=c:"for"==d?a.htmlFor=c:hc.hasOwnProperty(d)?a.setAttribute(hc[d],c):0==d.lastIndexOf("aria-",0)||0==d.lastIndexOf("data-",0)?a.setAttribute(d,c):a[d]=c})} var hc={cellpadding:"cellPadding",cellspacing:"cellSpacing",colspan:"colSpan",frameborder:"frameBorder",height:"height",maxlength:"maxLength",nonce:"nonce",role:"role",rowspan:"rowSpan",type:"type",usemap:"useMap",valign:"vAlign",width:"width"}; function ic(a,b,c){var d=arguments,e=document,f=String(d[0]),g=d[1];if(!ec&&g&&(g.name||g.type)){f=["<",f];g.name&&f.push(' name="',Ob(g.name),'"');if(g.type){f.push(' type="',Ob(g.type),'"');var h={};z(h,g);delete h.type;g=h}f.push(">");f=f.join("")}f=jc(e,f);g&&("string"===typeof g?f.className=g:Array.isArray(g)?f.className=g.join(" "):gc(f,g));2<d.length&&kc(e,f,d);return f} function kc(a,b,c){function d(g){g&&b.appendChild("string"===typeof g?a.createTextNode(g):g)}for(var e=2;e<c.length;e++){var f=c[e];!ma(f)||n(f)&&0<f.nodeType?d(f):w(lc(f)?Xa(f):f,d)}}function jc(a,b){b=String(b);"application/xhtml+xml"===a.contentType&&(b=b.toLowerCase());return a.createElement(b)}function lc(a){if(a&&"number"==typeof a.length){if(n(a))return"function"==typeof a.item||"string"==typeof a.item;if(na(a))return"function"==typeof a.item}return!1};function mc(a){l.setTimeout(function(){throw a;},0)}var nc; function oc(){var a=l.MessageChannel;"undefined"===typeof a&&"undefined"!==typeof window&&window.postMessage&&window.addEventListener&&!y("Presto")&&(a=function(){var e=jc(document,"IFRAME");e.style.display="none";Lb(e);document.documentElement.appendChild(e);var f=e.contentWindow;e=f.document;e.open();e.write(Ib(Kb));e.close();var g="callImmediate"+Math.random(),h="file:"==f.location.protocol?"*":f.location.protocol+"//"+f.location.host;e=q(function(m){if(("*"==h||m.origin==h)&&m.data==g)this.port1.onmessage()}, this);f.addEventListener("message",e,!1);this.port1={};this.port2={postMessage:function(){f.postMessage(g,h)}}});if("undefined"!==typeof a&&!y("Trident")&&!y("MSIE")){var b=new a,c={},d=c;b.port1.onmessage=function(){if(void 0!==c.next){c=c.next;var e=c.Fb;c.Fb=null;e()}};return function(e){d.next={Fb:e};d=d.next;b.port2.postMessage(0)}}return function(e){l.setTimeout(e,0)}};function pc(a,b){qc||rc();sc||(qc(),sc=!0);La.add(a,b)}var qc;function rc(){if(l.Promise&&l.Promise.resolve){var a=l.Promise.resolve(void 0);qc=function(){a.then(tc)}}else qc=function(){var b=tc;!na(l.setImmediate)||l.Window&&l.Window.prototype&&!y("Edge")&&l.Window.prototype.setImmediate==l.setImmediate?(nc||(nc=oc()),nc(b)):l.setImmediate(b)}}var sc=!1,La=new Ha;function tc(){for(var a;a=Ka();){try{a.a.call(a.b)}catch(b){mc(b)}Ga(Ja,a)}sc=!1};function C(a,b){this.a=uc;this.i=void 0;this.f=this.b=this.c=null;this.g=this.h=!1;if(a!=ka)try{var c=this;a.call(b,function(d){vc(c,wc,d)},function(d){if(!(d instanceof xc))try{if(d instanceof Error)throw d;throw Error("Promise rejected.");}catch(e){}vc(c,yc,d)})}catch(d){vc(this,yc,d)}}var uc=0,wc=2,yc=3;function zc(){this.next=this.f=this.b=this.g=this.a=null;this.c=!1}zc.prototype.reset=function(){this.f=this.b=this.g=this.a=null;this.c=!1};var Ac=new Fa(function(){return new zc},function(a){a.reset()}); function Bc(a,b,c){var d=Ac.get();d.g=a;d.b=b;d.f=c;return d}function D(a){if(a instanceof C)return a;var b=new C(ka);vc(b,wc,a);return b}function E(a){return new C(function(b,c){c(a)})}function Cc(a,b,c){Dc(a,b,c,null)||pc(ta(b,a))}function Ec(a){return new C(function(b,c){var d=a.length,e=[];if(d)for(var f=function(p,v){d--;e[p]=v;0==d&&b(e)},g=function(p){c(p)},h=0,m;h<a.length;h++)m=a[h],Cc(m,ta(f,h),g);else b(e)})} function Fc(a){return new C(function(b){var c=a.length,d=[];if(c)for(var e=function(h,m,p){c--;d[h]=m?{Ob:!0,value:p}:{Ob:!1,reason:p};0==c&&b(d)},f=0,g;f<a.length;f++)g=a[f],Cc(g,ta(e,f,!0),ta(e,f,!1));else b(d)})}C.prototype.then=function(a,b,c){return Gc(this,na(a)?a:null,na(b)?b:null,c)};C.prototype.$goog_Thenable=!0;k=C.prototype;k.na=function(a,b){a=Bc(a,a,b);a.c=!0;Hc(this,a);return this};k.s=function(a,b){return Gc(this,null,a,b)}; k.cancel=function(a){if(this.a==uc){var b=new xc(a);pc(function(){Ic(this,b)},this)}};function Ic(a,b){if(a.a==uc)if(a.c){var c=a.c;if(c.b){for(var d=0,e=null,f=null,g=c.b;g&&(g.c||(d++,g.a==a&&(e=g),!(e&&1<d)));g=g.next)e||(f=g);e&&(c.a==uc&&1==d?Ic(c,b):(f?(d=f,d.next==c.f&&(c.f=d),d.next=d.next.next):Jc(c),Kc(c,e,yc,b)))}a.c=null}else vc(a,yc,b)}function Hc(a,b){a.b||a.a!=wc&&a.a!=yc||Lc(a);a.f?a.f.next=b:a.b=b;a.f=b} function Gc(a,b,c,d){var e=Bc(null,null,null);e.a=new C(function(f,g){e.g=b?function(h){try{var m=b.call(d,h);f(m)}catch(p){g(p)}}:f;e.b=c?function(h){try{var m=c.call(d,h);void 0===m&&h instanceof xc?g(h):f(m)}catch(p){g(p)}}:g});e.a.c=a;Hc(a,e);return e.a}k.Zc=function(a){this.a=uc;vc(this,wc,a)};k.$c=function(a){this.a=uc;vc(this,yc,a)}; function vc(a,b,c){a.a==uc&&(a===c&&(b=yc,c=new TypeError("Promise cannot resolve to itself")),a.a=1,Dc(c,a.Zc,a.$c,a)||(a.i=c,a.a=b,a.c=null,Lc(a),b!=yc||c instanceof xc||Mc(a,c)))}function Dc(a,b,c,d){if(a instanceof C)return Hc(a,Bc(b||ka,c||null,d)),!0;if(Ca(a))return a.then(b,c,d),!0;if(n(a))try{var e=a.then;if(na(e))return Nc(a,e,b,c,d),!0}catch(f){return c.call(d,f),!0}return!1} function Nc(a,b,c,d,e){function f(m){h||(h=!0,d.call(e,m))}function g(m){h||(h=!0,c.call(e,m))}var h=!1;try{b.call(a,g,f)}catch(m){f(m)}}function Lc(a){a.h||(a.h=!0,pc(a.fc,a))}function Jc(a){var b=null;a.b&&(b=a.b,a.b=b.next,b.next=null);a.b||(a.f=null);return b}k.fc=function(){for(var a;a=Jc(this);)Kc(this,a,this.a,this.i);this.h=!1}; function Kc(a,b,c,d){if(c==yc&&b.b&&!b.c)for(;a&&a.g;a=a.c)a.g=!1;if(b.a)b.a.c=null,Oc(b,c,d);else try{b.c?b.g.call(b.f):Oc(b,c,d)}catch(e){Pc.call(null,e)}Ga(Ac,b)}function Oc(a,b,c){b==wc?a.g.call(a.f,c):a.b&&a.b.call(a.f,c)}function Mc(a,b){a.g=!0;pc(function(){a.g&&Pc.call(null,b)})}var Pc=mc;function xc(a){u.call(this,a)}r(xc,u);xc.prototype.name="cancel";function Qc(){0!=Rc&&(Sc[oa(this)]=this);this.xa=this.xa;this.oa=this.oa}var Rc=0,Sc={};Qc.prototype.xa=!1;function Tc(a){if(!a.xa&&(a.xa=!0,a.Da(),0!=Rc)){var b=oa(a);if(0!=Rc&&a.oa&&0<a.oa.length)throw Error(a+" did not empty its onDisposeCallbacks queue. This probably means it overrode dispose() or disposeInternal() without calling the superclass' method.");delete Sc[b]}}Qc.prototype.Da=function(){if(this.oa)for(;this.oa.length;)this.oa.shift()()};var Uc=Object.freeze||function(a){return a};var Vc=!Tb||9<=Number(dc),Wc=Tb&&!cc("9"),Xc=function(){if(!l.addEventListener||!Object.defineProperty)return!1;var a=!1,b=Object.defineProperty({},"passive",{get:function(){a=!0}});try{l.addEventListener("test",ka,b),l.removeEventListener("test",ka,b)}catch(c){}return a}();function F(a,b){this.type=a;this.b=this.target=b;this.defaultPrevented=!1}F.prototype.preventDefault=function(){this.defaultPrevented=!0};function Yc(a,b){F.call(this,a?a.type:"");this.relatedTarget=this.b=this.target=null;this.button=this.screenY=this.screenX=this.clientY=this.clientX=0;this.key="";this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1;this.pointerId=0;this.pointerType="";this.a=null;if(a){var c=this.type=a.type,d=a.changedTouches&&a.changedTouches.length?a.changedTouches[0]:null;this.target=a.target||a.srcElement;this.b=b;if(b=a.relatedTarget){if(Wb){a:{try{Pb(b.nodeName);var e=!0;break a}catch(f){}e=!1}e||(b=null)}}else"mouseover"== c?b=a.fromElement:"mouseout"==c&&(b=a.toElement);this.relatedTarget=b;d?(this.clientX=void 0!==d.clientX?d.clientX:d.pageX,this.clientY=void 0!==d.clientY?d.clientY:d.pageY,this.screenX=d.screenX||0,this.screenY=d.screenY||0):(this.clientX=void 0!==a.clientX?a.clientX:a.pageX,this.clientY=void 0!==a.clientY?a.clientY:a.pageY,this.screenX=a.screenX||0,this.screenY=a.screenY||0);this.button=a.button;this.key=a.key||"";this.ctrlKey=a.ctrlKey;this.altKey=a.altKey;this.shiftKey=a.shiftKey;this.metaKey= a.metaKey;this.pointerId=a.pointerId||0;this.pointerType="string"===typeof a.pointerType?a.pointerType:Zc[a.pointerType]||"";this.a=a;a.defaultPrevented&&this.preventDefault()}}r(Yc,F);var Zc=Uc({2:"touch",3:"pen",4:"mouse"});Yc.prototype.preventDefault=function(){Yc.$a.preventDefault.call(this);var a=this.a;if(a.preventDefault)a.preventDefault();else if(a.returnValue=!1,Wc)try{if(a.ctrlKey||112<=a.keyCode&&123>=a.keyCode)a.keyCode=-1}catch(b){}};Yc.prototype.g=function(){return this.a};var $c="closure_listenable_"+(1E6*Math.random()|0),ad=0;function bd(a,b,c,d,e){this.listener=a;this.proxy=null;this.src=b;this.type=c;this.capture=!!d;this.Ua=e;this.key=++ad;this.va=this.Oa=!1}function cd(a){a.va=!0;a.listener=null;a.proxy=null;a.src=null;a.Ua=null};function dd(a){this.src=a;this.a={};this.b=0}dd.prototype.add=function(a,b,c,d,e){var f=a.toString();a=this.a[f];a||(a=this.a[f]=[],this.b++);var g=ed(a,b,d,e);-1<g?(b=a[g],c||(b.Oa=!1)):(b=new bd(b,this.src,f,!!d,e),b.Oa=c,a.push(b));return b};function fd(a,b){var c=b.type;c in a.a&&Ua(a.a[c],b)&&(cd(b),0==a.a[c].length&&(delete a.a[c],a.b--))}function ed(a,b,c,d){for(var e=0;e<a.length;++e){var f=a[e];if(!f.va&&f.listener==b&&f.capture==!!c&&f.Ua==d)return e}return-1};var gd="closure_lm_"+(1E6*Math.random()|0),hd={},id=0;function jd(a,b,c,d,e){if(d&&d.once)kd(a,b,c,d,e);else if(Array.isArray(b))for(var f=0;f<b.length;f++)jd(a,b[f],c,d,e);else c=ld(c),a&&a[$c]?md(a,b,c,n(d)?!!d.capture:!!d,e):nd(a,b,c,!1,d,e)} function nd(a,b,c,d,e,f){if(!b)throw Error("Invalid event type");var g=n(e)?!!e.capture:!!e,h=od(a);h||(a[gd]=h=new dd(a));c=h.add(b,c,d,g,f);if(!c.proxy){d=pd();c.proxy=d;d.src=a;d.listener=c;if(a.addEventListener)Xc||(e=g),void 0===e&&(e=!1),a.addEventListener(b.toString(),d,e);else if(a.attachEvent)a.attachEvent(qd(b.toString()),d);else if(a.addListener&&a.removeListener)a.addListener(d);else throw Error("addEventListener and attachEvent are unavailable.");id++}} function pd(){var a=rd,b=Vc?function(c){return a.call(b.src,b.listener,c)}:function(c){c=a.call(b.src,b.listener,c);if(!c)return c};return b}function kd(a,b,c,d,e){if(Array.isArray(b))for(var f=0;f<b.length;f++)kd(a,b[f],c,d,e);else c=ld(c),a&&a[$c]?sd(a,b,c,n(d)?!!d.capture:!!d,e):nd(a,b,c,!0,d,e)} function G(a,b,c,d,e){if(Array.isArray(b))for(var f=0;f<b.length;f++)G(a,b[f],c,d,e);else(d=n(d)?!!d.capture:!!d,c=ld(c),a&&a[$c])?(a=a.v,b=String(b).toString(),b in a.a&&(f=a.a[b],c=ed(f,c,d,e),-1<c&&(cd(f[c]),Array.prototype.splice.call(f,c,1),0==f.length&&(delete a.a[b],a.b--)))):a&&(a=od(a))&&(b=a.a[b.toString()],a=-1,b&&(a=ed(b,c,d,e)),(c=-1<a?b[a]:null)&&td(c))} function td(a){if("number"!==typeof a&&a&&!a.va){var b=a.src;if(b&&b[$c])fd(b.v,a);else{var c=a.type,d=a.proxy;b.removeEventListener?b.removeEventListener(c,d,a.capture):b.detachEvent?b.detachEvent(qd(c),d):b.addListener&&b.removeListener&&b.removeListener(d);id--;(c=od(b))?(fd(c,a),0==c.b&&(c.src=null,b[gd]=null)):cd(a)}}}function qd(a){return a in hd?hd[a]:hd[a]="on"+a} function ud(a,b,c,d){var e=!0;if(a=od(a))if(b=a.a[b.toString()])for(b=b.concat(),a=0;a<b.length;a++){var f=b[a];f&&f.capture==c&&!f.va&&(f=vd(f,d),e=e&&!1!==f)}return e}function vd(a,b){var c=a.listener,d=a.Ua||a.src;a.Oa&&td(a);return c.call(d,b)} function rd(a,b){if(a.va)return!0;if(!Vc){if(!b)a:{b=["window","event"];for(var c=l,d=0;d<b.length;d++)if(c=c[b[d]],null==c){b=null;break a}b=c}d=b;b=new Yc(d,this);c=!0;if(!(0>d.keyCode||void 0!=d.returnValue)){a:{var e=!1;if(0==d.keyCode)try{d.keyCode=-1;break a}catch(g){e=!0}if(e||void 0==d.returnValue)d.returnValue=!0}d=[];for(e=b.b;e;e=e.parentNode)d.push(e);a=a.type;for(e=d.length-1;0<=e;e--){b.b=d[e];var f=ud(d[e],a,!0,b);c=c&&f}for(e=0;e<d.length;e++)b.b=d[e],f=ud(d[e],a,!1,b),c=c&&f}return c}return vd(a, new Yc(b,this))}function od(a){a=a[gd];return a instanceof dd?a:null}var wd="__closure_events_fn_"+(1E9*Math.random()>>>0);function ld(a){if(na(a))return a;a[wd]||(a[wd]=function(b){return a.handleEvent(b)});return a[wd]};function H(){Qc.call(this);this.v=new dd(this);this.$b=this;this.fb=null}r(H,Qc);H.prototype[$c]=!0;H.prototype.addEventListener=function(a,b,c,d){jd(this,a,b,c,d)};H.prototype.removeEventListener=function(a,b,c,d){G(this,a,b,c,d)}; H.prototype.dispatchEvent=function(a){var b,c=this.fb;if(c)for(b=[];c;c=c.fb)b.push(c);c=this.$b;var d=a.type||a;if("string"===typeof a)a=new F(a,c);else if(a instanceof F)a.target=a.target||c;else{var e=a;a=new F(d,c);z(a,e)}e=!0;if(b)for(var f=b.length-1;0<=f;f--){var g=a.b=b[f];e=xd(g,d,!0,a)&&e}g=a.b=c;e=xd(g,d,!0,a)&&e;e=xd(g,d,!1,a)&&e;if(b)for(f=0;f<b.length;f++)g=a.b=b[f],e=xd(g,d,!1,a)&&e;return e}; H.prototype.Da=function(){H.$a.Da.call(this);if(this.v){var a=this.v,b=0,c;for(c in a.a){for(var d=a.a[c],e=0;e<d.length;e++)++b,cd(d[e]);delete a.a[c];a.b--}}this.fb=null};function md(a,b,c,d,e){a.v.add(String(b),c,!1,d,e)}function sd(a,b,c,d,e){a.v.add(String(b),c,!0,d,e)} function xd(a,b,c,d){b=a.v.a[String(b)];if(!b)return!0;b=b.concat();for(var e=!0,f=0;f<b.length;++f){var g=b[f];if(g&&!g.va&&g.capture==c){var h=g.listener,m=g.Ua||g.src;g.Oa&&fd(a.v,g);e=!1!==h.call(m,d)&&e}}return e&&!d.defaultPrevented};function zd(a,b,c){if(na(a))c&&(a=q(a,c));else if(a&&"function"==typeof a.handleEvent)a=q(a.handleEvent,a);else throw Error("Invalid listener argument");return 2147483647<Number(b)?-1:l.setTimeout(a,b||0)}function Ad(a){var b=null;return(new C(function(c,d){b=zd(function(){c(void 0)},a);-1==b&&d(Error("Failed to schedule timer."))})).s(function(c){l.clearTimeout(b);throw c;})};function Bd(a){if(a.V&&"function"==typeof a.V)return a.V();if("string"===typeof a)return a.split("");if(ma(a)){for(var b=[],c=a.length,d=0;d<c;d++)b.push(a[d]);return b}b=[];c=0;for(d in a)b[c++]=a[d];return b}function Cd(a){if(a.Y&&"function"==typeof a.Y)return a.Y();if(!a.V||"function"!=typeof a.V){if(ma(a)||"string"===typeof a){var b=[];a=a.length;for(var c=0;c<a;c++)b.push(c);return b}b=[];c=0;for(var d in a)b[c++]=d;return b}} function Dd(a,b){if(a.forEach&&"function"==typeof a.forEach)a.forEach(b,void 0);else if(ma(a)||"string"===typeof a)w(a,b,void 0);else for(var c=Cd(a),d=Bd(a),e=d.length,f=0;f<e;f++)b.call(void 0,d[f],c&&c[f],a)};function Ed(a,b){this.b={};this.a=[];this.c=0;var c=arguments.length;if(1<c){if(c%2)throw Error("Uneven number of arguments");for(var d=0;d<c;d+=2)this.set(arguments[d],arguments[d+1])}else if(a)if(a instanceof Ed)for(c=a.Y(),d=0;d<c.length;d++)this.set(c[d],a.get(c[d]));else for(d in a)this.set(d,a[d])}k=Ed.prototype;k.V=function(){Fd(this);for(var a=[],b=0;b<this.a.length;b++)a.push(this.b[this.a[b]]);return a};k.Y=function(){Fd(this);return this.a.concat()}; k.clear=function(){this.b={};this.c=this.a.length=0};function Fd(a){if(a.c!=a.a.length){for(var b=0,c=0;b<a.a.length;){var d=a.a[b];Gd(a.b,d)&&(a.a[c++]=d);b++}a.a.length=c}if(a.c!=a.a.length){var e={};for(c=b=0;b<a.a.length;)d=a.a[b],Gd(e,d)||(a.a[c++]=d,e[d]=1),b++;a.a.length=c}}k.get=function(a,b){return Gd(this.b,a)?this.b[a]:b};k.set=function(a,b){Gd(this.b,a)||(this.c++,this.a.push(a));this.b[a]=b}; k.forEach=function(a,b){for(var c=this.Y(),d=0;d<c.length;d++){var e=c[d],f=this.get(e);a.call(b,f,e,this)}};function Gd(a,b){return Object.prototype.hasOwnProperty.call(a,b)};var Hd=/^(?:([^:/?#.]+):)?(?:\/\/(?:([^/?#]*)@)?([^/#?]*?)(?::([0-9]+))?(?=[/\\#?]|$))?([^?#]+)?(?:\?([^#]*))?(?:#([\s\S]*))?$/;function Id(a,b){if(a){a=a.split("&");for(var c=0;c<a.length;c++){var d=a[c].indexOf("="),e=null;if(0<=d){var f=a[c].substring(0,d);e=a[c].substring(d+1)}else f=a[c];b(f,e?decodeURIComponent(e.replace(/\+/g," ")):"")}}};function Jd(a,b){this.a=this.l=this.f="";this.g=null;this.h=this.c="";this.i=!1;var c;a instanceof Jd?(this.i=void 0!==b?b:a.i,Kd(this,a.f),this.l=a.l,this.a=a.a,Ld(this,a.g),this.c=a.c,Md(this,Nd(a.b)),this.h=a.h):a&&(c=String(a).match(Hd))?(this.i=!!b,Kd(this,c[1]||"",!0),this.l=Od(c[2]||""),this.a=Od(c[3]||"",!0),Ld(this,c[4]),this.c=Od(c[5]||"",!0),Md(this,c[6]||"",!0),this.h=Od(c[7]||"")):(this.i=!!b,this.b=new Pd(null,this.i))} Jd.prototype.toString=function(){var a=[],b=this.f;b&&a.push(Qd(b,Rd,!0),":");var c=this.a;if(c||"file"==b)a.push("//"),(b=this.l)&&a.push(Qd(b,Rd,!0),"@"),a.push(encodeURIComponent(String(c)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),c=this.g,null!=c&&a.push(":",String(c));if(c=this.c)this.a&&"/"!=c.charAt(0)&&a.push("/"),a.push(Qd(c,"/"==c.charAt(0)?Sd:Td,!0));(c=this.b.toString())&&a.push("?",c);(c=this.h)&&a.push("#",Qd(c,Ud));return a.join("")}; Jd.prototype.resolve=function(a){var b=new Jd(this),c=!!a.f;c?Kd(b,a.f):c=!!a.l;c?b.l=a.l:c=!!a.a;c?b.a=a.a:c=null!=a.g;var d=a.c;if(c)Ld(b,a.g);else if(c=!!a.c){if("/"!=d.charAt(0))if(this.a&&!this.c)d="/"+d;else{var e=b.c.lastIndexOf("/");-1!=e&&(d=b.c.substr(0,e+1)+d)}e=d;if(".."==e||"."==e)d="";else if(x(e,"./")||x(e,"/.")){d=0==e.lastIndexOf("/",0);e=e.split("/");for(var f=[],g=0;g<e.length;){var h=e[g++];"."==h?d&&g==e.length&&f.push(""):".."==h?((1<f.length||1==f.length&&""!=f[0])&&f.pop(), d&&g==e.length&&f.push("")):(f.push(h),d=!0)}d=f.join("/")}else d=e}c?b.c=d:c=""!==a.b.toString();c?Md(b,Nd(a.b)):c=!!a.h;c&&(b.h=a.h);return b};function Kd(a,b,c){a.f=c?Od(b,!0):b;a.f&&(a.f=a.f.replace(/:$/,""))}function Ld(a,b){if(b){b=Number(b);if(isNaN(b)||0>b)throw Error("Bad port number "+b);a.g=b}else a.g=null}function Md(a,b,c){b instanceof Pd?(a.b=b,Vd(a.b,a.i)):(c||(b=Qd(b,Wd)),a.b=new Pd(b,a.i))}function I(a,b,c){a.b.set(b,c)}function Xd(a,b){return a.b.get(b)} function J(a){return a instanceof Jd?new Jd(a):new Jd(a,void 0)}function Yd(a,b,c,d){var e=new Jd(null,void 0);a&&Kd(e,a);b&&(e.a=b);c&&Ld(e,c);d&&(e.c=d);return e}function Od(a,b){return a?b?decodeURI(a.replace(/%25/g,"%2525")):decodeURIComponent(a):""}function Qd(a,b,c){return"string"===typeof a?(a=encodeURI(a).replace(b,Zd),c&&(a=a.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),a):null}function Zd(a){a=a.charCodeAt(0);return"%"+(a>>4&15).toString(16)+(a&15).toString(16)} var Rd=/[#\/\?@]/g,Td=/[#\?:]/g,Sd=/[#\?]/g,Wd=/[#\?@]/g,Ud=/#/g;function Pd(a,b){this.b=this.a=null;this.c=a||null;this.f=!!b}function $d(a){a.a||(a.a=new Ed,a.b=0,a.c&&Id(a.c,function(b,c){a.add(decodeURIComponent(b.replace(/\+/g," ")),c)}))}function ae(a){var b=Cd(a);if("undefined"==typeof b)throw Error("Keys are undefined");var c=new Pd(null,void 0);a=Bd(a);for(var d=0;d<b.length;d++){var e=b[d],f=a[d];Array.isArray(f)?be(c,e,f):c.add(e,f)}return c}k=Pd.prototype; k.add=function(a,b){$d(this);this.c=null;a=ce(this,a);var c=this.a.get(a);c||this.a.set(a,c=[]);c.push(b);this.b+=1;return this};function de(a,b){$d(a);b=ce(a,b);Gd(a.a.b,b)&&(a.c=null,a.b-=a.a.get(b).length,a=a.a,Gd(a.b,b)&&(delete a.b[b],a.c--,a.a.length>2*a.c&&Fd(a)))}k.clear=function(){this.a=this.c=null;this.b=0};function ee(a,b){$d(a);b=ce(a,b);return Gd(a.a.b,b)}k.forEach=function(a,b){$d(this);this.a.forEach(function(c,d){w(c,function(e){a.call(b,e,d,this)},this)},this)}; k.Y=function(){$d(this);for(var a=this.a.V(),b=this.a.Y(),c=[],d=0;d<b.length;d++)for(var e=a[d],f=0;f<e.length;f++)c.push(b[d]);return c};k.V=function(a){$d(this);var b=[];if("string"===typeof a)ee(this,a)&&(b=Wa(b,this.a.get(ce(this,a))));else{a=this.a.V();for(var c=0;c<a.length;c++)b=Wa(b,a[c])}return b};k.set=function(a,b){$d(this);this.c=null;a=ce(this,a);ee(this,a)&&(this.b-=this.a.get(a).length);this.a.set(a,[b]);this.b+=1;return this}; k.get=function(a,b){if(!a)return b;a=this.V(a);return 0<a.length?String(a[0]):b};function be(a,b,c){de(a,b);0<c.length&&(a.c=null,a.a.set(ce(a,b),Xa(c)),a.b+=c.length)}k.toString=function(){if(this.c)return this.c;if(!this.a)return"";for(var a=[],b=this.a.Y(),c=0;c<b.length;c++){var d=b[c],e=encodeURIComponent(String(d));d=this.V(d);for(var f=0;f<d.length;f++){var g=e;""!==d[f]&&(g+="="+encodeURIComponent(String(d[f])));a.push(g)}}return this.c=a.join("&")}; function Nd(a){var b=new Pd;b.c=a.c;a.a&&(b.a=new Ed(a.a),b.b=a.b);return b}function ce(a,b){b=String(b);a.f&&(b=b.toLowerCase());return b}function Vd(a,b){b&&!a.f&&($d(a),a.c=null,a.a.forEach(function(c,d){var e=d.toLowerCase();d!=e&&(de(this,d),be(this,e,c))},a));a.f=b};function fe(a){var b=[];ge(new he,a,b);return b.join("")}function he(){} function ge(a,b,c){if(null==b)c.push("null");else{if("object"==typeof b){if(Array.isArray(b)){var d=b;b=d.length;c.push("[");for(var e="",f=0;f<b;f++)c.push(e),ge(a,d[f],c),e=",";c.push("]");return}if(b instanceof String||b instanceof Number||b instanceof Boolean)b=b.valueOf();else{c.push("{");e="";for(d in b)Object.prototype.hasOwnProperty.call(b,d)&&(f=b[d],"function"!=typeof f&&(c.push(e),ie(d,c),c.push(":"),ge(a,f,c),e=","));c.push("}");return}}switch(typeof b){case "string":ie(b,c);break;case "number":c.push(isFinite(b)&& !isNaN(b)?String(b):"null");break;case "boolean":c.push(String(b));break;case "function":c.push("null");break;default:throw Error("Unknown type: "+typeof b);}}}var je={'"':'\\"',"\\":"\\\\","/":"\\/","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\x0B":"\\u000b"},ke=/\uffff/.test("\uffff")?/[\\"\x00-\x1f\x7f-\uffff]/g:/[\\"\x00-\x1f\x7f-\xff]/g; function ie(a,b){b.push('"',a.replace(ke,function(c){var d=je[c];d||(d="\\u"+(c.charCodeAt(0)|65536).toString(16).substr(1),je[c]=d);return d}),'"')};function le(){var a=K();return Tb&&!!dc&&11==dc||/Edge\/\d+/.test(a)}function me(){return l.window&&l.window.location.href||self&&self.location&&self.location.href||""}function ne(a,b){b=b||l.window;var c="about:blank";a&&(c=Db(Fb(a)));b.location.href=c}function oe(a,b){var c=[],d;for(d in a)d in b?typeof a[d]!=typeof b[d]?c.push(d):"object"==typeof a[d]&&null!=a[d]&&null!=b[d]?0<oe(a[d],b[d]).length&&c.push(d):a[d]!==b[d]&&c.push(d):c.push(d);for(d in b)d in a||c.push(d);return c} function pe(){var a=K();a=qe(a)!=re?null:(a=a.match(/\sChrome\/(\d+)/i))&&2==a.length?parseInt(a[1],10):null;return a&&30>a?!1:!Tb||!dc||9<dc}function se(a){a=(a||K()).toLowerCase();return a.match(/android/)||a.match(/webos/)||a.match(/iphone|ipad|ipod/)||a.match(/blackberry/)||a.match(/windows phone/)||a.match(/iemobile/)?!0:!1}function te(a){a=a||l.window;try{a.close()}catch(b){}} function ue(a,b,c){var d=Math.floor(1E9*Math.random()).toString();b=b||500;c=c||600;var e=(window.screen.availHeight-c)/2,f=(window.screen.availWidth-b)/2;b={width:b,height:c,top:0<e?e:0,left:0<f?f:0,location:!0,resizable:!0,statusbar:!0,toolbar:!1};c=K().toLowerCase();d&&(b.target=d,x(c,"crios/")&&(b.target="_blank"));qe(K())==ve&&(a=a||"http://localhost",b.scrollbars=!0);c=a||"";(a=b)||(a={});d=window;b=c instanceof Ab?c:Fb("undefined"!=typeof c.href?c.href:String(c));c=a.target||c.target;e=[]; for(g in a)switch(g){case "width":case "height":case "top":case "left":e.push(g+"="+a[g]);break;case "target":case "noopener":case "noreferrer":break;default:e.push(g+"="+(a[g]?1:0))}var g=e.join(",");if((y("iPhone")&&!y("iPod")&&!y("iPad")||y("iPad")||y("iPod"))&&d.navigator&&d.navigator.standalone&&c&&"_self"!=c)g=jc(document,"A"),nb(g,"HTMLAnchorElement"),b instanceof Ab||b instanceof Ab||(b="object"==typeof b&&b.sa?b.ra():String(b),Eb.test(b)||(b="about:invalid#zClosurez"),b=new Ab(Bb,b)),g.href= Db(b),g.setAttribute("target",c),a.noreferrer&&g.setAttribute("rel","noreferrer"),a=document.createEvent("MouseEvent"),a.initMouseEvent("click",!0,!0,d,1),g.dispatchEvent(a),g={};else if(a.noreferrer){if(g=d.open("",c,g),a=Db(b),g&&(Vb&&x(a,";")&&(a="'"+a.replace(/'/g,"%27")+"'"),g.opener=null,a=Jb('<meta name="referrer" content="no-referrer"><meta http-equiv="refresh" content="0; url='+Ob(a)+'">'),d=g.document))d.write(Ib(a)),d.close()}else(g=d.open(Db(b),c,g))&&a.noopener&&(g.opener=null);if(g)try{g.focus()}catch(h){}return g} function we(a){return new C(function(b){function c(){Ad(2E3).then(function(){if(!a||a.closed)b();else return c()})}return c()})}var xe=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,ye=/^[^@]+@[^@]+$/;function ze(){var a=null;return(new C(function(b){"complete"==l.document.readyState?b():(a=function(){b()},kd(window,"load",a))})).s(function(b){G(window,"load",a);throw b;})} function Ae(){return Be(void 0)?ze().then(function(){return new C(function(a,b){var c=l.document,d=setTimeout(function(){b(Error("Cordova framework is not ready."))},1E3);c.addEventListener("deviceready",function(){clearTimeout(d);a()},!1)})}):E(Error("Cordova must run in an Android or iOS file scheme."))}function Be(a){a=a||K();return!("file:"!==Ce()&&"ionic:"!==Ce()||!a.toLowerCase().match(/iphone|ipad|ipod|android/))}function De(){var a=l.window;try{return!(!a||a==a.top)}catch(b){return!1}} function Ee(){return"undefined"!==typeof l.WorkerGlobalScope&&"function"===typeof l.importScripts}function Fe(){return firebase.INTERNAL.hasOwnProperty("reactNative")?"ReactNative":firebase.INTERNAL.hasOwnProperty("node")?"Node":Ee()?"Worker":"Browser"}function Ge(){var a=Fe();return"ReactNative"===a||"Node"===a}function He(){for(var a=50,b=[];0<a;)b.push("1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".charAt(Math.floor(62*Math.random()))),a--;return b.join("")} var ve="Firefox",re="Chrome"; function qe(a){var b=a.toLowerCase();if(x(b,"opera/")||x(b,"opr/")||x(b,"opios/"))return"Opera";if(x(b,"iemobile"))return"IEMobile";if(x(b,"msie")||x(b,"trident/"))return"IE";if(x(b,"edge/"))return"Edge";if(x(b,"firefox/"))return ve;if(x(b,"silk/"))return"Silk";if(x(b,"blackberry"))return"Blackberry";if(x(b,"webos"))return"Webos";if(!x(b,"safari/")||x(b,"chrome/")||x(b,"crios/")||x(b,"android"))if(!x(b,"chrome/")&&!x(b,"crios/")||x(b,"edge/")){if(x(b,"android"))return"Android";if((a=a.match(/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/))&& 2==a.length)return a[1]}else return re;else return"Safari";return"Other"}var Ie={ld:"FirebaseCore-web",nd:"FirebaseUI-web"};function Je(a,b){b=b||[];var c=[],d={},e;for(e in Ie)d[Ie[e]]=!0;for(e=0;e<b.length;e++)"undefined"!==typeof d[b[e]]&&(delete d[b[e]],c.push(b[e]));c.sort();b=c;b.length||(b=["FirebaseCore-web"]);c=Fe();"Browser"===c?(d=K(),c=qe(d)):"Worker"===c&&(d=K(),c=qe(d)+"-"+c);return c+"/JsCore/"+a+"/"+b.join(",")}function K(){return l.navigator&&l.navigator.userAgent||""} function L(a,b){a=a.split(".");b=b||l;for(var c=0;c<a.length&&"object"==typeof b&&null!=b;c++)b=b[a[c]];c!=a.length&&(b=void 0);return b}function Ke(){try{var a=l.localStorage,b=Le();if(a)return a.setItem(b,"1"),a.removeItem(b),le()?!!l.indexedDB:!0}catch(c){return Ee()&&!!l.indexedDB}return!1}function Me(){return(Ne()||"chrome-extension:"===Ce()||Be())&&!Ge()&&Ke()&&!Ee()}function Ne(){return"http:"===Ce()||"https:"===Ce()}function Ce(){return l.location&&l.location.protocol||null} function Oe(a){a=a||K();return se(a)||qe(a)==ve?!1:!0}function Pe(a){return"undefined"===typeof a?null:fe(a)}function Qe(a){var b={},c;for(c in a)a.hasOwnProperty(c)&&null!==a[c]&&void 0!==a[c]&&(b[c]=a[c]);return b}function Re(a){if(null!==a)return JSON.parse(a)}function Le(a){return a?a:Math.floor(1E9*Math.random()).toString()}function Se(a){a=a||K();return"Safari"==qe(a)||a.toLowerCase().match(/iphone|ipad|ipod/)?!1:!0} function Te(){var a=l.___jsl;if(a&&a.H)for(var b in a.H)if(a.H[b].r=a.H[b].r||[],a.H[b].L=a.H[b].L||[],a.H[b].r=a.H[b].L.concat(),a.CP)for(var c=0;c<a.CP.length;c++)a.CP[c]=null}function Ue(a,b){if(a>b)throw Error("Short delay should be less than long delay!");this.a=a;this.c=b;a=K();b=Fe();this.b=se(a)||"ReactNative"===b} Ue.prototype.get=function(){var a=l.navigator;return(a&&"boolean"===typeof a.onLine&&(Ne()||"chrome-extension:"===Ce()||"undefined"!==typeof a.connection)?a.onLine:1)?this.b?this.c:this.a:Math.min(5E3,this.a)};function Ve(){var a=l.document;return a&&"undefined"!==typeof a.visibilityState?"visible"==a.visibilityState:!0} function We(){var a=l.document,b=null;return Ve()||!a?D():(new C(function(c){b=function(){Ve()&&(a.removeEventListener("visibilitychange",b,!1),c())};a.addEventListener("visibilitychange",b,!1)})).s(function(c){a.removeEventListener("visibilitychange",b,!1);throw c;})}function Xe(a){"undefined"!==typeof console&&"function"===typeof console.warn&&console.warn(a)} function Ye(a){try{var b=new Date(parseInt(a,10));if(!isNaN(b.getTime())&&!/[^0-9]/.test(a))return b.toUTCString()}catch(c){}return null}function Ze(){return!(!L("fireauth.oauthhelper",l)&&!L("fireauth.iframe",l))}function $e(){var a=l.navigator;return a&&a.serviceWorker&&a.serviceWorker.controller||null}function af(){var a=l.navigator;return a&&a.serviceWorker?D().then(function(){return a.serviceWorker.ready}).then(function(b){return b.active||null}).s(function(){return null}):D(null)};var bf={};function cf(a){bf[a]||(bf[a]=!0,Xe(a))};var df;try{var ef={};Object.defineProperty(ef,"abcd",{configurable:!0,enumerable:!0,value:1});Object.defineProperty(ef,"abcd",{configurable:!0,enumerable:!0,value:2});df=2==ef.abcd}catch(a){df=!1}function M(a,b,c){df?Object.defineProperty(a,b,{configurable:!0,enumerable:!0,value:c}):a[b]=c}function N(a,b){if(b)for(var c in b)b.hasOwnProperty(c)&&M(a,c,b[c])}function ff(a){var b={};N(b,a);return b}function gf(a){var b={},c;for(c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b} function hf(a,b){if(!b||!b.length)return!0;if(!a)return!1;for(var c=0;c<b.length;c++){var d=a[b[c]];if(void 0===d||null===d||""===d)return!1}return!0}function jf(a){var b=a;if("object"==typeof a&&null!=a){b="length"in a?[]:{};for(var c in a)M(b,c,jf(a[c]))}return b};/* Copyright 2019 Google Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ function kf(a){var b=a&&(a[lf]?"phone":null);if(b&&a&&a[mf]){M(this,"uid",a[mf]);M(this,"displayName",a[nf]||null);var c=null;a[of]&&(c=(new Date(a[of])).toUTCString());M(this,"enrollmentTime",c);M(this,"factorId",b)}else throw new t("internal-error","Internal assert: invalid MultiFactorInfo object");}kf.prototype.w=function(){return{uid:this.uid,displayName:this.displayName,factorId:this.factorId,enrollmentTime:this.enrollmentTime}};function pf(a){try{var b=new qf(a)}catch(c){b=null}return b} var nf="displayName",of="enrolledAt",mf="mfaEnrollmentId",lf="phoneInfo";function qf(a){kf.call(this,a);M(this,"phoneNumber",a[lf])}r(qf,kf);qf.prototype.w=function(){var a=qf.$a.w.call(this);a.phoneNumber=this.phoneNumber;return a};function rf(a){var b={},c=a[sf],d=a[tf],e=a[uf];a=pf(a[vf]);if(!e||e!=wf&&e!=xf&&!c||e==xf&&!d||e==yf&&!a)throw Error("Invalid checkActionCode response!");e==xf?(b[zf]=c||null,b[Af]=c||null,b[Bf]=d):(b[zf]=d||null,b[Af]=d||null,b[Bf]=c||null);b[Cf]=a||null;M(this,Df,e);M(this,Ef,jf(b))} var yf="REVERT_SECOND_FACTOR_ADDITION",wf="EMAIL_SIGNIN",xf="VERIFY_AND_CHANGE_EMAIL",sf="email",vf="mfaInfo",tf="newEmail",uf="requestType",Bf="email",zf="fromEmail",Cf="multiFactorInfo",Af="previousEmail",Ef="data",Df="operation";function Ff(a){a=J(a);var b=Xd(a,Gf)||null,c=Xd(a,Hf)||null,d=Xd(a,If)||null;d=d?Jf[d]||null:null;if(!b||!c||!d)throw new t("argument-error",Gf+", "+Hf+"and "+If+" are required in a valid action code URL.");N(this,{apiKey:b,operation:d,code:c,continueUrl:Xd(a,Kf)||null,languageCode:Xd(a,Lf)||null,tenantId:Xd(a,Mf)||null})} var Gf="apiKey",Hf="oobCode",Kf="continueUrl",Lf="languageCode",If="mode",Mf="tenantId",Jf={recoverEmail:"RECOVER_EMAIL",resetPassword:"PASSWORD_RESET",revertSecondFactorAddition:yf,signIn:wf,verifyAndChangeEmail:xf,verifyEmail:"VERIFY_EMAIL"};function Nf(a){try{return new Ff(a)}catch(b){return null}};function Of(a){var b=a[Pf];if("undefined"===typeof b)throw new t("missing-continue-uri");if("string"!==typeof b||"string"===typeof b&&!b.length)throw new t("invalid-continue-uri");this.h=b;this.b=this.a=null;this.g=!1;var c=a[Qf];if(c&&"object"===typeof c){b=c[Rf];var d=c[Sf];c=c[Tf];if("string"===typeof b&&b.length){this.a=b;if("undefined"!==typeof d&&"boolean"!==typeof d)throw new t("argument-error",Sf+" property must be a boolean when specified.");this.g=!!d;if("undefined"!==typeof c&&("string"!== typeof c||"string"===typeof c&&!c.length))throw new t("argument-error",Tf+" property must be a non empty string when specified.");this.b=c||null}else{if("undefined"!==typeof b)throw new t("argument-error",Rf+" property must be a non empty string when specified.");if("undefined"!==typeof d||"undefined"!==typeof c)throw new t("missing-android-pkg-name");}}else if("undefined"!==typeof c)throw new t("argument-error",Qf+" property must be a non null object when specified.");this.f=null;if((b=a[Uf])&&"object"=== typeof b)if(b=b[Vf],"string"===typeof b&&b.length)this.f=b;else{if("undefined"!==typeof b)throw new t("argument-error",Vf+" property must be a non empty string when specified.");}else if("undefined"!==typeof b)throw new t("argument-error",Uf+" property must be a non null object when specified.");b=a[Wf];if("undefined"!==typeof b&&"boolean"!==typeof b)throw new t("argument-error",Wf+" property must be a boolean when specified.");this.c=!!b;a=a[Xf];if("undefined"!==typeof a&&("string"!==typeof a||"string"=== typeof a&&!a.length))throw new t("argument-error",Xf+" property must be a non empty string when specified.");this.i=a||null}var Qf="android",Xf="dynamicLinkDomain",Wf="handleCodeInApp",Uf="iOS",Pf="url",Sf="installApp",Tf="minimumVersion",Rf="packageName",Vf="bundleId"; function Yf(a){var b={};b.continueUrl=a.h;b.canHandleCodeInApp=a.c;if(b.androidPackageName=a.a)b.androidMinimumVersion=a.b,b.androidInstallApp=a.g;b.iOSBundleId=a.f;b.dynamicLinkDomain=a.i;for(var c in b)null===b[c]&&delete b[c];return b};function Zf(a){return Pa(a,function(b){b=b.toString(16);return 1<b.length?b:"0"+b}).join("")};var $f=null;function ag(a){var b="";bg(a,function(c){b+=String.fromCharCode(c)});return b}function bg(a,b){function c(m){for(;d<a.length;){var p=a.charAt(d++),v=$f[p];if(null!=v)return v;if(!/^[\s\xa0]*$/.test(p))throw Error("Unknown base64 encoding at char: "+p);}return m}cg();for(var d=0;;){var e=c(-1),f=c(0),g=c(64),h=c(64);if(64===h&&-1===e)break;b(e<<2|f>>4);64!=g&&(b(f<<4&240|g>>2),64!=h&&b(g<<6&192|h))}} function cg(){if(!$f){$f={};for(var a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),b=["+/=","+/","-_=","-_.","-_"],c=0;5>c;c++)for(var d=a.concat(b[c].split("")),e=0;e<d.length;e++){var f=d[e];void 0===$f[f]&&($f[f]=e)}}};function dg(a){var b=eg(a);if(!(b&&b.sub&&b.iss&&b.aud&&b.exp))throw Error("Invalid JWT");this.g=a;this.c=b.exp;this.h=b.sub;ua();this.a=b.provider_id||b.firebase&&b.firebase.sign_in_provider||null;this.f=b.firebase&&b.firebase.tenant||null;this.b=!!b.is_anonymous||"anonymous"==this.a}dg.prototype.S=function(){return this.f};dg.prototype.i=function(){return this.b};dg.prototype.toString=function(){return this.g};function fg(a){try{return new dg(a)}catch(b){return null}} function eg(a){if(!a)return null;a=a.split(".");if(3!=a.length)return null;a=a[1];for(var b=(4-a.length%4)%4,c=0;c<b;c++)a+=".";try{return JSON.parse(ag(a))}catch(d){}return null};var gg="oauth_consumer_key oauth_nonce oauth_signature oauth_signature_method oauth_timestamp oauth_token oauth_version".split(" "),hg=["client_id","response_type","scope","redirect_uri","state"],ig={md:{Ja:"locale",ua:700,ta:600,fa:"facebook.com",Wa:hg},od:{Ja:null,ua:500,ta:750,fa:"github.com",Wa:hg},pd:{Ja:"hl",ua:515,ta:680,fa:"google.com",Wa:hg},vd:{Ja:"lang",ua:485,ta:705,fa:"twitter.com",Wa:gg},jd:{Ja:"locale",ua:640,ta:600,fa:"apple.com",Wa:[]}}; function jg(a){for(var b in ig)if(ig[b].fa==a)return ig[b];return null};function kg(a){var b={};b["facebook.com"]=lg;b["google.com"]=mg;b["github.com"]=ng;b["twitter.com"]=og;var c=a&&a[pg];try{if(c)return b[c]?new b[c](a):new qg(a);if("undefined"!==typeof a[rg])return new sg(a)}catch(d){}return null}var rg="idToken",pg="providerId"; function sg(a){var b=a[pg];if(!b&&a[rg]){var c=fg(a[rg]);c&&c.a&&(b=c.a)}if(!b)throw Error("Invalid additional user info!");if("anonymous"==b||"custom"==b)b=null;c=!1;"undefined"!==typeof a.isNewUser?c=!!a.isNewUser:"identitytoolkit#SignupNewUserResponse"===a.kind&&(c=!0);M(this,"providerId",b);M(this,"isNewUser",c)}function qg(a){sg.call(this,a);a=Re(a.rawUserInfo||"{}");M(this,"profile",jf(a||{}))}r(qg,sg); function lg(a){qg.call(this,a);if("facebook.com"!=this.providerId)throw Error("Invalid provider ID!");}r(lg,qg);function ng(a){qg.call(this,a);if("github.com"!=this.providerId)throw Error("Invalid provider ID!");M(this,"username",this.profile&&this.profile.login||null)}r(ng,qg);function mg(a){qg.call(this,a);if("google.com"!=this.providerId)throw Error("Invalid provider ID!");}r(mg,qg); function og(a){qg.call(this,a);if("twitter.com"!=this.providerId)throw Error("Invalid provider ID!");M(this,"username",a.screenName||null)}r(og,qg);function tg(a){var b=J(a),c=Xd(b,"link"),d=Xd(J(c),"link");b=Xd(b,"deep_link_id");return Xd(J(b),"link")||b||d||c||a};function ug(a,b){if(!a&&!b)throw new t("internal-error","Internal assert: no raw session string available");if(a&&b)throw new t("internal-error","Internal assert: unable to determine the session type");this.a=a||null;this.b=b||null;this.type=this.a?vg:wg}var vg="enroll",wg="signin";ug.prototype.Ha=function(){return this.a?D(this.a):D(this.b)};ug.prototype.w=function(){return this.type==vg?{multiFactorSession:{idToken:this.a}}:{multiFactorSession:{pendingCredential:this.b}}};function xg(){}xg.prototype.ja=function(){};xg.prototype.b=function(){};xg.prototype.c=function(){};xg.prototype.w=function(){};function yg(a,b){return a.then(function(c){if(c[zg]){var d=fg(c[zg]);if(!d||b!=d.h)throw new t("user-mismatch");return c}throw new t("user-mismatch");}).s(function(c){throw c&&c.code&&c.code==va+"user-not-found"?new t("user-mismatch"):c;})} function Ag(a,b){if(b)this.a=b;else throw new t("internal-error","failed to construct a credential");M(this,"providerId",a);M(this,"signInMethod",a)}Ag.prototype.ja=function(a){return Bg(a,Cg(this))};Ag.prototype.b=function(a,b){var c=Cg(this);c.idToken=b;return Dg(a,c)};Ag.prototype.c=function(a,b){return yg(Eg(a,Cg(this)),b)};function Cg(a){return{pendingToken:a.a,requestUri:"http://localhost"}}Ag.prototype.w=function(){return{providerId:this.providerId,signInMethod:this.signInMethod,pendingToken:this.a}}; function Fg(a){if(a&&a.providerId&&a.signInMethod&&0==a.providerId.indexOf("saml.")&&a.pendingToken)try{return new Ag(a.providerId,a.pendingToken)}catch(b){}return null} function Gg(a,b,c){this.a=null;if(b.idToken||b.accessToken)b.idToken&&M(this,"idToken",b.idToken),b.accessToken&&M(this,"accessToken",b.accessToken),b.nonce&&!b.pendingToken&&M(this,"nonce",b.nonce),b.pendingToken&&(this.a=b.pendingToken);else if(b.oauthToken&&b.oauthTokenSecret)M(this,"accessToken",b.oauthToken),M(this,"secret",b.oauthTokenSecret);else throw new t("internal-error","failed to construct a credential");M(this,"providerId",a);M(this,"signInMethod",c)} Gg.prototype.ja=function(a){return Bg(a,Hg(this))};Gg.prototype.b=function(a,b){var c=Hg(this);c.idToken=b;return Dg(a,c)};Gg.prototype.c=function(a,b){var c=Hg(this);return yg(Eg(a,c),b)}; function Hg(a){var b={};a.idToken&&(b.id_token=a.idToken);a.accessToken&&(b.access_token=a.accessToken);a.secret&&(b.oauth_token_secret=a.secret);b.providerId=a.providerId;a.nonce&&!a.a&&(b.nonce=a.nonce);b={postBody:ae(b).toString(),requestUri:"http://localhost"};a.a&&(delete b.postBody,b.pendingToken=a.a);return b} Gg.prototype.w=function(){var a={providerId:this.providerId,signInMethod:this.signInMethod};this.idToken&&(a.oauthIdToken=this.idToken);this.accessToken&&(a.oauthAccessToken=this.accessToken);this.secret&&(a.oauthTokenSecret=this.secret);this.nonce&&(a.nonce=this.nonce);this.a&&(a.pendingToken=this.a);return a}; function Ig(a){if(a&&a.providerId&&a.signInMethod){var b={idToken:a.oauthIdToken,accessToken:a.oauthTokenSecret?null:a.oauthAccessToken,oauthTokenSecret:a.oauthTokenSecret,oauthToken:a.oauthTokenSecret&&a.oauthAccessToken,nonce:a.nonce,pendingToken:a.pendingToken};try{return new Gg(a.providerId,b,a.signInMethod)}catch(c){}}return null}function Jg(a,b){this.Pc=b||[];N(this,{providerId:a,isOAuthProvider:!0});this.Hb={};this.ob=(jg(a)||{}).Ja||null;this.nb=null} Jg.prototype.Ka=function(a){this.Hb=lb(a);return this};function Kg(a){if("string"!==typeof a||0!=a.indexOf("saml."))throw new t("argument-error",'SAML provider IDs must be prefixed with "saml."');Jg.call(this,a,[])}r(Kg,Jg);function Lg(a){Jg.call(this,a,hg);this.a=[]}r(Lg,Jg);Lg.prototype.Ca=function(a){Ta(this.a,a)||this.a.push(a);return this};Lg.prototype.Pb=function(){return Xa(this.a)}; Lg.prototype.credential=function(a,b){var c;n(a)?c={idToken:a.idToken||null,accessToken:a.accessToken||null,nonce:a.rawNonce||null}:c={idToken:a||null,accessToken:b||null};if(!c.idToken&&!c.accessToken)throw new t("argument-error","credential failed: must provide the ID token and/or the access token.");return new Gg(this.providerId,c,this.providerId)};function Mg(){Lg.call(this,"facebook.com")}r(Mg,Lg);M(Mg,"PROVIDER_ID","facebook.com");M(Mg,"FACEBOOK_SIGN_IN_METHOD","facebook.com"); function Ng(a){if(!a)throw new t("argument-error","credential failed: expected 1 argument (the OAuth access token).");var b=a;n(a)&&(b=a.accessToken);return(new Mg).credential({accessToken:b})}function Og(){Lg.call(this,"github.com")}r(Og,Lg);M(Og,"PROVIDER_ID","github.com");M(Og,"GITHUB_SIGN_IN_METHOD","github.com"); function Pg(a){if(!a)throw new t("argument-error","credential failed: expected 1 argument (the OAuth access token).");var b=a;n(a)&&(b=a.accessToken);return(new Og).credential({accessToken:b})}function Qg(){Lg.call(this,"google.com");this.Ca("profile")}r(Qg,Lg);M(Qg,"PROVIDER_ID","google.com");M(Qg,"GOOGLE_SIGN_IN_METHOD","google.com");function Rg(a,b){var c=a;n(a)&&(c=a.idToken,b=a.accessToken);return(new Qg).credential({idToken:c,accessToken:b})}function Sg(){Jg.call(this,"twitter.com",gg)} r(Sg,Jg);M(Sg,"PROVIDER_ID","twitter.com");M(Sg,"TWITTER_SIGN_IN_METHOD","twitter.com");function Tg(a,b){var c=a;n(c)||(c={oauthToken:a,oauthTokenSecret:b});if(!c.oauthToken||!c.oauthTokenSecret)throw new t("argument-error","credential failed: expected 2 arguments (the OAuth access token and secret).");return new Gg("twitter.com",c,"twitter.com")} function Ug(a,b,c){this.a=a;this.f=b;M(this,"providerId","password");M(this,"signInMethod",c===Vg.EMAIL_LINK_SIGN_IN_METHOD?Vg.EMAIL_LINK_SIGN_IN_METHOD:Vg.EMAIL_PASSWORD_SIGN_IN_METHOD)}Ug.prototype.ja=function(a){return this.signInMethod==Vg.EMAIL_LINK_SIGN_IN_METHOD?O(a,Wg,{email:this.a,oobCode:this.f}):O(a,Xg,{email:this.a,password:this.f})}; Ug.prototype.b=function(a,b){return this.signInMethod==Vg.EMAIL_LINK_SIGN_IN_METHOD?O(a,Yg,{idToken:b,email:this.a,oobCode:this.f}):O(a,Zg,{idToken:b,email:this.a,password:this.f})};Ug.prototype.c=function(a,b){return yg(this.ja(a),b)};Ug.prototype.w=function(){return{email:this.a,password:this.f,signInMethod:this.signInMethod}};function $g(a){return a&&a.email&&a.password?new Ug(a.email,a.password,a.signInMethod):null}function Vg(){N(this,{providerId:"password",isOAuthProvider:!1})} function ah(a,b){b=bh(b);if(!b)throw new t("argument-error","Invalid email link!");return new Ug(a,b.code,Vg.EMAIL_LINK_SIGN_IN_METHOD)}function bh(a){a=tg(a);return(a=Nf(a))&&a.operation===wf?a:null}N(Vg,{PROVIDER_ID:"password"});N(Vg,{EMAIL_LINK_SIGN_IN_METHOD:"emailLink"});N(Vg,{EMAIL_PASSWORD_SIGN_IN_METHOD:"password"});function ch(a){if(!(a.cb&&a.bb||a.La&&a.ea))throw new t("internal-error");this.a=a;M(this,"providerId","phone");this.fa="phone";M(this,"signInMethod","phone")} ch.prototype.ja=function(a){return a.eb(dh(this))};ch.prototype.b=function(a,b){var c=dh(this);c.idToken=b;return O(a,eh,c)};ch.prototype.c=function(a,b){var c=dh(this);c.operation="REAUTH";a=O(a,fh,c);return yg(a,b)};ch.prototype.w=function(){var a={providerId:"phone"};this.a.cb&&(a.verificationId=this.a.cb);this.a.bb&&(a.verificationCode=this.a.bb);this.a.La&&(a.temporaryProof=this.a.La);this.a.ea&&(a.phoneNumber=this.a.ea);return a}; function gh(a){if(a&&"phone"===a.providerId&&(a.verificationId&&a.verificationCode||a.temporaryProof&&a.phoneNumber)){var b={};w(["verificationId","verificationCode","temporaryProof","phoneNumber"],function(c){a[c]&&(b[c]=a[c])});return new ch(b)}return null}function dh(a){return a.a.La&&a.a.ea?{temporaryProof:a.a.La,phoneNumber:a.a.ea}:{sessionInfo:a.a.cb,code:a.a.bb}} function hh(a){try{this.a=a||firebase.auth()}catch(b){throw new t("argument-error","Either an instance of firebase.auth.Auth must be passed as an argument to the firebase.auth.PhoneAuthProvider constructor, or the default firebase App instance must be initialized via firebase.initializeApp().");}N(this,{providerId:"phone",isOAuthProvider:!1})} hh.prototype.eb=function(a,b){var c=this.a.a;return D(b.verify()).then(function(d){if("string"!==typeof d)throw new t("argument-error","An implementation of firebase.auth.ApplicationVerifier.prototype.verify() must return a firebase.Promise that resolves with a string.");switch(b.type){case "recaptcha":var e=n(a)?a.session:null,f=n(a)?a.phoneNumber:a,g;e&&e.type==vg?g=e.Ha().then(function(h){return ih(c,{idToken:h,phoneEnrollmentInfo:{phoneNumber:f,recaptchaToken:d}})}):e&&e.type==wg?g=e.Ha().then(function(h){return jh(c, {mfaPendingCredential:h,mfaEnrollmentId:a.multiFactorHint&&a.multiFactorHint.uid||a.multiFactorUid,phoneSignInInfo:{recaptchaToken:d}})}):g=kh(c,{phoneNumber:f,recaptchaToken:d});return g.then(function(h){"function"===typeof b.reset&&b.reset();return h},function(h){"function"===typeof b.reset&&b.reset();throw h;});default:throw new t("argument-error",'Only firebase.auth.ApplicationVerifiers with type="recaptcha" are currently supported.');}})}; function lh(a,b){if(!a)throw new t("missing-verification-id");if(!b)throw new t("missing-verification-code");return new ch({cb:a,bb:b})}N(hh,{PROVIDER_ID:"phone"});N(hh,{PHONE_SIGN_IN_METHOD:"phone"}); function mh(a){if(a.temporaryProof&&a.phoneNumber)return new ch({La:a.temporaryProof,ea:a.phoneNumber});var b=a&&a.providerId;if(!b||"password"===b)return null;var c=a&&a.oauthAccessToken,d=a&&a.oauthTokenSecret,e=a&&a.nonce,f=a&&a.oauthIdToken,g=a&&a.pendingToken;try{switch(b){case "google.com":return Rg(f,c);case "facebook.com":return Ng(c);case "github.com":return Pg(c);case "twitter.com":return Tg(c,d);default:return c||d||f||g?g?0==b.indexOf("saml.")?new Ag(b,g):new Gg(b,{pendingToken:g,idToken:a.oauthIdToken, accessToken:a.oauthAccessToken},b):(new Lg(b)).credential({idToken:f,accessToken:c,rawNonce:e}):null}}catch(h){return null}}function nh(a){if(!a.isOAuthProvider)throw new t("invalid-oauth-provider");};function oh(a,b,c,d,e,f,g){this.c=a;this.b=b||null;this.g=c||null;this.f=d||null;this.i=f||null;this.h=g||null;this.a=e||null;if(this.g||this.a){if(this.g&&this.a)throw new t("invalid-auth-event");if(this.g&&!this.f)throw new t("invalid-auth-event");}else throw new t("invalid-auth-event");}oh.prototype.getUid=function(){var a=[];a.push(this.c);this.b&&a.push(this.b);this.f&&a.push(this.f);this.h&&a.push(this.h);return a.join("-")};oh.prototype.S=function(){return this.h}; oh.prototype.w=function(){return{type:this.c,eventId:this.b,urlResponse:this.g,sessionId:this.f,postBody:this.i,tenantId:this.h,error:this.a&&this.a.w()}};function ph(a){a=a||{};return a.type?new oh(a.type,a.eventId,a.urlResponse,a.sessionId,a.error&&ya(a.error),a.postBody,a.tenantId):null};/* Copyright 2018 Google Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ function qh(){this.b=null;this.a=[]}var rh=null;function sh(a){var b=rh;b.a.push(a);b.b||(b.b=function(c){for(var d=0;d<b.a.length;d++)b.a[d](c)},a=L("universalLinks.subscribe",l),"function"===typeof a&&a(null,b.b))};function th(a){var b="unauthorized-domain",c=void 0,d=J(a);a=d.a;d=d.f;"chrome-extension"==d?c=Nb("This chrome extension ID (chrome-extension://%s) is not authorized to run this operation. Add it to the OAuth redirect domains list in the Firebase console -> Auth section -> Sign in method tab.",a):"http"==d||"https"==d?c=Nb("This domain (%s) is not authorized to run this operation. Add it to the OAuth redirect domains list in the Firebase console -> Auth section -> Sign in method tab.",a):b="operation-not-supported-in-this-environment"; t.call(this,b,c)}r(th,t);function uh(a,b,c){t.call(this,a,c);a=b||{};a.Ib&&M(this,"email",a.Ib);a.ea&&M(this,"phoneNumber",a.ea);a.credential&&M(this,"credential",a.credential);a.Yb&&M(this,"tenantId",a.Yb)}r(uh,t);uh.prototype.w=function(){var a={code:this.code,message:this.message};this.email&&(a.email=this.email);this.phoneNumber&&(a.phoneNumber=this.phoneNumber);this.tenantId&&(a.tenantId=this.tenantId);var b=this.credential&&this.credential.w();b&&z(a,b);return a};uh.prototype.toJSON=function(){return this.w()}; function vh(a){if(a.code){var b=a.code||"";0==b.indexOf(va)&&(b=b.substring(va.length));var c={credential:mh(a),Yb:a.tenantId};if(a.email)c.Ib=a.email;else if(a.phoneNumber)c.ea=a.phoneNumber;else if(!c.credential)return new t(b,a.message||void 0);return new uh(b,c,a.message)}return null};function wh(){}wh.prototype.c=null;function xh(a){return a.c||(a.c=a.b())};var yh;function zh(){}r(zh,wh);zh.prototype.a=function(){var a=Ah(this);return a?new ActiveXObject(a):new XMLHttpRequest};zh.prototype.b=function(){var a={};Ah(this)&&(a[0]=!0,a[1]=!0);return a}; function Ah(a){if(!a.f&&"undefined"==typeof XMLHttpRequest&&"undefined"!=typeof ActiveXObject){for(var b=["MSXML2.XMLHTTP.6.0","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"],c=0;c<b.length;c++){var d=b[c];try{return new ActiveXObject(d),a.f=d}catch(e){}}throw Error("Could not create ActiveXObject. ActiveX might be disabled, or MSXML might not be installed");}return a.f}yh=new zh;function Bh(){}r(Bh,wh);Bh.prototype.a=function(){var a=new XMLHttpRequest;if("withCredentials"in a)return a;if("undefined"!=typeof XDomainRequest)return new Ch;throw Error("Unsupported browser");};Bh.prototype.b=function(){return{}}; function Ch(){this.a=new XDomainRequest;this.readyState=0;this.onreadystatechange=null;this.responseType=this.responseText=this.response="";this.status=-1;this.statusText="";this.a.onload=q(this.pc,this);this.a.onerror=q(this.Rb,this);this.a.onprogress=q(this.qc,this);this.a.ontimeout=q(this.uc,this)}k=Ch.prototype;k.open=function(a,b,c){if(null!=c&&!c)throw Error("Only async requests are supported.");this.a.open(a,b)}; k.send=function(a){if(a)if("string"==typeof a)this.a.send(a);else throw Error("Only string data is supported");else this.a.send()};k.abort=function(){this.a.abort()};k.setRequestHeader=function(){};k.getResponseHeader=function(a){return"content-type"==a.toLowerCase()?this.a.contentType:""};k.pc=function(){this.status=200;this.response=this.responseText=this.a.responseText;Dh(this,4)};k.Rb=function(){this.status=500;this.response=this.responseText="";Dh(this,4)};k.uc=function(){this.Rb()}; k.qc=function(){this.status=200;Dh(this,1)};function Dh(a,b){a.readyState=b;if(a.onreadystatechange)a.onreadystatechange()}k.getAllResponseHeaders=function(){return"content-type: "+this.a.contentType};function Eh(a,b,c){this.reset(a,b,c,void 0,void 0)}Eh.prototype.a=null;var Fh=0;Eh.prototype.reset=function(a,b,c,d,e){"number"==typeof e||Fh++;d||ua();delete this.a};function Gh(a){this.f=a;this.b=this.c=this.a=null}function Hh(a,b){this.name=a;this.value=b}Hh.prototype.toString=function(){return this.name};var Ih=new Hh("SEVERE",1E3),Jh=new Hh("WARNING",900),Kh=new Hh("CONFIG",700),Lh=new Hh("FINE",500);function Mh(a){if(a.c)return a.c;if(a.a)return Mh(a.a);Ea("Root logger has no level set.");return null}Gh.prototype.log=function(a,b,c){if(a.value>=Mh(this).value)for(na(b)&&(b=b()),a=new Eh(a,String(b),this.f),c&&(a.a=c),c=this;c;)c=c.a};var Nh={},Oh=null; function Ph(a){Oh||(Oh=new Gh(""),Nh[""]=Oh,Oh.c=Kh);var b;if(!(b=Nh[a])){b=new Gh(a);var c=a.lastIndexOf("."),d=a.substr(c+1);c=Ph(a.substr(0,c));c.b||(c.b={});c.b[d]=b;b.a=c;Nh[a]=b}return b};function Qh(a,b){a&&a.log(Lh,b,void 0)};function Rh(a){this.f=a}r(Rh,wh);Rh.prototype.a=function(){return new Sh(this.f)};Rh.prototype.b=function(a){return function(){return a}}({});function Sh(a){H.call(this);this.o=a;this.readyState=Th;this.status=0;this.responseType=this.responseText=this.response=this.statusText="";this.onreadystatechange=null;this.i=new Headers;this.b=null;this.m="GET";this.g="";this.a=!1;this.h=Ph("goog.net.FetchXmlHttp");this.l=this.c=this.f=null}r(Sh,H);var Th=0;k=Sh.prototype; k.open=function(a,b){if(this.readyState!=Th)throw this.abort(),Error("Error reopening a connection");this.m=a;this.g=b;this.readyState=1;Uh(this)};k.send=function(a){if(1!=this.readyState)throw this.abort(),Error("need to call open() first. ");this.a=!0;var b={headers:this.i,method:this.m,credentials:void 0,cache:void 0};a&&(b.body=a);this.o.fetch(new Request(this.g,b)).then(this.tc.bind(this),this.Ta.bind(this))}; k.abort=function(){this.response=this.responseText="";this.i=new Headers;this.status=0;this.c&&this.c.cancel("Request was aborted.");1<=this.readyState&&this.a&&4!=this.readyState&&(this.a=!1,Vh(this,!1));this.readyState=Th}; k.tc=function(a){this.a&&(this.f=a,this.b||(this.b=a.headers,this.readyState=2,Uh(this)),this.a&&(this.readyState=3,Uh(this),this.a&&("arraybuffer"===this.responseType?a.arrayBuffer().then(this.rc.bind(this),this.Ta.bind(this)):"undefined"!==typeof l.ReadableStream&&"body"in a?(this.response=this.responseText="",this.c=a.body.getReader(),this.l=new TextDecoder,Wh(this)):a.text().then(this.sc.bind(this),this.Ta.bind(this)))))};function Wh(a){a.c.read().then(a.oc.bind(a)).catch(a.Ta.bind(a))} k.oc=function(a){if(this.a){var b=this.l.decode(a.value?a.value:new Uint8Array(0),{stream:!a.done});b&&(this.response=this.responseText+=b);a.done?Vh(this,!0):Uh(this);3==this.readyState&&Wh(this)}};k.sc=function(a){this.a&&(this.response=this.responseText=a,Vh(this,!0))};k.rc=function(a){this.a&&(this.response=a,Vh(this,!0))};k.Ta=function(a){var b=this.h;b&&b.log(Jh,"Failed to fetch url "+this.g,a instanceof Error?a:Error(a));this.a&&Vh(this,!0)}; function Vh(a,b){b&&a.f&&(a.status=a.f.status,a.statusText=a.f.statusText);a.readyState=4;a.f=null;a.c=null;a.l=null;Uh(a)}k.setRequestHeader=function(a,b){this.i.append(a,b)};k.getResponseHeader=function(a){return this.b?this.b.get(a.toLowerCase())||"":((a=this.h)&&a.log(Jh,"Attempting to get response header but no headers have been received for url: "+this.g,void 0),"")}; k.getAllResponseHeaders=function(){if(!this.b){var a=this.h;a&&a.log(Jh,"Attempting to get all response headers but no headers have been received for url: "+this.g,void 0);return""}a=[];for(var b=this.b.entries(),c=b.next();!c.done;)c=c.value,a.push(c[0]+": "+c[1]),c=b.next();return a.join("\r\n")};function Uh(a){a.onreadystatechange&&a.onreadystatechange.call(a)};function Xh(a){H.call(this);this.headers=new Ed;this.O=a||null;this.c=!1;this.A=this.a=null;this.h=this.P=this.l="";this.f=this.N=this.i=this.G=!1;this.g=0;this.o=null;this.m=Yh;this.u=this.R=!1}r(Xh,H);var Yh="";Xh.prototype.b=Ph("goog.net.XhrIo");var Zh=/^https?$/i,$h=["POST","PUT"]; function ai(a,b,c,d,e){if(a.a)throw Error("[goog.net.XhrIo] Object is active with another request="+a.l+"; newUri="+b);c=c?c.toUpperCase():"GET";a.l=b;a.h="";a.P=c;a.G=!1;a.c=!0;a.a=a.O?a.O.a():yh.a();a.A=a.O?xh(a.O):xh(yh);a.a.onreadystatechange=q(a.Ub,a);try{Qh(a.b,bi(a,"Opening Xhr")),a.N=!0,a.a.open(c,String(b),!0),a.N=!1}catch(g){Qh(a.b,bi(a,"Error opening Xhr: "+g.message));ci(a,g);return}b=d||"";var f=new Ed(a.headers);e&&Dd(e,function(g,h){f.set(h,g)});e=Ra(f.Y());d=l.FormData&&b instanceof l.FormData;!Ta($h,c)||e||d||f.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");f.forEach(function(g,h){this.a.setRequestHeader(h,g)},a);a.m&&(a.a.responseType=a.m);"withCredentials"in a.a&&a.a.withCredentials!==a.R&&(a.a.withCredentials=a.R);try{di(a),0<a.g&&(a.u=ei(a.a),Qh(a.b,bi(a,"Will abort after "+a.g+"ms if incomplete, xhr2 "+a.u)),a.u?(a.a.timeout=a.g,a.a.ontimeout=q(a.Ma,a)):a.o=zd(a.Ma,a.g,a)),Qh(a.b,bi(a,"Sending request")),a.i=!0,a.a.send(b),a.i=!1}catch(g){Qh(a.b, bi(a,"Send error: "+g.message)),ci(a,g)}}function ei(a){return Tb&&cc(9)&&"number"===typeof a.timeout&&void 0!==a.ontimeout}function Sa(a){return"content-type"==a.toLowerCase()}k=Xh.prototype;k.Ma=function(){"undefined"!=typeof ha&&this.a&&(this.h="Timed out after "+this.g+"ms, aborting",Qh(this.b,bi(this,this.h)),this.dispatchEvent("timeout"),this.abort(8))};function ci(a,b){a.c=!1;a.a&&(a.f=!0,a.a.abort(),a.f=!1);a.h=b;fi(a);gi(a)} function fi(a){a.G||(a.G=!0,a.dispatchEvent("complete"),a.dispatchEvent("error"))}k.abort=function(){this.a&&this.c&&(Qh(this.b,bi(this,"Aborting")),this.c=!1,this.f=!0,this.a.abort(),this.f=!1,this.dispatchEvent("complete"),this.dispatchEvent("abort"),gi(this))};k.Da=function(){this.a&&(this.c&&(this.c=!1,this.f=!0,this.a.abort(),this.f=!1),gi(this,!0));Xh.$a.Da.call(this)};k.Ub=function(){this.xa||(this.N||this.i||this.f?hi(this):this.Ic())};k.Ic=function(){hi(this)}; function hi(a){if(a.c&&"undefined"!=typeof ha)if(a.A[1]&&4==ii(a)&&2==ji(a))Qh(a.b,bi(a,"Local request error detected and ignored"));else if(a.i&&4==ii(a))zd(a.Ub,0,a);else if(a.dispatchEvent("readystatechange"),4==ii(a)){Qh(a.b,bi(a,"Request complete"));a.c=!1;try{var b=ji(a);a:switch(b){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var c=!0;break a;default:c=!1}var d;if(!(d=c)){var e;if(e=0===b){var f=String(a.l).match(Hd)[1]||null;if(!f&&l.self&&l.self.location){var g=l.self.location.protocol; f=g.substr(0,g.length-1)}e=!Zh.test(f?f.toLowerCase():"")}d=e}if(d)a.dispatchEvent("complete"),a.dispatchEvent("success");else{try{var h=2<ii(a)?a.a.statusText:""}catch(m){Qh(a.b,"Can not get status: "+m.message),h=""}a.h=h+" ["+ji(a)+"]";fi(a)}}finally{gi(a)}}}function gi(a,b){if(a.a){di(a);var c=a.a,d=a.A[0]?ka:null;a.a=null;a.A=null;b||a.dispatchEvent("ready");try{c.onreadystatechange=d}catch(e){(a=a.b)&&a.log(Ih,"Problem encountered resetting onreadystatechange: "+e.message,void 0)}}} function di(a){a.a&&a.u&&(a.a.ontimeout=null);a.o&&(l.clearTimeout(a.o),a.o=null)}function ii(a){return a.a?a.a.readyState:0}function ji(a){try{return 2<ii(a)?a.a.status:-1}catch(b){return-1}}function ki(a){try{return a.a?a.a.responseText:""}catch(b){return Qh(a.b,"Can not get responseText: "+b.message),""}} k.getResponse=function(){try{if(!this.a)return null;if("response"in this.a)return this.a.response;switch(this.m){case Yh:case "text":return this.a.responseText;case "arraybuffer":if("mozResponseArrayBuffer"in this.a)return this.a.mozResponseArrayBuffer}var a=this.b;a&&a.log(Ih,"Response type "+this.m+" is not supported on this browser",void 0);return null}catch(b){return Qh(this.b,"Can not get response: "+b.message),null}};function bi(a,b){return b+" ["+a.P+" "+a.l+" "+ji(a)+"]"};/* Portions of this code are from MochiKit, received by The Closure Authors under the MIT license. All other code is Copyright 2005-2009 The Closure Authors. All Rights Reserved. */ function li(a){var b=mi;this.g=[];this.u=b;this.o=a||null;this.f=this.a=!1;this.c=void 0;this.m=this.A=this.i=!1;this.h=0;this.b=null;this.l=0}li.prototype.cancel=function(a){if(this.a)this.c instanceof li&&this.c.cancel();else{if(this.b){var b=this.b;delete this.b;a?b.cancel(a):(b.l--,0>=b.l&&b.cancel())}this.u?this.u.call(this.o,this):this.m=!0;this.a||(a=new ni(this),oi(this),pi(this,!1,a))}};li.prototype.v=function(a,b){this.i=!1;pi(this,a,b)};function pi(a,b,c){a.a=!0;a.c=c;a.f=!b;qi(a)} function oi(a){if(a.a){if(!a.m)throw new ri(a);a.m=!1}}function si(a,b){ti(a,null,b,void 0)}function ti(a,b,c,d){a.g.push([b,c,d]);a.a&&qi(a)}li.prototype.then=function(a,b,c){var d,e,f=new C(function(g,h){d=g;e=h});ti(this,d,function(g){g instanceof ni?f.cancel():e(g)});return f.then(a,b,c)};li.prototype.$goog_Thenable=!0;function ui(a){return Qa(a.g,function(b){return na(b[1])})} function qi(a){if(a.h&&a.a&&ui(a)){var b=a.h,c=vi[b];c&&(l.clearTimeout(c.a),delete vi[b]);a.h=0}a.b&&(a.b.l--,delete a.b);b=a.c;for(var d=c=!1;a.g.length&&!a.i;){var e=a.g.shift(),f=e[0],g=e[1];e=e[2];if(f=a.f?g:f)try{var h=f.call(e||a.o,b);void 0!==h&&(a.f=a.f&&(h==b||h instanceof Error),a.c=b=h);if(Ca(b)||"function"===typeof l.Promise&&b instanceof l.Promise)d=!0,a.i=!0}catch(m){b=m,a.f=!0,ui(a)||(c=!0)}}a.c=b;d&&(h=q(a.v,a,!0),d=q(a.v,a,!1),b instanceof li?(ti(b,h,d),b.A=!0):b.then(h,d));c&&(b= new wi(b),vi[b.a]=b,a.h=b.a)}function ri(){u.call(this)}r(ri,u);ri.prototype.message="Deferred has already fired";ri.prototype.name="AlreadyCalledError";function ni(){u.call(this)}r(ni,u);ni.prototype.message="Deferred was canceled";ni.prototype.name="CanceledError";function wi(a){this.a=l.setTimeout(q(this.c,this),0);this.b=a}wi.prototype.c=function(){delete vi[this.a];throw this.b;};var vi={};function xi(a){var b={},c=b.document||document,d=wb(a).toString(),e=jc(document,"SCRIPT"),f={Vb:e,Ma:void 0},g=new li(f),h=null,m=null!=b.timeout?b.timeout:5E3;0<m&&(h=window.setTimeout(function(){yi(e,!0);var p=new zi(Ai,"Timeout reached for loading script "+d);oi(g);pi(g,!1,p)},m),f.Ma=h);e.onload=e.onreadystatechange=function(){e.readyState&&"loaded"!=e.readyState&&"complete"!=e.readyState||(yi(e,b.wd||!1,h),oi(g),pi(g,!0,null))};e.onerror=function(){yi(e,!0,h);var p=new zi(Bi,"Error while loading script "+ d);oi(g);pi(g,!1,p)};f=b.attributes||{};z(f,{type:"text/javascript",charset:"UTF-8"});gc(e,f);Mb(e,a);Ci(c).appendChild(e);return g}function Ci(a){var b;return(b=(a||document).getElementsByTagName("HEAD"))&&0!=b.length?b[0]:a.documentElement}function mi(){if(this&&this.Vb){var a=this.Vb;a&&"SCRIPT"==a.tagName&&yi(a,!0,this.Ma)}} function yi(a,b,c){null!=c&&l.clearTimeout(c);a.onload=ka;a.onerror=ka;a.onreadystatechange=ka;b&&window.setTimeout(function(){a&&a.parentNode&&a.parentNode.removeChild(a)},0)}var Bi=0,Ai=1;function zi(a,b){var c="Jsloader error (code #"+a+")";b&&(c+=": "+b);u.call(this,c);this.code=a}r(zi,u);function Di(a){this.f=a}r(Di,wh);Di.prototype.a=function(){return new this.f};Di.prototype.b=function(){return{}}; function Ei(a,b,c){this.c=a;a=b||{};this.l=a.secureTokenEndpoint||"https://securetoken.googleapis.com/v1/token";this.v=a.secureTokenTimeout||Fi;this.g=lb(a.secureTokenHeaders||Gi);this.h=a.firebaseEndpoint||"https://www.googleapis.com/identitytoolkit/v3/relyingparty/";this.i=a.identityPlatformEndpoint||"https://identitytoolkit.googleapis.com/v2/";this.m=a.firebaseTimeout||Hi;this.a=lb(a.firebaseHeaders||Ii);c&&(this.a["X-Client-Version"]=c,this.g["X-Client-Version"]=c);c="Node"==Fe();c=l.XMLHttpRequest|| c&&firebase.INTERNAL.node&&firebase.INTERNAL.node.XMLHttpRequest;if(!c&&!Ee())throw new t("internal-error","The XMLHttpRequest compatibility library was not found.");this.f=void 0;Ee()?this.f=new Rh(self):Ge()?this.f=new Di(c):this.f=new Bh;this.b=null}var Ji,zg="idToken",Fi=new Ue(3E4,6E4),Gi={"Content-Type":"application/x-www-form-urlencoded"},Hi=new Ue(3E4,6E4),Ii={"Content-Type":"application/json"};function Ki(a,b){b?a.a["X-Firebase-Locale"]=b:delete a.a["X-Firebase-Locale"]} function Li(a,b){b&&(a.l=Mi("https://securetoken.googleapis.com/v1/token",b),a.h=Mi("https://www.googleapis.com/identitytoolkit/v3/relyingparty/",b),a.i=Mi("https://identitytoolkit.googleapis.com/v2/",b))}function Mi(a,b){a=J(a);b=J(b.url);a.c=a.a+a.c;Kd(a,b.f);a.a=b.a;Ld(a,b.g);return a.toString()}function Ni(a,b){b?(a.a["X-Client-Version"]=b,a.g["X-Client-Version"]=b):(delete a.a["X-Client-Version"],delete a.g["X-Client-Version"])}Ei.prototype.S=function(){return this.b}; function Oi(a,b,c,d,e,f,g){pe()||Ee()?a=q(a.u,a):(Ji||(Ji=new C(function(h,m){Pi(h,m)})),a=q(a.o,a));a(b,c,d,e,f,g)} Ei.prototype.u=function(a,b,c,d,e,f){if(Ee()&&("undefined"===typeof l.fetch||"undefined"===typeof l.Headers||"undefined"===typeof l.Request))throw new t("operation-not-supported-in-this-environment","fetch, Headers and Request native APIs or equivalent Polyfills must be available to support HTTP requests from a Worker environment.");var g=new Xh(this.f);if(f){g.g=Math.max(0,f);var h=setTimeout(function(){g.dispatchEvent("timeout")},f)}md(g,"complete",function(){h&&clearTimeout(h);var m=null;try{m= JSON.parse(ki(this))||null}catch(p){m=null}b&&b(m)});sd(g,"ready",function(){h&&clearTimeout(h);Tc(this)});sd(g,"timeout",function(){h&&clearTimeout(h);Tc(this);b&&b(null)});ai(g,a,c,d,e)};var Qi=new ob(pb,"https://apis.google.com/js/client.js?onload=%{onload}"),Ri="__fcb"+Math.floor(1E6*Math.random()).toString(); function Pi(a,b){if(((window.gapi||{}).client||{}).request)a();else{l[Ri]=function(){((window.gapi||{}).client||{}).request?a():b(Error("CORS_UNSUPPORTED"))};var c=xb(Qi,{onload:Ri});si(xi(c),function(){b(Error("CORS_UNSUPPORTED"))})}} Ei.prototype.o=function(a,b,c,d,e){var f=this;Ji.then(function(){window.gapi.client.setApiKey(f.c);var g=window.gapi.auth.getToken();window.gapi.auth.setToken(null);window.gapi.client.request({path:a,method:c,body:d,headers:e,authType:"none",callback:function(h){window.gapi.auth.setToken(g);b&&b(h)}})}).s(function(g){b&&b({error:{message:g&&g.message||"CORS_UNSUPPORTED"}})})}; function Si(a,b){return new C(function(c,d){"refresh_token"==b.grant_type&&b.refresh_token||"authorization_code"==b.grant_type&&b.code?Oi(a,a.l+"?key="+encodeURIComponent(a.c),function(e){e?e.error?d(Ti(e)):e.access_token&&e.refresh_token?c(e):d(new t("internal-error")):d(new t("network-request-failed"))},"POST",ae(b).toString(),a.g,a.v.get()):d(new t("internal-error"))})} function Ui(a,b,c,d,e,f,g){var h=J(b+c);I(h,"key",a.c);g&&I(h,"cb",ua().toString());var m="GET"==d;if(m)for(var p in e)e.hasOwnProperty(p)&&I(h,p,e[p]);return new C(function(v,B){Oi(a,h.toString(),function(A){A?A.error?B(Ti(A,f||{})):v(A):B(new t("network-request-failed"))},d,m?void 0:fe(Qe(e)),a.a,a.m.get())})}function Vi(a){a=a.email;if("string"!==typeof a||!ye.test(a))throw new t("invalid-email");}function Wi(a){"email"in a&&Vi(a)} function Xi(a,b){return O(a,Yi,{identifier:b,continueUri:Ne()?me():"http://localhost"}).then(function(c){return c.signinMethods||[]})}function Zi(a){return O(a,$i,{}).then(function(b){return b.authorizedDomains||[]})}function P(a){if(!a[zg]){if(a.mfaPendingCredential)throw new t("multi-factor-auth-required",null,lb(a));throw new t("internal-error");}} function aj(a){if(a.phoneNumber||a.temporaryProof){if(!a.phoneNumber||!a.temporaryProof)throw new t("internal-error");}else{if(!a.sessionInfo)throw new t("missing-verification-id");if(!a.code)throw new t("missing-verification-code");}}Ei.prototype.yb=function(){return O(this,bj,{})};Ei.prototype.Ab=function(a,b){return O(this,cj,{idToken:a,email:b})};Ei.prototype.Bb=function(a,b){return O(this,Zg,{idToken:a,password:b})};var dj={displayName:"DISPLAY_NAME",photoUrl:"PHOTO_URL"};k=Ei.prototype; k.Cb=function(a,b){var c={idToken:a},d=[];jb(dj,function(e,f){var g=b[f];null===g?d.push(e):f in b&&(c[f]=g)});d.length&&(c.deleteAttribute=d);return O(this,cj,c)};k.ub=function(a,b){a={requestType:"PASSWORD_RESET",email:a};z(a,b);return O(this,ej,a)};k.vb=function(a,b){a={requestType:"EMAIL_SIGNIN",email:a};z(a,b);return O(this,fj,a)};k.tb=function(a,b){a={requestType:"VERIFY_EMAIL",idToken:a};z(a,b);return O(this,gj,a)}; k.Db=function(a,b,c){a={requestType:"VERIFY_AND_CHANGE_EMAIL",idToken:a,newEmail:b};z(a,c);return O(this,hj,a)};function kh(a,b){return O(a,ij,b)}k.eb=function(a){return O(this,jj,a)};function ih(a,b){return O(a,kj,b).then(function(c){return c.phoneSessionInfo.sessionInfo})} function lj(a){if(!a.phoneVerificationInfo)throw new t("internal-error");if(!a.phoneVerificationInfo.sessionInfo)throw new t("missing-verification-id");if(!a.phoneVerificationInfo.code)throw new t("missing-verification-code");}function jh(a,b){return O(a,mj,b).then(function(c){return c.phoneResponseInfo.sessionInfo})}function nj(a,b,c){return O(a,oj,{idToken:b,deleteProvider:c})}function pj(a){if(!a.requestUri||!a.sessionId&&!a.postBody&&!a.pendingToken)throw new t("internal-error");} function qj(a,b){b.oauthIdToken&&b.providerId&&0==b.providerId.indexOf("oidc.")&&!b.pendingToken&&(a.sessionId?b.nonce=a.sessionId:a.postBody&&(a=new Pd(a.postBody),ee(a,"nonce")&&(b.nonce=a.get("nonce"))));return b} function rj(a){var b=null;a.needConfirmation?(a.code="account-exists-with-different-credential",b=vh(a)):"FEDERATED_USER_ID_ALREADY_LINKED"==a.errorMessage?(a.code="credential-already-in-use",b=vh(a)):"EMAIL_EXISTS"==a.errorMessage?(a.code="email-already-in-use",b=vh(a)):a.errorMessage&&(b=sj(a.errorMessage));if(b)throw b;P(a)}function Bg(a,b){b.returnIdpCredential=!0;return O(a,tj,b)}function Dg(a,b){b.returnIdpCredential=!0;return O(a,uj,b)} function Eg(a,b){b.returnIdpCredential=!0;b.autoCreate=!1;return O(a,vj,b)}function wj(a){if(!a.oobCode)throw new t("invalid-action-code");}k.mb=function(a,b){return O(this,xj,{oobCode:a,newPassword:b})};k.Qa=function(a){return O(this,yj,{oobCode:a})};k.ib=function(a){return O(this,zj,{oobCode:a})}; var zj={endpoint:"setAccountInfo",B:wj,Z:"email",C:!0},yj={endpoint:"resetPassword",B:wj,F:function(a){var b=a.requestType;if(!b||!a.email&&"EMAIL_SIGNIN"!=b&&"VERIFY_AND_CHANGE_EMAIL"!=b)throw new t("internal-error");},C:!0},Aj={endpoint:"signupNewUser",B:function(a){Vi(a);if(!a.password)throw new t("weak-password");},F:P,U:!0,C:!0},Yi={endpoint:"createAuthUri",C:!0},Bj={endpoint:"deleteAccount",M:["idToken"]},oj={endpoint:"setAccountInfo",M:["idToken","deleteProvider"],B:function(a){if("array"!= la(a.deleteProvider))throw new t("internal-error");}},Wg={endpoint:"emailLinkSignin",M:["email","oobCode"],B:Vi,F:P,U:!0,C:!0},Yg={endpoint:"emailLinkSignin",M:["idToken","email","oobCode"],B:Vi,F:P,U:!0},Cj={endpoint:"accounts/mfaEnrollment:finalize",M:["idToken","phoneVerificationInfo"],B:lj,F:P,C:!0,Na:!0},Dj={endpoint:"accounts/mfaSignIn:finalize",M:["mfaPendingCredential","phoneVerificationInfo"],B:lj,F:P,C:!0,Na:!0},Ej={endpoint:"getAccountInfo"},fj={endpoint:"getOobConfirmationCode",M:["requestType"], B:function(a){if("EMAIL_SIGNIN"!=a.requestType)throw new t("internal-error");Vi(a)},Z:"email",C:!0},gj={endpoint:"getOobConfirmationCode",M:["idToken","requestType"],B:function(a){if("VERIFY_EMAIL"!=a.requestType)throw new t("internal-error");},Z:"email",C:!0},hj={endpoint:"getOobConfirmationCode",M:["idToken","newEmail","requestType"],B:function(a){if("VERIFY_AND_CHANGE_EMAIL"!=a.requestType)throw new t("internal-error");},Z:"email",C:!0},ej={endpoint:"getOobConfirmationCode",M:["requestType"],B:function(a){if("PASSWORD_RESET"!= a.requestType)throw new t("internal-error");Vi(a)},Z:"email",C:!0},$i={kb:!0,endpoint:"getProjectConfig",Tb:"GET"},Fj={kb:!0,endpoint:"getRecaptchaParam",Tb:"GET",F:function(a){if(!a.recaptchaSiteKey)throw new t("internal-error");}},xj={endpoint:"resetPassword",B:wj,Z:"email",C:!0},ij={endpoint:"sendVerificationCode",M:["phoneNumber","recaptchaToken"],Z:"sessionInfo",C:!0},cj={endpoint:"setAccountInfo",M:["idToken"],B:Wi,U:!0},Zg={endpoint:"setAccountInfo",M:["idToken"],B:function(a){Wi(a);if(!a.password)throw new t("weak-password"); },F:P,U:!0},bj={endpoint:"signupNewUser",F:P,U:!0,C:!0},kj={endpoint:"accounts/mfaEnrollment:start",M:["idToken","phoneEnrollmentInfo"],B:function(a){if(!a.phoneEnrollmentInfo)throw new t("internal-error");if(!a.phoneEnrollmentInfo.phoneNumber)throw new t("missing-phone-number");if(!a.phoneEnrollmentInfo.recaptchaToken)throw new t("missing-app-credential");},F:function(a){if(!a.phoneSessionInfo||!a.phoneSessionInfo.sessionInfo)throw new t("internal-error");},C:!0,Na:!0},mj={endpoint:"accounts/mfaSignIn:start", M:["mfaPendingCredential","mfaEnrollmentId","phoneSignInInfo"],B:function(a){if(!a.phoneSignInInfo||!a.phoneSignInInfo.recaptchaToken)throw new t("missing-app-credential");},F:function(a){if(!a.phoneResponseInfo||!a.phoneResponseInfo.sessionInfo)throw new t("internal-error");},C:!0,Na:!0},tj={endpoint:"verifyAssertion",B:pj,Xa:qj,F:rj,U:!0,C:!0},vj={endpoint:"verifyAssertion",B:pj,Xa:qj,F:function(a){if(a.errorMessage&&"USER_NOT_FOUND"==a.errorMessage)throw new t("user-not-found");if(a.errorMessage)throw sj(a.errorMessage); P(a)},U:!0,C:!0},uj={endpoint:"verifyAssertion",B:function(a){pj(a);if(!a.idToken)throw new t("internal-error");},Xa:qj,F:rj,U:!0},Gj={endpoint:"verifyCustomToken",B:function(a){if(!a.token)throw new t("invalid-custom-token");},F:P,U:!0,C:!0},Xg={endpoint:"verifyPassword",B:function(a){Vi(a);if(!a.password)throw new t("wrong-password");},F:P,U:!0,C:!0},jj={endpoint:"verifyPhoneNumber",B:aj,F:P,C:!0},eh={endpoint:"verifyPhoneNumber",B:function(a){if(!a.idToken)throw new t("internal-error");aj(a)}, F:function(a){if(a.temporaryProof)throw a.code="credential-already-in-use",vh(a);P(a)}},fh={Gb:{USER_NOT_FOUND:"user-not-found"},endpoint:"verifyPhoneNumber",B:aj,F:P,C:!0},Hj={endpoint:"accounts/mfaEnrollment:withdraw",M:["idToken","mfaEnrollmentId"],F:function(a){if(!!a[zg]^!!a.refreshToken)throw new t("internal-error");},C:!0,Na:!0}; function O(a,b,c){if(!hf(c,b.M))return E(new t("internal-error"));var d=!!b.Na,e=b.Tb||"POST",f;return D(c).then(b.B).then(function(){b.U&&(c.returnSecureToken=!0);b.C&&a.b&&"undefined"===typeof c.tenantId&&(c.tenantId=a.b);return d?Ui(a,a.i,b.endpoint,e,c,b.Gb,b.kb||!1):Ui(a,a.h,b.endpoint,e,c,b.Gb,b.kb||!1)}).then(function(g){f=g;return b.Xa?b.Xa(c,f):f}).then(b.F).then(function(){if(!b.Z)return f;if(!(b.Z in f))throw new t("internal-error");return f[b.Z]})} function sj(a){return Ti({error:{errors:[{message:a}],code:400,message:a}})} function Ti(a,b){var c=(a.error&&a.error.errors&&a.error.errors[0]||{}).reason||"";var d={keyInvalid:"invalid-api-key",ipRefererBlocked:"app-not-authorized"};if(c=d[c]?new t(d[c]):null)return c;c=a.error&&a.error.message||"";d={INVALID_CUSTOM_TOKEN:"invalid-custom-token",CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_EMAIL:"invalid-email",INVALID_PASSWORD:"wrong-password",USER_DISABLED:"user-disabled", MISSING_PASSWORD:"internal-error",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_OR_INVALID_NONCE:"missing-or-invalid-nonce",INVALID_MESSAGE_PAYLOAD:"invalid-message-payload",INVALID_RECIPIENT_EMAIL:"invalid-recipient-email",INVALID_SENDER:"invalid-sender",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests", EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",INVALID_PROVIDER_ID:"invalid-provider-id",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",CORS_UNSUPPORTED:"cors-unsupported",DYNAMIC_LINK_NOT_ACTIVATED:"dynamic-link-not-activated",INVALID_APP_ID:"invalid-app-id",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",WEAK_PASSWORD:"weak-password", OPERATION_NOT_ALLOWED:"operation-not-allowed",USER_CANCELLED:"user-cancelled",CAPTCHA_CHECK_FAILED:"captcha-check-failed",INVALID_APP_CREDENTIAL:"invalid-app-credential",INVALID_CODE:"invalid-verification-code",INVALID_PHONE_NUMBER:"invalid-phone-number",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_APP_CREDENTIAL:"missing-app-credential",MISSING_CODE:"missing-verification-code",MISSING_PHONE_NUMBER:"missing-phone-number",MISSING_SESSION_INFO:"missing-verification-id", QUOTA_EXCEEDED:"quota-exceeded",SESSION_EXPIRED:"code-expired",REJECTED_CREDENTIAL:"rejected-credential",INVALID_CONTINUE_URI:"invalid-continue-uri",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",MISSING_IOS_BUNDLE_ID:"missing-ios-bundle-id",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_DYNAMIC_LINK_DOMAIN:"invalid-dynamic-link-domain",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",INVALID_CERT_HASH:"invalid-cert-hash",UNSUPPORTED_TENANT_OPERATION:"unsupported-tenant-operation", INVALID_TENANT_ID:"invalid-tenant-id",TENANT_ID_MISMATCH:"tenant-id-mismatch",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",EMAIL_CHANGE_NEEDS_VERIFICATION:"email-change-needs-verification",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded", UNSUPPORTED_FIRST_FACTOR:"unsupported-first-factor",UNVERIFIED_EMAIL:"unverified-email"};z(d,b||{});b=(b=c.match(/^[^\s]+\s*:\s*([\s\S]*)$/))&&1<b.length?b[1]:void 0;for(var e in d)if(0===c.indexOf(e))return new t(d[e],b);!b&&a&&(b=Pe(a));return new t("internal-error",b)};function Ij(a){this.b=a;this.a=null;this.qb=Jj(this)} function Jj(a){return Kj().then(function(){return new C(function(b,c){L("gapi.iframes.getContext")().open({where:document.body,url:a.b,messageHandlersFilter:L("gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER"),attributes:{style:{position:"absolute",top:"-100px",width:"1px",height:"1px"}},dontclear:!0},function(d){function e(){clearTimeout(f);b()}a.a=d;a.a.restyle({setHideOnLeave:!1});var f=setTimeout(function(){c(Error("Network Error"))},Lj.get());d.ping(e).then(e,function(){c(Error("Network Error"))})})})})} function Mj(a,b){return a.qb.then(function(){return new C(function(c){a.a.send(b.type,b,c,L("gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER"))})})}function Nj(a,b){a.qb.then(function(){a.a.register("authEvent",b,L("gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER"))})}var Oj=new ob(pb,"https://apis.google.com/js/api.js?onload=%{onload}"),Pj=new Ue(3E4,6E4),Lj=new Ue(5E3,15E3),Qj=null; function Kj(){return Qj?Qj:Qj=(new C(function(a,b){function c(){Te();L("gapi.load")("gapi.iframes",{callback:a,ontimeout:function(){Te();b(Error("Network Error"))},timeout:Pj.get()})}if(L("gapi.iframes.Iframe"))a();else if(L("gapi.load"))c();else{var d="__iframefcb"+Math.floor(1E6*Math.random()).toString();l[d]=function(){L("gapi.load")?c():b(Error("Network Error"))};d=xb(Oj,{onload:d});D(xi(d)).s(function(){b(Error("Network Error"))})}})).s(function(a){Qj=null;throw a;})};function Rj(a,b,c,d){this.l=a;this.h=b;this.i=c;this.g=d;this.f=null;this.g?(a=J(this.g.url),a=Yd(a.f,a.a,a.g,"/emulator/auth/iframe")):a=Yd("https",this.l,null,"/__/auth/iframe");this.a=a;I(this.a,"apiKey",this.h);I(this.a,"appName",this.i);this.b=null;this.c=[]}Rj.prototype.toString=function(){this.f?I(this.a,"v",this.f):de(this.a.b,"v");this.b?I(this.a,"eid",this.b):de(this.a.b,"eid");this.c.length?I(this.a,"fw",this.c.join(",")):de(this.a.b,"fw");return this.a.toString()}; function Sj(a,b,c,d,e,f){this.u=a;this.o=b;this.c=c;this.v=d;this.m=f;this.i=this.g=this.l=null;this.a=e;this.h=this.f=null}Sj.prototype.xb=function(a){this.h=a;return this}; Sj.prototype.toString=function(){if(this.m){var a=J(this.m.url);a=Yd(a.f,a.a,a.g,"/emulator/auth/handler")}else a=Yd("https",this.u,null,"/__/auth/handler");I(a,"apiKey",this.o);I(a,"appName",this.c);I(a,"authType",this.v);if(this.a.isOAuthProvider){var b=this.a;try{var c=firebase.app(this.c).auth().ka()}catch(h){c=null}b.nb=c;I(a,"providerId",this.a.providerId);c=this.a;b=Qe(c.Hb);for(var d in b)b[d]=b[d].toString();d=c.Pc;b=lb(b);for(var e=0;e<d.length;e++){var f=d[e];f in b&&delete b[f]}c.ob&& c.nb&&!b[c.ob]&&(b[c.ob]=c.nb);kb(b)||I(a,"customParameters",Pe(b))}"function"===typeof this.a.Pb&&(c=this.a.Pb(),c.length&&I(a,"scopes",c.join(",")));this.l?I(a,"redirectUrl",this.l):de(a.b,"redirectUrl");this.g?I(a,"eventId",this.g):de(a.b,"eventId");this.i?I(a,"v",this.i):de(a.b,"v");if(this.b)for(var g in this.b)this.b.hasOwnProperty(g)&&!Xd(a,g)&&I(a,g,this.b[g]);this.h?I(a,"tid",this.h):de(a.b,"tid");this.f?I(a,"eid",this.f):de(a.b,"eid");g=Tj(this.c);g.length&&I(a,"fw",g.join(","));return a.toString()}; function Tj(a){try{return firebase.app(a).auth().Ga()}catch(b){return[]}}function Uj(a,b,c,d,e,f){this.o=a;this.g=b;this.b=c;this.f=f;this.c=d||null;this.i=e||null;this.l=this.u=this.A=null;this.h=[];this.v=this.a=null} function Vj(a){var b=me();return Zi(a).then(function(c){a:{var d=J(b),e=d.f;d=d.a;for(var f=0;f<c.length;f++){var g=c[f];var h=d;var m=e;0==g.indexOf("chrome-extension://")?h=J(g).a==h&&"chrome-extension"==m:"http"!=m&&"https"!=m?h=!1:xe.test(g)?h=h==g:(g=g.split(".").join("\\."),h=(new RegExp("^(.+\\."+g+"|"+g+")$","i")).test(h));if(h){c=!0;break a}}c=!1}if(!c)throw new th(me());})} function Wj(a){if(a.v)return a.v;a.v=ze().then(function(){if(!a.u){var b=a.c,c=a.i,d=Tj(a.b),e=new Rj(a.o,a.g,a.b,a.f);e.f=b;e.b=c;e.c=Xa(d||[]);a.u=e.toString()}a.m=new Ij(a.u);Xj(a)});return a.v}k=Uj.prototype;k.Nb=function(a,b,c){var d=new t("popup-closed-by-user"),e=new t("web-storage-unsupported"),f=this,g=!1;return this.la().then(function(){Yj(f).then(function(h){h||(a&&te(a),b(e),g=!0)})}).s(function(){}).then(function(){if(!g)return we(a)}).then(function(){if(!g)return Ad(c).then(function(){b(d)})})}; k.Wb=function(){var a=K();return!Oe(a)&&!Se(a)};k.Sb=function(){return!1}; k.Lb=function(a,b,c,d,e,f,g,h){if(!a)return E(new t("popup-blocked"));if(g&&!Oe())return this.la().s(function(p){te(a);e(p)}),d(),D();this.a||(this.a=Vj(Zj(this)));var m=this;return this.a.then(function(){var p=m.la().s(function(v){te(a);e(v);throw v;});d();return p}).then(function(){nh(c);if(!g){var p=ak(m.o,m.g,m.b,b,c,null,f,m.c,void 0,m.i,h,m.f);ne(p,a)}}).s(function(p){"auth/network-request-failed"==p.code&&(m.a=null);throw p;})}; function Zj(a){a.l||(a.A=a.c?Je(a.c,Tj(a.b)):null,a.l=new Ei(a.g,Aa(a.i),a.A),a.f&&Li(a.l,a.f));return a.l}k.Mb=function(a,b,c,d){this.a||(this.a=Vj(Zj(this)));var e=this;return this.a.then(function(){nh(b);var f=ak(e.o,e.g,e.b,a,b,me(),c,e.c,void 0,e.i,d,e.f);ne(f)}).s(function(f){"auth/network-request-failed"==f.code&&(e.a=null);throw f;})};k.la=function(){var a=this;return Wj(this).then(function(){return a.m.qb}).s(function(){a.a=null;throw new t("network-request-failed");})};k.Zb=function(){return!0}; function ak(a,b,c,d,e,f,g,h,m,p,v,B){a=new Sj(a,b,c,d,e,B);a.l=f;a.g=g;a.i=h;a.b=lb(m||null);a.f=p;return a.xb(v).toString()}function Xj(a){if(!a.m)throw Error("IfcHandler must be initialized!");Nj(a.m,function(b){var c={};if(b&&b.authEvent){var d=!1;b=ph(b.authEvent);for(c=0;c<a.h.length;c++)d=a.h[c](b)||d;c={};c.status=d?"ACK":"ERROR";return D(c)}c.status="ERROR";return D(c)})} function Yj(a){var b={type:"webStorageSupport"};return Wj(a).then(function(){return Mj(a.m,b)}).then(function(c){if(c&&c.length&&"undefined"!==typeof c[0].webStorageSupport)return c[0].webStorageSupport;throw Error();})}k.Ea=function(a){this.h.push(a)};k.Ra=function(a){Va(this.h,function(b){return b==a})};function bk(a){this.a=a||firebase.INTERNAL.reactNative&&firebase.INTERNAL.reactNative.AsyncStorage;if(!this.a)throw new t("internal-error","The React Native compatibility library was not found.");this.type="asyncStorage"}k=bk.prototype;k.get=function(a){return D(this.a.getItem(a)).then(function(b){return b&&Re(b)})};k.set=function(a,b){return D(this.a.setItem(a,Pe(b)))};k.T=function(a){return D(this.a.removeItem(a))};k.ca=function(){};k.ia=function(){};function ck(a){this.b=a;this.a={};this.f=q(this.c,this)}var dk=[];function ek(){var a=Ee()?self:null;w(dk,function(c){c.b==a&&(b=c)});if(!b){var b=new ck(a);dk.push(b)}return b} ck.prototype.c=function(a){var b=a.data.eventType,c=a.data.eventId,d=this.a[b];if(d&&0<d.length){a.ports[0].postMessage({status:"ack",eventId:c,eventType:b,response:null});var e=[];w(d,function(f){e.push(D().then(function(){return f(a.origin,a.data.data)}))});Fc(e).then(function(f){var g=[];w(f,function(h){g.push({fulfilled:h.Ob,value:h.value,reason:h.reason?h.reason.message:void 0})});w(g,function(h){for(var m in h)"undefined"===typeof h[m]&&delete h[m]});a.ports[0].postMessage({status:"done",eventId:c, eventType:b,response:g})})}};function fk(a,b,c){kb(a.a)&&a.b.addEventListener("message",a.f);"undefined"===typeof a.a[b]&&(a.a[b]=[]);a.a[b].push(c)};function gk(a){this.a=a}gk.prototype.postMessage=function(a,b){this.a.postMessage(a,b)};function hk(a){this.c=a;this.b=!1;this.a=[]} function ik(a,b,c,d){var e,f=c||{},g,h,m,p=null;if(a.b)return E(Error("connection_unavailable"));var v=d?800:50,B="undefined"!==typeof MessageChannel?new MessageChannel:null;return(new C(function(A,Q){B?(e=Math.floor(Math.random()*Math.pow(10,20)).toString(),B.port1.start(),h=setTimeout(function(){Q(Error("unsupported_event"))},v),g=function(xa){xa.data.eventId===e&&("ack"===xa.data.status?(clearTimeout(h),m=setTimeout(function(){Q(Error("timeout"))},3E3)):"done"===xa.data.status?(clearTimeout(m), "undefined"!==typeof xa.data.response?A(xa.data.response):Q(Error("unknown_error"))):(clearTimeout(h),clearTimeout(m),Q(Error("invalid_response"))))},p={messageChannel:B,onMessage:g},a.a.push(p),B.port1.addEventListener("message",g),a.c.postMessage({eventType:b,eventId:e,data:f},[B.port2])):Q(Error("connection_unavailable"))})).then(function(A){jk(a,p);return A}).s(function(A){jk(a,p);throw A;})} function jk(a,b){if(b){var c=b.messageChannel,d=b.onMessage;c&&(c.port1.removeEventListener("message",d),c.port1.close());Va(a.a,function(e){return e==b})}}hk.prototype.close=function(){for(;0<this.a.length;)jk(this,this.a[0]);this.b=!0};function kk(){if(!lk())throw new t("web-storage-unsupported");this.c={};this.a=[];this.b=0;this.m=l.indexedDB;this.type="indexedDB";this.g=this.l=this.f=this.i=null;this.o=!1;this.h=null;var a=this;Ee()&&self?(this.l=ek(),fk(this.l,"keyChanged",function(b,c){return mk(a).then(function(d){0<d.length&&w(a.a,function(e){e(d)});return{keyProcessed:Ta(d,c.key)}})}),fk(this.l,"ping",function(){return D(["keyChanged"])})):af().then(function(b){if(a.h=b)a.g=new hk(new gk(b)),ik(a.g,"ping",null,!0).then(function(c){c[0].fulfilled&& Ta(c[0].value,"keyChanged")&&(a.o=!0)}).s(function(){})})}var nk;function ok(a){return new C(function(b,c){var d=a.m.deleteDatabase("firebaseLocalStorageDb");d.onsuccess=function(){b()};d.onerror=function(e){c(Error(e.target.error))}})} function pk(a){return new C(function(b,c){var d=a.m.open("firebaseLocalStorageDb",1);d.onerror=function(e){try{e.preventDefault()}catch(f){}c(Error(e.target.error))};d.onupgradeneeded=function(e){e=e.target.result;try{e.createObjectStore("firebaseLocalStorage",{keyPath:"fbase_key"})}catch(f){c(f)}};d.onsuccess=function(e){e=e.target.result;e.objectStoreNames.contains("firebaseLocalStorage")?b(e):ok(a).then(function(){return pk(a)}).then(function(f){b(f)}).s(function(f){c(f)})}})} function qk(a){a.v||(a.v=pk(a));return a.v}function lk(){try{return!!l.indexedDB}catch(a){return!1}}function rk(a){return a.objectStore("firebaseLocalStorage")}function sk(a,b){return a.transaction(["firebaseLocalStorage"],b?"readwrite":"readonly")}function tk(a){return new C(function(b,c){a.onsuccess=function(d){d&&d.target?b(d.target.result):b()};a.onerror=function(d){c(d.target.error)}})}k=kk.prototype; k.set=function(a,b){var c=!1,d,e=this;return qk(this).then(function(f){d=f;f=rk(sk(d,!0));return tk(f.get(a))}).then(function(f){var g=rk(sk(d,!0));if(f)return f.value=b,tk(g.put(f));e.b++;c=!0;f={};f.fbase_key=a;f.value=b;return tk(g.add(f))}).then(function(){e.c[a]=b;return uk(e,a)}).na(function(){c&&e.b--})};function uk(a,b){return a.g&&a.h&&$e()===a.h?ik(a.g,"keyChanged",{key:b},a.o).then(function(){}).s(function(){}):D()} k.get=function(a){return qk(this).then(function(b){return tk(rk(sk(b,!1)).get(a))}).then(function(b){return b&&b.value})};k.T=function(a){var b=!1,c=this;return qk(this).then(function(d){b=!0;c.b++;return tk(rk(sk(d,!0))["delete"](a))}).then(function(){delete c.c[a];return uk(c,a)}).na(function(){b&&c.b--})}; function mk(a){return qk(a).then(function(b){var c=rk(sk(b,!1));return c.getAll?tk(c.getAll()):new C(function(d,e){var f=[],g=c.openCursor();g.onsuccess=function(h){(h=h.target.result)?(f.push(h.value),h["continue"]()):d(f)};g.onerror=function(h){e(h.target.error)}})}).then(function(b){var c={},d=[];if(0==a.b){for(d=0;d<b.length;d++)c[b[d].fbase_key]=b[d].value;d=oe(a.c,c);a.c=c}return d})}k.ca=function(a){0==this.a.length&&vk(this);this.a.push(a)}; k.ia=function(a){Va(this.a,function(b){return b==a});0==this.a.length&&wk(this)};function vk(a){function b(){a.f=setTimeout(function(){a.i=mk(a).then(function(c){0<c.length&&w(a.a,function(d){d(c)})}).then(function(){b()}).s(function(c){"STOP_EVENT"!=c.message&&b()})},800)}wk(a);b()}function wk(a){a.i&&a.i.cancel("STOP_EVENT");a.f&&(clearTimeout(a.f),a.f=null)};function xk(a){var b=this,c=null;this.a=[];this.type="indexedDB";this.c=a;this.b=D().then(function(){if(lk()){var d=Le(),e="__sak"+d;nk||(nk=new kk);c=nk;return c.set(e,d).then(function(){return c.get(e)}).then(function(f){if(f!==d)throw Error("indexedDB not supported!");return c.T(e)}).then(function(){return c}).s(function(){return b.c})}return b.c}).then(function(d){b.type=d.type;d.ca(function(e){w(b.a,function(f){f(e)})});return d})}k=xk.prototype;k.get=function(a){return this.b.then(function(b){return b.get(a)})}; k.set=function(a,b){return this.b.then(function(c){return c.set(a,b)})};k.T=function(a){return this.b.then(function(b){return b.T(a)})};k.ca=function(a){this.a.push(a)};k.ia=function(a){Va(this.a,function(b){return b==a})};function yk(){this.a={};this.type="inMemory"}k=yk.prototype;k.get=function(a){return D(this.a[a])};k.set=function(a,b){this.a[a]=b;return D()};k.T=function(a){delete this.a[a];return D()};k.ca=function(){};k.ia=function(){};function zk(){if(!Ak()){if("Node"==Fe())throw new t("internal-error","The LocalStorage compatibility library was not found.");throw new t("web-storage-unsupported");}this.a=Bk()||firebase.INTERNAL.node.localStorage;this.type="localStorage"}function Bk(){try{var a=l.localStorage,b=Le();a&&(a.setItem(b,"1"),a.removeItem(b));return a}catch(c){return null}} function Ak(){var a="Node"==Fe();a=Bk()||a&&firebase.INTERNAL.node&&firebase.INTERNAL.node.localStorage;if(!a)return!1;try{return a.setItem("__sak","1"),a.removeItem("__sak"),!0}catch(b){return!1}}k=zk.prototype;k.get=function(a){var b=this;return D().then(function(){var c=b.a.getItem(a);return Re(c)})};k.set=function(a,b){var c=this;return D().then(function(){var d=Pe(b);null===d?c.T(a):c.a.setItem(a,d)})};k.T=function(a){var b=this;return D().then(function(){b.a.removeItem(a)})}; k.ca=function(a){l.window&&jd(l.window,"storage",a)};k.ia=function(a){l.window&&G(l.window,"storage",a)};function Ck(){this.type="nullStorage"}k=Ck.prototype;k.get=function(){return D(null)};k.set=function(){return D()};k.T=function(){return D()};k.ca=function(){};k.ia=function(){};function Dk(){if(!Ek()){if("Node"==Fe())throw new t("internal-error","The SessionStorage compatibility library was not found.");throw new t("web-storage-unsupported");}this.a=Fk()||firebase.INTERNAL.node.sessionStorage;this.type="sessionStorage"}function Fk(){try{var a=l.sessionStorage,b=Le();a&&(a.setItem(b,"1"),a.removeItem(b));return a}catch(c){return null}} function Ek(){var a="Node"==Fe();a=Fk()||a&&firebase.INTERNAL.node&&firebase.INTERNAL.node.sessionStorage;if(!a)return!1;try{return a.setItem("__sak","1"),a.removeItem("__sak"),!0}catch(b){return!1}}k=Dk.prototype;k.get=function(a){var b=this;return D().then(function(){var c=b.a.getItem(a);return Re(c)})};k.set=function(a,b){var c=this;return D().then(function(){var d=Pe(b);null===d?c.T(a):c.a.setItem(a,d)})};k.T=function(a){var b=this;return D().then(function(){b.a.removeItem(a)})};k.ca=function(){}; k.ia=function(){};function Gk(){var a={};a.Browser=Hk;a.Node=Ik;a.ReactNative=Jk;a.Worker=Kk;this.a=a[Fe()]}var Lk,Hk={D:zk,ab:Dk},Ik={D:zk,ab:Dk},Jk={D:bk,ab:Ck},Kk={D:zk,ab:Ck};/* Copyright 2017 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ var Mk={qd:"local",NONE:"none",sd:"session"};function Nk(a){var b=new t("invalid-persistence-type"),c=new t("unsupported-persistence-type");a:{for(d in Mk)if(Mk[d]==a){var d=!0;break a}d=!1}if(!d||"string"!==typeof a)throw b;switch(Fe()){case "ReactNative":if("session"===a)throw c;break;case "Node":if("none"!==a)throw c;break;case "Worker":if("session"===a||!lk()&&"none"!==a)throw c;break;default:if(!Ke()&&"none"!==a)throw c;}} function Ok(){var a=!Se(K())&&De()?!0:!1,b=Oe(),c=Ke();this.v=a;this.h=b;this.l=c;this.a={};Lk||(Lk=new Gk);a=Lk;try{this.g=!le()&&Ze()||!l.indexedDB?new a.a.D:new xk(Ee()?new yk:new a.a.D)}catch(d){this.g=new yk,this.h=!0}try{this.i=new a.a.ab}catch(d){this.i=new yk}this.m=new yk;this.f=q(this.Xb,this);this.b={}}var Pk;function Qk(){Pk||(Pk=new Ok);return Pk}function Rk(a,b){switch(b){case "session":return a.i;case "none":return a.m;default:return a.g}} function Sk(a,b){return"firebase:"+a.name+(b?":"+b:"")}function Tk(a,b,c){var d=Sk(b,c),e=Rk(a,b.D);return a.get(b,c).then(function(f){var g=null;try{g=Re(l.localStorage.getItem(d))}catch(h){}if(g&&!f)return l.localStorage.removeItem(d),a.set(b,g,c);g&&f&&"localStorage"!=e.type&&l.localStorage.removeItem(d)})}k=Ok.prototype;k.get=function(a,b){return Rk(this,a.D).get(Sk(a,b))};function Uk(a,b,c){c=Sk(b,c);"local"==b.D&&(a.b[c]=null);return Rk(a,b.D).T(c)} k.set=function(a,b,c){var d=Sk(a,c),e=this,f=Rk(this,a.D);return f.set(d,b).then(function(){return f.get(d)}).then(function(g){"local"==a.D&&(e.b[d]=g)})};k.addListener=function(a,b,c){a=Sk(a,b);this.l&&(this.b[a]=l.localStorage.getItem(a));kb(this.a)&&(Rk(this,"local").ca(this.f),this.h||(le()||!Ze())&&l.indexedDB||!this.l||Vk(this));this.a[a]||(this.a[a]=[]);this.a[a].push(c)}; k.removeListener=function(a,b,c){a=Sk(a,b);this.a[a]&&(Va(this.a[a],function(d){return d==c}),0==this.a[a].length&&delete this.a[a]);kb(this.a)&&(Rk(this,"local").ia(this.f),Wk(this))};function Vk(a){Wk(a);a.c=setInterval(function(){for(var b in a.a){var c=l.localStorage.getItem(b),d=a.b[b];c!=d&&(a.b[b]=c,c=new Yc({type:"storage",key:b,target:window,oldValue:d,newValue:c,a:!0}),a.Xb(c))}},1E3)}function Wk(a){a.c&&(clearInterval(a.c),a.c=null)} k.Xb=function(a){if(a&&a.g){var b=a.a.key;if(null==b)for(var c in this.a){var d=this.b[c];"undefined"===typeof d&&(d=null);var e=l.localStorage.getItem(c);e!==d&&(this.b[c]=e,this.lb(c))}else if(0==b.indexOf("firebase:")&&this.a[b]){"undefined"!==typeof a.a.a?Rk(this,"local").ia(this.f):Wk(this);if(this.v)if(c=l.localStorage.getItem(b),d=a.a.newValue,d!==c)null!==d?l.localStorage.setItem(b,d):l.localStorage.removeItem(b);else if(this.b[b]===d&&"undefined"===typeof a.a.a)return;var f=this;c=function(){if("undefined"!== typeof a.a.a||f.b[b]!==l.localStorage.getItem(b))f.b[b]=l.localStorage.getItem(b),f.lb(b)};Tb&&dc&&10==dc&&l.localStorage.getItem(b)!==a.a.newValue&&a.a.newValue!==a.a.oldValue?setTimeout(c,10):c()}}else w(a,q(this.lb,this))};k.lb=function(a){this.a[a]&&w(this.a[a],function(b){b()})};function Xk(a){this.a=a;this.b=Qk()}var Yk={name:"authEvent",D:"local"};function Zk(a){return a.b.get(Yk,a.a).then(function(b){return ph(b)})};function $k(){this.a=Qk()};function al(){this.b=-1};function bl(a,b){this.b=cl;this.f=l.Uint8Array?new Uint8Array(this.b):Array(this.b);this.g=this.c=0;this.a=[];this.i=a;this.h=b;this.l=l.Int32Array?new Int32Array(64):Array(64);void 0===dl&&(l.Int32Array?dl=new Int32Array(el):dl=el);this.reset()}var dl;r(bl,al);for(var cl=64,fl=cl-1,gl=[],hl=0;hl<fl;hl++)gl[hl]=0;var il=Wa(128,gl);bl.prototype.reset=function(){this.g=this.c=0;this.a=l.Int32Array?new Int32Array(this.h):Xa(this.h)}; function jl(a){for(var b=a.f,c=a.l,d=0,e=0;e<b.length;)c[d++]=b[e]<<24|b[e+1]<<16|b[e+2]<<8|b[e+3],e=4*d;for(b=16;64>b;b++){e=c[b-15]|0;d=c[b-2]|0;var f=(c[b-16]|0)+((e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3)|0,g=(c[b-7]|0)+((d>>>17|d<<15)^(d>>>19|d<<13)^d>>>10)|0;c[b]=f+g|0}d=a.a[0]|0;e=a.a[1]|0;var h=a.a[2]|0,m=a.a[3]|0,p=a.a[4]|0,v=a.a[5]|0,B=a.a[6]|0;f=a.a[7]|0;for(b=0;64>b;b++){var A=((d>>>2|d<<30)^(d>>>13|d<<19)^(d>>>22|d<<10))+(d&e^d&h^e&h)|0;g=p&v^~p&B;f=f+((p>>>6|p<<26)^(p>>>11|p<<21)^(p>>>25|p<< 7))|0;g=g+(dl[b]|0)|0;g=f+(g+(c[b]|0)|0)|0;f=B;B=v;v=p;p=m+g|0;m=h;h=e;e=d;d=g+A|0}a.a[0]=a.a[0]+d|0;a.a[1]=a.a[1]+e|0;a.a[2]=a.a[2]+h|0;a.a[3]=a.a[3]+m|0;a.a[4]=a.a[4]+p|0;a.a[5]=a.a[5]+v|0;a.a[6]=a.a[6]+B|0;a.a[7]=a.a[7]+f|0} function kl(a,b,c){void 0===c&&(c=b.length);var d=0,e=a.c;if("string"===typeof b)for(;d<c;)a.f[e++]=b.charCodeAt(d++),e==a.b&&(jl(a),e=0);else if(ma(b))for(;d<c;){var f=b[d++];if(!("number"==typeof f&&0<=f&&255>=f&&f==(f|0)))throw Error("message must be a byte array");a.f[e++]=f;e==a.b&&(jl(a),e=0)}else throw Error("message must be string or array");a.c=e;a.g+=c} var el=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804, 4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function ll(){bl.call(this,8,ml)}r(ll,bl);var ml=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225];function nl(a,b,c,d,e,f){this.m=a;this.i=b;this.l=c;this.v=d||null;this.u=e||null;this.o=f;this.h=b+":"+c;this.A=new $k;this.g=new Xk(this.h);this.f=null;this.b=[];this.a=this.c=null}function ol(a){return new t("invalid-cordova-configuration",a)}k=nl.prototype; k.la=function(){return this.Ia?this.Ia:this.Ia=Ae().then(function(){if("function"!==typeof L("universalLinks.subscribe",l))throw ol("cordova-universal-links-plugin-fix is not installed");if("undefined"===typeof L("BuildInfo.packageName",l))throw ol("cordova-plugin-buildinfo is not installed");if("function"!==typeof L("cordova.plugins.browsertab.openUrl",l))throw ol("cordova-plugin-browsertab is not installed");if("function"!==typeof L("cordova.InAppBrowser.open",l))throw ol("cordova-plugin-inappbrowser is not installed"); },function(){throw new t("cordova-not-ready");})};function pl(){for(var a=20,b=[];0<a;)b.push("1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".charAt(Math.floor(62*Math.random()))),a--;return b.join("")}function ql(a){var b=new ll;kl(b,a);a=[];var c=8*b.g;56>b.c?kl(b,il,56-b.c):kl(b,il,b.b-(b.c-56));for(var d=63;56<=d;d--)b.f[d]=c&255,c/=256;jl(b);for(d=c=0;d<b.i;d++)for(var e=24;0<=e;e-=8)a[c++]=b.a[d]>>e&255;return Zf(a)} k.Nb=function(a,b){b(new t("operation-not-supported-in-this-environment"));return D()};k.Lb=function(){return E(new t("operation-not-supported-in-this-environment"))};k.Zb=function(){return!1};k.Wb=function(){return!0};k.Sb=function(){return!0}; k.Mb=function(a,b,c,d){if(this.c)return E(new t("redirect-operation-pending"));var e=this,f=l.document,g=null,h=null,m=null,p=null;return this.c=D().then(function(){nh(b);return rl(e)}).then(function(){return sl(e,a,b,c,d)}).then(function(){return(new C(function(v,B){h=function(){var A=L("cordova.plugins.browsertab.close",l);v();"function"===typeof A&&A();e.a&&"function"===typeof e.a.close&&(e.a.close(),e.a=null);return!1};e.Ea(h);m=function(){g||(g=Ad(2E3).then(function(){B(new t("redirect-cancelled-by-user"))}))}; p=function(){Ve()&&m()};f.addEventListener("resume",m,!1);K().toLowerCase().match(/android/)||f.addEventListener("visibilitychange",p,!1)})).s(function(v){return tl(e).then(function(){throw v;})})}).na(function(){m&&f.removeEventListener("resume",m,!1);p&&f.removeEventListener("visibilitychange",p,!1);g&&g.cancel();h&&e.Ra(h);e.c=null})}; function sl(a,b,c,d,e){var f=pl(),g=new oh(b,d,null,f,new t("no-auth-event"),null,e),h=L("BuildInfo.packageName",l);if("string"!==typeof h)throw new t("invalid-cordova-configuration");var m=L("BuildInfo.displayName",l),p={};if(K().toLowerCase().match(/iphone|ipad|ipod/))p.ibi=h;else if(K().toLowerCase().match(/android/))p.apn=h;else return E(new t("operation-not-supported-in-this-environment"));m&&(p.appDisplayName=m);f=ql(f);p.sessionId=f;var v=ak(a.m,a.i,a.l,b,c,null,d,a.v,p,a.u,e,a.o);return a.la().then(function(){var B= a.h;return a.A.a.set(Yk,g.w(),B)}).then(function(){var B=L("cordova.plugins.browsertab.isAvailable",l);if("function"!==typeof B)throw new t("invalid-cordova-configuration");var A=null;B(function(Q){if(Q){A=L("cordova.plugins.browsertab.openUrl",l);if("function"!==typeof A)throw new t("invalid-cordova-configuration");A(v)}else{A=L("cordova.InAppBrowser.open",l);if("function"!==typeof A)throw new t("invalid-cordova-configuration");Q=K();a.a=A(v,Q.match(/(iPad|iPhone|iPod).*OS 7_\d/i)||Q.match(/(iPad|iPhone|iPod).*OS 8_\d/i)? "_blank":"_system","location=yes")}})})}function ul(a,b){for(var c=0;c<a.b.length;c++)try{a.b[c](b)}catch(d){}}function rl(a){a.f||(a.f=a.la().then(function(){return new C(function(b){function c(d){b(d);a.Ra(c);return!1}a.Ea(c);vl(a)})}));return a.f}function tl(a){var b=null;return Zk(a.g).then(function(c){b=c;c=a.g;return Uk(c.b,Yk,c.a)}).then(function(){return b})} function vl(a){function b(g){d=!0;e&&e.cancel();tl(a).then(function(h){var m=c;if(h&&g&&g.url){var p=null;m=tg(g.url);-1!=m.indexOf("/__/auth/callback")&&(p=J(m),p=Re(Xd(p,"firebaseError")||null),p=(p="object"===typeof p?ya(p):null)?new oh(h.c,h.b,null,null,p,null,h.S()):new oh(h.c,h.b,m,h.f,null,null,h.S()));m=p||c}ul(a,m)})}var c=new oh("unknown",null,null,null,new t("no-auth-event")),d=!1,e=Ad(500).then(function(){return tl(a).then(function(){d||ul(a,c)})}),f=l.handleOpenURL;l.handleOpenURL=function(g){0== g.toLowerCase().indexOf(L("BuildInfo.packageName",l).toLowerCase()+"://")&&b({url:g});if("function"===typeof f)try{f(g)}catch(h){console.error(h)}};rh||(rh=new qh);sh(b)}k.Ea=function(a){this.b.push(a);rl(this).s(function(b){"auth/invalid-cordova-configuration"===b.code&&(b=new oh("unknown",null,null,null,new t("no-auth-event")),a(b))})};k.Ra=function(a){Va(this.b,function(b){return b==a})};function wl(a){this.a=a;this.b=Qk()}var xl={name:"pendingRedirect",D:"session"};function yl(a){return a.b.set(xl,"pending",a.a)}function zl(a){return Uk(a.b,xl,a.a)}function Al(a){return a.b.get(xl,a.a).then(function(b){return"pending"==b})};function Bl(a,b,c,d){this.i={};this.u=0;this.O=a;this.m=b;this.v=c;this.G=d;this.h=[];this.f=!1;this.l=q(this.o,this);this.b=new Cl;this.A=new Dl;this.g=new wl(El(this.m,this.v));this.c={};this.c.unknown=this.b;this.c.signInViaRedirect=this.b;this.c.linkViaRedirect=this.b;this.c.reauthViaRedirect=this.b;this.c.signInViaPopup=this.A;this.c.linkViaPopup=this.A;this.c.reauthViaPopup=this.A;this.a=Fl(this.O,this.m,this.v,Ba,this.G)} function Fl(a,b,c,d,e){var f=firebase.SDK_VERSION||null;return Be()?new nl(a,b,c,f,d,e):new Uj(a,b,c,f,d,e)}Bl.prototype.reset=function(){this.f=!1;this.a.Ra(this.l);this.a=Fl(this.O,this.m,this.v,null,this.G);this.i={}};function Gl(a){a.f||(a.f=!0,a.a.Ea(a.l));var b=a.a;return a.a.la().s(function(c){a.a==b&&a.reset();throw c;})} function Hl(a){a.a.Wb()&&Gl(a).s(function(b){var c=new oh("unknown",null,null,null,new t("operation-not-supported-in-this-environment"));Il(b)&&a.o(c)});a.a.Sb()||Jl(a.b)}function Kl(a,b){Ta(a.h,b)||a.h.push(b);a.f||Al(a.g).then(function(c){c?zl(a.g).then(function(){Gl(a).s(function(d){var e=new oh("unknown",null,null,null,new t("operation-not-supported-in-this-environment"));Il(d)&&a.o(e)})}):Hl(a)}).s(function(){Hl(a)})}function Ll(a,b){Va(a.h,function(c){return c==b})} Bl.prototype.o=function(a){if(!a)throw new t("invalid-auth-event");6E5<=ua()-this.u&&(this.i={},this.u=0);if(a&&a.getUid()&&this.i.hasOwnProperty(a.getUid()))return!1;for(var b=!1,c=0;c<this.h.length;c++){var d=this.h[c];if(d.Eb(a.c,a.b)){if(b=this.c[a.c])b.h(a,d),a&&(a.f||a.b)&&(this.i[a.getUid()]=!0,this.u=ua());b=!0;break}}Jl(this.b);return b};var Ml=new Ue(2E3,1E4),Nl=new Ue(3E4,6E4);Bl.prototype.qa=function(){return this.b.qa()}; function Ol(a,b,c,d,e,f,g){return a.a.Lb(b,c,d,function(){a.f||(a.f=!0,a.a.Ea(a.l))},function(){a.reset()},e,f,g)}function Il(a){return a&&"auth/cordova-not-ready"==a.code?!0:!1} function Pl(a,b,c,d,e){var f;return yl(a.g).then(function(){return a.a.Mb(b,c,d,e).s(function(g){if(Il(g))throw new t("operation-not-supported-in-this-environment");f=g;return zl(a.g).then(function(){throw f;})}).then(function(){return a.a.Zb()?new C(function(){}):zl(a.g).then(function(){return a.qa()}).then(function(){}).s(function(){})})})}function Ql(a,b,c,d,e){return a.a.Nb(d,function(f){b.ma(c,null,f,e)},Ml.get())}var Rl={};function El(a,b,c){a=a+":"+b;c&&(a=a+":"+c.url);return a} function Sl(a,b,c,d){var e=El(b,c,d);Rl[e]||(Rl[e]=new Bl(a,b,c,d));return Rl[e]}function Cl(){this.b=null;this.f=[];this.c=[];this.a=null;this.i=this.g=!1}Cl.prototype.reset=function(){this.b=null;this.a&&(this.a.cancel(),this.a=null)}; Cl.prototype.h=function(a,b){if(a){this.reset();this.g=!0;var c=a.c,d=a.b,e=a.a&&"auth/web-storage-unsupported"==a.a.code,f=a.a&&"auth/operation-not-supported-in-this-environment"==a.a.code;this.i=!(!e&&!f);"unknown"!=c||e||f?a.a?(Tl(this,!0,null,a.a),D()):b.Fa(c,d)?Ul(this,a,b):E(new t("invalid-auth-event")):(Tl(this,!1,null,null),D())}else E(new t("invalid-auth-event"))};function Jl(a){a.g||(a.g=!0,Tl(a,!1,null,null))}function Vl(a){a.g&&!a.i&&Tl(a,!1,null,null)} function Ul(a,b,c){c=c.Fa(b.c,b.b);var d=b.g,e=b.f,f=b.i,g=b.S(),h=!!b.c.match(/Redirect$/);c(d,e,g,f).then(function(m){Tl(a,h,m,null)}).s(function(m){Tl(a,h,null,m)})}function Wl(a,b){a.b=function(){return E(b)};if(a.c.length)for(var c=0;c<a.c.length;c++)a.c[c](b)}function Xl(a,b){a.b=function(){return D(b)};if(a.f.length)for(var c=0;c<a.f.length;c++)a.f[c](b)}function Tl(a,b,c,d){b?d?Wl(a,d):Xl(a,c):Xl(a,{user:null});a.f=[];a.c=[]} Cl.prototype.qa=function(){var a=this;return new C(function(b,c){a.b?a.b().then(b,c):(a.f.push(b),a.c.push(c),Yl(a))})};function Yl(a){var b=new t("timeout");a.a&&a.a.cancel();a.a=Ad(Nl.get()).then(function(){a.b||(a.g=!0,Tl(a,!0,null,b))})}function Dl(){}Dl.prototype.h=function(a,b){if(a){var c=a.c,d=a.b;a.a?(b.ma(a.c,null,a.a,a.b),D()):b.Fa(c,d)?Zl(a,b):E(new t("invalid-auth-event"))}else E(new t("invalid-auth-event"))}; function Zl(a,b){var c=a.b,d=a.c;b.Fa(d,c)(a.g,a.f,a.S(),a.i).then(function(e){b.ma(d,e,null,c)}).s(function(e){b.ma(d,null,e,c)})};function $l(){this.hb=!1;Object.defineProperty(this,"appVerificationDisabled",{get:function(){return this.hb},set:function(a){this.hb=a},enumerable:!1})};function am(a,b){this.a=b;M(this,"verificationId",a)}am.prototype.confirm=function(a){a=lh(this.verificationId,a);return this.a(a)};function bm(a,b,c,d){return(new hh(a)).eb(b,c).then(function(e){return new am(e,d)})};function cm(a){var b=eg(a);if(!(b&&b.exp&&b.auth_time&&b.iat))throw new t("internal-error","An internal error occurred. The token obtained by Firebase appears to be malformed. Please retry the operation.");N(this,{token:a,expirationTime:Ye(1E3*b.exp),authTime:Ye(1E3*b.auth_time),issuedAtTime:Ye(1E3*b.iat),signInProvider:b.firebase&&b.firebase.sign_in_provider?b.firebase.sign_in_provider:null,signInSecondFactor:b.firebase&&b.firebase.sign_in_second_factor?b.firebase.sign_in_second_factor:null,claims:b})} ;function dm(a,b,c){var d=b&&b[em];if(!d)throw new t("argument-error","Internal assert: Invalid MultiFactorResolver");this.a=a;this.f=lb(b);this.g=c;this.c=new ug(null,d);this.b=[];var e=this;w(b[fm]||[],function(f){(f=pf(f))&&e.b.push(f)});M(this,"auth",this.a);M(this,"session",this.c);M(this,"hints",this.b)}var fm="mfaInfo",em="mfaPendingCredential";dm.prototype.Qc=function(a){var b=this;return a.rb(this.a.a,this.c).then(function(c){var d=lb(b.f);delete d[fm];delete d[em];z(d,c);return b.g(d)})};function gm(a,b,c,d){t.call(this,"multi-factor-auth-required",d,b);this.b=new dm(a,b,c);M(this,"resolver",this.b)}r(gm,t);function hm(a,b,c){if(a&&n(a.serverResponse)&&"auth/multi-factor-auth-required"===a.code)try{return new gm(b,a.serverResponse,c,a.message)}catch(d){}return null};function im(){}im.prototype.rb=function(a,b,c){return b.type==vg?jm(this,a,b,c):km(this,a,b)};function jm(a,b,c,d){return c.Ha().then(function(e){e={idToken:e};"undefined"!==typeof d&&(e.displayName=d);z(e,{phoneVerificationInfo:dh(a.a)});return O(b,Cj,e)})}function km(a,b,c){return c.Ha().then(function(d){d={mfaPendingCredential:d};z(d,{phoneVerificationInfo:dh(a.a)});return O(b,Dj,d)})}function lm(a){M(this,"factorId",a.fa);this.a=a}r(lm,im); function mm(a){lm.call(this,a);if(this.a.fa!=hh.PROVIDER_ID)throw new t("argument-error","firebase.auth.PhoneMultiFactorAssertion requires a valid firebase.auth.PhoneAuthCredential");}r(mm,lm);function nm(a,b){F.call(this,a);for(var c in b)this[c]=b[c]}r(nm,F);function om(a,b){this.a=a;this.b=[];this.c=q(this.xc,this);jd(this.a,"userReloaded",this.c);var c=[];b&&b.multiFactor&&b.multiFactor.enrolledFactors&&w(b.multiFactor.enrolledFactors,function(d){var e=null,f={};if(d){d.uid&&(f[mf]=d.uid);d.displayName&&(f[nf]=d.displayName);d.enrollmentTime&&(f[of]=(new Date(d.enrollmentTime)).toISOString());d.phoneNumber&&(f[lf]=d.phoneNumber);try{e=new qf(f)}catch(g){}d=e}else d=null;d&&c.push(d)});pm(this,c)} function qm(a){var b=[];w(a.mfaInfo||[],function(c){(c=pf(c))&&b.push(c)});return b}k=om.prototype;k.xc=function(a){pm(this,qm(a.gd))};function pm(a,b){a.b=b;M(a,"enrolledFactors",b)}k.Qb=function(){return this.a.I().then(function(a){return new ug(a,null)})};k.ec=function(a,b){var c=this,d=this.a.a;return this.Qb().then(function(e){return a.rb(d,e,b)}).then(function(e){rm(c.a,e);return c.a.reload()})}; k.ad=function(a){var b=this,c="string"===typeof a?a:a.uid,d=this.a.a;return this.a.I().then(function(e){return O(d,Hj,{idToken:e,mfaEnrollmentId:c})}).then(function(e){var f=Oa(b.b,function(g){return g.uid!=c});pm(b,f);rm(b.a,e);return b.a.reload().s(function(g){if("auth/user-token-expired"!=g.code)throw g;})})};k.w=function(){return{multiFactor:{enrolledFactors:Pa(this.b,function(a){return a.w()})}}};function sm(a,b,c){this.h=a;this.i=b;this.g=c;this.c=3E4;this.f=96E4;this.b=null;this.a=this.c;if(this.f<this.c)throw Error("Proactive refresh lower bound greater than upper bound!");}sm.prototype.start=function(){this.a=this.c;tm(this,!0)};function um(a,b){if(b)return a.a=a.c,a.g();b=a.a;a.a*=2;a.a>a.f&&(a.a=a.f);return b}function tm(a,b){a.stop();a.b=Ad(um(a,b)).then(function(){return We()}).then(function(){return a.h()}).then(function(){tm(a,!0)}).s(function(c){a.i(c)&&tm(a,!1)})} sm.prototype.stop=function(){this.b&&(this.b.cancel(),this.b=null)};function vm(a){this.c=a;this.b=this.a=null}vm.prototype.w=function(){return{apiKey:this.c.c,refreshToken:this.a,accessToken:this.b&&this.b.toString(),expirationTime:wm(this)}};function wm(a){return a.b&&1E3*a.b.c||0}function xm(a,b){var c=b.refreshToken;a.b=fg(b[zg]||"");a.a=c}function ym(a,b){a.b=b.b;a.a=b.a} function zm(a,b){return Si(a.c,b).then(function(c){a.b=fg(c.access_token);a.a=c.refresh_token;return{accessToken:a.b.toString(),refreshToken:a.a}}).s(function(c){"auth/user-token-expired"==c.code&&(a.a=null);throw c;})}vm.prototype.getToken=function(a){a=!!a;return this.b&&!this.a?E(new t("user-token-expired")):a||!this.b||ua()>wm(this)-3E4?this.a?zm(this,{grant_type:"refresh_token",refresh_token:this.a}):D(null):D({accessToken:this.b.toString(),refreshToken:this.a})};function Am(a,b){this.a=a||null;this.b=b||null;N(this,{lastSignInTime:Ye(b||null),creationTime:Ye(a||null)})}function Bm(a){return new Am(a.a,a.b)}Am.prototype.w=function(){return{lastLoginAt:this.b,createdAt:this.a}};function Cm(a,b,c,d,e,f){N(this,{uid:a,displayName:d||null,photoURL:e||null,email:c||null,phoneNumber:f||null,providerId:b})} function Dm(a,b,c){this.G=[];this.l=a.apiKey;this.m=a.appName;this.o=a.authDomain||null;var d=firebase.SDK_VERSION?Je(firebase.SDK_VERSION):null;this.a=new Ei(this.l,Aa(Ba),d);a.emulatorConfig&&Li(this.a,a.emulatorConfig);this.b=new vm(this.a);Em(this,b[zg]);xm(this.b,b);M(this,"refreshToken",this.b.a);Fm(this,c||{});H.call(this);this.P=!1;this.o&&Me()&&(this.i=Sl(this.o,this.l,this.m));this.R=[];this.f=null;this.u=Gm(this);this.$=q(this.gb,this);var e=this;this.pa=null;this.Ba=function(f){e.wa(f.h)}; this.ba=null;this.za=function(f){Li(e.a,f.c)};this.W=null;this.X=[];this.Aa=function(f){Hm(e,f.f)};this.aa=null;this.N=new om(this,c);M(this,"multiFactor",this.N)}r(Dm,H);Dm.prototype.wa=function(a){this.pa=a;Ki(this.a,a)};Dm.prototype.ka=function(){return this.pa};function Im(a,b){a.ba&&G(a.ba,"languageCodeChanged",a.Ba);(a.ba=b)&&jd(b,"languageCodeChanged",a.Ba)}function Jm(a,b){a.W&&G(a.W,"emulatorConfigChanged",a.za);(a.W=b)&&jd(b,"emulatorConfigChanged",a.za)} function Hm(a,b){a.X=b;Ni(a.a,firebase.SDK_VERSION?Je(firebase.SDK_VERSION,a.X):null)}Dm.prototype.Ga=function(){return Xa(this.X)};function Km(a,b){a.aa&&G(a.aa,"frameworkChanged",a.Aa);(a.aa=b)&&jd(b,"frameworkChanged",a.Aa)}Dm.prototype.gb=function(){this.u.b&&(this.u.stop(),this.u.start())};function Lm(a){try{return firebase.app(a.m).auth()}catch(b){throw new t("internal-error","No firebase.auth.Auth instance is available for the Firebase App '"+a.m+"'!");}} function Gm(a){return new sm(function(){return a.I(!0)},function(b){return b&&"auth/network-request-failed"==b.code?!0:!1},function(){var b=wm(a.b)-ua()-3E5;return 0<b?b:0})}function Mm(a){a.A||a.u.b||(a.u.start(),G(a,"tokenChanged",a.$),jd(a,"tokenChanged",a.$))}function Nm(a){G(a,"tokenChanged",a.$);a.u.stop()}function Em(a,b){a.ya=b;M(a,"_lat",b)}function Om(a,b){Va(a.R,function(c){return c==b})} function Pm(a){for(var b=[],c=0;c<a.R.length;c++)b.push(a.R[c](a));return Fc(b).then(function(){return a})}function Qm(a){a.i&&!a.P&&(a.P=!0,Kl(a.i,a))}function Fm(a,b){N(a,{uid:b.uid,displayName:b.displayName||null,photoURL:b.photoURL||null,email:b.email||null,emailVerified:b.emailVerified||!1,phoneNumber:b.phoneNumber||null,isAnonymous:b.isAnonymous||!1,tenantId:b.tenantId||null,metadata:new Am(b.createdAt,b.lastLoginAt),providerData:[]});a.a.b=a.tenantId}M(Dm.prototype,"providerId","firebase"); function Rm(){}function Sm(a){return D().then(function(){if(a.A)throw new t("app-deleted");})}function Tm(a){return Pa(a.providerData,function(b){return b.providerId})}function Um(a,b){b&&(Vm(a,b.providerId),a.providerData.push(b))}function Vm(a,b){Va(a.providerData,function(c){return c.providerId==b})}function Wm(a,b,c){("uid"!=b||c)&&a.hasOwnProperty(b)&&M(a,b,c)} function Xm(a,b){a!=b&&(N(a,{uid:b.uid,displayName:b.displayName,photoURL:b.photoURL,email:b.email,emailVerified:b.emailVerified,phoneNumber:b.phoneNumber,isAnonymous:b.isAnonymous,tenantId:b.tenantId,providerData:[]}),b.metadata?M(a,"metadata",Bm(b.metadata)):M(a,"metadata",new Am),w(b.providerData,function(c){Um(a,c)}),ym(a.b,b.b),M(a,"refreshToken",a.b.a),pm(a.N,b.N.b))}k=Dm.prototype;k.reload=function(){var a=this;return R(this,Sm(this).then(function(){return Ym(a).then(function(){return Pm(a)}).then(Rm)}))}; function Ym(a){return a.I().then(function(b){var c=a.isAnonymous;return Zm(a,b).then(function(){c||Wm(a,"isAnonymous",!1);return b})})}k.nc=function(a){return this.I(a).then(function(b){return new cm(b)})};k.I=function(a){var b=this;return R(this,Sm(this).then(function(){return b.b.getToken(a)}).then(function(c){if(!c)throw new t("internal-error");c.accessToken!=b.ya&&(Em(b,c.accessToken),b.dispatchEvent(new nm("tokenChanged")));Wm(b,"refreshToken",c.refreshToken);return c.accessToken}))}; function rm(a,b){b[zg]&&a.ya!=b[zg]&&(xm(a.b,b),a.dispatchEvent(new nm("tokenChanged")),Em(a,b[zg]),Wm(a,"refreshToken",a.b.a))}function Zm(a,b){return O(a.a,Ej,{idToken:b}).then(q(a.Jc,a))} k.Jc=function(a){a=a.users;if(!a||!a.length)throw new t("internal-error");a=a[0];Fm(this,{uid:a.localId,displayName:a.displayName,photoURL:a.photoUrl,email:a.email,emailVerified:!!a.emailVerified,phoneNumber:a.phoneNumber,lastLoginAt:a.lastLoginAt,createdAt:a.createdAt,tenantId:a.tenantId});for(var b=$m(a),c=0;c<b.length;c++)Um(this,b[c]);Wm(this,"isAnonymous",!(this.email&&a.passwordHash)&&!(this.providerData&&this.providerData.length));this.dispatchEvent(new nm("userReloaded",{gd:a}))}; function $m(a){return(a=a.providerUserInfo)&&a.length?Pa(a,function(b){return new Cm(b.rawId,b.providerId,b.email,b.displayName,b.photoUrl,b.phoneNumber)}):[]}k.Kc=function(a){cf("firebase.User.prototype.reauthenticateAndRetrieveDataWithCredential is deprecated. Please use firebase.User.prototype.reauthenticateWithCredential instead.");return this.sb(a)}; k.sb=function(a){var b=this,c=null;return R(this,a.c(this.a,this.uid).then(function(d){rm(b,d);c=an(b,d,"reauthenticate");b.f=null;return b.reload()}).then(function(){return c}),!0)};function bn(a,b){return Ym(a).then(function(){if(Ta(Tm(a),b))return Pm(a).then(function(){throw new t("provider-already-linked");})})}k.Bc=function(a){cf("firebase.User.prototype.linkAndRetrieveDataWithCredential is deprecated. Please use firebase.User.prototype.linkWithCredential instead.");return this.pb(a)}; k.pb=function(a){var b=this,c=null;return R(this,bn(this,a.providerId).then(function(){return b.I()}).then(function(d){return a.b(b.a,d)}).then(function(d){c=an(b,d,"link");return cn(b,d)}).then(function(){return c}))};k.Cc=function(a,b){var c=this;return R(this,bn(this,"phone").then(function(){return bm(Lm(c),a,b,q(c.pb,c))}))};k.Lc=function(a,b){var c=this;return R(this,D().then(function(){return bm(Lm(c),a,b,q(c.sb,c))}),!0)}; function an(a,b,c){var d=mh(b);b=kg(b);return ff({user:a,credential:d,additionalUserInfo:b,operationType:c})}function cn(a,b){rm(a,b);return a.reload().then(function(){return a})}k.Ab=function(a){var b=this;return R(this,this.I().then(function(c){return b.a.Ab(c,a)}).then(function(c){rm(b,c);return b.reload()}))};k.dd=function(a){var b=this;return R(this,this.I().then(function(c){return a.b(b.a,c)}).then(function(c){rm(b,c);return b.reload()}))}; k.Bb=function(a){var b=this;return R(this,this.I().then(function(c){return b.a.Bb(c,a)}).then(function(c){rm(b,c);return b.reload()}))}; k.Cb=function(a){if(void 0===a.displayName&&void 0===a.photoURL)return Sm(this);var b=this;return R(this,this.I().then(function(c){return b.a.Cb(c,{displayName:a.displayName,photoUrl:a.photoURL})}).then(function(c){rm(b,c);Wm(b,"displayName",c.displayName||null);Wm(b,"photoURL",c.photoUrl||null);w(b.providerData,function(d){"password"===d.providerId&&(M(d,"displayName",b.displayName),M(d,"photoURL",b.photoURL))});return Pm(b)}).then(Rm))}; k.bd=function(a){var b=this;return R(this,Ym(this).then(function(c){return Ta(Tm(b),a)?nj(b.a,c,[a]).then(function(d){var e={};w(d.providerUserInfo||[],function(f){e[f.providerId]=!0});w(Tm(b),function(f){e[f]||Vm(b,f)});e[hh.PROVIDER_ID]||M(b,"phoneNumber",null);return Pm(b)}):Pm(b).then(function(){throw new t("no-such-provider");})}))}; k.delete=function(){var a=this;return R(this,this.I().then(function(b){return O(a.a,Bj,{idToken:b})}).then(function(){a.dispatchEvent(new nm("userDeleted"))})).then(function(){for(var b=0;b<a.G.length;b++)a.G[b].cancel("app-deleted");Im(a,null);Jm(a,null);Km(a,null);a.G=[];a.A=!0;Nm(a);M(a,"refreshToken",null);a.i&&Ll(a.i,a)})}; k.Eb=function(a,b){return"linkViaPopup"==a&&(this.h||null)==b&&this.g||"reauthViaPopup"==a&&(this.h||null)==b&&this.g||"linkViaRedirect"==a&&(this.ga||null)==b||"reauthViaRedirect"==a&&(this.ga||null)==b?!0:!1};k.ma=function(a,b,c,d){"linkViaPopup"!=a&&"reauthViaPopup"!=a||d!=(this.h||null)||(c&&this.O?this.O(c):b&&!c&&this.g&&this.g(b),this.c&&(this.c.cancel(),this.c=null),delete this.g,delete this.O)}; k.Fa=function(a,b){return"linkViaPopup"==a&&b==(this.h||null)?q(this.Jb,this):"reauthViaPopup"==a&&b==(this.h||null)?q(this.Kb,this):"linkViaRedirect"==a&&(this.ga||null)==b?q(this.Jb,this):"reauthViaRedirect"==a&&(this.ga||null)==b?q(this.Kb,this):null};k.Dc=function(a){var b=this;return dn(this,"linkViaPopup",a,function(){return bn(b,a.providerId).then(function(){return Pm(b)})},!1)};k.Mc=function(a){return dn(this,"reauthViaPopup",a,function(){return D()},!0)}; function dn(a,b,c,d,e){if(!Me())return E(new t("operation-not-supported-in-this-environment"));if(a.f&&!e)return E(a.f);var f=jg(c.providerId),g=Le(a.uid+":::"),h=null;(!Oe()||De())&&a.o&&c.isOAuthProvider&&(h=ak(a.o,a.l,a.m,b,c,null,g,firebase.SDK_VERSION||null,null,null,a.tenantId));var m=ue(h,f&&f.ua,f&&f.ta);d=d().then(function(){en(a);if(!e)return a.I().then(function(){})}).then(function(){return Ol(a.i,m,b,c,g,!!h,a.tenantId)}).then(function(){return new C(function(p,v){a.ma(b,null,new t("cancelled-popup-request"), a.h||null);a.g=p;a.O=v;a.h=g;a.c=Ql(a.i,a,b,m,g)})}).then(function(p){m&&te(m);return p?ff(p):null}).s(function(p){m&&te(m);throw p;});return R(a,d,e)}k.Ec=function(a){var b=this;return fn(this,"linkViaRedirect",a,function(){return bn(b,a.providerId)},!1)};k.Nc=function(a){return fn(this,"reauthViaRedirect",a,function(){return D()},!0)}; function fn(a,b,c,d,e){if(!Me())return E(new t("operation-not-supported-in-this-environment"));if(a.f&&!e)return E(a.f);var f=null,g=Le(a.uid+":::");d=d().then(function(){en(a);if(!e)return a.I().then(function(){})}).then(function(){a.ga=g;return Pm(a)}).then(function(h){a.ha&&(h=a.ha,h=h.b.set(gn,a.w(),h.a));return h}).then(function(){return Pl(a.i,b,c,g,a.tenantId)}).s(function(h){f=h;if(a.ha)return hn(a.ha);throw f;}).then(function(){if(f)throw f;});return R(a,d,e)} function en(a){if(!a.i||!a.P){if(a.i&&!a.P)throw new t("internal-error");throw new t("auth-domain-config-required");}}k.Jb=function(a,b,c,d){var e=this;this.c&&(this.c.cancel(),this.c=null);var f=null;c=this.I().then(function(g){return Dg(e.a,{requestUri:a,postBody:d,sessionId:b,idToken:g})}).then(function(g){f=an(e,g,"link");return cn(e,g)}).then(function(){return f});return R(this,c)}; k.Kb=function(a,b,c,d){var e=this;this.c&&(this.c.cancel(),this.c=null);var f=null,g=D().then(function(){return yg(Eg(e.a,{requestUri:a,sessionId:b,postBody:d,tenantId:c}),e.uid)}).then(function(h){f=an(e,h,"reauthenticate");rm(e,h);e.f=null;return e.reload()}).then(function(){return f});return R(this,g,!0)}; k.tb=function(a){var b=this,c=null;return R(this,this.I().then(function(d){c=d;return"undefined"===typeof a||kb(a)?{}:Yf(new Of(a))}).then(function(d){return b.a.tb(c,d)}).then(function(d){if(b.email!=d)return b.reload()}).then(function(){}))};k.Db=function(a,b){var c=this,d=null;return R(this,this.I().then(function(e){d=e;return"undefined"===typeof b||kb(b)?{}:Yf(new Of(b))}).then(function(e){return c.a.Db(d,a,e)}).then(function(e){if(c.email!=e)return c.reload()}).then(function(){}))}; function R(a,b,c){var d=jn(a,b,c);a.G.push(d);d.na(function(){Ua(a.G,d)});return d.s(function(e){var f=null;e&&"auth/multi-factor-auth-required"===e.code&&(f=hm(e.w(),Lm(a),q(a.ic,a)));throw f||e;})}k.ic=function(a){var b=null,c=this;a=yg(D(a),c.uid).then(function(d){b=an(c,d,"reauthenticate");rm(c,d);c.f=null;return c.reload()}).then(function(){return b});return R(this,a,!0)}; function jn(a,b,c){return a.f&&!c?(b.cancel(),E(a.f)):b.s(function(d){!d||"auth/user-disabled"!=d.code&&"auth/user-token-expired"!=d.code||(a.f||a.dispatchEvent(new nm("userInvalidated")),a.f=d);throw d;})}k.toJSON=function(){return this.w()}; k.w=function(){var a={uid:this.uid,displayName:this.displayName,photoURL:this.photoURL,email:this.email,emailVerified:this.emailVerified,phoneNumber:this.phoneNumber,isAnonymous:this.isAnonymous,tenantId:this.tenantId,providerData:[],apiKey:this.l,appName:this.m,authDomain:this.o,stsTokenManager:this.b.w(),redirectEventId:this.ga||null};this.metadata&&z(a,this.metadata.w());w(this.providerData,function(b){a.providerData.push(gf(b))});z(a,this.N.w());return a}; function kn(a){if(!a.apiKey)return null;var b={apiKey:a.apiKey,authDomain:a.authDomain,appName:a.appName,emulatorConfig:a.emulatorConfig},c={};if(a.stsTokenManager&&a.stsTokenManager.accessToken)c[zg]=a.stsTokenManager.accessToken,c.refreshToken=a.stsTokenManager.refreshToken||null;else return null;var d=new Dm(b,c,a);a.providerData&&w(a.providerData,function(e){e&&Um(d,ff(e))});a.redirectEventId&&(d.ga=a.redirectEventId);return d} function ln(a,b,c,d){var e=new Dm(a,b);c&&(e.ha=c);d&&Hm(e,d);return e.reload().then(function(){return e})}function mn(a,b,c,d){var e=a.b,f={};f[zg]=e.b&&e.b.toString();f.refreshToken=e.a;b=new Dm(b||{apiKey:a.l,authDomain:a.o,appName:a.m},f);c&&(b.ha=c);d&&Hm(b,d);Xm(b,a);return b};function nn(a){this.a=a;this.b=Qk()}var gn={name:"redirectUser",D:"session"};function hn(a){return Uk(a.b,gn,a.a)}function on(a,b){return a.b.get(gn,a.a).then(function(c){c&&b&&(c.authDomain=b);return kn(c||{})})};function pn(a){this.a=a;this.b=Qk();this.c=null;this.f=qn(this);this.b.addListener(rn("local"),this.a,q(this.g,this))}pn.prototype.g=function(){var a=this,b=rn("local");sn(this,function(){return D().then(function(){return a.c&&"local"!=a.c.D?a.b.get(b,a.a):null}).then(function(c){if(c)return tn(a,"local").then(function(){a.c=b})})})};function tn(a,b){var c=[],d;for(d in Mk)Mk[d]!==b&&c.push(Uk(a.b,rn(Mk[d]),a.a));c.push(Uk(a.b,un,a.a));return Ec(c)} function qn(a){var b=rn("local"),c=rn("session"),d=rn("none");return Tk(a.b,b,a.a).then(function(){return a.b.get(c,a.a)}).then(function(e){return e?c:a.b.get(d,a.a).then(function(f){return f?d:a.b.get(b,a.a).then(function(g){return g?b:a.b.get(un,a.a).then(function(h){return h?rn(h):b})})})}).then(function(e){a.c=e;return tn(a,e.D)}).s(function(){a.c||(a.c=b)})}var un={name:"persistence",D:"session"};function rn(a){return{name:"authUser",D:a}} pn.prototype.wb=function(a){var b=null,c=this;Nk(a);return sn(this,function(){return a!=c.c.D?c.b.get(c.c,c.a).then(function(d){b=d;return tn(c,a)}).then(function(){c.c=rn(a);if(b)return c.b.set(c.c,b,c.a)}):D()})};function vn(a){return sn(a,function(){return a.b.set(un,a.c.D,a.a)})}function wn(a,b){return sn(a,function(){return a.b.set(a.c,b.w(),a.a)})}function xn(a){return sn(a,function(){return Uk(a.b,a.c,a.a)})} function yn(a,b,c){return sn(a,function(){return a.b.get(a.c,a.a).then(function(d){d&&b&&(d.authDomain=b);d&&c&&(d.emulatorConfig=c);return kn(d||{})})})}function sn(a,b){a.f=a.f.then(b,b);return a.f};function zn(a){this.m=!1;M(this,"settings",new $l);M(this,"app",a);if(S(this).options&&S(this).options.apiKey)a=firebase.SDK_VERSION?Je(firebase.SDK_VERSION):null,this.a=new Ei(S(this).options&&S(this).options.apiKey,Aa(Ba),a);else throw new t("invalid-api-key");this.R=[];this.u=[];this.P=[];this.ac=firebase.INTERNAL.createSubscribe(q(this.yc,this));this.X=void 0;this.bc=firebase.INTERNAL.createSubscribe(q(this.zc,this));An(this,null);this.l=new pn(S(this).options.apiKey+":"+S(this).name);this.G= new nn(S(this).options.apiKey+":"+S(this).name);this.$=T(this,Bn(this));this.i=T(this,Cn(this));this.ba=!1;this.pa=q(this.Yc,this);this.Ba=q(this.da,this);this.ya=q(this.kc,this);this.za=q(this.vc,this);this.Aa=q(this.wc,this);this.b=null;Dn(this);this.INTERNAL={};this.INTERNAL["delete"]=q(this.delete,this);this.INTERNAL.logFramework=q(this.Fc,this);this.A=0;H.call(this);En(this);this.N=[];this.f=null}r(zn,H);function Fn(a){F.call(this,"languageCodeChanged");this.h=a}r(Fn,F); function Gn(a){F.call(this,"emulatorConfigChanged");this.c=a}r(Gn,F);function Hn(a){F.call(this,"frameworkChanged");this.f=a}r(Hn,F);k=zn.prototype;k.wb=function(a){a=this.l.wb(a);return T(this,a)};k.wa=function(a){this.aa===a||this.m||(this.aa=a,Ki(this.a,this.aa),this.dispatchEvent(new Fn(this.ka())))};k.ka=function(){return this.aa};k.ed=function(){var a=l.navigator;this.wa(a?a.languages&&a.languages[0]||a.language||a.userLanguage||null:null)}; k.fd=function(a){if(!this.f){if(!/^https?:\/\//.test(a))throw new t("argument-error","Emulator URL must start with a valid scheme (http:// or https://).");In();this.f={url:a};this.settings.hb=!0;Li(this.a,this.f);this.dispatchEvent(new Gn(this.f))}}; function In(){Xe("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials.");l.document&&ze().then(function(){var a=l.document.createElement("div");a.innerText="Running in emulator mode. Do not use with production credentials.";a.style.position="fixed";a.style.width="100%";a.style.backgroundColor="#ffffff";a.style.border=".1em solid #000000";a.style.color="#ff0000";a.style.bottom="0px";a.style.left="0px";a.style.margin="0px";a.style.zIndex= 1E4;a.style.textAlign="center";a.classList.add("firebase-emulator-warning");l.document.body.appendChild(a)})}k.Fc=function(a){this.N.push(a);Ni(this.a,firebase.SDK_VERSION?Je(firebase.SDK_VERSION,this.N):null);this.dispatchEvent(new Hn(this.N))};k.Ga=function(){return Xa(this.N)};k.xb=function(a){this.W===a||this.m||(this.W=a,this.a.b=this.W)};k.S=function(){return this.W}; function En(a){Object.defineProperty(a,"lc",{get:function(){return this.ka()},set:function(b){this.wa(b)},enumerable:!1});a.aa=null;Object.defineProperty(a,"ti",{get:function(){return this.S()},set:function(b){this.xb(b)},enumerable:!1});a.W=null}k.toJSON=function(){return{apiKey:S(this).options.apiKey,authDomain:S(this).options.authDomain,appName:S(this).name,currentUser:U(this)&&U(this).w()}};function Jn(a){return a.gb||E(new t("auth-domain-config-required"))} function Dn(a){var b=S(a).options.authDomain,c=S(a).options.apiKey;b&&Me()&&(a.gb=a.$.then(function(){if(!a.m){a.b=Sl(b,c,S(a).name,a.f);Kl(a.b,a);U(a)&&Qm(U(a));if(a.o){Qm(a.o);var d=a.o;d.wa(a.ka());Im(d,a);d=a.o;Hm(d,a.N);Km(d,a);d=a.o;Li(d.a,a.f);Jm(d,a);a.o=null}return a.b}}))}k.Eb=function(a,b){switch(a){case "unknown":case "signInViaRedirect":return!0;case "signInViaPopup":return this.h==b&&!!this.g;default:return!1}}; k.ma=function(a,b,c,d){"signInViaPopup"==a&&this.h==d&&(c&&this.O?this.O(c):b&&!c&&this.g&&this.g(b),this.c&&(this.c.cancel(),this.c=null),delete this.g,delete this.O)};k.Fa=function(a,b){return"signInViaRedirect"==a||"signInViaPopup"==a&&this.h==b&&this.g?q(this.hc,this):null};k.hc=function(a,b,c,d){var e=this,f={requestUri:a,postBody:d,sessionId:b,tenantId:c};this.c&&(this.c.cancel(),this.c=null);return e.$.then(function(){return Kn(e,Bg(e.a,f))})}; k.Wc=function(a){if(!Me())return E(new t("operation-not-supported-in-this-environment"));var b=this,c=jg(a.providerId),d=Le(),e=null;(!Oe()||De())&&S(this).options.authDomain&&a.isOAuthProvider&&(e=ak(S(this).options.authDomain,S(this).options.apiKey,S(this).name,"signInViaPopup",a,null,d,firebase.SDK_VERSION||null,null,null,this.S(),this.f));var f=ue(e,c&&c.ua,c&&c.ta);c=Jn(this).then(function(g){return Ol(g,f,"signInViaPopup",a,d,!!e,b.S())}).then(function(){return new C(function(g,h){b.ma("signInViaPopup", null,new t("cancelled-popup-request"),b.h);b.g=g;b.O=h;b.h=d;b.c=Ql(b.b,b,"signInViaPopup",f,d)})}).then(function(g){f&&te(f);return g?ff(g):null}).s(function(g){f&&te(f);throw g;});return T(this,c)};k.Xc=function(a){if(!Me())return E(new t("operation-not-supported-in-this-environment"));var b=this,c=Jn(this).then(function(){return vn(b.l)}).then(function(){return Pl(b.b,"signInViaRedirect",a,void 0,b.S())});return T(this,c)}; function Ln(a){if(!Me())return E(new t("operation-not-supported-in-this-environment"));var b=Jn(a).then(function(){return a.b.qa()}).then(function(c){return c?ff(c):null});return T(a,b)}k.qa=function(){var a=this;return Ln(this).then(function(b){a.b&&Vl(a.b.b);return b}).s(function(b){a.b&&Vl(a.b.b);throw b;})}; k.cd=function(a){if(!a)return E(new t("null-user"));if(this.W!=a.tenantId)return E(new t("tenant-id-mismatch"));var b=this,c={};c.apiKey=S(this).options.apiKey;c.authDomain=S(this).options.authDomain;c.appName=S(this).name;var d=mn(a,c,b.G,b.Ga());return T(this,this.i.then(function(){if(S(b).options.apiKey!=a.l)return d.reload()}).then(function(){if(U(b)&&a.uid==U(b).uid)return Xm(U(b),a),b.da(a);An(b,d);Qm(d);return b.da(d)}).then(function(){Mn(b)}))}; function Nn(a,b){var c={};c.apiKey=S(a).options.apiKey;c.authDomain=S(a).options.authDomain;c.appName=S(a).name;a.f&&(c.emulatorConfig=a.f);return a.$.then(function(){return ln(c,b,a.G,a.Ga())}).then(function(d){if(U(a)&&d.uid==U(a).uid)return Xm(U(a),d),a.da(d);An(a,d);Qm(d);return a.da(d)}).then(function(){Mn(a)})} function An(a,b){U(a)&&(Om(U(a),a.Ba),G(U(a),"tokenChanged",a.ya),G(U(a),"userDeleted",a.za),G(U(a),"userInvalidated",a.Aa),Nm(U(a)));b&&(b.R.push(a.Ba),jd(b,"tokenChanged",a.ya),jd(b,"userDeleted",a.za),jd(b,"userInvalidated",a.Aa),0<a.A&&Mm(b));M(a,"currentUser",b);b&&(b.wa(a.ka()),Im(b,a),Hm(b,a.N),Km(b,a),Li(b.a,a.f),Jm(b,a))}k.zb=function(){var a=this,b=this.i.then(function(){a.b&&Vl(a.b.b);if(!U(a))return D();An(a,null);return xn(a.l).then(function(){Mn(a)})});return T(this,b)}; function On(a){var b=on(a.G,S(a).options.authDomain).then(function(c){if(a.o=c)c.ha=a.G;return hn(a.G)});return T(a,b)}function Bn(a){var b=S(a).options.authDomain,c=On(a).then(function(){return yn(a.l,b,a.f)}).then(function(d){return d?(d.ha=a.G,a.o&&(a.o.ga||null)==(d.ga||null)?d:d.reload().then(function(){return wn(a.l,d).then(function(){return d})}).s(function(e){return"auth/network-request-failed"==e.code?d:xn(a.l)})):null}).then(function(d){An(a,d||null)});return T(a,c)} function Cn(a){return a.$.then(function(){return Ln(a)}).s(function(){}).then(function(){if(!a.m)return a.pa()}).s(function(){}).then(function(){if(!a.m){a.ba=!0;var b=a.l;b.b.addListener(rn("local"),b.a,a.pa)}})} k.Yc=function(){var a=this;return yn(this.l,S(this).options.authDomain).then(function(b){if(!a.m){var c;if(c=U(a)&&b){c=U(a).uid;var d=b.uid;c=void 0===c||null===c||""===c||void 0===d||null===d||""===d?!1:c==d}if(c)return Xm(U(a),b),U(a).I();if(U(a)||b)An(a,b),b&&(Qm(b),b.ha=a.G),a.b&&Kl(a.b,a),Mn(a)}})};k.da=function(a){return wn(this.l,a)};k.kc=function(){Mn(this);this.da(U(this))};k.vc=function(){this.zb()};k.wc=function(){this.zb()}; function Kn(a,b){var c=null,d=null;return T(a,b.then(function(e){c=mh(e);d=kg(e);return Nn(a,e)},function(e){var f=null;e&&"auth/multi-factor-auth-required"===e.code&&(f=hm(e.w(),a,q(a.jc,a)));throw f||e;}).then(function(){return ff({user:U(a),credential:c,additionalUserInfo:d,operationType:"signIn"})}))}k.jc=function(a){var b=this;return this.i.then(function(){return Kn(b,D(a))})};k.yc=function(a){var b=this;this.addAuthTokenListener(function(){a.next(U(b))})}; k.zc=function(a){var b=this;Pn(this,function(){a.next(U(b))})};k.Hc=function(a,b,c){var d=this;this.ba&&Promise.resolve().then(function(){"function"===typeof a?a(U(d)):"function"===typeof a.next&&a.next(U(d))});return this.ac(a,b,c)};k.Gc=function(a,b,c){var d=this;this.ba&&Promise.resolve().then(function(){d.X=d.getUid();"function"===typeof a?a(U(d)):"function"===typeof a.next&&a.next(U(d))});return this.bc(a,b,c)}; k.mc=function(a){var b=this,c=this.i.then(function(){return U(b)?U(b).I(a).then(function(d){return{accessToken:d}}):null});return T(this,c)};k.Sc=function(a){var b=this;return this.i.then(function(){return Kn(b,O(b.a,Gj,{token:a}))}).then(function(c){var d=c.user;Wm(d,"isAnonymous",!1);b.da(d);return c})};k.Tc=function(a,b){var c=this;return this.i.then(function(){return Kn(c,O(c.a,Xg,{email:a,password:b}))})}; k.dc=function(a,b){var c=this;return this.i.then(function(){return Kn(c,O(c.a,Aj,{email:a,password:b}))})};k.Za=function(a){var b=this;return this.i.then(function(){return Kn(b,a.ja(b.a))})};k.Rc=function(a){cf("firebase.auth.Auth.prototype.signInAndRetrieveDataWithCredential is deprecated. Please use firebase.auth.Auth.prototype.signInWithCredential instead.");return this.Za(a)}; k.yb=function(){var a=this;return this.i.then(function(){var b=U(a);if(b&&b.isAnonymous){var c=ff({providerId:null,isNewUser:!1});return ff({user:b,credential:null,additionalUserInfo:c,operationType:"signIn"})}return Kn(a,a.a.yb()).then(function(d){var e=d.user;Wm(e,"isAnonymous",!0);a.da(e);return d})})};function S(a){return a.app}function U(a){return a.currentUser}k.getUid=function(){return U(this)&&U(this).uid||null};function Qn(a){return U(a)&&U(a)._lat||null} function Mn(a){if(a.ba){for(var b=0;b<a.u.length;b++)if(a.u[b])a.u[b](Qn(a));if(a.X!==a.getUid()&&a.P.length)for(a.X=a.getUid(),b=0;b<a.P.length;b++)if(a.P[b])a.P[b](Qn(a))}}k.cc=function(a){this.addAuthTokenListener(a);this.A++;0<this.A&&U(this)&&Mm(U(this))};k.Oc=function(a){var b=this;w(this.u,function(c){c==a&&b.A--});0>this.A&&(this.A=0);0==this.A&&U(this)&&Nm(U(this));this.removeAuthTokenListener(a)}; k.addAuthTokenListener=function(a){var b=this;this.u.push(a);T(this,this.i.then(function(){b.m||Ta(b.u,a)&&a(Qn(b))}))};k.removeAuthTokenListener=function(a){Va(this.u,function(b){return b==a})};function Pn(a,b){a.P.push(b);T(a,a.i.then(function(){!a.m&&Ta(a.P,b)&&a.X!==a.getUid()&&(a.X=a.getUid(),b(Qn(a)))}))} k.delete=function(){this.m=!0;for(var a=0;a<this.R.length;a++)this.R[a].cancel("app-deleted");this.R=[];this.l&&(a=this.l,a.b.removeListener(rn("local"),a.a,this.pa));this.b&&(Ll(this.b,this),Vl(this.b.b));return Promise.resolve()};function T(a,b){a.R.push(b);b.na(function(){Ua(a.R,b)});return b}k.gc=function(a){return T(this,Xi(this.a,a))};k.Ac=function(a){return!!bh(a)}; k.vb=function(a,b){var c=this;return T(this,D().then(function(){var d=new Of(b);if(!d.c)throw new t("argument-error",Wf+" must be true when sending sign in link to email");return Yf(d)}).then(function(d){return c.a.vb(a,d)}).then(function(){}))};k.hd=function(a){return this.Qa(a).then(function(b){return b.data.email})};k.mb=function(a,b){return T(this,this.a.mb(a,b).then(function(){}))};k.Qa=function(a){return T(this,this.a.Qa(a).then(function(b){return new rf(b)}))}; k.ib=function(a){return T(this,this.a.ib(a).then(function(){}))};k.ub=function(a,b){var c=this;return T(this,D().then(function(){return"undefined"===typeof b||kb(b)?{}:Yf(new Of(b))}).then(function(d){return c.a.ub(a,d)}).then(function(){}))};k.Vc=function(a,b){return T(this,bm(this,a,b,q(this.Za,this)))}; k.Uc=function(a,b){var c=this;return T(this,D().then(function(){var d=b||me(),e=ah(a,d);d=bh(d);if(!d)throw new t("argument-error","Invalid email link!");if(d.tenantId!==c.S())throw new t("tenant-id-mismatch");return c.Za(e)}))};function Rn(){}Rn.prototype.render=function(){};Rn.prototype.reset=function(){};Rn.prototype.getResponse=function(){};Rn.prototype.execute=function(){};function Sn(){this.a={};this.b=1E12}var Tn=null;Sn.prototype.render=function(a,b){this.a[this.b.toString()]=new Un(a,b);return this.b++};Sn.prototype.reset=function(a){var b=Vn(this,a);a=Wn(a);b&&a&&(b.delete(),delete this.a[a])};Sn.prototype.getResponse=function(a){return(a=Vn(this,a))?a.getResponse():null};Sn.prototype.execute=function(a){(a=Vn(this,a))&&a.execute()};function Vn(a,b){return(b=Wn(b))?a.a[b]||null:null}function Wn(a){return(a="undefined"===typeof a?1E12:a)?a.toString():null} function Un(a,b){this.g=!1;this.c=b;this.a=this.b=null;this.h="invisible"!==this.c.size;this.f=fc(a);var c=this;this.i=function(){c.execute()};this.h?this.execute():jd(this.f,"click",this.i)}Un.prototype.getResponse=function(){Xn(this);return this.b}; Un.prototype.execute=function(){Xn(this);var a=this;this.a||(this.a=setTimeout(function(){a.b=He();var b=a.c.callback,c=a.c["expired-callback"];if(b)try{b(a.b)}catch(d){}a.a=setTimeout(function(){a.a=null;a.b=null;if(c)try{c()}catch(d){}a.h&&a.execute()},6E4)},500))};Un.prototype.delete=function(){Xn(this);this.g=!0;clearTimeout(this.a);this.a=null;G(this.f,"click",this.i)};function Xn(a){if(a.g)throw Error("reCAPTCHA mock was already deleted!");};function Yn(){}M(Yn,"FACTOR_ID","phone");function Zn(){}Zn.prototype.g=function(){Tn||(Tn=new Sn);return D(Tn)};Zn.prototype.c=function(){};var $n=null;function ao(){this.b=l.grecaptcha?Infinity:0;this.f=null;this.a="__rcb"+Math.floor(1E6*Math.random()).toString()}var bo=new ob(pb,"https://www.google.com/recaptcha/api.js?onload=%{onload}&render=explicit&hl=%{hl}"),co=new Ue(3E4,6E4); ao.prototype.g=function(a){var b=this;return new C(function(c,d){var e=setTimeout(function(){d(new t("network-request-failed"))},co.get());if(!l.grecaptcha||a!==b.f&&!b.b){l[b.a]=function(){if(l.grecaptcha){b.f=a;var g=l.grecaptcha.render;l.grecaptcha.render=function(h,m){h=g(h,m);b.b++;return h};clearTimeout(e);c(l.grecaptcha)}else clearTimeout(e),d(new t("internal-error"));delete l[b.a]};var f=xb(bo,{onload:b.a,hl:a||""});D(xi(f)).s(function(){clearTimeout(e);d(new t("internal-error","Unable to load external reCAPTCHA dependencies!"))})}else clearTimeout(e), c(l.grecaptcha)})};ao.prototype.c=function(){this.b--};var eo=null;function fo(a,b,c,d,e,f,g){M(this,"type","recaptcha");this.c=this.f=null;this.A=!1;this.m=b;this.g=null;g?($n||($n=new Zn),g=$n):(eo||(eo=new ao),g=eo);this.v=g;this.a=c||{theme:"light",type:"image"};this.h=[];if(this.a[go])throw new t("argument-error","sitekey should not be provided for reCAPTCHA as one is automatically provisioned for the current project.");this.i="invisible"===this.a[ho];if(!l.document)throw new t("operation-not-supported-in-this-environment","RecaptchaVerifier is only supported in a browser HTTP/HTTPS environment with DOM support."); if(!fc(b)||!this.i&&fc(b).hasChildNodes())throw new t("argument-error","reCAPTCHA container is either not found or already contains inner elements!");this.o=new Ei(a,f||null,e||null);this.u=d||function(){return null};var h=this;this.l=[];var m=this.a[io];this.a[io]=function(v){jo(h,v);if("function"===typeof m)m(v);else if("string"===typeof m){var B=L(m,l);"function"===typeof B&&B(v)}};var p=this.a[ko];this.a[ko]=function(){jo(h,null);if("function"===typeof p)p();else if("string"===typeof p){var v= L(p,l);"function"===typeof v&&v()}}}var io="callback",ko="expired-callback",go="sitekey",ho="size";function jo(a,b){for(var c=0;c<a.l.length;c++)try{a.l[c](b)}catch(d){}}function lo(a,b){Va(a.l,function(c){return c==b})}function mo(a,b){a.h.push(b);b.na(function(){Ua(a.h,b)});return b}k=fo.prototype; k.Ia=function(){var a=this;return this.f?this.f:this.f=mo(this,D().then(function(){if(Ne()&&!Ee())return ze();throw new t("operation-not-supported-in-this-environment","RecaptchaVerifier is only supported in a browser HTTP/HTTPS environment.");}).then(function(){return a.v.g(a.u())}).then(function(b){a.g=b;return O(a.o,Fj,{})}).then(function(b){a.a[go]=b.recaptchaSiteKey}).s(function(b){a.f=null;throw b;}))}; k.render=function(){no(this);var a=this;return mo(this,this.Ia().then(function(){if(null===a.c){var b=a.m;if(!a.i){var c=fc(b);b=ic("DIV");c.appendChild(b)}a.c=a.g.render(b,a.a)}return a.c}))};k.verify=function(){no(this);var a=this;return mo(this,this.render().then(function(b){return new C(function(c){var d=a.g.getResponse(b);if(d)c(d);else{var e=function(f){f&&(lo(a,e),c(f))};a.l.push(e);a.i&&a.g.execute(a.c)}})}))};k.reset=function(){no(this);null!==this.c&&this.g.reset(this.c)}; function no(a){if(a.A)throw new t("internal-error","RecaptchaVerifier instance has been destroyed.");}k.clear=function(){no(this);this.A=!0;this.v.c();for(var a=0;a<this.h.length;a++)this.h[a].cancel("RecaptchaVerifier instance has been destroyed.");if(!this.i){a=fc(this.m);for(var b;b=a.firstChild;)a.removeChild(b)}}; function oo(a,b,c){var d=!1;try{this.b=c||firebase.app()}catch(g){throw new t("argument-error","No firebase.app.App instance is currently initialized.");}if(this.b.options&&this.b.options.apiKey)c=this.b.options.apiKey;else throw new t("invalid-api-key");var e=this,f=null;try{f=this.b.auth().Ga()}catch(g){}try{d=this.b.auth().settings.appVerificationDisabledForTesting}catch(g){}f=firebase.SDK_VERSION?Je(firebase.SDK_VERSION,f):null;fo.call(this,c,a,b,function(){try{var g=e.b.auth().ka()}catch(h){g= null}return g},f,Aa(Ba),d)}r(oo,fo);function po(a,b,c,d){a:{c=Array.prototype.slice.call(c);var e=0;for(var f=!1,g=0;g<b.length;g++)if(b[g].optional)f=!0;else{if(f)throw new t("internal-error","Argument validator encountered a required argument after an optional argument.");e++}f=b.length;if(c.length<e||f<c.length)d="Expected "+(e==f?1==e?"1 argument":e+" arguments":e+"-"+f+" arguments")+" but got "+c.length+".";else{for(e=0;e<c.length;e++)if(f=b[e].optional&&void 0===c[e],!b[e].K(c[e])&&!f){b=b[e];if(0>e||e>=qo.length)throw new t("internal-error", "Argument validator received an unsupported number of arguments.");c=qo[e];d=(d?"":c+" argument ")+(b.name?'"'+b.name+'" ':"")+"must be "+b.J+".";break a}d=null}}if(d)throw new t("argument-error",a+" failed: "+d);}var qo="First Second Third Fourth Fifth Sixth Seventh Eighth Ninth".split(" ");function V(a,b){return{name:a||"",J:"a valid string",optional:!!b,K:function(c){return"string"===typeof c}}} function ro(a,b){return{name:a||"",J:"a boolean",optional:!!b,K:function(c){return"boolean"===typeof c}}}function W(a,b){return{name:a||"",J:"a valid object",optional:!!b,K:n}}function so(a,b){return{name:a||"",J:"a function",optional:!!b,K:function(c){return"function"===typeof c}}}function to(a,b){return{name:a||"",J:"null",optional:!!b,K:function(c){return null===c}}}function uo(){return{name:"",J:"an HTML element",optional:!1,K:function(a){return!!(a&&a instanceof Element)}}} function vo(){return{name:"auth",J:"an instance of Firebase Auth",optional:!0,K:function(a){return!!(a&&a instanceof zn)}}}function wo(){return{name:"app",J:"an instance of Firebase App",optional:!0,K:function(a){return!!(a&&a instanceof firebase.app.App)}}}function xo(a){return{name:a?a+"Credential":"credential",J:a?"a valid "+a+" credential":"a valid credential",optional:!1,K:function(b){if(!b)return!1;var c=!a||b.providerId===a;return!(!b.ja||!c)}}} function yo(){return{name:"multiFactorAssertion",J:"a valid multiFactorAssertion",optional:!1,K:function(a){return a?!!a.rb:!1}}}function zo(){return{name:"authProvider",J:"a valid Auth provider",optional:!1,K:function(a){return!!(a&&a.providerId&&a.hasOwnProperty&&a.hasOwnProperty("isOAuthProvider"))}}}function Ao(a,b){return n(a)&&"string"===typeof a.type&&a.type===b&&"function"===typeof a.Ha}function Bo(a){return n(a)&&"string"===typeof a.uid} function Co(){return{name:"applicationVerifier",J:"an implementation of firebase.auth.ApplicationVerifier",optional:!1,K:function(a){return!(!a||"string"!==typeof a.type||"function"!==typeof a.verify)}}}function X(a,b,c,d){return{name:c||"",J:a.J+" or "+b.J,optional:!!d,K:function(e){return a.K(e)||b.K(e)}}};function Y(a,b){for(var c in b){var d=b[c].name;a[d]=Do(d,a[c],b[c].j)}}function Eo(a,b){for(var c in b){var d=b[c].name;d!==c&&Object.defineProperty(a,d,{get:ta(function(e){return this[e]},c),set:ta(function(e,f,g,h){po(e,[g],[h],!0);this[f]=h},d,c,b[c].jb),enumerable:!0})}}function Z(a,b,c,d){a[b]=Do(b,c,d)} function Do(a,b,c){function d(){var g=Array.prototype.slice.call(arguments);po(e,c,g);return b.apply(this,g)}if(!c)return b;var e=Fo(a),f;for(f in b)d[f]=b[f];for(f in b.prototype)d.prototype[f]=b.prototype[f];return d}function Fo(a){a=a.split(".");return a[a.length-1]};Y(zn.prototype,{ib:{name:"applyActionCode",j:[V("code")]},Qa:{name:"checkActionCode",j:[V("code")]},mb:{name:"confirmPasswordReset",j:[V("code"),V("newPassword")]},dc:{name:"createUserWithEmailAndPassword",j:[V("email"),V("password")]},gc:{name:"fetchSignInMethodsForEmail",j:[V("email")]},qa:{name:"getRedirectResult",j:[]},Ac:{name:"isSignInWithEmailLink",j:[V("emailLink")]},Gc:{name:"onAuthStateChanged",j:[X(W(),so(),"nextOrObserver"),so("opt_error",!0),so("opt_completed",!0)]},Hc:{name:"onIdTokenChanged", j:[X(W(),so(),"nextOrObserver"),so("opt_error",!0),so("opt_completed",!0)]},ub:{name:"sendPasswordResetEmail",j:[V("email"),X(W("opt_actionCodeSettings",!0),to(null,!0),"opt_actionCodeSettings",!0)]},vb:{name:"sendSignInLinkToEmail",j:[V("email"),W("actionCodeSettings")]},wb:{name:"setPersistence",j:[V("persistence")]},Rc:{name:"signInAndRetrieveDataWithCredential",j:[xo()]},yb:{name:"signInAnonymously",j:[]},Za:{name:"signInWithCredential",j:[xo()]},Sc:{name:"signInWithCustomToken",j:[V("token")]}, Tc:{name:"signInWithEmailAndPassword",j:[V("email"),V("password")]},Uc:{name:"signInWithEmailLink",j:[V("email"),V("emailLink",!0)]},Vc:{name:"signInWithPhoneNumber",j:[V("phoneNumber"),Co()]},Wc:{name:"signInWithPopup",j:[zo()]},Xc:{name:"signInWithRedirect",j:[zo()]},cd:{name:"updateCurrentUser",j:[X(function(a){return{name:"user",J:"an instance of Firebase User",optional:!!a,K:function(b){return!!(b&&b instanceof Dm)}}}(),to(),"user")]},zb:{name:"signOut",j:[]},toJSON:{name:"toJSON",j:[V(null, !0)]},ed:{name:"useDeviceLanguage",j:[]},fd:{name:"useEmulator",j:[V("url")]},hd:{name:"verifyPasswordResetCode",j:[V("code")]}});Eo(zn.prototype,{lc:{name:"languageCode",jb:X(V(),to(),"languageCode")},ti:{name:"tenantId",jb:X(V(),to(),"tenantId")}});zn.Persistence=Mk;zn.Persistence.LOCAL="local";zn.Persistence.SESSION="session";zn.Persistence.NONE="none"; Y(Dm.prototype,{"delete":{name:"delete",j:[]},nc:{name:"getIdTokenResult",j:[ro("opt_forceRefresh",!0)]},I:{name:"getIdToken",j:[ro("opt_forceRefresh",!0)]},Bc:{name:"linkAndRetrieveDataWithCredential",j:[xo()]},pb:{name:"linkWithCredential",j:[xo()]},Cc:{name:"linkWithPhoneNumber",j:[V("phoneNumber"),Co()]},Dc:{name:"linkWithPopup",j:[zo()]},Ec:{name:"linkWithRedirect",j:[zo()]},Kc:{name:"reauthenticateAndRetrieveDataWithCredential",j:[xo()]},sb:{name:"reauthenticateWithCredential",j:[xo()]},Lc:{name:"reauthenticateWithPhoneNumber", j:[V("phoneNumber"),Co()]},Mc:{name:"reauthenticateWithPopup",j:[zo()]},Nc:{name:"reauthenticateWithRedirect",j:[zo()]},reload:{name:"reload",j:[]},tb:{name:"sendEmailVerification",j:[X(W("opt_actionCodeSettings",!0),to(null,!0),"opt_actionCodeSettings",!0)]},toJSON:{name:"toJSON",j:[V(null,!0)]},bd:{name:"unlink",j:[V("provider")]},Ab:{name:"updateEmail",j:[V("email")]},Bb:{name:"updatePassword",j:[V("password")]},dd:{name:"updatePhoneNumber",j:[xo("phone")]},Cb:{name:"updateProfile",j:[W("profile")]}, Db:{name:"verifyBeforeUpdateEmail",j:[V("email"),X(W("opt_actionCodeSettings",!0),to(null,!0),"opt_actionCodeSettings",!0)]}});Y(Sn.prototype,{execute:{name:"execute"},render:{name:"render"},reset:{name:"reset"},getResponse:{name:"getResponse"}});Y(Rn.prototype,{execute:{name:"execute"},render:{name:"render"},reset:{name:"reset"},getResponse:{name:"getResponse"}});Y(C.prototype,{na:{name:"finally"},s:{name:"catch"},then:{name:"then"}}); Eo($l.prototype,{appVerificationDisabled:{name:"appVerificationDisabledForTesting",jb:ro("appVerificationDisabledForTesting")}});Y(am.prototype,{confirm:{name:"confirm",j:[V("verificationCode")]}});Z(xg,"fromJSON",function(a){a="string"===typeof a?JSON.parse(a):a;for(var b,c=[Ig,$g,gh,Fg],d=0;d<c.length;d++)if(b=c[d](a))return b;return null},[X(V(),W(),"json")]);Z(Vg,"credential",function(a,b){return new Ug(a,b)},[V("email"),V("password")]);Y(Ug.prototype,{w:{name:"toJSON",j:[V(null,!0)]}}); Y(Mg.prototype,{Ca:{name:"addScope",j:[V("scope")]},Ka:{name:"setCustomParameters",j:[W("customOAuthParameters")]}});Z(Mg,"credential",Ng,[X(V(),W(),"token")]);Z(Vg,"credentialWithLink",ah,[V("email"),V("emailLink")]);Y(Og.prototype,{Ca:{name:"addScope",j:[V("scope")]},Ka:{name:"setCustomParameters",j:[W("customOAuthParameters")]}});Z(Og,"credential",Pg,[X(V(),W(),"token")]);Y(Qg.prototype,{Ca:{name:"addScope",j:[V("scope")]},Ka:{name:"setCustomParameters",j:[W("customOAuthParameters")]}}); Z(Qg,"credential",Rg,[X(V(),X(W(),to()),"idToken"),X(V(),to(),"accessToken",!0)]);Y(Sg.prototype,{Ka:{name:"setCustomParameters",j:[W("customOAuthParameters")]}});Z(Sg,"credential",Tg,[X(V(),W(),"token"),V("secret",!0)]);Y(Lg.prototype,{Ca:{name:"addScope",j:[V("scope")]},credential:{name:"credential",j:[X(V(),X(W(),to()),"optionsOrIdToken"),X(V(),to(),"accessToken",!0)]},Ka:{name:"setCustomParameters",j:[W("customOAuthParameters")]}});Y(Gg.prototype,{w:{name:"toJSON",j:[V(null,!0)]}}); Y(Ag.prototype,{w:{name:"toJSON",j:[V(null,!0)]}});Z(hh,"credential",lh,[V("verificationId"),V("verificationCode")]); Y(hh.prototype,{eb:{name:"verifyPhoneNumber",j:[X(V(),function(a,b){return{name:a||"phoneInfoOptions",J:"valid phone info options",optional:!!b,K:function(c){return c?c.session&&c.phoneNumber?Ao(c.session,vg)&&"string"===typeof c.phoneNumber:c.session&&c.multiFactorHint?Ao(c.session,wg)&&Bo(c.multiFactorHint):c.session&&c.multiFactorUid?Ao(c.session,wg)&&"string"===typeof c.multiFactorUid:c.phoneNumber?"string"===typeof c.phoneNumber:!1:!1}}}(),"phoneInfoOptions"),Co()]}}); Y(ch.prototype,{w:{name:"toJSON",j:[V(null,!0)]}});Y(t.prototype,{toJSON:{name:"toJSON",j:[V(null,!0)]}});Y(uh.prototype,{toJSON:{name:"toJSON",j:[V(null,!0)]}});Y(th.prototype,{toJSON:{name:"toJSON",j:[V(null,!0)]}});Y(gm.prototype,{toJSON:{name:"toJSON",j:[V(null,!0)]}});Y(dm.prototype,{Qc:{name:"resolveSignIn",j:[yo()]}}); Y(om.prototype,{Qb:{name:"getSession",j:[]},ec:{name:"enroll",j:[yo(),V("displayName",!0)]},ad:{name:"unenroll",j:[X({name:"multiFactorInfo",J:"a valid multiFactorInfo",optional:!1,K:Bo},V(),"multiFactorInfoIdentifier")]}});Y(oo.prototype,{clear:{name:"clear",j:[]},render:{name:"render",j:[]},verify:{name:"verify",j:[]}});Z(Ff,"parseLink",Nf,[V("link")]);Z(Yn,"assertion",function(a){return new mm(a)},[xo("phone")]); (function(){if("undefined"!==typeof firebase&&firebase.INTERNAL&&firebase.INTERNAL.registerComponent){var a={ActionCodeInfo:{Operation:{EMAIL_SIGNIN:wf,PASSWORD_RESET:"PASSWORD_RESET",RECOVER_EMAIL:"RECOVER_EMAIL",REVERT_SECOND_FACTOR_ADDITION:yf,VERIFY_AND_CHANGE_EMAIL:xf,VERIFY_EMAIL:"VERIFY_EMAIL"}},Auth:zn,AuthCredential:xg,Error:t};Z(a,"EmailAuthProvider",Vg,[]);Z(a,"FacebookAuthProvider",Mg,[]);Z(a,"GithubAuthProvider",Og,[]);Z(a,"GoogleAuthProvider",Qg,[]);Z(a,"TwitterAuthProvider",Sg,[]); Z(a,"OAuthProvider",Lg,[V("providerId")]);Z(a,"SAMLAuthProvider",Kg,[V("providerId")]);Z(a,"PhoneAuthProvider",hh,[vo()]);Z(a,"RecaptchaVerifier",oo,[X(V(),uo(),"recaptchaContainer"),W("recaptchaParameters",!0),wo()]);Z(a,"ActionCodeURL",Ff,[]);Z(a,"PhoneMultiFactorGenerator",Yn,[]);firebase.INTERNAL.registerComponent({name:"auth",instanceFactory:function(b){b=b.getProvider("app").getImmediate();return new zn(b)},multipleInstances:!1,serviceProps:a,instantiationMode:"LAZY",type:"PUBLIC"});firebase.INTERNAL.registerComponent({name:"auth-internal", instanceFactory:function(b){b=b.getProvider("auth").getImmediate();return{getUid:q(b.getUid,b),getToken:q(b.mc,b),addAuthTokenListener:q(b.cc,b),removeAuthTokenListener:q(b.Oc,b)}},multipleInstances:!1,instantiationMode:"LAZY",type:"PRIVATE"});firebase.registerVersion("@firebase/auth","0.15.0");firebase.INTERNAL.extendNamespace({User:Dm})}else throw Error("Cannot find the firebase namespace; be sure to include firebase-app.js before this library.");})();}).apply(typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : typeof window !== 'undefined' ? window : {}); //# sourceMappingURL=auth.js.map /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__("./node_modules/webpack/buildin/global.js"))) /***/ }), /***/ "./node_modules/@firebase/database/dist/index.cjs.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(process) { Object.defineProperty(exports, '__esModule', { value: true }); var firebase = __webpack_require__("./node_modules/@firebase/app/dist/index.cjs.js"); var tslib = __webpack_require__("./node_modules/@firebase/database/node_modules/tslib/tslib.es6.js"); var util = __webpack_require__("./node_modules/@firebase/database/node_modules/@firebase/util/dist/index.cjs.js"); var logger$1 = __webpack_require__("./node_modules/@firebase/logger/dist/index.esm.js"); var component = __webpack_require__("./node_modules/@firebase/database/node_modules/@firebase/component/dist/index.cjs.js"); function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } var firebase__default = /*#__PURE__*/_interopDefaultLegacy(firebase); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Wraps a DOM Storage object and: * - automatically encode objects as JSON strings before storing them to allow us to store arbitrary types. * - prefixes names with "firebase:" to avoid collisions with app data. * * We automatically (see storage.js) create two such wrappers, one for sessionStorage, * and one for localStorage. * * @constructor */ var DOMStorageWrapper = /** @class */ (function () { /** * @param {Storage} domStorage_ The underlying storage object (e.g. localStorage or sessionStorage) */ function DOMStorageWrapper(domStorage_) { this.domStorage_ = domStorage_; // Use a prefix to avoid collisions with other stuff saved by the app. this.prefix_ = 'firebase:'; } /** * @param {string} key The key to save the value under * @param {?Object} value The value being stored, or null to remove the key. */ DOMStorageWrapper.prototype.set = function (key, value) { if (value == null) { this.domStorage_.removeItem(this.prefixedName_(key)); } else { this.domStorage_.setItem(this.prefixedName_(key), util.stringify(value)); } }; /** * @param {string} key * @return {*} The value that was stored under this key, or null */ DOMStorageWrapper.prototype.get = function (key) { var storedVal = this.domStorage_.getItem(this.prefixedName_(key)); if (storedVal == null) { return null; } else { return util.jsonEval(storedVal); } }; /** * @param {string} key */ DOMStorageWrapper.prototype.remove = function (key) { this.domStorage_.removeItem(this.prefixedName_(key)); }; /** * @param {string} name * @return {string} */ DOMStorageWrapper.prototype.prefixedName_ = function (name) { return this.prefix_ + name; }; DOMStorageWrapper.prototype.toString = function () { return this.domStorage_.toString(); }; return DOMStorageWrapper; }()); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * An in-memory storage implementation that matches the API of DOMStorageWrapper * (TODO: create interface for both to implement). * * @constructor */ var MemoryStorage = /** @class */ (function () { function MemoryStorage() { this.cache_ = {}; this.isInMemoryStorage = true; } MemoryStorage.prototype.set = function (key, value) { if (value == null) { delete this.cache_[key]; } else { this.cache_[key] = value; } }; MemoryStorage.prototype.get = function (key) { if (util.contains(this.cache_, key)) { return this.cache_[key]; } return null; }; MemoryStorage.prototype.remove = function (key) { delete this.cache_[key]; }; return MemoryStorage; }()); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Helper to create a DOMStorageWrapper or else fall back to MemoryStorage. * TODO: Once MemoryStorage and DOMStorageWrapper have a shared interface this method annotation should change * to reflect this type * * @param {string} domStorageName Name of the underlying storage object * (e.g. 'localStorage' or 'sessionStorage'). * @return {?} Turning off type information until a common interface is defined. */ var createStoragefor = function (domStorageName) { try { // NOTE: just accessing "localStorage" or "window['localStorage']" may throw a security exception, // so it must be inside the try/catch. if (typeof window !== 'undefined' && typeof window[domStorageName] !== 'undefined') { // Need to test cache. Just because it's here doesn't mean it works var domStorage = window[domStorageName]; domStorage.setItem('firebase:sentinel', 'cache'); domStorage.removeItem('firebase:sentinel'); return new DOMStorageWrapper(domStorage); } } catch (e) { } // Failed to create wrapper. Just return in-memory storage. // TODO: log? return new MemoryStorage(); }; /** A storage object that lasts across sessions */ var PersistentStorage = createStoragefor('localStorage'); /** A storage object that only lasts one session */ var SessionStorage = createStoragefor('sessionStorage'); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var logClient = new logger$1.Logger('@firebase/database'); /** * Returns a locally-unique ID (generated by just incrementing up from 0 each time its called). * @type {function(): number} Generated ID. */ var LUIDGenerator = (function () { var id = 1; return function () { return id++; }; })(); /** * Sha1 hash of the input string * @param {!string} str The string to hash * @return {!string} The resulting hash */ var sha1 = function (str) { var utf8Bytes = util.stringToByteArray(str); var sha1 = new util.Sha1(); sha1.update(utf8Bytes); var sha1Bytes = sha1.digest(); return util.base64.encodeByteArray(sha1Bytes); }; /** * @param {...*} varArgs * @return {string} * @private */ var buildLogMessage_ = function () { var varArgs = []; for (var _i = 0; _i < arguments.length; _i++) { varArgs[_i] = arguments[_i]; } var message = ''; for (var i = 0; i < varArgs.length; i++) { var arg = varArgs[i]; if (Array.isArray(arg) || (arg && typeof arg === 'object' && // eslint-disable-next-line @typescript-eslint/no-explicit-any typeof arg.length === 'number')) { message += buildLogMessage_.apply(null, arg); } else if (typeof arg === 'object') { message += util.stringify(arg); } else { message += arg; } message += ' '; } return message; }; /** * Use this for all debug messages in Firebase. * @type {?function(string)} */ var logger = null; /** * Flag to check for log availability on first log message * @type {boolean} * @private */ var firstLog_ = true; /** * The implementation of Firebase.enableLogging (defined here to break dependencies) * @param {boolean|?function(string)} logger_ A flag to turn on logging, or a custom logger * @param {boolean=} persistent Whether or not to persist logging settings across refreshes */ var enableLogging = function (logger_, persistent) { util.assert(!persistent || logger_ === true || logger_ === false, "Can't turn on custom loggers persistently."); if (logger_ === true) { logClient.logLevel = logger$1.LogLevel.VERBOSE; logger = logClient.log.bind(logClient); if (persistent) { SessionStorage.set('logging_enabled', true); } } else if (typeof logger_ === 'function') { logger = logger_; } else { logger = null; SessionStorage.remove('logging_enabled'); } }; /** * * @param {...(string|Arguments)} varArgs */ var log = function () { var varArgs = []; for (var _i = 0; _i < arguments.length; _i++) { varArgs[_i] = arguments[_i]; } if (firstLog_ === true) { firstLog_ = false; if (logger === null && SessionStorage.get('logging_enabled') === true) { enableLogging(true); } } if (logger) { var message = buildLogMessage_.apply(null, varArgs); logger(message); } }; /** * @param {!string} prefix * @return {function(...[*])} */ var logWrapper = function (prefix) { return function () { var varArgs = []; for (var _i = 0; _i < arguments.length; _i++) { varArgs[_i] = arguments[_i]; } log.apply(void 0, tslib.__spread([prefix], varArgs)); }; }; /** * @param {...string} varArgs */ var error = function () { var varArgs = []; for (var _i = 0; _i < arguments.length; _i++) { varArgs[_i] = arguments[_i]; } var message = 'FIREBASE INTERNAL ERROR: ' + buildLogMessage_.apply(void 0, tslib.__spread(varArgs)); logClient.error(message); }; /** * @param {...string} varArgs */ var fatal = function () { var varArgs = []; for (var _i = 0; _i < arguments.length; _i++) { varArgs[_i] = arguments[_i]; } var message = "FIREBASE FATAL ERROR: " + buildLogMessage_.apply(void 0, tslib.__spread(varArgs)); logClient.error(message); throw new Error(message); }; /** * @param {...*} varArgs */ var warn = function () { var varArgs = []; for (var _i = 0; _i < arguments.length; _i++) { varArgs[_i] = arguments[_i]; } var message = 'FIREBASE WARNING: ' + buildLogMessage_.apply(void 0, tslib.__spread(varArgs)); logClient.warn(message); }; /** * Logs a warning if the containing page uses https. Called when a call to new Firebase * does not use https. */ var warnIfPageIsSecure = function () { // Be very careful accessing browser globals. Who knows what may or may not exist. if (typeof window !== 'undefined' && window.location && window.location.protocol && window.location.protocol.indexOf('https:') !== -1) { warn('Insecure Firebase access from a secure page. ' + 'Please use https in calls to new Firebase().'); } }; /** * Returns true if data is NaN, or +/- Infinity. * @param {*} data * @return {boolean} */ var isInvalidJSONNumber = function (data) { return (typeof data === 'number' && (data !== data || // NaN data === Number.POSITIVE_INFINITY || data === Number.NEGATIVE_INFINITY)); }; /** * @param {function()} fn */ var executeWhenDOMReady = function (fn) { if (util.isNodeSdk() || document.readyState === 'complete') { fn(); } else { // Modeled after jQuery. Try DOMContentLoaded and onreadystatechange (which // fire before onload), but fall back to onload. var called_1 = false; var wrappedFn_1 = function () { if (!document.body) { setTimeout(wrappedFn_1, Math.floor(10)); return; } if (!called_1) { called_1 = true; fn(); } }; if (document.addEventListener) { document.addEventListener('DOMContentLoaded', wrappedFn_1, false); // fallback to onload. window.addEventListener('load', wrappedFn_1, false); // eslint-disable-next-line @typescript-eslint/no-explicit-any } else if (document.attachEvent) { // IE. // eslint-disable-next-line @typescript-eslint/no-explicit-any document.attachEvent('onreadystatechange', function () { if (document.readyState === 'complete') { wrappedFn_1(); } }); // fallback to onload. // eslint-disable-next-line @typescript-eslint/no-explicit-any window.attachEvent('onload', wrappedFn_1); // jQuery has an extra hack for IE that we could employ (based on // http://javascript.nwbox.com/IEContentLoaded/) But it looks really old. // I'm hoping we don't need it. } } }; /** * Minimum key name. Invalid for actual data, used as a marker to sort before any valid names * @type {!string} */ var MIN_NAME = '[MIN_NAME]'; /** * Maximum key name. Invalid for actual data, used as a marker to sort above any valid names * @type {!string} */ var MAX_NAME = '[MAX_NAME]'; /** * Compares valid Firebase key names, plus min and max name * @param {!string} a * @param {!string} b * @return {!number} */ var nameCompare = function (a, b) { if (a === b) { return 0; } else if (a === MIN_NAME || b === MAX_NAME) { return -1; } else if (b === MIN_NAME || a === MAX_NAME) { return 1; } else { var aAsInt = tryParseInt(a), bAsInt = tryParseInt(b); if (aAsInt !== null) { if (bAsInt !== null) { return aAsInt - bAsInt === 0 ? a.length - b.length : aAsInt - bAsInt; } else { return -1; } } else if (bAsInt !== null) { return 1; } else { return a < b ? -1 : 1; } } }; /** * @param {!string} a * @param {!string} b * @return {!number} comparison result. */ var stringCompare = function (a, b) { if (a === b) { return 0; } else if (a < b) { return -1; } else { return 1; } }; /** * @param {string} key * @param {Object} obj * @return {*} */ var requireKey = function (key, obj) { if (obj && key in obj) { return obj[key]; } else { throw new Error('Missing required key (' + key + ') in object: ' + util.stringify(obj)); } }; /** * @param {*} obj * @return {string} */ var ObjectToUniqueKey = function (obj) { if (typeof obj !== 'object' || obj === null) { return util.stringify(obj); } var keys = []; // eslint-disable-next-line guard-for-in for (var k in obj) { keys.push(k); } // Export as json, but with the keys sorted. keys.sort(); var key = '{'; for (var i = 0; i < keys.length; i++) { if (i !== 0) { key += ','; } key += util.stringify(keys[i]); key += ':'; key += ObjectToUniqueKey(obj[keys[i]]); } key += '}'; return key; }; /** * Splits a string into a number of smaller segments of maximum size * @param {!string} str The string * @param {!number} segsize The maximum number of chars in the string. * @return {Array.<string>} The string, split into appropriately-sized chunks */ var splitStringBySize = function (str, segsize) { var len = str.length; if (len <= segsize) { return [str]; } var dataSegs = []; for (var c = 0; c < len; c += segsize) { if (c + segsize > len) { dataSegs.push(str.substring(c, len)); } else { dataSegs.push(str.substring(c, c + segsize)); } } return dataSegs; }; /** * Apply a function to each (key, value) pair in an object or * apply a function to each (index, value) pair in an array * @param obj The object or array to iterate over * @param fn The function to apply */ function each(obj, fn) { for (var key in obj) { if (obj.hasOwnProperty(key)) { fn(key, obj[key]); } } } /** * Borrowed from http://hg.secondlife.com/llsd/src/tip/js/typedarray.js (MIT License) * I made one modification at the end and removed the NaN / Infinity * handling (since it seemed broken [caused an overflow] and we don't need it). See MJL comments. * @param {!number} v A double * @return {string} */ var doubleToIEEE754String = function (v) { util.assert(!isInvalidJSONNumber(v), 'Invalid JSON number'); // MJL var ebits = 11, fbits = 52; var bias = (1 << (ebits - 1)) - 1; var s, e, f, ln, i; // Compute sign, exponent, fraction // Skip NaN / Infinity handling --MJL. if (v === 0) { e = 0; f = 0; s = 1 / v === -Infinity ? 1 : 0; } else { s = v < 0; v = Math.abs(v); if (v >= Math.pow(2, 1 - bias)) { // Normalized ln = Math.min(Math.floor(Math.log(v) / Math.LN2), bias); e = ln + bias; f = Math.round(v * Math.pow(2, fbits - ln) - Math.pow(2, fbits)); } else { // Denormalized e = 0; f = Math.round(v / Math.pow(2, 1 - bias - fbits)); } } // Pack sign, exponent, fraction var bits = []; for (i = fbits; i; i -= 1) { bits.push(f % 2 ? 1 : 0); f = Math.floor(f / 2); } for (i = ebits; i; i -= 1) { bits.push(e % 2 ? 1 : 0); e = Math.floor(e / 2); } bits.push(s ? 1 : 0); bits.reverse(); var str = bits.join(''); // Return the data as a hex string. --MJL var hexByteString = ''; for (i = 0; i < 64; i += 8) { var hexByte = parseInt(str.substr(i, 8), 2).toString(16); if (hexByte.length === 1) { hexByte = '0' + hexByte; } hexByteString = hexByteString + hexByte; } return hexByteString.toLowerCase(); }; /** * Used to detect if we're in a Chrome content script (which executes in an * isolated environment where long-polling doesn't work). * @return {boolean} */ var isChromeExtensionContentScript = function () { return !!(typeof window === 'object' && window['chrome'] && window['chrome']['extension'] && !/^chrome/.test(window.location.href)); }; /** * Used to detect if we're in a Windows 8 Store app. * @return {boolean} */ var isWindowsStoreApp = function () { // Check for the presence of a couple WinRT globals return typeof Windows === 'object' && typeof Windows.UI === 'object'; }; /** * Converts a server error code to a Javascript Error * @param {!string} code * @param {!Query} query * @return {Error} */ var errorForServerCode = function (code, query) { var reason = 'Unknown Error'; if (code === 'too_big') { reason = 'The data requested exceeds the maximum size ' + 'that can be accessed with a single request.'; } else if (code === 'permission_denied') { reason = "Client doesn't have permission to access the desired data."; } else if (code === 'unavailable') { reason = 'The service is unavailable'; } var error = new Error(code + ' at ' + query.path.toString() + ': ' + reason); // eslint-disable-next-line @typescript-eslint/no-explicit-any error.code = code.toUpperCase(); return error; }; /** * Used to test for integer-looking strings * @type {RegExp} * @private */ var INTEGER_REGEXP_ = new RegExp('^-?(0*)\\d{1,10}$'); /** * If the string contains a 32-bit integer, return it. Else return null. * @param {!string} str * @return {?number} */ var tryParseInt = function (str) { if (INTEGER_REGEXP_.test(str)) { var intVal = Number(str); if (intVal >= -2147483648 && intVal <= 2147483647) { return intVal; } } return null; }; /** * Helper to run some code but catch any exceptions and re-throw them later. * Useful for preventing user callbacks from breaking internal code. * * Re-throwing the exception from a setTimeout is a little evil, but it's very * convenient (we don't have to try to figure out when is a safe point to * re-throw it), and the behavior seems reasonable: * * * If you aren't pausing on exceptions, you get an error in the console with * the correct stack trace. * * If you're pausing on all exceptions, the debugger will pause on your * exception and then again when we rethrow it. * * If you're only pausing on uncaught exceptions, the debugger will only pause * on us re-throwing it. * * @param {!function()} fn The code to guard. */ var exceptionGuard = function (fn) { try { fn(); } catch (e) { // Re-throw exception when it's safe. setTimeout(function () { // It used to be that "throw e" would result in a good console error with // relevant context, but as of Chrome 39, you just get the firebase.js // file/line number where we re-throw it, which is useless. So we log // e.stack explicitly. var stack = e.stack || ''; warn('Exception was thrown by user callback.', stack); throw e; }, Math.floor(0)); } }; /** * @return {boolean} true if we think we're currently being crawled. */ var beingCrawled = function () { var userAgent = (typeof window === 'object' && window['navigator'] && window['navigator']['userAgent']) || ''; // For now we whitelist the most popular crawlers. We should refine this to be the set of crawlers we // believe to support JavaScript/AJAX rendering. // NOTE: Google Webmaster Tools doesn't really belong, but their "This is how a visitor to your website // would have seen the page" is flaky if we don't treat it as a crawler. return (userAgent.search(/googlebot|google webmaster tools|bingbot|yahoo! slurp|baiduspider|yandexbot|duckduckbot/i) >= 0); }; /** * Same as setTimeout() except on Node.JS it will /not/ prevent the process from exiting. * * It is removed with clearTimeout() as normal. * * @param {Function} fn Function to run. * @param {number} time Milliseconds to wait before running. * @return {number|Object} The setTimeout() return value. */ var setTimeoutNonBlocking = function (fn, time) { var timeout = setTimeout(fn, time); // eslint-disable-next-line @typescript-eslint/no-explicit-any if (typeof timeout === 'object' && timeout['unref']) { // eslint-disable-next-line @typescript-eslint/no-explicit-any timeout['unref'](); } return timeout; }; /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * An immutable object representing a parsed path. It's immutable so that you * can pass them around to other functions without worrying about them changing * it. */ var Path = /** @class */ (function () { /** * @param {string|Array.<string>} pathOrString Path string to parse, * or another path, or the raw tokens array * @param {number=} pieceNum */ function Path(pathOrString, pieceNum) { if (pieceNum === void 0) { this.pieces_ = pathOrString.split('/'); // Remove empty pieces. var copyTo = 0; for (var i = 0; i < this.pieces_.length; i++) { if (this.pieces_[i].length > 0) { this.pieces_[copyTo] = this.pieces_[i]; copyTo++; } } this.pieces_.length = copyTo; this.pieceNum_ = 0; } else { this.pieces_ = pathOrString; this.pieceNum_ = pieceNum; } } Object.defineProperty(Path, "Empty", { /** * Singleton to represent an empty path * * @const */ get: function () { return new Path(''); }, enumerable: false, configurable: true }); Path.prototype.getFront = function () { if (this.pieceNum_ >= this.pieces_.length) { return null; } return this.pieces_[this.pieceNum_]; }; /** * @return {number} The number of segments in this path */ Path.prototype.getLength = function () { return this.pieces_.length - this.pieceNum_; }; /** * @return {!Path} */ Path.prototype.popFront = function () { var pieceNum = this.pieceNum_; if (pieceNum < this.pieces_.length) { pieceNum++; } return new Path(this.pieces_, pieceNum); }; /** * @return {?string} */ Path.prototype.getBack = function () { if (this.pieceNum_ < this.pieces_.length) { return this.pieces_[this.pieces_.length - 1]; } return null; }; Path.prototype.toString = function () { var pathString = ''; for (var i = this.pieceNum_; i < this.pieces_.length; i++) { if (this.pieces_[i] !== '') { pathString += '/' + this.pieces_[i]; } } return pathString || '/'; }; Path.prototype.toUrlEncodedString = function () { var pathString = ''; for (var i = this.pieceNum_; i < this.pieces_.length; i++) { if (this.pieces_[i] !== '') { pathString += '/' + encodeURIComponent(String(this.pieces_[i])); } } return pathString || '/'; }; /** * Shallow copy of the parts of the path. * * @param {number=} begin * @return {!Array<string>} */ Path.prototype.slice = function (begin) { if (begin === void 0) { begin = 0; } return this.pieces_.slice(this.pieceNum_ + begin); }; /** * @return {?Path} */ Path.prototype.parent = function () { if (this.pieceNum_ >= this.pieces_.length) { return null; } var pieces = []; for (var i = this.pieceNum_; i < this.pieces_.length - 1; i++) { pieces.push(this.pieces_[i]); } return new Path(pieces, 0); }; /** * @param {string|!Path} childPathObj * @return {!Path} */ Path.prototype.child = function (childPathObj) { var pieces = []; for (var i = this.pieceNum_; i < this.pieces_.length; i++) { pieces.push(this.pieces_[i]); } if (childPathObj instanceof Path) { for (var i = childPathObj.pieceNum_; i < childPathObj.pieces_.length; i++) { pieces.push(childPathObj.pieces_[i]); } } else { var childPieces = childPathObj.split('/'); for (var i = 0; i < childPieces.length; i++) { if (childPieces[i].length > 0) { pieces.push(childPieces[i]); } } } return new Path(pieces, 0); }; /** * @return {boolean} True if there are no segments in this path */ Path.prototype.isEmpty = function () { return this.pieceNum_ >= this.pieces_.length; }; /** * @param {!Path} outerPath * @param {!Path} innerPath * @return {!Path} The path from outerPath to innerPath */ Path.relativePath = function (outerPath, innerPath) { var outer = outerPath.getFront(), inner = innerPath.getFront(); if (outer === null) { return innerPath; } else if (outer === inner) { return Path.relativePath(outerPath.popFront(), innerPath.popFront()); } else { throw new Error('INTERNAL ERROR: innerPath (' + innerPath + ') is not within ' + 'outerPath (' + outerPath + ')'); } }; /** * @param {!Path} left * @param {!Path} right * @return {number} -1, 0, 1 if left is less, equal, or greater than the right. */ Path.comparePaths = function (left, right) { var leftKeys = left.slice(); var rightKeys = right.slice(); for (var i = 0; i < leftKeys.length && i < rightKeys.length; i++) { var cmp = nameCompare(leftKeys[i], rightKeys[i]); if (cmp !== 0) { return cmp; } } if (leftKeys.length === rightKeys.length) { return 0; } return leftKeys.length < rightKeys.length ? -1 : 1; }; /** * * @param {Path} other * @return {boolean} true if paths are the same. */ Path.prototype.equals = function (other) { if (this.getLength() !== other.getLength()) { return false; } for (var i = this.pieceNum_, j = other.pieceNum_; i <= this.pieces_.length; i++, j++) { if (this.pieces_[i] !== other.pieces_[j]) { return false; } } return true; }; /** * * @param {!Path} other * @return {boolean} True if this path is a parent (or the same as) other */ Path.prototype.contains = function (other) { var i = this.pieceNum_; var j = other.pieceNum_; if (this.getLength() > other.getLength()) { return false; } while (i < this.pieces_.length) { if (this.pieces_[i] !== other.pieces_[j]) { return false; } ++i; ++j; } return true; }; return Path; }()); // end Path /** * Dynamic (mutable) path used to count path lengths. * * This class is used to efficiently check paths for valid * length (in UTF8 bytes) and depth (used in path validation). * * Throws Error exception if path is ever invalid. * * The definition of a path always begins with '/'. */ var ValidationPath = /** @class */ (function () { /** * @param {!Path} path Initial Path. * @param {string} errorPrefix_ Prefix for any error messages. */ function ValidationPath(path, errorPrefix_) { this.errorPrefix_ = errorPrefix_; /** @type {!Array<string>} */ this.parts_ = path.slice(); /** @type {number} Initialize to number of '/' chars needed in path. */ this.byteLength_ = Math.max(1, this.parts_.length); for (var i = 0; i < this.parts_.length; i++) { this.byteLength_ += util.stringLength(this.parts_[i]); } this.checkValid_(); } Object.defineProperty(ValidationPath, "MAX_PATH_DEPTH", { /** @const {number} Maximum key depth. */ get: function () { return 32; }, enumerable: false, configurable: true }); Object.defineProperty(ValidationPath, "MAX_PATH_LENGTH_BYTES", { /** @const {number} Maximum number of (UTF8) bytes in a Firebase path. */ get: function () { return 768; }, enumerable: false, configurable: true }); /** @param {string} child */ ValidationPath.prototype.push = function (child) { // Count the needed '/' if (this.parts_.length > 0) { this.byteLength_ += 1; } this.parts_.push(child); this.byteLength_ += util.stringLength(child); this.checkValid_(); }; ValidationPath.prototype.pop = function () { var last = this.parts_.pop(); this.byteLength_ -= util.stringLength(last); // Un-count the previous '/' if (this.parts_.length > 0) { this.byteLength_ -= 1; } }; ValidationPath.prototype.checkValid_ = function () { if (this.byteLength_ > ValidationPath.MAX_PATH_LENGTH_BYTES) { throw new Error(this.errorPrefix_ + 'has a key path longer than ' + ValidationPath.MAX_PATH_LENGTH_BYTES + ' bytes (' + this.byteLength_ + ').'); } if (this.parts_.length > ValidationPath.MAX_PATH_DEPTH) { throw new Error(this.errorPrefix_ + 'path specified exceeds the maximum depth that can be written (' + ValidationPath.MAX_PATH_DEPTH + ') or object contains a cycle ' + this.toErrorString()); } }; /** * String for use in error messages - uses '.' notation for path. * * @return {string} */ ValidationPath.prototype.toErrorString = function () { if (this.parts_.length === 0) { return ''; } return "in property '" + this.parts_.join('.') + "'"; }; return ValidationPath; }()); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var PROTOCOL_VERSION = '5'; var VERSION_PARAM = 'v'; var TRANSPORT_SESSION_PARAM = 's'; var REFERER_PARAM = 'r'; var FORGE_REF = 'f'; var FORGE_DOMAIN = 'firebaseio.com'; var LAST_SESSION_PARAM = 'ls'; var APPLICATION_ID_PARAM = 'p'; var WEBSOCKET = 'websocket'; var LONG_POLLING = 'long_polling'; /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * A class that holds metadata about a Repo object * * @constructor */ var RepoInfo = /** @class */ (function () { /** * @param host Hostname portion of the url for the repo * @param secure Whether or not this repo is accessed over ssl * @param namespace The namespace represented by the repo * @param webSocketOnly Whether to prefer websockets over all other transports (used by Nest). * @param nodeAdmin Whether this instance uses Admin SDK credentials * @param persistenceKey Override the default session persistence storage key */ function RepoInfo(host, secure, namespace, webSocketOnly, nodeAdmin, persistenceKey, includeNamespaceInQueryParams) { if (nodeAdmin === void 0) { nodeAdmin = false; } if (persistenceKey === void 0) { persistenceKey = ''; } if (includeNamespaceInQueryParams === void 0) { includeNamespaceInQueryParams = false; } this.secure = secure; this.namespace = namespace; this.webSocketOnly = webSocketOnly; this.nodeAdmin = nodeAdmin; this.persistenceKey = persistenceKey; this.includeNamespaceInQueryParams = includeNamespaceInQueryParams; this.host = host.toLowerCase(); this.domain = this.host.substr(this.host.indexOf('.') + 1); this.internalHost = PersistentStorage.get('host:' + host) || this.host; } RepoInfo.prototype.needsQueryParam = function () { return (this.host !== this.internalHost || this.isCustomHost() || this.includeNamespaceInQueryParams); }; RepoInfo.prototype.isCacheableHost = function () { return this.internalHost.substr(0, 2) === 's-'; }; RepoInfo.prototype.isDemoHost = function () { return this.domain === 'firebaseio-demo.com'; }; RepoInfo.prototype.isCustomHost = function () { return (this.domain !== 'firebaseio.com' && this.domain !== 'firebaseio-demo.com'); }; RepoInfo.prototype.updateHost = function (newHost) { if (newHost !== this.internalHost) { this.internalHost = newHost; if (this.isCacheableHost()) { PersistentStorage.set('host:' + this.host, this.internalHost); } } }; /** * Returns the websocket URL for this repo * @param {string} type of connection * @param {Object} params list * @return {string} The URL for this repo */ RepoInfo.prototype.connectionURL = function (type, params) { util.assert(typeof type === 'string', 'typeof type must == string'); util.assert(typeof params === 'object', 'typeof params must == object'); var connURL; if (type === WEBSOCKET) { connURL = (this.secure ? 'wss://' : 'ws://') + this.internalHost + '/.ws?'; } else if (type === LONG_POLLING) { connURL = (this.secure ? 'https://' : 'http://') + this.internalHost + '/.lp?'; } else { throw new Error('Unknown connection type: ' + type); } if (this.needsQueryParam()) { params['ns'] = this.namespace; } var pairs = []; each(params, function (key, value) { pairs.push(key + '=' + value); }); return connURL + pairs.join('&'); }; /** @return {string} */ RepoInfo.prototype.toString = function () { var str = this.toURLString(); if (this.persistenceKey) { str += '<' + this.persistenceKey + '>'; } return str; }; /** @return {string} */ RepoInfo.prototype.toURLString = function () { return (this.secure ? 'https://' : 'http://') + this.host; }; return RepoInfo; }()); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * @param {!string} pathString * @return {string} */ function decodePath(pathString) { var pathStringDecoded = ''; var pieces = pathString.split('/'); for (var i = 0; i < pieces.length; i++) { if (pieces[i].length > 0) { var piece = pieces[i]; try { piece = decodeURIComponent(piece.replace(/\+/g, ' ')); } catch (e) { } pathStringDecoded += '/' + piece; } } return pathStringDecoded; } /** * @param {!string} queryString * @return {!{[key:string]:string}} key value hash */ function decodeQuery(queryString) { var e_1, _a; var results = {}; if (queryString.charAt(0) === '?') { queryString = queryString.substring(1); } try { for (var _b = tslib.__values(queryString.split('&')), _c = _b.next(); !_c.done; _c = _b.next()) { var segment = _c.value; if (segment.length === 0) { continue; } var kv = segment.split('='); if (kv.length === 2) { results[decodeURIComponent(kv[0])] = decodeURIComponent(kv[1]); } else { warn("Invalid query segment '" + segment + "' in query '" + queryString + "'"); } } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (_c && !_c.done && (_a = _b.return)) _a.call(_b); } finally { if (e_1) throw e_1.error; } } return results; } var parseRepoInfo = function (dataURL, nodeAdmin) { var parsedUrl = parseDatabaseURL(dataURL), namespace = parsedUrl.namespace; if (parsedUrl.domain === 'firebase.com') { fatal(parsedUrl.host + ' is no longer supported. ' + 'Please use <YOUR FIREBASE>.firebaseio.com instead'); } // Catch common error of uninitialized namespace value. if ((!namespace || namespace === 'undefined') && parsedUrl.domain !== 'localhost') { fatal('Cannot parse Firebase url. Please use https://<YOUR FIREBASE>.firebaseio.com'); } if (!parsedUrl.secure) { warnIfPageIsSecure(); } var webSocketOnly = parsedUrl.scheme === 'ws' || parsedUrl.scheme === 'wss'; return { repoInfo: new RepoInfo(parsedUrl.host, parsedUrl.secure, namespace, nodeAdmin, webSocketOnly, /*persistenceKey=*/ '', /*includeNamespaceInQueryParams=*/ namespace !== parsedUrl.subdomain), path: new Path(parsedUrl.pathString) }; }; /** * * @param {!string} dataURL * @return {{host: string, port: number, domain: string, subdomain: string, secure: boolean, scheme: string, pathString: string, namespace: string}} */ var parseDatabaseURL = function (dataURL) { // Default to empty strings in the event of a malformed string. var host = '', domain = '', subdomain = '', pathString = '', namespace = ''; // Always default to SSL, unless otherwise specified. var secure = true, scheme = 'https', port = 443; // Don't do any validation here. The caller is responsible for validating the result of parsing. if (typeof dataURL === 'string') { // Parse scheme. var colonInd = dataURL.indexOf('//'); if (colonInd >= 0) { scheme = dataURL.substring(0, colonInd - 1); dataURL = dataURL.substring(colonInd + 2); } // Parse host, path, and query string. var slashInd = dataURL.indexOf('/'); if (slashInd === -1) { slashInd = dataURL.length; } var questionMarkInd = dataURL.indexOf('?'); if (questionMarkInd === -1) { questionMarkInd = dataURL.length; } host = dataURL.substring(0, Math.min(slashInd, questionMarkInd)); if (slashInd < questionMarkInd) { // For pathString, questionMarkInd will always come after slashInd pathString = decodePath(dataURL.substring(slashInd, questionMarkInd)); } var queryParams = decodeQuery(dataURL.substring(Math.min(dataURL.length, questionMarkInd))); // If we have a port, use scheme for determining if it's secure. colonInd = host.indexOf(':'); if (colonInd >= 0) { secure = scheme === 'https' || scheme === 'wss'; port = parseInt(host.substring(colonInd + 1), 10); } else { colonInd = host.length; } var hostWithoutPort = host.slice(0, colonInd); if (hostWithoutPort.toLowerCase() === 'localhost') { domain = 'localhost'; } else if (hostWithoutPort.split('.').length <= 2) { domain = hostWithoutPort; } else { // Interpret the subdomain of a 3 or more component URL as the namespace name. var dotInd = host.indexOf('.'); subdomain = host.substring(0, dotInd).toLowerCase(); domain = host.substring(dotInd + 1); // Normalize namespaces to lowercase to share storage / connection. namespace = subdomain; } // Always treat the value of the `ns` as the namespace name if it is present. if ('ns' in queryParams) { namespace = queryParams['ns']; } } return { host: host, port: port, domain: domain, subdomain: subdomain, secure: secure, scheme: scheme, pathString: pathString, namespace: namespace }; }; /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * True for invalid Firebase keys * @type {RegExp} * @private */ var INVALID_KEY_REGEX_ = /[\[\].#$\/\u0000-\u001F\u007F]/; /** * True for invalid Firebase paths. * Allows '/' in paths. * @type {RegExp} * @private */ var INVALID_PATH_REGEX_ = /[\[\].#$\u0000-\u001F\u007F]/; /** * Maximum number of characters to allow in leaf value * @type {number} * @private */ var MAX_LEAF_SIZE_ = 10 * 1024 * 1024; /** * @param {*} key * @return {boolean} */ var isValidKey = function (key) { return (typeof key === 'string' && key.length !== 0 && !INVALID_KEY_REGEX_.test(key)); }; /** * @param {string} pathString * @return {boolean} */ var isValidPathString = function (pathString) { return (typeof pathString === 'string' && pathString.length !== 0 && !INVALID_PATH_REGEX_.test(pathString)); }; /** * @param {string} pathString * @return {boolean} */ var isValidRootPathString = function (pathString) { if (pathString) { // Allow '/.info/' at the beginning. pathString = pathString.replace(/^\/*\.info(\/|$)/, '/'); } return isValidPathString(pathString); }; /** * @param {*} priority * @return {boolean} */ var isValidPriority = function (priority) { return (priority === null || typeof priority === 'string' || (typeof priority === 'number' && !isInvalidJSONNumber(priority)) || (priority && typeof priority === 'object' && // eslint-disable-next-line @typescript-eslint/no-explicit-any util.contains(priority, '.sv'))); }; /** * Pre-validate a datum passed as an argument to Firebase function. * * @param {string} fnName * @param {number} argumentNumber * @param {*} data * @param {!Path} path * @param {boolean} optional */ var validateFirebaseDataArg = function (fnName, argumentNumber, data, path, optional) { if (optional && data === undefined) { return; } validateFirebaseData(util.errorPrefix(fnName, argumentNumber, optional), data, path); }; /** * Validate a data object client-side before sending to server. * * @param {string} errorPrefix * @param {*} data * @param {!Path|!ValidationPath} path_ */ var validateFirebaseData = function (errorPrefix, data, path_) { var path = path_ instanceof Path ? new ValidationPath(path_, errorPrefix) : path_; if (data === undefined) { throw new Error(errorPrefix + 'contains undefined ' + path.toErrorString()); } if (typeof data === 'function') { throw new Error(errorPrefix + 'contains a function ' + path.toErrorString() + ' with contents = ' + data.toString()); } if (isInvalidJSONNumber(data)) { throw new Error(errorPrefix + 'contains ' + data.toString() + ' ' + path.toErrorString()); } // Check max leaf size, but try to avoid the utf8 conversion if we can. if (typeof data === 'string' && data.length > MAX_LEAF_SIZE_ / 3 && util.stringLength(data) > MAX_LEAF_SIZE_) { throw new Error(errorPrefix + 'contains a string greater than ' + MAX_LEAF_SIZE_ + ' utf8 bytes ' + path.toErrorString() + " ('" + data.substring(0, 50) + "...')"); } // TODO = Perf = Consider combining the recursive validation of keys into NodeFromJSON // to save extra walking of large objects. if (data && typeof data === 'object') { var hasDotValue_1 = false; var hasActualChild_1 = false; each(data, function (key, value) { if (key === '.value') { hasDotValue_1 = true; } else if (key !== '.priority' && key !== '.sv') { hasActualChild_1 = true; if (!isValidKey(key)) { throw new Error(errorPrefix + ' contains an invalid key (' + key + ') ' + path.toErrorString() + '. Keys must be non-empty strings ' + 'and can\'t contain ".", "#", "$", "/", "[", or "]"'); } } path.push(key); validateFirebaseData(errorPrefix, value, path); path.pop(); }); if (hasDotValue_1 && hasActualChild_1) { throw new Error(errorPrefix + ' contains ".value" child ' + path.toErrorString() + ' in addition to actual children.'); } } }; /** * Pre-validate paths passed in the firebase function. * * @param {string} errorPrefix * @param {Array<!Path>} mergePaths */ var validateFirebaseMergePaths = function (errorPrefix, mergePaths) { var i, curPath; for (i = 0; i < mergePaths.length; i++) { curPath = mergePaths[i]; var keys = curPath.slice(); for (var j = 0; j < keys.length; j++) { if (keys[j] === '.priority' && j === keys.length - 1) ; else if (!isValidKey(keys[j])) { throw new Error(errorPrefix + 'contains an invalid key (' + keys[j] + ') in path ' + curPath.toString() + '. Keys must be non-empty strings ' + 'and can\'t contain ".", "#", "$", "/", "[", or "]"'); } } } // Check that update keys are not descendants of each other. // We rely on the property that sorting guarantees that ancestors come // right before descendants. mergePaths.sort(Path.comparePaths); var prevPath = null; for (i = 0; i < mergePaths.length; i++) { curPath = mergePaths[i]; if (prevPath !== null && prevPath.contains(curPath)) { throw new Error(errorPrefix + 'contains a path ' + prevPath.toString() + ' that is ancestor of another path ' + curPath.toString()); } prevPath = curPath; } }; /** * pre-validate an object passed as an argument to firebase function ( * must be an object - e.g. for firebase.update()). * * @param {string} fnName * @param {number} argumentNumber * @param {*} data * @param {!Path} path * @param {boolean} optional */ var validateFirebaseMergeDataArg = function (fnName, argumentNumber, data, path, optional) { if (optional && data === undefined) { return; } var errorPrefix = util.errorPrefix(fnName, argumentNumber, optional); if (!(data && typeof data === 'object') || Array.isArray(data)) { throw new Error(errorPrefix + ' must be an object containing the children to replace.'); } var mergePaths = []; each(data, function (key, value) { var curPath = new Path(key); validateFirebaseData(errorPrefix, value, path.child(curPath)); if (curPath.getBack() === '.priority') { if (!isValidPriority(value)) { throw new Error(errorPrefix + "contains an invalid value for '" + curPath.toString() + "', which must be a valid " + 'Firebase priority (a string, finite number, server value, or null).'); } } mergePaths.push(curPath); }); validateFirebaseMergePaths(errorPrefix, mergePaths); }; var validatePriority = function (fnName, argumentNumber, priority, optional) { if (optional && priority === undefined) { return; } if (isInvalidJSONNumber(priority)) { throw new Error(util.errorPrefix(fnName, argumentNumber, optional) + 'is ' + priority.toString() + ', but must be a valid Firebase priority (a string, finite number, ' + 'server value, or null).'); } // Special case to allow importing data with a .sv. if (!isValidPriority(priority)) { throw new Error(util.errorPrefix(fnName, argumentNumber, optional) + 'must be a valid Firebase priority ' + '(a string, finite number, server value, or null).'); } }; var validateEventType = function (fnName, argumentNumber, eventType, optional) { if (optional && eventType === undefined) { return; } switch (eventType) { case 'value': case 'child_added': case 'child_removed': case 'child_changed': case 'child_moved': break; default: throw new Error(util.errorPrefix(fnName, argumentNumber, optional) + 'must be a valid event type = "value", "child_added", "child_removed", ' + '"child_changed", or "child_moved".'); } }; var validateKey = function (fnName, argumentNumber, key, optional) { if (optional && key === undefined) { return; } if (!isValidKey(key)) { throw new Error(util.errorPrefix(fnName, argumentNumber, optional) + 'was an invalid key = "' + key + '". Firebase keys must be non-empty strings and ' + 'can\'t contain ".", "#", "$", "/", "[", or "]").'); } }; var validatePathString = function (fnName, argumentNumber, pathString, optional) { if (optional && pathString === undefined) { return; } if (!isValidPathString(pathString)) { throw new Error(util.errorPrefix(fnName, argumentNumber, optional) + 'was an invalid path = "' + pathString + '". Paths must be non-empty strings and ' + 'can\'t contain ".", "#", "$", "[", or "]"'); } }; var validateRootPathString = function (fnName, argumentNumber, pathString, optional) { if (pathString) { // Allow '/.info/' at the beginning. pathString = pathString.replace(/^\/*\.info(\/|$)/, '/'); } validatePathString(fnName, argumentNumber, pathString, optional); }; var validateWritablePath = function (fnName, path) { if (path.getFront() === '.info') { throw new Error(fnName + " failed = Can't modify data under /.info/"); } }; var validateUrl = function (fnName, argumentNumber, parsedUrl) { // TODO = Validate server better. var pathString = parsedUrl.path.toString(); if (!(typeof parsedUrl.repoInfo.host === 'string') || parsedUrl.repoInfo.host.length === 0 || (!isValidKey(parsedUrl.repoInfo.namespace) && parsedUrl.repoInfo.host.split(':')[0] !== 'localhost') || (pathString.length !== 0 && !isValidRootPathString(pathString))) { throw new Error(util.errorPrefix(fnName, argumentNumber, false) + 'must be a valid firebase URL and ' + 'the path can\'t contain ".", "#", "$", "[", or "]".'); } }; var validateBoolean = function (fnName, argumentNumber, bool, optional) { if (optional && bool === undefined) { return; } if (typeof bool !== 'boolean') { throw new Error(util.errorPrefix(fnName, argumentNumber, optional) + 'must be a boolean.'); } }; /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * @constructor */ var OnDisconnect = /** @class */ (function () { /** * @param {!Repo} repo_ * @param {!Path} path_ */ function OnDisconnect(repo_, path_) { this.repo_ = repo_; this.path_ = path_; } /** * @param {function(?Error)=} onComplete * @return {!firebase.Promise} */ OnDisconnect.prototype.cancel = function (onComplete) { util.validateArgCount('OnDisconnect.cancel', 0, 1, arguments.length); util.validateCallback('OnDisconnect.cancel', 1, onComplete, true); var deferred = new util.Deferred(); this.repo_.onDisconnectCancel(this.path_, deferred.wrapCallback(onComplete)); return deferred.promise; }; /** * @param {function(?Error)=} onComplete * @return {!firebase.Promise} */ OnDisconnect.prototype.remove = function (onComplete) { util.validateArgCount('OnDisconnect.remove', 0, 1, arguments.length); validateWritablePath('OnDisconnect.remove', this.path_); util.validateCallback('OnDisconnect.remove', 1, onComplete, true); var deferred = new util.Deferred(); this.repo_.onDisconnectSet(this.path_, null, deferred.wrapCallback(onComplete)); return deferred.promise; }; /** * @param {*} value * @param {function(?Error)=} onComplete * @return {!firebase.Promise} */ OnDisconnect.prototype.set = function (value, onComplete) { util.validateArgCount('OnDisconnect.set', 1, 2, arguments.length); validateWritablePath('OnDisconnect.set', this.path_); validateFirebaseDataArg('OnDisconnect.set', 1, value, this.path_, false); util.validateCallback('OnDisconnect.set', 2, onComplete, true); var deferred = new util.Deferred(); this.repo_.onDisconnectSet(this.path_, value, deferred.wrapCallback(onComplete)); return deferred.promise; }; /** * @param {*} value * @param {number|string|null} priority * @param {function(?Error)=} onComplete * @return {!firebase.Promise} */ OnDisconnect.prototype.setWithPriority = function (value, priority, onComplete) { util.validateArgCount('OnDisconnect.setWithPriority', 2, 3, arguments.length); validateWritablePath('OnDisconnect.setWithPriority', this.path_); validateFirebaseDataArg('OnDisconnect.setWithPriority', 1, value, this.path_, false); validatePriority('OnDisconnect.setWithPriority', 2, priority, false); util.validateCallback('OnDisconnect.setWithPriority', 3, onComplete, true); var deferred = new util.Deferred(); this.repo_.onDisconnectSetWithPriority(this.path_, value, priority, deferred.wrapCallback(onComplete)); return deferred.promise; }; /** * @param {!Object} objectToMerge * @param {function(?Error)=} onComplete * @return {!firebase.Promise} */ OnDisconnect.prototype.update = function (objectToMerge, onComplete) { util.validateArgCount('OnDisconnect.update', 1, 2, arguments.length); validateWritablePath('OnDisconnect.update', this.path_); if (Array.isArray(objectToMerge)) { var newObjectToMerge = {}; for (var i = 0; i < objectToMerge.length; ++i) { newObjectToMerge['' + i] = objectToMerge[i]; } objectToMerge = newObjectToMerge; warn('Passing an Array to firebase.database.onDisconnect().update() is deprecated. Use set() if you want to overwrite the ' + 'existing data, or an Object with integer keys if you really do want to only update some of the children.'); } validateFirebaseMergeDataArg('OnDisconnect.update', 1, objectToMerge, this.path_, false); util.validateCallback('OnDisconnect.update', 2, onComplete, true); var deferred = new util.Deferred(); this.repo_.onDisconnectUpdate(this.path_, objectToMerge, deferred.wrapCallback(onComplete)); return deferred.promise; }; return OnDisconnect; }()); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var TransactionResult = /** @class */ (function () { /** * A type for the resolve value of Firebase.transaction. * @constructor * @dict * @param {boolean} committed * @param {DataSnapshot} snapshot */ function TransactionResult(committed, snapshot) { this.committed = committed; this.snapshot = snapshot; } // Do not create public documentation. This is intended to make JSON serialization work but is otherwise unnecessary // for end-users TransactionResult.prototype.toJSON = function () { util.validateArgCount('TransactionResult.toJSON', 0, 1, arguments.length); return { committed: this.committed, snapshot: this.snapshot.toJSON() }; }; return TransactionResult; }()); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Fancy ID generator that creates 20-character string identifiers with the * following properties: * * 1. They're based on timestamp so that they sort *after* any existing ids. * 2. They contain 72-bits of random data after the timestamp so that IDs won't * collide with other clients' IDs. * 3. They sort *lexicographically* (so the timestamp is converted to characters * that will sort properly). * 4. They're monotonically increasing. Even if you generate more than one in * the same timestamp, the latter ones will sort after the former ones. We do * this by using the previous random bits but "incrementing" them by 1 (only * in the case of a timestamp collision). */ var nextPushId = (function () { // Modeled after base64 web-safe chars, but ordered by ASCII. var PUSH_CHARS = '-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz'; // Timestamp of last push, used to prevent local collisions if you push twice // in one ms. var lastPushTime = 0; // We generate 72-bits of randomness which get turned into 12 characters and // appended to the timestamp to prevent collisions with other clients. We // store the last characters we generated because in the event of a collision, // we'll use those same characters except "incremented" by one. var lastRandChars = []; return function (now) { var duplicateTime = now === lastPushTime; lastPushTime = now; var i; var timeStampChars = new Array(8); for (i = 7; i >= 0; i--) { timeStampChars[i] = PUSH_CHARS.charAt(now % 64); // NOTE: Can't use << here because javascript will convert to int and lose // the upper bits. now = Math.floor(now / 64); } util.assert(now === 0, 'Cannot push at time == 0'); var id = timeStampChars.join(''); if (!duplicateTime) { for (i = 0; i < 12; i++) { lastRandChars[i] = Math.floor(Math.random() * 64); } } else { // If the timestamp hasn't changed since last push, use the same random // number, except incremented by 1. for (i = 11; i >= 0 && lastRandChars[i] === 63; i--) { lastRandChars[i] = 0; } lastRandChars[i]++; } for (i = 0; i < 12; i++) { id += PUSH_CHARS.charAt(lastRandChars[i]); } util.assert(id.length === 20, 'nextPushId: Length should be 20.'); return id; }; })(); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * * @param {!string} name * @param {!Node} node * @constructor * @struct */ var NamedNode = /** @class */ (function () { function NamedNode(name, node) { this.name = name; this.node = node; } /** * * @param {!string} name * @param {!Node} node * @return {NamedNode} */ NamedNode.Wrap = function (name, node) { return new NamedNode(name, node); }; return NamedNode; }()); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * * @constructor */ var Index = /** @class */ (function () { function Index() { } /** * @return {function(!NamedNode, !NamedNode):number} A standalone comparison function for * this index */ Index.prototype.getCompare = function () { return this.compare.bind(this); }; /** * Given a before and after value for a node, determine if the indexed value has changed. Even if they are different, * it's possible that the changes are isolated to parts of the snapshot that are not indexed. * * @param {!Node} oldNode * @param {!Node} newNode * @return {boolean} True if the portion of the snapshot being indexed changed between oldNode and newNode */ Index.prototype.indexedValueChanged = function (oldNode, newNode) { var oldWrapped = new NamedNode(MIN_NAME, oldNode); var newWrapped = new NamedNode(MIN_NAME, newNode); return this.compare(oldWrapped, newWrapped) !== 0; }; /** * @return {!NamedNode} a node wrapper that will sort equal to or less than * any other node wrapper, using this index */ Index.prototype.minPost = function () { // eslint-disable-next-line @typescript-eslint/no-explicit-any return NamedNode.MIN; }; return Index; }()); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var __EMPTY_NODE; var KeyIndex = /** @class */ (function (_super) { tslib.__extends(KeyIndex, _super); function KeyIndex() { return _super !== null && _super.apply(this, arguments) || this; } Object.defineProperty(KeyIndex, "__EMPTY_NODE", { get: function () { return __EMPTY_NODE; }, set: function (val) { __EMPTY_NODE = val; }, enumerable: false, configurable: true }); /** * @inheritDoc */ KeyIndex.prototype.compare = function (a, b) { return nameCompare(a.name, b.name); }; /** * @inheritDoc */ KeyIndex.prototype.isDefinedOn = function (node) { // We could probably return true here (since every node has a key), but it's never called // so just leaving unimplemented for now. throw util.assertionError('KeyIndex.isDefinedOn not expected to be called.'); }; /** * @inheritDoc */ KeyIndex.prototype.indexedValueChanged = function (oldNode, newNode) { return false; // The key for a node never changes. }; /** * @inheritDoc */ KeyIndex.prototype.minPost = function () { // eslint-disable-next-line @typescript-eslint/no-explicit-any return NamedNode.MIN; }; /** * @inheritDoc */ KeyIndex.prototype.maxPost = function () { // TODO: This should really be created once and cached in a static property, but // NamedNode isn't defined yet, so I can't use it in a static. Bleh. return new NamedNode(MAX_NAME, __EMPTY_NODE); }; /** * @param {*} indexValue * @param {string} name * @return {!NamedNode} */ KeyIndex.prototype.makePost = function (indexValue, name) { util.assert(typeof indexValue === 'string', 'KeyIndex indexValue must always be a string.'); // We just use empty node, but it'll never be compared, since our comparator only looks at name. return new NamedNode(indexValue, __EMPTY_NODE); }; /** * @return {!string} String representation for inclusion in a query spec */ KeyIndex.prototype.toString = function () { return '.key'; }; return KeyIndex; }(Index)); var KEY_INDEX = new KeyIndex(); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var MAX_NODE; function setMaxNode(val) { MAX_NODE = val; } /** * @param {(!string|!number)} priority * @return {!string} */ var priorityHashText = function (priority) { if (typeof priority === 'number') { return 'number:' + doubleToIEEE754String(priority); } else { return 'string:' + priority; } }; /** * Validates that a priority snapshot Node is valid. * * @param {!Node} priorityNode */ var validatePriorityNode = function (priorityNode) { if (priorityNode.isLeafNode()) { var val = priorityNode.val(); util.assert(typeof val === 'string' || typeof val === 'number' || (typeof val === 'object' && util.contains(val, '.sv')), 'Priority must be a string or number.'); } else { util.assert(priorityNode === MAX_NODE || priorityNode.isEmpty(), 'priority of unexpected type.'); } // Don't call getPriority() on MAX_NODE to avoid hitting assertion. util.assert(priorityNode === MAX_NODE || priorityNode.getPriority().isEmpty(), "Priority nodes can't have a priority of their own."); }; /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var __childrenNodeConstructor; /** * LeafNode is a class for storing leaf nodes in a DataSnapshot. It * implements Node and stores the value of the node (a string, * number, or boolean) accessible via getValue(). */ var LeafNode = /** @class */ (function () { /** * @implements {Node} * @param {!(string|number|boolean|Object)} value_ The value to store in this leaf node. * The object type is possible in the event of a deferred value * @param {!Node=} priorityNode_ The priority of this node. */ function LeafNode(value_, priorityNode_) { if (priorityNode_ === void 0) { priorityNode_ = LeafNode.__childrenNodeConstructor.EMPTY_NODE; } this.value_ = value_; this.priorityNode_ = priorityNode_; this.lazyHash_ = null; util.assert(this.value_ !== undefined && this.value_ !== null, "LeafNode shouldn't be created with null/undefined value."); validatePriorityNode(this.priorityNode_); } Object.defineProperty(LeafNode, "__childrenNodeConstructor", { get: function () { return __childrenNodeConstructor; }, set: function (val) { __childrenNodeConstructor = val; }, enumerable: false, configurable: true }); /** @inheritDoc */ LeafNode.prototype.isLeafNode = function () { return true; }; /** @inheritDoc */ LeafNode.prototype.getPriority = function () { return this.priorityNode_; }; /** @inheritDoc */ LeafNode.prototype.updatePriority = function (newPriorityNode) { return new LeafNode(this.value_, newPriorityNode); }; /** @inheritDoc */ LeafNode.prototype.getImmediateChild = function (childName) { // Hack to treat priority as a regular child if (childName === '.priority') { return this.priorityNode_; } else { return LeafNode.__childrenNodeConstructor.EMPTY_NODE; } }; /** @inheritDoc */ LeafNode.prototype.getChild = function (path) { if (path.isEmpty()) { return this; } else if (path.getFront() === '.priority') { return this.priorityNode_; } else { return LeafNode.__childrenNodeConstructor.EMPTY_NODE; } }; /** * @inheritDoc */ LeafNode.prototype.hasChild = function () { return false; }; /** @inheritDoc */ LeafNode.prototype.getPredecessorChildName = function (childName, childNode) { return null; }; /** @inheritDoc */ LeafNode.prototype.updateImmediateChild = function (childName, newChildNode) { if (childName === '.priority') { return this.updatePriority(newChildNode); } else if (newChildNode.isEmpty() && childName !== '.priority') { return this; } else { return LeafNode.__childrenNodeConstructor.EMPTY_NODE.updateImmediateChild(childName, newChildNode).updatePriority(this.priorityNode_); } }; /** @inheritDoc */ LeafNode.prototype.updateChild = function (path, newChildNode) { var front = path.getFront(); if (front === null) { return newChildNode; } else if (newChildNode.isEmpty() && front !== '.priority') { return this; } else { util.assert(front !== '.priority' || path.getLength() === 1, '.priority must be the last token in a path'); return this.updateImmediateChild(front, LeafNode.__childrenNodeConstructor.EMPTY_NODE.updateChild(path.popFront(), newChildNode)); } }; /** @inheritDoc */ LeafNode.prototype.isEmpty = function () { return false; }; /** @inheritDoc */ LeafNode.prototype.numChildren = function () { return 0; }; /** @inheritDoc */ LeafNode.prototype.forEachChild = function (index, action) { return false; }; /** * @inheritDoc */ LeafNode.prototype.val = function (exportFormat) { if (exportFormat && !this.getPriority().isEmpty()) { return { '.value': this.getValue(), '.priority': this.getPriority().val() }; } else { return this.getValue(); } }; /** @inheritDoc */ LeafNode.prototype.hash = function () { if (this.lazyHash_ === null) { var toHash = ''; if (!this.priorityNode_.isEmpty()) { toHash += 'priority:' + priorityHashText(this.priorityNode_.val()) + ':'; } var type = typeof this.value_; toHash += type + ':'; if (type === 'number') { toHash += doubleToIEEE754String(this.value_); } else { toHash += this.value_; } this.lazyHash_ = sha1(toHash); } return this.lazyHash_; }; /** * Returns the value of the leaf node. * @return {Object|string|number|boolean} The value of the node. */ LeafNode.prototype.getValue = function () { return this.value_; }; /** * @inheritDoc */ LeafNode.prototype.compareTo = function (other) { if (other === LeafNode.__childrenNodeConstructor.EMPTY_NODE) { return 1; } else if (other instanceof LeafNode.__childrenNodeConstructor) { return -1; } else { util.assert(other.isLeafNode(), 'Unknown node type'); return this.compareToLeafNode_(other); } }; /** * Comparison specifically for two leaf nodes * @param {!LeafNode} otherLeaf * @return {!number} * @private */ LeafNode.prototype.compareToLeafNode_ = function (otherLeaf) { var otherLeafType = typeof otherLeaf.value_; var thisLeafType = typeof this.value_; var otherIndex = LeafNode.VALUE_TYPE_ORDER.indexOf(otherLeafType); var thisIndex = LeafNode.VALUE_TYPE_ORDER.indexOf(thisLeafType); util.assert(otherIndex >= 0, 'Unknown leaf type: ' + otherLeafType); util.assert(thisIndex >= 0, 'Unknown leaf type: ' + thisLeafType); if (otherIndex === thisIndex) { // Same type, compare values if (thisLeafType === 'object') { // Deferred value nodes are all equal, but we should also never get to this point... return 0; } else { // Note that this works because true > false, all others are number or string comparisons if (this.value_ < otherLeaf.value_) { return -1; } else if (this.value_ === otherLeaf.value_) { return 0; } else { return 1; } } } else { return thisIndex - otherIndex; } }; /** * @inheritDoc */ LeafNode.prototype.withIndex = function () { return this; }; /** * @inheritDoc */ LeafNode.prototype.isIndexed = function () { return true; }; /** * @inheritDoc */ LeafNode.prototype.equals = function (other) { /** * @inheritDoc */ if (other === this) { return true; } else if (other.isLeafNode()) { var otherLeaf = other; return (this.value_ === otherLeaf.value_ && this.priorityNode_.equals(otherLeaf.priorityNode_)); } else { return false; } }; /** * The sort order for comparing leaf nodes of different types. If two leaf nodes have * the same type, the comparison falls back to their value * @type {Array.<!string>} * @const */ LeafNode.VALUE_TYPE_ORDER = ['object', 'boolean', 'number', 'string']; return LeafNode; }()); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var nodeFromJSON; var MAX_NODE$1; function setNodeFromJSON(val) { nodeFromJSON = val; } function setMaxNode$1(val) { MAX_NODE$1 = val; } /** * @constructor * @extends {Index} * @private */ var PriorityIndex = /** @class */ (function (_super) { tslib.__extends(PriorityIndex, _super); function PriorityIndex() { return _super !== null && _super.apply(this, arguments) || this; } /** * @inheritDoc */ PriorityIndex.prototype.compare = function (a, b) { var aPriority = a.node.getPriority(); var bPriority = b.node.getPriority(); var indexCmp = aPriority.compareTo(bPriority); if (indexCmp === 0) { return nameCompare(a.name, b.name); } else { return indexCmp; } }; /** * @inheritDoc */ PriorityIndex.prototype.isDefinedOn = function (node) { return !node.getPriority().isEmpty(); }; /** * @inheritDoc */ PriorityIndex.prototype.indexedValueChanged = function (oldNode, newNode) { return !oldNode.getPriority().equals(newNode.getPriority()); }; /** * @inheritDoc */ PriorityIndex.prototype.minPost = function () { // eslint-disable-next-line @typescript-eslint/no-explicit-any return NamedNode.MIN; }; /** * @inheritDoc */ PriorityIndex.prototype.maxPost = function () { return new NamedNode(MAX_NAME, new LeafNode('[PRIORITY-POST]', MAX_NODE$1)); }; /** * @param {*} indexValue * @param {string} name * @return {!NamedNode} */ PriorityIndex.prototype.makePost = function (indexValue, name) { var priorityNode = nodeFromJSON(indexValue); return new NamedNode(name, new LeafNode('[PRIORITY-POST]', priorityNode)); }; /** * @return {!string} String representation for inclusion in a query spec */ PriorityIndex.prototype.toString = function () { return '.priority'; }; return PriorityIndex; }(Index)); var PRIORITY_INDEX = new PriorityIndex(); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * An iterator over an LLRBNode. */ var SortedMapIterator = /** @class */ (function () { /** * @template K, V, T * @param {LLRBNode|LLRBEmptyNode} node Node to iterate. * @param {?K} startKey * @param {function(K, K): number} comparator * @param {boolean} isReverse_ Whether or not to iterate in reverse * @param {(function(K, V):T)=} resultGenerator_ */ function SortedMapIterator(node, startKey, comparator, isReverse_, resultGenerator_) { if (resultGenerator_ === void 0) { resultGenerator_ = null; } this.isReverse_ = isReverse_; this.resultGenerator_ = resultGenerator_; /** @private * @type {Array.<!LLRBNode>} */ this.nodeStack_ = []; var cmp = 1; while (!node.isEmpty()) { node = node; cmp = startKey ? comparator(node.key, startKey) : 1; // flip the comparison if we're going in reverse if (isReverse_) { cmp *= -1; } if (cmp < 0) { // This node is less than our start key. ignore it if (this.isReverse_) { node = node.left; } else { node = node.right; } } else if (cmp === 0) { // This node is exactly equal to our start key. Push it on the stack, but stop iterating; this.nodeStack_.push(node); break; } else { // This node is greater than our start key, add it to the stack and move to the next one this.nodeStack_.push(node); if (this.isReverse_) { node = node.right; } else { node = node.left; } } } } SortedMapIterator.prototype.getNext = function () { if (this.nodeStack_.length === 0) { return null; } var node = this.nodeStack_.pop(); var result; if (this.resultGenerator_) { result = this.resultGenerator_(node.key, node.value); } else { result = { key: node.key, value: node.value }; } if (this.isReverse_) { node = node.left; while (!node.isEmpty()) { this.nodeStack_.push(node); node = node.right; } } else { node = node.right; while (!node.isEmpty()) { this.nodeStack_.push(node); node = node.left; } } return result; }; SortedMapIterator.prototype.hasNext = function () { return this.nodeStack_.length > 0; }; SortedMapIterator.prototype.peek = function () { if (this.nodeStack_.length === 0) { return null; } var node = this.nodeStack_[this.nodeStack_.length - 1]; if (this.resultGenerator_) { return this.resultGenerator_(node.key, node.value); } else { return { key: node.key, value: node.value }; } }; return SortedMapIterator; }()); /** * Represents a node in a Left-leaning Red-Black tree. */ var LLRBNode = /** @class */ (function () { /** * @template K, V * @param {!K} key Key associated with this node. * @param {!V} value Value associated with this node. * @param {?boolean} color Whether this node is red. * @param {?(LLRBNode|LLRBEmptyNode)=} left Left child. * @param {?(LLRBNode|LLRBEmptyNode)=} right Right child. */ function LLRBNode(key, value, color, left, right) { this.key = key; this.value = value; this.color = color != null ? color : LLRBNode.RED; this.left = left != null ? left : SortedMap.EMPTY_NODE; this.right = right != null ? right : SortedMap.EMPTY_NODE; } /** * Returns a copy of the current node, optionally replacing pieces of it. * * @param {?K} key New key for the node, or null. * @param {?V} value New value for the node, or null. * @param {?boolean} color New color for the node, or null. * @param {?LLRBNode|LLRBEmptyNode} left New left child for the node, or null. * @param {?LLRBNode|LLRBEmptyNode} right New right child for the node, or null. * @return {!LLRBNode} The node copy. */ LLRBNode.prototype.copy = function (key, value, color, left, right) { return new LLRBNode(key != null ? key : this.key, value != null ? value : this.value, color != null ? color : this.color, left != null ? left : this.left, right != null ? right : this.right); }; /** * @return {number} The total number of nodes in the tree. */ LLRBNode.prototype.count = function () { return this.left.count() + 1 + this.right.count(); }; /** * @return {boolean} True if the tree is empty. */ LLRBNode.prototype.isEmpty = function () { return false; }; /** * Traverses the tree in key order and calls the specified action function * for each node. * * @param {function(!K, !V):*} action Callback function to be called for each * node. If it returns true, traversal is aborted. * @return {*} The first truthy value returned by action, or the last falsey * value returned by action */ LLRBNode.prototype.inorderTraversal = function (action) { return (this.left.inorderTraversal(action) || !!action(this.key, this.value) || this.right.inorderTraversal(action)); }; /** * Traverses the tree in reverse key order and calls the specified action function * for each node. * * @param {function(!Object, !Object)} action Callback function to be called for each * node. If it returns true, traversal is aborted. * @return {*} True if traversal was aborted. */ LLRBNode.prototype.reverseTraversal = function (action) { return (this.right.reverseTraversal(action) || action(this.key, this.value) || this.left.reverseTraversal(action)); }; /** * @return {!Object} The minimum node in the tree. * @private */ LLRBNode.prototype.min_ = function () { if (this.left.isEmpty()) { return this; } else { return this.left.min_(); } }; /** * @return {!K} The maximum key in the tree. */ LLRBNode.prototype.minKey = function () { return this.min_().key; }; /** * @return {!K} The maximum key in the tree. */ LLRBNode.prototype.maxKey = function () { if (this.right.isEmpty()) { return this.key; } else { return this.right.maxKey(); } }; /** * * @param {!Object} key Key to insert. * @param {!Object} value Value to insert. * @param {Comparator} comparator Comparator. * @return {!LLRBNode} New tree, with the key/value added. */ LLRBNode.prototype.insert = function (key, value, comparator) { var n = this; var cmp = comparator(key, n.key); if (cmp < 0) { n = n.copy(null, null, null, n.left.insert(key, value, comparator), null); } else if (cmp === 0) { n = n.copy(null, value, null, null, null); } else { n = n.copy(null, null, null, null, n.right.insert(key, value, comparator)); } return n.fixUp_(); }; /** * @private * @return {!LLRBNode|LLRBEmptyNode} New tree, with the minimum key removed. */ LLRBNode.prototype.removeMin_ = function () { if (this.left.isEmpty()) { return SortedMap.EMPTY_NODE; } var n = this; if (!n.left.isRed_() && !n.left.left.isRed_()) { n = n.moveRedLeft_(); } n = n.copy(null, null, null, n.left.removeMin_(), null); return n.fixUp_(); }; /** * @param {!Object} key The key of the item to remove. * @param {Comparator} comparator Comparator. * @return {!LLRBNode|LLRBEmptyNode} New tree, with the specified item removed. */ LLRBNode.prototype.remove = function (key, comparator) { var n, smallest; n = this; if (comparator(key, n.key) < 0) { if (!n.left.isEmpty() && !n.left.isRed_() && !n.left.left.isRed_()) { n = n.moveRedLeft_(); } n = n.copy(null, null, null, n.left.remove(key, comparator), null); } else { if (n.left.isRed_()) { n = n.rotateRight_(); } if (!n.right.isEmpty() && !n.right.isRed_() && !n.right.left.isRed_()) { n = n.moveRedRight_(); } if (comparator(key, n.key) === 0) { if (n.right.isEmpty()) { return SortedMap.EMPTY_NODE; } else { smallest = n.right.min_(); n = n.copy(smallest.key, smallest.value, null, null, n.right.removeMin_()); } } n = n.copy(null, null, null, null, n.right.remove(key, comparator)); } return n.fixUp_(); }; /** * @private * @return {boolean} Whether this is a RED node. */ LLRBNode.prototype.isRed_ = function () { return this.color; }; /** * @private * @return {!LLRBNode} New tree after performing any needed rotations. */ LLRBNode.prototype.fixUp_ = function () { var n = this; if (n.right.isRed_() && !n.left.isRed_()) { n = n.rotateLeft_(); } if (n.left.isRed_() && n.left.left.isRed_()) { n = n.rotateRight_(); } if (n.left.isRed_() && n.right.isRed_()) { n = n.colorFlip_(); } return n; }; /** * @private * @return {!LLRBNode} New tree, after moveRedLeft. */ LLRBNode.prototype.moveRedLeft_ = function () { var n = this.colorFlip_(); if (n.right.left.isRed_()) { n = n.copy(null, null, null, null, n.right.rotateRight_()); n = n.rotateLeft_(); n = n.colorFlip_(); } return n; }; /** * @private * @return {!LLRBNode} New tree, after moveRedRight. */ LLRBNode.prototype.moveRedRight_ = function () { var n = this.colorFlip_(); if (n.left.left.isRed_()) { n = n.rotateRight_(); n = n.colorFlip_(); } return n; }; /** * @private * @return {!LLRBNode} New tree, after rotateLeft. */ LLRBNode.prototype.rotateLeft_ = function () { var nl = this.copy(null, null, LLRBNode.RED, null, this.right.left); return this.right.copy(null, null, this.color, nl, null); }; /** * @private * @return {!LLRBNode} New tree, after rotateRight. */ LLRBNode.prototype.rotateRight_ = function () { var nr = this.copy(null, null, LLRBNode.RED, this.left.right, null); return this.left.copy(null, null, this.color, null, nr); }; /** * @private * @return {!LLRBNode} New tree, after colorFlip. */ LLRBNode.prototype.colorFlip_ = function () { var left = this.left.copy(null, null, !this.left.color, null, null); var right = this.right.copy(null, null, !this.right.color, null, null); return this.copy(null, null, !this.color, left, right); }; /** * For testing. * * @private * @return {boolean} True if all is well. */ LLRBNode.prototype.checkMaxDepth_ = function () { var blackDepth = this.check_(); return Math.pow(2.0, blackDepth) <= this.count() + 1; }; /** * @private * @return {number} Not sure what this returns exactly. :-). */ LLRBNode.prototype.check_ = function () { if (this.isRed_() && this.left.isRed_()) { throw new Error('Red node has red child(' + this.key + ',' + this.value + ')'); } if (this.right.isRed_()) { throw new Error('Right child of (' + this.key + ',' + this.value + ') is red'); } var blackDepth = this.left.check_(); if (blackDepth !== this.right.check_()) { throw new Error('Black depths differ'); } else { return blackDepth + (this.isRed_() ? 0 : 1); } }; LLRBNode.RED = true; LLRBNode.BLACK = false; return LLRBNode; }()); /** * Represents an empty node (a leaf node in the Red-Black Tree). */ var LLRBEmptyNode = /** @class */ (function () { function LLRBEmptyNode() { } /** * Returns a copy of the current node. * * @return {!LLRBEmptyNode} The node copy. */ LLRBEmptyNode.prototype.copy = function (key, value, color, left, right) { return this; }; /** * Returns a copy of the tree, with the specified key/value added. * * @param {!K} key Key to be added. * @param {!V} value Value to be added. * @param {Comparator} comparator Comparator. * @return {!LLRBNode} New tree, with item added. */ LLRBEmptyNode.prototype.insert = function (key, value, comparator) { return new LLRBNode(key, value, null); }; /** * Returns a copy of the tree, with the specified key removed. * * @param {!K} key The key to remove. * @param {Comparator} comparator Comparator. * @return {!LLRBEmptyNode} New tree, with item removed. */ LLRBEmptyNode.prototype.remove = function (key, comparator) { return this; }; /** * @return {number} The total number of nodes in the tree. */ LLRBEmptyNode.prototype.count = function () { return 0; }; /** * @return {boolean} True if the tree is empty. */ LLRBEmptyNode.prototype.isEmpty = function () { return true; }; /** * Traverses the tree in key order and calls the specified action function * for each node. * * @param {function(!K, !V):*} action Callback function to be called for each * node. If it returns true, traversal is aborted. * @return {boolean} True if traversal was aborted. */ LLRBEmptyNode.prototype.inorderTraversal = function (action) { return false; }; /** * Traverses the tree in reverse key order and calls the specified action function * for each node. * * @param {function(!K, !V)} action Callback function to be called for each * node. If it returns true, traversal is aborted. * @return {boolean} True if traversal was aborted. */ LLRBEmptyNode.prototype.reverseTraversal = function (action) { return false; }; /** * @return {null} */ LLRBEmptyNode.prototype.minKey = function () { return null; }; /** * @return {null} */ LLRBEmptyNode.prototype.maxKey = function () { return null; }; /** * @private * @return {number} Not sure what this returns exactly. :-). */ LLRBEmptyNode.prototype.check_ = function () { return 0; }; /** * @private * @return {boolean} Whether this node is red. */ LLRBEmptyNode.prototype.isRed_ = function () { return false; }; return LLRBEmptyNode; }()); /** * An immutable sorted map implementation, based on a Left-leaning Red-Black * tree. */ var SortedMap = /** @class */ (function () { /** * @template K, V * @param {function(K, K):number} comparator_ Key comparator. * @param {LLRBNode=} root_ (Optional) Root node for the map. */ function SortedMap(comparator_, root_) { if (root_ === void 0) { root_ = SortedMap.EMPTY_NODE; } this.comparator_ = comparator_; this.root_ = root_; } /** * Returns a copy of the map, with the specified key/value added or replaced. * (TODO: We should perhaps rename this method to 'put') * * @param {!K} key Key to be added. * @param {!V} value Value to be added. * @return {!SortedMap.<K, V>} New map, with item added. */ SortedMap.prototype.insert = function (key, value) { return new SortedMap(this.comparator_, this.root_ .insert(key, value, this.comparator_) .copy(null, null, LLRBNode.BLACK, null, null)); }; /** * Returns a copy of the map, with the specified key removed. * * @param {!K} key The key to remove. * @return {!SortedMap.<K, V>} New map, with item removed. */ SortedMap.prototype.remove = function (key) { return new SortedMap(this.comparator_, this.root_ .remove(key, this.comparator_) .copy(null, null, LLRBNode.BLACK, null, null)); }; /** * Returns the value of the node with the given key, or null. * * @param {!K} key The key to look up. * @return {?V} The value of the node with the given key, or null if the * key doesn't exist. */ SortedMap.prototype.get = function (key) { var cmp; var node = this.root_; while (!node.isEmpty()) { cmp = this.comparator_(key, node.key); if (cmp === 0) { return node.value; } else if (cmp < 0) { node = node.left; } else if (cmp > 0) { node = node.right; } } return null; }; /** * Returns the key of the item *before* the specified key, or null if key is the first item. * @param {K} key The key to find the predecessor of * @return {?K} The predecessor key. */ SortedMap.prototype.getPredecessorKey = function (key) { var cmp, node = this.root_, rightParent = null; while (!node.isEmpty()) { cmp = this.comparator_(key, node.key); if (cmp === 0) { if (!node.left.isEmpty()) { node = node.left; while (!node.right.isEmpty()) { node = node.right; } return node.key; } else if (rightParent) { return rightParent.key; } else { return null; // first item. } } else if (cmp < 0) { node = node.left; } else if (cmp > 0) { rightParent = node; node = node.right; } } throw new Error('Attempted to find predecessor key for a nonexistent key. What gives?'); }; /** * @return {boolean} True if the map is empty. */ SortedMap.prototype.isEmpty = function () { return this.root_.isEmpty(); }; /** * @return {number} The total number of nodes in the map. */ SortedMap.prototype.count = function () { return this.root_.count(); }; /** * @return {?K} The minimum key in the map. */ SortedMap.prototype.minKey = function () { return this.root_.minKey(); }; /** * @return {?K} The maximum key in the map. */ SortedMap.prototype.maxKey = function () { return this.root_.maxKey(); }; /** * Traverses the map in key order and calls the specified action function * for each key/value pair. * * @param {function(!K, !V):*} action Callback function to be called * for each key/value pair. If action returns true, traversal is aborted. * @return {*} The first truthy value returned by action, or the last falsey * value returned by action */ SortedMap.prototype.inorderTraversal = function (action) { return this.root_.inorderTraversal(action); }; /** * Traverses the map in reverse key order and calls the specified action function * for each key/value pair. * * @param {function(!Object, !Object)} action Callback function to be called * for each key/value pair. If action returns true, traversal is aborted. * @return {*} True if the traversal was aborted. */ SortedMap.prototype.reverseTraversal = function (action) { return this.root_.reverseTraversal(action); }; /** * Returns an iterator over the SortedMap. * @template T * @param {(function(K, V):T)=} resultGenerator * @return {SortedMapIterator.<K, V, T>} The iterator. */ SortedMap.prototype.getIterator = function (resultGenerator) { return new SortedMapIterator(this.root_, null, this.comparator_, false, resultGenerator); }; SortedMap.prototype.getIteratorFrom = function (key, resultGenerator) { return new SortedMapIterator(this.root_, key, this.comparator_, false, resultGenerator); }; SortedMap.prototype.getReverseIteratorFrom = function (key, resultGenerator) { return new SortedMapIterator(this.root_, key, this.comparator_, true, resultGenerator); }; SortedMap.prototype.getReverseIterator = function (resultGenerator) { return new SortedMapIterator(this.root_, null, this.comparator_, true, resultGenerator); }; /** * Always use the same empty node, to reduce memory. * @const */ SortedMap.EMPTY_NODE = new LLRBEmptyNode(); return SortedMap; }()); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var LOG_2 = Math.log(2); /** * @constructor */ var Base12Num = /** @class */ (function () { /** * @param {number} length */ function Base12Num(length) { var logBase2 = function (num) { // eslint-disable-next-line @typescript-eslint/no-explicit-any return parseInt((Math.log(num) / LOG_2), 10); }; var bitMask = function (bits) { return parseInt(Array(bits + 1).join('1'), 2); }; this.count = logBase2(length + 1); this.current_ = this.count - 1; var mask = bitMask(this.count); this.bits_ = (length + 1) & mask; } /** * @return {boolean} */ Base12Num.prototype.nextBitIsOne = function () { //noinspection JSBitwiseOperatorUsage var result = !(this.bits_ & (0x1 << this.current_)); this.current_--; return result; }; return Base12Num; }()); /** * Takes a list of child nodes and constructs a SortedSet using the given comparison * function * * Uses the algorithm described in the paper linked here: * http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.46.1458 * * @template K, V * @param {Array.<!NamedNode>} childList Unsorted list of children * @param {function(!NamedNode, !NamedNode):number} cmp The comparison method to be used * @param {(function(NamedNode):K)=} keyFn An optional function to extract K from a node wrapper, if K's * type is not NamedNode * @param {(function(K, K):number)=} mapSortFn An optional override for comparator used by the generated sorted map * @return {SortedMap.<K, V>} */ var buildChildSet = function (childList, cmp, keyFn, mapSortFn) { childList.sort(cmp); var buildBalancedTree = function (low, high) { var length = high - low; var namedNode; var key; if (length === 0) { return null; } else if (length === 1) { namedNode = childList[low]; key = keyFn ? keyFn(namedNode) : namedNode; return new LLRBNode(key, namedNode.node, LLRBNode.BLACK, null, null); } else { // eslint-disable-next-line @typescript-eslint/no-explicit-any var middle = parseInt((length / 2), 10) + low; var left = buildBalancedTree(low, middle); var right = buildBalancedTree(middle + 1, high); namedNode = childList[middle]; key = keyFn ? keyFn(namedNode) : namedNode; return new LLRBNode(key, namedNode.node, LLRBNode.BLACK, left, right); } }; var buildFrom12Array = function (base12) { var node = null; var root = null; var index = childList.length; var buildPennant = function (chunkSize, color) { var low = index - chunkSize; var high = index; index -= chunkSize; var childTree = buildBalancedTree(low + 1, high); var namedNode = childList[low]; var key = keyFn ? keyFn(namedNode) : namedNode; attachPennant(new LLRBNode(key, namedNode.node, color, null, childTree)); }; var attachPennant = function (pennant) { if (node) { node.left = pennant; node = pennant; } else { root = pennant; node = pennant; } }; for (var i = 0; i < base12.count; ++i) { var isOne = base12.nextBitIsOne(); // The number of nodes taken in each slice is 2^(arr.length - (i + 1)) var chunkSize = Math.pow(2, base12.count - (i + 1)); if (isOne) { buildPennant(chunkSize, LLRBNode.BLACK); } else { // current == 2 buildPennant(chunkSize, LLRBNode.BLACK); buildPennant(chunkSize, LLRBNode.RED); } } return root; }; var base12 = new Base12Num(childList.length); var root = buildFrom12Array(base12); // eslint-disable-next-line @typescript-eslint/no-explicit-any return new SortedMap(mapSortFn || cmp, root); }; /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var _defaultIndexMap; var fallbackObject = {}; var IndexMap = /** @class */ (function () { function IndexMap(indexes_, indexSet_) { this.indexes_ = indexes_; this.indexSet_ = indexSet_; } Object.defineProperty(IndexMap, "Default", { /** * The default IndexMap for nodes without a priority */ get: function () { util.assert(fallbackObject && PRIORITY_INDEX, 'ChildrenNode.ts has not been loaded'); _defaultIndexMap = _defaultIndexMap || new IndexMap({ '.priority': fallbackObject }, { '.priority': PRIORITY_INDEX }); return _defaultIndexMap; }, enumerable: false, configurable: true }); IndexMap.prototype.get = function (indexKey) { var sortedMap = util.safeGet(this.indexes_, indexKey); if (!sortedMap) { throw new Error('No index defined for ' + indexKey); } if (sortedMap instanceof SortedMap) { return sortedMap; } else { // The index exists, but it falls back to just name comparison. Return null so that the calling code uses the // regular child map return null; } }; IndexMap.prototype.hasIndex = function (indexDefinition) { return util.contains(this.indexSet_, indexDefinition.toString()); }; IndexMap.prototype.addIndex = function (indexDefinition, existingChildren) { util.assert(indexDefinition !== KEY_INDEX, "KeyIndex always exists and isn't meant to be added to the IndexMap."); var childList = []; var sawIndexedValue = false; var iter = existingChildren.getIterator(NamedNode.Wrap); var next = iter.getNext(); while (next) { sawIndexedValue = sawIndexedValue || indexDefinition.isDefinedOn(next.node); childList.push(next); next = iter.getNext(); } var newIndex; if (sawIndexedValue) { newIndex = buildChildSet(childList, indexDefinition.getCompare()); } else { newIndex = fallbackObject; } var indexName = indexDefinition.toString(); var newIndexSet = tslib.__assign({}, this.indexSet_); newIndexSet[indexName] = indexDefinition; var newIndexes = tslib.__assign({}, this.indexes_); newIndexes[indexName] = newIndex; return new IndexMap(newIndexes, newIndexSet); }; /** * Ensure that this node is properly tracked in any indexes that we're maintaining */ IndexMap.prototype.addToIndexes = function (namedNode, existingChildren) { var _this = this; var newIndexes = util.map(this.indexes_, function (indexedChildren, indexName) { var index = util.safeGet(_this.indexSet_, indexName); util.assert(index, 'Missing index implementation for ' + indexName); if (indexedChildren === fallbackObject) { // Check to see if we need to index everything if (index.isDefinedOn(namedNode.node)) { // We need to build this index var childList = []; var iter = existingChildren.getIterator(NamedNode.Wrap); var next = iter.getNext(); while (next) { if (next.name !== namedNode.name) { childList.push(next); } next = iter.getNext(); } childList.push(namedNode); return buildChildSet(childList, index.getCompare()); } else { // No change, this remains a fallback return fallbackObject; } } else { var existingSnap = existingChildren.get(namedNode.name); var newChildren = indexedChildren; if (existingSnap) { newChildren = newChildren.remove(new NamedNode(namedNode.name, existingSnap)); } return newChildren.insert(namedNode, namedNode.node); } }); return new IndexMap(newIndexes, this.indexSet_); }; /** * Create a new IndexMap instance with the given value removed */ IndexMap.prototype.removeFromIndexes = function (namedNode, existingChildren) { var newIndexes = util.map(this.indexes_, function (indexedChildren) { if (indexedChildren === fallbackObject) { // This is the fallback. Just return it, nothing to do in this case return indexedChildren; } else { var existingSnap = existingChildren.get(namedNode.name); if (existingSnap) { return indexedChildren.remove(new NamedNode(namedNode.name, existingSnap)); } else { // No record of this child return indexedChildren; } } }); return new IndexMap(newIndexes, this.indexSet_); }; return IndexMap; }()); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ function NAME_ONLY_COMPARATOR(left, right) { return nameCompare(left.name, right.name); } function NAME_COMPARATOR(left, right) { return nameCompare(left, right); } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // TODO: For memory savings, don't store priorityNode_ if it's empty. var EMPTY_NODE; /** * ChildrenNode is a class for storing internal nodes in a DataSnapshot * (i.e. nodes with children). It implements Node and stores the * list of children in the children property, sorted by child name. * * @constructor * @implements {Node} */ var ChildrenNode = /** @class */ (function () { /** * * @param {!SortedMap.<string, !Node>} children_ List of children * of this node.. * @param {?Node} priorityNode_ The priority of this node (as a snapshot node). * @param {!IndexMap} indexMap_ */ function ChildrenNode(children_, priorityNode_, indexMap_) { this.children_ = children_; this.priorityNode_ = priorityNode_; this.indexMap_ = indexMap_; this.lazyHash_ = null; /** * Note: The only reason we allow null priority is for EMPTY_NODE, since we can't use * EMPTY_NODE as the priority of EMPTY_NODE. We might want to consider making EMPTY_NODE its own * class instead of an empty ChildrenNode. */ if (this.priorityNode_) { validatePriorityNode(this.priorityNode_); } if (this.children_.isEmpty()) { util.assert(!this.priorityNode_ || this.priorityNode_.isEmpty(), 'An empty node cannot have a priority'); } } Object.defineProperty(ChildrenNode, "EMPTY_NODE", { get: function () { return (EMPTY_NODE || (EMPTY_NODE = new ChildrenNode(new SortedMap(NAME_COMPARATOR), null, IndexMap.Default))); }, enumerable: false, configurable: true }); /** @inheritDoc */ ChildrenNode.prototype.isLeafNode = function () { return false; }; /** @inheritDoc */ ChildrenNode.prototype.getPriority = function () { return this.priorityNode_ || EMPTY_NODE; }; /** @inheritDoc */ ChildrenNode.prototype.updatePriority = function (newPriorityNode) { if (this.children_.isEmpty()) { // Don't allow priorities on empty nodes return this; } else { return new ChildrenNode(this.children_, newPriorityNode, this.indexMap_); } }; /** @inheritDoc */ ChildrenNode.prototype.getImmediateChild = function (childName) { // Hack to treat priority as a regular child if (childName === '.priority') { return this.getPriority(); } else { var child = this.children_.get(childName); return child === null ? EMPTY_NODE : child; } }; /** @inheritDoc */ ChildrenNode.prototype.getChild = function (path) { var front = path.getFront(); if (front === null) { return this; } return this.getImmediateChild(front).getChild(path.popFront()); }; /** @inheritDoc */ ChildrenNode.prototype.hasChild = function (childName) { return this.children_.get(childName) !== null; }; /** @inheritDoc */ ChildrenNode.prototype.updateImmediateChild = function (childName, newChildNode) { util.assert(newChildNode, 'We should always be passing snapshot nodes'); if (childName === '.priority') { return this.updatePriority(newChildNode); } else { var namedNode = new NamedNode(childName, newChildNode); var newChildren = void 0, newIndexMap = void 0; if (newChildNode.isEmpty()) { newChildren = this.children_.remove(childName); newIndexMap = this.indexMap_.removeFromIndexes(namedNode, this.children_); } else { newChildren = this.children_.insert(childName, newChildNode); newIndexMap = this.indexMap_.addToIndexes(namedNode, this.children_); } var newPriority = newChildren.isEmpty() ? EMPTY_NODE : this.priorityNode_; return new ChildrenNode(newChildren, newPriority, newIndexMap); } }; /** @inheritDoc */ ChildrenNode.prototype.updateChild = function (path, newChildNode) { var front = path.getFront(); if (front === null) { return newChildNode; } else { util.assert(path.getFront() !== '.priority' || path.getLength() === 1, '.priority must be the last token in a path'); var newImmediateChild = this.getImmediateChild(front).updateChild(path.popFront(), newChildNode); return this.updateImmediateChild(front, newImmediateChild); } }; /** @inheritDoc */ ChildrenNode.prototype.isEmpty = function () { return this.children_.isEmpty(); }; /** @inheritDoc */ ChildrenNode.prototype.numChildren = function () { return this.children_.count(); }; /** @inheritDoc */ ChildrenNode.prototype.val = function (exportFormat) { if (this.isEmpty()) { return null; } var obj = {}; var numKeys = 0, maxKey = 0, allIntegerKeys = true; this.forEachChild(PRIORITY_INDEX, function (key, childNode) { obj[key] = childNode.val(exportFormat); numKeys++; if (allIntegerKeys && ChildrenNode.INTEGER_REGEXP_.test(key)) { maxKey = Math.max(maxKey, Number(key)); } else { allIntegerKeys = false; } }); if (!exportFormat && allIntegerKeys && maxKey < 2 * numKeys) { // convert to array. var array = []; // eslint-disable-next-line guard-for-in for (var key in obj) { array[key] = obj[key]; } return array; } else { if (exportFormat && !this.getPriority().isEmpty()) { obj['.priority'] = this.getPriority().val(); } return obj; } }; /** @inheritDoc */ ChildrenNode.prototype.hash = function () { if (this.lazyHash_ === null) { var toHash_1 = ''; if (!this.getPriority().isEmpty()) { toHash_1 += 'priority:' + priorityHashText(this.getPriority().val()) + ':'; } this.forEachChild(PRIORITY_INDEX, function (key, childNode) { var childHash = childNode.hash(); if (childHash !== '') { toHash_1 += ':' + key + ':' + childHash; } }); this.lazyHash_ = toHash_1 === '' ? '' : sha1(toHash_1); } return this.lazyHash_; }; /** @inheritDoc */ ChildrenNode.prototype.getPredecessorChildName = function (childName, childNode, index) { var idx = this.resolveIndex_(index); if (idx) { var predecessor = idx.getPredecessorKey(new NamedNode(childName, childNode)); return predecessor ? predecessor.name : null; } else { return this.children_.getPredecessorKey(childName); } }; /** * @param {!Index} indexDefinition * @return {?string} */ ChildrenNode.prototype.getFirstChildName = function (indexDefinition) { var idx = this.resolveIndex_(indexDefinition); if (idx) { var minKey = idx.minKey(); return minKey && minKey.name; } else { return this.children_.minKey(); } }; /** * @param {!Index} indexDefinition * @return {?NamedNode} */ ChildrenNode.prototype.getFirstChild = function (indexDefinition) { var minKey = this.getFirstChildName(indexDefinition); if (minKey) { return new NamedNode(minKey, this.children_.get(minKey)); } else { return null; } }; /** * Given an index, return the key name of the largest value we have, according to that index * @param {!Index} indexDefinition * @return {?string} */ ChildrenNode.prototype.getLastChildName = function (indexDefinition) { var idx = this.resolveIndex_(indexDefinition); if (idx) { var maxKey = idx.maxKey(); return maxKey && maxKey.name; } else { return this.children_.maxKey(); } }; /** * @param {!Index} indexDefinition * @return {?NamedNode} */ ChildrenNode.prototype.getLastChild = function (indexDefinition) { var maxKey = this.getLastChildName(indexDefinition); if (maxKey) { return new NamedNode(maxKey, this.children_.get(maxKey)); } else { return null; } }; /** * @inheritDoc */ ChildrenNode.prototype.forEachChild = function (index, action) { var idx = this.resolveIndex_(index); if (idx) { return idx.inorderTraversal(function (wrappedNode) { return action(wrappedNode.name, wrappedNode.node); }); } else { return this.children_.inorderTraversal(action); } }; /** * @param {!Index} indexDefinition * @return {SortedMapIterator} */ ChildrenNode.prototype.getIterator = function (indexDefinition) { return this.getIteratorFrom(indexDefinition.minPost(), indexDefinition); }; /** * * @param {!NamedNode} startPost * @param {!Index} indexDefinition * @return {!SortedMapIterator} */ ChildrenNode.prototype.getIteratorFrom = function (startPost, indexDefinition) { var idx = this.resolveIndex_(indexDefinition); if (idx) { return idx.getIteratorFrom(startPost, function (key) { return key; }); } else { var iterator = this.children_.getIteratorFrom(startPost.name, NamedNode.Wrap); var next = iterator.peek(); while (next != null && indexDefinition.compare(next, startPost) < 0) { iterator.getNext(); next = iterator.peek(); } return iterator; } }; /** * @param {!Index} indexDefinition * @return {!SortedMapIterator} */ ChildrenNode.prototype.getReverseIterator = function (indexDefinition) { return this.getReverseIteratorFrom(indexDefinition.maxPost(), indexDefinition); }; /** * @param {!NamedNode} endPost * @param {!Index} indexDefinition * @return {!SortedMapIterator} */ ChildrenNode.prototype.getReverseIteratorFrom = function (endPost, indexDefinition) { var idx = this.resolveIndex_(indexDefinition); if (idx) { return idx.getReverseIteratorFrom(endPost, function (key) { return key; }); } else { var iterator = this.children_.getReverseIteratorFrom(endPost.name, NamedNode.Wrap); var next = iterator.peek(); while (next != null && indexDefinition.compare(next, endPost) > 0) { iterator.getNext(); next = iterator.peek(); } return iterator; } }; /** * @inheritDoc */ ChildrenNode.prototype.compareTo = function (other) { if (this.isEmpty()) { if (other.isEmpty()) { return 0; } else { return -1; } } else if (other.isLeafNode() || other.isEmpty()) { return 1; } else if (other === MAX_NODE$2) { return -1; } else { // Must be another node with children. return 0; } }; /** * @inheritDoc */ ChildrenNode.prototype.withIndex = function (indexDefinition) { if (indexDefinition === KEY_INDEX || this.indexMap_.hasIndex(indexDefinition)) { return this; } else { var newIndexMap = this.indexMap_.addIndex(indexDefinition, this.children_); return new ChildrenNode(this.children_, this.priorityNode_, newIndexMap); } }; /** * @inheritDoc */ ChildrenNode.prototype.isIndexed = function (index) { return index === KEY_INDEX || this.indexMap_.hasIndex(index); }; /** * @inheritDoc */ ChildrenNode.prototype.equals = function (other) { if (other === this) { return true; } else if (other.isLeafNode()) { return false; } else { var otherChildrenNode = other; if (!this.getPriority().equals(otherChildrenNode.getPriority())) { return false; } else if (this.children_.count() === otherChildrenNode.children_.count()) { var thisIter = this.getIterator(PRIORITY_INDEX); var otherIter = otherChildrenNode.getIterator(PRIORITY_INDEX); var thisCurrent = thisIter.getNext(); var otherCurrent = otherIter.getNext(); while (thisCurrent && otherCurrent) { if (thisCurrent.name !== otherCurrent.name || !thisCurrent.node.equals(otherCurrent.node)) { return false; } thisCurrent = thisIter.getNext(); otherCurrent = otherIter.getNext(); } return thisCurrent === null && otherCurrent === null; } else { return false; } } }; /** * Returns a SortedMap ordered by index, or null if the default (by-key) ordering can be used * instead. * * @private * @param {!Index} indexDefinition * @return {?SortedMap.<NamedNode, Node>} */ ChildrenNode.prototype.resolveIndex_ = function (indexDefinition) { if (indexDefinition === KEY_INDEX) { return null; } else { return this.indexMap_.get(indexDefinition.toString()); } }; /** * @private * @type {RegExp} */ ChildrenNode.INTEGER_REGEXP_ = /^(0|[1-9]\d*)$/; return ChildrenNode; }()); /** * @constructor * @extends {ChildrenNode} * @private */ var MaxNode = /** @class */ (function (_super) { tslib.__extends(MaxNode, _super); function MaxNode() { return _super.call(this, new SortedMap(NAME_COMPARATOR), ChildrenNode.EMPTY_NODE, IndexMap.Default) || this; } MaxNode.prototype.compareTo = function (other) { if (other === this) { return 0; } else { return 1; } }; MaxNode.prototype.equals = function (other) { // Not that we every compare it, but MAX_NODE is only ever equal to itself return other === this; }; MaxNode.prototype.getPriority = function () { return this; }; MaxNode.prototype.getImmediateChild = function (childName) { return ChildrenNode.EMPTY_NODE; }; MaxNode.prototype.isEmpty = function () { return false; }; return MaxNode; }(ChildrenNode)); /** * Marker that will sort higher than any other snapshot. * @type {!MAX_NODE} * @const */ var MAX_NODE$2 = new MaxNode(); Object.defineProperties(NamedNode, { MIN: { value: new NamedNode(MIN_NAME, ChildrenNode.EMPTY_NODE) }, MAX: { value: new NamedNode(MAX_NAME, MAX_NODE$2) } }); /** * Reference Extensions */ KeyIndex.__EMPTY_NODE = ChildrenNode.EMPTY_NODE; LeafNode.__childrenNodeConstructor = ChildrenNode; setMaxNode(MAX_NODE$2); setMaxNode$1(MAX_NODE$2); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var USE_HINZE = true; /** * Constructs a snapshot node representing the passed JSON and returns it. * @param {*} json JSON to create a node for. * @param {?string|?number=} priority Optional priority to use. This will be ignored if the * passed JSON contains a .priority property. * @return {!Node} */ function nodeFromJSON$1(json, priority) { if (priority === void 0) { priority = null; } if (json === null) { return ChildrenNode.EMPTY_NODE; } if (typeof json === 'object' && '.priority' in json) { priority = json['.priority']; } util.assert(priority === null || typeof priority === 'string' || typeof priority === 'number' || (typeof priority === 'object' && '.sv' in priority), 'Invalid priority type found: ' + typeof priority); if (typeof json === 'object' && '.value' in json && json['.value'] !== null) { json = json['.value']; } // Valid leaf nodes include non-objects or server-value wrapper objects if (typeof json !== 'object' || '.sv' in json) { var jsonLeaf = json; return new LeafNode(jsonLeaf, nodeFromJSON$1(priority)); } if (!(json instanceof Array) && USE_HINZE) { var children_1 = []; var childrenHavePriority_1 = false; var hinzeJsonObj = json; each(hinzeJsonObj, function (key, child) { if (key.substring(0, 1) !== '.') { // Ignore metadata nodes var childNode = nodeFromJSON$1(child); if (!childNode.isEmpty()) { childrenHavePriority_1 = childrenHavePriority_1 || !childNode.getPriority().isEmpty(); children_1.push(new NamedNode(key, childNode)); } } }); if (children_1.length === 0) { return ChildrenNode.EMPTY_NODE; } var childSet = buildChildSet(children_1, NAME_ONLY_COMPARATOR, function (namedNode) { return namedNode.name; }, NAME_COMPARATOR); if (childrenHavePriority_1) { var sortedChildSet = buildChildSet(children_1, PRIORITY_INDEX.getCompare()); return new ChildrenNode(childSet, nodeFromJSON$1(priority), new IndexMap({ '.priority': sortedChildSet }, { '.priority': PRIORITY_INDEX })); } else { return new ChildrenNode(childSet, nodeFromJSON$1(priority), IndexMap.Default); } } else { var node_1 = ChildrenNode.EMPTY_NODE; each(json, function (key, childData) { if (util.contains(json, key)) { if (key.substring(0, 1) !== '.') { // ignore metadata nodes. var childNode = nodeFromJSON$1(childData); if (childNode.isLeafNode() || !childNode.isEmpty()) { node_1 = node_1.updateImmediateChild(key, childNode); } } } }); return node_1.updatePriority(nodeFromJSON$1(priority)); } } setNodeFromJSON(nodeFromJSON$1); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * @constructor * @extends {Index} * @private */ var ValueIndex = /** @class */ (function (_super) { tslib.__extends(ValueIndex, _super); function ValueIndex() { return _super !== null && _super.apply(this, arguments) || this; } /** * @inheritDoc */ ValueIndex.prototype.compare = function (a, b) { var indexCmp = a.node.compareTo(b.node); if (indexCmp === 0) { return nameCompare(a.name, b.name); } else { return indexCmp; } }; /** * @inheritDoc */ ValueIndex.prototype.isDefinedOn = function (node) { return true; }; /** * @inheritDoc */ ValueIndex.prototype.indexedValueChanged = function (oldNode, newNode) { return !oldNode.equals(newNode); }; /** * @inheritDoc */ ValueIndex.prototype.minPost = function () { // eslint-disable-next-line @typescript-eslint/no-explicit-any return NamedNode.MIN; }; /** * @inheritDoc */ ValueIndex.prototype.maxPost = function () { // eslint-disable-next-line @typescript-eslint/no-explicit-any return NamedNode.MAX; }; /** * @param {*} indexValue * @param {string} name * @return {!NamedNode} */ ValueIndex.prototype.makePost = function (indexValue, name) { var valueNode = nodeFromJSON$1(indexValue); return new NamedNode(name, valueNode); }; /** * @return {!string} String representation for inclusion in a query spec */ ValueIndex.prototype.toString = function () { return '.value'; }; return ValueIndex; }(Index)); var VALUE_INDEX = new ValueIndex(); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * @param {!Path} indexPath * @constructor * @extends {Index} */ var PathIndex = /** @class */ (function (_super) { tslib.__extends(PathIndex, _super); function PathIndex(indexPath_) { var _this = _super.call(this) || this; _this.indexPath_ = indexPath_; util.assert(!indexPath_.isEmpty() && indexPath_.getFront() !== '.priority', "Can't create PathIndex with empty path or .priority key"); return _this; } /** * @param {!Node} snap * @return {!Node} * @protected */ PathIndex.prototype.extractChild = function (snap) { return snap.getChild(this.indexPath_); }; /** * @inheritDoc */ PathIndex.prototype.isDefinedOn = function (node) { return !node.getChild(this.indexPath_).isEmpty(); }; /** * @inheritDoc */ PathIndex.prototype.compare = function (a, b) { var aChild = this.extractChild(a.node); var bChild = this.extractChild(b.node); var indexCmp = aChild.compareTo(bChild); if (indexCmp === 0) { return nameCompare(a.name, b.name); } else { return indexCmp; } }; /** * @inheritDoc */ PathIndex.prototype.makePost = function (indexValue, name) { var valueNode = nodeFromJSON$1(indexValue); var node = ChildrenNode.EMPTY_NODE.updateChild(this.indexPath_, valueNode); return new NamedNode(name, node); }; /** * @inheritDoc */ PathIndex.prototype.maxPost = function () { var node = ChildrenNode.EMPTY_NODE.updateChild(this.indexPath_, MAX_NODE$2); return new NamedNode(MAX_NAME, node); }; /** * @inheritDoc */ PathIndex.prototype.toString = function () { return this.indexPath_.slice().join('/'); }; return PathIndex; }(Index)); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Class representing a firebase data snapshot. It wraps a SnapshotNode and * surfaces the public methods (val, forEach, etc.) we want to expose. */ var DataSnapshot = /** @class */ (function () { /** * @param {!Node} node_ A SnapshotNode to wrap. * @param {!Reference} ref_ The ref of the location this snapshot came from. * @param {!Index} index_ The iteration order for this snapshot */ function DataSnapshot(node_, ref_, index_) { this.node_ = node_; this.ref_ = ref_; this.index_ = index_; } /** * Retrieves the snapshot contents as JSON. Returns null if the snapshot is * empty. * * @return {*} JSON representation of the DataSnapshot contents, or null if empty. */ DataSnapshot.prototype.val = function () { util.validateArgCount('DataSnapshot.val', 0, 0, arguments.length); return this.node_.val(); }; /** * Returns the snapshot contents as JSON, including priorities of node. Suitable for exporting * the entire node contents. * @return {*} JSON representation of the DataSnapshot contents, or null if empty. */ DataSnapshot.prototype.exportVal = function () { util.validateArgCount('DataSnapshot.exportVal', 0, 0, arguments.length); return this.node_.val(true); }; // Do not create public documentation. This is intended to make JSON serialization work but is otherwise unnecessary // for end-users DataSnapshot.prototype.toJSON = function () { // Optional spacer argument is unnecessary because we're depending on recursion rather than stringifying the content util.validateArgCount('DataSnapshot.toJSON', 0, 1, arguments.length); return this.exportVal(); }; /** * Returns whether the snapshot contains a non-null value. * * @return {boolean} Whether the snapshot contains a non-null value, or is empty. */ DataSnapshot.prototype.exists = function () { util.validateArgCount('DataSnapshot.exists', 0, 0, arguments.length); return !this.node_.isEmpty(); }; /** * Returns a DataSnapshot of the specified child node's contents. * * @param {!string} childPathString Path to a child. * @return {!DataSnapshot} DataSnapshot for child node. */ DataSnapshot.prototype.child = function (childPathString) { util.validateArgCount('DataSnapshot.child', 0, 1, arguments.length); // Ensure the childPath is a string (can be a number) childPathString = String(childPathString); validatePathString('DataSnapshot.child', 1, childPathString, false); var childPath = new Path(childPathString); var childRef = this.ref_.child(childPath); return new DataSnapshot(this.node_.getChild(childPath), childRef, PRIORITY_INDEX); }; /** * Returns whether the snapshot contains a child at the specified path. * * @param {!string} childPathString Path to a child. * @return {boolean} Whether the child exists. */ DataSnapshot.prototype.hasChild = function (childPathString) { util.validateArgCount('DataSnapshot.hasChild', 1, 1, arguments.length); validatePathString('DataSnapshot.hasChild', 1, childPathString, false); var childPath = new Path(childPathString); return !this.node_.getChild(childPath).isEmpty(); }; /** * Returns the priority of the object, or null if no priority was set. * * @return {string|number|null} The priority. */ DataSnapshot.prototype.getPriority = function () { util.validateArgCount('DataSnapshot.getPriority', 0, 0, arguments.length); // typecast here because we never return deferred values or internal priorities (MAX_PRIORITY) return this.node_.getPriority().val(); }; /** * Iterates through child nodes and calls the specified action for each one. * * @param {function(!DataSnapshot)} action Callback function to be called * for each child. * @return {boolean} True if forEach was canceled by action returning true for * one of the child nodes. */ DataSnapshot.prototype.forEach = function (action) { var _this = this; util.validateArgCount('DataSnapshot.forEach', 1, 1, arguments.length); util.validateCallback('DataSnapshot.forEach', 1, action, false); if (this.node_.isLeafNode()) { return false; } var childrenNode = this.node_; // Sanitize the return value to a boolean. ChildrenNode.forEachChild has a weird return type... return !!childrenNode.forEachChild(this.index_, function (key, node) { return action(new DataSnapshot(node, _this.ref_.child(key), PRIORITY_INDEX)); }); }; /** * Returns whether this DataSnapshot has children. * @return {boolean} True if the DataSnapshot contains 1 or more child nodes. */ DataSnapshot.prototype.hasChildren = function () { util.validateArgCount('DataSnapshot.hasChildren', 0, 0, arguments.length); if (this.node_.isLeafNode()) { return false; } else { return !this.node_.isEmpty(); } }; Object.defineProperty(DataSnapshot.prototype, "key", { get: function () { return this.ref_.getKey(); }, enumerable: false, configurable: true }); /** * Returns the number of children for this DataSnapshot. * @return {number} The number of children that this DataSnapshot contains. */ DataSnapshot.prototype.numChildren = function () { util.validateArgCount('DataSnapshot.numChildren', 0, 0, arguments.length); return this.node_.numChildren(); }; /** * @return {Reference} The Firebase reference for the location this snapshot's data came from. */ DataSnapshot.prototype.getRef = function () { util.validateArgCount('DataSnapshot.ref', 0, 0, arguments.length); return this.ref_; }; Object.defineProperty(DataSnapshot.prototype, "ref", { get: function () { return this.getRef(); }, enumerable: false, configurable: true }); return DataSnapshot; }()); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Encapsulates the data needed to raise an event * @implements {Event} */ var DataEvent = /** @class */ (function () { /** * @param {!string} eventType One of: value, child_added, child_changed, child_moved, child_removed * @param {!EventRegistration} eventRegistration The function to call to with the event data. User provided * @param {!DataSnapshot} snapshot The data backing the event * @param {?string=} prevName Optional, the name of the previous child for child_* events. */ function DataEvent(eventType, eventRegistration, snapshot, prevName) { this.eventType = eventType; this.eventRegistration = eventRegistration; this.snapshot = snapshot; this.prevName = prevName; } /** * @inheritDoc */ DataEvent.prototype.getPath = function () { var ref = this.snapshot.getRef(); if (this.eventType === 'value') { return ref.path; } else { return ref.getParent().path; } }; /** * @inheritDoc */ DataEvent.prototype.getEventType = function () { return this.eventType; }; /** * @inheritDoc */ DataEvent.prototype.getEventRunner = function () { return this.eventRegistration.getEventRunner(this); }; /** * @inheritDoc */ DataEvent.prototype.toString = function () { return (this.getPath().toString() + ':' + this.eventType + ':' + util.stringify(this.snapshot.exportVal())); }; return DataEvent; }()); var CancelEvent = /** @class */ (function () { /** * @param {EventRegistration} eventRegistration * @param {Error} error * @param {!Path} path */ function CancelEvent(eventRegistration, error, path) { this.eventRegistration = eventRegistration; this.error = error; this.path = path; } /** * @inheritDoc */ CancelEvent.prototype.getPath = function () { return this.path; }; /** * @inheritDoc */ CancelEvent.prototype.getEventType = function () { return 'cancel'; }; /** * @inheritDoc */ CancelEvent.prototype.getEventRunner = function () { return this.eventRegistration.getEventRunner(this); }; /** * @inheritDoc */ CancelEvent.prototype.toString = function () { return this.path.toString() + ':cancel'; }; return CancelEvent; }()); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Represents registration for 'value' events. */ var ValueEventRegistration = /** @class */ (function () { /** * @param {?function(!DataSnapshot)} callback_ * @param {?function(Error)} cancelCallback_ * @param {?Object} context_ */ function ValueEventRegistration(callback_, cancelCallback_, context_) { this.callback_ = callback_; this.cancelCallback_ = cancelCallback_; this.context_ = context_; } /** * @inheritDoc */ ValueEventRegistration.prototype.respondsTo = function (eventType) { return eventType === 'value'; }; /** * @inheritDoc */ ValueEventRegistration.prototype.createEvent = function (change, query) { var index = query.getQueryParams().getIndex(); return new DataEvent('value', this, new DataSnapshot(change.snapshotNode, query.getRef(), index)); }; /** * @inheritDoc */ ValueEventRegistration.prototype.getEventRunner = function (eventData) { var ctx = this.context_; if (eventData.getEventType() === 'cancel') { util.assert(this.cancelCallback_, 'Raising a cancel event on a listener with no cancel callback'); var cancelCB_1 = this.cancelCallback_; return function () { // We know that error exists, we checked above that this is a cancel event cancelCB_1.call(ctx, eventData.error); }; } else { var cb_1 = this.callback_; return function () { cb_1.call(ctx, eventData.snapshot); }; } }; /** * @inheritDoc */ ValueEventRegistration.prototype.createCancelEvent = function (error, path) { if (this.cancelCallback_) { return new CancelEvent(this, error, path); } else { return null; } }; /** * @inheritDoc */ ValueEventRegistration.prototype.matches = function (other) { if (!(other instanceof ValueEventRegistration)) { return false; } else if (!other.callback_ || !this.callback_) { // If no callback specified, we consider it to match any callback. return true; } else { return (other.callback_ === this.callback_ && other.context_ === this.context_); } }; /** * @inheritDoc */ ValueEventRegistration.prototype.hasAnyCallback = function () { return this.callback_ !== null; }; return ValueEventRegistration; }()); /** * Represents the registration of 1 or more child_xxx events. * * Currently, it is always exactly 1 child_xxx event, but the idea is we might let you * register a group of callbacks together in the future. * * @constructor * @implements {EventRegistration} */ var ChildEventRegistration = /** @class */ (function () { /** * @param {?Object.<string, function(!DataSnapshot, ?string=)>} callbacks_ * @param {?function(Error)} cancelCallback_ * @param {Object=} context_ */ function ChildEventRegistration(callbacks_, cancelCallback_, context_) { this.callbacks_ = callbacks_; this.cancelCallback_ = cancelCallback_; this.context_ = context_; } /** * @inheritDoc */ ChildEventRegistration.prototype.respondsTo = function (eventType) { var eventToCheck = eventType === 'children_added' ? 'child_added' : eventType; eventToCheck = eventToCheck === 'children_removed' ? 'child_removed' : eventToCheck; return util.contains(this.callbacks_, eventToCheck); }; /** * @inheritDoc */ ChildEventRegistration.prototype.createCancelEvent = function (error, path) { if (this.cancelCallback_) { return new CancelEvent(this, error, path); } else { return null; } }; /** * @inheritDoc */ ChildEventRegistration.prototype.createEvent = function (change, query) { util.assert(change.childName != null, 'Child events should have a childName.'); var ref = query.getRef().child(/** @type {!string} */ change.childName); var index = query.getQueryParams().getIndex(); return new DataEvent(change.type, this, new DataSnapshot(change.snapshotNode, ref, index), change.prevName); }; /** * @inheritDoc */ ChildEventRegistration.prototype.getEventRunner = function (eventData) { var ctx = this.context_; if (eventData.getEventType() === 'cancel') { util.assert(this.cancelCallback_, 'Raising a cancel event on a listener with no cancel callback'); var cancelCB_2 = this.cancelCallback_; return function () { // We know that error exists, we checked above that this is a cancel event cancelCB_2.call(ctx, eventData.error); }; } else { var cb_2 = this.callbacks_[eventData.eventType]; return function () { cb_2.call(ctx, eventData.snapshot, eventData.prevName); }; } }; /** * @inheritDoc */ ChildEventRegistration.prototype.matches = function (other) { var _this = this; if (other instanceof ChildEventRegistration) { if (!this.callbacks_ || !other.callbacks_) { return true; } else if (this.context_ === other.context_) { var otherKeys = Object.keys(other.callbacks_); var thisKeys = Object.keys(this.callbacks_); var otherCount = otherKeys.length; var thisCount = thisKeys.length; if (otherCount === thisCount) { // If count is 1, do an exact match on eventType, if either is defined but null, it's a match. // If event types don't match, not a match // If count is not 1, exact match across all if (otherCount === 1) { var otherKey = otherKeys[0]; var thisKey = thisKeys[0]; return (thisKey === otherKey && (!other.callbacks_[otherKey] || !this.callbacks_[thisKey] || other.callbacks_[otherKey] === this.callbacks_[thisKey])); } else { // Exact match on each key. return thisKeys.every(function (eventType) { return other.callbacks_[eventType] === _this.callbacks_[eventType]; }); } } } } return false; }; /** * @inheritDoc */ ChildEventRegistration.prototype.hasAnyCallback = function () { return this.callbacks_ !== null; }; return ChildEventRegistration; }()); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var __referenceConstructor; /** * A Query represents a filter to be applied to a firebase location. This object purely represents the * query expression (and exposes our public API to build the query). The actual query logic is in ViewBase.js. * * Since every Firebase reference is a query, Firebase inherits from this object. */ var Query = /** @class */ (function () { function Query(repo, path, queryParams_, orderByCalled_) { this.repo = repo; this.path = path; this.queryParams_ = queryParams_; this.orderByCalled_ = orderByCalled_; } Object.defineProperty(Query, "__referenceConstructor", { get: function () { util.assert(__referenceConstructor, 'Reference.ts has not been loaded'); return __referenceConstructor; }, set: function (val) { __referenceConstructor = val; }, enumerable: false, configurable: true }); /** * Validates start/end values for queries. * @param {!QueryParams} params * @private */ Query.validateQueryEndpoints_ = function (params) { var startNode = null; var endNode = null; if (params.hasStart()) { startNode = params.getIndexStartValue(); } if (params.hasEnd()) { endNode = params.getIndexEndValue(); } if (params.getIndex() === KEY_INDEX) { var tooManyArgsError = 'Query: When ordering by key, you may only pass one argument to ' + 'startAt(), endAt(), or equalTo().'; var wrongArgTypeError = 'Query: When ordering by key, the argument passed to startAt(), endAt(),' + 'or equalTo() must be a string.'; if (params.hasStart()) { var startName = params.getIndexStartName(); if (startName !== MIN_NAME) { throw new Error(tooManyArgsError); } else if (typeof startNode !== 'string') { throw new Error(wrongArgTypeError); } } if (params.hasEnd()) { var endName = params.getIndexEndName(); if (endName !== MAX_NAME) { throw new Error(tooManyArgsError); } else if (typeof endNode !== 'string') { throw new Error(wrongArgTypeError); } } } else if (params.getIndex() === PRIORITY_INDEX) { if ((startNode != null && !isValidPriority(startNode)) || (endNode != null && !isValidPriority(endNode))) { throw new Error('Query: When ordering by priority, the first argument passed to startAt(), ' + 'endAt(), or equalTo() must be a valid priority value (null, a number, or a string).'); } } else { util.assert(params.getIndex() instanceof PathIndex || params.getIndex() === VALUE_INDEX, 'unknown index type.'); if ((startNode != null && typeof startNode === 'object') || (endNode != null && typeof endNode === 'object')) { throw new Error('Query: First argument passed to startAt(), endAt(), or equalTo() cannot be ' + 'an object.'); } } }; /** * Validates that limit* has been called with the correct combination of parameters * @param {!QueryParams} params * @private */ Query.validateLimit_ = function (params) { if (params.hasStart() && params.hasEnd() && params.hasLimit() && !params.hasAnchoredLimit()) { throw new Error("Query: Can't combine startAt(), endAt(), and limit(). Use limitToFirst() or limitToLast() instead."); } }; /** * Validates that no other order by call has been made * @param {!string} fnName * @private */ Query.prototype.validateNoPreviousOrderByCall_ = function (fnName) { if (this.orderByCalled_ === true) { throw new Error(fnName + ": You can't combine multiple orderBy calls."); } }; /** * @return {!QueryParams} */ Query.prototype.getQueryParams = function () { return this.queryParams_; }; /** * @return {!Reference} */ Query.prototype.getRef = function () { util.validateArgCount('Query.ref', 0, 0, arguments.length); // This is a slight hack. We cannot goog.require('fb.api.Firebase'), since Firebase requires fb.api.Query. // However, we will always export 'Firebase' to the global namespace, so it's guaranteed to exist by the time this // method gets called. return new Query.__referenceConstructor(this.repo, this.path); }; /** * @param {!string} eventType * @param {!function(DataSnapshot, string=)} callback * @param {(function(Error)|Object)=} cancelCallbackOrContext * @param {Object=} context * @return {!function(DataSnapshot, string=)} */ Query.prototype.on = function (eventType, callback, cancelCallbackOrContext, context) { util.validateArgCount('Query.on', 2, 4, arguments.length); validateEventType('Query.on', 1, eventType, false); util.validateCallback('Query.on', 2, callback, false); var ret = Query.getCancelAndContextArgs_('Query.on', cancelCallbackOrContext, context); if (eventType === 'value') { this.onValueEvent(callback, ret.cancel, ret.context); } else { var callbacks = {}; callbacks[eventType] = callback; this.onChildEvent(callbacks, ret.cancel, ret.context); } return callback; }; /** * @param {!function(!DataSnapshot)} callback * @param {?function(Error)} cancelCallback * @param {?Object} context * @protected */ Query.prototype.onValueEvent = function (callback, cancelCallback, context) { var container = new ValueEventRegistration(callback, cancelCallback || null, context || null); this.repo.addEventCallbackForQuery(this, container); }; /** * @param {!Object.<string, !function(!DataSnapshot, ?string)>} callbacks * @param {?function(Error)} cancelCallback * @param {?Object} context * @protected */ Query.prototype.onChildEvent = function (callbacks, cancelCallback, context) { var container = new ChildEventRegistration(callbacks, cancelCallback, context); this.repo.addEventCallbackForQuery(this, container); }; /** * @param {string=} eventType * @param {(function(!DataSnapshot, ?string=))=} callback * @param {Object=} context */ Query.prototype.off = function (eventType, callback, context) { util.validateArgCount('Query.off', 0, 3, arguments.length); validateEventType('Query.off', 1, eventType, true); util.validateCallback('Query.off', 2, callback, true); util.validateContextObject('Query.off', 3, context, true); var container = null; var callbacks = null; if (eventType === 'value') { var valueCallback = callback || null; container = new ValueEventRegistration(valueCallback, null, context || null); } else if (eventType) { if (callback) { callbacks = {}; callbacks[eventType] = callback; } container = new ChildEventRegistration(callbacks, null, context || null); } this.repo.removeEventCallbackForQuery(this, container); }; /** * Attaches a listener, waits for the first event, and then removes the listener * @param {!string} eventType * @param {!function(!DataSnapshot, string=)} userCallback * @param failureCallbackOrContext * @param context * @return {!firebase.Promise} */ Query.prototype.once = function (eventType, userCallback, failureCallbackOrContext, context) { var _this = this; util.validateArgCount('Query.once', 1, 4, arguments.length); validateEventType('Query.once', 1, eventType, false); util.validateCallback('Query.once', 2, userCallback, true); var ret = Query.getCancelAndContextArgs_('Query.once', failureCallbackOrContext, context); // TODO: Implement this more efficiently (in particular, use 'get' wire protocol for 'value' event) // TODO: consider actually wiring the callbacks into the promise. We cannot do this without a breaking change // because the API currently expects callbacks will be called synchronously if the data is cached, but this is // against the Promise specification. var firstCall = true; var deferred = new util.Deferred(); // A dummy error handler in case a user wasn't expecting promises deferred.promise.catch(function () { }); var onceCallback = function (snapshot) { // NOTE: Even though we unsubscribe, we may get called multiple times if a single action (e.g. set() with JSON) // triggers multiple events (e.g. child_added or child_changed). if (firstCall) { firstCall = false; _this.off(eventType, onceCallback); if (userCallback) { userCallback.bind(ret.context)(snapshot); } deferred.resolve(snapshot); } }; this.on(eventType, onceCallback, /*cancel=*/ function (err) { _this.off(eventType, onceCallback); if (ret.cancel) { ret.cancel.bind(ret.context)(err); } deferred.reject(err); }); return deferred.promise; }; /** * Set a limit and anchor it to the start of the window. * @param {!number} limit * @return {!Query} */ Query.prototype.limitToFirst = function (limit) { util.validateArgCount('Query.limitToFirst', 1, 1, arguments.length); if (typeof limit !== 'number' || Math.floor(limit) !== limit || limit <= 0) { throw new Error('Query.limitToFirst: First argument must be a positive integer.'); } if (this.queryParams_.hasLimit()) { throw new Error('Query.limitToFirst: Limit was already set (by another call to limit, ' + 'limitToFirst, or limitToLast).'); } return new Query(this.repo, this.path, this.queryParams_.limitToFirst(limit), this.orderByCalled_); }; /** * Set a limit and anchor it to the end of the window. * @param {!number} limit * @return {!Query} */ Query.prototype.limitToLast = function (limit) { util.validateArgCount('Query.limitToLast', 1, 1, arguments.length); if (typeof limit !== 'number' || Math.floor(limit) !== limit || limit <= 0) { throw new Error('Query.limitToLast: First argument must be a positive integer.'); } if (this.queryParams_.hasLimit()) { throw new Error('Query.limitToLast: Limit was already set (by another call to limit, ' + 'limitToFirst, or limitToLast).'); } return new Query(this.repo, this.path, this.queryParams_.limitToLast(limit), this.orderByCalled_); }; /** * Given a child path, return a new query ordered by the specified grandchild path. * @param {!string} path * @return {!Query} */ Query.prototype.orderByChild = function (path) { util.validateArgCount('Query.orderByChild', 1, 1, arguments.length); if (path === '$key') { throw new Error('Query.orderByChild: "$key" is invalid. Use Query.orderByKey() instead.'); } else if (path === '$priority') { throw new Error('Query.orderByChild: "$priority" is invalid. Use Query.orderByPriority() instead.'); } else if (path === '$value') { throw new Error('Query.orderByChild: "$value" is invalid. Use Query.orderByValue() instead.'); } validatePathString('Query.orderByChild', 1, path, false); this.validateNoPreviousOrderByCall_('Query.orderByChild'); var parsedPath = new Path(path); if (parsedPath.isEmpty()) { throw new Error('Query.orderByChild: cannot pass in empty path. Use Query.orderByValue() instead.'); } var index = new PathIndex(parsedPath); var newParams = this.queryParams_.orderBy(index); Query.validateQueryEndpoints_(newParams); return new Query(this.repo, this.path, newParams, /*orderByCalled=*/ true); }; /** * Return a new query ordered by the KeyIndex * @return {!Query} */ Query.prototype.orderByKey = function () { util.validateArgCount('Query.orderByKey', 0, 0, arguments.length); this.validateNoPreviousOrderByCall_('Query.orderByKey'); var newParams = this.queryParams_.orderBy(KEY_INDEX); Query.validateQueryEndpoints_(newParams); return new Query(this.repo, this.path, newParams, /*orderByCalled=*/ true); }; /** * Return a new query ordered by the PriorityIndex * @return {!Query} */ Query.prototype.orderByPriority = function () { util.validateArgCount('Query.orderByPriority', 0, 0, arguments.length); this.validateNoPreviousOrderByCall_('Query.orderByPriority'); var newParams = this.queryParams_.orderBy(PRIORITY_INDEX); Query.validateQueryEndpoints_(newParams); return new Query(this.repo, this.path, newParams, /*orderByCalled=*/ true); }; /** * Return a new query ordered by the ValueIndex * @return {!Query} */ Query.prototype.orderByValue = function () { util.validateArgCount('Query.orderByValue', 0, 0, arguments.length); this.validateNoPreviousOrderByCall_('Query.orderByValue'); var newParams = this.queryParams_.orderBy(VALUE_INDEX); Query.validateQueryEndpoints_(newParams); return new Query(this.repo, this.path, newParams, /*orderByCalled=*/ true); }; /** * @param {number|string|boolean|null} value * @param {?string=} name * @return {!Query} */ Query.prototype.startAt = function (value, name) { if (value === void 0) { value = null; } util.validateArgCount('Query.startAt', 0, 2, arguments.length); validateFirebaseDataArg('Query.startAt', 1, value, this.path, true); validateKey('Query.startAt', 2, name, true); var newParams = this.queryParams_.startAt(value, name); Query.validateLimit_(newParams); Query.validateQueryEndpoints_(newParams); if (this.queryParams_.hasStart()) { throw new Error('Query.startAt: Starting point was already set (by another call to startAt ' + 'or equalTo).'); } // Calling with no params tells us to start at the beginning. if (value === undefined) { value = null; name = null; } return new Query(this.repo, this.path, newParams, this.orderByCalled_); }; /** * @param {number|string|boolean|null} value * @param {?string=} name * @return {!Query} */ Query.prototype.endAt = function (value, name) { if (value === void 0) { value = null; } util.validateArgCount('Query.endAt', 0, 2, arguments.length); validateFirebaseDataArg('Query.endAt', 1, value, this.path, true); validateKey('Query.endAt', 2, name, true); var newParams = this.queryParams_.endAt(value, name); Query.validateLimit_(newParams); Query.validateQueryEndpoints_(newParams); if (this.queryParams_.hasEnd()) { throw new Error('Query.endAt: Ending point was already set (by another call to endAt or ' + 'equalTo).'); } return new Query(this.repo, this.path, newParams, this.orderByCalled_); }; /** * Load the selection of children with exactly the specified value, and, optionally, * the specified name. * @param {number|string|boolean|null} value * @param {string=} name * @return {!Query} */ Query.prototype.equalTo = function (value, name) { util.validateArgCount('Query.equalTo', 1, 2, arguments.length); validateFirebaseDataArg('Query.equalTo', 1, value, this.path, false); validateKey('Query.equalTo', 2, name, true); if (this.queryParams_.hasStart()) { throw new Error('Query.equalTo: Starting point was already set (by another call to startAt or ' + 'equalTo).'); } if (this.queryParams_.hasEnd()) { throw new Error('Query.equalTo: Ending point was already set (by another call to endAt or ' + 'equalTo).'); } return this.startAt(value, name).endAt(value, name); }; /** * @return {!string} URL for this location. */ Query.prototype.toString = function () { util.validateArgCount('Query.toString', 0, 0, arguments.length); return this.repo.toString() + this.path.toUrlEncodedString(); }; // Do not create public documentation. This is intended to make JSON serialization work but is otherwise unnecessary // for end-users. Query.prototype.toJSON = function () { // An optional spacer argument is unnecessary for a string. util.validateArgCount('Query.toJSON', 0, 1, arguments.length); return this.toString(); }; /** * An object representation of the query parameters used by this Query. * @return {!Object} */ Query.prototype.queryObject = function () { return this.queryParams_.getQueryObject(); }; /** * @return {!string} */ Query.prototype.queryIdentifier = function () { var obj = this.queryObject(); var id = ObjectToUniqueKey(obj); return id === '{}' ? 'default' : id; }; /** * Return true if this query and the provided query are equivalent; otherwise, return false. * @param {Query} other * @return {boolean} */ Query.prototype.isEqual = function (other) { util.validateArgCount('Query.isEqual', 1, 1, arguments.length); if (!(other instanceof Query)) { var error = 'Query.isEqual failed: First argument must be an instance of firebase.database.Query.'; throw new Error(error); } var sameRepo = this.repo === other.repo; var samePath = this.path.equals(other.path); var sameQueryIdentifier = this.queryIdentifier() === other.queryIdentifier(); return sameRepo && samePath && sameQueryIdentifier; }; /** * Helper used by .on and .once to extract the context and or cancel arguments. * @param {!string} fnName The function name (on or once) * @param {(function(Error)|Object)=} cancelOrContext * @param {Object=} context * @return {{cancel: ?function(Error), context: ?Object}} * @private */ Query.getCancelAndContextArgs_ = function (fnName, cancelOrContext, context) { var ret = { cancel: null, context: null }; if (cancelOrContext && context) { ret.cancel = cancelOrContext; util.validateCallback(fnName, 3, ret.cancel, true); ret.context = context; util.validateContextObject(fnName, 4, ret.context, true); } else if (cancelOrContext) { // we have either a cancel callback or a context. if (typeof cancelOrContext === 'object' && cancelOrContext !== null) { // it's a context! ret.context = cancelOrContext; } else if (typeof cancelOrContext === 'function') { ret.cancel = cancelOrContext; } else { throw new Error(util.errorPrefix(fnName, 3, true) + ' must either be a cancel callback or a context object.'); } } return ret; }; Object.defineProperty(Query.prototype, "ref", { get: function () { return this.getRef(); }, enumerable: false, configurable: true }); return Query; }()); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var ExistingValueProvider = /** @class */ (function () { function ExistingValueProvider(node_) { this.node_ = node_; } ExistingValueProvider.prototype.getImmediateChild = function (childName) { var child = this.node_.getImmediateChild(childName); return new ExistingValueProvider(child); }; ExistingValueProvider.prototype.node = function () { return this.node_; }; return ExistingValueProvider; }()); var DeferredValueProvider = /** @class */ (function () { function DeferredValueProvider(syncTree, path) { this.syncTree_ = syncTree; this.path_ = path; } DeferredValueProvider.prototype.getImmediateChild = function (childName) { var childPath = this.path_.child(childName); return new DeferredValueProvider(this.syncTree_, childPath); }; DeferredValueProvider.prototype.node = function () { return this.syncTree_.calcCompleteEventCache(this.path_); }; return DeferredValueProvider; }()); /** * Generate placeholders for deferred values. * @param {?Object} values * @return {!Object} */ var generateWithValues = function (values) { values = values || {}; values['timestamp'] = values['timestamp'] || new Date().getTime(); return values; }; /** * Value to use when firing local events. When writing server values, fire * local events with an approximate value, otherwise return value as-is. * @param {(Object|string|number|boolean)} value * @param {!Object} serverValues * @return {!(string|number|boolean)} */ var resolveDeferredLeafValue = function (value, existingVal, serverValues) { if (!value || typeof value !== 'object') { return value; } util.assert('.sv' in value, 'Unexpected leaf node or priority contents'); if (typeof value['.sv'] === 'string') { return resolveScalarDeferredValue(value['.sv'], existingVal, serverValues); } else if (typeof value['.sv'] === 'object') { return resolveComplexDeferredValue(value['.sv'], existingVal); } else { util.assert(false, 'Unexpected server value: ' + JSON.stringify(value, null, 2)); } }; var resolveScalarDeferredValue = function (op, existing, serverValues) { switch (op) { case 'timestamp': return serverValues['timestamp']; default: util.assert(false, 'Unexpected server value: ' + op); } }; var resolveComplexDeferredValue = function (op, existing, unused) { if (!op.hasOwnProperty('increment')) { util.assert(false, 'Unexpected server value: ' + JSON.stringify(op, null, 2)); } var delta = op['increment']; if (typeof delta !== 'number') { util.assert(false, 'Unexpected increment value: ' + delta); } var existingNode = existing.node(); util.assert(existingNode !== null && typeof existingNode !== 'undefined', 'Expected ChildrenNode.EMPTY_NODE for nulls'); // Incrementing a non-number sets the value to the incremented amount if (!existingNode.isLeafNode()) { return delta; } var leaf = existingNode; var existingVal = leaf.getValue(); if (typeof existingVal !== 'number') { return delta; } // No need to do over/underflow arithmetic here because JS only handles floats under the covers return existingVal + delta; }; /** * Recursively replace all deferred values and priorities in the tree with the * specified generated replacement values. * @param {!Path} path path to which write is relative * @param {!Node} node new data written at path * @param {!SyncTree} syncTree current data * @param {!Object} serverValues * @return {!SparseSnapshotTree} */ var resolveDeferredValueTree = function (path, node, syncTree, serverValues) { return resolveDeferredValue(node, new DeferredValueProvider(syncTree, path), serverValues); }; /** * Recursively replace all deferred values and priorities in the node with the * specified generated replacement values. If there are no server values in the node, * it'll be returned as-is. * @param {!Node} node * @param {!Object} serverValues * @return {!Node} */ var resolveDeferredValueSnapshot = function (node, existing, serverValues) { return resolveDeferredValue(node, new ExistingValueProvider(existing), serverValues); }; function resolveDeferredValue(node, existingVal, serverValues) { var rawPri = node.getPriority().val(); var priority = resolveDeferredLeafValue(rawPri, existingVal.getImmediateChild('.priority'), serverValues); var newNode; if (node.isLeafNode()) { var leafNode = node; var value = resolveDeferredLeafValue(leafNode.getValue(), existingVal, serverValues); if (value !== leafNode.getValue() || priority !== leafNode.getPriority().val()) { return new LeafNode(value, nodeFromJSON$1(priority)); } else { return node; } } else { var childrenNode = node; newNode = childrenNode; if (priority !== childrenNode.getPriority().val()) { newNode = newNode.updatePriority(new LeafNode(priority)); } childrenNode.forEachChild(PRIORITY_INDEX, function (childName, childNode) { var newChildNode = resolveDeferredValue(childNode, existingVal.getImmediateChild(childName), serverValues); if (newChildNode !== childNode) { newNode = newNode.updateImmediateChild(childName, newChildNode); } }); return newNode; } } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Helper class to store a sparse set of snapshots. */ var SparseSnapshotTree = /** @class */ (function () { function SparseSnapshotTree() { this.value = null; this.children = new Map(); } /** * Gets the node stored at the given path if one exists. * * @param path Path to look up snapshot for. * @return The retrieved node, or null. */ SparseSnapshotTree.prototype.find = function (path) { if (this.value != null) { return this.value.getChild(path); } else if (!path.isEmpty() && this.children.size > 0) { var childKey = path.getFront(); path = path.popFront(); if (this.children.has(childKey)) { var childTree = this.children.get(childKey); return childTree.find(path); } else { return null; } } else { return null; } }; /** * Stores the given node at the specified path. If there is already a node * at a shallower path, it merges the new data into that snapshot node. * * @param path Path to look up snapshot for. * @param data The new data, or null. */ SparseSnapshotTree.prototype.remember = function (path, data) { if (path.isEmpty()) { this.value = data; this.children.clear(); } else if (this.value !== null) { this.value = this.value.updateChild(path, data); } else { var childKey = path.getFront(); if (!this.children.has(childKey)) { this.children.set(childKey, new SparseSnapshotTree()); } var child = this.children.get(childKey); path = path.popFront(); child.remember(path, data); } }; /** * Purge the data at path from the cache. * * @param path Path to look up snapshot for. * @return True if this node should now be removed. */ SparseSnapshotTree.prototype.forget = function (path) { if (path.isEmpty()) { this.value = null; this.children.clear(); return true; } else { if (this.value !== null) { if (this.value.isLeafNode()) { // We're trying to forget a node that doesn't exist return false; } else { var value = this.value; this.value = null; var self_1 = this; value.forEachChild(PRIORITY_INDEX, function (key, tree) { self_1.remember(new Path(key), tree); }); return this.forget(path); } } else if (this.children.size > 0) { var childKey = path.getFront(); path = path.popFront(); if (this.children.has(childKey)) { var safeToRemove = this.children.get(childKey).forget(path); if (safeToRemove) { this.children.delete(childKey); } } return this.children.size === 0; } else { return true; } } }; /** * Recursively iterates through all of the stored tree and calls the * callback on each one. * * @param prefixPath Path to look up node for. * @param func The function to invoke for each tree. */ SparseSnapshotTree.prototype.forEachTree = function (prefixPath, func) { if (this.value !== null) { func(prefixPath, this.value); } else { this.forEachChild(function (key, tree) { var path = new Path(prefixPath.toString() + '/' + key); tree.forEachTree(path, func); }); } }; /** * Iterates through each immediate child and triggers the callback. * * @param func The function to invoke for each child. */ SparseSnapshotTree.prototype.forEachChild = function (func) { this.children.forEach(function (tree, key) { func(key, tree); }); }; return SparseSnapshotTree; }()); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * * @enum */ var OperationType; (function (OperationType) { OperationType[OperationType["OVERWRITE"] = 0] = "OVERWRITE"; OperationType[OperationType["MERGE"] = 1] = "MERGE"; OperationType[OperationType["ACK_USER_WRITE"] = 2] = "ACK_USER_WRITE"; OperationType[OperationType["LISTEN_COMPLETE"] = 3] = "LISTEN_COMPLETE"; })(OperationType || (OperationType = {})); /** * @param {boolean} fromUser * @param {boolean} fromServer * @param {?string} queryId * @param {boolean} tagged * @constructor */ var OperationSource = /** @class */ (function () { function OperationSource(fromUser, fromServer, queryId, tagged) { this.fromUser = fromUser; this.fromServer = fromServer; this.queryId = queryId; this.tagged = tagged; util.assert(!tagged || fromServer, 'Tagged queries must be from server.'); } /** * @const * @type {!OperationSource} */ OperationSource.User = new OperationSource( /*fromUser=*/ true, false, null, /*tagged=*/ false); /** * @const * @type {!OperationSource} */ OperationSource.Server = new OperationSource(false, /*fromServer=*/ true, null, /*tagged=*/ false); /** * @param {string} queryId * @return {!OperationSource} */ OperationSource.forServerTaggedQuery = function (queryId) { return new OperationSource(false, /*fromServer=*/ true, queryId, /*tagged=*/ true); }; return OperationSource; }()); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var AckUserWrite = /** @class */ (function () { /** * * @param {!Path} path * @param {!ImmutableTree<!boolean>} affectedTree A tree containing true for each affected path. Affected paths can't overlap. * @param {!boolean} revert */ function AckUserWrite( /** @inheritDoc */ path, /** @inheritDoc */ affectedTree, /** @inheritDoc */ revert) { this.path = path; this.affectedTree = affectedTree; this.revert = revert; /** @inheritDoc */ this.type = OperationType.ACK_USER_WRITE; /** @inheritDoc */ this.source = OperationSource.User; } /** * @inheritDoc */ AckUserWrite.prototype.operationForChild = function (childName) { if (!this.path.isEmpty()) { util.assert(this.path.getFront() === childName, 'operationForChild called for unrelated child.'); return new AckUserWrite(this.path.popFront(), this.affectedTree, this.revert); } else if (this.affectedTree.value != null) { util.assert(this.affectedTree.children.isEmpty(), 'affectedTree should not have overlapping affected paths.'); // All child locations are affected as well; just return same operation. return this; } else { var childTree = this.affectedTree.subtree(new Path(childName)); return new AckUserWrite(Path.Empty, childTree, this.revert); } }; return AckUserWrite; }()); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var emptyChildrenSingleton; /** * Singleton empty children collection. * * @const * @type {!SortedMap.<string, !ImmutableTree.<?>>} */ var EmptyChildren = function () { if (!emptyChildrenSingleton) { emptyChildrenSingleton = new SortedMap(stringCompare); } return emptyChildrenSingleton; }; /** * A tree with immutable elements. */ var ImmutableTree = /** @class */ (function () { /** * @template T * @param {?T} value * @param {SortedMap.<string, !ImmutableTree.<T>>=} children */ function ImmutableTree(value, children) { if (children === void 0) { children = EmptyChildren(); } this.value = value; this.children = children; } /** * @template T * @param {!Object.<string, !T>} obj * @return {!ImmutableTree.<!T>} */ ImmutableTree.fromObject = function (obj) { var tree = ImmutableTree.Empty; each(obj, function (childPath, childSnap) { tree = tree.set(new Path(childPath), childSnap); }); return tree; }; /** * True if the value is empty and there are no children * @return {boolean} */ ImmutableTree.prototype.isEmpty = function () { return this.value === null && this.children.isEmpty(); }; /** * Given a path and predicate, return the first node and the path to that node * where the predicate returns true. * * TODO Do a perf test -- If we're creating a bunch of {path: value:} objects * on the way back out, it may be better to pass down a pathSoFar obj. * * @param {!Path} relativePath The remainder of the path * @param {function(T):boolean} predicate The predicate to satisfy to return a * node * @return {?{path:!Path, value:!T}} */ ImmutableTree.prototype.findRootMostMatchingPathAndValue = function (relativePath, predicate) { if (this.value != null && predicate(this.value)) { return { path: Path.Empty, value: this.value }; } else { if (relativePath.isEmpty()) { return null; } else { var front = relativePath.getFront(); var child = this.children.get(front); if (child !== null) { var childExistingPathAndValue = child.findRootMostMatchingPathAndValue(relativePath.popFront(), predicate); if (childExistingPathAndValue != null) { var fullPath = new Path(front).child(childExistingPathAndValue.path); return { path: fullPath, value: childExistingPathAndValue.value }; } else { return null; } } else { return null; } } } }; /** * Find, if it exists, the shortest subpath of the given path that points a defined * value in the tree * @param {!Path} relativePath * @return {?{path: !Path, value: !T}} */ ImmutableTree.prototype.findRootMostValueAndPath = function (relativePath) { return this.findRootMostMatchingPathAndValue(relativePath, function () { return true; }); }; /** * @param {!Path} relativePath * @return {!ImmutableTree.<T>} The subtree at the given path */ ImmutableTree.prototype.subtree = function (relativePath) { if (relativePath.isEmpty()) { return this; } else { var front = relativePath.getFront(); var childTree = this.children.get(front); if (childTree !== null) { return childTree.subtree(relativePath.popFront()); } else { return ImmutableTree.Empty; } } }; /** * Sets a value at the specified path. * * @param {!Path} relativePath Path to set value at. * @param {?T} toSet Value to set. * @return {!ImmutableTree.<T>} Resulting tree. */ ImmutableTree.prototype.set = function (relativePath, toSet) { if (relativePath.isEmpty()) { return new ImmutableTree(toSet, this.children); } else { var front = relativePath.getFront(); var child = this.children.get(front) || ImmutableTree.Empty; var newChild = child.set(relativePath.popFront(), toSet); var newChildren = this.children.insert(front, newChild); return new ImmutableTree(this.value, newChildren); } }; /** * Removes the value at the specified path. * * @param {!Path} relativePath Path to value to remove. * @return {!ImmutableTree.<T>} Resulting tree. */ ImmutableTree.prototype.remove = function (relativePath) { if (relativePath.isEmpty()) { if (this.children.isEmpty()) { return ImmutableTree.Empty; } else { return new ImmutableTree(null, this.children); } } else { var front = relativePath.getFront(); var child = this.children.get(front); if (child) { var newChild = child.remove(relativePath.popFront()); var newChildren = void 0; if (newChild.isEmpty()) { newChildren = this.children.remove(front); } else { newChildren = this.children.insert(front, newChild); } if (this.value === null && newChildren.isEmpty()) { return ImmutableTree.Empty; } else { return new ImmutableTree(this.value, newChildren); } } else { return this; } } }; /** * Gets a value from the tree. * * @param {!Path} relativePath Path to get value for. * @return {?T} Value at path, or null. */ ImmutableTree.prototype.get = function (relativePath) { if (relativePath.isEmpty()) { return this.value; } else { var front = relativePath.getFront(); var child = this.children.get(front); if (child) { return child.get(relativePath.popFront()); } else { return null; } } }; /** * Replace the subtree at the specified path with the given new tree. * * @param {!Path} relativePath Path to replace subtree for. * @param {!ImmutableTree} newTree New tree. * @return {!ImmutableTree} Resulting tree. */ ImmutableTree.prototype.setTree = function (relativePath, newTree) { if (relativePath.isEmpty()) { return newTree; } else { var front = relativePath.getFront(); var child = this.children.get(front) || ImmutableTree.Empty; var newChild = child.setTree(relativePath.popFront(), newTree); var newChildren = void 0; if (newChild.isEmpty()) { newChildren = this.children.remove(front); } else { newChildren = this.children.insert(front, newChild); } return new ImmutableTree(this.value, newChildren); } }; /** * Performs a depth first fold on this tree. Transforms a tree into a single * value, given a function that operates on the path to a node, an optional * current value, and a map of child names to folded subtrees * @template V * @param {function(Path, ?T, Object.<string, V>):V} fn * @return {V} */ ImmutableTree.prototype.fold = function (fn) { return this.fold_(Path.Empty, fn); }; /** * Recursive helper for public-facing fold() method * @template V * @param {!Path} pathSoFar * @param {function(Path, ?T, Object.<string, V>):V} fn * @return {V} * @private */ ImmutableTree.prototype.fold_ = function (pathSoFar, fn) { var accum = {}; this.children.inorderTraversal(function (childKey, childTree) { accum[childKey] = childTree.fold_(pathSoFar.child(childKey), fn); }); return fn(pathSoFar, this.value, accum); }; /** * Find the first matching value on the given path. Return the result of applying f to it. * @template V * @param {!Path} path * @param {!function(!Path, !T):?V} f * @return {?V} */ ImmutableTree.prototype.findOnPath = function (path, f) { return this.findOnPath_(path, Path.Empty, f); }; ImmutableTree.prototype.findOnPath_ = function (pathToFollow, pathSoFar, f) { var result = this.value ? f(pathSoFar, this.value) : false; if (result) { return result; } else { if (pathToFollow.isEmpty()) { return null; } else { var front = pathToFollow.getFront(); var nextChild = this.children.get(front); if (nextChild) { return nextChild.findOnPath_(pathToFollow.popFront(), pathSoFar.child(front), f); } else { return null; } } } }; /** * * @param {!Path} path * @param {!function(!Path, !T)} f * @returns {!ImmutableTree.<T>} */ ImmutableTree.prototype.foreachOnPath = function (path, f) { return this.foreachOnPath_(path, Path.Empty, f); }; ImmutableTree.prototype.foreachOnPath_ = function (pathToFollow, currentRelativePath, f) { if (pathToFollow.isEmpty()) { return this; } else { if (this.value) { f(currentRelativePath, this.value); } var front = pathToFollow.getFront(); var nextChild = this.children.get(front); if (nextChild) { return nextChild.foreachOnPath_(pathToFollow.popFront(), currentRelativePath.child(front), f); } else { return ImmutableTree.Empty; } } }; /** * Calls the given function for each node in the tree that has a value. * * @param {function(!Path, !T)} f A function to be called with * the path from the root of the tree to a node, and the value at that node. * Called in depth-first order. */ ImmutableTree.prototype.foreach = function (f) { this.foreach_(Path.Empty, f); }; ImmutableTree.prototype.foreach_ = function (currentRelativePath, f) { this.children.inorderTraversal(function (childName, childTree) { childTree.foreach_(currentRelativePath.child(childName), f); }); if (this.value) { f(currentRelativePath, this.value); } }; /** * * @param {function(string, !T)} f */ ImmutableTree.prototype.foreachChild = function (f) { this.children.inorderTraversal(function (childName, childTree) { if (childTree.value) { f(childName, childTree.value); } }); }; // eslint-disable-next-line @typescript-eslint/no-explicit-any ImmutableTree.Empty = new ImmutableTree(null); return ImmutableTree; }()); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * @param {!OperationSource} source * @param {!Path} path * @constructor * @implements {Operation} */ var ListenComplete = /** @class */ (function () { function ListenComplete(source, path) { this.source = source; this.path = path; /** @inheritDoc */ this.type = OperationType.LISTEN_COMPLETE; } ListenComplete.prototype.operationForChild = function (childName) { if (this.path.isEmpty()) { return new ListenComplete(this.source, Path.Empty); } else { return new ListenComplete(this.source, this.path.popFront()); } }; return ListenComplete; }()); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * @param {!OperationSource} source * @param {!Path} path * @param {!Node} snap * @constructor * @implements {Operation} */ var Overwrite = /** @class */ (function () { function Overwrite(source, path, snap) { this.source = source; this.path = path; this.snap = snap; /** @inheritDoc */ this.type = OperationType.OVERWRITE; } Overwrite.prototype.operationForChild = function (childName) { if (this.path.isEmpty()) { return new Overwrite(this.source, Path.Empty, this.snap.getImmediateChild(childName)); } else { return new Overwrite(this.source, this.path.popFront(), this.snap); } }; return Overwrite; }()); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * @param {!OperationSource} source * @param {!Path} path * @param {!ImmutableTree.<!Node>} children * @constructor * @implements {Operation} */ var Merge = /** @class */ (function () { function Merge( /** @inheritDoc */ source, /** @inheritDoc */ path, /** @inheritDoc */ children) { this.source = source; this.path = path; this.children = children; /** @inheritDoc */ this.type = OperationType.MERGE; } /** * @inheritDoc */ Merge.prototype.operationForChild = function (childName) { if (this.path.isEmpty()) { var childTree = this.children.subtree(new Path(childName)); if (childTree.isEmpty()) { // This child is unaffected return null; } else if (childTree.value) { // We have a snapshot for the child in question. This becomes an overwrite of the child. return new Overwrite(this.source, Path.Empty, childTree.value); } else { // This is a merge at a deeper level return new Merge(this.source, Path.Empty, childTree); } } else { util.assert(this.path.getFront() === childName, "Can't get a merge for a child not on the path of the operation"); return new Merge(this.source, this.path.popFront(), this.children); } }; /** * @inheritDoc */ Merge.prototype.toString = function () { return ('Operation(' + this.path + ': ' + this.source.toString() + ' merge: ' + this.children.toString() + ')'); }; return Merge; }()); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * A cache node only stores complete children. Additionally it holds a flag whether the node can be considered fully * initialized in the sense that we know at one point in time this represented a valid state of the world, e.g. * initialized with data from the server, or a complete overwrite by the client. The filtered flag also tracks * whether a node potentially had children removed due to a filter. */ var CacheNode = /** @class */ (function () { /** * @param {!Node} node_ * @param {boolean} fullyInitialized_ * @param {boolean} filtered_ */ function CacheNode(node_, fullyInitialized_, filtered_) { this.node_ = node_; this.fullyInitialized_ = fullyInitialized_; this.filtered_ = filtered_; } /** * Returns whether this node was fully initialized with either server data or a complete overwrite by the client * @return {boolean} */ CacheNode.prototype.isFullyInitialized = function () { return this.fullyInitialized_; }; /** * Returns whether this node is potentially missing children due to a filter applied to the node * @return {boolean} */ CacheNode.prototype.isFiltered = function () { return this.filtered_; }; /** * @param {!Path} path * @return {boolean} */ CacheNode.prototype.isCompleteForPath = function (path) { if (path.isEmpty()) { return this.isFullyInitialized() && !this.filtered_; } var childKey = path.getFront(); return this.isCompleteForChild(childKey); }; /** * @param {!string} key * @return {boolean} */ CacheNode.prototype.isCompleteForChild = function (key) { return ((this.isFullyInitialized() && !this.filtered_) || this.node_.hasChild(key)); }; /** * @return {!Node} */ CacheNode.prototype.getNode = function () { return this.node_; }; return CacheNode; }()); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Stores the data we have cached for a view. * * serverSnap is the cached server data, eventSnap is the cached event data (server data plus any local writes). * * @constructor */ var ViewCache = /** @class */ (function () { /** * * @param {!CacheNode} eventCache_ * @param {!CacheNode} serverCache_ */ function ViewCache(eventCache_, serverCache_) { this.eventCache_ = eventCache_; this.serverCache_ = serverCache_; } /** * @param {!Node} eventSnap * @param {boolean} complete * @param {boolean} filtered * @return {!ViewCache} */ ViewCache.prototype.updateEventSnap = function (eventSnap, complete, filtered) { return new ViewCache(new CacheNode(eventSnap, complete, filtered), this.serverCache_); }; /** * @param {!Node} serverSnap * @param {boolean} complete * @param {boolean} filtered * @return {!ViewCache} */ ViewCache.prototype.updateServerSnap = function (serverSnap, complete, filtered) { return new ViewCache(this.eventCache_, new CacheNode(serverSnap, complete, filtered)); }; /** * @return {!CacheNode} */ ViewCache.prototype.getEventCache = function () { return this.eventCache_; }; /** * @return {?Node} */ ViewCache.prototype.getCompleteEventSnap = function () { return this.eventCache_.isFullyInitialized() ? this.eventCache_.getNode() : null; }; /** * @return {!CacheNode} */ ViewCache.prototype.getServerCache = function () { return this.serverCache_; }; /** * @return {?Node} */ ViewCache.prototype.getCompleteServerSnap = function () { return this.serverCache_.isFullyInitialized() ? this.serverCache_.getNode() : null; }; /** * @const * @type {ViewCache} */ ViewCache.Empty = new ViewCache(new CacheNode(ChildrenNode.EMPTY_NODE, /*fullyInitialized=*/ false, /*filtered=*/ false), new CacheNode(ChildrenNode.EMPTY_NODE, /*fullyInitialized=*/ false, /*filtered=*/ false)); return ViewCache; }()); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * @constructor * @struct * @param {!string} type The event type * @param {!Node} snapshotNode The data * @param {string=} childName The name for this child, if it's a child event * @param {Node=} oldSnap Used for intermediate processing of child changed events * @param {string=} prevName The name for the previous child, if applicable */ var Change = /** @class */ (function () { function Change(type, snapshotNode, childName, oldSnap, prevName) { this.type = type; this.snapshotNode = snapshotNode; this.childName = childName; this.oldSnap = oldSnap; this.prevName = prevName; } /** * @param {!Node} snapshot * @return {!Change} */ Change.valueChange = function (snapshot) { return new Change(Change.VALUE, snapshot); }; /** * @param {string} childKey * @param {!Node} snapshot * @return {!Change} */ Change.childAddedChange = function (childKey, snapshot) { return new Change(Change.CHILD_ADDED, snapshot, childKey); }; /** * @param {string} childKey * @param {!Node} snapshot * @return {!Change} */ Change.childRemovedChange = function (childKey, snapshot) { return new Change(Change.CHILD_REMOVED, snapshot, childKey); }; /** * @param {string} childKey * @param {!Node} newSnapshot * @param {!Node} oldSnapshot * @return {!Change} */ Change.childChangedChange = function (childKey, newSnapshot, oldSnapshot) { return new Change(Change.CHILD_CHANGED, newSnapshot, childKey, oldSnapshot); }; /** * @param {string} childKey * @param {!Node} snapshot * @return {!Change} */ Change.childMovedChange = function (childKey, snapshot) { return new Change(Change.CHILD_MOVED, snapshot, childKey); }; //event types /** Event type for a child added */ Change.CHILD_ADDED = 'child_added'; /** Event type for a child removed */ Change.CHILD_REMOVED = 'child_removed'; /** Event type for a child changed */ Change.CHILD_CHANGED = 'child_changed'; /** Event type for a child moved */ Change.CHILD_MOVED = 'child_moved'; /** Event type for a value change */ Change.VALUE = 'value'; return Change; }()); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Doesn't really filter nodes but applies an index to the node and keeps track of any changes * * @constructor * @implements {NodeFilter} * @param {!Index} index */ var IndexedFilter = /** @class */ (function () { function IndexedFilter(index_) { this.index_ = index_; } IndexedFilter.prototype.updateChild = function (snap, key, newChild, affectedPath, source, optChangeAccumulator) { util.assert(snap.isIndexed(this.index_), 'A node must be indexed if only a child is updated'); var oldChild = snap.getImmediateChild(key); // Check if anything actually changed. if (oldChild.getChild(affectedPath).equals(newChild.getChild(affectedPath))) { // There's an edge case where a child can enter or leave the view because affectedPath was set to null. // In this case, affectedPath will appear null in both the old and new snapshots. So we need // to avoid treating these cases as "nothing changed." if (oldChild.isEmpty() === newChild.isEmpty()) { // Nothing changed. // This assert should be valid, but it's expensive (can dominate perf testing) so don't actually do it. //assert(oldChild.equals(newChild), 'Old and new snapshots should be equal.'); return snap; } } if (optChangeAccumulator != null) { if (newChild.isEmpty()) { if (snap.hasChild(key)) { optChangeAccumulator.trackChildChange(Change.childRemovedChange(key, oldChild)); } else { util.assert(snap.isLeafNode(), 'A child remove without an old child only makes sense on a leaf node'); } } else if (oldChild.isEmpty()) { optChangeAccumulator.trackChildChange(Change.childAddedChange(key, newChild)); } else { optChangeAccumulator.trackChildChange(Change.childChangedChange(key, newChild, oldChild)); } } if (snap.isLeafNode() && newChild.isEmpty()) { return snap; } else { // Make sure the node is indexed return snap.updateImmediateChild(key, newChild).withIndex(this.index_); } }; /** * @inheritDoc */ IndexedFilter.prototype.updateFullNode = function (oldSnap, newSnap, optChangeAccumulator) { if (optChangeAccumulator != null) { if (!oldSnap.isLeafNode()) { oldSnap.forEachChild(PRIORITY_INDEX, function (key, childNode) { if (!newSnap.hasChild(key)) { optChangeAccumulator.trackChildChange(Change.childRemovedChange(key, childNode)); } }); } if (!newSnap.isLeafNode()) { newSnap.forEachChild(PRIORITY_INDEX, function (key, childNode) { if (oldSnap.hasChild(key)) { var oldChild = oldSnap.getImmediateChild(key); if (!oldChild.equals(childNode)) { optChangeAccumulator.trackChildChange(Change.childChangedChange(key, childNode, oldChild)); } } else { optChangeAccumulator.trackChildChange(Change.childAddedChange(key, childNode)); } }); } } return newSnap.withIndex(this.index_); }; /** * @inheritDoc */ IndexedFilter.prototype.updatePriority = function (oldSnap, newPriority) { if (oldSnap.isEmpty()) { return ChildrenNode.EMPTY_NODE; } else { return oldSnap.updatePriority(newPriority); } }; /** * @inheritDoc */ IndexedFilter.prototype.filtersNodes = function () { return false; }; /** * @inheritDoc */ IndexedFilter.prototype.getIndexedFilter = function () { return this; }; /** * @inheritDoc */ IndexedFilter.prototype.getIndex = function () { return this.index_; }; return IndexedFilter; }()); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var ChildChangeAccumulator = /** @class */ (function () { function ChildChangeAccumulator() { this.changeMap = new Map(); } ChildChangeAccumulator.prototype.trackChildChange = function (change) { var type = change.type; var childKey = change.childName; util.assert(type === Change.CHILD_ADDED || type === Change.CHILD_CHANGED || type === Change.CHILD_REMOVED, 'Only child changes supported for tracking'); util.assert(childKey !== '.priority', 'Only non-priority child changes can be tracked.'); var oldChange = this.changeMap.get(childKey); if (oldChange) { var oldType = oldChange.type; if (type === Change.CHILD_ADDED && oldType === Change.CHILD_REMOVED) { this.changeMap.set(childKey, Change.childChangedChange(childKey, change.snapshotNode, oldChange.snapshotNode)); } else if (type === Change.CHILD_REMOVED && oldType === Change.CHILD_ADDED) { this.changeMap.delete(childKey); } else if (type === Change.CHILD_REMOVED && oldType === Change.CHILD_CHANGED) { this.changeMap.set(childKey, Change.childRemovedChange(childKey, oldChange.oldSnap)); } else if (type === Change.CHILD_CHANGED && oldType === Change.CHILD_ADDED) { this.changeMap.set(childKey, Change.childAddedChange(childKey, change.snapshotNode)); } else if (type === Change.CHILD_CHANGED && oldType === Change.CHILD_CHANGED) { this.changeMap.set(childKey, Change.childChangedChange(childKey, change.snapshotNode, oldChange.oldSnap)); } else { throw util.assertionError('Illegal combination of changes: ' + change + ' occurred after ' + oldChange); } } else { this.changeMap.set(childKey, change); } }; ChildChangeAccumulator.prototype.getChanges = function () { return Array.from(this.changeMap.values()); }; return ChildChangeAccumulator; }()); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * An implementation of CompleteChildSource that never returns any additional children * * @private * @constructor * @implements CompleteChildSource */ // eslint-disable-next-line @typescript-eslint/naming-convention var NoCompleteChildSource_ = /** @class */ (function () { function NoCompleteChildSource_() { } /** * @inheritDoc */ NoCompleteChildSource_.prototype.getCompleteChild = function (childKey) { return null; }; /** * @inheritDoc */ NoCompleteChildSource_.prototype.getChildAfterChild = function (index, child, reverse) { return null; }; return NoCompleteChildSource_; }()); /** * Singleton instance. * @const * @type {!CompleteChildSource} */ var NO_COMPLETE_CHILD_SOURCE = new NoCompleteChildSource_(); /** * An implementation of CompleteChildSource that uses a WriteTree in addition to any other server data or * old event caches available to calculate complete children. * * * @implements CompleteChildSource */ var WriteTreeCompleteChildSource = /** @class */ (function () { /** * @param {!WriteTreeRef} writes_ * @param {!ViewCache} viewCache_ * @param {?Node} optCompleteServerCache_ */ function WriteTreeCompleteChildSource(writes_, viewCache_, optCompleteServerCache_) { if (optCompleteServerCache_ === void 0) { optCompleteServerCache_ = null; } this.writes_ = writes_; this.viewCache_ = viewCache_; this.optCompleteServerCache_ = optCompleteServerCache_; } /** * @inheritDoc */ WriteTreeCompleteChildSource.prototype.getCompleteChild = function (childKey) { var node = this.viewCache_.getEventCache(); if (node.isCompleteForChild(childKey)) { return node.getNode().getImmediateChild(childKey); } else { var serverNode = this.optCompleteServerCache_ != null ? new CacheNode(this.optCompleteServerCache_, true, false) : this.viewCache_.getServerCache(); return this.writes_.calcCompleteChild(childKey, serverNode); } }; /** * @inheritDoc */ WriteTreeCompleteChildSource.prototype.getChildAfterChild = function (index, child, reverse) { var completeServerData = this.optCompleteServerCache_ != null ? this.optCompleteServerCache_ : this.viewCache_.getCompleteServerSnap(); var nodes = this.writes_.calcIndexedSlice(completeServerData, child, 1, reverse, index); if (nodes.length === 0) { return null; } else { return nodes[0]; } }; return WriteTreeCompleteChildSource; }()); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * @constructor * @struct */ var ProcessorResult = /** @class */ (function () { /** * @param {!ViewCache} viewCache * @param {!Array.<!Change>} changes */ function ProcessorResult(viewCache, changes) { this.viewCache = viewCache; this.changes = changes; } return ProcessorResult; }()); /** * @constructor */ var ViewProcessor = /** @class */ (function () { /** * @param {!NodeFilter} filter_ */ function ViewProcessor(filter_) { this.filter_ = filter_; } /** * @param {!ViewCache} viewCache */ ViewProcessor.prototype.assertIndexed = function (viewCache) { util.assert(viewCache.getEventCache().getNode().isIndexed(this.filter_.getIndex()), 'Event snap not indexed'); util.assert(viewCache.getServerCache().getNode().isIndexed(this.filter_.getIndex()), 'Server snap not indexed'); }; /** * @param {!ViewCache} oldViewCache * @param {!Operation} operation * @param {!WriteTreeRef} writesCache * @param {?Node} completeCache * @return {!ProcessorResult} */ ViewProcessor.prototype.applyOperation = function (oldViewCache, operation, writesCache, completeCache) { var accumulator = new ChildChangeAccumulator(); var newViewCache, filterServerNode; if (operation.type === OperationType.OVERWRITE) { var overwrite = operation; if (overwrite.source.fromUser) { newViewCache = this.applyUserOverwrite_(oldViewCache, overwrite.path, overwrite.snap, writesCache, completeCache, accumulator); } else { util.assert(overwrite.source.fromServer, 'Unknown source.'); // We filter the node if it's a tagged update or the node has been previously filtered and the // update is not at the root in which case it is ok (and necessary) to mark the node unfiltered // again filterServerNode = overwrite.source.tagged || (oldViewCache.getServerCache().isFiltered() && !overwrite.path.isEmpty()); newViewCache = this.applyServerOverwrite_(oldViewCache, overwrite.path, overwrite.snap, writesCache, completeCache, filterServerNode, accumulator); } } else if (operation.type === OperationType.MERGE) { var merge = operation; if (merge.source.fromUser) { newViewCache = this.applyUserMerge_(oldViewCache, merge.path, merge.children, writesCache, completeCache, accumulator); } else { util.assert(merge.source.fromServer, 'Unknown source.'); // We filter the node if it's a tagged update or the node has been previously filtered filterServerNode = merge.source.tagged || oldViewCache.getServerCache().isFiltered(); newViewCache = this.applyServerMerge_(oldViewCache, merge.path, merge.children, writesCache, completeCache, filterServerNode, accumulator); } } else if (operation.type === OperationType.ACK_USER_WRITE) { var ackUserWrite = operation; if (!ackUserWrite.revert) { newViewCache = this.ackUserWrite_(oldViewCache, ackUserWrite.path, ackUserWrite.affectedTree, writesCache, completeCache, accumulator); } else { newViewCache = this.revertUserWrite_(oldViewCache, ackUserWrite.path, writesCache, completeCache, accumulator); } } else if (operation.type === OperationType.LISTEN_COMPLETE) { newViewCache = this.listenComplete_(oldViewCache, operation.path, writesCache, accumulator); } else { throw util.assertionError('Unknown operation type: ' + operation.type); } var changes = accumulator.getChanges(); ViewProcessor.maybeAddValueEvent_(oldViewCache, newViewCache, changes); return new ProcessorResult(newViewCache, changes); }; /** * @param {!ViewCache} oldViewCache * @param {!ViewCache} newViewCache * @param {!Array.<!Change>} accumulator * @private */ ViewProcessor.maybeAddValueEvent_ = function (oldViewCache, newViewCache, accumulator) { var eventSnap = newViewCache.getEventCache(); if (eventSnap.isFullyInitialized()) { var isLeafOrEmpty = eventSnap.getNode().isLeafNode() || eventSnap.getNode().isEmpty(); var oldCompleteSnap = oldViewCache.getCompleteEventSnap(); if (accumulator.length > 0 || !oldViewCache.getEventCache().isFullyInitialized() || (isLeafOrEmpty && !eventSnap.getNode().equals(/** @type {!Node} */ oldCompleteSnap)) || !eventSnap.getNode().getPriority().equals(oldCompleteSnap.getPriority())) { accumulator.push(Change.valueChange( /** @type {!Node} */ newViewCache.getCompleteEventSnap())); } } }; /** * @param {!ViewCache} viewCache * @param {!Path} changePath * @param {!WriteTreeRef} writesCache * @param {!CompleteChildSource} source * @param {!ChildChangeAccumulator} accumulator * @return {!ViewCache} * @private */ ViewProcessor.prototype.generateEventCacheAfterServerEvent_ = function (viewCache, changePath, writesCache, source, accumulator) { var oldEventSnap = viewCache.getEventCache(); if (writesCache.shadowingWrite(changePath) != null) { // we have a shadowing write, ignore changes return viewCache; } else { var newEventCache = void 0, serverNode = void 0; if (changePath.isEmpty()) { // TODO: figure out how this plays with "sliding ack windows" util.assert(viewCache.getServerCache().isFullyInitialized(), 'If change path is empty, we must have complete server data'); if (viewCache.getServerCache().isFiltered()) { // We need to special case this, because we need to only apply writes to complete children, or // we might end up raising events for incomplete children. If the server data is filtered deep // writes cannot be guaranteed to be complete var serverCache = viewCache.getCompleteServerSnap(); var completeChildren = serverCache instanceof ChildrenNode ? serverCache : ChildrenNode.EMPTY_NODE; var completeEventChildren = writesCache.calcCompleteEventChildren(completeChildren); newEventCache = this.filter_.updateFullNode(viewCache.getEventCache().getNode(), completeEventChildren, accumulator); } else { var completeNode = writesCache.calcCompleteEventCache(viewCache.getCompleteServerSnap()); newEventCache = this.filter_.updateFullNode(viewCache.getEventCache().getNode(), completeNode, accumulator); } } else { var childKey = changePath.getFront(); if (childKey === '.priority') { util.assert(changePath.getLength() === 1, "Can't have a priority with additional path components"); var oldEventNode = oldEventSnap.getNode(); serverNode = viewCache.getServerCache().getNode(); // we might have overwrites for this priority var updatedPriority = writesCache.calcEventCacheAfterServerOverwrite(changePath, oldEventNode, serverNode); if (updatedPriority != null) { newEventCache = this.filter_.updatePriority(oldEventNode, updatedPriority); } else { // priority didn't change, keep old node newEventCache = oldEventSnap.getNode(); } } else { var childChangePath = changePath.popFront(); // update child var newEventChild = void 0; if (oldEventSnap.isCompleteForChild(childKey)) { serverNode = viewCache.getServerCache().getNode(); var eventChildUpdate = writesCache.calcEventCacheAfterServerOverwrite(changePath, oldEventSnap.getNode(), serverNode); if (eventChildUpdate != null) { newEventChild = oldEventSnap .getNode() .getImmediateChild(childKey) .updateChild(childChangePath, eventChildUpdate); } else { // Nothing changed, just keep the old child newEventChild = oldEventSnap .getNode() .getImmediateChild(childKey); } } else { newEventChild = writesCache.calcCompleteChild(childKey, viewCache.getServerCache()); } if (newEventChild != null) { newEventCache = this.filter_.updateChild(oldEventSnap.getNode(), childKey, newEventChild, childChangePath, source, accumulator); } else { // no complete child available or no change newEventCache = oldEventSnap.getNode(); } } } return viewCache.updateEventSnap(newEventCache, oldEventSnap.isFullyInitialized() || changePath.isEmpty(), this.filter_.filtersNodes()); } }; /** * @param {!ViewCache} oldViewCache * @param {!Path} changePath * @param {!Node} changedSnap * @param {!WriteTreeRef} writesCache * @param {?Node} completeCache * @param {boolean} filterServerNode * @param {!ChildChangeAccumulator} accumulator * @return {!ViewCache} * @private */ ViewProcessor.prototype.applyServerOverwrite_ = function (oldViewCache, changePath, changedSnap, writesCache, completeCache, filterServerNode, accumulator) { var oldServerSnap = oldViewCache.getServerCache(); var newServerCache; var serverFilter = filterServerNode ? this.filter_ : this.filter_.getIndexedFilter(); if (changePath.isEmpty()) { newServerCache = serverFilter.updateFullNode(oldServerSnap.getNode(), changedSnap, null); } else if (serverFilter.filtersNodes() && !oldServerSnap.isFiltered()) { // we want to filter the server node, but we didn't filter the server node yet, so simulate a full update var newServerNode = oldServerSnap .getNode() .updateChild(changePath, changedSnap); newServerCache = serverFilter.updateFullNode(oldServerSnap.getNode(), newServerNode, null); } else { var childKey = changePath.getFront(); if (!oldServerSnap.isCompleteForPath(changePath) && changePath.getLength() > 1) { // We don't update incomplete nodes with updates intended for other listeners return oldViewCache; } var childChangePath = changePath.popFront(); var childNode = oldServerSnap.getNode().getImmediateChild(childKey); var newChildNode = childNode.updateChild(childChangePath, changedSnap); if (childKey === '.priority') { newServerCache = serverFilter.updatePriority(oldServerSnap.getNode(), newChildNode); } else { newServerCache = serverFilter.updateChild(oldServerSnap.getNode(), childKey, newChildNode, childChangePath, NO_COMPLETE_CHILD_SOURCE, null); } } var newViewCache = oldViewCache.updateServerSnap(newServerCache, oldServerSnap.isFullyInitialized() || changePath.isEmpty(), serverFilter.filtersNodes()); var source = new WriteTreeCompleteChildSource(writesCache, newViewCache, completeCache); return this.generateEventCacheAfterServerEvent_(newViewCache, changePath, writesCache, source, accumulator); }; /** * @param {!ViewCache} oldViewCache * @param {!Path} changePath * @param {!Node} changedSnap * @param {!WriteTreeRef} writesCache * @param {?Node} completeCache * @param {!ChildChangeAccumulator} accumulator * @return {!ViewCache} * @private */ ViewProcessor.prototype.applyUserOverwrite_ = function (oldViewCache, changePath, changedSnap, writesCache, completeCache, accumulator) { var oldEventSnap = oldViewCache.getEventCache(); var newViewCache, newEventCache; var source = new WriteTreeCompleteChildSource(writesCache, oldViewCache, completeCache); if (changePath.isEmpty()) { newEventCache = this.filter_.updateFullNode(oldViewCache.getEventCache().getNode(), changedSnap, accumulator); newViewCache = oldViewCache.updateEventSnap(newEventCache, true, this.filter_.filtersNodes()); } else { var childKey = changePath.getFront(); if (childKey === '.priority') { newEventCache = this.filter_.updatePriority(oldViewCache.getEventCache().getNode(), changedSnap); newViewCache = oldViewCache.updateEventSnap(newEventCache, oldEventSnap.isFullyInitialized(), oldEventSnap.isFiltered()); } else { var childChangePath = changePath.popFront(); var oldChild = oldEventSnap.getNode().getImmediateChild(childKey); var newChild = void 0; if (childChangePath.isEmpty()) { // Child overwrite, we can replace the child newChild = changedSnap; } else { var childNode = source.getCompleteChild(childKey); if (childNode != null) { if (childChangePath.getBack() === '.priority' && childNode.getChild(childChangePath.parent()).isEmpty()) { // This is a priority update on an empty node. If this node exists on the server, the // server will send down the priority in the update, so ignore for now newChild = childNode; } else { newChild = childNode.updateChild(childChangePath, changedSnap); } } else { // There is no complete child node available newChild = ChildrenNode.EMPTY_NODE; } } if (!oldChild.equals(newChild)) { var newEventSnap = this.filter_.updateChild(oldEventSnap.getNode(), childKey, newChild, childChangePath, source, accumulator); newViewCache = oldViewCache.updateEventSnap(newEventSnap, oldEventSnap.isFullyInitialized(), this.filter_.filtersNodes()); } else { newViewCache = oldViewCache; } } } return newViewCache; }; /** * @param {!ViewCache} viewCache * @param {string} childKey * @return {boolean} * @private */ ViewProcessor.cacheHasChild_ = function (viewCache, childKey) { return viewCache.getEventCache().isCompleteForChild(childKey); }; /** * @param {!ViewCache} viewCache * @param {!Path} path * @param {ImmutableTree.<!Node>} changedChildren * @param {!WriteTreeRef} writesCache * @param {?Node} serverCache * @param {!ChildChangeAccumulator} accumulator * @return {!ViewCache} * @private */ ViewProcessor.prototype.applyUserMerge_ = function (viewCache, path, changedChildren, writesCache, serverCache, accumulator) { var _this = this; // HACK: In the case of a limit query, there may be some changes that bump things out of the // window leaving room for new items. It's important we process these changes first, so we // iterate the changes twice, first processing any that affect items currently in view. // TODO: I consider an item "in view" if cacheHasChild is true, which checks both the server // and event snap. I'm not sure if this will result in edge cases when a child is in one but // not the other. var curViewCache = viewCache; changedChildren.foreach(function (relativePath, childNode) { var writePath = path.child(relativePath); if (ViewProcessor.cacheHasChild_(viewCache, writePath.getFront())) { curViewCache = _this.applyUserOverwrite_(curViewCache, writePath, childNode, writesCache, serverCache, accumulator); } }); changedChildren.foreach(function (relativePath, childNode) { var writePath = path.child(relativePath); if (!ViewProcessor.cacheHasChild_(viewCache, writePath.getFront())) { curViewCache = _this.applyUserOverwrite_(curViewCache, writePath, childNode, writesCache, serverCache, accumulator); } }); return curViewCache; }; /** * @param {!Node} node * @param {ImmutableTree.<!Node>} merge * @return {!Node} * @private */ ViewProcessor.prototype.applyMerge_ = function (node, merge) { merge.foreach(function (relativePath, childNode) { node = node.updateChild(relativePath, childNode); }); return node; }; /** * @param {!ViewCache} viewCache * @param {!Path} path * @param {!ImmutableTree.<!Node>} changedChildren * @param {!WriteTreeRef} writesCache * @param {?Node} serverCache * @param {boolean} filterServerNode * @param {!ChildChangeAccumulator} accumulator * @return {!ViewCache} * @private */ ViewProcessor.prototype.applyServerMerge_ = function (viewCache, path, changedChildren, writesCache, serverCache, filterServerNode, accumulator) { var _this = this; // If we don't have a cache yet, this merge was intended for a previously listen in the same location. Ignore it and // wait for the complete data update coming soon. if (viewCache.getServerCache().getNode().isEmpty() && !viewCache.getServerCache().isFullyInitialized()) { return viewCache; } // HACK: In the case of a limit query, there may be some changes that bump things out of the // window leaving room for new items. It's important we process these changes first, so we // iterate the changes twice, first processing any that affect items currently in view. // TODO: I consider an item "in view" if cacheHasChild is true, which checks both the server // and event snap. I'm not sure if this will result in edge cases when a child is in one but // not the other. var curViewCache = viewCache; var viewMergeTree; if (path.isEmpty()) { viewMergeTree = changedChildren; } else { viewMergeTree = ImmutableTree.Empty.setTree(path, changedChildren); } var serverNode = viewCache.getServerCache().getNode(); viewMergeTree.children.inorderTraversal(function (childKey, childTree) { if (serverNode.hasChild(childKey)) { var serverChild = viewCache .getServerCache() .getNode() .getImmediateChild(childKey); var newChild = _this.applyMerge_(serverChild, childTree); curViewCache = _this.applyServerOverwrite_(curViewCache, new Path(childKey), newChild, writesCache, serverCache, filterServerNode, accumulator); } }); viewMergeTree.children.inorderTraversal(function (childKey, childMergeTree) { var isUnknownDeepMerge = !viewCache.getServerCache().isCompleteForChild(childKey) && childMergeTree.value == null; if (!serverNode.hasChild(childKey) && !isUnknownDeepMerge) { var serverChild = viewCache .getServerCache() .getNode() .getImmediateChild(childKey); var newChild = _this.applyMerge_(serverChild, childMergeTree); curViewCache = _this.applyServerOverwrite_(curViewCache, new Path(childKey), newChild, writesCache, serverCache, filterServerNode, accumulator); } }); return curViewCache; }; /** * @param {!ViewCache} viewCache * @param {!Path} ackPath * @param {!ImmutableTree<!boolean>} affectedTree * @param {!WriteTreeRef} writesCache * @param {?Node} completeCache * @param {!ChildChangeAccumulator} accumulator * @return {!ViewCache} * @private */ ViewProcessor.prototype.ackUserWrite_ = function (viewCache, ackPath, affectedTree, writesCache, completeCache, accumulator) { if (writesCache.shadowingWrite(ackPath) != null) { return viewCache; } // Only filter server node if it is currently filtered var filterServerNode = viewCache.getServerCache().isFiltered(); // Essentially we'll just get our existing server cache for the affected paths and re-apply it as a server update // now that it won't be shadowed. var serverCache = viewCache.getServerCache(); if (affectedTree.value != null) { // This is an overwrite. if ((ackPath.isEmpty() && serverCache.isFullyInitialized()) || serverCache.isCompleteForPath(ackPath)) { return this.applyServerOverwrite_(viewCache, ackPath, serverCache.getNode().getChild(ackPath), writesCache, completeCache, filterServerNode, accumulator); } else if (ackPath.isEmpty()) { // This is a goofy edge case where we are acking data at this location but don't have full data. We // should just re-apply whatever we have in our cache as a merge. var changedChildren_1 = ImmutableTree.Empty; serverCache.getNode().forEachChild(KEY_INDEX, function (name, node) { changedChildren_1 = changedChildren_1.set(new Path(name), node); }); return this.applyServerMerge_(viewCache, ackPath, changedChildren_1, writesCache, completeCache, filterServerNode, accumulator); } else { return viewCache; } } else { // This is a merge. var changedChildren_2 = ImmutableTree.Empty; affectedTree.foreach(function (mergePath, value) { var serverCachePath = ackPath.child(mergePath); if (serverCache.isCompleteForPath(serverCachePath)) { changedChildren_2 = changedChildren_2.set(mergePath, serverCache.getNode().getChild(serverCachePath)); } }); return this.applyServerMerge_(viewCache, ackPath, changedChildren_2, writesCache, completeCache, filterServerNode, accumulator); } }; /** * @param {!ViewCache} viewCache * @param {!Path} path * @param {!WriteTreeRef} writesCache * @param {!ChildChangeAccumulator} accumulator * @return {!ViewCache} * @private */ ViewProcessor.prototype.listenComplete_ = function (viewCache, path, writesCache, accumulator) { var oldServerNode = viewCache.getServerCache(); var newViewCache = viewCache.updateServerSnap(oldServerNode.getNode(), oldServerNode.isFullyInitialized() || path.isEmpty(), oldServerNode.isFiltered()); return this.generateEventCacheAfterServerEvent_(newViewCache, path, writesCache, NO_COMPLETE_CHILD_SOURCE, accumulator); }; /** * @param {!ViewCache} viewCache * @param {!Path} path * @param {!WriteTreeRef} writesCache * @param {?Node} completeServerCache * @param {!ChildChangeAccumulator} accumulator * @return {!ViewCache} * @private */ ViewProcessor.prototype.revertUserWrite_ = function (viewCache, path, writesCache, completeServerCache, accumulator) { var complete; if (writesCache.shadowingWrite(path) != null) { return viewCache; } else { var source = new WriteTreeCompleteChildSource(writesCache, viewCache, completeServerCache); var oldEventCache = viewCache.getEventCache().getNode(); var newEventCache = void 0; if (path.isEmpty() || path.getFront() === '.priority') { var newNode = void 0; if (viewCache.getServerCache().isFullyInitialized()) { newNode = writesCache.calcCompleteEventCache(viewCache.getCompleteServerSnap()); } else { var serverChildren = viewCache.getServerCache().getNode(); util.assert(serverChildren instanceof ChildrenNode, 'serverChildren would be complete if leaf node'); newNode = writesCache.calcCompleteEventChildren(serverChildren); } newNode = newNode; newEventCache = this.filter_.updateFullNode(oldEventCache, newNode, accumulator); } else { var childKey = path.getFront(); var newChild = writesCache.calcCompleteChild(childKey, viewCache.getServerCache()); if (newChild == null && viewCache.getServerCache().isCompleteForChild(childKey)) { newChild = oldEventCache.getImmediateChild(childKey); } if (newChild != null) { newEventCache = this.filter_.updateChild(oldEventCache, childKey, newChild, path.popFront(), source, accumulator); } else if (viewCache.getEventCache().getNode().hasChild(childKey)) { // No complete child available, delete the existing one, if any newEventCache = this.filter_.updateChild(oldEventCache, childKey, ChildrenNode.EMPTY_NODE, path.popFront(), source, accumulator); } else { newEventCache = oldEventCache; } if (newEventCache.isEmpty() && viewCache.getServerCache().isFullyInitialized()) { // We might have reverted all child writes. Maybe the old event was a leaf node complete = writesCache.calcCompleteEventCache(viewCache.getCompleteServerSnap()); if (complete.isLeafNode()) { newEventCache = this.filter_.updateFullNode(newEventCache, complete, accumulator); } } } complete = viewCache.getServerCache().isFullyInitialized() || writesCache.shadowingWrite(Path.Empty) != null; return viewCache.updateEventSnap(newEventCache, complete, this.filter_.filtersNodes()); } }; return ViewProcessor; }()); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * An EventGenerator is used to convert "raw" changes (Change) as computed by the * CacheDiffer into actual events (Event) that can be raised. See generateEventsForChanges() * for details. * * @constructor */ var EventGenerator = /** @class */ (function () { /** * * @param {!Query} query_ */ function EventGenerator(query_) { this.query_ = query_; /** * @private * @type {!Index} */ this.index_ = this.query_.getQueryParams().getIndex(); } /** * Given a set of raw changes (no moved events and prevName not specified yet), and a set of * EventRegistrations that should be notified of these changes, generate the actual events to be raised. * * Notes: * - child_moved events will be synthesized at this time for any child_changed events that affect * our index. * - prevName will be calculated based on the index ordering. * * @param {!Array.<!Change>} changes * @param {!Node} eventCache * @param {!Array.<!EventRegistration>} eventRegistrations * @return {!Array.<!Event>} */ EventGenerator.prototype.generateEventsForChanges = function (changes, eventCache, eventRegistrations) { var _this = this; var events = []; var moves = []; changes.forEach(function (change) { if (change.type === Change.CHILD_CHANGED && _this.index_.indexedValueChanged(change.oldSnap, change.snapshotNode)) { moves.push(Change.childMovedChange(change.childName, change.snapshotNode)); } }); this.generateEventsForType_(events, Change.CHILD_REMOVED, changes, eventRegistrations, eventCache); this.generateEventsForType_(events, Change.CHILD_ADDED, changes, eventRegistrations, eventCache); this.generateEventsForType_(events, Change.CHILD_MOVED, moves, eventRegistrations, eventCache); this.generateEventsForType_(events, Change.CHILD_CHANGED, changes, eventRegistrations, eventCache); this.generateEventsForType_(events, Change.VALUE, changes, eventRegistrations, eventCache); return events; }; /** * Given changes of a single change type, generate the corresponding events. * * @param {!Array.<!Event>} events * @param {!string} eventType * @param {!Array.<!Change>} changes * @param {!Array.<!EventRegistration>} registrations * @param {!Node} eventCache * @private */ EventGenerator.prototype.generateEventsForType_ = function (events, eventType, changes, registrations, eventCache) { var _this = this; var filteredChanges = changes.filter(function (change) { return change.type === eventType; }); filteredChanges.sort(this.compareChanges_.bind(this)); filteredChanges.forEach(function (change) { var materializedChange = _this.materializeSingleChange_(change, eventCache); registrations.forEach(function (registration) { if (registration.respondsTo(change.type)) { events.push(registration.createEvent(materializedChange, _this.query_)); } }); }); }; /** * @param {!Change} change * @param {!Node} eventCache * @return {!Change} * @private */ EventGenerator.prototype.materializeSingleChange_ = function (change, eventCache) { if (change.type === 'value' || change.type === 'child_removed') { return change; } else { change.prevName = eventCache.getPredecessorChildName( /** @type {!string} */ change.childName, change.snapshotNode, this.index_); return change; } }; /** * @param {!Change} a * @param {!Change} b * @return {number} * @private */ EventGenerator.prototype.compareChanges_ = function (a, b) { if (a.childName == null || b.childName == null) { throw util.assertionError('Should only compare child_ events.'); } var aWrapped = new NamedNode(a.childName, a.snapshotNode); var bWrapped = new NamedNode(b.childName, b.snapshotNode); return this.index_.compare(aWrapped, bWrapped); }; return EventGenerator; }()); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * A view represents a specific location and query that has 1 or more event registrations. * * It does several things: * - Maintains the list of event registrations for this location/query. * - Maintains a cache of the data visible for this location/query. * - Applies new operations (via applyOperation), updates the cache, and based on the event * registrations returns the set of events to be raised. * @constructor */ var View = /** @class */ (function () { /** * * @param {!Query} query_ * @param {!ViewCache} initialViewCache */ function View(query_, initialViewCache) { this.query_ = query_; this.eventRegistrations_ = []; var params = this.query_.getQueryParams(); var indexFilter = new IndexedFilter(params.getIndex()); var filter = params.getNodeFilter(); /** * @type {ViewProcessor} * @private */ this.processor_ = new ViewProcessor(filter); var initialServerCache = initialViewCache.getServerCache(); var initialEventCache = initialViewCache.getEventCache(); // Don't filter server node with other filter than index, wait for tagged listen var serverSnap = indexFilter.updateFullNode(ChildrenNode.EMPTY_NODE, initialServerCache.getNode(), null); var eventSnap = filter.updateFullNode(ChildrenNode.EMPTY_NODE, initialEventCache.getNode(), null); var newServerCache = new CacheNode(serverSnap, initialServerCache.isFullyInitialized(), indexFilter.filtersNodes()); var newEventCache = new CacheNode(eventSnap, initialEventCache.isFullyInitialized(), filter.filtersNodes()); /** * @type {!ViewCache} * @private */ this.viewCache_ = new ViewCache(newEventCache, newServerCache); /** * @type {!EventGenerator} * @private */ this.eventGenerator_ = new EventGenerator(this.query_); } /** * @return {!Query} */ View.prototype.getQuery = function () { return this.query_; }; /** * @return {?Node} */ View.prototype.getServerCache = function () { return this.viewCache_.getServerCache().getNode(); }; /** * @param {!Path} path * @return {?Node} */ View.prototype.getCompleteServerCache = function (path) { var cache = this.viewCache_.getCompleteServerSnap(); if (cache) { // If this isn't a "loadsAllData" view, then cache isn't actually a complete cache and // we need to see if it contains the child we're interested in. if (this.query_.getQueryParams().loadsAllData() || (!path.isEmpty() && !cache.getImmediateChild(path.getFront()).isEmpty())) { return cache.getChild(path); } } return null; }; /** * @return {boolean} */ View.prototype.isEmpty = function () { return this.eventRegistrations_.length === 0; }; /** * @param {!EventRegistration} eventRegistration */ View.prototype.addEventRegistration = function (eventRegistration) { this.eventRegistrations_.push(eventRegistration); }; /** * @param {?EventRegistration} eventRegistration If null, remove all callbacks. * @param {Error=} cancelError If a cancelError is provided, appropriate cancel events will be returned. * @return {!Array.<!Event>} Cancel events, if cancelError was provided. */ View.prototype.removeEventRegistration = function (eventRegistration, cancelError) { var cancelEvents = []; if (cancelError) { util.assert(eventRegistration == null, 'A cancel should cancel all event registrations.'); var path_1 = this.query_.path; this.eventRegistrations_.forEach(function (registration) { cancelError /** @type {!Error} */ = cancelError; var maybeEvent = registration.createCancelEvent(cancelError, path_1); if (maybeEvent) { cancelEvents.push(maybeEvent); } }); } if (eventRegistration) { var remaining = []; for (var i = 0; i < this.eventRegistrations_.length; ++i) { var existing = this.eventRegistrations_[i]; if (!existing.matches(eventRegistration)) { remaining.push(existing); } else if (eventRegistration.hasAnyCallback()) { // We're removing just this one remaining = remaining.concat(this.eventRegistrations_.slice(i + 1)); break; } } this.eventRegistrations_ = remaining; } else { this.eventRegistrations_ = []; } return cancelEvents; }; /** * Applies the given Operation, updates our cache, and returns the appropriate events. * * @param {!Operation} operation * @param {!WriteTreeRef} writesCache * @param {?Node} completeServerCache * @return {!Array.<!Event>} */ View.prototype.applyOperation = function (operation, writesCache, completeServerCache) { if (operation.type === OperationType.MERGE && operation.source.queryId !== null) { util.assert(this.viewCache_.getCompleteServerSnap(), 'We should always have a full cache before handling merges'); util.assert(this.viewCache_.getCompleteEventSnap(), 'Missing event cache, even though we have a server cache'); } var oldViewCache = this.viewCache_; var result = this.processor_.applyOperation(oldViewCache, operation, writesCache, completeServerCache); this.processor_.assertIndexed(result.viewCache); util.assert(result.viewCache.getServerCache().isFullyInitialized() || !oldViewCache.getServerCache().isFullyInitialized(), 'Once a server snap is complete, it should never go back'); this.viewCache_ = result.viewCache; return this.generateEventsForChanges_(result.changes, result.viewCache.getEventCache().getNode(), null); }; /** * @param {!EventRegistration} registration * @return {!Array.<!Event>} */ View.prototype.getInitialEvents = function (registration) { var eventSnap = this.viewCache_.getEventCache(); var initialChanges = []; if (!eventSnap.getNode().isLeafNode()) { var eventNode = eventSnap.getNode(); eventNode.forEachChild(PRIORITY_INDEX, function (key, childNode) { initialChanges.push(Change.childAddedChange(key, childNode)); }); } if (eventSnap.isFullyInitialized()) { initialChanges.push(Change.valueChange(eventSnap.getNode())); } return this.generateEventsForChanges_(initialChanges, eventSnap.getNode(), registration); }; /** * @private * @param {!Array.<!Change>} changes * @param {!Node} eventCache * @param {EventRegistration=} eventRegistration * @return {!Array.<!Event>} */ View.prototype.generateEventsForChanges_ = function (changes, eventCache, eventRegistration) { var registrations = eventRegistration ? [eventRegistration] : this.eventRegistrations_; return this.eventGenerator_.generateEventsForChanges(changes, eventCache, registrations); }; return View; }()); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var __referenceConstructor$1; /** * SyncPoint represents a single location in a SyncTree with 1 or more event registrations, meaning we need to * maintain 1 or more Views at this location to cache server data and raise appropriate events for server changes * and user writes (set, transaction, update). * * It's responsible for: * - Maintaining the set of 1 or more views necessary at this location (a SyncPoint with 0 views should be removed). * - Proxying user / server operations to the views as appropriate (i.e. applyServerOverwrite, * applyUserOverwrite, etc.) */ var SyncPoint = /** @class */ (function () { function SyncPoint() { /** * The Views being tracked at this location in the tree, stored as a map where the key is a * queryId and the value is the View for that query. * * NOTE: This list will be quite small (usually 1, but perhaps 2 or 3; any more is an odd use case). */ this.views = new Map(); } Object.defineProperty(SyncPoint, "__referenceConstructor", { get: function () { util.assert(__referenceConstructor$1, 'Reference.ts has not been loaded'); return __referenceConstructor$1; }, set: function (val) { util.assert(!__referenceConstructor$1, '__referenceConstructor has already been defined'); __referenceConstructor$1 = val; }, enumerable: false, configurable: true }); SyncPoint.prototype.isEmpty = function () { return this.views.size === 0; }; SyncPoint.prototype.applyOperation = function (operation, writesCache, optCompleteServerCache) { var e_1, _a; var queryId = operation.source.queryId; if (queryId !== null) { var view = this.views.get(queryId); util.assert(view != null, 'SyncTree gave us an op for an invalid query.'); return view.applyOperation(operation, writesCache, optCompleteServerCache); } else { var events = []; try { for (var _b = tslib.__values(this.views.values()), _c = _b.next(); !_c.done; _c = _b.next()) { var view = _c.value; events = events.concat(view.applyOperation(operation, writesCache, optCompleteServerCache)); } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (_c && !_c.done && (_a = _b.return)) _a.call(_b); } finally { if (e_1) throw e_1.error; } } return events; } }; /** * Add an event callback for the specified query. * * @param {!Query} query * @param {!EventRegistration} eventRegistration * @param {!WriteTreeRef} writesCache * @param {?Node} serverCache Complete server cache, if we have it. * @param {boolean} serverCacheComplete * @return {!Array.<!Event>} Events to raise. */ SyncPoint.prototype.addEventRegistration = function (query, eventRegistration, writesCache, serverCache, serverCacheComplete) { var queryId = query.queryIdentifier(); var view = this.views.get(queryId); if (!view) { // TODO: make writesCache take flag for complete server node var eventCache = writesCache.calcCompleteEventCache(serverCacheComplete ? serverCache : null); var eventCacheComplete = false; if (eventCache) { eventCacheComplete = true; } else if (serverCache instanceof ChildrenNode) { eventCache = writesCache.calcCompleteEventChildren(serverCache); eventCacheComplete = false; } else { eventCache = ChildrenNode.EMPTY_NODE; eventCacheComplete = false; } var viewCache = new ViewCache(new CacheNode( /** @type {!Node} */ eventCache, eventCacheComplete, false), new CacheNode( /** @type {!Node} */ serverCache, serverCacheComplete, false)); view = new View(query, viewCache); this.views.set(queryId, view); } // This is guaranteed to exist now, we just created anything that was missing view.addEventRegistration(eventRegistration); return view.getInitialEvents(eventRegistration); }; /** * Remove event callback(s). Return cancelEvents if a cancelError is specified. * * If query is the default query, we'll check all views for the specified eventRegistration. * If eventRegistration is null, we'll remove all callbacks for the specified view(s). * * @param {!Query} query * @param {?EventRegistration} eventRegistration If null, remove all callbacks. * @param {Error=} cancelError If a cancelError is provided, appropriate cancel events will be returned. * @return {{removed:!Array.<!Query>, events:!Array.<!Event>}} removed queries and any cancel events */ SyncPoint.prototype.removeEventRegistration = function (query, eventRegistration, cancelError) { var e_2, _a; var queryId = query.queryIdentifier(); var removed = []; var cancelEvents = []; var hadCompleteView = this.hasCompleteView(); if (queryId === 'default') { try { // When you do ref.off(...), we search all views for the registration to remove. for (var _b = tslib.__values(this.views.entries()), _c = _b.next(); !_c.done; _c = _b.next()) { var _d = tslib.__read(_c.value, 2), viewQueryId = _d[0], view = _d[1]; cancelEvents = cancelEvents.concat(view.removeEventRegistration(eventRegistration, cancelError)); if (view.isEmpty()) { this.views.delete(viewQueryId); // We'll deal with complete views later. if (!view.getQuery().getQueryParams().loadsAllData()) { removed.push(view.getQuery()); } } } } catch (e_2_1) { e_2 = { error: e_2_1 }; } finally { try { if (_c && !_c.done && (_a = _b.return)) _a.call(_b); } finally { if (e_2) throw e_2.error; } } } else { // remove the callback from the specific view. var view = this.views.get(queryId); if (view) { cancelEvents = cancelEvents.concat(view.removeEventRegistration(eventRegistration, cancelError)); if (view.isEmpty()) { this.views.delete(queryId); // We'll deal with complete views later. if (!view.getQuery().getQueryParams().loadsAllData()) { removed.push(view.getQuery()); } } } } if (hadCompleteView && !this.hasCompleteView()) { // We removed our last complete view. removed.push(new SyncPoint.__referenceConstructor(query.repo, query.path)); } return { removed: removed, events: cancelEvents }; }; SyncPoint.prototype.getQueryViews = function () { var e_3, _a; var result = []; try { for (var _b = tslib.__values(this.views.values()), _c = _b.next(); !_c.done; _c = _b.next()) { var view = _c.value; if (!view.getQuery().getQueryParams().loadsAllData()) { result.push(view); } } } catch (e_3_1) { e_3 = { error: e_3_1 }; } finally { try { if (_c && !_c.done && (_a = _b.return)) _a.call(_b); } finally { if (e_3) throw e_3.error; } } return result; }; /** * @param path The path to the desired complete snapshot * @return A complete cache, if it exists */ SyncPoint.prototype.getCompleteServerCache = function (path) { var e_4, _a; var serverCache = null; try { for (var _b = tslib.__values(this.views.values()), _c = _b.next(); !_c.done; _c = _b.next()) { var view = _c.value; serverCache = serverCache || view.getCompleteServerCache(path); } } catch (e_4_1) { e_4 = { error: e_4_1 }; } finally { try { if (_c && !_c.done && (_a = _b.return)) _a.call(_b); } finally { if (e_4) throw e_4.error; } } return serverCache; }; SyncPoint.prototype.viewForQuery = function (query) { var params = query.getQueryParams(); if (params.loadsAllData()) { return this.getCompleteView(); } else { var queryId = query.queryIdentifier(); return this.views.get(queryId); } }; SyncPoint.prototype.viewExistsForQuery = function (query) { return this.viewForQuery(query) != null; }; SyncPoint.prototype.hasCompleteView = function () { return this.getCompleteView() != null; }; SyncPoint.prototype.getCompleteView = function () { var e_5, _a; try { for (var _b = tslib.__values(this.views.values()), _c = _b.next(); !_c.done; _c = _b.next()) { var view = _c.value; if (view.getQuery().getQueryParams().loadsAllData()) { return view; } } } catch (e_5_1) { e_5 = { error: e_5_1 }; } finally { try { if (_c && !_c.done && (_a = _b.return)) _a.call(_b); } finally { if (e_5) throw e_5.error; } } return null; }; return SyncPoint; }()); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * This class holds a collection of writes that can be applied to nodes in unison. It abstracts away the logic with * dealing with priority writes and multiple nested writes. At any given path there is only allowed to be one write * modifying that path. Any write to an existing path or shadowing an existing path will modify that existing write * to reflect the write added. */ var CompoundWrite = /** @class */ (function () { function CompoundWrite(writeTree_) { this.writeTree_ = writeTree_; } CompoundWrite.prototype.addWrite = function (path, node) { if (path.isEmpty()) { return new CompoundWrite(new ImmutableTree(node)); } else { var rootmost = this.writeTree_.findRootMostValueAndPath(path); if (rootmost != null) { var rootMostPath = rootmost.path; var value = rootmost.value; var relativePath = Path.relativePath(rootMostPath, path); value = value.updateChild(relativePath, node); return new CompoundWrite(this.writeTree_.set(rootMostPath, value)); } else { var subtree = new ImmutableTree(node); var newWriteTree = this.writeTree_.setTree(path, subtree); return new CompoundWrite(newWriteTree); } } }; CompoundWrite.prototype.addWrites = function (path, updates) { var newWrite = this; each(updates, function (childKey, node) { newWrite = newWrite.addWrite(path.child(childKey), node); }); return newWrite; }; /** * Will remove a write at the given path and deeper paths. This will <em>not</em> modify a write at a higher * location, which must be removed by calling this method with that path. * * @param path The path at which a write and all deeper writes should be removed * @return {!CompoundWrite} The new CompoundWrite with the removed path */ CompoundWrite.prototype.removeWrite = function (path) { if (path.isEmpty()) { return CompoundWrite.Empty; } else { var newWriteTree = this.writeTree_.setTree(path, ImmutableTree.Empty); return new CompoundWrite(newWriteTree); } }; /** * Returns whether this CompoundWrite will fully overwrite a node at a given location and can therefore be * considered "complete". * * @param path The path to check for * @return Whether there is a complete write at that path */ CompoundWrite.prototype.hasCompleteWrite = function (path) { return this.getCompleteNode(path) != null; }; /** * Returns a node for a path if and only if the node is a "complete" overwrite at that path. This will not aggregate * writes from deeper paths, but will return child nodes from a more shallow path. * * @param path The path to get a complete write * @return The node if complete at that path, or null otherwise. */ CompoundWrite.prototype.getCompleteNode = function (path) { var rootmost = this.writeTree_.findRootMostValueAndPath(path); if (rootmost != null) { return this.writeTree_ .get(rootmost.path) .getChild(Path.relativePath(rootmost.path, path)); } else { return null; } }; /** * Returns all children that are guaranteed to be a complete overwrite. * * @return A list of all complete children. */ CompoundWrite.prototype.getCompleteChildren = function () { var children = []; var node = this.writeTree_.value; if (node != null) { // If it's a leaf node, it has no children; so nothing to do. if (!node.isLeafNode()) { node.forEachChild(PRIORITY_INDEX, function (childName, childNode) { children.push(new NamedNode(childName, childNode)); }); } } else { this.writeTree_.children.inorderTraversal(function (childName, childTree) { if (childTree.value != null) { children.push(new NamedNode(childName, childTree.value)); } }); } return children; }; CompoundWrite.prototype.childCompoundWrite = function (path) { if (path.isEmpty()) { return this; } else { var shadowingNode = this.getCompleteNode(path); if (shadowingNode != null) { return new CompoundWrite(new ImmutableTree(shadowingNode)); } else { return new CompoundWrite(this.writeTree_.subtree(path)); } } }; /** * Returns true if this CompoundWrite is empty and therefore does not modify any nodes. * @return Whether this CompoundWrite is empty */ CompoundWrite.prototype.isEmpty = function () { return this.writeTree_.isEmpty(); }; /** * Applies this CompoundWrite to a node. The node is returned with all writes from this CompoundWrite applied to the * node * @param node The node to apply this CompoundWrite to * @return The node with all writes applied */ CompoundWrite.prototype.apply = function (node) { return applySubtreeWrite(Path.Empty, this.writeTree_, node); }; CompoundWrite.Empty = new CompoundWrite(new ImmutableTree(null)); return CompoundWrite; }()); function applySubtreeWrite(relativePath, writeTree, node) { if (writeTree.value != null) { // Since there a write is always a leaf, we're done here return node.updateChild(relativePath, writeTree.value); } else { var priorityWrite_1 = null; writeTree.children.inorderTraversal(function (childKey, childTree) { if (childKey === '.priority') { // Apply priorities at the end so we don't update priorities for either empty nodes or forget // to apply priorities to empty nodes that are later filled util.assert(childTree.value !== null, 'Priority writes must always be leaf nodes'); priorityWrite_1 = childTree.value; } else { node = applySubtreeWrite(relativePath.child(childKey), childTree, node); } }); // If there was a priority write, we only apply it if the node is not empty if (!node.getChild(relativePath).isEmpty() && priorityWrite_1 !== null) { node = node.updateChild(relativePath.child('.priority'), priorityWrite_1); } return node; } } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * WriteTree tracks all pending user-initiated writes and has methods to calculate the result of merging them * with underlying server data (to create "event cache" data). Pending writes are added with addOverwrite() * and addMerge(), and removed with removeWrite(). * * @constructor */ var WriteTree = /** @class */ (function () { function WriteTree() { /** * A tree tracking the result of applying all visible writes. This does not include transactions with * applyLocally=false or writes that are completely shadowed by other writes. * * @type {!CompoundWrite} * @private */ this.visibleWrites_ = CompoundWrite.Empty; /** * A list of all pending writes, regardless of visibility and shadowed-ness. Used to calculate arbitrary * sets of the changed data, such as hidden writes (from transactions) or changes with certain writes excluded (also * used by transactions). * * @type {!Array.<!WriteRecord>} * @private */ this.allWrites_ = []; this.lastWriteId_ = -1; } /** * Create a new WriteTreeRef for the given path. For use with a new sync point at the given path. * * @param {!Path} path * @return {!WriteTreeRef} */ WriteTree.prototype.childWrites = function (path) { return new WriteTreeRef(path, this); }; /** * Record a new overwrite from user code. * * @param {!Path} path * @param {!Node} snap * @param {!number} writeId * @param {boolean=} visible This is set to false by some transactions. It should be excluded from event caches */ WriteTree.prototype.addOverwrite = function (path, snap, writeId, visible) { util.assert(writeId > this.lastWriteId_, 'Stacking an older write on top of newer ones'); if (visible === undefined) { visible = true; } this.allWrites_.push({ path: path, snap: snap, writeId: writeId, visible: visible }); if (visible) { this.visibleWrites_ = this.visibleWrites_.addWrite(path, snap); } this.lastWriteId_ = writeId; }; /** * Record a new merge from user code. * * @param {!Path} path * @param {!Object.<string, !Node>} changedChildren * @param {!number} writeId */ WriteTree.prototype.addMerge = function (path, changedChildren, writeId) { util.assert(writeId > this.lastWriteId_, 'Stacking an older merge on top of newer ones'); this.allWrites_.push({ path: path, children: changedChildren, writeId: writeId, visible: true }); this.visibleWrites_ = this.visibleWrites_.addWrites(path, changedChildren); this.lastWriteId_ = writeId; }; /** * @param {!number} writeId * @return {?WriteRecord} */ WriteTree.prototype.getWrite = function (writeId) { for (var i = 0; i < this.allWrites_.length; i++) { var record = this.allWrites_[i]; if (record.writeId === writeId) { return record; } } return null; }; /** * Remove a write (either an overwrite or merge) that has been successfully acknowledge by the server. Recalculates * the tree if necessary. We return true if it may have been visible, meaning views need to reevaluate. * * @param {!number} writeId * @return {boolean} true if the write may have been visible (meaning we'll need to reevaluate / raise * events as a result). */ WriteTree.prototype.removeWrite = function (writeId) { // Note: disabling this check. It could be a transaction that preempted another transaction, and thus was applied // out of order. //const validClear = revert || this.allWrites_.length === 0 || writeId <= this.allWrites_[0].writeId; //assert(validClear, "Either we don't have this write, or it's the first one in the queue"); var _this = this; var idx = this.allWrites_.findIndex(function (s) { return s.writeId === writeId; }); util.assert(idx >= 0, 'removeWrite called with nonexistent writeId.'); var writeToRemove = this.allWrites_[idx]; this.allWrites_.splice(idx, 1); var removedWriteWasVisible = writeToRemove.visible; var removedWriteOverlapsWithOtherWrites = false; var i = this.allWrites_.length - 1; while (removedWriteWasVisible && i >= 0) { var currentWrite = this.allWrites_[i]; if (currentWrite.visible) { if (i >= idx && this.recordContainsPath_(currentWrite, writeToRemove.path)) { // The removed write was completely shadowed by a subsequent write. removedWriteWasVisible = false; } else if (writeToRemove.path.contains(currentWrite.path)) { // Either we're covering some writes or they're covering part of us (depending on which came first). removedWriteOverlapsWithOtherWrites = true; } } i--; } if (!removedWriteWasVisible) { return false; } else if (removedWriteOverlapsWithOtherWrites) { // There's some shadowing going on. Just rebuild the visible writes from scratch. this.resetTree_(); return true; } else { // There's no shadowing. We can safely just remove the write(s) from visibleWrites. if (writeToRemove.snap) { this.visibleWrites_ = this.visibleWrites_.removeWrite(writeToRemove.path); } else { var children = writeToRemove.children; each(children, function (childName) { _this.visibleWrites_ = _this.visibleWrites_.removeWrite(writeToRemove.path.child(childName)); }); } return true; } }; /** * Return a complete snapshot for the given path if there's visible write data at that path, else null. * No server data is considered. * * @param {!Path} path * @return {?Node} */ WriteTree.prototype.getCompleteWriteData = function (path) { return this.visibleWrites_.getCompleteNode(path); }; /** * Given optional, underlying server data, and an optional set of constraints (exclude some sets, include hidden * writes), attempt to calculate a complete snapshot for the given path * * @param {!Path} treePath * @param {?Node} completeServerCache * @param {Array.<number>=} writeIdsToExclude An optional set to be excluded * @param {boolean=} includeHiddenWrites Defaults to false, whether or not to layer on writes with visible set to false * @return {?Node} */ WriteTree.prototype.calcCompleteEventCache = function (treePath, completeServerCache, writeIdsToExclude, includeHiddenWrites) { if (!writeIdsToExclude && !includeHiddenWrites) { var shadowingNode = this.visibleWrites_.getCompleteNode(treePath); if (shadowingNode != null) { return shadowingNode; } else { var subMerge = this.visibleWrites_.childCompoundWrite(treePath); if (subMerge.isEmpty()) { return completeServerCache; } else if (completeServerCache == null && !subMerge.hasCompleteWrite(Path.Empty)) { // We wouldn't have a complete snapshot, since there's no underlying data and no complete shadow return null; } else { var layeredCache = completeServerCache || ChildrenNode.EMPTY_NODE; return subMerge.apply(layeredCache); } } } else { var merge = this.visibleWrites_.childCompoundWrite(treePath); if (!includeHiddenWrites && merge.isEmpty()) { return completeServerCache; } else { // If the server cache is null, and we don't have a complete cache, we need to return null if (!includeHiddenWrites && completeServerCache == null && !merge.hasCompleteWrite(Path.Empty)) { return null; } else { var filter = function (write) { return ((write.visible || includeHiddenWrites) && (!writeIdsToExclude || !~writeIdsToExclude.indexOf(write.writeId)) && (write.path.contains(treePath) || treePath.contains(write.path))); }; var mergeAtPath = WriteTree.layerTree_(this.allWrites_, filter, treePath); var layeredCache = completeServerCache || ChildrenNode.EMPTY_NODE; return mergeAtPath.apply(layeredCache); } } } }; /** * With optional, underlying server data, attempt to return a children node of children that we have complete data for. * Used when creating new views, to pre-fill their complete event children snapshot. * * @param {!Path} treePath * @param {?ChildrenNode} completeServerChildren * @return {!ChildrenNode} */ WriteTree.prototype.calcCompleteEventChildren = function (treePath, completeServerChildren) { var completeChildren = ChildrenNode.EMPTY_NODE; var topLevelSet = this.visibleWrites_.getCompleteNode(treePath); if (topLevelSet) { if (!topLevelSet.isLeafNode()) { // we're shadowing everything. Return the children. topLevelSet.forEachChild(PRIORITY_INDEX, function (childName, childSnap) { completeChildren = completeChildren.updateImmediateChild(childName, childSnap); }); } return completeChildren; } else if (completeServerChildren) { // Layer any children we have on top of this // We know we don't have a top-level set, so just enumerate existing children var merge_1 = this.visibleWrites_.childCompoundWrite(treePath); completeServerChildren.forEachChild(PRIORITY_INDEX, function (childName, childNode) { var node = merge_1 .childCompoundWrite(new Path(childName)) .apply(childNode); completeChildren = completeChildren.updateImmediateChild(childName, node); }); // Add any complete children we have from the set merge_1.getCompleteChildren().forEach(function (namedNode) { completeChildren = completeChildren.updateImmediateChild(namedNode.name, namedNode.node); }); return completeChildren; } else { // We don't have anything to layer on top of. Layer on any children we have // Note that we can return an empty snap if we have a defined delete var merge = this.visibleWrites_.childCompoundWrite(treePath); merge.getCompleteChildren().forEach(function (namedNode) { completeChildren = completeChildren.updateImmediateChild(namedNode.name, namedNode.node); }); return completeChildren; } }; /** * Given that the underlying server data has updated, determine what, if anything, needs to be * applied to the event cache. * * Possibilities: * * 1. No writes are shadowing. Events should be raised, the snap to be applied comes from the server data * * 2. Some write is completely shadowing. No events to be raised * * 3. Is partially shadowed. Events * * Either existingEventSnap or existingServerSnap must exist * * @param {!Path} treePath * @param {!Path} childPath * @param {?Node} existingEventSnap * @param {?Node} existingServerSnap * @return {?Node} */ WriteTree.prototype.calcEventCacheAfterServerOverwrite = function (treePath, childPath, existingEventSnap, existingServerSnap) { util.assert(existingEventSnap || existingServerSnap, 'Either existingEventSnap or existingServerSnap must exist'); var path = treePath.child(childPath); if (this.visibleWrites_.hasCompleteWrite(path)) { // At this point we can probably guarantee that we're in case 2, meaning no events // May need to check visibility while doing the findRootMostValueAndPath call return null; } else { // No complete shadowing. We're either partially shadowing or not shadowing at all. var childMerge = this.visibleWrites_.childCompoundWrite(path); if (childMerge.isEmpty()) { // We're not shadowing at all. Case 1 return existingServerSnap.getChild(childPath); } else { // This could be more efficient if the serverNode + updates doesn't change the eventSnap // However this is tricky to find out, since user updates don't necessary change the server // snap, e.g. priority updates on empty nodes, or deep deletes. Another special case is if the server // adds nodes, but doesn't change any existing writes. It is therefore not enough to // only check if the updates change the serverNode. // Maybe check if the merge tree contains these special cases and only do a full overwrite in that case? return childMerge.apply(existingServerSnap.getChild(childPath)); } } }; /** * Returns a complete child for a given server snap after applying all user writes or null if there is no * complete child for this ChildKey. * * @param {!Path} treePath * @param {!string} childKey * @param {!CacheNode} existingServerSnap * @return {?Node} */ WriteTree.prototype.calcCompleteChild = function (treePath, childKey, existingServerSnap) { var path = treePath.child(childKey); var shadowingNode = this.visibleWrites_.getCompleteNode(path); if (shadowingNode != null) { return shadowingNode; } else { if (existingServerSnap.isCompleteForChild(childKey)) { var childMerge = this.visibleWrites_.childCompoundWrite(path); return childMerge.apply(existingServerSnap.getNode().getImmediateChild(childKey)); } else { return null; } } }; /** * Returns a node if there is a complete overwrite for this path. More specifically, if there is a write at * a higher path, this will return the child of that write relative to the write and this path. * Returns null if there is no write at this path. */ WriteTree.prototype.shadowingWrite = function (path) { return this.visibleWrites_.getCompleteNode(path); }; /** * This method is used when processing child remove events on a query. If we can, we pull in children that were outside * the window, but may now be in the window. */ WriteTree.prototype.calcIndexedSlice = function (treePath, completeServerData, startPost, count, reverse, index) { var toIterate; var merge = this.visibleWrites_.childCompoundWrite(treePath); var shadowingNode = merge.getCompleteNode(Path.Empty); if (shadowingNode != null) { toIterate = shadowingNode; } else if (completeServerData != null) { toIterate = merge.apply(completeServerData); } else { // no children to iterate on return []; } toIterate = toIterate.withIndex(index); if (!toIterate.isEmpty() && !toIterate.isLeafNode()) { var nodes = []; var cmp = index.getCompare(); var iter = reverse ? toIterate.getReverseIteratorFrom(startPost, index) : toIterate.getIteratorFrom(startPost, index); var next = iter.getNext(); while (next && nodes.length < count) { if (cmp(next, startPost) !== 0) { nodes.push(next); } next = iter.getNext(); } return nodes; } else { return []; } }; WriteTree.prototype.recordContainsPath_ = function (writeRecord, path) { if (writeRecord.snap) { return writeRecord.path.contains(path); } else { for (var childName in writeRecord.children) { if (writeRecord.children.hasOwnProperty(childName) && writeRecord.path.child(childName).contains(path)) { return true; } } return false; } }; /** * Re-layer the writes and merges into a tree so we can efficiently calculate event snapshots */ WriteTree.prototype.resetTree_ = function () { this.visibleWrites_ = WriteTree.layerTree_(this.allWrites_, WriteTree.DefaultFilter_, Path.Empty); if (this.allWrites_.length > 0) { this.lastWriteId_ = this.allWrites_[this.allWrites_.length - 1].writeId; } else { this.lastWriteId_ = -1; } }; /** * The default filter used when constructing the tree. Keep everything that's visible. */ WriteTree.DefaultFilter_ = function (write) { return write.visible; }; /** * Static method. Given an array of WriteRecords, a filter for which ones to include, and a path, construct the tree of * event data at that path. */ WriteTree.layerTree_ = function (writes, filter, treeRoot) { var compoundWrite = CompoundWrite.Empty; for (var i = 0; i < writes.length; ++i) { var write = writes[i]; // Theory, a later set will either: // a) abort a relevant transaction, so no need to worry about excluding it from calculating that transaction // b) not be relevant to a transaction (separate branch), so again will not affect the data for that transaction if (filter(write)) { var writePath = write.path; var relativePath = void 0; if (write.snap) { if (treeRoot.contains(writePath)) { relativePath = Path.relativePath(treeRoot, writePath); compoundWrite = compoundWrite.addWrite(relativePath, write.snap); } else if (writePath.contains(treeRoot)) { relativePath = Path.relativePath(writePath, treeRoot); compoundWrite = compoundWrite.addWrite(Path.Empty, write.snap.getChild(relativePath)); } else ; } else if (write.children) { if (treeRoot.contains(writePath)) { relativePath = Path.relativePath(treeRoot, writePath); compoundWrite = compoundWrite.addWrites(relativePath, write.children); } else if (writePath.contains(treeRoot)) { relativePath = Path.relativePath(writePath, treeRoot); if (relativePath.isEmpty()) { compoundWrite = compoundWrite.addWrites(Path.Empty, write.children); } else { var child = util.safeGet(write.children, relativePath.getFront()); if (child) { // There exists a child in this node that matches the root path var deepNode = child.getChild(relativePath.popFront()); compoundWrite = compoundWrite.addWrite(Path.Empty, deepNode); } } } else ; } else { throw util.assertionError('WriteRecord should have .snap or .children'); } } } return compoundWrite; }; return WriteTree; }()); /** * A WriteTreeRef wraps a WriteTree and a path, for convenient access to a particular subtree. All of the methods * just proxy to the underlying WriteTree. * * @constructor */ var WriteTreeRef = /** @class */ (function () { /** * @param {!Path} path * @param {!WriteTree} writeTree */ function WriteTreeRef(path, writeTree) { this.treePath_ = path; this.writeTree_ = writeTree; } /** * If possible, returns a complete event cache, using the underlying server data if possible. In addition, can be used * to get a cache that includes hidden writes, and excludes arbitrary writes. Note that customizing the returned node * can lead to a more expensive calculation. * * @param {?Node} completeServerCache * @param {Array.<number>=} writeIdsToExclude Optional writes to exclude. * @param {boolean=} includeHiddenWrites Defaults to false, whether or not to layer on writes with visible set to false * @return {?Node} */ WriteTreeRef.prototype.calcCompleteEventCache = function (completeServerCache, writeIdsToExclude, includeHiddenWrites) { return this.writeTree_.calcCompleteEventCache(this.treePath_, completeServerCache, writeIdsToExclude, includeHiddenWrites); }; /** * If possible, returns a children node containing all of the complete children we have data for. The returned data is a * mix of the given server data and write data. * * @param {?ChildrenNode} completeServerChildren * @return {!ChildrenNode} */ WriteTreeRef.prototype.calcCompleteEventChildren = function (completeServerChildren) { return this.writeTree_.calcCompleteEventChildren(this.treePath_, completeServerChildren); }; /** * Given that either the underlying server data has updated or the outstanding writes have updated, determine what, * if anything, needs to be applied to the event cache. * * Possibilities: * * 1. No writes are shadowing. Events should be raised, the snap to be applied comes from the server data * * 2. Some write is completely shadowing. No events to be raised * * 3. Is partially shadowed. Events should be raised * * Either existingEventSnap or existingServerSnap must exist, this is validated via an assert * * @param {!Path} path * @param {?Node} existingEventSnap * @param {?Node} existingServerSnap * @return {?Node} */ WriteTreeRef.prototype.calcEventCacheAfterServerOverwrite = function (path, existingEventSnap, existingServerSnap) { return this.writeTree_.calcEventCacheAfterServerOverwrite(this.treePath_, path, existingEventSnap, existingServerSnap); }; /** * Returns a node if there is a complete overwrite for this path. More specifically, if there is a write at * a higher path, this will return the child of that write relative to the write and this path. * Returns null if there is no write at this path. * * @param {!Path} path * @return {?Node} */ WriteTreeRef.prototype.shadowingWrite = function (path) { return this.writeTree_.shadowingWrite(this.treePath_.child(path)); }; /** * This method is used when processing child remove events on a query. If we can, we pull in children that were outside * the window, but may now be in the window * * @param {?Node} completeServerData * @param {!NamedNode} startPost * @param {!number} count * @param {boolean} reverse * @param {!Index} index * @return {!Array.<!NamedNode>} */ WriteTreeRef.prototype.calcIndexedSlice = function (completeServerData, startPost, count, reverse, index) { return this.writeTree_.calcIndexedSlice(this.treePath_, completeServerData, startPost, count, reverse, index); }; /** * Returns a complete child for a given server snap after applying all user writes or null if there is no * complete child for this ChildKey. * * @param {!string} childKey * @param {!CacheNode} existingServerCache * @return {?Node} */ WriteTreeRef.prototype.calcCompleteChild = function (childKey, existingServerCache) { return this.writeTree_.calcCompleteChild(this.treePath_, childKey, existingServerCache); }; /** * Return a WriteTreeRef for a child. * * @param {string} childName * @return {!WriteTreeRef} */ WriteTreeRef.prototype.child = function (childName) { return new WriteTreeRef(this.treePath_.child(childName), this.writeTree_); }; return WriteTreeRef; }()); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * SyncTree is the central class for managing event callback registration, data caching, views * (query processing), and event generation. There are typically two SyncTree instances for * each Repo, one for the normal Firebase data, and one for the .info data. * * It has a number of responsibilities, including: * - Tracking all user event callbacks (registered via addEventRegistration() and removeEventRegistration()). * - Applying and caching data changes for user set(), transaction(), and update() calls * (applyUserOverwrite(), applyUserMerge()). * - Applying and caching data changes for server data changes (applyServerOverwrite(), * applyServerMerge()). * - Generating user-facing events for server and user changes (all of the apply* methods * return the set of events that need to be raised as a result). * - Maintaining the appropriate set of server listens to ensure we are always subscribed * to the correct set of paths and queries to satisfy the current set of user event * callbacks (listens are started/stopped using the provided listenProvider). * * NOTE: Although SyncTree tracks event callbacks and calculates events to raise, the actual * events are returned to the caller rather than raised synchronously. * * @constructor */ var SyncTree = /** @class */ (function () { /** * @param {!ListenProvider} listenProvider_ Used by SyncTree to start / stop listening * to server data. */ function SyncTree(listenProvider_) { this.listenProvider_ = listenProvider_; /** * Tree of SyncPoints. There's a SyncPoint at any location that has 1 or more views. */ this.syncPointTree_ = ImmutableTree.Empty; /** * A tree of all pending user writes (user-initiated set()'s, transaction()'s, update()'s, etc.). */ this.pendingWriteTree_ = new WriteTree(); this.tagToQueryMap = new Map(); this.queryToTagMap = new Map(); } /** * Apply the data changes for a user-generated set() or transaction() call. * * @return Events to raise. */ SyncTree.prototype.applyUserOverwrite = function (path, newData, writeId, visible) { // Record pending write. this.pendingWriteTree_.addOverwrite(path, newData, writeId, visible); if (!visible) { return []; } else { return this.applyOperationToSyncPoints_(new Overwrite(OperationSource.User, path, newData)); } }; /** * Apply the data from a user-generated update() call * * @return Events to raise. */ SyncTree.prototype.applyUserMerge = function (path, changedChildren, writeId) { // Record pending merge. this.pendingWriteTree_.addMerge(path, changedChildren, writeId); var changeTree = ImmutableTree.fromObject(changedChildren); return this.applyOperationToSyncPoints_(new Merge(OperationSource.User, path, changeTree)); }; /** * Acknowledge a pending user write that was previously registered with applyUserOverwrite() or applyUserMerge(). * * @param revert True if the given write failed and needs to be reverted * @return Events to raise. */ SyncTree.prototype.ackUserWrite = function (writeId, revert) { if (revert === void 0) { revert = false; } var write = this.pendingWriteTree_.getWrite(writeId); var needToReevaluate = this.pendingWriteTree_.removeWrite(writeId); if (!needToReevaluate) { return []; } else { var affectedTree_1 = ImmutableTree.Empty; if (write.snap != null) { // overwrite affectedTree_1 = affectedTree_1.set(Path.Empty, true); } else { each(write.children, function (pathString, node) { affectedTree_1 = affectedTree_1.set(new Path(pathString), node); }); } return this.applyOperationToSyncPoints_(new AckUserWrite(write.path, affectedTree_1, revert)); } }; /** * Apply new server data for the specified path.. * * @return Events to raise. */ SyncTree.prototype.applyServerOverwrite = function (path, newData) { return this.applyOperationToSyncPoints_(new Overwrite(OperationSource.Server, path, newData)); }; /** * Apply new server data to be merged in at the specified path. * * @return Events to raise. */ SyncTree.prototype.applyServerMerge = function (path, changedChildren) { var changeTree = ImmutableTree.fromObject(changedChildren); return this.applyOperationToSyncPoints_(new Merge(OperationSource.Server, path, changeTree)); }; /** * Apply a listen complete for a query * * @return Events to raise. */ SyncTree.prototype.applyListenComplete = function (path) { return this.applyOperationToSyncPoints_(new ListenComplete(OperationSource.Server, path)); }; /** * Apply new server data for the specified tagged query. * * @return Events to raise. */ SyncTree.prototype.applyTaggedQueryOverwrite = function (path, snap, tag) { var queryKey = this.queryKeyForTag_(tag); if (queryKey != null) { var r = SyncTree.parseQueryKey_(queryKey); var queryPath = r.path, queryId = r.queryId; var relativePath = Path.relativePath(queryPath, path); var op = new Overwrite(OperationSource.forServerTaggedQuery(queryId), relativePath, snap); return this.applyTaggedOperation_(queryPath, op); } else { // Query must have been removed already return []; } }; /** * Apply server data to be merged in for the specified tagged query. * * @return Events to raise. */ SyncTree.prototype.applyTaggedQueryMerge = function (path, changedChildren, tag) { var queryKey = this.queryKeyForTag_(tag); if (queryKey) { var r = SyncTree.parseQueryKey_(queryKey); var queryPath = r.path, queryId = r.queryId; var relativePath = Path.relativePath(queryPath, path); var changeTree = ImmutableTree.fromObject(changedChildren); var op = new Merge(OperationSource.forServerTaggedQuery(queryId), relativePath, changeTree); return this.applyTaggedOperation_(queryPath, op); } else { // We've already removed the query. No big deal, ignore the update return []; } }; /** * Apply a listen complete for a tagged query * * @return Events to raise. */ SyncTree.prototype.applyTaggedListenComplete = function (path, tag) { var queryKey = this.queryKeyForTag_(tag); if (queryKey) { var r = SyncTree.parseQueryKey_(queryKey); var queryPath = r.path, queryId = r.queryId; var relativePath = Path.relativePath(queryPath, path); var op = new ListenComplete(OperationSource.forServerTaggedQuery(queryId), relativePath); return this.applyTaggedOperation_(queryPath, op); } else { // We've already removed the query. No big deal, ignore the update return []; } }; /** * Add an event callback for the specified query. * * @return Events to raise. */ SyncTree.prototype.addEventRegistration = function (query, eventRegistration) { var path = query.path; var serverCache = null; var foundAncestorDefaultView = false; // Any covering writes will necessarily be at the root, so really all we need to find is the server cache. // Consider optimizing this once there's a better understanding of what actual behavior will be. this.syncPointTree_.foreachOnPath(path, function (pathToSyncPoint, sp) { var relativePath = Path.relativePath(pathToSyncPoint, path); serverCache = serverCache || sp.getCompleteServerCache(relativePath); foundAncestorDefaultView = foundAncestorDefaultView || sp.hasCompleteView(); }); var syncPoint = this.syncPointTree_.get(path); if (!syncPoint) { syncPoint = new SyncPoint(); this.syncPointTree_ = this.syncPointTree_.set(path, syncPoint); } else { foundAncestorDefaultView = foundAncestorDefaultView || syncPoint.hasCompleteView(); serverCache = serverCache || syncPoint.getCompleteServerCache(Path.Empty); } var serverCacheComplete; if (serverCache != null) { serverCacheComplete = true; } else { serverCacheComplete = false; serverCache = ChildrenNode.EMPTY_NODE; var subtree = this.syncPointTree_.subtree(path); subtree.foreachChild(function (childName, childSyncPoint) { var completeCache = childSyncPoint.getCompleteServerCache(Path.Empty); if (completeCache) { serverCache = serverCache.updateImmediateChild(childName, completeCache); } }); } var viewAlreadyExists = syncPoint.viewExistsForQuery(query); if (!viewAlreadyExists && !query.getQueryParams().loadsAllData()) { // We need to track a tag for this query var queryKey = SyncTree.makeQueryKey_(query); util.assert(!this.queryToTagMap.has(queryKey), 'View does not exist, but we have a tag'); var tag = SyncTree.getNextQueryTag_(); this.queryToTagMap.set(queryKey, tag); this.tagToQueryMap.set(tag, queryKey); } var writesCache = this.pendingWriteTree_.childWrites(path); var events = syncPoint.addEventRegistration(query, eventRegistration, writesCache, serverCache, serverCacheComplete); if (!viewAlreadyExists && !foundAncestorDefaultView) { var view /** @type !View */ = syncPoint.viewForQuery(query); events = events.concat(this.setupListener_(query, view)); } return events; }; /** * Remove event callback(s). * * If query is the default query, we'll check all queries for the specified eventRegistration. * If eventRegistration is null, we'll remove all callbacks for the specified query/queries. * * @param eventRegistration If null, all callbacks are removed. * @param cancelError If a cancelError is provided, appropriate cancel events will be returned. * @return Cancel events, if cancelError was provided. */ SyncTree.prototype.removeEventRegistration = function (query, eventRegistration, cancelError) { var _this = this; // Find the syncPoint first. Then deal with whether or not it has matching listeners var path = query.path; var maybeSyncPoint = this.syncPointTree_.get(path); var cancelEvents = []; // A removal on a default query affects all queries at that location. A removal on an indexed query, even one without // other query constraints, does *not* affect all queries at that location. So this check must be for 'default', and // not loadsAllData(). if (maybeSyncPoint && (query.queryIdentifier() === 'default' || maybeSyncPoint.viewExistsForQuery(query))) { /** * @type {{removed: !Array.<!Query>, events: !Array.<!Event>}} */ var removedAndEvents = maybeSyncPoint.removeEventRegistration(query, eventRegistration, cancelError); if (maybeSyncPoint.isEmpty()) { this.syncPointTree_ = this.syncPointTree_.remove(path); } var removed = removedAndEvents.removed; cancelEvents = removedAndEvents.events; // We may have just removed one of many listeners and can short-circuit this whole process // We may also not have removed a default listener, in which case all of the descendant listeners should already be // properly set up. // // Since indexed queries can shadow if they don't have other query constraints, check for loadsAllData(), instead of // queryId === 'default' var removingDefault = -1 !== removed.findIndex(function (query) { return query.getQueryParams().loadsAllData(); }); var covered = this.syncPointTree_.findOnPath(path, function (relativePath, parentSyncPoint) { return parentSyncPoint.hasCompleteView(); }); if (removingDefault && !covered) { var subtree = this.syncPointTree_.subtree(path); // There are potentially child listeners. Determine what if any listens we need to send before executing the // removal if (!subtree.isEmpty()) { // We need to fold over our subtree and collect the listeners to send var newViews = this.collectDistinctViewsForSubTree_(subtree); // Ok, we've collected all the listens we need. Set them up. for (var i = 0; i < newViews.length; ++i) { var view = newViews[i], newQuery = view.getQuery(); var listener = this.createListenerForView_(view); this.listenProvider_.startListening(SyncTree.queryForListening_(newQuery), this.tagForQuery_(newQuery), listener.hashFn, listener.onComplete); } } } // If we removed anything and we're not covered by a higher up listen, we need to stop listening on this query // The above block has us covered in terms of making sure we're set up on listens lower in the tree. // Also, note that if we have a cancelError, it's already been removed at the provider level. if (!covered && removed.length > 0 && !cancelError) { // If we removed a default, then we weren't listening on any of the other queries here. Just cancel the one // default. Otherwise, we need to iterate through and cancel each individual query if (removingDefault) { // We don't tag default listeners var defaultTag = null; this.listenProvider_.stopListening(SyncTree.queryForListening_(query), defaultTag); } else { removed.forEach(function (queryToRemove) { var tagToRemove = _this.queryToTagMap.get(SyncTree.makeQueryKey_(queryToRemove)); _this.listenProvider_.stopListening(SyncTree.queryForListening_(queryToRemove), tagToRemove); }); } } // Now, clear all of the tags we're tracking for the removed listens this.removeTags_(removed); } return cancelEvents; }; /** * Returns a complete cache, if we have one, of the data at a particular path. If the location does not have a * listener above it, we will get a false "null". This shouldn't be a problem because transactions will always * have a listener above, and atomic operations would correctly show a jitter of <increment value> -> * <incremented total> as the write is applied locally and then acknowledged at the server. * * Note: this method will *include* hidden writes from transaction with applyLocally set to false. * * @param path The path to the data we want * @param writeIdsToExclude A specific set to be excluded */ SyncTree.prototype.calcCompleteEventCache = function (path, writeIdsToExclude) { var includeHiddenSets = true; var writeTree = this.pendingWriteTree_; var serverCache = this.syncPointTree_.findOnPath(path, function (pathSoFar, syncPoint) { var relativePath = Path.relativePath(pathSoFar, path); var serverCache = syncPoint.getCompleteServerCache(relativePath); if (serverCache) { return serverCache; } }); return writeTree.calcCompleteEventCache(path, serverCache, writeIdsToExclude, includeHiddenSets); }; /** * This collapses multiple unfiltered views into a single view, since we only need a single * listener for them. */ SyncTree.prototype.collectDistinctViewsForSubTree_ = function (subtree) { return subtree.fold(function (relativePath, maybeChildSyncPoint, childMap) { if (maybeChildSyncPoint && maybeChildSyncPoint.hasCompleteView()) { var completeView = maybeChildSyncPoint.getCompleteView(); return [completeView]; } else { // No complete view here, flatten any deeper listens into an array var views_1 = []; if (maybeChildSyncPoint) { views_1 = maybeChildSyncPoint.getQueryViews(); } each(childMap, function (_key, childViews) { views_1 = views_1.concat(childViews); }); return views_1; } }); }; SyncTree.prototype.removeTags_ = function (queries) { for (var j = 0; j < queries.length; ++j) { var removedQuery = queries[j]; if (!removedQuery.getQueryParams().loadsAllData()) { // We should have a tag for this var removedQueryKey = SyncTree.makeQueryKey_(removedQuery); var removedQueryTag = this.queryToTagMap.get(removedQueryKey); this.queryToTagMap.delete(removedQueryKey); this.tagToQueryMap.delete(removedQueryTag); } } }; /** * Normalizes a query to a query we send the server for listening * * @return The normalized query */ SyncTree.queryForListening_ = function (query) { if (query.getQueryParams().loadsAllData() && !query.getQueryParams().isDefault()) { // We treat queries that load all data as default queries // Cast is necessary because ref() technically returns Firebase which is actually fb.api.Firebase which inherits // from Query return query.getRef(); } else { return query; } }; /** * For a given new listen, manage the de-duplication of outstanding subscriptions. * * @return This method can return events to support synchronous data sources */ SyncTree.prototype.setupListener_ = function (query, view) { var path = query.path; var tag = this.tagForQuery_(query); var listener = this.createListenerForView_(view); var events = this.listenProvider_.startListening(SyncTree.queryForListening_(query), tag, listener.hashFn, listener.onComplete); var subtree = this.syncPointTree_.subtree(path); // The root of this subtree has our query. We're here because we definitely need to send a listen for that, but we // may need to shadow other listens as well. if (tag) { util.assert(!subtree.value.hasCompleteView(), "If we're adding a query, it shouldn't be shadowed"); } else { // Shadow everything at or below this location, this is a default listener. var queriesToStop = subtree.fold(function (relativePath, maybeChildSyncPoint, childMap) { if (!relativePath.isEmpty() && maybeChildSyncPoint && maybeChildSyncPoint.hasCompleteView()) { return [maybeChildSyncPoint.getCompleteView().getQuery()]; } else { // No default listener here, flatten any deeper queries into an array var queries_1 = []; if (maybeChildSyncPoint) { queries_1 = queries_1.concat(maybeChildSyncPoint.getQueryViews().map(function (view) { return view.getQuery(); })); } each(childMap, function (_key, childQueries) { queries_1 = queries_1.concat(childQueries); }); return queries_1; } }); for (var i = 0; i < queriesToStop.length; ++i) { var queryToStop = queriesToStop[i]; this.listenProvider_.stopListening(SyncTree.queryForListening_(queryToStop), this.tagForQuery_(queryToStop)); } } return events; }; SyncTree.prototype.createListenerForView_ = function (view) { var _this = this; var query = view.getQuery(); var tag = this.tagForQuery_(query); return { hashFn: function () { var cache = view.getServerCache() || ChildrenNode.EMPTY_NODE; return cache.hash(); }, onComplete: function (status) { if (status === 'ok') { if (tag) { return _this.applyTaggedListenComplete(query.path, tag); } else { return _this.applyListenComplete(query.path); } } else { // If a listen failed, kill all of the listeners here, not just the one that triggered the error. // Note that this may need to be scoped to just this listener if we change permissions on filtered children var error = errorForServerCode(status, query); return _this.removeEventRegistration(query, /*eventRegistration*/ null, error); } } }; }; /** * Given a query, computes a "queryKey" suitable for use in our queryToTagMap_. */ SyncTree.makeQueryKey_ = function (query) { return query.path.toString() + '$' + query.queryIdentifier(); }; /** * Given a queryKey (created by makeQueryKey), parse it back into a path and queryId. */ SyncTree.parseQueryKey_ = function (queryKey) { var splitIndex = queryKey.indexOf('$'); util.assert(splitIndex !== -1 && splitIndex < queryKey.length - 1, 'Bad queryKey.'); return { queryId: queryKey.substr(splitIndex + 1), path: new Path(queryKey.substr(0, splitIndex)) }; }; /** * Return the query associated with the given tag, if we have one */ SyncTree.prototype.queryKeyForTag_ = function (tag) { return this.tagToQueryMap.get(tag); }; /** * Return the tag associated with the given query. */ SyncTree.prototype.tagForQuery_ = function (query) { var queryKey = SyncTree.makeQueryKey_(query); return this.queryToTagMap.get(queryKey); }; /** * Static accessor for query tags. */ SyncTree.getNextQueryTag_ = function () { return SyncTree.nextQueryTag_++; }; /** * A helper method to apply tagged operations */ SyncTree.prototype.applyTaggedOperation_ = function (queryPath, operation) { var syncPoint = this.syncPointTree_.get(queryPath); util.assert(syncPoint, "Missing sync point for query tag that we're tracking"); var writesCache = this.pendingWriteTree_.childWrites(queryPath); return syncPoint.applyOperation(operation, writesCache, /*serverCache=*/ null); }; /** * A helper method that visits all descendant and ancestor SyncPoints, applying the operation. * * NOTES: * - Descendant SyncPoints will be visited first (since we raise events depth-first). * * - We call applyOperation() on each SyncPoint passing three things: * 1. A version of the Operation that has been made relative to the SyncPoint location. * 2. A WriteTreeRef of any writes we have cached at the SyncPoint location. * 3. A snapshot Node with cached server data, if we have it. * * - We concatenate all of the events returned by each SyncPoint and return the result. */ SyncTree.prototype.applyOperationToSyncPoints_ = function (operation) { return this.applyOperationHelper_(operation, this.syncPointTree_, /*serverCache=*/ null, this.pendingWriteTree_.childWrites(Path.Empty)); }; /** * Recursive helper for applyOperationToSyncPoints_ */ SyncTree.prototype.applyOperationHelper_ = function (operation, syncPointTree, serverCache, writesCache) { if (operation.path.isEmpty()) { return this.applyOperationDescendantsHelper_(operation, syncPointTree, serverCache, writesCache); } else { var syncPoint = syncPointTree.get(Path.Empty); // If we don't have cached server data, see if we can get it from this SyncPoint. if (serverCache == null && syncPoint != null) { serverCache = syncPoint.getCompleteServerCache(Path.Empty); } var events = []; var childName = operation.path.getFront(); var childOperation = operation.operationForChild(childName); var childTree = syncPointTree.children.get(childName); if (childTree && childOperation) { var childServerCache = serverCache ? serverCache.getImmediateChild(childName) : null; var childWritesCache = writesCache.child(childName); events = events.concat(this.applyOperationHelper_(childOperation, childTree, childServerCache, childWritesCache)); } if (syncPoint) { events = events.concat(syncPoint.applyOperation(operation, writesCache, serverCache)); } return events; } }; /** * Recursive helper for applyOperationToSyncPoints_ */ SyncTree.prototype.applyOperationDescendantsHelper_ = function (operation, syncPointTree, serverCache, writesCache) { var _this = this; var syncPoint = syncPointTree.get(Path.Empty); // If we don't have cached server data, see if we can get it from this SyncPoint. if (serverCache == null && syncPoint != null) { serverCache = syncPoint.getCompleteServerCache(Path.Empty); } var events = []; syncPointTree.children.inorderTraversal(function (childName, childTree) { var childServerCache = serverCache ? serverCache.getImmediateChild(childName) : null; var childWritesCache = writesCache.child(childName); var childOperation = operation.operationForChild(childName); if (childOperation) { events = events.concat(_this.applyOperationDescendantsHelper_(childOperation, childTree, childServerCache, childWritesCache)); } }); if (syncPoint) { events = events.concat(syncPoint.applyOperation(operation, writesCache, serverCache)); } return events; }; /** * Static tracker for next query tag. */ SyncTree.nextQueryTag_ = 1; return SyncTree; }()); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Mutable object which basically just stores a reference to the "latest" immutable snapshot. * * @constructor */ var SnapshotHolder = /** @class */ (function () { function SnapshotHolder() { this.rootNode_ = ChildrenNode.EMPTY_NODE; } SnapshotHolder.prototype.getNode = function (path) { return this.rootNode_.getChild(path); }; SnapshotHolder.prototype.updateSnapshot = function (path, newSnapshotNode) { this.rootNode_ = this.rootNode_.updateChild(path, newSnapshotNode); }; return SnapshotHolder; }()); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Tracks a collection of stats. * * @constructor */ var StatsCollection = /** @class */ (function () { function StatsCollection() { this.counters_ = {}; } StatsCollection.prototype.incrementCounter = function (name, amount) { if (amount === void 0) { amount = 1; } if (!util.contains(this.counters_, name)) { this.counters_[name] = 0; } this.counters_[name] += amount; }; StatsCollection.prototype.get = function () { return util.deepCopy(this.counters_); }; return StatsCollection; }()); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var StatsManager = /** @class */ (function () { function StatsManager() { } StatsManager.getCollection = function (repoInfo) { var hashString = repoInfo.toString(); if (!this.collections_[hashString]) { this.collections_[hashString] = new StatsCollection(); } return this.collections_[hashString]; }; StatsManager.getOrCreateReporter = function (repoInfo, creatorFunction) { var hashString = repoInfo.toString(); if (!this.reporters_[hashString]) { this.reporters_[hashString] = creatorFunction(); } return this.reporters_[hashString]; }; StatsManager.collections_ = {}; StatsManager.reporters_ = {}; return StatsManager; }()); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Returns the delta from the previous call to get stats. * * @param collection_ The collection to "listen" to. * @constructor */ var StatsListener = /** @class */ (function () { function StatsListener(collection_) { this.collection_ = collection_; this.last_ = null; } StatsListener.prototype.get = function () { var newStats = this.collection_.get(); var delta = tslib.__assign({}, newStats); if (this.last_) { each(this.last_, function (stat, value) { delta[stat] = delta[stat] - value; }); } this.last_ = newStats; return delta; }; return StatsListener; }()); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // Assuming some apps may have a short amount of time on page, and a bulk of firebase operations probably // happen on page load, we try to report our first set of stats pretty quickly, but we wait at least 10 // seconds to try to ensure the Firebase connection is established / settled. var FIRST_STATS_MIN_TIME = 10 * 1000; var FIRST_STATS_MAX_TIME = 30 * 1000; // We'll continue to report stats on average every 5 minutes. var REPORT_STATS_INTERVAL = 5 * 60 * 1000; /** * @constructor */ var StatsReporter = /** @class */ (function () { /** * @param collection * @param server_ */ function StatsReporter(collection, server_) { this.server_ = server_; this.statsToReport_ = {}; this.statsListener_ = new StatsListener(collection); var timeout = FIRST_STATS_MIN_TIME + (FIRST_STATS_MAX_TIME - FIRST_STATS_MIN_TIME) * Math.random(); setTimeoutNonBlocking(this.reportStats_.bind(this), Math.floor(timeout)); } StatsReporter.prototype.includeStat = function (stat) { this.statsToReport_[stat] = true; }; StatsReporter.prototype.reportStats_ = function () { var _this = this; var stats = this.statsListener_.get(); var reportedStats = {}; var haveStatsToReport = false; each(stats, function (stat, value) { if (value > 0 && util.contains(_this.statsToReport_, stat)) { reportedStats[stat] = value; haveStatsToReport = true; } }); if (haveStatsToReport) { this.server_.reportStats(reportedStats); } // queue our next run. setTimeoutNonBlocking(this.reportStats_.bind(this), Math.floor(Math.random() * 2 * REPORT_STATS_INTERVAL)); }; return StatsReporter; }()); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * The event queue serves a few purposes: * 1. It ensures we maintain event order in the face of event callbacks doing operations that result in more * events being queued. * 2. raiseQueuedEvents() handles being called reentrantly nicely. That is, if in the course of raising events, * raiseQueuedEvents() is called again, the "inner" call will pick up raising events where the "outer" call * left off, ensuring that the events are still raised synchronously and in order. * 3. You can use raiseEventsAtPath and raiseEventsForChangedPath to ensure only relevant previously-queued * events are raised synchronously. * * NOTE: This can all go away if/when we move to async events. * * @constructor */ var EventQueue = /** @class */ (function () { function EventQueue() { /** * @private * @type {!Array.<EventList>} */ this.eventLists_ = []; /** * Tracks recursion depth of raiseQueuedEvents_, for debugging purposes. * @private * @type {!number} */ this.recursionDepth_ = 0; } /** * @param {!Array.<Event>} eventDataList The new events to queue. */ EventQueue.prototype.queueEvents = function (eventDataList) { // We group events by path, storing them in a single EventList, to make it easier to skip over them quickly. var currList = null; for (var i = 0; i < eventDataList.length; i++) { var eventData = eventDataList[i]; var eventPath = eventData.getPath(); if (currList !== null && !eventPath.equals(currList.getPath())) { this.eventLists_.push(currList); currList = null; } if (currList === null) { currList = new EventList(eventPath); } currList.add(eventData); } if (currList) { this.eventLists_.push(currList); } }; /** * Queues the specified events and synchronously raises all events (including previously queued ones) * for the specified path. * * It is assumed that the new events are all for the specified path. * * @param {!Path} path The path to raise events for. * @param {!Array.<Event>} eventDataList The new events to raise. */ EventQueue.prototype.raiseEventsAtPath = function (path, eventDataList) { this.queueEvents(eventDataList); this.raiseQueuedEventsMatchingPredicate_(function (eventPath) { return eventPath.equals(path); }); }; /** * Queues the specified events and synchronously raises all events (including previously queued ones) for * locations related to the specified change path (i.e. all ancestors and descendants). * * It is assumed that the new events are all related (ancestor or descendant) to the specified path. * * @param {!Path} changedPath The path to raise events for. * @param {!Array.<!Event>} eventDataList The events to raise */ EventQueue.prototype.raiseEventsForChangedPath = function (changedPath, eventDataList) { this.queueEvents(eventDataList); this.raiseQueuedEventsMatchingPredicate_(function (eventPath) { return eventPath.contains(changedPath) || changedPath.contains(eventPath); }); }; /** * @param {!function(!Path):boolean} predicate * @private */ EventQueue.prototype.raiseQueuedEventsMatchingPredicate_ = function (predicate) { this.recursionDepth_++; var sentAll = true; for (var i = 0; i < this.eventLists_.length; i++) { var eventList = this.eventLists_[i]; if (eventList) { var eventPath = eventList.getPath(); if (predicate(eventPath)) { this.eventLists_[i].raise(); this.eventLists_[i] = null; } else { sentAll = false; } } } if (sentAll) { this.eventLists_ = []; } this.recursionDepth_--; }; return EventQueue; }()); /** * @param {!Path} path * @constructor */ var EventList = /** @class */ (function () { function EventList(path_) { this.path_ = path_; /** * @type {!Array.<Event>} * @private */ this.events_ = []; } /** * @param {!Event} eventData */ EventList.prototype.add = function (eventData) { this.events_.push(eventData); }; /** * Iterates through the list and raises each event */ EventList.prototype.raise = function () { for (var i = 0; i < this.events_.length; i++) { var eventData = this.events_[i]; if (eventData !== null) { this.events_[i] = null; var eventFn = eventData.getEventRunner(); if (logger) { log('event: ' + eventData.toString()); } exceptionGuard(eventFn); } } }; /** * @return {!Path} */ EventList.prototype.getPath = function () { return this.path_; }; return EventList; }()); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Base class to be used if you want to emit events. Call the constructor with * the set of allowed event names. */ var EventEmitter = /** @class */ (function () { /** * @param {!Array.<string>} allowedEvents_ */ function EventEmitter(allowedEvents_) { this.allowedEvents_ = allowedEvents_; this.listeners_ = {}; util.assert(Array.isArray(allowedEvents_) && allowedEvents_.length > 0, 'Requires a non-empty array'); } /** * To be called by derived classes to trigger events. * @param {!string} eventType * @param {...*} varArgs */ EventEmitter.prototype.trigger = function (eventType) { var varArgs = []; for (var _i = 1; _i < arguments.length; _i++) { varArgs[_i - 1] = arguments[_i]; } if (Array.isArray(this.listeners_[eventType])) { // Clone the list, since callbacks could add/remove listeners. var listeners = tslib.__spread(this.listeners_[eventType]); for (var i = 0; i < listeners.length; i++) { listeners[i].callback.apply(listeners[i].context, varArgs); } } }; EventEmitter.prototype.on = function (eventType, callback, context) { this.validateEventType_(eventType); this.listeners_[eventType] = this.listeners_[eventType] || []; this.listeners_[eventType].push({ callback: callback, context: context }); var eventData = this.getInitialEvent(eventType); if (eventData) { callback.apply(context, eventData); } }; EventEmitter.prototype.off = function (eventType, callback, context) { this.validateEventType_(eventType); var listeners = this.listeners_[eventType] || []; for (var i = 0; i < listeners.length; i++) { if (listeners[i].callback === callback && (!context || context === listeners[i].context)) { listeners.splice(i, 1); return; } } }; EventEmitter.prototype.validateEventType_ = function (eventType) { util.assert(this.allowedEvents_.find(function (et) { return et === eventType; }), 'Unknown event: ' + eventType); }; return EventEmitter; }()); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * @extends {EventEmitter} */ var VisibilityMonitor = /** @class */ (function (_super) { tslib.__extends(VisibilityMonitor, _super); function VisibilityMonitor() { var _this = _super.call(this, ['visible']) || this; var hidden; var visibilityChange; if (typeof document !== 'undefined' && typeof document.addEventListener !== 'undefined') { if (typeof document['hidden'] !== 'undefined') { // Opera 12.10 and Firefox 18 and later support visibilityChange = 'visibilitychange'; hidden = 'hidden'; } else if (typeof document['mozHidden'] !== 'undefined') { visibilityChange = 'mozvisibilitychange'; hidden = 'mozHidden'; } else if (typeof document['msHidden'] !== 'undefined') { visibilityChange = 'msvisibilitychange'; hidden = 'msHidden'; } else if (typeof document['webkitHidden'] !== 'undefined') { visibilityChange = 'webkitvisibilitychange'; hidden = 'webkitHidden'; } } // Initially, we always assume we are visible. This ensures that in browsers // without page visibility support or in cases where we are never visible // (e.g. chrome extension), we act as if we are visible, i.e. don't delay // reconnects _this.visible_ = true; if (visibilityChange) { document.addEventListener(visibilityChange, function () { var visible = !document[hidden]; if (visible !== _this.visible_) { _this.visible_ = visible; _this.trigger('visible', visible); } }, false); } return _this; } VisibilityMonitor.getInstance = function () { return new VisibilityMonitor(); }; /** * @param {!string} eventType * @return {Array.<boolean>} */ VisibilityMonitor.prototype.getInitialEvent = function (eventType) { util.assert(eventType === 'visible', 'Unknown event type: ' + eventType); return [this.visible_]; }; return VisibilityMonitor; }(EventEmitter)); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Monitors online state (as reported by window.online/offline events). * * The expectation is that this could have many false positives (thinks we are online * when we're not), but no false negatives. So we can safely use it to determine when * we definitely cannot reach the internet. * * @extends {EventEmitter} */ var OnlineMonitor = /** @class */ (function (_super) { tslib.__extends(OnlineMonitor, _super); function OnlineMonitor() { var _this = _super.call(this, ['online']) || this; _this.online_ = true; // We've had repeated complaints that Cordova apps can get stuck "offline", e.g. // https://forum.ionicframework.com/t/firebase-connection-is-lost-and-never-come-back/43810 // It would seem that the 'online' event does not always fire consistently. So we disable it // for Cordova. if (typeof window !== 'undefined' && typeof window.addEventListener !== 'undefined' && !util.isMobileCordova()) { window.addEventListener('online', function () { if (!_this.online_) { _this.online_ = true; _this.trigger('online', true); } }, false); window.addEventListener('offline', function () { if (_this.online_) { _this.online_ = false; _this.trigger('online', false); } }, false); } return _this; } OnlineMonitor.getInstance = function () { return new OnlineMonitor(); }; /** * @param {!string} eventType * @return {Array.<boolean>} */ OnlineMonitor.prototype.getInitialEvent = function (eventType) { util.assert(eventType === 'online', 'Unknown event type: ' + eventType); return [this.online_]; }; /** * @return {boolean} */ OnlineMonitor.prototype.currentlyOnline = function () { return this.online_; }; return OnlineMonitor; }(EventEmitter)); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * This class ensures the packets from the server arrive in order * This class takes data from the server and ensures it gets passed into the callbacks in order. * @constructor */ var PacketReceiver = /** @class */ (function () { /** * @param onMessage_ */ function PacketReceiver(onMessage_) { this.onMessage_ = onMessage_; this.pendingResponses = []; this.currentResponseNum = 0; this.closeAfterResponse = -1; this.onClose = null; } PacketReceiver.prototype.closeAfter = function (responseNum, callback) { this.closeAfterResponse = responseNum; this.onClose = callback; if (this.closeAfterResponse < this.currentResponseNum) { this.onClose(); this.onClose = null; } }; /** * Each message from the server comes with a response number, and an array of data. The responseNumber * allows us to ensure that we process them in the right order, since we can't be guaranteed that all * browsers will respond in the same order as the requests we sent * @param {number} requestNum * @param {Array} data */ PacketReceiver.prototype.handleResponse = function (requestNum, data) { var _this = this; this.pendingResponses[requestNum] = data; var _loop_1 = function () { var toProcess = this_1.pendingResponses[this_1.currentResponseNum]; delete this_1.pendingResponses[this_1.currentResponseNum]; var _loop_2 = function (i) { if (toProcess[i]) { exceptionGuard(function () { _this.onMessage_(toProcess[i]); }); } }; for (var i = 0; i < toProcess.length; ++i) { _loop_2(i); } if (this_1.currentResponseNum === this_1.closeAfterResponse) { if (this_1.onClose) { this_1.onClose(); this_1.onClose = null; } return "break"; } this_1.currentResponseNum++; }; var this_1 = this; while (this.pendingResponses[this.currentResponseNum]) { var state_1 = _loop_1(); if (state_1 === "break") break; } }; return PacketReceiver; }()); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // URL query parameters associated with longpolling var FIREBASE_LONGPOLL_START_PARAM = 'start'; var FIREBASE_LONGPOLL_CLOSE_COMMAND = 'close'; var FIREBASE_LONGPOLL_COMMAND_CB_NAME = 'pLPCommand'; var FIREBASE_LONGPOLL_DATA_CB_NAME = 'pRTLPCB'; var FIREBASE_LONGPOLL_ID_PARAM = 'id'; var FIREBASE_LONGPOLL_PW_PARAM = 'pw'; var FIREBASE_LONGPOLL_SERIAL_PARAM = 'ser'; var FIREBASE_LONGPOLL_CALLBACK_ID_PARAM = 'cb'; var FIREBASE_LONGPOLL_SEGMENT_NUM_PARAM = 'seg'; var FIREBASE_LONGPOLL_SEGMENTS_IN_PACKET = 'ts'; var FIREBASE_LONGPOLL_DATA_PARAM = 'd'; var FIREBASE_LONGPOLL_DISCONN_FRAME_REQUEST_PARAM = 'dframe'; //Data size constants. //TODO: Perf: the maximum length actually differs from browser to browser. // We should check what browser we're on and set accordingly. var MAX_URL_DATA_SIZE = 1870; var SEG_HEADER_SIZE = 30; //ie: &seg=8299234&ts=982389123&d= var MAX_PAYLOAD_SIZE = MAX_URL_DATA_SIZE - SEG_HEADER_SIZE; /** * Keepalive period * send a fresh request at minimum every 25 seconds. Opera has a maximum request * length of 30 seconds that we can't exceed. * @const * @type {number} */ var KEEPALIVE_REQUEST_INTERVAL = 25000; /** * How long to wait before aborting a long-polling connection attempt. * @const * @type {number} */ var LP_CONNECT_TIMEOUT = 30000; /** * This class manages a single long-polling connection. * * @constructor * @implements {Transport} */ var BrowserPollConnection = /** @class */ (function () { /** * @param connId An identifier for this connection, used for logging * @param repoInfo The info for the endpoint to send data to. * @param applicationId The Firebase App ID for this project. * @param transportSessionId Optional transportSessionid if we are reconnecting for an existing * transport session * @param lastSessionId Optional lastSessionId if the PersistentConnection has already created a * connection previously */ function BrowserPollConnection(connId, repoInfo, applicationId, transportSessionId, lastSessionId) { this.connId = connId; this.repoInfo = repoInfo; this.applicationId = applicationId; this.transportSessionId = transportSessionId; this.lastSessionId = lastSessionId; this.bytesSent = 0; this.bytesReceived = 0; this.everConnected_ = false; this.log_ = logWrapper(connId); this.stats_ = StatsManager.getCollection(repoInfo); this.urlFn = function (params) { return repoInfo.connectionURL(LONG_POLLING, params); }; } /** * * @param {function(Object)} onMessage Callback when messages arrive * @param {function()} onDisconnect Callback with connection lost. */ BrowserPollConnection.prototype.open = function (onMessage, onDisconnect) { var _this = this; this.curSegmentNum = 0; this.onDisconnect_ = onDisconnect; this.myPacketOrderer = new PacketReceiver(onMessage); this.isClosed_ = false; this.connectTimeoutTimer_ = setTimeout(function () { _this.log_('Timed out trying to connect.'); // Make sure we clear the host cache _this.onClosed_(); _this.connectTimeoutTimer_ = null; // eslint-disable-next-line @typescript-eslint/no-explicit-any }, Math.floor(LP_CONNECT_TIMEOUT)); // Ensure we delay the creation of the iframe until the DOM is loaded. executeWhenDOMReady(function () { if (_this.isClosed_) { return; } //Set up a callback that gets triggered once a connection is set up. _this.scriptTagHolder = new FirebaseIFrameScriptHolder(function () { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } var _a = tslib.__read(args, 5), command = _a[0], arg1 = _a[1], arg2 = _a[2], arg3 = _a[3], arg4 = _a[4]; _this.incrementIncomingBytes_(args); if (!_this.scriptTagHolder) { return; // we closed the connection. } if (_this.connectTimeoutTimer_) { clearTimeout(_this.connectTimeoutTimer_); _this.connectTimeoutTimer_ = null; } _this.everConnected_ = true; if (command === FIREBASE_LONGPOLL_START_PARAM) { _this.id = arg1; _this.password = arg2; } else if (command === FIREBASE_LONGPOLL_CLOSE_COMMAND) { // Don't clear the host cache. We got a response from the server, so we know it's reachable if (arg1) { // We aren't expecting any more data (other than what the server's already in the process of sending us // through our already open polls), so don't send any more. _this.scriptTagHolder.sendNewPolls = false; // arg1 in this case is the last response number sent by the server. We should try to receive // all of the responses up to this one before closing _this.myPacketOrderer.closeAfter(arg1, function () { _this.onClosed_(); }); } else { _this.onClosed_(); } } else { throw new Error('Unrecognized command received: ' + command); } }, function () { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } var _a = tslib.__read(args, 2), pN = _a[0], data = _a[1]; _this.incrementIncomingBytes_(args); _this.myPacketOrderer.handleResponse(pN, data); }, function () { _this.onClosed_(); }, _this.urlFn); //Send the initial request to connect. The serial number is simply to keep the browser from pulling previous results //from cache. var urlParams = {}; urlParams[FIREBASE_LONGPOLL_START_PARAM] = 't'; urlParams[FIREBASE_LONGPOLL_SERIAL_PARAM] = Math.floor(Math.random() * 100000000); if (_this.scriptTagHolder.uniqueCallbackIdentifier) { urlParams[FIREBASE_LONGPOLL_CALLBACK_ID_PARAM] = _this.scriptTagHolder.uniqueCallbackIdentifier; } urlParams[VERSION_PARAM] = PROTOCOL_VERSION; if (_this.transportSessionId) { urlParams[TRANSPORT_SESSION_PARAM] = _this.transportSessionId; } if (_this.lastSessionId) { urlParams[LAST_SESSION_PARAM] = _this.lastSessionId; } if (_this.applicationId) { urlParams[APPLICATION_ID_PARAM] = _this.applicationId; } if (typeof location !== 'undefined' && location.href && location.href.indexOf(FORGE_DOMAIN) !== -1) { urlParams[REFERER_PARAM] = FORGE_REF; } var connectURL = _this.urlFn(urlParams); _this.log_('Connecting via long-poll to ' + connectURL); _this.scriptTagHolder.addTag(connectURL, function () { /* do nothing */ }); }); }; /** * Call this when a handshake has completed successfully and we want to consider the connection established */ BrowserPollConnection.prototype.start = function () { this.scriptTagHolder.startLongPoll(this.id, this.password); this.addDisconnectPingFrame(this.id, this.password); }; /** * Forces long polling to be considered as a potential transport */ BrowserPollConnection.forceAllow = function () { BrowserPollConnection.forceAllow_ = true; }; /** * Forces longpolling to not be considered as a potential transport */ BrowserPollConnection.forceDisallow = function () { BrowserPollConnection.forceDisallow_ = true; }; // Static method, use string literal so it can be accessed in a generic way BrowserPollConnection.isAvailable = function () { if (util.isNodeSdk()) { return false; } else if (BrowserPollConnection.forceAllow_) { return true; } else { // NOTE: In React-Native there's normally no 'document', but if you debug a React-Native app in // the Chrome debugger, 'document' is defined, but document.createElement is null (2015/06/08). return (!BrowserPollConnection.forceDisallow_ && typeof document !== 'undefined' && document.createElement != null && !isChromeExtensionContentScript() && !isWindowsStoreApp()); } }; /** * No-op for polling */ BrowserPollConnection.prototype.markConnectionHealthy = function () { }; /** * Stops polling and cleans up the iframe * @private */ BrowserPollConnection.prototype.shutdown_ = function () { this.isClosed_ = true; if (this.scriptTagHolder) { this.scriptTagHolder.close(); this.scriptTagHolder = null; } //remove the disconnect frame, which will trigger an XHR call to the server to tell it we're leaving. if (this.myDisconnFrame) { document.body.removeChild(this.myDisconnFrame); this.myDisconnFrame = null; } if (this.connectTimeoutTimer_) { clearTimeout(this.connectTimeoutTimer_); this.connectTimeoutTimer_ = null; } }; /** * Triggered when this transport is closed * @private */ BrowserPollConnection.prototype.onClosed_ = function () { if (!this.isClosed_) { this.log_('Longpoll is closing itself'); this.shutdown_(); if (this.onDisconnect_) { this.onDisconnect_(this.everConnected_); this.onDisconnect_ = null; } } }; /** * External-facing close handler. RealTime has requested we shut down. Kill our connection and tell the server * that we've left. */ BrowserPollConnection.prototype.close = function () { if (!this.isClosed_) { this.log_('Longpoll is being closed.'); this.shutdown_(); } }; /** * Send the JSON object down to the server. It will need to be stringified, base64 encoded, and then * broken into chunks (since URLs have a small maximum length). * @param {!Object} data The JSON data to transmit. */ BrowserPollConnection.prototype.send = function (data) { var dataStr = util.stringify(data); this.bytesSent += dataStr.length; this.stats_.incrementCounter('bytes_sent', dataStr.length); //first, lets get the base64-encoded data var base64data = util.base64Encode(dataStr); //We can only fit a certain amount in each URL, so we need to split this request //up into multiple pieces if it doesn't fit in one request. var dataSegs = splitStringBySize(base64data, MAX_PAYLOAD_SIZE); //Enqueue each segment for transmission. We assign each chunk a sequential ID and a total number //of segments so that we can reassemble the packet on the server. for (var i = 0; i < dataSegs.length; i++) { this.scriptTagHolder.enqueueSegment(this.curSegmentNum, dataSegs.length, dataSegs[i]); this.curSegmentNum++; } }; /** * This is how we notify the server that we're leaving. * We aren't able to send requests with DHTML on a window close event, but we can * trigger XHR requests in some browsers (everything but Opera basically). * @param {!string} id * @param {!string} pw */ BrowserPollConnection.prototype.addDisconnectPingFrame = function (id, pw) { if (util.isNodeSdk()) { return; } this.myDisconnFrame = document.createElement('iframe'); var urlParams = {}; urlParams[FIREBASE_LONGPOLL_DISCONN_FRAME_REQUEST_PARAM] = 't'; urlParams[FIREBASE_LONGPOLL_ID_PARAM] = id; urlParams[FIREBASE_LONGPOLL_PW_PARAM] = pw; this.myDisconnFrame.src = this.urlFn(urlParams); this.myDisconnFrame.style.display = 'none'; document.body.appendChild(this.myDisconnFrame); }; /** * Used to track the bytes received by this client * @param {*} args * @private */ BrowserPollConnection.prototype.incrementIncomingBytes_ = function (args) { // TODO: This is an annoying perf hit just to track the number of incoming bytes. Maybe it should be opt-in. var bytesReceived = util.stringify(args).length; this.bytesReceived += bytesReceived; this.stats_.incrementCounter('bytes_received', bytesReceived); }; return BrowserPollConnection; }()); /********************************************************************************************* * A wrapper around an iframe that is used as a long-polling script holder. * @constructor *********************************************************************************************/ var FirebaseIFrameScriptHolder = /** @class */ (function () { /** * @param commandCB - The callback to be called when control commands are recevied from the server. * @param onMessageCB - The callback to be triggered when responses arrive from the server. * @param onDisconnect - The callback to be triggered when this tag holder is closed * @param urlFn - A function that provides the URL of the endpoint to send data to. */ function FirebaseIFrameScriptHolder(commandCB, onMessageCB, onDisconnect, urlFn) { this.onDisconnect = onDisconnect; this.urlFn = urlFn; //We maintain a count of all of the outstanding requests, because if we have too many active at once it can cause //problems in some browsers. this.outstandingRequests = new Set(); //A queue of the pending segments waiting for transmission to the server. this.pendingSegs = []; //A serial number. We use this for two things: // 1) A way to ensure the browser doesn't cache responses to polls // 2) A way to make the server aware when long-polls arrive in a different order than we started them. The // server needs to release both polls in this case or it will cause problems in Opera since Opera can only execute // JSONP code in the order it was added to the iframe. this.currentSerial = Math.floor(Math.random() * 100000000); // This gets set to false when we're "closing down" the connection (e.g. we're switching transports but there's still // incoming data from the server that we're waiting for). this.sendNewPolls = true; if (!util.isNodeSdk()) { //Each script holder registers a couple of uniquely named callbacks with the window. These are called from the //iframes where we put the long-polling script tags. We have two callbacks: // 1) Command Callback - Triggered for control issues, like starting a connection. // 2) Message Callback - Triggered when new data arrives. this.uniqueCallbackIdentifier = LUIDGenerator(); window[FIREBASE_LONGPOLL_COMMAND_CB_NAME + this.uniqueCallbackIdentifier] = commandCB; window[FIREBASE_LONGPOLL_DATA_CB_NAME + this.uniqueCallbackIdentifier] = onMessageCB; //Create an iframe for us to add script tags to. this.myIFrame = FirebaseIFrameScriptHolder.createIFrame_(); // Set the iframe's contents. var script = ''; // if we set a javascript url, it's IE and we need to set the document domain. The javascript url is sufficient // for ie9, but ie8 needs to do it again in the document itself. if (this.myIFrame.src && this.myIFrame.src.substr(0, 'javascript:'.length) === 'javascript:') { var currentDomain = document.domain; script = '<script>document.domain="' + currentDomain + '";</script>'; } var iframeContents = '<html><body>' + script + '</body></html>'; try { this.myIFrame.doc.open(); this.myIFrame.doc.write(iframeContents); this.myIFrame.doc.close(); } catch (e) { log('frame writing exception'); if (e.stack) { log(e.stack); } log(e); } } else { this.commandCB = commandCB; this.onMessageCB = onMessageCB; } } /** * Each browser has its own funny way to handle iframes. Here we mush them all together into one object that I can * actually use. * @private * @return {Element} */ FirebaseIFrameScriptHolder.createIFrame_ = function () { var iframe = document.createElement('iframe'); iframe.style.display = 'none'; // This is necessary in order to initialize the document inside the iframe if (document.body) { document.body.appendChild(iframe); try { // If document.domain has been modified in IE, this will throw an error, and we need to set the // domain of the iframe's document manually. We can do this via a javascript: url as the src attribute // Also note that we must do this *after* the iframe has been appended to the page. Otherwise it doesn't work. var a = iframe.contentWindow.document; if (!a) { // Apologies for the log-spam, I need to do something to keep closure from optimizing out the assignment above. log('No IE domain setting required'); } } catch (e) { var domain = document.domain; iframe.src = "javascript:void((function(){document.open();document.domain='" + domain + "';document.close();})())"; } } else { // LongPollConnection attempts to delay initialization until the document is ready, so hopefully this // never gets hit. throw 'Document body has not initialized. Wait to initialize Firebase until after the document is ready.'; } // Get the document of the iframe in a browser-specific way. if (iframe.contentDocument) { iframe.doc = iframe.contentDocument; // Firefox, Opera, Safari } else if (iframe.contentWindow) { iframe.doc = iframe.contentWindow.document; // Internet Explorer // eslint-disable-next-line @typescript-eslint/no-explicit-any } else if (iframe.document) { // eslint-disable-next-line @typescript-eslint/no-explicit-any iframe.doc = iframe.document; //others? } return iframe; }; /** * Cancel all outstanding queries and remove the frame. */ FirebaseIFrameScriptHolder.prototype.close = function () { var _this = this; //Mark this iframe as dead, so no new requests are sent. this.alive = false; if (this.myIFrame) { //We have to actually remove all of the html inside this iframe before removing it from the //window, or IE will continue loading and executing the script tags we've already added, which //can lead to some errors being thrown. Setting innerHTML seems to be the easiest way to do this. this.myIFrame.doc.body.innerHTML = ''; setTimeout(function () { if (_this.myIFrame !== null) { document.body.removeChild(_this.myIFrame); _this.myIFrame = null; } }, Math.floor(0)); } // Protect from being called recursively. var onDisconnect = this.onDisconnect; if (onDisconnect) { this.onDisconnect = null; onDisconnect(); } }; /** * Actually start the long-polling session by adding the first script tag(s) to the iframe. * @param {!string} id - The ID of this connection * @param {!string} pw - The password for this connection */ FirebaseIFrameScriptHolder.prototype.startLongPoll = function (id, pw) { this.myID = id; this.myPW = pw; this.alive = true; //send the initial request. If there are requests queued, make sure that we transmit as many as we are currently able to. while (this.newRequest_()) { } }; /** * This is called any time someone might want a script tag to be added. It adds a script tag when there aren't * too many outstanding requests and we are still alive. * * If there are outstanding packet segments to send, it sends one. If there aren't, it sends a long-poll anyways if * needed. */ FirebaseIFrameScriptHolder.prototype.newRequest_ = function () { // We keep one outstanding request open all the time to receive data, but if we need to send data // (pendingSegs.length > 0) then we create a new request to send the data. The server will automatically // close the old request. if (this.alive && this.sendNewPolls && this.outstandingRequests.size < (this.pendingSegs.length > 0 ? 2 : 1)) { //construct our url this.currentSerial++; var urlParams = {}; urlParams[FIREBASE_LONGPOLL_ID_PARAM] = this.myID; urlParams[FIREBASE_LONGPOLL_PW_PARAM] = this.myPW; urlParams[FIREBASE_LONGPOLL_SERIAL_PARAM] = this.currentSerial; var theURL = this.urlFn(urlParams); //Now add as much data as we can. var curDataString = ''; var i = 0; while (this.pendingSegs.length > 0) { //first, lets see if the next segment will fit. var nextSeg = this.pendingSegs[0]; if (nextSeg.d.length + SEG_HEADER_SIZE + curDataString.length <= MAX_URL_DATA_SIZE) { //great, the segment will fit. Lets append it. var theSeg = this.pendingSegs.shift(); curDataString = curDataString + '&' + FIREBASE_LONGPOLL_SEGMENT_NUM_PARAM + i + '=' + theSeg.seg + '&' + FIREBASE_LONGPOLL_SEGMENTS_IN_PACKET + i + '=' + theSeg.ts + '&' + FIREBASE_LONGPOLL_DATA_PARAM + i + '=' + theSeg.d; i++; } else { break; } } theURL = theURL + curDataString; this.addLongPollTag_(theURL, this.currentSerial); return true; } else { return false; } }; /** * Queue a packet for transmission to the server. * @param segnum - A sequential id for this packet segment used for reassembly * @param totalsegs - The total number of segments in this packet * @param data - The data for this segment. */ FirebaseIFrameScriptHolder.prototype.enqueueSegment = function (segnum, totalsegs, data) { //add this to the queue of segments to send. this.pendingSegs.push({ seg: segnum, ts: totalsegs, d: data }); //send the data immediately if there isn't already data being transmitted, unless //startLongPoll hasn't been called yet. if (this.alive) { this.newRequest_(); } }; /** * Add a script tag for a regular long-poll request. * @param {!string} url - The URL of the script tag. * @param {!number} serial - The serial number of the request. * @private */ FirebaseIFrameScriptHolder.prototype.addLongPollTag_ = function (url, serial) { var _this = this; //remember that we sent this request. this.outstandingRequests.add(serial); var doNewRequest = function () { _this.outstandingRequests.delete(serial); _this.newRequest_(); }; // If this request doesn't return on its own accord (by the server sending us some data), we'll // create a new one after the KEEPALIVE interval to make sure we always keep a fresh request open. var keepaliveTimeout = setTimeout(doNewRequest, Math.floor(KEEPALIVE_REQUEST_INTERVAL)); var readyStateCB = function () { // Request completed. Cancel the keepalive. clearTimeout(keepaliveTimeout); // Trigger a new request so we can continue receiving data. doNewRequest(); }; this.addTag(url, readyStateCB); }; /** * Add an arbitrary script tag to the iframe. * @param {!string} url - The URL for the script tag source. * @param {!function()} loadCB - A callback to be triggered once the script has loaded. */ FirebaseIFrameScriptHolder.prototype.addTag = function (url, loadCB) { var _this = this; if (util.isNodeSdk()) { // eslint-disable-next-line @typescript-eslint/no-explicit-any this.doNodeLongPoll(url, loadCB); } else { setTimeout(function () { try { // if we're already closed, don't add this poll if (!_this.sendNewPolls) { return; } var newScript_1 = _this.myIFrame.doc.createElement('script'); newScript_1.type = 'text/javascript'; newScript_1.async = true; newScript_1.src = url; // eslint-disable-next-line @typescript-eslint/no-explicit-any newScript_1.onload = newScript_1.onreadystatechange = function () { // eslint-disable-next-line @typescript-eslint/no-explicit-any var rstate = newScript_1.readyState; if (!rstate || rstate === 'loaded' || rstate === 'complete') { // eslint-disable-next-line @typescript-eslint/no-explicit-any newScript_1.onload = newScript_1.onreadystatechange = null; if (newScript_1.parentNode) { newScript_1.parentNode.removeChild(newScript_1); } loadCB(); } }; newScript_1.onerror = function () { log('Long-poll script failed to load: ' + url); _this.sendNewPolls = false; _this.close(); }; _this.myIFrame.doc.body.appendChild(newScript_1); } catch (e) { // TODO: we should make this error visible somehow } }, Math.floor(1)); } }; return FirebaseIFrameScriptHolder; }()); /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** The semver (www.semver.org) version of the SDK. */ var SDK_VERSION = ''; // SDK_VERSION should be set before any database instance is created function setSDKVersion(version) { SDK_VERSION = version; } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var WEBSOCKET_MAX_FRAME_SIZE = 16384; var WEBSOCKET_KEEPALIVE_INTERVAL = 45000; var WebSocketImpl = null; if (typeof MozWebSocket !== 'undefined') { WebSocketImpl = MozWebSocket; } else if (typeof WebSocket !== 'undefined') { WebSocketImpl = WebSocket; } /** * Create a new websocket connection with the given callbacks. * @constructor * @implements {Transport} */ var WebSocketConnection = /** @class */ (function () { /** * @param connId identifier for this transport * @param repoInfo The info for the websocket endpoint. * @param applicationId The Firebase App ID for this project. * @param transportSessionId Optional transportSessionId if this is connecting to an existing transport * session * @param lastSessionId Optional lastSessionId if there was a previous connection */ function WebSocketConnection(connId, repoInfo, applicationId, transportSessionId, lastSessionId) { this.connId = connId; this.applicationId = applicationId; this.keepaliveTimer = null; this.frames = null; this.totalFrames = 0; this.bytesSent = 0; this.bytesReceived = 0; this.log_ = logWrapper(this.connId); this.stats_ = StatsManager.getCollection(repoInfo); this.connURL = WebSocketConnection.connectionURL_(repoInfo, transportSessionId, lastSessionId); this.nodeAdmin = repoInfo.nodeAdmin; } /** * @param {RepoInfo} repoInfo The info for the websocket endpoint. * @param {string=} transportSessionId Optional transportSessionId if this is connecting to an existing transport * session * @param {string=} lastSessionId Optional lastSessionId if there was a previous connection * @return {string} connection url * @private */ WebSocketConnection.connectionURL_ = function (repoInfo, transportSessionId, lastSessionId) { var urlParams = {}; urlParams[VERSION_PARAM] = PROTOCOL_VERSION; if (!util.isNodeSdk() && typeof location !== 'undefined' && location.href && location.href.indexOf(FORGE_DOMAIN) !== -1) { urlParams[REFERER_PARAM] = FORGE_REF; } if (transportSessionId) { urlParams[TRANSPORT_SESSION_PARAM] = transportSessionId; } if (lastSessionId) { urlParams[LAST_SESSION_PARAM] = lastSessionId; } return repoInfo.connectionURL(WEBSOCKET, urlParams); }; /** * * @param onMessage Callback when messages arrive * @param onDisconnect Callback with connection lost. */ WebSocketConnection.prototype.open = function (onMessage, onDisconnect) { var _this = this; this.onDisconnect = onDisconnect; this.onMessage = onMessage; this.log_('Websocket connecting to ' + this.connURL); this.everConnected_ = false; // Assume failure until proven otherwise. PersistentStorage.set('previous_websocket_failure', true); try { if (util.isNodeSdk()) { var device = this.nodeAdmin ? 'AdminNode' : 'Node'; // UA Format: Firebase/<wire_protocol>/<sdk_version>/<platform>/<device> var options = { headers: { 'User-Agent': "Firebase/" + PROTOCOL_VERSION + "/" + SDK_VERSION + "/" + process.platform + "/" + device, 'X-Firebase-GMPID': this.applicationId || '' } }; // Plumb appropriate http_proxy environment variable into faye-websocket if it exists. var env = process['env']; var proxy = this.connURL.indexOf('wss://') === 0 ? env['HTTPS_PROXY'] || env['https_proxy'] : env['HTTP_PROXY'] || env['http_proxy']; if (proxy) { options['proxy'] = { origin: proxy }; } this.mySock = new WebSocketImpl(this.connURL, [], options); } else { var options = { headers: { 'X-Firebase-GMPID': this.applicationId || '' } }; this.mySock = new WebSocketImpl(this.connURL, [], options); } } catch (e) { this.log_('Error instantiating WebSocket.'); var error = e.message || e.data; if (error) { this.log_(error); } this.onClosed_(); return; } this.mySock.onopen = function () { _this.log_('Websocket connected.'); _this.everConnected_ = true; }; this.mySock.onclose = function () { _this.log_('Websocket connection was disconnected.'); _this.mySock = null; _this.onClosed_(); }; this.mySock.onmessage = function (m) { _this.handleIncomingFrame(m); }; this.mySock.onerror = function (e) { _this.log_('WebSocket error. Closing connection.'); // eslint-disable-next-line @typescript-eslint/no-explicit-any var error = e.message || e.data; if (error) { _this.log_(error); } _this.onClosed_(); }; }; /** * No-op for websockets, we don't need to do anything once the connection is confirmed as open */ WebSocketConnection.prototype.start = function () { }; WebSocketConnection.forceDisallow = function () { WebSocketConnection.forceDisallow_ = true; }; WebSocketConnection.isAvailable = function () { var isOldAndroid = false; if (typeof navigator !== 'undefined' && navigator.userAgent) { var oldAndroidRegex = /Android ([0-9]{0,}\.[0-9]{0,})/; var oldAndroidMatch = navigator.userAgent.match(oldAndroidRegex); if (oldAndroidMatch && oldAndroidMatch.length > 1) { if (parseFloat(oldAndroidMatch[1]) < 4.4) { isOldAndroid = true; } } } return (!isOldAndroid && WebSocketImpl !== null && !WebSocketConnection.forceDisallow_); }; /** * Returns true if we previously failed to connect with this transport. * @return {boolean} */ WebSocketConnection.previouslyFailed = function () { // If our persistent storage is actually only in-memory storage, // we default to assuming that it previously failed to be safe. return (PersistentStorage.isInMemoryStorage || PersistentStorage.get('previous_websocket_failure') === true); }; WebSocketConnection.prototype.markConnectionHealthy = function () { PersistentStorage.remove('previous_websocket_failure'); }; WebSocketConnection.prototype.appendFrame_ = function (data) { this.frames.push(data); if (this.frames.length === this.totalFrames) { var fullMess = this.frames.join(''); this.frames = null; var jsonMess = util.jsonEval(fullMess); //handle the message this.onMessage(jsonMess); } }; /** * @param {number} frameCount The number of frames we are expecting from the server * @private */ WebSocketConnection.prototype.handleNewFrameCount_ = function (frameCount) { this.totalFrames = frameCount; this.frames = []; }; /** * Attempts to parse a frame count out of some text. If it can't, assumes a value of 1 * @param {!String} data * @return {?String} Any remaining data to be process, or null if there is none * @private */ WebSocketConnection.prototype.extractFrameCount_ = function (data) { util.assert(this.frames === null, 'We already have a frame buffer'); // TODO: The server is only supposed to send up to 9999 frames (i.e. length <= 4), but that isn't being enforced // currently. So allowing larger frame counts (length <= 6). See https://app.asana.com/0/search/8688598998380/8237608042508 if (data.length <= 6) { var frameCount = Number(data); if (!isNaN(frameCount)) { this.handleNewFrameCount_(frameCount); return null; } } this.handleNewFrameCount_(1); return data; }; /** * Process a websocket frame that has arrived from the server. * @param mess The frame data */ WebSocketConnection.prototype.handleIncomingFrame = function (mess) { if (this.mySock === null) { return; // Chrome apparently delivers incoming packets even after we .close() the connection sometimes. } var data = mess['data']; this.bytesReceived += data.length; this.stats_.incrementCounter('bytes_received', data.length); this.resetKeepAlive(); if (this.frames !== null) { // we're buffering this.appendFrame_(data); } else { // try to parse out a frame count, otherwise, assume 1 and process it var remainingData = this.extractFrameCount_(data); if (remainingData !== null) { this.appendFrame_(remainingData); } } }; /** * Send a message to the server * @param {Object} data The JSON object to transmit */ WebSocketConnection.prototype.send = function (data) { this.resetKeepAlive(); var dataStr = util.stringify(data); this.bytesSent += dataStr.length; this.stats_.incrementCounter('bytes_sent', dataStr.length); //We can only fit a certain amount in each websocket frame, so we need to split this request //up into multiple pieces if it doesn't fit in one request. var dataSegs = splitStringBySize(dataStr, WEBSOCKET_MAX_FRAME_SIZE); //Send the length header if (dataSegs.length > 1) { this.sendString_(String(dataSegs.length)); } //Send the actual data in segments. for (var i = 0; i < dataSegs.length; i++) { this.sendString_(dataSegs[i]); } }; WebSocketConnection.prototype.shutdown_ = function () { this.isClosed_ = true; if (this.keepaliveTimer) { clearInterval(this.keepaliveTimer); this.keepaliveTimer = null; } if (this.mySock) { this.mySock.close(); this.mySock = null; } }; WebSocketConnection.prototype.onClosed_ = function () { if (!this.isClosed_) { this.log_('WebSocket is closing itself'); this.shutdown_(); // since this is an internal close, trigger the close listener if (this.onDisconnect) { this.onDisconnect(this.everConnected_); this.onDisconnect = null; } } }; /** * External-facing close handler. * Close the websocket and kill the connection. */ WebSocketConnection.prototype.close = function () { if (!this.isClosed_) { this.log_('WebSocket is being closed'); this.shutdown_(); } }; /** * Kill the current keepalive timer and start a new one, to ensure that it always fires N seconds after * the last activity. */ WebSocketConnection.prototype.resetKeepAlive = function () { var _this = this; clearInterval(this.keepaliveTimer); this.keepaliveTimer = setInterval(function () { //If there has been no websocket activity for a while, send a no-op if (_this.mySock) { _this.sendString_('0'); } _this.resetKeepAlive(); // eslint-disable-next-line @typescript-eslint/no-explicit-any }, Math.floor(WEBSOCKET_KEEPALIVE_INTERVAL)); }; /** * Send a string over the websocket. * * @param {string} str String to send. * @private */ WebSocketConnection.prototype.sendString_ = function (str) { // Firefox seems to sometimes throw exceptions (NS_ERROR_UNEXPECTED) from websocket .send() // calls for some unknown reason. We treat these as an error and disconnect. // See https://app.asana.com/0/58926111402292/68021340250410 try { this.mySock.send(str); } catch (e) { this.log_('Exception thrown from WebSocket.send():', e.message || e.data, 'Closing connection.'); setTimeout(this.onClosed_.bind(this), 0); } }; /** * Number of response before we consider the connection "healthy." * @type {number} */ WebSocketConnection.responsesRequiredToBeHealthy = 2; /** * Time to wait for the connection te become healthy before giving up. * @type {number} */ WebSocketConnection.healthyTimeout = 30000; return WebSocketConnection; }()); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Currently simplistic, this class manages what transport a Connection should use at various stages of its * lifecycle. * * It starts with longpolling in a browser, and httppolling on node. It then upgrades to websockets if * they are available. * @constructor */ var TransportManager = /** @class */ (function () { /** * @param {!RepoInfo} repoInfo Metadata around the namespace we're connecting to */ function TransportManager(repoInfo) { this.initTransports_(repoInfo); } Object.defineProperty(TransportManager, "ALL_TRANSPORTS", { /** * @const * @type {!Array.<function(new:Transport, string, RepoInfo, string=)>} */ get: function () { return [BrowserPollConnection, WebSocketConnection]; }, enumerable: false, configurable: true }); /** * @param {!RepoInfo} repoInfo * @private */ TransportManager.prototype.initTransports_ = function (repoInfo) { var e_1, _a; var isWebSocketsAvailable = WebSocketConnection && WebSocketConnection['isAvailable'](); var isSkipPollConnection = isWebSocketsAvailable && !WebSocketConnection.previouslyFailed(); if (repoInfo.webSocketOnly) { if (!isWebSocketsAvailable) { warn("wss:// URL used, but browser isn't known to support websockets. Trying anyway."); } isSkipPollConnection = true; } if (isSkipPollConnection) { this.transports_ = [WebSocketConnection]; } else { var transports = (this.transports_ = []); try { for (var _b = tslib.__values(TransportManager.ALL_TRANSPORTS), _c = _b.next(); !_c.done; _c = _b.next()) { var transport = _c.value; if (transport && transport['isAvailable']()) { transports.push(transport); } } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (_c && !_c.done && (_a = _b.return)) _a.call(_b); } finally { if (e_1) throw e_1.error; } } } }; /** * @return {function(new:Transport, !string, !RepoInfo, string=, string=)} The constructor for the * initial transport to use */ TransportManager.prototype.initialTransport = function () { if (this.transports_.length > 0) { return this.transports_[0]; } else { throw new Error('No transports available'); } }; /** * @return {?function(new:Transport, function(),function(), string=)} The constructor for the next * transport, or null */ TransportManager.prototype.upgradeTransport = function () { if (this.transports_.length > 1) { return this.transports_[1]; } else { return null; } }; return TransportManager; }()); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // Abort upgrade attempt if it takes longer than 60s. var UPGRADE_TIMEOUT = 60000; // For some transports (WebSockets), we need to "validate" the transport by exchanging a few requests and responses. // If we haven't sent enough requests within 5s, we'll start sending noop ping requests. var DELAY_BEFORE_SENDING_EXTRA_REQUESTS = 5000; // If the initial data sent triggers a lot of bandwidth (i.e. it's a large put or a listen for a large amount of data) // then we may not be able to exchange our ping/pong requests within the healthy timeout. So if we reach the timeout // but we've sent/received enough bytes, we don't cancel the connection. var BYTES_SENT_HEALTHY_OVERRIDE = 10 * 1024; var BYTES_RECEIVED_HEALTHY_OVERRIDE = 100 * 1024; var MESSAGE_TYPE = 't'; var MESSAGE_DATA = 'd'; var CONTROL_SHUTDOWN = 's'; var CONTROL_RESET = 'r'; var CONTROL_ERROR = 'e'; var CONTROL_PONG = 'o'; var SWITCH_ACK = 'a'; var END_TRANSMISSION = 'n'; var PING = 'p'; var SERVER_HELLO = 'h'; /** * Creates a new real-time connection to the server using whichever method works * best in the current browser. * * @constructor */ var Connection = /** @class */ (function () { /** * @param id - an id for this connection * @param repoInfo_ - the info for the endpoint to connect to * @param applicationId_ - the Firebase App ID for this project * @param onMessage_ - the callback to be triggered when a server-push message arrives * @param onReady_ - the callback to be triggered when this connection is ready to send messages. * @param onDisconnect_ - the callback to be triggered when a connection was lost * @param onKill_ - the callback to be triggered when this connection has permanently shut down. * @param lastSessionId - last session id in persistent connection. is used to clean up old session in real-time server */ function Connection(id, repoInfo_, applicationId_, onMessage_, onReady_, onDisconnect_, onKill_, lastSessionId) { this.id = id; this.repoInfo_ = repoInfo_; this.applicationId_ = applicationId_; this.onMessage_ = onMessage_; this.onReady_ = onReady_; this.onDisconnect_ = onDisconnect_; this.onKill_ = onKill_; this.lastSessionId = lastSessionId; this.connectionCount = 0; this.pendingDataMessages = []; this.state_ = 0 /* CONNECTING */; this.log_ = logWrapper('c:' + this.id + ':'); this.transportManager_ = new TransportManager(repoInfo_); this.log_('Connection created'); this.start_(); } /** * Starts a connection attempt * @private */ Connection.prototype.start_ = function () { var _this = this; var conn = this.transportManager_.initialTransport(); this.conn_ = new conn(this.nextTransportId_(), this.repoInfo_, this.applicationId_, undefined, this.lastSessionId); // For certain transports (WebSockets), we need to send and receive several messages back and forth before we // can consider the transport healthy. this.primaryResponsesRequired_ = conn['responsesRequiredToBeHealthy'] || 0; var onMessageReceived = this.connReceiver_(this.conn_); var onConnectionLost = this.disconnReceiver_(this.conn_); this.tx_ = this.conn_; this.rx_ = this.conn_; this.secondaryConn_ = null; this.isHealthy_ = false; /* * Firefox doesn't like when code from one iframe tries to create another iframe by way of the parent frame. * This can occur in the case of a redirect, i.e. we guessed wrong on what server to connect to and received a reset. * Somehow, setTimeout seems to make this ok. That doesn't make sense from a security perspective, since you should * still have the context of your originating frame. */ setTimeout(function () { // this.conn_ gets set to null in some of the tests. Check to make sure it still exists before using it _this.conn_ && _this.conn_.open(onMessageReceived, onConnectionLost); }, Math.floor(0)); var healthyTimeoutMS = conn['healthyTimeout'] || 0; if (healthyTimeoutMS > 0) { this.healthyTimeout_ = setTimeoutNonBlocking(function () { _this.healthyTimeout_ = null; if (!_this.isHealthy_) { if (_this.conn_ && _this.conn_.bytesReceived > BYTES_RECEIVED_HEALTHY_OVERRIDE) { _this.log_('Connection exceeded healthy timeout but has received ' + _this.conn_.bytesReceived + ' bytes. Marking connection healthy.'); _this.isHealthy_ = true; _this.conn_.markConnectionHealthy(); } else if (_this.conn_ && _this.conn_.bytesSent > BYTES_SENT_HEALTHY_OVERRIDE) { _this.log_('Connection exceeded healthy timeout but has sent ' + _this.conn_.bytesSent + ' bytes. Leaving connection alive.'); // NOTE: We don't want to mark it healthy, since we have no guarantee that the bytes have made it to // the server. } else { _this.log_('Closing unhealthy connection after timeout.'); _this.close(); } } // eslint-disable-next-line @typescript-eslint/no-explicit-any }, Math.floor(healthyTimeoutMS)); } }; /** * @return {!string} * @private */ Connection.prototype.nextTransportId_ = function () { return 'c:' + this.id + ':' + this.connectionCount++; }; Connection.prototype.disconnReceiver_ = function (conn) { var _this = this; return function (everConnected) { if (conn === _this.conn_) { _this.onConnectionLost_(everConnected); } else if (conn === _this.secondaryConn_) { _this.log_('Secondary connection lost.'); _this.onSecondaryConnectionLost_(); } else { _this.log_('closing an old connection'); } }; }; Connection.prototype.connReceiver_ = function (conn) { var _this = this; return function (message) { if (_this.state_ !== 2 /* DISCONNECTED */) { if (conn === _this.rx_) { _this.onPrimaryMessageReceived_(message); } else if (conn === _this.secondaryConn_) { _this.onSecondaryMessageReceived_(message); } else { _this.log_('message on old connection'); } } }; }; /** * * @param {Object} dataMsg An arbitrary data message to be sent to the server */ Connection.prototype.sendRequest = function (dataMsg) { // wrap in a data message envelope and send it on var msg = { t: 'd', d: dataMsg }; this.sendData_(msg); }; Connection.prototype.tryCleanupConnection = function () { if (this.tx_ === this.secondaryConn_ && this.rx_ === this.secondaryConn_) { this.log_('cleaning up and promoting a connection: ' + this.secondaryConn_.connId); this.conn_ = this.secondaryConn_; this.secondaryConn_ = null; // the server will shutdown the old connection } }; Connection.prototype.onSecondaryControl_ = function (controlData) { if (MESSAGE_TYPE in controlData) { var cmd = controlData[MESSAGE_TYPE]; if (cmd === SWITCH_ACK) { this.upgradeIfSecondaryHealthy_(); } else if (cmd === CONTROL_RESET) { // Most likely the session wasn't valid. Abandon the switch attempt this.log_('Got a reset on secondary, closing it'); this.secondaryConn_.close(); // If we were already using this connection for something, than we need to fully close if (this.tx_ === this.secondaryConn_ || this.rx_ === this.secondaryConn_) { this.close(); } } else if (cmd === CONTROL_PONG) { this.log_('got pong on secondary.'); this.secondaryResponsesRequired_--; this.upgradeIfSecondaryHealthy_(); } } }; Connection.prototype.onSecondaryMessageReceived_ = function (parsedData) { var layer = requireKey('t', parsedData); var data = requireKey('d', parsedData); if (layer === 'c') { this.onSecondaryControl_(data); } else if (layer === 'd') { // got a data message, but we're still second connection. Need to buffer it up this.pendingDataMessages.push(data); } else { throw new Error('Unknown protocol layer: ' + layer); } }; Connection.prototype.upgradeIfSecondaryHealthy_ = function () { if (this.secondaryResponsesRequired_ <= 0) { this.log_('Secondary connection is healthy.'); this.isHealthy_ = true; this.secondaryConn_.markConnectionHealthy(); this.proceedWithUpgrade_(); } else { // Send a ping to make sure the connection is healthy. this.log_('sending ping on secondary.'); this.secondaryConn_.send({ t: 'c', d: { t: PING, d: {} } }); } }; Connection.prototype.proceedWithUpgrade_ = function () { // tell this connection to consider itself open this.secondaryConn_.start(); // send ack this.log_('sending client ack on secondary'); this.secondaryConn_.send({ t: 'c', d: { t: SWITCH_ACK, d: {} } }); // send end packet on primary transport, switch to sending on this one // can receive on this one, buffer responses until end received on primary transport this.log_('Ending transmission on primary'); this.conn_.send({ t: 'c', d: { t: END_TRANSMISSION, d: {} } }); this.tx_ = this.secondaryConn_; this.tryCleanupConnection(); }; Connection.prototype.onPrimaryMessageReceived_ = function (parsedData) { // Must refer to parsedData properties in quotes, so closure doesn't touch them. var layer = requireKey('t', parsedData); var data = requireKey('d', parsedData); if (layer === 'c') { this.onControl_(data); } else if (layer === 'd') { this.onDataMessage_(data); } }; Connection.prototype.onDataMessage_ = function (message) { this.onPrimaryResponse_(); // We don't do anything with data messages, just kick them up a level this.onMessage_(message); }; Connection.prototype.onPrimaryResponse_ = function () { if (!this.isHealthy_) { this.primaryResponsesRequired_--; if (this.primaryResponsesRequired_ <= 0) { this.log_('Primary connection is healthy.'); this.isHealthy_ = true; this.conn_.markConnectionHealthy(); } } }; Connection.prototype.onControl_ = function (controlData) { var cmd = requireKey(MESSAGE_TYPE, controlData); if (MESSAGE_DATA in controlData) { var payload = controlData[MESSAGE_DATA]; if (cmd === SERVER_HELLO) { this.onHandshake_(payload); } else if (cmd === END_TRANSMISSION) { this.log_('recvd end transmission on primary'); this.rx_ = this.secondaryConn_; for (var i = 0; i < this.pendingDataMessages.length; ++i) { this.onDataMessage_(this.pendingDataMessages[i]); } this.pendingDataMessages = []; this.tryCleanupConnection(); } else if (cmd === CONTROL_SHUTDOWN) { // This was previously the 'onKill' callback passed to the lower-level connection // payload in this case is the reason for the shutdown. Generally a human-readable error this.onConnectionShutdown_(payload); } else if (cmd === CONTROL_RESET) { // payload in this case is the host we should contact this.onReset_(payload); } else if (cmd === CONTROL_ERROR) { error('Server Error: ' + payload); } else if (cmd === CONTROL_PONG) { this.log_('got pong on primary.'); this.onPrimaryResponse_(); this.sendPingOnPrimaryIfNecessary_(); } else { error('Unknown control packet command: ' + cmd); } } }; /** * * @param {Object} handshake The handshake data returned from the server * @private */ Connection.prototype.onHandshake_ = function (handshake) { var timestamp = handshake.ts; var version = handshake.v; var host = handshake.h; this.sessionId = handshake.s; this.repoInfo_.updateHost(host); // if we've already closed the connection, then don't bother trying to progress further if (this.state_ === 0 /* CONNECTING */) { this.conn_.start(); this.onConnectionEstablished_(this.conn_, timestamp); if (PROTOCOL_VERSION !== version) { warn('Protocol version mismatch detected'); } // TODO: do we want to upgrade? when? maybe a delay? this.tryStartUpgrade_(); } }; Connection.prototype.tryStartUpgrade_ = function () { var conn = this.transportManager_.upgradeTransport(); if (conn) { this.startUpgrade_(conn); } }; Connection.prototype.startUpgrade_ = function (conn) { var _this = this; this.secondaryConn_ = new conn(this.nextTransportId_(), this.repoInfo_, this.applicationId_, this.sessionId); // For certain transports (WebSockets), we need to send and receive several messages back and forth before we // can consider the transport healthy. this.secondaryResponsesRequired_ = conn['responsesRequiredToBeHealthy'] || 0; var onMessage = this.connReceiver_(this.secondaryConn_); var onDisconnect = this.disconnReceiver_(this.secondaryConn_); this.secondaryConn_.open(onMessage, onDisconnect); // If we haven't successfully upgraded after UPGRADE_TIMEOUT, give up and kill the secondary. setTimeoutNonBlocking(function () { if (_this.secondaryConn_) { _this.log_('Timed out trying to upgrade.'); _this.secondaryConn_.close(); } }, Math.floor(UPGRADE_TIMEOUT)); }; Connection.prototype.onReset_ = function (host) { this.log_('Reset packet received. New host: ' + host); this.repoInfo_.updateHost(host); // TODO: if we're already "connected", we need to trigger a disconnect at the next layer up. // We don't currently support resets after the connection has already been established if (this.state_ === 1 /* CONNECTED */) { this.close(); } else { // Close whatever connections we have open and start again. this.closeConnections_(); this.start_(); } }; Connection.prototype.onConnectionEstablished_ = function (conn, timestamp) { var _this = this; this.log_('Realtime connection established.'); this.conn_ = conn; this.state_ = 1 /* CONNECTED */; if (this.onReady_) { this.onReady_(timestamp, this.sessionId); this.onReady_ = null; } // If after 5 seconds we haven't sent enough requests to the server to get the connection healthy, // send some pings. if (this.primaryResponsesRequired_ === 0) { this.log_('Primary connection is healthy.'); this.isHealthy_ = true; } else { setTimeoutNonBlocking(function () { _this.sendPingOnPrimaryIfNecessary_(); }, Math.floor(DELAY_BEFORE_SENDING_EXTRA_REQUESTS)); } }; Connection.prototype.sendPingOnPrimaryIfNecessary_ = function () { // If the connection isn't considered healthy yet, we'll send a noop ping packet request. if (!this.isHealthy_ && this.state_ === 1 /* CONNECTED */) { this.log_('sending ping on primary.'); this.sendData_({ t: 'c', d: { t: PING, d: {} } }); } }; Connection.prototype.onSecondaryConnectionLost_ = function () { var conn = this.secondaryConn_; this.secondaryConn_ = null; if (this.tx_ === conn || this.rx_ === conn) { // we are relying on this connection already in some capacity. Therefore, a failure is real this.close(); } }; /** * * @param {boolean} everConnected Whether or not the connection ever reached a server. Used to determine if * we should flush the host cache * @private */ Connection.prototype.onConnectionLost_ = function (everConnected) { this.conn_ = null; // NOTE: IF you're seeing a Firefox error for this line, I think it might be because it's getting // called on window close and RealtimeState.CONNECTING is no longer defined. Just a guess. if (!everConnected && this.state_ === 0 /* CONNECTING */) { this.log_('Realtime connection failed.'); // Since we failed to connect at all, clear any cached entry for this namespace in case the machine went away if (this.repoInfo_.isCacheableHost()) { PersistentStorage.remove('host:' + this.repoInfo_.host); // reset the internal host to what we would show the user, i.e. <ns>.firebaseio.com this.repoInfo_.internalHost = this.repoInfo_.host; } } else if (this.state_ === 1 /* CONNECTED */) { this.log_('Realtime connection lost.'); } this.close(); }; /** * * @param {string} reason * @private */ Connection.prototype.onConnectionShutdown_ = function (reason) { this.log_('Connection shutdown command received. Shutting down...'); if (this.onKill_) { this.onKill_(reason); this.onKill_ = null; } // We intentionally don't want to fire onDisconnect (kill is a different case), // so clear the callback. this.onDisconnect_ = null; this.close(); }; Connection.prototype.sendData_ = function (data) { if (this.state_ !== 1 /* CONNECTED */) { throw 'Connection is not connected'; } else { this.tx_.send(data); } }; /** * Cleans up this connection, calling the appropriate callbacks */ Connection.prototype.close = function () { if (this.state_ !== 2 /* DISCONNECTED */) { this.log_('Closing realtime connection.'); this.state_ = 2 /* DISCONNECTED */; this.closeConnections_(); if (this.onDisconnect_) { this.onDisconnect_(); this.onDisconnect_ = null; } } }; /** * * @private */ Connection.prototype.closeConnections_ = function () { this.log_('Shutting down all connections'); if (this.conn_) { this.conn_.close(); this.conn_ = null; } if (this.secondaryConn_) { this.secondaryConn_.close(); this.secondaryConn_ = null; } if (this.healthyTimeout_) { clearTimeout(this.healthyTimeout_); this.healthyTimeout_ = null; } }; return Connection; }()); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Interface defining the set of actions that can be performed against the Firebase server * (basically corresponds to our wire protocol). * * @interface */ var ServerActions = /** @class */ (function () { function ServerActions() { } /** * @param {string} pathString * @param {*} data * @param {function(string, string)=} onComplete * @param {string=} hash */ ServerActions.prototype.put = function (pathString, data, onComplete, hash) { }; /** * @param {string} pathString * @param {*} data * @param {function(string, ?string)} onComplete * @param {string=} hash */ ServerActions.prototype.merge = function (pathString, data, onComplete, hash) { }; /** * Refreshes the auth token for the current connection. * @param {string} token The authentication token */ ServerActions.prototype.refreshAuthToken = function (token) { }; /** * @param {string} pathString * @param {*} data * @param {function(string, string)=} onComplete */ ServerActions.prototype.onDisconnectPut = function (pathString, data, onComplete) { }; /** * @param {string} pathString * @param {*} data * @param {function(string, string)=} onComplete */ ServerActions.prototype.onDisconnectMerge = function (pathString, data, onComplete) { }; /** * @param {string} pathString * @param {function(string, string)=} onComplete */ ServerActions.prototype.onDisconnectCancel = function (pathString, onComplete) { }; /** * @param {Object.<string, *>} stats */ ServerActions.prototype.reportStats = function (stats) { }; return ServerActions; }()); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var RECONNECT_MIN_DELAY = 1000; var RECONNECT_MAX_DELAY_DEFAULT = 60 * 5 * 1000; // 5 minutes in milliseconds (Case: 1858) var RECONNECT_MAX_DELAY_FOR_ADMINS = 30 * 1000; // 30 seconds for admin clients (likely to be a backend server) var RECONNECT_DELAY_MULTIPLIER = 1.3; var RECONNECT_DELAY_RESET_TIMEOUT = 30000; // Reset delay back to MIN_DELAY after being connected for 30sec. var SERVER_KILL_INTERRUPT_REASON = 'server_kill'; // If auth fails repeatedly, we'll assume something is wrong and log a warning / back off. var INVALID_AUTH_TOKEN_THRESHOLD = 3; /** * Firebase connection. Abstracts wire protocol and handles reconnecting. * * NOTE: All JSON objects sent to the realtime connection must have property names enclosed * in quotes to make sure the closure compiler does not minify them. */ var PersistentConnection = /** @class */ (function (_super) { tslib.__extends(PersistentConnection, _super); /** * @implements {ServerActions} * @param repoInfo_ Data about the namespace we are connecting to * @param applicationId_ The Firebase App ID for this project * @param onDataUpdate_ A callback for new data from the server */ function PersistentConnection(repoInfo_, applicationId_, onDataUpdate_, onConnectStatus_, onServerInfoUpdate_, authTokenProvider_, authOverride_) { var _this = _super.call(this) || this; _this.repoInfo_ = repoInfo_; _this.applicationId_ = applicationId_; _this.onDataUpdate_ = onDataUpdate_; _this.onConnectStatus_ = onConnectStatus_; _this.onServerInfoUpdate_ = onServerInfoUpdate_; _this.authTokenProvider_ = authTokenProvider_; _this.authOverride_ = authOverride_; // Used for diagnostic logging. _this.id = PersistentConnection.nextPersistentConnectionId_++; _this.log_ = logWrapper('p:' + _this.id + ':'); _this.interruptReasons_ = {}; /** Map<path, Map<queryId, ListenSpec>> */ _this.listens = new Map(); _this.outstandingPuts_ = []; _this.outstandingPutCount_ = 0; _this.onDisconnectRequestQueue_ = []; _this.connected_ = false; _this.reconnectDelay_ = RECONNECT_MIN_DELAY; _this.maxReconnectDelay_ = RECONNECT_MAX_DELAY_DEFAULT; _this.securityDebugCallback_ = null; _this.lastSessionId = null; _this.establishConnectionTimer_ = null; _this.visible_ = false; // Before we get connected, we keep a queue of pending messages to send. _this.requestCBHash_ = {}; _this.requestNumber_ = 0; _this.realtime_ = null; _this.authToken_ = null; _this.forceTokenRefresh_ = false; _this.invalidAuthTokenCount_ = 0; _this.firstConnection_ = true; _this.lastConnectionAttemptTime_ = null; _this.lastConnectionEstablishedTime_ = null; if (authOverride_ && !util.isNodeSdk()) { throw new Error('Auth override specified in options, but not supported on non Node.js platforms'); } _this.scheduleConnect_(0); VisibilityMonitor.getInstance().on('visible', _this.onVisible_, _this); if (repoInfo_.host.indexOf('fblocal') === -1) { OnlineMonitor.getInstance().on('online', _this.onOnline_, _this); } return _this; } PersistentConnection.prototype.sendRequest = function (action, body, onResponse) { var curReqNum = ++this.requestNumber_; var msg = { r: curReqNum, a: action, b: body }; this.log_(util.stringify(msg)); util.assert(this.connected_, "sendRequest call when we're not connected not allowed."); this.realtime_.sendRequest(msg); if (onResponse) { this.requestCBHash_[curReqNum] = onResponse; } }; /** * @inheritDoc */ PersistentConnection.prototype.listen = function (query, currentHashFn, tag, onComplete) { var queryId = query.queryIdentifier(); var pathString = query.path.toString(); this.log_('Listen called for ' + pathString + ' ' + queryId); if (!this.listens.has(pathString)) { this.listens.set(pathString, new Map()); } util.assert(query.getQueryParams().isDefault() || !query.getQueryParams().loadsAllData(), 'listen() called for non-default but complete query'); util.assert(!this.listens.get(pathString).has(queryId), 'listen() called twice for same path/queryId.'); var listenSpec = { onComplete: onComplete, hashFn: currentHashFn, query: query, tag: tag }; this.listens.get(pathString).set(queryId, listenSpec); if (this.connected_) { this.sendListen_(listenSpec); } }; PersistentConnection.prototype.sendListen_ = function (listenSpec) { var _this = this; var query = listenSpec.query; var pathString = query.path.toString(); var queryId = query.queryIdentifier(); this.log_('Listen on ' + pathString + ' for ' + queryId); var req = { /*path*/ p: pathString }; var action = 'q'; // Only bother to send query if it's non-default. if (listenSpec.tag) { req['q'] = query.queryObject(); req['t'] = listenSpec.tag; } req[ /*hash*/'h'] = listenSpec.hashFn(); this.sendRequest(action, req, function (message) { var payload = message[ /*data*/'d']; var status = message[ /*status*/'s']; // print warnings in any case... PersistentConnection.warnOnListenWarnings_(payload, query); var currentListenSpec = _this.listens.get(pathString) && _this.listens.get(pathString).get(queryId); // only trigger actions if the listen hasn't been removed and readded if (currentListenSpec === listenSpec) { _this.log_('listen response', message); if (status !== 'ok') { _this.removeListen_(pathString, queryId); } if (listenSpec.onComplete) { listenSpec.onComplete(status, payload); } } }); }; PersistentConnection.warnOnListenWarnings_ = function (payload, query) { if (payload && typeof payload === 'object' && util.contains(payload, 'w')) { // eslint-disable-next-line @typescript-eslint/no-explicit-any var warnings = util.safeGet(payload, 'w'); if (Array.isArray(warnings) && ~warnings.indexOf('no_index')) { var indexSpec = '".indexOn": "' + query.getQueryParams().getIndex().toString() + '"'; var indexPath = query.path.toString(); warn("Using an unspecified index. Your data will be downloaded and " + ("filtered on the client. Consider adding " + indexSpec + " at ") + (indexPath + " to your security rules for better performance.")); } } }; /** * @inheritDoc */ PersistentConnection.prototype.refreshAuthToken = function (token) { this.authToken_ = token; this.log_('Auth token refreshed'); if (this.authToken_) { this.tryAuth(); } else { //If we're connected we want to let the server know to unauthenticate us. If we're not connected, simply delete //the credential so we dont become authenticated next time we connect. if (this.connected_) { this.sendRequest('unauth', {}, function () { }); } } this.reduceReconnectDelayIfAdminCredential_(token); }; PersistentConnection.prototype.reduceReconnectDelayIfAdminCredential_ = function (credential) { // NOTE: This isn't intended to be bulletproof (a malicious developer can always just modify the client). // Additionally, we don't bother resetting the max delay back to the default if auth fails / expires. var isFirebaseSecret = credential && credential.length === 40; if (isFirebaseSecret || util.isAdmin(credential)) { this.log_('Admin auth credential detected. Reducing max reconnect time.'); this.maxReconnectDelay_ = RECONNECT_MAX_DELAY_FOR_ADMINS; } }; /** * Attempts to authenticate with the given credentials. If the authentication attempt fails, it's triggered like * a auth revoked (the connection is closed). */ PersistentConnection.prototype.tryAuth = function () { var _this = this; if (this.connected_ && this.authToken_) { var token_1 = this.authToken_; var authMethod = util.isValidFormat(token_1) ? 'auth' : 'gauth'; var requestData = { cred: token_1 }; if (this.authOverride_ === null) { requestData['noauth'] = true; } else if (typeof this.authOverride_ === 'object') { requestData['authvar'] = this.authOverride_; } this.sendRequest(authMethod, requestData, function (res) { var status = res[ /*status*/'s']; var data = res[ /*data*/'d'] || 'error'; if (_this.authToken_ === token_1) { if (status === 'ok') { _this.invalidAuthTokenCount_ = 0; } else { // Triggers reconnect and force refresh for auth token _this.onAuthRevoked_(status, data); } } }); } }; /** * @inheritDoc */ PersistentConnection.prototype.unlisten = function (query, tag) { var pathString = query.path.toString(); var queryId = query.queryIdentifier(); this.log_('Unlisten called for ' + pathString + ' ' + queryId); util.assert(query.getQueryParams().isDefault() || !query.getQueryParams().loadsAllData(), 'unlisten() called for non-default but complete query'); var listen = this.removeListen_(pathString, queryId); if (listen && this.connected_) { this.sendUnlisten_(pathString, queryId, query.queryObject(), tag); } }; PersistentConnection.prototype.sendUnlisten_ = function (pathString, queryId, queryObj, tag) { this.log_('Unlisten on ' + pathString + ' for ' + queryId); var req = { /*path*/ p: pathString }; var action = 'n'; // Only bother sending queryId if it's non-default. if (tag) { req['q'] = queryObj; req['t'] = tag; } this.sendRequest(action, req); }; /** * @inheritDoc */ PersistentConnection.prototype.onDisconnectPut = function (pathString, data, onComplete) { if (this.connected_) { this.sendOnDisconnect_('o', pathString, data, onComplete); } else { this.onDisconnectRequestQueue_.push({ pathString: pathString, action: 'o', data: data, onComplete: onComplete }); } }; /** * @inheritDoc */ PersistentConnection.prototype.onDisconnectMerge = function (pathString, data, onComplete) { if (this.connected_) { this.sendOnDisconnect_('om', pathString, data, onComplete); } else { this.onDisconnectRequestQueue_.push({ pathString: pathString, action: 'om', data: data, onComplete: onComplete }); } }; /** * @inheritDoc */ PersistentConnection.prototype.onDisconnectCancel = function (pathString, onComplete) { if (this.connected_) { this.sendOnDisconnect_('oc', pathString, null, onComplete); } else { this.onDisconnectRequestQueue_.push({ pathString: pathString, action: 'oc', data: null, onComplete: onComplete }); } }; PersistentConnection.prototype.sendOnDisconnect_ = function (action, pathString, data, onComplete) { var request = { /*path*/ p: pathString, /*data*/ d: data }; this.log_('onDisconnect ' + action, request); this.sendRequest(action, request, function (response) { if (onComplete) { setTimeout(function () { onComplete(response[ /*status*/'s'], response[ /* data */'d']); }, Math.floor(0)); } }); }; /** * @inheritDoc */ PersistentConnection.prototype.put = function (pathString, data, onComplete, hash) { this.putInternal('p', pathString, data, onComplete, hash); }; /** * @inheritDoc */ PersistentConnection.prototype.merge = function (pathString, data, onComplete, hash) { this.putInternal('m', pathString, data, onComplete, hash); }; PersistentConnection.prototype.putInternal = function (action, pathString, data, onComplete, hash) { var request = { /*path*/ p: pathString, /*data*/ d: data }; if (hash !== undefined) { request[ /*hash*/'h'] = hash; } // TODO: Only keep track of the most recent put for a given path? this.outstandingPuts_.push({ action: action, request: request, onComplete: onComplete }); this.outstandingPutCount_++; var index = this.outstandingPuts_.length - 1; if (this.connected_) { this.sendPut_(index); } else { this.log_('Buffering put: ' + pathString); } }; PersistentConnection.prototype.sendPut_ = function (index) { var _this = this; var action = this.outstandingPuts_[index].action; var request = this.outstandingPuts_[index].request; var onComplete = this.outstandingPuts_[index].onComplete; this.outstandingPuts_[index].queued = this.connected_; this.sendRequest(action, request, function (message) { _this.log_(action + ' response', message); delete _this.outstandingPuts_[index]; _this.outstandingPutCount_--; // Clean up array occasionally. if (_this.outstandingPutCount_ === 0) { _this.outstandingPuts_ = []; } if (onComplete) { onComplete(message[ /*status*/'s'], message[ /* data */'d']); } }); }; /** * @inheritDoc */ PersistentConnection.prototype.reportStats = function (stats) { var _this = this; // If we're not connected, we just drop the stats. if (this.connected_) { var request = { /*counters*/ c: stats }; this.log_('reportStats', request); this.sendRequest(/*stats*/ 's', request, function (result) { var status = result[ /*status*/'s']; if (status !== 'ok') { var errorReason = result[ /* data */'d']; _this.log_('reportStats', 'Error sending stats: ' + errorReason); } }); } }; PersistentConnection.prototype.onDataMessage_ = function (message) { if ('r' in message) { // this is a response this.log_('from server: ' + util.stringify(message)); var reqNum = message['r']; var onResponse = this.requestCBHash_[reqNum]; if (onResponse) { delete this.requestCBHash_[reqNum]; onResponse(message[ /*body*/'b']); } } else if ('error' in message) { throw 'A server-side error has occurred: ' + message['error']; } else if ('a' in message) { // a and b are action and body, respectively this.onDataPush_(message['a'], message['b']); } }; PersistentConnection.prototype.onDataPush_ = function (action, body) { this.log_('handleServerMessage', action, body); if (action === 'd') { this.onDataUpdate_(body[ /*path*/'p'], body[ /*data*/'d'], /*isMerge*/ false, body['t']); } else if (action === 'm') { this.onDataUpdate_(body[ /*path*/'p'], body[ /*data*/'d'], /*isMerge=*/ true, body['t']); } else if (action === 'c') { this.onListenRevoked_(body[ /*path*/'p'], body[ /*query*/'q']); } else if (action === 'ac') { this.onAuthRevoked_(body[ /*status code*/'s'], body[ /* explanation */'d']); } else if (action === 'sd') { this.onSecurityDebugPacket_(body); } else { error('Unrecognized action received from server: ' + util.stringify(action) + '\nAre you using the latest client?'); } }; PersistentConnection.prototype.onReady_ = function (timestamp, sessionId) { this.log_('connection ready'); this.connected_ = true; this.lastConnectionEstablishedTime_ = new Date().getTime(); this.handleTimestamp_(timestamp); this.lastSessionId = sessionId; if (this.firstConnection_) { this.sendConnectStats_(); } this.restoreState_(); this.firstConnection_ = false; this.onConnectStatus_(true); }; PersistentConnection.prototype.scheduleConnect_ = function (timeout) { var _this = this; util.assert(!this.realtime_, "Scheduling a connect when we're already connected/ing?"); if (this.establishConnectionTimer_) { clearTimeout(this.establishConnectionTimer_); } // NOTE: Even when timeout is 0, it's important to do a setTimeout to work around an infuriating "Security Error" in // Firefox when trying to write to our long-polling iframe in some scenarios (e.g. Forge or our unit tests). this.establishConnectionTimer_ = setTimeout(function () { _this.establishConnectionTimer_ = null; _this.establishConnection_(); // eslint-disable-next-line @typescript-eslint/no-explicit-any }, Math.floor(timeout)); }; PersistentConnection.prototype.onVisible_ = function (visible) { // NOTE: Tabbing away and back to a window will defeat our reconnect backoff, but I think that's fine. if (visible && !this.visible_ && this.reconnectDelay_ === this.maxReconnectDelay_) { this.log_('Window became visible. Reducing delay.'); this.reconnectDelay_ = RECONNECT_MIN_DELAY; if (!this.realtime_) { this.scheduleConnect_(0); } } this.visible_ = visible; }; PersistentConnection.prototype.onOnline_ = function (online) { if (online) { this.log_('Browser went online.'); this.reconnectDelay_ = RECONNECT_MIN_DELAY; if (!this.realtime_) { this.scheduleConnect_(0); } } else { this.log_('Browser went offline. Killing connection.'); if (this.realtime_) { this.realtime_.close(); } } }; PersistentConnection.prototype.onRealtimeDisconnect_ = function () { this.log_('data client disconnected'); this.connected_ = false; this.realtime_ = null; // Since we don't know if our sent transactions succeeded or not, we need to cancel them. this.cancelSentTransactions_(); // Clear out the pending requests. this.requestCBHash_ = {}; if (this.shouldReconnect_()) { if (!this.visible_) { this.log_("Window isn't visible. Delaying reconnect."); this.reconnectDelay_ = this.maxReconnectDelay_; this.lastConnectionAttemptTime_ = new Date().getTime(); } else if (this.lastConnectionEstablishedTime_) { // If we've been connected long enough, reset reconnect delay to minimum. var timeSinceLastConnectSucceeded = new Date().getTime() - this.lastConnectionEstablishedTime_; if (timeSinceLastConnectSucceeded > RECONNECT_DELAY_RESET_TIMEOUT) { this.reconnectDelay_ = RECONNECT_MIN_DELAY; } this.lastConnectionEstablishedTime_ = null; } var timeSinceLastConnectAttempt = new Date().getTime() - this.lastConnectionAttemptTime_; var reconnectDelay = Math.max(0, this.reconnectDelay_ - timeSinceLastConnectAttempt); reconnectDelay = Math.random() * reconnectDelay; this.log_('Trying to reconnect in ' + reconnectDelay + 'ms'); this.scheduleConnect_(reconnectDelay); // Adjust reconnect delay for next time. this.reconnectDelay_ = Math.min(this.maxReconnectDelay_, this.reconnectDelay_ * RECONNECT_DELAY_MULTIPLIER); } this.onConnectStatus_(false); }; PersistentConnection.prototype.establishConnection_ = function () { var _this = this; if (this.shouldReconnect_()) { this.log_('Making a connection attempt'); this.lastConnectionAttemptTime_ = new Date().getTime(); this.lastConnectionEstablishedTime_ = null; var onDataMessage_1 = this.onDataMessage_.bind(this); var onReady_1 = this.onReady_.bind(this); var onDisconnect_1 = this.onRealtimeDisconnect_.bind(this); var connId_1 = this.id + ':' + PersistentConnection.nextConnectionId_++; var self_1 = this; var lastSessionId_1 = this.lastSessionId; var canceled_1 = false; var connection_1 = null; var closeFn_1 = function () { if (connection_1) { connection_1.close(); } else { canceled_1 = true; onDisconnect_1(); } }; var sendRequestFn = function (msg) { util.assert(connection_1, "sendRequest call when we're not connected not allowed."); connection_1.sendRequest(msg); }; this.realtime_ = { close: closeFn_1, sendRequest: sendRequestFn }; var forceRefresh = this.forceTokenRefresh_; this.forceTokenRefresh_ = false; // First fetch auth token, and establish connection after fetching the token was successful this.authTokenProvider_ .getToken(forceRefresh) .then(function (result) { if (!canceled_1) { log('getToken() completed. Creating connection.'); self_1.authToken_ = result && result.accessToken; connection_1 = new Connection(connId_1, self_1.repoInfo_, self_1.applicationId_, onDataMessage_1, onReady_1, onDisconnect_1, /* onKill= */ function (reason) { warn(reason + ' (' + self_1.repoInfo_.toString() + ')'); self_1.interrupt(SERVER_KILL_INTERRUPT_REASON); }, lastSessionId_1); } else { log('getToken() completed but was canceled'); } }) .then(null, function (error) { self_1.log_('Failed to get token: ' + error); if (!canceled_1) { if (_this.repoInfo_.nodeAdmin) { // This may be a critical error for the Admin Node.js SDK, so log a warning. // But getToken() may also just have temporarily failed, so we still want to // continue retrying. warn(error); } closeFn_1(); } }); } }; PersistentConnection.prototype.interrupt = function (reason) { log('Interrupting connection for reason: ' + reason); this.interruptReasons_[reason] = true; if (this.realtime_) { this.realtime_.close(); } else { if (this.establishConnectionTimer_) { clearTimeout(this.establishConnectionTimer_); this.establishConnectionTimer_ = null; } if (this.connected_) { this.onRealtimeDisconnect_(); } } }; PersistentConnection.prototype.resume = function (reason) { log('Resuming connection for reason: ' + reason); delete this.interruptReasons_[reason]; if (util.isEmpty(this.interruptReasons_)) { this.reconnectDelay_ = RECONNECT_MIN_DELAY; if (!this.realtime_) { this.scheduleConnect_(0); } } }; PersistentConnection.prototype.handleTimestamp_ = function (timestamp) { var delta = timestamp - new Date().getTime(); this.onServerInfoUpdate_({ serverTimeOffset: delta }); }; PersistentConnection.prototype.cancelSentTransactions_ = function () { for (var i = 0; i < this.outstandingPuts_.length; i++) { var put = this.outstandingPuts_[i]; if (put && /*hash*/ 'h' in put.request && put.queued) { if (put.onComplete) { put.onComplete('disconnect'); } delete this.outstandingPuts_[i]; this.outstandingPutCount_--; } } // Clean up array occasionally. if (this.outstandingPutCount_ === 0) { this.outstandingPuts_ = []; } }; PersistentConnection.prototype.onListenRevoked_ = function (pathString, query) { // Remove the listen and manufacture a "permission_denied" error for the failed listen. var queryId; if (!query) { queryId = 'default'; } else { queryId = query.map(function (q) { return ObjectToUniqueKey(q); }).join('$'); } var listen = this.removeListen_(pathString, queryId); if (listen && listen.onComplete) { listen.onComplete('permission_denied'); } }; PersistentConnection.prototype.removeListen_ = function (pathString, queryId) { var normalizedPathString = new Path(pathString).toString(); // normalize path. var listen; if (this.listens.has(normalizedPathString)) { var map = this.listens.get(normalizedPathString); listen = map.get(queryId); map.delete(queryId); if (map.size === 0) { this.listens.delete(normalizedPathString); } } else { // all listens for this path has already been removed listen = undefined; } return listen; }; PersistentConnection.prototype.onAuthRevoked_ = function (statusCode, explanation) { log('Auth token revoked: ' + statusCode + '/' + explanation); this.authToken_ = null; this.forceTokenRefresh_ = true; this.realtime_.close(); if (statusCode === 'invalid_token' || statusCode === 'permission_denied') { // We'll wait a couple times before logging the warning / increasing the // retry period since oauth tokens will report as "invalid" if they're // just expired. Plus there may be transient issues that resolve themselves. this.invalidAuthTokenCount_++; if (this.invalidAuthTokenCount_ >= INVALID_AUTH_TOKEN_THRESHOLD) { // Set a long reconnect delay because recovery is unlikely this.reconnectDelay_ = RECONNECT_MAX_DELAY_FOR_ADMINS; // Notify the auth token provider that the token is invalid, which will log // a warning this.authTokenProvider_.notifyForInvalidToken(); } } }; PersistentConnection.prototype.onSecurityDebugPacket_ = function (body) { if (this.securityDebugCallback_) { this.securityDebugCallback_(body); } else { if ('msg' in body) { console.log('FIREBASE: ' + body['msg'].replace('\n', '\nFIREBASE: ')); } } }; PersistentConnection.prototype.restoreState_ = function () { var e_1, _a, e_2, _b; //Re-authenticate ourselves if we have a credential stored. this.tryAuth(); try { // Puts depend on having received the corresponding data update from the server before they complete, so we must // make sure to send listens before puts. for (var _c = tslib.__values(this.listens.values()), _d = _c.next(); !_d.done; _d = _c.next()) { var queries = _d.value; try { for (var _e = (e_2 = void 0, tslib.__values(queries.values())), _f = _e.next(); !_f.done; _f = _e.next()) { var listenSpec = _f.value; this.sendListen_(listenSpec); } } catch (e_2_1) { e_2 = { error: e_2_1 }; } finally { try { if (_f && !_f.done && (_b = _e.return)) _b.call(_e); } finally { if (e_2) throw e_2.error; } } } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (_d && !_d.done && (_a = _c.return)) _a.call(_c); } finally { if (e_1) throw e_1.error; } } for (var i = 0; i < this.outstandingPuts_.length; i++) { if (this.outstandingPuts_[i]) { this.sendPut_(i); } } while (this.onDisconnectRequestQueue_.length) { var request = this.onDisconnectRequestQueue_.shift(); this.sendOnDisconnect_(request.action, request.pathString, request.data, request.onComplete); } }; /** * Sends client stats for first connection */ PersistentConnection.prototype.sendConnectStats_ = function () { var stats = {}; var clientName = 'js'; if (util.isNodeSdk()) { if (this.repoInfo_.nodeAdmin) { clientName = 'admin_node'; } else { clientName = 'node'; } } stats['sdk.' + clientName + '.' + SDK_VERSION.replace(/\./g, '-')] = 1; if (util.isMobileCordova()) { stats['framework.cordova'] = 1; } else if (util.isReactNative()) { stats['framework.reactnative'] = 1; } this.reportStats(stats); }; PersistentConnection.prototype.shouldReconnect_ = function () { var online = OnlineMonitor.getInstance().currentlyOnline(); return util.isEmpty(this.interruptReasons_) && online; }; PersistentConnection.nextPersistentConnectionId_ = 0; /** * Counter for number of connections created. Mainly used for tagging in the logs */ PersistentConnection.nextConnectionId_ = 0; return PersistentConnection; }(ServerActions)); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * An implementation of ServerActions that communicates with the server via REST requests. * This is mostly useful for compatibility with crawlers, where we don't want to spin up a full * persistent connection (using WebSockets or long-polling) */ var ReadonlyRestClient = /** @class */ (function (_super) { tslib.__extends(ReadonlyRestClient, _super); /** * @param {!RepoInfo} repoInfo_ Data about the namespace we are connecting to * @param {function(string, *, boolean, ?number)} onDataUpdate_ A callback for new data from the server * @param {AuthTokenProvider} authTokenProvider_ * @implements {ServerActions} */ function ReadonlyRestClient(repoInfo_, onDataUpdate_, authTokenProvider_) { var _this = _super.call(this) || this; _this.repoInfo_ = repoInfo_; _this.onDataUpdate_ = onDataUpdate_; _this.authTokenProvider_ = authTokenProvider_; /** @private {function(...[*])} */ _this.log_ = logWrapper('p:rest:'); /** * We don't actually need to track listens, except to prevent us calling an onComplete for a listen * that's been removed. :-/ * * @private {!Object.<string, !Object>} */ _this.listens_ = {}; return _this; } ReadonlyRestClient.prototype.reportStats = function (stats) { throw new Error('Method not implemented.'); }; /** * @param {!Query} query * @param {?number=} tag * @return {string} * @private */ ReadonlyRestClient.getListenId_ = function (query, tag) { if (tag !== undefined) { return 'tag$' + tag; } else { util.assert(query.getQueryParams().isDefault(), "should have a tag if it's not a default query."); return query.path.toString(); } }; /** @inheritDoc */ ReadonlyRestClient.prototype.listen = function (query, currentHashFn, tag, onComplete) { var _this = this; var pathString = query.path.toString(); this.log_('Listen called for ' + pathString + ' ' + query.queryIdentifier()); // Mark this listener so we can tell if it's removed. var listenId = ReadonlyRestClient.getListenId_(query, tag); var thisListen = {}; this.listens_[listenId] = thisListen; var queryStringParameters = query .getQueryParams() .toRestQueryStringParameters(); this.restRequest_(pathString + '.json', queryStringParameters, function (error, result) { var data = result; if (error === 404) { data = null; error = null; } if (error === null) { _this.onDataUpdate_(pathString, data, /*isMerge=*/ false, tag); } if (util.safeGet(_this.listens_, listenId) === thisListen) { var status_1; if (!error) { status_1 = 'ok'; } else if (error === 401) { status_1 = 'permission_denied'; } else { status_1 = 'rest_error:' + error; } onComplete(status_1, null); } }); }; /** @inheritDoc */ ReadonlyRestClient.prototype.unlisten = function (query, tag) { var listenId = ReadonlyRestClient.getListenId_(query, tag); delete this.listens_[listenId]; }; /** @inheritDoc */ ReadonlyRestClient.prototype.refreshAuthToken = function (token) { // no-op since we just always call getToken. }; /** * Performs a REST request to the given path, with the provided query string parameters, * and any auth credentials we have. * * @param {!string} pathString * @param {!Object.<string, *>} queryStringParameters * @param {?function(?number, *=)} callback * @private */ ReadonlyRestClient.prototype.restRequest_ = function (pathString, queryStringParameters, callback) { var _this = this; if (queryStringParameters === void 0) { queryStringParameters = {}; } queryStringParameters['format'] = 'export'; this.authTokenProvider_ .getToken(/*forceRefresh=*/ false) .then(function (authTokenData) { var authToken = authTokenData && authTokenData.accessToken; if (authToken) { queryStringParameters['auth'] = authToken; } var url = (_this.repoInfo_.secure ? 'https://' : 'http://') + _this.repoInfo_.host + pathString + '?' + 'ns=' + _this.repoInfo_.namespace + util.querystring(queryStringParameters); _this.log_('Sending REST request for ' + url); var xhr = new XMLHttpRequest(); xhr.onreadystatechange = function () { if (callback && xhr.readyState === 4) { _this.log_('REST Response for ' + url + ' received. status:', xhr.status, 'response:', xhr.responseText); var res = null; if (xhr.status >= 200 && xhr.status < 300) { try { res = util.jsonEval(xhr.responseText); } catch (e) { warn('Failed to parse JSON response for ' + url + ': ' + xhr.responseText); } callback(null, res); } else { // 401 and 404 are expected. if (xhr.status !== 401 && xhr.status !== 404) { warn('Got unsuccessful REST response for ' + url + ' Status: ' + xhr.status); } callback(xhr.status); } callback = null; } }; xhr.open('GET', url, /*asynchronous=*/ true); xhr.send(); }); }; return ReadonlyRestClient; }(ServerActions)); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var INTERRUPT_REASON = 'repo_interrupt'; /** * A connection to a single data repository. */ var Repo = /** @class */ (function () { function Repo(repoInfo_, forceRestClient, app, authTokenProvider) { var _this = this; this.repoInfo_ = repoInfo_; this.app = app; this.dataUpdateCount = 0; this.statsListener_ = null; this.eventQueue_ = new EventQueue(); this.nextWriteId_ = 1; this.interceptServerDataCallback_ = null; /** A list of data pieces and paths to be set when this client disconnects. */ this.onDisconnect_ = new SparseSnapshotTree(); // TODO: This should be @private but it's used by test_access.js and internal.js this.persistentConnection_ = null; this.stats_ = StatsManager.getCollection(repoInfo_); if (forceRestClient || beingCrawled()) { this.server_ = new ReadonlyRestClient(this.repoInfo_, this.onDataUpdate_.bind(this), authTokenProvider); // Minor hack: Fire onConnect immediately, since there's no actual connection. setTimeout(this.onConnectStatus_.bind(this, true), 0); } else { var authOverride = app.options['databaseAuthVariableOverride']; // Validate authOverride if (typeof authOverride !== 'undefined' && authOverride !== null) { if (typeof authOverride !== 'object') { throw new Error('Only objects are supported for option databaseAuthVariableOverride'); } try { util.stringify(authOverride); } catch (e) { throw new Error('Invalid authOverride provided: ' + e); } } this.persistentConnection_ = new PersistentConnection(this.repoInfo_, app.options.appId, this.onDataUpdate_.bind(this), this.onConnectStatus_.bind(this), this.onServerInfoUpdate_.bind(this), authTokenProvider, authOverride); this.server_ = this.persistentConnection_; } authTokenProvider.addTokenChangeListener(function (token) { _this.server_.refreshAuthToken(token); }); // In the case of multiple Repos for the same repoInfo (i.e. there are multiple Firebase.Contexts being used), // we only want to create one StatsReporter. As such, we'll report stats over the first Repo created. this.statsReporter_ = StatsManager.getOrCreateReporter(repoInfo_, function () { return new StatsReporter(_this.stats_, _this.server_); }); this.transactionsInit_(); // Used for .info. this.infoData_ = new SnapshotHolder(); this.infoSyncTree_ = new SyncTree({ startListening: function (query, tag, currentHashFn, onComplete) { var infoEvents = []; var node = _this.infoData_.getNode(query.path); // This is possibly a hack, but we have different semantics for .info endpoints. We don't raise null events // on initial data... if (!node.isEmpty()) { infoEvents = _this.infoSyncTree_.applyServerOverwrite(query.path, node); setTimeout(function () { onComplete('ok'); }, 0); } return infoEvents; }, stopListening: function () { } }); this.updateInfo_('connected', false); this.serverSyncTree_ = new SyncTree({ startListening: function (query, tag, currentHashFn, onComplete) { _this.server_.listen(query, currentHashFn, tag, function (status, data) { var events = onComplete(status, data); _this.eventQueue_.raiseEventsForChangedPath(query.path, events); }); // No synchronous events for network-backed sync trees return []; }, stopListening: function (query, tag) { _this.server_.unlisten(query, tag); } }); } /** * @return The URL corresponding to the root of this Firebase. */ Repo.prototype.toString = function () { return ((this.repoInfo_.secure ? 'https://' : 'http://') + this.repoInfo_.host); }; /** * @return The namespace represented by the repo. */ Repo.prototype.name = function () { return this.repoInfo_.namespace; }; /** * @return The time in milliseconds, taking the server offset into account if we have one. */ Repo.prototype.serverTime = function () { var offsetNode = this.infoData_.getNode(new Path('.info/serverTimeOffset')); var offset = offsetNode.val() || 0; return new Date().getTime() + offset; }; /** * Generate ServerValues using some variables from the repo object. */ Repo.prototype.generateServerValues = function () { return generateWithValues({ timestamp: this.serverTime() }); }; /** * Called by realtime when we get new messages from the server. */ Repo.prototype.onDataUpdate_ = function (pathString, data, isMerge, tag) { // For testing. this.dataUpdateCount++; var path = new Path(pathString); data = this.interceptServerDataCallback_ ? this.interceptServerDataCallback_(pathString, data) : data; var events = []; if (tag) { if (isMerge) { var taggedChildren = util.map(data, function (raw) { return nodeFromJSON$1(raw); }); events = this.serverSyncTree_.applyTaggedQueryMerge(path, taggedChildren, tag); } else { var taggedSnap = nodeFromJSON$1(data); events = this.serverSyncTree_.applyTaggedQueryOverwrite(path, taggedSnap, tag); } } else if (isMerge) { var changedChildren = util.map(data, function (raw) { return nodeFromJSON$1(raw); }); events = this.serverSyncTree_.applyServerMerge(path, changedChildren); } else { var snap = nodeFromJSON$1(data); events = this.serverSyncTree_.applyServerOverwrite(path, snap); } var affectedPath = path; if (events.length > 0) { // Since we have a listener outstanding for each transaction, receiving any events // is a proxy for some change having occurred. affectedPath = this.rerunTransactions_(path); } this.eventQueue_.raiseEventsForChangedPath(affectedPath, events); }; // TODO: This should be @private but it's used by test_access.js and internal.js Repo.prototype.interceptServerData_ = function (callback) { this.interceptServerDataCallback_ = callback; }; Repo.prototype.onConnectStatus_ = function (connectStatus) { this.updateInfo_('connected', connectStatus); if (connectStatus === false) { this.runOnDisconnectEvents_(); } }; Repo.prototype.onServerInfoUpdate_ = function (updates) { var _this = this; each(updates, function (key, value) { _this.updateInfo_(key, value); }); }; Repo.prototype.updateInfo_ = function (pathString, value) { var path = new Path('/.info/' + pathString); var newNode = nodeFromJSON$1(value); this.infoData_.updateSnapshot(path, newNode); var events = this.infoSyncTree_.applyServerOverwrite(path, newNode); this.eventQueue_.raiseEventsForChangedPath(path, events); }; Repo.prototype.getNextWriteId_ = function () { return this.nextWriteId_++; }; Repo.prototype.setWithPriority = function (path, newVal, newPriority, onComplete) { var _this = this; this.log_('set', { path: path.toString(), value: newVal, priority: newPriority }); // TODO: Optimize this behavior to either (a) store flag to skip resolving where possible and / or // (b) store unresolved paths on JSON parse var serverValues = this.generateServerValues(); var newNodeUnresolved = nodeFromJSON$1(newVal, newPriority); var existing = this.serverSyncTree_.calcCompleteEventCache(path); var newNode = resolveDeferredValueSnapshot(newNodeUnresolved, existing, serverValues); var writeId = this.getNextWriteId_(); var events = this.serverSyncTree_.applyUserOverwrite(path, newNode, writeId, true); this.eventQueue_.queueEvents(events); this.server_.put(path.toString(), newNodeUnresolved.val(/*export=*/ true), function (status, errorReason) { var success = status === 'ok'; if (!success) { warn('set at ' + path + ' failed: ' + status); } var clearEvents = _this.serverSyncTree_.ackUserWrite(writeId, !success); _this.eventQueue_.raiseEventsForChangedPath(path, clearEvents); _this.callOnCompleteCallback(onComplete, status, errorReason); }); var affectedPath = this.abortTransactions_(path); this.rerunTransactions_(affectedPath); // We queued the events above, so just flush the queue here this.eventQueue_.raiseEventsForChangedPath(affectedPath, []); }; Repo.prototype.update = function (path, childrenToMerge, onComplete) { var _this = this; this.log_('update', { path: path.toString(), value: childrenToMerge }); // Start with our existing data and merge each child into it. var empty = true; var serverValues = this.generateServerValues(); var changedChildren = {}; each(childrenToMerge, function (changedKey, changedValue) { empty = false; changedChildren[changedKey] = resolveDeferredValueTree(path.child(changedKey), nodeFromJSON$1(changedValue), _this.serverSyncTree_, serverValues); }); if (!empty) { var writeId_1 = this.getNextWriteId_(); var events = this.serverSyncTree_.applyUserMerge(path, changedChildren, writeId_1); this.eventQueue_.queueEvents(events); this.server_.merge(path.toString(), childrenToMerge, function (status, errorReason) { var success = status === 'ok'; if (!success) { warn('update at ' + path + ' failed: ' + status); } var clearEvents = _this.serverSyncTree_.ackUserWrite(writeId_1, !success); var affectedPath = clearEvents.length > 0 ? _this.rerunTransactions_(path) : path; _this.eventQueue_.raiseEventsForChangedPath(affectedPath, clearEvents); _this.callOnCompleteCallback(onComplete, status, errorReason); }); each(childrenToMerge, function (changedPath) { var affectedPath = _this.abortTransactions_(path.child(changedPath)); _this.rerunTransactions_(affectedPath); }); // We queued the events above, so just flush the queue here this.eventQueue_.raiseEventsForChangedPath(path, []); } else { log("update() called with empty data. Don't do anything."); this.callOnCompleteCallback(onComplete, 'ok'); } }; /** * Applies all of the changes stored up in the onDisconnect_ tree. */ Repo.prototype.runOnDisconnectEvents_ = function () { var _this = this; this.log_('onDisconnectEvents'); var serverValues = this.generateServerValues(); var resolvedOnDisconnectTree = new SparseSnapshotTree(); this.onDisconnect_.forEachTree(Path.Empty, function (path, node) { var resolved = resolveDeferredValueTree(path, node, _this.serverSyncTree_, serverValues); resolvedOnDisconnectTree.remember(path, resolved); }); var events = []; resolvedOnDisconnectTree.forEachTree(Path.Empty, function (path, snap) { events = events.concat(_this.serverSyncTree_.applyServerOverwrite(path, snap)); var affectedPath = _this.abortTransactions_(path); _this.rerunTransactions_(affectedPath); }); this.onDisconnect_ = new SparseSnapshotTree(); this.eventQueue_.raiseEventsForChangedPath(Path.Empty, events); }; Repo.prototype.onDisconnectCancel = function (path, onComplete) { var _this = this; this.server_.onDisconnectCancel(path.toString(), function (status, errorReason) { if (status === 'ok') { _this.onDisconnect_.forget(path); } _this.callOnCompleteCallback(onComplete, status, errorReason); }); }; Repo.prototype.onDisconnectSet = function (path, value, onComplete) { var _this = this; var newNode = nodeFromJSON$1(value); this.server_.onDisconnectPut(path.toString(), newNode.val(/*export=*/ true), function (status, errorReason) { if (status === 'ok') { _this.onDisconnect_.remember(path, newNode); } _this.callOnCompleteCallback(onComplete, status, errorReason); }); }; Repo.prototype.onDisconnectSetWithPriority = function (path, value, priority, onComplete) { var _this = this; var newNode = nodeFromJSON$1(value, priority); this.server_.onDisconnectPut(path.toString(), newNode.val(/*export=*/ true), function (status, errorReason) { if (status === 'ok') { _this.onDisconnect_.remember(path, newNode); } _this.callOnCompleteCallback(onComplete, status, errorReason); }); }; Repo.prototype.onDisconnectUpdate = function (path, childrenToMerge, onComplete) { var _this = this; if (util.isEmpty(childrenToMerge)) { log("onDisconnect().update() called with empty data. Don't do anything."); this.callOnCompleteCallback(onComplete, 'ok'); return; } this.server_.onDisconnectMerge(path.toString(), childrenToMerge, function (status, errorReason) { if (status === 'ok') { each(childrenToMerge, function (childName, childNode) { var newChildNode = nodeFromJSON$1(childNode); _this.onDisconnect_.remember(path.child(childName), newChildNode); }); } _this.callOnCompleteCallback(onComplete, status, errorReason); }); }; Repo.prototype.addEventCallbackForQuery = function (query, eventRegistration) { var events; if (query.path.getFront() === '.info') { events = this.infoSyncTree_.addEventRegistration(query, eventRegistration); } else { events = this.serverSyncTree_.addEventRegistration(query, eventRegistration); } this.eventQueue_.raiseEventsAtPath(query.path, events); }; Repo.prototype.removeEventCallbackForQuery = function (query, eventRegistration) { // These are guaranteed not to raise events, since we're not passing in a cancelError. However, we can future-proof // a little bit by handling the return values anyways. var events; if (query.path.getFront() === '.info') { events = this.infoSyncTree_.removeEventRegistration(query, eventRegistration); } else { events = this.serverSyncTree_.removeEventRegistration(query, eventRegistration); } this.eventQueue_.raiseEventsAtPath(query.path, events); }; Repo.prototype.interrupt = function () { if (this.persistentConnection_) { this.persistentConnection_.interrupt(INTERRUPT_REASON); } }; Repo.prototype.resume = function () { if (this.persistentConnection_) { this.persistentConnection_.resume(INTERRUPT_REASON); } }; Repo.prototype.stats = function (showDelta) { if (showDelta === void 0) { showDelta = false; } if (typeof console === 'undefined') { return; } var stats; if (showDelta) { if (!this.statsListener_) { this.statsListener_ = new StatsListener(this.stats_); } stats = this.statsListener_.get(); } else { stats = this.stats_.get(); } var longestName = Object.keys(stats).reduce(function (previousValue, currentValue) { return Math.max(currentValue.length, previousValue); }, 0); each(stats, function (stat, value) { var paddedStat = stat; // pad stat names to be the same length (plus 2 extra spaces). for (var i = stat.length; i < longestName + 2; i++) { paddedStat += ' '; } console.log(paddedStat + value); }); }; Repo.prototype.statsIncrementCounter = function (metric) { this.stats_.incrementCounter(metric); this.statsReporter_.includeStat(metric); }; Repo.prototype.log_ = function () { var varArgs = []; for (var _i = 0; _i < arguments.length; _i++) { varArgs[_i] = arguments[_i]; } var prefix = ''; if (this.persistentConnection_) { prefix = this.persistentConnection_.id + ':'; } log.apply(void 0, tslib.__spread([prefix], varArgs)); }; Repo.prototype.callOnCompleteCallback = function (callback, status, errorReason) { if (callback) { exceptionGuard(function () { if (status === 'ok') { callback(null); } else { var code = (status || 'error').toUpperCase(); var message = code; if (errorReason) { message += ': ' + errorReason; } var error = new Error(message); // eslint-disable-next-line @typescript-eslint/no-explicit-any error.code = code; callback(error); } }); } }; Object.defineProperty(Repo.prototype, "database", { get: function () { return this.__database || (this.__database = new Database(this)); }, enumerable: false, configurable: true }); return Repo; }()); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Filters nodes by range and uses an IndexFilter to track any changes after filtering the node * * @constructor * @implements {NodeFilter} */ var RangedFilter = /** @class */ (function () { /** * @param {!QueryParams} params */ function RangedFilter(params) { this.indexedFilter_ = new IndexedFilter(params.getIndex()); this.index_ = params.getIndex(); this.startPost_ = RangedFilter.getStartPost_(params); this.endPost_ = RangedFilter.getEndPost_(params); } /** * @return {!NamedNode} */ RangedFilter.prototype.getStartPost = function () { return this.startPost_; }; /** * @return {!NamedNode} */ RangedFilter.prototype.getEndPost = function () { return this.endPost_; }; /** * @param {!NamedNode} node * @return {boolean} */ RangedFilter.prototype.matches = function (node) { return (this.index_.compare(this.getStartPost(), node) <= 0 && this.index_.compare(node, this.getEndPost()) <= 0); }; /** * @inheritDoc */ RangedFilter.prototype.updateChild = function (snap, key, newChild, affectedPath, source, optChangeAccumulator) { if (!this.matches(new NamedNode(key, newChild))) { newChild = ChildrenNode.EMPTY_NODE; } return this.indexedFilter_.updateChild(snap, key, newChild, affectedPath, source, optChangeAccumulator); }; /** * @inheritDoc */ RangedFilter.prototype.updateFullNode = function (oldSnap, newSnap, optChangeAccumulator) { if (newSnap.isLeafNode()) { // Make sure we have a children node with the correct index, not a leaf node; newSnap = ChildrenNode.EMPTY_NODE; } var filtered = newSnap.withIndex(this.index_); // Don't support priorities on queries filtered = filtered.updatePriority(ChildrenNode.EMPTY_NODE); var self = this; newSnap.forEachChild(PRIORITY_INDEX, function (key, childNode) { if (!self.matches(new NamedNode(key, childNode))) { filtered = filtered.updateImmediateChild(key, ChildrenNode.EMPTY_NODE); } }); return this.indexedFilter_.updateFullNode(oldSnap, filtered, optChangeAccumulator); }; /** * @inheritDoc */ RangedFilter.prototype.updatePriority = function (oldSnap, newPriority) { // Don't support priorities on queries return oldSnap; }; /** * @inheritDoc */ RangedFilter.prototype.filtersNodes = function () { return true; }; /** * @inheritDoc */ RangedFilter.prototype.getIndexedFilter = function () { return this.indexedFilter_; }; /** * @inheritDoc */ RangedFilter.prototype.getIndex = function () { return this.index_; }; /** * @param {!QueryParams} params * @return {!NamedNode} * @private */ RangedFilter.getStartPost_ = function (params) { if (params.hasStart()) { var startName = params.getIndexStartName(); return params.getIndex().makePost(params.getIndexStartValue(), startName); } else { return params.getIndex().minPost(); } }; /** * @param {!QueryParams} params * @return {!NamedNode} * @private */ RangedFilter.getEndPost_ = function (params) { if (params.hasEnd()) { var endName = params.getIndexEndName(); return params.getIndex().makePost(params.getIndexEndValue(), endName); } else { return params.getIndex().maxPost(); } }; return RangedFilter; }()); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Applies a limit and a range to a node and uses RangedFilter to do the heavy lifting where possible * * @constructor * @implements {NodeFilter} */ var LimitedFilter = /** @class */ (function () { /** * @param {!QueryParams} params */ function LimitedFilter(params) { this.rangedFilter_ = new RangedFilter(params); this.index_ = params.getIndex(); this.limit_ = params.getLimit(); this.reverse_ = !params.isViewFromLeft(); } /** * @inheritDoc */ LimitedFilter.prototype.updateChild = function (snap, key, newChild, affectedPath, source, optChangeAccumulator) { if (!this.rangedFilter_.matches(new NamedNode(key, newChild))) { newChild = ChildrenNode.EMPTY_NODE; } if (snap.getImmediateChild(key).equals(newChild)) { // No change return snap; } else if (snap.numChildren() < this.limit_) { return this.rangedFilter_ .getIndexedFilter() .updateChild(snap, key, newChild, affectedPath, source, optChangeAccumulator); } else { return this.fullLimitUpdateChild_(snap, key, newChild, source, optChangeAccumulator); } }; /** * @inheritDoc */ LimitedFilter.prototype.updateFullNode = function (oldSnap, newSnap, optChangeAccumulator) { var filtered; if (newSnap.isLeafNode() || newSnap.isEmpty()) { // Make sure we have a children node with the correct index, not a leaf node; filtered = ChildrenNode.EMPTY_NODE.withIndex(this.index_); } else { if (this.limit_ * 2 < newSnap.numChildren() && newSnap.isIndexed(this.index_)) { // Easier to build up a snapshot, since what we're given has more than twice the elements we want filtered = ChildrenNode.EMPTY_NODE.withIndex(this.index_); // anchor to the startPost, endPost, or last element as appropriate var iterator = void 0; if (this.reverse_) { iterator = newSnap.getReverseIteratorFrom(this.rangedFilter_.getEndPost(), this.index_); } else { iterator = newSnap.getIteratorFrom(this.rangedFilter_.getStartPost(), this.index_); } var count = 0; while (iterator.hasNext() && count < this.limit_) { var next = iterator.getNext(); var inRange = void 0; if (this.reverse_) { inRange = this.index_.compare(this.rangedFilter_.getStartPost(), next) <= 0; } else { inRange = this.index_.compare(next, this.rangedFilter_.getEndPost()) <= 0; } if (inRange) { filtered = filtered.updateImmediateChild(next.name, next.node); count++; } else { // if we have reached the end post, we cannot keep adding elemments break; } } } else { // The snap contains less than twice the limit. Faster to delete from the snap than build up a new one filtered = newSnap.withIndex(this.index_); // Don't support priorities on queries filtered = filtered.updatePriority(ChildrenNode.EMPTY_NODE); var startPost = void 0; var endPost = void 0; var cmp = void 0; var iterator = void 0; if (this.reverse_) { iterator = filtered.getReverseIterator(this.index_); startPost = this.rangedFilter_.getEndPost(); endPost = this.rangedFilter_.getStartPost(); var indexCompare_1 = this.index_.getCompare(); cmp = function (a, b) { return indexCompare_1(b, a); }; } else { iterator = filtered.getIterator(this.index_); startPost = this.rangedFilter_.getStartPost(); endPost = this.rangedFilter_.getEndPost(); cmp = this.index_.getCompare(); } var count = 0; var foundStartPost = false; while (iterator.hasNext()) { var next = iterator.getNext(); if (!foundStartPost && cmp(startPost, next) <= 0) { // start adding foundStartPost = true; } var inRange = foundStartPost && count < this.limit_ && cmp(next, endPost) <= 0; if (inRange) { count++; } else { filtered = filtered.updateImmediateChild(next.name, ChildrenNode.EMPTY_NODE); } } } } return this.rangedFilter_ .getIndexedFilter() .updateFullNode(oldSnap, filtered, optChangeAccumulator); }; /** * @inheritDoc */ LimitedFilter.prototype.updatePriority = function (oldSnap, newPriority) { // Don't support priorities on queries return oldSnap; }; /** * @inheritDoc */ LimitedFilter.prototype.filtersNodes = function () { return true; }; /** * @inheritDoc */ LimitedFilter.prototype.getIndexedFilter = function () { return this.rangedFilter_.getIndexedFilter(); }; /** * @inheritDoc */ LimitedFilter.prototype.getIndex = function () { return this.index_; }; /** * @param {!Node} snap * @param {string} childKey * @param {!Node} childSnap * @param {!CompleteChildSource} source * @param {?ChildChangeAccumulator} changeAccumulator * @return {!Node} * @private */ LimitedFilter.prototype.fullLimitUpdateChild_ = function (snap, childKey, childSnap, source, changeAccumulator) { // TODO: rename all cache stuff etc to general snap terminology var cmp; if (this.reverse_) { var indexCmp_1 = this.index_.getCompare(); cmp = function (a, b) { return indexCmp_1(b, a); }; } else { cmp = this.index_.getCompare(); } var oldEventCache = snap; util.assert(oldEventCache.numChildren() === this.limit_, ''); var newChildNamedNode = new NamedNode(childKey, childSnap); var windowBoundary = this.reverse_ ? oldEventCache.getFirstChild(this.index_) : oldEventCache.getLastChild(this.index_); var inRange = this.rangedFilter_.matches(newChildNamedNode); if (oldEventCache.hasChild(childKey)) { var oldChildSnap = oldEventCache.getImmediateChild(childKey); var nextChild = source.getChildAfterChild(this.index_, windowBoundary, this.reverse_); while (nextChild != null && (nextChild.name === childKey || oldEventCache.hasChild(nextChild.name))) { // There is a weird edge case where a node is updated as part of a merge in the write tree, but hasn't // been applied to the limited filter yet. Ignore this next child which will be updated later in // the limited filter... nextChild = source.getChildAfterChild(this.index_, nextChild, this.reverse_); } var compareNext = nextChild == null ? 1 : cmp(nextChild, newChildNamedNode); var remainsInWindow = inRange && !childSnap.isEmpty() && compareNext >= 0; if (remainsInWindow) { if (changeAccumulator != null) { changeAccumulator.trackChildChange(Change.childChangedChange(childKey, childSnap, oldChildSnap)); } return oldEventCache.updateImmediateChild(childKey, childSnap); } else { if (changeAccumulator != null) { changeAccumulator.trackChildChange(Change.childRemovedChange(childKey, oldChildSnap)); } var newEventCache = oldEventCache.updateImmediateChild(childKey, ChildrenNode.EMPTY_NODE); var nextChildInRange = nextChild != null && this.rangedFilter_.matches(nextChild); if (nextChildInRange) { if (changeAccumulator != null) { changeAccumulator.trackChildChange(Change.childAddedChange(nextChild.name, nextChild.node)); } return newEventCache.updateImmediateChild(nextChild.name, nextChild.node); } else { return newEventCache; } } } else if (childSnap.isEmpty()) { // we're deleting a node, but it was not in the window, so ignore it return snap; } else if (inRange) { if (cmp(windowBoundary, newChildNamedNode) >= 0) { if (changeAccumulator != null) { changeAccumulator.trackChildChange(Change.childRemovedChange(windowBoundary.name, windowBoundary.node)); changeAccumulator.trackChildChange(Change.childAddedChange(childKey, childSnap)); } return oldEventCache .updateImmediateChild(childKey, childSnap) .updateImmediateChild(windowBoundary.name, ChildrenNode.EMPTY_NODE); } else { return snap; } } else { return snap; } }; return LimitedFilter; }()); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * This class is an immutable-from-the-public-api struct containing a set of query parameters defining a * range to be returned for a particular location. It is assumed that validation of parameters is done at the * user-facing API level, so it is not done here. * @constructor */ var QueryParams = /** @class */ (function () { function QueryParams() { this.limitSet_ = false; this.startSet_ = false; this.startNameSet_ = false; this.endSet_ = false; this.endNameSet_ = false; this.limit_ = 0; this.viewFrom_ = ''; this.indexStartValue_ = null; this.indexStartName_ = ''; this.indexEndValue_ = null; this.indexEndName_ = ''; this.index_ = PRIORITY_INDEX; } /** * @return {boolean} */ QueryParams.prototype.hasStart = function () { return this.startSet_; }; /** * @return {boolean} True if it would return from left. */ QueryParams.prototype.isViewFromLeft = function () { if (this.viewFrom_ === '') { // limit(), rather than limitToFirst or limitToLast was called. // This means that only one of startSet_ and endSet_ is true. Use them // to calculate which side of the view to anchor to. If neither is set, // anchor to the end. return this.startSet_; } else { return (this.viewFrom_ === QueryParams.WIRE_PROTOCOL_CONSTANTS_.VIEW_FROM_LEFT); } }; /** * Only valid to call if hasStart() returns true * @return {*} */ QueryParams.prototype.getIndexStartValue = function () { util.assert(this.startSet_, 'Only valid if start has been set'); return this.indexStartValue_; }; /** * Only valid to call if hasStart() returns true. * Returns the starting key name for the range defined by these query parameters * @return {!string} */ QueryParams.prototype.getIndexStartName = function () { util.assert(this.startSet_, 'Only valid if start has been set'); if (this.startNameSet_) { return this.indexStartName_; } else { return MIN_NAME; } }; /** * @return {boolean} */ QueryParams.prototype.hasEnd = function () { return this.endSet_; }; /** * Only valid to call if hasEnd() returns true. * @return {*} */ QueryParams.prototype.getIndexEndValue = function () { util.assert(this.endSet_, 'Only valid if end has been set'); return this.indexEndValue_; }; /** * Only valid to call if hasEnd() returns true. * Returns the end key name for the range defined by these query parameters * @return {!string} */ QueryParams.prototype.getIndexEndName = function () { util.assert(this.endSet_, 'Only valid if end has been set'); if (this.endNameSet_) { return this.indexEndName_; } else { return MAX_NAME; } }; /** * @return {boolean} */ QueryParams.prototype.hasLimit = function () { return this.limitSet_; }; /** * @return {boolean} True if a limit has been set and it has been explicitly anchored */ QueryParams.prototype.hasAnchoredLimit = function () { return this.limitSet_ && this.viewFrom_ !== ''; }; /** * Only valid to call if hasLimit() returns true * @return {!number} */ QueryParams.prototype.getLimit = function () { util.assert(this.limitSet_, 'Only valid if limit has been set'); return this.limit_; }; /** * @return {!Index} */ QueryParams.prototype.getIndex = function () { return this.index_; }; /** * @return {!QueryParams} * @private */ QueryParams.prototype.copy_ = function () { var copy = new QueryParams(); copy.limitSet_ = this.limitSet_; copy.limit_ = this.limit_; copy.startSet_ = this.startSet_; copy.indexStartValue_ = this.indexStartValue_; copy.startNameSet_ = this.startNameSet_; copy.indexStartName_ = this.indexStartName_; copy.endSet_ = this.endSet_; copy.indexEndValue_ = this.indexEndValue_; copy.endNameSet_ = this.endNameSet_; copy.indexEndName_ = this.indexEndName_; copy.index_ = this.index_; copy.viewFrom_ = this.viewFrom_; return copy; }; /** * @param {!number} newLimit * @return {!QueryParams} */ QueryParams.prototype.limit = function (newLimit) { var newParams = this.copy_(); newParams.limitSet_ = true; newParams.limit_ = newLimit; newParams.viewFrom_ = ''; return newParams; }; /** * @param {!number} newLimit * @return {!QueryParams} */ QueryParams.prototype.limitToFirst = function (newLimit) { var newParams = this.copy_(); newParams.limitSet_ = true; newParams.limit_ = newLimit; newParams.viewFrom_ = QueryParams.WIRE_PROTOCOL_CONSTANTS_.VIEW_FROM_LEFT; return newParams; }; /** * @param {!number} newLimit * @return {!QueryParams} */ QueryParams.prototype.limitToLast = function (newLimit) { var newParams = this.copy_(); newParams.limitSet_ = true; newParams.limit_ = newLimit; newParams.viewFrom_ = QueryParams.WIRE_PROTOCOL_CONSTANTS_.VIEW_FROM_RIGHT; return newParams; }; /** * @param {*} indexValue * @param {?string=} key * @return {!QueryParams} */ QueryParams.prototype.startAt = function (indexValue, key) { var newParams = this.copy_(); newParams.startSet_ = true; if (indexValue === undefined) { indexValue = null; } newParams.indexStartValue_ = indexValue; if (key != null) { newParams.startNameSet_ = true; newParams.indexStartName_ = key; } else { newParams.startNameSet_ = false; newParams.indexStartName_ = ''; } return newParams; }; /** * @param {*} indexValue * @param {?string=} key * @return {!QueryParams} */ QueryParams.prototype.endAt = function (indexValue, key) { var newParams = this.copy_(); newParams.endSet_ = true; if (indexValue === undefined) { indexValue = null; } newParams.indexEndValue_ = indexValue; if (key !== undefined) { newParams.endNameSet_ = true; newParams.indexEndName_ = key; } else { newParams.endNameSet_ = false; newParams.indexEndName_ = ''; } return newParams; }; /** * @param {!Index} index * @return {!QueryParams} */ QueryParams.prototype.orderBy = function (index) { var newParams = this.copy_(); newParams.index_ = index; return newParams; }; /** * @return {!Object} */ QueryParams.prototype.getQueryObject = function () { var WIRE_PROTOCOL_CONSTANTS = QueryParams.WIRE_PROTOCOL_CONSTANTS_; var obj = {}; if (this.startSet_) { obj[WIRE_PROTOCOL_CONSTANTS.INDEX_START_VALUE] = this.indexStartValue_; if (this.startNameSet_) { obj[WIRE_PROTOCOL_CONSTANTS.INDEX_START_NAME] = this.indexStartName_; } } if (this.endSet_) { obj[WIRE_PROTOCOL_CONSTANTS.INDEX_END_VALUE] = this.indexEndValue_; if (this.endNameSet_) { obj[WIRE_PROTOCOL_CONSTANTS.INDEX_END_NAME] = this.indexEndName_; } } if (this.limitSet_) { obj[WIRE_PROTOCOL_CONSTANTS.LIMIT] = this.limit_; var viewFrom = this.viewFrom_; if (viewFrom === '') { if (this.isViewFromLeft()) { viewFrom = WIRE_PROTOCOL_CONSTANTS.VIEW_FROM_LEFT; } else { viewFrom = WIRE_PROTOCOL_CONSTANTS.VIEW_FROM_RIGHT; } } obj[WIRE_PROTOCOL_CONSTANTS.VIEW_FROM] = viewFrom; } // For now, priority index is the default, so we only specify if it's some other index if (this.index_ !== PRIORITY_INDEX) { obj[WIRE_PROTOCOL_CONSTANTS.INDEX] = this.index_.toString(); } return obj; }; /** * @return {boolean} */ QueryParams.prototype.loadsAllData = function () { return !(this.startSet_ || this.endSet_ || this.limitSet_); }; /** * @return {boolean} */ QueryParams.prototype.isDefault = function () { return this.loadsAllData() && this.index_ === PRIORITY_INDEX; }; /** * @return {!NodeFilter} */ QueryParams.prototype.getNodeFilter = function () { if (this.loadsAllData()) { return new IndexedFilter(this.getIndex()); } else if (this.hasLimit()) { return new LimitedFilter(this); } else { return new RangedFilter(this); } }; /** * Returns a set of REST query string parameters representing this query. * * @return {!Object.<string,*>} query string parameters */ QueryParams.prototype.toRestQueryStringParameters = function () { var REST_CONSTANTS = QueryParams.REST_QUERY_CONSTANTS_; var qs = {}; if (this.isDefault()) { return qs; } var orderBy; if (this.index_ === PRIORITY_INDEX) { orderBy = REST_CONSTANTS.PRIORITY_INDEX; } else if (this.index_ === VALUE_INDEX) { orderBy = REST_CONSTANTS.VALUE_INDEX; } else if (this.index_ === KEY_INDEX) { orderBy = REST_CONSTANTS.KEY_INDEX; } else { util.assert(this.index_ instanceof PathIndex, 'Unrecognized index type!'); orderBy = this.index_.toString(); } qs[REST_CONSTANTS.ORDER_BY] = util.stringify(orderBy); if (this.startSet_) { qs[REST_CONSTANTS.START_AT] = util.stringify(this.indexStartValue_); if (this.startNameSet_) { qs[REST_CONSTANTS.START_AT] += ',' + util.stringify(this.indexStartName_); } } if (this.endSet_) { qs[REST_CONSTANTS.END_AT] = util.stringify(this.indexEndValue_); if (this.endNameSet_) { qs[REST_CONSTANTS.END_AT] += ',' + util.stringify(this.indexEndName_); } } if (this.limitSet_) { if (this.isViewFromLeft()) { qs[REST_CONSTANTS.LIMIT_TO_FIRST] = this.limit_; } else { qs[REST_CONSTANTS.LIMIT_TO_LAST] = this.limit_; } } return qs; }; /** * Wire Protocol Constants * @const * @enum {string} * @private */ QueryParams.WIRE_PROTOCOL_CONSTANTS_ = { INDEX_START_VALUE: 'sp', INDEX_START_NAME: 'sn', INDEX_END_VALUE: 'ep', INDEX_END_NAME: 'en', LIMIT: 'l', VIEW_FROM: 'vf', VIEW_FROM_LEFT: 'l', VIEW_FROM_RIGHT: 'r', INDEX: 'i' }; /** * REST Query Constants * @const * @enum {string} * @private */ QueryParams.REST_QUERY_CONSTANTS_ = { ORDER_BY: 'orderBy', PRIORITY_INDEX: '$priority', VALUE_INDEX: '$value', KEY_INDEX: '$key', START_AT: 'startAt', END_AT: 'endAt', LIMIT_TO_FIRST: 'limitToFirst', LIMIT_TO_LAST: 'limitToLast' }; /** * Default, empty query parameters * @type {!QueryParams} * @const */ QueryParams.DEFAULT = new QueryParams(); return QueryParams; }()); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var Reference = /** @class */ (function (_super) { tslib.__extends(Reference, _super); /** * Call options: * new Reference(Repo, Path) or * new Reference(url: string, string|RepoManager) * * Externally - this is the firebase.database.Reference type. * * @param {!Repo} repo * @param {(!Path)} path * @extends {Query} */ function Reference(repo, path) { var _this = this; if (!(repo instanceof Repo)) { throw new Error('new Reference() no longer supported - use app.database().'); } // call Query's constructor, passing in the repo and path. _this = _super.call(this, repo, path, QueryParams.DEFAULT, false) || this; return _this; } /** @return {?string} */ Reference.prototype.getKey = function () { util.validateArgCount('Reference.key', 0, 0, arguments.length); if (this.path.isEmpty()) { return null; } else { return this.path.getBack(); } }; /** * @param {!(string|Path)} pathString * @return {!Reference} */ Reference.prototype.child = function (pathString) { util.validateArgCount('Reference.child', 1, 1, arguments.length); if (typeof pathString === 'number') { pathString = String(pathString); } else if (!(pathString instanceof Path)) { if (this.path.getFront() === null) { validateRootPathString('Reference.child', 1, pathString, false); } else { validatePathString('Reference.child', 1, pathString, false); } } return new Reference(this.repo, this.path.child(pathString)); }; /** @return {?Reference} */ Reference.prototype.getParent = function () { util.validateArgCount('Reference.parent', 0, 0, arguments.length); var parentPath = this.path.parent(); return parentPath === null ? null : new Reference(this.repo, parentPath); }; /** @return {!Reference} */ Reference.prototype.getRoot = function () { util.validateArgCount('Reference.root', 0, 0, arguments.length); var ref = this; while (ref.getParent() !== null) { ref = ref.getParent(); } return ref; }; /** @return {!Database} */ Reference.prototype.databaseProp = function () { return this.repo.database; }; /** * @param {*} newVal * @param {function(?Error)=} onComplete * @return {!Promise} */ Reference.prototype.set = function (newVal, onComplete) { util.validateArgCount('Reference.set', 1, 2, arguments.length); validateWritablePath('Reference.set', this.path); validateFirebaseDataArg('Reference.set', 1, newVal, this.path, false); util.validateCallback('Reference.set', 2, onComplete, true); var deferred = new util.Deferred(); this.repo.setWithPriority(this.path, newVal, /*priority=*/ null, deferred.wrapCallback(onComplete)); return deferred.promise; }; /** * @param {!Object} objectToMerge * @param {function(?Error)=} onComplete * @return {!Promise} */ Reference.prototype.update = function (objectToMerge, onComplete) { util.validateArgCount('Reference.update', 1, 2, arguments.length); validateWritablePath('Reference.update', this.path); if (Array.isArray(objectToMerge)) { var newObjectToMerge = {}; for (var i = 0; i < objectToMerge.length; ++i) { newObjectToMerge['' + i] = objectToMerge[i]; } objectToMerge = newObjectToMerge; warn('Passing an Array to Firebase.update() is deprecated. ' + 'Use set() if you want to overwrite the existing data, or ' + 'an Object with integer keys if you really do want to ' + 'only update some of the children.'); } validateFirebaseMergeDataArg('Reference.update', 1, objectToMerge, this.path, false); util.validateCallback('Reference.update', 2, onComplete, true); var deferred = new util.Deferred(); this.repo.update(this.path, objectToMerge, deferred.wrapCallback(onComplete)); return deferred.promise; }; /** * @param {*} newVal * @param {string|number|null} newPriority * @param {function(?Error)=} onComplete * @return {!Promise} */ Reference.prototype.setWithPriority = function (newVal, newPriority, onComplete) { util.validateArgCount('Reference.setWithPriority', 2, 3, arguments.length); validateWritablePath('Reference.setWithPriority', this.path); validateFirebaseDataArg('Reference.setWithPriority', 1, newVal, this.path, false); validatePriority('Reference.setWithPriority', 2, newPriority, false); util.validateCallback('Reference.setWithPriority', 3, onComplete, true); if (this.getKey() === '.length' || this.getKey() === '.keys') { throw ('Reference.setWithPriority failed: ' + this.getKey() + ' is a read-only object.'); } var deferred = new util.Deferred(); this.repo.setWithPriority(this.path, newVal, newPriority, deferred.wrapCallback(onComplete)); return deferred.promise; }; /** * @param {function(?Error)=} onComplete * @return {!Promise} */ Reference.prototype.remove = function (onComplete) { util.validateArgCount('Reference.remove', 0, 1, arguments.length); validateWritablePath('Reference.remove', this.path); util.validateCallback('Reference.remove', 1, onComplete, true); return this.set(null, onComplete); }; /** * @param {function(*):*} transactionUpdate * @param {(function(?Error, boolean, ?DataSnapshot))=} onComplete * @param {boolean=} applyLocally * @return {!Promise} */ Reference.prototype.transaction = function (transactionUpdate, onComplete, applyLocally) { util.validateArgCount('Reference.transaction', 1, 3, arguments.length); validateWritablePath('Reference.transaction', this.path); util.validateCallback('Reference.transaction', 1, transactionUpdate, false); util.validateCallback('Reference.transaction', 2, onComplete, true); // NOTE: applyLocally is an internal-only option for now. We need to decide if we want to keep it and how // to expose it. validateBoolean('Reference.transaction', 3, applyLocally, true); if (this.getKey() === '.length' || this.getKey() === '.keys') { throw ('Reference.transaction failed: ' + this.getKey() + ' is a read-only object.'); } if (applyLocally === undefined) { applyLocally = true; } var deferred = new util.Deferred(); if (typeof onComplete === 'function') { deferred.promise.catch(function () { }); } var promiseComplete = function (error, committed, snapshot) { if (error) { deferred.reject(error); } else { deferred.resolve(new TransactionResult(committed, snapshot)); } if (typeof onComplete === 'function') { onComplete(error, committed, snapshot); } }; this.repo.startTransaction(this.path, transactionUpdate, promiseComplete, applyLocally); return deferred.promise; }; /** * @param {string|number|null} priority * @param {function(?Error)=} onComplete * @return {!Promise} */ Reference.prototype.setPriority = function (priority, onComplete) { util.validateArgCount('Reference.setPriority', 1, 2, arguments.length); validateWritablePath('Reference.setPriority', this.path); validatePriority('Reference.setPriority', 1, priority, false); util.validateCallback('Reference.setPriority', 2, onComplete, true); var deferred = new util.Deferred(); this.repo.setWithPriority(this.path.child('.priority'), priority, null, deferred.wrapCallback(onComplete)); return deferred.promise; }; /** * @param {*=} value * @param {function(?Error)=} onComplete * @return {!Reference} */ Reference.prototype.push = function (value, onComplete) { util.validateArgCount('Reference.push', 0, 2, arguments.length); validateWritablePath('Reference.push', this.path); validateFirebaseDataArg('Reference.push', 1, value, this.path, true); util.validateCallback('Reference.push', 2, onComplete, true); var now = this.repo.serverTime(); var name = nextPushId(now); // push() returns a ThennableReference whose promise is fulfilled with a regular Reference. // We use child() to create handles to two different references. The first is turned into a // ThennableReference below by adding then() and catch() methods and is used as the // return value of push(). The second remains a regular Reference and is used as the fulfilled // value of the first ThennableReference. var thennablePushRef = this.child(name); var pushRef = this.child(name); var promise; if (value != null) { promise = thennablePushRef.set(value, onComplete).then(function () { return pushRef; }); } else { promise = Promise.resolve(pushRef); } thennablePushRef.then = promise.then.bind(promise); thennablePushRef.catch = promise.then.bind(promise, undefined); if (typeof onComplete === 'function') { promise.catch(function () { }); } return thennablePushRef; }; /** * @return {!OnDisconnect} */ Reference.prototype.onDisconnect = function () { validateWritablePath('Reference.onDisconnect', this.path); return new OnDisconnect(this.repo, this.path); }; Object.defineProperty(Reference.prototype, "database", { get: function () { return this.databaseProp(); }, enumerable: false, configurable: true }); Object.defineProperty(Reference.prototype, "key", { get: function () { return this.getKey(); }, enumerable: false, configurable: true }); Object.defineProperty(Reference.prototype, "parent", { get: function () { return this.getParent(); }, enumerable: false, configurable: true }); Object.defineProperty(Reference.prototype, "root", { get: function () { return this.getRoot(); }, enumerable: false, configurable: true }); return Reference; }(Query)); /** * Define reference constructor in various modules * * We are doing this here to avoid several circular * dependency issues */ Query.__referenceConstructor = Reference; SyncPoint.__referenceConstructor = Reference; /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Node in a Tree. */ var TreeNode = /** @class */ (function () { function TreeNode() { // TODO: Consider making accessors that create children and value lazily or // separate Internal / Leaf 'types'. this.children = {}; this.childCount = 0; this.value = null; } return TreeNode; }()); /** * A light-weight tree, traversable by path. Nodes can have both values and children. * Nodes are not enumerated (by forEachChild) unless they have a value or non-empty * children. */ var Tree = /** @class */ (function () { /** * @template T * @param {string=} name_ Optional name of the node. * @param {Tree=} parent_ Optional parent node. * @param {TreeNode=} node_ Optional node to wrap. */ function Tree(name_, parent_, node_) { if (name_ === void 0) { name_ = ''; } if (parent_ === void 0) { parent_ = null; } if (node_ === void 0) { node_ = new TreeNode(); } this.name_ = name_; this.parent_ = parent_; this.node_ = node_; } /** * Returns a sub-Tree for the given path. * * @param {!(string|Path)} pathObj Path to look up. * @return {!Tree.<T>} Tree for path. */ Tree.prototype.subTree = function (pathObj) { // TODO: Require pathObj to be Path? var path = pathObj instanceof Path ? pathObj : new Path(pathObj); var child = this, next = path.getFront(); while (next !== null) { var childNode = util.safeGet(child.node_.children, next) || new TreeNode(); child = new Tree(next, child, childNode); path = path.popFront(); next = path.getFront(); } return child; }; /** * Returns the data associated with this tree node. * * @return {?T} The data or null if no data exists. */ Tree.prototype.getValue = function () { return this.node_.value; }; /** * Sets data to this tree node. * * @param {!T} value Value to set. */ Tree.prototype.setValue = function (value) { util.assert(typeof value !== 'undefined', 'Cannot set value to undefined'); this.node_.value = value; this.updateParents_(); }; /** * Clears the contents of the tree node (its value and all children). */ Tree.prototype.clear = function () { this.node_.value = null; this.node_.children = {}; this.node_.childCount = 0; this.updateParents_(); }; /** * @return {boolean} Whether the tree has any children. */ Tree.prototype.hasChildren = function () { return this.node_.childCount > 0; }; /** * @return {boolean} Whether the tree is empty (no value or children). */ Tree.prototype.isEmpty = function () { return this.getValue() === null && !this.hasChildren(); }; /** * Calls action for each child of this tree node. * * @param {function(!Tree.<T>)} action Action to be called for each child. */ Tree.prototype.forEachChild = function (action) { var _this = this; each(this.node_.children, function (child, childTree) { action(new Tree(child, _this, childTree)); }); }; /** * Does a depth-first traversal of this node's descendants, calling action for each one. * * @param {function(!Tree.<T>)} action Action to be called for each child. * @param {boolean=} includeSelf Whether to call action on this node as well. Defaults to * false. * @param {boolean=} childrenFirst Whether to call action on children before calling it on * parent. */ Tree.prototype.forEachDescendant = function (action, includeSelf, childrenFirst) { if (includeSelf && !childrenFirst) { action(this); } this.forEachChild(function (child) { child.forEachDescendant(action, /*includeSelf=*/ true, childrenFirst); }); if (includeSelf && childrenFirst) { action(this); } }; /** * Calls action on each ancestor node. * * @param {function(!Tree.<T>)} action Action to be called on each parent; return * true to abort. * @param {boolean=} includeSelf Whether to call action on this node as well. * @return {boolean} true if the action callback returned true. */ Tree.prototype.forEachAncestor = function (action, includeSelf) { var node = includeSelf ? this : this.parent(); while (node !== null) { if (action(node)) { return true; } node = node.parent(); } return false; }; /** * Does a depth-first traversal of this node's descendants. When a descendant with a value * is found, action is called on it and traversal does not continue inside the node. * Action is *not* called on this node. * * @param {function(!Tree.<T>)} action Action to be called for each child. */ Tree.prototype.forEachImmediateDescendantWithValue = function (action) { this.forEachChild(function (child) { if (child.getValue() !== null) { action(child); } else { child.forEachImmediateDescendantWithValue(action); } }); }; /** * @return {!Path} The path of this tree node, as a Path. */ Tree.prototype.path = function () { return new Path(this.parent_ === null ? this.name_ : this.parent_.path() + '/' + this.name_); }; /** * @return {string} The name of the tree node. */ Tree.prototype.name = function () { return this.name_; }; /** * @return {?Tree} The parent tree node, or null if this is the root of the tree. */ Tree.prototype.parent = function () { return this.parent_; }; /** * Adds or removes this child from its parent based on whether it's empty or not. * * @private */ Tree.prototype.updateParents_ = function () { if (this.parent_ !== null) { this.parent_.updateChild_(this.name_, this); } }; /** * Adds or removes the passed child to this tree node, depending on whether it's empty. * * @param {string} childName The name of the child to update. * @param {!Tree.<T>} child The child to update. * @private */ Tree.prototype.updateChild_ = function (childName, child) { var childEmpty = child.isEmpty(); var childExists = util.contains(this.node_.children, childName); if (childEmpty && childExists) { delete this.node_.children[childName]; this.node_.childCount--; this.updateParents_(); } else if (!childEmpty && !childExists) { this.node_.children[childName] = child.node_; this.node_.childCount++; this.updateParents_(); } }; return Tree; }()); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // TODO: This is pretty messy. Ideally, a lot of this would move into FirebaseData, or a transaction-specific // component used by FirebaseData, but it has ties to user callbacks (transaction update and onComplete) as well // as the realtime connection (to send transactions to the server). So that all needs to be decoupled first. // For now it's part of Repo, but in its own file. /** * @enum {number} */ var TransactionStatus; (function (TransactionStatus) { // We've run the transaction and updated transactionResultData_ with the result, but it isn't currently sent to the // server. A transaction will go from RUN -> SENT -> RUN if it comes back from the server as rejected due to // mismatched hash. TransactionStatus[TransactionStatus["RUN"] = 0] = "RUN"; // We've run the transaction and sent it to the server and it's currently outstanding (hasn't come back as accepted // or rejected yet). TransactionStatus[TransactionStatus["SENT"] = 1] = "SENT"; // Temporary state used to mark completed transactions (whether successful or aborted). The transaction will be // removed when we get a chance to prune completed ones. TransactionStatus[TransactionStatus["COMPLETED"] = 2] = "COMPLETED"; // Used when an already-sent transaction needs to be aborted (e.g. due to a conflicting set() call that was made). // If it comes back as unsuccessful, we'll abort it. TransactionStatus[TransactionStatus["SENT_NEEDS_ABORT"] = 3] = "SENT_NEEDS_ABORT"; // Temporary state used to mark transactions that need to be aborted. TransactionStatus[TransactionStatus["NEEDS_ABORT"] = 4] = "NEEDS_ABORT"; })(TransactionStatus || (TransactionStatus = {})); /** * If a transaction does not succeed after 25 retries, we abort it. Among other things this ensure that if there's * ever a bug causing a mismatch between client / server hashes for some data, we won't retry indefinitely. * @type {number} * @const * @private */ // eslint-disable-next-line @typescript-eslint/no-explicit-any Repo.MAX_TRANSACTION_RETRIES_ = 25; /** * Setup the transaction data structures * @private */ // eslint-disable-next-line @typescript-eslint/no-explicit-any Repo.prototype.transactionsInit_ = function () { /** * Stores queues of outstanding transactions for Firebase locations. * * @type {!Tree.<Array.<!Transaction>>} * @private */ this.transactionQueueTree_ = new Tree(); }; /** * Creates a new transaction, adds it to the transactions we're tracking, and sends it to the server if possible. * * @param {!Path} path Path at which to do transaction. * @param {function(*):*} transactionUpdate Update callback. * @param {?function(?Error, boolean, ?DataSnapshot)} onComplete Completion callback. * @param {boolean} applyLocally Whether or not to make intermediate results visible */ Repo.prototype.startTransaction = function (path, transactionUpdate, onComplete, applyLocally) { this.log_('transaction on ' + path); // Add a watch to make sure we get server updates. var valueCallback = function () { }; var watchRef = new Reference(this, path); watchRef.on('value', valueCallback); var unwatcher = function () { watchRef.off('value', valueCallback); }; // Initialize transaction. var transaction = { path: path, update: transactionUpdate, onComplete: onComplete, // One of TransactionStatus enums. status: null, // Used when combining transactions at different locations to figure out which one goes first. order: LUIDGenerator(), // Whether to raise local events for this transaction. applyLocally: applyLocally, // Count of how many times we've retried the transaction. retryCount: 0, // Function to call to clean up our .on() listener. unwatcher: unwatcher, // Stores why a transaction was aborted. abortReason: null, currentWriteId: null, currentInputSnapshot: null, currentOutputSnapshotRaw: null, currentOutputSnapshotResolved: null }; // Run transaction initially. var currentState = this.getLatestState_(path); transaction.currentInputSnapshot = currentState; var newVal = transaction.update(currentState.val()); if (newVal === undefined) { // Abort transaction. transaction.unwatcher(); transaction.currentOutputSnapshotRaw = null; transaction.currentOutputSnapshotResolved = null; if (transaction.onComplete) { // We just set the input snapshot, so this cast should be safe var snapshot = new DataSnapshot(transaction.currentInputSnapshot, new Reference(this, transaction.path), PRIORITY_INDEX); transaction.onComplete(null, false, snapshot); } } else { validateFirebaseData('transaction failed: Data returned ', newVal, transaction.path); // Mark as run and add to our queue. transaction.status = TransactionStatus.RUN; var queueNode = this.transactionQueueTree_.subTree(path); var nodeQueue = queueNode.getValue() || []; nodeQueue.push(transaction); queueNode.setValue(nodeQueue); // Update visibleData and raise events // Note: We intentionally raise events after updating all of our transaction state, since the user could // start new transactions from the event callbacks. var priorityForNode = void 0; if (typeof newVal === 'object' && newVal !== null && util.contains(newVal, '.priority')) { // eslint-disable-next-line @typescript-eslint/no-explicit-any priorityForNode = util.safeGet(newVal, '.priority'); util.assert(isValidPriority(priorityForNode), 'Invalid priority returned by transaction. ' + 'Priority must be a valid string, finite number, server value, or null.'); } else { var currentNode = this.serverSyncTree_.calcCompleteEventCache(path) || ChildrenNode.EMPTY_NODE; priorityForNode = currentNode.getPriority().val(); } priorityForNode /** @type {null|number|string} */ = priorityForNode; var serverValues = this.generateServerValues(); var newNodeUnresolved = nodeFromJSON$1(newVal, priorityForNode); var newNode = resolveDeferredValueSnapshot(newNodeUnresolved, currentState, serverValues); transaction.currentOutputSnapshotRaw = newNodeUnresolved; transaction.currentOutputSnapshotResolved = newNode; transaction.currentWriteId = this.getNextWriteId_(); var events = this.serverSyncTree_.applyUserOverwrite(path, newNode, transaction.currentWriteId, transaction.applyLocally); this.eventQueue_.raiseEventsForChangedPath(path, events); this.sendReadyTransactions_(); } }; /** * @param {!Path} path * @param {Array.<number>=} excludeSets A specific set to exclude * @return {Node} * @private */ // eslint-disable-next-line @typescript-eslint/no-explicit-any Repo.prototype.getLatestState_ = function (path, excludeSets) { return (this.serverSyncTree_.calcCompleteEventCache(path, excludeSets) || ChildrenNode.EMPTY_NODE); }; /** * Sends any already-run transactions that aren't waiting for outstanding transactions to * complete. * * Externally it's called with no arguments, but it calls itself recursively with a particular * transactionQueueTree node to recurse through the tree. * * @param {Tree.<Array.<Transaction>>=} node transactionQueueTree node to start at. * @private */ // eslint-disable-next-line @typescript-eslint/no-explicit-any Repo.prototype.sendReadyTransactions_ = function (node) { var _this = this; if (node === void 0) { node = this.transactionQueueTree_; } // Before recursing, make sure any completed transactions are removed. if (!node) { this.pruneCompletedTransactionsBelowNode_(node); } if (node.getValue() !== null) { var queue = this.buildTransactionQueue_(node); util.assert(queue.length > 0, 'Sending zero length transaction queue'); var allRun = queue.every(function (transaction) { return transaction.status === TransactionStatus.RUN; }); // If they're all run (and not sent), we can send them. Else, we must wait. if (allRun) { this.sendTransactionQueue_(node.path(), queue); } } else if (node.hasChildren()) { node.forEachChild(function (childNode) { _this.sendReadyTransactions_(childNode); }); } }; /** * Given a list of run transactions, send them to the server and then handle the result (success or failure). * * @param {!Path} path The location of the queue. * @param {!Array.<Transaction>} queue Queue of transactions under the specified location. * @private */ // eslint-disable-next-line @typescript-eslint/no-explicit-any Repo.prototype.sendTransactionQueue_ = function (path, queue) { var _this = this; // Mark transactions as sent and increment retry count! var setsToIgnore = queue.map(function (txn) { return txn.currentWriteId; }); var latestState = this.getLatestState_(path, setsToIgnore); var snapToSend = latestState; var latestHash = latestState.hash(); for (var i = 0; i < queue.length; i++) { var txn = queue[i]; util.assert(txn.status === TransactionStatus.RUN, 'tryToSendTransactionQueue_: items in queue should all be run.'); txn.status = TransactionStatus.SENT; txn.retryCount++; var relativePath = Path.relativePath(path, txn.path); // If we've gotten to this point, the output snapshot must be defined. snapToSend = snapToSend.updateChild(relativePath /** @type {!Node} */, txn.currentOutputSnapshotRaw); } var dataToSend = snapToSend.val(true); var pathToSend = path; // Send the put. this.server_.put(pathToSend.toString(), dataToSend, function (status) { _this.log_('transaction put response', { path: pathToSend.toString(), status: status }); var events = []; if (status === 'ok') { // Queue up the callbacks and fire them after cleaning up all of our transaction state, since // the callback could trigger more transactions or sets. var callbacks = []; for (var i = 0; i < queue.length; i++) { queue[i].status = TransactionStatus.COMPLETED; events = events.concat(_this.serverSyncTree_.ackUserWrite(queue[i].currentWriteId)); if (queue[i].onComplete) { // We never unset the output snapshot, and given that this transaction is complete, it should be set var node = queue[i].currentOutputSnapshotResolved; var ref = new Reference(_this, queue[i].path); var snapshot = new DataSnapshot(node, ref, PRIORITY_INDEX); callbacks.push(queue[i].onComplete.bind(null, null, true, snapshot)); } queue[i].unwatcher(); } // Now remove the completed transactions. _this.pruneCompletedTransactionsBelowNode_(_this.transactionQueueTree_.subTree(path)); // There may be pending transactions that we can now send. _this.sendReadyTransactions_(); _this.eventQueue_.raiseEventsForChangedPath(path, events); // Finally, trigger onComplete callbacks. for (var i = 0; i < callbacks.length; i++) { exceptionGuard(callbacks[i]); } } else { // transactions are no longer sent. Update their status appropriately. if (status === 'datastale') { for (var i = 0; i < queue.length; i++) { if (queue[i].status === TransactionStatus.SENT_NEEDS_ABORT) { queue[i].status = TransactionStatus.NEEDS_ABORT; } else { queue[i].status = TransactionStatus.RUN; } } } else { warn('transaction at ' + pathToSend.toString() + ' failed: ' + status); for (var i = 0; i < queue.length; i++) { queue[i].status = TransactionStatus.NEEDS_ABORT; queue[i].abortReason = status; } } _this.rerunTransactions_(path); } }, latestHash); }; /** * Finds all transactions dependent on the data at changedPath and reruns them. * * Should be called any time cached data changes. * * Return the highest path that was affected by rerunning transactions. This is the path at which events need to * be raised for. * * @param {!Path} changedPath The path in mergedData that changed. * @return {!Path} The rootmost path that was affected by rerunning transactions. * @private */ // eslint-disable-next-line @typescript-eslint/no-explicit-any Repo.prototype.rerunTransactions_ = function (changedPath) { var rootMostTransactionNode = this.getAncestorTransactionNode_(changedPath); var path = rootMostTransactionNode.path(); var queue = this.buildTransactionQueue_(rootMostTransactionNode); this.rerunTransactionQueue_(queue, path); return path; }; /** * Does all the work of rerunning transactions (as well as cleans up aborted transactions and whatnot). * * @param {Array.<Transaction>} queue The queue of transactions to run. * @param {!Path} path The path the queue is for. * @private */ // eslint-disable-next-line @typescript-eslint/no-explicit-any Repo.prototype.rerunTransactionQueue_ = function (queue, path) { if (queue.length === 0) { return; // Nothing to do! } // Queue up the callbacks and fire them after cleaning up all of our transaction state, since // the callback could trigger more transactions or sets. var callbacks = []; var events = []; // Ignore all of the sets we're going to re-run. var txnsToRerun = queue.filter(function (q) { return q.status === TransactionStatus.RUN; }); var setsToIgnore = txnsToRerun.map(function (q) { return q.currentWriteId; }); for (var i = 0; i < queue.length; i++) { var transaction = queue[i]; var relativePath = Path.relativePath(path, transaction.path); var abortTransaction = false, abortReason = void 0; util.assert(relativePath !== null, 'rerunTransactionsUnderNode_: relativePath should not be null.'); if (transaction.status === TransactionStatus.NEEDS_ABORT) { abortTransaction = true; abortReason = transaction.abortReason; events = events.concat(this.serverSyncTree_.ackUserWrite(transaction.currentWriteId, true)); } else if (transaction.status === TransactionStatus.RUN) { // eslint-disable-next-line @typescript-eslint/no-explicit-any if (transaction.retryCount >= Repo.MAX_TRANSACTION_RETRIES_) { abortTransaction = true; abortReason = 'maxretry'; events = events.concat(this.serverSyncTree_.ackUserWrite(transaction.currentWriteId, true)); } else { // This code reruns a transaction var currentNode = this.getLatestState_(transaction.path, setsToIgnore); transaction.currentInputSnapshot = currentNode; var newData = queue[i].update(currentNode.val()); if (newData !== undefined) { validateFirebaseData('transaction failed: Data returned ', newData, transaction.path); var newDataNode = nodeFromJSON$1(newData); var hasExplicitPriority = typeof newData === 'object' && newData != null && util.contains(newData, '.priority'); if (!hasExplicitPriority) { // Keep the old priority if there wasn't a priority explicitly specified. newDataNode = newDataNode.updatePriority(currentNode.getPriority()); } var oldWriteId = transaction.currentWriteId; var serverValues = this.generateServerValues(); var newNodeResolved = resolveDeferredValueSnapshot(newDataNode, currentNode, serverValues); transaction.currentOutputSnapshotRaw = newDataNode; transaction.currentOutputSnapshotResolved = newNodeResolved; transaction.currentWriteId = this.getNextWriteId_(); // Mutates setsToIgnore in place setsToIgnore.splice(setsToIgnore.indexOf(oldWriteId), 1); events = events.concat(this.serverSyncTree_.applyUserOverwrite(transaction.path, newNodeResolved, transaction.currentWriteId, transaction.applyLocally)); events = events.concat(this.serverSyncTree_.ackUserWrite(oldWriteId, true)); } else { abortTransaction = true; abortReason = 'nodata'; events = events.concat(this.serverSyncTree_.ackUserWrite(transaction.currentWriteId, true)); } } } this.eventQueue_.raiseEventsForChangedPath(path, events); events = []; if (abortTransaction) { // Abort. queue[i].status = TransactionStatus.COMPLETED; // Removing a listener can trigger pruning which can muck with mergedData/visibleData (as it prunes data). // So defer the unwatcher until we're done. (function (unwatcher) { setTimeout(unwatcher, Math.floor(0)); })(queue[i].unwatcher); if (queue[i].onComplete) { if (abortReason === 'nodata') { var ref = new Reference(this, queue[i].path); // We set this field immediately, so it's safe to cast to an actual snapshot var lastInput /** @type {!Node} */ = queue[i].currentInputSnapshot; var snapshot = new DataSnapshot(lastInput, ref, PRIORITY_INDEX); callbacks.push(queue[i].onComplete.bind(null, null, false, snapshot)); } else { callbacks.push(queue[i].onComplete.bind(null, new Error(abortReason), false, null)); } } } } // Clean up completed transactions. this.pruneCompletedTransactionsBelowNode_(this.transactionQueueTree_); // Now fire callbacks, now that we're in a good, known state. for (var i = 0; i < callbacks.length; i++) { exceptionGuard(callbacks[i]); } // Try to send the transaction result to the server. this.sendReadyTransactions_(); }; /** * Returns the rootmost ancestor node of the specified path that has a pending transaction on it, or just returns * the node for the given path if there are no pending transactions on any ancestor. * * @param {!Path} path The location to start at. * @return {!Tree.<Array.<!Transaction>>} The rootmost node with a transaction. * @private */ // eslint-disable-next-line @typescript-eslint/no-explicit-any Repo.prototype.getAncestorTransactionNode_ = function (path) { var front; // Start at the root and walk deeper into the tree towards path until we find a node with pending transactions. var transactionNode = this.transactionQueueTree_; front = path.getFront(); while (front !== null && transactionNode.getValue() === null) { transactionNode = transactionNode.subTree(front); path = path.popFront(); front = path.getFront(); } return transactionNode; }; /** * Builds the queue of all transactions at or below the specified transactionNode. * * @param {!Tree.<Array.<Transaction>>} transactionNode * @return {Array.<Transaction>} The generated queue. * @private */ // eslint-disable-next-line @typescript-eslint/no-explicit-any Repo.prototype.buildTransactionQueue_ = function (transactionNode) { // Walk any child transaction queues and aggregate them into a single queue. var transactionQueue = []; this.aggregateTransactionQueuesForNode_(transactionNode, transactionQueue); // Sort them by the order the transactions were created. transactionQueue.sort(function (a, b) { return a.order - b.order; }); return transactionQueue; }; /** * @param {!Tree.<Array.<Transaction>>} node * @param {Array.<Transaction>} queue * @private */ // eslint-disable-next-line @typescript-eslint/no-explicit-any Repo.prototype.aggregateTransactionQueuesForNode_ = function (node, queue) { var _this = this; var nodeQueue = node.getValue(); if (nodeQueue !== null) { for (var i = 0; i < nodeQueue.length; i++) { queue.push(nodeQueue[i]); } } node.forEachChild(function (child) { _this.aggregateTransactionQueuesForNode_(child, queue); }); }; /** * Remove COMPLETED transactions at or below this node in the transactionQueueTree_. * * @param {!Tree.<Array.<!Transaction>>} node * @private */ // eslint-disable-next-line @typescript-eslint/no-explicit-any Repo.prototype.pruneCompletedTransactionsBelowNode_ = function (node) { var _this = this; var queue = node.getValue(); if (queue) { var to = 0; for (var from = 0; from < queue.length; from++) { if (queue[from].status !== TransactionStatus.COMPLETED) { queue[to] = queue[from]; to++; } } queue.length = to; node.setValue(queue.length > 0 ? queue : null); } node.forEachChild(function (childNode) { _this.pruneCompletedTransactionsBelowNode_(childNode); }); }; /** * Aborts all transactions on ancestors or descendants of the specified path. Called when doing a set() or update() * since we consider them incompatible with transactions. * * @param {!Path} path Path for which we want to abort related transactions. * @return {!Path} * @private */ // eslint-disable-next-line @typescript-eslint/no-explicit-any Repo.prototype.abortTransactions_ = function (path) { var _this = this; var affectedPath = this.getAncestorTransactionNode_(path).path(); var transactionNode = this.transactionQueueTree_.subTree(path); transactionNode.forEachAncestor(function (node) { _this.abortTransactionsOnNode_(node); }); this.abortTransactionsOnNode_(transactionNode); transactionNode.forEachDescendant(function (node) { _this.abortTransactionsOnNode_(node); }); return affectedPath; }; /** * Abort transactions stored in this transaction queue node. * * @param {!Tree.<Array.<Transaction>>} node Node to abort transactions for. * @private */ // eslint-disable-next-line @typescript-eslint/no-explicit-any Repo.prototype.abortTransactionsOnNode_ = function (node) { var queue = node.getValue(); if (queue !== null) { // Queue up the callbacks and fire them after cleaning up all of our transaction state, since // the callback could trigger more transactions or sets. var callbacks = []; // Go through queue. Any already-sent transactions must be marked for abort, while the unsent ones // can be immediately aborted and removed. var events = []; var lastSent = -1; for (var i = 0; i < queue.length; i++) { if (queue[i].status === TransactionStatus.SENT_NEEDS_ABORT) ; else if (queue[i].status === TransactionStatus.SENT) { util.assert(lastSent === i - 1, 'All SENT items should be at beginning of queue.'); lastSent = i; // Mark transaction for abort when it comes back. queue[i].status = TransactionStatus.SENT_NEEDS_ABORT; queue[i].abortReason = 'set'; } else { util.assert(queue[i].status === TransactionStatus.RUN, 'Unexpected transaction status in abort'); // We can abort it immediately. queue[i].unwatcher(); events = events.concat(this.serverSyncTree_.ackUserWrite(queue[i].currentWriteId, true)); if (queue[i].onComplete) { var snapshot = null; callbacks.push(queue[i].onComplete.bind(null, new Error('set'), false, snapshot)); } } } if (lastSent === -1) { // We're not waiting for any sent transactions. We can clear the queue. node.setValue(null); } else { // Remove the transactions we aborted. queue.length = lastSent + 1; } // Now fire the callbacks. this.eventQueue_.raiseEventsForChangedPath(node.path(), events); for (var i = 0; i < callbacks.length; i++) { exceptionGuard(callbacks[i]); } } }; /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Abstraction around FirebaseApp's token fetching capabilities. */ var FirebaseAuthTokenProvider = /** @class */ (function () { function FirebaseAuthTokenProvider(app_, authProvider_) { var _this = this; this.app_ = app_; this.authProvider_ = authProvider_; this.auth_ = null; this.auth_ = authProvider_.getImmediate({ optional: true }); if (!this.auth_) { authProvider_.get().then(function (auth) { return (_this.auth_ = auth); }); } } /** * @param {boolean} forceRefresh * @return {!Promise<FirebaseAuthTokenData>} */ FirebaseAuthTokenProvider.prototype.getToken = function (forceRefresh) { if (!this.auth_) { return Promise.resolve(null); } return this.auth_.getToken(forceRefresh).catch(function (error) { // TODO: Need to figure out all the cases this is raised and whether // this makes sense. if (error && error.code === 'auth/token-not-initialized') { log('Got auth/token-not-initialized error. Treating as null token.'); return null; } else { return Promise.reject(error); } }); }; FirebaseAuthTokenProvider.prototype.addTokenChangeListener = function (listener) { // TODO: We might want to wrap the listener and call it with no args to // avoid a leaky abstraction, but that makes removing the listener harder. if (this.auth_) { this.auth_.addAuthTokenListener(listener); } else { setTimeout(function () { return listener(null); }, 0); this.authProvider_ .get() .then(function (auth) { return auth.addAuthTokenListener(listener); }); } }; FirebaseAuthTokenProvider.prototype.removeTokenChangeListener = function (listener) { this.authProvider_ .get() .then(function (auth) { return auth.removeAuthTokenListener(listener); }); }; FirebaseAuthTokenProvider.prototype.notifyForInvalidToken = function () { var errorMessage = 'Provided authentication credentials for the app named "' + this.app_.name + '" are invalid. This usually indicates your app was not ' + 'initialized correctly. '; if ('credential' in this.app_.options) { errorMessage += 'Make sure the "credential" property provided to initializeApp() ' + 'is authorized to access the specified "databaseURL" and is from the correct ' + 'project.'; } else if ('serviceAccount' in this.app_.options) { errorMessage += 'Make sure the "serviceAccount" property provided to initializeApp() ' + 'is authorized to access the specified "databaseURL" and is from the correct ' + 'project.'; } else { errorMessage += 'Make sure the "apiKey" and "databaseURL" properties provided to ' + 'initializeApp() match the values provided for your app at ' + 'https://console.firebase.google.com/.'; } warn(errorMessage); }; return FirebaseAuthTokenProvider; }()); /* Auth token provider that the Admin SDK uses to connect to the Emulator. */ var EmulatorAdminTokenProvider = /** @class */ (function () { function EmulatorAdminTokenProvider() { } EmulatorAdminTokenProvider.prototype.getToken = function (forceRefresh) { return Promise.resolve({ accessToken: EmulatorAdminTokenProvider.EMULATOR_AUTH_TOKEN }); }; EmulatorAdminTokenProvider.prototype.addTokenChangeListener = function (listener) { // Invoke the listener immediately to match the behavior in Firebase Auth // (see packages/auth/src/auth.js#L1807) listener(EmulatorAdminTokenProvider.EMULATOR_AUTH_TOKEN); }; EmulatorAdminTokenProvider.prototype.removeTokenChangeListener = function (listener) { }; EmulatorAdminTokenProvider.prototype.notifyForInvalidToken = function () { }; EmulatorAdminTokenProvider.EMULATOR_AUTH_TOKEN = 'owner'; return EmulatorAdminTokenProvider; }()); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * This variable is also defined in the firebase node.js admin SDK. Before * modifying this definition, consult the definition in: * * https://github.com/firebase/firebase-admin-node * * and make sure the two are consistent. */ var FIREBASE_DATABASE_EMULATOR_HOST_VAR = 'FIREBASE_DATABASE_EMULATOR_HOST'; var _staticInstance; /** * Creates and caches Repo instances. */ var RepoManager = /** @class */ (function () { function RepoManager() { /** * @private {!Object.<string, Object<string, !fb.core.Repo>>} */ this.repos_ = {}; /** * If true, new Repos will be created to use ReadonlyRestClient (for testing purposes). * @private {boolean} */ this.useRestClient_ = false; } RepoManager.getInstance = function () { if (!_staticInstance) { _staticInstance = new RepoManager(); } return _staticInstance; }; // TODO(koss): Remove these functions unless used in tests? RepoManager.prototype.interrupt = function () { var e_1, _a, e_2, _b; try { for (var _c = tslib.__values(Object.keys(this.repos_)), _d = _c.next(); !_d.done; _d = _c.next()) { var appName = _d.value; try { for (var _e = (e_2 = void 0, tslib.__values(Object.keys(this.repos_[appName]))), _f = _e.next(); !_f.done; _f = _e.next()) { var dbUrl = _f.value; this.repos_[appName][dbUrl].interrupt(); } } catch (e_2_1) { e_2 = { error: e_2_1 }; } finally { try { if (_f && !_f.done && (_b = _e.return)) _b.call(_e); } finally { if (e_2) throw e_2.error; } } } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (_d && !_d.done && (_a = _c.return)) _a.call(_c); } finally { if (e_1) throw e_1.error; } } }; RepoManager.prototype.resume = function () { var e_3, _a, e_4, _b; try { for (var _c = tslib.__values(Object.keys(this.repos_)), _d = _c.next(); !_d.done; _d = _c.next()) { var appName = _d.value; try { for (var _e = (e_4 = void 0, tslib.__values(Object.keys(this.repos_[appName]))), _f = _e.next(); !_f.done; _f = _e.next()) { var dbUrl = _f.value; this.repos_[appName][dbUrl].resume(); } } catch (e_4_1) { e_4 = { error: e_4_1 }; } finally { try { if (_f && !_f.done && (_b = _e.return)) _b.call(_e); } finally { if (e_4) throw e_4.error; } } } } catch (e_3_1) { e_3 = { error: e_3_1 }; } finally { try { if (_d && !_d.done && (_a = _c.return)) _a.call(_c); } finally { if (e_3) throw e_3.error; } } }; /** * This function should only ever be called to CREATE a new database instance. * * @param {!FirebaseApp} app * @return {!Database} */ RepoManager.prototype.databaseFromApp = function (app, authProvider, url, nodeAdmin) { var dbUrl = url || app.options.databaseURL; if (dbUrl === undefined) { if (!app.options.projectId) { fatal("Can't determine Firebase Database URL. Be sure to include " + ' a Project ID when calling firebase.initializeApp().'); } log('Using default host for project ', app.options.projectId); dbUrl = app.options.projectId + "-default-rtdb.firebaseio.com"; } var parsedUrl = parseRepoInfo(dbUrl, nodeAdmin); var repoInfo = parsedUrl.repoInfo; var isEmulator; var dbEmulatorHost = undefined; if (typeof process !== 'undefined') { dbEmulatorHost = process.env[FIREBASE_DATABASE_EMULATOR_HOST_VAR]; } if (dbEmulatorHost) { isEmulator = true; dbUrl = "http://" + dbEmulatorHost + "?ns=" + repoInfo.namespace; parsedUrl = parseRepoInfo(dbUrl, nodeAdmin); repoInfo = parsedUrl.repoInfo; } else { isEmulator = !parsedUrl.repoInfo.secure; } var authTokenProvider = nodeAdmin && isEmulator ? new EmulatorAdminTokenProvider() : new FirebaseAuthTokenProvider(app, authProvider); validateUrl('Invalid Firebase Database URL', 1, parsedUrl); if (!parsedUrl.path.isEmpty()) { fatal('Database URL must point to the root of a Firebase Database ' + '(not including a child path).'); } var repo = this.createRepo(repoInfo, app, authTokenProvider); return repo.database; }; /** * Remove the repo and make sure it is disconnected. * * @param {!Repo} repo */ RepoManager.prototype.deleteRepo = function (repo) { var appRepos = util.safeGet(this.repos_, repo.app.name); // This should never happen... if (!appRepos || util.safeGet(appRepos, repo.repoInfo_.toURLString()) !== repo) { fatal("Database " + repo.app.name + "(" + repo.repoInfo_ + ") has already been deleted."); } repo.interrupt(); delete appRepos[repo.repoInfo_.toURLString()]; }; /** * Ensures a repo doesn't already exist and then creates one using the * provided app. * * @param {!RepoInfo} repoInfo The metadata about the Repo * @param {!FirebaseApp} app * @return {!Repo} The Repo object for the specified server / repoName. */ RepoManager.prototype.createRepo = function (repoInfo, app, authTokenProvider) { var appRepos = util.safeGet(this.repos_, app.name); if (!appRepos) { appRepos = {}; this.repos_[app.name] = appRepos; } var repo = util.safeGet(appRepos, repoInfo.toURLString()); if (repo) { fatal('Database initialized multiple times. Please make sure the format of the database URL matches with each database() call.'); } repo = new Repo(repoInfo, this.useRestClient_, app, authTokenProvider); appRepos[repoInfo.toURLString()] = repo; return repo; }; /** * Forces us to use ReadonlyRestClient instead of PersistentConnection for new Repos. * @param {boolean} forceRestClient */ RepoManager.prototype.forceRestClient = function (forceRestClient) { this.useRestClient_ = forceRestClient; }; return RepoManager; }()); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Class representing a firebase database. * @implements {FirebaseService} */ var Database = /** @class */ (function () { /** * The constructor should not be called by users of our public API. * @param {!Repo} repo_ */ function Database(repo_) { this.repo_ = repo_; if (!(repo_ instanceof Repo)) { fatal("Don't call new Database() directly - please use firebase.database()."); } /** @type {Reference} */ this.root_ = new Reference(repo_, Path.Empty); this.INTERNAL = new DatabaseInternals(this); } Object.defineProperty(Database.prototype, "app", { get: function () { return this.repo_.app; }, enumerable: false, configurable: true }); Database.prototype.ref = function (path) { this.checkDeleted_('ref'); util.validateArgCount('database.ref', 0, 1, arguments.length); if (path instanceof Reference) { return this.refFromURL(path.toString()); } return path !== undefined ? this.root_.child(path) : this.root_; }; /** * Returns a reference to the root or the path specified in url. * We throw a exception if the url is not in the same domain as the * current repo. * @param {string} url * @return {!Reference} Firebase reference. */ Database.prototype.refFromURL = function (url) { /** @const {string} */ var apiName = 'database.refFromURL'; this.checkDeleted_(apiName); util.validateArgCount(apiName, 1, 1, arguments.length); var parsedURL = parseRepoInfo(url, this.repo_.repoInfo_.nodeAdmin); validateUrl(apiName, 1, parsedURL); var repoInfo = parsedURL.repoInfo; if (repoInfo.host !== this.repo_.repoInfo_.host) { fatal(apiName + ': Host name does not match the current database: ' + '(found ' + repoInfo.host + ' but expected ' + this.repo_.repoInfo_.host + ')'); } return this.ref(parsedURL.path.toString()); }; /** * @param {string} apiName */ Database.prototype.checkDeleted_ = function (apiName) { if (this.repo_ === null) { fatal('Cannot call ' + apiName + ' on a deleted database.'); } }; // Make individual repo go offline. Database.prototype.goOffline = function () { util.validateArgCount('database.goOffline', 0, 0, arguments.length); this.checkDeleted_('goOffline'); this.repo_.interrupt(); }; Database.prototype.goOnline = function () { util.validateArgCount('database.goOnline', 0, 0, arguments.length); this.checkDeleted_('goOnline'); this.repo_.resume(); }; Database.ServerValue = { TIMESTAMP: { '.sv': 'timestamp' }, increment: function (delta) { return { '.sv': { 'increment': delta } }; } }; return Database; }()); var DatabaseInternals = /** @class */ (function () { /** @param {!Database} database */ function DatabaseInternals(database) { this.database = database; } /** @return {Promise<void>} */ DatabaseInternals.prototype.delete = function () { return tslib.__awaiter(this, void 0, void 0, function () { return tslib.__generator(this, function (_a) { // eslint-disable-next-line @typescript-eslint/no-explicit-any this.database.checkDeleted_('delete'); // eslint-disable-next-line @typescript-eslint/no-explicit-any RepoManager.getInstance().deleteRepo(this.database.repo_); // eslint-disable-next-line @typescript-eslint/no-explicit-any this.database.repo_ = null; // eslint-disable-next-line @typescript-eslint/no-explicit-any this.database.root_ = null; this.database.INTERNAL = null; this.database = null; return [2 /*return*/]; }); }); }; return DatabaseInternals; }()); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * INTERNAL methods for internal-use only (tests, etc.). * * Customers shouldn't use these or else should be aware that they could break at any time. * * @const */ var forceLongPolling = function () { WebSocketConnection.forceDisallow(); BrowserPollConnection.forceAllow(); }; var forceWebSockets = function () { BrowserPollConnection.forceDisallow(); }; /* Used by App Manager */ var isWebSocketsAvailable = function () { return WebSocketConnection['isAvailable'](); }; var setSecurityDebugCallback = function (ref, callback) { // eslint-disable-next-line @typescript-eslint/no-explicit-any ref.repo.persistentConnection_.securityDebugCallback_ = callback; }; var stats = function (ref, showDelta) { ref.repo.stats(showDelta); }; var statsIncrementCounter = function (ref, metric) { ref.repo.statsIncrementCounter(metric); }; var dataUpdateCount = function (ref) { return ref.repo.dataUpdateCount; }; var interceptServerData = function (ref, callback) { return ref.repo.interceptServerData_(callback); }; var INTERNAL = /*#__PURE__*/Object.freeze({ __proto__: null, forceLongPolling: forceLongPolling, forceWebSockets: forceWebSockets, isWebSocketsAvailable: isWebSocketsAvailable, setSecurityDebugCallback: setSecurityDebugCallback, stats: stats, statsIncrementCounter: statsIncrementCounter, dataUpdateCount: dataUpdateCount, interceptServerData: interceptServerData }); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var DataConnection = PersistentConnection; /** * @param {!string} pathString * @param {function(*)} onComplete */ // eslint-disable-next-line @typescript-eslint/no-explicit-any PersistentConnection.prototype.simpleListen = function (pathString, onComplete) { this.sendRequest('q', { p: pathString }, onComplete); }; /** * @param {*} data * @param {function(*)} onEcho */ // eslint-disable-next-line @typescript-eslint/no-explicit-any PersistentConnection.prototype.echo = function (data, onEcho) { this.sendRequest('echo', { d: data }, onEcho); }; // RealTimeConnection properties that we use in tests. var RealTimeConnection = Connection; /** * @param {function(): string} newHash * @return {function()} */ var hijackHash = function (newHash) { var oldPut = PersistentConnection.prototype.put; PersistentConnection.prototype.put = function (pathString, data, onComplete, hash) { if (hash !== undefined) { hash = newHash(); } oldPut.call(this, pathString, data, onComplete, hash); }; return function () { PersistentConnection.prototype.put = oldPut; }; }; /** * @type {function(new:RepoInfo, !string, boolean, !string, boolean): undefined} */ var ConnectionTarget = RepoInfo; /** * @param {!Query} query * @return {!string} */ var queryIdentifier = function (query) { return query.queryIdentifier(); }; /** * Forces the RepoManager to create Repos that use ReadonlyRestClient instead of PersistentConnection. * * @param {boolean} forceRestClient */ var forceRestClient = function (forceRestClient) { RepoManager.getInstance().forceRestClient(forceRestClient); }; var TEST_ACCESS = /*#__PURE__*/Object.freeze({ __proto__: null, DataConnection: DataConnection, RealTimeConnection: RealTimeConnection, hijackHash: hijackHash, ConnectionTarget: ConnectionTarget, queryIdentifier: queryIdentifier, forceRestClient: forceRestClient }); var name = "@firebase/database"; var version = "0.6.13"; /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var ServerValue = Database.ServerValue; function registerDatabase(instance) { // set SDK_VERSION setSDKVersion(instance.SDK_VERSION); // Register the Database Service with the 'firebase' namespace. var namespace = instance.INTERNAL.registerComponent(new component.Component('database', function (container, url) { /* Dependencies */ // getImmediate for FirebaseApp will always succeed var app = container.getProvider('app').getImmediate(); var authProvider = container.getProvider('auth-internal'); return RepoManager.getInstance().databaseFromApp(app, authProvider, url); }, "PUBLIC" /* PUBLIC */) .setServiceProps( // firebase.database namespace properties { Reference: Reference, Query: Query, Database: Database, DataSnapshot: DataSnapshot, enableLogging: enableLogging, INTERNAL: INTERNAL, ServerValue: ServerValue, TEST_ACCESS: TEST_ACCESS }) .setMultipleInstances(true)); instance.registerVersion(name, version); if (util.isNodeSdk()) { module.exports = namespace; } } registerDatabase(firebase__default['default']); exports.DataSnapshot = DataSnapshot; exports.Database = Database; exports.OnDisconnect = OnDisconnect; exports.Query = Query; exports.Reference = Reference; exports.ServerValue = ServerValue; exports.enableLogging = enableLogging; exports.registerDatabase = registerDatabase; //# sourceMappingURL=index.cjs.js.map /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__("./node_modules/process/browser.js"))) /***/ }), /***/ "./node_modules/@firebase/database/node_modules/@firebase/component/dist/index.cjs.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, '__esModule', { value: true }); var tslib = __webpack_require__("./node_modules/@firebase/database/node_modules/tslib/tslib.es6.js"); var util = __webpack_require__("./node_modules/@firebase/database/node_modules/@firebase/util/dist/index.cjs.js"); /** * Component for service name T, e.g. `auth`, `auth-internal` */ var Component = /** @class */ (function () { /** * * @param name The public service name, e.g. app, auth, firestore, database * @param instanceFactory Service factory responsible for creating the public interface * @param type whether the service provided by the component is public or private */ function Component(name, instanceFactory, type) { this.name = name; this.instanceFactory = instanceFactory; this.type = type; this.multipleInstances = false; /** * Properties to be added to the service namespace */ this.serviceProps = {}; this.instantiationMode = "LAZY" /* LAZY */; } Component.prototype.setInstantiationMode = function (mode) { this.instantiationMode = mode; return this; }; Component.prototype.setMultipleInstances = function (multipleInstances) { this.multipleInstances = multipleInstances; return this; }; Component.prototype.setServiceProps = function (props) { this.serviceProps = props; return this; }; return Component; }()); /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var DEFAULT_ENTRY_NAME = '[DEFAULT]'; /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Provider for instance for service name T, e.g. 'auth', 'auth-internal' * NameServiceMapping[T] is an alias for the type of the instance */ var Provider = /** @class */ (function () { function Provider(name, container) { this.name = name; this.container = container; this.component = null; this.instances = new Map(); this.instancesDeferred = new Map(); } /** * @param identifier A provider can provide mulitple instances of a service * if this.component.multipleInstances is true. */ Provider.prototype.get = function (identifier) { if (identifier === void 0) { identifier = DEFAULT_ENTRY_NAME; } // if multipleInstances is not supported, use the default name var normalizedIdentifier = this.normalizeInstanceIdentifier(identifier); if (!this.instancesDeferred.has(normalizedIdentifier)) { var deferred = new util.Deferred(); this.instancesDeferred.set(normalizedIdentifier, deferred); // If the service instance is available, resolve the promise with it immediately try { var instance = this.getOrInitializeService(normalizedIdentifier); if (instance) { deferred.resolve(instance); } } catch (e) { // when the instance factory throws an exception during get(), it should not cause // a fatal error. We just return the unresolved promise in this case. } } return this.instancesDeferred.get(normalizedIdentifier).promise; }; Provider.prototype.getImmediate = function (options) { var _a = tslib.__assign({ identifier: DEFAULT_ENTRY_NAME, optional: false }, options), identifier = _a.identifier, optional = _a.optional; // if multipleInstances is not supported, use the default name var normalizedIdentifier = this.normalizeInstanceIdentifier(identifier); try { var instance = this.getOrInitializeService(normalizedIdentifier); if (!instance) { if (optional) { return null; } throw Error("Service " + this.name + " is not available"); } return instance; } catch (e) { if (optional) { return null; } else { throw e; } } }; Provider.prototype.getComponent = function () { return this.component; }; Provider.prototype.setComponent = function (component) { var e_1, _a; if (component.name !== this.name) { throw Error("Mismatching Component " + component.name + " for Provider " + this.name + "."); } if (this.component) { throw Error("Component for " + this.name + " has already been provided"); } this.component = component; // if the service is eager, initialize the default instance if (isComponentEager(component)) { try { this.getOrInitializeService(DEFAULT_ENTRY_NAME); } catch (e) { // when the instance factory for an eager Component throws an exception during the eager // initialization, it should not cause a fatal error. // TODO: Investigate if we need to make it configurable, because some component may want to cause // a fatal error in this case? } } try { // Create service instances for the pending promises and resolve them // NOTE: if this.multipleInstances is false, only the default instance will be created // and all promises with resolve with it regardless of the identifier. for (var _b = tslib.__values(this.instancesDeferred.entries()), _c = _b.next(); !_c.done; _c = _b.next()) { var _d = tslib.__read(_c.value, 2), instanceIdentifier = _d[0], instanceDeferred = _d[1]; var normalizedIdentifier = this.normalizeInstanceIdentifier(instanceIdentifier); try { // `getOrInitializeService()` should always return a valid instance since a component is guaranteed. use ! to make typescript happy. var instance = this.getOrInitializeService(normalizedIdentifier); instanceDeferred.resolve(instance); } catch (e) { // when the instance factory throws an exception, it should not cause // a fatal error. We just leave the promise unresolved. } } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (_c && !_c.done && (_a = _b.return)) _a.call(_b); } finally { if (e_1) throw e_1.error; } } }; Provider.prototype.clearInstance = function (identifier) { if (identifier === void 0) { identifier = DEFAULT_ENTRY_NAME; } this.instancesDeferred.delete(identifier); this.instances.delete(identifier); }; // app.delete() will call this method on every provider to delete the services // TODO: should we mark the provider as deleted? Provider.prototype.delete = function () { return tslib.__awaiter(this, void 0, void 0, function () { var services; return tslib.__generator(this, function (_a) { switch (_a.label) { case 0: services = Array.from(this.instances.values()); return [4 /*yield*/, Promise.all(tslib.__spread(services .filter(function (service) { return 'INTERNAL' in service; }) // legacy services // eslint-disable-next-line @typescript-eslint/no-explicit-any .map(function (service) { return service.INTERNAL.delete(); }), services .filter(function (service) { return '_delete' in service; }) // modularized services // eslint-disable-next-line @typescript-eslint/no-explicit-any .map(function (service) { return service._delete(); })))]; case 1: _a.sent(); return [2 /*return*/]; } }); }); }; Provider.prototype.isComponentSet = function () { return this.component != null; }; Provider.prototype.getOrInitializeService = function (identifier) { var instance = this.instances.get(identifier); if (!instance && this.component) { instance = this.component.instanceFactory(this.container, normalizeIdentifierForFactory(identifier)); this.instances.set(identifier, instance); } return instance || null; }; Provider.prototype.normalizeInstanceIdentifier = function (identifier) { if (this.component) { return this.component.multipleInstances ? identifier : DEFAULT_ENTRY_NAME; } else { return identifier; // assume multiple instances are supported before the component is provided. } }; return Provider; }()); // undefined should be passed to the service factory for the default instance function normalizeIdentifierForFactory(identifier) { return identifier === DEFAULT_ENTRY_NAME ? undefined : identifier; } function isComponentEager(component) { return component.instantiationMode === "EAGER" /* EAGER */; } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * ComponentContainer that provides Providers for service name T, e.g. `auth`, `auth-internal` */ var ComponentContainer = /** @class */ (function () { function ComponentContainer(name) { this.name = name; this.providers = new Map(); } /** * * @param component Component being added * @param overwrite When a component with the same name has already been registered, * if overwrite is true: overwrite the existing component with the new component and create a new * provider with the new component. It can be useful in tests where you want to use different mocks * for different tests. * if overwrite is false: throw an exception */ ComponentContainer.prototype.addComponent = function (component) { var provider = this.getProvider(component.name); if (provider.isComponentSet()) { throw new Error("Component " + component.name + " has already been registered with " + this.name); } provider.setComponent(component); }; ComponentContainer.prototype.addOrOverwriteComponent = function (component) { var provider = this.getProvider(component.name); if (provider.isComponentSet()) { // delete the existing provider from the container, so we can register the new component this.providers.delete(component.name); } this.addComponent(component); }; /** * getProvider provides a type safe interface where it can only be called with a field name * present in NameServiceMapping interface. * * Firebase SDKs providing services should extend NameServiceMapping interface to register * themselves. */ ComponentContainer.prototype.getProvider = function (name) { if (this.providers.has(name)) { return this.providers.get(name); } // create a Provider for a service that hasn't registered with Firebase var provider = new Provider(name, this); this.providers.set(name, provider); return provider; }; ComponentContainer.prototype.getProviders = function () { return Array.from(this.providers.values()); }; return ComponentContainer; }()); exports.Component = Component; exports.ComponentContainer = ComponentContainer; exports.Provider = Provider; //# sourceMappingURL=index.cjs.js.map /***/ }), /***/ "./node_modules/@firebase/database/node_modules/@firebase/util/dist/index.cjs.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(global) { Object.defineProperty(exports, '__esModule', { value: true }); var tslib = __webpack_require__("./node_modules/@firebase/database/node_modules/tslib/tslib.es6.js"); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * @fileoverview Firebase constants. Some of these (@defines) can be overridden at compile-time. */ var CONSTANTS = { /** * @define {boolean} Whether this is the client Node.js SDK. */ NODE_CLIENT: false, /** * @define {boolean} Whether this is the Admin Node.js SDK. */ NODE_ADMIN: false, /** * Firebase SDK Version */ SDK_VERSION: '${JSCORE_VERSION}' }; /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Throws an error if the provided assertion is falsy */ var assert = function (assertion, message) { if (!assertion) { throw assertionError(message); } }; /** * Returns an Error object suitable for throwing. */ var assertionError = function (message) { return new Error('Firebase Database (' + CONSTANTS.SDK_VERSION + ') INTERNAL ASSERT FAILED: ' + message); }; /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var stringToByteArray = function (str) { // TODO(user): Use native implementations if/when available var out = []; var p = 0; for (var i = 0; i < str.length; i++) { var c = str.charCodeAt(i); if (c < 128) { out[p++] = c; } else if (c < 2048) { out[p++] = (c >> 6) | 192; out[p++] = (c & 63) | 128; } else if ((c & 0xfc00) === 0xd800 && i + 1 < str.length && (str.charCodeAt(i + 1) & 0xfc00) === 0xdc00) { // Surrogate Pair c = 0x10000 + ((c & 0x03ff) << 10) + (str.charCodeAt(++i) & 0x03ff); out[p++] = (c >> 18) | 240; out[p++] = ((c >> 12) & 63) | 128; out[p++] = ((c >> 6) & 63) | 128; out[p++] = (c & 63) | 128; } else { out[p++] = (c >> 12) | 224; out[p++] = ((c >> 6) & 63) | 128; out[p++] = (c & 63) | 128; } } return out; }; /** * Turns an array of numbers into the string given by the concatenation of the * characters to which the numbers correspond. * @param bytes Array of numbers representing characters. * @return Stringification of the array. */ var byteArrayToString = function (bytes) { // TODO(user): Use native implementations if/when available var out = []; var pos = 0, c = 0; while (pos < bytes.length) { var c1 = bytes[pos++]; if (c1 < 128) { out[c++] = String.fromCharCode(c1); } else if (c1 > 191 && c1 < 224) { var c2 = bytes[pos++]; out[c++] = String.fromCharCode(((c1 & 31) << 6) | (c2 & 63)); } else if (c1 > 239 && c1 < 365) { // Surrogate Pair var c2 = bytes[pos++]; var c3 = bytes[pos++]; var c4 = bytes[pos++]; var u = (((c1 & 7) << 18) | ((c2 & 63) << 12) | ((c3 & 63) << 6) | (c4 & 63)) - 0x10000; out[c++] = String.fromCharCode(0xd800 + (u >> 10)); out[c++] = String.fromCharCode(0xdc00 + (u & 1023)); } else { var c2 = bytes[pos++]; var c3 = bytes[pos++]; out[c++] = String.fromCharCode(((c1 & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63)); } } return out.join(''); }; // We define it as an object literal instead of a class because a class compiled down to es5 can't // be treeshaked. https://github.com/rollup/rollup/issues/1691 // Static lookup maps, lazily populated by init_() var base64 = { /** * Maps bytes to characters. */ byteToCharMap_: null, /** * Maps characters to bytes. */ charToByteMap_: null, /** * Maps bytes to websafe characters. * @private */ byteToCharMapWebSafe_: null, /** * Maps websafe characters to bytes. * @private */ charToByteMapWebSafe_: null, /** * Our default alphabet, shared between * ENCODED_VALS and ENCODED_VALS_WEBSAFE */ ENCODED_VALS_BASE: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' + 'abcdefghijklmnopqrstuvwxyz' + '0123456789', /** * Our default alphabet. Value 64 (=) is special; it means "nothing." */ get ENCODED_VALS() { return this.ENCODED_VALS_BASE + '+/='; }, /** * Our websafe alphabet. */ get ENCODED_VALS_WEBSAFE() { return this.ENCODED_VALS_BASE + '-_.'; }, /** * Whether this browser supports the atob and btoa functions. This extension * started at Mozilla but is now implemented by many browsers. We use the * ASSUME_* variables to avoid pulling in the full useragent detection library * but still allowing the standard per-browser compilations. * */ HAS_NATIVE_SUPPORT: typeof atob === 'function', /** * Base64-encode an array of bytes. * * @param input An array of bytes (numbers with * value in [0, 255]) to encode. * @param webSafe Boolean indicating we should use the * alternative alphabet. * @return The base64 encoded string. */ encodeByteArray: function (input, webSafe) { if (!Array.isArray(input)) { throw Error('encodeByteArray takes an array as a parameter'); } this.init_(); var byteToCharMap = webSafe ? this.byteToCharMapWebSafe_ : this.byteToCharMap_; var output = []; for (var i = 0; i < input.length; i += 3) { var byte1 = input[i]; var haveByte2 = i + 1 < input.length; var byte2 = haveByte2 ? input[i + 1] : 0; var haveByte3 = i + 2 < input.length; var byte3 = haveByte3 ? input[i + 2] : 0; var outByte1 = byte1 >> 2; var outByte2 = ((byte1 & 0x03) << 4) | (byte2 >> 4); var outByte3 = ((byte2 & 0x0f) << 2) | (byte3 >> 6); var outByte4 = byte3 & 0x3f; if (!haveByte3) { outByte4 = 64; if (!haveByte2) { outByte3 = 64; } } output.push(byteToCharMap[outByte1], byteToCharMap[outByte2], byteToCharMap[outByte3], byteToCharMap[outByte4]); } return output.join(''); }, /** * Base64-encode a string. * * @param input A string to encode. * @param webSafe If true, we should use the * alternative alphabet. * @return The base64 encoded string. */ encodeString: function (input, webSafe) { // Shortcut for Mozilla browsers that implement // a native base64 encoder in the form of "btoa/atob" if (this.HAS_NATIVE_SUPPORT && !webSafe) { return btoa(input); } return this.encodeByteArray(stringToByteArray(input), webSafe); }, /** * Base64-decode a string. * * @param input to decode. * @param webSafe True if we should use the * alternative alphabet. * @return string representing the decoded value. */ decodeString: function (input, webSafe) { // Shortcut for Mozilla browsers that implement // a native base64 encoder in the form of "btoa/atob" if (this.HAS_NATIVE_SUPPORT && !webSafe) { return atob(input); } return byteArrayToString(this.decodeStringToByteArray(input, webSafe)); }, /** * Base64-decode a string. * * In base-64 decoding, groups of four characters are converted into three * bytes. If the encoder did not apply padding, the input length may not * be a multiple of 4. * * In this case, the last group will have fewer than 4 characters, and * padding will be inferred. If the group has one or two characters, it decodes * to one byte. If the group has three characters, it decodes to two bytes. * * @param input Input to decode. * @param webSafe True if we should use the web-safe alphabet. * @return bytes representing the decoded value. */ decodeStringToByteArray: function (input, webSafe) { this.init_(); var charToByteMap = webSafe ? this.charToByteMapWebSafe_ : this.charToByteMap_; var output = []; for (var i = 0; i < input.length;) { var byte1 = charToByteMap[input.charAt(i++)]; var haveByte2 = i < input.length; var byte2 = haveByte2 ? charToByteMap[input.charAt(i)] : 0; ++i; var haveByte3 = i < input.length; var byte3 = haveByte3 ? charToByteMap[input.charAt(i)] : 64; ++i; var haveByte4 = i < input.length; var byte4 = haveByte4 ? charToByteMap[input.charAt(i)] : 64; ++i; if (byte1 == null || byte2 == null || byte3 == null || byte4 == null) { throw Error(); } var outByte1 = (byte1 << 2) | (byte2 >> 4); output.push(outByte1); if (byte3 !== 64) { var outByte2 = ((byte2 << 4) & 0xf0) | (byte3 >> 2); output.push(outByte2); if (byte4 !== 64) { var outByte3 = ((byte3 << 6) & 0xc0) | byte4; output.push(outByte3); } } } return output; }, /** * Lazy static initialization function. Called before * accessing any of the static map variables. * @private */ init_: function () { if (!this.byteToCharMap_) { this.byteToCharMap_ = {}; this.charToByteMap_ = {}; this.byteToCharMapWebSafe_ = {}; this.charToByteMapWebSafe_ = {}; // We want quick mappings back and forth, so we precompute two maps. for (var i = 0; i < this.ENCODED_VALS.length; i++) { this.byteToCharMap_[i] = this.ENCODED_VALS.charAt(i); this.charToByteMap_[this.byteToCharMap_[i]] = i; this.byteToCharMapWebSafe_[i] = this.ENCODED_VALS_WEBSAFE.charAt(i); this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[i]] = i; // Be forgiving when decoding and correctly decode both encodings. if (i >= this.ENCODED_VALS_BASE.length) { this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(i)] = i; this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(i)] = i; } } } } }; /** * URL-safe base64 encoding */ var base64Encode = function (str) { var utf8Bytes = stringToByteArray(str); return base64.encodeByteArray(utf8Bytes, true); }; /** * URL-safe base64 decoding * * NOTE: DO NOT use the global atob() function - it does NOT support the * base64Url variant encoding. * * @param str To be decoded * @return Decoded result, if possible */ var base64Decode = function (str) { try { return base64.decodeString(str, true); } catch (e) { console.error('base64Decode failed: ', e); } return null; }; /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Do a deep-copy of basic JavaScript Objects or Arrays. */ function deepCopy(value) { return deepExtend(undefined, value); } /** * Copy properties from source to target (recursively allows extension * of Objects and Arrays). Scalar values in the target are over-written. * If target is undefined, an object of the appropriate type will be created * (and returned). * * We recursively copy all child properties of plain Objects in the source- so * that namespace- like dictionaries are merged. * * Note that the target can be a function, in which case the properties in * the source Object are copied onto it as static properties of the Function. */ function deepExtend(target, source) { if (!(source instanceof Object)) { return source; } switch (source.constructor) { case Date: // Treat Dates like scalars; if the target date object had any child // properties - they will be lost! var dateValue = source; return new Date(dateValue.getTime()); case Object: if (target === undefined) { target = {}; } break; case Array: // Always copy the array source and overwrite the target. target = []; break; default: // Not a plain Object - treat it as a scalar. return source; } for (var prop in source) { if (!source.hasOwnProperty(prop)) { continue; } target[prop] = deepExtend(target[prop], source[prop]); } return target; } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var Deferred = /** @class */ (function () { function Deferred() { var _this = this; this.reject = function () { }; this.resolve = function () { }; this.promise = new Promise(function (resolve, reject) { _this.resolve = resolve; _this.reject = reject; }); } /** * Our API internals are not promiseified and cannot because our callback APIs have subtle expectations around * invoking promises inline, which Promises are forbidden to do. This method accepts an optional node-style callback * and returns a node-style callback which will resolve or reject the Deferred's promise. */ Deferred.prototype.wrapCallback = function (callback) { var _this = this; return function (error, value) { if (error) { _this.reject(error); } else { _this.resolve(value); } if (typeof callback === 'function') { // Attaching noop handler just in case developer wasn't expecting // promises _this.promise.catch(function () { }); // Some of our callbacks don't expect a value and our own tests // assert that the parameter length is 1 if (callback.length === 1) { callback(error); } else { callback(error, value); } } }; }; return Deferred; }()); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Returns navigator.userAgent string or '' if it's not defined. * @return user agent string */ function getUA() { if (typeof navigator !== 'undefined' && typeof navigator['userAgent'] === 'string') { return navigator['userAgent']; } else { return ''; } } /** * Detect Cordova / PhoneGap / Ionic frameworks on a mobile device. * * Deliberately does not rely on checking `file://` URLs (as this fails PhoneGap * in the Ripple emulator) nor Cordova `onDeviceReady`, which would normally * wait for a callback. */ function isMobileCordova() { return (typeof window !== 'undefined' && // @ts-ignore Setting up an broadly applicable index signature for Window // just to deal with this case would probably be a bad idea. !!(window['cordova'] || window['phonegap'] || window['PhoneGap']) && /ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(getUA())); } /** * Detect Node.js. * * @return true if Node.js environment is detected. */ // Node detection logic from: https://github.com/iliakan/detect-node/ function isNode() { try { return (Object.prototype.toString.call(global.process) === '[object process]'); } catch (e) { return false; } } /** * Detect Browser Environment */ function isBrowser() { return typeof self === 'object' && self.self === self; } function isBrowserExtension() { var runtime = typeof chrome === 'object' ? chrome.runtime : typeof browser === 'object' ? browser.runtime : undefined; return typeof runtime === 'object' && runtime.id !== undefined; } /** * Detect React Native. * * @return true if ReactNative environment is detected. */ function isReactNative() { return (typeof navigator === 'object' && navigator['product'] === 'ReactNative'); } /** Detects Electron apps. */ function isElectron() { return getUA().indexOf('Electron/') >= 0; } /** Detects Internet Explorer. */ function isIE() { var ua = getUA(); return ua.indexOf('MSIE ') >= 0 || ua.indexOf('Trident/') >= 0; } /** Detects Universal Windows Platform apps. */ function isUWP() { return getUA().indexOf('MSAppHost/') >= 0; } /** * Detect whether the current SDK build is the Node version. * * @return true if it's the Node SDK build. */ function isNodeSdk() { return CONSTANTS.NODE_CLIENT === true || CONSTANTS.NODE_ADMIN === true; } /** Returns true if we are running in Safari. */ function isSafari() { return (!isNode() && navigator.userAgent.includes('Safari') && !navigator.userAgent.includes('Chrome')); } /** * This method checks if indexedDB is supported by current browser/service worker context * @return true if indexedDB is supported by current browser/service worker context */ function isIndexedDBAvailable() { return 'indexedDB' in self && indexedDB != null; } /** * This method validates browser context for indexedDB by opening a dummy indexedDB database and reject * if errors occur during the database open operation. */ function validateIndexedDBOpenable() { return new Promise(function (resolve, reject) { try { var preExist_1 = true; var DB_CHECK_NAME_1 = 'validate-browser-context-for-indexeddb-analytics-module'; var request_1 = window.indexedDB.open(DB_CHECK_NAME_1); request_1.onsuccess = function () { request_1.result.close(); // delete database only when it doesn't pre-exist if (!preExist_1) { window.indexedDB.deleteDatabase(DB_CHECK_NAME_1); } resolve(true); }; request_1.onupgradeneeded = function () { preExist_1 = false; }; request_1.onerror = function () { var _a; reject(((_a = request_1.error) === null || _a === void 0 ? void 0 : _a.message) || ''); }; } catch (error) { reject(error); } }); } /** * * This method checks whether cookie is enabled within current browser * @return true if cookie is enabled within current browser */ function areCookiesEnabled() { if (!navigator || !navigator.cookieEnabled) { return false; } return true; } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var ERROR_NAME = 'FirebaseError'; // Based on code from: // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error#Custom_Error_Types var FirebaseError = /** @class */ (function (_super) { tslib.__extends(FirebaseError, _super); function FirebaseError(code, message) { var _this = _super.call(this, message) || this; _this.code = code; _this.name = ERROR_NAME; // Fix For ES5 // https://github.com/Microsoft/TypeScript-wiki/blob/master/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work Object.setPrototypeOf(_this, FirebaseError.prototype); // Maintains proper stack trace for where our error was thrown. // Only available on V8. if (Error.captureStackTrace) { Error.captureStackTrace(_this, ErrorFactory.prototype.create); } return _this; } return FirebaseError; }(Error)); var ErrorFactory = /** @class */ (function () { function ErrorFactory(service, serviceName, errors) { this.service = service; this.serviceName = serviceName; this.errors = errors; } ErrorFactory.prototype.create = function (code) { var data = []; for (var _i = 1; _i < arguments.length; _i++) { data[_i - 1] = arguments[_i]; } var customData = data[0] || {}; var fullCode = this.service + "/" + code; var template = this.errors[code]; var message = template ? replaceTemplate(template, customData) : 'Error'; // Service Name: Error message (service/code). var fullMessage = this.serviceName + ": " + message + " (" + fullCode + ")."; var error = new FirebaseError(fullCode, fullMessage); // Keys with an underscore at the end of their name are not included in // error.data for some reason. // TODO: Replace with Object.entries when lib is updated to es2017. for (var _a = 0, _b = Object.keys(customData); _a < _b.length; _a++) { var key = _b[_a]; if (key.slice(-1) !== '_') { if (key in error) { console.warn("Overwriting FirebaseError base field \"" + key + "\" can cause unexpected behavior."); } error[key] = customData[key]; } } return error; }; return ErrorFactory; }()); function replaceTemplate(template, data) { return template.replace(PATTERN, function (_, key) { var value = data[key]; return value != null ? String(value) : "<" + key + "?>"; }); } var PATTERN = /\{\$([^}]+)}/g; /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Evaluates a JSON string into a javascript object. * * @param {string} str A string containing JSON. * @return {*} The javascript object representing the specified JSON. */ function jsonEval(str) { return JSON.parse(str); } /** * Returns JSON representing a javascript object. * @param {*} data Javascript object to be stringified. * @return {string} The JSON contents of the object. */ function stringify(data) { return JSON.stringify(data); } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Decodes a Firebase auth. token into constituent parts. * * Notes: * - May return with invalid / incomplete claims if there's no native base64 decoding support. * - Doesn't check if the token is actually valid. */ var decode = function (token) { var header = {}, claims = {}, data = {}, signature = ''; try { var parts = token.split('.'); header = jsonEval(base64Decode(parts[0]) || ''); claims = jsonEval(base64Decode(parts[1]) || ''); signature = parts[2]; data = claims['d'] || {}; delete claims['d']; } catch (e) { } return { header: header, claims: claims, data: data, signature: signature }; }; /** * Decodes a Firebase auth. token and checks the validity of its time-based claims. Will return true if the * token is within the time window authorized by the 'nbf' (not-before) and 'iat' (issued-at) claims. * * Notes: * - May return a false negative if there's no native base64 decoding support. * - Doesn't check if the token is actually valid. */ var isValidTimestamp = function (token) { var claims = decode(token).claims; var now = Math.floor(new Date().getTime() / 1000); var validSince = 0, validUntil = 0; if (typeof claims === 'object') { if (claims.hasOwnProperty('nbf')) { validSince = claims['nbf']; } else if (claims.hasOwnProperty('iat')) { validSince = claims['iat']; } if (claims.hasOwnProperty('exp')) { validUntil = claims['exp']; } else { // token will expire after 24h by default validUntil = validSince + 86400; } } return (!!now && !!validSince && !!validUntil && now >= validSince && now <= validUntil); }; /** * Decodes a Firebase auth. token and returns its issued at time if valid, null otherwise. * * Notes: * - May return null if there's no native base64 decoding support. * - Doesn't check if the token is actually valid. */ var issuedAtTime = function (token) { var claims = decode(token).claims; if (typeof claims === 'object' && claims.hasOwnProperty('iat')) { return claims['iat']; } return null; }; /** * Decodes a Firebase auth. token and checks the validity of its format. Expects a valid issued-at time. * * Notes: * - May return a false negative if there's no native base64 decoding support. * - Doesn't check if the token is actually valid. */ var isValidFormat = function (token) { var decoded = decode(token), claims = decoded.claims; return !!claims && typeof claims === 'object' && claims.hasOwnProperty('iat'); }; /** * Attempts to peer into an auth token and determine if it's an admin auth token by looking at the claims portion. * * Notes: * - May return a false negative if there's no native base64 decoding support. * - Doesn't check if the token is actually valid. */ var isAdmin = function (token) { var claims = decode(token).claims; return typeof claims === 'object' && claims['admin'] === true; }; /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ function contains(obj, key) { return Object.prototype.hasOwnProperty.call(obj, key); } function safeGet(obj, key) { if (Object.prototype.hasOwnProperty.call(obj, key)) { return obj[key]; } else { return undefined; } } function isEmpty(obj) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { return false; } } return true; } function map(obj, fn, contextObj) { var res = {}; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { res[key] = fn.call(contextObj, obj[key], key, obj); } } return res; } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Returns a querystring-formatted string (e.g. &arg=val&arg2=val2) from a * params object (e.g. {arg: 'val', arg2: 'val2'}) * Note: You must prepend it with ? when adding it to a URL. */ function querystring(querystringParams) { var params = []; var _loop_1 = function (key, value) { if (Array.isArray(value)) { value.forEach(function (arrayVal) { params.push(encodeURIComponent(key) + '=' + encodeURIComponent(arrayVal)); }); } else { params.push(encodeURIComponent(key) + '=' + encodeURIComponent(value)); } }; for (var _i = 0, _a = Object.entries(querystringParams); _i < _a.length; _i++) { var _b = _a[_i], key = _b[0], value = _b[1]; _loop_1(key, value); } return params.length ? '&' + params.join('&') : ''; } /** * Decodes a querystring (e.g. ?arg=val&arg2=val2) into a params object * (e.g. {arg: 'val', arg2: 'val2'}) */ function querystringDecode(querystring) { var obj = {}; var tokens = querystring.replace(/^\?/, '').split('&'); tokens.forEach(function (token) { if (token) { var key = token.split('='); obj[key[0]] = key[1]; } }); return obj; } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * @fileoverview SHA-1 cryptographic hash. * Variable names follow the notation in FIPS PUB 180-3: * http://csrc.nist.gov/publications/fips/fips180-3/fips180-3_final.pdf. * * Usage: * var sha1 = new sha1(); * sha1.update(bytes); * var hash = sha1.digest(); * * Performance: * Chrome 23: ~400 Mbit/s * Firefox 16: ~250 Mbit/s * */ /** * SHA-1 cryptographic hash constructor. * * The properties declared here are discussed in the above algorithm document. * @constructor * @final * @struct */ var Sha1 = /** @class */ (function () { function Sha1() { /** * Holds the previous values of accumulated variables a-e in the compress_ * function. * @private */ this.chain_ = []; /** * A buffer holding the partially computed hash result. * @private */ this.buf_ = []; /** * An array of 80 bytes, each a part of the message to be hashed. Referred to * as the message schedule in the docs. * @private */ this.W_ = []; /** * Contains data needed to pad messages less than 64 bytes. * @private */ this.pad_ = []; /** * @private {number} */ this.inbuf_ = 0; /** * @private {number} */ this.total_ = 0; this.blockSize = 512 / 8; this.pad_[0] = 128; for (var i = 1; i < this.blockSize; ++i) { this.pad_[i] = 0; } this.reset(); } Sha1.prototype.reset = function () { this.chain_[0] = 0x67452301; this.chain_[1] = 0xefcdab89; this.chain_[2] = 0x98badcfe; this.chain_[3] = 0x10325476; this.chain_[4] = 0xc3d2e1f0; this.inbuf_ = 0; this.total_ = 0; }; /** * Internal compress helper function. * @param buf Block to compress. * @param offset Offset of the block in the buffer. * @private */ Sha1.prototype.compress_ = function (buf, offset) { if (!offset) { offset = 0; } var W = this.W_; // get 16 big endian words if (typeof buf === 'string') { for (var i = 0; i < 16; i++) { // TODO(user): [bug 8140122] Recent versions of Safari for Mac OS and iOS // have a bug that turns the post-increment ++ operator into pre-increment // during JIT compilation. We have code that depends heavily on SHA-1 for // correctness and which is affected by this bug, so I've removed all uses // of post-increment ++ in which the result value is used. We can revert // this change once the Safari bug // (https://bugs.webkit.org/show_bug.cgi?id=109036) has been fixed and // most clients have been updated. W[i] = (buf.charCodeAt(offset) << 24) | (buf.charCodeAt(offset + 1) << 16) | (buf.charCodeAt(offset + 2) << 8) | buf.charCodeAt(offset + 3); offset += 4; } } else { for (var i = 0; i < 16; i++) { W[i] = (buf[offset] << 24) | (buf[offset + 1] << 16) | (buf[offset + 2] << 8) | buf[offset + 3]; offset += 4; } } // expand to 80 words for (var i = 16; i < 80; i++) { var t = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16]; W[i] = ((t << 1) | (t >>> 31)) & 0xffffffff; } var a = this.chain_[0]; var b = this.chain_[1]; var c = this.chain_[2]; var d = this.chain_[3]; var e = this.chain_[4]; var f, k; // TODO(user): Try to unroll this loop to speed up the computation. for (var i = 0; i < 80; i++) { if (i < 40) { if (i < 20) { f = d ^ (b & (c ^ d)); k = 0x5a827999; } else { f = b ^ c ^ d; k = 0x6ed9eba1; } } else { if (i < 60) { f = (b & c) | (d & (b | c)); k = 0x8f1bbcdc; } else { f = b ^ c ^ d; k = 0xca62c1d6; } } var t = (((a << 5) | (a >>> 27)) + f + e + k + W[i]) & 0xffffffff; e = d; d = c; c = ((b << 30) | (b >>> 2)) & 0xffffffff; b = a; a = t; } this.chain_[0] = (this.chain_[0] + a) & 0xffffffff; this.chain_[1] = (this.chain_[1] + b) & 0xffffffff; this.chain_[2] = (this.chain_[2] + c) & 0xffffffff; this.chain_[3] = (this.chain_[3] + d) & 0xffffffff; this.chain_[4] = (this.chain_[4] + e) & 0xffffffff; }; Sha1.prototype.update = function (bytes, length) { // TODO(johnlenz): tighten the function signature and remove this check if (bytes == null) { return; } if (length === undefined) { length = bytes.length; } var lengthMinusBlock = length - this.blockSize; var n = 0; // Using local instead of member variables gives ~5% speedup on Firefox 16. var buf = this.buf_; var inbuf = this.inbuf_; // The outer while loop should execute at most twice. while (n < length) { // When we have no data in the block to top up, we can directly process the // input buffer (assuming it contains sufficient data). This gives ~25% // speedup on Chrome 23 and ~15% speedup on Firefox 16, but requires that // the data is provided in large chunks (or in multiples of 64 bytes). if (inbuf === 0) { while (n <= lengthMinusBlock) { this.compress_(bytes, n); n += this.blockSize; } } if (typeof bytes === 'string') { while (n < length) { buf[inbuf] = bytes.charCodeAt(n); ++inbuf; ++n; if (inbuf === this.blockSize) { this.compress_(buf); inbuf = 0; // Jump to the outer loop so we use the full-block optimization. break; } } } else { while (n < length) { buf[inbuf] = bytes[n]; ++inbuf; ++n; if (inbuf === this.blockSize) { this.compress_(buf); inbuf = 0; // Jump to the outer loop so we use the full-block optimization. break; } } } } this.inbuf_ = inbuf; this.total_ += length; }; /** @override */ Sha1.prototype.digest = function () { var digest = []; var totalBits = this.total_ * 8; // Add pad 0x80 0x00*. if (this.inbuf_ < 56) { this.update(this.pad_, 56 - this.inbuf_); } else { this.update(this.pad_, this.blockSize - (this.inbuf_ - 56)); } // Add # bits. for (var i = this.blockSize - 1; i >= 56; i--) { this.buf_[i] = totalBits & 255; totalBits /= 256; // Don't use bit-shifting here! } this.compress_(this.buf_); var n = 0; for (var i = 0; i < 5; i++) { for (var j = 24; j >= 0; j -= 8) { digest[n] = (this.chain_[i] >> j) & 255; ++n; } } return digest; }; return Sha1; }()); /** * Helper to make a Subscribe function (just like Promise helps make a * Thenable). * * @param executor Function which can make calls to a single Observer * as a proxy. * @param onNoObservers Callback when count of Observers goes to zero. */ function createSubscribe(executor, onNoObservers) { var proxy = new ObserverProxy(executor, onNoObservers); return proxy.subscribe.bind(proxy); } /** * Implement fan-out for any number of Observers attached via a subscribe * function. */ var ObserverProxy = /** @class */ (function () { /** * @param executor Function which can make calls to a single Observer * as a proxy. * @param onNoObservers Callback when count of Observers goes to zero. */ function ObserverProxy(executor, onNoObservers) { var _this = this; this.observers = []; this.unsubscribes = []; this.observerCount = 0; // Micro-task scheduling by calling task.then(). this.task = Promise.resolve(); this.finalized = false; this.onNoObservers = onNoObservers; // Call the executor asynchronously so subscribers that are called // synchronously after the creation of the subscribe function // can still receive the very first value generated in the executor. this.task .then(function () { executor(_this); }) .catch(function (e) { _this.error(e); }); } ObserverProxy.prototype.next = function (value) { this.forEachObserver(function (observer) { observer.next(value); }); }; ObserverProxy.prototype.error = function (error) { this.forEachObserver(function (observer) { observer.error(error); }); this.close(error); }; ObserverProxy.prototype.complete = function () { this.forEachObserver(function (observer) { observer.complete(); }); this.close(); }; /** * Subscribe function that can be used to add an Observer to the fan-out list. * * - We require that no event is sent to a subscriber sychronously to their * call to subscribe(). */ ObserverProxy.prototype.subscribe = function (nextOrObserver, error, complete) { var _this = this; var observer; if (nextOrObserver === undefined && error === undefined && complete === undefined) { throw new Error('Missing Observer.'); } // Assemble an Observer object when passed as callback functions. if (implementsAnyMethods(nextOrObserver, [ 'next', 'error', 'complete' ])) { observer = nextOrObserver; } else { observer = { next: nextOrObserver, error: error, complete: complete }; } if (observer.next === undefined) { observer.next = noop; } if (observer.error === undefined) { observer.error = noop; } if (observer.complete === undefined) { observer.complete = noop; } var unsub = this.unsubscribeOne.bind(this, this.observers.length); // Attempt to subscribe to a terminated Observable - we // just respond to the Observer with the final error or complete // event. if (this.finalized) { // eslint-disable-next-line @typescript-eslint/no-floating-promises this.task.then(function () { try { if (_this.finalError) { observer.error(_this.finalError); } else { observer.complete(); } } catch (e) { // nothing } return; }); } this.observers.push(observer); return unsub; }; // Unsubscribe is synchronous - we guarantee that no events are sent to // any unsubscribed Observer. ObserverProxy.prototype.unsubscribeOne = function (i) { if (this.observers === undefined || this.observers[i] === undefined) { return; } delete this.observers[i]; this.observerCount -= 1; if (this.observerCount === 0 && this.onNoObservers !== undefined) { this.onNoObservers(this); } }; ObserverProxy.prototype.forEachObserver = function (fn) { if (this.finalized) { // Already closed by previous event....just eat the additional values. return; } // Since sendOne calls asynchronously - there is no chance that // this.observers will become undefined. for (var i = 0; i < this.observers.length; i++) { this.sendOne(i, fn); } }; // Call the Observer via one of it's callback function. We are careful to // confirm that the observe has not been unsubscribed since this asynchronous // function had been queued. ObserverProxy.prototype.sendOne = function (i, fn) { var _this = this; // Execute the callback asynchronously // eslint-disable-next-line @typescript-eslint/no-floating-promises this.task.then(function () { if (_this.observers !== undefined && _this.observers[i] !== undefined) { try { fn(_this.observers[i]); } catch (e) { // Ignore exceptions raised in Observers or missing methods of an // Observer. // Log error to console. b/31404806 if (typeof console !== 'undefined' && console.error) { console.error(e); } } } }); }; ObserverProxy.prototype.close = function (err) { var _this = this; if (this.finalized) { return; } this.finalized = true; if (err !== undefined) { this.finalError = err; } // Proxy is no longer needed - garbage collect references // eslint-disable-next-line @typescript-eslint/no-floating-promises this.task.then(function () { _this.observers = undefined; _this.onNoObservers = undefined; }); }; return ObserverProxy; }()); /** Turn synchronous function into one called asynchronously. */ // eslint-disable-next-line @typescript-eslint/ban-types function async(fn, onError) { return function () { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } Promise.resolve(true) .then(function () { fn.apply(void 0, args); }) .catch(function (error) { if (onError) { onError(error); } }); }; } /** * Return true if the object passed in implements any of the named methods. */ function implementsAnyMethods(obj, methods) { if (typeof obj !== 'object' || obj === null) { return false; } for (var _i = 0, methods_1 = methods; _i < methods_1.length; _i++) { var method = methods_1[_i]; if (method in obj && typeof obj[method] === 'function') { return true; } } return false; } function noop() { // do nothing } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Check to make sure the appropriate number of arguments are provided for a public function. * Throws an error if it fails. * * @param fnName The function name * @param minCount The minimum number of arguments to allow for the function call * @param maxCount The maximum number of argument to allow for the function call * @param argCount The actual number of arguments provided. */ var validateArgCount = function (fnName, minCount, maxCount, argCount) { var argError; if (argCount < minCount) { argError = 'at least ' + minCount; } else if (argCount > maxCount) { argError = maxCount === 0 ? 'none' : 'no more than ' + maxCount; } if (argError) { var error = fnName + ' failed: Was called with ' + argCount + (argCount === 1 ? ' argument.' : ' arguments.') + ' Expects ' + argError + '.'; throw new Error(error); } }; /** * Generates a string to prefix an error message about failed argument validation * * @param fnName The function name * @param argumentNumber The index of the argument * @param optional Whether or not the argument is optional * @return The prefix to add to the error thrown for validation. */ function errorPrefix(fnName, argumentNumber, optional) { var argName = ''; switch (argumentNumber) { case 1: argName = optional ? 'first' : 'First'; break; case 2: argName = optional ? 'second' : 'Second'; break; case 3: argName = optional ? 'third' : 'Third'; break; case 4: argName = optional ? 'fourth' : 'Fourth'; break; default: throw new Error('errorPrefix called with argumentNumber > 4. Need to update it?'); } var error = fnName + ' failed: '; error += argName + ' argument '; return error; } /** * @param fnName * @param argumentNumber * @param namespace * @param optional */ function validateNamespace(fnName, argumentNumber, namespace, optional) { if (optional && !namespace) { return; } if (typeof namespace !== 'string') { //TODO: I should do more validation here. We only allow certain chars in namespaces. throw new Error(errorPrefix(fnName, argumentNumber, optional) + 'must be a valid firebase namespace.'); } } function validateCallback(fnName, argumentNumber, // eslint-disable-next-line @typescript-eslint/ban-types callback, optional) { if (optional && !callback) { return; } if (typeof callback !== 'function') { throw new Error(errorPrefix(fnName, argumentNumber, optional) + 'must be a valid function.'); } } function validateContextObject(fnName, argumentNumber, context, optional) { if (optional && !context) { return; } if (typeof context !== 'object' || context === null) { throw new Error(errorPrefix(fnName, argumentNumber, optional) + 'must be a valid context object.'); } } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // Code originally came from goog.crypt.stringToUtf8ByteArray, but for some reason they // automatically replaced '\r\n' with '\n', and they didn't handle surrogate pairs, // so it's been modified. // Note that not all Unicode characters appear as single characters in JavaScript strings. // fromCharCode returns the UTF-16 encoding of a character - so some Unicode characters // use 2 characters in Javascript. All 4-byte UTF-8 characters begin with a first // character in the range 0xD800 - 0xDBFF (the first character of a so-called surrogate // pair). // See http://www.ecma-international.org/ecma-262/5.1/#sec-15.1.3 /** * @param {string} str * @return {Array} */ var stringToByteArray$1 = function (str) { var out = []; var p = 0; for (var i = 0; i < str.length; i++) { var c = str.charCodeAt(i); // Is this the lead surrogate in a surrogate pair? if (c >= 0xd800 && c <= 0xdbff) { var high = c - 0xd800; // the high 10 bits. i++; assert(i < str.length, 'Surrogate pair missing trail surrogate.'); var low = str.charCodeAt(i) - 0xdc00; // the low 10 bits. c = 0x10000 + (high << 10) + low; } if (c < 128) { out[p++] = c; } else if (c < 2048) { out[p++] = (c >> 6) | 192; out[p++] = (c & 63) | 128; } else if (c < 65536) { out[p++] = (c >> 12) | 224; out[p++] = ((c >> 6) & 63) | 128; out[p++] = (c & 63) | 128; } else { out[p++] = (c >> 18) | 240; out[p++] = ((c >> 12) & 63) | 128; out[p++] = ((c >> 6) & 63) | 128; out[p++] = (c & 63) | 128; } } return out; }; /** * Calculate length without actually converting; useful for doing cheaper validation. * @param {string} str * @return {number} */ var stringLength = function (str) { var p = 0; for (var i = 0; i < str.length; i++) { var c = str.charCodeAt(i); if (c < 128) { p++; } else if (c < 2048) { p += 2; } else if (c >= 0xd800 && c <= 0xdbff) { // Lead surrogate of a surrogate pair. The pair together will take 4 bytes to represent. p += 4; i++; // skip trail surrogate. } else { p += 3; } } return p; }; /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * The amount of milliseconds to exponentially increase. */ var DEFAULT_INTERVAL_MILLIS = 1000; /** * The factor to backoff by. * Should be a number greater than 1. */ var DEFAULT_BACKOFF_FACTOR = 2; /** * The maximum milliseconds to increase to. * * <p>Visible for testing */ var MAX_VALUE_MILLIS = 4 * 60 * 60 * 1000; // Four hours, like iOS and Android. /** * The percentage of backoff time to randomize by. * See * http://go/safe-client-behavior#step-1-determine-the-appropriate-retry-interval-to-handle-spike-traffic * for context. * * <p>Visible for testing */ var RANDOM_FACTOR = 0.5; /** * Based on the backoff method from * https://github.com/google/closure-library/blob/master/closure/goog/math/exponentialbackoff.js. * Extracted here so we don't need to pass metadata and a stateful ExponentialBackoff object around. */ function calculateBackoffMillis(backoffCount, intervalMillis, backoffFactor) { if (intervalMillis === void 0) { intervalMillis = DEFAULT_INTERVAL_MILLIS; } if (backoffFactor === void 0) { backoffFactor = DEFAULT_BACKOFF_FACTOR; } // Calculates an exponentially increasing value. // Deviation: calculates value from count and a constant interval, so we only need to save value // and count to restore state. var currBaseValue = intervalMillis * Math.pow(backoffFactor, backoffCount); // A random "fuzz" to avoid waves of retries. // Deviation: randomFactor is required. var randomWait = Math.round( // A fraction of the backoff value to add/subtract. // Deviation: changes multiplication order to improve readability. RANDOM_FACTOR * currBaseValue * // A random float (rounded to int by Math.round above) in the range [-1, 1]. Determines // if we add or subtract. (Math.random() - 0.5) * 2); // Limits backoff to max to avoid effectively permanent backoff. return Math.min(MAX_VALUE_MILLIS, currBaseValue + randomWait); } exports.CONSTANTS = CONSTANTS; exports.Deferred = Deferred; exports.ErrorFactory = ErrorFactory; exports.FirebaseError = FirebaseError; exports.MAX_VALUE_MILLIS = MAX_VALUE_MILLIS; exports.RANDOM_FACTOR = RANDOM_FACTOR; exports.Sha1 = Sha1; exports.areCookiesEnabled = areCookiesEnabled; exports.assert = assert; exports.assertionError = assertionError; exports.async = async; exports.base64 = base64; exports.base64Decode = base64Decode; exports.base64Encode = base64Encode; exports.calculateBackoffMillis = calculateBackoffMillis; exports.contains = contains; exports.createSubscribe = createSubscribe; exports.decode = decode; exports.deepCopy = deepCopy; exports.deepExtend = deepExtend; exports.errorPrefix = errorPrefix; exports.getUA = getUA; exports.isAdmin = isAdmin; exports.isBrowser = isBrowser; exports.isBrowserExtension = isBrowserExtension; exports.isElectron = isElectron; exports.isEmpty = isEmpty; exports.isIE = isIE; exports.isIndexedDBAvailable = isIndexedDBAvailable; exports.isMobileCordova = isMobileCordova; exports.isNode = isNode; exports.isNodeSdk = isNodeSdk; exports.isReactNative = isReactNative; exports.isSafari = isSafari; exports.isUWP = isUWP; exports.isValidFormat = isValidFormat; exports.isValidTimestamp = isValidTimestamp; exports.issuedAtTime = issuedAtTime; exports.jsonEval = jsonEval; exports.map = map; exports.querystring = querystring; exports.querystringDecode = querystringDecode; exports.safeGet = safeGet; exports.stringLength = stringLength; exports.stringToByteArray = stringToByteArray$1; exports.stringify = stringify; exports.validateArgCount = validateArgCount; exports.validateCallback = validateCallback; exports.validateContextObject = validateContextObject; exports.validateIndexedDBOpenable = validateIndexedDBOpenable; exports.validateNamespace = validateNamespace; //# sourceMappingURL=index.cjs.js.map /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__("./node_modules/webpack/buildin/global.js"))) /***/ }), /***/ "./node_modules/@firebase/database/node_modules/tslib/tslib.es6.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); /* harmony export (immutable) */ __webpack_exports__["__extends"] = __extends; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__assign", function() { return __assign; }); /* harmony export (immutable) */ __webpack_exports__["__rest"] = __rest; /* harmony export (immutable) */ __webpack_exports__["__decorate"] = __decorate; /* harmony export (immutable) */ __webpack_exports__["__param"] = __param; /* harmony export (immutable) */ __webpack_exports__["__metadata"] = __metadata; /* harmony export (immutable) */ __webpack_exports__["__awaiter"] = __awaiter; /* harmony export (immutable) */ __webpack_exports__["__generator"] = __generator; /* harmony export (immutable) */ __webpack_exports__["__createBinding"] = __createBinding; /* harmony export (immutable) */ __webpack_exports__["__exportStar"] = __exportStar; /* harmony export (immutable) */ __webpack_exports__["__values"] = __values; /* harmony export (immutable) */ __webpack_exports__["__read"] = __read; /* harmony export (immutable) */ __webpack_exports__["__spread"] = __spread; /* harmony export (immutable) */ __webpack_exports__["__spreadArrays"] = __spreadArrays; /* harmony export (immutable) */ __webpack_exports__["__await"] = __await; /* harmony export (immutable) */ __webpack_exports__["__asyncGenerator"] = __asyncGenerator; /* harmony export (immutable) */ __webpack_exports__["__asyncDelegator"] = __asyncDelegator; /* harmony export (immutable) */ __webpack_exports__["__asyncValues"] = __asyncValues; /* harmony export (immutable) */ __webpack_exports__["__makeTemplateObject"] = __makeTemplateObject; /* harmony export (immutable) */ __webpack_exports__["__importStar"] = __importStar; /* harmony export (immutable) */ __webpack_exports__["__importDefault"] = __importDefault; /* harmony export (immutable) */ __webpack_exports__["__classPrivateFieldGet"] = __classPrivateFieldGet; /* harmony export (immutable) */ __webpack_exports__["__classPrivateFieldSet"] = __classPrivateFieldSet; /*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */ /* global Reflect, Promise */ var extendStatics = function(d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; function __extends(d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); } var __assign = function() { __assign = Object.assign || function __assign(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; } return __assign.apply(this, arguments); } function __rest(s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; } return t; } function __decorate(decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; } function __param(paramIndex, decorator) { return function (target, key) { decorator(target, key, paramIndex); } } function __metadata(metadataKey, metadataValue) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); } function __awaiter(thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); } function __generator(thisArg, body) { var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; function verb(n) { return function (v) { return step([n, v]); }; } function step(op) { if (f) throw new TypeError("Generator is already executing."); while (_) try { if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; if (y = 0, t) op = [op[0] & 2, t.value]; switch (op[0]) { case 0: case 1: t = op; break; case 4: _.label++; return { value: op[1], done: false }; case 5: _.label++; y = op[1]; op = [0]; continue; case 7: op = _.ops.pop(); _.trys.pop(); continue; default: if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } if (t[2]) _.ops.pop(); _.trys.pop(); continue; } op = body.call(thisArg, _); } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } } function __createBinding(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; } function __exportStar(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) exports[p] = m[p]; } function __values(o) { var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; if (m) return m.call(o); if (o && typeof o.length === "number") return { next: function () { if (o && i >= o.length) o = void 0; return { value: o && o[i++], done: !o }; } }; throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); } function __read(o, n) { var m = typeof Symbol === "function" && o[Symbol.iterator]; if (!m) return o; var i = m.call(o), r, ar = [], e; try { while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); } catch (error) { e = { error: error }; } finally { try { if (r && !r.done && (m = i["return"])) m.call(i); } finally { if (e) throw e.error; } } return ar; } function __spread() { for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); return ar; } function __spreadArrays() { for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; for (var r = Array(s), k = 0, i = 0; i < il; i++) for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) r[k] = a[j]; return r; }; function __await(v) { return this instanceof __await ? (this.v = v, this) : new __await(v); } function __asyncGenerator(thisArg, _arguments, generator) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var g = generator.apply(thisArg, _arguments || []), i, q = []; return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } function fulfill(value) { resume("next", value); } function reject(value) { resume("throw", value); } function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } } function __asyncDelegator(o) { var i, p; return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } } function __asyncValues(o) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var m = o[Symbol.asyncIterator], i; return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } } function __makeTemplateObject(cooked, raw) { if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } return cooked; }; function __importStar(mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; result.default = mod; return result; } function __importDefault(mod) { return (mod && mod.__esModule) ? mod : { default: mod }; } function __classPrivateFieldGet(receiver, privateMap) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return privateMap.get(receiver); } function __classPrivateFieldSet(receiver, privateMap, value) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to set private field on non-instance"); } privateMap.set(receiver, value); return value; } /***/ }), /***/ "./node_modules/@firebase/firestore/dist/index.cjs.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(process) { Object.defineProperty(exports, "__esModule", { value: !0 }); var t = __webpack_require__("./node_modules/@firebase/firestore/node_modules/tslib/tslib.es6.js"), e = __webpack_require__("./node_modules/@firebase/app/dist/index.cjs.js"), n = __webpack_require__("./node_modules/@firebase/logger/dist/index.esm.js"), r = __webpack_require__("./node_modules/@firebase/firestore/node_modules/@firebase/util/dist/index.cjs.js"), i = __webpack_require__("./node_modules/@firebase/webchannel-wrapper/dist/index.esm.js"), o = __webpack_require__("./node_modules/@firebase/firestore/node_modules/@firebase/component/dist/index.cjs.js"); function s(t) { return t && "object" == typeof t && "default" in t ? t : { default: t }; } var u = s(e), a = { // Causes are copied from: // https://github.com/grpc/grpc/blob/bceec94ea4fc5f0085d81235d8e1c06798dc341a/include/grpc%2B%2B/impl/codegen/status_code_enum.h /** Not an error; returned on success. */ OK: "ok", /** The operation was cancelled (typically by the caller). */ CANCELLED: "cancelled", /** Unknown error or an error from a different error domain. */ UNKNOWN: "unknown", /** * Client specified an invalid argument. Note that this differs from * FAILED_PRECONDITION. INVALID_ARGUMENT indicates arguments that are * problematic regardless of the state of the system (e.g., a malformed file * name). */ INVALID_ARGUMENT: "invalid-argument", /** * Deadline expired before operation could complete. For operations that * change the state of the system, this error may be returned even if the * operation has completed successfully. For example, a successful response * from a server could have been delayed long enough for the deadline to * expire. */ DEADLINE_EXCEEDED: "deadline-exceeded", /** Some requested entity (e.g., file or directory) was not found. */ NOT_FOUND: "not-found", /** * Some entity that we attempted to create (e.g., file or directory) already * exists. */ ALREADY_EXISTS: "already-exists", /** * The caller does not have permission to execute the specified operation. * PERMISSION_DENIED must not be used for rejections caused by exhausting * some resource (use RESOURCE_EXHAUSTED instead for those errors). * PERMISSION_DENIED must not be used if the caller can not be identified * (use UNAUTHENTICATED instead for those errors). */ PERMISSION_DENIED: "permission-denied", /** * The request does not have valid authentication credentials for the * operation. */ UNAUTHENTICATED: "unauthenticated", /** * Some resource has been exhausted, perhaps a per-user quota, or perhaps the * entire file system is out of space. */ RESOURCE_EXHAUSTED: "resource-exhausted", /** * Operation was rejected because the system is not in a state required for * the operation's execution. For example, directory to be deleted may be * non-empty, an rmdir operation is applied to a non-directory, etc. * * A litmus test that may help a service implementor in deciding * between FAILED_PRECONDITION, ABORTED, and UNAVAILABLE: * (a) Use UNAVAILABLE if the client can retry just the failing call. * (b) Use ABORTED if the client should retry at a higher-level * (e.g., restarting a read-modify-write sequence). * (c) Use FAILED_PRECONDITION if the client should not retry until * the system state has been explicitly fixed. E.g., if an "rmdir" * fails because the directory is non-empty, FAILED_PRECONDITION * should be returned since the client should not retry unless * they have first fixed up the directory by deleting files from it. * (d) Use FAILED_PRECONDITION if the client performs conditional * REST Get/Update/Delete on a resource and the resource on the * server does not match the condition. E.g., conflicting * read-modify-write on the same resource. */ FAILED_PRECONDITION: "failed-precondition", /** * The operation was aborted, typically due to a concurrency issue like * sequencer check failures, transaction aborts, etc. * * See litmus test above for deciding between FAILED_PRECONDITION, ABORTED, * and UNAVAILABLE. */ ABORTED: "aborted", /** * Operation was attempted past the valid range. E.g., seeking or reading * past end of file. * * Unlike INVALID_ARGUMENT, this error indicates a problem that may be fixed * if the system state changes. For example, a 32-bit file system will * generate INVALID_ARGUMENT if asked to read at an offset that is not in the * range [0,2^32-1], but it will generate OUT_OF_RANGE if asked to read from * an offset past the current file size. * * There is a fair bit of overlap between FAILED_PRECONDITION and * OUT_OF_RANGE. We recommend using OUT_OF_RANGE (the more specific error) * when it applies so that callers who are iterating through a space can * easily look for an OUT_OF_RANGE error to detect when they are done. */ OUT_OF_RANGE: "out-of-range", /** Operation is not implemented or not supported/enabled in this service. */ UNIMPLEMENTED: "unimplemented", /** * Internal errors. Means some invariants expected by underlying System has * been broken. If you see one of these errors, Something is very broken. */ INTERNAL: "internal", /** * The service is currently unavailable. This is a most likely a transient * condition and may be corrected by retrying with a backoff. * * See litmus test above for deciding between FAILED_PRECONDITION, ABORTED, * and UNAVAILABLE. */ UNAVAILABLE: "unavailable", /** Unrecoverable data loss or corruption. */ DATA_LOSS: "data-loss" }, c = /** @class */ function(e) { function n(t, n) { var r = this; return (r = e.call(this, n) || this).code = t, r.message = n, r.name = "FirebaseError", // HACK: We write a toString property directly because Error is not a real // class and so inheritance does not work correctly. We could alternatively // do the same "back-door inheritance" trick that FirebaseError does. r.toString = function() { return r.name + ": [code=" + r.code + "]: " + r.message; }, r; } return t.__extends(n, e), n; }(Error), h = new n.Logger("@firebase/firestore"); /** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** Converts a Base64 encoded string to a binary string. */ /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // Helper methods are needed because variables can't be exported as read/write function f() { return h.logLevel; } /** * Sets the verbosity of Cloud Firestore logs (debug, error, or silent). * * @param logLevel * The verbosity you set for activity and error logging. Can be any of * the following values: * * <ul> * <li>`debug` for the most verbose logging level, primarily for * debugging.</li> * <li>`error` to log errors only.</li> * <li><code>`silent` to turn off logging.</li> * </ul> */ function l(e) { for (var r = [], i = 1; i < arguments.length; i++) r[i - 1] = arguments[i]; if (h.logLevel <= n.LogLevel.DEBUG) { var o = r.map(v); h.debug.apply(h, t.__spreadArrays([ "Firestore (7.24.0): " + e ], o)); } } function p(e) { for (var r = [], i = 1; i < arguments.length; i++) r[i - 1] = arguments[i]; if (h.logLevel <= n.LogLevel.ERROR) { var o = r.map(v); h.error.apply(h, t.__spreadArrays([ "Firestore (7.24.0): " + e ], o)); } } function d(e) { for (var r = [], i = 1; i < arguments.length; i++) r[i - 1] = arguments[i]; if (h.logLevel <= n.LogLevel.WARN) { var o = r.map(v); h.warn.apply(h, t.__spreadArrays([ "Firestore (7.24.0): " + e ], o)); } } /** * Converts an additional log parameter to a string representation. */ function v(t) { if ("string" == typeof t) return t; try { return e = t, JSON.stringify(e); } catch (e) { // Converting to JSON failed, just log the object directly return t; } /** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** Formats an object as a JSON string, suitable for logging. */ var e; } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Unconditionally fails, throwing an Error with the given message. * Messages are stripped in production builds. * * Returns `never` and can be used in expressions: * @example * let futureVar = fail('not implemented yet'); */ function y(t) { void 0 === t && (t = "Unexpected state"); // Log the failure in addition to throw an exception, just in case the // exception is swallowed. var e = "FIRESTORE (7.24.0) INTERNAL ASSERTION FAILED: " + t; // NOTE: We don't use FirestoreError here because these are internal failures // that cannot be handled by the user. (Also it would create a circular // dependency between the error and assert modules which doesn't work.) throw p(e), new Error(e) /** * Fails if the given assertion condition is false, throwing an Error with the * given message if it did. * * Messages are stripped in production builds. */; } function g(t, e) { t || y(); } /** * Casts `obj` to `T`. In non-production builds, verifies that `obj` is an * instance of `T` before casting. */ function m(t, // eslint-disable-next-line @typescript-eslint/no-explicit-any e) { return t; } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ function w(t) { var e = 0; for (var n in t) Object.prototype.hasOwnProperty.call(t, n) && e++; return e; } function _(t, e) { for (var n in t) Object.prototype.hasOwnProperty.call(t, n) && e(n, t[n]); } function b(t) { for (var e in t) if (Object.prototype.hasOwnProperty.call(t, e)) return !1; return !0; } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Path represents an ordered sequence of string segments. */ var I = /** @class */ function() { function t(t, e, n) { void 0 === e ? e = 0 : e > t.length && y(), void 0 === n ? n = t.length - e : n > t.length - e && y(), this.segments = t, this.offset = e, this.t = n; } return Object.defineProperty(t.prototype, "length", { get: function() { return this.t; }, enumerable: !1, configurable: !0 }), t.prototype.isEqual = function(e) { return 0 === t.i(this, e); }, t.prototype.child = function(e) { var n = this.segments.slice(this.offset, this.limit()); return e instanceof t ? e.forEach((function(t) { n.push(t); })) : n.push(e), this.o(n); }, /** The index of one past the last segment of the path. */ t.prototype.limit = function() { return this.offset + this.length; }, t.prototype.u = function(t) { return t = void 0 === t ? 1 : t, this.o(this.segments, this.offset + t, this.length - t); }, t.prototype.h = function() { return this.o(this.segments, this.offset, this.length - 1); }, t.prototype.l = function() { return this.segments[this.offset]; }, t.prototype._ = function() { return this.get(this.length - 1); }, t.prototype.get = function(t) { return this.segments[this.offset + t]; }, t.prototype.m = function() { return 0 === this.length; }, t.prototype.T = function(t) { if (t.length < this.length) return !1; for (var e = 0; e < this.length; e++) if (this.get(e) !== t.get(e)) return !1; return !0; }, t.prototype.I = function(t) { if (this.length + 1 !== t.length) return !1; for (var e = 0; e < this.length; e++) if (this.get(e) !== t.get(e)) return !1; return !0; }, t.prototype.forEach = function(t) { for (var e = this.offset, n = this.limit(); e < n; e++) t(this.segments[e]); }, t.prototype.A = function() { return this.segments.slice(this.offset, this.limit()); }, t.i = function(t, e) { for (var n = Math.min(t.length, e.length), r = 0; r < n; r++) { var i = t.get(r), o = e.get(r); if (i < o) return -1; if (i > o) return 1; } return t.length < e.length ? -1 : t.length > e.length ? 1 : 0; }, t; }(), E = /** @class */ function(e) { function n() { return null !== e && e.apply(this, arguments) || this; } return t.__extends(n, e), n.prototype.o = function(t, e, r) { return new n(t, e, r); }, n.prototype.R = function() { // NOTE: The client is ignorant of any path segments containing escape // sequences (e.g. __id123__) and just passes them through raw (they exist // for legacy reasons and should not be used frequently). return this.A().join("/"); }, n.prototype.toString = function() { return this.R(); }, /** * Creates a resource path from the given slash-delimited string. If multiple * arguments are provided, all components are combined. Leading and trailing * slashes from all components are ignored. */ n.g = function() { for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e]; // NOTE: The client is ignorant of any path segments containing escape // sequences (e.g. __id123__) and just passes them through raw (they exist // for legacy reasons and should not be used frequently). for (var r = [], i = 0, o = t; i < o.length; i++) { var s = o[i]; if (s.indexOf("//") >= 0) throw new c(a.INVALID_ARGUMENT, "Invalid segment (" + s + "). Paths must not contain // in them."); // Strip leading and traling slashed. r.push.apply(r, s.split("/").filter((function(t) { return t.length > 0; }))); } return new n(r); }, n.P = function() { return new n([]); }, n; }(I), T = /^[_a-zA-Z][_a-zA-Z0-9]*$/, N = /** @class */ function(e) { function n() { return null !== e && e.apply(this, arguments) || this; } return t.__extends(n, e), n.prototype.o = function(t, e, r) { return new n(t, e, r); }, /** * Returns true if the string could be used as a segment in a field path * without escaping. */ n.V = function(t) { return T.test(t); }, n.prototype.R = function() { return this.A().map((function(t) { return t = t.replace("\\", "\\\\").replace("`", "\\`"), n.V(t) || (t = "`" + t + "`"), t; })).join("."); }, n.prototype.toString = function() { return this.R(); }, /** * Returns true if this field references the key of a document. */ n.prototype.p = function() { return 1 === this.length && "__name__" === this.get(0); }, /** * The field designating the key of a document. */ n.v = function() { return new n([ "__name__" ]); }, /** * Parses a field string from the given server-formatted string. * * - Splitting the empty string is not allowed (for now at least). * - Empty segments within the string (e.g. if there are two consecutive * separators) are not allowed. * * TODO(b/37244157): we should make this more strict. Right now, it allows * non-identifier path components, even if they aren't escaped. */ n.S = function(t) { for (var e = [], r = "", i = 0, o = function() { if (0 === r.length) throw new c(a.INVALID_ARGUMENT, "Invalid field path (" + t + "). Paths must not be empty, begin with '.', end with '.', or contain '..'"); e.push(r), r = ""; }, s = !1; i < t.length; ) { var u = t[i]; if ("\\" === u) { if (i + 1 === t.length) throw new c(a.INVALID_ARGUMENT, "Path has trailing escape character: " + t); var h = t[i + 1]; if ("\\" !== h && "." !== h && "`" !== h) throw new c(a.INVALID_ARGUMENT, "Path has invalid escape sequence: " + t); r += h, i += 2; } else "`" === u ? (s = !s, i++) : "." !== u || s ? (r += u, i++) : (o(), i++); } if (o(), s) throw new c(a.INVALID_ARGUMENT, "Unterminated ` in path: " + t); return new n(e); }, n.P = function() { return new n([]); }, n; }(I), A = /** @class */ function() { function t(t) { this.path = t; } return t.D = function(e) { return new t(E.g(e)); }, t.C = function(e) { return new t(E.g(e).u(5)); }, /** Returns true if the document is in the specified collectionId. */ t.prototype.N = function(t) { return this.path.length >= 2 && this.path.get(this.path.length - 2) === t; }, t.prototype.isEqual = function(t) { return null !== t && 0 === E.i(this.path, t.path); }, t.prototype.toString = function() { return this.path.toString(); }, t.i = function(t, e) { return E.i(t.path, e.path); }, t.F = function(t) { return t.length % 2 == 0; }, /** * Creates and returns a new document key with the given segments. * * @param segments The segments of the path to the document * @return A new instance of DocumentKey */ t.$ = function(e) { return new t(new E(e.slice())); }, t; }(); /** * A slash-separated path for navigating resources (documents and collections) * within Firestore. */ /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Validates that no arguments were passed in the invocation of functionName. * * Forward the magic "arguments" variable as second parameter on which the * parameter validation is performed: * validateNoArgs('myFunction', arguments); */ function S(t, e) { if (0 !== e.length) throw new c(a.INVALID_ARGUMENT, "Function " + t + "() does not support arguments, but was called with " + W(e.length, "argument") + "."); } /** * Validates the invocation of functionName has the exact number of arguments. * * Forward the magic "arguments" variable as second parameter on which the * parameter validation is performed: * validateExactNumberOfArgs('myFunction', arguments, 2); */ function D(t, e, n) { if (e.length !== n) throw new c(a.INVALID_ARGUMENT, "Function " + t + "() requires " + W(n, "argument") + ", but was called with " + W(e.length, "argument") + "."); } /** * Validates the invocation of functionName has at least the provided number of * arguments (but can have many more). * * Forward the magic "arguments" variable as second parameter on which the * parameter validation is performed: * validateAtLeastNumberOfArgs('myFunction', arguments, 2); */ function x(t, e, n) { if (e.length < n) throw new c(a.INVALID_ARGUMENT, "Function " + t + "() requires at least " + W(n, "argument") + ", but was called with " + W(e.length, "argument") + "."); } /** * Validates the invocation of functionName has number of arguments between * the values provided. * * Forward the magic "arguments" variable as second parameter on which the * parameter validation is performed: * validateBetweenNumberOfArgs('myFunction', arguments, 2, 3); */ function L(t, e, n, r) { if (e.length < n || e.length > r) throw new c(a.INVALID_ARGUMENT, "Function " + t + "() requires between " + n + " and " + r + " arguments, but was called with " + W(e.length, "argument") + "."); } /** * Validates the provided argument is an array and has as least the expected * number of elements. */ /** * Validates the provided positional argument has the native JavaScript type * using typeof checks. */ function k(t, e, n, r) { C(t, e, B(n) + " argument", r); } /** * Validates the provided argument has the native JavaScript type using * typeof checks or is undefined. */ function R(t, e, n, r) { void 0 !== r && k(t, e, n, r); } /** * Validates the provided named option has the native JavaScript type using * typeof checks. */ function O(t, e, n, r) { C(t, e, n + " option", r); } /** * Validates the provided named option has the native JavaScript type using * typeof checks or is undefined. */ function P(t, e, n, r) { void 0 !== r && O(t, e, n, r); } /** * Validates that two boolean options are not set at the same time. */ /** * Validates that the provided named option equals one of the expected values. */ /** * Validates that the provided named option equals one of the expected values or * is undefined. */ function V(t, e, n, r, i) { void 0 !== r && function(t, e, n, r, i) { for (var o = [], s = 0, u = i; s < u.length; s++) { var h = u[s]; if (h === r) return; o.push(M(h)); } var f = M(r); throw new c(a.INVALID_ARGUMENT, "Invalid value " + f + " provided to function " + t + '() for option "' + n + '". Acceptable values: ' + o.join(", ")); }(t, 0, n, r, i); } /** * Validates that the provided argument is a valid enum. * * @param functionName Function making the validation call. * @param enums Array containing all possible values for the enum. * @param position Position of the argument in `functionName`. * @param argument Argument to validate. * @return The value as T if the argument can be converted. */ function U(t, e, n, r) { if (!e.some((function(t) { return t === r; }))) throw new c(a.INVALID_ARGUMENT, "Invalid value " + M(r) + " provided to function " + t + "() for its " + B(n) + " argument. Acceptable values: " + e.join(", ")); return r; } /** Helper to validate the type of a provided input. */ function C(t, e, n, r) { if (!("object" === e ? F(r) : "non-empty string" === e ? "string" == typeof r && "" !== r : typeof r === e)) { var i = M(r); throw new c(a.INVALID_ARGUMENT, "Function " + t + "() requires its " + n + " to be of type " + e + ", but it was: " + i); } } /** * Returns true if it's a non-null object without a custom prototype * (i.e. excludes Array, Date, etc.). */ function F(t) { return "object" == typeof t && null !== t && (Object.getPrototypeOf(t) === Object.prototype || null === Object.getPrototypeOf(t)); } /** Returns a string describing the type / value of the provided input. */ function M(t) { if (void 0 === t) return "undefined"; if (null === t) return "null"; if ("string" == typeof t) return t.length > 20 && (t = t.substring(0, 20) + "..."), JSON.stringify(t); if ("number" == typeof t || "boolean" == typeof t) return "" + t; if ("object" == typeof t) { if (t instanceof Array) return "an array"; var e = /** Hacky method to try to get the constructor name for an object. */ function(t) { if (t.constructor) { var e = /function\s+([^\s(]+)\s*\(/.exec(t.constructor.toString()); if (e && e.length > 1) return e[1]; } return null; }(t); return e ? "a custom " + e + " object" : "an object"; } return "function" == typeof t ? "a function" : y(); } function q(t, e, n) { if (void 0 === n) throw new c(a.INVALID_ARGUMENT, "Function " + t + "() requires a valid " + B(e) + " argument, but it was undefined."); } /** * Validates the provided positional argument is an object, and its keys and * values match the expected keys and types provided in optionTypes. */ function j(t, e, n) { _(e, (function(e, r) { if (n.indexOf(e) < 0) throw new c(a.INVALID_ARGUMENT, "Unknown option '" + e + "' passed to function " + t + "(). Available options: " + n.join(", ")); })); } /** * Helper method to throw an error that the provided argument did not pass * an instanceof check. */ function G(t, e, n, r) { var i = M(r); return new c(a.INVALID_ARGUMENT, "Function " + t + "() requires its " + B(n) + " argument to be a " + e + ", but it was: " + i); } function z(t, e, n) { if (n <= 0) throw new c(a.INVALID_ARGUMENT, "Function " + t + "() requires its " + B(e) + " argument to be a positive number, but it was: " + n + "."); } /** Converts a number to its english word representation */ function B(t) { switch (t) { case 1: return "first"; case 2: return "second"; case 3: return "third"; default: return t + "th"; } } /** * Formats the given word as plural conditionally given the preceding number. */ function W(t, e) { return t + " " + e + (1 === t ? "" : "s"); } /** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Generates `nBytes` of random bytes. * * If `nBytes < 0` , an error will be thrown. */ function K(t) { // Polyfills for IE and WebWorker by using `self` and `msCrypto` when `crypto` is not available. var e = // eslint-disable-next-line @typescript-eslint/no-explicit-any "undefined" != typeof self && (self.crypto || self.msCrypto), n = new Uint8Array(t); if (e && "function" == typeof e.getRandomValues) e.getRandomValues(n); else // Falls back to Math.random for (var r = 0; r < t; r++) n[r] = Math.floor(256 * Math.random()); return n; } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var Q = /** @class */ function() { function t() {} return t.k = function() { for ( // Alphanumeric characters var t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", e = Math.floor(256 / t.length) * t.length, n = "" // The largest byte value that is a multiple of `char.length`. ; n.length < 20; ) for (var r = K(40), i = 0; i < r.length; ++i) // Only accept values that are [0, maxMultiple), this ensures they can // be evenly mapped to indices of `chars` via a modulo operation. n.length < 20 && r[i] < e && (n += t.charAt(r[i] % t.length)); return n; }, t; }(); function H(t, e) { return t < e ? -1 : t > e ? 1 : 0; } /** Helper to compare arrays using isEqual(). */ function Y(t, e, n) { return t.length === e.length && t.every((function(t, r) { return n(t, e[r]); })); } /** * Returns the immediate lexicographically-following string. This is useful to * construct an inclusive range for indexeddb iterators. */ function $(t) { // Return the input string, with an additional NUL byte appended. return t + "\0"; } /** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Immutable class that represents a "proto" byte string. * * Proto byte strings can either be Base64-encoded strings or Uint8Arrays when * sent on the wire. This class abstracts away this differentiation by holding * the proto byte string in a common class that must be converted into a string * before being sent as a proto. */ var X = /** @class */ function() { function t(t) { this.M = t; } return t.fromBase64String = function(e) { return new t(atob(e)); }, t.fromUint8Array = function(e) { return new t( /** * Helper function to convert an Uint8array to a binary string. */ function(t) { for (var e = "", n = 0; n < t.length; ++n) e += String.fromCharCode(t[n]); return e; }(e)); }, t.prototype.toBase64 = function() { return t = this.M, btoa(t); /** Converts a binary string to a Base64 encoded string. */ var t; /** True if and only if the Base64 conversion functions are available. */ }, t.prototype.toUint8Array = function() { return function(t) { for (var e = new Uint8Array(t.length), n = 0; n < t.length; n++) e[n] = t.charCodeAt(n); return e; }(this.M); }, t.prototype.O = function() { return 2 * this.M.length; }, t.prototype.L = function(t) { return H(this.M, t.M); }, t.prototype.isEqual = function(t) { return this.M === t.M; }, t; }(); X.B = new X(""); var J = /** @class */ function() { function t(t) { this.q = t; } /** * Creates a new `Bytes` object from the given Base64 string, converting it to * bytes. * * @param base64 The Base64 string used to create the `Bytes` object. */ return t.fromBase64String = function(e) { try { return new t(X.fromBase64String(e)); } catch (e) { throw new c(a.INVALID_ARGUMENT, "Failed to construct Bytes from Base64 string: " + e); } }, /** * Creates a new `Bytes` object from the given Uint8Array. * * @param array The Uint8Array used to create the `Bytes` object. */ t.fromUint8Array = function(e) { return new t(X.fromUint8Array(e)); }, /** * Returns the underlying bytes as a Base64-encoded string. * * @return The Base64-encoded string created from the `Bytes` object. */ t.prototype.toBase64 = function() { return this.q.toBase64(); }, /** * Returns the underlying bytes in a new `Uint8Array`. * * @return The Uint8Array created from the `Bytes` object. */ t.prototype.toUint8Array = function() { return this.q.toUint8Array(); }, /** * Returns a string representation of the `Bytes` object. * * @return A string representation of the `Bytes` object. */ t.prototype.toString = function() { return "Bytes(base64: " + this.toBase64() + ")"; }, /** * Returns true if this `Bytes` object is equal to the provided one. * * @param other The `Bytes` object to compare against. * @return true if this `Bytes` object is equal to the provided one. */ t.prototype.isEqual = function(t) { return this.q.isEqual(t.q); }, t; }(); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** Helper function to assert Uint8Array is available at runtime. */ function Z() { if ("undefined" == typeof Uint8Array) throw new c(a.UNIMPLEMENTED, "Uint8Arrays are not available in this environment."); } /** Helper function to assert Base64 functions are available at runtime. */ function tt() { if ("undefined" == typeof atob) throw new c(a.UNIMPLEMENTED, "Blobs are unavailable in Firestore in this environment."); } /** * Immutable class holding a blob (binary data). * * This class is directly exposed in the public API. It extends the Bytes class * of the firestore-exp API to support `instanceof Bytes` checks during user * data conversion. * * Note that while you can't hide the constructor in JavaScript code, we are * using the hack above to make sure no-one outside this module can call it. */ var et = /** @class */ function(e) { function n() { return null !== e && e.apply(this, arguments) || this; } return t.__extends(n, e), n.fromBase64String = function(t) { D("Blob.fromBase64String", arguments, 1), k("Blob.fromBase64String", "string", 1, t), tt(); try { return new n(X.fromBase64String(t)); } catch (t) { throw new c(a.INVALID_ARGUMENT, "Failed to construct Blob from Base64 string: " + t); } }, n.fromUint8Array = function(t) { if (D("Blob.fromUint8Array", arguments, 1), Z(), !(t instanceof Uint8Array)) throw G("Blob.fromUint8Array", "Uint8Array", 1, t); return new n(X.fromUint8Array(t)); }, n.prototype.toBase64 = function() { return D("Blob.toBase64", arguments, 0), tt(), e.prototype.toBase64.call(this); }, n.prototype.toUint8Array = function() { return D("Blob.toUint8Array", arguments, 0), Z(), e.prototype.toUint8Array.call(this); }, n.prototype.toString = function() { return "Blob(base64: " + this.toBase64() + ")"; }, n; }(J), nt = /** * Constructs a DatabaseInfo using the provided host, databaseId and * persistenceKey. * * @param databaseId The database to use. * @param persistenceKey A unique identifier for this Firestore's local * storage (used in conjunction with the databaseId). * @param host The Firestore backend host to connect to. * @param ssl Whether to use SSL when connecting. * @param forceLongPolling Whether to use the forceLongPolling option * when using WebChannel as the network transport. * @param autoDetectLongPolling Whether to use the detectBufferingProxy * option when using WebChannel as the network transport. */ function(t, e, n, r, i, o) { this.U = t, this.persistenceKey = e, this.host = n, this.ssl = r, this.forceLongPolling = i, this.W = o; }, rt = /** @class */ function() { function t(t, e) { this.projectId = t, this.database = e || "(default)"; } return Object.defineProperty(t.prototype, "j", { get: function() { return "(default)" === this.database; }, enumerable: !1, configurable: !0 }), t.prototype.isEqual = function(e) { return e instanceof t && e.projectId === this.projectId && e.database === this.database; }, t.prototype.L = function(t) { return H(this.projectId, t.projectId) || H(this.database, t.database); }, t; }(), it = /** @class */ function() { function t(t, e) { this.K = t, this.G = e, /** * The inner map for a key -> value pair. Due to the possibility of * collisions we keep a list of entries that we do a linear search through * to find an actual match. Note that collisions should be rare, so we still * expect near constant time lookups in practice. */ this.H = {} /** Get a value for this key, or undefined if it does not exist. */; } return t.prototype.get = function(t) { var e = this.K(t), n = this.H[e]; if (void 0 !== n) for (var r = 0, i = n; r < i.length; r++) { var o = i[r], s = o[0], u = o[1]; if (this.G(s, t)) return u; } }, t.prototype.has = function(t) { return void 0 !== this.get(t); }, /** Put this key and value in the map. */ t.prototype.set = function(t, e) { var n = this.K(t), r = this.H[n]; if (void 0 !== r) { for (var i = 0; i < r.length; i++) if (this.G(r[i][0], t)) return void (r[i] = [ t, e ]); r.push([ t, e ]); } else this.H[n] = [ [ t, e ] ]; }, /** * Remove this key from the map. Returns a boolean if anything was deleted. */ t.prototype.delete = function(t) { var e = this.K(t), n = this.H[e]; if (void 0 === n) return !1; for (var r = 0; r < n.length; r++) if (this.G(n[r][0], t)) return 1 === n.length ? delete this.H[e] : n.splice(r, 1), !0; return !1; }, t.prototype.forEach = function(t) { _(this.H, (function(e, n) { for (var r = 0, i = n; r < i.length; r++) { var o = i[r], s = o[0], u = o[1]; t(s, u); } })); }, t.prototype.m = function() { return b(this.H); }, t; }(), ot = /** @class */ function() { /** * Creates a new timestamp. * * @param seconds The number of seconds of UTC time since Unix epoch * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to * 9999-12-31T23:59:59Z inclusive. * @param nanoseconds The non-negative fractions of a second at nanosecond * resolution. Negative second values with fractions must still have * non-negative nanoseconds values that count forward in time. Must be * from 0 to 999,999,999 inclusive. */ function t(t, e) { if (this.seconds = t, this.nanoseconds = e, e < 0) throw new c(a.INVALID_ARGUMENT, "Timestamp nanoseconds out of range: " + e); if (e >= 1e9) throw new c(a.INVALID_ARGUMENT, "Timestamp nanoseconds out of range: " + e); if (t < -62135596800) throw new c(a.INVALID_ARGUMENT, "Timestamp seconds out of range: " + t); // This will break in the year 10,000. if (t >= 253402300800) throw new c(a.INVALID_ARGUMENT, "Timestamp seconds out of range: " + t); } /** * Creates a new timestamp with the current date, with millisecond precision. * * @return a new timestamp representing the current date. */ return t.now = function() { return t.fromMillis(Date.now()); }, /** * Creates a new timestamp from the given date. * * @param date The date to initialize the `Timestamp` from. * @return A new `Timestamp` representing the same point in time as the given * date. */ t.fromDate = function(e) { return t.fromMillis(e.getTime()); }, /** * Creates a new timestamp from the given number of milliseconds. * * @param milliseconds Number of milliseconds since Unix epoch * 1970-01-01T00:00:00Z. * @return A new `Timestamp` representing the same point in time as the given * number of milliseconds. */ t.fromMillis = function(e) { var n = Math.floor(e / 1e3); return new t(n, 1e6 * (e - 1e3 * n)); }, /** * Converts a `Timestamp` to a JavaScript `Date` object. This conversion causes * a loss of precision since `Date` objects only support millisecond precision. * * @return JavaScript `Date` object representing the same point in time as * this `Timestamp`, with millisecond precision. */ t.prototype.toDate = function() { return new Date(this.toMillis()); }, /** * Converts a `Timestamp` to a numeric timestamp (in milliseconds since * epoch). This operation causes a loss of precision. * * @return The point in time corresponding to this timestamp, represented as * the number of milliseconds since Unix epoch 1970-01-01T00:00:00Z. */ t.prototype.toMillis = function() { return 1e3 * this.seconds + this.nanoseconds / 1e6; }, t.prototype.Y = function(t) { return this.seconds === t.seconds ? H(this.nanoseconds, t.nanoseconds) : H(this.seconds, t.seconds); }, /** * Returns true if this `Timestamp` is equal to the provided one. * * @param other The `Timestamp` to compare against. * @return true if this `Timestamp` is equal to the provided one. */ t.prototype.isEqual = function(t) { return t.seconds === this.seconds && t.nanoseconds === this.nanoseconds; }, t.prototype.toString = function() { return "Timestamp(seconds=" + this.seconds + ", nanoseconds=" + this.nanoseconds + ")"; }, t.prototype.toJSON = function() { return { seconds: this.seconds, nanoseconds: this.nanoseconds }; }, /** * Converts this object to a primitive string, which allows Timestamp objects to be compared * using the `>`, `<=`, `>=` and `>` operators. */ t.prototype.valueOf = function() { // This method returns a string of the form <seconds>.<nanoseconds> where <seconds> is // translated to have a non-negative value and both <seconds> and <nanoseconds> are left-padded // with zeroes to be a consistent length. Strings with this format then have a lexiographical // ordering that matches the expected ordering. The <seconds> translation is done to avoid // having a leading negative sign (i.e. a leading '-' character) in its string representation, // which would affect its lexiographical ordering. var t = this.seconds - -62135596800; // Note: Up to 12 decimal digits are required to represent all valid 'seconds' values. return String(t).padStart(12, "0") + "." + String(this.nanoseconds).padStart(9, "0"); }, t; }(), st = /** @class */ function() { function t(t) { this.timestamp = t; } return t.J = function(e) { return new t(e); }, t.min = function() { return new t(new ot(0, 0)); }, t.prototype.L = function(t) { return this.timestamp.Y(t.timestamp); }, t.prototype.isEqual = function(t) { return this.timestamp.isEqual(t.timestamp); }, /** Returns a number representation of the version for use in spec tests. */ t.prototype.X = function() { // Convert to microseconds. return 1e6 * this.timestamp.seconds + this.timestamp.nanoseconds / 1e3; }, t.prototype.toString = function() { return "SnapshotVersion(" + this.timestamp.toString() + ")"; }, t.prototype.Z = function() { return this.timestamp; }, t; }(); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Returns whether a variable is either undefined or null. */ function ut(t) { return null == t; } /** Returns whether the value represents -0. */ function at(t) { // Detect if the value is -0.0. Based on polyfill from // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is return 0 === t && 1 / t == -1 / 0; } /** * Returns whether a value is an integer and in the safe integer range * @param value The value to test for being an integer and in the safe range */ function ct(t) { return "number" == typeof t && Number.isInteger(t) && !at(t) && t <= Number.MAX_SAFE_INTEGER && t >= Number.MIN_SAFE_INTEGER; } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // Visible for testing var ht = function(t, e, n, r, i, o, s) { void 0 === e && (e = null), void 0 === n && (n = []), void 0 === r && (r = []), void 0 === i && (i = null), void 0 === o && (o = null), void 0 === s && (s = null), this.path = t, this.collectionGroup = e, this.orderBy = n, this.filters = r, this.limit = i, this.startAt = o, this.endAt = s, this.tt = null; }; /** * Initializes a Target with a path and optional additional query constraints. * Path must currently be empty if this is a collection group query. * * NOTE: you should always construct `Target` from `Query.toTarget` instead of * using this factory method, because `Query` provides an implicit `orderBy` * property. */ function ft(t, e, n, r, i, o, s) { return void 0 === e && (e = null), void 0 === n && (n = []), void 0 === r && (r = []), void 0 === i && (i = null), void 0 === o && (o = null), void 0 === s && (s = null), new ht(t, e, n, r, i, o, s); } function lt(t) { var e = m(t); if (null === e.tt) { var n = e.path.R(); null !== e.collectionGroup && (n += "|cg:" + e.collectionGroup), n += "|f:", n += e.filters.map((function(t) { return function(t) { // TODO(b/29183165): Technically, this won't be unique if two values have // the same description, such as the int 3 and the string "3". So we should // add the types in here somehow, too. return t.field.R() + t.op.toString() + re(t.value); }(t); })).join(","), n += "|ob:", n += e.orderBy.map((function(t) { return (e = t).field.R() + e.dir; var e; })).join(","), ut(e.limit) || (n += "|l:", n += e.limit), e.startAt && (n += "|lb:", n += ar(e.startAt)), e.endAt && (n += "|ub:", n += ar(e.endAt)), e.tt = n; } return e.tt; } function pt(t, e) { if (t.limit !== e.limit) return !1; if (t.orderBy.length !== e.orderBy.length) return !1; for (var n = 0; n < t.orderBy.length; n++) if (!pr(t.orderBy[n], e.orderBy[n])) return !1; if (t.filters.length !== e.filters.length) return !1; for (var r = 0; r < t.filters.length; r++) if (i = t.filters[r], o = e.filters[r], i.op !== o.op || !i.field.isEqual(o.field) || !Zt(i.value, o.value)) return !1; var i, o; return t.collectionGroup === e.collectionGroup && !!t.path.isEqual(e.path) && !!hr(t.startAt, e.startAt) && hr(t.endAt, e.endAt); } function dt(t) { return A.F(t.path) && null === t.collectionGroup && 0 === t.filters.length; } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * An immutable set of metadata that the local store tracks for each target. */ var vt, yt, gt = /** @class */ function() { function t( /** The target being listened to. */ t, /** * The target ID to which the target corresponds; Assigned by the * LocalStore for user listens and by the SyncEngine for limbo watches. */ e, /** The purpose of the target. */ n, /** * The sequence number of the last transaction during which this target data * was modified. */ r, /** The latest snapshot version seen for this target. */ i /** * The maximum snapshot version at which the associated view * contained no limbo documents. */ , o /** * An opaque, server-assigned token that allows watching a target to be * resumed after disconnecting without retransmitting all the data that * matches the target. The resume token essentially identifies a point in * time from which the server should resume sending results. */ , s) { void 0 === i && (i = st.min()), void 0 === o && (o = st.min()), void 0 === s && (s = X.B), this.target = t, this.targetId = e, this.et = n, this.sequenceNumber = r, this.nt = i, this.lastLimboFreeSnapshotVersion = o, this.resumeToken = s; } /** Creates a new target data instance with an updated sequence number. */ return t.prototype.st = function(e) { return new t(this.target, this.targetId, this.et, e, this.nt, this.lastLimboFreeSnapshotVersion, this.resumeToken); }, /** * Creates a new target data instance with an updated resume token and * snapshot version. */ t.prototype.it = function(e, n) { return new t(this.target, this.targetId, this.et, this.sequenceNumber, n, this.lastLimboFreeSnapshotVersion, e); }, /** * Creates a new target data instance with an updated last limbo free * snapshot version number. */ t.prototype.rt = function(e) { return new t(this.target, this.targetId, this.et, this.sequenceNumber, this.nt, e, this.resumeToken); }, t; }(), mt = // TODO(b/33078163): just use simplest form of existence filter for now function(t) { this.count = t; }; /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Determines whether an error code represents a permanent error when received * in response to a non-write operation. * * See isPermanentWriteError for classifying write errors. */ function wt(t) { switch (t) { case a.OK: return y(); case a.CANCELLED: case a.UNKNOWN: case a.DEADLINE_EXCEEDED: case a.RESOURCE_EXHAUSTED: case a.INTERNAL: case a.UNAVAILABLE: // Unauthenticated means something went wrong with our token and we need // to retry with new credentials which will happen automatically. case a.UNAUTHENTICATED: return !1; case a.INVALID_ARGUMENT: case a.NOT_FOUND: case a.ALREADY_EXISTS: case a.PERMISSION_DENIED: case a.FAILED_PRECONDITION: // Aborted might be retried in some scenarios, but that is dependant on // the context and should handled individually by the calling code. // See https://cloud.google.com/apis/design/errors. case a.ABORTED: case a.OUT_OF_RANGE: case a.UNIMPLEMENTED: case a.DATA_LOSS: return !0; default: return y(); } } /** * Determines whether an error code represents a permanent error when received * in response to a write operation. * * Write operations must be handled specially because as of b/119437764, ABORTED * errors on the write stream should be retried too (even though ABORTED errors * are not generally retryable). * * Note that during the initial handshake on the write stream an ABORTED error * signals that we should discard our stream token (i.e. it is permanent). This * means a handshake error should be classified with isPermanentError, above. */ /** * Maps an error Code from GRPC status code number, like 0, 1, or 14. These * are not the same as HTTP status codes. * * @returns The Code equivalent to the given GRPC status code. Fails if there * is no match. */ function _t(t) { if (void 0 === t) // This shouldn't normally happen, but in certain error cases (like trying // to send invalid proto messages) we may get an error with no GRPC code. return p("GRPC error has no .code"), a.UNKNOWN; switch (t) { case vt.OK: return a.OK; case vt.CANCELLED: return a.CANCELLED; case vt.UNKNOWN: return a.UNKNOWN; case vt.DEADLINE_EXCEEDED: return a.DEADLINE_EXCEEDED; case vt.RESOURCE_EXHAUSTED: return a.RESOURCE_EXHAUSTED; case vt.INTERNAL: return a.INTERNAL; case vt.UNAVAILABLE: return a.UNAVAILABLE; case vt.UNAUTHENTICATED: return a.UNAUTHENTICATED; case vt.INVALID_ARGUMENT: return a.INVALID_ARGUMENT; case vt.NOT_FOUND: return a.NOT_FOUND; case vt.ALREADY_EXISTS: return a.ALREADY_EXISTS; case vt.PERMISSION_DENIED: return a.PERMISSION_DENIED; case vt.FAILED_PRECONDITION: return a.FAILED_PRECONDITION; case vt.ABORTED: return a.ABORTED; case vt.OUT_OF_RANGE: return a.OUT_OF_RANGE; case vt.UNIMPLEMENTED: return a.UNIMPLEMENTED; case vt.DATA_LOSS: return a.DATA_LOSS; default: return y(); } } /** * Converts an HTTP response's error status to the equivalent error code. * * @param status An HTTP error response status ("FAILED_PRECONDITION", * "UNKNOWN", etc.) * @returns The equivalent Code. Non-matching responses are mapped to * Code.UNKNOWN. */ (yt = vt || (vt = {}))[yt.OK = 0] = "OK", yt[yt.CANCELLED = 1] = "CANCELLED", yt[yt.UNKNOWN = 2] = "UNKNOWN", yt[yt.INVALID_ARGUMENT = 3] = "INVALID_ARGUMENT", yt[yt.DEADLINE_EXCEEDED = 4] = "DEADLINE_EXCEEDED", yt[yt.NOT_FOUND = 5] = "NOT_FOUND", yt[yt.ALREADY_EXISTS = 6] = "ALREADY_EXISTS", yt[yt.PERMISSION_DENIED = 7] = "PERMISSION_DENIED", yt[yt.UNAUTHENTICATED = 16] = "UNAUTHENTICATED", yt[yt.RESOURCE_EXHAUSTED = 8] = "RESOURCE_EXHAUSTED", yt[yt.FAILED_PRECONDITION = 9] = "FAILED_PRECONDITION", yt[yt.ABORTED = 10] = "ABORTED", yt[yt.OUT_OF_RANGE = 11] = "OUT_OF_RANGE", yt[yt.UNIMPLEMENTED = 12] = "UNIMPLEMENTED", yt[yt.INTERNAL = 13] = "INTERNAL", yt[yt.UNAVAILABLE = 14] = "UNAVAILABLE", yt[yt.DATA_LOSS = 15] = "DATA_LOSS"; /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // An immutable sorted map implementation, based on a Left-leaning Red-Black // tree. var bt = /** @class */ function() { function t(t, e) { this.i = t, this.root = e || Et.EMPTY; } // Returns a copy of the map, with the specified key/value added or replaced. return t.prototype.ot = function(e, n) { return new t(this.i, this.root.ot(e, n, this.i).copy(null, null, Et.at, null, null)); }, // Returns a copy of the map, with the specified key removed. t.prototype.remove = function(e) { return new t(this.i, this.root.remove(e, this.i).copy(null, null, Et.at, null, null)); }, // Returns the value of the node with the given key, or null. t.prototype.get = function(t) { for (var e = this.root; !e.m(); ) { var n = this.i(t, e.key); if (0 === n) return e.value; n < 0 ? e = e.left : n > 0 && (e = e.right); } return null; }, // Returns the index of the element in this sorted map, or -1 if it doesn't // exist. t.prototype.indexOf = function(t) { for ( // Number of nodes that were pruned when descending right var e = 0, n = this.root; !n.m(); ) { var r = this.i(t, n.key); if (0 === r) return e + n.left.size; r < 0 ? n = n.left : ( // Count all nodes left of the node plus the node itself e += n.left.size + 1, n = n.right); } // Node not found return -1; }, t.prototype.m = function() { return this.root.m(); }, Object.defineProperty(t.prototype, "size", { // Returns the total number of nodes in the map. get: function() { return this.root.size; }, enumerable: !1, configurable: !0 }), // Returns the minimum key in the map. t.prototype.ct = function() { return this.root.ct(); }, // Returns the maximum key in the map. t.prototype.ut = function() { return this.root.ut(); }, // Traverses the map in key order and calls the specified action function // for each key/value pair. If action returns true, traversal is aborted. // Returns the first truthy value returned by action, or the last falsey // value returned by action. t.prototype.ht = function(t) { return this.root.ht(t); }, t.prototype.forEach = function(t) { this.ht((function(e, n) { return t(e, n), !1; })); }, t.prototype.toString = function() { var t = []; return this.ht((function(e, n) { return t.push(e + ":" + n), !1; })), "{" + t.join(", ") + "}"; }, // Traverses the map in reverse key order and calls the specified action // function for each key/value pair. If action returns true, traversal is // aborted. // Returns the first truthy value returned by action, or the last falsey // value returned by action. t.prototype.lt = function(t) { return this.root.lt(t); }, // Returns an iterator over the SortedMap. t.prototype._t = function() { return new It(this.root, null, this.i, !1); }, t.prototype.ft = function(t) { return new It(this.root, t, this.i, !1); }, t.prototype.dt = function() { return new It(this.root, null, this.i, !0); }, t.prototype.wt = function(t) { return new It(this.root, t, this.i, !0); }, t; }(), It = /** @class */ function() { function t(t, e, n, r) { this.Tt = r, this.Et = []; for (var i = 1; !t.m(); ) if (i = e ? n(t.key, e) : 1, // flip the comparison if we're going in reverse r && (i *= -1), i < 0) // This node is less than our start key. ignore it t = this.Tt ? t.left : t.right; else { if (0 === i) { // This node is exactly equal to our start key. Push it on the stack, // but stop iterating; this.Et.push(t); break; } // This node is greater than our start key, add it to the stack and move // to the next one this.Et.push(t), t = this.Tt ? t.right : t.left; } } return t.prototype.It = function() { var t = this.Et.pop(), e = { key: t.key, value: t.value }; if (this.Tt) for (t = t.left; !t.m(); ) this.Et.push(t), t = t.right; else for (t = t.right; !t.m(); ) this.Et.push(t), t = t.left; return e; }, t.prototype.At = function() { return this.Et.length > 0; }, t.prototype.Rt = function() { if (0 === this.Et.length) return null; var t = this.Et[this.Et.length - 1]; return { key: t.key, value: t.value }; }, t; }(), Et = /** @class */ function() { function t(e, n, r, i, o) { this.key = e, this.value = n, this.color = null != r ? r : t.RED, this.left = null != i ? i : t.EMPTY, this.right = null != o ? o : t.EMPTY, this.size = this.left.size + 1 + this.right.size; } // Returns a copy of the current node, optionally replacing pieces of it. return t.prototype.copy = function(e, n, r, i, o) { return new t(null != e ? e : this.key, null != n ? n : this.value, null != r ? r : this.color, null != i ? i : this.left, null != o ? o : this.right); }, t.prototype.m = function() { return !1; }, // Traverses the tree in key order and calls the specified action function // for each node. If action returns true, traversal is aborted. // Returns the first truthy value returned by action, or the last falsey // value returned by action. t.prototype.ht = function(t) { return this.left.ht(t) || t(this.key, this.value) || this.right.ht(t); }, // Traverses the tree in reverse key order and calls the specified action // function for each node. If action returns true, traversal is aborted. // Returns the first truthy value returned by action, or the last falsey // value returned by action. t.prototype.lt = function(t) { return this.right.lt(t) || t(this.key, this.value) || this.left.lt(t); }, // Returns the minimum node in the tree. t.prototype.min = function() { return this.left.m() ? this : this.left.min(); }, // Returns the maximum key in the tree. t.prototype.ct = function() { return this.min().key; }, // Returns the maximum key in the tree. t.prototype.ut = function() { return this.right.m() ? this.key : this.right.ut(); }, // Returns new tree, with the key/value added. t.prototype.ot = function(t, e, n) { var r = this, i = n(t, r.key); return (r = i < 0 ? r.copy(null, null, null, r.left.ot(t, e, n), null) : 0 === i ? r.copy(null, e, null, null, null) : r.copy(null, null, null, null, r.right.ot(t, e, n))).gt(); }, t.prototype.Pt = function() { if (this.left.m()) return t.EMPTY; var e = this; return e.left.yt() || e.left.left.yt() || (e = e.Vt()), (e = e.copy(null, null, null, e.left.Pt(), null)).gt(); }, // Returns new tree, with the specified item removed. t.prototype.remove = function(e, n) { var r, i = this; if (n(e, i.key) < 0) i.left.m() || i.left.yt() || i.left.left.yt() || (i = i.Vt()), i = i.copy(null, null, null, i.left.remove(e, n), null); else { if (i.left.yt() && (i = i.bt()), i.right.m() || i.right.yt() || i.right.left.yt() || (i = i.vt()), 0 === n(e, i.key)) { if (i.right.m()) return t.EMPTY; r = i.right.min(), i = i.copy(r.key, r.value, null, null, i.right.Pt()); } i = i.copy(null, null, null, null, i.right.remove(e, n)); } return i.gt(); }, t.prototype.yt = function() { return this.color; }, // Returns new tree after performing any needed rotations. t.prototype.gt = function() { var t = this; return t.right.yt() && !t.left.yt() && (t = t.St()), t.left.yt() && t.left.left.yt() && (t = t.bt()), t.left.yt() && t.right.yt() && (t = t.Dt()), t; }, t.prototype.Vt = function() { var t = this.Dt(); return t.right.left.yt() && (t = (t = (t = t.copy(null, null, null, null, t.right.bt())).St()).Dt()), t; }, t.prototype.vt = function() { var t = this.Dt(); return t.left.left.yt() && (t = (t = t.bt()).Dt()), t; }, t.prototype.St = function() { var e = this.copy(null, null, t.RED, null, this.right.left); return this.right.copy(null, null, this.color, e, null); }, t.prototype.bt = function() { var e = this.copy(null, null, t.RED, this.left.right, null); return this.left.copy(null, null, this.color, null, e); }, t.prototype.Dt = function() { var t = this.left.copy(null, null, !this.left.color, null, null), e = this.right.copy(null, null, !this.right.color, null, null); return this.copy(null, null, !this.color, t, e); }, // For testing. t.prototype.Ct = function() { var t = this.Nt(); return Math.pow(2, t) <= this.size + 1; }, // In a balanced RB tree, the black-depth (number of black nodes) from root to // leaves is equal on both sides. This function verifies that or asserts. t.prototype.Nt = function() { if (this.yt() && this.left.yt()) throw y(); if (this.right.yt()) throw y(); var t = this.left.Nt(); if (t !== this.right.Nt()) throw y(); return t + (this.yt() ? 0 : 1); }, t; }(); // end SortedMap // An iterator over an LLRBNode. // end LLRBNode // Empty node is shared between all LLRB trees. // eslint-disable-next-line @typescript-eslint/no-explicit-any Et.EMPTY = null, Et.RED = !0, Et.at = !1, // end LLRBEmptyNode Et.EMPTY = new (/** @class */ function() { function t() { this.size = 0; } return Object.defineProperty(t.prototype, "key", { get: function() { throw y(); }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "value", { get: function() { throw y(); }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "color", { get: function() { throw y(); }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "left", { get: function() { throw y(); }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "right", { get: function() { throw y(); }, enumerable: !1, configurable: !0 }), // Returns a copy of the current node. t.prototype.copy = function(t, e, n, r, i) { return this; }, // Returns a copy of the tree, with the specified key/value added. t.prototype.ot = function(t, e, n) { return new Et(t, e); }, // Returns a copy of the tree, with the specified key removed. t.prototype.remove = function(t, e) { return this; }, t.prototype.m = function() { return !0; }, t.prototype.ht = function(t) { return !1; }, t.prototype.lt = function(t) { return !1; }, t.prototype.ct = function() { return null; }, t.prototype.ut = function() { return null; }, t.prototype.yt = function() { return !1; }, // For testing. t.prototype.Ct = function() { return !0; }, t.prototype.Nt = function() { return 0; }, t; }()); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * SortedSet is an immutable (copy-on-write) collection that holds elements * in order specified by the provided comparator. * * NOTE: if provided comparator returns 0 for two elements, we consider them to * be equal! */ var Tt = /** @class */ function() { function t(t) { this.i = t, this.data = new bt(this.i); } return t.prototype.has = function(t) { return null !== this.data.get(t); }, t.prototype.first = function() { return this.data.ct(); }, t.prototype.last = function() { return this.data.ut(); }, Object.defineProperty(t.prototype, "size", { get: function() { return this.data.size; }, enumerable: !1, configurable: !0 }), t.prototype.indexOf = function(t) { return this.data.indexOf(t); }, /** Iterates elements in order defined by "comparator" */ t.prototype.forEach = function(t) { this.data.ht((function(e, n) { return t(e), !1; })); }, /** Iterates over `elem`s such that: range[0] <= elem < range[1]. */ t.prototype.Ft = function(t, e) { for (var n = this.data.ft(t[0]); n.At(); ) { var r = n.It(); if (this.i(r.key, t[1]) >= 0) return; e(r.key); } }, /** * Iterates over `elem`s such that: start <= elem until false is returned. */ t.prototype.xt = function(t, e) { var n; for (n = void 0 !== e ? this.data.ft(e) : this.data._t(); n.At(); ) if (!t(n.It().key)) return; }, /** Finds the least element greater than or equal to `elem`. */ t.prototype.$t = function(t) { var e = this.data.ft(t); return e.At() ? e.It().key : null; }, t.prototype._t = function() { return new Nt(this.data._t()); }, t.prototype.ft = function(t) { return new Nt(this.data.ft(t)); }, /** Inserts or updates an element */ t.prototype.add = function(t) { return this.copy(this.data.remove(t).ot(t, !0)); }, /** Deletes an element */ t.prototype.delete = function(t) { return this.has(t) ? this.copy(this.data.remove(t)) : this; }, t.prototype.m = function() { return this.data.m(); }, t.prototype.kt = function(t) { var e = this; // Make sure `result` always refers to the larger one of the two sets. return e.size < t.size && (e = t, t = this), t.forEach((function(t) { e = e.add(t); })), e; }, t.prototype.isEqual = function(e) { if (!(e instanceof t)) return !1; if (this.size !== e.size) return !1; for (var n = this.data._t(), r = e.data._t(); n.At(); ) { var i = n.It().key, o = r.It().key; if (0 !== this.i(i, o)) return !1; } return !0; }, t.prototype.A = function() { var t = []; return this.forEach((function(e) { t.push(e); })), t; }, t.prototype.toString = function() { var t = []; return this.forEach((function(e) { return t.push(e); })), "SortedSet(" + t.toString() + ")"; }, t.prototype.copy = function(e) { var n = new t(this.i); return n.data = e, n; }, t; }(), Nt = /** @class */ function() { function t(t) { this.Mt = t; } return t.prototype.It = function() { return this.Mt.It().key; }, t.prototype.At = function() { return this.Mt.At(); }, t; }(), At = new bt(A.i); function St() { return At; } function Dt() { return St(); } var xt = new bt(A.i); function Lt() { return xt; } var kt = new bt(A.i), Rt = new Tt(A.i); function Ot() { for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e]; for (var n = Rt, r = 0, i = t; r < i.length; r++) { var o = i[r]; n = n.add(o); } return n; } var Pt = new Tt(H); function Vt() { return Pt; } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * DocumentSet is an immutable (copy-on-write) collection that holds documents * in order specified by the provided comparator. We always add a document key * comparator on top of what is provided to guarantee document equality based on * the key. */ var Ut = /** @class */ function() { /** The default ordering is by key if the comparator is omitted */ function t(t) { // We are adding document key comparator to the end as it's the only // guaranteed unique property of a document. this.i = t ? function(e, n) { return t(e, n) || A.i(e.key, n.key); } : function(t, e) { return A.i(t.key, e.key); }, this.Ot = Lt(), this.Lt = new bt(this.i) /** * Returns an empty copy of the existing DocumentSet, using the same * comparator. */; } return t.Bt = function(e) { return new t(e.i); }, t.prototype.has = function(t) { return null != this.Ot.get(t); }, t.prototype.get = function(t) { return this.Ot.get(t); }, t.prototype.first = function() { return this.Lt.ct(); }, t.prototype.last = function() { return this.Lt.ut(); }, t.prototype.m = function() { return this.Lt.m(); }, /** * Returns the index of the provided key in the document set, or -1 if the * document key is not present in the set; */ t.prototype.indexOf = function(t) { var e = this.Ot.get(t); return e ? this.Lt.indexOf(e) : -1; }, Object.defineProperty(t.prototype, "size", { get: function() { return this.Lt.size; }, enumerable: !1, configurable: !0 }), /** Iterates documents in order defined by "comparator" */ t.prototype.forEach = function(t) { this.Lt.ht((function(e, n) { return t(e), !1; })); }, /** Inserts or updates a document with the same key */ t.prototype.add = function(t) { // First remove the element if we have it. var e = this.delete(t.key); return e.copy(e.Ot.ot(t.key, t), e.Lt.ot(t, null)); }, /** Deletes a document with a given key */ t.prototype.delete = function(t) { var e = this.get(t); return e ? this.copy(this.Ot.remove(t), this.Lt.remove(e)) : this; }, t.prototype.isEqual = function(e) { if (!(e instanceof t)) return !1; if (this.size !== e.size) return !1; for (var n = this.Lt._t(), r = e.Lt._t(); n.At(); ) { var i = n.It().key, o = r.It().key; if (!i.isEqual(o)) return !1; } return !0; }, t.prototype.toString = function() { var t = []; return this.forEach((function(e) { t.push(e.toString()); })), 0 === t.length ? "DocumentSet ()" : "DocumentSet (\n " + t.join(" \n") + "\n)"; }, t.prototype.copy = function(e, n) { var r = new t; return r.i = this.i, r.Ot = e, r.Lt = n, r; }, t; }(), Ct = /** @class */ function() { function t() { this.qt = new bt(A.i); } return t.prototype.track = function(t) { var e = t.doc.key, n = this.qt.get(e); n ? // Merge the new change with the existing change. 0 /* Added */ !== t.type && 3 /* Metadata */ === n.type ? this.qt = this.qt.ot(e, t) : 3 /* Metadata */ === t.type && 1 /* Removed */ !== n.type ? this.qt = this.qt.ot(e, { type: n.type, doc: t.doc }) : 2 /* Modified */ === t.type && 2 /* Modified */ === n.type ? this.qt = this.qt.ot(e, { type: 2 /* Modified */ , doc: t.doc }) : 2 /* Modified */ === t.type && 0 /* Added */ === n.type ? this.qt = this.qt.ot(e, { type: 0 /* Added */ , doc: t.doc }) : 1 /* Removed */ === t.type && 0 /* Added */ === n.type ? this.qt = this.qt.remove(e) : 1 /* Removed */ === t.type && 2 /* Modified */ === n.type ? this.qt = this.qt.ot(e, { type: 1 /* Removed */ , doc: n.doc }) : 0 /* Added */ === t.type && 1 /* Removed */ === n.type ? this.qt = this.qt.ot(e, { type: 2 /* Modified */ , doc: t.doc }) : // This includes these cases, which don't make sense: // Added->Added // Removed->Removed // Modified->Added // Removed->Modified // Metadata->Added // Removed->Metadata y() : this.qt = this.qt.ot(e, t); }, t.prototype.Ut = function() { var t = []; return this.qt.ht((function(e, n) { t.push(n); })), t; }, t; }(), Ft = /** @class */ function() { function t(t, e, n, r, i, o, s, u) { this.query = t, this.docs = e, this.Qt = n, this.docChanges = r, this.Wt = i, this.fromCache = o, this.jt = s, this.Kt = u /** Returns a view snapshot as if all documents in the snapshot were added. */; } return t.Gt = function(e, n, r, i) { var o = []; return n.forEach((function(t) { o.push({ type: 0 /* Added */ , doc: t }); })), new t(e, n, Ut.Bt(n), o, r, i, /* syncStateChanged= */ !0, /* excludesMetadataChanges= */ !1); }, Object.defineProperty(t.prototype, "hasPendingWrites", { get: function() { return !this.Wt.m(); }, enumerable: !1, configurable: !0 }), t.prototype.isEqual = function(t) { if (!(this.fromCache === t.fromCache && this.jt === t.jt && this.Wt.isEqual(t.Wt) && Qn(this.query, t.query) && this.docs.isEqual(t.docs) && this.Qt.isEqual(t.Qt))) return !1; var e = this.docChanges, n = t.docChanges; if (e.length !== n.length) return !1; for (var r = 0; r < e.length; r++) if (e[r].type !== n[r].type || !e[r].doc.isEqual(n[r].doc)) return !1; return !0; }, t; }(), Mt = /** @class */ function() { function t( /** * The snapshot version this event brings us up to, or MIN if not set. */ t, /** * A map from target to changes to the target. See TargetChange. */ e, /** * A set of targets that is known to be inconsistent. Listens for these * targets should be re-established without resume tokens. */ n, /** * A set of which documents have changed or been deleted, along with the * doc's new values (if not deleted). */ r, /** * A set of which document updates are due only to limbo resolution targets. */ i) { this.nt = t, this.zt = e, this.Ht = n, this.Yt = r, this.Jt = i; } /** * HACK: Views require RemoteEvents in order to determine whether the view is * CURRENT, but secondary tabs don't receive remote events. So this method is * used to create a synthesized RemoteEvent that can be used to apply a * CURRENT status change to a View, for queries executed in a different tab. */ // PORTING NOTE: Multi-tab only return t.Xt = function(e, n) { var r = new Map; return r.set(e, qt.Zt(e, n)), new t(st.min(), r, Vt(), St(), Ot()); }, t; }(), qt = /** @class */ function() { function t( /** * An opaque, server-assigned token that allows watching a query to be resumed * after disconnecting without retransmitting all the data that matches the * query. The resume token essentially identifies a point in time from which * the server should resume sending results. */ t, /** * The "current" (synced) status of this target. Note that "current" * has special meaning in the RPC protocol that implies that a target is * both up-to-date and consistent with the rest of the watch stream. */ e, /** * The set of documents that were newly assigned to this target as part of * this remote event. */ n, /** * The set of documents that were already assigned to this target but received * an update during this remote event. */ r, /** * The set of documents that were removed from this target as part of this * remote event. */ i) { this.resumeToken = t, this.te = e, this.ee = n, this.ne = r, this.se = i /** * This method is used to create a synthesized TargetChanges that can be used to * apply a CURRENT status change to a View (for queries executed in a different * tab) or for new queries (to raise snapshots with correct CURRENT status). */; } return t.Zt = function(e, n) { return new t(X.B, n, Ot(), Ot(), Ot()); }, t; }(), jt = function( /** The new document applies to all of these targets. */ t, /** The new document is removed from all of these targets. */ e, /** The key of the document for this change. */ n, /** * The new document or NoDocument if it was deleted. Is null if the * document went out of view without the server sending a new document. */ r) { this.ie = t, this.removedTargetIds = e, this.key = n, this.re = r; }, Gt = function(t, e) { this.targetId = t, this.oe = e; }, zt = function( /** What kind of change occurred to the watch target. */ t, /** The target IDs that were added/removed/set. */ e, /** * An opaque, server-assigned token that allows watching a target to be * resumed after disconnecting without retransmitting all the data that * matches the target. The resume token essentially identifies a point in * time from which the server should resume sending results. */ n /** An RPC error indicating why the watch failed. */ , r) { void 0 === n && (n = X.B), void 0 === r && (r = null), this.state = t, this.targetIds = e, this.resumeToken = n, this.cause = r; }, Bt = /** @class */ function() { function t() { /** * The number of pending responses (adds or removes) that we are waiting on. * We only consider targets active that have no pending responses. */ this.ae = 0, /** * Keeps track of the document changes since the last raised snapshot. * * These changes are continuously updated as we receive document updates and * always reflect the current set of changes against the last issued snapshot. */ this.ce = Qt(), /** See public getters for explanations of these fields. */ this.ue = X.B, this.he = !1, /** * Whether this target state should be included in the next snapshot. We * initialize to true so that newly-added targets are included in the next * RemoteEvent. */ this.le = !0; } return Object.defineProperty(t.prototype, "te", { /** * Whether this target has been marked 'current'. * * 'Current' has special meaning in the RPC protocol: It implies that the * Watch backend has sent us all changes up to the point at which the target * was added and that the target is consistent with the rest of the watch * stream. */ get: function() { return this.he; }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "resumeToken", { /** The last resume token sent to us for this target. */ get: function() { return this.ue; }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "_e", { /** Whether this target has pending target adds or target removes. */ get: function() { return 0 !== this.ae; }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "fe", { /** Whether we have modified any state that should trigger a snapshot. */ get: function() { return this.le; }, enumerable: !1, configurable: !0 }), /** * Applies the resume token to the TargetChange, but only when it has a new * value. Empty resumeTokens are discarded. */ t.prototype.de = function(t) { t.O() > 0 && (this.le = !0, this.ue = t); }, /** * Creates a target change from the current set of changes. * * To reset the document changes after raising this snapshot, call * `clearPendingChanges()`. */ t.prototype.we = function() { var t = Ot(), e = Ot(), n = Ot(); return this.ce.forEach((function(r, i) { switch (i) { case 0 /* Added */ : t = t.add(r); break; case 2 /* Modified */ : e = e.add(r); break; case 1 /* Removed */ : n = n.add(r); break; default: y(); } })), new qt(this.ue, this.he, t, e, n); }, /** * Resets the document changes and sets `hasPendingChanges` to false. */ t.prototype.me = function() { this.le = !1, this.ce = Qt(); }, t.prototype.Te = function(t, e) { this.le = !0, this.ce = this.ce.ot(t, e); }, t.prototype.Ee = function(t) { this.le = !0, this.ce = this.ce.remove(t); }, t.prototype.Ie = function() { this.ae += 1; }, t.prototype.Ae = function() { this.ae -= 1; }, t.prototype.Re = function() { this.le = !0, this.he = !0; }, t; }(), Wt = /** @class */ function() { function t(t) { this.ge = t, /** The internal state of all tracked targets. */ this.Pe = new Map, /** Keeps track of the documents to update since the last raised snapshot. */ this.ye = St(), /** A mapping of document keys to their set of target IDs. */ this.Ve = Kt(), /** * A list of targets with existence filter mismatches. These targets are * known to be inconsistent and their listens needs to be re-established by * RemoteStore. */ this.pe = new Tt(H) /** * Processes and adds the DocumentWatchChange to the current set of changes. */; } return t.prototype.be = function(t) { for (var e = 0, n = t.ie; e < n.length; e++) { var r = n[e]; t.re instanceof kn ? this.ve(r, t.re) : t.re instanceof Rn && this.Se(r, t.key, t.re); } for (var i = 0, o = t.removedTargetIds; i < o.length; i++) { var s = o[i]; this.Se(s, t.key, t.re); } }, /** Processes and adds the WatchTargetChange to the current set of changes. */ t.prototype.De = function(t) { var e = this; this.Ce(t, (function(n) { var r = e.Ne(n); switch (t.state) { case 0 /* NoChange */ : e.Fe(n) && r.de(t.resumeToken); break; case 1 /* Added */ : // We need to decrement the number of pending acks needed from watch // for this targetId. r.Ae(), r._e || // We have a freshly added target, so we need to reset any state // that we had previously. This can happen e.g. when remove and add // back a target for existence filter mismatches. r.me(), r.de(t.resumeToken); break; case 2 /* Removed */ : // We need to keep track of removed targets to we can post-filter and // remove any target changes. // We need to decrement the number of pending acks needed from watch // for this targetId. r.Ae(), r._e || e.removeTarget(n); break; case 3 /* Current */ : e.Fe(n) && (r.Re(), r.de(t.resumeToken)); break; case 4 /* Reset */ : e.Fe(n) && ( // Reset the target and synthesizes removes for all existing // documents. The backend will re-add any documents that still // match the target before it sends the next global snapshot. e.xe(n), r.de(t.resumeToken)); break; default: y(); } })); }, /** * Iterates over all targetIds that the watch change applies to: either the * targetIds explicitly listed in the change or the targetIds of all currently * active targets. */ t.prototype.Ce = function(t, e) { var n = this; t.targetIds.length > 0 ? t.targetIds.forEach(e) : this.Pe.forEach((function(t, r) { n.Fe(r) && e(r); })); }, /** * Handles existence filters and synthesizes deletes for filter mismatches. * Targets that are invalidated by filter mismatches are added to * `pendingTargetResets`. */ t.prototype.$e = function(t) { var e = t.targetId, n = t.oe.count, r = this.ke(e); if (r) { var i = r.target; if (dt(i)) if (0 === n) { // The existence filter told us the document does not exist. We deduce // that this document does not exist and apply a deleted document to // our updates. Without applying this deleted document there might be // another query that will raise this document as part of a snapshot // until it is resolved, essentially exposing inconsistency between // queries. var o = new A(i.path); this.Se(e, o, new Rn(o, st.min())); } else g(1 === n); else this.Me(e) !== n && ( // Existence filter mismatch: We reset the mapping and raise a new // snapshot with `isFromCache:true`. this.xe(e), this.pe = this.pe.add(e)); } }, /** * Converts the currently accumulated state into a remote event at the * provided snapshot version. Resets the accumulated changes before returning. */ t.prototype.Oe = function(t) { var e = this, n = new Map; this.Pe.forEach((function(r, i) { var o = e.ke(i); if (o) { if (r.te && dt(o.target)) { // Document queries for document that don't exist can produce an empty // result set. To update our local cache, we synthesize a document // delete if we have not previously received the document. This // resolves the limbo state of the document, removing it from // limboDocumentRefs. // TODO(dimond): Ideally we would have an explicit lookup target // instead resulting in an explicit delete message and we could // remove this special logic. var s = new A(o.target.path); null !== e.ye.get(s) || e.Le(i, s) || e.Se(i, s, new Rn(s, t)); } r.fe && (n.set(i, r.we()), r.me()); } })); var r = Ot(); // We extract the set of limbo-only document updates as the GC logic // special-cases documents that do not appear in the target cache. // TODO(gsoltis): Expand on this comment once GC is available in the JS // client. this.Ve.forEach((function(t, n) { var i = !0; n.xt((function(t) { var n = e.ke(t); return !n || 2 /* LimboResolution */ === n.et || (i = !1, !1); })), i && (r = r.add(t)); })); var i = new Mt(t, n, this.pe, this.ye, r); return this.ye = St(), this.Ve = Kt(), this.pe = new Tt(H), i; }, /** * Adds the provided document to the internal list of document updates and * its document key to the given target's mapping. */ // Visible for testing. t.prototype.ve = function(t, e) { if (this.Fe(t)) { var n = this.Le(t, e.key) ? 2 /* Modified */ : 0 /* Added */; this.Ne(t).Te(e.key, n), this.ye = this.ye.ot(e.key, e), this.Ve = this.Ve.ot(e.key, this.Be(e.key).add(t)); } }, /** * Removes the provided document from the target mapping. If the * document no longer matches the target, but the document's state is still * known (e.g. we know that the document was deleted or we received the change * that caused the filter mismatch), the new document can be provided * to update the remote document cache. */ // Visible for testing. t.prototype.Se = function(t, e, n) { if (this.Fe(t)) { var r = this.Ne(t); this.Le(t, e) ? r.Te(e, 1 /* Removed */) : // The document may have entered and left the target before we raised a // snapshot, so we can just ignore the change. r.Ee(e), this.Ve = this.Ve.ot(e, this.Be(e).delete(t)), n && (this.ye = this.ye.ot(e, n)); } }, t.prototype.removeTarget = function(t) { this.Pe.delete(t); }, /** * Returns the current count of documents in the target. This includes both * the number of documents that the LocalStore considers to be part of the * target as well as any accumulated changes. */ t.prototype.Me = function(t) { var e = this.Ne(t).we(); return this.ge.qe(t).size + e.ee.size - e.se.size; }, /** * Increment the number of acks needed from watch before we can consider the * server to be 'in-sync' with the client's active targets. */ t.prototype.Ie = function(t) { this.Ne(t).Ie(); }, t.prototype.Ne = function(t) { var e = this.Pe.get(t); return e || (e = new Bt, this.Pe.set(t, e)), e; }, t.prototype.Be = function(t) { var e = this.Ve.get(t); return e || (e = new Tt(H), this.Ve = this.Ve.ot(t, e)), e; }, /** * Verifies that the user is still interested in this target (by calling * `getTargetDataForTarget()`) and that we are not waiting for pending ADDs * from watch. */ t.prototype.Fe = function(t) { var e = null !== this.ke(t); return e || l("WatchChangeAggregator", "Detected inactive target", t), e; }, /** * Returns the TargetData for an active target (i.e. a target that the user * is still interested in that has no outstanding target change requests). */ t.prototype.ke = function(t) { var e = this.Pe.get(t); return e && e._e ? null : this.ge.Ue(t); }, /** * Resets the state of a Watch target to its initial state (e.g. sets * 'current' to false, clears the resume token and removes its target mapping * from all documents). */ t.prototype.xe = function(t) { var e = this; this.Pe.set(t, new Bt), this.ge.qe(t).forEach((function(n) { e.Se(t, n, /*updatedDocument=*/ null); })); }, /** * Returns whether the LocalStore considers the document to be part of the * specified target. */ t.prototype.Le = function(t, e) { return this.ge.qe(t).has(e); }, t; }(); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * DocumentChangeSet keeps track of a set of changes to docs in a query, merging * duplicate events for the same doc. */ function Kt() { return new bt(A.i); } function Qt() { return new bt(A.i); } /** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Represents a locally-applied ServerTimestamp. * * Server Timestamps are backed by MapValues that contain an internal field * `__type__` with a value of `server_timestamp`. The previous value and local * write time are stored in its `__previous_value__` and `__local_write_time__` * fields respectively. * * Notes: * - ServerTimestampValue instances are created as the result of applying a * TransformMutation (see TransformMutation.applyTo()). They can only exist in * the local view of a document. Therefore they do not need to be parsed or * serialized. * - When evaluated locally (e.g. for snapshot.data()), they by default * evaluate to `null`. This behavior can be configured by passing custom * FieldValueOptions to value(). * - With respect to other ServerTimestampValues, they sort by their * localWriteTime. */ function Ht(t) { var e, n; return "server_timestamp" === (null === (n = ((null === (e = null == t ? void 0 : t.mapValue) || void 0 === e ? void 0 : e.fields) || {}).__type__) || void 0 === n ? void 0 : n.stringValue); } /** * Creates a new ServerTimestamp proto value (using the internal format). */ /** * Returns the value of the field before this ServerTimestamp was set. * * Preserving the previous values allows the user to display the last resoled * value until the backend responds with the timestamp. */ function Yt(t) { var e = t.mapValue.fields.__previous_value__; return Ht(e) ? Yt(e) : e; } /** * Returns the local time at which this timestamp was first set. */ function $t(t) { var e = oe(t.mapValue.fields.__local_write_time__.timestampValue); return new ot(e.seconds, e.nanos); } /** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // A RegExp matching ISO 8601 UTC timestamps with optional fraction. var Xt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/); /** Extracts the backend's type order for the provided value. */ function Jt(t) { return "nullValue" in t ? 0 /* NullValue */ : "booleanValue" in t ? 1 /* BooleanValue */ : "integerValue" in t || "doubleValue" in t ? 2 /* NumberValue */ : "timestampValue" in t ? 3 /* TimestampValue */ : "stringValue" in t ? 5 /* StringValue */ : "bytesValue" in t ? 6 /* BlobValue */ : "referenceValue" in t ? 7 /* RefValue */ : "geoPointValue" in t ? 8 /* GeoPointValue */ : "arrayValue" in t ? 9 /* ArrayValue */ : "mapValue" in t ? Ht(t) ? 4 /* ServerTimestampValue */ : 10 /* ObjectValue */ : y(); } /** Tests `left` and `right` for equality based on the backend semantics. */ function Zt(t, e) { var n = Jt(t); if (n !== Jt(e)) return !1; switch (n) { case 0 /* NullValue */ : return !0; case 1 /* BooleanValue */ : return t.booleanValue === e.booleanValue; case 4 /* ServerTimestampValue */ : return $t(t).isEqual($t(e)); case 3 /* TimestampValue */ : return function(t, e) { if ("string" == typeof t.timestampValue && "string" == typeof e.timestampValue && t.timestampValue.length === e.timestampValue.length) // Use string equality for ISO 8601 timestamps return t.timestampValue === e.timestampValue; var n = oe(t.timestampValue), r = oe(e.timestampValue); return n.seconds === r.seconds && n.nanos === r.nanos; }(t, e); case 5 /* StringValue */ : return t.stringValue === e.stringValue; case 6 /* BlobValue */ : return function(t, e) { return ue(t.bytesValue).isEqual(ue(e.bytesValue)); }(t, e); case 7 /* RefValue */ : return t.referenceValue === e.referenceValue; case 8 /* GeoPointValue */ : return function(t, e) { return se(t.geoPointValue.latitude) === se(e.geoPointValue.latitude) && se(t.geoPointValue.longitude) === se(e.geoPointValue.longitude); }(t, e); case 2 /* NumberValue */ : return function(t, e) { if ("integerValue" in t && "integerValue" in e) return se(t.integerValue) === se(e.integerValue); if ("doubleValue" in t && "doubleValue" in e) { var n = se(t.doubleValue), r = se(e.doubleValue); return n === r ? at(n) === at(r) : isNaN(n) && isNaN(r); } return !1; }(t, e); case 9 /* ArrayValue */ : return Y(t.arrayValue.values || [], e.arrayValue.values || [], Zt); case 10 /* ObjectValue */ : return function(t, e) { var n = t.mapValue.fields || {}, r = e.mapValue.fields || {}; if (w(n) !== w(r)) return !1; for (var i in n) if (n.hasOwnProperty(i) && (void 0 === r[i] || !Zt(n[i], r[i]))) return !1; return !0; }(t, e); default: return y(); } } function te(t, e) { return void 0 !== (t.values || []).find((function(t) { return Zt(t, e); })); } function ee(t, e) { var n = Jt(t), r = Jt(e); if (n !== r) return H(n, r); switch (n) { case 0 /* NullValue */ : return 0; case 1 /* BooleanValue */ : return H(t.booleanValue, e.booleanValue); case 2 /* NumberValue */ : return function(t, e) { var n = se(t.integerValue || t.doubleValue), r = se(e.integerValue || e.doubleValue); return n < r ? -1 : n > r ? 1 : n === r ? 0 : // one or both are NaN. isNaN(n) ? isNaN(r) ? 0 : -1 : 1; }(t, e); case 3 /* TimestampValue */ : return ne(t.timestampValue, e.timestampValue); case 4 /* ServerTimestampValue */ : return ne($t(t), $t(e)); case 5 /* StringValue */ : return H(t.stringValue, e.stringValue); case 6 /* BlobValue */ : return function(t, e) { var n = ue(t), r = ue(e); return n.L(r); }(t.bytesValue, e.bytesValue); case 7 /* RefValue */ : return function(t, e) { for (var n = t.split("/"), r = e.split("/"), i = 0; i < n.length && i < r.length; i++) { var o = H(n[i], r[i]); if (0 !== o) return o; } return H(n.length, r.length); }(t.referenceValue, e.referenceValue); case 8 /* GeoPointValue */ : return function(t, e) { var n = H(se(t.latitude), se(e.latitude)); return 0 !== n ? n : H(se(t.longitude), se(e.longitude)); }(t.geoPointValue, e.geoPointValue); case 9 /* ArrayValue */ : return function(t, e) { for (var n = t.values || [], r = e.values || [], i = 0; i < n.length && i < r.length; ++i) { var o = ee(n[i], r[i]); if (o) return o; } return H(n.length, r.length); }(t.arrayValue, e.arrayValue); case 10 /* ObjectValue */ : return function(t, e) { var n = t.fields || {}, r = Object.keys(n), i = e.fields || {}, o = Object.keys(i); // Even though MapValues are likely sorted correctly based on their insertion // order (e.g. when received from the backend), local modifications can bring // elements out of order. We need to re-sort the elements to ensure that // canonical IDs are independent of insertion order. r.sort(), o.sort(); for (var s = 0; s < r.length && s < o.length; ++s) { var u = H(r[s], o[s]); if (0 !== u) return u; var a = ee(n[r[s]], i[o[s]]); if (0 !== a) return a; } return H(r.length, o.length); }(t.mapValue, e.mapValue); default: throw y(); } } function ne(t, e) { if ("string" == typeof t && "string" == typeof e && t.length === e.length) return H(t, e); var n = oe(t), r = oe(e), i = H(n.seconds, r.seconds); return 0 !== i ? i : H(n.nanos, r.nanos); } function re(t) { return ie(t); } function ie(t) { return "nullValue" in t ? "null" : "booleanValue" in t ? "" + t.booleanValue : "integerValue" in t ? "" + t.integerValue : "doubleValue" in t ? "" + t.doubleValue : "timestampValue" in t ? function(t) { var e = oe(t); return "time(" + e.seconds + "," + e.nanos + ")"; }(t.timestampValue) : "stringValue" in t ? t.stringValue : "bytesValue" in t ? ue(t.bytesValue).toBase64() : "referenceValue" in t ? (n = t.referenceValue, A.C(n).toString()) : "geoPointValue" in t ? "geo(" + (e = t.geoPointValue).latitude + "," + e.longitude + ")" : "arrayValue" in t ? function(t) { for (var e = "[", n = !0, r = 0, i = t.values || []; r < i.length; r++) { n ? n = !1 : e += ",", e += ie(i[r]); } return e + "]"; }(t.arrayValue) : "mapValue" in t ? function(t) { for ( // Iteration order in JavaScript is not guaranteed. To ensure that we generate // matching canonical IDs for identical maps, we need to sort the keys. var e = "{", n = !0, r = 0, i = Object.keys(t.fields || {}).sort(); r < i.length; r++) { var o = i[r]; n ? n = !1 : e += ",", e += o + ":" + ie(t.fields[o]); } return e + "}"; }(t.mapValue) : y(); var e, n; } function oe(t) { // The json interface (for the browser) will return an iso timestamp string, // while the proto js library (for node) will return a // google.protobuf.Timestamp instance. if (g(!!t), "string" == typeof t) { // The date string can have higher precision (nanos) than the Date class // (millis), so we do some custom parsing here. // Parse the nanos right out of the string. var e = 0, n = Xt.exec(t); if (g(!!n), n[1]) { // Pad the fraction out to 9 digits (nanos). var r = n[1]; r = (r + "000000000").substr(0, 9), e = Number(r); } // Parse the date to get the seconds. var i = new Date(t); return { seconds: Math.floor(i.getTime() / 1e3), nanos: e }; } return { seconds: se(t.seconds), nanos: se(t.nanos) }; } /** * Converts the possible Proto types for numbers into a JavaScript number. * Returns 0 if the value is not numeric. */ function se(t) { // TODO(bjornick): Handle int64 greater than 53 bits. return "number" == typeof t ? t : "string" == typeof t ? Number(t) : 0; } /** Converts the possible Proto types for Blobs into a ByteString. */ function ue(t) { return "string" == typeof t ? X.fromBase64String(t) : X.fromUint8Array(t); } /** Returns a reference value for the provided database and key. */ function ae(t, e) { return { referenceValue: "projects/" + t.projectId + "/databases/" + t.database + "/documents/" + e.path.R() }; } /** Returns true if `value` is an IntegerValue . */ function ce(t) { return !!t && "integerValue" in t; } /** Returns true if `value` is a DoubleValue. */ /** Returns true if `value` is an ArrayValue. */ function he(t) { return !!t && "arrayValue" in t; } /** Returns true if `value` is a NullValue. */ function fe(t) { return !!t && "nullValue" in t; } /** Returns true if `value` is NaN. */ function le(t) { return !!t && "doubleValue" in t && isNaN(Number(t.doubleValue)); } /** Returns true if `value` is a MapValue. */ function pe(t) { return !!t && "mapValue" in t; } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var de = { asc: "ASCENDING", desc: "DESCENDING" }, ve = { "<": "LESS_THAN", "<=": "LESS_THAN_OR_EQUAL", ">": "GREATER_THAN", ">=": "GREATER_THAN_OR_EQUAL", "==": "EQUAL", "!=": "NOT_EQUAL", "array-contains": "ARRAY_CONTAINS", in: "IN", "not-in": "NOT_IN", "array-contains-any": "ARRAY_CONTAINS_ANY" }, ye = function(t, e) { this.U = t, this.Qe = e; }; /** * This class generates JsonObject values for the Datastore API suitable for * sending to either GRPC stub methods or via the JSON/HTTP REST API. * * The serializer supports both Protobuf.js and Proto3 JSON formats. By * setting `useProto3Json` to true, the serializer will use the Proto3 JSON * format. * * For a description of the Proto3 JSON format check * https://developers.google.com/protocol-buffers/docs/proto3#json * * TODO(klimt): We can remove the databaseId argument if we keep the full * resource name in documents. */ /** * Returns an IntegerValue for `value`. */ function ge(t) { return { integerValue: "" + t }; } /** * Returns an DoubleValue for `value` that is encoded based the serializer's * `useProto3Json` setting. */ function me(t, e) { if (t.Qe) { if (isNaN(e)) return { doubleValue: "NaN" }; if (e === 1 / 0) return { doubleValue: "Infinity" }; if (e === -1 / 0) return { doubleValue: "-Infinity" }; } return { doubleValue: at(e) ? "-0" : e }; } /** * Returns a value for a number that's appropriate to put into a proto. * The return value is an IntegerValue if it can safely represent the value, * otherwise a DoubleValue is returned. */ function we(t, e) { return ct(e) ? ge(e) : me(t, e); } /** * Returns a value for a Date that's appropriate to put into a proto. */ function _e(t, e) { return t.Qe ? new Date(1e3 * e.seconds).toISOString().replace(/\.\d*/, "").replace("Z", "") + "." + ("000000000" + e.nanoseconds).slice(-9) + "Z" : { seconds: "" + e.seconds, nanos: e.nanoseconds }; } /** * Returns a value for bytes that's appropriate to put in a proto. * * Visible for testing. */ function be(t, e) { return t.Qe ? e.toBase64() : e.toUint8Array(); } /** * Returns a ByteString based on the proto string value. */ function Ie(t, e) { return _e(t, e.Z()); } function Ee(t) { return g(!!t), st.J(function(t) { var e = oe(t); return new ot(e.seconds, e.nanos); }(t)); } function Te(t, e) { return function(t) { return new E([ "projects", t.projectId, "databases", t.database ]); }(t).child("documents").child(e).R(); } function Ne(t) { var e = E.g(t); return g(He(e)), e; } function Ae(t, e) { return Te(t.U, e.path); } function Se(t, e) { var n = Ne(e); return g(n.get(1) === t.U.projectId), g(!n.get(3) && !t.U.database || n.get(3) === t.U.database), new A(ke(n)); } function De(t, e) { return Te(t.U, e); } function xe(t) { var e = Ne(t); // In v1beta1 queries for collections at the root did not have a trailing // "/documents". In v1 all resource paths contain "/documents". Preserve the // ability to read the v1beta1 form for compatibility with queries persisted // in the local target cache. return 4 === e.length ? E.P() : ke(e); } function Le(t) { return new E([ "projects", t.U.projectId, "databases", t.U.database ]).R(); } function ke(t) { return g(t.length > 4 && "documents" === t.get(4)), t.u(5) /** Creates a Document proto from key and fields (but no create/update time) */; } function Re(t, e, n) { return { name: Ae(t, e), fields: n.proto.mapValue.fields }; } function Oe(t, e) { var n; if (e instanceof wn) n = { update: Re(t, e.key, e.value) }; else if (e instanceof Nn) n = { delete: Ae(t, e.key) }; else if (e instanceof _n) n = { update: Re(t, e.key, e.data), updateMask: Qe(e.We) }; else if (e instanceof In) n = { transform: { document: Ae(t, e.key), fieldTransforms: e.fieldTransforms.map((function(t) { return function(t, e) { var n = e.transform; if (n instanceof Ze) return { fieldPath: e.field.R(), setToServerValue: "REQUEST_TIME" }; if (n instanceof tn) return { fieldPath: e.field.R(), appendMissingElements: { values: n.elements } }; if (n instanceof nn) return { fieldPath: e.field.R(), removeAllFromArray: { values: n.elements } }; if (n instanceof on) return { fieldPath: e.field.R(), increment: n.je }; throw y(); }(0, t); })) } }; else { if (!(e instanceof An)) return y(); n = { verify: Ae(t, e.key) }; } return e.Ge.Ke || (n.currentDocument = function(t, e) { return void 0 !== e.updateTime ? { updateTime: Ie(t, e.updateTime) } : void 0 !== e.exists ? { exists: e.exists } : y(); }(t, e.Ge)), n; } function Pe(t, e) { var n = e.currentDocument ? function(t) { return void 0 !== t.updateTime ? fn.updateTime(Ee(t.updateTime)) : void 0 !== t.exists ? fn.exists(t.exists) : fn.ze(); }(e.currentDocument) : fn.ze(); if (e.update) { e.update.name; var r = Se(t, e.update.name), i = new Sn({ mapValue: { fields: e.update.fields } }); if (e.updateMask) { var o = function(t) { var e = t.fieldPaths || []; return new an(e.map((function(t) { return N.S(t); }))); }(e.updateMask); return new _n(r, i, o, n); } return new wn(r, i, n); } if (e.delete) { var s = Se(t, e.delete); return new Nn(s, n); } if (e.transform) { var u = Se(t, e.transform.document), a = e.transform.fieldTransforms.map((function(e) { return function(t, e) { var n = null; if ("setToServerValue" in e) g("REQUEST_TIME" === e.setToServerValue), n = new Ze; else if ("appendMissingElements" in e) { var r = e.appendMissingElements.values || []; n = new tn(r); } else if ("removeAllFromArray" in e) { var i = e.removeAllFromArray.values || []; n = new nn(i); } else "increment" in e ? n = new on(t, e.increment) : y(); var o = N.S(e.fieldPath); return new cn(o, n); }(t, e); })); return g(!0 === n.exists), new In(u, a); } if (e.verify) { var c = Se(t, e.verify); return new An(c, n); } return y(); } function Ve(t, e) { return { documents: [ De(t, e.path) ] }; } function Ue(t, e) { // Dissect the path into parent, collectionId, and optional key filter. var n = { structuredQuery: {} }, r = e.path; null !== e.collectionGroup ? (n.parent = De(t, r), n.structuredQuery.from = [ { collectionId: e.collectionGroup, allDescendants: !0 } ]) : (n.parent = De(t, r.h()), n.structuredQuery.from = [ { collectionId: r._() } ]); var i = function(t) { if (0 !== t.length) { var e = t.map((function(t) { // visible for testing return function(t) { if ("==" /* EQUAL */ === t.op) { if (le(t.value)) return { unaryFilter: { field: ze(t.field), op: "IS_NAN" } }; if (fe(t.value)) return { unaryFilter: { field: ze(t.field), op: "IS_NULL" } }; } else if ("!=" /* NOT_EQUAL */ === t.op) { if (le(t.value)) return { unaryFilter: { field: ze(t.field), op: "IS_NOT_NAN" } }; if (fe(t.value)) return { unaryFilter: { field: ze(t.field), op: "IS_NOT_NULL" } }; } return { fieldFilter: { field: ze(t.field), op: Ge(t.op), value: t.value } }; }(t); })); return 1 === e.length ? e[0] : { compositeFilter: { op: "AND", filters: e } }; } }(e.filters); i && (n.structuredQuery.where = i); var o = function(t) { if (0 !== t.length) return t.map((function(t) { // visible for testing return function(t) { return { field: ze(t.field), direction: je(t.dir) }; }(t); })); }(e.orderBy); o && (n.structuredQuery.orderBy = o); var s = function(t, e) { return t.Qe || ut(e) ? e : { value: e }; }(t, e.limit); return null !== s && (n.structuredQuery.limit = s), e.startAt && (n.structuredQuery.startAt = Me(e.startAt)), e.endAt && (n.structuredQuery.endAt = Me(e.endAt)), n; } function Ce(t) { var e = xe(t.parent), n = t.structuredQuery, r = n.from ? n.from.length : 0, i = null; if (r > 0) { g(1 === r); var o = n.from[0]; o.allDescendants ? i = o.collectionId : e = e.child(o.collectionId); } var s = []; n.where && (s = Fe(n.where)); var u = []; n.orderBy && (u = n.orderBy.map((function(t) { return function(t) { return new fr(Be(t.field), // visible for testing function(t) { switch (t) { case "ASCENDING": return "asc" /* ASCENDING */; case "DESCENDING": return "desc" /* DESCENDING */; default: return; } }(t.direction)); }(t); }))); var a = null; n.limit && (a = function(t) { var e; return ut(e = "object" == typeof t ? t.value : t) ? null : e; }(n.limit)); var c = null; n.startAt && (c = qe(n.startAt)); var h = null; return n.endAt && (h = qe(n.endAt)), zn(Vn(e, i, u, s, a, "F" /* First */ , c, h)); } function Fe(t) { return t ? void 0 !== t.unaryFilter ? [ Ke(t) ] : void 0 !== t.fieldFilter ? [ We(t) ] : void 0 !== t.compositeFilter ? t.compositeFilter.filters.map((function(t) { return Fe(t); })).reduce((function(t, e) { return t.concat(e); })) : y() : []; } function Me(t) { return { before: t.before, values: t.position }; } function qe(t) { var e = !!t.before, n = t.values || []; return new ur(n, e); } // visible for testing function je(t) { return de[t]; } function Ge(t) { return ve[t]; } function ze(t) { return { fieldPath: t.R() }; } function Be(t) { return N.S(t.fieldPath); } function We(t) { return Jn.create(Be(t.fieldFilter.field), function(t) { switch (t) { case "EQUAL": return "==" /* EQUAL */; case "NOT_EQUAL": return "!=" /* NOT_EQUAL */; case "GREATER_THAN": return ">" /* GREATER_THAN */; case "GREATER_THAN_OR_EQUAL": return ">=" /* GREATER_THAN_OR_EQUAL */; case "LESS_THAN": return "<" /* LESS_THAN */; case "LESS_THAN_OR_EQUAL": return "<=" /* LESS_THAN_OR_EQUAL */; case "ARRAY_CONTAINS": return "array-contains" /* ARRAY_CONTAINS */; case "IN": return "in" /* IN */; case "NOT_IN": return "not-in" /* NOT_IN */; case "ARRAY_CONTAINS_ANY": return "array-contains-any" /* ARRAY_CONTAINS_ANY */; case "OPERATOR_UNSPECIFIED": default: return y(); } }(t.fieldFilter.op), t.fieldFilter.value); } function Ke(t) { switch (t.unaryFilter.op) { case "IS_NAN": var e = Be(t.unaryFilter.field); return Jn.create(e, "==" /* EQUAL */ , { doubleValue: NaN }); case "IS_NULL": var n = Be(t.unaryFilter.field); return Jn.create(n, "==" /* EQUAL */ , { nullValue: "NULL_VALUE" }); case "IS_NOT_NAN": var r = Be(t.unaryFilter.field); return Jn.create(r, "!=" /* NOT_EQUAL */ , { doubleValue: NaN }); case "IS_NOT_NULL": var i = Be(t.unaryFilter.field); return Jn.create(i, "!=" /* NOT_EQUAL */ , { nullValue: "NULL_VALUE" }); case "OPERATOR_UNSPECIFIED": default: return y(); } } function Qe(t) { var e = []; return t.fields.forEach((function(t) { return e.push(t.R()); })), { fieldPaths: e }; } function He(t) { // Resource names have at least 4 components (project ID, database ID) return t.length >= 4 && "projects" === t.get(0) && "databases" === t.get(2); } /** * @license * Copyright 2018 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** Represents a transform within a TransformMutation. */ var Ye = function() { // Make sure that the structural type of `TransformOperation` is unique. // See https://github.com/microsoft/TypeScript/issues/5451 this.He = void 0; }; /** * Computes the local transform result against the provided `previousValue`, * optionally using the provided localWriteTime. */ function $e(t, e, n) { return t instanceof Ze ? function(t, e) { var n = { fields: { __type__: { stringValue: "server_timestamp" }, __local_write_time__: { timestampValue: { seconds: t.seconds, nanos: t.nanoseconds } } } }; return e && (n.fields.__previous_value__ = e), { mapValue: n }; }(n, e) : t instanceof tn ? en(t, e) : t instanceof nn ? rn(t, e) : function(t, e) { // PORTING NOTE: Since JavaScript's integer arithmetic is limited to 53 bit // precision and resolves overflows by reducing precision, we do not // manually cap overflows at 2^63. var n = Je(t, e), r = sn(n) + sn(t.je); return ce(n) && ce(t.je) ? ge(r) : me(t.serializer, r); }(t, e); } /** * Computes a final transform result after the transform has been acknowledged * by the server, potentially using the server-provided transformResult. */ function Xe(t, e, n) { // The server just sends null as the transform result for array operations, // so we have to calculate a result the same as we do for local // applications. return t instanceof tn ? en(t, e) : t instanceof nn ? rn(t, e) : n; } /** * If this transform operation is not idempotent, returns the base value to * persist for this transform. If a base value is returned, the transform * operation is always applied to this base value, even if document has * already been updated. * * Base values provide consistent behavior for non-idempotent transforms and * allow us to return the same latency-compensated value even if the backend * has already applied the transform operation. The base value is null for * idempotent transforms, as they can be re-played even if the backend has * already applied them. * * @return a base value to store along with the mutation, or null for * idempotent transforms. */ function Je(t, e) { return t instanceof on ? ce(n = e) || function(t) { return !!t && "doubleValue" in t; }(n) ? e : { integerValue: 0 } : null; var n; } /** Transforms a value into a server-generated timestamp. */ var Ze = /** @class */ function(e) { function n() { return null !== e && e.apply(this, arguments) || this; } return t.__extends(n, e), n; }(Ye), tn = /** @class */ function(e) { function n(t) { var n = this; return (n = e.call(this) || this).elements = t, n; } return t.__extends(n, e), n; }(Ye); /** Transforms an array value via a union operation. */ function en(t, e) { for (var n = un(e), r = function(t) { n.some((function(e) { return Zt(e, t); })) || n.push(t); }, i = 0, o = t.elements; i < o.length; i++) { r(o[i]); } return { arrayValue: { values: n } }; } /** Transforms an array value via a remove operation. */ var nn = /** @class */ function(e) { function n(t) { var n = this; return (n = e.call(this) || this).elements = t, n; } return t.__extends(n, e), n; }(Ye); function rn(t, e) { for (var n = un(e), r = function(t) { n = n.filter((function(e) { return !Zt(e, t); })); }, i = 0, o = t.elements; i < o.length; i++) { r(o[i]); } return { arrayValue: { values: n } }; } /** * Implements the backend semantics for locally computed NUMERIC_ADD (increment) * transforms. Converts all field values to integers or doubles, but unlike the * backend does not cap integer values at 2^63. Instead, JavaScript number * arithmetic is used and precision loss can occur for values greater than 2^53. */ var on = /** @class */ function(e) { function n(t, n) { var r = this; return (r = e.call(this) || this).serializer = t, r.je = n, r; } return t.__extends(n, e), n; }(Ye); function sn(t) { return se(t.integerValue || t.doubleValue); } function un(t) { return he(t) && t.arrayValue.values ? t.arrayValue.values.slice() : []; } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Provides a set of fields that can be used to partially patch a document. * FieldMask is used in conjunction with ObjectValue. * Examples: * foo - Overwrites foo entirely with the provided value. If foo is not * present in the companion ObjectValue, the field is deleted. * foo.bar - Overwrites only the field bar of the object foo. * If foo is not an object, foo is replaced with an object * containing foo */ var an = /** @class */ function() { function t(t) { this.fields = t, // TODO(dimond): validation of FieldMask // Sort the field mask to support `FieldMask.isEqual()` and assert below. t.sort(N.i) /** * Verifies that `fieldPath` is included by at least one field in this field * mask. * * This is an O(n) operation, where `n` is the size of the field mask. */; } return t.prototype.Ye = function(t) { for (var e = 0, n = this.fields; e < n.length; e++) { if (n[e].T(t)) return !0; } return !1; }, t.prototype.isEqual = function(t) { return Y(this.fields, t.fields, (function(t, e) { return t.isEqual(e); })); }, t; }(), cn = function(t, e) { this.field = t, this.transform = e; }; /** A field path and the TransformOperation to perform upon it. */ /** The result of successfully applying a mutation to the backend. */ var hn = function( /** * The version at which the mutation was committed: * * - For most operations, this is the updateTime in the WriteResult. * - For deletes, the commitTime of the WriteResponse (because deletes are * not stored and have no updateTime). * * Note that these versions can be different: No-op writes will not change * the updateTime even though the commitTime advances. */ t, /** * The resulting fields returned from the backend after a * TransformMutation has been committed. Contains one FieldValue for each * FieldTransform that was in the mutation. * * Will be null if the mutation was not a TransformMutation. */ e) { this.version = t, this.transformResults = e; }, fn = /** @class */ function() { function t(t, e) { this.updateTime = t, this.exists = e /** Creates a new empty Precondition. */; } return t.ze = function() { return new t; }, /** Creates a new Precondition with an exists flag. */ t.exists = function(e) { return new t(void 0, e); }, /** Creates a new Precondition based on a version a document exists at. */ t.updateTime = function(e) { return new t(e); }, Object.defineProperty(t.prototype, "Ke", { /** Returns whether this Precondition is empty. */ get: function() { return void 0 === this.updateTime && void 0 === this.exists; }, enumerable: !1, configurable: !0 }), t.prototype.isEqual = function(t) { return this.exists === t.exists && (this.updateTime ? !!t.updateTime && this.updateTime.isEqual(t.updateTime) : !t.updateTime); }, t; }(); /** * Encodes a precondition for a mutation. This follows the model that the * backend accepts with the special case of an explicit "empty" precondition * (meaning no precondition). */ /** * Returns true if the preconditions is valid for the given document * (or null if no document is available). */ function ln(t, e) { return void 0 !== t.updateTime ? e instanceof kn && e.version.isEqual(t.updateTime) : void 0 === t.exists || t.exists === e instanceof kn; } /** * A mutation describes a self-contained change to a document. Mutations can * create, replace, delete, and update subsets of documents. * * Mutations not only act on the value of the document but also its version. * * For local mutations (mutations that haven't been committed yet), we preserve * the existing version for Set, Patch, and Transform mutations. For Delete * mutations, we reset the version to 0. * * Here's the expected transition table. * * MUTATION APPLIED TO RESULTS IN * * SetMutation Document(v3) Document(v3) * SetMutation NoDocument(v3) Document(v0) * SetMutation null Document(v0) * PatchMutation Document(v3) Document(v3) * PatchMutation NoDocument(v3) NoDocument(v3) * PatchMutation null null * TransformMutation Document(v3) Document(v3) * TransformMutation NoDocument(v3) NoDocument(v3) * TransformMutation null null * DeleteMutation Document(v3) NoDocument(v0) * DeleteMutation NoDocument(v3) NoDocument(v0) * DeleteMutation null NoDocument(v0) * * For acknowledged mutations, we use the updateTime of the WriteResponse as * the resulting version for Set, Patch, and Transform mutations. As deletes * have no explicit update time, we use the commitTime of the WriteResponse for * Delete mutations. * * If a mutation is acknowledged by the backend but fails the precondition check * locally, we return an `UnknownDocument` and rely on Watch to send us the * updated version. * * Note that TransformMutations don't create Documents (in the case of being * applied to a NoDocument), even though they would on the backend. This is * because the client always combines the TransformMutation with a SetMutation * or PatchMutation and we only want to apply the transform if the prior * mutation resulted in a Document (always true for a SetMutation, but not * necessarily for a PatchMutation). * * ## Subclassing Notes * * Subclasses of Mutation need to implement applyToRemoteDocument() and * applyToLocalView() to implement the actual behavior of applying the mutation * to some source document. */ var pn = function() {}; /** * Applies this mutation to the given MaybeDocument or null for the purposes * of computing a new remote document. If the input document doesn't match the * expected state (e.g. it is null or outdated), an `UnknownDocument` can be * returned. * * @param mutation The mutation to apply. * @param maybeDoc The document to mutate. The input document can be null if * the client has no knowledge of the pre-mutation state of the document. * @param mutationResult The result of applying the mutation from the backend. * @return The mutated document. The returned document may be an * UnknownDocument if the mutation could not be applied to the locally * cached base document. */ function dn(t, e, n) { return t instanceof wn ? function(t, e, n) { // Unlike applySetMutationToLocalView, if we're applying a mutation to a // remote document the server has accepted the mutation so the precondition // must have held. return new kn(t.key, n.version, t.value, { hasCommittedMutations: !0 }); }(t, 0, n) : t instanceof _n ? function(t, e, n) { if (!ln(t.Ge, e)) // Since the mutation was not rejected, we know that the precondition // matched on the backend. We therefore must not have the expected version // of the document in our cache and return an UnknownDocument with the // known updateTime. return new On(t.key, n.version); var r = bn(t, e); return new kn(t.key, n.version, r, { hasCommittedMutations: !0 }); }(t, e, n) : t instanceof In ? function(t, e, n) { if (g(null != n.transformResults), !ln(t.Ge, e)) // Since the mutation was not rejected, we know that the precondition // matched on the backend. We therefore must not have the expected version // of the document in our cache and return an UnknownDocument with the // known updateTime. return new On(t.key, n.version); var r = En(t, e), i = /** * Creates a list of "transform results" (a transform result is a field value * representing the result of applying a transform) for use after a * TransformMutation has been acknowledged by the server. * * @param fieldTransforms The field transforms to apply the result to. * @param baseDoc The document prior to applying this mutation batch. * @param serverTransformResults The transform results received by the server. * @return The transform results list. */ function(t, e, n) { var r = []; g(t.length === n.length); for (var i = 0; i < n.length; i++) { var o = t[i], s = o.transform, u = null; e instanceof kn && (u = e.field(o.field)), r.push(Xe(s, u, n[i])); } return r; }(t.fieldTransforms, e, n.transformResults), o = n.version, s = Tn(t, r.data(), i); return new kn(t.key, o, s, { hasCommittedMutations: !0 }); }(t, e, n) : function(t, e, n) { // Unlike applyToLocalView, if we're applying a mutation to a remote // document the server has accepted the mutation so the precondition must // have held. return new Rn(t.key, n.version, { hasCommittedMutations: !0 }); }(t, 0, n); } /** * Applies this mutation to the given MaybeDocument or null for the purposes * of computing the new local view of a document. Both the input and returned * documents can be null. * * @param mutation The mutation to apply. * @param maybeDoc The document to mutate. The input document can be null if * the client has no knowledge of the pre-mutation state of the document. * @param baseDoc The state of the document prior to this mutation batch. The * input document can be null if the client has no knowledge of the * pre-mutation state of the document. * @param localWriteTime A timestamp indicating the local write time of the * batch this mutation is a part of. * @return The mutated document. The returned document may be null, but only * if maybeDoc was null and the mutation would not create a new document. */ function vn(t, e, n, r) { return t instanceof wn ? function(t, e) { if (!ln(t.Ge, e)) return e; var n = mn(e); return new kn(t.key, n, t.value, { Je: !0 }); }(t, e) : t instanceof _n ? function(t, e) { if (!ln(t.Ge, e)) return e; var n = mn(e), r = bn(t, e); return new kn(t.key, n, r, { Je: !0 }); }(t, e) : t instanceof In ? function(t, e, n, r) { if (!ln(t.Ge, e)) return e; var i = En(t, e), o = function(t, e, n, r) { for (var i = [], o = 0, s = t; o < s.length; o++) { var u = s[o], a = u.transform, c = null; n instanceof kn && (c = n.field(u.field)), null === c && r instanceof kn && ( // If the current document does not contain a value for the mutated // field, use the value that existed before applying this mutation // batch. This solves an edge case where a PatchMutation clears the // values in a nested map before the TransformMutation is applied. c = r.field(u.field)), i.push($e(a, c, e)); } return i; }(t.fieldTransforms, n, e, r), s = Tn(t, i.data(), o); return new kn(t.key, i.version, s, { Je: !0 }); }(t, e, r, n) : function(t, e) { return ln(t.Ge, e) ? new Rn(t.key, st.min()) : e; }(t, e); } /** * If this mutation is not idempotent, returns the base value to persist with * this mutation. If a base value is returned, the mutation is always applied * to this base value, even if document has already been updated. * * The base value is a sparse object that consists of only the document * fields for which this mutation contains a non-idempotent transformation * (e.g. a numeric increment). The provided value guarantees consistent * behavior for non-idempotent transforms and allow us to return the same * latency-compensated value even if the backend has already applied the * mutation. The base value is null for idempotent mutations, as they can be * re-played even if the backend has already applied them. * * @return a base value to store along with the mutation, or null for * idempotent mutations. */ function yn(t, e) { return t instanceof In ? function(t, e) { for (var n = null, r = 0, i = t.fieldTransforms; r < i.length; r++) { var o = i[r], s = e instanceof kn ? e.field(o.field) : void 0, u = Je(o.transform, s || null); null != u && (n = null == n ? (new Dn).set(o.field, u) : n.set(o.field, u)); } return n ? n.Xe() : null; }(t, e) : null; } function gn(t, e) { return t.type === e.type && !!t.key.isEqual(e.key) && !!t.Ge.isEqual(e.Ge) && (0 /* Set */ === t.type ? t.value.isEqual(e.value) : 1 /* Patch */ === t.type ? t.data.isEqual(e.data) && t.We.isEqual(e.We) : 2 /* Transform */ !== t.type || Y(t.fieldTransforms, t.fieldTransforms, (function(t, e) { return function(t, e) { return t.field.isEqual(e.field) && function(t, e) { return t instanceof tn && e instanceof tn || t instanceof nn && e instanceof nn ? Y(t.elements, e.elements, Zt) : t instanceof on && e instanceof on ? Zt(t.je, e.je) : t instanceof Ze && e instanceof Ze; }(t.transform, e.transform); }(t, e); }))); } /** * Returns the version from the given document for use as the result of a * mutation. Mutations are defined to return the version of the base document * only if it is an existing document. Deleted and unknown documents have a * post-mutation version of SnapshotVersion.min(). */ function mn(t) { return t instanceof kn ? t.version : st.min(); } /** * A mutation that creates or replaces the document at the given key with the * object value contents. */ var wn = /** @class */ function(e) { function n(t, n, r) { var i = this; return (i = e.call(this) || this).key = t, i.value = n, i.Ge = r, i.type = 0 /* Set */ , i; } return t.__extends(n, e), n; }(pn), _n = /** @class */ function(e) { function n(t, n, r, i) { var o = this; return (o = e.call(this) || this).key = t, o.data = n, o.We = r, o.Ge = i, o.type = 1 /* Patch */ , o; } return t.__extends(n, e), n; }(pn); function bn(t, e) { return function(t, e) { var n = new Dn(e); return t.We.fields.forEach((function(e) { if (!e.m()) { var r = t.data.field(e); null !== r ? n.set(e, r) : n.delete(e); } })), n.Xe(); }(t, e instanceof kn ? e.data() : Sn.empty()); } var In = /** @class */ function(e) { function n(t, n) { var r = this; return (r = e.call(this) || this).key = t, r.fieldTransforms = n, r.type = 2 /* Transform */ , // NOTE: We set a precondition of exists: true as a safety-check, since we // always combine TransformMutations with a SetMutation or PatchMutation which // (if successful) should end up with an existing document. r.Ge = fn.exists(!0), r; } return t.__extends(n, e), n; }(pn); function En(t, e) { return e; } function Tn(t, e, n) { for (var r = new Dn(e), i = 0; i < t.fieldTransforms.length; i++) { var o = t.fieldTransforms[i]; r.set(o.field, n[i]); } return r.Xe(); } /** A mutation that deletes the document at the given key. */ var Nn = /** @class */ function(e) { function n(t, n) { var r = this; return (r = e.call(this) || this).key = t, r.Ge = n, r.type = 3 /* Delete */ , r; } return t.__extends(n, e), n; }(pn), An = /** @class */ function(e) { function n(t, n) { var r = this; return (r = e.call(this) || this).key = t, r.Ge = n, r.type = 4 /* Verify */ , r; } return t.__extends(n, e), n; }(pn), Sn = /** @class */ function() { function t(t) { this.proto = t; } return t.empty = function() { return new t({ mapValue: {} }); }, /** * Returns the value at the given path or null. * * @param path the path to search * @return The value at the path or if there it doesn't exist. */ t.prototype.field = function(t) { if (t.m()) return this.proto; for (var e = this.proto, n = 0; n < t.length - 1; ++n) { if (!e.mapValue.fields) return null; if (!pe(e = e.mapValue.fields[t.get(n)])) return null; } return (e = (e.mapValue.fields || {})[t._()]) || null; }, t.prototype.isEqual = function(t) { return Zt(this.proto, t.proto); }, t; }(), Dn = /** @class */ function() { /** * @param baseObject The object to mutate. */ function t(t) { void 0 === t && (t = Sn.empty()), this.Ze = t, /** A map that contains the accumulated changes in this builder. */ this.tn = new Map; } /** * Sets the field to the provided value. * * @param path The field path to set. * @param value The value to set. * @return The current Builder instance. */ return t.prototype.set = function(t, e) { return this.en(t, e), this; }, /** * Removes the field at the specified path. If there is no field at the * specified path, nothing is changed. * * @param path The field path to remove. * @return The current Builder instance. */ t.prototype.delete = function(t) { return this.en(t, null), this; }, /** * Adds `value` to the overlay map at `path`. Creates nested map entries if * needed. */ t.prototype.en = function(t, e) { for (var n = this.tn, r = 0; r < t.length - 1; ++r) { var i = t.get(r), o = n.get(i); o instanceof Map ? // Re-use a previously created map n = o : o && 10 /* ObjectValue */ === Jt(o) ? ( // Convert the existing Protobuf MapValue into a map o = new Map(Object.entries(o.mapValue.fields || {})), n.set(i, o), n = o) : ( // Create an empty map to represent the current nesting level o = new Map, n.set(i, o), n = o); } n.set(t._(), e); }, /** Returns an ObjectValue with all mutations applied. */ t.prototype.Xe = function() { var t = this.nn(N.P(), this.tn); return null != t ? new Sn(t) : this.Ze; }, /** * Applies any overlays from `currentOverlays` that exist at `currentPath` * and returns the merged data at `currentPath` (or null if there were no * changes). * * @param currentPath The path at the current nesting level. Can be set to * FieldValue.emptyPath() to represent the root. * @param currentOverlays The overlays at the current nesting level in the * same format as `overlayMap`. * @return The merged data at `currentPath` or null if no modifications * were applied. */ t.prototype.nn = function(t, e) { var n = this, r = !1, i = this.Ze.field(t), o = pe(i) ? // If there is already data at the current path, base our Object.assign({}, i.mapValue.fields) : {}; return e.forEach((function(e, i) { if (e instanceof Map) { var s = n.nn(t.child(i), e); null != s && (o[i] = s, r = !0); } else null !== e ? (o[i] = e, r = !0) : o.hasOwnProperty(i) && (delete o[i], r = !0); })), r ? { mapValue: { fields: o } } : null; }, t; }(); /** * Returns a FieldMask built from all fields in a MapValue. */ function xn(t) { var e = []; return _(t.fields || {}, (function(t, n) { var r = new N([ t ]); if (pe(n)) { var i = xn(n.mapValue).fields; if (0 === i.length) // Preserve the empty map by adding it to the FieldMask. e.push(r); else // For nested and non-empty ObjectValues, add the FieldPath of the // leaf nodes. for (var o = 0, s = i; o < s.length; o++) { var u = s[o]; e.push(r.child(u)); } } else // For nested and non-empty ObjectValues, add the FieldPath of the leaf // nodes. e.push(r); })), new an(e) /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * The result of a lookup for a given path may be an existing document or a * marker that this document does not exist at a given version. */; } var Ln = function(t, e) { this.key = t, this.version = e; }, kn = /** @class */ function(e) { function n(t, n, r, i) { var o = this; return (o = e.call(this, t, n) || this).sn = r, o.Je = !!i.Je, o.hasCommittedMutations = !!i.hasCommittedMutations, o; } return t.__extends(n, e), n.prototype.field = function(t) { return this.sn.field(t); }, n.prototype.data = function() { return this.sn; }, n.prototype.rn = function() { return this.sn.proto; }, n.prototype.isEqual = function(t) { return t instanceof n && this.key.isEqual(t.key) && this.version.isEqual(t.version) && this.Je === t.Je && this.hasCommittedMutations === t.hasCommittedMutations && this.sn.isEqual(t.sn); }, n.prototype.toString = function() { return "Document(" + this.key + ", " + this.version + ", " + this.sn.toString() + ", {hasLocalMutations: " + this.Je + "}), {hasCommittedMutations: " + this.hasCommittedMutations + "})"; }, Object.defineProperty(n.prototype, "hasPendingWrites", { get: function() { return this.Je || this.hasCommittedMutations; }, enumerable: !1, configurable: !0 }), n; }(Ln), Rn = /** @class */ function(e) { function n(t, n, r) { var i = this; return (i = e.call(this, t, n) || this).hasCommittedMutations = !(!r || !r.hasCommittedMutations), i; } return t.__extends(n, e), n.prototype.toString = function() { return "NoDocument(" + this.key + ", " + this.version + ")"; }, Object.defineProperty(n.prototype, "hasPendingWrites", { get: function() { return this.hasCommittedMutations; }, enumerable: !1, configurable: !0 }), n.prototype.isEqual = function(t) { return t instanceof n && t.hasCommittedMutations === this.hasCommittedMutations && t.version.isEqual(this.version) && t.key.isEqual(this.key); }, n; }(Ln), On = /** @class */ function(e) { function n() { return null !== e && e.apply(this, arguments) || this; } return t.__extends(n, e), n.prototype.toString = function() { return "UnknownDocument(" + this.key + ", " + this.version + ")"; }, Object.defineProperty(n.prototype, "hasPendingWrites", { get: function() { return !0; }, enumerable: !1, configurable: !0 }), n.prototype.isEqual = function(t) { return t instanceof n && t.version.isEqual(this.version) && t.key.isEqual(this.key); }, n; }(Ln), Pn = /** * Initializes a Query with a path and optional additional query constraints. * Path must currently be empty if this is a collection group query. */ function(t, e, n, r, i, o /* First */ , s, u) { void 0 === e && (e = null), void 0 === n && (n = []), void 0 === r && (r = []), void 0 === i && (i = null), void 0 === o && (o = "F"), void 0 === s && (s = null), void 0 === u && (u = null), this.path = t, this.collectionGroup = e, this.on = n, this.filters = r, this.limit = i, this.an = o, this.startAt = s, this.endAt = u, this.cn = null, // The corresponding `Target` of this `Query` instance. this.un = null, this.startAt, this.endAt; }; /** * Represents a document in Firestore with a key, version, data and whether the * data has local mutations applied to it. */ /** Creates a new Query instance with the options provided. */ function Vn(t, e, n, r, i, o, s, u) { return new Pn(t, e, n, r, i, o, s, u); } /** Creates a new Query for a query that matches all documents at `path` */ function Un(t) { return new Pn(t); } /** * Helper to convert a collection group query into a collection query at a * specific path. This is used when executing collection group queries, since * we have to split the query into a set of collection queries at multiple * paths. */ function Cn(t) { return !ut(t.limit) && "F" /* First */ === t.an; } function Fn(t) { return !ut(t.limit) && "L" /* Last */ === t.an; } function Mn(t) { return t.on.length > 0 ? t.on[0].field : null; } function qn(t) { for (var e = 0, n = t.filters; e < n.length; e++) { var r = n[e]; if (r.hn()) return r.field; } return null; } /** * Checks if any of the provided Operators are included in the query and * returns the first one that is, or null if none are. */ /** * Returns whether the query matches a collection group rather than a specific * collection. */ function jn(t) { return null !== t.collectionGroup; } /** * Returns the implicit order by constraint that is used to execute the Query, * which can be different from the order by constraints the user provided (e.g. * the SDK and backend always orders by `__name__`). */ function Gn(t) { var e = m(t); if (null === e.cn) { e.cn = []; var n = qn(e), r = Mn(e); if (null !== n && null === r) // In order to implicitly add key ordering, we must also add the // inequality filter field for it to be a valid query. // Note that the default inequality field and key ordering is ascending. n.p() || e.cn.push(new fr(n)), e.cn.push(new fr(N.v(), "asc" /* ASCENDING */)); else { for (var i = !1, o = 0, s = e.on; o < s.length; o++) { var u = s[o]; e.cn.push(u), u.field.p() && (i = !0); } if (!i) { // The order of the implicit key ordering always matches the last // explicit order by var a = e.on.length > 0 ? e.on[e.on.length - 1].dir : "asc" /* ASCENDING */; e.cn.push(new fr(N.v(), a)); } } } return e.cn; } /** * Converts this `Query` instance to it's corresponding `Target` representation. */ function zn(t) { var e = m(t); if (!e.un) if ("F" /* First */ === e.an) e.un = ft(e.path, e.collectionGroup, Gn(e), e.filters, e.limit, e.startAt, e.endAt); else { for ( // Flip the orderBy directions since we want the last results var n = [], r = 0, i = Gn(e); r < i.length; r++) { var o = i[r], s = "desc" /* DESCENDING */ === o.dir ? "asc" /* ASCENDING */ : "desc" /* DESCENDING */; n.push(new fr(o.field, s)); } // We need to swap the cursors to match the now-flipped query ordering. var u = e.endAt ? new ur(e.endAt.position, !e.endAt.before) : null, a = e.startAt ? new ur(e.startAt.position, !e.startAt.before) : null; // Now return as a LimitType.First query. e.un = ft(e.path, e.collectionGroup, n, e.filters, e.limit, u, a); } return e.un; } function Bn(t, e, n) { return new Pn(t.path, t.collectionGroup, t.on.slice(), t.filters.slice(), e, n, t.startAt, t.endAt); } function Wn(t, e) { return new Pn(t.path, t.collectionGroup, t.on.slice(), t.filters.slice(), t.limit, t.an, e, t.endAt); } function Kn(t, e) { return new Pn(t.path, t.collectionGroup, t.on.slice(), t.filters.slice(), t.limit, t.an, t.startAt, e); } function Qn(t, e) { return pt(zn(t), zn(e)) && t.an === e.an; } // TODO(b/29183165): This is used to get a unique string from a query to, for // example, use as a dictionary key, but the implementation is subject to // collisions. Make it collision-free. function Hn(t) { return lt(zn(t)) + "|lt:" + t.an; } function Yn(t) { return "Query(target=" + function(t) { var e = t.path.R(); return null !== t.collectionGroup && (e += " collectionGroup=" + t.collectionGroup), t.filters.length > 0 && (e += ", filters: [" + t.filters.map((function(t) { return (e = t).field.R() + " " + e.op + " " + re(e.value); /** Returns a debug description for `filter`. */ var e; /** Filter that matches on key fields (i.e. '__name__'). */ })).join(", ") + "]"), ut(t.limit) || (e += ", limit: " + t.limit), t.orderBy.length > 0 && (e += ", orderBy: [" + t.orderBy.map((function(t) { return (e = t).field.R() + " (" + e.dir + ")"; var e; })).join(", ") + "]"), t.startAt && (e += ", startAt: " + ar(t.startAt)), t.endAt && (e += ", endAt: " + ar(t.endAt)), "Target(" + e + ")"; }(zn(t)) + "; limitType=" + t.an + ")"; } /** Returns whether `doc` matches the constraints of `query`. */ function $n(t, e) { return function(t, e) { var n = e.key.path; return null !== t.collectionGroup ? e.key.N(t.collectionGroup) && t.path.T(n) : A.F(t.path) ? t.path.isEqual(n) : t.path.I(n); }(t, e) && function(t, e) { for (var n = 0, r = t.on; n < r.length; n++) { var i = r[n]; // order by key always matches if (!i.field.p() && null === e.field(i.field)) return !1; } return !0; }(t, e) && function(t, e) { for (var n = 0, r = t.filters; n < r.length; n++) { if (!r[n].matches(e)) return !1; } return !0; }(t, e) && function(t, e) { return !(t.startAt && !cr(t.startAt, Gn(t), e)) && (!t.endAt || !cr(t.endAt, Gn(t), e)); }(t, e); } function Xn(t) { return function(e, n) { for (var r = !1, i = 0, o = Gn(t); i < o.length; i++) { var s = o[i], u = lr(s, e, n); if (0 !== u) return u; r = r || s.field.p(); } return 0; }; } var Jn = /** @class */ function(e) { function n(t, n, r) { var i = this; return (i = e.call(this) || this).field = t, i.op = n, i.value = r, i; } /** * Creates a filter based on the provided arguments. */ return t.__extends(n, e), n.create = function(t, e, r) { if (t.p()) return "in" /* IN */ === e || "not-in" /* NOT_IN */ === e ? this.ln(t, e, r) : new Zn(t, e, r); if (fe(r)) { if ("==" /* EQUAL */ !== e && "!=" /* NOT_EQUAL */ !== e) throw new c(a.INVALID_ARGUMENT, "Invalid query. Null only supports '==' and '!=' comparisons."); return new n(t, e, r); } if (le(r)) { if ("==" /* EQUAL */ !== e && "!=" /* NOT_EQUAL */ !== e) throw new c(a.INVALID_ARGUMENT, "Invalid query. NaN only supports '==' and '!=' comparisons."); return new n(t, e, r); } return "array-contains" /* ARRAY_CONTAINS */ === e ? new rr(t, r) : "in" /* IN */ === e ? new ir(t, r) : "not-in" /* NOT_IN */ === e ? new or(t, r) : "array-contains-any" /* ARRAY_CONTAINS_ANY */ === e ? new sr(t, r) : new n(t, e, r); }, n.ln = function(t, e, n) { return "in" /* IN */ === e ? new tr(t, n) : new er(t, n); }, n.prototype.matches = function(t) { var e = t.field(this.field); // Types do not have to match in NOT_EQUAL filters. return "!=" /* NOT_EQUAL */ === this.op ? null !== e && this._n(ee(e, this.value)) : null !== e && Jt(this.value) === Jt(e) && this._n(ee(e, this.value)); // Only compare types with matching backend order (such as double and int). }, n.prototype._n = function(t) { switch (this.op) { case "<" /* LESS_THAN */ : return t < 0; case "<=" /* LESS_THAN_OR_EQUAL */ : return t <= 0; case "==" /* EQUAL */ : return 0 === t; case "!=" /* NOT_EQUAL */ : return 0 !== t; case ">" /* GREATER_THAN */ : return t > 0; case ">=" /* GREATER_THAN_OR_EQUAL */ : return t >= 0; default: return y(); } }, n.prototype.hn = function() { return [ "<" /* LESS_THAN */ , "<=" /* LESS_THAN_OR_EQUAL */ , ">" /* GREATER_THAN */ , ">=" /* GREATER_THAN_OR_EQUAL */ , "!=" /* NOT_EQUAL */ , "not-in" /* NOT_IN */ ].indexOf(this.op) >= 0; }, n; }((function() {})); var Zn = /** @class */ function(e) { function n(t, n, r) { var i = this; return (i = e.call(this, t, n, r) || this).key = A.C(r.referenceValue), i; } return t.__extends(n, e), n.prototype.matches = function(t) { var e = A.i(t.key, this.key); return this._n(e); }, n; }(Jn), tr = /** @class */ function(e) { function n(t, n) { var r = this; return (r = e.call(this, t, "in" /* IN */ , n) || this).keys = nr("in" /* IN */ , n), r; } return t.__extends(n, e), n.prototype.matches = function(t) { return this.keys.some((function(e) { return e.isEqual(t.key); })); }, n; }(Jn), er = /** @class */ function(e) { function n(t, n) { var r = this; return (r = e.call(this, t, "not-in" /* NOT_IN */ , n) || this).keys = nr("not-in" /* NOT_IN */ , n), r; } return t.__extends(n, e), n.prototype.matches = function(t) { return !this.keys.some((function(e) { return e.isEqual(t.key); })); }, n; }(Jn); /** Filter that matches on key fields within an array. */ function nr(t, e) { var n; return ((null === (n = e.arrayValue) || void 0 === n ? void 0 : n.values) || []).map((function(t) { return A.C(t.referenceValue); })); } /** A Filter that implements the array-contains operator. */ var rr = /** @class */ function(e) { function n(t, n) { return e.call(this, t, "array-contains" /* ARRAY_CONTAINS */ , n) || this; } return t.__extends(n, e), n.prototype.matches = function(t) { var e = t.field(this.field); return he(e) && te(e.arrayValue, this.value); }, n; }(Jn), ir = /** @class */ function(e) { function n(t, n) { return e.call(this, t, "in" /* IN */ , n) || this; } return t.__extends(n, e), n.prototype.matches = function(t) { var e = t.field(this.field); return null !== e && te(this.value.arrayValue, e); }, n; }(Jn), or = /** @class */ function(e) { function n(t, n) { return e.call(this, t, "not-in" /* NOT_IN */ , n) || this; } return t.__extends(n, e), n.prototype.matches = function(t) { if (te(this.value.arrayValue, { nullValue: "NULL_VALUE" })) return !1; var e = t.field(this.field); return null !== e && !te(this.value.arrayValue, e); }, n; }(Jn), sr = /** @class */ function(e) { function n(t, n) { return e.call(this, t, "array-contains-any" /* ARRAY_CONTAINS_ANY */ , n) || this; } return t.__extends(n, e), n.prototype.matches = function(t) { var e = this, n = t.field(this.field); return !(!he(n) || !n.arrayValue.values) && n.arrayValue.values.some((function(t) { return te(e.value.arrayValue, t); })); }, n; }(Jn), ur = function(t, e) { this.position = t, this.before = e; }; /** A Filter that implements the IN operator. */ function ar(t) { // TODO(b/29183165): Make this collision robust. return (t.before ? "b" : "a") + ":" + t.position.map((function(t) { return re(t); })).join(","); } /** * Returns true if a document sorts before a bound using the provided sort * order. */ function cr(t, e, n) { for (var r = 0, i = 0; i < t.position.length; i++) { var o = e[i], s = t.position[i]; if (r = o.field.p() ? A.i(A.C(s.referenceValue), n.key) : ee(s, n.field(o.field)), "desc" /* DESCENDING */ === o.dir && (r *= -1), 0 !== r) break; } return t.before ? r <= 0 : r < 0; } function hr(t, e) { if (null === t) return null === e; if (null === e) return !1; if (t.before !== e.before || t.position.length !== e.position.length) return !1; for (var n = 0; n < t.position.length; n++) if (!Zt(t.position[n], e.position[n])) return !1; return !0; } /** * An ordering on a field, in some Direction. Direction defaults to ASCENDING. */ var fr = function(t, e /* ASCENDING */) { void 0 === e && (e = "asc"), this.field = t, this.dir = e; }; function lr(t, e, n) { var r = t.field.p() ? A.i(e.key, n.key) : function(t, e, n) { var r = e.field(t), i = n.field(t); return null !== r && null !== i ? ee(r, i) : y(); }(t.field, e, n); switch (t.dir) { case "asc" /* ASCENDING */ : return r; case "desc" /* DESCENDING */ : return -1 * r; default: return y(); } } function pr(t, e) { return t.dir === e.dir && t.field.isEqual(e.field); } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var dr = function() { var t = this; this.promise = new Promise((function(e, n) { t.resolve = e, t.reject = n; })); }, vr = /** @class */ function() { function t( /** * The AsyncQueue to run backoff operations on. */ t, /** * The ID to use when scheduling backoff operations on the AsyncQueue. */ e, /** * The initial delay (used as the base delay on the first retry attempt). * Note that jitter will still be applied, so the actual delay could be as * little as 0.5*initialDelayMs. */ n /** * The multiplier to use to determine the extended base delay after each * attempt. */ , r /** * The maximum base delay after which no further backoff is performed. * Note that jitter will still be applied, so the actual delay could be as * much as 1.5*maxDelayMs. */ , i) { void 0 === n && (n = 1e3), void 0 === r && (r = 1.5), void 0 === i && (i = 6e4), this.fn = t, this.dn = e, this.wn = n, this.mn = r, this.Tn = i, this.En = 0, this.In = null, /** The last backoff attempt, as epoch milliseconds. */ this.An = Date.now(), this.reset(); } /** * Resets the backoff delay. * * The very next backoffAndWait() will have no delay. If it is called again * (i.e. due to an error), initialDelayMs (plus jitter) will be used, and * subsequent ones will increase according to the backoffFactor. */ return t.prototype.reset = function() { this.En = 0; }, /** * Resets the backoff delay to the maximum delay (e.g. for use after a * RESOURCE_EXHAUSTED error). */ t.prototype.Rn = function() { this.En = this.Tn; }, /** * Returns a promise that resolves after currentDelayMs, and increases the * delay for any subsequent attempts. If there was a pending backoff operation * already, it will be canceled. */ t.prototype.gn = function(t) { var e = this; // Cancel any pending backoff operation. this.cancel(); // First schedule using the current base (which may be 0 and should be // honored as such). var n = Math.floor(this.En + this.Pn()), r = Math.max(0, Date.now() - this.An), i = Math.max(0, n - r); // Guard against lastAttemptTime being in the future due to a clock change. i > 0 && l("ExponentialBackoff", "Backing off for " + i + " ms (base delay: " + this.En + " ms, delay with jitter: " + n + " ms, last attempt: " + r + " ms ago)"), this.In = this.fn.yn(this.dn, i, (function() { return e.An = Date.now(), t(); })), // Apply backoff factor to determine next delay and ensure it is within // bounds. this.En *= this.mn, this.En < this.wn && (this.En = this.wn), this.En > this.Tn && (this.En = this.Tn); }, t.prototype.Vn = function() { null !== this.In && (this.In.pn(), this.In = null); }, t.prototype.cancel = function() { null !== this.In && (this.In.cancel(), this.In = null); }, /** Returns a random value in the range [-currentBaseMs/2, currentBaseMs/2] */ t.prototype.Pn = function() { return (Math.random() - .5) * this.En; }, t; }(), yr = /** @class */ function() { function t(t) { var e = this; // NOTE: next/catchCallback will always point to our own wrapper functions, // not the user's raw next() or catch() callbacks. this.bn = null, this.vn = null, // When the operation resolves, we'll set result or error and mark isDone. this.result = void 0, this.error = void 0, this.Sn = !1, // Set to true when .then() or .catch() are called and prevents additional // chaining. this.Dn = !1, t((function(t) { e.Sn = !0, e.result = t, e.bn && // value should be defined unless T is Void, but we can't express // that in the type system. e.bn(t); }), (function(t) { e.Sn = !0, e.error = t, e.vn && e.vn(t); })); } return t.prototype.catch = function(t) { return this.next(void 0, t); }, t.prototype.next = function(e, n) { var r = this; return this.Dn && y(), this.Dn = !0, this.Sn ? this.error ? this.Cn(n, this.error) : this.Nn(e, this.result) : new t((function(t, i) { r.bn = function(n) { r.Nn(e, n).next(t, i); }, r.vn = function(e) { r.Cn(n, e).next(t, i); }; })); }, t.prototype.Fn = function() { var t = this; return new Promise((function(e, n) { t.next(e, n); })); }, t.prototype.xn = function(e) { try { var n = e(); return n instanceof t ? n : t.resolve(n); } catch (e) { return t.reject(e); } }, t.prototype.Nn = function(e, n) { return e ? this.xn((function() { return e(n); })) : t.resolve(n); }, t.prototype.Cn = function(e, n) { return e ? this.xn((function() { return e(n); })) : t.reject(n); }, t.resolve = function(e) { return new t((function(t, n) { t(e); })); }, t.reject = function(e) { return new t((function(t, n) { n(e); })); }, t.$n = function( // Accept all Promise types in waitFor(). // eslint-disable-next-line @typescript-eslint/no-explicit-any e) { return new t((function(t, n) { var r = 0, i = 0, o = !1; e.forEach((function(e) { ++r, e.next((function() { ++i, o && i === r && t(); }), (function(t) { return n(t); })); })), o = !0, i === r && t(); })); }, /** * Given an array of predicate functions that asynchronously evaluate to a * boolean, implements a short-circuiting `or` between the results. Predicates * will be evaluated until one of them returns `true`, then stop. The final * result will be whether any of them returned `true`. */ t.kn = function(e) { for (var n = t.resolve(!1), r = function(e) { n = n.next((function(n) { return n ? t.resolve(n) : e(); })); }, i = 0, o = e; i < o.length; i++) { r(o[i]); } return n; }, t.forEach = function(t, e) { var n = this, r = []; return t.forEach((function(t, i) { r.push(e.call(n, t, i)); })), this.$n(r); }, t; }(), gr = /** @class */ function() { /* * Creates a new SimpleDb wrapper for IndexedDb database `name`. * * Note that `version` must not be a downgrade. IndexedDB does not support * downgrading the schema version. We currently do not support any way to do * versioning outside of IndexedDB's versioning mechanism, as only * version-upgrade transactions are allowed to do things like create * objectstores. */ function e(t, n, i) { this.name = t, this.version = n, this.Mn = i, // NOTE: According to https://bugs.webkit.org/show_bug.cgi?id=197050, the // bug we're checking for should exist in iOS >= 12.2 and < 13, but for // whatever reason it's much harder to hit after 12.2 so we only proactively // log on 12.2. 12.2 === e.On(r.getUA()) && p("Firestore persistence suffers from a bug in iOS 12.2 Safari that may cause your app to stop working. See https://stackoverflow.com/q/56496296/110915 for details and a potential workaround."); } /** Deletes the specified database. */ return e.delete = function(t) { return l("SimpleDb", "Removing database:", t), Er(window.indexedDB.deleteDatabase(t)).Fn(); }, /** Returns true if IndexedDB is available in the current environment. */ e.Ln = function() { if ("undefined" == typeof indexedDB) return !1; if (e.Bn()) return !0; // We extensively use indexed array values and compound keys, // which IE and Edge do not support. However, they still have indexedDB // defined on the window, so we need to check for them here and make sure // to return that persistence is not enabled for those browsers. // For tracking support of this feature, see here: // https://developer.microsoft.com/en-us/microsoft-edge/platform/status/indexeddbarraysandmultientrysupport/ // Check the UA string to find out the browser. var t = r.getUA(), n = e.On(t), i = 0 < n && n < 10, o = e.qn(t), s = 0 < o && o < 4.5; // IE 10 // ua = 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0)'; // IE 11 // ua = 'Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko'; // Edge // ua = 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, // like Gecko) Chrome/39.0.2171.71 Safari/537.36 Edge/12.0'; // iOS Safari: Disable for users running iOS version < 10. return !(t.indexOf("MSIE ") > 0 || t.indexOf("Trident/") > 0 || t.indexOf("Edge/") > 0 || i || s); }, /** * Returns true if the backing IndexedDB store is the Node IndexedDBShim * (see https://github.com/axemclion/IndexedDBShim). */ e.Bn = function() { var t; return "undefined" != typeof process && "YES" === (null === (t = process.env) || void 0 === t ? void 0 : t.Un); }, /** Helper to get a typed SimpleDbStore from a transaction. */ e.Qn = function(t, e) { return t.store(e); }, // visible for testing /** Parse User Agent to determine iOS version. Returns -1 if not found. */ e.On = function(t) { var e = t.match(/i(?:phone|pad|pod) os ([\d_]+)/i), n = e ? e[1].split("_").slice(0, 2).join(".") : "-1"; return Number(n); }, // visible for testing /** Parse User Agent to determine Android version. Returns -1 if not found. */ e.qn = function(t) { var e = t.match(/Android ([\d.]+)/i), n = e ? e[1].split(".").slice(0, 2).join(".") : "-1"; return Number(n); }, /** * Opens the specified database, creating or upgrading it if necessary. */ e.prototype.Wn = function(e) { return t.__awaiter(this, void 0, void 0, (function() { var n, r = this; return t.__generator(this, (function(t) { switch (t.label) { case 0: return this.db ? [ 3 /*break*/ , 2 ] : (l("SimpleDb", "Opening database:", this.name), n = this, [ 4 /*yield*/ , new Promise((function(t, n) { // TODO(mikelehen): Investigate browser compatibility. // https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API/Using_IndexedDB // suggests IE9 and older WebKit browsers handle upgrade // differently. They expect setVersion, as described here: // https://developer.mozilla.org/en-US/docs/Web/API/IDBVersionChangeRequest/setVersion var i = indexedDB.open(r.name, r.version); i.onsuccess = function(e) { var n = e.target.result; t(n); }, i.onblocked = function() { n(new wr(e, "Cannot upgrade IndexedDB schema while another tab is open. Close all tabs that access Firestore and reload this page to proceed.")); }, i.onerror = function(t) { var r = t.target.error; "VersionError" === r.name ? n(new c(a.FAILED_PRECONDITION, "A newer version of the Firestore SDK was previously used and so the persisted data is not compatible with the version of the SDK you are now using. The SDK will operate with persistence disabled. If you need persistence, please re-upgrade to a newer version of the SDK or else clear the persisted IndexedDB data for your app to start fresh.")) : n(new wr(e, r)); }, i.onupgradeneeded = function(t) { l("SimpleDb", 'Database "' + r.name + '" requires upgrade from version:', t.oldVersion); var e = t.target.result; r.Mn.createOrUpgrade(e, i.transaction, t.oldVersion, r.version).next((function() { l("SimpleDb", "Database upgrade to version " + r.version + " complete"); })); }; })) ]); case 1: n.db = t.sent(), t.label = 2; case 2: return [ 2 /*return*/ , (this.jn && (this.db.onversionchange = function(t) { return r.jn(t); }), this.db) ]; } })); })); }, e.prototype.Kn = function(t) { this.jn = t, this.db && (this.db.onversionchange = function(e) { return t(e); }); }, e.prototype.runTransaction = function(e, n, r, i) { return t.__awaiter(this, void 0, void 0, (function() { var o, s, u, a, c; return t.__generator(this, (function(h) { switch (h.label) { case 0: o = "readonly" === n, s = 0, u = function() { var n, u, c, h, f; return t.__generator(this, (function(t) { switch (t.label) { case 0: ++s, t.label = 1; case 1: return t.trys.push([ 1, 4, , 5 ]), [ 4 /*yield*/ , a.Wn(e) ]; case 2: // Wait for the transaction to complete (i.e. IndexedDb's onsuccess event to // fire), but still return the original transactionFnResult back to the // caller. return a.db = t.sent(), n = br.open(a.db, e, o ? "readonly" : "readwrite", r), u = i(n).catch((function(t) { // Abort the transaction if there was an error. return n.abort(t), yr.reject(t); })).Fn(), c = {}, u.catch((function() {})), [ 4 /*yield*/ , n.Gn ]; case 3: return [ 2 /*return*/ , (c.value = ( // Wait for the transaction to complete (i.e. IndexedDb's onsuccess event to // fire), but still return the original transactionFnResult back to the // caller. t.sent(), u), c) ]; case 4: return h = t.sent(), f = "FirebaseError" !== h.name && s < 3, l("SimpleDb", "Transaction failed with error:", h.message, "Retrying:", f), a.close(), f ? [ 3 /*break*/ , 5 ] : [ 2 /*return*/ , { value: Promise.reject(h) } ]; case 5: return [ 2 /*return*/ ]; } })); }, a = this, h.label = 1; case 1: return [ 5 /*yield**/ , u() ]; case 2: if ("object" == typeof (c = h.sent())) return [ 2 /*return*/ , c.value ]; h.label = 3; case 3: return [ 3 /*break*/ , 1 ]; case 4: return [ 2 /*return*/ ]; } })); })); }, e.prototype.close = function() { this.db && this.db.close(), this.db = void 0; }, e; }(), mr = /** @class */ function() { function t(t) { this.zn = t, this.Hn = !1, this.Yn = null; } return Object.defineProperty(t.prototype, "Sn", { get: function() { return this.Hn; }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "Jn", { get: function() { return this.Yn; }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "cursor", { set: function(t) { this.zn = t; }, enumerable: !1, configurable: !0 }), /** * This function can be called to stop iteration at any point. */ t.prototype.done = function() { this.Hn = !0; }, /** * This function can be called to skip to that next key, which could be * an index or a primary key. */ t.prototype.Xn = function(t) { this.Yn = t; }, /** * Delete the current cursor value from the object store. * * NOTE: You CANNOT do this with a keysOnly query. */ t.prototype.delete = function() { return Er(this.zn.delete()); }, t; }(), wr = /** @class */ function(e) { function n(t, n) { var r = this; return (r = e.call(this, a.UNAVAILABLE, "IndexedDB transaction '" + t + "' failed: " + n) || this).name = "IndexedDbTransactionError", r; } return t.__extends(n, e), n; }(c); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * A helper for running delayed tasks following an exponential backoff curve * between attempts. * * Each delay is made up of a "base" delay which follows the exponential * backoff curve, and a +/- 50% "jitter" that is calculated and added to the * base delay. This prevents clients from accidentally synchronizing their * delays causing spikes of load to the backend. */ /** Verifies whether `e` is an IndexedDbTransactionError. */ function _r(t) { // Use name equality, as instanceof checks on errors don't work with errors // that wrap other errors. return "IndexedDbTransactionError" === t.name; } /** * Wraps an IDBTransaction and exposes a store() method to get a handle to a * specific object store. */ var br = /** @class */ function() { function t(t, e) { var n = this; this.action = t, this.transaction = e, this.aborted = !1, /** * A promise that resolves with the result of the IndexedDb transaction. */ this.Zn = new dr, this.transaction.oncomplete = function() { n.Zn.resolve(); }, this.transaction.onabort = function() { e.error ? n.Zn.reject(new wr(t, e.error)) : n.Zn.resolve(); }, this.transaction.onerror = function(e) { var r = Nr(e.target.error); n.Zn.reject(new wr(t, r)); }; } return t.open = function(e, n, r, i) { try { return new t(n, e.transaction(i, r)); } catch (e) { throw new wr(n, e); } }, Object.defineProperty(t.prototype, "Gn", { get: function() { return this.Zn.promise; }, enumerable: !1, configurable: !0 }), t.prototype.abort = function(t) { t && this.Zn.reject(t), this.aborted || (l("SimpleDb", "Aborting transaction:", t ? t.message : "Client-initiated abort"), this.aborted = !0, this.transaction.abort()); }, /** * Returns a SimpleDbStore<KeyType, ValueType> for the specified store. All * operations performed on the SimpleDbStore happen within the context of this * transaction and it cannot be used anymore once the transaction is * completed. * * Note that we can't actually enforce that the KeyType and ValueType are * correct, but they allow type safety through the rest of the consuming code. */ t.prototype.store = function(t) { var e = this.transaction.objectStore(t); return new Ir(e); }, t; }(), Ir = /** @class */ function() { function t(t) { this.store = t; } return t.prototype.put = function(t, e) { var n; return void 0 !== e ? (l("SimpleDb", "PUT", this.store.name, t, e), n = this.store.put(e, t)) : (l("SimpleDb", "PUT", this.store.name, "<auto-key>", t), n = this.store.put(t)), Er(n); }, /** * Adds a new value into an Object Store and returns the new key. Similar to * IndexedDb's `add()`, this method will fail on primary key collisions. * * @param value The object to write. * @return The key of the value to add. */ t.prototype.add = function(t) { return l("SimpleDb", "ADD", this.store.name, t, t), Er(this.store.add(t)); }, /** * Gets the object with the specified key from the specified store, or null * if no object exists with the specified key. * * @key The key of the object to get. * @return The object with the specified key or null if no object exists. */ t.prototype.get = function(t) { var e = this; // We're doing an unsafe cast to ValueType. // eslint-disable-next-line @typescript-eslint/no-explicit-any return Er(this.store.get(t)).next((function(n) { // Normalize nonexistence to null. return void 0 === n && (n = null), l("SimpleDb", "GET", e.store.name, t, n), n; })); }, t.prototype.delete = function(t) { return l("SimpleDb", "DELETE", this.store.name, t), Er(this.store.delete(t)); }, /** * If we ever need more of the count variants, we can add overloads. For now, * all we need is to count everything in a store. * * Returns the number of rows in the store. */ t.prototype.count = function() { return l("SimpleDb", "COUNT", this.store.name), Er(this.store.count()); }, t.prototype.ts = function(t, e) { var n = this.cursor(this.options(t, e)), r = []; return this.es(n, (function(t, e) { r.push(e); })).next((function() { return r; })); }, t.prototype.ns = function(t, e) { l("SimpleDb", "DELETE ALL", this.store.name); var n = this.options(t, e); n.ss = !1; var r = this.cursor(n); return this.es(r, (function(t, e, n) { return n.delete(); })); }, t.prototype.rs = function(t, e) { var n; e ? n = t : (n = {}, e = t); var r = this.cursor(n); return this.es(r, e); }, /** * Iterates over a store, but waits for the given callback to complete for * each entry before iterating the next entry. This allows the callback to do * asynchronous work to determine if this iteration should continue. * * The provided callback should return `true` to continue iteration, and * `false` otherwise. */ t.prototype.os = function(t) { var e = this.cursor({}); return new yr((function(n, r) { e.onerror = function(t) { var e = Nr(t.target.error); r(e); }, e.onsuccess = function(e) { var r = e.target.result; r ? t(r.primaryKey, r.value).next((function(t) { t ? r.continue() : n(); })) : n(); }; })); }, t.prototype.es = function(t, e) { var n = []; return new yr((function(r, i) { t.onerror = function(t) { i(t.target.error); }, t.onsuccess = function(t) { var i = t.target.result; if (i) { var o = new mr(i), s = e(i.primaryKey, i.value, o); if (s instanceof yr) { var u = s.catch((function(t) { return o.done(), yr.reject(t); })); n.push(u); } o.Sn ? r() : null === o.Jn ? i.continue() : i.continue(o.Jn); } else r(); }; })).next((function() { return yr.$n(n); })); }, t.prototype.options = function(t, e) { var n = void 0; return void 0 !== t && ("string" == typeof t ? n = t : e = t), { index: n, range: e }; }, t.prototype.cursor = function(t) { var e = "next"; if (t.reverse && (e = "prev"), t.index) { var n = this.store.index(t.index); return t.ss ? n.openKeyCursor(t.range, e) : n.openCursor(t.range, e); } return this.store.openCursor(t.range, e); }, t; }(); /** * A wrapper around an IDBObjectStore providing an API that: * * 1) Has generic KeyType / ValueType parameters to provide strongly-typed * methods for acting against the object store. * 2) Deals with IndexedDB's onsuccess / onerror event callbacks, making every * method return a PersistencePromise instead. * 3) Provides a higher-level API to avoid needing to do excessive wrapping of * intermediate IndexedDB types (IDBCursorWithValue, etc.) */ /** * Wraps an IDBRequest in a PersistencePromise, using the onsuccess / onerror * handlers to resolve / reject the PersistencePromise as appropriate. */ function Er(t) { return new yr((function(e, n) { t.onsuccess = function(t) { var n = t.target.result; e(n); }, t.onerror = function(t) { var e = Nr(t.target.error); n(e); }; })); } // Guard so we only report the error once. var Tr = !1; function Nr(t) { var e = gr.On(r.getUA()); if (e >= 12.2 && e < 13) { var n = "An internal error was encountered in the Indexed Database server"; if (t.message.indexOf(n) >= 0) { // Wrap error in a more descriptive one. var i = new c("internal", "IOS_INDEXEDDB_BUG1: IndexedDb has thrown '" + n + "'. This is likely due to an unavoidable bug in iOS. See https://stackoverflow.com/q/56496296/110915 for details and a potential workaround."); return Tr || (Tr = !0, // Throw a global exception outside of this promise chain, for the user to // potentially catch. setTimeout((function() { throw i; }), 0)), i; } } return t; } /** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** The Platform's 'window' implementation or null if not available. */ function Ar() { // `window` is not always available, e.g. in ReactNative and WebWorkers. // eslint-disable-next-line no-restricted-globals return "undefined" != typeof window ? window : null; } /** The Platform's 'document' implementation or null if not available. */ function Sr() { // `document` is not always available, e.g. in ReactNative and WebWorkers. // eslint-disable-next-line no-restricted-globals return "undefined" != typeof document ? document : null; } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Represents an operation scheduled to be run in the future on an AsyncQueue. * * It is created via DelayedOperation.createAndSchedule(). * * Supports cancellation (via cancel()) and early execution (via skipDelay()). * * Note: We implement `PromiseLike` instead of `Promise`, as the `Promise` type * in newer versions of TypeScript defines `finally`, which is not available in * IE. */ var Dr = /** @class */ function() { function t(t, e, n, r, i) { this.cs = t, this.dn = e, this.us = n, this.op = r, this.hs = i, this.ls = new dr, this.then = this.ls.promise.then.bind(this.ls.promise), // It's normal for the deferred promise to be canceled (due to cancellation) // and so we attach a dummy catch callback to avoid // 'UnhandledPromiseRejectionWarning' log spam. this.ls.promise.catch((function(t) {})) /** * Creates and returns a DelayedOperation that has been scheduled to be * executed on the provided asyncQueue after the provided delayMs. * * @param asyncQueue The queue to schedule the operation on. * @param id A Timer ID identifying the type of operation this is. * @param delayMs The delay (ms) before the operation should be scheduled. * @param op The operation to run. * @param removalCallback A callback to be called synchronously once the * operation is executed or canceled, notifying the AsyncQueue to remove it * from its delayedOperations list. * PORTING NOTE: This exists to prevent making removeDelayedOperation() and * the DelayedOperation class public. */; } return t._s = function(e, n, r, i, o) { var s = new t(e, n, Date.now() + r, i, o); return s.start(r), s; }, /** * Starts the timer. This is called immediately after construction by * createAndSchedule(). */ t.prototype.start = function(t) { var e = this; this.fs = setTimeout((function() { return e.ds(); }), t); }, /** * Queues the operation to run immediately (if it hasn't already been run or * canceled). */ t.prototype.pn = function() { return this.ds(); }, /** * Cancels the operation if it hasn't already been executed or canceled. The * promise will be rejected. * * As long as the operation has not yet been run, calling cancel() provides a * guarantee that the operation will not be run. */ t.prototype.cancel = function(t) { null !== this.fs && (this.clearTimeout(), this.ls.reject(new c(a.CANCELLED, "Operation cancelled" + (t ? ": " + t : "")))); }, t.prototype.ds = function() { var t = this; this.cs.ws((function() { return null !== t.fs ? (t.clearTimeout(), t.op().then((function(e) { return t.ls.resolve(e); }))) : Promise.resolve(); })); }, t.prototype.clearTimeout = function() { null !== this.fs && (this.hs(this), clearTimeout(this.fs), this.fs = null); }, t; }(), xr = /** @class */ function() { function e() { var t = this; // The last promise in the queue. this.Ts = Promise.resolve(), // A list of retryable operations. Retryable operations are run in order and // retried with backoff. this.Es = [], // Is this AsyncQueue being shut down? Once it is set to true, it will not // be changed again. this.Is = !1, // Operations scheduled to be queued in the future. Operations are // automatically removed after they are run or canceled. this.As = [], // visible for testing this.Rs = null, // Flag set while there's an outstanding AsyncQueue operation, used for // assertion sanity-checks. this.gs = !1, // List of TimerIds to fast-forward delays for. this.Ps = [], // Backoff timer used to schedule retries for retryable operations this.ys = new vr(this, "async_queue_retry" /* AsyncQueueRetry */), // Visibility handler that triggers an immediate retry of all retryable // operations. Meant to speed up recovery when we regain file system access // after page comes into foreground. this.Vs = function() { var e = Sr(); e && l("AsyncQueue", "Visibility state changed to ", e.visibilityState), t.ys.Vn(); }; var e = Sr(); e && "function" == typeof e.addEventListener && e.addEventListener("visibilitychange", this.Vs); } return Object.defineProperty(e.prototype, "ps", { // Is this AsyncQueue being shut down? If true, this instance will not enqueue // any new operations, Promises from enqueue requests will not resolve. get: function() { return this.Is; }, enumerable: !1, configurable: !0 }), /** * Adds a new operation to the queue without waiting for it to complete (i.e. * we ignore the Promise result). */ e.prototype.ws = function(t) { // eslint-disable-next-line @typescript-eslint/no-floating-promises this.enqueue(t); }, /** * Regardless if the queue has initialized shutdown, adds a new operation to the * queue without waiting for it to complete (i.e. we ignore the Promise result). */ e.prototype.bs = function(t) { this.vs(), // eslint-disable-next-line @typescript-eslint/no-floating-promises this.Ss(t); }, /** * Initialize the shutdown of this queue. Once this method is called, the * only possible way to request running an operation is through * `enqueueEvenWhileRestricted()`. */ e.prototype.Ds = function() { if (!this.Is) { this.Is = !0; var t = Sr(); t && "function" == typeof t.removeEventListener && t.removeEventListener("visibilitychange", this.Vs); } }, /** * Adds a new operation to the queue. Returns a promise that will be resolved * when the promise returned by the new operation is (with its value). */ e.prototype.enqueue = function(t) { return this.vs(), this.Is ? new Promise((function(t) {})) : this.Ss(t); }, /** * Enqueue a retryable operation. * * A retryable operation is rescheduled with backoff if it fails with a * IndexedDbTransactionError (the error type used by SimpleDb). All * retryable operations are executed in order and only run if all prior * operations were retried successfully. */ e.prototype.Cs = function(t) { var e = this; this.ws((function() { return e.Es.push(t), e.Ns(); })); }, /** * Runs the next operation from the retryable queue. If the operation fails, * reschedules with backoff. */ e.prototype.Ns = function() { return t.__awaiter(this, void 0, void 0, (function() { var e, n = this; return t.__generator(this, (function(t) { switch (t.label) { case 0: if (0 === this.Es.length) return [ 3 /*break*/ , 5 ]; t.label = 1; case 1: return t.trys.push([ 1, 3, , 4 ]), [ 4 /*yield*/ , this.Es[0]() ]; case 2: return t.sent(), this.Es.shift(), this.ys.reset(), [ 3 /*break*/ , 4 ]; case 3: if (!_r(e = t.sent())) throw e; // Failure will be handled by AsyncQueue return l("AsyncQueue", "Operation failed with retryable error: " + e), [ 3 /*break*/ , 4 ]; case 4: this.Es.length > 0 && // If there are additional operations, we re-schedule `retryNextOp()`. // This is necessary to run retryable operations that failed during // their initial attempt since we don't know whether they are already // enqueued. If, for example, `op1`, `op2`, `op3` are enqueued and `op1` // needs to be re-run, we will run `op1`, `op1`, `op2` using the // already enqueued calls to `retryNextOp()`. `op3()` will then run in the // call scheduled here. // Since `backoffAndRun()` cancels an existing backoff and schedules a // new backoff on every call, there is only ever a single additional // operation in the queue. this.ys.gn((function() { return n.Ns(); })), t.label = 5; case 5: return [ 2 /*return*/ ]; } })); })); }, e.prototype.Ss = function(t) { var e = this, n = this.Ts.then((function() { return e.gs = !0, t().catch((function(t) { // Re-throw the error so that this.tail becomes a rejected Promise and // all further attempts to chain (via .then) will just short-circuit // and return the rejected Promise. throw e.Rs = t, e.gs = !1, p("INTERNAL UNHANDLED ERROR: ", /** * Chrome includes Error.message in Error.stack. Other browsers do not. * This returns expected output of message + stack when available. * @param error Error or FirestoreError */ function(t) { var e = t.message || ""; return t.stack && (e = t.stack.includes(t.message) ? t.stack : t.message + "\n" + t.stack), e; }(t)), t; })).then((function(t) { return e.gs = !1, t; })); })); return this.Ts = n, n; }, /** * Schedules an operation to be queued on the AsyncQueue once the specified * `delayMs` has elapsed. The returned DelayedOperation can be used to cancel * or fast-forward the operation prior to its running. */ e.prototype.yn = function(t, e, n) { var r = this; this.vs(), // Fast-forward delays for timerIds that have been overriden. this.Ps.indexOf(t) > -1 && (e = 0); var i = Dr._s(this, t, e, n, (function(t) { return r.Fs(t); })); return this.As.push(i), i; }, e.prototype.vs = function() { this.Rs && y(); }, /** * Verifies there's an operation currently in-progress on the AsyncQueue. * Unfortunately we can't verify that the running code is in the promise chain * of that operation, so this isn't a foolproof check, but it should be enough * to catch some bugs. */ e.prototype.xs = function() {}, /** * Waits until all currently queued tasks are finished executing. Delayed * operations are not run. */ e.prototype.$s = function() { return t.__awaiter(this, void 0, void 0, (function() { var e; return t.__generator(this, (function(t) { switch (t.label) { case 0: return [ 4 /*yield*/ , e = this.Ts ]; case 1: t.sent(), t.label = 2; case 2: if (e !== this.Ts) return [ 3 /*break*/ , 0 ]; t.label = 3; case 3: return [ 2 /*return*/ ]; } })); })); }, /** * For Tests: Determine if a delayed operation with a particular TimerId * exists. */ e.prototype.ks = function(t) { for (var e = 0, n = this.As; e < n.length; e++) { if (n[e].dn === t) return !0; } return !1; }, /** * For Tests: Runs some or all delayed operations early. * * @param lastTimerId Delayed operations up to and including this TimerId will * be drained. Pass TimerId.All to run all delayed operations. * @returns a Promise that resolves once all operations have been run. */ e.prototype.Ms = function(t) { var e = this; // Note that draining may generate more delayed ops, so we do that first. return this.$s().then((function() { // Run ops in the same order they'd run if they ran naturally. e.As.sort((function(t, e) { return t.us - e.us; })); for (var n = 0, r = e.As; n < r.length; n++) { var i = r[n]; if (i.pn(), "all" /* All */ !== t && i.dn === t) break; } return e.$s(); })); }, /** * For Tests: Skip all subsequent delays for a timer id. */ e.prototype.Os = function(t) { this.Ps.push(t); }, /** Called once a DelayedOperation is run or canceled. */ e.prototype.Fs = function(t) { // NOTE: indexOf / slice are O(n), but delayedOperations is expected to be small. var e = this.As.indexOf(t); this.As.splice(e, 1); }, e; }(); /** * Returns a FirestoreError that can be surfaced to the user if the provided * error is an IndexedDbTransactionError. Re-throws the error otherwise. */ function Lr(t, e) { if (p("AsyncQueue", e + ": " + t), _r(t)) return new c(a.UNAVAILABLE, e + ": " + t); throw t; } var kr = function() { this.Ls = void 0, this.listeners = []; }, Rr = function() { this.Bs = new it((function(t) { return Hn(t); }), Qn), this.onlineState = "Unknown" /* Unknown */ , this.qs = new Set; }; function Or(e, n) { return t.__awaiter(this, void 0, void 0, (function() { var r, i, o, s, u, a, c; return t.__generator(this, (function(t) { switch (t.label) { case 0: if (r = m(e), i = n.query, o = !1, (s = r.Bs.get(i)) || (o = !0, s = new kr), !o) return [ 3 /*break*/ , 4 ]; t.label = 1; case 1: return t.trys.push([ 1, 3, , 4 ]), u = s, [ 4 /*yield*/ , r.Us(i) ]; case 2: return u.Ls = t.sent(), [ 3 /*break*/ , 4 ]; case 3: return a = t.sent(), c = Lr(a, "Initialization of query '" + Yn(n.query) + "' failed"), [ 2 /*return*/ , void n.onError(c) ]; case 4: return r.Bs.set(i, s), s.listeners.push(n), // Run global snapshot listeners if a consistent snapshot has been emitted. n.Qs(r.onlineState), s.Ls && n.Ws(s.Ls) && Cr(r), [ 2 /*return*/ ]; } })); })); } function Pr(e, n) { return t.__awaiter(this, void 0, void 0, (function() { var r, i, o, s, u; return t.__generator(this, (function(t) { return r = m(e), i = n.query, o = !1, (s = r.Bs.get(i)) && (u = s.listeners.indexOf(n)) >= 0 && (s.listeners.splice(u, 1), o = 0 === s.listeners.length), o ? [ 2 /*return*/ , (r.Bs.delete(i), r.js(i)) ] : [ 2 /*return*/ ]; })); })); } function Vr(t, e) { for (var n = m(t), r = !1, i = 0, o = e; i < o.length; i++) { var s = o[i], u = s.query, a = n.Bs.get(u); if (a) { for (var c = 0, h = a.listeners; c < h.length; c++) { h[c].Ws(s) && (r = !0); } a.Ls = s; } } r && Cr(n); } function Ur(t, e, n) { var r = m(t), i = r.Bs.get(e); if (i) for (var o = 0, s = i.listeners; o < s.length; o++) { s[o].onError(n); } // Remove all listeners. NOTE: We don't need to call syncEngine.unlisten() // after an error. r.Bs.delete(e); } // Call all global snapshot listeners that have been set. function Cr(t) { t.qs.forEach((function(t) { t.next(); })); } /** * QueryListener takes a series of internal view snapshots and determines * when to raise the event. * * It uses an Observer to dispatch events. */ var Fr = /** @class */ function() { function t(t, e, n) { this.query = t, this.Ks = e, /** * Initial snapshots (e.g. from cache) may not be propagated to the wrapped * observer. This flag is set to true once we've actually raised an event. */ this.Gs = !1, this.zs = null, this.onlineState = "Unknown" /* Unknown */ , this.options = n || {} /** * Applies the new ViewSnapshot to this listener, raising a user-facing event * if applicable (depending on what changed, whether the user has opted into * metadata-only changes, etc.). Returns true if a user-facing event was * indeed raised. */; } return t.prototype.Ws = function(t) { if (!this.options.includeMetadataChanges) { for ( // Remove the metadata only changes. var e = [], n = 0, r = t.docChanges; n < r.length; n++) { var i = r[n]; 3 /* Metadata */ !== i.type && e.push(i); } t = new Ft(t.query, t.docs, t.Qt, e, t.Wt, t.fromCache, t.jt, /* excludesMetadataChanges= */ !0); } var o = !1; return this.Gs ? this.Hs(t) && (this.Ks.next(t), o = !0) : this.Ys(t, this.onlineState) && (this.Js(t), o = !0), this.zs = t, o; }, t.prototype.onError = function(t) { this.Ks.error(t); }, /** Returns whether a snapshot was raised. */ t.prototype.Qs = function(t) { this.onlineState = t; var e = !1; return this.zs && !this.Gs && this.Ys(this.zs, t) && (this.Js(this.zs), e = !0), e; }, t.prototype.Ys = function(t, e) { // Always raise the first event when we're synced if (!t.fromCache) return !0; // NOTE: We consider OnlineState.Unknown as online (it should become Offline // or Online if we wait long enough). var n = "Offline" /* Offline */ !== e; // Don't raise the event if we're online, aren't synced yet (checked // above) and are waiting for a sync. return !(this.options.Xs && n || t.docs.m() && "Offline" /* Offline */ !== e); // Raise data from cache if we have any documents or we are offline }, t.prototype.Hs = function(t) { // We don't need to handle includeDocumentMetadataChanges here because // the Metadata only changes have already been stripped out if needed. // At this point the only changes we will see are the ones we should // propagate. if (t.docChanges.length > 0) return !0; var e = this.zs && this.zs.hasPendingWrites !== t.hasPendingWrites; return !(!t.jt && !e) && !0 === this.options.includeMetadataChanges; // Generally we should have hit one of the cases above, but it's possible // to get here if there were only metadata docChanges and they got // stripped out. }, t.prototype.Js = function(t) { t = Ft.Gt(t.query, t.docs, t.Wt, t.fromCache), this.Gs = !0, this.Ks.next(t); }, t; }(), Mr = /** @class */ function() { function t(t) { this.uid = t; } return t.prototype.Zs = function() { return null != this.uid; }, /** * Returns a key representing this user, suitable for inclusion in a * dictionary. */ t.prototype.ti = function() { return this.Zs() ? "uid:" + this.uid : "anonymous-user"; }, t.prototype.isEqual = function(t) { return t.uid === this.uid; }, t; }(); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Simple wrapper around a nullable UID. Mostly exists to make code more * readable. */ /** A user with a null UID. */ Mr.UNAUTHENTICATED = new Mr(null), // TODO(mikelehen): Look into getting a proper uid-equivalent for // non-FirebaseAuth providers. Mr.ei = new Mr("google-credentials-uid"), Mr.ni = new Mr("first-party-uid"); /** * @license * Copyright 2018 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * `ListenSequence` is a monotonic sequence. It is initialized with a minimum value to * exceed. All subsequent calls to next will return increasing values. If provided with a * `SequenceNumberSyncer`, it will additionally bump its next value when told of a new value, as * well as write out sequence numbers that it produces via `next()`. */ var qr = /** @class */ function() { function t(t, e) { var n = this; this.previousValue = t, e && (e.si = function(t) { return n.ii(t); }, this.ri = function(t) { return e.oi(t); }); } return t.prototype.ii = function(t) { return this.previousValue = Math.max(t, this.previousValue), this.previousValue; }, t.prototype.next = function() { var t = ++this.previousValue; return this.ri && this.ri(t), t; }, t; }(); /** Assembles the key for a client state in WebStorage */ function jr(t, e) { return "firestore_clients_" + t + "_" + e; } // The format of the WebStorage key that stores the mutation state is: // firestore_mutations_<persistence_prefix>_<batch_id> // (for unauthenticated users) // or: firestore_mutations_<persistence_prefix>_<batch_id>_<user_uid> // 'user_uid' is last to avoid needing to escape '_' characters that it might // contain. /** Assembles the key for a mutation batch in WebStorage */ function Gr(t, e, n) { var r = "firestore_mutations_" + t + "_" + n; return e.Zs() && (r += "_" + e.uid), r; } // The format of the WebStorage key that stores a query target's metadata is: // firestore_targets_<persistence_prefix>_<target_id> /** Assembles the key for a query state in WebStorage */ function zr(t, e) { return "firestore_targets_" + t + "_" + e; } // The WebStorage prefix that stores the primary tab's online state. The // format of the key is: // firestore_online_state_<persistence_prefix> /** * Holds the state of a mutation batch, including its user ID, batch ID and * whether the batch is 'pending', 'acknowledged' or 'rejected'. */ // Visible for testing qr.ai = -1; var Br = /** @class */ function() { function t(t, e, n, r) { this.user = t, this.batchId = e, this.state = n, this.error = r /** * Parses a MutationMetadata from its JSON representation in WebStorage. * Logs a warning and returns null if the format of the data is not valid. */; } return t.ci = function(e, n, r) { var i = JSON.parse(r), o = "object" == typeof i && -1 !== [ "pending", "acknowledged", "rejected" ].indexOf(i.state) && (void 0 === i.error || "object" == typeof i.error), s = void 0; return o && i.error && ((o = "string" == typeof i.error.message && "string" == typeof i.error.code) && (s = new c(i.error.code, i.error.message))), o ? new t(e, n, i.state, s) : (p("SharedClientState", "Failed to parse mutation state for ID '" + n + "': " + r), null); }, t.prototype.ui = function() { var t = { state: this.state, updateTimeMs: Date.now() }; return this.error && (t.error = { code: this.error.code, message: this.error.message }), JSON.stringify(t); }, t; }(), Wr = /** @class */ function() { function t(t, e, n) { this.targetId = t, this.state = e, this.error = n /** * Parses a QueryTargetMetadata from its JSON representation in WebStorage. * Logs a warning and returns null if the format of the data is not valid. */; } return t.ci = function(e, n) { var r = JSON.parse(n), i = "object" == typeof r && -1 !== [ "not-current", "current", "rejected" ].indexOf(r.state) && (void 0 === r.error || "object" == typeof r.error), o = void 0; return i && r.error && ((i = "string" == typeof r.error.message && "string" == typeof r.error.code) && (o = new c(r.error.code, r.error.message))), i ? new t(e, r.state, o) : (p("SharedClientState", "Failed to parse target state for ID '" + e + "': " + n), null); }, t.prototype.ui = function() { var t = { state: this.state, updateTimeMs: Date.now() }; return this.error && (t.error = { code: this.error.code, message: this.error.message }), JSON.stringify(t); }, t; }(), Kr = /** @class */ function() { function t(t, e) { this.clientId = t, this.activeTargetIds = e /** * Parses a RemoteClientState from the JSON representation in WebStorage. * Logs a warning and returns null if the format of the data is not valid. */; } return t.ci = function(e, n) { for (var r = JSON.parse(n), i = "object" == typeof r && r.activeTargetIds instanceof Array, o = Vt(), s = 0; i && s < r.activeTargetIds.length; ++s) i = ct(r.activeTargetIds[s]), o = o.add(r.activeTargetIds[s]); return i ? new t(e, o) : (p("SharedClientState", "Failed to parse client data for instance '" + e + "': " + n), null); }, t; }(), Qr = /** @class */ function() { function t(t, e) { this.clientId = t, this.onlineState = e /** * Parses a SharedOnlineState from its JSON representation in WebStorage. * Logs a warning and returns null if the format of the data is not valid. */; } return t.ci = function(e) { var n = JSON.parse(e); return "object" == typeof n && -1 !== [ "Unknown", "Online", "Offline" ].indexOf(n.onlineState) && "string" == typeof n.clientId ? new t(n.clientId, n.onlineState) : (p("SharedClientState", "Failed to parse online state: " + e), null); }, t; }(), Hr = /** @class */ function() { function t() { this.activeTargetIds = Vt(); } return t.prototype.hi = function(t) { this.activeTargetIds = this.activeTargetIds.add(t); }, t.prototype.li = function(t) { this.activeTargetIds = this.activeTargetIds.delete(t); }, /** * Converts this entry into a JSON-encoded format we can use for WebStorage. * Does not encode `clientId` as it is part of the key in WebStorage. */ t.prototype.ui = function() { var t = { activeTargetIds: this.activeTargetIds.A(), updateTimeMs: Date.now() }; return JSON.stringify(t); }, t; }(), Yr = /** @class */ function() { function e(t, e, n, r, i) { this.window = t, this.fn = e, this.persistenceKey = n, this._i = r, this.fi = null, this.di = null, this.si = null, this.wi = this.mi.bind(this), this.Ti = new bt(H), this.Ei = !1, /** * Captures WebStorage events that occur before `start()` is called. These * events are replayed once `WebStorageSharedClientState` is started. */ this.Ii = []; // Escape the special characters mentioned here: // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions var o = n.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); this.storage = this.window.localStorage, this.currentUser = i, this.Ai = jr(this.persistenceKey, this._i), this.Ri = /** Assembles the key for the current sequence number. */ function(t) { return "firestore_sequence_number_" + t; }(this.persistenceKey), this.Ti = this.Ti.ot(this._i, new Hr), this.gi = new RegExp("^firestore_clients_" + o + "_([^_]*)$"), this.Pi = new RegExp("^firestore_mutations_" + o + "_(\\d+)(?:_(.*))?$"), this.yi = new RegExp("^firestore_targets_" + o + "_(\\d+)$"), this.Vi = /** Assembles the key for the online state of the primary tab. */ function(t) { return "firestore_online_state_" + t; }(this.persistenceKey), // Rather than adding the storage observer during start(), we add the // storage observer during initialization. This ensures that we collect // events before other components populate their initial state (during their // respective start() calls). Otherwise, we might for example miss a // mutation that is added after LocalStore's start() processed the existing // mutations but before we observe WebStorage events. this.window.addEventListener("storage", this.wi); } /** Returns 'true' if WebStorage is available in the current environment. */ return e.Ln = function(t) { return !(!t || !t.localStorage); }, e.prototype.start = function() { return t.__awaiter(this, void 0, void 0, (function() { var e, n, r, i, o, s, u, a, c, h, f, l = this; return t.__generator(this, (function(t) { switch (t.label) { case 0: return [ 4 /*yield*/ , this.fi.pi() ]; case 1: for (e = t.sent(), n = 0, r = e; n < r.length; n++) (i = r[n]) !== this._i && (o = this.getItem(jr(this.persistenceKey, i))) && (s = Kr.ci(i, o)) && (this.Ti = this.Ti.ot(s.clientId, s)); for (this.bi(), (u = this.storage.getItem(this.Vi)) && (a = this.vi(u)) && this.Si(a), c = 0, h = this.Ii; c < h.length; c++) f = h[c], this.mi(f); return this.Ii = [], // Register a window unload hook to remove the client metadata entry from // WebStorage even if `shutdown()` was not called. this.window.addEventListener("unload", (function() { return l.Di(); })), this.Ei = !0, [ 2 /*return*/ ]; } })); })); }, e.prototype.oi = function(t) { this.setItem(this.Ri, JSON.stringify(t)); }, e.prototype.Ci = function() { return this.Ni(this.Ti); }, e.prototype.Fi = function(t) { var e = !1; return this.Ti.forEach((function(n, r) { r.activeTargetIds.has(t) && (e = !0); })), e; }, e.prototype.xi = function(t) { this.$i(t, "pending"); }, e.prototype.ki = function(t, e, n) { this.$i(t, e, n), // Once a final mutation result is observed by other clients, they no longer // access the mutation's metadata entry. Since WebStorage replays events // in order, it is safe to delete the entry right after updating it. this.Mi(t); }, e.prototype.Oi = function(t) { var e = "not-current"; // Lookup an existing query state if the target ID was already registered // by another tab if (this.Fi(t)) { var n = this.storage.getItem(zr(this.persistenceKey, t)); if (n) { var r = Wr.ci(t, n); r && (e = r.state); } } return this.Li.hi(t), this.bi(), e; }, e.prototype.Bi = function(t) { this.Li.li(t), this.bi(); }, e.prototype.qi = function(t) { return this.Li.activeTargetIds.has(t); }, e.prototype.Ui = function(t) { this.removeItem(zr(this.persistenceKey, t)); }, e.prototype.Qi = function(t, e, n) { this.Wi(t, e, n); }, e.prototype.ji = function(t, e, n) { var r = this; e.forEach((function(t) { r.Mi(t); })), this.currentUser = t, n.forEach((function(t) { r.xi(t); })); }, e.prototype.Ki = function(t) { this.Gi(t); }, e.prototype.Di = function() { this.Ei && (this.window.removeEventListener("storage", this.wi), this.removeItem(this.Ai), this.Ei = !1); }, e.prototype.getItem = function(t) { var e = this.storage.getItem(t); return l("SharedClientState", "READ", t, e), e; }, e.prototype.setItem = function(t, e) { l("SharedClientState", "SET", t, e), this.storage.setItem(t, e); }, e.prototype.removeItem = function(t) { l("SharedClientState", "REMOVE", t), this.storage.removeItem(t); }, e.prototype.mi = function(e) { var n = this, r = e; // Note: The function is typed to take Event to be interface-compatible with // `Window.addEventListener`. if (r.storageArea === this.storage) { if (l("SharedClientState", "EVENT", r.key, r.newValue), r.key === this.Ai) return void p("Received WebStorage notification for local change. Another client might have garbage-collected our state"); this.fn.Cs((function() { return t.__awaiter(n, void 0, void 0, (function() { var e, n, i, o, s, u; return t.__generator(this, (function(t) { if (this.Ei) { if (null !== r.key) if (this.gi.test(r.key)) { if (null == r.newValue) return e = this.zi(r.key), [ 2 /*return*/ , this.Hi(e, null) ]; if (n = this.Yi(r.key, r.newValue)) return [ 2 /*return*/ , this.Hi(n.clientId, n) ]; } else if (this.Pi.test(r.key)) { if (null !== r.newValue && (i = this.Ji(r.key, r.newValue))) return [ 2 /*return*/ , this.Xi(i) ]; } else if (this.yi.test(r.key)) { if (null !== r.newValue && (o = this.Zi(r.key, r.newValue))) return [ 2 /*return*/ , this.tr(o) ]; } else if (r.key === this.Vi) { if (null !== r.newValue && (s = this.vi(r.newValue))) return [ 2 /*return*/ , this.Si(s) ]; } else r.key === this.Ri && (u = function(t) { var e = qr.ai; if (null != t) try { var n = JSON.parse(t); g("number" == typeof n), e = n; } catch (t) { p("SharedClientState", "Failed to read sequence number from WebStorage", t); } return e; }(r.newValue)) !== qr.ai && this.si(u); } else this.Ii.push(r); return [ 2 /*return*/ ]; })); })); })); } }, Object.defineProperty(e.prototype, "Li", { get: function() { return this.Ti.get(this._i); }, enumerable: !1, configurable: !0 }), e.prototype.bi = function() { this.setItem(this.Ai, this.Li.ui()); }, e.prototype.$i = function(t, e, n) { var r = new Br(this.currentUser, t, e, n), i = Gr(this.persistenceKey, this.currentUser, t); this.setItem(i, r.ui()); }, e.prototype.Mi = function(t) { var e = Gr(this.persistenceKey, this.currentUser, t); this.removeItem(e); }, e.prototype.Gi = function(t) { var e = { clientId: this._i, onlineState: t }; this.storage.setItem(this.Vi, JSON.stringify(e)); }, e.prototype.Wi = function(t, e, n) { var r = zr(this.persistenceKey, t), i = new Wr(t, e, n); this.setItem(r, i.ui()); }, /** * Parses a client state key in WebStorage. Returns null if the key does not * match the expected key format. */ e.prototype.zi = function(t) { var e = this.gi.exec(t); return e ? e[1] : null; }, /** * Parses a client state in WebStorage. Returns 'null' if the value could not * be parsed. */ e.prototype.Yi = function(t, e) { var n = this.zi(t); return Kr.ci(n, e); }, /** * Parses a mutation batch state in WebStorage. Returns 'null' if the value * could not be parsed. */ e.prototype.Ji = function(t, e) { var n = this.Pi.exec(t), r = Number(n[1]), i = void 0 !== n[2] ? n[2] : null; return Br.ci(new Mr(i), r, e); }, /** * Parses a query target state from WebStorage. Returns 'null' if the value * could not be parsed. */ e.prototype.Zi = function(t, e) { var n = this.yi.exec(t), r = Number(n[1]); return Wr.ci(r, e); }, /** * Parses an online state from WebStorage. Returns 'null' if the value * could not be parsed. */ e.prototype.vi = function(t) { return Qr.ci(t); }, e.prototype.Xi = function(e) { return t.__awaiter(this, void 0, void 0, (function() { return t.__generator(this, (function(t) { return e.user.uid === this.currentUser.uid ? [ 2 /*return*/ , this.fi.er(e.batchId, e.state, e.error) ] : (l("SharedClientState", "Ignoring mutation for non-active user " + e.user.uid), [ 2 /*return*/ ]); })); })); }, e.prototype.tr = function(t) { return this.fi.nr(t.targetId, t.state, t.error); }, e.prototype.Hi = function(t, e) { var n = this, r = e ? this.Ti.ot(t, e) : this.Ti.remove(t), i = this.Ni(this.Ti), o = this.Ni(r), s = [], u = []; return o.forEach((function(t) { i.has(t) || s.push(t); })), i.forEach((function(t) { o.has(t) || u.push(t); })), this.fi.sr(s, u).then((function() { n.Ti = r; })); }, e.prototype.Si = function(t) { // We check whether the client that wrote this online state is still active // by comparing its client ID to the list of clients kept active in // IndexedDb. If a client does not update their IndexedDb client state // within 5 seconds, it is considered inactive and we don't emit an online // state event. this.Ti.get(t.clientId) && this.di(t.onlineState); }, e.prototype.Ni = function(t) { var e = Vt(); return t.forEach((function(t, n) { e = e.kt(n.activeTargetIds); })), e; }, e; }(), $r = /** @class */ function() { function t() { this.ir = new Hr, this.rr = {}, this.di = null, this.si = null; } return t.prototype.xi = function(t) { // No op. }, t.prototype.ki = function(t, e, n) { // No op. }, t.prototype.Oi = function(t) { return this.ir.hi(t), this.rr[t] || "not-current"; }, t.prototype.Qi = function(t, e, n) { this.rr[t] = e; }, t.prototype.Bi = function(t) { this.ir.li(t); }, t.prototype.qi = function(t) { return this.ir.activeTargetIds.has(t); }, t.prototype.Ui = function(t) { delete this.rr[t]; }, t.prototype.Ci = function() { return this.ir.activeTargetIds; }, t.prototype.Fi = function(t) { return this.ir.activeTargetIds.has(t); }, t.prototype.start = function() { return this.ir = new Hr, Promise.resolve(); }, t.prototype.ji = function(t, e, n) { // No op. }, t.prototype.Ki = function(t) { // No op. }, t.prototype.Di = function() {}, t.prototype.oi = function(t) {}, t; }(), Xr = /** @class */ function() { /** * @param batchId The unique ID of this mutation batch. * @param localWriteTime The original write time of this mutation. * @param baseMutations Mutations that are used to populate the base * values when this mutation is applied locally. This can be used to locally * overwrite values that are persisted in the remote document cache. Base * mutations are never sent to the backend. * @param mutations The user-provided mutations in this mutation batch. * User-provided mutations are applied both locally and remotely on the * backend. */ function t(t, e, n, r) { this.batchId = t, this.ar = e, this.baseMutations = n, this.mutations = r /** * Applies all the mutations in this MutationBatch to the specified document * to create a new remote document * * @param docKey The key of the document to apply mutations to. * @param maybeDoc The document to apply mutations to. * @param batchResult The result of applying the MutationBatch to the * backend. */; } return t.prototype.cr = function(t, e, n) { for (var r = n.ur, i = 0; i < this.mutations.length; i++) { var o = this.mutations[i]; o.key.isEqual(t) && (e = dn(o, e, r[i])); } return e; }, /** * Computes the local view of a document given all the mutations in this * batch. * * @param docKey The key of the document to apply mutations to. * @param maybeDoc The document to apply mutations to. */ t.prototype.hr = function(t, e) { // First, apply the base state. This allows us to apply non-idempotent // transform against a consistent set of values. for (var n = 0, r = this.baseMutations; n < r.length; n++) { var i = r[n]; i.key.isEqual(t) && (e = vn(i, e, e, this.ar)); } // Second, apply all user-provided mutations. for (var o = e, s = 0, u = this.mutations; s < u.length; s++) { var a = u[s]; a.key.isEqual(t) && (e = vn(a, e, o, this.ar)); } return e; }, /** * Computes the local view for all provided documents given the mutations in * this batch. */ t.prototype.lr = function(t) { var e = this, n = t; // TODO(mrschmidt): This implementation is O(n^2). If we apply the mutations // directly (as done in `applyToLocalView()`), we can reduce the complexity // to O(n). return this.mutations.forEach((function(r) { var i = e.hr(r.key, t.get(r.key)); i && (n = n.ot(r.key, i)); })), n; }, t.prototype.keys = function() { return this.mutations.reduce((function(t, e) { return t.add(e.key); }), Ot()); }, t.prototype.isEqual = function(t) { return this.batchId === t.batchId && Y(this.mutations, t.mutations, (function(t, e) { return gn(t, e); })) && Y(this.baseMutations, t.baseMutations, (function(t, e) { return gn(t, e); })); }, t; }(), Jr = /** @class */ function() { function t(t, e, n, /** * A pre-computed mapping from each mutated document to the resulting * version. */ r) { this.batch = t, this._r = e, this.ur = n, this.dr = r /** * Creates a new MutationBatchResult for the given batch and results. There * must be one result for each mutation in the batch. This static factory * caches a document=>version mapping (docVersions). */; } return t.from = function(e, n, r) { g(e.mutations.length === r.length); for (var i = kt, o = e.mutations, s = 0; s < o.length; s++) i = i.ot(o[s].key, r[s].version); return new t(e, n, r, i); }, t; }(), Zr = /** @class */ function() { function t() { // A mapping of document key to the new cache entry that should be written (or null if any // existing cache entry should be removed). this.wr = new it((function(t) { return t.toString(); }), (function(t, e) { return t.isEqual(e); })), this.mr = !1; } return Object.defineProperty(t.prototype, "readTime", { get: function() { return this.Tr; }, set: function(t) { this.Tr = t; }, enumerable: !1, configurable: !0 }), /** * Buffers a `RemoteDocumentCache.addEntry()` call. * * You can only modify documents that have already been retrieved via * `getEntry()/getEntries()` (enforced via IndexedDbs `apply()`). */ t.prototype.Er = function(t, e) { this.Ir(), this.readTime = e, this.wr.set(t.key, t); }, /** * Buffers a `RemoteDocumentCache.removeEntry()` call. * * You can only remove documents that have already been retrieved via * `getEntry()/getEntries()` (enforced via IndexedDbs `apply()`). */ t.prototype.Ar = function(t, e) { this.Ir(), e && (this.readTime = e), this.wr.set(t, null); }, /** * Looks up an entry in the cache. The buffered changes will first be checked, * and if no buffered change applies, this will forward to * `RemoteDocumentCache.getEntry()`. * * @param transaction The transaction in which to perform any persistence * operations. * @param documentKey The key of the entry to look up. * @return The cached Document or NoDocument entry, or null if we have nothing * cached. */ t.prototype.Rr = function(t, e) { this.Ir(); var n = this.wr.get(e); return void 0 !== n ? yr.resolve(n) : this.gr(t, e); }, /** * Looks up several entries in the cache, forwarding to * `RemoteDocumentCache.getEntry()`. * * @param transaction The transaction in which to perform any persistence * operations. * @param documentKeys The keys of the entries to look up. * @return A map of cached `Document`s or `NoDocument`s, indexed by key. If an * entry cannot be found, the corresponding key will be mapped to a null * value. */ t.prototype.getEntries = function(t, e) { return this.Pr(t, e); }, /** * Applies buffered changes to the underlying RemoteDocumentCache, using * the provided transaction. */ t.prototype.apply = function(t) { return this.Ir(), this.mr = !0, this.yr(t); }, /** Helper to assert this.changes is not null */ t.prototype.Ir = function() {}, t; }(), ti = "The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.", ei = /** @class */ function() { function t() { this.Vr = []; } return t.prototype.pr = function(t) { this.Vr.push(t); }, t.prototype.br = function() { this.Vr.forEach((function(t) { return t(); })); }, t; }(), ni = /** @class */ function() { function t(t, e, n) { this.vr = t, this.Sr = e, this.Dr = n /** * Get the local view of the document identified by `key`. * * @return Local view of the document or null if we don't have any cached * state for it. */; } return t.prototype.Cr = function(t, e) { var n = this; return this.Sr.Nr(t, e).next((function(r) { return n.Fr(t, e, r); })); }, /** Internal version of `getDocument` that allows reusing batches. */ t.prototype.Fr = function(t, e, n) { return this.vr.Rr(t, e).next((function(t) { for (var r = 0, i = n; r < i.length; r++) { t = i[r].hr(e, t); } return t; })); }, // Returns the view of the given `docs` as they would appear after applying // all mutations in the given `batches`. t.prototype.$r = function(t, e, n) { var r = Dt(); return e.forEach((function(t, e) { for (var i = 0, o = n; i < o.length; i++) { e = o[i].hr(t, e); } r = r.ot(t, e); })), r; }, /** * Gets the local view of the documents identified by `keys`. * * If we don't have cached state for a document in `keys`, a NoDocument will * be stored for that key in the resulting set. */ t.prototype.kr = function(t, e) { var n = this; return this.vr.getEntries(t, e).next((function(e) { return n.Mr(t, e); })); }, /** * Similar to `getDocuments`, but creates the local view from the given * `baseDocs` without retrieving documents from the local store. */ t.prototype.Mr = function(t, e) { var n = this; return this.Sr.Or(t, e).next((function(r) { var i = n.$r(t, e, r), o = St(); return i.forEach((function(t, e) { // TODO(http://b/32275378): Don't conflate missing / deleted. e || (e = new Rn(t, st.min())), o = o.ot(t, e); })), o; })); }, /** * Performs a query against the local view of all documents. * * @param transaction The persistence transaction. * @param query The query to match documents against. * @param sinceReadTime If not set to SnapshotVersion.min(), return only * documents that have been read since this snapshot version (exclusive). */ t.prototype.Lr = function(t, e, n) { /** * Returns whether the query matches a single document by path (rather than a * collection). */ return function(t) { return A.F(t.path) && null === t.collectionGroup && 0 === t.filters.length; }(e) ? this.Br(t, e.path) : jn(e) ? this.qr(t, e, n) : this.Ur(t, e, n); }, t.prototype.Br = function(t, e) { // Just do a simple document lookup. return this.Cr(t, new A(e)).next((function(t) { var e = Lt(); return t instanceof kn && (e = e.ot(t.key, t)), e; })); }, t.prototype.qr = function(t, e, n) { var r = this, i = e.collectionGroup, o = Lt(); return this.Dr.Qr(t, i).next((function(s) { return yr.forEach(s, (function(s) { var u = function(t, e) { return new Pn(e, /*collectionGroup=*/ null, t.on.slice(), t.filters.slice(), t.limit, t.an, t.startAt, t.endAt); }(e, s.child(i)); return r.Ur(t, u, n).next((function(t) { t.forEach((function(t, e) { o = o.ot(t, e); })); })); })).next((function() { return o; })); })); }, t.prototype.Ur = function(t, e, n) { var r, i, o = this; // Query the remote documents and overlay mutations. return this.vr.Lr(t, e, n).next((function(n) { return r = n, o.Sr.Wr(t, e); })).next((function(e) { return i = e, o.jr(t, i, r).next((function(t) { r = t; for (var e = 0, n = i; e < n.length; e++) for (var o = n[e], s = 0, u = o.mutations; s < u.length; s++) { var a = u[s], c = a.key, h = r.get(c), f = vn(a, h, h, o.ar); r = f instanceof kn ? r.ot(c, f) : r.remove(c); } })); })).next((function() { // Finally, filter out any documents that don't actually match // the query. return r.forEach((function(t, n) { $n(e, n) || (r = r.remove(t)); })), r; })); }, t.prototype.jr = function(t, e, n) { for (var r = Ot(), i = 0, o = e; i < o.length; i++) for (var s = 0, u = o[i].mutations; s < u.length; s++) { var a = u[s]; a instanceof _n && null === n.get(a.key) && (r = r.add(a.key)); } var c = n; return this.vr.getEntries(t, r).next((function(t) { return t.forEach((function(t, e) { null !== e && e instanceof kn && (c = c.ot(t, e)); })), c; })); }, t; }(), ri = /** @class */ function() { function t(t, e, n, r) { this.targetId = t, this.fromCache = e, this.Kr = n, this.Gr = r; } return t.zr = function(e, n) { for (var r = Ot(), i = Ot(), o = 0, s = n.docChanges; o < s.length; o++) { var u = s[o]; switch (u.type) { case 0 /* Added */ : r = r.add(u.doc.key); break; case 1 /* Removed */ : i = i.add(u.doc.key); // do nothing } } return new t(e, n.fromCache, r, i); }, t; }(); /** * Holds the state of a query target, including its target ID and whether the * target is 'not-current', 'current' or 'rejected'. */ // Visible for testing /** * @license * Copyright 2018 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ function ii(t, e) { var n = t[0], r = t[1], i = e[0], o = e[1], s = H(n, i); return 0 === s ? H(r, o) : s; } /** * Used to calculate the nth sequence number. Keeps a rolling buffer of the * lowest n values passed to `addElement`, and finally reports the largest of * them in `maxValue`. */ var oi = /** @class */ function() { function t(t) { this.Hr = t, this.buffer = new Tt(ii), this.Yr = 0; } return t.prototype.Jr = function() { return ++this.Yr; }, t.prototype.Xr = function(t) { var e = [ t, this.Jr() ]; if (this.buffer.size < this.Hr) this.buffer = this.buffer.add(e); else { var n = this.buffer.last(); ii(e, n) < 0 && (this.buffer = this.buffer.delete(n).add(e)); } }, Object.defineProperty(t.prototype, "maxValue", { get: function() { // Guaranteed to be non-empty. If we decide we are not collecting any // sequence numbers, nthSequenceNumber below short-circuits. If we have // decided that we are collecting n sequence numbers, it's because n is some // percentage of the existing sequence numbers. That means we should never // be in a situation where we are collecting sequence numbers but don't // actually have any. return this.buffer.last()[0]; }, enumerable: !1, configurable: !0 }), t; }(), si = { Zr: !1, eo: 0, no: 0, so: 0 }, ui = /** @class */ function() { function t( // When we attempt to collect, we will only do so if the cache size is greater than this // threshold. Passing `COLLECTION_DISABLED` here will cause collection to always be skipped. t, // The percentage of sequence numbers that we will attempt to collect e, // A cap on the total number of sequence numbers that will be collected. This prevents // us from collecting a huge number of sequence numbers if the cache has grown very large. n) { this.io = t, this.ro = e, this.oo = n; } return t.ao = function(e) { return new t(e, t.co, t.uo); }, t; }(); ui.ho = -1, ui.lo = 1048576, ui._o = 41943040, ui.co = 10, ui.uo = 1e3, ui.fo = new ui(ui._o, ui.co, ui.uo), ui.do = new ui(ui.ho, 0, 0); /** * This class is responsible for the scheduling of LRU garbage collection. It handles checking * whether or not GC is enabled, as well as which delay to use before the next run. */ var ai = /** @class */ function() { function e(t, e) { this.wo = t, this.cs = e, this.mo = !1, this.To = null; } return e.prototype.start = function(t) { this.wo.params.io !== ui.ho && this.Eo(t); }, e.prototype.stop = function() { this.To && (this.To.cancel(), this.To = null); }, Object.defineProperty(e.prototype, "Ei", { get: function() { return null !== this.To; }, enumerable: !1, configurable: !0 }), e.prototype.Eo = function(e) { var n = this, r = this.mo ? 3e5 : 6e4; l("LruGarbageCollector", "Garbage collection scheduled in " + r + "ms"), this.To = this.cs.yn("lru_garbage_collection" /* LruGarbageCollection */ , r, (function() { return t.__awaiter(n, void 0, void 0, (function() { var n; return t.__generator(this, (function(t) { switch (t.label) { case 0: this.To = null, this.mo = !0, t.label = 1; case 1: return t.trys.push([ 1, 3, , 7 ]), [ 4 /*yield*/ , e.Io(this.wo) ]; case 2: return t.sent(), [ 3 /*break*/ , 7 ]; case 3: return _r(n = t.sent()) ? (l("LruGarbageCollector", "Ignoring IndexedDB error during garbage collection: ", n), [ 3 /*break*/ , 6 ]) : [ 3 /*break*/ , 4 ]; case 4: return [ 4 /*yield*/ , Do(n) ]; case 5: t.sent(), t.label = 6; case 6: return [ 3 /*break*/ , 7 ]; case 7: return [ 4 /*yield*/ , this.Eo(e) ]; case 8: return t.sent(), [ 2 /*return*/ ]; } })); })); })); }, e; }(), ci = /** @class */ function() { function t(t, e) { this.Ao = t, this.params = e /** Given a percentile of target to collect, returns the number of targets to collect. */; } return t.prototype.Ro = function(t, e) { return this.Ao.Po(t).next((function(t) { return Math.floor(e / 100 * t); })); }, /** Returns the nth sequence number, counting in order from the smallest. */ t.prototype.yo = function(t, e) { var n = this; if (0 === e) return yr.resolve(qr.ai); var r = new oi(e); return this.Ao.Ce(t, (function(t) { return r.Xr(t.sequenceNumber); })).next((function() { return n.Ao.Vo(t, (function(t) { return r.Xr(t); })); })).next((function() { return r.maxValue; })); }, /** * Removes targets with a sequence number equal to or less than the given upper bound, and removes * document associations with those targets. */ t.prototype.po = function(t, e, n) { return this.Ao.po(t, e, n); }, /** * Removes documents that have a sequence number equal to or less than the upper bound and are not * otherwise pinned. */ t.prototype.bo = function(t, e) { return this.Ao.bo(t, e); }, t.prototype.vo = function(t, e) { var n = this; return this.params.io === ui.ho ? (l("LruGarbageCollector", "Garbage collection skipped; disabled"), yr.resolve(si)) : this.So(t).next((function(r) { return r < n.params.io ? (l("LruGarbageCollector", "Garbage collection skipped; Cache size " + r + " is lower than threshold " + n.params.io), si) : n.Do(t, e); })); }, t.prototype.So = function(t) { return this.Ao.So(t); }, t.prototype.Do = function(t, e) { var r, i, o, s, u, a, c, h = this, p = Date.now(); return this.Ro(t, this.params.ro).next((function(e) { // Cap at the configured max return e > h.params.oo ? (l("LruGarbageCollector", "Capping sequence numbers to collect down to the maximum of " + h.params.oo + " from " + e), i = h.params.oo) : i = e, s = Date.now(), h.yo(t, i); })).next((function(n) { return r = n, u = Date.now(), h.po(t, r, e); })).next((function(e) { return o = e, a = Date.now(), h.bo(t, r); })).next((function(t) { return c = Date.now(), f() <= n.LogLevel.DEBUG && l("LruGarbageCollector", "LRU Garbage Collection\n\tCounted targets in " + (s - p) + "ms\n\tDetermined least recently used " + i + " in " + (u - s) + "ms\n\tRemoved " + o + " targets in " + (a - u) + "ms\n\tRemoved " + t + " documents in " + (c - a) + "ms\nTotal Duration: " + (c - p) + "ms"), yr.resolve({ Zr: !0, eo: i, no: o, so: t }); })); }, t; }(); /** Implements the steps for LRU garbage collection. */ /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Encodes a resource path into a IndexedDb-compatible string form. */ function hi(t) { for (var e = "", n = 0; n < t.length; n++) e.length > 0 && (e = li(e)), e = fi(t.get(n), e); return li(e); } /** Encodes a single segment of a resource path into the given result */ function fi(t, e) { for (var n = e, r = t.length, i = 0; i < r; i++) { var o = t.charAt(i); switch (o) { case "\0": n += ""; break; case "": n += ""; break; default: n += o; } } return n; } /** Encodes a path separator into the given result */ function li(t) { return t + ""; } /** * Decodes the given IndexedDb-compatible string form of a resource path into * a ResourcePath instance. Note that this method is not suitable for use with * decoding resource names from the server; those are One Platform format * strings. */ function pi(t) { // Event the empty path must encode as a path of at least length 2. A path // with exactly 2 must be the empty path. var e = t.length; if (g(e >= 2), 2 === e) return g("" === t.charAt(0) && "" === t.charAt(1)), E.P(); // Escape characters cannot exist past the second-to-last position in the // source value. for (var n = e - 2, r = [], i = "", o = 0; o < e; ) { // The last two characters of a valid encoded path must be a separator, so // there must be an end to this segment. var s = t.indexOf("", o); switch ((s < 0 || s > n) && y(), t.charAt(s + 1)) { case "": var u = t.substring(o, s), a = void 0; 0 === i.length ? // Avoid copying for the common case of a segment that excludes \0 // and \001 a = u : (a = i += u, i = ""), r.push(a); break; case "": i += t.substring(o, s), i += "\0"; break; case "": // The escape character can be used in the output to encode itself. i += t.substring(o, s + 1); break; default: y(); } o = s + 2; } return new E(r); } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** Serializer for values stored in the LocalStore. */ var di = function(t) { this.Co = t; }; /** Decodes a remote document from storage locally to a Document. */ function vi(t, e) { if (e.document) return function(t, e, n) { var r = Se(t, e.name), i = Ee(e.updateTime), o = new Sn({ mapValue: { fields: e.fields } }); return new kn(r, i, o, { hasCommittedMutations: !!n }); }(t.Co, e.document, !!e.hasCommittedMutations); if (e.noDocument) { var n = A.$(e.noDocument.path), r = _i(e.noDocument.readTime); return new Rn(n, r, { hasCommittedMutations: !!e.hasCommittedMutations }); } if (e.unknownDocument) { var i = A.$(e.unknownDocument.path), o = _i(e.unknownDocument.version); return new On(i, o); } return y(); } /** Encodes a document for storage locally. */ function yi(t, e, n) { var r = gi(n), i = e.key.path.h().A(); if (e instanceof kn) { var o = function(t, e) { return { name: Ae(t, e.key), fields: e.rn().mapValue.fields, updateTime: _e(t, e.version.Z()) }; }(t.Co, e), s = e.hasCommittedMutations; return new Ki( /* unknownDocument= */ null, /* noDocument= */ null, o, s, r, i); } if (e instanceof Rn) { var u = e.key.path.A(), a = wi(e.version), c = e.hasCommittedMutations; return new Ki( /* unknownDocument= */ null, new Bi(u, a), /* document= */ null, c, r, i); } if (e instanceof On) { var h = e.key.path.A(), f = wi(e.version); return new Ki(new Wi(h, f), /* noDocument= */ null, /* document= */ null, /* hasCommittedMutations= */ !0, r, i); } return y(); } function gi(t) { var e = t.Z(); return [ e.seconds, e.nanoseconds ]; } function mi(t) { var e = new ot(t[0], t[1]); return st.J(e); } function wi(t) { var e = t.Z(); return new Mi(e.seconds, e.nanoseconds); } function _i(t) { var e = new ot(t.seconds, t.nanoseconds); return st.J(e); } /** Encodes a batch of mutations into a DbMutationBatch for local storage. */ /** Decodes a DbMutationBatch into a MutationBatch */ function bi(t, e) { var n = (e.baseMutations || []).map((function(e) { return Pe(t.Co, e); })), r = e.mutations.map((function(e) { return Pe(t.Co, e); })), i = ot.fromMillis(e.localWriteTimeMs); return new Xr(e.batchId, i, n, r); } /** Decodes a DbTarget into TargetData */ function Ii(t) { var e, n, r = _i(t.readTime), i = void 0 !== t.lastLimboFreeSnapshotVersion ? _i(t.lastLimboFreeSnapshotVersion) : st.min(); return void 0 !== t.query.documents ? (g(1 === (n = t.query).documents.length), e = zn(Un(xe(n.documents[0])))) : e = Ce(t.query), new gt(e, t.targetId, 0 /* Listen */ , t.lastListenSequenceNumber, r, i, X.fromBase64String(t.resumeToken)) /** Encodes TargetData into a DbTarget for storage locally. */; } function Ei(t, e) { var n, r = wi(e.nt), i = wi(e.lastLimboFreeSnapshotVersion); n = dt(e.target) ? Ve(t.Co, e.target) : Ue(t.Co, e.target); // We can't store the resumeToken as a ByteString in IndexedDb, so we // convert it to a base64 string for storage. var o = e.resumeToken.toBase64(); // lastListenSequenceNumber is always 0 until we do real GC. return new Hi(e.targetId, lt(e.target), r, o, e.sequenceNumber, i, n); } /** * A helper function for figuring out what kind of query has been stored. */ /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** A mutation queue for a specific user, backed by IndexedDB. */ var Ti = /** @class */ function() { function t( /** * The normalized userId (e.g. null UID => "" userId) used to store / * retrieve mutations. */ t, e, n, r) { this.userId = t, this.serializer = e, this.Dr = n, this.No = r, /** * Caches the document keys for pending mutation batches. If the mutation * has been removed from IndexedDb, the cached value may continue to * be used to retrieve the batch's document keys. To remove a cached value * locally, `removeCachedMutationKeys()` should be invoked either directly * or through `removeMutationBatches()`. * * With multi-tab, when the primary client acknowledges or rejects a mutation, * this cache is used by secondary clients to invalidate the local * view of the documents that were previously affected by the mutation. */ // PORTING NOTE: Multi-tab only. this.Fo = {} /** * Creates a new mutation queue for the given user. * @param user The user for which to create a mutation queue. * @param serializer The serializer to use when persisting to IndexedDb. */; } return t.xo = function(e, n, r, i) { // TODO(mcg): Figure out what constraints there are on userIDs // In particular, are there any reserved characters? are empty ids allowed? // For the moment store these together in the same mutations table assuming // that empty userIDs aren't allowed. return g("" !== e.uid), new t(e.Zs() ? e.uid : "", n, r, i); }, t.prototype.$o = function(t) { var e = !0, n = IDBKeyRange.bound([ this.userId, Number.NEGATIVE_INFINITY ], [ this.userId, Number.POSITIVE_INFINITY ]); return Si(t).rs({ index: Gi.userMutationsIndex, range: n }, (function(t, n, r) { e = !1, r.done(); })).next((function() { return e; })); }, t.prototype.ko = function(t, e, n, r) { var i = this, o = Di(t), s = Si(t); // The IndexedDb implementation in Chrome (and Firefox) does not handle // compound indices that include auto-generated keys correctly. To ensure // that the index entry is added correctly in all browsers, we perform two // writes: The first write is used to retrieve the next auto-generated Batch // ID, and the second write populates the index and stores the actual // mutation batch. // See: https://bugs.chromium.org/p/chromium/issues/detail?id=701972 // We write an empty object to obtain key // eslint-disable-next-line @typescript-eslint/no-explicit-any return s.add({}).next((function(u) { g("number" == typeof u); for (var a = new Xr(u, e, n, r), c = function(t, e, n) { var r = n.baseMutations.map((function(e) { return Oe(t.Co, e); })), i = n.mutations.map((function(e) { return Oe(t.Co, e); })); return new Gi(e, n.batchId, n.ar.toMillis(), r, i); }(i.serializer, i.userId, a), h = [], f = new Tt((function(t, e) { return H(t.R(), e.R()); })), l = 0, p = r; l < p.length; l++) { var d = p[l], v = zi.key(i.userId, d.key.path, u); f = f.add(d.key.path.h()), h.push(s.put(c)), h.push(o.put(v, zi.PLACEHOLDER)); } return f.forEach((function(e) { h.push(i.Dr.Mo(t, e)); })), t.pr((function() { i.Fo[u] = a.keys(); })), yr.$n(h).next((function() { return a; })); })); }, t.prototype.Oo = function(t, e) { var n = this; return Si(t).get(e).next((function(t) { return t ? (g(t.userId === n.userId), bi(n.serializer, t)) : null; })); }, /** * Returns the document keys for the mutation batch with the given batchId. * For primary clients, this method returns `null` after * `removeMutationBatches()` has been called. Secondary clients return a * cached result until `removeCachedMutationKeys()` is invoked. */ // PORTING NOTE: Multi-tab only. t.prototype.Lo = function(t, e) { var n = this; return this.Fo[e] ? yr.resolve(this.Fo[e]) : this.Oo(t, e).next((function(t) { if (t) { var r = t.keys(); return n.Fo[e] = r, r; } return null; })); }, t.prototype.Bo = function(t, e) { var n = this, r = e + 1, i = IDBKeyRange.lowerBound([ this.userId, r ]), o = null; return Si(t).rs({ index: Gi.userMutationsIndex, range: i }, (function(t, e, i) { e.userId === n.userId && (g(e.batchId >= r), o = bi(n.serializer, e)), i.done(); })).next((function() { return o; })); }, t.prototype.qo = function(t) { var e = IDBKeyRange.upperBound([ this.userId, Number.POSITIVE_INFINITY ]), n = -1; return Si(t).rs({ index: Gi.userMutationsIndex, range: e, reverse: !0 }, (function(t, e, r) { n = e.batchId, r.done(); })).next((function() { return n; })); }, t.prototype.Uo = function(t) { var e = this, n = IDBKeyRange.bound([ this.userId, -1 ], [ this.userId, Number.POSITIVE_INFINITY ]); return Si(t).ts(Gi.userMutationsIndex, n).next((function(t) { return t.map((function(t) { return bi(e.serializer, t); })); })); }, t.prototype.Nr = function(t, e) { var n = this, r = zi.prefixForPath(this.userId, e.path), i = IDBKeyRange.lowerBound(r), o = []; // Scan the document-mutation index starting with a prefix starting with // the given documentKey. return Di(t).rs({ range: i }, (function(r, i, s) { var u = r[0], a = r[1], c = r[2], h = pi(a); // Only consider rows matching exactly the specific key of // interest. Note that because we order by path first, and we // order terminators before path separators, we'll encounter all // the index rows for documentKey contiguously. In particular, all // the rows for documentKey will occur before any rows for // documents nested in a subcollection beneath documentKey so we // can stop as soon as we hit any such row. if (u === n.userId && e.path.isEqual(h)) // Look up the mutation batch in the store. return Si(t).get(c).next((function(t) { if (!t) throw y(); g(t.userId === n.userId), o.push(bi(n.serializer, t)); })); s.done(); })).next((function() { return o; })); }, t.prototype.Or = function(t, e) { var n = this, r = new Tt(H), i = []; return e.forEach((function(e) { var o = zi.prefixForPath(n.userId, e.path), s = IDBKeyRange.lowerBound(o), u = Di(t).rs({ range: s }, (function(t, i, o) { var s = t[0], u = t[1], a = t[2], c = pi(u); // Only consider rows matching exactly the specific key of // interest. Note that because we order by path first, and we // order terminators before path separators, we'll encounter all // the index rows for documentKey contiguously. In particular, all // the rows for documentKey will occur before any rows for // documents nested in a subcollection beneath documentKey so we // can stop as soon as we hit any such row. s === n.userId && e.path.isEqual(c) ? r = r.add(a) : o.done(); })); i.push(u); })), yr.$n(i).next((function() { return n.Qo(t, r); })); }, t.prototype.Wr = function(t, e) { var n = this, r = e.path, i = r.length + 1, o = zi.prefixForPath(this.userId, r), s = IDBKeyRange.lowerBound(o), u = new Tt(H); return Di(t).rs({ range: s }, (function(t, e, o) { var s = t[0], a = t[1], c = t[2], h = pi(a); s === n.userId && r.T(h) ? // Rows with document keys more than one segment longer than the // query path can't be matches. For example, a query on 'rooms' // can't match the document /rooms/abc/messages/xyx. // TODO(mcg): we'll need a different scanner when we implement // ancestor queries. h.length === i && (u = u.add(c)) : o.done(); })).next((function() { return n.Qo(t, u); })); }, t.prototype.Qo = function(t, e) { var n = this, r = [], i = []; // TODO(rockwood): Implement this using iterate. return e.forEach((function(e) { i.push(Si(t).get(e).next((function(t) { if (null === t) throw y(); g(t.userId === n.userId), r.push(bi(n.serializer, t)); }))); })), yr.$n(i).next((function() { return r; })); }, t.prototype.Wo = function(t, e) { var n = this; return Ai(t.jo, this.userId, e).next((function(r) { return t.pr((function() { n.Ko(e.batchId); })), yr.forEach(r, (function(e) { return n.No.Go(t, e); })); })); }, /** * Clears the cached keys for a mutation batch. This method should be * called by secondary clients after they process mutation updates. * * Note that this method does not have to be called from primary clients as * the corresponding cache entries are cleared when an acknowledged or * rejected batch is removed from the mutation queue. */ // PORTING NOTE: Multi-tab only t.prototype.Ko = function(t) { delete this.Fo[t]; }, t.prototype.zo = function(t) { var e = this; return this.$o(t).next((function(n) { if (!n) return yr.resolve(); // Verify that there are no entries in the documentMutations index if // the queue is empty. var r = IDBKeyRange.lowerBound(zi.prefixForUser(e.userId)), i = []; return Di(t).rs({ range: r }, (function(t, n, r) { if (t[0] === e.userId) { var o = pi(t[1]); i.push(o); } else r.done(); })).next((function() { g(0 === i.length); })); })); }, t.prototype.Ho = function(t, e) { return Ni(t, this.userId, e); }, // PORTING NOTE: Multi-tab only (state is held in memory in other clients). /** Returns the mutation queue's metadata from IndexedDb. */ t.prototype.Yo = function(t) { var e = this; return xi(t).get(this.userId).next((function(t) { return t || new ji(e.userId, -1, /*lastStreamToken=*/ ""); })); }, t; }(); /** * @return true if the mutation queue for the given user contains a pending * mutation for the given key. */ function Ni(t, e, n) { var r = zi.prefixForPath(e, n.path), i = r[1], o = IDBKeyRange.lowerBound(r), s = !1; return Di(t).rs({ range: o, ss: !0 }, (function(t, n, r) { var o = t[0], u = t[1]; t[2]; o === e && u === i && (s = !0), r.done(); })).next((function() { return s; })); } /** Returns true if any mutation queue contains the given document. */ /** * Delete a mutation batch and the associated document mutations. * @return A PersistencePromise of the document mutations that were removed. */ function Ai(t, e, n) { var r = t.store(Gi.store), i = t.store(zi.store), o = [], s = IDBKeyRange.only(n.batchId), u = 0, a = r.rs({ range: s }, (function(t, e, n) { return u++, n.delete(); })); o.push(a.next((function() { g(1 === u); }))); for (var c = [], h = 0, f = n.mutations; h < f.length; h++) { var l = f[h], p = zi.key(e, l.key.path, n.batchId); o.push(i.delete(p)), c.push(l.key); } return yr.$n(o).next((function() { return c; })); } /** * Helper to get a typed SimpleDbStore for the mutations object store. */ function Si(t) { return ho.Qn(t, Gi.store); } /** * Helper to get a typed SimpleDbStore for the mutationQueues object store. */ function Di(t) { return ho.Qn(t, zi.store); } /** * Helper to get a typed SimpleDbStore for the mutationQueues object store. */ function xi(t) { return ho.Qn(t, ji.store); } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * The RemoteDocumentCache for IndexedDb. To construct, invoke * `newIndexedDbRemoteDocumentCache()`. */ var Li = /** @class */ function() { /** * @param serializer The document serializer. * @param indexManager The query indexes that need to be maintained. */ function t(t, e) { this.serializer = t, this.Dr = e /** * Adds the supplied entries to the cache. * * All calls of `addEntry` are required to go through the RemoteDocumentChangeBuffer * returned by `newChangeBuffer()` to ensure proper accounting of metadata. */; } return t.prototype.Er = function(t, e, n) { return Oi(t).put(Pi(e), n); }, /** * Removes a document from the cache. * * All calls of `removeEntry` are required to go through the RemoteDocumentChangeBuffer * returned by `newChangeBuffer()` to ensure proper accounting of metadata. */ t.prototype.Ar = function(t, e) { var n = Oi(t), r = Pi(e); return n.delete(r); }, /** * Updates the current cache size. * * Callers to `addEntry()` and `removeEntry()` *must* call this afterwards to update the * cache's metadata. */ t.prototype.updateMetadata = function(t, e) { var n = this; return this.getMetadata(t).next((function(r) { return r.byteSize += e, n.Jo(t, r); })); }, t.prototype.Rr = function(t, e) { var n = this; return Oi(t).get(Pi(e)).next((function(t) { return n.Xo(t); })); }, /** * Looks up an entry in the cache. * * @param documentKey The key of the entry to look up. * @return The cached MaybeDocument entry and its size, or null if we have nothing cached. */ t.prototype.Zo = function(t, e) { var n = this; return Oi(t).get(Pi(e)).next((function(t) { var e = n.Xo(t); return e ? { ta: e, size: Vi(t) } : null; })); }, t.prototype.getEntries = function(t, e) { var n = this, r = Dt(); return this.ea(t, e, (function(t, e) { var i = n.Xo(e); r = r.ot(t, i); })).next((function() { return r; })); }, /** * Looks up several entries in the cache. * * @param documentKeys The set of keys entries to look up. * @return A map of MaybeDocuments indexed by key (if a document cannot be * found, the key will be mapped to null) and a map of sizes indexed by * key (zero if the key cannot be found). */ t.prototype.na = function(t, e) { var n = this, r = Dt(), i = new bt(A.i); return this.ea(t, e, (function(t, e) { var o = n.Xo(e); o ? (r = r.ot(t, o), i = i.ot(t, Vi(e))) : (r = r.ot(t, null), i = i.ot(t, 0)); })).next((function() { return { sa: r, ia: i }; })); }, t.prototype.ea = function(t, e, n) { if (e.m()) return yr.resolve(); var r = IDBKeyRange.bound(e.first().path.A(), e.last().path.A()), i = e._t(), o = i.It(); return Oi(t).rs({ range: r }, (function(t, e, r) { // Go through keys not found in cache. for (var s = A.$(t); o && A.i(o, s) < 0; ) n(o, null), o = i.It(); o && o.isEqual(s) && ( // Key found in cache. n(o, e), o = i.At() ? i.It() : null), // Skip to the next key (if there is one). o ? r.Xn(o.path.A()) : r.done(); })).next((function() { // The rest of the keys are not in the cache. One case where `iterate` // above won't go through them is when the cache is empty. for (;o; ) n(o, null), o = i.At() ? i.It() : null; })); }, t.prototype.Lr = function(t, e, n) { var r = this, i = Lt(), o = e.path.length + 1, s = {}; if (n.isEqual(st.min())) { // Documents are ordered by key, so we can use a prefix scan to narrow // down the documents we need to match the query against. var u = e.path.A(); s.range = IDBKeyRange.lowerBound(u); } else { // Execute an index-free query and filter by read time. This is safe // since all document changes to queries that have a // lastLimboFreeSnapshotVersion (`sinceReadTime`) have a read time set. var a = e.path.A(), c = gi(n); s.range = IDBKeyRange.lowerBound([ a, c ], /* open= */ !0), s.index = Ki.collectionReadTimeIndex; } return Oi(t).rs(s, (function(t, n, s) { // The query is actually returning any path that starts with the query // path prefix which may include documents in subcollections. For // example, a query on 'rooms' will return rooms/abc/messages/xyx but we // shouldn't match it. Fix this by discarding rows with document keys // more than one segment longer than the query path. if (t.length === o) { var u = vi(r.serializer, n); e.path.T(u.key.path) ? u instanceof kn && $n(e, u) && (i = i.ot(u.key, u)) : s.done(); } })).next((function() { return i; })); }, t.prototype.ra = function(t) { return new ki(this, !!t && t.oa); }, t.prototype.aa = function(t) { return this.getMetadata(t).next((function(t) { return t.byteSize; })); }, t.prototype.getMetadata = function(t) { return Ri(t).get(Qi.key).next((function(t) { return g(!!t), t; })); }, t.prototype.Jo = function(t, e) { return Ri(t).put(Qi.key, e); }, /** * Decodes `remoteDoc` and returns the document (or null, if the document * corresponds to the format used for sentinel deletes). */ t.prototype.Xo = function(t) { if (t) { var e = vi(this.serializer, t); return e instanceof Rn && e.version.isEqual(st.min()) ? null : e; } return null; }, t; }(), ki = /** @class */ function(e) { /** * @param documentCache The IndexedDbRemoteDocumentCache to apply the changes to. * @param trackRemovals Whether to create sentinel deletes that can be tracked by * `getNewDocumentChanges()`. */ function n(t, n) { var r = this; return (r = e.call(this) || this).ca = t, r.oa = n, // A map of document sizes prior to applying the changes in this buffer. r.ua = new it((function(t) { return t.toString(); }), (function(t, e) { return t.isEqual(e); })), r; } return t.__extends(n, e), n.prototype.yr = function(t) { var e = this, n = [], r = 0, i = new Tt((function(t, e) { return H(t.R(), e.R()); })); return this.wr.forEach((function(o, s) { var u = e.ua.get(o); if (s) { var a = yi(e.ca.serializer, s, e.readTime); i = i.add(o.path.h()); var c = Vi(a); r += c - u, n.push(e.ca.Er(t, o, a)); } else if (r -= u, e.oa) { // In order to track removals, we store a "sentinel delete" in the // RemoteDocumentCache. This entry is represented by a NoDocument // with a version of 0 and ignored by `maybeDecodeDocument()` but // preserved in `getNewDocumentChanges()`. var h = yi(e.ca.serializer, new Rn(o, st.min()), e.readTime); n.push(e.ca.Er(t, o, h)); } else n.push(e.ca.Ar(t, o)); })), i.forEach((function(r) { n.push(e.ca.Dr.Mo(t, r)); })), n.push(this.ca.updateMetadata(t, r)), yr.$n(n); }, n.prototype.gr = function(t, e) { var n = this; // Record the size of everything we load from the cache so we can compute a delta later. return this.ca.Zo(t, e).next((function(t) { return null === t ? (n.ua.set(e, 0), null) : (n.ua.set(e, t.size), t.ta); })); }, n.prototype.Pr = function(t, e) { var n = this; // Record the size of everything we load from the cache so we can compute // a delta later. return this.ca.na(t, e).next((function(t) { var e = t.sa; // Note: `getAllFromCache` returns two maps instead of a single map from // keys to `DocumentSizeEntry`s. This is to allow returning the // `NullableMaybeDocumentMap` directly, without a conversion. return t.ia.forEach((function(t, e) { n.ua.set(t, e); })), e; })); }, n; }(Zr); /** * Creates a new IndexedDbRemoteDocumentCache. * * @param serializer The document serializer. * @param indexManager The query indexes that need to be maintained. */ /** * Handles the details of adding and updating documents in the IndexedDbRemoteDocumentCache. * * Unlike the MemoryRemoteDocumentChangeBuffer, the IndexedDb implementation computes the size * delta for all submitted changes. This avoids having to re-read all documents from IndexedDb * when we apply the changes. */ function Ri(t) { return ho.Qn(t, Qi.store); } /** * Helper to get a typed SimpleDbStore for the remoteDocuments object store. */ function Oi(t) { return ho.Qn(t, Ki.store); } function Pi(t) { return t.path.A(); } /** * Retrusn an approximate size for the given document. */ function Vi(t) { var e; if (t.document) e = t.document; else if (t.unknownDocument) e = t.unknownDocument; else { if (!t.noDocument) throw y(); e = t.noDocument; } return JSON.stringify(e).length; } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * An in-memory implementation of IndexManager. */ var Ui = /** @class */ function() { function t() { this.ha = new Ci; } return t.prototype.Mo = function(t, e) { return this.ha.add(e), yr.resolve(); }, t.prototype.Qr = function(t, e) { return yr.resolve(this.ha.getEntries(e)); }, t; }(), Ci = /** @class */ function() { function t() { this.index = {}; } // Returns false if the entry already existed. return t.prototype.add = function(t) { var e = t._(), n = t.h(), r = this.index[e] || new Tt(E.i), i = !r.has(n); return this.index[e] = r.add(n), i; }, t.prototype.has = function(t) { var e = t._(), n = t.h(), r = this.index[e]; return r && r.has(n); }, t.prototype.getEntries = function(t) { return (this.index[t] || new Tt(E.i)).A(); }, t; }(), Fi = /** @class */ function() { function t(t) { this.serializer = t; } /** * Performs database creation and schema upgrades. * * Note that in production, this method is only ever used to upgrade the schema * to SCHEMA_VERSION. Different values of toVersion are only used for testing * and local feature development. */ return t.prototype.createOrUpgrade = function(t, e, n, r) { var i = this; g(n < r && n >= 0 && r <= 10); var o = new br("createOrUpgrade", e); n < 1 && r >= 1 && (function(t) { t.createObjectStore(qi.store); }(t), function(t) { t.createObjectStore(ji.store, { keyPath: ji.keyPath }), t.createObjectStore(Gi.store, { keyPath: Gi.keyPath, autoIncrement: !0 }).createIndex(Gi.userMutationsIndex, Gi.userMutationsKeyPath, { unique: !0 }), t.createObjectStore(zi.store); }(t), Ji(t), function(t) { t.createObjectStore(Ki.store); }(t)); // Migration 2 to populate the targetGlobal object no longer needed since // migration 3 unconditionally clears it. var s = yr.resolve(); return n < 3 && r >= 3 && ( // Brand new clients don't need to drop and recreate--only clients that // potentially have corrupt data. 0 !== n && (function(t) { t.deleteObjectStore(Yi.store), t.deleteObjectStore(Hi.store), t.deleteObjectStore($i.store); }(t), Ji(t)), s = s.next((function() { /** * Creates the target global singleton row. * * @param {IDBTransaction} txn The version upgrade transaction for indexeddb */ return function(t) { var e = t.store($i.store), n = new $i( /*highestTargetId=*/ 0, /*lastListenSequenceNumber=*/ 0, st.min().Z(), /*targetCount=*/ 0); return e.put($i.key, n); }(o); }))), n < 4 && r >= 4 && (0 !== n && ( // Schema version 3 uses auto-generated keys to generate globally unique // mutation batch IDs (this was previously ensured internally by the // client). To migrate to the new schema, we have to read all mutations // and write them back out. We preserve the existing batch IDs to guarantee // consistency with other object stores. Any further mutation batch IDs will // be auto-generated. s = s.next((function() { return function(t, e) { return e.store(Gi.store).ts().next((function(n) { t.deleteObjectStore(Gi.store), t.createObjectStore(Gi.store, { keyPath: Gi.keyPath, autoIncrement: !0 }).createIndex(Gi.userMutationsIndex, Gi.userMutationsKeyPath, { unique: !0 }); var r = e.store(Gi.store), i = n.map((function(t) { return r.put(t); })); return yr.$n(i); })); }(t, o); }))), s = s.next((function() { !function(t) { t.createObjectStore(Zi.store, { keyPath: Zi.keyPath }); }(t); }))), n < 5 && r >= 5 && (s = s.next((function() { return i.removeAcknowledgedMutations(o); }))), n < 6 && r >= 6 && (s = s.next((function() { return function(t) { t.createObjectStore(Qi.store); }(t), i.addDocumentGlobal(o); }))), n < 7 && r >= 7 && (s = s.next((function() { return i.ensureSequenceNumbers(o); }))), n < 8 && r >= 8 && (s = s.next((function() { return i.createCollectionParentIndex(t, o); }))), n < 9 && r >= 9 && (s = s.next((function() { // Multi-Tab used to manage its own changelog, but this has been moved // to the DbRemoteDocument object store itself. Since the previous change // log only contained transient data, we can drop its object store. !function(t) { t.objectStoreNames.contains("remoteDocumentChanges") && t.deleteObjectStore("remoteDocumentChanges"); }(t), function(t) { var e = t.objectStore(Ki.store); e.createIndex(Ki.readTimeIndex, Ki.readTimeIndexPath, { unique: !1 }), e.createIndex(Ki.collectionReadTimeIndex, Ki.collectionReadTimeIndexPath, { unique: !1 }); }(e); }))), n < 10 && r >= 10 && (s = s.next((function() { return i.rewriteCanonicalIds(o); }))), s; }, t.prototype.addDocumentGlobal = function(t) { var e = 0; return t.store(Ki.store).rs((function(t, n) { e += Vi(n); })).next((function() { var n = new Qi(e); return t.store(Qi.store).put(Qi.key, n); })); }, t.prototype.removeAcknowledgedMutations = function(t) { var e = this, n = t.store(ji.store), r = t.store(Gi.store); return n.ts().next((function(n) { return yr.forEach(n, (function(n) { var i = IDBKeyRange.bound([ n.userId, -1 ], [ n.userId, n.lastAcknowledgedBatchId ]); return r.ts(Gi.userMutationsIndex, i).next((function(r) { return yr.forEach(r, (function(r) { g(r.userId === n.userId); var i = bi(e.serializer, r); return Ai(t, n.userId, i).next((function() {})); })); })); })); })); }, /** * Ensures that every document in the remote document cache has a corresponding sentinel row * with a sequence number. Missing rows are given the most recently used sequence number. */ t.prototype.ensureSequenceNumbers = function(t) { var e = t.store(Yi.store), n = t.store(Ki.store); return t.store($i.store).get($i.key).next((function(t) { var r = []; return n.rs((function(n, i) { var o = new E(n), s = function(t) { return [ 0, hi(t) ]; }(o); r.push(e.get(s).next((function(n) { return n ? yr.resolve() : function(n) { return e.put(new Yi(0, hi(n), t.highestListenSequenceNumber)); }(o); }))); })).next((function() { return yr.$n(r); })); })); }, t.prototype.createCollectionParentIndex = function(t, e) { // Create the index. t.createObjectStore(Xi.store, { keyPath: Xi.keyPath }); var n = e.store(Xi.store), r = new Ci, i = function(t) { if (r.add(t)) { var e = t._(), i = t.h(); return n.put({ collectionId: e, parent: hi(i) }); } }; // Helper to add an index entry iff we haven't already written it. // Index existing remote documents. return e.store(Ki.store).rs({ ss: !0 }, (function(t, e) { var n = new E(t); return i(n.h()); })).next((function() { return e.store(zi.store).rs({ ss: !0 }, (function(t, e) { t[0]; var n = t[1], r = (t[2], pi(n)); return i(r.h()); })); })); }, t.prototype.rewriteCanonicalIds = function(t) { var e = this, n = t.store(Hi.store); return n.rs((function(t, r) { var i = Ii(r), o = Ei(e.serializer, i); return n.put(o); })); }, t; }(), Mi = function(t, e) { this.seconds = t, this.nanoseconds = e; }, qi = function(t, /** Whether to allow shared access from multiple tabs. */ e, n) { this.ownerId = t, this.allowTabSynchronization = e, this.leaseTimestampMs = n; }; /** * Internal implementation of the collection-parent index exposed by MemoryIndexManager. * Also used for in-memory caching by IndexedDbIndexManager and initial index population * in indexeddb_schema.ts */ /** * Name of the IndexedDb object store. * * Note that the name 'owner' is chosen to ensure backwards compatibility with * older clients that only supported single locked access to the persistence * layer. */ qi.store = "owner", /** * The key string used for the single object that exists in the * DbPrimaryClient store. */ qi.key = "owner"; var ji = function( /** * The normalized user ID to which this queue belongs. */ t, /** * An identifier for the highest numbered batch that has been acknowledged * by the server. All MutationBatches in this queue with batchIds less * than or equal to this value are considered to have been acknowledged by * the server. * * NOTE: this is deprecated and no longer used by the code. */ e, /** * A stream token that was previously sent by the server. * * See StreamingWriteRequest in datastore.proto for more details about * usage. * * After sending this token, earlier tokens may not be used anymore so * only a single stream token is retained. * * NOTE: this is deprecated and no longer used by the code. */ n) { this.userId = t, this.lastAcknowledgedBatchId = e, this.lastStreamToken = n; }; /** Name of the IndexedDb object store. */ ji.store = "mutationQueues", /** Keys are automatically assigned via the userId property. */ ji.keyPath = "userId"; /** * An object to be stored in the 'mutations' store in IndexedDb. * * Represents a batch of user-level mutations intended to be sent to the server * in a single write. Each user-level batch gets a separate DbMutationBatch * with a new batchId. */ var Gi = function( /** * The normalized user ID to which this batch belongs. */ t, /** * An identifier for this batch, allocated using an auto-generated key. */ e, /** * The local write time of the batch, stored as milliseconds since the * epoch. */ n, /** * A list of "mutations" that represent a partial base state from when this * write batch was initially created. During local application of the write * batch, these baseMutations are applied prior to the real writes in order * to override certain document fields from the remote document cache. This * is necessary in the case of non-idempotent writes (e.g. `increment()` * transforms) to make sure that the local view of the modified documents * doesn't flicker if the remote document cache receives the result of the * non-idempotent write before the write is removed from the queue. * * These mutations are never sent to the backend. */ r, /** * A list of mutations to apply. All mutations will be applied atomically. * * Mutations are serialized via toMutation(). */ i) { this.userId = t, this.batchId = e, this.localWriteTimeMs = n, this.baseMutations = r, this.mutations = i; }; /** Name of the IndexedDb object store. */ Gi.store = "mutations", /** Keys are automatically assigned via the userId, batchId properties. */ Gi.keyPath = "batchId", /** The index name for lookup of mutations by user. */ Gi.userMutationsIndex = "userMutationsIndex", /** The user mutations index is keyed by [userId, batchId] pairs. */ Gi.userMutationsKeyPath = [ "userId", "batchId" ]; var zi = /** @class */ function() { function t() {} /** * Creates a [userId] key for use in the DbDocumentMutations index to iterate * over all of a user's document mutations. */ return t.prefixForUser = function(t) { return [ t ]; }, /** * Creates a [userId, encodedPath] key for use in the DbDocumentMutations * index to iterate over all at document mutations for a given path or lower. */ t.prefixForPath = function(t, e) { return [ t, hi(e) ]; }, /** * Creates a full index key of [userId, encodedPath, batchId] for inserting * and deleting into the DbDocumentMutations index. */ t.key = function(t, e, n) { return [ t, hi(e), n ]; }, t; }(); zi.store = "documentMutations", /** * Because we store all the useful information for this store in the key, * there is no useful information to store as the value. The raw (unencoded) * path cannot be stored because IndexedDb doesn't store prototype * information. */ zi.PLACEHOLDER = new zi; var Bi = function(t, e) { this.path = t, this.readTime = e; }, Wi = function(t, e) { this.path = t, this.version = e; }, Ki = // TODO: We are currently storing full document keys almost three times // (once as part of the primary key, once - partly - as `parentPath` and once // inside the encoded documents). During our next migration, we should // rewrite the primary key as parentPath + document ID which would allow us // to drop one value. function( /** * Set to an instance of DbUnknownDocument if the data for a document is * not known, but it is known that a document exists at the specified * version (e.g. it had a successful update applied to it) */ t, /** * Set to an instance of a DbNoDocument if it is known that no document * exists. */ e, /** * Set to an instance of a Document if there's a cached version of the * document. */ n, /** * Documents that were written to the remote document store based on * a write acknowledgment are marked with `hasCommittedMutations`. These * documents are potentially inconsistent with the backend's copy and use * the write's commit version as their document version. */ r, /** * When the document was read from the backend. Undefined for data written * prior to schema version 9. */ i, /** * The path of the collection this document is part of. Undefined for data * written prior to schema version 9. */ o) { this.unknownDocument = t, this.noDocument = e, this.document = n, this.hasCommittedMutations = r, this.readTime = i, this.parentPath = o; }; /** * Represents a document that is known to exist but whose data is unknown. * Stored in IndexedDb as part of a DbRemoteDocument object. */ Ki.store = "remoteDocuments", /** * An index that provides access to all entries sorted by read time (which * corresponds to the last modification time of each row). * * This index is used to provide a changelog for Multi-Tab. */ Ki.readTimeIndex = "readTimeIndex", Ki.readTimeIndexPath = "readTime", /** * An index that provides access to documents in a collection sorted by read * time. * * This index is used to allow the RemoteDocumentCache to fetch newly changed * documents in a collection. */ Ki.collectionReadTimeIndex = "collectionReadTimeIndex", Ki.collectionReadTimeIndexPath = [ "parentPath", "readTime" ]; /** * Contains a single entry that has metadata about the remote document cache. */ var Qi = /** * @param byteSize Approximately the total size in bytes of all the documents in the document * cache. */ function(t) { this.byteSize = t; }; Qi.store = "remoteDocumentGlobal", Qi.key = "remoteDocumentGlobalKey"; var Hi = function( /** * An auto-generated sequential numeric identifier for the query. * * Queries are stored using their canonicalId as the key, but these * canonicalIds can be quite long so we additionally assign a unique * queryId which can be used by referenced data structures (e.g. * indexes) to minimize the on-disk cost. */ t, /** * The canonical string representing this query. This is not unique. */ e, /** * The last readTime received from the Watch Service for this query. * * This is the same value as TargetChange.read_time in the protos. */ n, /** * An opaque, server-assigned token that allows watching a query to be * resumed after disconnecting without retransmitting all the data * that matches the query. The resume token essentially identifies a * point in time from which the server should resume sending results. * * This is related to the snapshotVersion in that the resumeToken * effectively also encodes that value, but the resumeToken is opaque * and sometimes encodes additional information. * * A consequence of this is that the resumeToken should be used when * asking the server to reason about where this client is in the watch * stream, but the client should use the snapshotVersion for its own * purposes. * * This is the same value as TargetChange.resume_token in the protos. */ r, /** * A sequence number representing the last time this query was * listened to, used for garbage collection purposes. * * Conventionally this would be a timestamp value, but device-local * clocks are unreliable and they must be able to create new listens * even while disconnected. Instead this should be a monotonically * increasing number that's incremented on each listen call. * * This is different from the queryId since the queryId is an * immutable identifier assigned to the Query on first use while * lastListenSequenceNumber is updated every time the query is * listened to. */ i, /** * Denotes the maximum snapshot version at which the associated query view * contained no limbo documents. Undefined for data written prior to * schema version 9. */ o, /** * The query for this target. * * Because canonical ids are not unique we must store the actual query. We * use the proto to have an object we can persist without having to * duplicate translation logic to and from a `Query` object. */ s) { this.targetId = t, this.canonicalId = e, this.readTime = n, this.resumeToken = r, this.lastListenSequenceNumber = i, this.lastLimboFreeSnapshotVersion = o, this.query = s; }; Hi.store = "targets", /** Keys are automatically assigned via the targetId property. */ Hi.keyPath = "targetId", /** The name of the queryTargets index. */ Hi.queryTargetsIndexName = "queryTargetsIndex", /** * The index of all canonicalIds to the targets that they match. This is not * a unique mapping because canonicalId does not promise a unique name for all * possible queries, so we append the targetId to make the mapping unique. */ Hi.queryTargetsKeyPath = [ "canonicalId", "targetId" ]; /** * An object representing an association between a target and a document, or a * sentinel row marking the last sequence number at which a document was used. * Each document cached must have a corresponding sentinel row before lru * garbage collection is enabled. * * The target associations and sentinel rows are co-located so that orphaned * documents and their sequence numbers can be identified efficiently via a scan * of this store. */ var Yi = function( /** * The targetId identifying a target or 0 for a sentinel row. */ t, /** * The path to the document, as encoded in the key. */ e, /** * If this is a sentinel row, this should be the sequence number of the last * time the document specified by `path` was used. Otherwise, it should be * `undefined`. */ n) { this.targetId = t, this.path = e, this.sequenceNumber = n; }; /** Name of the IndexedDb object store. */ Yi.store = "targetDocuments", /** Keys are automatically assigned via the targetId, path properties. */ Yi.keyPath = [ "targetId", "path" ], /** The index name for the reverse index. */ Yi.documentTargetsIndex = "documentTargetsIndex", /** We also need to create the reverse index for these properties. */ Yi.documentTargetsKeyPath = [ "path", "targetId" ]; /** * A record of global state tracked across all Targets, tracked separately * to avoid the need for extra indexes. * * This should be kept in-sync with the proto used in the iOS client. */ var $i = function( /** * The highest numbered target id across all targets. * * See DbTarget.targetId. */ t, /** * The highest numbered lastListenSequenceNumber across all targets. * * See DbTarget.lastListenSequenceNumber. */ e, /** * A global snapshot version representing the last consistent snapshot we * received from the backend. This is monotonically increasing and any * snapshots received from the backend prior to this version (e.g. for * targets resumed with a resumeToken) should be suppressed (buffered) * until the backend has caught up to this snapshot version again. This * prevents our cache from ever going backwards in time. */ n, /** * The number of targets persisted. */ r) { this.highestTargetId = t, this.highestListenSequenceNumber = e, this.lastRemoteSnapshotVersion = n, this.targetCount = r; }; /** * The key string used for the single object that exists in the * DbTargetGlobal store. */ $i.key = "targetGlobalKey", $i.store = "targetGlobal"; /** * An object representing an association between a Collection id (e.g. 'messages') * to a parent path (e.g. '/chats/123') that contains it as a (sub)collection. * This is used to efficiently find all collections to query when performing * a Collection Group query. */ var Xi = function( /** * The collectionId (e.g. 'messages') */ t, /** * The path to the parent (either a document location or an empty path for * a root-level collection). */ e) { this.collectionId = t, this.parent = e; }; /** Name of the IndexedDb object store. */ function Ji(t) { t.createObjectStore(Yi.store, { keyPath: Yi.keyPath }).createIndex(Yi.documentTargetsIndex, Yi.documentTargetsKeyPath, { unique: !0 }), // NOTE: This is unique only because the TargetId is the suffix. t.createObjectStore(Hi.store, { keyPath: Hi.keyPath }).createIndex(Hi.queryTargetsIndexName, Hi.queryTargetsKeyPath, { unique: !0 }), t.createObjectStore($i.store); } Xi.store = "collectionParents", /** Keys are automatically assigned via the collectionId, parent properties. */ Xi.keyPath = [ "collectionId", "parent" ]; var Zi = function( // Note: Previous schema versions included a field // "lastProcessedDocumentChangeId". Don't use anymore. /** The auto-generated client id assigned at client startup. */ t, /** The last time this state was updated. */ e, /** Whether the client's network connection is enabled. */ n, /** Whether this client is running in a foreground tab. */ r) { this.clientId = t, this.updateTimeMs = e, this.networkEnabled = n, this.inForeground = r; }; /** Name of the IndexedDb object store. */ Zi.store = "clientMetadata", /** Keys are automatically assigned via the clientId properties. */ Zi.keyPath = "clientId"; var to = t.__spreadArrays(t.__spreadArrays(t.__spreadArrays([ ji.store, Gi.store, zi.store, Ki.store, Hi.store, qi.store, $i.store, Yi.store ], [ Zi.store ]), [ Qi.store ]), [ Xi.store ]), eo = /** @class */ function() { function t() { /** * An in-memory copy of the index entries we've already written since the SDK * launched. Used to avoid re-writing the same entry repeatedly. * * This is *NOT* a complete cache of what's in persistence and so can never be used to * satisfy reads. */ this.la = new Ci; } /** * Adds a new entry to the collection parent index. * * Repeated calls for the same collectionPath should be avoided within a * transaction as IndexedDbIndexManager only caches writes once a transaction * has been committed. */ return t.prototype.Mo = function(t, e) { var n = this; if (!this.la.has(e)) { var r = e._(), i = e.h(); t.pr((function() { // Add the collection to the in memory cache only if the transaction was // successfully committed. n.la.add(e); })); var o = { collectionId: r, parent: hi(i) }; return no(t).put(o); } return yr.resolve(); }, t.prototype.Qr = function(t, e) { var n = [], r = IDBKeyRange.bound([ e, "" ], [ $(e), "" ], /*lowerOpen=*/ !1, /*upperOpen=*/ !0); return no(t).ts(r).next((function(t) { for (var r = 0, i = t; r < i.length; r++) { var o = i[r]; // This collectionId guard shouldn't be necessary (and isn't as long // as we're running in a real browser), but there's a bug in // indexeddbshim that breaks our range in our tests running in node: // https://github.com/axemclion/IndexedDBShim/issues/334 if (o.collectionId !== e) break; n.push(pi(o.parent)); } return n; })); }, t; }(); // V2 is no longer usable (see comment at top of file) // Visible for testing /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * A persisted implementation of IndexManager. */ /** * Helper to get a typed SimpleDbStore for the collectionParents * document store. */ function no(t) { return ho.Qn(t, Xi.store); } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** Offset to ensure non-overlapping target ids. */ /** * Generates monotonically increasing target IDs for sending targets to the * watch stream. * * The client constructs two generators, one for the target cache, and one for * for the sync engine (to generate limbo documents targets). These * generators produce non-overlapping IDs (by using even and odd IDs * respectively). * * By separating the target ID space, the query cache can generate target IDs * that persist across client restarts, while sync engine can independently * generate in-memory target IDs that are transient and can be reused after a * restart. */ var ro = /** @class */ function() { function t(t) { this._a = t; } return t.prototype.next = function() { return this._a += 2, this._a; }, t.fa = function() { // The target cache generator must return '2' in its first call to `next()` // as there is no differentiation in the protocol layer between an unset // number and the number '0'. If we were to sent a target with target ID // '0', the backend would consider it unset and replace it with its own ID. return new t(0); }, t.da = function() { // Sync engine assigns target IDs for limbo document detection. return new t(-1); }, t; }(), io = /** @class */ function() { function t(t, e) { this.No = t, this.serializer = e; } // PORTING NOTE: We don't cache global metadata for the target cache, since // some of it (in particular `highestTargetId`) can be modified by secondary // tabs. We could perhaps be more granular (and e.g. still cache // `lastRemoteSnapshotVersion` in memory) but for simplicity we currently go // to IndexedDb whenever we need to read metadata. We can revisit if it turns // out to have a meaningful performance impact. return t.prototype.wa = function(t) { var e = this; return this.ma(t).next((function(n) { var r = new ro(n.highestTargetId); return n.highestTargetId = r.next(), e.Ta(t, n).next((function() { return n.highestTargetId; })); })); }, t.prototype.Ea = function(t) { return this.ma(t).next((function(t) { return st.J(new ot(t.lastRemoteSnapshotVersion.seconds, t.lastRemoteSnapshotVersion.nanoseconds)); })); }, t.prototype.Ia = function(t) { return this.ma(t).next((function(t) { return t.highestListenSequenceNumber; })); }, t.prototype.Aa = function(t, e, n) { var r = this; return this.ma(t).next((function(i) { return i.highestListenSequenceNumber = e, n && (i.lastRemoteSnapshotVersion = n.Z()), e > i.highestListenSequenceNumber && (i.highestListenSequenceNumber = e), r.Ta(t, i); })); }, t.prototype.Ra = function(t, e) { var n = this; return this.ga(t, e).next((function() { return n.ma(t).next((function(r) { return r.targetCount += 1, n.Pa(e, r), n.Ta(t, r); })); })); }, t.prototype.ya = function(t, e) { return this.ga(t, e); }, t.prototype.Va = function(t, e) { var n = this; return this.pa(t, e.targetId).next((function() { return oo(t).delete(e.targetId); })).next((function() { return n.ma(t); })).next((function(e) { return g(e.targetCount > 0), e.targetCount -= 1, n.Ta(t, e); })); }, /** * Drops any targets with sequence number less than or equal to the upper bound, excepting those * present in `activeTargetIds`. Document associations for the removed targets are also removed. * Returns the number of targets removed. */ t.prototype.po = function(t, e, n) { var r = this, i = 0, o = []; return oo(t).rs((function(s, u) { var a = Ii(u); a.sequenceNumber <= e && null === n.get(a.targetId) && (i++, o.push(r.Va(t, a))); })).next((function() { return yr.$n(o); })).next((function() { return i; })); }, /** * Call provided function with each `TargetData` that we have cached. */ t.prototype.Ce = function(t, e) { return oo(t).rs((function(t, n) { var r = Ii(n); e(r); })); }, t.prototype.ma = function(t) { return so(t).get($i.key).next((function(t) { return g(null !== t), t; })); }, t.prototype.Ta = function(t, e) { return so(t).put($i.key, e); }, t.prototype.ga = function(t, e) { return oo(t).put(Ei(this.serializer, e)); }, /** * In-place updates the provided metadata to account for values in the given * TargetData. Saving is done separately. Returns true if there were any * changes to the metadata. */ t.prototype.Pa = function(t, e) { var n = !1; return t.targetId > e.highestTargetId && (e.highestTargetId = t.targetId, n = !0), t.sequenceNumber > e.highestListenSequenceNumber && (e.highestListenSequenceNumber = t.sequenceNumber, n = !0), n; }, t.prototype.ba = function(t) { return this.ma(t).next((function(t) { return t.targetCount; })); }, t.prototype.va = function(t, e) { // Iterating by the canonicalId may yield more than one result because // canonicalId values are not required to be unique per target. This query // depends on the queryTargets index to be efficient. var n = lt(e), r = IDBKeyRange.bound([ n, Number.NEGATIVE_INFINITY ], [ n, Number.POSITIVE_INFINITY ]), i = null; return oo(t).rs({ range: r, index: Hi.queryTargetsIndexName }, (function(t, n, r) { var o = Ii(n); // After finding a potential match, check that the target is // actually equal to the requested target. pt(e, o.target) && (i = o, r.done()); })).next((function() { return i; })); }, t.prototype.Sa = function(t, e, n) { var r = this, i = [], o = uo(t); // PORTING NOTE: The reverse index (documentsTargets) is maintained by // IndexedDb. return e.forEach((function(e) { var s = hi(e.path); i.push(o.put(new Yi(n, s))), i.push(r.No.Da(t, n, e)); })), yr.$n(i); }, t.prototype.Ca = function(t, e, n) { var r = this, i = uo(t); // PORTING NOTE: The reverse index (documentsTargets) is maintained by // IndexedDb. return yr.forEach(e, (function(e) { var o = hi(e.path); return yr.$n([ i.delete([ n, o ]), r.No.Na(t, n, e) ]); })); }, t.prototype.pa = function(t, e) { var n = uo(t), r = IDBKeyRange.bound([ e ], [ e + 1 ], /*lowerOpen=*/ !1, /*upperOpen=*/ !0); return n.delete(r); }, t.prototype.Fa = function(t, e) { var n = IDBKeyRange.bound([ e ], [ e + 1 ], /*lowerOpen=*/ !1, /*upperOpen=*/ !0), r = uo(t), i = Ot(); return r.rs({ range: n, ss: !0 }, (function(t, e, n) { var r = pi(t[1]), o = new A(r); i = i.add(o); })).next((function() { return i; })); }, t.prototype.Ho = function(t, e) { var n = hi(e.path), r = IDBKeyRange.bound([ n ], [ $(n) ], /*lowerOpen=*/ !1, /*upperOpen=*/ !0), i = 0; return uo(t).rs({ index: Yi.documentTargetsIndex, ss: !0, range: r }, (function(t, e, n) { var r = t[0]; // Having a sentinel row for a document does not count as containing that document; // For the target cache, containing the document means the document is part of some // target. t[1]; 0 !== r && (i++, n.done()); })).next((function() { return i > 0; })); }, /** * Looks up a TargetData entry by target ID. * * @param targetId The target ID of the TargetData entry to look up. * @return The cached TargetData entry, or null if the cache has no entry for * the target. */ // PORTING NOTE: Multi-tab only. t.prototype.Ue = function(t, e) { return oo(t).get(e).next((function(t) { return t ? Ii(t) : null; })); }, t; }(); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Helper to get a typed SimpleDbStore for the queries object store. */ function oo(t) { return ho.Qn(t, Hi.store); } /** * Helper to get a typed SimpleDbStore for the target globals object store. */ function so(t) { return ho.Qn(t, $i.store); } /** * Helper to get a typed SimpleDbStore for the document target object store. */ function uo(t) { return ho.Qn(t, Yi.store); } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var ao = "Failed to obtain exclusive access to the persistence layer. To allow shared access, make sure to invoke `enablePersistence()` with `synchronizeTabs:true` in all tabs. If you are using `experimentalForceOwningTab:true`, make sure that only one tab has persistence enabled at any given time.", co = /** @class */ function(e) { function n(t, n) { var r = this; return (r = e.call(this) || this).jo = t, r.xa = n, r; } return t.__extends(n, e), n; }(ei), ho = /** @class */ function() { function e( /** * Whether to synchronize the in-memory state of multiple tabs and share * access to local persistence. */ t, n, r, i, o, s, u, h, f, /** * If set to true, forcefully obtains database access. Existing tabs will * no longer be able to access IndexedDB. */ l) { if (this.allowTabSynchronization = t, this.persistenceKey = n, this.clientId = r, this.fn = o, this.window = s, this.document = u, this.$a = f, this.ka = l, this.Ma = null, this.Oa = !1, this.isPrimary = !1, this.networkEnabled = !0, /** Our window.unload handler, if registered. */ this.La = null, this.inForeground = !1, /** Our 'visibilitychange' listener if registered. */ this.Ba = null, /** The client metadata refresh task. */ this.qa = null, /** The last time we garbage collected the client metadata object store. */ this.Ua = Number.NEGATIVE_INFINITY, /** A listener to notify on primary state changes. */ this.Qa = function(t) { return Promise.resolve(); }, !e.Ln()) throw new c(a.UNIMPLEMENTED, "This platform is either missing IndexedDB or is known to have an incomplete implementation. Offline persistence has been disabled."); this.No = new po(this, i), this.Wa = n + "main", this.serializer = new di(h), this.ja = new gr(this.Wa, 10, new Fi(this.serializer)), this.Ka = new io(this.No, this.serializer), this.Dr = new eo, this.vr = function(t, e) { return new Li(t, e); }(this.serializer, this.Dr), this.window && this.window.localStorage ? this.Ga = this.window.localStorage : (this.Ga = null, !1 === l && p("IndexedDbPersistence", "LocalStorage is unavailable. As a result, persistence may not work reliably. In particular enablePersistence() could fail immediately after refreshing the page.")); } return e.Qn = function(t, e) { if (t instanceof co) return gr.Qn(t.jo, e); throw y(); }, /** * Attempt to start IndexedDb persistence. * * @return {Promise<void>} Whether persistence was enabled. */ e.prototype.start = function() { var t = this; // NOTE: This is expected to fail sometimes (in the case of another tab // already having the persistence lock), so it's the first thing we should // do. return this.za().then((function() { if (!t.isPrimary && !t.allowTabSynchronization) // Fail `start()` if `synchronizeTabs` is disabled and we cannot // obtain the primary lease. throw new c(a.FAILED_PRECONDITION, ao); return t.Ha(), t.Ya(), t.Ja(), t.runTransaction("getHighestListenSequenceNumber", "readonly", (function(e) { return t.Ka.Ia(e); })); })).then((function(e) { t.Ma = new qr(e, t.$a); })).then((function() { t.Oa = !0; })).catch((function(e) { return t.ja && t.ja.close(), Promise.reject(e); })); }, /** * Registers a listener that gets called when the primary state of the * instance changes. Upon registering, this listener is invoked immediately * with the current primary state. * * PORTING NOTE: This is only used for Web multi-tab. */ e.prototype.Xa = function(e) { var n = this; return this.Qa = function(r) { return t.__awaiter(n, void 0, void 0, (function() { return t.__generator(this, (function(t) { return this.Ei ? [ 2 /*return*/ , e(r) ] : [ 2 /*return*/ ]; })); })); }, e(this.isPrimary); }, /** * Registers a listener that gets called when the database receives a * version change event indicating that it has deleted. * * PORTING NOTE: This is only used for Web multi-tab. */ e.prototype.Za = function(e) { var n = this; this.ja.Kn((function(r) { return t.__awaiter(n, void 0, void 0, (function() { return t.__generator(this, (function(t) { switch (t.label) { case 0: return null === r.newVersion ? [ 4 /*yield*/ , e() ] : [ 3 /*break*/ , 2 ]; case 1: t.sent(), t.label = 2; case 2: return [ 2 /*return*/ ]; } })); })); })); }, /** * Adjusts the current network state in the client's metadata, potentially * affecting the primary lease. * * PORTING NOTE: This is only used for Web multi-tab. */ e.prototype.tc = function(e) { var n = this; this.networkEnabled !== e && (this.networkEnabled = e, // Schedule a primary lease refresh for immediate execution. The eventual // lease update will be propagated via `primaryStateListener`. this.fn.ws((function() { return t.__awaiter(n, void 0, void 0, (function() { return t.__generator(this, (function(t) { switch (t.label) { case 0: return this.Ei ? [ 4 /*yield*/ , this.za() ] : [ 3 /*break*/ , 2 ]; case 1: t.sent(), t.label = 2; case 2: return [ 2 /*return*/ ]; } })); })); }))); }, /** * Updates the client metadata in IndexedDb and attempts to either obtain or * extend the primary lease for the local client. Asynchronously notifies the * primary state listener if the client either newly obtained or released its * primary lease. */ e.prototype.za = function() { var t = this; return this.runTransaction("updateClientMetadataAndTryBecomePrimary", "readwrite", (function(e) { return lo(e).put(new Zi(t.clientId, Date.now(), t.networkEnabled, t.inForeground)).next((function() { if (t.isPrimary) return t.ec(e).next((function(e) { e || (t.isPrimary = !1, t.fn.Cs((function() { return t.Qa(!1); }))); })); })).next((function() { return t.nc(e); })).next((function(n) { return t.isPrimary && !n ? t.sc(e).next((function() { return !1; })) : !!n && t.ic(e).next((function() { return !0; })); })); })).catch((function(e) { if (_r(e)) // Proceed with the existing state. Any subsequent access to // IndexedDB will verify the lease. return l("IndexedDbPersistence", "Failed to extend owner lease: ", e), t.isPrimary; if (!t.allowTabSynchronization) throw e; return l("IndexedDbPersistence", "Releasing owner lease after error during lease refresh", e), /* isPrimary= */ !1; })).then((function(e) { t.isPrimary !== e && t.fn.Cs((function() { return t.Qa(e); })), t.isPrimary = e; })); }, e.prototype.ec = function(t) { var e = this; return fo(t).get(qi.key).next((function(t) { return yr.resolve(e.rc(t)); })); }, e.prototype.oc = function(t) { return lo(t).delete(this.clientId); }, /** * If the garbage collection threshold has passed, prunes the * RemoteDocumentChanges and the ClientMetadata store based on the last update * time of all clients. */ e.prototype.ac = function() { return t.__awaiter(this, void 0, void 0, (function() { var n, r, i, o, s = this; return t.__generator(this, (function(t) { switch (t.label) { case 0: return !this.isPrimary || this.cc(this.Ua, 18e5) ? [ 3 /*break*/ , 2 ] : (this.Ua = Date.now(), [ 4 /*yield*/ , this.runTransaction("maybeGarbageCollectMultiClientState", "readwrite-primary", (function(t) { var n = e.Qn(t, Zi.store); return n.ts().next((function(t) { var e = s.uc(t, 18e5), r = t.filter((function(t) { return -1 === e.indexOf(t); })); // Delete metadata for clients that are no longer considered active. return yr.forEach(r, (function(t) { return n.delete(t.clientId); })).next((function() { return r; })); })); })).catch((function() { return []; })) ]); case 1: // Delete potential leftover entries that may continue to mark the // inactive clients as zombied in LocalStorage. // Ideally we'd delete the IndexedDb and LocalStorage zombie entries for // the client atomically, but we can't. So we opt to delete the IndexedDb // entries first to avoid potentially reviving a zombied client. if (n = t.sent(), this.Ga) for (r = 0, i = n; r < i.length; r++) o = i[r], this.Ga.removeItem(this.hc(o.clientId)); t.label = 2; case 2: return [ 2 /*return*/ ]; } })); })); }, /** * Schedules a recurring timer to update the client metadata and to either * extend or acquire the primary lease if the client is eligible. */ e.prototype.Ja = function() { var t = this; this.qa = this.fn.yn("client_metadata_refresh" /* ClientMetadataRefresh */ , 4e3, (function() { return t.za().then((function() { return t.ac(); })).then((function() { return t.Ja(); })); })); }, /** Checks whether `client` is the local client. */ e.prototype.rc = function(t) { return !!t && t.ownerId === this.clientId; }, /** * Evaluate the state of all active clients and determine whether the local * client is or can act as the holder of the primary lease. Returns whether * the client is eligible for the lease, but does not actually acquire it. * May return 'false' even if there is no active leaseholder and another * (foreground) client should become leaseholder instead. */ e.prototype.nc = function(t) { var e = this; return this.ka ? yr.resolve(!0) : fo(t).get(qi.key).next((function(n) { // A client is eligible for the primary lease if: // - its network is enabled and the client's tab is in the foreground. // - its network is enabled and no other client's tab is in the // foreground. // - every clients network is disabled and the client's tab is in the // foreground. // - every clients network is disabled and no other client's tab is in // the foreground. // - the `forceOwningTab` setting was passed in. if (null !== n && e.cc(n.leaseTimestampMs, 5e3) && !e.lc(n.ownerId)) { if (e.rc(n) && e.networkEnabled) return !0; if (!e.rc(n)) { if (!n.allowTabSynchronization) // Fail the `canActAsPrimary` check if the current leaseholder has // not opted into multi-tab synchronization. If this happens at // client startup, we reject the Promise returned by // `enablePersistence()` and the user can continue to use Firestore // with in-memory persistence. // If this fails during a lease refresh, we will instead block the // AsyncQueue from executing further operations. Note that this is // acceptable since mixing & matching different `synchronizeTabs` // settings is not supported. // TODO(b/114226234): Remove this check when `synchronizeTabs` can // no longer be turned off. throw new c(a.FAILED_PRECONDITION, ao); return !1; } } return !(!e.networkEnabled || !e.inForeground) || lo(t).ts().next((function(t) { return void 0 === e.uc(t, 5e3).find((function(t) { if (e.clientId !== t.clientId) { var n = !e.networkEnabled && t.networkEnabled, r = !e.inForeground && t.inForeground, i = e.networkEnabled === t.networkEnabled; if (n || r && i) return !0; } return !1; })); })); })).next((function(t) { return e.isPrimary !== t && l("IndexedDbPersistence", "Client " + (t ? "is" : "is not") + " eligible for a primary lease."), t; })); }, e.prototype.Di = function() { return t.__awaiter(this, void 0, void 0, (function() { var e = this; return t.__generator(this, (function(t) { switch (t.label) { case 0: // Use `SimpleDb.runTransaction` directly to avoid failing if another tab // has obtained the primary lease. // The shutdown() operations are idempotent and can be called even when // start() aborted (e.g. because it couldn't acquire the persistence lease). return this.Oa = !1, this._c(), this.qa && (this.qa.cancel(), this.qa = null), this.fc(), this.dc(), [ 4 /*yield*/ , this.ja.runTransaction("shutdown", "readwrite", [ qi.store, Zi.store ], (function(t) { var n = new co(t, qr.ai); return e.sc(n).next((function() { return e.oc(n); })); })) ]; case 1: // The shutdown() operations are idempotent and can be called even when // start() aborted (e.g. because it couldn't acquire the persistence lease). // Use `SimpleDb.runTransaction` directly to avoid failing if another tab // has obtained the primary lease. return t.sent(), this.ja.close(), // Remove the entry marking the client as zombied from LocalStorage since // we successfully deleted its metadata from IndexedDb. this.wc(), [ 2 /*return*/ ]; } })); })); }, /** * Returns clients that are not zombied and have an updateTime within the * provided threshold. */ e.prototype.uc = function(t, e) { var n = this; return t.filter((function(t) { return n.cc(t.updateTimeMs, e) && !n.lc(t.clientId); })); }, /** * Returns the IDs of the clients that are currently active. If multi-tab * is not supported, returns an array that only contains the local client's * ID. * * PORTING NOTE: This is only used for Web multi-tab. */ e.prototype.pi = function() { var t = this; return this.runTransaction("getActiveClients", "readonly", (function(e) { return lo(e).ts().next((function(e) { return t.uc(e, 18e5).map((function(t) { return t.clientId; })); })); })); }, Object.defineProperty(e.prototype, "Ei", { get: function() { return this.Oa; }, enumerable: !1, configurable: !0 }), e.prototype.mc = function(t) { return Ti.xo(t, this.serializer, this.Dr, this.No); }, e.prototype.Tc = function() { return this.Ka; }, e.prototype.Ec = function() { return this.vr; }, e.prototype.Ic = function() { return this.Dr; }, e.prototype.runTransaction = function(t, e, n) { var r = this; l("IndexedDbPersistence", "Starting transaction:", t); var i, o = "readonly" === e ? "readonly" : "readwrite"; // Do all transactions as readwrite against all object stores, since we // are the only reader/writer. return this.ja.runTransaction(t, o, to, (function(o) { return i = new co(o, r.Ma ? r.Ma.next() : qr.ai), "readwrite-primary" === e ? r.ec(i).next((function(t) { return !!t || r.nc(i); })).next((function(e) { if (!e) throw p("Failed to obtain primary lease for action '" + t + "'."), r.isPrimary = !1, r.fn.Cs((function() { return r.Qa(!1); })), new c(a.FAILED_PRECONDITION, ti); return n(i); })).next((function(t) { return r.ic(i).next((function() { return t; })); })) : r.Ac(i).next((function() { return n(i); })); })).then((function(t) { return i.br(), t; })); }, /** * Verifies that the current tab is the primary leaseholder or alternatively * that the leaseholder has opted into multi-tab synchronization. */ // TODO(b/114226234): Remove this check when `synchronizeTabs` can no longer // be turned off. e.prototype.Ac = function(t) { var e = this; return fo(t).get(qi.key).next((function(t) { if (null !== t && e.cc(t.leaseTimestampMs, 5e3) && !e.lc(t.ownerId) && !e.rc(t) && !(e.ka || e.allowTabSynchronization && t.allowTabSynchronization)) throw new c(a.FAILED_PRECONDITION, ao); })); }, /** * Obtains or extends the new primary lease for the local client. This * method does not verify that the client is eligible for this lease. */ e.prototype.ic = function(t) { var e = new qi(this.clientId, this.allowTabSynchronization, Date.now()); return fo(t).put(qi.key, e); }, e.Ln = function() { return gr.Ln(); }, /** Checks the primary lease and removes it if we are the current primary. */ e.prototype.sc = function(t) { var e = this, n = fo(t); return n.get(qi.key).next((function(t) { return e.rc(t) ? (l("IndexedDbPersistence", "Releasing primary lease."), n.delete(qi.key)) : yr.resolve(); })); }, /** Verifies that `updateTimeMs` is within `maxAgeMs`. */ e.prototype.cc = function(t, e) { var n = Date.now(); return !(t < n - e || t > n && (p("Detected an update time that is in the future: " + t + " > " + n), 1)); }, e.prototype.Ha = function() { var t = this; null !== this.document && "function" == typeof this.document.addEventListener && (this.Ba = function() { t.fn.ws((function() { return t.inForeground = "visible" === t.document.visibilityState, t.za(); })); }, this.document.addEventListener("visibilitychange", this.Ba), this.inForeground = "visible" === this.document.visibilityState); }, e.prototype.fc = function() { this.Ba && (this.document.removeEventListener("visibilitychange", this.Ba), this.Ba = null); }, /** * Attaches a window.unload handler that will synchronously write our * clientId to a "zombie client id" location in LocalStorage. This can be used * by tabs trying to acquire the primary lease to determine that the lease * is no longer valid even if the timestamp is recent. This is particularly * important for the refresh case (so the tab correctly re-acquires the * primary lease). LocalStorage is used for this rather than IndexedDb because * it is a synchronous API and so can be used reliably from an unload * handler. */ e.prototype.Ya = function() { var t, e = this; "function" == typeof (null === (t = this.window) || void 0 === t ? void 0 : t.addEventListener) && (this.La = function() { // Note: In theory, this should be scheduled on the AsyncQueue since it // accesses internal state. We execute this code directly during shutdown // to make sure it gets a chance to run. e._c(), e.fn.ws((function() { return e.Di(); })); }, this.window.addEventListener("unload", this.La)); }, e.prototype.dc = function() { this.La && (this.window.removeEventListener("unload", this.La), this.La = null); }, /** * Returns whether a client is "zombied" based on its LocalStorage entry. * Clients become zombied when their tab closes without running all of the * cleanup logic in `shutdown()`. */ e.prototype.lc = function(t) { var e; try { var n = null !== (null === (e = this.Ga) || void 0 === e ? void 0 : e.getItem(this.hc(t))); return l("IndexedDbPersistence", "Client '" + t + "' " + (n ? "is" : "is not") + " zombied in LocalStorage"), n; } catch (t) { // Gracefully handle if LocalStorage isn't working. return p("IndexedDbPersistence", "Failed to get zombied client id.", t), !1; } }, /** * Record client as zombied (a client that had its tab closed). Zombied * clients are ignored during primary tab selection. */ e.prototype._c = function() { if (this.Ga) try { this.Ga.setItem(this.hc(this.clientId), String(Date.now())); } catch (t) { // Gracefully handle if LocalStorage isn't available / working. p("Failed to set zombie client id.", t); } }, /** Removes the zombied client entry if it exists. */ e.prototype.wc = function() { if (this.Ga) try { this.Ga.removeItem(this.hc(this.clientId)); } catch (t) { // Ignore } }, e.prototype.hc = function(t) { return "firestore_zombie_" + this.persistenceKey + "_" + t; }, e; }(); /** * Oldest acceptable age in milliseconds for client metadata before the client * is considered inactive and its associated data is garbage collected. */ /** * Helper to get a typed SimpleDbStore for the primary client object store. */ function fo(t) { return ho.Qn(t, qi.store); } /** * Helper to get a typed SimpleDbStore for the client metadata object store. */ function lo(t) { return ho.Qn(t, Zi.store); } /** Provides LRU functionality for IndexedDB persistence. */ var po = /** @class */ function() { function t(t, e) { this.db = t, this.wo = new ci(this, e); } return t.prototype.Po = function(t) { var e = this.Rc(t); return this.db.Tc().ba(t).next((function(t) { return e.next((function(e) { return t + e; })); })); }, t.prototype.Rc = function(t) { var e = 0; return this.Vo(t, (function(t) { e++; })).next((function() { return e; })); }, t.prototype.Ce = function(t, e) { return this.db.Tc().Ce(t, e); }, t.prototype.Vo = function(t, e) { return this.gc(t, (function(t, n) { return e(n); })); }, t.prototype.Da = function(t, e, n) { return vo(t, n); }, t.prototype.Na = function(t, e, n) { return vo(t, n); }, t.prototype.po = function(t, e, n) { return this.db.Tc().po(t, e, n); }, t.prototype.Go = function(t, e) { return vo(t, e); }, /** * Returns true if anything would prevent this document from being garbage * collected, given that the document in question is not present in any * targets and has a sequence number less than or equal to the upper bound for * the collection run. */ t.prototype.Pc = function(t, e) { return function(t, e) { var n = !1; return xi(t).os((function(r) { return Ni(t, r, e).next((function(t) { return t && (n = !0), yr.resolve(!t); })); })).next((function() { return n; })); }(t, e); }, t.prototype.bo = function(t, e) { var n = this, r = this.db.Ec().ra(), i = [], o = 0; return this.gc(t, (function(s, u) { if (u <= e) { var a = n.Pc(t, s).next((function(e) { if (!e) // Our size accounting requires us to read all documents before // removing them. return o++, r.Rr(t, s).next((function() { return r.Ar(s), uo(t).delete([ 0, hi(s.path) ]); })); })); i.push(a); } })).next((function() { return yr.$n(i); })).next((function() { return r.apply(t); })).next((function() { return o; })); }, t.prototype.removeTarget = function(t, e) { var n = e.st(t.xa); return this.db.Tc().ya(t, n); }, t.prototype.yc = function(t, e) { return vo(t, e); }, /** * Call provided function for each document in the cache that is 'orphaned'. Orphaned * means not a part of any target, so the only entry in the target-document index for * that document will be the sentinel row (targetId 0), which will also have the sequence * number for the last time the document was accessed. */ t.prototype.gc = function(t, e) { var n, r = uo(t), i = qr.ai; return r.rs({ index: Yi.documentTargetsIndex }, (function(t, r) { var o = t[0], s = (t[1], r.path), u = r.sequenceNumber; 0 === o ? ( // if nextToReport is valid, report it, this is a new key so the // last one must not be a member of any targets. i !== qr.ai && e(new A(pi(n)), i), // set nextToReport to be this sequence number. It's the next one we // might report, if we don't find any targets for this document. // Note that the sequence number must be defined when the targetId // is 0. i = u, n = s) : // set nextToReport to be invalid, we know we don't need to report // this one since we found a target for it. i = qr.ai; })).next((function() { // Since we report sequence numbers after getting to the next key, we // need to check if the last key we iterated over was an orphaned // document and report it. i !== qr.ai && e(new A(pi(n)), i); })); }, t.prototype.So = function(t) { return this.db.Ec().aa(t); }, t; }(); function vo(t, e) { return uo(t).put( /** * @return A value suitable for writing a sentinel row in the target-document * store. */ function(t, e) { return new Yi(0, hi(t.path), e); }(e, t.xa)); } /** * Generates a string used as a prefix when storing data in IndexedDB and * LocalStorage. */ function yo(t, e) { // Use two different prefix formats: // * firestore / persistenceKey / projectID . databaseID / ... // * firestore / persistenceKey / projectID / ... // projectIDs are DNS-compatible names and cannot contain dots // so there's no danger of collisions. var n = t.projectId; return t.j || (n += "." + t.database), "firestore/" + e + "/" + n + "/" /** * Implements `LocalStore` interface. * * Note: some field defined in this class might have public access level, but * the class is not exported so they are only accessible from this module. * This is useful to implement optional features (like bundles) in free * functions, such that they are tree-shakeable. */; } var go = /** @class */ function() { function t( /** Manages our in-memory or durable persistence. */ t, e, n) { this.persistence = t, this.Vc = e, /** * Maps a targetID to data about its target. * * PORTING NOTE: We are using an immutable data structure on Web to make re-runs * of `applyRemoteEvent()` idempotent. */ this.bc = new bt(H), /** Maps a target to its targetID. */ // TODO(wuandy): Evaluate if TargetId can be part of Target. this.vc = new it((function(t) { return lt(t); }), pt), /** * The read time of the last entry processed by `getNewDocumentChanges()`. * * PORTING NOTE: This is only used for multi-tab synchronization. */ this.Sc = st.min(), this.Sr = t.mc(n), this.Dc = t.Ec(), this.Ka = t.Tc(), this.Cc = new ni(this.Dc, this.Sr, this.persistence.Ic()), this.Vc.Nc(this.Cc); } return t.prototype.Io = function(t) { var e = this; return this.persistence.runTransaction("Collect garbage", "readwrite-primary", (function(n) { return t.vo(n, e.bc); })); }, t; }(); /** * Acknowledges the given batch. * * On the happy path when a batch is acknowledged, the local store will * * + remove the batch from the mutation queue; * + apply the changes to the remote document cache; * + recalculate the latency compensated view implied by those changes (there * may be mutations in the queue that affect the documents but haven't been * acknowledged yet); and * + give the changed documents back the sync engine * * @returns The resulting (modified) documents. */ function mo(t, e) { var n = m(t); return n.persistence.runTransaction("Acknowledge batch", "readwrite-primary", (function(t) { var r = e.batch.keys(), i = n.Dc.ra({ oa: !0 }); return function(t, e, n, r) { var i = n.batch, o = i.keys(), s = yr.resolve(); return o.forEach((function(t) { s = s.next((function() { return r.Rr(e, t); })).next((function(e) { var o = e, s = n.dr.get(t); g(null !== s), (!o || o.version.L(s) < 0) && ((o = i.cr(t, o, n)) && // We use the commitVersion as the readTime rather than the // document's updateTime since the updateTime is not advanced // for updates that do not modify the underlying document. r.Er(o, n._r)); })); })), s.next((function() { return t.Sr.Wo(e, i); })); }(n, t, e, i).next((function() { return i.apply(t); })).next((function() { return n.Sr.zo(t); })).next((function() { return n.Cc.kr(t, r); })); })); } /** * Removes mutations from the MutationQueue for the specified batch; * LocalDocuments will be recalculated. * * @returns The resulting modified documents. */ /** * Returns the last consistent snapshot processed (used by the RemoteStore to * determine whether to buffer incoming snapshots from the backend). */ function wo(t) { var e = m(t); return e.persistence.runTransaction("Get last remote snapshot version", "readonly", (function(t) { return e.Ka.Ea(t); })); } /** * Updates the "ground-state" (remote) documents. We assume that the remote * event reflects any write batches that have been acknowledged or rejected * (i.e. we do not re-apply local mutations to updates from this event). * * LocalDocuments are re-calculated if there are remaining mutations in the * queue. */ function _o(t, e) { var n = m(t), r = e.nt, i = n.bc; return n.persistence.runTransaction("Apply remote event", "readwrite-primary", (function(t) { var o = n.Dc.ra({ oa: !0 }); // Reset newTargetDataByTargetMap in case this transaction gets re-run. i = n.bc; var s = []; e.zt.forEach((function(e, o) { var u = i.get(o); if (u) { // Only update the remote keys if the target is still active. This // ensures that we can persist the updated target data along with // the updated assignment. s.push(n.Ka.Ca(t, e.se, o).next((function() { return n.Ka.Sa(t, e.ee, o); }))); var a = e.resumeToken; // Update the resume token if the change includes one. if (a.O() > 0) { var c = u.it(a, r).st(t.xa); i = i.ot(o, c), // Update the target data if there are target changes (or if // sufficient time has passed since the last update). /** * Returns true if the newTargetData should be persisted during an update of * an active target. TargetData should always be persisted when a target is * being released and should not call this function. * * While the target is active, TargetData updates can be omitted when nothing * about the target has changed except metadata like the resume token or * snapshot version. Occasionally it's worth the extra write to prevent these * values from getting too stale after a crash, but this doesn't have to be * too frequent. */ function(t, e, n) { // Always persist target data if we don't already have a resume token. return g(e.resumeToken.O() > 0), 0 === t.resumeToken.O() || ( // Don't allow resume token changes to be buffered indefinitely. This // allows us to be reasonably up-to-date after a crash and avoids needing // to loop over all active queries on shutdown. Especially in the browser // we may not get time to do anything interesting while the current tab is // closing. e.nt.X() - t.nt.X() >= 3e8 || n.ee.size + n.ne.size + n.se.size > 0); }(u, c, e) && s.push(n.Ka.ya(t, c)); } } })); var u = St(), a = Ot(); // HACK: The only reason we allow a null snapshot version is so that we // can synthesize remote events when we get permission denied errors while // trying to resolve the state of a locally cached document that is in // limbo. if (e.Yt.forEach((function(t, e) { a = a.add(t); })), // Each loop iteration only affects its "own" doc, so it's safe to get all the remote // documents in advance in a single call. s.push(o.getEntries(t, a).next((function(i) { e.Yt.forEach((function(a, c) { var h = i.get(a); // Note: The order of the steps below is important, since we want // to ensure that rejected limbo resolutions (which fabricate // NoDocuments with SnapshotVersion.min()) never add documents to // cache. c instanceof Rn && c.version.isEqual(st.min()) ? ( // NoDocuments with SnapshotVersion.min() are used in manufactured // events. We remove these documents from cache since we lost // access. o.Ar(a, r), u = u.ot(a, c)) : null == h || c.version.L(h.version) > 0 || 0 === c.version.L(h.version) && h.hasPendingWrites ? (o.Er(c, r), u = u.ot(a, c)) : l("LocalStore", "Ignoring outdated watch update for ", a, ". Current version:", h.version, " Watch version:", c.version), e.Jt.has(a) && s.push(n.persistence.No.yc(t, a)); })); }))), !r.isEqual(st.min())) { var c = n.Ka.Ea(t).next((function(e) { return n.Ka.Aa(t, t.xa, r); })); s.push(c); } return yr.$n(s).next((function() { return o.apply(t); })).next((function() { return n.Cc.Mr(t, u); })); })).then((function(t) { return n.bc = i, t; })); } /** * Gets the mutation batch after the passed in batchId in the mutation queue * or null if empty. * @param afterBatchId If provided, the batch to search after. * @returns The next mutation or null if there wasn't one. */ function bo(t, e) { var n = m(t); return n.persistence.runTransaction("Get next mutation batch", "readonly", (function(t) { return void 0 === e && (e = -1), n.Sr.Bo(t, e); })); } /** * Reads the current value of a Document with a given key or null if not * found - used for testing. */ /** * Assigns the given target an internal ID so that its results can be pinned so * they don't get GC'd. A target must be allocated in the local store before * the store can be used to manage its view. * * Allocating an already allocated `Target` will return the existing `TargetData` * for that `Target`. */ function Io(t, e) { var n = m(t); return n.persistence.runTransaction("Allocate target", "readwrite", (function(t) { var r; return n.Ka.va(t, e).next((function(i) { return i ? ( // This target has been listened to previously, so reuse the // previous targetID. // TODO(mcg): freshen last accessed date? r = i, yr.resolve(r)) : n.Ka.wa(t).next((function(i) { return r = new gt(e, i, 0 /* Listen */ , t.xa), n.Ka.Ra(t, r).next((function() { return r; })); })); })); })).then((function(t) { // If Multi-Tab is enabled, the existing target data may be newer than // the in-memory data var r = n.bc.get(t.targetId); return (null === r || t.nt.L(r.nt) > 0) && (n.bc = n.bc.ot(t.targetId, t), n.vc.set(e, t.targetId)), t; })); } /** * Returns the TargetData as seen by the LocalStore, including updates that may * have not yet been persisted to the TargetCache. */ // Visible for testing. /** * Unpins all the documents associated with the given target. If * `keepPersistedTargetData` is set to false and Eager GC enabled, the method * directly removes the associated target data from the target cache. * * Releasing a non-existing `Target` is a no-op. */ // PORTING NOTE: `keepPersistedTargetData` is multi-tab only. function Eo(e, n, r) { return t.__awaiter(this, void 0, void 0, (function() { var i, o, s, u; return t.__generator(this, (function(t) { switch (t.label) { case 0: i = m(e), o = i.bc.get(n), s = r ? "readwrite" : "readwrite-primary", t.label = 1; case 1: return t.trys.push([ 1, 4, , 5 ]), r ? [ 3 /*break*/ , 3 ] : [ 4 /*yield*/ , i.persistence.runTransaction("Release target", s, (function(t) { return i.persistence.No.removeTarget(t, o); })) ]; case 2: t.sent(), t.label = 3; case 3: return [ 3 /*break*/ , 5 ]; case 4: if (!_r(u = t.sent())) throw u; // All `releaseTarget` does is record the final metadata state for the // target, but we've been recording this periodically during target // activity. If we lose this write this could cause a very slight // difference in the order of target deletion during GC, but we // don't define exact LRU semantics so this is acceptable. return l("LocalStore", "Failed to update sequence numbers for target " + n + ": " + u), [ 3 /*break*/ , 5 ]; case 5: return i.bc = i.bc.remove(n), i.vc.delete(o.target), [ 2 /*return*/ ]; } })); })); } /** * Runs the specified query against the local store and returns the results, * potentially taking advantage of query data from previous executions (such * as the set of remote keys). * * @param usePreviousResults Whether results from previous executions can * be used to optimize this query execution. */ function To(t, e, n) { var r = m(t), i = st.min(), o = Ot(); return r.persistence.runTransaction("Execute query", "readonly", (function(t) { return function(t, e, n) { var r = m(t), i = r.vc.get(n); return void 0 !== i ? yr.resolve(r.bc.get(i)) : r.Ka.va(e, n); }(r, t, zn(e)).next((function(e) { if (e) return i = e.lastLimboFreeSnapshotVersion, r.Ka.Fa(t, e.targetId).next((function(t) { o = t; })); })).next((function() { return r.Vc.Lr(t, e, n ? i : st.min(), n ? o : Ot()); })).next((function(t) { return { documents: t, Fc: o }; })); })); } // PORTING NOTE: Multi-Tab only. function No(t, e) { var n = m(t), r = m(n.Ka), i = n.bc.get(e); return i ? Promise.resolve(i.target) : n.persistence.runTransaction("Get target data", "readonly", (function(t) { return r.Ue(t, e).next((function(t) { return t ? t.target : null; })); })); } /** * Returns the set of documents that have been updated since the last call. * If this is the first call, returns the set of changes since client * initialization. Further invocations will return document that have changed * since the prior call. */ // PORTING NOTE: Multi-Tab only. function Ao(t) { var e = m(t); return e.persistence.runTransaction("Get new document changes", "readonly", (function(t) { return function(t, e, n) { var r = m(t), i = St(), o = gi(n), s = Oi(e), u = IDBKeyRange.lowerBound(o, !0); return s.rs({ index: Ki.readTimeIndex, range: u }, (function(t, e) { // Unlike `getEntry()` and others, `getNewDocumentChanges()` parses // the documents directly since we want to keep sentinel deletes. var n = vi(r.serializer, e); i = i.ot(n.key, n), o = e.readTime; })).next((function() { return { xc: i, readTime: mi(o) }; })); }(e.Dc, t, e.Sc); })).then((function(t) { var n = t.xc, r = t.readTime; return e.Sc = r, n; })); } /** * Reads the newest document change from persistence and moves the internal * synchronization marker forward so that calls to `getNewDocumentChanges()` * only return changes that happened after client initialization. */ // PORTING NOTE: Multi-Tab only. function So(e) { return t.__awaiter(this, void 0, void 0, (function() { var n; return t.__generator(this, (function(t) { return [ 2 /*return*/ , (n = m(e)).persistence.runTransaction("Synchronize last document change read time", "readonly", (function(t) { return function(t) { var e = Oi(t), n = st.min(); // If there are no existing entries, we return SnapshotVersion.min(). return e.rs({ index: Ki.readTimeIndex, reverse: !0 }, (function(t, e, r) { e.readTime && (n = mi(e.readTime)), r.done(); })).next((function() { return n; })); }(t); })).then((function(t) { n.Sc = t; })) ]; })); })); } /** * Verifies the error thrown by a LocalStore operation. If a LocalStore * operation fails because the primary lease has been taken by another client, * we ignore the error (the persistence layer will immediately call * `applyPrimaryLease` to propagate the primary state change). All other errors * are re-thrown. * * @param err An error returned by a LocalStore operation. * @return A Promise that resolves after we recovered, or the original error. */ function Do(e) { return t.__awaiter(this, void 0, void 0, (function() { return t.__generator(this, (function(t) { if (e.code !== a.FAILED_PRECONDITION || e.message !== ti) throw e; return l("LocalStore", "Unexpectedly lost primary lease"), [ 2 /*return*/ ]; })); })); } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * A collection of references to a document from some kind of numbered entity * (either a target ID or batch ID). As references are added to or removed from * the set corresponding events are emitted to a registered garbage collector. * * Each reference is represented by a DocumentReference object. Each of them * contains enough information to uniquely identify the reference. They are all * stored primarily in a set sorted by key. A document is considered garbage if * there's no references in that set (this can be efficiently checked thanks to * sorting by key). * * ReferenceSet also keeps a secondary set that contains references sorted by * IDs. This one is used to efficiently implement removal of all references by * some target ID. */ var xo = /** @class */ function() { function t() { // A set of outstanding references to a document sorted by key. this.$c = new Tt(Lo.kc), // A set of outstanding references to a document sorted by target id. this.Mc = new Tt(Lo.Oc) /** Returns true if the reference set contains no references. */; } return t.prototype.m = function() { return this.$c.m(); }, /** Adds a reference to the given document key for the given ID. */ t.prototype.Da = function(t, e) { var n = new Lo(t, e); this.$c = this.$c.add(n), this.Mc = this.Mc.add(n); }, /** Add references to the given document keys for the given ID. */ t.prototype.Lc = function(t, e) { var n = this; t.forEach((function(t) { return n.Da(t, e); })); }, /** * Removes a reference to the given document key for the given * ID. */ t.prototype.Na = function(t, e) { this.Bc(new Lo(t, e)); }, t.prototype.qc = function(t, e) { var n = this; t.forEach((function(t) { return n.Na(t, e); })); }, /** * Clears all references with a given ID. Calls removeRef() for each key * removed. */ t.prototype.Uc = function(t) { var e = this, n = new A(new E([])), r = new Lo(n, t), i = new Lo(n, t + 1), o = []; return this.Mc.Ft([ r, i ], (function(t) { e.Bc(t), o.push(t.key); })), o; }, t.prototype.Qc = function() { var t = this; this.$c.forEach((function(e) { return t.Bc(e); })); }, t.prototype.Bc = function(t) { this.$c = this.$c.delete(t), this.Mc = this.Mc.delete(t); }, t.prototype.Wc = function(t) { var e = new A(new E([])), n = new Lo(e, t), r = new Lo(e, t + 1), i = Ot(); return this.Mc.Ft([ n, r ], (function(t) { i = i.add(t.key); })), i; }, t.prototype.Ho = function(t) { var e = new Lo(t, 0), n = this.$c.$t(e); return null !== n && t.isEqual(n.key); }, t; }(), Lo = /** @class */ function() { function t(t, e) { this.key = t, this.jc = e /** Compare by key then by ID */; } return t.kc = function(t, e) { return A.i(t.key, e.key) || H(t.jc, e.jc); }, /** Compare by ID then by key */ t.Oc = function(t, e) { return H(t.jc, e.jc) || A.i(t.key, e.key); }, t; }(), ko = function(t, e) { this.user = e, this.type = "OAuth", this.Kc = {}, // Set the headers using Object Literal notation to avoid minification this.Kc.Authorization = "Bearer " + t; }, Ro = /** @class */ function() { function t() { /** * Stores the listener registered with setChangeListener() * This isn't actually necessary since the UID never changes, but we use this * to verify the listen contract is adhered to in tests. */ this.Gc = null; } return t.prototype.getToken = function() { return Promise.resolve(null); }, t.prototype.zc = function() {}, t.prototype.Hc = function(t) { this.Gc = t, // Fire with initial user. t(Mr.UNAUTHENTICATED); }, t.prototype.Yc = function() { this.Gc = null; }, t; }(), Oo = /** @class */ function() { function t(t) { var e = this; /** * The auth token listener registered with FirebaseApp, retained here so we * can unregister it. */ this.Jc = null, /** Tracks the current User. */ this.currentUser = Mr.UNAUTHENTICATED, this.Xc = !1, /** * Counter used to detect if the token changed while a getToken request was * outstanding. */ this.Zc = 0, /** The listener registered with setChangeListener(). */ this.Gc = null, this.forceRefresh = !1, this.Jc = function() { e.Zc++, e.currentUser = e.tu(), e.Xc = !0, e.Gc && e.Gc(e.currentUser); }, this.Zc = 0, this.auth = t.getImmediate({ optional: !0 }), this.auth ? this.auth.addAuthTokenListener(this.Jc) : ( // if auth is not available, invoke tokenListener once with null token this.Jc(null), t.get().then((function(t) { e.auth = t, e.Jc && // tokenListener can be removed by removeChangeListener() e.auth.addAuthTokenListener(e.Jc); }), (function() {}))); } return t.prototype.getToken = function() { var t = this, e = this.Zc, n = this.forceRefresh; // Take note of the current value of the tokenCounter so that this method // can fail (with an ABORTED error) if there is a token change while the // request is outstanding. return this.forceRefresh = !1, this.auth ? this.auth.getToken(n).then((function(n) { // Cancel the request since the token changed while the request was // outstanding so the response is potentially for a previous user (which // user, we can't be sure). return t.Zc !== e ? (l("FirebaseCredentialsProvider", "getToken aborted due to token change."), t.getToken()) : n ? (g("string" == typeof n.accessToken), new ko(n.accessToken, t.currentUser)) : null; })) : Promise.resolve(null); }, t.prototype.zc = function() { this.forceRefresh = !0; }, t.prototype.Hc = function(t) { this.Gc = t, // Fire the initial event this.Xc && t(this.currentUser); }, t.prototype.Yc = function() { this.auth && this.auth.removeAuthTokenListener(this.Jc), this.Jc = null, this.Gc = null; }, // Auth.getUid() can return null even with a user logged in. It is because // getUid() is synchronous, but the auth code populating Uid is asynchronous. // This method should only be called in the AuthTokenListener callback // to guarantee to get the actual user. t.prototype.tu = function() { var t = this.auth && this.auth.getUid(); return g(null === t || "string" == typeof t), new Mr(t); }, t; }(), Po = /** @class */ function() { function t(t, e) { this.eu = t, this.nu = e, this.type = "FirstParty", this.user = Mr.ni; } return Object.defineProperty(t.prototype, "Kc", { get: function() { var t = { "X-Goog-AuthUser": this.nu }, e = this.eu.auth.getAuthHeaderValueForFirstParty([]); // Use array notation to prevent minification return e && (t.Authorization = e), t; }, enumerable: !1, configurable: !0 }), t; }(), Vo = /** @class */ function() { function t(t, e) { this.eu = t, this.nu = e; } return t.prototype.getToken = function() { return Promise.resolve(new Po(this.eu, this.nu)); }, t.prototype.Hc = function(t) { // Fire with initial uid. t(Mr.ni); }, t.prototype.Yc = function() {}, t.prototype.zc = function() {}, t; }(), Uo = /** @class */ function() { function e(t, e, n, r, i, o) { this.fn = t, this.su = n, this.iu = r, this.ru = i, this.listener = o, this.state = 0 /* Initial */ , /** * A close count that's incremented every time the stream is closed; used by * getCloseGuardedDispatcher() to invalidate callbacks that happen after * close. */ this.ou = 0, this.au = null, this.stream = null, this.ys = new vr(t, e) /** * Returns true if start() has been called and no error has occurred. True * indicates the stream is open or in the process of opening (which * encompasses respecting backoff, getting auth tokens, and starting the * actual RPC). Use isOpen() to determine if the stream is open and ready for * outbound requests. */; } return e.prototype.cu = function() { return 1 /* Starting */ === this.state || 2 /* Open */ === this.state || 4 /* Backoff */ === this.state; }, /** * Returns true if the underlying RPC is open (the onOpen() listener has been * called) and the stream is ready for outbound requests. */ e.prototype.uu = function() { return 2 /* Open */ === this.state; }, /** * Starts the RPC. Only allowed if isStarted() returns false. The stream is * not immediately ready for use: onOpen() will be invoked when the RPC is * ready for outbound requests, at which point isOpen() will return true. * * When start returns, isStarted() will return true. */ e.prototype.start = function() { 3 /* Error */ !== this.state ? this.auth() : this.hu(); }, /** * Stops the RPC. This call is idempotent and allowed regardless of the * current isStarted() state. * * When stop returns, isStarted() and isOpen() will both return false. */ e.prototype.stop = function() { return t.__awaiter(this, void 0, void 0, (function() { return t.__generator(this, (function(t) { switch (t.label) { case 0: return this.cu() ? [ 4 /*yield*/ , this.close(0 /* Initial */) ] : [ 3 /*break*/ , 2 ]; case 1: t.sent(), t.label = 2; case 2: return [ 2 /*return*/ ]; } })); })); }, /** * After an error the stream will usually back off on the next attempt to * start it. If the error warrants an immediate restart of the stream, the * sender can use this to indicate that the receiver should not back off. * * Each error will call the onClose() listener. That function can decide to * inhibit backoff if required. */ e.prototype.lu = function() { this.state = 0 /* Initial */ , this.ys.reset(); }, /** * Marks this stream as idle. If no further actions are performed on the * stream for one minute, the stream will automatically close itself and * notify the stream's onClose() handler with Status.OK. The stream will then * be in a !isStarted() state, requiring the caller to start the stream again * before further use. * * Only streams that are in state 'Open' can be marked idle, as all other * states imply pending network operations. */ e.prototype._u = function() { var t = this; // Starts the idle time if we are in state 'Open' and are not yet already // running a timer (in which case the previous idle timeout still applies). this.uu() && null === this.au && (this.au = this.fn.yn(this.su, 6e4, (function() { return t.fu(); }))); }, /** Sends a message to the underlying stream. */ e.prototype.du = function(t) { this.wu(), this.stream.send(t); }, /** Called by the idle timer when the stream should close due to inactivity. */ e.prototype.fu = function() { return t.__awaiter(this, void 0, void 0, (function() { return t.__generator(this, (function(t) { return this.uu() ? [ 2 /*return*/ , this.close(0 /* Initial */) ] : [ 2 /*return*/ ]; })); })); }, /** Marks the stream as active again. */ e.prototype.wu = function() { this.au && (this.au.cancel(), this.au = null); }, /** * Closes the stream and cleans up as necessary: * * * closes the underlying GRPC stream; * * calls the onClose handler with the given 'error'; * * sets internal stream state to 'finalState'; * * adjusts the backoff timer based on the error * * A new stream can be opened by calling start(). * * @param finalState the intended state of the stream after closing. * @param error the error the connection was closed with. */ e.prototype.close = function(e, n) { return t.__awaiter(this, void 0, void 0, (function() { return t.__generator(this, (function(t) { switch (t.label) { case 0: // Notify the listener that the stream closed. // Cancel any outstanding timers (they're guaranteed not to execute). return this.wu(), this.ys.cancel(), // Invalidates any stream-related callbacks (e.g. from auth or the // underlying stream), guaranteeing they won't execute. this.ou++, 3 /* Error */ !== e ? // If this is an intentional close ensure we don't delay our next connection attempt. this.ys.reset() : n && n.code === a.RESOURCE_EXHAUSTED ? ( // Log the error. (Probably either 'quota exceeded' or 'max queue length reached'.) p(n.toString()), p("Using maximum backoff delay to prevent overloading the backend."), this.ys.Rn()) : n && n.code === a.UNAUTHENTICATED && // "unauthenticated" error means the token was rejected. Try force refreshing it in case it // just expired. this.ru.zc(), // Clean up the underlying stream because we are no longer interested in events. null !== this.stream && (this.mu(), this.stream.close(), this.stream = null), // This state must be assigned before calling onClose() to allow the callback to // inhibit backoff or otherwise manipulate the state in its non-started state. this.state = e, [ 4 /*yield*/ , this.listener.Tu(n) ]; case 1: // Cancel any outstanding timers (they're guaranteed not to execute). // Notify the listener that the stream closed. return t.sent(), [ 2 /*return*/ ]; } })); })); }, /** * Can be overridden to perform additional cleanup before the stream is closed. * Calling super.tearDown() is not required. */ e.prototype.mu = function() {}, e.prototype.auth = function() { var t = this; this.state = 1 /* Starting */; var e = this.Eu(this.ou), n = this.ou; // TODO(mikelehen): Just use dispatchIfNotClosed, but see TODO below. this.ru.getToken().then((function(e) { // Stream can be stopped while waiting for authentication. // TODO(mikelehen): We really should just use dispatchIfNotClosed // and let this dispatch onto the queue, but that opened a spec test can // of worms that I don't want to deal with in this PR. t.ou === n && // Normally we'd have to schedule the callback on the AsyncQueue. // However, the following calls are safe to be called outside the // AsyncQueue since they don't chain asynchronous calls t.Iu(e); }), (function(n) { e((function() { var e = new c(a.UNKNOWN, "Fetching auth token failed: " + n.message); return t.Au(e); })); })); }, e.prototype.Iu = function(t) { var e = this, n = this.Eu(this.ou); this.stream = this.Ru(t), this.stream.gu((function() { n((function() { return e.state = 2 /* Open */ , e.listener.gu(); })); })), this.stream.Tu((function(t) { n((function() { return e.Au(t); })); })), this.stream.onMessage((function(t) { n((function() { return e.onMessage(t); })); })); }, e.prototype.hu = function() { var e = this; this.state = 4 /* Backoff */ , this.ys.gn((function() { return t.__awaiter(e, void 0, void 0, (function() { return t.__generator(this, (function(t) { return this.state = 0 /* Initial */ , this.start(), [ 2 /*return*/ ]; })); })); })); }, // Visible for tests e.prototype.Au = function(t) { // In theory the stream could close cleanly, however, in our current model // we never expect this to happen because if we stop a stream ourselves, // this callback will never be called. To prevent cases where we retry // without a backoff accidentally, we set the stream to error in all cases. return l("PersistentStream", "close with error: " + t), this.stream = null, this.close(3 /* Error */ , t); }, /** * Returns a "dispatcher" function that dispatches operations onto the * AsyncQueue but only runs them if closeCount remains unchanged. This allows * us to turn auth / stream callbacks into no-ops if the stream is closed / * re-opened, etc. */ e.prototype.Eu = function(t) { var e = this; return function(n) { e.fn.ws((function() { return e.ou === t ? n() : (l("PersistentStream", "stream callback skipped by getCloseGuardedDispatcher."), Promise.resolve()); })); }; }, e; }(), Co = /** @class */ function(e) { function n(t, n, r, i, o) { var s = this; return (s = e.call(this, t, "listen_stream_connection_backoff" /* ListenStreamConnectionBackoff */ , "listen_stream_idle" /* ListenStreamIdle */ , n, r, o) || this).serializer = i, s; } return t.__extends(n, e), n.prototype.Ru = function(t) { return this.iu.Pu("Listen", t); }, n.prototype.onMessage = function(t) { // A successful response means the stream is healthy this.ys.reset(); var e = function(t, e) { var n; if ("targetChange" in e) { e.targetChange; // proto3 default value is unset in JSON (undefined), so use 'NO_CHANGE' // if unset var r = function(t) { return "NO_CHANGE" === t ? 0 /* NoChange */ : "ADD" === t ? 1 /* Added */ : "REMOVE" === t ? 2 /* Removed */ : "CURRENT" === t ? 3 /* Current */ : "RESET" === t ? 4 /* Reset */ : y(); }(e.targetChange.targetChangeType || "NO_CHANGE"), i = e.targetChange.targetIds || [], o = function(t, e) { return t.Qe ? (g(void 0 === e || "string" == typeof e), X.fromBase64String(e || "")) : (g(void 0 === e || e instanceof Uint8Array), X.fromUint8Array(e || new Uint8Array)); }(t, e.targetChange.resumeToken), s = e.targetChange.cause, u = s && function(t) { var e = void 0 === t.code ? a.UNKNOWN : _t(t.code); return new c(e, t.message || ""); }(s); n = new zt(r, i, o, u || null); } else if ("documentChange" in e) { e.documentChange; var h = e.documentChange; h.document, h.document.name, h.document.updateTime; var f = Se(t, h.document.name), l = Ee(h.document.updateTime), p = new Sn({ mapValue: { fields: h.document.fields } }), d = new kn(f, l, p, {}), v = h.targetIds || [], m = h.removedTargetIds || []; n = new jt(v, m, d.key, d); } else if ("documentDelete" in e) { e.documentDelete; var w = e.documentDelete; w.document; var _ = Se(t, w.document), b = w.readTime ? Ee(w.readTime) : st.min(), I = new Rn(_, b), E = w.removedTargetIds || []; n = new jt([], E, I.key, I); } else if ("documentRemove" in e) { e.documentRemove; var T = e.documentRemove; T.document; var N = Se(t, T.document), A = T.removedTargetIds || []; n = new jt([], A, N, null); } else { if (!("filter" in e)) return y(); e.filter; var S = e.filter; S.targetId; var D = S.count || 0, x = new mt(D), L = S.targetId; n = new Gt(L, x); } return n; }(this.serializer, t), n = function(t) { // We have only reached a consistent snapshot for the entire stream if there // is a read_time set and it applies to all targets (i.e. the list of // targets is empty). The backend is guaranteed to send such responses. if (!("targetChange" in t)) return st.min(); var e = t.targetChange; return e.targetIds && e.targetIds.length ? st.min() : e.readTime ? Ee(e.readTime) : st.min(); }(t); return this.listener.yu(e, n); }, /** * Registers interest in the results of the given target. If the target * includes a resumeToken it will be included in the request. Results that * affect the target will be streamed back as WatchChange messages that * reference the targetId. */ n.prototype.Vu = function(t) { var e = {}; e.database = Le(this.serializer), e.addTarget = function(t, e) { var n, r = e.target; return (n = dt(r) ? { documents: Ve(t, r) } : { query: Ue(t, r) }).targetId = e.targetId, e.resumeToken.O() > 0 && (n.resumeToken = be(t, e.resumeToken)), n; }(this.serializer, t); var n = function(t, e) { var n = function(t, e) { switch (e) { case 0 /* Listen */ : return null; case 1 /* ExistenceFilterMismatch */ : return "existence-filter-mismatch"; case 2 /* LimboResolution */ : return "limbo-document"; default: return y(); } }(0, e.et); return null == n ? null : { "goog-listen-tags": n }; }(this.serializer, t); n && (e.labels = n), this.du(e); }, /** * Unregisters interest in the results of the target associated with the * given targetId. */ n.prototype.pu = function(t) { var e = {}; e.database = Le(this.serializer), e.removeTarget = t, this.du(e); }, n; }(Uo), Fo = /** @class */ function(e) { function n(t, n, r, i, o) { var s = this; return (s = e.call(this, t, "write_stream_connection_backoff" /* WriteStreamConnectionBackoff */ , "write_stream_idle" /* WriteStreamIdle */ , n, r, o) || this).serializer = i, s.bu = !1, s; } return t.__extends(n, e), Object.defineProperty(n.prototype, "vu", { /** * Tracks whether or not a handshake has been successfully exchanged and * the stream is ready to accept mutations. */ get: function() { return this.bu; }, enumerable: !1, configurable: !0 }), // Override of PersistentStream.start n.prototype.start = function() { this.bu = !1, this.lastStreamToken = void 0, e.prototype.start.call(this); }, n.prototype.mu = function() { this.bu && this.Su([]); }, n.prototype.Ru = function(t) { return this.iu.Pu("Write", t); }, n.prototype.onMessage = function(t) { if ( // Always capture the last stream token. g(!!t.streamToken), this.lastStreamToken = t.streamToken, this.bu) { // A successful first write response means the stream is healthy, // Note, that we could consider a successful handshake healthy, however, // the write itself might be causing an error we want to back off from. this.ys.reset(); var e = function(t, e) { return t && t.length > 0 ? (g(void 0 !== e), t.map((function(t) { return function(t, e) { // NOTE: Deletes don't have an updateTime. var n = t.updateTime ? Ee(t.updateTime) : Ee(e); n.isEqual(st.min()) && ( // The Firestore Emulator currently returns an update time of 0 for // deletes of non-existing documents (rather than null). This breaks the // test "get deleted doc while offline with source=cache" as NoDocuments // with version 0 are filtered by IndexedDb's RemoteDocumentCache. // TODO(#2149): Remove this when Emulator is fixed n = Ee(e)); var r = null; return t.transformResults && t.transformResults.length > 0 && (r = t.transformResults), new hn(n, r); }(t, e); }))) : []; }(t.writeResults, t.commitTime), n = Ee(t.commitTime); return this.listener.Du(n, e); } // The first response is always the handshake response return g(!t.writeResults || 0 === t.writeResults.length), this.bu = !0, this.listener.Cu(); }, /** * Sends an initial streamToken to the server, performing the handshake * required to make the StreamingWrite RPC work. Subsequent * calls should wait until onHandshakeComplete was called. */ n.prototype.Nu = function() { // TODO(dimond): Support stream resumption. We intentionally do not set the // stream token on the handshake, ignoring any stream token we might have. var t = {}; t.database = Le(this.serializer), this.du(t); }, /** Sends a group of mutations to the Firestore backend to apply. */ n.prototype.Su = function(t) { var e = this, n = { streamToken: this.lastStreamToken, writes: t.map((function(t) { return Oe(e.serializer, t); })) }; this.du(n); }, n; }(Uo), Mo = /** @class */ function(e) { function n(t, n, r) { var i = this; return (i = e.call(this) || this).credentials = t, i.iu = n, i.serializer = r, i.Fu = !1, i; } return t.__extends(n, e), n.prototype.xu = function() { if (this.Fu) throw new c(a.FAILED_PRECONDITION, "The client has already been terminated."); }, /** Gets an auth token and invokes the provided RPC. */ n.prototype.$u = function(t, e, n) { var r = this; return this.xu(), this.credentials.getToken().then((function(i) { return r.iu.$u(t, e, n, i); })).catch((function(t) { throw t.code === a.UNAUTHENTICATED && r.credentials.zc(), t; })); }, /** Gets an auth token and invokes the provided RPC with streamed results. */ n.prototype.ku = function(t, e, n) { var r = this; return this.xu(), this.credentials.getToken().then((function(i) { return r.iu.ku(t, e, n, i); })).catch((function(t) { throw t.code === a.UNAUTHENTICATED && r.credentials.zc(), t; })); }, n.prototype.terminate = function() { this.Fu = !1; }, n; }((function() {})), qo = /** @class */ function() { function t(t, e) { this.cs = t, this.di = e, /** The current OnlineState. */ this.state = "Unknown" /* Unknown */ , /** * A count of consecutive failures to open the stream. If it reaches the * maximum defined by MAX_WATCH_STREAM_FAILURES, we'll set the OnlineState to * Offline. */ this.Mu = 0, /** * A timer that elapses after ONLINE_STATE_TIMEOUT_MS, at which point we * transition from OnlineState.Unknown to OnlineState.Offline without waiting * for the stream to actually fail (MAX_WATCH_STREAM_FAILURES times). */ this.Ou = null, /** * Whether the client should log a warning message if it fails to connect to * the backend (initially true, cleared after a successful stream, or if we've * logged the message already). */ this.Lu = !0 /** * Called by RemoteStore when a watch stream is started (including on each * backoff attempt). * * If this is the first attempt, it sets the OnlineState to Unknown and starts * the onlineStateTimer. */; } return t.prototype.Bu = function() { var t = this; 0 === this.Mu && (this.qu("Unknown" /* Unknown */), this.Ou = this.cs.yn("online_state_timeout" /* OnlineStateTimeout */ , 1e4, (function() { return t.Ou = null, t.Uu("Backend didn't respond within 10 seconds."), t.qu("Offline" /* Offline */), Promise.resolve(); }))); }, /** * Updates our OnlineState as appropriate after the watch stream reports a * failure. The first failure moves us to the 'Unknown' state. We then may * allow multiple failures (based on MAX_WATCH_STREAM_FAILURES) before we * actually transition to the 'Offline' state. */ t.prototype.Qu = function(t) { "Online" /* Online */ === this.state ? this.qu("Unknown" /* Unknown */) : (this.Mu++, this.Mu >= 1 && (this.Wu(), this.Uu("Connection failed 1 times. Most recent error: " + t.toString()), this.qu("Offline" /* Offline */))); }, /** * Explicitly sets the OnlineState to the specified state. * * Note that this resets our timers / failure counters, etc. used by our * Offline heuristics, so must not be used in place of * handleWatchStreamStart() and handleWatchStreamFailure(). */ t.prototype.set = function(t) { this.Wu(), this.Mu = 0, "Online" /* Online */ === t && ( // We've connected to watch at least once. Don't warn the developer // about being offline going forward. this.Lu = !1), this.qu(t); }, t.prototype.qu = function(t) { t !== this.state && (this.state = t, this.di(t)); }, t.prototype.Uu = function(t) { var e = "Could not reach Cloud Firestore backend. " + t + "\nThis typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend."; this.Lu ? (p(e), this.Lu = !1) : l("OnlineStateTracker", e); }, t.prototype.Wu = function() { null !== this.Ou && (this.Ou.cancel(), this.Ou = null); }, t; }(), jo = function( /** * The local store, used to fill the write pipeline with outbound mutations. */ e, /** The client-side proxy for interacting with the backend. */ n, r, i, o) { var s = this; this.ju = e, this.Ku = n, this.cs = r, this.Gu = {}, /** * A list of up to MAX_PENDING_WRITES writes that we have fetched from the * LocalStore via fillWritePipeline() and have or will send to the write * stream. * * Whenever writePipeline.length > 0 the RemoteStore will attempt to start or * restart the write stream. When the stream is established the writes in the * pipeline will be sent in order. * * Writes remain in writePipeline until they are acknowledged by the backend * and thus will automatically be re-sent if the stream is interrupted / * restarted before they're acknowledged. * * Write responses from the backend are linked to their originating request * purely based on order, and so we can just shift() writes from the front of * the writePipeline as we receive responses. */ this.zu = [], /** * A mapping of watched targets that the client cares about tracking and the * user has explicitly called a 'listen' for this target. * * These targets may or may not have been sent to or acknowledged by the * server. On re-establishing the listen stream, these targets should be sent * to the server. The targets removed with unlistens are removed eagerly * without waiting for confirmation from the listen stream. */ this.Hu = new Map, /** * A set of reasons for why the RemoteStore may be offline. If empty, the * RemoteStore may start its network connections. */ this.Yu = new Set, /** * Event handlers that get called when the network is disabled or enabled. * * PORTING NOTE: These functions are used on the Web client to create the * underlying streams (to support tree-shakeable streams). On Android and iOS, * the streams are created during construction of RemoteStore. */ this.Ju = [], this.Xu = o, this.Xu.Zu((function(e) { r.ws((function() { return t.__awaiter(s, void 0, void 0, (function() { return t.__generator(this, (function(e) { switch (e.label) { case 0: return Xo(this) ? (l("RemoteStore", "Restarting streams for network reachability change."), [ 4 /*yield*/ , function(e) { return t.__awaiter(this, void 0, void 0, (function() { var n; return t.__generator(this, (function(t) { switch (t.label) { case 0: return (n = m(e)).Yu.add(4 /* ConnectivityChange */), [ 4 /*yield*/ , zo(n) ]; case 1: return t.sent(), n.th.set("Unknown" /* Unknown */), n.Yu.delete(4 /* ConnectivityChange */), [ 4 /*yield*/ , Go(n) ]; case 2: return t.sent(), [ 2 /*return*/ ]; } })); })); }(this) ]) : [ 3 /*break*/ , 2 ]; case 1: e.sent(), e.label = 2; case 2: return [ 2 /*return*/ ]; } })); })); })); })), this.th = new qo(r, i); }; function Go(e) { return t.__awaiter(this, void 0, void 0, (function() { var n, r; return t.__generator(this, (function(t) { switch (t.label) { case 0: if (!Xo(e)) return [ 3 /*break*/ , 4 ]; n = 0, r = e.Ju, t.label = 1; case 1: return n < r.length ? [ 4 /*yield*/ , (0, r[n])(/* enabled= */ !0) ] : [ 3 /*break*/ , 4 ]; case 2: t.sent(), t.label = 3; case 3: return n++, [ 3 /*break*/ , 1 ]; case 4: return [ 2 /*return*/ ]; } })); })); } /** * Temporarily disables the network. The network can be re-enabled using * enableNetwork(). */ function zo(e) { return t.__awaiter(this, void 0, void 0, (function() { var n, r; return t.__generator(this, (function(t) { switch (t.label) { case 0: n = 0, r = e.Ju, t.label = 1; case 1: return n < r.length ? [ 4 /*yield*/ , (0, r[n])(/* enabled= */ !1) ] : [ 3 /*break*/ , 4 ]; case 2: t.sent(), t.label = 3; case 3: return n++, [ 3 /*break*/ , 1 ]; case 4: return [ 2 /*return*/ ]; } })); })); } function Bo(e) { return t.__awaiter(this, void 0, void 0, (function() { var n; return t.__generator(this, (function(t) { switch (t.label) { case 0: return n = m(e), l("RemoteStore", "RemoteStore shutting down."), n.Yu.add(5 /* Shutdown */), [ 4 /*yield*/ , zo(n) ]; case 1: return t.sent(), n.Xu.Di(), // Set the OnlineState to Unknown (rather than Offline) to avoid potentially // triggering spurious listener events with cached data, etc. n.th.set("Unknown" /* Unknown */), [ 2 /*return*/ ]; } })); })); } /** * Starts new listen for the given target. Uses resume token if provided. It * is a no-op if the target of given `TargetData` is already being listened to. */ function Wo(t, e) { var n = m(t); n.Hu.has(e.targetId) || ( // Mark this as something the client is currently listening for. n.Hu.set(e.targetId, e), $o(n) ? // The listen will be sent in onWatchStreamOpen Yo(n) : ls(n).uu() && Qo(n, e)); } /** * Removes the listen from server. It is a no-op if the given target id is * not being listened to. */ function Ko(t, e) { var n = m(t), r = ls(n); n.Hu.delete(e), r.uu() && Ho(n, e), 0 === n.Hu.size && (r.uu() ? r._u() : Xo(n) && // Revert to OnlineState.Unknown if the watch stream is not open and we // have no listeners, since without any listens to send we cannot // confirm if the stream is healthy and upgrade to OnlineState.Online. n.th.set("Unknown" /* Unknown */)); } /** * We need to increment the the expected number of pending responses we're due * from watch so we wait for the ack to process any messages from this target. */ function Qo(t, e) { t.eh.Ie(e.targetId), ls(t).Vu(e) /** * We need to increment the expected number of pending responses we're due * from watch so we wait for the removal on the server before we process any * messages from this target. */; } function Ho(t, e) { t.eh.Ie(e), ls(t).pu(e); } function Yo(t) { t.eh = new Wt({ qe: function(e) { return t.Gu.qe(e); }, Ue: function(e) { return t.Hu.get(e) || null; } }), ls(t).start(), t.th.Bu() /** * Returns whether the watch stream should be started because it's necessary * and has not yet been started. */; } function $o(t) { return Xo(t) && !ls(t).cu() && t.Hu.size > 0; } function Xo(t) { return 0 === m(t).Yu.size; } function Jo(t) { t.eh = void 0; } function Zo(e) { return t.__awaiter(this, void 0, void 0, (function() { return t.__generator(this, (function(t) { return e.Hu.forEach((function(t, n) { Qo(e, t); })), [ 2 /*return*/ ]; })); })); } function ts(e, n) { return t.__awaiter(this, void 0, void 0, (function() { return t.__generator(this, (function(t) { return Jo(e), // If we still need the watch stream, retry the connection. $o(e) ? (e.th.Qu(n), Yo(e)) : // No need to restart watch stream because there are no active targets. // The online state is set to unknown because there is no active attempt // at establishing a connection e.th.set("Unknown" /* Unknown */), [ 2 /*return*/ ]; })); })); } function es(e, n, r) { return t.__awaiter(this, void 0, void 0, (function() { var i, o, s; return t.__generator(this, (function(u) { switch (u.label) { case 0: if (e.th.set("Online" /* Online */), !(n instanceof zt && 2 /* Removed */ === n.state && n.cause)) // Mark the client as online since we got a message from the server return [ 3 /*break*/ , 6 ]; u.label = 1; case 1: return u.trys.push([ 1, 3, , 5 ]), [ 4 /*yield*/ , /** Handles an error on a target */ function(e, n) { return t.__awaiter(this, void 0, void 0, (function() { var r, i, o, s; return t.__generator(this, (function(t) { switch (t.label) { case 0: r = n.cause, i = 0, o = n.targetIds, t.label = 1; case 1: return i < o.length ? (s = o[i], e.Hu.has(s) ? [ 4 /*yield*/ , e.Gu.nh(s, r) ] : [ 3 /*break*/ , 3 ]) : [ 3 /*break*/ , 5 ]; case 2: t.sent(), e.Hu.delete(s), e.eh.removeTarget(s), t.label = 3; case 3: t.label = 4; case 4: return i++, [ 3 /*break*/ , 1 ]; case 5: return [ 2 /*return*/ ]; } })); })); }(e, n) ]; case 2: return u.sent(), [ 3 /*break*/ , 5 ]; case 3: return i = u.sent(), l("RemoteStore", "Failed to remove targets %s: %s ", n.targetIds.join(","), i), [ 4 /*yield*/ , ns(e, i) ]; case 4: return u.sent(), [ 3 /*break*/ , 5 ]; case 5: return [ 3 /*break*/ , 13 ]; case 6: if (n instanceof jt ? e.eh.be(n) : n instanceof Gt ? e.eh.$e(n) : e.eh.De(n), r.isEqual(st.min())) return [ 3 /*break*/ , 13 ]; u.label = 7; case 7: return u.trys.push([ 7, 11, , 13 ]), [ 4 /*yield*/ , wo(e.ju) ]; case 8: return o = u.sent(), r.L(o) >= 0 ? [ 4 /*yield*/ , /** * Takes a batch of changes from the Datastore, repackages them as a * RemoteEvent, and passes that on to the listener, which is typically the * SyncEngine. */ function(t, e) { var n = t.eh.Oe(e); // Update in-memory resume tokens. LocalStore will update the // persistent view of these when applying the completed RemoteEvent. return n.zt.forEach((function(n, r) { if (n.resumeToken.O() > 0) { var i = t.Hu.get(r); // A watched target might have been removed already. i && t.Hu.set(r, i.it(n.resumeToken, e)); } })), // Re-establish listens for the targets that have been invalidated by // existence filter mismatches. n.Ht.forEach((function(e) { var n = t.Hu.get(e); if (n) { // Clear the resume token for the target, since we're in a known mismatch // state. t.Hu.set(e, n.it(X.B, n.nt)), // Cause a hard reset by unwatching and rewatching immediately, but // deliberately don't send a resume token so that we get a full update. Ho(t, e); // Mark the target we send as being on behalf of an existence filter // mismatch, but don't actually retain that in listenTargets. This ensures // that we flag the first re-listen this way without impacting future // listens of this target (that might happen e.g. on reconnect). var r = new gt(n.target, e, 1 /* ExistenceFilterMismatch */ , n.sequenceNumber); Qo(t, r); } })), t.Gu.sh(n); }(e, r) ] : [ 3 /*break*/ , 10 ]; // We have received a target change with a global snapshot if the snapshot // version is not equal to SnapshotVersion.min(). case 9: // We have received a target change with a global snapshot if the snapshot // version is not equal to SnapshotVersion.min(). u.sent(), u.label = 10; case 10: return [ 3 /*break*/ , 13 ]; case 11: return l("RemoteStore", "Failed to raise snapshot:", s = u.sent()), [ 4 /*yield*/ , ns(e, s) ]; case 12: return u.sent(), [ 3 /*break*/ , 13 ]; case 13: return [ 2 /*return*/ ]; } })); })); } /** * Recovery logic for IndexedDB errors that takes the network offline until * `op` succeeds. Retries are scheduled with backoff using * `enqueueRetryable()`. If `op()` is not provided, IndexedDB access is * validated via a generic operation. * * The returned Promise is resolved once the network is disabled and before * any retry attempt. */ function ns(e, n, r) { return t.__awaiter(this, void 0, void 0, (function() { var i = this; return t.__generator(this, (function(o) { switch (o.label) { case 0: if (!_r(n)) throw n; // Disable network and raise offline snapshots return e.Yu.add(1 /* IndexedDbFailed */), [ 4 /*yield*/ , zo(e) ]; case 1: // Disable network and raise offline snapshots return o.sent(), e.th.set("Offline" /* Offline */), r || ( // Use a simple read operation to determine if IndexedDB recovered. // Ideally, we would expose a health check directly on SimpleDb, but // RemoteStore only has access to persistence through LocalStore. r = function() { return wo(e.ju); }), // Probe IndexedDB periodically and re-enable network e.cs.Cs((function() { return t.__awaiter(i, void 0, void 0, (function() { return t.__generator(this, (function(t) { switch (t.label) { case 0: return l("RemoteStore", "Retrying IndexedDB access"), [ 4 /*yield*/ , r() ]; case 1: return t.sent(), e.Yu.delete(1 /* IndexedDbFailed */), [ 4 /*yield*/ , Go(e) ]; case 2: return t.sent(), [ 2 /*return*/ ]; } })); })); })), [ 2 /*return*/ ]; } })); })); } /** * Executes `op`. If `op` fails, takes the network offline until `op` * succeeds. Returns after the first attempt. */ function rs(t, e) { return e().catch((function(n) { return ns(t, n, e); })); } function is(e) { return t.__awaiter(this, void 0, void 0, (function() { var n, r, i, o, s; return t.__generator(this, (function(t) { switch (t.label) { case 0: n = m(e), r = ps(n), i = n.zu.length > 0 ? n.zu[n.zu.length - 1].batchId : -1, t.label = 1; case 1: if (! /** * Returns true if we can add to the write pipeline (i.e. the network is * enabled and the write pipeline is not full). */ function(t) { return Xo(t) && t.zu.length < 10; } /** * Queues additional writes to be sent to the write stream, sending them * immediately if the write stream is established. */ (n)) return [ 3 /*break*/ , 7 ]; t.label = 2; case 2: return t.trys.push([ 2, 4, , 6 ]), [ 4 /*yield*/ , bo(n.ju, i) ]; case 3: return null === (o = t.sent()) ? (0 === n.zu.length && r._u(), [ 3 /*break*/ , 7 ]) : (i = o.batchId, function(t, e) { t.zu.push(e); var n = ps(t); n.uu() && n.vu && n.Su(e.mutations); }(n, o), [ 3 /*break*/ , 6 ]); case 4: return s = t.sent(), [ 4 /*yield*/ , ns(n, s) ]; case 5: return t.sent(), [ 3 /*break*/ , 6 ]; case 6: return [ 3 /*break*/ , 1 ]; case 7: return os(n) && ss(n), [ 2 /*return*/ ]; } })); })); } function os(t) { return Xo(t) && !ps(t).cu() && t.zu.length > 0; } function ss(t) { ps(t).start(); } function us(e) { return t.__awaiter(this, void 0, void 0, (function() { return t.__generator(this, (function(t) { return ps(e).Nu(), [ 2 /*return*/ ]; })); })); } function as(e) { return t.__awaiter(this, void 0, void 0, (function() { var n, r, i, o; return t.__generator(this, (function(t) { // Send the write pipeline now that the stream is established. for (n = ps(e), r = 0, i = e.zu; r < i.length; r++) o = i[r], n.Su(o.mutations); return [ 2 /*return*/ ]; })); })); } function cs(e, n, r) { return t.__awaiter(this, void 0, void 0, (function() { var i, o; return t.__generator(this, (function(t) { switch (t.label) { case 0: return i = e.zu.shift(), o = Jr.from(i, n, r), [ 4 /*yield*/ , rs(e, (function() { return e.Gu.ih(o); })) ]; case 1: // It's possible that with the completion of this mutation another // slot has freed up. return t.sent(), [ 4 /*yield*/ , is(e) ]; case 2: // It's possible that with the completion of this mutation another // slot has freed up. return t.sent(), [ 2 /*return*/ ]; } })); })); } function hs(e, n) { return t.__awaiter(this, void 0, void 0, (function() { return t.__generator(this, (function(r) { switch (r.label) { case 0: return n && ps(e).vu ? [ 4 /*yield*/ , function(e, n) { return t.__awaiter(this, void 0, void 0, (function() { var r, i; return t.__generator(this, (function(t) { switch (t.label) { case 0: return wt(i = n.code) && i !== a.ABORTED ? (r = e.zu.shift(), // In this case it's also unlikely that the server itself is melting // down -- this was just a bad request so inhibit backoff on the next // restart. ps(e).lu(), [ 4 /*yield*/ , rs(e, (function() { return e.Gu.rh(r.batchId, n); })) ]) : [ 3 /*break*/ , 3 ]; case 1: // It's possible that with the completion of this mutation // another slot has freed up. return t.sent(), [ 4 /*yield*/ , is(e) ]; case 2: // In this case it's also unlikely that the server itself is melting // down -- this was just a bad request so inhibit backoff on the next // restart. // It's possible that with the completion of this mutation // another slot has freed up. t.sent(), t.label = 3; case 3: return [ 2 /*return*/ ]; } })); })); }(e, n) ] : [ 3 /*break*/ , 2 ]; // This error affects the actual write. case 1: // This error affects the actual write. r.sent(), r.label = 2; case 2: // If the write stream closed after the write handshake completes, a write // operation failed and we fail the pending operation. // The write stream might have been started by refilling the write // pipeline for failed writes return os(e) && ss(e), [ 2 /*return*/ ]; } })); })); } /** * Toggles the network state when the client gains or loses its primary lease. */ function fs(e, n) { return t.__awaiter(this, void 0, void 0, (function() { var r, i; return t.__generator(this, (function(t) { switch (t.label) { case 0: return r = m(e), n ? (r.Yu.delete(2 /* IsSecondary */), [ 4 /*yield*/ , Go(r) ]) : [ 3 /*break*/ , 2 ]; case 1: return t.sent(), [ 3 /*break*/ , 5 ]; case 2: return (i = n) ? [ 3 /*break*/ , 4 ] : (r.Yu.add(2 /* IsSecondary */), [ 4 /*yield*/ , zo(r) ]); case 3: t.sent(), i = r.th.set("Unknown" /* Unknown */), t.label = 4; case 4: i, t.label = 5; case 5: return [ 2 /*return*/ ]; } })); })); } /** * If not yet initialized, registers the WatchStream and its network state * callback with `remoteStoreImpl`. Returns the existing stream if one is * already available. * * PORTING NOTE: On iOS and Android, the WatchStream gets registered on startup. * This is not done on Web to allow it to be tree-shaken. */ function ls(e) { var n = this; return e.oh || ( // Create stream (but note that it is not started yet). e.oh = function(t, e, n) { var r = m(t); return r.xu(), new Co(e, r.iu, r.credentials, r.serializer, n); }(e.Ku, e.cs, { gu: Zo.bind(null, e), Tu: ts.bind(null, e), yu: es.bind(null, e) }), e.Ju.push((function(r) { return t.__awaiter(n, void 0, void 0, (function() { return t.__generator(this, (function(t) { switch (t.label) { case 0: return r ? (e.oh.lu(), $o(e) ? Yo(e) : e.th.set("Unknown" /* Unknown */), [ 3 /*break*/ , 3 ]) : [ 3 /*break*/ , 1 ]; case 1: return [ 4 /*yield*/ , e.oh.stop() ]; case 2: t.sent(), Jo(e), t.label = 3; case 3: return [ 2 /*return*/ ]; } })); })); }))), e.oh /** * If not yet initialized, registers the WriteStream and its network state * callback with `remoteStoreImpl`. Returns the existing stream if one is * already available. * * PORTING NOTE: On iOS and Android, the WriteStream gets registered on startup. * This is not done on Web to allow it to be tree-shaken. */; } function ps(e) { var n = this; return e.ah || ( // Create stream (but note that it is not started yet). e.ah = function(t, e, n) { var r = m(t); return r.xu(), new Fo(e, r.iu, r.credentials, r.serializer, n); }(e.Ku, e.cs, { gu: us.bind(null, e), Tu: hs.bind(null, e), Cu: as.bind(null, e), Du: cs.bind(null, e) }), e.Ju.push((function(r) { return t.__awaiter(n, void 0, void 0, (function() { return t.__generator(this, (function(t) { switch (t.label) { case 0: return r ? (e.ah.lu(), [ 4 /*yield*/ , is(e) ]) : [ 3 /*break*/ , 2 ]; case 1: // This will start the write stream if necessary. return t.sent(), [ 3 /*break*/ , 4 ]; case 2: return [ 4 /*yield*/ , e.ah.stop() ]; case 3: t.sent(), e.zu.length > 0 && (l("RemoteStore", "Stopping write stream with " + e.zu.length + " pending writes"), e.zu = []), t.label = 4; case 4: return [ 2 /*return*/ ]; } })); })); }))), e.ah /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */; } var ds = function(t) { this.key = t; }, vs = function(t) { this.key = t; }, ys = /** @class */ function() { function t(t, /** Documents included in the remote target */ e) { this.query = t, this.uh = e, this.hh = null, /** * A flag whether the view is current with the backend. A view is considered * current after it has seen the current flag from the backend and did not * lose consistency within the watch stream (e.g. because of an existence * filter mismatch). */ this.te = !1, /** Documents in the view but not in the remote target */ this.lh = Ot(), /** Document Keys that have local changes */ this.Wt = Ot(), this._h = Xn(t), this.fh = new Ut(this._h); } return Object.defineProperty(t.prototype, "dh", { /** * The set of remote documents that the server has told us belongs to the target associated with * this view. */ get: function() { return this.uh; }, enumerable: !1, configurable: !0 }), /** * Iterates over a set of doc changes, applies the query limit, and computes * what the new results should be, what the changes were, and whether we may * need to go back to the local cache for more results. Does not make any * changes to the view. * @param docChanges The doc changes to apply to this view. * @param previousChanges If this is being called with a refill, then start * with this set of docs and changes instead of the current view. * @return a new set of docs, changes, and refill flag. */ t.prototype.wh = function(t, e) { var n = this, r = e ? e.mh : new Ct, i = e ? e.fh : this.fh, o = e ? e.Wt : this.Wt, s = i, u = !1, a = Cn(this.query) && i.size === this.query.limit ? i.last() : null, c = Fn(this.query) && i.size === this.query.limit ? i.first() : null; // Drop documents out to meet limit/limitToLast requirement. if (t.ht((function(t, e) { var h = i.get(t), f = e instanceof kn ? e : null; f && (f = $n(n.query, f) ? f : null); var l = !!h && n.Wt.has(h.key), p = !!f && (f.Je || // We only consider committed mutations for documents that were // mutated during the lifetime of the view. n.Wt.has(f.key) && f.hasCommittedMutations), d = !1; // Calculate change h && f ? h.data().isEqual(f.data()) ? l !== p && (r.track({ type: 3 /* Metadata */ , doc: f }), d = !0) : n.Th(h, f) || (r.track({ type: 2 /* Modified */ , doc: f }), d = !0, (a && n._h(f, a) > 0 || c && n._h(f, c) < 0) && ( // This doc moved from inside the limit to outside the limit. // That means there may be some other doc in the local cache // that should be included instead. u = !0)) : !h && f ? (r.track({ type: 0 /* Added */ , doc: f }), d = !0) : h && !f && (r.track({ type: 1 /* Removed */ , doc: h }), d = !0, (a || c) && ( // A doc was removed from a full limit query. We'll need to // requery from the local cache to see if we know about some other // doc that should be in the results. u = !0)), d && (f ? (s = s.add(f), o = p ? o.add(t) : o.delete(t)) : (s = s.delete(t), o = o.delete(t))); })), Cn(this.query) || Fn(this.query)) for (;s.size > this.query.limit; ) { var h = Cn(this.query) ? s.last() : s.first(); s = s.delete(h.key), o = o.delete(h.key), r.track({ type: 1 /* Removed */ , doc: h }); } return { fh: s, mh: r, Eh: u, Wt: o }; }, t.prototype.Th = function(t, e) { // We suppress the initial change event for documents that were modified as // part of a write acknowledgment (e.g. when the value of a server transform // is applied) as Watch will send us the same document again. // By suppressing the event, we only raise two user visible events (one with // `hasPendingWrites` and the final state of the document) instead of three // (one with `hasPendingWrites`, the modified document with // `hasPendingWrites` and the final state of the document). return t.Je && e.hasCommittedMutations && !e.Je; }, /** * Updates the view with the given ViewDocumentChanges and optionally updates * limbo docs and sync state from the provided target change. * @param docChanges The set of changes to make to the view's docs. * @param updateLimboDocuments Whether to update limbo documents based on this * change. * @param targetChange A target change to apply for computing limbo docs and * sync state. * @return A new ViewChange with the given docs, changes, and sync state. */ // PORTING NOTE: The iOS/Android clients always compute limbo document changes. t.prototype.yr = function(t, e, n) { var r = this, i = this.fh; this.fh = t.fh, this.Wt = t.Wt; // Sort changes based on type and query comparator var o = t.mh.Ut(); o.sort((function(t, e) { return function(t, e) { var n = function(t) { switch (t) { case 0 /* Added */ : return 1; case 2 /* Modified */ : case 3 /* Metadata */ : // A metadata change is converted to a modified change at the public // api layer. Since we sort by document key and then change type, // metadata and modified changes must be sorted equivalently. return 2; case 1 /* Removed */ : return 0; default: return y(); } }; return n(t) - n(e); }(t.type, e.type) || r._h(t.doc, e.doc); })), this.Ih(n); var s = e ? this.Ah() : [], u = 0 === this.lh.size && this.te ? 1 /* Synced */ : 0 /* Local */ , a = u !== this.hh; return this.hh = u, 0 !== o.length || a ? { snapshot: new Ft(this.query, t.fh, i, o, t.Wt, 0 /* Local */ === u, a, /* excludesMetadataChanges= */ !1), Rh: s } : { Rh: s }; // no changes }, /** * Applies an OnlineState change to the view, potentially generating a * ViewChange if the view's syncState changes as a result. */ t.prototype.Qs = function(t) { return this.te && "Offline" /* Offline */ === t ? ( // If we're offline, set `current` to false and then call applyChanges() // to refresh our syncState and generate a ViewChange as appropriate. We // are guaranteed to get a new TargetChange that sets `current` back to // true once the client is back online. this.te = !1, this.yr({ fh: this.fh, mh: new Ct, Wt: this.Wt, Eh: !1 }, /* updateLimboDocuments= */ !1)) : { Rh: [] }; }, /** * Returns whether the doc for the given key should be in limbo. */ t.prototype.gh = function(t) { // If the remote end says it's part of this query, it's not in limbo. return !this.uh.has(t) && // The local store doesn't think it's a result, so it shouldn't be in limbo. !!this.fh.has(t) && !this.fh.get(t).Je; }, /** * Updates syncedDocuments, current, and limbo docs based on the given change. * Returns the list of changes to which docs are in limbo. */ t.prototype.Ih = function(t) { var e = this; t && (t.ee.forEach((function(t) { return e.uh = e.uh.add(t); })), t.ne.forEach((function(t) {})), t.se.forEach((function(t) { return e.uh = e.uh.delete(t); })), this.te = t.te); }, t.prototype.Ah = function() { var t = this; // We can only determine limbo documents when we're in-sync with the server. if (!this.te) return []; // TODO(klimt): Do this incrementally so that it's not quadratic when // updating many documents. var e = this.lh; this.lh = Ot(), this.fh.forEach((function(e) { t.gh(e.key) && (t.lh = t.lh.add(e.key)); })); // Diff the new limbo docs with the old limbo docs. var n = []; return e.forEach((function(e) { t.lh.has(e) || n.push(new vs(e)); })), this.lh.forEach((function(t) { e.has(t) || n.push(new ds(t)); })), n; }, /** * Update the in-memory state of the current view with the state read from * persistence. * * We update the query view whenever a client's primary status changes: * - When a client transitions from primary to secondary, it can miss * LocalStorage updates and its query views may temporarily not be * synchronized with the state on disk. * - For secondary to primary transitions, the client needs to update the list * of `syncedDocuments` since secondary clients update their query views * based purely on synthesized RemoteEvents. * * @param queryResult.documents - The documents that match the query according * to the LocalStore. * @param queryResult.remoteKeys - The keys of the documents that match the * query according to the backend. * * @return The ViewChange that resulted from this synchronization. */ // PORTING NOTE: Multi-tab only. t.prototype.Ph = function(t) { this.uh = t.Fc, this.lh = Ot(); var e = this.wh(t.documents); return this.yr(e, /*updateLimboDocuments=*/ !0); }, /** * Returns a view snapshot as if this query was just listened to. Contains * a document add for every existing document and the `fromCache` and * `hasPendingWrites` status of the already established view. */ // PORTING NOTE: Multi-tab only. t.prototype.yh = function() { return Ft.Gt(this.query, this.fh, this.Wt, 0 /* Local */ === this.hh); }, t; }(), gs = function( /** * The query itself. */ t, /** * The target number created by the client that is used in the watch * stream to identify this query. */ e, /** * The view is responsible for computing the final merged truth of what * docs are in the query. It gets notified of local and remote changes, * and applies the query filters and limits to determine the most correct * possible results. */ n) { this.query = t, this.targetId = e, this.view = n; }, ms = function(t) { this.key = t, /** * Set to true once we've received a document. This is used in * getRemoteKeysForTarget() and ultimately used by WatchChangeAggregator to * decide whether it needs to manufacture a delete event for the target once * the target is CURRENT. */ this.Vh = !1; }, ws = /** @class */ function() { function t(t, e, n, // PORTING NOTE: Manages state synchronization in multi-tab environments. r, i, o) { this.ju = t, this.ph = e, this.bh = n, this.Sh = r, this.currentUser = i, this.Dh = o, this.Ch = {}, this.Nh = new it((function(t) { return Hn(t); }), Qn), this.Fh = new Map, /** * The keys of documents that are in limbo for which we haven't yet started a * limbo resolution query. */ this.xh = [], /** * Keeps track of the target ID for each document that is in limbo with an * active target. */ this.$h = new bt(A.i), /** * Keeps track of the information about an active limbo resolution for each * active target ID that was started for the purpose of limbo resolution. */ this.kh = new Map, this.Mh = new xo, /** Stores user completion handlers, indexed by User and BatchId. */ this.Oh = {}, /** Stores user callbacks waiting for all pending writes to be acknowledged. */ this.Lh = new Map, this.Bh = ro.da(), this.onlineState = "Unknown" /* Unknown */ , // The primary state is set to `true` or `false` immediately after Firestore // startup. In the interim, a client should only be considered primary if // `isPrimary` is true. this.qh = void 0; } return Object.defineProperty(t.prototype, "Uh", { get: function() { return !0 === this.qh; }, enumerable: !1, configurable: !0 }), t; }(); /** * Initiates the new listen, resolves promise when listen enqueued to the * server. All the subsequent view snapshots or errors are sent to the * subscribed handlers. Returns the initial snapshot. */ function _s(e, n) { return t.__awaiter(this, void 0, void 0, (function() { var r, i, o, s, u, a; return t.__generator(this, (function(t) { switch (t.label) { case 0: return r = Ks(e), (s = r.Nh.get(n)) ? ( // PORTING NOTE: With Multi-Tab Web, it is possible that a query view // already exists when EventManager calls us for the first time. This // happens when the primary tab is already listening to this query on // behalf of another tab and the user of the primary also starts listening // to the query. EventManager will not have an assigned target ID in this // case and calls `listen` to obtain this ID. i = s.targetId, r.Sh.Oi(i), o = s.view.yh(), [ 3 /*break*/ , 4 ]) : [ 3 /*break*/ , 1 ]; case 1: return [ 4 /*yield*/ , Io(r.ju, zn(n)) ]; case 2: return u = t.sent(), a = r.Sh.Oi(u.targetId), i = u.targetId, [ 4 /*yield*/ , bs(r, n, i, "current" === a) ]; case 3: o = t.sent(), r.Uh && Wo(r.ph, u), t.label = 4; case 4: return [ 2 /*return*/ , o ]; } })); })); } /** * Registers a view for a previously unknown query and computes its initial * snapshot. */ function bs(e, n, r, i) { return t.__awaiter(this, void 0, void 0, (function() { var o, s, u, a, c, h; return t.__generator(this, (function(f) { switch (f.label) { case 0: // PORTING NOTE: On Web only, we inject the code that registers new Limbo // targets based on view changes. This allows us to only depend on Limbo // changes when user code includes queries. return e.Qh = function(n, r, i) { return function(e, n, r, i) { return t.__awaiter(this, void 0, void 0, (function() { var o, s, u; return t.__generator(this, (function(t) { switch (t.label) { case 0: return o = n.view.wh(r), o.Eh ? [ 4 /*yield*/ , To(e.ju, n.query, /* usePreviousResults= */ !1).then((function(t) { var e = t.documents; return n.view.wh(e, o); })) ] : [ 3 /*break*/ , 2 ]; case 1: // The query has a limit and some docs were removed, so we need // to re-run the query against the local store to make sure we // didn't lose any good docs that had been past the limit. o = t.sent(), t.label = 2; case 2: return s = i && i.zt.get(n.targetId), u = n.view.yr(o, /* updateLimboDocuments= */ e.Uh, s), [ 2 /*return*/ , (Rs(e, n.targetId, u.Rh), u.snapshot) ]; } })); })); }(e, n, r, i); }, [ 4 /*yield*/ , To(e.ju, n, /* usePreviousResults= */ !0) ]; case 1: return o = f.sent(), s = new ys(n, o.Fc), u = s.wh(o.documents), a = qt.Zt(r, i && "Offline" /* Offline */ !== e.onlineState), c = s.yr(u, /* updateLimboDocuments= */ e.Uh, a), Rs(e, r, c.Rh), h = new gs(n, r, s), [ 2 /*return*/ , (e.Nh.set(n, h), e.Fh.has(r) ? e.Fh.get(r).push(n) : e.Fh.set(r, [ n ]), c.snapshot) ]; } })); })); } /** Stops listening to the query. */ function Is(e, n) { return t.__awaiter(this, void 0, void 0, (function() { var r, i, o; return t.__generator(this, (function(t) { switch (t.label) { case 0: return r = m(e), i = r.Nh.get(n), (o = r.Fh.get(i.targetId)).length > 1 ? [ 2 /*return*/ , (r.Fh.set(i.targetId, o.filter((function(t) { return !Qn(t, n); }))), void r.Nh.delete(n)) ] : r.Uh ? ( // We need to remove the local query target first to allow us to verify // whether any other client is still interested in this target. r.Sh.Bi(i.targetId), r.Sh.Fi(i.targetId) ? [ 3 /*break*/ , 2 ] : [ 4 /*yield*/ , Eo(r.ju, i.targetId, /*keepPersistedTargetData=*/ !1).then((function() { r.Sh.Ui(i.targetId), Ko(r.ph, i.targetId), Ls(r, i.targetId); })).catch(Do) ]) : [ 3 /*break*/ , 3 ]; case 1: t.sent(), t.label = 2; case 2: return [ 3 /*break*/ , 5 ]; case 3: return Ls(r, i.targetId), [ 4 /*yield*/ , Eo(r.ju, i.targetId, /*keepPersistedTargetData=*/ !0) ]; case 4: t.sent(), t.label = 5; case 5: return [ 2 /*return*/ ]; } })); })); } /** * Initiates the write of local mutation batch which involves adding the * writes to the mutation queue, notifying the remote store about new * mutations and raising events for any changes this write caused. * * The promise returned by this call is resolved when the above steps * have completed, *not* when the write was acked by the backend. The * userCallback is resolved once the write was acked/rejected by the * backend (or failed locally for any other reason). */ /** * Applies one remote event to the sync engine, notifying any views of the * changes, and releasing any pending mutation batches that would become * visible because of the snapshot version the remote event contains. */ function Es(e, n) { return t.__awaiter(this, void 0, void 0, (function() { var r, i; return t.__generator(this, (function(t) { switch (t.label) { case 0: r = m(e), t.label = 1; case 1: return t.trys.push([ 1, 4, , 6 ]), [ 4 /*yield*/ , _o(r.ju, n) ]; case 2: return i = t.sent(), // Update `receivedDocument` as appropriate for any limbo targets. n.zt.forEach((function(t, e) { var n = r.kh.get(e); n && ( // Since this is a limbo resolution lookup, it's for a single document // and it could be added, modified, or removed, but not a combination. g(t.ee.size + t.ne.size + t.se.size <= 1), t.ee.size > 0 ? n.Vh = !0 : t.ne.size > 0 ? g(n.Vh) : t.se.size > 0 && (g(n.Vh), n.Vh = !1)); })), [ 4 /*yield*/ , Vs(r, i, n) ]; case 3: // Update `receivedDocument` as appropriate for any limbo targets. return t.sent(), [ 3 /*break*/ , 6 ]; case 4: return [ 4 /*yield*/ , Do(t.sent()) ]; case 5: return t.sent(), [ 3 /*break*/ , 6 ]; case 6: return [ 2 /*return*/ ]; } })); })); } /** * Applies an OnlineState change to the sync engine and notifies any views of * the change. */ function Ts(t, e, n) { var r = m(t); // If we are the secondary client, we explicitly ignore the remote store's // online state (the local client may go offline, even though the primary // tab remains online) and only apply the primary tab's online state from // SharedClientState. if (r.Uh && 0 /* RemoteStore */ === n || !r.Uh && 1 /* SharedClientState */ === n) { var i = []; r.Nh.forEach((function(t, n) { var r = n.view.Qs(e); r.snapshot && i.push(r.snapshot); })), function(t, e) { var n = m(t); n.onlineState = e; var r = !1; n.Bs.forEach((function(t, n) { for (var i = 0, o = n.listeners; i < o.length; i++) { // Run global snapshot listeners if a consistent snapshot has been emitted. o[i].Qs(e) && (r = !0); } })), r && Cr(n); }(r.bh, e), i.length && r.Ch.yu(i), r.onlineState = e, r.Uh && r.Sh.Ki(e); } } /** * Rejects the listen for the given targetID. This can be triggered by the * backend for any active target. * * @param syncEngine The sync engine implementation. * @param targetId The targetID corresponds to one previously initiated by the * user as part of TargetData passed to listen() on RemoteStore. * @param err A description of the condition that has forced the rejection. * Nearly always this will be an indication that the user is no longer * authorized to see the data matching the target. */ function Ns(e, n, r) { return t.__awaiter(this, void 0, void 0, (function() { var i, o, s, u, a, c; return t.__generator(this, (function(t) { switch (t.label) { case 0: // PORTING NOTE: Multi-tab only. return (i = m(e)).Sh.Qi(n, "rejected", r), o = i.kh.get(n), (s = o && o.key) ? (u = (u = new bt(A.i)).ot(s, new Rn(s, st.min())), a = Ot().add(s), c = new Mt(st.min(), /* targetChanges= */ new Map, /* targetMismatches= */ new Tt(H), u, a), [ 4 /*yield*/ , Es(i, c) ]) : [ 3 /*break*/ , 2 ]; case 1: return t.sent(), // Since this query failed, we won't want to manually unlisten to it. // We only remove it from bookkeeping after we successfully applied the // RemoteEvent. If `applyRemoteEvent()` throws, we want to re-listen to // this query when the RemoteStore restarts the Watch stream, which should // re-trigger the target failure. i.$h = i.$h.remove(s), i.kh.delete(n), Ps(i), [ 3 /*break*/ , 4 ]; case 2: return [ 4 /*yield*/ , Eo(i.ju, n, /* keepPersistedTargetData */ !1).then((function() { return Ls(i, n, r); })).catch(Do) ]; case 3: t.sent(), t.label = 4; case 4: return [ 2 /*return*/ ]; } })); })); } function As(e, n) { return t.__awaiter(this, void 0, void 0, (function() { var r, i, o; return t.__generator(this, (function(t) { switch (t.label) { case 0: r = m(e), i = n.batch.batchId, t.label = 1; case 1: return t.trys.push([ 1, 4, , 6 ]), [ 4 /*yield*/ , mo(r.ju, n) ]; case 2: return o = t.sent(), // The local store may or may not be able to apply the write result and // raise events immediately (depending on whether the watcher is caught // up), so we raise user callbacks first so that they consistently happen // before listen events. xs(r, i, /*error=*/ null), Ds(r, i), r.Sh.ki(i, "acknowledged"), [ 4 /*yield*/ , Vs(r, o) ]; case 3: // The local store may or may not be able to apply the write result and // raise events immediately (depending on whether the watcher is caught // up), so we raise user callbacks first so that they consistently happen // before listen events. return t.sent(), [ 3 /*break*/ , 6 ]; case 4: return [ 4 /*yield*/ , Do(t.sent()) ]; case 5: return t.sent(), [ 3 /*break*/ , 6 ]; case 6: return [ 2 /*return*/ ]; } })); })); } function Ss(e, n, r) { return t.__awaiter(this, void 0, void 0, (function() { var i, o; return t.__generator(this, (function(t) { switch (t.label) { case 0: i = m(e), t.label = 1; case 1: return t.trys.push([ 1, 4, , 6 ]), [ 4 /*yield*/ , function(t, e) { var n = m(t); return n.persistence.runTransaction("Reject batch", "readwrite-primary", (function(t) { var r; return n.Sr.Oo(t, e).next((function(e) { return g(null !== e), r = e.keys(), n.Sr.Wo(t, e); })).next((function() { return n.Sr.zo(t); })).next((function() { return n.Cc.kr(t, r); })); })); }(i.ju, n) ]; case 2: return o = t.sent(), // The local store may or may not be able to apply the write result and // raise events immediately (depending on whether the watcher is caught up), // so we raise user callbacks first so that they consistently happen before // listen events. xs(i, n, r), Ds(i, n), i.Sh.ki(n, "rejected", r), [ 4 /*yield*/ , Vs(i, o) ]; case 3: // The local store may or may not be able to apply the write result and // raise events immediately (depending on whether the watcher is caught up), // so we raise user callbacks first so that they consistently happen before // listen events. return t.sent(), [ 3 /*break*/ , 6 ]; case 4: return [ 4 /*yield*/ , Do(t.sent()) ]; case 5: return t.sent(), [ 3 /*break*/ , 6 ]; case 6: return [ 2 /*return*/ ]; } })); })); } /** * Registers a user callback that resolves when all pending mutations at the moment of calling * are acknowledged . */ /** * Triggers the callbacks that are waiting for this batch id to get acknowledged by server, * if there are any. */ function Ds(t, e) { (t.Lh.get(e) || []).forEach((function(t) { t.resolve(); })), t.Lh.delete(e) /** Reject all outstanding callbacks waiting for pending writes to complete. */; } function xs(t, e, n) { var r = m(t), i = r.Oh[r.currentUser.ti()]; // NOTE: Mutations restored from persistence won't have callbacks, so it's // okay for there to be no callback for this ID. if (i) { var o = i.get(e); o && (n ? o.reject(n) : o.resolve(), i = i.remove(e)), r.Oh[r.currentUser.ti()] = i; } } function Ls(t, e, n) { void 0 === n && (n = null), t.Sh.Bi(e); for (var r = 0, i = t.Fh.get(e); r < i.length; r++) { var o = i[r]; t.Nh.delete(o), n && t.Ch.Wh(o, n); } t.Fh.delete(e), t.Uh && t.Mh.Uc(e).forEach((function(e) { t.Mh.Ho(e) || // We removed the last reference for this key ks(t, e); })); } function ks(t, e) { // It's possible that the target already got removed because the query failed. In that case, // the key won't exist in `limboTargetsByKey`. Only do the cleanup if we still have the target. var n = t.$h.get(e); null !== n && (Ko(t.ph, n), t.$h = t.$h.remove(e), t.kh.delete(n), Ps(t)); } function Rs(t, e, n) { for (var r = 0, i = n; r < i.length; r++) { var o = i[r]; o instanceof ds ? (t.Mh.Da(o.key, e), Os(t, o)) : o instanceof vs ? (l("SyncEngine", "Document no longer in limbo: " + o.key), t.Mh.Na(o.key, e), t.Mh.Ho(o.key) || // We removed the last reference for this key ks(t, o.key)) : y(); } } function Os(t, e) { var n = e.key; t.$h.get(n) || (l("SyncEngine", "New document in limbo: " + n), t.xh.push(n), Ps(t)); } /** * Starts listens for documents in limbo that are enqueued for resolution, * subject to a maximum number of concurrent resolutions. * * Without bounding the number of concurrent resolutions, the server can fail * with "resource exhausted" errors which can lead to pathological client * behavior as seen in https://github.com/firebase/firebase-js-sdk/issues/2683. */ function Ps(t) { for (;t.xh.length > 0 && t.$h.size < t.Dh; ) { var e = t.xh.shift(), n = t.Bh.next(); t.kh.set(n, new ms(e)), t.$h = t.$h.ot(e, n), Wo(t.ph, new gt(zn(Un(e.path)), n, 2 /* LimboResolution */ , qr.ai)); } } function Vs(e, n, r) { return t.__awaiter(this, void 0, void 0, (function() { var i, o, s, u; return t.__generator(this, (function(a) { switch (a.label) { case 0: return i = m(e), o = [], s = [], u = [], i.Nh.m() ? [ 3 /*break*/ , 3 ] : (i.Nh.forEach((function(t, e) { u.push(i.Qh(e, n, r).then((function(t) { if (t) { i.Uh && i.Sh.Qi(e.targetId, t.fromCache ? "not-current" : "current"), o.push(t); var n = ri.zr(e.targetId, t); s.push(n); } }))); })), [ 4 /*yield*/ , Promise.all(u) ]); case 1: return a.sent(), i.Ch.yu(o), [ 4 /*yield*/ , function(e, n) { return t.__awaiter(this, void 0, void 0, (function() { var r, i, o, s, u, a, c, h, f; return t.__generator(this, (function(t) { switch (t.label) { case 0: r = m(e), t.label = 1; case 1: return t.trys.push([ 1, 3, , 4 ]), [ 4 /*yield*/ , r.persistence.runTransaction("notifyLocalViewChanges", "readwrite", (function(t) { return yr.forEach(n, (function(e) { return yr.forEach(e.Kr, (function(n) { return r.persistence.No.Da(t, e.targetId, n); })).next((function() { return yr.forEach(e.Gr, (function(n) { return r.persistence.No.Na(t, e.targetId, n); })); })); })); })) ]; case 2: return t.sent(), [ 3 /*break*/ , 4 ]; case 3: if (!_r(i = t.sent())) throw i; // If `notifyLocalViewChanges` fails, we did not advance the sequence // number for the documents that were included in this transaction. // This might trigger them to be deleted earlier than they otherwise // would have, but it should not invalidate the integrity of the data. return l("LocalStore", "Failed to update sequence numbers: " + i), [ 3 /*break*/ , 4 ]; case 4: for (o = 0, s = n; o < s.length; o++) u = s[o], a = u.targetId, u.fromCache || (c = r.bc.get(a), h = c.nt, f = c.rt(h), // Advance the last limbo free snapshot version r.bc = r.bc.ot(a, f)); return [ 2 /*return*/ ]; } })); })); }(i.ju, s) ]; case 2: a.sent(), a.label = 3; case 3: return [ 2 /*return*/ ]; } })); })); } function Us(e, n) { return t.__awaiter(this, void 0, void 0, (function() { var r, i; return t.__generator(this, (function(o) { switch (o.label) { case 0: return (r = m(e)).currentUser.isEqual(n) ? [ 3 /*break*/ , 3 ] : (l("SyncEngine", "User change. New user:", n.ti()), [ 4 /*yield*/ , /** * Tells the LocalStore that the currently authenticated user has changed. * * In response the local store switches the mutation queue to the new user and * returns any resulting document changes. */ // PORTING NOTE: Android and iOS only return the documents affected by the // change. function(e, n) { return t.__awaiter(this, void 0, void 0, (function() { var r, i, o, s; return t.__generator(this, (function(t) { switch (t.label) { case 0: return r = m(e), i = r.Sr, o = r.Cc, [ 4 /*yield*/ , r.persistence.runTransaction("Handle user change", "readonly", (function(t) { // Swap out the mutation queue, grabbing the pending mutation batches // before and after. var e; return r.Sr.Uo(t).next((function(s) { return e = s, i = r.persistence.mc(n), // Recreate our LocalDocumentsView using the new // MutationQueue. o = new ni(r.Dc, i, r.persistence.Ic()), i.Uo(t); })).next((function(n) { for (var r = [], i = [], s = Ot(), u = 0, a = e // Union the old/new changed keys. ; u < a.length; u++) { var c = a[u]; r.push(c.batchId); for (var h = 0, f = c.mutations; h < f.length; h++) { var l = f[h]; s = s.add(l.key); } } for (var p = 0, d = n; p < d.length; p++) { var v = d[p]; i.push(v.batchId); for (var y = 0, g = v.mutations; y < g.length; y++) { var m = g[y]; s = s.add(m.key); } } // Return the set of all (potentially) changed documents and the list // of mutation batch IDs that were affected by change. return o.kr(t, s).next((function(t) { return { jh: t, Kh: r, Gh: i }; })); })); })) ]; case 1: return s = t.sent(), [ 2 /*return*/ , (r.Sr = i, r.Cc = o, r.Vc.Nc(r.Cc), s) ]; } })); })); }(r.ju, n) ]); case 1: return i = o.sent(), r.currentUser = n, // Fails tasks waiting for pending writes requested by previous user. function(t, e) { t.Lh.forEach((function(t) { t.forEach((function(t) { t.reject(new c(a.CANCELLED, "'waitForPendingWrites' promise is rejected due to a user change.")); })); })), t.Lh.clear(); }(r), // TODO(b/114226417): Consider calling this only in the primary tab. r.Sh.ji(n, i.Kh, i.Gh), [ 4 /*yield*/ , Vs(r, i.jh) ]; case 2: o.sent(), o.label = 3; case 3: return [ 2 /*return*/ ]; } })); })); } function Cs(t, e) { var n = m(t), r = n.kh.get(e); if (r && r.Vh) return Ot().add(r.key); var i = Ot(), o = n.Fh.get(e); if (!o) return i; for (var s = 0, u = o; s < u.length; s++) { var a = u[s], c = n.Nh.get(a); i = i.kt(c.view.dh); } return i; } /** * Reconcile the list of synced documents in an existing view with those * from persistence. */ function Fs(e, n) { return t.__awaiter(this, void 0, void 0, (function() { var r, i, o; return t.__generator(this, (function(t) { switch (t.label) { case 0: return [ 4 /*yield*/ , To((r = m(e)).ju, n.query, /* usePreviousResults= */ !0) ]; case 1: return i = t.sent(), o = n.view.Ph(i), [ 2 /*return*/ , (r.Uh && Rs(r, n.targetId, o.Rh), o) ]; } })); })); } /** Applies a mutation state to an existing batch. */ // PORTING NOTE: Multi-Tab only. function Ms(e, n, r, i) { return t.__awaiter(this, void 0, void 0, (function() { var o, s; return t.__generator(this, (function(t) { switch (t.label) { case 0: return [ 4 /*yield*/ , function(t, e) { var n = m(t), r = m(n.Sr); return n.persistence.runTransaction("Lookup mutation documents", "readonly", (function(t) { return r.Lo(t, e).next((function(e) { return e ? n.Cc.kr(t, e) : yr.resolve(null); })); })); }((o = m(e)).ju, n) ]; case 1: return null === (s = t.sent()) ? [ 3 /*break*/ , 6 ] : "pending" !== r ? [ 3 /*break*/ , 3 ] : [ 4 /*yield*/ , is(o.ph) ]; case 2: // If we are the primary client, we need to send this write to the // backend. Secondary clients will ignore these writes since their remote // connection is disabled. return t.sent(), [ 3 /*break*/ , 4 ]; case 3: "acknowledged" === r || "rejected" === r ? ( // NOTE: Both these methods are no-ops for batches that originated from // other clients. xs(o, n, i || null), Ds(o, n), function(t, e) { m(m(t).Sr).Ko(e); }(o.ju, n)) : y(), t.label = 4; case 4: return [ 4 /*yield*/ , Vs(o, s) ]; case 5: return t.sent(), [ 3 /*break*/ , 7 ]; case 6: // A throttled tab may not have seen the mutation before it was completed // and removed from the mutation queue, in which case we won't have cached // the affected documents. In this case we can safely ignore the update // since that means we didn't apply the mutation locally at all (if we // had, we would have cached the affected documents), and so we will just // see any resulting document changes via normal remote document updates // as applicable. l("SyncEngine", "Cannot apply mutation batch with id: " + n), t.label = 7; case 7: return [ 2 /*return*/ ]; } })); })); } /** Applies a query target change from a different tab. */ // PORTING NOTE: Multi-Tab only. function qs(e, n) { return t.__awaiter(this, void 0, void 0, (function() { var r, i, o, s, u, a, c, h; return t.__generator(this, (function(t) { switch (t.label) { case 0: return Ks(r = m(e)), Qs(r), !0 !== n || !0 === r.qh ? [ 3 /*break*/ , 3 ] : (i = r.Sh.Ci(), [ 4 /*yield*/ , js(r, i.A()) ]); case 1: return o = t.sent(), r.qh = !0, [ 4 /*yield*/ , fs(r.ph, !0) ]; case 2: for (t.sent(), s = 0, u = o; s < u.length; s++) a = u[s], Wo(r.ph, a); return [ 3 /*break*/ , 7 ]; case 3: return !1 !== n || !1 === r.qh ? [ 3 /*break*/ , 7 ] : (c = [], h = Promise.resolve(), r.Fh.forEach((function(t, e) { r.Sh.qi(e) ? c.push(e) : h = h.then((function() { return Ls(r, e), Eo(r.ju, e, /*keepPersistedTargetData=*/ !0); })), Ko(r.ph, e); })), [ 4 /*yield*/ , h ]); case 4: return t.sent(), [ 4 /*yield*/ , js(r, c) ]; case 5: return t.sent(), // PORTING NOTE: Multi-Tab only. function(t) { var e = m(t); e.kh.forEach((function(t, n) { Ko(e.ph, n); })), e.Mh.Qc(), e.kh = new Map, e.$h = new bt(A.i); }(r), r.qh = !1, [ 4 /*yield*/ , fs(r.ph, !1) ]; case 6: t.sent(), t.label = 7; case 7: return [ 2 /*return*/ ]; } })); })); } function js(e, n, r) { return t.__awaiter(this, void 0, void 0, (function() { var r, i, o, s, u, a, c, h, f, l, p, d, v, y; return t.__generator(this, (function(t) { switch (t.label) { case 0: r = m(e), i = [], o = [], s = 0, u = n, t.label = 1; case 1: return s < u.length ? (a = u[s], c = void 0, (h = r.Fh.get(a)) && 0 !== h.length ? [ 4 /*yield*/ , Io(r.ju, zn(h[0])) ] : [ 3 /*break*/ , 7 ]) : [ 3 /*break*/ , 13 ]; case 2: // For queries that have a local View, we fetch their current state // from LocalStore (as the resume token and the snapshot version // might have changed) and reconcile their views with the persisted // state (the list of syncedDocuments may have gotten out of sync). c = t.sent(), f = 0, l = h, t.label = 3; case 3: return f < l.length ? (p = l[f], d = r.Nh.get(p), [ 4 /*yield*/ , Fs(r, d) ]) : [ 3 /*break*/ , 6 ]; case 4: (v = t.sent()).snapshot && o.push(v.snapshot), t.label = 5; case 5: return f++, [ 3 /*break*/ , 3 ]; case 6: return [ 3 /*break*/ , 11 ]; case 7: return [ 4 /*yield*/ , No(r.ju, a) ]; case 8: return y = t.sent(), [ 4 /*yield*/ , Io(r.ju, y) ]; case 9: return c = t.sent(), [ 4 /*yield*/ , bs(r, Gs(y), a, /*current=*/ !1) ]; case 10: t.sent(), t.label = 11; case 11: i.push(c), t.label = 12; case 12: return s++, [ 3 /*break*/ , 1 ]; case 13: return [ 2 /*return*/ , (r.Ch.yu(o), i) ]; } })); })); } /** * Creates a `Query` object from the specified `Target`. There is no way to * obtain the original `Query`, so we synthesize a `Query` from the `Target` * object. * * The synthesized result might be different from the original `Query`, but * since the synthesized `Query` should return the same results as the * original one (only the presentation of results might differ), the potential * difference will not cause issues. */ // PORTING NOTE: Multi-Tab only. function Gs(t) { return Vn(t.path, t.collectionGroup, t.orderBy, t.filters, t.limit, "F" /* First */ , t.startAt, t.endAt); } /** Returns the IDs of the clients that are currently active. */ // PORTING NOTE: Multi-Tab only. function zs(t) { var e = m(t); return m(m(e.ju).persistence).pi(); } /** Applies a query target change from a different tab. */ // PORTING NOTE: Multi-Tab only. function Bs(e, n, r, i) { return t.__awaiter(this, void 0, void 0, (function() { var o, s, u; return t.__generator(this, (function(t) { switch (t.label) { case 0: return (o = m(e)).qh ? ( // If we receive a target state notification via WebStorage, we are // either already secondary or another tab has taken the primary lease. l("SyncEngine", "Ignoring unexpected query state notification."), [ 3 /*break*/ , 8 ]) : [ 3 /*break*/ , 1 ]; case 1: if (!o.Fh.has(n)) return [ 3 /*break*/ , 8 ]; switch (r) { case "current": case "not-current": return [ 3 /*break*/ , 2 ]; case "rejected": return [ 3 /*break*/ , 5 ]; } return [ 3 /*break*/ , 7 ]; case 2: return [ 4 /*yield*/ , Ao(o.ju) ]; case 3: return s = t.sent(), u = Mt.Xt(n, "current" === r), [ 4 /*yield*/ , Vs(o, s, u) ]; case 4: return t.sent(), [ 3 /*break*/ , 8 ]; case 5: return [ 4 /*yield*/ , Eo(o.ju, n, /* keepPersistedTargetData */ !0) ]; case 6: return t.sent(), Ls(o, n, i), [ 3 /*break*/ , 8 ]; case 7: y(), t.label = 8; case 8: return [ 2 /*return*/ ]; } })); })); } /** Adds or removes Watch targets for queries from different tabs. */ function Ws(e, n, r) { return t.__awaiter(this, void 0, void 0, (function() { var i, o, s, u, a, c, h, f, p, d; return t.__generator(this, (function(v) { switch (v.label) { case 0: if (!(i = Ks(e)).qh) return [ 3 /*break*/ , 10 ]; o = 0, s = n, v.label = 1; case 1: return o < s.length ? (u = s[o], i.Fh.has(u) ? ( // A target might have been added in a previous attempt l("SyncEngine", "Adding an already active target " + u), [ 3 /*break*/ , 5 ]) : [ 4 /*yield*/ , No(i.ju, u) ]) : [ 3 /*break*/ , 6 ]; case 2: return a = v.sent(), [ 4 /*yield*/ , Io(i.ju, a) ]; case 3: return c = v.sent(), [ 4 /*yield*/ , bs(i, Gs(a), c.targetId, /*current=*/ !1) ]; case 4: v.sent(), Wo(i.ph, c), v.label = 5; case 5: return o++, [ 3 /*break*/ , 1 ]; case 6: h = function(e) { return t.__generator(this, (function(t) { switch (t.label) { case 0: return i.Fh.has(e) ? [ 4 /*yield*/ , Eo(i.ju, e, /* keepPersistedTargetData */ !1).then((function() { Ko(i.ph, e), Ls(i, e); })).catch(Do) ] : [ 3 /*break*/ , 2 ]; // Release queries that are still active. case 1: // Release queries that are still active. t.sent(), t.label = 2; case 2: return [ 2 /*return*/ ]; } })); }, f = 0, p = r, v.label = 7; case 7: return f < p.length ? (d = p[f], [ 5 /*yield**/ , h(d) ]) : [ 3 /*break*/ , 10 ]; case 8: v.sent(), v.label = 9; case 9: return f++, [ 3 /*break*/ , 7 ]; case 10: return [ 2 /*return*/ ]; } })); })); } function Ks(t) { var e = m(t); return e.ph.Gu.sh = Es.bind(null, e), e.ph.Gu.qe = Cs.bind(null, e), e.ph.Gu.nh = Ns.bind(null, e), e.Ch.yu = Vr.bind(null, e.bh), e.Ch.Wh = Ur.bind(null, e.bh), e; } function Qs(t) { var e = m(t); return e.ph.Gu.ih = As.bind(null, e), e.ph.Gu.rh = Ss.bind(null, e), e; } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // TOOD(b/140938512): Drop SimpleQueryEngine and rename IndexFreeQueryEngine. /** * A query engine that takes advantage of the target document mapping in the * QueryCache. The IndexFreeQueryEngine optimizes query execution by only * reading the documents that previously matched a query plus any documents that were * edited after the query was last listened to. * * There are some cases where Index-Free queries are not guaranteed to produce * the same results as full collection scans. In these cases, the * IndexFreeQueryEngine falls back to full query processing. These cases are: * * - Limit queries where a document that matched the query previously no longer * matches the query. * * - Limit queries where a document edit may cause the document to sort below * another document that is in the local cache. * * - Queries that have never been CURRENT or free of Limbo documents. */ var Hs = /** @class */ function() { function t() {} return t.prototype.Nc = function(t) { this.zh = t; }, t.prototype.Lr = function(t, e, r, i) { var o = this; // Queries that match all documents don't benefit from using // IndexFreeQueries. It is more efficient to scan all documents in a // collection, rather than to perform individual lookups. return function(t) { return 0 === t.filters.length && null === t.limit && null == t.startAt && null == t.endAt && (0 === t.on.length || 1 === t.on.length && t.on[0].field.p()); }(e) || r.isEqual(st.min()) ? this.Hh(t, e) : this.zh.kr(t, i).next((function(s) { var u = o.Yh(e, s); return (Cn(e) || Fn(e)) && o.Eh(e.an, u, i, r) ? o.Hh(t, e) : (f() <= n.LogLevel.DEBUG && l("IndexFreeQueryEngine", "Re-using previous result from %s to execute query: %s", r.toString(), Yn(e)), o.zh.Lr(t, e, r).next((function(t) { // We merge `previousResults` into `updateResults`, since // `updateResults` is already a DocumentMap. If a document is // contained in both lists, then its contents are the same. return u.forEach((function(e) { t = t.ot(e.key, e); })), t; }))); })); // Queries that have never seen a snapshot without limbo free documents // should also be run as a full collection scan. }, /** Applies the query filter and sorting to the provided documents. */ t.prototype.Yh = function(t, e) { // Sort the documents and re-apply the query filter since previously // matching documents do not necessarily still match the query. var n = new Tt(Xn(t)); return e.forEach((function(e, r) { r instanceof kn && $n(t, r) && (n = n.add(r)); })), n; }, /** * Determines if a limit query needs to be refilled from cache, making it * ineligible for index-free execution. * * @param sortedPreviousResults The documents that matched the query when it * was last synchronized, sorted by the query's comparator. * @param remoteKeys The document keys that matched the query at the last * snapshot. * @param limboFreeSnapshotVersion The version of the snapshot when the query * was last synchronized. */ t.prototype.Eh = function(t, e, n, r) { // The query needs to be refilled if a previously matching document no // longer matches. if (n.size !== e.size) return !0; // Limit queries are not eligible for index-free query execution if there is // a potential that an older document from cache now sorts before a document // that was previously part of the limit. This, however, can only happen if // the document at the edge of the limit goes out of limit. // If a document that is not the limit boundary sorts differently, // the boundary of the limit itself did not change and documents from cache // will continue to be "rejected" by this boundary. Therefore, we can ignore // any modifications that don't affect the last document. var i = "F" /* First */ === t ? e.last() : e.first(); return !!i && (i.hasPendingWrites || i.version.L(r) > 0); }, t.prototype.Hh = function(t, e) { return f() <= n.LogLevel.DEBUG && l("IndexFreeQueryEngine", "Using full collection scan to execute query:", Yn(e)), this.zh.Lr(t, e, st.min()); }, t; }(), Ys = /** @class */ function() { function t(t, e) { this.Dr = t, this.No = e, /** * The set of all mutations that have been sent but not yet been applied to * the backend. */ this.Sr = [], /** Next value to use when assigning sequential IDs to each mutation batch. */ this.Jh = 1, /** An ordered mapping between documents and the mutations batch IDs. */ this.Xh = new Tt(Lo.kc); } return t.prototype.$o = function(t) { return yr.resolve(0 === this.Sr.length); }, t.prototype.ko = function(t, e, n, r) { var i = this.Jh; this.Jh++, this.Sr.length > 0 && this.Sr[this.Sr.length - 1]; var o = new Xr(i, e, n, r); this.Sr.push(o); // Track references by document key and index collection parents. for (var s = 0, u = r; s < u.length; s++) { var a = u[s]; this.Xh = this.Xh.add(new Lo(a.key, i)), this.Dr.Mo(t, a.key.path.h()); } return yr.resolve(o); }, t.prototype.Oo = function(t, e) { return yr.resolve(this.Zh(e)); }, t.prototype.Bo = function(t, e) { var n = e + 1, r = this.tl(n), i = r < 0 ? 0 : r; // The requested batchId may still be out of range so normalize it to the // start of the queue. return yr.resolve(this.Sr.length > i ? this.Sr[i] : null); }, t.prototype.qo = function() { return yr.resolve(0 === this.Sr.length ? -1 : this.Jh - 1); }, t.prototype.Uo = function(t) { return yr.resolve(this.Sr.slice()); }, t.prototype.Nr = function(t, e) { var n = this, r = new Lo(e, 0), i = new Lo(e, Number.POSITIVE_INFINITY), o = []; return this.Xh.Ft([ r, i ], (function(t) { var e = n.Zh(t.jc); o.push(e); })), yr.resolve(o); }, t.prototype.Or = function(t, e) { var n = this, r = new Tt(H); return e.forEach((function(t) { var e = new Lo(t, 0), i = new Lo(t, Number.POSITIVE_INFINITY); n.Xh.Ft([ e, i ], (function(t) { r = r.add(t.jc); })); })), yr.resolve(this.el(r)); }, t.prototype.Wr = function(t, e) { // Use the query path as a prefix for testing if a document matches the // query. var n = e.path, r = n.length + 1, i = n; // Construct a document reference for actually scanning the index. Unlike // the prefix the document key in this reference must have an even number of // segments. The empty segment can be used a suffix of the query path // because it precedes all other segments in an ordered traversal. A.F(i) || (i = i.child("")); var o = new Lo(new A(i), 0), s = new Tt(H); // Find unique batchIDs referenced by all documents potentially matching the // query. return this.Xh.xt((function(t) { var e = t.key.path; return !!n.T(e) && ( // Rows with document keys more than one segment longer than the query // path can't be matches. For example, a query on 'rooms' can't match // the document /rooms/abc/messages/xyx. // TODO(mcg): we'll need a different scanner when we implement // ancestor queries. e.length === r && (s = s.add(t.jc)), !0); }), o), yr.resolve(this.el(s)); }, t.prototype.el = function(t) { var e = this, n = []; // Construct an array of matching batches, sorted by batchID to ensure that // multiple mutations affecting the same document key are applied in order. return t.forEach((function(t) { var r = e.Zh(t); null !== r && n.push(r); })), n; }, t.prototype.Wo = function(t, e) { var n = this; g(0 === this.nl(e.batchId, "removed")), this.Sr.shift(); var r = this.Xh; return yr.forEach(e.mutations, (function(i) { var o = new Lo(i.key, e.batchId); return r = r.delete(o), n.No.Go(t, i.key); })).next((function() { n.Xh = r; })); }, t.prototype.Ko = function(t) { // No-op since the memory mutation queue does not maintain a separate cache. }, t.prototype.Ho = function(t, e) { var n = new Lo(e, 0), r = this.Xh.$t(n); return yr.resolve(e.isEqual(r && r.key)); }, t.prototype.zo = function(t) { return this.Sr.length, yr.resolve(); }, /** * Finds the index of the given batchId in the mutation queue and asserts that * the resulting index is within the bounds of the queue. * * @param batchId The batchId to search for * @param action A description of what the caller is doing, phrased in passive * form (e.g. "acknowledged" in a routine that acknowledges batches). */ t.prototype.nl = function(t, e) { return this.tl(t); }, /** * Finds the index of the given batchId in the mutation queue. This operation * is O(1). * * @return The computed index of the batch with the given batchId, based on * the state of the queue. Note this index can be negative if the requested * batchId has already been remvoed from the queue or past the end of the * queue if the batchId is larger than the last added batch. */ t.prototype.tl = function(t) { return 0 === this.Sr.length ? 0 : t - this.Sr[0].batchId; // Examine the front of the queue to figure out the difference between the // batchId and indexes in the array. Note that since the queue is ordered // by batchId, if the first batch has a larger batchId then the requested // batchId doesn't exist in the queue. }, /** * A version of lookupMutationBatch that doesn't return a promise, this makes * other functions that uses this code easier to read and more efficent. */ t.prototype.Zh = function(t) { var e = this.tl(t); return e < 0 || e >= this.Sr.length ? null : this.Sr[e]; }, t; }(), $s = /** @class */ function() { /** * @param sizer Used to assess the size of a document. For eager GC, this is expected to just * return 0 to avoid unnecessarily doing the work of calculating the size. */ function t(t, e) { this.Dr = t, this.sl = e, /** Underlying cache of documents and their read times. */ this.docs = new bt(A.i), /** Size of all cached documents. */ this.size = 0 /** * Adds the supplied entry to the cache and updates the cache size as appropriate. * * All calls of `addEntry` are required to go through the RemoteDocumentChangeBuffer * returned by `newChangeBuffer()`. */; } return t.prototype.Er = function(t, e, n) { var r = e.key, i = this.docs.get(r), o = i ? i.size : 0, s = this.sl(e); return this.docs = this.docs.ot(r, { ta: e, size: s, readTime: n }), this.size += s - o, this.Dr.Mo(t, r.path.h()); }, /** * Removes the specified entry from the cache and updates the cache size as appropriate. * * All calls of `removeEntry` are required to go through the RemoteDocumentChangeBuffer * returned by `newChangeBuffer()`. */ t.prototype.Ar = function(t) { var e = this.docs.get(t); e && (this.docs = this.docs.remove(t), this.size -= e.size); }, t.prototype.Rr = function(t, e) { var n = this.docs.get(e); return yr.resolve(n ? n.ta : null); }, t.prototype.getEntries = function(t, e) { var n = this, r = Dt(); return e.forEach((function(t) { var e = n.docs.get(t); r = r.ot(t, e ? e.ta : null); })), yr.resolve(r); }, t.prototype.Lr = function(t, e, n) { for (var r = Lt(), i = new A(e.path.child("")), o = this.docs.ft(i) // Documents are ordered by key, so we can use a prefix scan to narrow down // the documents we need to match the query against. ; o.At(); ) { var s = o.It(), u = s.key, a = s.value, c = a.ta, h = a.readTime; if (!e.path.T(u.path)) break; h.L(n) <= 0 || c instanceof kn && $n(e, c) && (r = r.ot(c.key, c)); } return yr.resolve(r); }, t.prototype.il = function(t, e) { return yr.forEach(this.docs, (function(t) { return e(t); })); }, t.prototype.ra = function(t) { // `trackRemovals` is ignores since the MemoryRemoteDocumentCache keeps // a separate changelog and does not need special handling for removals. return new Xs(this); }, t.prototype.aa = function(t) { return yr.resolve(this.size); }, t; }(), Xs = /** @class */ function(e) { function n(t) { var n = this; return (n = e.call(this) || this).ca = t, n; } return t.__extends(n, e), n.prototype.yr = function(t) { var e = this, n = []; return this.wr.forEach((function(r, i) { i ? n.push(e.ca.Er(t, i, e.readTime)) : e.ca.Ar(r); })), yr.$n(n); }, n.prototype.gr = function(t, e) { return this.ca.Rr(t, e); }, n.prototype.Pr = function(t, e) { return this.ca.getEntries(t, e); }, n; }(Zr), Js = /** @class */ function() { function t(t) { this.persistence = t, /** * Maps a target to the data about that target */ this.rl = new it((function(t) { return lt(t); }), pt), /** The last received snapshot version. */ this.lastRemoteSnapshotVersion = st.min(), /** The highest numbered target ID encountered. */ this.highestTargetId = 0, /** The highest sequence number encountered. */ this.ol = 0, /** * A ordered bidirectional mapping between documents and the remote target * IDs. */ this.al = new xo, this.targetCount = 0, this.cl = ro.fa(); } return t.prototype.Ce = function(t, e) { return this.rl.forEach((function(t, n) { return e(n); })), yr.resolve(); }, t.prototype.Ea = function(t) { return yr.resolve(this.lastRemoteSnapshotVersion); }, t.prototype.Ia = function(t) { return yr.resolve(this.ol); }, t.prototype.wa = function(t) { return this.highestTargetId = this.cl.next(), yr.resolve(this.highestTargetId); }, t.prototype.Aa = function(t, e, n) { return n && (this.lastRemoteSnapshotVersion = n), e > this.ol && (this.ol = e), yr.resolve(); }, t.prototype.ga = function(t) { this.rl.set(t.target, t); var e = t.targetId; e > this.highestTargetId && (this.cl = new ro(e), this.highestTargetId = e), t.sequenceNumber > this.ol && (this.ol = t.sequenceNumber); }, t.prototype.Ra = function(t, e) { return this.ga(e), this.targetCount += 1, yr.resolve(); }, t.prototype.ya = function(t, e) { return this.ga(e), yr.resolve(); }, t.prototype.Va = function(t, e) { return this.rl.delete(e.target), this.al.Uc(e.targetId), this.targetCount -= 1, yr.resolve(); }, t.prototype.po = function(t, e, n) { var r = this, i = 0, o = []; return this.rl.forEach((function(s, u) { u.sequenceNumber <= e && null === n.get(u.targetId) && (r.rl.delete(s), o.push(r.pa(t, u.targetId)), i++); })), yr.$n(o).next((function() { return i; })); }, t.prototype.ba = function(t) { return yr.resolve(this.targetCount); }, t.prototype.va = function(t, e) { var n = this.rl.get(e) || null; return yr.resolve(n); }, t.prototype.Sa = function(t, e, n) { return this.al.Lc(e, n), yr.resolve(); }, t.prototype.Ca = function(t, e, n) { this.al.qc(e, n); var r = this.persistence.No, i = []; return r && e.forEach((function(e) { i.push(r.Go(t, e)); })), yr.$n(i); }, t.prototype.pa = function(t, e) { return this.al.Uc(e), yr.resolve(); }, t.prototype.Fa = function(t, e) { var n = this.al.Wc(e); return yr.resolve(n); }, t.prototype.Ho = function(t, e) { return yr.resolve(this.al.Ho(e)); }, t; }(), Zs = /** @class */ function() { /** * The constructor accepts a factory for creating a reference delegate. This * allows both the delegate and this instance to have strong references to * each other without having nullable fields that would then need to be * checked or asserted on every access. */ function t(t) { var e = this; this.ul = {}, this.Ma = new qr(0), this.Oa = !1, this.Oa = !0, this.No = t(this), this.Ka = new Js(this), this.Dr = new Ui, this.vr = function(t, n) { return new $s(t, (function(t) { return e.No.hl(t); })); }(this.Dr); } return t.prototype.start = function() { return Promise.resolve(); }, t.prototype.Di = function() { // No durable state to ensure is closed on shutdown. return this.Oa = !1, Promise.resolve(); }, Object.defineProperty(t.prototype, "Ei", { get: function() { return this.Oa; }, enumerable: !1, configurable: !0 }), t.prototype.Za = function() { // No op. }, t.prototype.tc = function() { // No op. }, t.prototype.Ic = function() { return this.Dr; }, t.prototype.mc = function(t) { var e = this.ul[t.ti()]; return e || (e = new Ys(this.Dr, this.No), this.ul[t.ti()] = e), e; }, t.prototype.Tc = function() { return this.Ka; }, t.prototype.Ec = function() { return this.vr; }, t.prototype.runTransaction = function(t, e, n) { var r = this; l("MemoryPersistence", "Starting transaction:", t); var i = new tu(this.Ma.next()); return this.No.ll(), n(i).next((function(t) { return r.No._l(i).next((function() { return t; })); })).Fn().then((function(t) { return i.br(), t; })); }, t.prototype.fl = function(t, e) { return yr.kn(Object.values(this.ul).map((function(n) { return function() { return n.Ho(t, e); }; }))); }, t; }(), tu = /** @class */ function(e) { function n(t) { var n = this; return (n = e.call(this) || this).xa = t, n; } return t.__extends(n, e), n; }(ei), eu = /** @class */ function() { function t(t) { this.persistence = t, /** Tracks all documents that are active in Query views. */ this.dl = new xo, /** The list of documents that are potentially GCed after each transaction. */ this.wl = null; } return t.ml = function(e) { return new t(e); }, Object.defineProperty(t.prototype, "Tl", { get: function() { if (this.wl) return this.wl; throw y(); }, enumerable: !1, configurable: !0 }), t.prototype.Da = function(t, e, n) { return this.dl.Da(n, e), this.Tl.delete(n.toString()), yr.resolve(); }, t.prototype.Na = function(t, e, n) { return this.dl.Na(n, e), this.Tl.add(n.toString()), yr.resolve(); }, t.prototype.Go = function(t, e) { return this.Tl.add(e.toString()), yr.resolve(); }, t.prototype.removeTarget = function(t, e) { var n = this; this.dl.Uc(e.targetId).forEach((function(t) { return n.Tl.add(t.toString()); })); var r = this.persistence.Tc(); return r.Fa(t, e.targetId).next((function(t) { t.forEach((function(t) { return n.Tl.add(t.toString()); })); })).next((function() { return r.Va(t, e); })); }, t.prototype.ll = function() { this.wl = new Set; }, t.prototype._l = function(t) { var e = this, n = this.persistence.Ec().ra(); // Remove newly orphaned documents. return yr.forEach(this.Tl, (function(r) { var i = A.D(r); return e.El(t, i).next((function(t) { t || n.Ar(i); })); })).next((function() { return e.wl = null, n.apply(t); })); }, t.prototype.yc = function(t, e) { var n = this; return this.El(t, e).next((function(t) { t ? n.Tl.delete(e.toString()) : n.Tl.add(e.toString()); })); }, t.prototype.hl = function(t) { // For eager GC, we don't care about the document size, there are no size thresholds. return 0; }, t.prototype.El = function(t, e) { var n = this; return yr.kn([ function() { return yr.resolve(n.dl.Ho(e)); }, function() { return n.persistence.Tc().Ho(t, e); }, function() { return n.persistence.fl(t, e); } ]); }, t; }(), nu = /** @class */ function() { function t(t) { this.Il = t.Il, this.Al = t.Al; } return t.prototype.gu = function(t) { this.Rl = t; }, t.prototype.Tu = function(t) { this.gl = t; }, t.prototype.onMessage = function(t) { this.Pl = t; }, t.prototype.close = function() { this.Al(); }, t.prototype.send = function(t) { this.Il(t); }, t.prototype.yl = function() { this.Rl(); }, t.prototype.Vl = function(t) { this.gl(t); }, t.prototype.pl = function(t) { this.Pl(t); }, t; }(), ru = { BatchGetDocuments: "batchGet", Commit: "commit", RunQuery: "runQuery" }, iu = /** @class */ function(e) { function n(t) { var n = this; return (n = e.call(this, t) || this).forceLongPolling = t.forceLongPolling, n.W = t.W, n; } /** * Base class for all Rest-based connections to the backend (WebChannel and * HTTP). */ return t.__extends(n, e), n.prototype.Nl = function(t, e, n, r) { return new Promise((function(o, s) { var u = new i.XhrIo; u.listenOnce(i.EventType.COMPLETE, (function() { try { switch (u.getLastErrorCode()) { case i.ErrorCode.NO_ERROR: var e = u.getResponseJson(); l("Connection", "XHR received:", JSON.stringify(e)), o(e); break; case i.ErrorCode.TIMEOUT: l("Connection", 'RPC "' + t + '" timed out'), s(new c(a.DEADLINE_EXCEEDED, "Request time out")); break; case i.ErrorCode.HTTP_ERROR: var n = u.getStatus(); if (l("Connection", 'RPC "' + t + '" failed with status:', n, "response text:", u.getResponseText()), n > 0) { var r = u.getResponseJson().error; if (r && r.status && r.message) { var h = function(t) { var e = t.toLowerCase().replace("_", "-"); return Object.values(a).indexOf(e) >= 0 ? e : a.UNKNOWN; }(r.status); s(new c(h, r.message)); } else s(new c(a.UNKNOWN, "Server responded with status " + u.getStatus())); } else // If we received an HTTP_ERROR but there's no status code, // it's most probably a connection issue s(new c(a.UNAVAILABLE, "Connection failed.")); break; default: y(); } } finally { l("Connection", 'RPC "' + t + '" completed.'); } })); var h = JSON.stringify(r); u.send(e, "POST", h, n, 15); })); }, n.prototype.Pu = function(t, e) { var n = [ this.vl, "/", "google.firestore.v1.Firestore", "/", t, "/channel" ], o = i.createWebChannelTransport(), s = { // Required for backend stickiness, routing behavior is based on this // parameter. httpSessionIdParam: "gsessionid", initMessageHeaders: {}, messageUrlParams: { // This param is used to improve routing and project isolation by the // backend and must be included in every request. database: "projects/" + this.U.projectId + "/databases/" + this.U.database }, sendRawJson: !0, supportsCrossDomainXhr: !0, internalChannelParams: { // Override the default timeout (randomized between 10-20 seconds) since // a large write batch on a slow internet connection may take a long // time to send to the backend. Rather than have WebChannel impose a // tight timeout which could lead to infinite timeouts and retries, we // set it very large (5-10 minutes) and rely on the browser's builtin // timeouts to kick in if the request isn't working. forwardChannelRequestTimeoutMs: 6e5 }, forceLongPolling: this.forceLongPolling, detectBufferingProxy: this.W }; this.Cl(s.initMessageHeaders, e), // Sending the custom headers we just added to request.initMessageHeaders // (Authorization, etc.) will trigger the browser to make a CORS preflight // request because the XHR will no longer meet the criteria for a "simple" // CORS request: // https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS#Simple_requests // Therefore to avoid the CORS preflight request (an extra network // roundtrip), we use the httpHeadersOverwriteParam option to specify that // the headers should instead be encoded into a special "$httpHeaders" query // parameter, which is recognized by the webchannel backend. This is // formally defined here: // https://github.com/google/closure-library/blob/b0e1815b13fb92a46d7c9b3c30de5d6a396a3245/closure/goog/net/rpc/httpcors.js#L32 // TODO(b/145624756): There is a backend bug where $httpHeaders isn't respected if the request // doesn't have an Origin header. So we have to exclude a few browser environments that are // known to (sometimes) not include an Origin. See // https://github.com/firebase/firebase-js-sdk/issues/1491. r.isMobileCordova() || r.isReactNative() || r.isElectron() || r.isIE() || r.isUWP() || r.isBrowserExtension() || (s.httpHeadersOverwriteParam = "$httpHeaders"); var u = n.join(""); l("Connection", "Creating WebChannel: " + u, s); var h = o.createWebChannel(u, s), f = !1, p = !1, v = new nu({ Il: function(t) { p ? l("Connection", "Not sending because WebChannel is closed:", t) : (f || (l("Connection", "Opening WebChannel transport."), h.open(), f = !0), l("Connection", "WebChannel sending:", t), h.send(t)); }, Al: function() { return h.close(); } }), y = function(t, e) { // TODO(dimond): closure typing seems broken because WebChannel does // not implement goog.events.Listenable h.listen(t, (function(t) { try { e(t); } catch (t) { setTimeout((function() { throw t; }), 0); } })); }; // WebChannel supports sending the first message with the handshake - saving // a network round trip. However, it will have to call send in the same // JS event loop as open. In order to enforce this, we delay actually // opening the WebChannel until send is called. Whether we have called // open is tracked with this variable. // Closure events are guarded and exceptions are swallowed, so catch any // exception and rethrow using a setTimeout so they become visible again. // Note that eventually this function could go away if we are confident // enough the code is exception free. return y(i.WebChannel.EventType.OPEN, (function() { p || l("Connection", "WebChannel transport opened."); })), y(i.WebChannel.EventType.CLOSE, (function() { p || (p = !0, l("Connection", "WebChannel transport closed"), v.Vl()); })), y(i.WebChannel.EventType.ERROR, (function(t) { p || (p = !0, d("Connection", "WebChannel transport errored:", t), v.Vl(new c(a.UNAVAILABLE, "The operation could not be completed"))); })), y(i.WebChannel.EventType.MESSAGE, (function(t) { var e; if (!p) { var n = t.data[0]; g(!!n); // TODO(b/35143891): There is a bug in One Platform that caused errors // (and only errors) to be wrapped in an extra array. To be forward // compatible with the bug we need to check either condition. The latter // can be removed once the fix has been rolled out. // Use any because msgData.error is not typed. var r = n, i = r.error || (null === (e = r[0]) || void 0 === e ? void 0 : e.error); if (i) { l("Connection", "WebChannel received error:", i); // error.status will be a string like 'OK' or 'NOT_FOUND'. var o = i.status, s = function(t) { // lookup by string // eslint-disable-next-line @typescript-eslint/no-explicit-any var e = vt[t]; if (void 0 !== e) return _t(e); }(o), u = i.message; void 0 === s && (s = a.INTERNAL, u = "Unknown error status: " + o + " with message " + i.message), // Mark closed so no further events are propagated p = !0, v.Vl(new c(s, u)), h.close(); } else l("Connection", "WebChannel received:", n), v.pl(n); } })), setTimeout((function() { // Technically we could/should wait for the WebChannel opened event, // but because we want to send the first message with the WebChannel // handshake we pretend the channel opened here (asynchronously), and // then delay the actual open until the first message is sent. v.yl(); }), 0), v; }, n; }(/** @class */ function() { function t(t) { this.bl = t, this.U = t.U; var e = t.ssl ? "https" : "http"; this.vl = e + "://" + t.host, this.Sl = "projects/" + this.U.projectId + "/databases/" + this.U.database + "/documents"; } return t.prototype.$u = function(t, e, n, r) { var i = this.Dl(t, e); l("RestConnection", "Sending: ", i, n); var o = {}; return this.Cl(o, r), this.Nl(t, i, o, n).then((function(t) { return l("RestConnection", "Received: ", t), t; }), (function(e) { throw d("RestConnection", t + " failed with error: ", e, "url: ", i, "request:", n), e; })); }, t.prototype.ku = function(t, e, n, r) { // The REST API automatically aggregates all of the streamed results, so we // can just use the normal invoke() method. return this.$u(t, e, n, r); }, /** * Modifies the headers for a request, adding any authorization token if * present and any additional headers for the request. */ t.prototype.Cl = function(t, e) { if (t["X-Goog-Api-Client"] = "gl-js/ fire/7.24.0", // Content-Type: text/plain will avoid preflight requests which might // mess with CORS and redirects by proxies. If we add custom headers // we will need to change this code to potentially use the $httpOverwrite // parameter supported by ESF to avoid triggering preflight requests. t["Content-Type"] = "text/plain", e) for (var n in e.Kc) e.Kc.hasOwnProperty(n) && (t[n] = e.Kc[n]); }, t.prototype.Dl = function(t, e) { var n = ru[t]; return this.vl + "/v1/" + e + ":" + n; }, t; }()), ou = /** @class */ function() { function t() { var t = this; this.Fl = function() { return t.xl(); }, this.$l = function() { return t.kl(); }, this.Ml = [], this.Ol(); } return t.prototype.Zu = function(t) { this.Ml.push(t); }, t.prototype.Di = function() { window.removeEventListener("online", this.Fl), window.removeEventListener("offline", this.$l); }, t.prototype.Ol = function() { window.addEventListener("online", this.Fl), window.addEventListener("offline", this.$l); }, t.prototype.xl = function() { l("ConnectivityMonitor", "Network connectivity changed: AVAILABLE"); for (var t = 0, e = this.Ml; t < e.length; t++) { (0, e[t])(0 /* AVAILABLE */); } }, t.prototype.kl = function() { l("ConnectivityMonitor", "Network connectivity changed: UNAVAILABLE"); for (var t = 0, e = this.Ml; t < e.length; t++) { (0, e[t])(1 /* UNAVAILABLE */); } }, // TODO(chenbrian): Consider passing in window either into this component or // here for testing via FakeWindow. /** Checks that all used attributes of window are available. */ t.Ln = function() { return "undefined" != typeof window && void 0 !== window.addEventListener && void 0 !== window.removeEventListener; }, t; }(), su = /** @class */ function() { function t() {} return t.prototype.Zu = function(t) { // No-op. }, t.prototype.Di = function() { // No-op. }, t; }(); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** Initializes the WebChannelConnection for the browser. */ /** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ function uu(t) { return new ye(t, /* useProto3Json= */ !0); } /** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var au = "You are using the memory-only build of Firestore. Persistence support is only available via the @firebase/firestore bundle or the firebase-firestore.js build.", cu = /** @class */ function() { function e() {} return e.prototype.initialize = function(e) { return t.__awaiter(this, void 0, void 0, (function() { return t.__generator(this, (function(t) { switch (t.label) { case 0: return this.Sh = this.Ll(e), this.persistence = this.Bl(e), [ 4 /*yield*/ , this.persistence.start() ]; case 1: return t.sent(), this.ql = this.Ul(e), this.ju = this.Ql(e), [ 2 /*return*/ ]; } })); })); }, e.prototype.Ul = function(t) { return null; }, e.prototype.Ql = function(t) { /** Manages our in-memory or durable persistence. */ return e = this.persistence, n = new Hs, r = t.Wl, new go(e, n, r); var e, n, r; }, e.prototype.Bl = function(t) { if (t.persistenceSettings.jl) throw new c(a.FAILED_PRECONDITION, au); return new Zs(eu.ml); }, e.prototype.Ll = function(t) { return new $r; }, e.prototype.terminate = function() { return t.__awaiter(this, void 0, void 0, (function() { return t.__generator(this, (function(t) { switch (t.label) { case 0: return this.ql && this.ql.stop(), [ 4 /*yield*/ , this.Sh.Di() ]; case 1: return t.sent(), [ 4 /*yield*/ , this.persistence.Di() ]; case 2: return t.sent(), [ 2 /*return*/ ]; } })); })); }, e.prototype.clearPersistence = function(t, e) { throw new c(a.FAILED_PRECONDITION, au); }, e; }(), hu = /** @class */ function(e) { function n() { return null !== e && e.apply(this, arguments) || this; } return t.__extends(n, e), n.prototype.initialize = function(n) { return t.__awaiter(this, void 0, void 0, (function() { var r, i = this; return t.__generator(this, (function(o) { switch (o.label) { case 0: return [ 4 /*yield*/ , e.prototype.initialize.call(this, n) ]; case 1: return o.sent(), r = this.Kl.fi, this.Sh instanceof Yr ? (this.Sh.fi = { er: Ms.bind(null, r), nr: Bs.bind(null, r), sr: Ws.bind(null, r), pi: zs.bind(null, r) }, [ 4 /*yield*/ , this.Sh.start() ]) : [ 3 /*break*/ , 3 ]; case 2: o.sent(), o.label = 3; case 3: // NOTE: This will immediately call the listener, so we make sure to // set it after localStore / remoteStore are started. return [ 4 /*yield*/ , this.persistence.Xa((function(e) { return t.__awaiter(i, void 0, void 0, (function() { return t.__generator(this, (function(t) { switch (t.label) { case 0: return [ 4 /*yield*/ , qs(this.Kl.fi, e) ]; case 1: return t.sent(), this.ql && (e && !this.ql.Ei ? this.ql.start(this.ju) : e || this.ql.stop()), [ 2 /*return*/ ]; } })); })); })) ]; case 4: // NOTE: This will immediately call the listener, so we make sure to // set it after localStore / remoteStore are started. return o.sent(), [ 2 /*return*/ ]; } })); })); }, n.prototype.Ll = function(t) { if (t.persistenceSettings.jl && t.persistenceSettings.synchronizeTabs) { var e = Ar(); if (!Yr.Ln(e)) throw new c(a.UNIMPLEMENTED, "IndexedDB persistence is only available on platforms that support LocalStorage."); var n = yo(t.bl.U, t.bl.persistenceKey); return new Yr(e, t.cs, n, t.clientId, t.Wl); } return new $r; }, n; }(/** @class */ function(e) { function n(t) { var n = this; return (n = e.call(this) || this).Kl = t, n; } return t.__extends(n, e), n.prototype.initialize = function(n) { return t.__awaiter(this, void 0, void 0, (function() { return t.__generator(this, (function(t) { switch (t.label) { case 0: return [ 4 /*yield*/ , e.prototype.initialize.call(this, n) ]; case 1: return t.sent(), [ 4 /*yield*/ , So(this.ju) ]; case 2: return t.sent(), [ 4 /*yield*/ , this.Kl.initialize(this, n) ]; case 3: // Enqueue writes from a previous session return t.sent(), [ 4 /*yield*/ , Qs(this.Kl.fi) ]; case 4: // Enqueue writes from a previous session return t.sent(), [ 4 /*yield*/ , is(this.Kl.ph) ]; case 5: return t.sent(), [ 2 /*return*/ ]; } })); })); }, n.prototype.Ul = function(t) { var e = this.persistence.No.wo; return new ai(e, t.cs); }, n.prototype.Bl = function(t) { var e = yo(t.bl.U, t.bl.persistenceKey), n = uu(t.bl.U); return new ho(t.persistenceSettings.synchronizeTabs, e, t.clientId, ui.ao(t.persistenceSettings.cacheSizeBytes), t.cs, Ar(), Sr(), n, this.Sh, t.persistenceSettings.ka); }, n.prototype.Ll = function(t) { return new $r; }, n.prototype.clearPersistence = function(e, n) { return function(e) { return t.__awaiter(this, void 0, void 0, (function() { var n; return t.__generator(this, (function(t) { switch (t.label) { case 0: return gr.Ln() ? (n = e + "main", [ 4 /*yield*/ , gr.delete(n) ]) : [ 2 /*return*/ , Promise.resolve() ]; case 1: return t.sent(), [ 2 /*return*/ ]; } })); })); }(yo(e, n)); }, n; }(cu)), fu = /** @class */ function() { function e() {} return e.prototype.initialize = function(e, n) { return t.__awaiter(this, void 0, void 0, (function() { var r = this; return t.__generator(this, (function(t) { switch (t.label) { case 0: return this.ju ? [ 3 /*break*/ , 2 ] : (this.ju = e.ju, this.Sh = e.Sh, this.Ku = this.Gl(n), this.ph = this.zl(n), this.bh = this.Hl(n), this.fi = this.Yl(n), this.Sh.di = function(t) { return Ts(r.fi, t, 1 /* SharedClientState */); }, this.ph.Gu.Jl = Us.bind(null, this.fi), [ 4 /*yield*/ , fs(this.ph, this.fi.Uh) ]); case 1: t.sent(), t.label = 2; case 2: return [ 2 /*return*/ ]; } })); })); }, e.prototype.Hl = function(t) { return new Rr; }, e.prototype.Gl = function(t) { var e, n = uu(t.bl.U), r = (e = t.bl, new iu(e)); /** Return the Platform-specific connectivity monitor. */ return function(t, e, n) { return new Mo(t, e, n); }(t.credentials, r, n); }, e.prototype.zl = function(t) { var e, n, r, i, o, s = this; return e = this.ju, n = this.Ku, r = t.cs, i = function(t) { return Ts(s.fi, t, 0 /* RemoteStore */); }, o = ou.Ln() ? new ou : new su, new jo(e, n, r, i, o); }, e.prototype.Yl = function(t) { return function(t, e, n, // PORTING NOTE: Manages state synchronization in multi-tab environments. r, i, o, s) { var u = new ws(t, e, n, r, i, o); return s && (u.qh = !0), u; }(this.ju, this.ph, this.bh, this.Sh, t.Wl, t.Dh, !t.persistenceSettings.jl || !t.persistenceSettings.synchronizeTabs); }, e.prototype.terminate = function() { return Bo(this.ph); }, e; }(), lu = /** @class */ function() { function t(t) { this.observer = t, /** * When set to true, will not raise future events. Necessary to deal with * async detachment of listener. */ this.muted = !1; } return t.prototype.next = function(t) { this.observer.next && this.Xl(this.observer.next, t); }, t.prototype.error = function(t) { this.observer.error ? this.Xl(this.observer.error, t) : console.error("Uncaught Error in snapshot listener:", t); }, t.prototype.Zl = function() { this.muted = !0; }, t.prototype.Xl = function(t, e) { var n = this; this.muted || setTimeout((function() { n.muted || t(e); }), 0); }, t; }(), pu = function(t) { !function(t, e, n, r) { if (!(e instanceof Array) || e.length < 1) throw new c(a.INVALID_ARGUMENT, "Function FieldPath() requires its fieldNames argument to be an array with at least " + W(1, "element") + "."); }(0, t); for (var e = 0; e < t.length; ++e) if (k("FieldPath", "string", e, t[e]), 0 === t[e].length) throw new c(a.INVALID_ARGUMENT, "Invalid field name at argument $(i + 1). Field names must not be empty."); this.t_ = new N(t); }, du = /** @class */ function(e) { /** * Creates a FieldPath from the provided field names. If more than one field * name is provided, the path will point to a nested field in a document. * * @param fieldNames A list of field names. */ function n() { for (var t = [], n = 0; n < arguments.length; n++) t[n] = arguments[n]; return e.call(this, t) || this; } return t.__extends(n, e), n.documentId = function() { /** * Internal Note: The backend doesn't technically support querying by * document ID. Instead it queries by the entire document name (full path * included), but in the cases we currently support documentId(), the net * effect is the same. */ return new n(N.v().R()); }, n.prototype.isEqual = function(t) { if (!(t instanceof n)) throw G("isEqual", "FieldPath", 1, t); return this.t_.isEqual(t.t_); }, n; }(pu), vu = new RegExp("[~\\*/\\[\\]]"), yu = /** * @param _methodName The public API endpoint that returns this class. */ function(t) { this.e_ = t; }, gu = /** @class */ function(e) { function n() { return null !== e && e.apply(this, arguments) || this; } return t.__extends(n, e), n.prototype.n_ = function(t) { if (2 /* MergeSet */ !== t.s_) throw 1 /* Update */ === t.s_ ? t.i_(this.e_ + "() can only appear at the top level of your update data") : t.i_(this.e_ + "() cannot be used with set() unless you pass {merge:true}"); // No transform to add for a delete, but we need to add it to our // fieldMask so it gets deleted. return t.We.push(t.path), null; }, n.prototype.isEqual = function(t) { return t instanceof n; }, n; }(yu); /** * Provides all components needed for Firestore with in-memory persistence. * Uses EagerGC garbage collection. */ /** * Creates a child context for parsing SerializableFieldValues. * * This is different than calling `ParseContext.contextWith` because it keeps * the fieldTransforms and fieldMask separate. * * The created context has its `dataSource` set to `UserDataSource.Argument`. * Although these values are used with writes, any elements in these FieldValues * are not considered writes since they cannot contain any FieldValue sentinels, * etc. * * @param fieldValue The sentinel FieldValue for which to create a child * context. * @param context The parent context. * @param arrayElement Whether or not the FieldValue has an array. */ function mu(t, e, n) { return new Lu({ s_: 3 /* Argument */ , r_: e.settings.r_, methodName: t.e_, o_: n }, e.U, e.serializer, e.ignoreUndefinedProperties); } var wu = /** @class */ function(e) { function n() { return null !== e && e.apply(this, arguments) || this; } return t.__extends(n, e), n.prototype.n_ = function(t) { return new cn(t.path, new Ze); }, n.prototype.isEqual = function(t) { return t instanceof n; }, n; }(yu), _u = /** @class */ function(e) { function n(t, n) { var r = this; return (r = e.call(this, t) || this).a_ = n, r; } return t.__extends(n, e), n.prototype.n_ = function(t) { var e = mu(this, t, /*array=*/ !0), n = this.a_.map((function(t) { return Uu(t, e); })), r = new tn(n); return new cn(t.path, r); }, n.prototype.isEqual = function(t) { // TODO(mrschmidt): Implement isEquals return this === t; }, n; }(yu), bu = /** @class */ function(e) { function n(t, n) { var r = this; return (r = e.call(this, t) || this).a_ = n, r; } return t.__extends(n, e), n.prototype.n_ = function(t) { var e = mu(this, t, /*array=*/ !0), n = this.a_.map((function(t) { return Uu(t, e); })), r = new nn(n); return new cn(t.path, r); }, n.prototype.isEqual = function(t) { // TODO(mrschmidt): Implement isEquals return this === t; }, n; }(yu), Iu = /** @class */ function(e) { function n(t, n) { var r = this; return (r = e.call(this, t) || this).c_ = n, r; } return t.__extends(n, e), n.prototype.n_ = function(t) { var e = new on(t.serializer, we(t.serializer, this.c_)); return new cn(t.path, e); }, n.prototype.isEqual = function(t) { // TODO(mrschmidt): Implement isEquals return this === t; }, n; }(yu), Eu = /** @class */ function() { /** * Creates a new immutable `GeoPoint` object with the provided latitude and * longitude values. * @param latitude The latitude as number between -90 and 90. * @param longitude The longitude as number between -180 and 180. */ function t(t, e) { if (D("GeoPoint", arguments, 2), k("GeoPoint", "number", 1, t), k("GeoPoint", "number", 2, e), !isFinite(t) || t < -90 || t > 90) throw new c(a.INVALID_ARGUMENT, "Latitude must be a number between -90 and 90, but was: " + t); if (!isFinite(e) || e < -180 || e > 180) throw new c(a.INVALID_ARGUMENT, "Longitude must be a number between -180 and 180, but was: " + e); this.u_ = t, this.h_ = e; } return Object.defineProperty(t.prototype, "latitude", { /** * The latitude of this `GeoPoint` instance. */ get: function() { return this.u_; }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "longitude", { /** * The longitude of this `GeoPoint` instance. */ get: function() { return this.h_; }, enumerable: !1, configurable: !0 }), /** * Returns true if this `GeoPoint` is equal to the provided one. * * @param other The `GeoPoint` to compare against. * @return true if this `GeoPoint` is equal to the provided one. */ t.prototype.isEqual = function(t) { return this.u_ === t.u_ && this.h_ === t.h_; }, t.prototype.toJSON = function() { return { latitude: this.u_, longitude: this.h_ }; }, /** * Actually private to JS consumers of our API, so this function is prefixed * with an underscore. */ t.prototype.Y = function(t) { return H(this.u_, t.u_) || H(this.h_, t.h_); }, t; }(), Tu = function(t) { this.l_ = t; }, Nu = /^__.*__$/, Au = function(t, e, n) { this.__ = t, this.f_ = e, this.d_ = n; }, Su = /** @class */ function() { function t(t, e, n) { this.data = t, this.We = e, this.fieldTransforms = n; } return t.prototype.w_ = function(t, e) { var n = []; return null !== this.We ? n.push(new _n(t, this.data, this.We, e)) : n.push(new wn(t, this.data, e)), this.fieldTransforms.length > 0 && n.push(new In(t, this.fieldTransforms)), n; }, t; }(), Du = /** @class */ function() { function t(t, e, n) { this.data = t, this.We = e, this.fieldTransforms = n; } return t.prototype.w_ = function(t, e) { var n = [ new _n(t, this.data, this.We, e) ]; return this.fieldTransforms.length > 0 && n.push(new In(t, this.fieldTransforms)), n; }, t; }(); function xu(t) { switch (t) { case 0 /* Set */ : // fall through case 2 /* MergeSet */ : // fall through case 1 /* Update */ : return !0; case 3 /* Argument */ : case 4 /* ArrayArgument */ : return !1; default: throw y(); } } /** A "context" object passed around while parsing user data. */ var Lu = /** @class */ function() { /** * Initializes a ParseContext with the given source and path. * * @param settings The settings for the parser. * @param databaseId The database ID of the Firestore instance. * @param serializer The serializer to use to generate the Value proto. * @param ignoreUndefinedProperties Whether to ignore undefined properties * rather than throw. * @param fieldTransforms A mutable list of field transforms encountered while * parsing the data. * @param fieldMask A mutable list of field paths encountered while parsing * the data. * * TODO(b/34871131): We don't support array paths right now, so path can be * null to indicate the context represents any location within an array (in * which case certain features will not work and errors will be somewhat * compromised). */ function t(t, e, n, r, i, o) { this.settings = t, this.U = e, this.serializer = n, this.ignoreUndefinedProperties = r, // Minor hack: If fieldTransforms is undefined, we assume this is an // external call and we need to validate the entire path. void 0 === i && this.m_(), this.fieldTransforms = i || [], this.We = o || []; } return Object.defineProperty(t.prototype, "path", { get: function() { return this.settings.path; }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "s_", { get: function() { return this.settings.s_; }, enumerable: !1, configurable: !0 }), /** Returns a new context with the specified settings overwritten. */ t.prototype.T_ = function(e) { return new t(Object.assign(Object.assign({}, this.settings), e), this.U, this.serializer, this.ignoreUndefinedProperties, this.fieldTransforms, this.We); }, t.prototype.E_ = function(t) { var e, n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t), r = this.T_({ path: n, o_: !1 }); return r.I_(t), r; }, t.prototype.A_ = function(t) { var e, n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t), r = this.T_({ path: n, o_: !1 }); return r.m_(), r; }, t.prototype.R_ = function(t) { // TODO(b/34871131): We don't support array paths right now; so make path // undefined. return this.T_({ path: void 0, o_: !0 }); }, t.prototype.i_ = function(t) { return Gu(t, this.settings.methodName, this.settings.g_ || !1, this.path, this.settings.r_); }, /** Returns 'true' if 'fieldPath' was traversed when creating this context. */ t.prototype.contains = function(t) { return void 0 !== this.We.find((function(e) { return t.T(e); })) || void 0 !== this.fieldTransforms.find((function(e) { return t.T(e.field); })); }, t.prototype.m_ = function() { // TODO(b/34871131): Remove null check once we have proper paths for fields // within arrays. if (this.path) for (var t = 0; t < this.path.length; t++) this.I_(this.path.get(t)); }, t.prototype.I_ = function(t) { if (0 === t.length) throw this.i_("Document fields must not be empty"); if (xu(this.s_) && Nu.test(t)) throw this.i_('Document fields cannot begin and end with "__"'); }, t; }(), ku = /** @class */ function() { function t(t, e, n) { this.U = t, this.ignoreUndefinedProperties = e, this.serializer = n || uu(t) /** Creates a new top-level parse context. */; } return t.prototype.P_ = function(t, e, n, r) { return void 0 === r && (r = !1), new Lu({ s_: t, methodName: e, r_: n, path: N.P(), o_: !1, g_: r }, this.U, this.serializer, this.ignoreUndefinedProperties); }, t; }(); /** * Helper for parsing raw user input (provided via the API) into internal model * classes. */ /** Parse document data from a set() call. */ function Ru(t, e, n, r, i, o) { void 0 === o && (o = {}); var s = t.P_(o.merge || o.mergeFields ? 2 /* MergeSet */ : 0 /* Set */ , e, n, i); Mu("Data must be an object, but it was:", s, r); var u, h, f = Cu(r, s); if (o.merge) u = new an(s.We), h = s.fieldTransforms; else if (o.mergeFields) { for (var l = [], p = 0, d = o.mergeFields; p < d.length; p++) { var v = d[p], g = void 0; if (v instanceof pu) g = v.t_; else { if ("string" != typeof v) throw y(); g = ju(e, v, n); } if (!s.contains(g)) throw new c(a.INVALID_ARGUMENT, "Field '" + g + "' is specified in your field mask but missing from your input data."); zu(l, g) || l.push(g); } u = new an(l), h = s.fieldTransforms.filter((function(t) { return u.Ye(t.field); })); } else u = null, h = s.fieldTransforms; return new Su(new Sn(f), u, h); } /** Parse update data from an update() call. */ function Ou(t, e, n, r) { var i = t.P_(1 /* Update */ , e, n); Mu("Data must be an object, but it was:", i, r); var o = [], s = new Dn; _(r, (function(t, r) { var u = ju(e, t, n), a = i.A_(u); if (r instanceof gu || r instanceof Tu && r.l_ instanceof gu) // Add it to the field mask, but don't add anything to updateData. o.push(u); else { var c = Uu(r, a); null != c && (o.push(u), s.set(u, c)); } })); var u = new an(o); return new Du(s.Xe(), u, i.fieldTransforms); } /** Parse update data from a list of field/value arguments. */ function Pu(t, e, n, r, i, o) { var s = t.P_(1 /* Update */ , e, n), u = [ qu(e, r, n) ], h = [ i ]; if (o.length % 2 != 0) throw new c(a.INVALID_ARGUMENT, "Function " + e + "() needs to be called with an even number of arguments that alternate between field names and values."); for (var f = 0; f < o.length; f += 2) u.push(qu(e, o[f])), h.push(o[f + 1]); // We iterate in reverse order to pick the last value for a field if the // user specified the field multiple times. for (var l = [], p = new Dn, d = u.length - 1; d >= 0; --d) if (!zu(l, u[d])) { var v = u[d], y = h[d], g = s.A_(v); if (y instanceof gu || y instanceof Tu && y.l_ instanceof gu) // Add it to the field mask, but don't add anything to updateData. l.push(v); else { var m = Uu(y, g); null != m && (l.push(v), p.set(v, m)); } } var w = new an(l); return new Du(p.Xe(), w, s.fieldTransforms); } /** * Parse a "query value" (e.g. value in a where filter or a value in a cursor * bound). * * @param allowArrays Whether the query value is an array that may directly * contain additional arrays (e.g. the operand of an `in` query). */ function Vu(t, e, n, r) { return void 0 === r && (r = !1), Uu(n, t.P_(r ? 4 /* ArrayArgument */ : 3 /* Argument */ , e)); } /** * Parses user data to Protobuf Values. * * @param input Data to be parsed. * @param context A context object representing the current path being parsed, * the source of the data being parsed, etc. * @return The parsed value, or null if the value was a FieldValue sentinel * that should not be included in the resulting parsed data. */ function Uu(t, e) { if ( // Unwrap the API type from the Compat SDK. This will return the API type // from firestore-exp. t instanceof Tu && (t = t.l_), Fu(t)) return Mu("Unsupported field value:", e, t), Cu(t, e); if (t instanceof yu) // FieldValues usually parse into transforms (except FieldValue.delete()) // in which case we do not want to include this field in our parsed data // (as doing so will overwrite the field directly prior to the transform // trying to transform it). So we don't add this location to // context.fieldMask and we return null as our parsing result. /** * "Parses" the provided FieldValueImpl, adding any necessary transforms to * context.fieldTransforms. */ return function(t, e) { // Sentinels are only supported with writes, and not within arrays. if (!xu(e.s_)) throw e.i_(t.e_ + "() can only be used with update() and set()"); if (!e.path) throw e.i_(t.e_ + "() is not currently supported inside arrays"); var n = t.n_(e); n && e.fieldTransforms.push(n); }(t, e), null; if ( // If context.path is null we are inside an array and we don't support // field mask paths more granular than the top-level array. e.path && e.We.push(e.path), t instanceof Array) { // TODO(b/34871131): Include the path containing the array in the error // message. // In the case of IN queries, the parsed data is an array (representing // the set of values to be included for the IN query) that may directly // contain additional arrays (each representing an individual field // value), so we disable this validation. if (e.settings.o_ && 4 /* ArrayArgument */ !== e.s_) throw e.i_("Nested arrays are not supported"); return function(t, e) { for (var n = [], r = 0, i = 0, o = t; i < o.length; i++) { var s = Uu(o[i], e.R_(r)); null == s && ( // Just include nulls in the array for fields being replaced with a // sentinel. s = { nullValue: "NULL_VALUE" }), n.push(s), r++; } return { arrayValue: { values: n } }; }(t, e); } return function(t, e) { if (null === t) return { nullValue: "NULL_VALUE" }; if ("number" == typeof t) return we(e.serializer, t); if ("boolean" == typeof t) return { booleanValue: t }; if ("string" == typeof t) return { stringValue: t }; if (t instanceof Date) { var n = ot.fromDate(t); return { timestampValue: _e(e.serializer, n) }; } if (t instanceof ot) { // Firestore backend truncates precision down to microseconds. To ensure // offline mode works the same with regards to truncation, perform the // truncation immediately without waiting for the backend to do that. var r = new ot(t.seconds, 1e3 * Math.floor(t.nanoseconds / 1e3)); return { timestampValue: _e(e.serializer, r) }; } if (t instanceof Eu) return { geoPointValue: { latitude: t.latitude, longitude: t.longitude } }; if (t instanceof J) return { bytesValue: be(e.serializer, t.q) }; if (t instanceof Au) { var i = e.U, o = t.__; if (!o.isEqual(i)) throw e.i_("Document reference is for database " + o.projectId + "/" + o.database + " but should be for database " + i.projectId + "/" + i.database); return { referenceValue: Te(t.__ || e.U, t.f_.path) }; } if (void 0 === t && e.ignoreUndefinedProperties) return null; throw e.i_("Unsupported field value: " + M(t)); }(t, e); } function Cu(t, e) { var n = {}; return b(t) ? // If we encounter an empty object, we explicitly add it to the update // mask to ensure that the server creates a map entry. e.path && e.path.length > 0 && e.We.push(e.path) : _(t, (function(t, r) { var i = Uu(r, e.E_(t)); null != i && (n[t] = i); })), { mapValue: { fields: n } }; } function Fu(t) { return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof ot || t instanceof Eu || t instanceof J || t instanceof Au || t instanceof yu); } function Mu(t, e, n) { if (!Fu(n) || !F(n)) { var r = M(n); throw "an object" === r ? e.i_(t + " a custom object") : e.i_(t + " " + r); } } /** * Helper that calls fromDotSeparatedString() but wraps any error thrown. */ function qu(t, e, n) { if (e instanceof pu) return e.t_; if ("string" == typeof e) return ju(t, e); throw Gu("Field path arguments must be of type string or FieldPath.", t, /* hasConverter= */ !1, /* path= */ void 0, n); } /** * Wraps fromDotSeparatedString with an error message about the method that * was thrown. * @param methodName The publicly visible method name * @param path The dot-separated string form of a field path which will be split * on dots. * @param targetDoc The document against which the field path will be evaluated. */ function ju(e, n, r) { try { return function(e) { if (e.search(vu) >= 0) throw new c(a.INVALID_ARGUMENT, "Invalid field path (" + e + "). Paths must not contain '~', '*', '/', '[', or ']'"); try { return new (du.bind.apply(du, t.__spreadArrays([ void 0 ], e.split(".")))); } catch (t) { throw new c(a.INVALID_ARGUMENT, "Invalid field path (" + e + "). Paths must not be empty, begin with '.', end with '.', or contain '..'"); } }(n).t_; } catch (n) { throw Gu((i = n) instanceof Error ? i.message : i.toString(), e, /* hasConverter= */ !1, /* path= */ void 0, r); } /** * Extracts the message from a caught exception, which should be an Error object * though JS doesn't guarantee that. */ var i; /** Checks `haystack` if FieldPath `needle` is present. Runs in O(n). */} function Gu(t, e, n, r, i) { var o = r && !r.m(), s = void 0 !== i, u = "Function " + e + "() called with invalid data"; n && (u += " (via `toFirestore()`)"); var h = ""; return (o || s) && (h += " (found", o && (h += " in field " + r), s && (h += " in document " + i), h += ")"), new c(a.INVALID_ARGUMENT, (u += ". ") + t + h); } function zu(t, e) { return t.some((function(t) { return t.isEqual(e); })); } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Internal transaction object responsible for accumulating the mutations to * perform and the base versions for any documents read. */ var Bu = /** @class */ function() { function e(t) { this.Ku = t, // The version of each document that was read during this transaction. this.y_ = new Map, this.mutations = [], this.V_ = !1, /** * A deferred usage error that occurred previously in this transaction that * will cause the transaction to fail once it actually commits. */ this.p_ = null, /** * Set of documents that have been written in the transaction. * * When there's more than one write to the same key in a transaction, any * writes after the first are handled differently. */ this.b_ = new Set; } return e.prototype.v_ = function(e) { return t.__awaiter(this, void 0, void 0, (function() { var n, r = this; return t.__generator(this, (function(i) { switch (i.label) { case 0: if (this.S_(), this.mutations.length > 0) throw new c(a.INVALID_ARGUMENT, "Firestore transactions require all reads to be executed before all writes."); return [ 4 /*yield*/ , function(e, n) { return t.__awaiter(this, void 0, void 0, (function() { var r, i, o, s, u, a; return t.__generator(this, (function(t) { switch (t.label) { case 0: return r = m(e), i = Le(r.serializer) + "/documents", o = { documents: n.map((function(t) { return Ae(r.serializer, t); })) }, [ 4 /*yield*/ , r.ku("BatchGetDocuments", i, o) ]; case 1: return s = t.sent(), u = new Map, s.forEach((function(t) { var e = function(t, e) { return "found" in e ? function(t, e) { g(!!e.found), e.found.name, e.found.updateTime; var n = Se(t, e.found.name), r = Ee(e.found.updateTime), i = new Sn({ mapValue: { fields: e.found.fields } }); return new kn(n, r, i, {}); }(t, e) : "missing" in e ? function(t, e) { g(!!e.missing), g(!!e.readTime); var n = Se(t, e.missing), r = Ee(e.readTime); return new Rn(n, r); }(t, e) : y(); }(r.serializer, t); u.set(e.key.toString(), e); })), a = [], [ 2 /*return*/ , (n.forEach((function(t) { var e = u.get(t.toString()); g(!!e), a.push(e); })), a) ]; } })); })); }(this.Ku, e) ]; case 1: return [ 2 /*return*/ , ((n = i.sent()).forEach((function(t) { t instanceof Rn || t instanceof kn ? r.D_(t) : y(); })), n) ]; } })); })); }, e.prototype.set = function(t, e) { this.write(e.w_(t, this.Ge(t))), this.b_.add(t.toString()); }, e.prototype.update = function(t, e) { try { this.write(e.w_(t, this.C_(t))); } catch (t) { this.p_ = t; } this.b_.add(t.toString()); }, e.prototype.delete = function(t) { this.write([ new Nn(t, this.Ge(t)) ]), this.b_.add(t.toString()); }, e.prototype.commit = function() { return t.__awaiter(this, void 0, void 0, (function() { var e, n = this; return t.__generator(this, (function(r) { switch (r.label) { case 0: if (this.S_(), this.p_) throw this.p_; return e = this.y_, // For each mutation, note that the doc was written. this.mutations.forEach((function(t) { e.delete(t.key.toString()); })), // For each document that was read but not written to, we want to perform // a `verify` operation. e.forEach((function(t, e) { var r = A.D(e); n.mutations.push(new An(r, n.Ge(r))); })), [ 4 /*yield*/ , function(e, n) { return t.__awaiter(this, void 0, void 0, (function() { var r, i, o; return t.__generator(this, (function(t) { switch (t.label) { case 0: return r = m(e), i = Le(r.serializer) + "/documents", o = { writes: n.map((function(t) { return Oe(r.serializer, t); })) }, [ 4 /*yield*/ , r.$u("Commit", i, o) ]; case 1: return t.sent(), [ 2 /*return*/ ]; } })); })); }(this.Ku, this.mutations) ]; case 1: // For each mutation, note that the doc was written. return r.sent(), this.V_ = !0, [ 2 /*return*/ ]; } })); })); }, e.prototype.D_ = function(t) { var e; if (t instanceof kn) e = t.version; else { if (!(t instanceof Rn)) throw y(); // For deleted docs, we must use baseVersion 0 when we overwrite them. e = st.min(); } var n = this.y_.get(t.key.toString()); if (n) { if (!e.isEqual(n)) // This transaction will fail no matter what. throw new c(a.ABORTED, "Document version changed between two reads."); } else this.y_.set(t.key.toString(), e); }, /** * Returns the version of this document when it was read in this transaction, * as a precondition, or no precondition if it was not read. */ e.prototype.Ge = function(t) { var e = this.y_.get(t.toString()); return !this.b_.has(t.toString()) && e ? fn.updateTime(e) : fn.ze(); }, /** * Returns the precondition for a document if the operation is an update. */ e.prototype.C_ = function(t) { var e = this.y_.get(t.toString()); // The first time a document is written, we want to take into account the // read time and existence if (!this.b_.has(t.toString()) && e) { if (e.isEqual(st.min())) // The document doesn't exist, so fail the transaction. // This has to be validated locally because you can't send a // precondition that a document does not exist without changing the // semantics of the backend write to be an insert. This is the reverse // of what we want, since we want to assert that the document doesn't // exist but then send the update and have it fail. Since we can't // express that to the backend, we have to validate locally. // Note: this can change once we can send separate verify writes in the // transaction. throw new c(a.INVALID_ARGUMENT, "Can't update a document that doesn't exist."); // Document exists, base precondition on document update time. return fn.updateTime(e); } // Document was not read, so we just use the preconditions for a blind // update. return fn.exists(!0); }, e.prototype.write = function(t) { this.S_(), this.mutations = this.mutations.concat(t); }, e.prototype.S_ = function() {}, e; }(), Wu = /** @class */ function() { function e(t, e, n, r) { this.cs = t, this.Ku = e, this.updateFunction = n, this.ls = r, this.N_ = 5, this.ys = new vr(this.cs, "transaction_retry" /* TransactionRetry */) /** Runs the transaction and sets the result on deferred. */; } return e.prototype.run = function() { this.F_(); }, e.prototype.F_ = function() { var e = this; this.ys.gn((function() { return t.__awaiter(e, void 0, void 0, (function() { var e, n, r = this; return t.__generator(this, (function(t) { return e = new Bu(this.Ku), (n = this.x_(e)) && n.then((function(t) { r.cs.ws((function() { return e.commit().then((function() { r.ls.resolve(t); })).catch((function(t) { r.k_(t); })); })); })).catch((function(t) { r.k_(t); })), [ 2 /*return*/ ]; })); })); })); }, e.prototype.x_ = function(t) { try { var e = this.updateFunction(t); return !ut(e) && e.catch && e.then ? e : (this.ls.reject(Error("Transaction callback must return a Promise")), null); } catch (t) { // Do not retry errors thrown by user provided updateFunction. return this.ls.reject(t), null; } }, e.prototype.k_ = function(t) { var e = this; this.N_ > 0 && this.M_(t) ? (this.N_ -= 1, this.cs.ws((function() { return e.F_(), Promise.resolve(); }))) : this.ls.reject(t); }, e.prototype.M_ = function(t) { if ("FirebaseError" === t.name) { // In transactions, the backend will fail outdated reads with FAILED_PRECONDITION and // non-matching document versions with ABORTED. These errors should be retried. var e = t.code; return "aborted" === e || "failed-precondition" === e || !wt(e); } return !1; }, e; }(), Ku = /** @class */ function() { function e(t, /** * Asynchronous queue responsible for all of our internal processing. When * we get incoming work from the user (via public API) or the network * (incoming GRPC messages), we should always schedule onto this queue. * This ensures all of our work is properly serialized (e.g. we don't * start processing a new operation while the previous one is waiting for * an async I/O to complete). */ e) { this.credentials = t, this.cs = e, this.clientId = Q.k(), // We defer our initialization until we get the current user from // setChangeListener(). We block the async queue until we got the initial // user and the initialization is completed. This will prevent any scheduled // work from happening before initialization is completed. // If initializationDone resolved then the FirestoreClient is in a usable // state. this.O_ = new dr /** * Starts up the FirestoreClient, returning only whether or not enabling * persistence succeeded. * * The intent here is to "do the right thing" as far as users are concerned. * Namely, in cases where offline persistence is requested and possible, * enable it, but otherwise fall back to persistence disabled. For the most * part we expect this to succeed one way or the other so we don't expect our * users to actually wait on the firestore.enablePersistence Promise since * they generally won't care. * * Of course some users actually do care about whether or not persistence * was successfully enabled, so the Promise returned from this method * indicates this outcome. * * This presents a problem though: even before enablePersistence resolves or * rejects, users may have made calls to e.g. firestore.collection() which * means that the FirestoreClient in there will be available and will be * enqueuing actions on the async queue. * * Meanwhile any failure of an operation on the async queue causes it to * panic and reject any further work, on the premise that unhandled errors * are fatal. * * Consequently the fallback is handled internally here in start, and if the * fallback succeeds we signal success to the async queue even though the * start() itself signals failure. * * @param databaseInfo The connection information for the current instance. * @param offlineComponentProvider Provider that returns all components * required for memory-only or IndexedDB persistence. * @param onlineComponentProvider Provider that returns all components * required for online support. * @param persistenceSettings Settings object to configure offline * persistence. * @returns A deferred result indicating the user-visible result of enabling * offline persistence. This method will reject this if IndexedDB fails to * start for any reason. If usePersistence is false this is * unconditionally resolved. */; } return e.prototype.start = function(e, n, r, i) { var o = this; this.L_(), this.bl = e; // If usePersistence is true, certain classes of errors while starting are // recoverable but only by falling back to persistence disabled. // If there's an error in the first case but not in recovery we cannot // reject the promise blocking the async queue because this will cause the // async queue to panic. var s = new dr, u = !1; // Return only the result of enabling persistence. Note that this does not // need to await the completion of initializationDone because the result of // this method should not reflect any other kind of failure to start. return this.credentials.Hc((function(e) { if (!u) return u = !0, l("FirestoreClient", "Initializing. user=", e.uid), o.B_(n, r, i, e, s).then(o.O_.resolve, o.O_.reject); o.cs.Cs((function() { return function(e, n) { return t.__awaiter(this, void 0, void 0, (function() { var r, i; return t.__generator(this, (function(t) { switch (t.label) { case 0: return (r = m(e)).cs.xs(), l("RemoteStore", "RemoteStore received new credentials"), i = Xo(r), // Tear down and re-create our network streams. This will ensure we get a // fresh auth token for the new user and re-fill the write pipeline with // new mutations from the LocalStore (since mutations are per-user). r.Yu.add(3 /* CredentialChange */), [ 4 /*yield*/ , zo(r) ]; case 1: return t.sent(), i && // Don't set the network status to Unknown if we are offline. r.th.set("Unknown" /* Unknown */), [ 4 /*yield*/ , r.Gu.Jl(n) ]; case 2: return t.sent(), r.Yu.delete(3 /* CredentialChange */), [ 4 /*yield*/ , Go(r) ]; case 3: // Tear down and re-create our network streams. This will ensure we get a // fresh auth token for the new user and re-fill the write pipeline with // new mutations from the LocalStore (since mutations are per-user). return t.sent(), [ 2 /*return*/ ]; } })); })); }(o.ph, e); })); })), // Block the async queue until initialization is done this.cs.ws((function() { return o.O_.promise; })), s.promise; }, /** Enables the network connection and requeues all pending operations. */ e.prototype.enableNetwork = function() { var t = this; return this.L_(), this.cs.enqueue((function() { return t.persistence.tc(!0), function(t) { var e = m(t); return e.Yu.delete(0 /* UserDisabled */), Go(e); }(t.ph); })); }, /** * Initializes persistent storage, attempting to use IndexedDB if * usePersistence is true or memory-only if false. * * If IndexedDB fails because it's already open in another tab or because the * platform can't possibly support our implementation then this method rejects * the persistenceResult and falls back on memory-only persistence. * * @param offlineComponentProvider Provider that returns all components * required for memory-only or IndexedDB persistence. * @param onlineComponentProvider Provider that returns all components * required for online support. * @param persistenceSettings Settings object to configure offline persistence * @param user The initial user * @param persistenceResult A deferred result indicating the user-visible * result of enabling offline persistence. This method will reject this if * IndexedDB fails to start for any reason. If usePersistence is false * this is unconditionally resolved. * @returns a Promise indicating whether or not initialization should * continue, i.e. that one of the persistence implementations actually * succeeded. */ e.prototype.B_ = function(e, n, r, i, o) { return t.__awaiter(this, void 0, void 0, (function() { var s, u, a = this; return t.__generator(this, (function(c) { switch (c.label) { case 0: return c.trys.push([ 0, 3, , 4 ]), s = { cs: this.cs, bl: this.bl, clientId: this.clientId, credentials: this.credentials, Wl: i, Dh: 100, persistenceSettings: r }, [ 4 /*yield*/ , e.initialize(s) ]; case 1: return c.sent(), [ 4 /*yield*/ , n.initialize(e, s) ]; case 2: return c.sent(), this.persistence = e.persistence, this.Sh = e.Sh, this.ju = e.ju, this.ql = e.ql, this.Ku = n.Ku, this.ph = n.ph, this.fi = n.fi, this.q_ = n.bh, this.q_.Us = _s.bind(null, this.fi), this.q_.js = Is.bind(null, this.fi), // When a user calls clearPersistence() in one client, all other clients // need to be terminated to allow the delete to succeed. this.persistence.Za((function() { return t.__awaiter(a, void 0, void 0, (function() { return t.__generator(this, (function(t) { switch (t.label) { case 0: return [ 4 /*yield*/ , this.terminate() ]; case 1: return t.sent(), [ 2 /*return*/ ]; } })); })); })), o.resolve(), [ 3 /*break*/ , 4 ]; case 3: // An unknown failure on the first stage shuts everything down. if (u = c.sent(), // Regardless of whether or not the retry succeeds, from an user // perspective, offline persistence has failed. o.reject(u), !this.U_(u)) throw u; return [ 2 /*return*/ , (console.warn("Error enabling offline persistence. Falling back to persistence disabled: " + u), this.B_(new cu, new fu, { jl: !1 }, i, o)) ]; case 4: return [ 2 /*return*/ ]; } })); })); }, /** * Decides whether the provided error allows us to gracefully disable * persistence (as opposed to crashing the client). */ e.prototype.U_ = function(t) { return "FirebaseError" === t.name ? t.code === a.FAILED_PRECONDITION || t.code === a.UNIMPLEMENTED : !("undefined" != typeof DOMException && t instanceof DOMException) || // When the browser is out of quota we could get either quota exceeded // or an aborted error depending on whether the error happened during // schema migration. 22 === t.code || 20 === t.code || // Firefox Private Browsing mode disables IndexedDb and returns // INVALID_STATE for any usage. 11 === t.code; }, /** * Checks that the client has not been terminated. Ensures that other methods on * this class cannot be called after the client is terminated. */ e.prototype.L_ = function() { if (this.cs.ps) throw new c(a.FAILED_PRECONDITION, "The client has already been terminated."); }, /** Disables the network connection. Pending operations will not complete. */ e.prototype.disableNetwork = function() { var e = this; return this.L_(), this.cs.enqueue((function() { return e.persistence.tc(!1), function(e) { return t.__awaiter(this, void 0, void 0, (function() { var n; return t.__generator(this, (function(t) { switch (t.label) { case 0: return (n = m(e)).Yu.add(0 /* UserDisabled */), [ 4 /*yield*/ , zo(n) ]; case 1: return t.sent(), // Set the OnlineState to Offline so get()s return from cache, etc. n.th.set("Offline" /* Offline */), [ 2 /*return*/ ]; } })); })); }(e.ph); })); }, e.prototype.terminate = function() { var e = this; this.cs.Ds(); var n = new dr; return this.cs.bs((function() { return t.__awaiter(e, void 0, void 0, (function() { var e, r; return t.__generator(this, (function(t) { switch (t.label) { case 0: return t.trys.push([ 0, 4, , 5 ]), // PORTING NOTE: LocalStore does not need an explicit shutdown on web. this.ql && this.ql.stop(), [ 4 /*yield*/ , Bo(this.ph) ]; case 1: return t.sent(), [ 4 /*yield*/ , this.Sh.Di() ]; case 2: return t.sent(), [ 4 /*yield*/ , this.persistence.Di() ]; case 3: // PORTING NOTE: LocalStore does not need an explicit shutdown on web. return t.sent(), // `removeChangeListener` must be called after shutting down the // RemoteStore as it will prevent the RemoteStore from retrieving // auth tokens. this.credentials.Yc(), n.resolve(), [ 3 /*break*/ , 5 ]; case 4: return e = t.sent(), r = Lr(e, "Failed to shutdown persistence"), n.reject(r), [ 3 /*break*/ , 5 ]; case 5: return [ 2 /*return*/ ]; } })); })); })), n.promise; }, /** * Returns a Promise that resolves when all writes that were pending at the time this * method was called received server acknowledgement. An acknowledgement can be either acceptance * or rejection. */ e.prototype.waitForPendingWrites = function() { var e = this; this.L_(); var n = new dr; return this.cs.ws((function() { return function(e, n) { return t.__awaiter(this, void 0, void 0, (function() { var r, i, o, s, u; return t.__generator(this, (function(t) { switch (t.label) { case 0: Xo((r = m(e)).ph) || l("SyncEngine", "The network is disabled. The task returned by 'awaitPendingWrites()' will not complete until the network is enabled."), t.label = 1; case 1: return t.trys.push([ 1, 3, , 4 ]), [ 4 /*yield*/ , function(t) { var e = m(t); return e.persistence.runTransaction("Get highest unacknowledged batch id", "readonly", (function(t) { return e.Sr.qo(t); })); }(r.ju) ]; case 2: return -1 === (i = t.sent()) ? [ 2 /*return*/ , void n.resolve() ] : ((o = r.Lh.get(i) || []).push(n), r.Lh.set(i, o), [ 3 /*break*/ , 4 ]); case 3: return s = t.sent(), u = Lr(s, "Initialization of waitForPendingWrites() operation failed"), n.reject(u), [ 3 /*break*/ , 4 ]; case 4: return [ 2 /*return*/ ]; } })); })); }(e.fi, n); })), n.promise; }, e.prototype.listen = function(t, e, n) { var r = this; this.L_(); var i = new lu(n), o = new Fr(t, i, e); return this.cs.ws((function() { return Or(r.q_, o); })), function() { i.Zl(), r.cs.ws((function() { return Pr(r.q_, o); })); }; }, e.prototype.Q_ = function(e) { return t.__awaiter(this, void 0, void 0, (function() { var n, r = this; return t.__generator(this, (function(i) { switch (i.label) { case 0: return this.L_(), [ 4 /*yield*/ , this.O_.promise ]; case 1: return i.sent(), n = new dr, [ 2 /*return*/ , (this.cs.ws((function() { return function(e, n, r) { return t.__awaiter(this, void 0, void 0, (function() { var i, o, s; return t.__generator(this, (function(t) { switch (t.label) { case 0: return t.trys.push([ 0, 2, , 3 ]), [ 4 /*yield*/ , function(t, e) { var n = m(t); return n.persistence.runTransaction("read document", "readonly", (function(t) { return n.Cc.Cr(t, e); })); }(e, n) ]; case 1: return (i = t.sent()) instanceof kn ? r.resolve(i) : i instanceof Rn ? r.resolve(null) : r.reject(new c(a.UNAVAILABLE, "Failed to get document from cache. (However, this document may exist on the server. Run again without setting 'source' in the GetOptions to attempt to retrieve the document from the server.)")), [ 3 /*break*/ , 3 ]; case 2: return o = t.sent(), s = Lr(o, "Failed to get document '" + n + " from cache"), r.reject(s), [ 3 /*break*/ , 3 ]; case 3: return [ 2 /*return*/ ]; } })); })); }(r.ju, e, n); })), n.promise) ]; } })); })); }, e.prototype.W_ = function(e, n) { return void 0 === n && (n = {}), t.__awaiter(this, void 0, void 0, (function() { var r, i = this; return t.__generator(this, (function(t) { switch (t.label) { case 0: return this.L_(), [ 4 /*yield*/ , this.O_.promise ]; case 1: return t.sent(), r = new dr, [ 2 /*return*/ , (this.cs.ws((function() { return function(t, e, n, r, i) { var o = new lu({ next: function(o) { // Remove query first before passing event to user to avoid // user actions affecting the now stale query. e.ws((function() { return Pr(t, s); })); var u = o.docs.has(n); !u && o.fromCache ? // TODO(dimond): If we're online and the document doesn't // exist then we resolve with a doc.exists set to false. If // we're offline however, we reject the Promise in this // case. Two options: 1) Cache the negative response from // the server so we can deliver that even when you're // offline 2) Actually reject the Promise in the online case // if the document doesn't exist. i.reject(new c(a.UNAVAILABLE, "Failed to get document because the client is offline.")) : u && o.fromCache && r && "server" === r.source ? i.reject(new c(a.UNAVAILABLE, 'Failed to get document from server. (However, this document does exist in the local cache. Run again without setting source to "server" to retrieve the cached document.)')) : i.resolve(o); }, error: function(t) { return i.reject(t); } }), s = new Fr(Un(n.path), o, { includeMetadataChanges: !0, Xs: !0 }); return Or(t, s); }(i.q_, i.cs, e, n, r); })), r.promise) ]; } })); })); }, e.prototype.j_ = function(e) { return t.__awaiter(this, void 0, void 0, (function() { var n, r = this; return t.__generator(this, (function(i) { switch (i.label) { case 0: return this.L_(), [ 4 /*yield*/ , this.O_.promise ]; case 1: return i.sent(), n = new dr, [ 2 /*return*/ , (this.cs.ws((function() { return function(e, n, r) { return t.__awaiter(this, void 0, void 0, (function() { var i, o, s, u, a, c; return t.__generator(this, (function(t) { switch (t.label) { case 0: return t.trys.push([ 0, 2, , 3 ]), [ 4 /*yield*/ , To(e, n, /* usePreviousResults= */ !0) ]; case 1: return i = t.sent(), o = new ys(n, i.Fc), s = o.wh(i.documents), u = o.yr(s, /* updateLimboDocuments= */ !1), r.resolve(u.snapshot), [ 3 /*break*/ , 3 ]; case 2: return a = t.sent(), c = Lr(a, "Failed to execute query '" + n + " against cache"), r.reject(c), [ 3 /*break*/ , 3 ]; case 3: return [ 2 /*return*/ ]; } })); })); }(r.ju, e, n); })), n.promise) ]; } })); })); }, e.prototype.K_ = function(e, n) { return void 0 === n && (n = {}), t.__awaiter(this, void 0, void 0, (function() { var r, i = this; return t.__generator(this, (function(t) { switch (t.label) { case 0: return this.L_(), [ 4 /*yield*/ , this.O_.promise ]; case 1: return t.sent(), r = new dr, [ 2 /*return*/ , (this.cs.ws((function() { return function(t, e, n, r, i) { var o = new lu({ next: function(n) { // Remove query first before passing event to user to avoid // user actions affecting the now stale query. e.ws((function() { return Pr(t, s); })), n.fromCache && "server" === r.source ? i.reject(new c(a.UNAVAILABLE, 'Failed to get documents from server. (However, these documents may exist in the local cache. Run again without setting source to "server" to retrieve the cached documents.)')) : i.resolve(n); }, error: function(t) { return i.reject(t); } }), s = new Fr(n, o, { includeMetadataChanges: !0, Xs: !0 }); return Or(t, s); }(i.q_, i.cs, e, n, r); })), r.promise) ]; } })); })); }, e.prototype.write = function(e) { var n = this; this.L_(); var r = new dr; return this.cs.ws((function() { return function(e, n, r) { return t.__awaiter(this, void 0, void 0, (function() { var i, o, s, u; return t.__generator(this, (function(t) { switch (t.label) { case 0: i = Qs(e), t.label = 1; case 1: return t.trys.push([ 1, 5, , 6 ]), [ 4 /*yield*/ , /* Accepts locally generated Mutations and commit them to storage. */ function(t, e) { var n, r = m(t), i = ot.now(), o = e.reduce((function(t, e) { return t.add(e.key); }), Ot()); return r.persistence.runTransaction("Locally write mutations", "readwrite", (function(t) { return r.Cc.kr(t, o).next((function(o) { n = o; for ( // For non-idempotent mutations (such as `FieldValue.increment()`), // we record the base state in a separate patch mutation. This is // later used to guarantee consistent values and prevents flicker // even if the backend sends us an update that already includes our // transform. var s = [], u = 0, a = e; u < a.length; u++) { var c = a[u], h = yn(c, n.get(c.key)); null != h && // NOTE: The base state should only be applied if there's some // existing document to override, so use a Precondition of // exists=true s.push(new _n(c.key, h, xn(h.proto.mapValue), fn.exists(!0))); } return r.Sr.ko(t, i, s, e); })); })).then((function(t) { var e = t.lr(n); return { batchId: t.batchId, wr: e }; })); }(i.ju, n) ]; case 2: return o = t.sent(), i.Sh.xi(o.batchId), function(t, e, n) { var r = t.Oh[t.currentUser.ti()]; r || (r = new bt(H)), r = r.ot(e, n), t.Oh[t.currentUser.ti()] = r; }(i, o.batchId, r), [ 4 /*yield*/ , Vs(i, o.wr) ]; case 3: return t.sent(), [ 4 /*yield*/ , is(i.ph) ]; case 4: return t.sent(), [ 3 /*break*/ , 6 ]; case 5: return s = t.sent(), u = Lr(s, "Failed to persist write"), r.reject(u), [ 3 /*break*/ , 6 ]; case 6: return [ 2 /*return*/ ]; } })); })); }(n.fi, e, r); })), r.promise; }, e.prototype.U = function() { return this.bl.U; }, e.prototype.G_ = function(e) { var n = this; this.L_(); var r = new lu(e); return this.cs.ws((function() { return t.__awaiter(n, void 0, void 0, (function() { return t.__generator(this, (function(t) { return [ 2 /*return*/ , function(t, e) { m(t).qs.add(e), // Immediately fire an initial event, indicating all existing listeners // are in-sync. e.next(); }(this.q_, r) ]; })); })); })), function() { r.Zl(), n.cs.ws((function() { return t.__awaiter(n, void 0, void 0, (function() { return t.__generator(this, (function(t) { return [ 2 /*return*/ , function(t, e) { m(t).qs.delete(e); }(this.q_, r) ]; })); })); })); }; }, Object.defineProperty(e.prototype, "z_", { get: function() { // Technically, the asyncQueue is still running, but only accepting operations // related to termination or supposed to be run after termination. It is effectively // terminated to the eyes of users. return this.cs.ps; }, enumerable: !1, configurable: !0 }), /** * Takes an updateFunction in which a set of reads and writes can be performed * atomically. In the updateFunction, the client can read and write values * using the supplied transaction object. After the updateFunction, all * changes will be committed. If a retryable error occurs (ex: some other * client has changed any of the data referenced), then the updateFunction * will be called again after a backoff. If the updateFunction still fails * after all retries, then the transaction will be rejected. * * The transaction object passed to the updateFunction contains methods for * accessing documents and collections. Unlike other datastore access, data * accessed with the transaction will not reflect local changes that have not * been committed. For this reason, it is required that all reads are * performed before any writes. Transactions must be performed while online. */ e.prototype.transaction = function(t) { var e = this; this.L_(); var n = new dr; return this.cs.ws((function() { return new Wu(e.cs, e.Ku, t, n).run(), Promise.resolve(); })), n.promise; }, e; }(); /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * TransactionRunner encapsulates the logic needed to run and retry transactions * with backoff. */ function Qu(t) { /** * Returns true if obj is an object and contains at least one of the specified * methods. */ return function(t, e) { if ("object" != typeof t || null === t) return !1; for (var n = t, r = 0, i = [ "next", "error", "complete" ]; r < i.length; r++) { var o = i[r]; if (o in n && "function" == typeof n[o]) return !0; } return !1; }(t); } var Hu = /** @class */ function() { function t(t, e, n, r, i) { this.U = t, this.timestampsInSnapshots = e, this.H_ = n, this.Y_ = r, this.J_ = i; } return t.prototype.X_ = function(t) { switch (Jt(t)) { case 0 /* NullValue */ : return null; case 1 /* BooleanValue */ : return t.booleanValue; case 2 /* NumberValue */ : return se(t.integerValue || t.doubleValue); case 3 /* TimestampValue */ : return this.Z_(t.timestampValue); case 4 /* ServerTimestampValue */ : return this.tf(t); case 5 /* StringValue */ : return t.stringValue; case 6 /* BlobValue */ : return this.J_(ue(t.bytesValue)); case 7 /* RefValue */ : return this.ef(t.referenceValue); case 8 /* GeoPointValue */ : return this.nf(t.geoPointValue); case 9 /* ArrayValue */ : return this.sf(t.arrayValue); case 10 /* ObjectValue */ : return this.if(t.mapValue); default: throw y(); } }, t.prototype.if = function(t) { var e = this, n = {}; return _(t.fields || {}, (function(t, r) { n[t] = e.X_(r); })), n; }, t.prototype.nf = function(t) { return new Eu(se(t.latitude), se(t.longitude)); }, t.prototype.sf = function(t) { var e = this; return (t.values || []).map((function(t) { return e.X_(t); })); }, t.prototype.tf = function(t) { switch (this.H_) { case "previous": var e = Yt(t); return null == e ? null : this.X_(e); case "estimate": return this.Z_($t(t)); default: return null; } }, t.prototype.Z_ = function(t) { var e = oe(t), n = new ot(e.seconds, e.nanos); return this.timestampsInSnapshots ? n : n.toDate(); }, t.prototype.ef = function(t) { var e = E.g(t); g(He(e)); var n = new rt(e.get(1), e.get(3)), r = new A(e.u(5)); return n.isEqual(this.U) || // TODO(b/64130202): Somehow support foreign references. p("Document " + r + " contains a document reference within a different database (" + n.projectId + "/" + n.database + ") which is not supported. It will be treated as a reference in the current database (" + this.U.projectId + "/" + this.U.database + ") instead."), this.Y_(r); }, t; }(), Yu = ui.ho, $u = /** @class */ function() { function t(t) { var e, n, r, i, o; if (void 0 === t.host) { if (void 0 !== t.ssl) throw new c(a.INVALID_ARGUMENT, "Can't provide ssl option if host option is not set"); this.host = "firestore.googleapis.com", this.ssl = !0; } else O("settings", "non-empty string", "host", t.host), this.host = t.host, P("settings", "boolean", "ssl", t.ssl), this.ssl = null === (e = t.ssl) || void 0 === e || e; if (j("settings", t, [ "host", "ssl", "credentials", "timestampsInSnapshots", "cacheSizeBytes", "experimentalForceLongPolling", "experimentalAutoDetectLongPolling", "ignoreUndefinedProperties" ]), P("settings", "object", "credentials", t.credentials), this.credentials = t.credentials, P("settings", "boolean", "timestampsInSnapshots", t.timestampsInSnapshots), P("settings", "boolean", "ignoreUndefinedProperties", t.ignoreUndefinedProperties), // Nobody should set timestampsInSnapshots anymore, but the error depends on // whether they set it to true or false... !0 === t.timestampsInSnapshots ? p("The setting 'timestampsInSnapshots: true' is no longer required and should be removed.") : !1 === t.timestampsInSnapshots && p("Support for 'timestampsInSnapshots: false' will be removed soon. You must update your code to handle Timestamp objects."), this.timestampsInSnapshots = null === (n = t.timestampsInSnapshots) || void 0 === n || n, this.ignoreUndefinedProperties = null !== (r = t.ignoreUndefinedProperties) && void 0 !== r && r, P("settings", "number", "cacheSizeBytes", t.cacheSizeBytes), void 0 === t.cacheSizeBytes) this.cacheSizeBytes = ui._o; else { if (t.cacheSizeBytes !== Yu && t.cacheSizeBytes < ui.lo) throw new c(a.INVALID_ARGUMENT, "cacheSizeBytes must be at least " + ui.lo); this.cacheSizeBytes = t.cacheSizeBytes; } P("settings", "boolean", "experimentalForceLongPolling", t.experimentalForceLongPolling), this.experimentalForceLongPolling = null !== (i = t.experimentalForceLongPolling) && void 0 !== i && i, P("settings", "boolean", "experimentalAutoDetectLongPolling", t.experimentalAutoDetectLongPolling), this.experimentalAutoDetectLongPolling = null !== (o = t.experimentalAutoDetectLongPolling) && void 0 !== o && o, function(t, e, n, r) { if (!0 === e && !0 === r) throw new c(a.INVALID_ARGUMENT, "experimentalForceLongPolling and experimentalAutoDetectLongPolling cannot be used together."); }(0, t.experimentalForceLongPolling, 0, t.experimentalAutoDetectLongPolling); } return t.prototype.isEqual = function(t) { return this.host === t.host && this.ssl === t.ssl && this.timestampsInSnapshots === t.timestampsInSnapshots && this.credentials === t.credentials && this.cacheSizeBytes === t.cacheSizeBytes && this.experimentalForceLongPolling === t.experimentalForceLongPolling && this.experimentalAutoDetectLongPolling === t.experimentalAutoDetectLongPolling && this.ignoreUndefinedProperties === t.ignoreUndefinedProperties; }, t; }(), Xu = /** @class */ function() { // Note: We are using `MemoryComponentProvider` as a default // ComponentProvider to ensure backwards compatibility with the format // expected by the console build. function e(n, r, i, o) { var s = this; if (void 0 === i && (i = new cu), void 0 === o && (o = new fu), this.rf = i, this.af = o, this.cf = null, // Public for use in tests. // TODO(mikelehen): Use modularized initialization instead. this.uf = new xr, this.INTERNAL = { delete: function() { return t.__awaiter(s, void 0, void 0, (function() { return t.__generator(this, (function(t) { switch (t.label) { case 0: // The client must be initalized to ensure that all subsequent API usage // throws an exception. return this.hf(), [ 4 /*yield*/ , this.lf.terminate() ]; case 1: // The client must be initalized to ensure that all subsequent API usage // throws an exception. return t.sent(), [ 2 /*return*/ ]; } })); })); } }, "object" == typeof n.options) { // This is very likely a Firebase app object // TODO(b/34177605): Can we somehow use instanceof? var u = n; this.cf = u, this.__ = e._f(u), this.ff = u.name, this.df = new Oo(r); } else { var h = n; if (!h.projectId) throw new c(a.INVALID_ARGUMENT, "Must provide projectId"); this.__ = new rt(h.projectId, h.database), // Use a default persistenceKey that lines up with FirebaseApp. this.ff = "[DEFAULT]", this.df = new Ro; } this.wf = new $u({}); } return Object.defineProperty(e.prototype, "mf", { get: function() { return this.Tf || ( // Lazy initialize UserDataReader once the settings are frozen this.Tf = new ku(this.__, this.wf.ignoreUndefinedProperties)), this.Tf; }, enumerable: !1, configurable: !0 }), e.prototype.settings = function(t) { D("Firestore.settings", arguments, 1), k("Firestore.settings", "object", 1, t), t.merge && // Remove the property from the settings once the merge is completed delete (t = Object.assign(Object.assign({}, this.wf), t)).merge; var e = new $u(t); if (this.lf && !this.wf.isEqual(e)) throw new c(a.FAILED_PRECONDITION, "Firestore has already been started and its settings can no longer be changed. You can only call settings() before calling any other methods on a Firestore object."); this.wf = e, void 0 !== e.credentials && (this.df = function(t) { if (!t) return new Ro; switch (t.type) { case "gapi": var e = t.client; // Make sure this really is a Gapi client. return g(!("object" != typeof e || null === e || !e.auth || !e.auth.getAuthHeaderValueForFirstParty)), new Vo(e, t.sessionIndex || "0"); case "provider": return t.client; default: throw new c(a.INVALID_ARGUMENT, "makeCredentialsProvider failed due to invalid credential type"); } }(e.credentials)); }, e.prototype.enableNetwork = function() { return this.hf(), this.lf.enableNetwork(); }, e.prototype.disableNetwork = function() { return this.hf(), this.lf.disableNetwork(); }, e.prototype.enablePersistence = function(t) { var e, n; if (this.lf) throw new c(a.FAILED_PRECONDITION, "Firestore has already been started and persistence can no longer be enabled. You can only call enablePersistence() before calling any other methods on a Firestore object."); var r = !1, i = !1; if (t && (void 0 !== t.experimentalTabSynchronization && p("The 'experimentalTabSynchronization' setting will be removed. Use 'synchronizeTabs' instead."), r = null !== (n = null !== (e = t.synchronizeTabs) && void 0 !== e ? e : t.experimentalTabSynchronization) && void 0 !== n && n, i = !!t.experimentalForceOwningTab && t.experimentalForceOwningTab, r && i)) throw new c(a.INVALID_ARGUMENT, "The 'experimentalForceOwningTab' setting cannot be used with 'synchronizeTabs'."); return this.Ef(this.rf, this.af, { jl: !0, cacheSizeBytes: this.wf.cacheSizeBytes, synchronizeTabs: r, ka: i }); }, e.prototype.clearPersistence = function() { return t.__awaiter(this, void 0, void 0, (function() { var e, n = this; return t.__generator(this, (function(r) { if (void 0 !== this.lf && !this.lf.z_) throw new c(a.FAILED_PRECONDITION, "Persistence can only be cleared before a Firestore instance is initialized or after it is terminated."); return e = new dr, [ 2 /*return*/ , (this.uf.bs((function() { return t.__awaiter(n, void 0, void 0, (function() { var n; return t.__generator(this, (function(t) { switch (t.label) { case 0: return t.trys.push([ 0, 2, , 3 ]), [ 4 /*yield*/ , this.rf.clearPersistence(this.__, this.ff) ]; case 1: return t.sent(), e.resolve(), [ 3 /*break*/ , 3 ]; case 2: return n = t.sent(), e.reject(n), [ 3 /*break*/ , 3 ]; case 3: return [ 2 /*return*/ ]; } })); })); })), e.promise) ]; })); })); }, e.prototype.terminate = function() { return this.app._removeServiceInstance("firestore"), this.INTERNAL.delete(); }, Object.defineProperty(e.prototype, "If", { get: function() { return this.hf(), this.lf.z_; }, enumerable: !1, configurable: !0 }), e.prototype.waitForPendingWrites = function() { return this.hf(), this.lf.waitForPendingWrites(); }, e.prototype.onSnapshotsInSync = function(t) { if (this.hf(), Qu(t)) return this.lf.G_(t); k("Firestore.onSnapshotsInSync", "function", 1, t); var e = { next: t }; return this.lf.G_(e); }, e.prototype.hf = function() { return this.lf || // Kick off starting the client but don't actually wait for it. // eslint-disable-next-line @typescript-eslint/no-floating-promises this.Ef(new cu, new fu, { jl: !1 }), this.lf; }, e.prototype.Af = function() { return new nt(this.__, this.ff, this.wf.host, this.wf.ssl, this.wf.experimentalForceLongPolling, this.wf.experimentalAutoDetectLongPolling); }, e.prototype.Ef = function(t, e, n) { var r = this.Af(); return this.lf = new Ku(this.df, this.uf), this.lf.start(r, t, e, n); }, e._f = function(t) { if (e = t.options, "projectId", !Object.prototype.hasOwnProperty.call(e, "projectId")) throw new c(a.INVALID_ARGUMENT, '"projectId" not provided in firebase.initializeApp.'); var e, n = t.options.projectId; if (!n || "string" != typeof n) throw new c(a.INVALID_ARGUMENT, "projectId must be a string in FirebaseApp.options"); return new rt(n); }, Object.defineProperty(e.prototype, "app", { get: function() { if (!this.cf) throw new c(a.FAILED_PRECONDITION, "Firestore was not initialized using the Firebase SDK. 'app' is not available"); return this.cf; }, enumerable: !1, configurable: !0 }), e.prototype.collection = function(t) { return D("Firestore.collection", arguments, 1), k("Firestore.collection", "non-empty string", 1, t), this.hf(), new la(E.g(t), this, /* converter= */ null); }, e.prototype.doc = function(t) { return D("Firestore.doc", arguments, 1), k("Firestore.doc", "non-empty string", 1, t), this.hf(), ta.Rf(E.g(t), this, /* converter= */ null); }, e.prototype.collectionGroup = function(t) { if (D("Firestore.collectionGroup", arguments, 1), k("Firestore.collectionGroup", "non-empty string", 1, t), t.indexOf("/") >= 0) throw new c(a.INVALID_ARGUMENT, "Invalid collection ID '" + t + "' passed to function Firestore.collectionGroup(). Collection IDs must not contain '/'."); return this.hf(), new ha( /** * Creates a new Query for a collection group query that matches all documents * within the provided collection group. */ function(t) { return new Pn(E.P(), t); }(t), this, /* converter= */ null); }, e.prototype.runTransaction = function(t) { var e = this; return D("Firestore.runTransaction", arguments, 1), k("Firestore.runTransaction", "function", 1, t), this.hf().transaction((function(n) { return t(new Ju(e, n)); })); }, e.prototype.batch = function() { return this.hf(), new Zu(this); }, Object.defineProperty(e, "logLevel", { get: function() { switch (f()) { case n.LogLevel.DEBUG: return "debug"; case n.LogLevel.ERROR: return "error"; case n.LogLevel.SILENT: return "silent"; case n.LogLevel.WARN: return "warn"; case n.LogLevel.INFO: return "info"; case n.LogLevel.VERBOSE: return "verbose"; default: // The default log level is error return "error"; } }, enumerable: !1, configurable: !0 }), e.setLogLevel = function(t) { var e; D("Firestore.setLogLevel", arguments, 1), U("setLogLevel", [ "debug", "error", "silent", "warn", "info", "verbose" ], 1, t), e = t, h.setLogLevel(e); }, // Note: this is not a property because the minifier can't work correctly with // the way TypeScript compiler outputs properties. e.prototype.gf = function() { return this.wf.timestampsInSnapshots; }, // Visible for testing. e.prototype.Pf = function() { return this.wf; }, e; }(), Ju = /** @class */ function() { function t(t, e) { this.yf = t, this.Vf = e; } return t.prototype.get = function(t) { var e = this; D("Transaction.get", arguments, 1); var n = ya("Transaction.get", t, this.yf); return this.Vf.v_([ n.f_ ]).then((function(t) { if (!t || 1 !== t.length) return y(); var r = t[0]; if (r instanceof Rn) return new na(e.yf, n.f_, null, /* fromCache= */ !1, /* hasPendingWrites= */ !1, n.d_); if (r instanceof kn) return new na(e.yf, n.f_, r, /* fromCache= */ !1, /* hasPendingWrites= */ !1, n.d_); throw y(); })); }, t.prototype.set = function(t, e, n) { L("Transaction.set", arguments, 2, 3); var r = ya("Transaction.set", t, this.yf); n = pa("Transaction.set", n); var i = ma(r.d_, e, n), o = Ru(this.yf.mf, "Transaction.set", r.f_, i, null !== r.d_, n); return this.Vf.set(r.f_, o), this; }, t.prototype.update = function(t, e, n) { for (var r, i, o = [], s = 3; s < arguments.length; s++) o[s - 3] = arguments[s]; return "string" == typeof e || e instanceof du ? (x("Transaction.update", arguments, 3), r = ya("Transaction.update", t, this.yf), i = Pu(this.yf.mf, "Transaction.update", r.f_, e, n, o)) : (D("Transaction.update", arguments, 2), r = ya("Transaction.update", t, this.yf), i = Ou(this.yf.mf, "Transaction.update", r.f_, e)), this.Vf.update(r.f_, i), this; }, t.prototype.delete = function(t) { D("Transaction.delete", arguments, 1); var e = ya("Transaction.delete", t, this.yf); return this.Vf.delete(e.f_), this; }, t; }(), Zu = /** @class */ function() { function t(t) { this.yf = t, this.pf = [], this.bf = !1; } return t.prototype.set = function(t, e, n) { L("WriteBatch.set", arguments, 2, 3), this.vf(); var r = ya("WriteBatch.set", t, this.yf); n = pa("WriteBatch.set", n); var i = ma(r.d_, e, n), o = Ru(this.yf.mf, "WriteBatch.set", r.f_, i, null !== r.d_, n); return this.pf = this.pf.concat(o.w_(r.f_, fn.ze())), this; }, t.prototype.update = function(t, e, n) { for (var r, i, o = [], s = 3; s < arguments.length; s++) o[s - 3] = arguments[s]; return this.vf(), "string" == typeof e || e instanceof du ? (x("WriteBatch.update", arguments, 3), r = ya("WriteBatch.update", t, this.yf), i = Pu(this.yf.mf, "WriteBatch.update", r.f_, e, n, o)) : (D("WriteBatch.update", arguments, 2), r = ya("WriteBatch.update", t, this.yf), i = Ou(this.yf.mf, "WriteBatch.update", r.f_, e)), this.pf = this.pf.concat(i.w_(r.f_, fn.exists(!0))), this; }, t.prototype.delete = function(t) { D("WriteBatch.delete", arguments, 1), this.vf(); var e = ya("WriteBatch.delete", t, this.yf); return this.pf = this.pf.concat(new Nn(e.f_, fn.ze())), this; }, t.prototype.commit = function() { return this.vf(), this.bf = !0, this.pf.length > 0 ? this.yf.hf().write(this.pf) : Promise.resolve(); }, t.prototype.vf = function() { if (this.bf) throw new c(a.FAILED_PRECONDITION, "A write batch can no longer be used after commit() has been called."); }, t; }(), ta = /** @class */ function(e) { function n(t, n, r) { var i = this; return (i = e.call(this, n.__, t, r) || this).f_ = t, i.firestore = n, i.d_ = r, i.lf = i.firestore.hf(), i; } return t.__extends(n, e), n.Rf = function(t, e, r) { if (t.length % 2 != 0) throw new c(a.INVALID_ARGUMENT, "Invalid document reference. Document references must have an even number of segments, but " + t.R() + " has " + t.length); return new n(new A(t), e, r); }, Object.defineProperty(n.prototype, "id", { get: function() { return this.f_.path._(); }, enumerable: !1, configurable: !0 }), Object.defineProperty(n.prototype, "parent", { get: function() { return new la(this.f_.path.h(), this.firestore, this.d_); }, enumerable: !1, configurable: !0 }), Object.defineProperty(n.prototype, "path", { get: function() { return this.f_.path.R(); }, enumerable: !1, configurable: !0 }), n.prototype.collection = function(t) { if (D("DocumentReference.collection", arguments, 1), k("DocumentReference.collection", "non-empty string", 1, t), !t) throw new c(a.INVALID_ARGUMENT, "Must provide a non-empty collection name to collection()"); var e = E.g(t); return new la(this.f_.path.child(e), this.firestore, /* converter= */ null); }, n.prototype.isEqual = function(t) { if (!(t instanceof n)) throw G("isEqual", "DocumentReference", 1, t); return this.firestore === t.firestore && this.f_.isEqual(t.f_) && this.d_ === t.d_; }, n.prototype.set = function(t, e) { L("DocumentReference.set", arguments, 1, 2), e = pa("DocumentReference.set", e); var n = ma(this.d_, t, e), r = Ru(this.firestore.mf, "DocumentReference.set", this.f_, n, null !== this.d_, e); return this.lf.write(r.w_(this.f_, fn.ze())); }, n.prototype.update = function(t, e) { for (var n, r = [], i = 2; i < arguments.length; i++) r[i - 2] = arguments[i]; return "string" == typeof t || t instanceof du ? (x("DocumentReference.update", arguments, 2), n = Pu(this.firestore.mf, "DocumentReference.update", this.f_, t, e, r)) : (D("DocumentReference.update", arguments, 1), n = Ou(this.firestore.mf, "DocumentReference.update", this.f_, t)), this.lf.write(n.w_(this.f_, fn.exists(!0))); }, n.prototype.delete = function() { return D("DocumentReference.delete", arguments, 0), this.lf.write([ new Nn(this.f_, fn.ze()) ]); }, n.prototype.onSnapshot = function() { for (var t, e, n, r = this, i = [], o = 0; o < arguments.length; o++) i[o] = arguments[o]; L("DocumentReference.onSnapshot", arguments, 1, 4); var s = { includeMetadataChanges: !1 }, u = 0; "object" != typeof i[u] || Qu(i[u]) || (j("DocumentReference.onSnapshot", s = i[u], [ "includeMetadataChanges" ]), P("DocumentReference.onSnapshot", "boolean", "includeMetadataChanges", s.includeMetadataChanges), u++); var a = { includeMetadataChanges: s.includeMetadataChanges }; if (Qu(i[u])) { var c = i[u]; i[u] = null === (t = c.next) || void 0 === t ? void 0 : t.bind(c), i[u + 1] = null === (e = c.error) || void 0 === e ? void 0 : e.bind(c), i[u + 2] = null === (n = c.complete) || void 0 === n ? void 0 : n.bind(c); } else k("DocumentReference.onSnapshot", "function", u, i[u]), R("DocumentReference.onSnapshot", "function", u + 1, i[u + 1]), R("DocumentReference.onSnapshot", "function", u + 2, i[u + 2]); var h = { next: function(t) { i[u] && i[u](r.Sf(t)); }, error: i[u + 1], complete: i[u + 2] }; return this.lf.listen(Un(this.f_.path), a, h); }, n.prototype.get = function(t) { var e = this; L("DocumentReference.get", arguments, 0, 1), va("DocumentReference.get", t); var n = this.firestore.hf(); return t && "cache" === t.source ? n.Q_(this.f_).then((function(t) { return new na(e.firestore, e.f_, t, /*fromCache=*/ !0, t instanceof kn && t.Je, e.d_); })) : n.W_(this.f_, t).then((function(t) { return e.Sf(t); })); }, n.prototype.withConverter = function(t) { return new n(this.f_, this.firestore, t); }, /** * Converts a ViewSnapshot that contains the current document to a * DocumentSnapshot. */ n.prototype.Sf = function(t) { var e = t.docs.get(this.f_); return new na(this.firestore, this.f_, e, t.fromCache, t.hasPendingWrites, this.d_); }, n; }(Au), ea = /** @class */ function() { function t(t, e) { this.hasPendingWrites = t, this.fromCache = e /** * Returns true if this `SnapshotMetadata` is equal to the provided one. * * @param other The `SnapshotMetadata` to compare against. * @return true if this `SnapshotMetadata` is equal to the provided one. */; } return t.prototype.isEqual = function(t) { return this.hasPendingWrites === t.hasPendingWrites && this.fromCache === t.fromCache; }, t; }(), na = /** @class */ function() { function t(t, e, n, r, i, o) { this.yf = t, this.f_ = e, this.Df = n, this.Cf = r, this.Nf = i, this.d_ = o; } return t.prototype.data = function(t) { var e = this; if (L("DocumentSnapshot.data", arguments, 0, 1), t = da("DocumentSnapshot.data", t), this.Df) { // We only want to use the converter and create a new DocumentSnapshot // if a converter has been provided. if (this.d_) { var n = new ra(this.yf, this.f_, this.Df, this.Cf, this.Nf, /* converter= */ null); return this.d_.fromFirestore(n, t); } return new Hu(this.yf.__, this.yf.gf(), t.serverTimestamps || "none", (function(t) { return new ta(t, e.yf, /* converter= */ null); }), (function(t) { return new et(t); })).X_(this.Df.rn()); } }, t.prototype.get = function(t, e) { var n = this; if (L("DocumentSnapshot.get", arguments, 1, 2), e = da("DocumentSnapshot.get", e), this.Df) { var r = this.Df.data().field(qu("DocumentSnapshot.get", t, this.f_)); if (null !== r) return new Hu(this.yf.__, this.yf.gf(), e.serverTimestamps || "none", (function(t) { return new ta(t, n.yf, n.d_); }), (function(t) { return new et(t); })).X_(r); } }, Object.defineProperty(t.prototype, "id", { get: function() { return this.f_.path._(); }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "ref", { get: function() { return new ta(this.f_, this.yf, this.d_); }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "exists", { get: function() { return null !== this.Df; }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "metadata", { get: function() { return new ea(this.Nf, this.Cf); }, enumerable: !1, configurable: !0 }), t.prototype.isEqual = function(e) { if (!(e instanceof t)) throw G("isEqual", "DocumentSnapshot", 1, e); return this.yf === e.yf && this.Cf === e.Cf && this.f_.isEqual(e.f_) && (null === this.Df ? null === e.Df : this.Df.isEqual(e.Df)) && this.d_ === e.d_; }, t; }(), ra = /** @class */ function(e) { function n() { return null !== e && e.apply(this, arguments) || this; } return t.__extends(n, e), n.prototype.data = function(t) { return e.prototype.data.call(this, t); }, n; }(na); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // settings() defaults: function ia(t, e, n, r, i, o, s) { var u; if (i.p()) { if ("array-contains" /* ARRAY_CONTAINS */ === o || "array-contains-any" /* ARRAY_CONTAINS_ANY */ === o) throw new c(a.INVALID_ARGUMENT, "Invalid Query. You can't perform '" + o + "' queries on FieldPath.documentId()."); if ("in" /* IN */ === o || "not-in" /* NOT_IN */ === o) { ua(s, o); for (var h = [], f = 0, l = s; f < l.length; f++) { var p = l[f]; h.push(sa(r, t, p)); } u = { arrayValue: { values: h } }; } else u = sa(r, t, s); } else "in" /* IN */ !== o && "not-in" /* NOT_IN */ !== o && "array-contains-any" /* ARRAY_CONTAINS_ANY */ !== o || ua(s, o), u = Vu(n, e, s, /* allowArrays= */ "in" /* IN */ === o || "not-in" /* NOT_IN */ === o); var d = Jn.create(i, o, u); return function(t, e) { if (e.hn()) { var n = qn(t); if (null !== n && !n.isEqual(e.field)) throw new c(a.INVALID_ARGUMENT, "Invalid query. All where filters with an inequality (<, <=, >, or >=) must be on the same field. But you have inequality filters on '" + n.toString() + "' and '" + e.field.toString() + "'"); var r = Mn(t); null !== r && aa(t, e.field, r); } var i = function(t, e) { for (var n = 0, r = t.filters; n < r.length; n++) { var i = r[n]; if (e.indexOf(i.op) >= 0) return i.op; } return null; }(t, /** * Given an operator, returns the set of operators that cannot be used with it. * * Operators in a query must adhere to the following set of rules: * 1. Only one array operator is allowed. * 2. Only one disjunctive operator is allowed. * 3. NOT_EQUAL cannot be used with another NOT_EQUAL operator. * 4. NOT_IN cannot be used with array, disjunctive, or NOT_EQUAL operators. * * Array operators: ARRAY_CONTAINS, ARRAY_CONTAINS_ANY * Disjunctive operators: IN, ARRAY_CONTAINS_ANY, NOT_IN */ function(t) { switch (t) { case "!=" /* NOT_EQUAL */ : return [ "!=" /* NOT_EQUAL */ , "not-in" /* NOT_IN */ ]; case "array-contains" /* ARRAY_CONTAINS */ : return [ "array-contains" /* ARRAY_CONTAINS */ , "array-contains-any" /* ARRAY_CONTAINS_ANY */ , "not-in" /* NOT_IN */ ]; case "in" /* IN */ : return [ "array-contains-any" /* ARRAY_CONTAINS_ANY */ , "in" /* IN */ , "not-in" /* NOT_IN */ ]; case "array-contains-any" /* ARRAY_CONTAINS_ANY */ : return [ "array-contains" /* ARRAY_CONTAINS */ , "array-contains-any" /* ARRAY_CONTAINS_ANY */ , "in" /* IN */ , "not-in" /* NOT_IN */ ]; case "not-in" /* NOT_IN */ : return [ "array-contains" /* ARRAY_CONTAINS */ , "array-contains-any" /* ARRAY_CONTAINS_ANY */ , "in" /* IN */ , "not-in" /* NOT_IN */ , "!=" /* NOT_EQUAL */ ]; default: return []; } }(e.op)); if (null !== i) // Special case when it's a duplicate op to give a slightly clearer error message. throw i === e.op ? new c(a.INVALID_ARGUMENT, "Invalid query. You cannot use more than one '" + e.op.toString() + "' filter.") : new c(a.INVALID_ARGUMENT, "Invalid query. You cannot use '" + e.op.toString() + "' filters with '" + i.toString() + "' filters."); }(t, d), d; } function oa(t, e, n) { if (null !== t.startAt) throw new c(a.INVALID_ARGUMENT, "Invalid query. You must not call startAt() or startAfter() before calling orderBy()."); if (null !== t.endAt) throw new c(a.INVALID_ARGUMENT, "Invalid query. You must not call endAt() or endBefore() before calling orderBy()."); var r = new fr(e, n); return function(t, e) { if (null === Mn(t)) { // This is the first order by. It must match any inequality. var n = qn(t); null !== n && aa(t, n, e.field); } }(t, r), r /** * Create a Bound from a query and a document. * * Note that the Bound will always include the key of the document * and so only the provided document will compare equal to the returned * position. * * Will throw if the document does not contain all fields of the order by * of the query or if any of the fields in the order by are an uncommitted * server timestamp. */ /** * Parses the given documentIdValue into a ReferenceValue, throwing * appropriate errors if the value is anything other than a DocumentReference * or String, or if the string is malformed. */; } function sa(t, e, n) { if ("string" == typeof n) { if ("" === n) throw new c(a.INVALID_ARGUMENT, "Invalid query. When querying with FieldPath.documentId(), you must provide a valid document ID, but it was an empty string."); if (!jn(e) && -1 !== n.indexOf("/")) throw new c(a.INVALID_ARGUMENT, "Invalid query. When querying a collection by FieldPath.documentId(), you must provide a plain document ID, but '" + n + "' contains a '/' character."); var r = e.path.child(E.g(n)); if (!A.F(r)) throw new c(a.INVALID_ARGUMENT, "Invalid query. When querying a collection group by FieldPath.documentId(), the value provided must result in a valid document path, but '" + r + "' is not because it has an odd number of segments (" + r.length + ")."); return ae(t, new A(r)); } if (n instanceof Au) return ae(t, n.f_); throw new c(a.INVALID_ARGUMENT, "Invalid query. When querying with FieldPath.documentId(), you must provide a valid string or a DocumentReference, but it was: " + M(n) + "."); } /** * Validates that the value passed into a disjunctive filter satisfies all * array requirements. */ function ua(t, e) { if (!Array.isArray(t) || 0 === t.length) throw new c(a.INVALID_ARGUMENT, "Invalid Query. A non-empty array is required for '" + e.toString() + "' filters."); if (t.length > 10) throw new c(a.INVALID_ARGUMENT, "Invalid Query. '" + e.toString() + "' filters support a maximum of 10 elements in the value array."); if ("in" /* IN */ === e || "array-contains-any" /* ARRAY_CONTAINS_ANY */ === e) { if (t.indexOf(null) >= 0) throw new c(a.INVALID_ARGUMENT, "Invalid Query. '" + e.toString() + "' filters cannot contain 'null' in the value array."); if (t.filter((function(t) { return Number.isNaN(t); })).length > 0) throw new c(a.INVALID_ARGUMENT, "Invalid Query. '" + e.toString() + "' filters cannot contain 'NaN' in the value array."); } } function aa(t, e, n) { if (!n.isEqual(e)) throw new c(a.INVALID_ARGUMENT, "Invalid query. You have a where filter with an inequality (<, <=, >, or >=) on field '" + e.toString() + "' and so you must also use '" + e.toString() + "' as your first orderBy(), but your first orderBy() is on field '" + n.toString() + "' instead."); } function ca(t) { if (Fn(t) && 0 === t.on.length) throw new c(a.UNIMPLEMENTED, "limitToLast() queries require specifying at least one orderBy() clause"); } var ha = /** @class */ function() { function e(t, e, n) { this.Ff = t, this.firestore = e, this.d_ = n; } return e.prototype.where = function(t, n, r) { D("Query.where", arguments, 3), q("Query.where", 3, r); // Enumerated from the WhereFilterOp type in index.d.ts. var i = U("Query.where", [ "<" /* LESS_THAN */ , "<=" /* LESS_THAN_OR_EQUAL */ , "==" /* EQUAL */ , "!=" /* NOT_EQUAL */ , ">=" /* GREATER_THAN_OR_EQUAL */ , ">" /* GREATER_THAN */ , "array-contains" /* ARRAY_CONTAINS */ , "in" /* IN */ , "array-contains-any" /* ARRAY_CONTAINS_ANY */ , "not-in" /* NOT_IN */ ], 2, n), o = qu("Query.where", t), s = ia(this.Ff, "Query.where", this.firestore.mf, this.firestore.__, o, i, r); return new e(function(t, e) { var n = t.filters.concat([ e ]); return new Pn(t.path, t.collectionGroup, t.on.slice(), n, t.limit, t.an, t.startAt, t.endAt); }(this.Ff, s), this.firestore, this.d_); }, e.prototype.orderBy = function(t, n) { var r; if (L("Query.orderBy", arguments, 1, 2), R("Query.orderBy", "non-empty string", 2, n), void 0 === n || "asc" === n) r = "asc" /* ASCENDING */; else { if ("desc" !== n) throw new c(a.INVALID_ARGUMENT, "Function Query.orderBy() has unknown direction '" + n + "', expected 'asc' or 'desc'."); r = "desc" /* DESCENDING */; } var i = qu("Query.orderBy", t), o = oa(this.Ff, i, r); return new e(function(t, e) { // TODO(dimond): validate that orderBy does not list the same key twice. var n = t.on.concat([ e ]); return new Pn(t.path, t.collectionGroup, n, t.filters.slice(), t.limit, t.an, t.startAt, t.endAt); }(this.Ff, o), this.firestore, this.d_); }, e.prototype.limit = function(t) { return D("Query.limit", arguments, 1), k("Query.limit", "number", 1, t), z("Query.limit", 1, t), new e(Bn(this.Ff, t, "F" /* First */), this.firestore, this.d_); }, e.prototype.limitToLast = function(t) { return D("Query.limitToLast", arguments, 1), k("Query.limitToLast", "number", 1, t), z("Query.limitToLast", 1, t), new e(Bn(this.Ff, t, "L" /* Last */), this.firestore, this.d_); }, e.prototype.startAt = function(t) { for (var n = [], r = 1; r < arguments.length; r++) n[r - 1] = arguments[r]; x("Query.startAt", arguments, 1); var i = this.xf("Query.startAt", t, n, /*before=*/ !0); return new e(Wn(this.Ff, i), this.firestore, this.d_); }, e.prototype.startAfter = function(t) { for (var n = [], r = 1; r < arguments.length; r++) n[r - 1] = arguments[r]; x("Query.startAfter", arguments, 1); var i = this.xf("Query.startAfter", t, n, /*before=*/ !1); return new e(Wn(this.Ff, i), this.firestore, this.d_); }, e.prototype.endBefore = function(t) { for (var n = [], r = 1; r < arguments.length; r++) n[r - 1] = arguments[r]; x("Query.endBefore", arguments, 1); var i = this.xf("Query.endBefore", t, n, /*before=*/ !0); return new e(Kn(this.Ff, i), this.firestore, this.d_); }, e.prototype.endAt = function(t) { for (var n = [], r = 1; r < arguments.length; r++) n[r - 1] = arguments[r]; x("Query.endAt", arguments, 1); var i = this.xf("Query.endAt", t, n, /*before=*/ !1); return new e(Kn(this.Ff, i), this.firestore, this.d_); }, e.prototype.isEqual = function(t) { if (!(t instanceof e)) throw G("isEqual", "Query", 1, t); return this.firestore === t.firestore && Qn(this.Ff, t.Ff) && this.d_ === t.d_; }, e.prototype.withConverter = function(t) { return new e(this.Ff, this.firestore, t); }, /** Helper function to create a bound from a document or fields */ e.prototype.xf = function(e, n, r, i) { if (q(e, 1, n), n instanceof na) return D(e, t.__spreadArrays([ n ], r), 1), function(t, e, n, r, i) { if (!r) throw new c(a.NOT_FOUND, "Can't use a DocumentSnapshot that doesn't exist for " + n + "()."); // Because people expect to continue/end a query at the exact document // provided, we need to use the implicit sort order rather than the explicit // sort order, because it's guaranteed to contain the document key. That way // the position becomes unambiguous and the query continues/ends exactly at // the provided document. Without the key (by using the explicit sort // orders), multiple documents could match the position, yielding duplicate // results. for (var o = [], s = 0, u = Gn(t); s < u.length; s++) { var h = u[s]; if (h.field.p()) o.push(ae(e, r.key)); else { var f = r.field(h.field); if (Ht(f)) throw new c(a.INVALID_ARGUMENT, 'Invalid query. You are trying to start or end a query using a document for which the field "' + h.field + '" is an uncommitted server timestamp. (Since the value of this field is unknown, you cannot start/end a query with it.)'); if (null === f) { var l = h.field.R(); throw new c(a.INVALID_ARGUMENT, "Invalid query. You are trying to start or end a query using a document for which the field '" + l + "' (used as the orderBy) does not exist."); } o.push(f); } } return new ur(o, i); }(this.Ff, this.firestore.__, e, n.Df, i); var o = [ n ].concat(r); return function(t, e, n, r, i, o) { // Use explicit order by's because it has to match the query the user made var s = t.on; if (i.length > s.length) throw new c(a.INVALID_ARGUMENT, "Too many arguments provided to " + r + "(). The number of arguments must be less than or equal to the number of orderBy() clauses"); for (var u = [], h = 0; h < i.length; h++) { var f = i[h]; if (s[h].field.p()) { if ("string" != typeof f) throw new c(a.INVALID_ARGUMENT, "Invalid query. Expected a string for document ID in " + r + "(), but got a " + typeof f); if (!jn(t) && -1 !== f.indexOf("/")) throw new c(a.INVALID_ARGUMENT, "Invalid query. When querying a collection and ordering by FieldPath.documentId(), the value passed to " + r + "() must be a plain document ID, but '" + f + "' contains a slash."); var l = t.path.child(E.g(f)); if (!A.F(l)) throw new c(a.INVALID_ARGUMENT, "Invalid query. When querying a collection group and ordering by FieldPath.documentId(), the value passed to " + r + "() must result in a valid document path, but '" + l + "' is not because it contains an odd number of segments."); var p = new A(l); u.push(ae(e, p)); } else { var d = Vu(n, r, f); u.push(d); } } return new ur(u, o); }(this.Ff, this.firestore.__, this.firestore.mf, e, o, i); }, e.prototype.onSnapshot = function() { for (var t, e, n, r = this, i = [], o = 0; o < arguments.length; o++) i[o] = arguments[o]; L("Query.onSnapshot", arguments, 1, 4); var s = {}, u = 0; if ("object" != typeof i[u] || Qu(i[u]) || (j("Query.onSnapshot", s = i[u], [ "includeMetadataChanges" ]), P("Query.onSnapshot", "boolean", "includeMetadataChanges", s.includeMetadataChanges), u++), Qu(i[u])) { var a = i[u]; i[u] = null === (t = a.next) || void 0 === t ? void 0 : t.bind(a), i[u + 1] = null === (e = a.error) || void 0 === e ? void 0 : e.bind(a), i[u + 2] = null === (n = a.complete) || void 0 === n ? void 0 : n.bind(a); } else k("Query.onSnapshot", "function", u, i[u]), R("Query.onSnapshot", "function", u + 1, i[u + 1]), R("Query.onSnapshot", "function", u + 2, i[u + 2]); var c = { next: function(t) { i[u] && i[u](new fa(r.firestore, r.Ff, t, r.d_)); }, error: i[u + 1], complete: i[u + 2] }; return ca(this.Ff), this.firestore.hf().listen(this.Ff, s, c); }, e.prototype.get = function(t) { var e = this; L("Query.get", arguments, 0, 1), va("Query.get", t), ca(this.Ff); var n = this.firestore.hf(); return (t && "cache" === t.source ? n.j_(this.Ff) : n.K_(this.Ff, t)).then((function(t) { return new fa(e.firestore, e.Ff, t, e.d_); })); }, e; }(), fa = /** @class */ function() { function t(t, e, n, r) { this.yf = t, this.$f = e, this.kf = n, this.d_ = r, this.Mf = null, this.Of = null, this.metadata = new ea(n.hasPendingWrites, n.fromCache); } return Object.defineProperty(t.prototype, "docs", { get: function() { var t = []; return this.forEach((function(e) { return t.push(e); })), t; }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "empty", { get: function() { return this.kf.docs.m(); }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "size", { get: function() { return this.kf.docs.size; }, enumerable: !1, configurable: !0 }), t.prototype.forEach = function(t, e) { var n = this; L("QuerySnapshot.forEach", arguments, 1, 2), k("QuerySnapshot.forEach", "function", 1, t), this.kf.docs.forEach((function(r) { t.call(e, n.Lf(r, n.metadata.fromCache, n.kf.Wt.has(r.key))); })); }, Object.defineProperty(t.prototype, "query", { get: function() { return new ha(this.$f, this.yf, this.d_); }, enumerable: !1, configurable: !0 }), t.prototype.docChanges = function(t) { t && (j("QuerySnapshot.docChanges", t, [ "includeMetadataChanges" ]), P("QuerySnapshot.docChanges", "boolean", "includeMetadataChanges", t.includeMetadataChanges)); var e = !(!t || !t.includeMetadataChanges); if (e && this.kf.Kt) throw new c(a.INVALID_ARGUMENT, "To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot()."); return this.Mf && this.Of === e || (this.Mf = /** * Calculates the array of DocumentChanges for a given ViewSnapshot. * * Exported for testing. * * @param snapshot The ViewSnapshot that represents the expected state. * @param includeMetadataChanges Whether to include metadata changes. * @param converter A factory function that returns a QueryDocumentSnapshot. * @return An object that matches the DocumentChange API. */ function(t, e, n) { if (t.Qt.m()) { // Special case the first snapshot because index calculation is easy and // fast var r = 0; return t.docChanges.map((function(e) { var i = n(e.doc, t.fromCache, t.Wt.has(e.doc.key)); return e.doc, { type: "added", doc: i, oldIndex: -1, newIndex: r++ }; })); } // A DocumentSet that is updated incrementally as changes are applied to use // to lookup the index of a document. var i = t.Qt; return t.docChanges.filter((function(t) { return e || 3 /* Metadata */ !== t.type; })).map((function(e) { var r = n(e.doc, t.fromCache, t.Wt.has(e.doc.key)), o = -1, s = -1; return 0 /* Added */ !== e.type && (o = i.indexOf(e.doc.key), i = i.delete(e.doc.key)), 1 /* Removed */ !== e.type && (s = (i = i.add(e.doc)).indexOf(e.doc.key)), { type: ga(e.type), doc: r, oldIndex: o, newIndex: s }; })); }(this.kf, e, this.Lf.bind(this)), this.Of = e), this.Mf; }, /** Check the equality. The call can be very expensive. */ t.prototype.isEqual = function(e) { if (!(e instanceof t)) throw G("isEqual", "QuerySnapshot", 1, e); return this.yf === e.yf && Qn(this.$f, e.$f) && this.kf.isEqual(e.kf) && this.d_ === e.d_; }, t.prototype.Lf = function(t, e, n) { return new ra(this.yf, t.key, t, e, n, this.d_); }, t; }(), la = /** @class */ function(e) { function n(t, n, r) { var i = this; if ((i = e.call(this, Un(t), n, r) || this).Bf = t, t.length % 2 != 1) throw new c(a.INVALID_ARGUMENT, "Invalid collection reference. Collection references must have an odd number of segments, but " + t.R() + " has " + t.length); return i; } return t.__extends(n, e), Object.defineProperty(n.prototype, "id", { get: function() { return this.Ff.path._(); }, enumerable: !1, configurable: !0 }), Object.defineProperty(n.prototype, "parent", { get: function() { var t = this.Ff.path.h(); return t.m() ? null : new ta(new A(t), this.firestore, /* converter= */ null); }, enumerable: !1, configurable: !0 }), Object.defineProperty(n.prototype, "path", { get: function() { return this.Ff.path.R(); }, enumerable: !1, configurable: !0 }), n.prototype.doc = function(t) { L("CollectionReference.doc", arguments, 0, 1), // We allow omission of 'pathString' but explicitly prohibit passing in both // 'undefined' and 'null'. 0 === arguments.length && (t = Q.k()), k("CollectionReference.doc", "non-empty string", 1, t); var e = E.g(t); return ta.Rf(this.Ff.path.child(e), this.firestore, this.d_); }, n.prototype.add = function(t) { D("CollectionReference.add", arguments, 1); var e = this.d_ ? this.d_.toFirestore(t) : t; k("CollectionReference.add", "object", 1, e); var n = this.doc(); // Call set() with the converted value directly to avoid calling toFirestore() a second time. return new ta(n.f_, this.firestore, null).set(e).then((function() { return n; })); }, n.prototype.withConverter = function(t) { return new n(this.Bf, this.firestore, t); }, n; }(ha); function pa(t, e) { if (void 0 === e) return { merge: !1 }; if (j(t, e, [ "merge", "mergeFields" ]), P(t, "boolean", "merge", e.merge), function(t, e, n, r, i) { void 0 !== r && function(t, e, n, r, i) { if (!(r instanceof Array)) throw new c(a.INVALID_ARGUMENT, "Function " + t + "() requires its " + e + " option to be an array, but it was: " + M(r)); for (var o = 0; o < r.length; ++o) if (!i(r[o])) throw new c(a.INVALID_ARGUMENT, "Function " + t + "() requires all " + e + " elements to be " + n + ", but the value at index " + o + " was: " + M(r[o])); }(t, e, n, r, i); }(t, "mergeFields", "a string or a FieldPath", e.mergeFields, (function(t) { return "string" == typeof t || t instanceof du; })), void 0 !== e.mergeFields && void 0 !== e.merge) throw new c(a.INVALID_ARGUMENT, "Invalid options passed to function " + t + '(): You cannot specify both "merge" and "mergeFields".'); return e; } function da(t, e) { return void 0 === e ? {} : (j(t, e, [ "serverTimestamps" ]), V(t, 0, "serverTimestamps", e.serverTimestamps, [ "estimate", "previous", "none" ]), e); } function va(t, e) { R(t, "object", 1, e), e && (j(t, e, [ "source" ]), V(t, 0, "source", e.source, [ "default", "server", "cache" ])); } function ya(t, e, n) { if (e instanceof Au) { if (e.firestore !== n) throw new c(a.INVALID_ARGUMENT, "Provided document reference is from a different Firestore instance."); return e; } throw G(t, "DocumentReference", 1, e); } function ga(t) { switch (t) { case 0 /* Added */ : return "added"; case 2 /* Modified */ : case 3 /* Metadata */ : return "modified"; case 1 /* Removed */ : return "removed"; default: return y(); } } /** * Converts custom model object of type T into DocumentData by applying the * converter if it exists. * * This function is used when converting user objects to DocumentData * because we want to provide the user with a more specific error message if * their set() or fails due to invalid data originating from a toFirestore() * call. */ function ma(t, e, n) { // Cast to `any` in order to satisfy the union type constraint on // toFirestore(). // eslint-disable-next-line @typescript-eslint/no-explicit-any return t ? n && (n.merge || n.mergeFields) ? t.toFirestore(e, n) : t.toFirestore(e) : e; } /** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var wa = /** @class */ function(e) { function n() { return null !== e && e.apply(this, arguments) || this; } return t.__extends(n, e), n.serverTimestamp = function() { S("FieldValue.serverTimestamp", arguments); var t = new wu("serverTimestamp"); return t.e_ = "FieldValue.serverTimestamp", new n(t); }, n.delete = function() { S("FieldValue.delete", arguments); var t = new gu("deleteField"); return t.e_ = "FieldValue.delete", new n(t); }, n.arrayUnion = function() { for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e]; x("FieldValue.arrayUnion", arguments, 1); var r = /** * Returns a special value that can be used with {@link setDoc()} or {@link * updateDoc()} that tells the server to union the given elements with any array * value that already exists on the server. Each specified element that doesn't * already exist in the array will be added to the end. If the field being * modified is not already an array it will be overwritten with an array * containing exactly the specified elements. * * @param elements The elements to union into the array. * @return The `FieldValue` sentinel for use in a call to `setDoc()` or * `updateDoc()`. */ function() { for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e]; // NOTE: We don't actually parse the data until it's used in set() or // update() since we'd need the Firestore instance to do this. return x("arrayUnion()", arguments, 1), new _u("arrayUnion", t); }.apply(void 0, t); return r.e_ = "FieldValue.arrayUnion", new n(r); }, n.arrayRemove = function() { for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e]; x("FieldValue.arrayRemove", arguments, 1); var r = function() { for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e]; // NOTE: We don't actually parse the data until it's used in set() or // update() since we'd need the Firestore instance to do this. return x("arrayRemove()", arguments, 1), new bu("arrayRemove", t); }.apply(void 0, t); return r.e_ = "FieldValue.arrayRemove", new n(r); }, n.increment = function(t) { k("FieldValue.increment", "number", 1, t), D("FieldValue.increment", arguments, 1); var e = function(t) { return new Iu("increment", t); }(t); return e.e_ = "FieldValue.increment", new n(e); }, n.prototype.isEqual = function(t) { return this.l_.isEqual(t.l_); }, n; }(Tu), _a = { Firestore: Xu, GeoPoint: Eu, Timestamp: ot, Blob: et, Transaction: Ju, WriteBatch: Zu, DocumentReference: ta, DocumentSnapshot: na, Query: ha, QueryDocumentSnapshot: ra, QuerySnapshot: fa, CollectionReference: la, FieldPath: du, FieldValue: wa, setLogLevel: Xu.setLogLevel, CACHE_SIZE_UNLIMITED: Yu }; /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Configures Firestore as part of the Firebase SDK by calling registerService. * * @param firebase The FirebaseNamespace to register Firestore with * @param firestoreFactory A factory function that returns a new Firestore * instance. */ /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Registers the main Firestore build with the components framework. * Persistence can be enabled via `firebase.firestore().enablePersistence()`. */ function ba(t) { !function(t, e) { t.INTERNAL.registerComponent(new o.Component("firestore", (function(t) { return function(t, e) { var n = new fu, r = new hu(n); return new Xu(t, e, r, n); }(t.getProvider("app").getImmediate(), t.getProvider("auth-internal")); }), "PUBLIC" /* PUBLIC */).setServiceProps(Object.assign({}, _a))); }(t), t.registerVersion("@firebase/firestore", "1.18.0"); } ba(u.default), exports.__PRIVATE_registerFirestore = ba; //# sourceMappingURL=index.cjs.js.map /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__("./node_modules/process/browser.js"))) /***/ }), /***/ "./node_modules/@firebase/firestore/node_modules/@firebase/component/dist/index.cjs.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, '__esModule', { value: true }); var tslib = __webpack_require__("./node_modules/@firebase/firestore/node_modules/tslib/tslib.es6.js"); var util = __webpack_require__("./node_modules/@firebase/firestore/node_modules/@firebase/util/dist/index.cjs.js"); /** * Component for service name T, e.g. `auth`, `auth-internal` */ var Component = /** @class */ (function () { /** * * @param name The public service name, e.g. app, auth, firestore, database * @param instanceFactory Service factory responsible for creating the public interface * @param type whether the service provided by the component is public or private */ function Component(name, instanceFactory, type) { this.name = name; this.instanceFactory = instanceFactory; this.type = type; this.multipleInstances = false; /** * Properties to be added to the service namespace */ this.serviceProps = {}; this.instantiationMode = "LAZY" /* LAZY */; } Component.prototype.setInstantiationMode = function (mode) { this.instantiationMode = mode; return this; }; Component.prototype.setMultipleInstances = function (multipleInstances) { this.multipleInstances = multipleInstances; return this; }; Component.prototype.setServiceProps = function (props) { this.serviceProps = props; return this; }; return Component; }()); /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var DEFAULT_ENTRY_NAME = '[DEFAULT]'; /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Provider for instance for service name T, e.g. 'auth', 'auth-internal' * NameServiceMapping[T] is an alias for the type of the instance */ var Provider = /** @class */ (function () { function Provider(name, container) { this.name = name; this.container = container; this.component = null; this.instances = new Map(); this.instancesDeferred = new Map(); } /** * @param identifier A provider can provide mulitple instances of a service * if this.component.multipleInstances is true. */ Provider.prototype.get = function (identifier) { if (identifier === void 0) { identifier = DEFAULT_ENTRY_NAME; } // if multipleInstances is not supported, use the default name var normalizedIdentifier = this.normalizeInstanceIdentifier(identifier); if (!this.instancesDeferred.has(normalizedIdentifier)) { var deferred = new util.Deferred(); this.instancesDeferred.set(normalizedIdentifier, deferred); // If the service instance is available, resolve the promise with it immediately try { var instance = this.getOrInitializeService(normalizedIdentifier); if (instance) { deferred.resolve(instance); } } catch (e) { // when the instance factory throws an exception during get(), it should not cause // a fatal error. We just return the unresolved promise in this case. } } return this.instancesDeferred.get(normalizedIdentifier).promise; }; Provider.prototype.getImmediate = function (options) { var _a = tslib.__assign({ identifier: DEFAULT_ENTRY_NAME, optional: false }, options), identifier = _a.identifier, optional = _a.optional; // if multipleInstances is not supported, use the default name var normalizedIdentifier = this.normalizeInstanceIdentifier(identifier); try { var instance = this.getOrInitializeService(normalizedIdentifier); if (!instance) { if (optional) { return null; } throw Error("Service " + this.name + " is not available"); } return instance; } catch (e) { if (optional) { return null; } else { throw e; } } }; Provider.prototype.getComponent = function () { return this.component; }; Provider.prototype.setComponent = function (component) { var e_1, _a; if (component.name !== this.name) { throw Error("Mismatching Component " + component.name + " for Provider " + this.name + "."); } if (this.component) { throw Error("Component for " + this.name + " has already been provided"); } this.component = component; // if the service is eager, initialize the default instance if (isComponentEager(component)) { try { this.getOrInitializeService(DEFAULT_ENTRY_NAME); } catch (e) { // when the instance factory for an eager Component throws an exception during the eager // initialization, it should not cause a fatal error. // TODO: Investigate if we need to make it configurable, because some component may want to cause // a fatal error in this case? } } try { // Create service instances for the pending promises and resolve them // NOTE: if this.multipleInstances is false, only the default instance will be created // and all promises with resolve with it regardless of the identifier. for (var _b = tslib.__values(this.instancesDeferred.entries()), _c = _b.next(); !_c.done; _c = _b.next()) { var _d = tslib.__read(_c.value, 2), instanceIdentifier = _d[0], instanceDeferred = _d[1]; var normalizedIdentifier = this.normalizeInstanceIdentifier(instanceIdentifier); try { // `getOrInitializeService()` should always return a valid instance since a component is guaranteed. use ! to make typescript happy. var instance = this.getOrInitializeService(normalizedIdentifier); instanceDeferred.resolve(instance); } catch (e) { // when the instance factory throws an exception, it should not cause // a fatal error. We just leave the promise unresolved. } } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (_c && !_c.done && (_a = _b.return)) _a.call(_b); } finally { if (e_1) throw e_1.error; } } }; Provider.prototype.clearInstance = function (identifier) { if (identifier === void 0) { identifier = DEFAULT_ENTRY_NAME; } this.instancesDeferred.delete(identifier); this.instances.delete(identifier); }; // app.delete() will call this method on every provider to delete the services // TODO: should we mark the provider as deleted? Provider.prototype.delete = function () { return tslib.__awaiter(this, void 0, void 0, function () { var services; return tslib.__generator(this, function (_a) { switch (_a.label) { case 0: services = Array.from(this.instances.values()); return [4 /*yield*/, Promise.all(tslib.__spread(services .filter(function (service) { return 'INTERNAL' in service; }) // legacy services // eslint-disable-next-line @typescript-eslint/no-explicit-any .map(function (service) { return service.INTERNAL.delete(); }), services .filter(function (service) { return '_delete' in service; }) // modularized services // eslint-disable-next-line @typescript-eslint/no-explicit-any .map(function (service) { return service._delete(); })))]; case 1: _a.sent(); return [2 /*return*/]; } }); }); }; Provider.prototype.isComponentSet = function () { return this.component != null; }; Provider.prototype.getOrInitializeService = function (identifier) { var instance = this.instances.get(identifier); if (!instance && this.component) { instance = this.component.instanceFactory(this.container, normalizeIdentifierForFactory(identifier)); this.instances.set(identifier, instance); } return instance || null; }; Provider.prototype.normalizeInstanceIdentifier = function (identifier) { if (this.component) { return this.component.multipleInstances ? identifier : DEFAULT_ENTRY_NAME; } else { return identifier; // assume multiple instances are supported before the component is provided. } }; return Provider; }()); // undefined should be passed to the service factory for the default instance function normalizeIdentifierForFactory(identifier) { return identifier === DEFAULT_ENTRY_NAME ? undefined : identifier; } function isComponentEager(component) { return component.instantiationMode === "EAGER" /* EAGER */; } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * ComponentContainer that provides Providers for service name T, e.g. `auth`, `auth-internal` */ var ComponentContainer = /** @class */ (function () { function ComponentContainer(name) { this.name = name; this.providers = new Map(); } /** * * @param component Component being added * @param overwrite When a component with the same name has already been registered, * if overwrite is true: overwrite the existing component with the new component and create a new * provider with the new component. It can be useful in tests where you want to use different mocks * for different tests. * if overwrite is false: throw an exception */ ComponentContainer.prototype.addComponent = function (component) { var provider = this.getProvider(component.name); if (provider.isComponentSet()) { throw new Error("Component " + component.name + " has already been registered with " + this.name); } provider.setComponent(component); }; ComponentContainer.prototype.addOrOverwriteComponent = function (component) { var provider = this.getProvider(component.name); if (provider.isComponentSet()) { // delete the existing provider from the container, so we can register the new component this.providers.delete(component.name); } this.addComponent(component); }; /** * getProvider provides a type safe interface where it can only be called with a field name * present in NameServiceMapping interface. * * Firebase SDKs providing services should extend NameServiceMapping interface to register * themselves. */ ComponentContainer.prototype.getProvider = function (name) { if (this.providers.has(name)) { return this.providers.get(name); } // create a Provider for a service that hasn't registered with Firebase var provider = new Provider(name, this); this.providers.set(name, provider); return provider; }; ComponentContainer.prototype.getProviders = function () { return Array.from(this.providers.values()); }; return ComponentContainer; }()); exports.Component = Component; exports.ComponentContainer = ComponentContainer; exports.Provider = Provider; //# sourceMappingURL=index.cjs.js.map /***/ }), /***/ "./node_modules/@firebase/firestore/node_modules/@firebase/util/dist/index.cjs.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(global) { Object.defineProperty(exports, '__esModule', { value: true }); var tslib = __webpack_require__("./node_modules/@firebase/firestore/node_modules/tslib/tslib.es6.js"); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * @fileoverview Firebase constants. Some of these (@defines) can be overridden at compile-time. */ var CONSTANTS = { /** * @define {boolean} Whether this is the client Node.js SDK. */ NODE_CLIENT: false, /** * @define {boolean} Whether this is the Admin Node.js SDK. */ NODE_ADMIN: false, /** * Firebase SDK Version */ SDK_VERSION: '${JSCORE_VERSION}' }; /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Throws an error if the provided assertion is falsy */ var assert = function (assertion, message) { if (!assertion) { throw assertionError(message); } }; /** * Returns an Error object suitable for throwing. */ var assertionError = function (message) { return new Error('Firebase Database (' + CONSTANTS.SDK_VERSION + ') INTERNAL ASSERT FAILED: ' + message); }; /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var stringToByteArray = function (str) { // TODO(user): Use native implementations if/when available var out = []; var p = 0; for (var i = 0; i < str.length; i++) { var c = str.charCodeAt(i); if (c < 128) { out[p++] = c; } else if (c < 2048) { out[p++] = (c >> 6) | 192; out[p++] = (c & 63) | 128; } else if ((c & 0xfc00) === 0xd800 && i + 1 < str.length && (str.charCodeAt(i + 1) & 0xfc00) === 0xdc00) { // Surrogate Pair c = 0x10000 + ((c & 0x03ff) << 10) + (str.charCodeAt(++i) & 0x03ff); out[p++] = (c >> 18) | 240; out[p++] = ((c >> 12) & 63) | 128; out[p++] = ((c >> 6) & 63) | 128; out[p++] = (c & 63) | 128; } else { out[p++] = (c >> 12) | 224; out[p++] = ((c >> 6) & 63) | 128; out[p++] = (c & 63) | 128; } } return out; }; /** * Turns an array of numbers into the string given by the concatenation of the * characters to which the numbers correspond. * @param bytes Array of numbers representing characters. * @return Stringification of the array. */ var byteArrayToString = function (bytes) { // TODO(user): Use native implementations if/when available var out = []; var pos = 0, c = 0; while (pos < bytes.length) { var c1 = bytes[pos++]; if (c1 < 128) { out[c++] = String.fromCharCode(c1); } else if (c1 > 191 && c1 < 224) { var c2 = bytes[pos++]; out[c++] = String.fromCharCode(((c1 & 31) << 6) | (c2 & 63)); } else if (c1 > 239 && c1 < 365) { // Surrogate Pair var c2 = bytes[pos++]; var c3 = bytes[pos++]; var c4 = bytes[pos++]; var u = (((c1 & 7) << 18) | ((c2 & 63) << 12) | ((c3 & 63) << 6) | (c4 & 63)) - 0x10000; out[c++] = String.fromCharCode(0xd800 + (u >> 10)); out[c++] = String.fromCharCode(0xdc00 + (u & 1023)); } else { var c2 = bytes[pos++]; var c3 = bytes[pos++]; out[c++] = String.fromCharCode(((c1 & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63)); } } return out.join(''); }; // We define it as an object literal instead of a class because a class compiled down to es5 can't // be treeshaked. https://github.com/rollup/rollup/issues/1691 // Static lookup maps, lazily populated by init_() var base64 = { /** * Maps bytes to characters. */ byteToCharMap_: null, /** * Maps characters to bytes. */ charToByteMap_: null, /** * Maps bytes to websafe characters. * @private */ byteToCharMapWebSafe_: null, /** * Maps websafe characters to bytes. * @private */ charToByteMapWebSafe_: null, /** * Our default alphabet, shared between * ENCODED_VALS and ENCODED_VALS_WEBSAFE */ ENCODED_VALS_BASE: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' + 'abcdefghijklmnopqrstuvwxyz' + '0123456789', /** * Our default alphabet. Value 64 (=) is special; it means "nothing." */ get ENCODED_VALS() { return this.ENCODED_VALS_BASE + '+/='; }, /** * Our websafe alphabet. */ get ENCODED_VALS_WEBSAFE() { return this.ENCODED_VALS_BASE + '-_.'; }, /** * Whether this browser supports the atob and btoa functions. This extension * started at Mozilla but is now implemented by many browsers. We use the * ASSUME_* variables to avoid pulling in the full useragent detection library * but still allowing the standard per-browser compilations. * */ HAS_NATIVE_SUPPORT: typeof atob === 'function', /** * Base64-encode an array of bytes. * * @param input An array of bytes (numbers with * value in [0, 255]) to encode. * @param webSafe Boolean indicating we should use the * alternative alphabet. * @return The base64 encoded string. */ encodeByteArray: function (input, webSafe) { if (!Array.isArray(input)) { throw Error('encodeByteArray takes an array as a parameter'); } this.init_(); var byteToCharMap = webSafe ? this.byteToCharMapWebSafe_ : this.byteToCharMap_; var output = []; for (var i = 0; i < input.length; i += 3) { var byte1 = input[i]; var haveByte2 = i + 1 < input.length; var byte2 = haveByte2 ? input[i + 1] : 0; var haveByte3 = i + 2 < input.length; var byte3 = haveByte3 ? input[i + 2] : 0; var outByte1 = byte1 >> 2; var outByte2 = ((byte1 & 0x03) << 4) | (byte2 >> 4); var outByte3 = ((byte2 & 0x0f) << 2) | (byte3 >> 6); var outByte4 = byte3 & 0x3f; if (!haveByte3) { outByte4 = 64; if (!haveByte2) { outByte3 = 64; } } output.push(byteToCharMap[outByte1], byteToCharMap[outByte2], byteToCharMap[outByte3], byteToCharMap[outByte4]); } return output.join(''); }, /** * Base64-encode a string. * * @param input A string to encode. * @param webSafe If true, we should use the * alternative alphabet. * @return The base64 encoded string. */ encodeString: function (input, webSafe) { // Shortcut for Mozilla browsers that implement // a native base64 encoder in the form of "btoa/atob" if (this.HAS_NATIVE_SUPPORT && !webSafe) { return btoa(input); } return this.encodeByteArray(stringToByteArray(input), webSafe); }, /** * Base64-decode a string. * * @param input to decode. * @param webSafe True if we should use the * alternative alphabet. * @return string representing the decoded value. */ decodeString: function (input, webSafe) { // Shortcut for Mozilla browsers that implement // a native base64 encoder in the form of "btoa/atob" if (this.HAS_NATIVE_SUPPORT && !webSafe) { return atob(input); } return byteArrayToString(this.decodeStringToByteArray(input, webSafe)); }, /** * Base64-decode a string. * * In base-64 decoding, groups of four characters are converted into three * bytes. If the encoder did not apply padding, the input length may not * be a multiple of 4. * * In this case, the last group will have fewer than 4 characters, and * padding will be inferred. If the group has one or two characters, it decodes * to one byte. If the group has three characters, it decodes to two bytes. * * @param input Input to decode. * @param webSafe True if we should use the web-safe alphabet. * @return bytes representing the decoded value. */ decodeStringToByteArray: function (input, webSafe) { this.init_(); var charToByteMap = webSafe ? this.charToByteMapWebSafe_ : this.charToByteMap_; var output = []; for (var i = 0; i < input.length;) { var byte1 = charToByteMap[input.charAt(i++)]; var haveByte2 = i < input.length; var byte2 = haveByte2 ? charToByteMap[input.charAt(i)] : 0; ++i; var haveByte3 = i < input.length; var byte3 = haveByte3 ? charToByteMap[input.charAt(i)] : 64; ++i; var haveByte4 = i < input.length; var byte4 = haveByte4 ? charToByteMap[input.charAt(i)] : 64; ++i; if (byte1 == null || byte2 == null || byte3 == null || byte4 == null) { throw Error(); } var outByte1 = (byte1 << 2) | (byte2 >> 4); output.push(outByte1); if (byte3 !== 64) { var outByte2 = ((byte2 << 4) & 0xf0) | (byte3 >> 2); output.push(outByte2); if (byte4 !== 64) { var outByte3 = ((byte3 << 6) & 0xc0) | byte4; output.push(outByte3); } } } return output; }, /** * Lazy static initialization function. Called before * accessing any of the static map variables. * @private */ init_: function () { if (!this.byteToCharMap_) { this.byteToCharMap_ = {}; this.charToByteMap_ = {}; this.byteToCharMapWebSafe_ = {}; this.charToByteMapWebSafe_ = {}; // We want quick mappings back and forth, so we precompute two maps. for (var i = 0; i < this.ENCODED_VALS.length; i++) { this.byteToCharMap_[i] = this.ENCODED_VALS.charAt(i); this.charToByteMap_[this.byteToCharMap_[i]] = i; this.byteToCharMapWebSafe_[i] = this.ENCODED_VALS_WEBSAFE.charAt(i); this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[i]] = i; // Be forgiving when decoding and correctly decode both encodings. if (i >= this.ENCODED_VALS_BASE.length) { this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(i)] = i; this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(i)] = i; } } } } }; /** * URL-safe base64 encoding */ var base64Encode = function (str) { var utf8Bytes = stringToByteArray(str); return base64.encodeByteArray(utf8Bytes, true); }; /** * URL-safe base64 decoding * * NOTE: DO NOT use the global atob() function - it does NOT support the * base64Url variant encoding. * * @param str To be decoded * @return Decoded result, if possible */ var base64Decode = function (str) { try { return base64.decodeString(str, true); } catch (e) { console.error('base64Decode failed: ', e); } return null; }; /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Do a deep-copy of basic JavaScript Objects or Arrays. */ function deepCopy(value) { return deepExtend(undefined, value); } /** * Copy properties from source to target (recursively allows extension * of Objects and Arrays). Scalar values in the target are over-written. * If target is undefined, an object of the appropriate type will be created * (and returned). * * We recursively copy all child properties of plain Objects in the source- so * that namespace- like dictionaries are merged. * * Note that the target can be a function, in which case the properties in * the source Object are copied onto it as static properties of the Function. */ function deepExtend(target, source) { if (!(source instanceof Object)) { return source; } switch (source.constructor) { case Date: // Treat Dates like scalars; if the target date object had any child // properties - they will be lost! var dateValue = source; return new Date(dateValue.getTime()); case Object: if (target === undefined) { target = {}; } break; case Array: // Always copy the array source and overwrite the target. target = []; break; default: // Not a plain Object - treat it as a scalar. return source; } for (var prop in source) { if (!source.hasOwnProperty(prop)) { continue; } target[prop] = deepExtend(target[prop], source[prop]); } return target; } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var Deferred = /** @class */ (function () { function Deferred() { var _this = this; this.reject = function () { }; this.resolve = function () { }; this.promise = new Promise(function (resolve, reject) { _this.resolve = resolve; _this.reject = reject; }); } /** * Our API internals are not promiseified and cannot because our callback APIs have subtle expectations around * invoking promises inline, which Promises are forbidden to do. This method accepts an optional node-style callback * and returns a node-style callback which will resolve or reject the Deferred's promise. */ Deferred.prototype.wrapCallback = function (callback) { var _this = this; return function (error, value) { if (error) { _this.reject(error); } else { _this.resolve(value); } if (typeof callback === 'function') { // Attaching noop handler just in case developer wasn't expecting // promises _this.promise.catch(function () { }); // Some of our callbacks don't expect a value and our own tests // assert that the parameter length is 1 if (callback.length === 1) { callback(error); } else { callback(error, value); } } }; }; return Deferred; }()); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Returns navigator.userAgent string or '' if it's not defined. * @return user agent string */ function getUA() { if (typeof navigator !== 'undefined' && typeof navigator['userAgent'] === 'string') { return navigator['userAgent']; } else { return ''; } } /** * Detect Cordova / PhoneGap / Ionic frameworks on a mobile device. * * Deliberately does not rely on checking `file://` URLs (as this fails PhoneGap * in the Ripple emulator) nor Cordova `onDeviceReady`, which would normally * wait for a callback. */ function isMobileCordova() { return (typeof window !== 'undefined' && // @ts-ignore Setting up an broadly applicable index signature for Window // just to deal with this case would probably be a bad idea. !!(window['cordova'] || window['phonegap'] || window['PhoneGap']) && /ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(getUA())); } /** * Detect Node.js. * * @return true if Node.js environment is detected. */ // Node detection logic from: https://github.com/iliakan/detect-node/ function isNode() { try { return (Object.prototype.toString.call(global.process) === '[object process]'); } catch (e) { return false; } } /** * Detect Browser Environment */ function isBrowser() { return typeof self === 'object' && self.self === self; } function isBrowserExtension() { var runtime = typeof chrome === 'object' ? chrome.runtime : typeof browser === 'object' ? browser.runtime : undefined; return typeof runtime === 'object' && runtime.id !== undefined; } /** * Detect React Native. * * @return true if ReactNative environment is detected. */ function isReactNative() { return (typeof navigator === 'object' && navigator['product'] === 'ReactNative'); } /** Detects Electron apps. */ function isElectron() { return getUA().indexOf('Electron/') >= 0; } /** Detects Internet Explorer. */ function isIE() { var ua = getUA(); return ua.indexOf('MSIE ') >= 0 || ua.indexOf('Trident/') >= 0; } /** Detects Universal Windows Platform apps. */ function isUWP() { return getUA().indexOf('MSAppHost/') >= 0; } /** * Detect whether the current SDK build is the Node version. * * @return true if it's the Node SDK build. */ function isNodeSdk() { return CONSTANTS.NODE_CLIENT === true || CONSTANTS.NODE_ADMIN === true; } /** Returns true if we are running in Safari. */ function isSafari() { return (!isNode() && navigator.userAgent.includes('Safari') && !navigator.userAgent.includes('Chrome')); } /** * This method checks if indexedDB is supported by current browser/service worker context * @return true if indexedDB is supported by current browser/service worker context */ function isIndexedDBAvailable() { return 'indexedDB' in self && indexedDB != null; } /** * This method validates browser context for indexedDB by opening a dummy indexedDB database and reject * if errors occur during the database open operation. */ function validateIndexedDBOpenable() { return new Promise(function (resolve, reject) { try { var preExist_1 = true; var DB_CHECK_NAME_1 = 'validate-browser-context-for-indexeddb-analytics-module'; var request_1 = window.indexedDB.open(DB_CHECK_NAME_1); request_1.onsuccess = function () { request_1.result.close(); // delete database only when it doesn't pre-exist if (!preExist_1) { window.indexedDB.deleteDatabase(DB_CHECK_NAME_1); } resolve(true); }; request_1.onupgradeneeded = function () { preExist_1 = false; }; request_1.onerror = function () { var _a; reject(((_a = request_1.error) === null || _a === void 0 ? void 0 : _a.message) || ''); }; } catch (error) { reject(error); } }); } /** * * This method checks whether cookie is enabled within current browser * @return true if cookie is enabled within current browser */ function areCookiesEnabled() { if (!navigator || !navigator.cookieEnabled) { return false; } return true; } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var ERROR_NAME = 'FirebaseError'; // Based on code from: // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error#Custom_Error_Types var FirebaseError = /** @class */ (function (_super) { tslib.__extends(FirebaseError, _super); function FirebaseError(code, message) { var _this = _super.call(this, message) || this; _this.code = code; _this.name = ERROR_NAME; // Fix For ES5 // https://github.com/Microsoft/TypeScript-wiki/blob/master/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work Object.setPrototypeOf(_this, FirebaseError.prototype); // Maintains proper stack trace for where our error was thrown. // Only available on V8. if (Error.captureStackTrace) { Error.captureStackTrace(_this, ErrorFactory.prototype.create); } return _this; } return FirebaseError; }(Error)); var ErrorFactory = /** @class */ (function () { function ErrorFactory(service, serviceName, errors) { this.service = service; this.serviceName = serviceName; this.errors = errors; } ErrorFactory.prototype.create = function (code) { var data = []; for (var _i = 1; _i < arguments.length; _i++) { data[_i - 1] = arguments[_i]; } var customData = data[0] || {}; var fullCode = this.service + "/" + code; var template = this.errors[code]; var message = template ? replaceTemplate(template, customData) : 'Error'; // Service Name: Error message (service/code). var fullMessage = this.serviceName + ": " + message + " (" + fullCode + ")."; var error = new FirebaseError(fullCode, fullMessage); // Keys with an underscore at the end of their name are not included in // error.data for some reason. // TODO: Replace with Object.entries when lib is updated to es2017. for (var _a = 0, _b = Object.keys(customData); _a < _b.length; _a++) { var key = _b[_a]; if (key.slice(-1) !== '_') { if (key in error) { console.warn("Overwriting FirebaseError base field \"" + key + "\" can cause unexpected behavior."); } error[key] = customData[key]; } } return error; }; return ErrorFactory; }()); function replaceTemplate(template, data) { return template.replace(PATTERN, function (_, key) { var value = data[key]; return value != null ? String(value) : "<" + key + "?>"; }); } var PATTERN = /\{\$([^}]+)}/g; /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Evaluates a JSON string into a javascript object. * * @param {string} str A string containing JSON. * @return {*} The javascript object representing the specified JSON. */ function jsonEval(str) { return JSON.parse(str); } /** * Returns JSON representing a javascript object. * @param {*} data Javascript object to be stringified. * @return {string} The JSON contents of the object. */ function stringify(data) { return JSON.stringify(data); } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Decodes a Firebase auth. token into constituent parts. * * Notes: * - May return with invalid / incomplete claims if there's no native base64 decoding support. * - Doesn't check if the token is actually valid. */ var decode = function (token) { var header = {}, claims = {}, data = {}, signature = ''; try { var parts = token.split('.'); header = jsonEval(base64Decode(parts[0]) || ''); claims = jsonEval(base64Decode(parts[1]) || ''); signature = parts[2]; data = claims['d'] || {}; delete claims['d']; } catch (e) { } return { header: header, claims: claims, data: data, signature: signature }; }; /** * Decodes a Firebase auth. token and checks the validity of its time-based claims. Will return true if the * token is within the time window authorized by the 'nbf' (not-before) and 'iat' (issued-at) claims. * * Notes: * - May return a false negative if there's no native base64 decoding support. * - Doesn't check if the token is actually valid. */ var isValidTimestamp = function (token) { var claims = decode(token).claims; var now = Math.floor(new Date().getTime() / 1000); var validSince = 0, validUntil = 0; if (typeof claims === 'object') { if (claims.hasOwnProperty('nbf')) { validSince = claims['nbf']; } else if (claims.hasOwnProperty('iat')) { validSince = claims['iat']; } if (claims.hasOwnProperty('exp')) { validUntil = claims['exp']; } else { // token will expire after 24h by default validUntil = validSince + 86400; } } return (!!now && !!validSince && !!validUntil && now >= validSince && now <= validUntil); }; /** * Decodes a Firebase auth. token and returns its issued at time if valid, null otherwise. * * Notes: * - May return null if there's no native base64 decoding support. * - Doesn't check if the token is actually valid. */ var issuedAtTime = function (token) { var claims = decode(token).claims; if (typeof claims === 'object' && claims.hasOwnProperty('iat')) { return claims['iat']; } return null; }; /** * Decodes a Firebase auth. token and checks the validity of its format. Expects a valid issued-at time. * * Notes: * - May return a false negative if there's no native base64 decoding support. * - Doesn't check if the token is actually valid. */ var isValidFormat = function (token) { var decoded = decode(token), claims = decoded.claims; return !!claims && typeof claims === 'object' && claims.hasOwnProperty('iat'); }; /** * Attempts to peer into an auth token and determine if it's an admin auth token by looking at the claims portion. * * Notes: * - May return a false negative if there's no native base64 decoding support. * - Doesn't check if the token is actually valid. */ var isAdmin = function (token) { var claims = decode(token).claims; return typeof claims === 'object' && claims['admin'] === true; }; /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ function contains(obj, key) { return Object.prototype.hasOwnProperty.call(obj, key); } function safeGet(obj, key) { if (Object.prototype.hasOwnProperty.call(obj, key)) { return obj[key]; } else { return undefined; } } function isEmpty(obj) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { return false; } } return true; } function map(obj, fn, contextObj) { var res = {}; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { res[key] = fn.call(contextObj, obj[key], key, obj); } } return res; } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Returns a querystring-formatted string (e.g. &arg=val&arg2=val2) from a * params object (e.g. {arg: 'val', arg2: 'val2'}) * Note: You must prepend it with ? when adding it to a URL. */ function querystring(querystringParams) { var params = []; var _loop_1 = function (key, value) { if (Array.isArray(value)) { value.forEach(function (arrayVal) { params.push(encodeURIComponent(key) + '=' + encodeURIComponent(arrayVal)); }); } else { params.push(encodeURIComponent(key) + '=' + encodeURIComponent(value)); } }; for (var _i = 0, _a = Object.entries(querystringParams); _i < _a.length; _i++) { var _b = _a[_i], key = _b[0], value = _b[1]; _loop_1(key, value); } return params.length ? '&' + params.join('&') : ''; } /** * Decodes a querystring (e.g. ?arg=val&arg2=val2) into a params object * (e.g. {arg: 'val', arg2: 'val2'}) */ function querystringDecode(querystring) { var obj = {}; var tokens = querystring.replace(/^\?/, '').split('&'); tokens.forEach(function (token) { if (token) { var key = token.split('='); obj[key[0]] = key[1]; } }); return obj; } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * @fileoverview SHA-1 cryptographic hash. * Variable names follow the notation in FIPS PUB 180-3: * http://csrc.nist.gov/publications/fips/fips180-3/fips180-3_final.pdf. * * Usage: * var sha1 = new sha1(); * sha1.update(bytes); * var hash = sha1.digest(); * * Performance: * Chrome 23: ~400 Mbit/s * Firefox 16: ~250 Mbit/s * */ /** * SHA-1 cryptographic hash constructor. * * The properties declared here are discussed in the above algorithm document. * @constructor * @final * @struct */ var Sha1 = /** @class */ (function () { function Sha1() { /** * Holds the previous values of accumulated variables a-e in the compress_ * function. * @private */ this.chain_ = []; /** * A buffer holding the partially computed hash result. * @private */ this.buf_ = []; /** * An array of 80 bytes, each a part of the message to be hashed. Referred to * as the message schedule in the docs. * @private */ this.W_ = []; /** * Contains data needed to pad messages less than 64 bytes. * @private */ this.pad_ = []; /** * @private {number} */ this.inbuf_ = 0; /** * @private {number} */ this.total_ = 0; this.blockSize = 512 / 8; this.pad_[0] = 128; for (var i = 1; i < this.blockSize; ++i) { this.pad_[i] = 0; } this.reset(); } Sha1.prototype.reset = function () { this.chain_[0] = 0x67452301; this.chain_[1] = 0xefcdab89; this.chain_[2] = 0x98badcfe; this.chain_[3] = 0x10325476; this.chain_[4] = 0xc3d2e1f0; this.inbuf_ = 0; this.total_ = 0; }; /** * Internal compress helper function. * @param buf Block to compress. * @param offset Offset of the block in the buffer. * @private */ Sha1.prototype.compress_ = function (buf, offset) { if (!offset) { offset = 0; } var W = this.W_; // get 16 big endian words if (typeof buf === 'string') { for (var i = 0; i < 16; i++) { // TODO(user): [bug 8140122] Recent versions of Safari for Mac OS and iOS // have a bug that turns the post-increment ++ operator into pre-increment // during JIT compilation. We have code that depends heavily on SHA-1 for // correctness and which is affected by this bug, so I've removed all uses // of post-increment ++ in which the result value is used. We can revert // this change once the Safari bug // (https://bugs.webkit.org/show_bug.cgi?id=109036) has been fixed and // most clients have been updated. W[i] = (buf.charCodeAt(offset) << 24) | (buf.charCodeAt(offset + 1) << 16) | (buf.charCodeAt(offset + 2) << 8) | buf.charCodeAt(offset + 3); offset += 4; } } else { for (var i = 0; i < 16; i++) { W[i] = (buf[offset] << 24) | (buf[offset + 1] << 16) | (buf[offset + 2] << 8) | buf[offset + 3]; offset += 4; } } // expand to 80 words for (var i = 16; i < 80; i++) { var t = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16]; W[i] = ((t << 1) | (t >>> 31)) & 0xffffffff; } var a = this.chain_[0]; var b = this.chain_[1]; var c = this.chain_[2]; var d = this.chain_[3]; var e = this.chain_[4]; var f, k; // TODO(user): Try to unroll this loop to speed up the computation. for (var i = 0; i < 80; i++) { if (i < 40) { if (i < 20) { f = d ^ (b & (c ^ d)); k = 0x5a827999; } else { f = b ^ c ^ d; k = 0x6ed9eba1; } } else { if (i < 60) { f = (b & c) | (d & (b | c)); k = 0x8f1bbcdc; } else { f = b ^ c ^ d; k = 0xca62c1d6; } } var t = (((a << 5) | (a >>> 27)) + f + e + k + W[i]) & 0xffffffff; e = d; d = c; c = ((b << 30) | (b >>> 2)) & 0xffffffff; b = a; a = t; } this.chain_[0] = (this.chain_[0] + a) & 0xffffffff; this.chain_[1] = (this.chain_[1] + b) & 0xffffffff; this.chain_[2] = (this.chain_[2] + c) & 0xffffffff; this.chain_[3] = (this.chain_[3] + d) & 0xffffffff; this.chain_[4] = (this.chain_[4] + e) & 0xffffffff; }; Sha1.prototype.update = function (bytes, length) { // TODO(johnlenz): tighten the function signature and remove this check if (bytes == null) { return; } if (length === undefined) { length = bytes.length; } var lengthMinusBlock = length - this.blockSize; var n = 0; // Using local instead of member variables gives ~5% speedup on Firefox 16. var buf = this.buf_; var inbuf = this.inbuf_; // The outer while loop should execute at most twice. while (n < length) { // When we have no data in the block to top up, we can directly process the // input buffer (assuming it contains sufficient data). This gives ~25% // speedup on Chrome 23 and ~15% speedup on Firefox 16, but requires that // the data is provided in large chunks (or in multiples of 64 bytes). if (inbuf === 0) { while (n <= lengthMinusBlock) { this.compress_(bytes, n); n += this.blockSize; } } if (typeof bytes === 'string') { while (n < length) { buf[inbuf] = bytes.charCodeAt(n); ++inbuf; ++n; if (inbuf === this.blockSize) { this.compress_(buf); inbuf = 0; // Jump to the outer loop so we use the full-block optimization. break; } } } else { while (n < length) { buf[inbuf] = bytes[n]; ++inbuf; ++n; if (inbuf === this.blockSize) { this.compress_(buf); inbuf = 0; // Jump to the outer loop so we use the full-block optimization. break; } } } } this.inbuf_ = inbuf; this.total_ += length; }; /** @override */ Sha1.prototype.digest = function () { var digest = []; var totalBits = this.total_ * 8; // Add pad 0x80 0x00*. if (this.inbuf_ < 56) { this.update(this.pad_, 56 - this.inbuf_); } else { this.update(this.pad_, this.blockSize - (this.inbuf_ - 56)); } // Add # bits. for (var i = this.blockSize - 1; i >= 56; i--) { this.buf_[i] = totalBits & 255; totalBits /= 256; // Don't use bit-shifting here! } this.compress_(this.buf_); var n = 0; for (var i = 0; i < 5; i++) { for (var j = 24; j >= 0; j -= 8) { digest[n] = (this.chain_[i] >> j) & 255; ++n; } } return digest; }; return Sha1; }()); /** * Helper to make a Subscribe function (just like Promise helps make a * Thenable). * * @param executor Function which can make calls to a single Observer * as a proxy. * @param onNoObservers Callback when count of Observers goes to zero. */ function createSubscribe(executor, onNoObservers) { var proxy = new ObserverProxy(executor, onNoObservers); return proxy.subscribe.bind(proxy); } /** * Implement fan-out for any number of Observers attached via a subscribe * function. */ var ObserverProxy = /** @class */ (function () { /** * @param executor Function which can make calls to a single Observer * as a proxy. * @param onNoObservers Callback when count of Observers goes to zero. */ function ObserverProxy(executor, onNoObservers) { var _this = this; this.observers = []; this.unsubscribes = []; this.observerCount = 0; // Micro-task scheduling by calling task.then(). this.task = Promise.resolve(); this.finalized = false; this.onNoObservers = onNoObservers; // Call the executor asynchronously so subscribers that are called // synchronously after the creation of the subscribe function // can still receive the very first value generated in the executor. this.task .then(function () { executor(_this); }) .catch(function (e) { _this.error(e); }); } ObserverProxy.prototype.next = function (value) { this.forEachObserver(function (observer) { observer.next(value); }); }; ObserverProxy.prototype.error = function (error) { this.forEachObserver(function (observer) { observer.error(error); }); this.close(error); }; ObserverProxy.prototype.complete = function () { this.forEachObserver(function (observer) { observer.complete(); }); this.close(); }; /** * Subscribe function that can be used to add an Observer to the fan-out list. * * - We require that no event is sent to a subscriber sychronously to their * call to subscribe(). */ ObserverProxy.prototype.subscribe = function (nextOrObserver, error, complete) { var _this = this; var observer; if (nextOrObserver === undefined && error === undefined && complete === undefined) { throw new Error('Missing Observer.'); } // Assemble an Observer object when passed as callback functions. if (implementsAnyMethods(nextOrObserver, [ 'next', 'error', 'complete' ])) { observer = nextOrObserver; } else { observer = { next: nextOrObserver, error: error, complete: complete }; } if (observer.next === undefined) { observer.next = noop; } if (observer.error === undefined) { observer.error = noop; } if (observer.complete === undefined) { observer.complete = noop; } var unsub = this.unsubscribeOne.bind(this, this.observers.length); // Attempt to subscribe to a terminated Observable - we // just respond to the Observer with the final error or complete // event. if (this.finalized) { // eslint-disable-next-line @typescript-eslint/no-floating-promises this.task.then(function () { try { if (_this.finalError) { observer.error(_this.finalError); } else { observer.complete(); } } catch (e) { // nothing } return; }); } this.observers.push(observer); return unsub; }; // Unsubscribe is synchronous - we guarantee that no events are sent to // any unsubscribed Observer. ObserverProxy.prototype.unsubscribeOne = function (i) { if (this.observers === undefined || this.observers[i] === undefined) { return; } delete this.observers[i]; this.observerCount -= 1; if (this.observerCount === 0 && this.onNoObservers !== undefined) { this.onNoObservers(this); } }; ObserverProxy.prototype.forEachObserver = function (fn) { if (this.finalized) { // Already closed by previous event....just eat the additional values. return; } // Since sendOne calls asynchronously - there is no chance that // this.observers will become undefined. for (var i = 0; i < this.observers.length; i++) { this.sendOne(i, fn); } }; // Call the Observer via one of it's callback function. We are careful to // confirm that the observe has not been unsubscribed since this asynchronous // function had been queued. ObserverProxy.prototype.sendOne = function (i, fn) { var _this = this; // Execute the callback asynchronously // eslint-disable-next-line @typescript-eslint/no-floating-promises this.task.then(function () { if (_this.observers !== undefined && _this.observers[i] !== undefined) { try { fn(_this.observers[i]); } catch (e) { // Ignore exceptions raised in Observers or missing methods of an // Observer. // Log error to console. b/31404806 if (typeof console !== 'undefined' && console.error) { console.error(e); } } } }); }; ObserverProxy.prototype.close = function (err) { var _this = this; if (this.finalized) { return; } this.finalized = true; if (err !== undefined) { this.finalError = err; } // Proxy is no longer needed - garbage collect references // eslint-disable-next-line @typescript-eslint/no-floating-promises this.task.then(function () { _this.observers = undefined; _this.onNoObservers = undefined; }); }; return ObserverProxy; }()); /** Turn synchronous function into one called asynchronously. */ // eslint-disable-next-line @typescript-eslint/ban-types function async(fn, onError) { return function () { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } Promise.resolve(true) .then(function () { fn.apply(void 0, args); }) .catch(function (error) { if (onError) { onError(error); } }); }; } /** * Return true if the object passed in implements any of the named methods. */ function implementsAnyMethods(obj, methods) { if (typeof obj !== 'object' || obj === null) { return false; } for (var _i = 0, methods_1 = methods; _i < methods_1.length; _i++) { var method = methods_1[_i]; if (method in obj && typeof obj[method] === 'function') { return true; } } return false; } function noop() { // do nothing } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Check to make sure the appropriate number of arguments are provided for a public function. * Throws an error if it fails. * * @param fnName The function name * @param minCount The minimum number of arguments to allow for the function call * @param maxCount The maximum number of argument to allow for the function call * @param argCount The actual number of arguments provided. */ var validateArgCount = function (fnName, minCount, maxCount, argCount) { var argError; if (argCount < minCount) { argError = 'at least ' + minCount; } else if (argCount > maxCount) { argError = maxCount === 0 ? 'none' : 'no more than ' + maxCount; } if (argError) { var error = fnName + ' failed: Was called with ' + argCount + (argCount === 1 ? ' argument.' : ' arguments.') + ' Expects ' + argError + '.'; throw new Error(error); } }; /** * Generates a string to prefix an error message about failed argument validation * * @param fnName The function name * @param argumentNumber The index of the argument * @param optional Whether or not the argument is optional * @return The prefix to add to the error thrown for validation. */ function errorPrefix(fnName, argumentNumber, optional) { var argName = ''; switch (argumentNumber) { case 1: argName = optional ? 'first' : 'First'; break; case 2: argName = optional ? 'second' : 'Second'; break; case 3: argName = optional ? 'third' : 'Third'; break; case 4: argName = optional ? 'fourth' : 'Fourth'; break; default: throw new Error('errorPrefix called with argumentNumber > 4. Need to update it?'); } var error = fnName + ' failed: '; error += argName + ' argument '; return error; } /** * @param fnName * @param argumentNumber * @param namespace * @param optional */ function validateNamespace(fnName, argumentNumber, namespace, optional) { if (optional && !namespace) { return; } if (typeof namespace !== 'string') { //TODO: I should do more validation here. We only allow certain chars in namespaces. throw new Error(errorPrefix(fnName, argumentNumber, optional) + 'must be a valid firebase namespace.'); } } function validateCallback(fnName, argumentNumber, // eslint-disable-next-line @typescript-eslint/ban-types callback, optional) { if (optional && !callback) { return; } if (typeof callback !== 'function') { throw new Error(errorPrefix(fnName, argumentNumber, optional) + 'must be a valid function.'); } } function validateContextObject(fnName, argumentNumber, context, optional) { if (optional && !context) { return; } if (typeof context !== 'object' || context === null) { throw new Error(errorPrefix(fnName, argumentNumber, optional) + 'must be a valid context object.'); } } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // Code originally came from goog.crypt.stringToUtf8ByteArray, but for some reason they // automatically replaced '\r\n' with '\n', and they didn't handle surrogate pairs, // so it's been modified. // Note that not all Unicode characters appear as single characters in JavaScript strings. // fromCharCode returns the UTF-16 encoding of a character - so some Unicode characters // use 2 characters in Javascript. All 4-byte UTF-8 characters begin with a first // character in the range 0xD800 - 0xDBFF (the first character of a so-called surrogate // pair). // See http://www.ecma-international.org/ecma-262/5.1/#sec-15.1.3 /** * @param {string} str * @return {Array} */ var stringToByteArray$1 = function (str) { var out = []; var p = 0; for (var i = 0; i < str.length; i++) { var c = str.charCodeAt(i); // Is this the lead surrogate in a surrogate pair? if (c >= 0xd800 && c <= 0xdbff) { var high = c - 0xd800; // the high 10 bits. i++; assert(i < str.length, 'Surrogate pair missing trail surrogate.'); var low = str.charCodeAt(i) - 0xdc00; // the low 10 bits. c = 0x10000 + (high << 10) + low; } if (c < 128) { out[p++] = c; } else if (c < 2048) { out[p++] = (c >> 6) | 192; out[p++] = (c & 63) | 128; } else if (c < 65536) { out[p++] = (c >> 12) | 224; out[p++] = ((c >> 6) & 63) | 128; out[p++] = (c & 63) | 128; } else { out[p++] = (c >> 18) | 240; out[p++] = ((c >> 12) & 63) | 128; out[p++] = ((c >> 6) & 63) | 128; out[p++] = (c & 63) | 128; } } return out; }; /** * Calculate length without actually converting; useful for doing cheaper validation. * @param {string} str * @return {number} */ var stringLength = function (str) { var p = 0; for (var i = 0; i < str.length; i++) { var c = str.charCodeAt(i); if (c < 128) { p++; } else if (c < 2048) { p += 2; } else if (c >= 0xd800 && c <= 0xdbff) { // Lead surrogate of a surrogate pair. The pair together will take 4 bytes to represent. p += 4; i++; // skip trail surrogate. } else { p += 3; } } return p; }; /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * The amount of milliseconds to exponentially increase. */ var DEFAULT_INTERVAL_MILLIS = 1000; /** * The factor to backoff by. * Should be a number greater than 1. */ var DEFAULT_BACKOFF_FACTOR = 2; /** * The maximum milliseconds to increase to. * * <p>Visible for testing */ var MAX_VALUE_MILLIS = 4 * 60 * 60 * 1000; // Four hours, like iOS and Android. /** * The percentage of backoff time to randomize by. * See * http://go/safe-client-behavior#step-1-determine-the-appropriate-retry-interval-to-handle-spike-traffic * for context. * * <p>Visible for testing */ var RANDOM_FACTOR = 0.5; /** * Based on the backoff method from * https://github.com/google/closure-library/blob/master/closure/goog/math/exponentialbackoff.js. * Extracted here so we don't need to pass metadata and a stateful ExponentialBackoff object around. */ function calculateBackoffMillis(backoffCount, intervalMillis, backoffFactor) { if (intervalMillis === void 0) { intervalMillis = DEFAULT_INTERVAL_MILLIS; } if (backoffFactor === void 0) { backoffFactor = DEFAULT_BACKOFF_FACTOR; } // Calculates an exponentially increasing value. // Deviation: calculates value from count and a constant interval, so we only need to save value // and count to restore state. var currBaseValue = intervalMillis * Math.pow(backoffFactor, backoffCount); // A random "fuzz" to avoid waves of retries. // Deviation: randomFactor is required. var randomWait = Math.round( // A fraction of the backoff value to add/subtract. // Deviation: changes multiplication order to improve readability. RANDOM_FACTOR * currBaseValue * // A random float (rounded to int by Math.round above) in the range [-1, 1]. Determines // if we add or subtract. (Math.random() - 0.5) * 2); // Limits backoff to max to avoid effectively permanent backoff. return Math.min(MAX_VALUE_MILLIS, currBaseValue + randomWait); } exports.CONSTANTS = CONSTANTS; exports.Deferred = Deferred; exports.ErrorFactory = ErrorFactory; exports.FirebaseError = FirebaseError; exports.MAX_VALUE_MILLIS = MAX_VALUE_MILLIS; exports.RANDOM_FACTOR = RANDOM_FACTOR; exports.Sha1 = Sha1; exports.areCookiesEnabled = areCookiesEnabled; exports.assert = assert; exports.assertionError = assertionError; exports.async = async; exports.base64 = base64; exports.base64Decode = base64Decode; exports.base64Encode = base64Encode; exports.calculateBackoffMillis = calculateBackoffMillis; exports.contains = contains; exports.createSubscribe = createSubscribe; exports.decode = decode; exports.deepCopy = deepCopy; exports.deepExtend = deepExtend; exports.errorPrefix = errorPrefix; exports.getUA = getUA; exports.isAdmin = isAdmin; exports.isBrowser = isBrowser; exports.isBrowserExtension = isBrowserExtension; exports.isElectron = isElectron; exports.isEmpty = isEmpty; exports.isIE = isIE; exports.isIndexedDBAvailable = isIndexedDBAvailable; exports.isMobileCordova = isMobileCordova; exports.isNode = isNode; exports.isNodeSdk = isNodeSdk; exports.isReactNative = isReactNative; exports.isSafari = isSafari; exports.isUWP = isUWP; exports.isValidFormat = isValidFormat; exports.isValidTimestamp = isValidTimestamp; exports.issuedAtTime = issuedAtTime; exports.jsonEval = jsonEval; exports.map = map; exports.querystring = querystring; exports.querystringDecode = querystringDecode; exports.safeGet = safeGet; exports.stringLength = stringLength; exports.stringToByteArray = stringToByteArray$1; exports.stringify = stringify; exports.validateArgCount = validateArgCount; exports.validateCallback = validateCallback; exports.validateContextObject = validateContextObject; exports.validateIndexedDBOpenable = validateIndexedDBOpenable; exports.validateNamespace = validateNamespace; //# sourceMappingURL=index.cjs.js.map /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__("./node_modules/webpack/buildin/global.js"))) /***/ }), /***/ "./node_modules/@firebase/firestore/node_modules/tslib/tslib.es6.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); /* harmony export (immutable) */ __webpack_exports__["__extends"] = __extends; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__assign", function() { return __assign; }); /* harmony export (immutable) */ __webpack_exports__["__rest"] = __rest; /* harmony export (immutable) */ __webpack_exports__["__decorate"] = __decorate; /* harmony export (immutable) */ __webpack_exports__["__param"] = __param; /* harmony export (immutable) */ __webpack_exports__["__metadata"] = __metadata; /* harmony export (immutable) */ __webpack_exports__["__awaiter"] = __awaiter; /* harmony export (immutable) */ __webpack_exports__["__generator"] = __generator; /* harmony export (immutable) */ __webpack_exports__["__createBinding"] = __createBinding; /* harmony export (immutable) */ __webpack_exports__["__exportStar"] = __exportStar; /* harmony export (immutable) */ __webpack_exports__["__values"] = __values; /* harmony export (immutable) */ __webpack_exports__["__read"] = __read; /* harmony export (immutable) */ __webpack_exports__["__spread"] = __spread; /* harmony export (immutable) */ __webpack_exports__["__spreadArrays"] = __spreadArrays; /* harmony export (immutable) */ __webpack_exports__["__await"] = __await; /* harmony export (immutable) */ __webpack_exports__["__asyncGenerator"] = __asyncGenerator; /* harmony export (immutable) */ __webpack_exports__["__asyncDelegator"] = __asyncDelegator; /* harmony export (immutable) */ __webpack_exports__["__asyncValues"] = __asyncValues; /* harmony export (immutable) */ __webpack_exports__["__makeTemplateObject"] = __makeTemplateObject; /* harmony export (immutable) */ __webpack_exports__["__importStar"] = __importStar; /* harmony export (immutable) */ __webpack_exports__["__importDefault"] = __importDefault; /* harmony export (immutable) */ __webpack_exports__["__classPrivateFieldGet"] = __classPrivateFieldGet; /* harmony export (immutable) */ __webpack_exports__["__classPrivateFieldSet"] = __classPrivateFieldSet; /*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */ /* global Reflect, Promise */ var extendStatics = function(d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; function __extends(d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); } var __assign = function() { __assign = Object.assign || function __assign(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; } return __assign.apply(this, arguments); } function __rest(s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; } return t; } function __decorate(decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; } function __param(paramIndex, decorator) { return function (target, key) { decorator(target, key, paramIndex); } } function __metadata(metadataKey, metadataValue) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); } function __awaiter(thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); } function __generator(thisArg, body) { var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; function verb(n) { return function (v) { return step([n, v]); }; } function step(op) { if (f) throw new TypeError("Generator is already executing."); while (_) try { if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; if (y = 0, t) op = [op[0] & 2, t.value]; switch (op[0]) { case 0: case 1: t = op; break; case 4: _.label++; return { value: op[1], done: false }; case 5: _.label++; y = op[1]; op = [0]; continue; case 7: op = _.ops.pop(); _.trys.pop(); continue; default: if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } if (t[2]) _.ops.pop(); _.trys.pop(); continue; } op = body.call(thisArg, _); } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } } function __createBinding(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; } function __exportStar(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) exports[p] = m[p]; } function __values(o) { var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; if (m) return m.call(o); if (o && typeof o.length === "number") return { next: function () { if (o && i >= o.length) o = void 0; return { value: o && o[i++], done: !o }; } }; throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); } function __read(o, n) { var m = typeof Symbol === "function" && o[Symbol.iterator]; if (!m) return o; var i = m.call(o), r, ar = [], e; try { while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); } catch (error) { e = { error: error }; } finally { try { if (r && !r.done && (m = i["return"])) m.call(i); } finally { if (e) throw e.error; } } return ar; } function __spread() { for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); return ar; } function __spreadArrays() { for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; for (var r = Array(s), k = 0, i = 0; i < il; i++) for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) r[k] = a[j]; return r; }; function __await(v) { return this instanceof __await ? (this.v = v, this) : new __await(v); } function __asyncGenerator(thisArg, _arguments, generator) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var g = generator.apply(thisArg, _arguments || []), i, q = []; return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } function fulfill(value) { resume("next", value); } function reject(value) { resume("throw", value); } function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } } function __asyncDelegator(o) { var i, p; return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } } function __asyncValues(o) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var m = o[Symbol.asyncIterator], i; return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } } function __makeTemplateObject(cooked, raw) { if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } return cooked; }; function __importStar(mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; result.default = mod; return result; } function __importDefault(mod) { return (mod && mod.__esModule) ? mod : { default: mod }; } function __classPrivateFieldGet(receiver, privateMap) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return privateMap.get(receiver); } function __classPrivateFieldSet(receiver, privateMap, value) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to set private field on non-instance"); } privateMap.set(receiver, value); return value; } /***/ }), /***/ "./node_modules/@firebase/functions/dist/index.cjs.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; var firebase = __webpack_require__("./node_modules/@firebase/app/dist/index.cjs.js"); var tslib = __webpack_require__("./node_modules/@firebase/functions/node_modules/tslib/tslib.es6.js"); var component = __webpack_require__("./node_modules/@firebase/functions/node_modules/@firebase/component/dist/index.cjs.js"); function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } var firebase__default = /*#__PURE__*/_interopDefaultLegacy(firebase); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Standard error codes for different ways a request can fail, as defined by: * https://github.com/googleapis/googleapis/blob/master/google/rpc/code.proto * * This map is used primarily to convert from a backend error code string to * a client SDK error code string, and make sure it's in the supported set. */ var errorCodeMap = { OK: 'ok', CANCELLED: 'cancelled', UNKNOWN: 'unknown', INVALID_ARGUMENT: 'invalid-argument', DEADLINE_EXCEEDED: 'deadline-exceeded', NOT_FOUND: 'not-found', ALREADY_EXISTS: 'already-exists', PERMISSION_DENIED: 'permission-denied', UNAUTHENTICATED: 'unauthenticated', RESOURCE_EXHAUSTED: 'resource-exhausted', FAILED_PRECONDITION: 'failed-precondition', ABORTED: 'aborted', OUT_OF_RANGE: 'out-of-range', UNIMPLEMENTED: 'unimplemented', INTERNAL: 'internal', UNAVAILABLE: 'unavailable', DATA_LOSS: 'data-loss' }; /** * An explicit error that can be thrown from a handler to send an error to the * client that called the function. */ var HttpsErrorImpl = /** @class */ (function (_super) { tslib.__extends(HttpsErrorImpl, _super); function HttpsErrorImpl(code, message, details) { var _this = _super.call(this, message) || this; // This is a workaround for a bug in TypeScript when extending Error: // tslint:disable-next-line // https://github.com/Microsoft/TypeScript-wiki/blob/master/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work Object.setPrototypeOf(_this, HttpsErrorImpl.prototype); _this.code = code; _this.details = details; return _this; } return HttpsErrorImpl; }(Error)); /** * Takes an HTTP status code and returns the corresponding ErrorCode. * This is the standard HTTP status code -> error mapping defined in: * https://github.com/googleapis/googleapis/blob/master/google/rpc/code.proto * * @param status An HTTP status code. * @return The corresponding ErrorCode, or ErrorCode.UNKNOWN if none. */ function codeForHTTPStatus(status) { // Make sure any successful status is OK. if (status >= 200 && status < 300) { return 'ok'; } switch (status) { case 0: // This can happen if the server returns 500. return 'internal'; case 400: return 'invalid-argument'; case 401: return 'unauthenticated'; case 403: return 'permission-denied'; case 404: return 'not-found'; case 409: return 'aborted'; case 429: return 'resource-exhausted'; case 499: return 'cancelled'; case 500: return 'internal'; case 501: return 'unimplemented'; case 503: return 'unavailable'; case 504: return 'deadline-exceeded'; } return 'unknown'; } /** * Takes an HTTP response and returns the corresponding Error, if any. */ function _errorForResponse(status, bodyJSON, serializer) { var code = codeForHTTPStatus(status); // Start with reasonable defaults from the status code. var description = code; var details = undefined; // Then look through the body for explicit details. try { var errorJSON = bodyJSON && bodyJSON.error; if (errorJSON) { var status_1 = errorJSON.status; if (typeof status_1 === 'string') { if (!errorCodeMap[status_1]) { // They must've included an unknown error code in the body. return new HttpsErrorImpl('internal', 'internal'); } code = errorCodeMap[status_1]; // TODO(klimt): Add better default descriptions for error enums. // The default description needs to be updated for the new code. description = status_1; } var message = errorJSON.message; if (typeof message === 'string') { description = message; } details = errorJSON.details; if (details !== undefined) { details = serializer.decode(details); } } } catch (e) { // If we couldn't parse explicit error data, that's fine. } if (code === 'ok') { // Technically, there's an edge case where a developer could explicitly // return an error code of OK, and we will treat it as success, but that // seems reasonable. return null; } return new HttpsErrorImpl(code, description, details); } /** * Helper class to get metadata that should be included with a function call. */ var ContextProvider = /** @class */ (function () { function ContextProvider(authProvider, messagingProvider) { var _this = this; this.auth = null; this.messaging = null; this.auth = authProvider.getImmediate({ optional: true }); this.messaging = messagingProvider.getImmediate({ optional: true }); if (!this.auth) { authProvider.get().then(function (auth) { return (_this.auth = auth); }, function () { /* get() never rejects */ }); } if (!this.messaging) { messagingProvider.get().then(function (messaging) { return (_this.messaging = messaging); }, function () { /* get() never rejects */ }); } } ContextProvider.prototype.getAuthToken = function () { return tslib.__awaiter(this, void 0, void 0, function () { var token, e_1; return tslib.__generator(this, function (_a) { switch (_a.label) { case 0: if (!this.auth) { return [2 /*return*/, undefined]; } _a.label = 1; case 1: _a.trys.push([1, 3, , 4]); return [4 /*yield*/, this.auth.getToken()]; case 2: token = _a.sent(); if (!token) { return [2 /*return*/, undefined]; } return [2 /*return*/, token.accessToken]; case 3: e_1 = _a.sent(); // If there's any error when trying to get the auth token, leave it off. return [2 /*return*/, undefined]; case 4: return [2 /*return*/]; } }); }); }; ContextProvider.prototype.getInstanceIdToken = function () { return tslib.__awaiter(this, void 0, void 0, function () { return tslib.__generator(this, function (_a) { if (!this.messaging || !('Notification' in self) || Notification.permission !== 'granted') { return [2 /*return*/, undefined]; } try { return [2 /*return*/, this.messaging.getToken()]; } catch (e) { // We don't warn on this, because it usually means messaging isn't set up. // console.warn('Failed to retrieve instance id token.', e); // If there's any error when trying to get the token, leave it off. return [2 /*return*/, undefined]; } return [2 /*return*/]; }); }); }; ContextProvider.prototype.getContext = function () { return tslib.__awaiter(this, void 0, void 0, function () { var authToken, instanceIdToken; return tslib.__generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, this.getAuthToken()]; case 1: authToken = _a.sent(); return [4 /*yield*/, this.getInstanceIdToken()]; case 2: instanceIdToken = _a.sent(); return [2 /*return*/, { authToken: authToken, instanceIdToken: instanceIdToken }]; } }); }); }; return ContextProvider; }()); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var LONG_TYPE = 'type.googleapis.com/google.protobuf.Int64Value'; var UNSIGNED_LONG_TYPE = 'type.googleapis.com/google.protobuf.UInt64Value'; function mapValues( // { [k: string]: unknown } is no longer a wildcard assignment target after typescript 3.5 // eslint-disable-next-line @typescript-eslint/no-explicit-any o, f) { var result = {}; for (var key in o) { if (o.hasOwnProperty(key)) { result[key] = f(o[key]); } } return result; } var Serializer = /** @class */ (function () { function Serializer() { } // Takes data and encodes it in a JSON-friendly way, such that types such as // Date are preserved. Serializer.prototype.encode = function (data) { var _this = this; if (data == null) { return null; } if (data instanceof Number) { data = data.valueOf(); } if (typeof data === 'number' && isFinite(data)) { // Any number in JS is safe to put directly in JSON and parse as a double // without any loss of precision. return data; } if (data === true || data === false) { return data; } if (Object.prototype.toString.call(data) === '[object String]') { return data; } if (Array.isArray(data)) { return data.map(function (x) { return _this.encode(x); }); } if (typeof data === 'function' || typeof data === 'object') { return mapValues(data, function (x) { return _this.encode(x); }); } // If we got this far, the data is not encodable. throw new Error('Data cannot be encoded in JSON: ' + data); }; // Takes data that's been encoded in a JSON-friendly form and returns a form // with richer datatypes, such as Dates, etc. Serializer.prototype.decode = function (json) { var _this = this; if (json == null) { return json; } if (json['@type']) { switch (json['@type']) { case LONG_TYPE: // Fall through and handle this the same as unsigned. case UNSIGNED_LONG_TYPE: { // Technically, this could work return a valid number for malformed // data if there was a number followed by garbage. But it's just not // worth all the extra code to detect that case. var value = Number(json['value']); if (isNaN(value)) { throw new Error('Data cannot be decoded from JSON: ' + json); } return value; } default: { throw new Error('Data cannot be decoded from JSON: ' + json); } } } if (Array.isArray(json)) { return json.map(function (x) { return _this.decode(x); }); } if (typeof json === 'function' || typeof json === 'object') { return mapValues(json, function (x) { return _this.decode(x); }); } // Anything else is safe to return. return json; }; return Serializer; }()); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Returns a Promise that will be rejected after the given duration. * The error will be of type HttpsErrorImpl. * * @param millis Number of milliseconds to wait before rejecting. */ function failAfter(millis) { var timer; var promise = new Promise(function (_, reject) { timer = setTimeout(function () { reject(new HttpsErrorImpl('deadline-exceeded', 'deadline-exceeded')); }, millis); }); return { timer: timer, promise: promise }; } /** * The main class for the Firebase Functions SDK. */ var Service = /** @class */ (function () { /** * Creates a new Functions service for the given app and (optional) region or custom domain. * @param app_ The FirebaseApp to use. * @param regionOrCustomDomain_ one of: * a) A region to call functions from, such as us-central1 * b) A custom domain to use as a functions prefix, such as https://mydomain.com */ function Service(app_, authProvider, messagingProvider, regionOrCustomDomain_, fetchImpl) { var _this = this; if (regionOrCustomDomain_ === void 0) { regionOrCustomDomain_ = 'us-central1'; } this.app_ = app_; this.fetchImpl = fetchImpl; this.serializer = new Serializer(); this.emulatorOrigin = null; this.INTERNAL = { delete: function () { return Promise.resolve(_this.deleteService()); } }; this.contextProvider = new ContextProvider(authProvider, messagingProvider); // Cancels all ongoing requests when resolved. this.cancelAllRequests = new Promise(function (resolve) { _this.deleteService = function () { return resolve(); }; }); // Resolve the region or custom domain overload by attempting to parse it. try { var url = new URL(regionOrCustomDomain_); this.customDomain = url.origin; this.region = 'us-central1'; } catch (e) { this.customDomain = null; this.region = regionOrCustomDomain_; } } Object.defineProperty(Service.prototype, "app", { get: function () { return this.app_; }, enumerable: false, configurable: true }); /** * Returns the URL for a callable with the given name. * @param name The name of the callable. */ Service.prototype._url = function (name) { var projectId = this.app_.options.projectId; if (this.emulatorOrigin !== null) { var origin_1 = this.emulatorOrigin; return origin_1 + "/" + projectId + "/" + this.region + "/" + name; } if (this.customDomain !== null) { return this.customDomain + "/" + name; } return "https://" + this.region + "-" + projectId + ".cloudfunctions.net/" + name; }; /** * Changes this instance to point to a Cloud Functions emulator running * locally. See https://firebase.google.com/docs/functions/local-emulator * * @param origin The origin of the local emulator, such as * "http://localhost:5005". */ Service.prototype.useFunctionsEmulator = function (origin) { this.emulatorOrigin = origin; }; /** * Returns a reference to the callable https trigger with the given name. * @param name The name of the trigger. */ Service.prototype.httpsCallable = function (name, options) { var _this = this; return function (data) { return _this.call(name, data, options || {}); }; }; /** * Does an HTTP POST and returns the completed response. * @param url The url to post to. * @param body The JSON body of the post. * @param headers The HTTP headers to include in the request. * @return A Promise that will succeed when the request finishes. */ Service.prototype.postJSON = function (url, body, headers) { return tslib.__awaiter(this, void 0, void 0, function () { var response, e_1, json, e_2; return tslib.__generator(this, function (_a) { switch (_a.label) { case 0: headers['Content-Type'] = 'application/json'; _a.label = 1; case 1: _a.trys.push([1, 3, , 4]); return [4 /*yield*/, this.fetchImpl(url, { method: 'POST', body: JSON.stringify(body), headers: headers })]; case 2: response = _a.sent(); return [3 /*break*/, 4]; case 3: e_1 = _a.sent(); // This could be an unhandled error on the backend, or it could be a // network error. There's no way to know, since an unhandled error on the // backend will fail to set the proper CORS header, and thus will be // treated as a network error by fetch. return [2 /*return*/, { status: 0, json: null }]; case 4: json = null; _a.label = 5; case 5: _a.trys.push([5, 7, , 8]); return [4 /*yield*/, response.json()]; case 6: json = _a.sent(); return [3 /*break*/, 8]; case 7: e_2 = _a.sent(); return [3 /*break*/, 8]; case 8: return [2 /*return*/, { status: response.status, json: json }]; } }); }); }; /** * Calls a callable function asynchronously and returns the result. * @param name The name of the callable trigger. * @param data The data to pass as params to the function.s */ Service.prototype.call = function (name, data, options) { return tslib.__awaiter(this, void 0, void 0, function () { var url, body, headers, context, timeout, _a, timer, failAfterPromise, response, error, responseData, decodedData; return tslib.__generator(this, function (_b) { switch (_b.label) { case 0: url = this._url(name); // Encode any special types, such as dates, in the input data. data = this.serializer.encode(data); body = { data: data }; headers = {}; return [4 /*yield*/, this.contextProvider.getContext()]; case 1: context = _b.sent(); if (context.authToken) { headers['Authorization'] = 'Bearer ' + context.authToken; } if (context.instanceIdToken) { headers['Firebase-Instance-ID-Token'] = context.instanceIdToken; } timeout = options.timeout || 70000; _a = failAfter(timeout), timer = _a.timer, failAfterPromise = _a.promise; return [4 /*yield*/, Promise.race([ clearTimeoutWrapper(timer, this.postJSON(url, body, headers)), failAfterPromise, clearTimeoutWrapper(timer, this.cancelAllRequests) ])]; case 2: response = _b.sent(); // If service was deleted, interrupted response throws an error. if (!response) { throw new HttpsErrorImpl('cancelled', 'Firebase Functions instance was deleted.'); } error = _errorForResponse(response.status, response.json, this.serializer); if (error) { throw error; } if (!response.json) { throw new HttpsErrorImpl('internal', 'Response is not valid JSON object.'); } responseData = response.json.data; // TODO(klimt): For right now, allow "result" instead of "data", for // backwards compatibility. if (typeof responseData === 'undefined') { responseData = response.json.result; } if (typeof responseData === 'undefined') { // Consider the response malformed. throw new HttpsErrorImpl('internal', 'Response is missing data field.'); } decodedData = this.serializer.decode(responseData); return [2 /*return*/, { data: decodedData }]; } }); }); }; return Service; }()); function clearTimeoutWrapper(timer, promise) { return tslib.__awaiter(this, void 0, void 0, function () { var result; return tslib.__generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, promise]; case 1: result = _a.sent(); // eslint-disable-next-line @typescript-eslint/no-explicit-any clearTimeout(timer); return [2 /*return*/, result]; } }); }); } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Type constant for Firebase Functions. */ var FUNCTIONS_TYPE = 'functions'; function registerFunctions(instance, fetchImpl) { var namespaceExports = { // no-inline Functions: Service }; function factory(container, regionOrCustomDomain) { // Dependencies var app = container.getProvider('app').getImmediate(); var authProvider = container.getProvider('auth-internal'); var messagingProvider = container.getProvider('messaging'); // eslint-disable-next-line @typescript-eslint/no-explicit-any return new Service(app, authProvider, messagingProvider, regionOrCustomDomain, fetchImpl); } instance.INTERNAL.registerComponent(new component.Component(FUNCTIONS_TYPE, factory, "PUBLIC" /* PUBLIC */) .setServiceProps(namespaceExports) .setMultipleInstances(true)); } var name = "@firebase/functions"; var version = "0.5.1"; /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ registerFunctions(firebase__default['default'], fetch.bind(self)); firebase__default['default'].registerVersion(name, version); //# sourceMappingURL=index.cjs.js.map /***/ }), /***/ "./node_modules/@firebase/functions/node_modules/@firebase/component/dist/index.cjs.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, '__esModule', { value: true }); var tslib = __webpack_require__("./node_modules/@firebase/functions/node_modules/tslib/tslib.es6.js"); var util = __webpack_require__("./node_modules/@firebase/functions/node_modules/@firebase/util/dist/index.cjs.js"); /** * Component for service name T, e.g. `auth`, `auth-internal` */ var Component = /** @class */ (function () { /** * * @param name The public service name, e.g. app, auth, firestore, database * @param instanceFactory Service factory responsible for creating the public interface * @param type whether the service provided by the component is public or private */ function Component(name, instanceFactory, type) { this.name = name; this.instanceFactory = instanceFactory; this.type = type; this.multipleInstances = false; /** * Properties to be added to the service namespace */ this.serviceProps = {}; this.instantiationMode = "LAZY" /* LAZY */; } Component.prototype.setInstantiationMode = function (mode) { this.instantiationMode = mode; return this; }; Component.prototype.setMultipleInstances = function (multipleInstances) { this.multipleInstances = multipleInstances; return this; }; Component.prototype.setServiceProps = function (props) { this.serviceProps = props; return this; }; return Component; }()); /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var DEFAULT_ENTRY_NAME = '[DEFAULT]'; /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Provider for instance for service name T, e.g. 'auth', 'auth-internal' * NameServiceMapping[T] is an alias for the type of the instance */ var Provider = /** @class */ (function () { function Provider(name, container) { this.name = name; this.container = container; this.component = null; this.instances = new Map(); this.instancesDeferred = new Map(); } /** * @param identifier A provider can provide mulitple instances of a service * if this.component.multipleInstances is true. */ Provider.prototype.get = function (identifier) { if (identifier === void 0) { identifier = DEFAULT_ENTRY_NAME; } // if multipleInstances is not supported, use the default name var normalizedIdentifier = this.normalizeInstanceIdentifier(identifier); if (!this.instancesDeferred.has(normalizedIdentifier)) { var deferred = new util.Deferred(); this.instancesDeferred.set(normalizedIdentifier, deferred); // If the service instance is available, resolve the promise with it immediately try { var instance = this.getOrInitializeService(normalizedIdentifier); if (instance) { deferred.resolve(instance); } } catch (e) { // when the instance factory throws an exception during get(), it should not cause // a fatal error. We just return the unresolved promise in this case. } } return this.instancesDeferred.get(normalizedIdentifier).promise; }; Provider.prototype.getImmediate = function (options) { var _a = tslib.__assign({ identifier: DEFAULT_ENTRY_NAME, optional: false }, options), identifier = _a.identifier, optional = _a.optional; // if multipleInstances is not supported, use the default name var normalizedIdentifier = this.normalizeInstanceIdentifier(identifier); try { var instance = this.getOrInitializeService(normalizedIdentifier); if (!instance) { if (optional) { return null; } throw Error("Service " + this.name + " is not available"); } return instance; } catch (e) { if (optional) { return null; } else { throw e; } } }; Provider.prototype.getComponent = function () { return this.component; }; Provider.prototype.setComponent = function (component) { var e_1, _a; if (component.name !== this.name) { throw Error("Mismatching Component " + component.name + " for Provider " + this.name + "."); } if (this.component) { throw Error("Component for " + this.name + " has already been provided"); } this.component = component; // if the service is eager, initialize the default instance if (isComponentEager(component)) { try { this.getOrInitializeService(DEFAULT_ENTRY_NAME); } catch (e) { // when the instance factory for an eager Component throws an exception during the eager // initialization, it should not cause a fatal error. // TODO: Investigate if we need to make it configurable, because some component may want to cause // a fatal error in this case? } } try { // Create service instances for the pending promises and resolve them // NOTE: if this.multipleInstances is false, only the default instance will be created // and all promises with resolve with it regardless of the identifier. for (var _b = tslib.__values(this.instancesDeferred.entries()), _c = _b.next(); !_c.done; _c = _b.next()) { var _d = tslib.__read(_c.value, 2), instanceIdentifier = _d[0], instanceDeferred = _d[1]; var normalizedIdentifier = this.normalizeInstanceIdentifier(instanceIdentifier); try { // `getOrInitializeService()` should always return a valid instance since a component is guaranteed. use ! to make typescript happy. var instance = this.getOrInitializeService(normalizedIdentifier); instanceDeferred.resolve(instance); } catch (e) { // when the instance factory throws an exception, it should not cause // a fatal error. We just leave the promise unresolved. } } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (_c && !_c.done && (_a = _b.return)) _a.call(_b); } finally { if (e_1) throw e_1.error; } } }; Provider.prototype.clearInstance = function (identifier) { if (identifier === void 0) { identifier = DEFAULT_ENTRY_NAME; } this.instancesDeferred.delete(identifier); this.instances.delete(identifier); }; // app.delete() will call this method on every provider to delete the services // TODO: should we mark the provider as deleted? Provider.prototype.delete = function () { return tslib.__awaiter(this, void 0, void 0, function () { var services; return tslib.__generator(this, function (_a) { switch (_a.label) { case 0: services = Array.from(this.instances.values()); return [4 /*yield*/, Promise.all(tslib.__spread(services .filter(function (service) { return 'INTERNAL' in service; }) // legacy services // eslint-disable-next-line @typescript-eslint/no-explicit-any .map(function (service) { return service.INTERNAL.delete(); }), services .filter(function (service) { return '_delete' in service; }) // modularized services // eslint-disable-next-line @typescript-eslint/no-explicit-any .map(function (service) { return service._delete(); })))]; case 1: _a.sent(); return [2 /*return*/]; } }); }); }; Provider.prototype.isComponentSet = function () { return this.component != null; }; Provider.prototype.getOrInitializeService = function (identifier) { var instance = this.instances.get(identifier); if (!instance && this.component) { instance = this.component.instanceFactory(this.container, normalizeIdentifierForFactory(identifier)); this.instances.set(identifier, instance); } return instance || null; }; Provider.prototype.normalizeInstanceIdentifier = function (identifier) { if (this.component) { return this.component.multipleInstances ? identifier : DEFAULT_ENTRY_NAME; } else { return identifier; // assume multiple instances are supported before the component is provided. } }; return Provider; }()); // undefined should be passed to the service factory for the default instance function normalizeIdentifierForFactory(identifier) { return identifier === DEFAULT_ENTRY_NAME ? undefined : identifier; } function isComponentEager(component) { return component.instantiationMode === "EAGER" /* EAGER */; } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * ComponentContainer that provides Providers for service name T, e.g. `auth`, `auth-internal` */ var ComponentContainer = /** @class */ (function () { function ComponentContainer(name) { this.name = name; this.providers = new Map(); } /** * * @param component Component being added * @param overwrite When a component with the same name has already been registered, * if overwrite is true: overwrite the existing component with the new component and create a new * provider with the new component. It can be useful in tests where you want to use different mocks * for different tests. * if overwrite is false: throw an exception */ ComponentContainer.prototype.addComponent = function (component) { var provider = this.getProvider(component.name); if (provider.isComponentSet()) { throw new Error("Component " + component.name + " has already been registered with " + this.name); } provider.setComponent(component); }; ComponentContainer.prototype.addOrOverwriteComponent = function (component) { var provider = this.getProvider(component.name); if (provider.isComponentSet()) { // delete the existing provider from the container, so we can register the new component this.providers.delete(component.name); } this.addComponent(component); }; /** * getProvider provides a type safe interface where it can only be called with a field name * present in NameServiceMapping interface. * * Firebase SDKs providing services should extend NameServiceMapping interface to register * themselves. */ ComponentContainer.prototype.getProvider = function (name) { if (this.providers.has(name)) { return this.providers.get(name); } // create a Provider for a service that hasn't registered with Firebase var provider = new Provider(name, this); this.providers.set(name, provider); return provider; }; ComponentContainer.prototype.getProviders = function () { return Array.from(this.providers.values()); }; return ComponentContainer; }()); exports.Component = Component; exports.ComponentContainer = ComponentContainer; exports.Provider = Provider; //# sourceMappingURL=index.cjs.js.map /***/ }), /***/ "./node_modules/@firebase/functions/node_modules/@firebase/util/dist/index.cjs.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(global) { Object.defineProperty(exports, '__esModule', { value: true }); var tslib = __webpack_require__("./node_modules/@firebase/functions/node_modules/tslib/tslib.es6.js"); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * @fileoverview Firebase constants. Some of these (@defines) can be overridden at compile-time. */ var CONSTANTS = { /** * @define {boolean} Whether this is the client Node.js SDK. */ NODE_CLIENT: false, /** * @define {boolean} Whether this is the Admin Node.js SDK. */ NODE_ADMIN: false, /** * Firebase SDK Version */ SDK_VERSION: '${JSCORE_VERSION}' }; /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Throws an error if the provided assertion is falsy */ var assert = function (assertion, message) { if (!assertion) { throw assertionError(message); } }; /** * Returns an Error object suitable for throwing. */ var assertionError = function (message) { return new Error('Firebase Database (' + CONSTANTS.SDK_VERSION + ') INTERNAL ASSERT FAILED: ' + message); }; /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var stringToByteArray = function (str) { // TODO(user): Use native implementations if/when available var out = []; var p = 0; for (var i = 0; i < str.length; i++) { var c = str.charCodeAt(i); if (c < 128) { out[p++] = c; } else if (c < 2048) { out[p++] = (c >> 6) | 192; out[p++] = (c & 63) | 128; } else if ((c & 0xfc00) === 0xd800 && i + 1 < str.length && (str.charCodeAt(i + 1) & 0xfc00) === 0xdc00) { // Surrogate Pair c = 0x10000 + ((c & 0x03ff) << 10) + (str.charCodeAt(++i) & 0x03ff); out[p++] = (c >> 18) | 240; out[p++] = ((c >> 12) & 63) | 128; out[p++] = ((c >> 6) & 63) | 128; out[p++] = (c & 63) | 128; } else { out[p++] = (c >> 12) | 224; out[p++] = ((c >> 6) & 63) | 128; out[p++] = (c & 63) | 128; } } return out; }; /** * Turns an array of numbers into the string given by the concatenation of the * characters to which the numbers correspond. * @param bytes Array of numbers representing characters. * @return Stringification of the array. */ var byteArrayToString = function (bytes) { // TODO(user): Use native implementations if/when available var out = []; var pos = 0, c = 0; while (pos < bytes.length) { var c1 = bytes[pos++]; if (c1 < 128) { out[c++] = String.fromCharCode(c1); } else if (c1 > 191 && c1 < 224) { var c2 = bytes[pos++]; out[c++] = String.fromCharCode(((c1 & 31) << 6) | (c2 & 63)); } else if (c1 > 239 && c1 < 365) { // Surrogate Pair var c2 = bytes[pos++]; var c3 = bytes[pos++]; var c4 = bytes[pos++]; var u = (((c1 & 7) << 18) | ((c2 & 63) << 12) | ((c3 & 63) << 6) | (c4 & 63)) - 0x10000; out[c++] = String.fromCharCode(0xd800 + (u >> 10)); out[c++] = String.fromCharCode(0xdc00 + (u & 1023)); } else { var c2 = bytes[pos++]; var c3 = bytes[pos++]; out[c++] = String.fromCharCode(((c1 & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63)); } } return out.join(''); }; // We define it as an object literal instead of a class because a class compiled down to es5 can't // be treeshaked. https://github.com/rollup/rollup/issues/1691 // Static lookup maps, lazily populated by init_() var base64 = { /** * Maps bytes to characters. */ byteToCharMap_: null, /** * Maps characters to bytes. */ charToByteMap_: null, /** * Maps bytes to websafe characters. * @private */ byteToCharMapWebSafe_: null, /** * Maps websafe characters to bytes. * @private */ charToByteMapWebSafe_: null, /** * Our default alphabet, shared between * ENCODED_VALS and ENCODED_VALS_WEBSAFE */ ENCODED_VALS_BASE: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' + 'abcdefghijklmnopqrstuvwxyz' + '0123456789', /** * Our default alphabet. Value 64 (=) is special; it means "nothing." */ get ENCODED_VALS() { return this.ENCODED_VALS_BASE + '+/='; }, /** * Our websafe alphabet. */ get ENCODED_VALS_WEBSAFE() { return this.ENCODED_VALS_BASE + '-_.'; }, /** * Whether this browser supports the atob and btoa functions. This extension * started at Mozilla but is now implemented by many browsers. We use the * ASSUME_* variables to avoid pulling in the full useragent detection library * but still allowing the standard per-browser compilations. * */ HAS_NATIVE_SUPPORT: typeof atob === 'function', /** * Base64-encode an array of bytes. * * @param input An array of bytes (numbers with * value in [0, 255]) to encode. * @param webSafe Boolean indicating we should use the * alternative alphabet. * @return The base64 encoded string. */ encodeByteArray: function (input, webSafe) { if (!Array.isArray(input)) { throw Error('encodeByteArray takes an array as a parameter'); } this.init_(); var byteToCharMap = webSafe ? this.byteToCharMapWebSafe_ : this.byteToCharMap_; var output = []; for (var i = 0; i < input.length; i += 3) { var byte1 = input[i]; var haveByte2 = i + 1 < input.length; var byte2 = haveByte2 ? input[i + 1] : 0; var haveByte3 = i + 2 < input.length; var byte3 = haveByte3 ? input[i + 2] : 0; var outByte1 = byte1 >> 2; var outByte2 = ((byte1 & 0x03) << 4) | (byte2 >> 4); var outByte3 = ((byte2 & 0x0f) << 2) | (byte3 >> 6); var outByte4 = byte3 & 0x3f; if (!haveByte3) { outByte4 = 64; if (!haveByte2) { outByte3 = 64; } } output.push(byteToCharMap[outByte1], byteToCharMap[outByte2], byteToCharMap[outByte3], byteToCharMap[outByte4]); } return output.join(''); }, /** * Base64-encode a string. * * @param input A string to encode. * @param webSafe If true, we should use the * alternative alphabet. * @return The base64 encoded string. */ encodeString: function (input, webSafe) { // Shortcut for Mozilla browsers that implement // a native base64 encoder in the form of "btoa/atob" if (this.HAS_NATIVE_SUPPORT && !webSafe) { return btoa(input); } return this.encodeByteArray(stringToByteArray(input), webSafe); }, /** * Base64-decode a string. * * @param input to decode. * @param webSafe True if we should use the * alternative alphabet. * @return string representing the decoded value. */ decodeString: function (input, webSafe) { // Shortcut for Mozilla browsers that implement // a native base64 encoder in the form of "btoa/atob" if (this.HAS_NATIVE_SUPPORT && !webSafe) { return atob(input); } return byteArrayToString(this.decodeStringToByteArray(input, webSafe)); }, /** * Base64-decode a string. * * In base-64 decoding, groups of four characters are converted into three * bytes. If the encoder did not apply padding, the input length may not * be a multiple of 4. * * In this case, the last group will have fewer than 4 characters, and * padding will be inferred. If the group has one or two characters, it decodes * to one byte. If the group has three characters, it decodes to two bytes. * * @param input Input to decode. * @param webSafe True if we should use the web-safe alphabet. * @return bytes representing the decoded value. */ decodeStringToByteArray: function (input, webSafe) { this.init_(); var charToByteMap = webSafe ? this.charToByteMapWebSafe_ : this.charToByteMap_; var output = []; for (var i = 0; i < input.length;) { var byte1 = charToByteMap[input.charAt(i++)]; var haveByte2 = i < input.length; var byte2 = haveByte2 ? charToByteMap[input.charAt(i)] : 0; ++i; var haveByte3 = i < input.length; var byte3 = haveByte3 ? charToByteMap[input.charAt(i)] : 64; ++i; var haveByte4 = i < input.length; var byte4 = haveByte4 ? charToByteMap[input.charAt(i)] : 64; ++i; if (byte1 == null || byte2 == null || byte3 == null || byte4 == null) { throw Error(); } var outByte1 = (byte1 << 2) | (byte2 >> 4); output.push(outByte1); if (byte3 !== 64) { var outByte2 = ((byte2 << 4) & 0xf0) | (byte3 >> 2); output.push(outByte2); if (byte4 !== 64) { var outByte3 = ((byte3 << 6) & 0xc0) | byte4; output.push(outByte3); } } } return output; }, /** * Lazy static initialization function. Called before * accessing any of the static map variables. * @private */ init_: function () { if (!this.byteToCharMap_) { this.byteToCharMap_ = {}; this.charToByteMap_ = {}; this.byteToCharMapWebSafe_ = {}; this.charToByteMapWebSafe_ = {}; // We want quick mappings back and forth, so we precompute two maps. for (var i = 0; i < this.ENCODED_VALS.length; i++) { this.byteToCharMap_[i] = this.ENCODED_VALS.charAt(i); this.charToByteMap_[this.byteToCharMap_[i]] = i; this.byteToCharMapWebSafe_[i] = this.ENCODED_VALS_WEBSAFE.charAt(i); this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[i]] = i; // Be forgiving when decoding and correctly decode both encodings. if (i >= this.ENCODED_VALS_BASE.length) { this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(i)] = i; this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(i)] = i; } } } } }; /** * URL-safe base64 encoding */ var base64Encode = function (str) { var utf8Bytes = stringToByteArray(str); return base64.encodeByteArray(utf8Bytes, true); }; /** * URL-safe base64 decoding * * NOTE: DO NOT use the global atob() function - it does NOT support the * base64Url variant encoding. * * @param str To be decoded * @return Decoded result, if possible */ var base64Decode = function (str) { try { return base64.decodeString(str, true); } catch (e) { console.error('base64Decode failed: ', e); } return null; }; /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Do a deep-copy of basic JavaScript Objects or Arrays. */ function deepCopy(value) { return deepExtend(undefined, value); } /** * Copy properties from source to target (recursively allows extension * of Objects and Arrays). Scalar values in the target are over-written. * If target is undefined, an object of the appropriate type will be created * (and returned). * * We recursively copy all child properties of plain Objects in the source- so * that namespace- like dictionaries are merged. * * Note that the target can be a function, in which case the properties in * the source Object are copied onto it as static properties of the Function. */ function deepExtend(target, source) { if (!(source instanceof Object)) { return source; } switch (source.constructor) { case Date: // Treat Dates like scalars; if the target date object had any child // properties - they will be lost! var dateValue = source; return new Date(dateValue.getTime()); case Object: if (target === undefined) { target = {}; } break; case Array: // Always copy the array source and overwrite the target. target = []; break; default: // Not a plain Object - treat it as a scalar. return source; } for (var prop in source) { if (!source.hasOwnProperty(prop)) { continue; } target[prop] = deepExtend(target[prop], source[prop]); } return target; } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var Deferred = /** @class */ (function () { function Deferred() { var _this = this; this.reject = function () { }; this.resolve = function () { }; this.promise = new Promise(function (resolve, reject) { _this.resolve = resolve; _this.reject = reject; }); } /** * Our API internals are not promiseified and cannot because our callback APIs have subtle expectations around * invoking promises inline, which Promises are forbidden to do. This method accepts an optional node-style callback * and returns a node-style callback which will resolve or reject the Deferred's promise. */ Deferred.prototype.wrapCallback = function (callback) { var _this = this; return function (error, value) { if (error) { _this.reject(error); } else { _this.resolve(value); } if (typeof callback === 'function') { // Attaching noop handler just in case developer wasn't expecting // promises _this.promise.catch(function () { }); // Some of our callbacks don't expect a value and our own tests // assert that the parameter length is 1 if (callback.length === 1) { callback(error); } else { callback(error, value); } } }; }; return Deferred; }()); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Returns navigator.userAgent string or '' if it's not defined. * @return user agent string */ function getUA() { if (typeof navigator !== 'undefined' && typeof navigator['userAgent'] === 'string') { return navigator['userAgent']; } else { return ''; } } /** * Detect Cordova / PhoneGap / Ionic frameworks on a mobile device. * * Deliberately does not rely on checking `file://` URLs (as this fails PhoneGap * in the Ripple emulator) nor Cordova `onDeviceReady`, which would normally * wait for a callback. */ function isMobileCordova() { return (typeof window !== 'undefined' && // @ts-ignore Setting up an broadly applicable index signature for Window // just to deal with this case would probably be a bad idea. !!(window['cordova'] || window['phonegap'] || window['PhoneGap']) && /ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(getUA())); } /** * Detect Node.js. * * @return true if Node.js environment is detected. */ // Node detection logic from: https://github.com/iliakan/detect-node/ function isNode() { try { return (Object.prototype.toString.call(global.process) === '[object process]'); } catch (e) { return false; } } /** * Detect Browser Environment */ function isBrowser() { return typeof self === 'object' && self.self === self; } function isBrowserExtension() { var runtime = typeof chrome === 'object' ? chrome.runtime : typeof browser === 'object' ? browser.runtime : undefined; return typeof runtime === 'object' && runtime.id !== undefined; } /** * Detect React Native. * * @return true if ReactNative environment is detected. */ function isReactNative() { return (typeof navigator === 'object' && navigator['product'] === 'ReactNative'); } /** Detects Electron apps. */ function isElectron() { return getUA().indexOf('Electron/') >= 0; } /** Detects Internet Explorer. */ function isIE() { var ua = getUA(); return ua.indexOf('MSIE ') >= 0 || ua.indexOf('Trident/') >= 0; } /** Detects Universal Windows Platform apps. */ function isUWP() { return getUA().indexOf('MSAppHost/') >= 0; } /** * Detect whether the current SDK build is the Node version. * * @return true if it's the Node SDK build. */ function isNodeSdk() { return CONSTANTS.NODE_CLIENT === true || CONSTANTS.NODE_ADMIN === true; } /** Returns true if we are running in Safari. */ function isSafari() { return (!isNode() && navigator.userAgent.includes('Safari') && !navigator.userAgent.includes('Chrome')); } /** * This method checks if indexedDB is supported by current browser/service worker context * @return true if indexedDB is supported by current browser/service worker context */ function isIndexedDBAvailable() { return 'indexedDB' in self && indexedDB != null; } /** * This method validates browser context for indexedDB by opening a dummy indexedDB database and reject * if errors occur during the database open operation. */ function validateIndexedDBOpenable() { return new Promise(function (resolve, reject) { try { var preExist_1 = true; var DB_CHECK_NAME_1 = 'validate-browser-context-for-indexeddb-analytics-module'; var request_1 = window.indexedDB.open(DB_CHECK_NAME_1); request_1.onsuccess = function () { request_1.result.close(); // delete database only when it doesn't pre-exist if (!preExist_1) { window.indexedDB.deleteDatabase(DB_CHECK_NAME_1); } resolve(true); }; request_1.onupgradeneeded = function () { preExist_1 = false; }; request_1.onerror = function () { var _a; reject(((_a = request_1.error) === null || _a === void 0 ? void 0 : _a.message) || ''); }; } catch (error) { reject(error); } }); } /** * * This method checks whether cookie is enabled within current browser * @return true if cookie is enabled within current browser */ function areCookiesEnabled() { if (!navigator || !navigator.cookieEnabled) { return false; } return true; } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var ERROR_NAME = 'FirebaseError'; // Based on code from: // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error#Custom_Error_Types var FirebaseError = /** @class */ (function (_super) { tslib.__extends(FirebaseError, _super); function FirebaseError(code, message) { var _this = _super.call(this, message) || this; _this.code = code; _this.name = ERROR_NAME; // Fix For ES5 // https://github.com/Microsoft/TypeScript-wiki/blob/master/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work Object.setPrototypeOf(_this, FirebaseError.prototype); // Maintains proper stack trace for where our error was thrown. // Only available on V8. if (Error.captureStackTrace) { Error.captureStackTrace(_this, ErrorFactory.prototype.create); } return _this; } return FirebaseError; }(Error)); var ErrorFactory = /** @class */ (function () { function ErrorFactory(service, serviceName, errors) { this.service = service; this.serviceName = serviceName; this.errors = errors; } ErrorFactory.prototype.create = function (code) { var data = []; for (var _i = 1; _i < arguments.length; _i++) { data[_i - 1] = arguments[_i]; } var customData = data[0] || {}; var fullCode = this.service + "/" + code; var template = this.errors[code]; var message = template ? replaceTemplate(template, customData) : 'Error'; // Service Name: Error message (service/code). var fullMessage = this.serviceName + ": " + message + " (" + fullCode + ")."; var error = new FirebaseError(fullCode, fullMessage); // Keys with an underscore at the end of their name are not included in // error.data for some reason. // TODO: Replace with Object.entries when lib is updated to es2017. for (var _a = 0, _b = Object.keys(customData); _a < _b.length; _a++) { var key = _b[_a]; if (key.slice(-1) !== '_') { if (key in error) { console.warn("Overwriting FirebaseError base field \"" + key + "\" can cause unexpected behavior."); } error[key] = customData[key]; } } return error; }; return ErrorFactory; }()); function replaceTemplate(template, data) { return template.replace(PATTERN, function (_, key) { var value = data[key]; return value != null ? String(value) : "<" + key + "?>"; }); } var PATTERN = /\{\$([^}]+)}/g; /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Evaluates a JSON string into a javascript object. * * @param {string} str A string containing JSON. * @return {*} The javascript object representing the specified JSON. */ function jsonEval(str) { return JSON.parse(str); } /** * Returns JSON representing a javascript object. * @param {*} data Javascript object to be stringified. * @return {string} The JSON contents of the object. */ function stringify(data) { return JSON.stringify(data); } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Decodes a Firebase auth. token into constituent parts. * * Notes: * - May return with invalid / incomplete claims if there's no native base64 decoding support. * - Doesn't check if the token is actually valid. */ var decode = function (token) { var header = {}, claims = {}, data = {}, signature = ''; try { var parts = token.split('.'); header = jsonEval(base64Decode(parts[0]) || ''); claims = jsonEval(base64Decode(parts[1]) || ''); signature = parts[2]; data = claims['d'] || {}; delete claims['d']; } catch (e) { } return { header: header, claims: claims, data: data, signature: signature }; }; /** * Decodes a Firebase auth. token and checks the validity of its time-based claims. Will return true if the * token is within the time window authorized by the 'nbf' (not-before) and 'iat' (issued-at) claims. * * Notes: * - May return a false negative if there's no native base64 decoding support. * - Doesn't check if the token is actually valid. */ var isValidTimestamp = function (token) { var claims = decode(token).claims; var now = Math.floor(new Date().getTime() / 1000); var validSince = 0, validUntil = 0; if (typeof claims === 'object') { if (claims.hasOwnProperty('nbf')) { validSince = claims['nbf']; } else if (claims.hasOwnProperty('iat')) { validSince = claims['iat']; } if (claims.hasOwnProperty('exp')) { validUntil = claims['exp']; } else { // token will expire after 24h by default validUntil = validSince + 86400; } } return (!!now && !!validSince && !!validUntil && now >= validSince && now <= validUntil); }; /** * Decodes a Firebase auth. token and returns its issued at time if valid, null otherwise. * * Notes: * - May return null if there's no native base64 decoding support. * - Doesn't check if the token is actually valid. */ var issuedAtTime = function (token) { var claims = decode(token).claims; if (typeof claims === 'object' && claims.hasOwnProperty('iat')) { return claims['iat']; } return null; }; /** * Decodes a Firebase auth. token and checks the validity of its format. Expects a valid issued-at time. * * Notes: * - May return a false negative if there's no native base64 decoding support. * - Doesn't check if the token is actually valid. */ var isValidFormat = function (token) { var decoded = decode(token), claims = decoded.claims; return !!claims && typeof claims === 'object' && claims.hasOwnProperty('iat'); }; /** * Attempts to peer into an auth token and determine if it's an admin auth token by looking at the claims portion. * * Notes: * - May return a false negative if there's no native base64 decoding support. * - Doesn't check if the token is actually valid. */ var isAdmin = function (token) { var claims = decode(token).claims; return typeof claims === 'object' && claims['admin'] === true; }; /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ function contains(obj, key) { return Object.prototype.hasOwnProperty.call(obj, key); } function safeGet(obj, key) { if (Object.prototype.hasOwnProperty.call(obj, key)) { return obj[key]; } else { return undefined; } } function isEmpty(obj) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { return false; } } return true; } function map(obj, fn, contextObj) { var res = {}; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { res[key] = fn.call(contextObj, obj[key], key, obj); } } return res; } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Returns a querystring-formatted string (e.g. &arg=val&arg2=val2) from a * params object (e.g. {arg: 'val', arg2: 'val2'}) * Note: You must prepend it with ? when adding it to a URL. */ function querystring(querystringParams) { var params = []; var _loop_1 = function (key, value) { if (Array.isArray(value)) { value.forEach(function (arrayVal) { params.push(encodeURIComponent(key) + '=' + encodeURIComponent(arrayVal)); }); } else { params.push(encodeURIComponent(key) + '=' + encodeURIComponent(value)); } }; for (var _i = 0, _a = Object.entries(querystringParams); _i < _a.length; _i++) { var _b = _a[_i], key = _b[0], value = _b[1]; _loop_1(key, value); } return params.length ? '&' + params.join('&') : ''; } /** * Decodes a querystring (e.g. ?arg=val&arg2=val2) into a params object * (e.g. {arg: 'val', arg2: 'val2'}) */ function querystringDecode(querystring) { var obj = {}; var tokens = querystring.replace(/^\?/, '').split('&'); tokens.forEach(function (token) { if (token) { var key = token.split('='); obj[key[0]] = key[1]; } }); return obj; } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * @fileoverview SHA-1 cryptographic hash. * Variable names follow the notation in FIPS PUB 180-3: * http://csrc.nist.gov/publications/fips/fips180-3/fips180-3_final.pdf. * * Usage: * var sha1 = new sha1(); * sha1.update(bytes); * var hash = sha1.digest(); * * Performance: * Chrome 23: ~400 Mbit/s * Firefox 16: ~250 Mbit/s * */ /** * SHA-1 cryptographic hash constructor. * * The properties declared here are discussed in the above algorithm document. * @constructor * @final * @struct */ var Sha1 = /** @class */ (function () { function Sha1() { /** * Holds the previous values of accumulated variables a-e in the compress_ * function. * @private */ this.chain_ = []; /** * A buffer holding the partially computed hash result. * @private */ this.buf_ = []; /** * An array of 80 bytes, each a part of the message to be hashed. Referred to * as the message schedule in the docs. * @private */ this.W_ = []; /** * Contains data needed to pad messages less than 64 bytes. * @private */ this.pad_ = []; /** * @private {number} */ this.inbuf_ = 0; /** * @private {number} */ this.total_ = 0; this.blockSize = 512 / 8; this.pad_[0] = 128; for (var i = 1; i < this.blockSize; ++i) { this.pad_[i] = 0; } this.reset(); } Sha1.prototype.reset = function () { this.chain_[0] = 0x67452301; this.chain_[1] = 0xefcdab89; this.chain_[2] = 0x98badcfe; this.chain_[3] = 0x10325476; this.chain_[4] = 0xc3d2e1f0; this.inbuf_ = 0; this.total_ = 0; }; /** * Internal compress helper function. * @param buf Block to compress. * @param offset Offset of the block in the buffer. * @private */ Sha1.prototype.compress_ = function (buf, offset) { if (!offset) { offset = 0; } var W = this.W_; // get 16 big endian words if (typeof buf === 'string') { for (var i = 0; i < 16; i++) { // TODO(user): [bug 8140122] Recent versions of Safari for Mac OS and iOS // have a bug that turns the post-increment ++ operator into pre-increment // during JIT compilation. We have code that depends heavily on SHA-1 for // correctness and which is affected by this bug, so I've removed all uses // of post-increment ++ in which the result value is used. We can revert // this change once the Safari bug // (https://bugs.webkit.org/show_bug.cgi?id=109036) has been fixed and // most clients have been updated. W[i] = (buf.charCodeAt(offset) << 24) | (buf.charCodeAt(offset + 1) << 16) | (buf.charCodeAt(offset + 2) << 8) | buf.charCodeAt(offset + 3); offset += 4; } } else { for (var i = 0; i < 16; i++) { W[i] = (buf[offset] << 24) | (buf[offset + 1] << 16) | (buf[offset + 2] << 8) | buf[offset + 3]; offset += 4; } } // expand to 80 words for (var i = 16; i < 80; i++) { var t = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16]; W[i] = ((t << 1) | (t >>> 31)) & 0xffffffff; } var a = this.chain_[0]; var b = this.chain_[1]; var c = this.chain_[2]; var d = this.chain_[3]; var e = this.chain_[4]; var f, k; // TODO(user): Try to unroll this loop to speed up the computation. for (var i = 0; i < 80; i++) { if (i < 40) { if (i < 20) { f = d ^ (b & (c ^ d)); k = 0x5a827999; } else { f = b ^ c ^ d; k = 0x6ed9eba1; } } else { if (i < 60) { f = (b & c) | (d & (b | c)); k = 0x8f1bbcdc; } else { f = b ^ c ^ d; k = 0xca62c1d6; } } var t = (((a << 5) | (a >>> 27)) + f + e + k + W[i]) & 0xffffffff; e = d; d = c; c = ((b << 30) | (b >>> 2)) & 0xffffffff; b = a; a = t; } this.chain_[0] = (this.chain_[0] + a) & 0xffffffff; this.chain_[1] = (this.chain_[1] + b) & 0xffffffff; this.chain_[2] = (this.chain_[2] + c) & 0xffffffff; this.chain_[3] = (this.chain_[3] + d) & 0xffffffff; this.chain_[4] = (this.chain_[4] + e) & 0xffffffff; }; Sha1.prototype.update = function (bytes, length) { // TODO(johnlenz): tighten the function signature and remove this check if (bytes == null) { return; } if (length === undefined) { length = bytes.length; } var lengthMinusBlock = length - this.blockSize; var n = 0; // Using local instead of member variables gives ~5% speedup on Firefox 16. var buf = this.buf_; var inbuf = this.inbuf_; // The outer while loop should execute at most twice. while (n < length) { // When we have no data in the block to top up, we can directly process the // input buffer (assuming it contains sufficient data). This gives ~25% // speedup on Chrome 23 and ~15% speedup on Firefox 16, but requires that // the data is provided in large chunks (or in multiples of 64 bytes). if (inbuf === 0) { while (n <= lengthMinusBlock) { this.compress_(bytes, n); n += this.blockSize; } } if (typeof bytes === 'string') { while (n < length) { buf[inbuf] = bytes.charCodeAt(n); ++inbuf; ++n; if (inbuf === this.blockSize) { this.compress_(buf); inbuf = 0; // Jump to the outer loop so we use the full-block optimization. break; } } } else { while (n < length) { buf[inbuf] = bytes[n]; ++inbuf; ++n; if (inbuf === this.blockSize) { this.compress_(buf); inbuf = 0; // Jump to the outer loop so we use the full-block optimization. break; } } } } this.inbuf_ = inbuf; this.total_ += length; }; /** @override */ Sha1.prototype.digest = function () { var digest = []; var totalBits = this.total_ * 8; // Add pad 0x80 0x00*. if (this.inbuf_ < 56) { this.update(this.pad_, 56 - this.inbuf_); } else { this.update(this.pad_, this.blockSize - (this.inbuf_ - 56)); } // Add # bits. for (var i = this.blockSize - 1; i >= 56; i--) { this.buf_[i] = totalBits & 255; totalBits /= 256; // Don't use bit-shifting here! } this.compress_(this.buf_); var n = 0; for (var i = 0; i < 5; i++) { for (var j = 24; j >= 0; j -= 8) { digest[n] = (this.chain_[i] >> j) & 255; ++n; } } return digest; }; return Sha1; }()); /** * Helper to make a Subscribe function (just like Promise helps make a * Thenable). * * @param executor Function which can make calls to a single Observer * as a proxy. * @param onNoObservers Callback when count of Observers goes to zero. */ function createSubscribe(executor, onNoObservers) { var proxy = new ObserverProxy(executor, onNoObservers); return proxy.subscribe.bind(proxy); } /** * Implement fan-out for any number of Observers attached via a subscribe * function. */ var ObserverProxy = /** @class */ (function () { /** * @param executor Function which can make calls to a single Observer * as a proxy. * @param onNoObservers Callback when count of Observers goes to zero. */ function ObserverProxy(executor, onNoObservers) { var _this = this; this.observers = []; this.unsubscribes = []; this.observerCount = 0; // Micro-task scheduling by calling task.then(). this.task = Promise.resolve(); this.finalized = false; this.onNoObservers = onNoObservers; // Call the executor asynchronously so subscribers that are called // synchronously after the creation of the subscribe function // can still receive the very first value generated in the executor. this.task .then(function () { executor(_this); }) .catch(function (e) { _this.error(e); }); } ObserverProxy.prototype.next = function (value) { this.forEachObserver(function (observer) { observer.next(value); }); }; ObserverProxy.prototype.error = function (error) { this.forEachObserver(function (observer) { observer.error(error); }); this.close(error); }; ObserverProxy.prototype.complete = function () { this.forEachObserver(function (observer) { observer.complete(); }); this.close(); }; /** * Subscribe function that can be used to add an Observer to the fan-out list. * * - We require that no event is sent to a subscriber sychronously to their * call to subscribe(). */ ObserverProxy.prototype.subscribe = function (nextOrObserver, error, complete) { var _this = this; var observer; if (nextOrObserver === undefined && error === undefined && complete === undefined) { throw new Error('Missing Observer.'); } // Assemble an Observer object when passed as callback functions. if (implementsAnyMethods(nextOrObserver, [ 'next', 'error', 'complete' ])) { observer = nextOrObserver; } else { observer = { next: nextOrObserver, error: error, complete: complete }; } if (observer.next === undefined) { observer.next = noop; } if (observer.error === undefined) { observer.error = noop; } if (observer.complete === undefined) { observer.complete = noop; } var unsub = this.unsubscribeOne.bind(this, this.observers.length); // Attempt to subscribe to a terminated Observable - we // just respond to the Observer with the final error or complete // event. if (this.finalized) { // eslint-disable-next-line @typescript-eslint/no-floating-promises this.task.then(function () { try { if (_this.finalError) { observer.error(_this.finalError); } else { observer.complete(); } } catch (e) { // nothing } return; }); } this.observers.push(observer); return unsub; }; // Unsubscribe is synchronous - we guarantee that no events are sent to // any unsubscribed Observer. ObserverProxy.prototype.unsubscribeOne = function (i) { if (this.observers === undefined || this.observers[i] === undefined) { return; } delete this.observers[i]; this.observerCount -= 1; if (this.observerCount === 0 && this.onNoObservers !== undefined) { this.onNoObservers(this); } }; ObserverProxy.prototype.forEachObserver = function (fn) { if (this.finalized) { // Already closed by previous event....just eat the additional values. return; } // Since sendOne calls asynchronously - there is no chance that // this.observers will become undefined. for (var i = 0; i < this.observers.length; i++) { this.sendOne(i, fn); } }; // Call the Observer via one of it's callback function. We are careful to // confirm that the observe has not been unsubscribed since this asynchronous // function had been queued. ObserverProxy.prototype.sendOne = function (i, fn) { var _this = this; // Execute the callback asynchronously // eslint-disable-next-line @typescript-eslint/no-floating-promises this.task.then(function () { if (_this.observers !== undefined && _this.observers[i] !== undefined) { try { fn(_this.observers[i]); } catch (e) { // Ignore exceptions raised in Observers or missing methods of an // Observer. // Log error to console. b/31404806 if (typeof console !== 'undefined' && console.error) { console.error(e); } } } }); }; ObserverProxy.prototype.close = function (err) { var _this = this; if (this.finalized) { return; } this.finalized = true; if (err !== undefined) { this.finalError = err; } // Proxy is no longer needed - garbage collect references // eslint-disable-next-line @typescript-eslint/no-floating-promises this.task.then(function () { _this.observers = undefined; _this.onNoObservers = undefined; }); }; return ObserverProxy; }()); /** Turn synchronous function into one called asynchronously. */ // eslint-disable-next-line @typescript-eslint/ban-types function async(fn, onError) { return function () { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } Promise.resolve(true) .then(function () { fn.apply(void 0, args); }) .catch(function (error) { if (onError) { onError(error); } }); }; } /** * Return true if the object passed in implements any of the named methods. */ function implementsAnyMethods(obj, methods) { if (typeof obj !== 'object' || obj === null) { return false; } for (var _i = 0, methods_1 = methods; _i < methods_1.length; _i++) { var method = methods_1[_i]; if (method in obj && typeof obj[method] === 'function') { return true; } } return false; } function noop() { // do nothing } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Check to make sure the appropriate number of arguments are provided for a public function. * Throws an error if it fails. * * @param fnName The function name * @param minCount The minimum number of arguments to allow for the function call * @param maxCount The maximum number of argument to allow for the function call * @param argCount The actual number of arguments provided. */ var validateArgCount = function (fnName, minCount, maxCount, argCount) { var argError; if (argCount < minCount) { argError = 'at least ' + minCount; } else if (argCount > maxCount) { argError = maxCount === 0 ? 'none' : 'no more than ' + maxCount; } if (argError) { var error = fnName + ' failed: Was called with ' + argCount + (argCount === 1 ? ' argument.' : ' arguments.') + ' Expects ' + argError + '.'; throw new Error(error); } }; /** * Generates a string to prefix an error message about failed argument validation * * @param fnName The function name * @param argumentNumber The index of the argument * @param optional Whether or not the argument is optional * @return The prefix to add to the error thrown for validation. */ function errorPrefix(fnName, argumentNumber, optional) { var argName = ''; switch (argumentNumber) { case 1: argName = optional ? 'first' : 'First'; break; case 2: argName = optional ? 'second' : 'Second'; break; case 3: argName = optional ? 'third' : 'Third'; break; case 4: argName = optional ? 'fourth' : 'Fourth'; break; default: throw new Error('errorPrefix called with argumentNumber > 4. Need to update it?'); } var error = fnName + ' failed: '; error += argName + ' argument '; return error; } /** * @param fnName * @param argumentNumber * @param namespace * @param optional */ function validateNamespace(fnName, argumentNumber, namespace, optional) { if (optional && !namespace) { return; } if (typeof namespace !== 'string') { //TODO: I should do more validation here. We only allow certain chars in namespaces. throw new Error(errorPrefix(fnName, argumentNumber, optional) + 'must be a valid firebase namespace.'); } } function validateCallback(fnName, argumentNumber, // eslint-disable-next-line @typescript-eslint/ban-types callback, optional) { if (optional && !callback) { return; } if (typeof callback !== 'function') { throw new Error(errorPrefix(fnName, argumentNumber, optional) + 'must be a valid function.'); } } function validateContextObject(fnName, argumentNumber, context, optional) { if (optional && !context) { return; } if (typeof context !== 'object' || context === null) { throw new Error(errorPrefix(fnName, argumentNumber, optional) + 'must be a valid context object.'); } } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // Code originally came from goog.crypt.stringToUtf8ByteArray, but for some reason they // automatically replaced '\r\n' with '\n', and they didn't handle surrogate pairs, // so it's been modified. // Note that not all Unicode characters appear as single characters in JavaScript strings. // fromCharCode returns the UTF-16 encoding of a character - so some Unicode characters // use 2 characters in Javascript. All 4-byte UTF-8 characters begin with a first // character in the range 0xD800 - 0xDBFF (the first character of a so-called surrogate // pair). // See http://www.ecma-international.org/ecma-262/5.1/#sec-15.1.3 /** * @param {string} str * @return {Array} */ var stringToByteArray$1 = function (str) { var out = []; var p = 0; for (var i = 0; i < str.length; i++) { var c = str.charCodeAt(i); // Is this the lead surrogate in a surrogate pair? if (c >= 0xd800 && c <= 0xdbff) { var high = c - 0xd800; // the high 10 bits. i++; assert(i < str.length, 'Surrogate pair missing trail surrogate.'); var low = str.charCodeAt(i) - 0xdc00; // the low 10 bits. c = 0x10000 + (high << 10) + low; } if (c < 128) { out[p++] = c; } else if (c < 2048) { out[p++] = (c >> 6) | 192; out[p++] = (c & 63) | 128; } else if (c < 65536) { out[p++] = (c >> 12) | 224; out[p++] = ((c >> 6) & 63) | 128; out[p++] = (c & 63) | 128; } else { out[p++] = (c >> 18) | 240; out[p++] = ((c >> 12) & 63) | 128; out[p++] = ((c >> 6) & 63) | 128; out[p++] = (c & 63) | 128; } } return out; }; /** * Calculate length without actually converting; useful for doing cheaper validation. * @param {string} str * @return {number} */ var stringLength = function (str) { var p = 0; for (var i = 0; i < str.length; i++) { var c = str.charCodeAt(i); if (c < 128) { p++; } else if (c < 2048) { p += 2; } else if (c >= 0xd800 && c <= 0xdbff) { // Lead surrogate of a surrogate pair. The pair together will take 4 bytes to represent. p += 4; i++; // skip trail surrogate. } else { p += 3; } } return p; }; /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * The amount of milliseconds to exponentially increase. */ var DEFAULT_INTERVAL_MILLIS = 1000; /** * The factor to backoff by. * Should be a number greater than 1. */ var DEFAULT_BACKOFF_FACTOR = 2; /** * The maximum milliseconds to increase to. * * <p>Visible for testing */ var MAX_VALUE_MILLIS = 4 * 60 * 60 * 1000; // Four hours, like iOS and Android. /** * The percentage of backoff time to randomize by. * See * http://go/safe-client-behavior#step-1-determine-the-appropriate-retry-interval-to-handle-spike-traffic * for context. * * <p>Visible for testing */ var RANDOM_FACTOR = 0.5; /** * Based on the backoff method from * https://github.com/google/closure-library/blob/master/closure/goog/math/exponentialbackoff.js. * Extracted here so we don't need to pass metadata and a stateful ExponentialBackoff object around. */ function calculateBackoffMillis(backoffCount, intervalMillis, backoffFactor) { if (intervalMillis === void 0) { intervalMillis = DEFAULT_INTERVAL_MILLIS; } if (backoffFactor === void 0) { backoffFactor = DEFAULT_BACKOFF_FACTOR; } // Calculates an exponentially increasing value. // Deviation: calculates value from count and a constant interval, so we only need to save value // and count to restore state. var currBaseValue = intervalMillis * Math.pow(backoffFactor, backoffCount); // A random "fuzz" to avoid waves of retries. // Deviation: randomFactor is required. var randomWait = Math.round( // A fraction of the backoff value to add/subtract. // Deviation: changes multiplication order to improve readability. RANDOM_FACTOR * currBaseValue * // A random float (rounded to int by Math.round above) in the range [-1, 1]. Determines // if we add or subtract. (Math.random() - 0.5) * 2); // Limits backoff to max to avoid effectively permanent backoff. return Math.min(MAX_VALUE_MILLIS, currBaseValue + randomWait); } exports.CONSTANTS = CONSTANTS; exports.Deferred = Deferred; exports.ErrorFactory = ErrorFactory; exports.FirebaseError = FirebaseError; exports.MAX_VALUE_MILLIS = MAX_VALUE_MILLIS; exports.RANDOM_FACTOR = RANDOM_FACTOR; exports.Sha1 = Sha1; exports.areCookiesEnabled = areCookiesEnabled; exports.assert = assert; exports.assertionError = assertionError; exports.async = async; exports.base64 = base64; exports.base64Decode = base64Decode; exports.base64Encode = base64Encode; exports.calculateBackoffMillis = calculateBackoffMillis; exports.contains = contains; exports.createSubscribe = createSubscribe; exports.decode = decode; exports.deepCopy = deepCopy; exports.deepExtend = deepExtend; exports.errorPrefix = errorPrefix; exports.getUA = getUA; exports.isAdmin = isAdmin; exports.isBrowser = isBrowser; exports.isBrowserExtension = isBrowserExtension; exports.isElectron = isElectron; exports.isEmpty = isEmpty; exports.isIE = isIE; exports.isIndexedDBAvailable = isIndexedDBAvailable; exports.isMobileCordova = isMobileCordova; exports.isNode = isNode; exports.isNodeSdk = isNodeSdk; exports.isReactNative = isReactNative; exports.isSafari = isSafari; exports.isUWP = isUWP; exports.isValidFormat = isValidFormat; exports.isValidTimestamp = isValidTimestamp; exports.issuedAtTime = issuedAtTime; exports.jsonEval = jsonEval; exports.map = map; exports.querystring = querystring; exports.querystringDecode = querystringDecode; exports.safeGet = safeGet; exports.stringLength = stringLength; exports.stringToByteArray = stringToByteArray$1; exports.stringify = stringify; exports.validateArgCount = validateArgCount; exports.validateCallback = validateCallback; exports.validateContextObject = validateContextObject; exports.validateIndexedDBOpenable = validateIndexedDBOpenable; exports.validateNamespace = validateNamespace; //# sourceMappingURL=index.cjs.js.map /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__("./node_modules/webpack/buildin/global.js"))) /***/ }), /***/ "./node_modules/@firebase/functions/node_modules/tslib/tslib.es6.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); /* harmony export (immutable) */ __webpack_exports__["__extends"] = __extends; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__assign", function() { return __assign; }); /* harmony export (immutable) */ __webpack_exports__["__rest"] = __rest; /* harmony export (immutable) */ __webpack_exports__["__decorate"] = __decorate; /* harmony export (immutable) */ __webpack_exports__["__param"] = __param; /* harmony export (immutable) */ __webpack_exports__["__metadata"] = __metadata; /* harmony export (immutable) */ __webpack_exports__["__awaiter"] = __awaiter; /* harmony export (immutable) */ __webpack_exports__["__generator"] = __generator; /* harmony export (immutable) */ __webpack_exports__["__createBinding"] = __createBinding; /* harmony export (immutable) */ __webpack_exports__["__exportStar"] = __exportStar; /* harmony export (immutable) */ __webpack_exports__["__values"] = __values; /* harmony export (immutable) */ __webpack_exports__["__read"] = __read; /* harmony export (immutable) */ __webpack_exports__["__spread"] = __spread; /* harmony export (immutable) */ __webpack_exports__["__spreadArrays"] = __spreadArrays; /* harmony export (immutable) */ __webpack_exports__["__await"] = __await; /* harmony export (immutable) */ __webpack_exports__["__asyncGenerator"] = __asyncGenerator; /* harmony export (immutable) */ __webpack_exports__["__asyncDelegator"] = __asyncDelegator; /* harmony export (immutable) */ __webpack_exports__["__asyncValues"] = __asyncValues; /* harmony export (immutable) */ __webpack_exports__["__makeTemplateObject"] = __makeTemplateObject; /* harmony export (immutable) */ __webpack_exports__["__importStar"] = __importStar; /* harmony export (immutable) */ __webpack_exports__["__importDefault"] = __importDefault; /* harmony export (immutable) */ __webpack_exports__["__classPrivateFieldGet"] = __classPrivateFieldGet; /* harmony export (immutable) */ __webpack_exports__["__classPrivateFieldSet"] = __classPrivateFieldSet; /*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */ /* global Reflect, Promise */ var extendStatics = function(d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; function __extends(d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); } var __assign = function() { __assign = Object.assign || function __assign(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; } return __assign.apply(this, arguments); } function __rest(s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; } return t; } function __decorate(decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; } function __param(paramIndex, decorator) { return function (target, key) { decorator(target, key, paramIndex); } } function __metadata(metadataKey, metadataValue) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); } function __awaiter(thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); } function __generator(thisArg, body) { var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; function verb(n) { return function (v) { return step([n, v]); }; } function step(op) { if (f) throw new TypeError("Generator is already executing."); while (_) try { if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; if (y = 0, t) op = [op[0] & 2, t.value]; switch (op[0]) { case 0: case 1: t = op; break; case 4: _.label++; return { value: op[1], done: false }; case 5: _.label++; y = op[1]; op = [0]; continue; case 7: op = _.ops.pop(); _.trys.pop(); continue; default: if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } if (t[2]) _.ops.pop(); _.trys.pop(); continue; } op = body.call(thisArg, _); } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } } function __createBinding(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; } function __exportStar(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) exports[p] = m[p]; } function __values(o) { var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; if (m) return m.call(o); if (o && typeof o.length === "number") return { next: function () { if (o && i >= o.length) o = void 0; return { value: o && o[i++], done: !o }; } }; throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); } function __read(o, n) { var m = typeof Symbol === "function" && o[Symbol.iterator]; if (!m) return o; var i = m.call(o), r, ar = [], e; try { while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); } catch (error) { e = { error: error }; } finally { try { if (r && !r.done && (m = i["return"])) m.call(i); } finally { if (e) throw e.error; } } return ar; } function __spread() { for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); return ar; } function __spreadArrays() { for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; for (var r = Array(s), k = 0, i = 0; i < il; i++) for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) r[k] = a[j]; return r; }; function __await(v) { return this instanceof __await ? (this.v = v, this) : new __await(v); } function __asyncGenerator(thisArg, _arguments, generator) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var g = generator.apply(thisArg, _arguments || []), i, q = []; return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } function fulfill(value) { resume("next", value); } function reject(value) { resume("throw", value); } function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } } function __asyncDelegator(o) { var i, p; return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } } function __asyncValues(o) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var m = o[Symbol.asyncIterator], i; return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } } function __makeTemplateObject(cooked, raw) { if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } return cooked; }; function __importStar(mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; result.default = mod; return result; } function __importDefault(mod) { return (mod && mod.__esModule) ? mod : { default: mod }; } function __classPrivateFieldGet(receiver, privateMap) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return privateMap.get(receiver); } function __classPrivateFieldSet(receiver, privateMap, value) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to set private field on non-instance"); } privateMap.set(receiver, value); return value; } /***/ }), /***/ "./node_modules/@firebase/logger/dist/index.esm.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LogLevel", function() { return LogLevel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Logger", function() { return Logger; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setLogLevel", function() { return setLogLevel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setUserLogHandler", function() { return setUserLogHandler; }); /*! ***************************************************************************** Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT. See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ function __spreadArrays() { for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; for (var r = Array(s), k = 0, i = 0; i < il; i++) for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) r[k] = a[j]; return r; } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var _a; /** * A container for all of the Logger instances */ var instances = []; /** * The JS SDK supports 5 log levels and also allows a user the ability to * silence the logs altogether. * * The order is a follows: * DEBUG < VERBOSE < INFO < WARN < ERROR * * All of the log types above the current log level will be captured (i.e. if * you set the log level to `INFO`, errors will still be logged, but `DEBUG` and * `VERBOSE` logs will not) */ var LogLevel; (function (LogLevel) { LogLevel[LogLevel["DEBUG"] = 0] = "DEBUG"; LogLevel[LogLevel["VERBOSE"] = 1] = "VERBOSE"; LogLevel[LogLevel["INFO"] = 2] = "INFO"; LogLevel[LogLevel["WARN"] = 3] = "WARN"; LogLevel[LogLevel["ERROR"] = 4] = "ERROR"; LogLevel[LogLevel["SILENT"] = 5] = "SILENT"; })(LogLevel || (LogLevel = {})); var levelStringToEnum = { 'debug': LogLevel.DEBUG, 'verbose': LogLevel.VERBOSE, 'info': LogLevel.INFO, 'warn': LogLevel.WARN, 'error': LogLevel.ERROR, 'silent': LogLevel.SILENT }; /** * The default log level */ var defaultLogLevel = LogLevel.INFO; /** * By default, `console.debug` is not displayed in the developer console (in * chrome). To avoid forcing users to have to opt-in to these logs twice * (i.e. once for firebase, and once in the console), we are sending `DEBUG` * logs to the `console.log` function. */ var ConsoleMethod = (_a = {}, _a[LogLevel.DEBUG] = 'log', _a[LogLevel.VERBOSE] = 'log', _a[LogLevel.INFO] = 'info', _a[LogLevel.WARN] = 'warn', _a[LogLevel.ERROR] = 'error', _a); /** * The default log handler will forward DEBUG, VERBOSE, INFO, WARN, and ERROR * messages on to their corresponding console counterparts (if the log method * is supported by the current log level) */ var defaultLogHandler = function (instance, logType) { var args = []; for (var _i = 2; _i < arguments.length; _i++) { args[_i - 2] = arguments[_i]; } if (logType < instance.logLevel) { return; } var now = new Date().toISOString(); var method = ConsoleMethod[logType]; if (method) { console[method].apply(console, __spreadArrays(["[" + now + "] " + instance.name + ":"], args)); } else { throw new Error("Attempted to log a message with an invalid logType (value: " + logType + ")"); } }; var Logger = /** @class */ (function () { /** * Gives you an instance of a Logger to capture messages according to * Firebase's logging scheme. * * @param name The name that the logs will be associated with */ function Logger(name) { this.name = name; /** * The log level of the given Logger instance. */ this._logLevel = defaultLogLevel; /** * The main (internal) log handler for the Logger instance. * Can be set to a new function in internal package code but not by user. */ this._logHandler = defaultLogHandler; /** * The optional, additional, user-defined log handler for the Logger instance. */ this._userLogHandler = null; /** * Capture the current instance for later use */ instances.push(this); } Object.defineProperty(Logger.prototype, "logLevel", { get: function () { return this._logLevel; }, set: function (val) { if (!(val in LogLevel)) { throw new TypeError("Invalid value \"" + val + "\" assigned to `logLevel`"); } this._logLevel = val; }, enumerable: false, configurable: true }); // Workaround for setter/getter having to be the same type. Logger.prototype.setLogLevel = function (val) { this._logLevel = typeof val === 'string' ? levelStringToEnum[val] : val; }; Object.defineProperty(Logger.prototype, "logHandler", { get: function () { return this._logHandler; }, set: function (val) { if (typeof val !== 'function') { throw new TypeError('Value assigned to `logHandler` must be a function'); } this._logHandler = val; }, enumerable: false, configurable: true }); Object.defineProperty(Logger.prototype, "userLogHandler", { get: function () { return this._userLogHandler; }, set: function (val) { this._userLogHandler = val; }, enumerable: false, configurable: true }); /** * The functions below are all based on the `console` interface */ Logger.prototype.debug = function () { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } this._userLogHandler && this._userLogHandler.apply(this, __spreadArrays([this, LogLevel.DEBUG], args)); this._logHandler.apply(this, __spreadArrays([this, LogLevel.DEBUG], args)); }; Logger.prototype.log = function () { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } this._userLogHandler && this._userLogHandler.apply(this, __spreadArrays([this, LogLevel.VERBOSE], args)); this._logHandler.apply(this, __spreadArrays([this, LogLevel.VERBOSE], args)); }; Logger.prototype.info = function () { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } this._userLogHandler && this._userLogHandler.apply(this, __spreadArrays([this, LogLevel.INFO], args)); this._logHandler.apply(this, __spreadArrays([this, LogLevel.INFO], args)); }; Logger.prototype.warn = function () { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } this._userLogHandler && this._userLogHandler.apply(this, __spreadArrays([this, LogLevel.WARN], args)); this._logHandler.apply(this, __spreadArrays([this, LogLevel.WARN], args)); }; Logger.prototype.error = function () { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } this._userLogHandler && this._userLogHandler.apply(this, __spreadArrays([this, LogLevel.ERROR], args)); this._logHandler.apply(this, __spreadArrays([this, LogLevel.ERROR], args)); }; return Logger; }()); function setLogLevel(level) { instances.forEach(function (inst) { inst.setLogLevel(level); }); } function setUserLogHandler(logCallback, options) { var _loop_1 = function (instance) { var customLogLevel = null; if (options && options.level) { customLogLevel = levelStringToEnum[options.level]; } if (logCallback === null) { instance.userLogHandler = null; } else { instance.userLogHandler = function (instance, level) { var args = []; for (var _i = 2; _i < arguments.length; _i++) { args[_i - 2] = arguments[_i]; } var message = args .map(function (arg) { if (arg == null) { return null; } else if (typeof arg === 'string') { return arg; } else if (typeof arg === 'number' || typeof arg === 'boolean') { return arg.toString(); } else if (arg instanceof Error) { return arg.message; } else { try { return JSON.stringify(arg); } catch (ignored) { return null; } } }) .filter(function (arg) { return arg; }) .join(' '); if (level >= (customLogLevel !== null && customLogLevel !== void 0 ? customLogLevel : instance.logLevel)) { logCallback({ level: LogLevel[level].toLowerCase(), message: message, args: args, type: instance.name }); } }; } }; for (var _i = 0, instances_1 = instances; _i < instances_1.length; _i++) { var instance = instances_1[_i]; _loop_1(instance); } } //# sourceMappingURL=index.esm.js.map /***/ }), /***/ "./node_modules/@firebase/messaging/dist/index.esm.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__firebase_installations__ = __webpack_require__("./node_modules/@firebase/messaging/node_modules/@firebase/installations/dist/index.esm.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__firebase_component__ = __webpack_require__("./node_modules/@firebase/messaging/node_modules/@firebase/component/dist/index.cjs.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__firebase_component___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1__firebase_component__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__firebase_util__ = __webpack_require__("./node_modules/@firebase/messaging/node_modules/@firebase/util/dist/index.cjs.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__firebase_util___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2__firebase_util__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_tslib__ = __webpack_require__("./node_modules/@firebase/messaging/node_modules/tslib/tslib.es6.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_idb__ = __webpack_require__("./node_modules/idb/build/idb.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_idb___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_idb__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__firebase_app__ = __webpack_require__("./node_modules/@firebase/app/dist/index.cjs.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__firebase_app___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5__firebase_app__); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var _a; var ERROR_MAP = (_a = {}, _a["missing-app-config-values" /* MISSING_APP_CONFIG_VALUES */] = 'Missing App configuration value: "{$valueName}"', _a["only-available-in-window" /* AVAILABLE_IN_WINDOW */] = 'This method is available in a Window context.', _a["only-available-in-sw" /* AVAILABLE_IN_SW */] = 'This method is available in a service worker context.', _a["permission-default" /* PERMISSION_DEFAULT */] = 'The notification permission was not granted and dismissed instead.', _a["permission-blocked" /* PERMISSION_BLOCKED */] = 'The notification permission was not granted and blocked instead.', _a["unsupported-browser" /* UNSUPPORTED_BROWSER */] = "This browser doesn't support the API's required to use the firebase SDK.", _a["failed-service-worker-registration" /* FAILED_DEFAULT_REGISTRATION */] = 'We are unable to register the default service worker. {$browserErrorMessage}', _a["token-subscribe-failed" /* TOKEN_SUBSCRIBE_FAILED */] = 'A problem occurred while subscribing the user to FCM: {$errorInfo}', _a["token-subscribe-no-token" /* TOKEN_SUBSCRIBE_NO_TOKEN */] = 'FCM returned no token when subscribing the user to push.', _a["token-unsubscribe-failed" /* TOKEN_UNSUBSCRIBE_FAILED */] = 'A problem occurred while unsubscribing the ' + 'user from FCM: {$errorInfo}', _a["token-update-failed" /* TOKEN_UPDATE_FAILED */] = 'A problem occurred while updating the user from FCM: {$errorInfo}', _a["token-update-no-token" /* TOKEN_UPDATE_NO_TOKEN */] = 'FCM returned no token when updating the user to push.', _a["use-sw-after-get-token" /* USE_SW_AFTER_GET_TOKEN */] = 'The useServiceWorker() method may only be called once and must be ' + 'called before calling getToken() to ensure your service worker is used.', _a["invalid-sw-registration" /* INVALID_SW_REGISTRATION */] = 'The input to useServiceWorker() must be a ServiceWorkerRegistration.', _a["invalid-bg-handler" /* INVALID_BG_HANDLER */] = 'The input to setBackgroundMessageHandler() must be a function.', _a["invalid-vapid-key" /* INVALID_VAPID_KEY */] = 'The public VAPID key must be a string.', _a["use-vapid-key-after-get-token" /* USE_VAPID_KEY_AFTER_GET_TOKEN */] = 'The usePublicVapidKey() method may only be called once and must be ' + 'called before calling getToken() to ensure your VAPID key is used.', _a); var ERROR_FACTORY = new __WEBPACK_IMPORTED_MODULE_2__firebase_util__["ErrorFactory"]('messaging', 'Messaging', ERROR_MAP); /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var DEFAULT_SW_PATH = '/firebase-messaging-sw.js'; var DEFAULT_SW_SCOPE = '/firebase-cloud-messaging-push-scope'; var DEFAULT_VAPID_KEY = 'BDOU99-h67HcA6JeFXHbSNMu7e2yNNu3RzoMj8TM4W88jITfq7ZmPvIM1Iv-4_l2LxQcYwhqby2xGpWwzjfAnG4'; var ENDPOINT = 'https://fcmregistrations.googleapis.com/v1'; /** Key of FCM Payload in Notification's data field. */ var FCM_MSG = 'FCM_MSG'; var CONSOLE_CAMPAIGN_ID = 'google.c.a.c_id'; var CONSOLE_CAMPAIGN_NAME = 'google.c.a.c_l'; var CONSOLE_CAMPAIGN_TIME = 'google.c.a.ts'; /** Set to '1' if Analytics is enabled for the campaign */ var CONSOLE_CAMPAIGN_ANALYTICS_ENABLED = 'google.c.a.e'; var TAG = 'FirebaseMessaging: '; /** * @license * Copyright 2018 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the License * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express * or implied. See the License for the specific language governing permissions and limitations under * the License. */ var MessageType; (function (MessageType) { MessageType["PUSH_RECEIVED"] = "push-received"; MessageType["NOTIFICATION_CLICKED"] = "notification-clicked"; })(MessageType || (MessageType = {})); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ function arrayToBase64(array) { var uint8Array = new Uint8Array(array); var base64String = btoa(String.fromCharCode.apply(String, Object(__WEBPACK_IMPORTED_MODULE_3_tslib__["__spread"])(uint8Array))); return base64String.replace(/=/g, '').replace(/\+/g, '-').replace(/\//g, '_'); } function base64ToArray(base64String) { var padding = '='.repeat((4 - (base64String.length % 4)) % 4); var base64 = (base64String + padding) .replace(/\-/g, '+') .replace(/_/g, '/'); var rawData = atob(base64); var outputArray = new Uint8Array(rawData.length); for (var i = 0; i < rawData.length; ++i) { outputArray[i] = rawData.charCodeAt(i); } return outputArray; } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var OLD_DB_NAME = 'fcm_token_details_db'; /** * The last DB version of 'fcm_token_details_db' was 4. This is one higher, so that the upgrade * callback is called for all versions of the old DB. */ var OLD_DB_VERSION = 5; var OLD_OBJECT_STORE_NAME = 'fcm_token_object_Store'; function migrateOldDatabase(senderId) { return Object(__WEBPACK_IMPORTED_MODULE_3_tslib__["__awaiter"])(this, void 0, void 0, function () { var databases, dbNames, tokenDetails, db; var _this = this; return Object(__WEBPACK_IMPORTED_MODULE_3_tslib__["__generator"])(this, function (_a) { switch (_a.label) { case 0: if (!('databases' in indexedDB)) return [3 /*break*/, 2]; return [4 /*yield*/, indexedDB.databases()]; case 1: databases = _a.sent(); dbNames = databases.map(function (db) { return db.name; }); if (!dbNames.includes(OLD_DB_NAME)) { // old DB didn't exist, no need to open. return [2 /*return*/, null]; } _a.label = 2; case 2: tokenDetails = null; return [4 /*yield*/, Object(__WEBPACK_IMPORTED_MODULE_4_idb__["openDb"])(OLD_DB_NAME, OLD_DB_VERSION, function (db) { return Object(__WEBPACK_IMPORTED_MODULE_3_tslib__["__awaiter"])(_this, void 0, void 0, function () { var objectStore, value, oldDetails, oldDetails, oldDetails; var _a; return Object(__WEBPACK_IMPORTED_MODULE_3_tslib__["__generator"])(this, function (_b) { switch (_b.label) { case 0: if (db.oldVersion < 2) { // Database too old, skip migration. return [2 /*return*/]; } if (!db.objectStoreNames.contains(OLD_OBJECT_STORE_NAME)) { // Database did not exist. Nothing to do. return [2 /*return*/]; } objectStore = db.transaction.objectStore(OLD_OBJECT_STORE_NAME); return [4 /*yield*/, objectStore.index('fcmSenderId').get(senderId)]; case 1: value = _b.sent(); return [4 /*yield*/, objectStore.clear()]; case 2: _b.sent(); if (!value) { // No entry in the database, nothing to migrate. return [2 /*return*/]; } if (db.oldVersion === 2) { oldDetails = value; if (!oldDetails.auth || !oldDetails.p256dh || !oldDetails.endpoint) { return [2 /*return*/]; } tokenDetails = { token: oldDetails.fcmToken, createTime: (_a = oldDetails.createTime) !== null && _a !== void 0 ? _a : Date.now(), subscriptionOptions: { auth: oldDetails.auth, p256dh: oldDetails.p256dh, endpoint: oldDetails.endpoint, swScope: oldDetails.swScope, vapidKey: typeof oldDetails.vapidKey === 'string' ? oldDetails.vapidKey : arrayToBase64(oldDetails.vapidKey) } }; } else if (db.oldVersion === 3) { oldDetails = value; tokenDetails = { token: oldDetails.fcmToken, createTime: oldDetails.createTime, subscriptionOptions: { auth: arrayToBase64(oldDetails.auth), p256dh: arrayToBase64(oldDetails.p256dh), endpoint: oldDetails.endpoint, swScope: oldDetails.swScope, vapidKey: arrayToBase64(oldDetails.vapidKey) } }; } else if (db.oldVersion === 4) { oldDetails = value; tokenDetails = { token: oldDetails.fcmToken, createTime: oldDetails.createTime, subscriptionOptions: { auth: arrayToBase64(oldDetails.auth), p256dh: arrayToBase64(oldDetails.p256dh), endpoint: oldDetails.endpoint, swScope: oldDetails.swScope, vapidKey: arrayToBase64(oldDetails.vapidKey) } }; } return [2 /*return*/]; } }); }); })]; case 3: db = _a.sent(); db.close(); // Delete all old databases. return [4 /*yield*/, Object(__WEBPACK_IMPORTED_MODULE_4_idb__["deleteDb"])(OLD_DB_NAME)]; case 4: // Delete all old databases. _a.sent(); return [4 /*yield*/, Object(__WEBPACK_IMPORTED_MODULE_4_idb__["deleteDb"])('fcm_vapid_details_db')]; case 5: _a.sent(); return [4 /*yield*/, Object(__WEBPACK_IMPORTED_MODULE_4_idb__["deleteDb"])('undefined')]; case 6: _a.sent(); return [2 /*return*/, checkTokenDetails(tokenDetails) ? tokenDetails : null]; } }); }); } function checkTokenDetails(tokenDetails) { if (!tokenDetails || !tokenDetails.subscriptionOptions) { return false; } var subscriptionOptions = tokenDetails.subscriptionOptions; return (typeof tokenDetails.createTime === 'number' && tokenDetails.createTime > 0 && typeof tokenDetails.token === 'string' && tokenDetails.token.length > 0 && typeof subscriptionOptions.auth === 'string' && subscriptionOptions.auth.length > 0 && typeof subscriptionOptions.p256dh === 'string' && subscriptionOptions.p256dh.length > 0 && typeof subscriptionOptions.endpoint === 'string' && subscriptionOptions.endpoint.length > 0 && typeof subscriptionOptions.swScope === 'string' && subscriptionOptions.swScope.length > 0 && typeof subscriptionOptions.vapidKey === 'string' && subscriptionOptions.vapidKey.length > 0); } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // Exported for tests. var DATABASE_NAME = 'firebase-messaging-database'; var DATABASE_VERSION = 1; var OBJECT_STORE_NAME = 'firebase-messaging-store'; var dbPromise = null; function getDbPromise() { if (!dbPromise) { dbPromise = Object(__WEBPACK_IMPORTED_MODULE_4_idb__["openDb"])(DATABASE_NAME, DATABASE_VERSION, function (upgradeDb) { // We don't use 'break' in this switch statement, the fall-through behavior is what we want, // because if there are multiple versions between the old version and the current version, we // want ALL the migrations that correspond to those versions to run, not only the last one. // eslint-disable-next-line default-case switch (upgradeDb.oldVersion) { case 0: upgradeDb.createObjectStore(OBJECT_STORE_NAME); } }); } return dbPromise; } /** Gets record(s) from the objectStore that match the given key. */ function dbGet(firebaseDependencies) { return Object(__WEBPACK_IMPORTED_MODULE_3_tslib__["__awaiter"])(this, void 0, void 0, function () { var key, db, tokenDetails, oldTokenDetails; return Object(__WEBPACK_IMPORTED_MODULE_3_tslib__["__generator"])(this, function (_a) { switch (_a.label) { case 0: key = getKey(firebaseDependencies); return [4 /*yield*/, getDbPromise()]; case 1: db = _a.sent(); return [4 /*yield*/, db .transaction(OBJECT_STORE_NAME) .objectStore(OBJECT_STORE_NAME) .get(key)]; case 2: tokenDetails = _a.sent(); if (!tokenDetails) return [3 /*break*/, 3]; return [2 /*return*/, tokenDetails]; case 3: return [4 /*yield*/, migrateOldDatabase(firebaseDependencies.appConfig.senderId)]; case 4: oldTokenDetails = _a.sent(); if (!oldTokenDetails) return [3 /*break*/, 6]; return [4 /*yield*/, dbSet(firebaseDependencies, oldTokenDetails)]; case 5: _a.sent(); return [2 /*return*/, oldTokenDetails]; case 6: return [2 /*return*/]; } }); }); } /** Assigns or overwrites the record for the given key with the given value. */ function dbSet(firebaseDependencies, tokenDetails) { return Object(__WEBPACK_IMPORTED_MODULE_3_tslib__["__awaiter"])(this, void 0, void 0, function () { var key, db, tx; return Object(__WEBPACK_IMPORTED_MODULE_3_tslib__["__generator"])(this, function (_a) { switch (_a.label) { case 0: key = getKey(firebaseDependencies); return [4 /*yield*/, getDbPromise()]; case 1: db = _a.sent(); tx = db.transaction(OBJECT_STORE_NAME, 'readwrite'); return [4 /*yield*/, tx.objectStore(OBJECT_STORE_NAME).put(tokenDetails, key)]; case 2: _a.sent(); return [4 /*yield*/, tx.complete]; case 3: _a.sent(); return [2 /*return*/, tokenDetails]; } }); }); } /** Removes record(s) from the objectStore that match the given key. */ function dbRemove(firebaseDependencies) { return Object(__WEBPACK_IMPORTED_MODULE_3_tslib__["__awaiter"])(this, void 0, void 0, function () { var key, db, tx; return Object(__WEBPACK_IMPORTED_MODULE_3_tslib__["__generator"])(this, function (_a) { switch (_a.label) { case 0: key = getKey(firebaseDependencies); return [4 /*yield*/, getDbPromise()]; case 1: db = _a.sent(); tx = db.transaction(OBJECT_STORE_NAME, 'readwrite'); return [4 /*yield*/, tx.objectStore(OBJECT_STORE_NAME).delete(key)]; case 2: _a.sent(); return [4 /*yield*/, tx.complete]; case 3: _a.sent(); return [2 /*return*/]; } }); }); } function getKey(_a) { var appConfig = _a.appConfig; return appConfig.appId; } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ function requestGetToken(firebaseDependencies, subscriptionOptions) { return Object(__WEBPACK_IMPORTED_MODULE_3_tslib__["__awaiter"])(this, void 0, void 0, function () { var headers, body, subscribeOptions, responseData, response, err_1, message; return Object(__WEBPACK_IMPORTED_MODULE_3_tslib__["__generator"])(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, getHeaders(firebaseDependencies)]; case 1: headers = _a.sent(); body = getBody(subscriptionOptions); subscribeOptions = { method: 'POST', headers: headers, body: JSON.stringify(body) }; _a.label = 2; case 2: _a.trys.push([2, 5, , 6]); return [4 /*yield*/, fetch(getEndpoint(firebaseDependencies.appConfig), subscribeOptions)]; case 3: response = _a.sent(); return [4 /*yield*/, response.json()]; case 4: responseData = _a.sent(); return [3 /*break*/, 6]; case 5: err_1 = _a.sent(); throw ERROR_FACTORY.create("token-subscribe-failed" /* TOKEN_SUBSCRIBE_FAILED */, { errorInfo: err_1 }); case 6: if (responseData.error) { message = responseData.error.message; throw ERROR_FACTORY.create("token-subscribe-failed" /* TOKEN_SUBSCRIBE_FAILED */, { errorInfo: message }); } if (!responseData.token) { throw ERROR_FACTORY.create("token-subscribe-no-token" /* TOKEN_SUBSCRIBE_NO_TOKEN */); } return [2 /*return*/, responseData.token]; } }); }); } function requestUpdateToken(firebaseDependencies, tokenDetails) { return Object(__WEBPACK_IMPORTED_MODULE_3_tslib__["__awaiter"])(this, void 0, void 0, function () { var headers, body, updateOptions, responseData, response, err_2, message; return Object(__WEBPACK_IMPORTED_MODULE_3_tslib__["__generator"])(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, getHeaders(firebaseDependencies)]; case 1: headers = _a.sent(); body = getBody(tokenDetails.subscriptionOptions); updateOptions = { method: 'PATCH', headers: headers, body: JSON.stringify(body) }; _a.label = 2; case 2: _a.trys.push([2, 5, , 6]); return [4 /*yield*/, fetch(getEndpoint(firebaseDependencies.appConfig) + "/" + tokenDetails.token, updateOptions)]; case 3: response = _a.sent(); return [4 /*yield*/, response.json()]; case 4: responseData = _a.sent(); return [3 /*break*/, 6]; case 5: err_2 = _a.sent(); throw ERROR_FACTORY.create("token-update-failed" /* TOKEN_UPDATE_FAILED */, { errorInfo: err_2 }); case 6: if (responseData.error) { message = responseData.error.message; throw ERROR_FACTORY.create("token-update-failed" /* TOKEN_UPDATE_FAILED */, { errorInfo: message }); } if (!responseData.token) { throw ERROR_FACTORY.create("token-update-no-token" /* TOKEN_UPDATE_NO_TOKEN */); } return [2 /*return*/, responseData.token]; } }); }); } function requestDeleteToken(firebaseDependencies, token) { return Object(__WEBPACK_IMPORTED_MODULE_3_tslib__["__awaiter"])(this, void 0, void 0, function () { var headers, unsubscribeOptions, response, responseData, message, err_3; return Object(__WEBPACK_IMPORTED_MODULE_3_tslib__["__generator"])(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, getHeaders(firebaseDependencies)]; case 1: headers = _a.sent(); unsubscribeOptions = { method: 'DELETE', headers: headers }; _a.label = 2; case 2: _a.trys.push([2, 5, , 6]); return [4 /*yield*/, fetch(getEndpoint(firebaseDependencies.appConfig) + "/" + token, unsubscribeOptions)]; case 3: response = _a.sent(); return [4 /*yield*/, response.json()]; case 4: responseData = _a.sent(); if (responseData.error) { message = responseData.error.message; throw ERROR_FACTORY.create("token-unsubscribe-failed" /* TOKEN_UNSUBSCRIBE_FAILED */, { errorInfo: message }); } return [3 /*break*/, 6]; case 5: err_3 = _a.sent(); throw ERROR_FACTORY.create("token-unsubscribe-failed" /* TOKEN_UNSUBSCRIBE_FAILED */, { errorInfo: err_3 }); case 6: return [2 /*return*/]; } }); }); } function getEndpoint(_a) { var projectId = _a.projectId; return ENDPOINT + "/projects/" + projectId + "/registrations"; } function getHeaders(_a) { var appConfig = _a.appConfig, installations = _a.installations; return Object(__WEBPACK_IMPORTED_MODULE_3_tslib__["__awaiter"])(this, void 0, void 0, function () { var authToken; return Object(__WEBPACK_IMPORTED_MODULE_3_tslib__["__generator"])(this, function (_b) { switch (_b.label) { case 0: return [4 /*yield*/, installations.getToken()]; case 1: authToken = _b.sent(); return [2 /*return*/, new Headers({ 'Content-Type': 'application/json', Accept: 'application/json', 'x-goog-api-key': appConfig.apiKey, 'x-goog-firebase-installations-auth': "FIS " + authToken })]; } }); }); } function getBody(_a) { var p256dh = _a.p256dh, auth = _a.auth, endpoint = _a.endpoint, vapidKey = _a.vapidKey; var body = { web: { endpoint: endpoint, auth: auth, p256dh: p256dh } }; if (vapidKey !== DEFAULT_VAPID_KEY) { body.web.applicationPubKey = vapidKey; } return body; } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** UpdateRegistration will be called once every week. */ var TOKEN_EXPIRATION_MS = 7 * 24 * 60 * 60 * 1000; // 7 days function getToken(firebaseDependencies, swRegistration, vapidKey) { return Object(__WEBPACK_IMPORTED_MODULE_3_tslib__["__awaiter"])(this, void 0, void 0, function () { var pushSubscription, tokenDetails, subscriptionOptions, e_1; return Object(__WEBPACK_IMPORTED_MODULE_3_tslib__["__generator"])(this, function (_a) { switch (_a.label) { case 0: if (Notification.permission !== 'granted') { throw ERROR_FACTORY.create("permission-blocked" /* PERMISSION_BLOCKED */); } return [4 /*yield*/, getPushSubscription(swRegistration, vapidKey)]; case 1: pushSubscription = _a.sent(); return [4 /*yield*/, dbGet(firebaseDependencies)]; case 2: tokenDetails = _a.sent(); subscriptionOptions = { vapidKey: vapidKey, swScope: swRegistration.scope, endpoint: pushSubscription.endpoint, auth: arrayToBase64(pushSubscription.getKey('auth')), p256dh: arrayToBase64(pushSubscription.getKey('p256dh')) }; if (!!tokenDetails) return [3 /*break*/, 3]; // No token, get a new one. return [2 /*return*/, getNewToken(firebaseDependencies, subscriptionOptions)]; case 3: if (!!isTokenValid(tokenDetails.subscriptionOptions, subscriptionOptions)) return [3 /*break*/, 8]; _a.label = 4; case 4: _a.trys.push([4, 6, , 7]); return [4 /*yield*/, requestDeleteToken(firebaseDependencies, tokenDetails.token)]; case 5: _a.sent(); return [3 /*break*/, 7]; case 6: e_1 = _a.sent(); // Suppress errors because of #2364 console.warn(e_1); return [3 /*break*/, 7]; case 7: return [2 /*return*/, getNewToken(firebaseDependencies, subscriptionOptions)]; case 8: if (Date.now() >= tokenDetails.createTime + TOKEN_EXPIRATION_MS) { // Weekly token refresh return [2 /*return*/, updateToken({ token: tokenDetails.token, createTime: Date.now(), subscriptionOptions: subscriptionOptions }, firebaseDependencies, swRegistration)]; } else { // Valid token, nothing to do. return [2 /*return*/, tokenDetails.token]; } case 9: return [2 /*return*/]; } }); }); } /** * This method deletes the token from the database, unsubscribes the token from FCM, and unregisters * the push subscription if it exists. */ function deleteToken(firebaseDependencies, swRegistration) { return Object(__WEBPACK_IMPORTED_MODULE_3_tslib__["__awaiter"])(this, void 0, void 0, function () { var tokenDetails, pushSubscription; return Object(__WEBPACK_IMPORTED_MODULE_3_tslib__["__generator"])(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, dbGet(firebaseDependencies)]; case 1: tokenDetails = _a.sent(); if (!tokenDetails) return [3 /*break*/, 4]; return [4 /*yield*/, requestDeleteToken(firebaseDependencies, tokenDetails.token)]; case 2: _a.sent(); return [4 /*yield*/, dbRemove(firebaseDependencies)]; case 3: _a.sent(); _a.label = 4; case 4: return [4 /*yield*/, swRegistration.pushManager.getSubscription()]; case 5: pushSubscription = _a.sent(); if (pushSubscription) { return [2 /*return*/, pushSubscription.unsubscribe()]; } // If there's no SW, consider it a success. return [2 /*return*/, true]; } }); }); } function updateToken(tokenDetails, firebaseDependencies, swRegistration) { return Object(__WEBPACK_IMPORTED_MODULE_3_tslib__["__awaiter"])(this, void 0, void 0, function () { var updatedToken, updatedTokenDetails, e_2; return Object(__WEBPACK_IMPORTED_MODULE_3_tslib__["__generator"])(this, function (_a) { switch (_a.label) { case 0: _a.trys.push([0, 3, , 5]); return [4 /*yield*/, requestUpdateToken(firebaseDependencies, tokenDetails)]; case 1: updatedToken = _a.sent(); updatedTokenDetails = Object(__WEBPACK_IMPORTED_MODULE_3_tslib__["__assign"])(Object(__WEBPACK_IMPORTED_MODULE_3_tslib__["__assign"])({}, tokenDetails), { token: updatedToken, createTime: Date.now() }); return [4 /*yield*/, dbSet(firebaseDependencies, updatedTokenDetails)]; case 2: _a.sent(); return [2 /*return*/, updatedToken]; case 3: e_2 = _a.sent(); return [4 /*yield*/, deleteToken(firebaseDependencies, swRegistration)]; case 4: _a.sent(); throw e_2; case 5: return [2 /*return*/]; } }); }); } function getNewToken(firebaseDependencies, subscriptionOptions) { return Object(__WEBPACK_IMPORTED_MODULE_3_tslib__["__awaiter"])(this, void 0, void 0, function () { var token, tokenDetails; return Object(__WEBPACK_IMPORTED_MODULE_3_tslib__["__generator"])(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, requestGetToken(firebaseDependencies, subscriptionOptions)]; case 1: token = _a.sent(); tokenDetails = { token: token, createTime: Date.now(), subscriptionOptions: subscriptionOptions }; return [4 /*yield*/, dbSet(firebaseDependencies, tokenDetails)]; case 2: _a.sent(); return [2 /*return*/, tokenDetails.token]; } }); }); } /** * Gets a PushSubscription for the current user. */ function getPushSubscription(swRegistration, vapidKey) { return Object(__WEBPACK_IMPORTED_MODULE_3_tslib__["__awaiter"])(this, void 0, void 0, function () { var subscription; return Object(__WEBPACK_IMPORTED_MODULE_3_tslib__["__generator"])(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, swRegistration.pushManager.getSubscription()]; case 1: subscription = _a.sent(); if (subscription) { return [2 /*return*/, subscription]; } return [2 /*return*/, swRegistration.pushManager.subscribe({ userVisibleOnly: true, // Chrome <= 75 doesn't support base64-encoded VAPID key. For backward compatibility, VAPID key // submitted to pushManager#subscribe must be of type Uint8Array. applicationServerKey: base64ToArray(vapidKey) })]; } }); }); } /** * Checks if the saved tokenDetails object matches the configuration provided. */ function isTokenValid(dbOptions, currentOptions) { var isVapidKeyEqual = currentOptions.vapidKey === dbOptions.vapidKey; var isEndpointEqual = currentOptions.endpoint === dbOptions.endpoint; var isAuthEqual = currentOptions.auth === dbOptions.auth; var isP256dhEqual = currentOptions.p256dh === dbOptions.p256dh; return isVapidKeyEqual && isEndpointEqual && isAuthEqual && isP256dhEqual; } /** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ function externalizePayload(internalPayload) { var payload = { from: internalPayload.from, // eslint-disable-next-line camelcase collapseKey: internalPayload.collapse_key }; propagateNotificationPayload(payload, internalPayload); propagateDataPayload(payload, internalPayload); propagateFcmOptions(payload, internalPayload); return payload; } function propagateNotificationPayload(payload, messagePayloadInternal) { if (!messagePayloadInternal.notification) { return; } payload.notification = {}; var title = messagePayloadInternal.notification.title; if (!!title) { payload.notification.title = title; } var body = messagePayloadInternal.notification.body; if (!!body) { payload.notification.body = body; } var image = messagePayloadInternal.notification.image; if (!!image) { payload.notification.image = image; } } function propagateDataPayload(payload, messagePayloadInternal) { if (!messagePayloadInternal.data) { return; } payload.data = messagePayloadInternal.data; } function propagateFcmOptions(payload, messagePayloadInternal) { if (!messagePayloadInternal.fcmOptions) { return; } payload.fcmOptions = {}; var link = messagePayloadInternal.fcmOptions.link; if (!!link) { payload.fcmOptions.link = link; } // eslint-disable-next-line camelcase var analyticsLabel = messagePayloadInternal.fcmOptions.analytics_label; if (!!analyticsLabel) { payload.fcmOptions.analyticsLabel = analyticsLabel; } } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ function isConsoleMessage(data) { // This message has a campaign ID, meaning it was sent using the Firebase Console. return typeof data === 'object' && !!data && CONSOLE_CAMPAIGN_ID in data; } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** Returns a promise that resolves after given time passes. */ function sleep(ms) { return new Promise(function (resolve) { setTimeout(resolve, ms); }); } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var SwController = /** @class */ (function () { function SwController(firebaseDependencies) { var _this = this; this.firebaseDependencies = firebaseDependencies; // A boolean flag to determine wether an app is using onBackgroundMessage or // setBackgroundMessageHandler. onBackgroundMessage will receive a MessagePayload regardless of if // a notification is displayed. Whereas, setBackgroundMessageHandler will swallow the // MessagePayload if a NotificationPayload is included. this.isOnBackgroundMessageUsed = null; this.vapidKey = null; this.bgMessageHandler = null; self.addEventListener('push', function (e) { e.waitUntil(_this.onPush(e)); }); self.addEventListener('pushsubscriptionchange', function (e) { e.waitUntil(_this.onSubChange(e)); }); self.addEventListener('notificationclick', function (e) { e.waitUntil(_this.onNotificationClick(e)); }); } Object.defineProperty(SwController.prototype, "app", { get: function () { return this.firebaseDependencies.app; }, enumerable: false, configurable: true }); /** * @deprecated. Use onBackgroundMessage(nextOrObserver: NextFn<object> | Observer<object>): * Unsubscribe instead. * * Calling setBackgroundMessageHandler will opt in to some specific behaviors. * * 1.) If a notification doesn't need to be shown due to a window already being visible, then push * messages will be sent to the page. 2.) If a notification needs to be shown, and the message * contains no notification data this method will be called and the promise it returns will be * passed to event.waitUntil. If you do not set this callback then all push messages will let and * the developer can handle them in a their own 'push' event callback * * @param callback The callback to be called when a push message is received and a notification * must be shown. The callback will be given the data from the push message. */ SwController.prototype.setBackgroundMessageHandler = function (callback) { this.isOnBackgroundMessageUsed = false; if (!callback || typeof callback !== 'function') { throw ERROR_FACTORY.create("invalid-bg-handler" /* INVALID_BG_HANDLER */); } this.bgMessageHandler = callback; }; SwController.prototype.onBackgroundMessage = function (nextOrObserver) { var _this = this; this.isOnBackgroundMessageUsed = true; this.bgMessageHandler = nextOrObserver; return function () { _this.bgMessageHandler = null; }; }; // TODO: Remove getToken from SW Controller. Calling this from an old SW can cause all kinds of // trouble. SwController.prototype.getToken = function () { var _a, _b; return Object(__WEBPACK_IMPORTED_MODULE_3_tslib__["__awaiter"])(this, void 0, void 0, function () { var tokenDetails; return Object(__WEBPACK_IMPORTED_MODULE_3_tslib__["__generator"])(this, function (_c) { switch (_c.label) { case 0: if (!!this.vapidKey) return [3 /*break*/, 2]; return [4 /*yield*/, dbGet(this.firebaseDependencies)]; case 1: tokenDetails = _c.sent(); this.vapidKey = (_b = (_a = tokenDetails === null || tokenDetails === void 0 ? void 0 : tokenDetails.subscriptionOptions) === null || _a === void 0 ? void 0 : _a.vapidKey) !== null && _b !== void 0 ? _b : DEFAULT_VAPID_KEY; _c.label = 2; case 2: return [2 /*return*/, getToken(this.firebaseDependencies, self.registration, this.vapidKey)]; } }); }); }; // TODO: Remove deleteToken from SW Controller. Calling this from an old SW can cause all kinds of // trouble. SwController.prototype.deleteToken = function () { return deleteToken(this.firebaseDependencies, self.registration); }; SwController.prototype.requestPermission = function () { throw ERROR_FACTORY.create("only-available-in-window" /* AVAILABLE_IN_WINDOW */); }; // TODO: Remove this together with getToken from SW Controller. SwController.prototype.usePublicVapidKey = function (vapidKey) { if (this.vapidKey !== null) { throw ERROR_FACTORY.create("use-vapid-key-after-get-token" /* USE_VAPID_KEY_AFTER_GET_TOKEN */); } if (typeof vapidKey !== 'string' || vapidKey.length === 0) { throw ERROR_FACTORY.create("invalid-vapid-key" /* INVALID_VAPID_KEY */); } this.vapidKey = vapidKey; }; SwController.prototype.useServiceWorker = function () { throw ERROR_FACTORY.create("only-available-in-window" /* AVAILABLE_IN_WINDOW */); }; SwController.prototype.onMessage = function () { throw ERROR_FACTORY.create("only-available-in-window" /* AVAILABLE_IN_WINDOW */); }; SwController.prototype.onTokenRefresh = function () { throw ERROR_FACTORY.create("only-available-in-window" /* AVAILABLE_IN_WINDOW */); }; /** * A handler for push events that shows notifications based on the content of the payload. * * The payload must be a JSON-encoded Object with a `notification` key. The value of the * `notification` property will be used as the NotificationOptions object passed to * showNotification. Additionally, the `title` property of the notification object will be used as * the title. * * If there is no notification data in the payload then no notification will be shown. */ SwController.prototype.onPush = function (event) { return Object(__WEBPACK_IMPORTED_MODULE_3_tslib__["__awaiter"])(this, void 0, void 0, function () { var internalPayload, clientList, isNotificationShown, payload; return Object(__WEBPACK_IMPORTED_MODULE_3_tslib__["__generator"])(this, function (_a) { switch (_a.label) { case 0: internalPayload = getMessagePayloadInternal(event); if (!internalPayload) { console.debug(TAG + 'failed to get parsed MessagePayload from the PushEvent. Skip handling the push.'); return [2 /*return*/]; } return [4 /*yield*/, getClientList()]; case 1: clientList = _a.sent(); if (hasVisibleClients(clientList)) { return [2 /*return*/, sendMessagePayloadInternalToWindows(clientList, internalPayload)]; } isNotificationShown = false; if (!!!internalPayload.notification) return [3 /*break*/, 3]; return [4 /*yield*/, showNotification(wrapInternalPayload(internalPayload))]; case 2: _a.sent(); isNotificationShown = true; _a.label = 3; case 3: // MessagePayload is only passed to `onBackgroundMessage`. Skip passing MessagePayload for // the legacy `setBackgroundMessageHandler` to preserve the SDK behaviors. if (isNotificationShown === true && this.isOnBackgroundMessageUsed === false) { return [2 /*return*/]; } if (!!this.bgMessageHandler) { payload = externalizePayload(internalPayload); if (typeof this.bgMessageHandler === 'function') { this.bgMessageHandler(payload); } else { this.bgMessageHandler.next(payload); } } return [2 /*return*/]; } }); }); }; SwController.prototype.onSubChange = function (event) { var _a, _b; return Object(__WEBPACK_IMPORTED_MODULE_3_tslib__["__awaiter"])(this, void 0, void 0, function () { var newSubscription, tokenDetails; return Object(__WEBPACK_IMPORTED_MODULE_3_tslib__["__generator"])(this, function (_c) { switch (_c.label) { case 0: newSubscription = event.newSubscription; if (!!newSubscription) return [3 /*break*/, 2]; // Subscription revoked, delete token return [4 /*yield*/, deleteToken(this.firebaseDependencies, self.registration)]; case 1: // Subscription revoked, delete token _c.sent(); return [2 /*return*/]; case 2: return [4 /*yield*/, dbGet(this.firebaseDependencies)]; case 3: tokenDetails = _c.sent(); return [4 /*yield*/, deleteToken(this.firebaseDependencies, self.registration)]; case 4: _c.sent(); return [4 /*yield*/, getToken(this.firebaseDependencies, self.registration, (_b = (_a = tokenDetails === null || tokenDetails === void 0 ? void 0 : tokenDetails.subscriptionOptions) === null || _a === void 0 ? void 0 : _a.vapidKey) !== null && _b !== void 0 ? _b : DEFAULT_VAPID_KEY)]; case 5: _c.sent(); return [2 /*return*/]; } }); }); }; SwController.prototype.onNotificationClick = function (event) { var _a, _b; return Object(__WEBPACK_IMPORTED_MODULE_3_tslib__["__awaiter"])(this, void 0, void 0, function () { var internalPayload, link, url, originUrl, client; return Object(__WEBPACK_IMPORTED_MODULE_3_tslib__["__generator"])(this, function (_c) { switch (_c.label) { case 0: internalPayload = (_b = (_a = event.notification) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b[FCM_MSG]; if (!internalPayload) { return [2 /*return*/]; } else if (event.action) { // User clicked on an action button. This will allow developers to act on action button clicks // by using a custom onNotificationClick listener that they define. return [2 /*return*/]; } // Prevent other listeners from receiving the event event.stopImmediatePropagation(); event.notification.close(); link = getLink(internalPayload); if (!link) { return [2 /*return*/]; } url = new URL(link, self.location.href); originUrl = new URL(self.location.origin); if (url.host !== originUrl.host) { return [2 /*return*/]; } return [4 /*yield*/, getWindowClient(url)]; case 1: client = _c.sent(); if (!!client) return [3 /*break*/, 4]; return [4 /*yield*/, self.clients.openWindow(link)]; case 2: client = _c.sent(); // Wait three seconds for the client to initialize and set up the message handler so that it // can receive the message. return [4 /*yield*/, sleep(3000)]; case 3: // Wait three seconds for the client to initialize and set up the message handler so that it // can receive the message. _c.sent(); return [3 /*break*/, 6]; case 4: return [4 /*yield*/, client.focus()]; case 5: client = _c.sent(); _c.label = 6; case 6: if (!client) { // Window Client will not be returned if it's for a third party origin. return [2 /*return*/]; } internalPayload.messageType = MessageType.NOTIFICATION_CLICKED; internalPayload.isFirebaseMessaging = true; return [2 /*return*/, client.postMessage(internalPayload)]; } }); }); }; return SwController; }()); function wrapInternalPayload(internalPayload) { var _a; var wrappedInternalPayload = Object(__WEBPACK_IMPORTED_MODULE_3_tslib__["__assign"])({}, internalPayload.notification); // Put the message payload under FCM_MSG name so we can identify the notification as being an FCM // notification vs a notification from somewhere else (i.e. normal web push or developer generated // notification). wrappedInternalPayload.data = (_a = {}, _a[FCM_MSG] = internalPayload, _a); return wrappedInternalPayload; } function getMessagePayloadInternal(_a) { var data = _a.data; if (!data) { return null; } try { return data.json(); } catch (err) { // Not JSON so not an FCM message. return null; } } /** * @param url The URL to look for when focusing a client. * @return Returns an existing window client or a newly opened WindowClient. */ function getWindowClient(url) { return Object(__WEBPACK_IMPORTED_MODULE_3_tslib__["__awaiter"])(this, void 0, void 0, function () { var clientList, clientList_1, clientList_1_1, client, clientUrl; var e_1, _a; return Object(__WEBPACK_IMPORTED_MODULE_3_tslib__["__generator"])(this, function (_b) { switch (_b.label) { case 0: return [4 /*yield*/, getClientList()]; case 1: clientList = _b.sent(); try { for (clientList_1 = Object(__WEBPACK_IMPORTED_MODULE_3_tslib__["__values"])(clientList), clientList_1_1 = clientList_1.next(); !clientList_1_1.done; clientList_1_1 = clientList_1.next()) { client = clientList_1_1.value; clientUrl = new URL(client.url, self.location.href); if (url.host === clientUrl.host) { return [2 /*return*/, client]; } } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (clientList_1_1 && !clientList_1_1.done && (_a = clientList_1.return)) _a.call(clientList_1); } finally { if (e_1) throw e_1.error; } } return [2 /*return*/, null]; } }); }); } /** * @returns If there is currently a visible WindowClient, this method will resolve to true, * otherwise false. */ function hasVisibleClients(clientList) { return clientList.some(function (client) { return client.visibilityState === 'visible' && // Ignore chrome-extension clients as that matches the background pages of extensions, which // are always considered visible for some reason. !client.url.startsWith('chrome-extension://'); }); } function sendMessagePayloadInternalToWindows(clientList, internalPayload) { var e_2, _a; internalPayload.isFirebaseMessaging = true; internalPayload.messageType = MessageType.PUSH_RECEIVED; try { for (var clientList_2 = Object(__WEBPACK_IMPORTED_MODULE_3_tslib__["__values"])(clientList), clientList_2_1 = clientList_2.next(); !clientList_2_1.done; clientList_2_1 = clientList_2.next()) { var client = clientList_2_1.value; client.postMessage(internalPayload); } } catch (e_2_1) { e_2 = { error: e_2_1 }; } finally { try { if (clientList_2_1 && !clientList_2_1.done && (_a = clientList_2.return)) _a.call(clientList_2); } finally { if (e_2) throw e_2.error; } } } function getClientList() { return self.clients.matchAll({ type: 'window', includeUncontrolled: true // TS doesn't know that "type: 'window'" means it'll return WindowClient[] }); } function showNotification(notificationPayloadInternal) { var _a; // Note: Firefox does not support the maxActions property. // https://developer.mozilla.org/en-US/docs/Web/API/notification/maxActions var actions = notificationPayloadInternal.actions; var maxActions = Notification.maxActions; if (actions && maxActions && actions.length > maxActions) { console.warn("This browser only supports " + maxActions + " actions. The remaining actions will not be displayed."); } return self.registration.showNotification((_a = /* title= */ notificationPayloadInternal.title) !== null && _a !== void 0 ? _a : '', notificationPayloadInternal); } function getLink(payload) { var _a, _b, _c; // eslint-disable-next-line camelcase var link = (_b = (_a = payload.fcmOptions) === null || _a === void 0 ? void 0 : _a.link) !== null && _b !== void 0 ? _b : (_c = payload.notification) === null || _c === void 0 ? void 0 : _c.click_action; if (link) { return link; } if (isConsoleMessage(payload.data)) { // Notification created in the Firebase Console. Redirect to origin. return self.location.origin; } else { return null; } } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var WindowController = /** @class */ (function () { function WindowController(firebaseDependencies) { var _this = this; this.firebaseDependencies = firebaseDependencies; this.vapidKey = null; this.onMessageCallback = null; navigator.serviceWorker.addEventListener('message', function (e) { return _this.messageEventListener(e); }); } Object.defineProperty(WindowController.prototype, "app", { get: function () { return this.firebaseDependencies.app; }, enumerable: false, configurable: true }); WindowController.prototype.messageEventListener = function (event) { return Object(__WEBPACK_IMPORTED_MODULE_3_tslib__["__awaiter"])(this, void 0, void 0, function () { var internalPayload, dataPayload; return Object(__WEBPACK_IMPORTED_MODULE_3_tslib__["__generator"])(this, function (_a) { switch (_a.label) { case 0: internalPayload = event.data; if (!internalPayload.isFirebaseMessaging) { return [2 /*return*/]; } // onMessageCallback is either a function or observer/subscriber. // TODO: in the modularization release, have onMessage handle type MessagePayload as supposed to // the legacy payload where some fields are in snake cases. if (this.onMessageCallback && internalPayload.messageType === MessageType.PUSH_RECEIVED) { if (typeof this.onMessageCallback === 'function') { this.onMessageCallback(stripInternalFields(Object.assign({}, internalPayload))); } else { this.onMessageCallback.next(Object.assign({}, internalPayload)); } } dataPayload = internalPayload.data; if (!(isConsoleMessage(dataPayload) && dataPayload[CONSOLE_CAMPAIGN_ANALYTICS_ENABLED] === '1')) return [3 /*break*/, 2]; return [4 /*yield*/, this.logEvent(internalPayload.messageType, dataPayload)]; case 1: _a.sent(); _a.label = 2; case 2: return [2 /*return*/]; } }); }); }; WindowController.prototype.getVapidKey = function () { return this.vapidKey; }; WindowController.prototype.getSwReg = function () { return this.swRegistration; }; WindowController.prototype.getToken = function (options) { return Object(__WEBPACK_IMPORTED_MODULE_3_tslib__["__awaiter"])(this, void 0, void 0, function () { return Object(__WEBPACK_IMPORTED_MODULE_3_tslib__["__generator"])(this, function (_a) { switch (_a.label) { case 0: if (!(Notification.permission === 'default')) return [3 /*break*/, 2]; return [4 /*yield*/, Notification.requestPermission()]; case 1: _a.sent(); _a.label = 2; case 2: if (Notification.permission !== 'granted') { throw ERROR_FACTORY.create("permission-blocked" /* PERMISSION_BLOCKED */); } return [4 /*yield*/, this.updateVapidKey(options === null || options === void 0 ? void 0 : options.vapidKey)]; case 3: _a.sent(); return [4 /*yield*/, this.updateSwReg(options === null || options === void 0 ? void 0 : options.serviceWorkerRegistration)]; case 4: _a.sent(); return [2 /*return*/, getToken(this.firebaseDependencies, this.swRegistration, this.vapidKey)]; } }); }); }; WindowController.prototype.updateVapidKey = function (vapidKey) { return Object(__WEBPACK_IMPORTED_MODULE_3_tslib__["__awaiter"])(this, void 0, void 0, function () { return Object(__WEBPACK_IMPORTED_MODULE_3_tslib__["__generator"])(this, function (_a) { if (!!vapidKey) { this.vapidKey = vapidKey; } else if (!this.vapidKey) { this.vapidKey = DEFAULT_VAPID_KEY; } return [2 /*return*/]; }); }); }; WindowController.prototype.updateSwReg = function (swRegistration) { return Object(__WEBPACK_IMPORTED_MODULE_3_tslib__["__awaiter"])(this, void 0, void 0, function () { return Object(__WEBPACK_IMPORTED_MODULE_3_tslib__["__generator"])(this, function (_a) { switch (_a.label) { case 0: if (!(!swRegistration && !this.swRegistration)) return [3 /*break*/, 2]; return [4 /*yield*/, this.registerDefaultSw()]; case 1: _a.sent(); _a.label = 2; case 2: if (!swRegistration && !!this.swRegistration) { return [2 /*return*/]; } if (!(swRegistration instanceof ServiceWorkerRegistration)) { throw ERROR_FACTORY.create("invalid-sw-registration" /* INVALID_SW_REGISTRATION */); } this.swRegistration = swRegistration; return [2 /*return*/]; } }); }); }; WindowController.prototype.registerDefaultSw = function () { return Object(__WEBPACK_IMPORTED_MODULE_3_tslib__["__awaiter"])(this, void 0, void 0, function () { var _a, e_1; return Object(__WEBPACK_IMPORTED_MODULE_3_tslib__["__generator"])(this, function (_b) { switch (_b.label) { case 0: _b.trys.push([0, 2, , 3]); _a = this; return [4 /*yield*/, navigator.serviceWorker.register(DEFAULT_SW_PATH, { scope: DEFAULT_SW_SCOPE })]; case 1: _a.swRegistration = _b.sent(); // The timing when browser updates sw when sw has an update is unreliable by my experiment. It // leads to version conflict when the SDK upgrades to a newer version in the main page, but sw // is stuck with the old version. For example, // https://github.com/firebase/firebase-js-sdk/issues/2590 The following line reliably updates // sw if there was an update. this.swRegistration.update().catch(function () { /* it is non blocking and we don't care if it failed */ }); return [3 /*break*/, 3]; case 2: e_1 = _b.sent(); throw ERROR_FACTORY.create("failed-service-worker-registration" /* FAILED_DEFAULT_REGISTRATION */, { browserErrorMessage: e_1.message }); case 3: return [2 /*return*/]; } }); }); }; WindowController.prototype.deleteToken = function () { return Object(__WEBPACK_IMPORTED_MODULE_3_tslib__["__awaiter"])(this, void 0, void 0, function () { return Object(__WEBPACK_IMPORTED_MODULE_3_tslib__["__generator"])(this, function (_a) { switch (_a.label) { case 0: if (!!this.swRegistration) return [3 /*break*/, 2]; return [4 /*yield*/, this.registerDefaultSw()]; case 1: _a.sent(); _a.label = 2; case 2: return [2 /*return*/, deleteToken(this.firebaseDependencies, this.swRegistration)]; } }); }); }; /** * Request permission if it is not currently granted. * * @return Resolves if the permission was granted, rejects otherwise. * * @deprecated Use Notification.requestPermission() instead. * https://developer.mozilla.org/en-US/docs/Web/API/Notification/requestPermission */ WindowController.prototype.requestPermission = function () { return Object(__WEBPACK_IMPORTED_MODULE_3_tslib__["__awaiter"])(this, void 0, void 0, function () { var permissionResult; return Object(__WEBPACK_IMPORTED_MODULE_3_tslib__["__generator"])(this, function (_a) { switch (_a.label) { case 0: if (Notification.permission === 'granted') { return [2 /*return*/]; } return [4 /*yield*/, Notification.requestPermission()]; case 1: permissionResult = _a.sent(); if (permissionResult === 'granted') { return [2 /*return*/]; } else if (permissionResult === 'denied') { throw ERROR_FACTORY.create("permission-blocked" /* PERMISSION_BLOCKED */); } else { throw ERROR_FACTORY.create("permission-default" /* PERMISSION_DEFAULT */); } } }); }); }; /** * @deprecated. Use getToken(options?: {vapidKey?: string; serviceWorkerRegistration?: * ServiceWorkerRegistration;}): Promise<string> instead. */ WindowController.prototype.usePublicVapidKey = function (vapidKey) { if (this.vapidKey !== null) { throw ERROR_FACTORY.create("use-vapid-key-after-get-token" /* USE_VAPID_KEY_AFTER_GET_TOKEN */); } if (typeof vapidKey !== 'string' || vapidKey.length === 0) { throw ERROR_FACTORY.create("invalid-vapid-key" /* INVALID_VAPID_KEY */); } this.vapidKey = vapidKey; }; /** * @deprecated. Use getToken(options?: {vapidKey?: string; serviceWorkerRegistration?: * ServiceWorkerRegistration;}): Promise<string> instead. */ WindowController.prototype.useServiceWorker = function (swRegistration) { if (!(swRegistration instanceof ServiceWorkerRegistration)) { throw ERROR_FACTORY.create("invalid-sw-registration" /* INVALID_SW_REGISTRATION */); } if (this.swRegistration) { throw ERROR_FACTORY.create("use-sw-after-get-token" /* USE_SW_AFTER_GET_TOKEN */); } this.swRegistration = swRegistration; }; /** * @param nextOrObserver An observer object or a function triggered on message. * * @return The unsubscribe function for the observer. */ WindowController.prototype.onMessage = function (nextOrObserver) { var _this = this; this.onMessageCallback = nextOrObserver; return function () { _this.onMessageCallback = null; }; }; WindowController.prototype.setBackgroundMessageHandler = function () { throw ERROR_FACTORY.create("only-available-in-sw" /* AVAILABLE_IN_SW */); }; WindowController.prototype.onBackgroundMessage = function () { throw ERROR_FACTORY.create("only-available-in-sw" /* AVAILABLE_IN_SW */); }; /** * @deprecated No-op. It was initially designed with token rotation requests from server in mind. * However, the plan to implement such feature was abandoned. */ WindowController.prototype.onTokenRefresh = function () { return function () { }; }; WindowController.prototype.logEvent = function (messageType, data) { return Object(__WEBPACK_IMPORTED_MODULE_3_tslib__["__awaiter"])(this, void 0, void 0, function () { var eventType, analytics; return Object(__WEBPACK_IMPORTED_MODULE_3_tslib__["__generator"])(this, function (_a) { switch (_a.label) { case 0: eventType = getEventType(messageType); return [4 /*yield*/, this.firebaseDependencies.analyticsProvider.get()]; case 1: analytics = _a.sent(); analytics.logEvent(eventType, { /* eslint-disable camelcase */ message_id: data[CONSOLE_CAMPAIGN_ID], message_name: data[CONSOLE_CAMPAIGN_NAME], message_time: data[CONSOLE_CAMPAIGN_TIME], message_device_time: Math.floor(Date.now() / 1000) /* eslint-enable camelcase */ }); return [2 /*return*/]; } }); }); }; return WindowController; }()); function getEventType(messageType) { switch (messageType) { case MessageType.NOTIFICATION_CLICKED: return 'notification_open'; case MessageType.PUSH_RECEIVED: return 'notification_foreground'; default: throw new Error(); } } function stripInternalFields(internalPayload) { delete internalPayload.messageType; delete internalPayload.isFirebaseMessaging; return internalPayload; } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ function extractAppConfig(app) { var e_1, _a; if (!app || !app.options) { throw getMissingValueError('App Configuration Object'); } if (!app.name) { throw getMissingValueError('App Name'); } // Required app config keys var configKeys = [ 'projectId', 'apiKey', 'appId', 'messagingSenderId' ]; var options = app.options; try { for (var configKeys_1 = Object(__WEBPACK_IMPORTED_MODULE_3_tslib__["__values"])(configKeys), configKeys_1_1 = configKeys_1.next(); !configKeys_1_1.done; configKeys_1_1 = configKeys_1.next()) { var keyName = configKeys_1_1.value; if (!options[keyName]) { throw getMissingValueError(keyName); } } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (configKeys_1_1 && !configKeys_1_1.done && (_a = configKeys_1.return)) _a.call(configKeys_1); } finally { if (e_1) throw e_1.error; } } return { appName: app.name, projectId: options.projectId, apiKey: options.apiKey, appId: options.appId, senderId: options.messagingSenderId }; } function getMissingValueError(valueName) { return ERROR_FACTORY.create("missing-app-config-values" /* MISSING_APP_CONFIG_VALUES */, { valueName: valueName }); } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var MESSAGING_NAME = 'messaging'; function factoryMethod(container) { // Dependencies. var app = container.getProvider('app').getImmediate(); var appConfig = extractAppConfig(app); var installations = container.getProvider('installations').getImmediate(); var analyticsProvider = container.getProvider('analytics-internal'); var firebaseDependencies = { app: app, appConfig: appConfig, installations: installations, analyticsProvider: analyticsProvider }; if (!isSupported()) { throw ERROR_FACTORY.create("unsupported-browser" /* UNSUPPORTED_BROWSER */); } if (self && 'ServiceWorkerGlobalScope' in self) { // Running in ServiceWorker context return new SwController(firebaseDependencies); } else { // Assume we are in the window context. return new WindowController(firebaseDependencies); } } var NAMESPACE_EXPORTS = { isSupported: isSupported }; __WEBPACK_IMPORTED_MODULE_5__firebase_app___default.a.INTERNAL.registerComponent(new __WEBPACK_IMPORTED_MODULE_1__firebase_component__["Component"](MESSAGING_NAME, factoryMethod, "PUBLIC" /* PUBLIC */).setServiceProps(NAMESPACE_EXPORTS)); function isSupported() { if (self && 'ServiceWorkerGlobalScope' in self) { // Running in ServiceWorker context return isSWControllerSupported(); } else { // Assume we are in the window context. return isWindowControllerSupported(); } } /** * Checks to see if the required APIs exist. */ function isWindowControllerSupported() { return ('indexedDB' in window && indexedDB !== null && navigator.cookieEnabled && 'serviceWorker' in navigator && 'PushManager' in window && 'Notification' in window && 'fetch' in window && ServiceWorkerRegistration.prototype.hasOwnProperty('showNotification') && PushSubscription.prototype.hasOwnProperty('getKey')); } /** * Checks to see if the required APIs exist within SW Context. */ function isSWControllerSupported() { return ('indexedDB' in self && indexedDB !== null && 'PushManager' in self && 'Notification' in self && ServiceWorkerRegistration.prototype.hasOwnProperty('showNotification') && PushSubscription.prototype.hasOwnProperty('getKey')); } //# sourceMappingURL=index.esm.js.map /***/ }), /***/ "./node_modules/@firebase/messaging/node_modules/@firebase/component/dist/index.cjs.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, '__esModule', { value: true }); var tslib = __webpack_require__("./node_modules/@firebase/messaging/node_modules/tslib/tslib.es6.js"); var util = __webpack_require__("./node_modules/@firebase/messaging/node_modules/@firebase/util/dist/index.cjs.js"); /** * Component for service name T, e.g. `auth`, `auth-internal` */ var Component = /** @class */ (function () { /** * * @param name The public service name, e.g. app, auth, firestore, database * @param instanceFactory Service factory responsible for creating the public interface * @param type whether the service provided by the component is public or private */ function Component(name, instanceFactory, type) { this.name = name; this.instanceFactory = instanceFactory; this.type = type; this.multipleInstances = false; /** * Properties to be added to the service namespace */ this.serviceProps = {}; this.instantiationMode = "LAZY" /* LAZY */; } Component.prototype.setInstantiationMode = function (mode) { this.instantiationMode = mode; return this; }; Component.prototype.setMultipleInstances = function (multipleInstances) { this.multipleInstances = multipleInstances; return this; }; Component.prototype.setServiceProps = function (props) { this.serviceProps = props; return this; }; return Component; }()); /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var DEFAULT_ENTRY_NAME = '[DEFAULT]'; /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Provider for instance for service name T, e.g. 'auth', 'auth-internal' * NameServiceMapping[T] is an alias for the type of the instance */ var Provider = /** @class */ (function () { function Provider(name, container) { this.name = name; this.container = container; this.component = null; this.instances = new Map(); this.instancesDeferred = new Map(); } /** * @param identifier A provider can provide mulitple instances of a service * if this.component.multipleInstances is true. */ Provider.prototype.get = function (identifier) { if (identifier === void 0) { identifier = DEFAULT_ENTRY_NAME; } // if multipleInstances is not supported, use the default name var normalizedIdentifier = this.normalizeInstanceIdentifier(identifier); if (!this.instancesDeferred.has(normalizedIdentifier)) { var deferred = new util.Deferred(); this.instancesDeferred.set(normalizedIdentifier, deferred); // If the service instance is available, resolve the promise with it immediately try { var instance = this.getOrInitializeService(normalizedIdentifier); if (instance) { deferred.resolve(instance); } } catch (e) { // when the instance factory throws an exception during get(), it should not cause // a fatal error. We just return the unresolved promise in this case. } } return this.instancesDeferred.get(normalizedIdentifier).promise; }; Provider.prototype.getImmediate = function (options) { var _a = tslib.__assign({ identifier: DEFAULT_ENTRY_NAME, optional: false }, options), identifier = _a.identifier, optional = _a.optional; // if multipleInstances is not supported, use the default name var normalizedIdentifier = this.normalizeInstanceIdentifier(identifier); try { var instance = this.getOrInitializeService(normalizedIdentifier); if (!instance) { if (optional) { return null; } throw Error("Service " + this.name + " is not available"); } return instance; } catch (e) { if (optional) { return null; } else { throw e; } } }; Provider.prototype.getComponent = function () { return this.component; }; Provider.prototype.setComponent = function (component) { var e_1, _a; if (component.name !== this.name) { throw Error("Mismatching Component " + component.name + " for Provider " + this.name + "."); } if (this.component) { throw Error("Component for " + this.name + " has already been provided"); } this.component = component; // if the service is eager, initialize the default instance if (isComponentEager(component)) { try { this.getOrInitializeService(DEFAULT_ENTRY_NAME); } catch (e) { // when the instance factory for an eager Component throws an exception during the eager // initialization, it should not cause a fatal error. // TODO: Investigate if we need to make it configurable, because some component may want to cause // a fatal error in this case? } } try { // Create service instances for the pending promises and resolve them // NOTE: if this.multipleInstances is false, only the default instance will be created // and all promises with resolve with it regardless of the identifier. for (var _b = tslib.__values(this.instancesDeferred.entries()), _c = _b.next(); !_c.done; _c = _b.next()) { var _d = tslib.__read(_c.value, 2), instanceIdentifier = _d[0], instanceDeferred = _d[1]; var normalizedIdentifier = this.normalizeInstanceIdentifier(instanceIdentifier); try { // `getOrInitializeService()` should always return a valid instance since a component is guaranteed. use ! to make typescript happy. var instance = this.getOrInitializeService(normalizedIdentifier); instanceDeferred.resolve(instance); } catch (e) { // when the instance factory throws an exception, it should not cause // a fatal error. We just leave the promise unresolved. } } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (_c && !_c.done && (_a = _b.return)) _a.call(_b); } finally { if (e_1) throw e_1.error; } } }; Provider.prototype.clearInstance = function (identifier) { if (identifier === void 0) { identifier = DEFAULT_ENTRY_NAME; } this.instancesDeferred.delete(identifier); this.instances.delete(identifier); }; // app.delete() will call this method on every provider to delete the services // TODO: should we mark the provider as deleted? Provider.prototype.delete = function () { return tslib.__awaiter(this, void 0, void 0, function () { var services; return tslib.__generator(this, function (_a) { switch (_a.label) { case 0: services = Array.from(this.instances.values()); return [4 /*yield*/, Promise.all(tslib.__spread(services .filter(function (service) { return 'INTERNAL' in service; }) // legacy services // eslint-disable-next-line @typescript-eslint/no-explicit-any .map(function (service) { return service.INTERNAL.delete(); }), services .filter(function (service) { return '_delete' in service; }) // modularized services // eslint-disable-next-line @typescript-eslint/no-explicit-any .map(function (service) { return service._delete(); })))]; case 1: _a.sent(); return [2 /*return*/]; } }); }); }; Provider.prototype.isComponentSet = function () { return this.component != null; }; Provider.prototype.getOrInitializeService = function (identifier) { var instance = this.instances.get(identifier); if (!instance && this.component) { instance = this.component.instanceFactory(this.container, normalizeIdentifierForFactory(identifier)); this.instances.set(identifier, instance); } return instance || null; }; Provider.prototype.normalizeInstanceIdentifier = function (identifier) { if (this.component) { return this.component.multipleInstances ? identifier : DEFAULT_ENTRY_NAME; } else { return identifier; // assume multiple instances are supported before the component is provided. } }; return Provider; }()); // undefined should be passed to the service factory for the default instance function normalizeIdentifierForFactory(identifier) { return identifier === DEFAULT_ENTRY_NAME ? undefined : identifier; } function isComponentEager(component) { return component.instantiationMode === "EAGER" /* EAGER */; } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * ComponentContainer that provides Providers for service name T, e.g. `auth`, `auth-internal` */ var ComponentContainer = /** @class */ (function () { function ComponentContainer(name) { this.name = name; this.providers = new Map(); } /** * * @param component Component being added * @param overwrite When a component with the same name has already been registered, * if overwrite is true: overwrite the existing component with the new component and create a new * provider with the new component. It can be useful in tests where you want to use different mocks * for different tests. * if overwrite is false: throw an exception */ ComponentContainer.prototype.addComponent = function (component) { var provider = this.getProvider(component.name); if (provider.isComponentSet()) { throw new Error("Component " + component.name + " has already been registered with " + this.name); } provider.setComponent(component); }; ComponentContainer.prototype.addOrOverwriteComponent = function (component) { var provider = this.getProvider(component.name); if (provider.isComponentSet()) { // delete the existing provider from the container, so we can register the new component this.providers.delete(component.name); } this.addComponent(component); }; /** * getProvider provides a type safe interface where it can only be called with a field name * present in NameServiceMapping interface. * * Firebase SDKs providing services should extend NameServiceMapping interface to register * themselves. */ ComponentContainer.prototype.getProvider = function (name) { if (this.providers.has(name)) { return this.providers.get(name); } // create a Provider for a service that hasn't registered with Firebase var provider = new Provider(name, this); this.providers.set(name, provider); return provider; }; ComponentContainer.prototype.getProviders = function () { return Array.from(this.providers.values()); }; return ComponentContainer; }()); exports.Component = Component; exports.ComponentContainer = ComponentContainer; exports.Provider = Provider; //# sourceMappingURL=index.cjs.js.map /***/ }), /***/ "./node_modules/@firebase/messaging/node_modules/@firebase/installations/dist/index.esm.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export registerInstallations */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__firebase_app__ = __webpack_require__("./node_modules/@firebase/app/dist/index.cjs.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__firebase_app___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__firebase_app__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__firebase_component__ = __webpack_require__("./node_modules/@firebase/messaging/node_modules/@firebase/component/dist/index.cjs.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__firebase_component___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1__firebase_component__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_tslib__ = __webpack_require__("./node_modules/@firebase/messaging/node_modules/tslib/tslib.es6.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__firebase_util__ = __webpack_require__("./node_modules/@firebase/messaging/node_modules/@firebase/util/dist/index.cjs.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__firebase_util___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3__firebase_util__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_idb__ = __webpack_require__("./node_modules/idb/build/idb.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_idb___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_idb__); var name = "@firebase/installations"; var version = "0.4.17"; /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var PENDING_TIMEOUT_MS = 10000; var PACKAGE_VERSION = "w:" + version; var INTERNAL_AUTH_VERSION = 'FIS_v2'; var INSTALLATIONS_API_URL = 'https://firebaseinstallations.googleapis.com/v1'; var TOKEN_EXPIRATION_BUFFER = 60 * 60 * 1000; // One hour var SERVICE = 'installations'; var SERVICE_NAME = 'Installations'; /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var _a; var ERROR_DESCRIPTION_MAP = (_a = {}, _a["missing-app-config-values" /* MISSING_APP_CONFIG_VALUES */] = 'Missing App configuration value: "{$valueName}"', _a["not-registered" /* NOT_REGISTERED */] = 'Firebase Installation is not registered.', _a["installation-not-found" /* INSTALLATION_NOT_FOUND */] = 'Firebase Installation not found.', _a["request-failed" /* REQUEST_FAILED */] = '{$requestName} request failed with error "{$serverCode} {$serverStatus}: {$serverMessage}"', _a["app-offline" /* APP_OFFLINE */] = 'Could not process request. Application offline.', _a["delete-pending-registration" /* DELETE_PENDING_REGISTRATION */] = "Can't delete installation while there is a pending registration request.", _a); var ERROR_FACTORY = new __WEBPACK_IMPORTED_MODULE_3__firebase_util__["ErrorFactory"](SERVICE, SERVICE_NAME, ERROR_DESCRIPTION_MAP); /** Returns true if error is a FirebaseError that is based on an error from the server. */ function isServerError(error) { return (error instanceof __WEBPACK_IMPORTED_MODULE_3__firebase_util__["FirebaseError"] && error.code.includes("request-failed" /* REQUEST_FAILED */)); } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ function getInstallationsEndpoint(_a) { var projectId = _a.projectId; return INSTALLATIONS_API_URL + "/projects/" + projectId + "/installations"; } function extractAuthTokenInfoFromResponse(response) { return { token: response.token, requestStatus: 2 /* COMPLETED */, expiresIn: getExpiresInFromResponseExpiresIn(response.expiresIn), creationTime: Date.now() }; } function getErrorFromResponse(requestName, response) { return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__awaiter"])(this, void 0, void 0, function () { var responseJson, errorData; return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__generator"])(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, response.json()]; case 1: responseJson = _a.sent(); errorData = responseJson.error; return [2 /*return*/, ERROR_FACTORY.create("request-failed" /* REQUEST_FAILED */, { requestName: requestName, serverCode: errorData.code, serverMessage: errorData.message, serverStatus: errorData.status })]; } }); }); } function getHeaders(_a) { var apiKey = _a.apiKey; return new Headers({ 'Content-Type': 'application/json', Accept: 'application/json', 'x-goog-api-key': apiKey }); } function getHeadersWithAuth(appConfig, _a) { var refreshToken = _a.refreshToken; var headers = getHeaders(appConfig); headers.append('Authorization', getAuthorizationHeader(refreshToken)); return headers; } /** * Calls the passed in fetch wrapper and returns the response. * If the returned response has a status of 5xx, re-runs the function once and * returns the response. */ function retryIfServerError(fn) { return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__awaiter"])(this, void 0, void 0, function () { var result; return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__generator"])(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, fn()]; case 1: result = _a.sent(); if (result.status >= 500 && result.status < 600) { // Internal Server Error. Retry request. return [2 /*return*/, fn()]; } return [2 /*return*/, result]; } }); }); } function getExpiresInFromResponseExpiresIn(responseExpiresIn) { // This works because the server will never respond with fractions of a second. return Number(responseExpiresIn.replace('s', '000')); } function getAuthorizationHeader(refreshToken) { return INTERNAL_AUTH_VERSION + " " + refreshToken; } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ function createInstallationRequest(appConfig, _a) { var fid = _a.fid; return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__awaiter"])(this, void 0, void 0, function () { var endpoint, headers, body, request, response, responseValue, registeredInstallationEntry; return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__generator"])(this, function (_b) { switch (_b.label) { case 0: endpoint = getInstallationsEndpoint(appConfig); headers = getHeaders(appConfig); body = { fid: fid, authVersion: INTERNAL_AUTH_VERSION, appId: appConfig.appId, sdkVersion: PACKAGE_VERSION }; request = { method: 'POST', headers: headers, body: JSON.stringify(body) }; return [4 /*yield*/, retryIfServerError(function () { return fetch(endpoint, request); })]; case 1: response = _b.sent(); if (!response.ok) return [3 /*break*/, 3]; return [4 /*yield*/, response.json()]; case 2: responseValue = _b.sent(); registeredInstallationEntry = { fid: responseValue.fid || fid, registrationStatus: 2 /* COMPLETED */, refreshToken: responseValue.refreshToken, authToken: extractAuthTokenInfoFromResponse(responseValue.authToken) }; return [2 /*return*/, registeredInstallationEntry]; case 3: return [4 /*yield*/, getErrorFromResponse('Create Installation', response)]; case 4: throw _b.sent(); } }); }); } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** Returns a promise that resolves after given time passes. */ function sleep(ms) { return new Promise(function (resolve) { setTimeout(resolve, ms); }); } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ function bufferToBase64UrlSafe(array) { var b64 = btoa(String.fromCharCode.apply(String, Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__spread"])(array))); return b64.replace(/\+/g, '-').replace(/\//g, '_'); } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var VALID_FID_PATTERN = /^[cdef][\w-]{21}$/; var INVALID_FID = ''; /** * Generates a new FID using random values from Web Crypto API. * Returns an empty string if FID generation fails for any reason. */ function generateFid() { try { // A valid FID has exactly 22 base64 characters, which is 132 bits, or 16.5 // bytes. our implementation generates a 17 byte array instead. var fidByteArray = new Uint8Array(17); var crypto_1 = self.crypto || self.msCrypto; crypto_1.getRandomValues(fidByteArray); // Replace the first 4 random bits with the constant FID header of 0b0111. fidByteArray[0] = 112 + (fidByteArray[0] % 16); var fid = encode(fidByteArray); return VALID_FID_PATTERN.test(fid) ? fid : INVALID_FID; } catch (_a) { // FID generation errored return INVALID_FID; } } /** Converts a FID Uint8Array to a base64 string representation. */ function encode(fidByteArray) { var b64String = bufferToBase64UrlSafe(fidByteArray); // Remove the 23rd character that was added because of the extra 4 bits at the // end of our 17 byte array, and the '=' padding. return b64String.substr(0, 22); } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** Returns a string key that can be used to identify the app. */ function getKey(appConfig) { return appConfig.appName + "!" + appConfig.appId; } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var fidChangeCallbacks = new Map(); /** * Calls the onIdChange callbacks with the new FID value, and broadcasts the * change to other tabs. */ function fidChanged(appConfig, fid) { var key = getKey(appConfig); callFidChangeCallbacks(key, fid); broadcastFidChange(key, fid); } function addCallback(appConfig, callback) { // Open the broadcast channel if it's not already open, // to be able to listen to change events from other tabs. getBroadcastChannel(); var key = getKey(appConfig); var callbackSet = fidChangeCallbacks.get(key); if (!callbackSet) { callbackSet = new Set(); fidChangeCallbacks.set(key, callbackSet); } callbackSet.add(callback); } function removeCallback(appConfig, callback) { var key = getKey(appConfig); var callbackSet = fidChangeCallbacks.get(key); if (!callbackSet) { return; } callbackSet.delete(callback); if (callbackSet.size === 0) { fidChangeCallbacks.delete(key); } // Close broadcast channel if there are no more callbacks. closeBroadcastChannel(); } function callFidChangeCallbacks(key, fid) { var e_1, _a; var callbacks = fidChangeCallbacks.get(key); if (!callbacks) { return; } try { for (var callbacks_1 = Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__values"])(callbacks), callbacks_1_1 = callbacks_1.next(); !callbacks_1_1.done; callbacks_1_1 = callbacks_1.next()) { var callback = callbacks_1_1.value; callback(fid); } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (callbacks_1_1 && !callbacks_1_1.done && (_a = callbacks_1.return)) _a.call(callbacks_1); } finally { if (e_1) throw e_1.error; } } } function broadcastFidChange(key, fid) { var channel = getBroadcastChannel(); if (channel) { channel.postMessage({ key: key, fid: fid }); } closeBroadcastChannel(); } var broadcastChannel = null; /** Opens and returns a BroadcastChannel if it is supported by the browser. */ function getBroadcastChannel() { if (!broadcastChannel && 'BroadcastChannel' in self) { broadcastChannel = new BroadcastChannel('[Firebase] FID Change'); broadcastChannel.onmessage = function (e) { callFidChangeCallbacks(e.data.key, e.data.fid); }; } return broadcastChannel; } function closeBroadcastChannel() { if (fidChangeCallbacks.size === 0 && broadcastChannel) { broadcastChannel.close(); broadcastChannel = null; } } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var DATABASE_NAME = 'firebase-installations-database'; var DATABASE_VERSION = 1; var OBJECT_STORE_NAME = 'firebase-installations-store'; var dbPromise = null; function getDbPromise() { if (!dbPromise) { dbPromise = Object(__WEBPACK_IMPORTED_MODULE_4_idb__["openDb"])(DATABASE_NAME, DATABASE_VERSION, function (upgradeDB) { // We don't use 'break' in this switch statement, the fall-through // behavior is what we want, because if there are multiple versions between // the old version and the current version, we want ALL the migrations // that correspond to those versions to run, not only the last one. // eslint-disable-next-line default-case switch (upgradeDB.oldVersion) { case 0: upgradeDB.createObjectStore(OBJECT_STORE_NAME); } }); } return dbPromise; } /** Assigns or overwrites the record for the given key with the given value. */ function set(appConfig, value) { return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__awaiter"])(this, void 0, void 0, function () { var key, db, tx, objectStore, oldValue; return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__generator"])(this, function (_a) { switch (_a.label) { case 0: key = getKey(appConfig); return [4 /*yield*/, getDbPromise()]; case 1: db = _a.sent(); tx = db.transaction(OBJECT_STORE_NAME, 'readwrite'); objectStore = tx.objectStore(OBJECT_STORE_NAME); return [4 /*yield*/, objectStore.get(key)]; case 2: oldValue = _a.sent(); return [4 /*yield*/, objectStore.put(value, key)]; case 3: _a.sent(); return [4 /*yield*/, tx.complete]; case 4: _a.sent(); if (!oldValue || oldValue.fid !== value.fid) { fidChanged(appConfig, value.fid); } return [2 /*return*/, value]; } }); }); } /** Removes record(s) from the objectStore that match the given key. */ function remove(appConfig) { return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__awaiter"])(this, void 0, void 0, function () { var key, db, tx; return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__generator"])(this, function (_a) { switch (_a.label) { case 0: key = getKey(appConfig); return [4 /*yield*/, getDbPromise()]; case 1: db = _a.sent(); tx = db.transaction(OBJECT_STORE_NAME, 'readwrite'); return [4 /*yield*/, tx.objectStore(OBJECT_STORE_NAME).delete(key)]; case 2: _a.sent(); return [4 /*yield*/, tx.complete]; case 3: _a.sent(); return [2 /*return*/]; } }); }); } /** * Atomically updates a record with the result of updateFn, which gets * called with the current value. If newValue is undefined, the record is * deleted instead. * @return Updated value */ function update(appConfig, updateFn) { return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__awaiter"])(this, void 0, void 0, function () { var key, db, tx, store, oldValue, newValue; return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__generator"])(this, function (_a) { switch (_a.label) { case 0: key = getKey(appConfig); return [4 /*yield*/, getDbPromise()]; case 1: db = _a.sent(); tx = db.transaction(OBJECT_STORE_NAME, 'readwrite'); store = tx.objectStore(OBJECT_STORE_NAME); return [4 /*yield*/, store.get(key)]; case 2: oldValue = _a.sent(); newValue = updateFn(oldValue); if (!(newValue === undefined)) return [3 /*break*/, 4]; return [4 /*yield*/, store.delete(key)]; case 3: _a.sent(); return [3 /*break*/, 6]; case 4: return [4 /*yield*/, store.put(newValue, key)]; case 5: _a.sent(); _a.label = 6; case 6: return [4 /*yield*/, tx.complete]; case 7: _a.sent(); if (newValue && (!oldValue || oldValue.fid !== newValue.fid)) { fidChanged(appConfig, newValue.fid); } return [2 /*return*/, newValue]; } }); }); } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Updates and returns the InstallationEntry from the database. * Also triggers a registration request if it is necessary and possible. */ function getInstallationEntry(appConfig) { return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__awaiter"])(this, void 0, void 0, function () { var registrationPromise, installationEntry; var _a; return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__generator"])(this, function (_b) { switch (_b.label) { case 0: return [4 /*yield*/, update(appConfig, function (oldEntry) { var installationEntry = updateOrCreateInstallationEntry(oldEntry); var entryWithPromise = triggerRegistrationIfNecessary(appConfig, installationEntry); registrationPromise = entryWithPromise.registrationPromise; return entryWithPromise.installationEntry; })]; case 1: installationEntry = _b.sent(); if (!(installationEntry.fid === INVALID_FID)) return [3 /*break*/, 3]; _a = {}; return [4 /*yield*/, registrationPromise]; case 2: // FID generation failed. Waiting for the FID from the server. return [2 /*return*/, (_a.installationEntry = _b.sent(), _a)]; case 3: return [2 /*return*/, { installationEntry: installationEntry, registrationPromise: registrationPromise }]; } }); }); } /** * Creates a new Installation Entry if one does not exist. * Also clears timed out pending requests. */ function updateOrCreateInstallationEntry(oldEntry) { var entry = oldEntry || { fid: generateFid(), registrationStatus: 0 /* NOT_STARTED */ }; return clearTimedOutRequest(entry); } /** * If the Firebase Installation is not registered yet, this will trigger the * registration and return an InProgressInstallationEntry. * * If registrationPromise does not exist, the installationEntry is guaranteed * to be registered. */ function triggerRegistrationIfNecessary(appConfig, installationEntry) { if (installationEntry.registrationStatus === 0 /* NOT_STARTED */) { if (!navigator.onLine) { // Registration required but app is offline. var registrationPromiseWithError = Promise.reject(ERROR_FACTORY.create("app-offline" /* APP_OFFLINE */)); return { installationEntry: installationEntry, registrationPromise: registrationPromiseWithError }; } // Try registering. Change status to IN_PROGRESS. var inProgressEntry = { fid: installationEntry.fid, registrationStatus: 1 /* IN_PROGRESS */, registrationTime: Date.now() }; var registrationPromise = registerInstallation(appConfig, inProgressEntry); return { installationEntry: inProgressEntry, registrationPromise: registrationPromise }; } else if (installationEntry.registrationStatus === 1 /* IN_PROGRESS */) { return { installationEntry: installationEntry, registrationPromise: waitUntilFidRegistration(appConfig) }; } else { return { installationEntry: installationEntry }; } } /** This will be executed only once for each new Firebase Installation. */ function registerInstallation(appConfig, installationEntry) { return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__awaiter"])(this, void 0, void 0, function () { var registeredInstallationEntry, e_1; return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__generator"])(this, function (_a) { switch (_a.label) { case 0: _a.trys.push([0, 2, , 7]); return [4 /*yield*/, createInstallationRequest(appConfig, installationEntry)]; case 1: registeredInstallationEntry = _a.sent(); return [2 /*return*/, set(appConfig, registeredInstallationEntry)]; case 2: e_1 = _a.sent(); if (!(isServerError(e_1) && e_1.serverCode === 409)) return [3 /*break*/, 4]; // Server returned a "FID can not be used" error. // Generate a new ID next time. return [4 /*yield*/, remove(appConfig)]; case 3: // Server returned a "FID can not be used" error. // Generate a new ID next time. _a.sent(); return [3 /*break*/, 6]; case 4: // Registration failed. Set FID as not registered. return [4 /*yield*/, set(appConfig, { fid: installationEntry.fid, registrationStatus: 0 /* NOT_STARTED */ })]; case 5: // Registration failed. Set FID as not registered. _a.sent(); _a.label = 6; case 6: throw e_1; case 7: return [2 /*return*/]; } }); }); } /** Call if FID registration is pending in another request. */ function waitUntilFidRegistration(appConfig) { return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__awaiter"])(this, void 0, void 0, function () { var entry, _a, installationEntry, registrationPromise; return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__generator"])(this, function (_b) { switch (_b.label) { case 0: return [4 /*yield*/, updateInstallationRequest(appConfig)]; case 1: entry = _b.sent(); _b.label = 2; case 2: if (!(entry.registrationStatus === 1 /* IN_PROGRESS */)) return [3 /*break*/, 5]; // createInstallation request still in progress. return [4 /*yield*/, sleep(100)]; case 3: // createInstallation request still in progress. _b.sent(); return [4 /*yield*/, updateInstallationRequest(appConfig)]; case 4: entry = _b.sent(); return [3 /*break*/, 2]; case 5: if (!(entry.registrationStatus === 0 /* NOT_STARTED */)) return [3 /*break*/, 7]; return [4 /*yield*/, getInstallationEntry(appConfig)]; case 6: _a = _b.sent(), installationEntry = _a.installationEntry, registrationPromise = _a.registrationPromise; if (registrationPromise) { return [2 /*return*/, registrationPromise]; } else { // if there is no registrationPromise, entry is registered. return [2 /*return*/, installationEntry]; } case 7: return [2 /*return*/, entry]; } }); }); } /** * Called only if there is a CreateInstallation request in progress. * * Updates the InstallationEntry in the DB based on the status of the * CreateInstallation request. * * Returns the updated InstallationEntry. */ function updateInstallationRequest(appConfig) { return update(appConfig, function (oldEntry) { if (!oldEntry) { throw ERROR_FACTORY.create("installation-not-found" /* INSTALLATION_NOT_FOUND */); } return clearTimedOutRequest(oldEntry); }); } function clearTimedOutRequest(entry) { if (hasInstallationRequestTimedOut(entry)) { return { fid: entry.fid, registrationStatus: 0 /* NOT_STARTED */ }; } return entry; } function hasInstallationRequestTimedOut(installationEntry) { return (installationEntry.registrationStatus === 1 /* IN_PROGRESS */ && installationEntry.registrationTime + PENDING_TIMEOUT_MS < Date.now()); } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ function generateAuthTokenRequest(_a, installationEntry) { var appConfig = _a.appConfig, platformLoggerProvider = _a.platformLoggerProvider; return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__awaiter"])(this, void 0, void 0, function () { var endpoint, headers, platformLogger, body, request, response, responseValue, completedAuthToken; return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__generator"])(this, function (_b) { switch (_b.label) { case 0: endpoint = getGenerateAuthTokenEndpoint(appConfig, installationEntry); headers = getHeadersWithAuth(appConfig, installationEntry); platformLogger = platformLoggerProvider.getImmediate({ optional: true }); if (platformLogger) { headers.append('x-firebase-client', platformLogger.getPlatformInfoString()); } body = { installation: { sdkVersion: PACKAGE_VERSION } }; request = { method: 'POST', headers: headers, body: JSON.stringify(body) }; return [4 /*yield*/, retryIfServerError(function () { return fetch(endpoint, request); })]; case 1: response = _b.sent(); if (!response.ok) return [3 /*break*/, 3]; return [4 /*yield*/, response.json()]; case 2: responseValue = _b.sent(); completedAuthToken = extractAuthTokenInfoFromResponse(responseValue); return [2 /*return*/, completedAuthToken]; case 3: return [4 /*yield*/, getErrorFromResponse('Generate Auth Token', response)]; case 4: throw _b.sent(); } }); }); } function getGenerateAuthTokenEndpoint(appConfig, _a) { var fid = _a.fid; return getInstallationsEndpoint(appConfig) + "/" + fid + "/authTokens:generate"; } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Returns a valid authentication token for the installation. Generates a new * token if one doesn't exist, is expired or about to expire. * * Should only be called if the Firebase Installation is registered. */ function refreshAuthToken(dependencies, forceRefresh) { if (forceRefresh === void 0) { forceRefresh = false; } return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__awaiter"])(this, void 0, void 0, function () { var tokenPromise, entry, authToken, _a; return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__generator"])(this, function (_b) { switch (_b.label) { case 0: return [4 /*yield*/, update(dependencies.appConfig, function (oldEntry) { if (!isEntryRegistered(oldEntry)) { throw ERROR_FACTORY.create("not-registered" /* NOT_REGISTERED */); } var oldAuthToken = oldEntry.authToken; if (!forceRefresh && isAuthTokenValid(oldAuthToken)) { // There is a valid token in the DB. return oldEntry; } else if (oldAuthToken.requestStatus === 1 /* IN_PROGRESS */) { // There already is a token request in progress. tokenPromise = waitUntilAuthTokenRequest(dependencies, forceRefresh); return oldEntry; } else { // No token or token expired. if (!navigator.onLine) { throw ERROR_FACTORY.create("app-offline" /* APP_OFFLINE */); } var inProgressEntry = makeAuthTokenRequestInProgressEntry(oldEntry); tokenPromise = fetchAuthTokenFromServer(dependencies, inProgressEntry); return inProgressEntry; } })]; case 1: entry = _b.sent(); if (!tokenPromise) return [3 /*break*/, 3]; return [4 /*yield*/, tokenPromise]; case 2: _a = _b.sent(); return [3 /*break*/, 4]; case 3: _a = entry.authToken; _b.label = 4; case 4: authToken = _a; return [2 /*return*/, authToken]; } }); }); } /** * Call only if FID is registered and Auth Token request is in progress. * * Waits until the current pending request finishes. If the request times out, * tries once in this thread as well. */ function waitUntilAuthTokenRequest(dependencies, forceRefresh) { return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__awaiter"])(this, void 0, void 0, function () { var entry, authToken; return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__generator"])(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, updateAuthTokenRequest(dependencies.appConfig)]; case 1: entry = _a.sent(); _a.label = 2; case 2: if (!(entry.authToken.requestStatus === 1 /* IN_PROGRESS */)) return [3 /*break*/, 5]; // generateAuthToken still in progress. return [4 /*yield*/, sleep(100)]; case 3: // generateAuthToken still in progress. _a.sent(); return [4 /*yield*/, updateAuthTokenRequest(dependencies.appConfig)]; case 4: entry = _a.sent(); return [3 /*break*/, 2]; case 5: authToken = entry.authToken; if (authToken.requestStatus === 0 /* NOT_STARTED */) { // The request timed out or failed in a different call. Try again. return [2 /*return*/, refreshAuthToken(dependencies, forceRefresh)]; } else { return [2 /*return*/, authToken]; } } }); }); } /** * Called only if there is a GenerateAuthToken request in progress. * * Updates the InstallationEntry in the DB based on the status of the * GenerateAuthToken request. * * Returns the updated InstallationEntry. */ function updateAuthTokenRequest(appConfig) { return update(appConfig, function (oldEntry) { if (!isEntryRegistered(oldEntry)) { throw ERROR_FACTORY.create("not-registered" /* NOT_REGISTERED */); } var oldAuthToken = oldEntry.authToken; if (hasAuthTokenRequestTimedOut(oldAuthToken)) { return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__assign"])(Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__assign"])({}, oldEntry), { authToken: { requestStatus: 0 /* NOT_STARTED */ } }); } return oldEntry; }); } function fetchAuthTokenFromServer(dependencies, installationEntry) { return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__awaiter"])(this, void 0, void 0, function () { var authToken, updatedInstallationEntry, e_1, updatedInstallationEntry; return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__generator"])(this, function (_a) { switch (_a.label) { case 0: _a.trys.push([0, 3, , 8]); return [4 /*yield*/, generateAuthTokenRequest(dependencies, installationEntry)]; case 1: authToken = _a.sent(); updatedInstallationEntry = Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__assign"])(Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__assign"])({}, installationEntry), { authToken: authToken }); return [4 /*yield*/, set(dependencies.appConfig, updatedInstallationEntry)]; case 2: _a.sent(); return [2 /*return*/, authToken]; case 3: e_1 = _a.sent(); if (!(isServerError(e_1) && (e_1.serverCode === 401 || e_1.serverCode === 404))) return [3 /*break*/, 5]; // Server returned a "FID not found" or a "Invalid authentication" error. // Generate a new ID next time. return [4 /*yield*/, remove(dependencies.appConfig)]; case 4: // Server returned a "FID not found" or a "Invalid authentication" error. // Generate a new ID next time. _a.sent(); return [3 /*break*/, 7]; case 5: updatedInstallationEntry = Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__assign"])(Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__assign"])({}, installationEntry), { authToken: { requestStatus: 0 /* NOT_STARTED */ } }); return [4 /*yield*/, set(dependencies.appConfig, updatedInstallationEntry)]; case 6: _a.sent(); _a.label = 7; case 7: throw e_1; case 8: return [2 /*return*/]; } }); }); } function isEntryRegistered(installationEntry) { return (installationEntry !== undefined && installationEntry.registrationStatus === 2 /* COMPLETED */); } function isAuthTokenValid(authToken) { return (authToken.requestStatus === 2 /* COMPLETED */ && !isAuthTokenExpired(authToken)); } function isAuthTokenExpired(authToken) { var now = Date.now(); return (now < authToken.creationTime || authToken.creationTime + authToken.expiresIn < now + TOKEN_EXPIRATION_BUFFER); } /** Returns an updated InstallationEntry with an InProgressAuthToken. */ function makeAuthTokenRequestInProgressEntry(oldEntry) { var inProgressAuthToken = { requestStatus: 1 /* IN_PROGRESS */, requestTime: Date.now() }; return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__assign"])(Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__assign"])({}, oldEntry), { authToken: inProgressAuthToken }); } function hasAuthTokenRequestTimedOut(authToken) { return (authToken.requestStatus === 1 /* IN_PROGRESS */ && authToken.requestTime + PENDING_TIMEOUT_MS < Date.now()); } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ function getId(dependencies) { return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__awaiter"])(this, void 0, void 0, function () { var _a, installationEntry, registrationPromise; return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__generator"])(this, function (_b) { switch (_b.label) { case 0: return [4 /*yield*/, getInstallationEntry(dependencies.appConfig)]; case 1: _a = _b.sent(), installationEntry = _a.installationEntry, registrationPromise = _a.registrationPromise; if (registrationPromise) { registrationPromise.catch(console.error); } else { // If the installation is already registered, update the authentication // token if needed. refreshAuthToken(dependencies).catch(console.error); } return [2 /*return*/, installationEntry.fid]; } }); }); } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ function getToken(dependencies, forceRefresh) { if (forceRefresh === void 0) { forceRefresh = false; } return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__awaiter"])(this, void 0, void 0, function () { var authToken; return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__generator"])(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, completeInstallationRegistration(dependencies.appConfig)]; case 1: _a.sent(); return [4 /*yield*/, refreshAuthToken(dependencies, forceRefresh)]; case 2: authToken = _a.sent(); return [2 /*return*/, authToken.token]; } }); }); } function completeInstallationRegistration(appConfig) { return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__awaiter"])(this, void 0, void 0, function () { var registrationPromise; return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__generator"])(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, getInstallationEntry(appConfig)]; case 1: registrationPromise = (_a.sent()).registrationPromise; if (!registrationPromise) return [3 /*break*/, 3]; // A createInstallation request is in progress. Wait until it finishes. return [4 /*yield*/, registrationPromise]; case 2: // A createInstallation request is in progress. Wait until it finishes. _a.sent(); _a.label = 3; case 3: return [2 /*return*/]; } }); }); } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ function deleteInstallationRequest(appConfig, installationEntry) { return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__awaiter"])(this, void 0, void 0, function () { var endpoint, headers, request, response; return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__generator"])(this, function (_a) { switch (_a.label) { case 0: endpoint = getDeleteEndpoint(appConfig, installationEntry); headers = getHeadersWithAuth(appConfig, installationEntry); request = { method: 'DELETE', headers: headers }; return [4 /*yield*/, retryIfServerError(function () { return fetch(endpoint, request); })]; case 1: response = _a.sent(); if (!!response.ok) return [3 /*break*/, 3]; return [4 /*yield*/, getErrorFromResponse('Delete Installation', response)]; case 2: throw _a.sent(); case 3: return [2 /*return*/]; } }); }); } function getDeleteEndpoint(appConfig, _a) { var fid = _a.fid; return getInstallationsEndpoint(appConfig) + "/" + fid; } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ function deleteInstallation(dependencies) { return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__awaiter"])(this, void 0, void 0, function () { var appConfig, entry; return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__generator"])(this, function (_a) { switch (_a.label) { case 0: appConfig = dependencies.appConfig; return [4 /*yield*/, update(appConfig, function (oldEntry) { if (oldEntry && oldEntry.registrationStatus === 0 /* NOT_STARTED */) { // Delete the unregistered entry without sending a deleteInstallation request. return undefined; } return oldEntry; })]; case 1: entry = _a.sent(); if (!entry) return [3 /*break*/, 6]; if (!(entry.registrationStatus === 1 /* IN_PROGRESS */)) return [3 /*break*/, 2]; // Can't delete while trying to register. throw ERROR_FACTORY.create("delete-pending-registration" /* DELETE_PENDING_REGISTRATION */); case 2: if (!(entry.registrationStatus === 2 /* COMPLETED */)) return [3 /*break*/, 6]; if (!!navigator.onLine) return [3 /*break*/, 3]; throw ERROR_FACTORY.create("app-offline" /* APP_OFFLINE */); case 3: return [4 /*yield*/, deleteInstallationRequest(appConfig, entry)]; case 4: _a.sent(); return [4 /*yield*/, remove(appConfig)]; case 5: _a.sent(); _a.label = 6; case 6: return [2 /*return*/]; } }); }); } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Sets a new callback that will get called when Installation ID changes. * Returns an unsubscribe function that will remove the callback when called. */ function onIdChange(_a, callback) { var appConfig = _a.appConfig; addCallback(appConfig, callback); return function () { removeCallback(appConfig, callback); }; } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ function extractAppConfig(app) { var e_1, _a; if (!app || !app.options) { throw getMissingValueError('App Configuration'); } if (!app.name) { throw getMissingValueError('App Name'); } // Required app config keys var configKeys = [ 'projectId', 'apiKey', 'appId' ]; try { for (var configKeys_1 = Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__values"])(configKeys), configKeys_1_1 = configKeys_1.next(); !configKeys_1_1.done; configKeys_1_1 = configKeys_1.next()) { var keyName = configKeys_1_1.value; if (!app.options[keyName]) { throw getMissingValueError(keyName); } } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (configKeys_1_1 && !configKeys_1_1.done && (_a = configKeys_1.return)) _a.call(configKeys_1); } finally { if (e_1) throw e_1.error; } } return { appName: app.name, projectId: app.options.projectId, apiKey: app.options.apiKey, appId: app.options.appId }; } function getMissingValueError(valueName) { return ERROR_FACTORY.create("missing-app-config-values" /* MISSING_APP_CONFIG_VALUES */, { valueName: valueName }); } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ function registerInstallations(instance) { var installationsName = 'installations'; instance.INTERNAL.registerComponent(new __WEBPACK_IMPORTED_MODULE_1__firebase_component__["Component"](installationsName, function (container) { var app = container.getProvider('app').getImmediate(); // Throws if app isn't configured properly. var appConfig = extractAppConfig(app); var platformLoggerProvider = container.getProvider('platform-logger'); var dependencies = { appConfig: appConfig, platformLoggerProvider: platformLoggerProvider }; var installations = { app: app, getId: function () { return getId(dependencies); }, getToken: function (forceRefresh) { return getToken(dependencies, forceRefresh); }, delete: function () { return deleteInstallation(dependencies); }, onIdChange: function (callback) { return onIdChange(dependencies, callback); } }; return installations; }, "PUBLIC" /* PUBLIC */)); instance.registerVersion(name, version); } registerInstallations(__WEBPACK_IMPORTED_MODULE_0__firebase_app___default.a); //# sourceMappingURL=index.esm.js.map /***/ }), /***/ "./node_modules/@firebase/messaging/node_modules/@firebase/util/dist/index.cjs.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(global) { Object.defineProperty(exports, '__esModule', { value: true }); var tslib = __webpack_require__("./node_modules/@firebase/messaging/node_modules/tslib/tslib.es6.js"); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * @fileoverview Firebase constants. Some of these (@defines) can be overridden at compile-time. */ var CONSTANTS = { /** * @define {boolean} Whether this is the client Node.js SDK. */ NODE_CLIENT: false, /** * @define {boolean} Whether this is the Admin Node.js SDK. */ NODE_ADMIN: false, /** * Firebase SDK Version */ SDK_VERSION: '${JSCORE_VERSION}' }; /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Throws an error if the provided assertion is falsy */ var assert = function (assertion, message) { if (!assertion) { throw assertionError(message); } }; /** * Returns an Error object suitable for throwing. */ var assertionError = function (message) { return new Error('Firebase Database (' + CONSTANTS.SDK_VERSION + ') INTERNAL ASSERT FAILED: ' + message); }; /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var stringToByteArray = function (str) { // TODO(user): Use native implementations if/when available var out = []; var p = 0; for (var i = 0; i < str.length; i++) { var c = str.charCodeAt(i); if (c < 128) { out[p++] = c; } else if (c < 2048) { out[p++] = (c >> 6) | 192; out[p++] = (c & 63) | 128; } else if ((c & 0xfc00) === 0xd800 && i + 1 < str.length && (str.charCodeAt(i + 1) & 0xfc00) === 0xdc00) { // Surrogate Pair c = 0x10000 + ((c & 0x03ff) << 10) + (str.charCodeAt(++i) & 0x03ff); out[p++] = (c >> 18) | 240; out[p++] = ((c >> 12) & 63) | 128; out[p++] = ((c >> 6) & 63) | 128; out[p++] = (c & 63) | 128; } else { out[p++] = (c >> 12) | 224; out[p++] = ((c >> 6) & 63) | 128; out[p++] = (c & 63) | 128; } } return out; }; /** * Turns an array of numbers into the string given by the concatenation of the * characters to which the numbers correspond. * @param bytes Array of numbers representing characters. * @return Stringification of the array. */ var byteArrayToString = function (bytes) { // TODO(user): Use native implementations if/when available var out = []; var pos = 0, c = 0; while (pos < bytes.length) { var c1 = bytes[pos++]; if (c1 < 128) { out[c++] = String.fromCharCode(c1); } else if (c1 > 191 && c1 < 224) { var c2 = bytes[pos++]; out[c++] = String.fromCharCode(((c1 & 31) << 6) | (c2 & 63)); } else if (c1 > 239 && c1 < 365) { // Surrogate Pair var c2 = bytes[pos++]; var c3 = bytes[pos++]; var c4 = bytes[pos++]; var u = (((c1 & 7) << 18) | ((c2 & 63) << 12) | ((c3 & 63) << 6) | (c4 & 63)) - 0x10000; out[c++] = String.fromCharCode(0xd800 + (u >> 10)); out[c++] = String.fromCharCode(0xdc00 + (u & 1023)); } else { var c2 = bytes[pos++]; var c3 = bytes[pos++]; out[c++] = String.fromCharCode(((c1 & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63)); } } return out.join(''); }; // We define it as an object literal instead of a class because a class compiled down to es5 can't // be treeshaked. https://github.com/rollup/rollup/issues/1691 // Static lookup maps, lazily populated by init_() var base64 = { /** * Maps bytes to characters. */ byteToCharMap_: null, /** * Maps characters to bytes. */ charToByteMap_: null, /** * Maps bytes to websafe characters. * @private */ byteToCharMapWebSafe_: null, /** * Maps websafe characters to bytes. * @private */ charToByteMapWebSafe_: null, /** * Our default alphabet, shared between * ENCODED_VALS and ENCODED_VALS_WEBSAFE */ ENCODED_VALS_BASE: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' + 'abcdefghijklmnopqrstuvwxyz' + '0123456789', /** * Our default alphabet. Value 64 (=) is special; it means "nothing." */ get ENCODED_VALS() { return this.ENCODED_VALS_BASE + '+/='; }, /** * Our websafe alphabet. */ get ENCODED_VALS_WEBSAFE() { return this.ENCODED_VALS_BASE + '-_.'; }, /** * Whether this browser supports the atob and btoa functions. This extension * started at Mozilla but is now implemented by many browsers. We use the * ASSUME_* variables to avoid pulling in the full useragent detection library * but still allowing the standard per-browser compilations. * */ HAS_NATIVE_SUPPORT: typeof atob === 'function', /** * Base64-encode an array of bytes. * * @param input An array of bytes (numbers with * value in [0, 255]) to encode. * @param webSafe Boolean indicating we should use the * alternative alphabet. * @return The base64 encoded string. */ encodeByteArray: function (input, webSafe) { if (!Array.isArray(input)) { throw Error('encodeByteArray takes an array as a parameter'); } this.init_(); var byteToCharMap = webSafe ? this.byteToCharMapWebSafe_ : this.byteToCharMap_; var output = []; for (var i = 0; i < input.length; i += 3) { var byte1 = input[i]; var haveByte2 = i + 1 < input.length; var byte2 = haveByte2 ? input[i + 1] : 0; var haveByte3 = i + 2 < input.length; var byte3 = haveByte3 ? input[i + 2] : 0; var outByte1 = byte1 >> 2; var outByte2 = ((byte1 & 0x03) << 4) | (byte2 >> 4); var outByte3 = ((byte2 & 0x0f) << 2) | (byte3 >> 6); var outByte4 = byte3 & 0x3f; if (!haveByte3) { outByte4 = 64; if (!haveByte2) { outByte3 = 64; } } output.push(byteToCharMap[outByte1], byteToCharMap[outByte2], byteToCharMap[outByte3], byteToCharMap[outByte4]); } return output.join(''); }, /** * Base64-encode a string. * * @param input A string to encode. * @param webSafe If true, we should use the * alternative alphabet. * @return The base64 encoded string. */ encodeString: function (input, webSafe) { // Shortcut for Mozilla browsers that implement // a native base64 encoder in the form of "btoa/atob" if (this.HAS_NATIVE_SUPPORT && !webSafe) { return btoa(input); } return this.encodeByteArray(stringToByteArray(input), webSafe); }, /** * Base64-decode a string. * * @param input to decode. * @param webSafe True if we should use the * alternative alphabet. * @return string representing the decoded value. */ decodeString: function (input, webSafe) { // Shortcut for Mozilla browsers that implement // a native base64 encoder in the form of "btoa/atob" if (this.HAS_NATIVE_SUPPORT && !webSafe) { return atob(input); } return byteArrayToString(this.decodeStringToByteArray(input, webSafe)); }, /** * Base64-decode a string. * * In base-64 decoding, groups of four characters are converted into three * bytes. If the encoder did not apply padding, the input length may not * be a multiple of 4. * * In this case, the last group will have fewer than 4 characters, and * padding will be inferred. If the group has one or two characters, it decodes * to one byte. If the group has three characters, it decodes to two bytes. * * @param input Input to decode. * @param webSafe True if we should use the web-safe alphabet. * @return bytes representing the decoded value. */ decodeStringToByteArray: function (input, webSafe) { this.init_(); var charToByteMap = webSafe ? this.charToByteMapWebSafe_ : this.charToByteMap_; var output = []; for (var i = 0; i < input.length;) { var byte1 = charToByteMap[input.charAt(i++)]; var haveByte2 = i < input.length; var byte2 = haveByte2 ? charToByteMap[input.charAt(i)] : 0; ++i; var haveByte3 = i < input.length; var byte3 = haveByte3 ? charToByteMap[input.charAt(i)] : 64; ++i; var haveByte4 = i < input.length; var byte4 = haveByte4 ? charToByteMap[input.charAt(i)] : 64; ++i; if (byte1 == null || byte2 == null || byte3 == null || byte4 == null) { throw Error(); } var outByte1 = (byte1 << 2) | (byte2 >> 4); output.push(outByte1); if (byte3 !== 64) { var outByte2 = ((byte2 << 4) & 0xf0) | (byte3 >> 2); output.push(outByte2); if (byte4 !== 64) { var outByte3 = ((byte3 << 6) & 0xc0) | byte4; output.push(outByte3); } } } return output; }, /** * Lazy static initialization function. Called before * accessing any of the static map variables. * @private */ init_: function () { if (!this.byteToCharMap_) { this.byteToCharMap_ = {}; this.charToByteMap_ = {}; this.byteToCharMapWebSafe_ = {}; this.charToByteMapWebSafe_ = {}; // We want quick mappings back and forth, so we precompute two maps. for (var i = 0; i < this.ENCODED_VALS.length; i++) { this.byteToCharMap_[i] = this.ENCODED_VALS.charAt(i); this.charToByteMap_[this.byteToCharMap_[i]] = i; this.byteToCharMapWebSafe_[i] = this.ENCODED_VALS_WEBSAFE.charAt(i); this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[i]] = i; // Be forgiving when decoding and correctly decode both encodings. if (i >= this.ENCODED_VALS_BASE.length) { this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(i)] = i; this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(i)] = i; } } } } }; /** * URL-safe base64 encoding */ var base64Encode = function (str) { var utf8Bytes = stringToByteArray(str); return base64.encodeByteArray(utf8Bytes, true); }; /** * URL-safe base64 decoding * * NOTE: DO NOT use the global atob() function - it does NOT support the * base64Url variant encoding. * * @param str To be decoded * @return Decoded result, if possible */ var base64Decode = function (str) { try { return base64.decodeString(str, true); } catch (e) { console.error('base64Decode failed: ', e); } return null; }; /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Do a deep-copy of basic JavaScript Objects or Arrays. */ function deepCopy(value) { return deepExtend(undefined, value); } /** * Copy properties from source to target (recursively allows extension * of Objects and Arrays). Scalar values in the target are over-written. * If target is undefined, an object of the appropriate type will be created * (and returned). * * We recursively copy all child properties of plain Objects in the source- so * that namespace- like dictionaries are merged. * * Note that the target can be a function, in which case the properties in * the source Object are copied onto it as static properties of the Function. */ function deepExtend(target, source) { if (!(source instanceof Object)) { return source; } switch (source.constructor) { case Date: // Treat Dates like scalars; if the target date object had any child // properties - they will be lost! var dateValue = source; return new Date(dateValue.getTime()); case Object: if (target === undefined) { target = {}; } break; case Array: // Always copy the array source and overwrite the target. target = []; break; default: // Not a plain Object - treat it as a scalar. return source; } for (var prop in source) { if (!source.hasOwnProperty(prop)) { continue; } target[prop] = deepExtend(target[prop], source[prop]); } return target; } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var Deferred = /** @class */ (function () { function Deferred() { var _this = this; this.reject = function () { }; this.resolve = function () { }; this.promise = new Promise(function (resolve, reject) { _this.resolve = resolve; _this.reject = reject; }); } /** * Our API internals are not promiseified and cannot because our callback APIs have subtle expectations around * invoking promises inline, which Promises are forbidden to do. This method accepts an optional node-style callback * and returns a node-style callback which will resolve or reject the Deferred's promise. */ Deferred.prototype.wrapCallback = function (callback) { var _this = this; return function (error, value) { if (error) { _this.reject(error); } else { _this.resolve(value); } if (typeof callback === 'function') { // Attaching noop handler just in case developer wasn't expecting // promises _this.promise.catch(function () { }); // Some of our callbacks don't expect a value and our own tests // assert that the parameter length is 1 if (callback.length === 1) { callback(error); } else { callback(error, value); } } }; }; return Deferred; }()); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Returns navigator.userAgent string or '' if it's not defined. * @return user agent string */ function getUA() { if (typeof navigator !== 'undefined' && typeof navigator['userAgent'] === 'string') { return navigator['userAgent']; } else { return ''; } } /** * Detect Cordova / PhoneGap / Ionic frameworks on a mobile device. * * Deliberately does not rely on checking `file://` URLs (as this fails PhoneGap * in the Ripple emulator) nor Cordova `onDeviceReady`, which would normally * wait for a callback. */ function isMobileCordova() { return (typeof window !== 'undefined' && // @ts-ignore Setting up an broadly applicable index signature for Window // just to deal with this case would probably be a bad idea. !!(window['cordova'] || window['phonegap'] || window['PhoneGap']) && /ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(getUA())); } /** * Detect Node.js. * * @return true if Node.js environment is detected. */ // Node detection logic from: https://github.com/iliakan/detect-node/ function isNode() { try { return (Object.prototype.toString.call(global.process) === '[object process]'); } catch (e) { return false; } } /** * Detect Browser Environment */ function isBrowser() { return typeof self === 'object' && self.self === self; } function isBrowserExtension() { var runtime = typeof chrome === 'object' ? chrome.runtime : typeof browser === 'object' ? browser.runtime : undefined; return typeof runtime === 'object' && runtime.id !== undefined; } /** * Detect React Native. * * @return true if ReactNative environment is detected. */ function isReactNative() { return (typeof navigator === 'object' && navigator['product'] === 'ReactNative'); } /** Detects Electron apps. */ function isElectron() { return getUA().indexOf('Electron/') >= 0; } /** Detects Internet Explorer. */ function isIE() { var ua = getUA(); return ua.indexOf('MSIE ') >= 0 || ua.indexOf('Trident/') >= 0; } /** Detects Universal Windows Platform apps. */ function isUWP() { return getUA().indexOf('MSAppHost/') >= 0; } /** * Detect whether the current SDK build is the Node version. * * @return true if it's the Node SDK build. */ function isNodeSdk() { return CONSTANTS.NODE_CLIENT === true || CONSTANTS.NODE_ADMIN === true; } /** Returns true if we are running in Safari. */ function isSafari() { return (!isNode() && navigator.userAgent.includes('Safari') && !navigator.userAgent.includes('Chrome')); } /** * This method checks if indexedDB is supported by current browser/service worker context * @return true if indexedDB is supported by current browser/service worker context */ function isIndexedDBAvailable() { return 'indexedDB' in self && indexedDB != null; } /** * This method validates browser context for indexedDB by opening a dummy indexedDB database and reject * if errors occur during the database open operation. */ function validateIndexedDBOpenable() { return new Promise(function (resolve, reject) { try { var preExist_1 = true; var DB_CHECK_NAME_1 = 'validate-browser-context-for-indexeddb-analytics-module'; var request_1 = window.indexedDB.open(DB_CHECK_NAME_1); request_1.onsuccess = function () { request_1.result.close(); // delete database only when it doesn't pre-exist if (!preExist_1) { window.indexedDB.deleteDatabase(DB_CHECK_NAME_1); } resolve(true); }; request_1.onupgradeneeded = function () { preExist_1 = false; }; request_1.onerror = function () { var _a; reject(((_a = request_1.error) === null || _a === void 0 ? void 0 : _a.message) || ''); }; } catch (error) { reject(error); } }); } /** * * This method checks whether cookie is enabled within current browser * @return true if cookie is enabled within current browser */ function areCookiesEnabled() { if (!navigator || !navigator.cookieEnabled) { return false; } return true; } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var ERROR_NAME = 'FirebaseError'; // Based on code from: // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error#Custom_Error_Types var FirebaseError = /** @class */ (function (_super) { tslib.__extends(FirebaseError, _super); function FirebaseError(code, message) { var _this = _super.call(this, message) || this; _this.code = code; _this.name = ERROR_NAME; // Fix For ES5 // https://github.com/Microsoft/TypeScript-wiki/blob/master/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work Object.setPrototypeOf(_this, FirebaseError.prototype); // Maintains proper stack trace for where our error was thrown. // Only available on V8. if (Error.captureStackTrace) { Error.captureStackTrace(_this, ErrorFactory.prototype.create); } return _this; } return FirebaseError; }(Error)); var ErrorFactory = /** @class */ (function () { function ErrorFactory(service, serviceName, errors) { this.service = service; this.serviceName = serviceName; this.errors = errors; } ErrorFactory.prototype.create = function (code) { var data = []; for (var _i = 1; _i < arguments.length; _i++) { data[_i - 1] = arguments[_i]; } var customData = data[0] || {}; var fullCode = this.service + "/" + code; var template = this.errors[code]; var message = template ? replaceTemplate(template, customData) : 'Error'; // Service Name: Error message (service/code). var fullMessage = this.serviceName + ": " + message + " (" + fullCode + ")."; var error = new FirebaseError(fullCode, fullMessage); // Keys with an underscore at the end of their name are not included in // error.data for some reason. // TODO: Replace with Object.entries when lib is updated to es2017. for (var _a = 0, _b = Object.keys(customData); _a < _b.length; _a++) { var key = _b[_a]; if (key.slice(-1) !== '_') { if (key in error) { console.warn("Overwriting FirebaseError base field \"" + key + "\" can cause unexpected behavior."); } error[key] = customData[key]; } } return error; }; return ErrorFactory; }()); function replaceTemplate(template, data) { return template.replace(PATTERN, function (_, key) { var value = data[key]; return value != null ? String(value) : "<" + key + "?>"; }); } var PATTERN = /\{\$([^}]+)}/g; /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Evaluates a JSON string into a javascript object. * * @param {string} str A string containing JSON. * @return {*} The javascript object representing the specified JSON. */ function jsonEval(str) { return JSON.parse(str); } /** * Returns JSON representing a javascript object. * @param {*} data Javascript object to be stringified. * @return {string} The JSON contents of the object. */ function stringify(data) { return JSON.stringify(data); } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Decodes a Firebase auth. token into constituent parts. * * Notes: * - May return with invalid / incomplete claims if there's no native base64 decoding support. * - Doesn't check if the token is actually valid. */ var decode = function (token) { var header = {}, claims = {}, data = {}, signature = ''; try { var parts = token.split('.'); header = jsonEval(base64Decode(parts[0]) || ''); claims = jsonEval(base64Decode(parts[1]) || ''); signature = parts[2]; data = claims['d'] || {}; delete claims['d']; } catch (e) { } return { header: header, claims: claims, data: data, signature: signature }; }; /** * Decodes a Firebase auth. token and checks the validity of its time-based claims. Will return true if the * token is within the time window authorized by the 'nbf' (not-before) and 'iat' (issued-at) claims. * * Notes: * - May return a false negative if there's no native base64 decoding support. * - Doesn't check if the token is actually valid. */ var isValidTimestamp = function (token) { var claims = decode(token).claims; var now = Math.floor(new Date().getTime() / 1000); var validSince = 0, validUntil = 0; if (typeof claims === 'object') { if (claims.hasOwnProperty('nbf')) { validSince = claims['nbf']; } else if (claims.hasOwnProperty('iat')) { validSince = claims['iat']; } if (claims.hasOwnProperty('exp')) { validUntil = claims['exp']; } else { // token will expire after 24h by default validUntil = validSince + 86400; } } return (!!now && !!validSince && !!validUntil && now >= validSince && now <= validUntil); }; /** * Decodes a Firebase auth. token and returns its issued at time if valid, null otherwise. * * Notes: * - May return null if there's no native base64 decoding support. * - Doesn't check if the token is actually valid. */ var issuedAtTime = function (token) { var claims = decode(token).claims; if (typeof claims === 'object' && claims.hasOwnProperty('iat')) { return claims['iat']; } return null; }; /** * Decodes a Firebase auth. token and checks the validity of its format. Expects a valid issued-at time. * * Notes: * - May return a false negative if there's no native base64 decoding support. * - Doesn't check if the token is actually valid. */ var isValidFormat = function (token) { var decoded = decode(token), claims = decoded.claims; return !!claims && typeof claims === 'object' && claims.hasOwnProperty('iat'); }; /** * Attempts to peer into an auth token and determine if it's an admin auth token by looking at the claims portion. * * Notes: * - May return a false negative if there's no native base64 decoding support. * - Doesn't check if the token is actually valid. */ var isAdmin = function (token) { var claims = decode(token).claims; return typeof claims === 'object' && claims['admin'] === true; }; /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ function contains(obj, key) { return Object.prototype.hasOwnProperty.call(obj, key); } function safeGet(obj, key) { if (Object.prototype.hasOwnProperty.call(obj, key)) { return obj[key]; } else { return undefined; } } function isEmpty(obj) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { return false; } } return true; } function map(obj, fn, contextObj) { var res = {}; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { res[key] = fn.call(contextObj, obj[key], key, obj); } } return res; } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Returns a querystring-formatted string (e.g. &arg=val&arg2=val2) from a * params object (e.g. {arg: 'val', arg2: 'val2'}) * Note: You must prepend it with ? when adding it to a URL. */ function querystring(querystringParams) { var params = []; var _loop_1 = function (key, value) { if (Array.isArray(value)) { value.forEach(function (arrayVal) { params.push(encodeURIComponent(key) + '=' + encodeURIComponent(arrayVal)); }); } else { params.push(encodeURIComponent(key) + '=' + encodeURIComponent(value)); } }; for (var _i = 0, _a = Object.entries(querystringParams); _i < _a.length; _i++) { var _b = _a[_i], key = _b[0], value = _b[1]; _loop_1(key, value); } return params.length ? '&' + params.join('&') : ''; } /** * Decodes a querystring (e.g. ?arg=val&arg2=val2) into a params object * (e.g. {arg: 'val', arg2: 'val2'}) */ function querystringDecode(querystring) { var obj = {}; var tokens = querystring.replace(/^\?/, '').split('&'); tokens.forEach(function (token) { if (token) { var key = token.split('='); obj[key[0]] = key[1]; } }); return obj; } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * @fileoverview SHA-1 cryptographic hash. * Variable names follow the notation in FIPS PUB 180-3: * http://csrc.nist.gov/publications/fips/fips180-3/fips180-3_final.pdf. * * Usage: * var sha1 = new sha1(); * sha1.update(bytes); * var hash = sha1.digest(); * * Performance: * Chrome 23: ~400 Mbit/s * Firefox 16: ~250 Mbit/s * */ /** * SHA-1 cryptographic hash constructor. * * The properties declared here are discussed in the above algorithm document. * @constructor * @final * @struct */ var Sha1 = /** @class */ (function () { function Sha1() { /** * Holds the previous values of accumulated variables a-e in the compress_ * function. * @private */ this.chain_ = []; /** * A buffer holding the partially computed hash result. * @private */ this.buf_ = []; /** * An array of 80 bytes, each a part of the message to be hashed. Referred to * as the message schedule in the docs. * @private */ this.W_ = []; /** * Contains data needed to pad messages less than 64 bytes. * @private */ this.pad_ = []; /** * @private {number} */ this.inbuf_ = 0; /** * @private {number} */ this.total_ = 0; this.blockSize = 512 / 8; this.pad_[0] = 128; for (var i = 1; i < this.blockSize; ++i) { this.pad_[i] = 0; } this.reset(); } Sha1.prototype.reset = function () { this.chain_[0] = 0x67452301; this.chain_[1] = 0xefcdab89; this.chain_[2] = 0x98badcfe; this.chain_[3] = 0x10325476; this.chain_[4] = 0xc3d2e1f0; this.inbuf_ = 0; this.total_ = 0; }; /** * Internal compress helper function. * @param buf Block to compress. * @param offset Offset of the block in the buffer. * @private */ Sha1.prototype.compress_ = function (buf, offset) { if (!offset) { offset = 0; } var W = this.W_; // get 16 big endian words if (typeof buf === 'string') { for (var i = 0; i < 16; i++) { // TODO(user): [bug 8140122] Recent versions of Safari for Mac OS and iOS // have a bug that turns the post-increment ++ operator into pre-increment // during JIT compilation. We have code that depends heavily on SHA-1 for // correctness and which is affected by this bug, so I've removed all uses // of post-increment ++ in which the result value is used. We can revert // this change once the Safari bug // (https://bugs.webkit.org/show_bug.cgi?id=109036) has been fixed and // most clients have been updated. W[i] = (buf.charCodeAt(offset) << 24) | (buf.charCodeAt(offset + 1) << 16) | (buf.charCodeAt(offset + 2) << 8) | buf.charCodeAt(offset + 3); offset += 4; } } else { for (var i = 0; i < 16; i++) { W[i] = (buf[offset] << 24) | (buf[offset + 1] << 16) | (buf[offset + 2] << 8) | buf[offset + 3]; offset += 4; } } // expand to 80 words for (var i = 16; i < 80; i++) { var t = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16]; W[i] = ((t << 1) | (t >>> 31)) & 0xffffffff; } var a = this.chain_[0]; var b = this.chain_[1]; var c = this.chain_[2]; var d = this.chain_[3]; var e = this.chain_[4]; var f, k; // TODO(user): Try to unroll this loop to speed up the computation. for (var i = 0; i < 80; i++) { if (i < 40) { if (i < 20) { f = d ^ (b & (c ^ d)); k = 0x5a827999; } else { f = b ^ c ^ d; k = 0x6ed9eba1; } } else { if (i < 60) { f = (b & c) | (d & (b | c)); k = 0x8f1bbcdc; } else { f = b ^ c ^ d; k = 0xca62c1d6; } } var t = (((a << 5) | (a >>> 27)) + f + e + k + W[i]) & 0xffffffff; e = d; d = c; c = ((b << 30) | (b >>> 2)) & 0xffffffff; b = a; a = t; } this.chain_[0] = (this.chain_[0] + a) & 0xffffffff; this.chain_[1] = (this.chain_[1] + b) & 0xffffffff; this.chain_[2] = (this.chain_[2] + c) & 0xffffffff; this.chain_[3] = (this.chain_[3] + d) & 0xffffffff; this.chain_[4] = (this.chain_[4] + e) & 0xffffffff; }; Sha1.prototype.update = function (bytes, length) { // TODO(johnlenz): tighten the function signature and remove this check if (bytes == null) { return; } if (length === undefined) { length = bytes.length; } var lengthMinusBlock = length - this.blockSize; var n = 0; // Using local instead of member variables gives ~5% speedup on Firefox 16. var buf = this.buf_; var inbuf = this.inbuf_; // The outer while loop should execute at most twice. while (n < length) { // When we have no data in the block to top up, we can directly process the // input buffer (assuming it contains sufficient data). This gives ~25% // speedup on Chrome 23 and ~15% speedup on Firefox 16, but requires that // the data is provided in large chunks (or in multiples of 64 bytes). if (inbuf === 0) { while (n <= lengthMinusBlock) { this.compress_(bytes, n); n += this.blockSize; } } if (typeof bytes === 'string') { while (n < length) { buf[inbuf] = bytes.charCodeAt(n); ++inbuf; ++n; if (inbuf === this.blockSize) { this.compress_(buf); inbuf = 0; // Jump to the outer loop so we use the full-block optimization. break; } } } else { while (n < length) { buf[inbuf] = bytes[n]; ++inbuf; ++n; if (inbuf === this.blockSize) { this.compress_(buf); inbuf = 0; // Jump to the outer loop so we use the full-block optimization. break; } } } } this.inbuf_ = inbuf; this.total_ += length; }; /** @override */ Sha1.prototype.digest = function () { var digest = []; var totalBits = this.total_ * 8; // Add pad 0x80 0x00*. if (this.inbuf_ < 56) { this.update(this.pad_, 56 - this.inbuf_); } else { this.update(this.pad_, this.blockSize - (this.inbuf_ - 56)); } // Add # bits. for (var i = this.blockSize - 1; i >= 56; i--) { this.buf_[i] = totalBits & 255; totalBits /= 256; // Don't use bit-shifting here! } this.compress_(this.buf_); var n = 0; for (var i = 0; i < 5; i++) { for (var j = 24; j >= 0; j -= 8) { digest[n] = (this.chain_[i] >> j) & 255; ++n; } } return digest; }; return Sha1; }()); /** * Helper to make a Subscribe function (just like Promise helps make a * Thenable). * * @param executor Function which can make calls to a single Observer * as a proxy. * @param onNoObservers Callback when count of Observers goes to zero. */ function createSubscribe(executor, onNoObservers) { var proxy = new ObserverProxy(executor, onNoObservers); return proxy.subscribe.bind(proxy); } /** * Implement fan-out for any number of Observers attached via a subscribe * function. */ var ObserverProxy = /** @class */ (function () { /** * @param executor Function which can make calls to a single Observer * as a proxy. * @param onNoObservers Callback when count of Observers goes to zero. */ function ObserverProxy(executor, onNoObservers) { var _this = this; this.observers = []; this.unsubscribes = []; this.observerCount = 0; // Micro-task scheduling by calling task.then(). this.task = Promise.resolve(); this.finalized = false; this.onNoObservers = onNoObservers; // Call the executor asynchronously so subscribers that are called // synchronously after the creation of the subscribe function // can still receive the very first value generated in the executor. this.task .then(function () { executor(_this); }) .catch(function (e) { _this.error(e); }); } ObserverProxy.prototype.next = function (value) { this.forEachObserver(function (observer) { observer.next(value); }); }; ObserverProxy.prototype.error = function (error) { this.forEachObserver(function (observer) { observer.error(error); }); this.close(error); }; ObserverProxy.prototype.complete = function () { this.forEachObserver(function (observer) { observer.complete(); }); this.close(); }; /** * Subscribe function that can be used to add an Observer to the fan-out list. * * - We require that no event is sent to a subscriber sychronously to their * call to subscribe(). */ ObserverProxy.prototype.subscribe = function (nextOrObserver, error, complete) { var _this = this; var observer; if (nextOrObserver === undefined && error === undefined && complete === undefined) { throw new Error('Missing Observer.'); } // Assemble an Observer object when passed as callback functions. if (implementsAnyMethods(nextOrObserver, [ 'next', 'error', 'complete' ])) { observer = nextOrObserver; } else { observer = { next: nextOrObserver, error: error, complete: complete }; } if (observer.next === undefined) { observer.next = noop; } if (observer.error === undefined) { observer.error = noop; } if (observer.complete === undefined) { observer.complete = noop; } var unsub = this.unsubscribeOne.bind(this, this.observers.length); // Attempt to subscribe to a terminated Observable - we // just respond to the Observer with the final error or complete // event. if (this.finalized) { // eslint-disable-next-line @typescript-eslint/no-floating-promises this.task.then(function () { try { if (_this.finalError) { observer.error(_this.finalError); } else { observer.complete(); } } catch (e) { // nothing } return; }); } this.observers.push(observer); return unsub; }; // Unsubscribe is synchronous - we guarantee that no events are sent to // any unsubscribed Observer. ObserverProxy.prototype.unsubscribeOne = function (i) { if (this.observers === undefined || this.observers[i] === undefined) { return; } delete this.observers[i]; this.observerCount -= 1; if (this.observerCount === 0 && this.onNoObservers !== undefined) { this.onNoObservers(this); } }; ObserverProxy.prototype.forEachObserver = function (fn) { if (this.finalized) { // Already closed by previous event....just eat the additional values. return; } // Since sendOne calls asynchronously - there is no chance that // this.observers will become undefined. for (var i = 0; i < this.observers.length; i++) { this.sendOne(i, fn); } }; // Call the Observer via one of it's callback function. We are careful to // confirm that the observe has not been unsubscribed since this asynchronous // function had been queued. ObserverProxy.prototype.sendOne = function (i, fn) { var _this = this; // Execute the callback asynchronously // eslint-disable-next-line @typescript-eslint/no-floating-promises this.task.then(function () { if (_this.observers !== undefined && _this.observers[i] !== undefined) { try { fn(_this.observers[i]); } catch (e) { // Ignore exceptions raised in Observers or missing methods of an // Observer. // Log error to console. b/31404806 if (typeof console !== 'undefined' && console.error) { console.error(e); } } } }); }; ObserverProxy.prototype.close = function (err) { var _this = this; if (this.finalized) { return; } this.finalized = true; if (err !== undefined) { this.finalError = err; } // Proxy is no longer needed - garbage collect references // eslint-disable-next-line @typescript-eslint/no-floating-promises this.task.then(function () { _this.observers = undefined; _this.onNoObservers = undefined; }); }; return ObserverProxy; }()); /** Turn synchronous function into one called asynchronously. */ // eslint-disable-next-line @typescript-eslint/ban-types function async(fn, onError) { return function () { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } Promise.resolve(true) .then(function () { fn.apply(void 0, args); }) .catch(function (error) { if (onError) { onError(error); } }); }; } /** * Return true if the object passed in implements any of the named methods. */ function implementsAnyMethods(obj, methods) { if (typeof obj !== 'object' || obj === null) { return false; } for (var _i = 0, methods_1 = methods; _i < methods_1.length; _i++) { var method = methods_1[_i]; if (method in obj && typeof obj[method] === 'function') { return true; } } return false; } function noop() { // do nothing } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Check to make sure the appropriate number of arguments are provided for a public function. * Throws an error if it fails. * * @param fnName The function name * @param minCount The minimum number of arguments to allow for the function call * @param maxCount The maximum number of argument to allow for the function call * @param argCount The actual number of arguments provided. */ var validateArgCount = function (fnName, minCount, maxCount, argCount) { var argError; if (argCount < minCount) { argError = 'at least ' + minCount; } else if (argCount > maxCount) { argError = maxCount === 0 ? 'none' : 'no more than ' + maxCount; } if (argError) { var error = fnName + ' failed: Was called with ' + argCount + (argCount === 1 ? ' argument.' : ' arguments.') + ' Expects ' + argError + '.'; throw new Error(error); } }; /** * Generates a string to prefix an error message about failed argument validation * * @param fnName The function name * @param argumentNumber The index of the argument * @param optional Whether or not the argument is optional * @return The prefix to add to the error thrown for validation. */ function errorPrefix(fnName, argumentNumber, optional) { var argName = ''; switch (argumentNumber) { case 1: argName = optional ? 'first' : 'First'; break; case 2: argName = optional ? 'second' : 'Second'; break; case 3: argName = optional ? 'third' : 'Third'; break; case 4: argName = optional ? 'fourth' : 'Fourth'; break; default: throw new Error('errorPrefix called with argumentNumber > 4. Need to update it?'); } var error = fnName + ' failed: '; error += argName + ' argument '; return error; } /** * @param fnName * @param argumentNumber * @param namespace * @param optional */ function validateNamespace(fnName, argumentNumber, namespace, optional) { if (optional && !namespace) { return; } if (typeof namespace !== 'string') { //TODO: I should do more validation here. We only allow certain chars in namespaces. throw new Error(errorPrefix(fnName, argumentNumber, optional) + 'must be a valid firebase namespace.'); } } function validateCallback(fnName, argumentNumber, // eslint-disable-next-line @typescript-eslint/ban-types callback, optional) { if (optional && !callback) { return; } if (typeof callback !== 'function') { throw new Error(errorPrefix(fnName, argumentNumber, optional) + 'must be a valid function.'); } } function validateContextObject(fnName, argumentNumber, context, optional) { if (optional && !context) { return; } if (typeof context !== 'object' || context === null) { throw new Error(errorPrefix(fnName, argumentNumber, optional) + 'must be a valid context object.'); } } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // Code originally came from goog.crypt.stringToUtf8ByteArray, but for some reason they // automatically replaced '\r\n' with '\n', and they didn't handle surrogate pairs, // so it's been modified. // Note that not all Unicode characters appear as single characters in JavaScript strings. // fromCharCode returns the UTF-16 encoding of a character - so some Unicode characters // use 2 characters in Javascript. All 4-byte UTF-8 characters begin with a first // character in the range 0xD800 - 0xDBFF (the first character of a so-called surrogate // pair). // See http://www.ecma-international.org/ecma-262/5.1/#sec-15.1.3 /** * @param {string} str * @return {Array} */ var stringToByteArray$1 = function (str) { var out = []; var p = 0; for (var i = 0; i < str.length; i++) { var c = str.charCodeAt(i); // Is this the lead surrogate in a surrogate pair? if (c >= 0xd800 && c <= 0xdbff) { var high = c - 0xd800; // the high 10 bits. i++; assert(i < str.length, 'Surrogate pair missing trail surrogate.'); var low = str.charCodeAt(i) - 0xdc00; // the low 10 bits. c = 0x10000 + (high << 10) + low; } if (c < 128) { out[p++] = c; } else if (c < 2048) { out[p++] = (c >> 6) | 192; out[p++] = (c & 63) | 128; } else if (c < 65536) { out[p++] = (c >> 12) | 224; out[p++] = ((c >> 6) & 63) | 128; out[p++] = (c & 63) | 128; } else { out[p++] = (c >> 18) | 240; out[p++] = ((c >> 12) & 63) | 128; out[p++] = ((c >> 6) & 63) | 128; out[p++] = (c & 63) | 128; } } return out; }; /** * Calculate length without actually converting; useful for doing cheaper validation. * @param {string} str * @return {number} */ var stringLength = function (str) { var p = 0; for (var i = 0; i < str.length; i++) { var c = str.charCodeAt(i); if (c < 128) { p++; } else if (c < 2048) { p += 2; } else if (c >= 0xd800 && c <= 0xdbff) { // Lead surrogate of a surrogate pair. The pair together will take 4 bytes to represent. p += 4; i++; // skip trail surrogate. } else { p += 3; } } return p; }; /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * The amount of milliseconds to exponentially increase. */ var DEFAULT_INTERVAL_MILLIS = 1000; /** * The factor to backoff by. * Should be a number greater than 1. */ var DEFAULT_BACKOFF_FACTOR = 2; /** * The maximum milliseconds to increase to. * * <p>Visible for testing */ var MAX_VALUE_MILLIS = 4 * 60 * 60 * 1000; // Four hours, like iOS and Android. /** * The percentage of backoff time to randomize by. * See * http://go/safe-client-behavior#step-1-determine-the-appropriate-retry-interval-to-handle-spike-traffic * for context. * * <p>Visible for testing */ var RANDOM_FACTOR = 0.5; /** * Based on the backoff method from * https://github.com/google/closure-library/blob/master/closure/goog/math/exponentialbackoff.js. * Extracted here so we don't need to pass metadata and a stateful ExponentialBackoff object around. */ function calculateBackoffMillis(backoffCount, intervalMillis, backoffFactor) { if (intervalMillis === void 0) { intervalMillis = DEFAULT_INTERVAL_MILLIS; } if (backoffFactor === void 0) { backoffFactor = DEFAULT_BACKOFF_FACTOR; } // Calculates an exponentially increasing value. // Deviation: calculates value from count and a constant interval, so we only need to save value // and count to restore state. var currBaseValue = intervalMillis * Math.pow(backoffFactor, backoffCount); // A random "fuzz" to avoid waves of retries. // Deviation: randomFactor is required. var randomWait = Math.round( // A fraction of the backoff value to add/subtract. // Deviation: changes multiplication order to improve readability. RANDOM_FACTOR * currBaseValue * // A random float (rounded to int by Math.round above) in the range [-1, 1]. Determines // if we add or subtract. (Math.random() - 0.5) * 2); // Limits backoff to max to avoid effectively permanent backoff. return Math.min(MAX_VALUE_MILLIS, currBaseValue + randomWait); } exports.CONSTANTS = CONSTANTS; exports.Deferred = Deferred; exports.ErrorFactory = ErrorFactory; exports.FirebaseError = FirebaseError; exports.MAX_VALUE_MILLIS = MAX_VALUE_MILLIS; exports.RANDOM_FACTOR = RANDOM_FACTOR; exports.Sha1 = Sha1; exports.areCookiesEnabled = areCookiesEnabled; exports.assert = assert; exports.assertionError = assertionError; exports.async = async; exports.base64 = base64; exports.base64Decode = base64Decode; exports.base64Encode = base64Encode; exports.calculateBackoffMillis = calculateBackoffMillis; exports.contains = contains; exports.createSubscribe = createSubscribe; exports.decode = decode; exports.deepCopy = deepCopy; exports.deepExtend = deepExtend; exports.errorPrefix = errorPrefix; exports.getUA = getUA; exports.isAdmin = isAdmin; exports.isBrowser = isBrowser; exports.isBrowserExtension = isBrowserExtension; exports.isElectron = isElectron; exports.isEmpty = isEmpty; exports.isIE = isIE; exports.isIndexedDBAvailable = isIndexedDBAvailable; exports.isMobileCordova = isMobileCordova; exports.isNode = isNode; exports.isNodeSdk = isNodeSdk; exports.isReactNative = isReactNative; exports.isSafari = isSafari; exports.isUWP = isUWP; exports.isValidFormat = isValidFormat; exports.isValidTimestamp = isValidTimestamp; exports.issuedAtTime = issuedAtTime; exports.jsonEval = jsonEval; exports.map = map; exports.querystring = querystring; exports.querystringDecode = querystringDecode; exports.safeGet = safeGet; exports.stringLength = stringLength; exports.stringToByteArray = stringToByteArray$1; exports.stringify = stringify; exports.validateArgCount = validateArgCount; exports.validateCallback = validateCallback; exports.validateContextObject = validateContextObject; exports.validateIndexedDBOpenable = validateIndexedDBOpenable; exports.validateNamespace = validateNamespace; //# sourceMappingURL=index.cjs.js.map /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__("./node_modules/webpack/buildin/global.js"))) /***/ }), /***/ "./node_modules/@firebase/messaging/node_modules/tslib/tslib.es6.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); /* harmony export (immutable) */ __webpack_exports__["__extends"] = __extends; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__assign", function() { return __assign; }); /* harmony export (immutable) */ __webpack_exports__["__rest"] = __rest; /* harmony export (immutable) */ __webpack_exports__["__decorate"] = __decorate; /* harmony export (immutable) */ __webpack_exports__["__param"] = __param; /* harmony export (immutable) */ __webpack_exports__["__metadata"] = __metadata; /* harmony export (immutable) */ __webpack_exports__["__awaiter"] = __awaiter; /* harmony export (immutable) */ __webpack_exports__["__generator"] = __generator; /* harmony export (immutable) */ __webpack_exports__["__createBinding"] = __createBinding; /* harmony export (immutable) */ __webpack_exports__["__exportStar"] = __exportStar; /* harmony export (immutable) */ __webpack_exports__["__values"] = __values; /* harmony export (immutable) */ __webpack_exports__["__read"] = __read; /* harmony export (immutable) */ __webpack_exports__["__spread"] = __spread; /* harmony export (immutable) */ __webpack_exports__["__spreadArrays"] = __spreadArrays; /* harmony export (immutable) */ __webpack_exports__["__await"] = __await; /* harmony export (immutable) */ __webpack_exports__["__asyncGenerator"] = __asyncGenerator; /* harmony export (immutable) */ __webpack_exports__["__asyncDelegator"] = __asyncDelegator; /* harmony export (immutable) */ __webpack_exports__["__asyncValues"] = __asyncValues; /* harmony export (immutable) */ __webpack_exports__["__makeTemplateObject"] = __makeTemplateObject; /* harmony export (immutable) */ __webpack_exports__["__importStar"] = __importStar; /* harmony export (immutable) */ __webpack_exports__["__importDefault"] = __importDefault; /* harmony export (immutable) */ __webpack_exports__["__classPrivateFieldGet"] = __classPrivateFieldGet; /* harmony export (immutable) */ __webpack_exports__["__classPrivateFieldSet"] = __classPrivateFieldSet; /*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */ /* global Reflect, Promise */ var extendStatics = function(d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; function __extends(d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); } var __assign = function() { __assign = Object.assign || function __assign(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; } return __assign.apply(this, arguments); } function __rest(s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; } return t; } function __decorate(decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; } function __param(paramIndex, decorator) { return function (target, key) { decorator(target, key, paramIndex); } } function __metadata(metadataKey, metadataValue) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); } function __awaiter(thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); } function __generator(thisArg, body) { var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; function verb(n) { return function (v) { return step([n, v]); }; } function step(op) { if (f) throw new TypeError("Generator is already executing."); while (_) try { if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; if (y = 0, t) op = [op[0] & 2, t.value]; switch (op[0]) { case 0: case 1: t = op; break; case 4: _.label++; return { value: op[1], done: false }; case 5: _.label++; y = op[1]; op = [0]; continue; case 7: op = _.ops.pop(); _.trys.pop(); continue; default: if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } if (t[2]) _.ops.pop(); _.trys.pop(); continue; } op = body.call(thisArg, _); } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } } function __createBinding(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; } function __exportStar(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) exports[p] = m[p]; } function __values(o) { var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; if (m) return m.call(o); if (o && typeof o.length === "number") return { next: function () { if (o && i >= o.length) o = void 0; return { value: o && o[i++], done: !o }; } }; throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); } function __read(o, n) { var m = typeof Symbol === "function" && o[Symbol.iterator]; if (!m) return o; var i = m.call(o), r, ar = [], e; try { while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); } catch (error) { e = { error: error }; } finally { try { if (r && !r.done && (m = i["return"])) m.call(i); } finally { if (e) throw e.error; } } return ar; } function __spread() { for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); return ar; } function __spreadArrays() { for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; for (var r = Array(s), k = 0, i = 0; i < il; i++) for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) r[k] = a[j]; return r; }; function __await(v) { return this instanceof __await ? (this.v = v, this) : new __await(v); } function __asyncGenerator(thisArg, _arguments, generator) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var g = generator.apply(thisArg, _arguments || []), i, q = []; return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } function fulfill(value) { resume("next", value); } function reject(value) { resume("throw", value); } function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } } function __asyncDelegator(o) { var i, p; return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } } function __asyncValues(o) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var m = o[Symbol.asyncIterator], i; return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } } function __makeTemplateObject(cooked, raw) { if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } return cooked; }; function __importStar(mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; result.default = mod; return result; } function __importDefault(mod) { return (mod && mod.__esModule) ? mod : { default: mod }; } function __classPrivateFieldGet(receiver, privateMap) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return privateMap.get(receiver); } function __classPrivateFieldSet(receiver, privateMap, value) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to set private field on non-instance"); } privateMap.set(receiver, value); return value; } /***/ }), /***/ "./node_modules/@firebase/performance/dist/index.cjs.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, '__esModule', { value: true }); var firebase = __webpack_require__("./node_modules/@firebase/app/dist/index.cjs.js"); __webpack_require__("./node_modules/@firebase/performance/node_modules/@firebase/installations/dist/index.esm.js"); var tslib = __webpack_require__("./node_modules/@firebase/performance/node_modules/tslib/tslib.es6.js"); var util = __webpack_require__("./node_modules/@firebase/performance/node_modules/@firebase/util/dist/index.cjs.js"); var logger$1 = __webpack_require__("./node_modules/@firebase/logger/dist/index.esm.js"); var component = __webpack_require__("./node_modules/@firebase/performance/node_modules/@firebase/component/dist/index.cjs.js"); function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } var firebase__default = /*#__PURE__*/_interopDefaultLegacy(firebase); var name = "@firebase/performance"; var version = "0.4.2"; /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var SDK_VERSION = version; /** The prefix for start User Timing marks used for creating Traces. */ var TRACE_START_MARK_PREFIX = 'FB-PERF-TRACE-START'; /** The prefix for stop User Timing marks used for creating Traces. */ var TRACE_STOP_MARK_PREFIX = 'FB-PERF-TRACE-STOP'; /** The prefix for User Timing measure used for creating Traces. */ var TRACE_MEASURE_PREFIX = 'FB-PERF-TRACE-MEASURE'; /** The prefix for out of the box page load Trace name. */ var OOB_TRACE_PAGE_LOAD_PREFIX = '_wt_'; var FIRST_PAINT_COUNTER_NAME = '_fp'; var FIRST_CONTENTFUL_PAINT_COUNTER_NAME = '_fcp'; var FIRST_INPUT_DELAY_COUNTER_NAME = '_fid'; var CONFIG_LOCAL_STORAGE_KEY = '@firebase/performance/config'; var CONFIG_EXPIRY_LOCAL_STORAGE_KEY = '@firebase/performance/configexpire'; var SERVICE = 'performance'; var SERVICE_NAME = 'Performance'; /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var _a; var ERROR_DESCRIPTION_MAP = (_a = {}, _a["trace started" /* TRACE_STARTED_BEFORE */] = 'Trace {$traceName} was started before.', _a["trace stopped" /* TRACE_STOPPED_BEFORE */] = 'Trace {$traceName} is not running.', _a["nonpositive trace startTime" /* NONPOSITIVE_TRACE_START_TIME */] = 'Trace {$traceName} startTime should be positive.', _a["nonpositive trace duration" /* NONPOSITIVE_TRACE_DURATION */] = 'Trace {$traceName} duration should be positive.', _a["no window" /* NO_WINDOW */] = 'Window is not available.', _a["no app id" /* NO_APP_ID */] = 'App id is not available.', _a["no project id" /* NO_PROJECT_ID */] = 'Project id is not available.', _a["no api key" /* NO_API_KEY */] = 'Api key is not available.', _a["invalid cc log" /* INVALID_CC_LOG */] = 'Attempted to queue invalid cc event', _a["FB not default" /* FB_NOT_DEFAULT */] = 'Performance can only start when Firebase app instance is the default one.', _a["RC response not ok" /* RC_NOT_OK */] = 'RC response is not ok', _a["invalid attribute name" /* INVALID_ATTRIBUTE_NAME */] = 'Attribute name {$attributeName} is invalid.', _a["invalid attribute value" /* INVALID_ATTRIBUTE_VALUE */] = 'Attribute value {$attributeValue} is invalid.', _a["invalid custom metric name" /* INVALID_CUSTOM_METRIC_NAME */] = 'Custom metric name {$customMetricName} is invalid', _a["invalid String merger input" /* INVALID_STRING_MERGER_PARAMETER */] = 'Input for String merger is invalid, contact support team to resolve.', _a); var ERROR_FACTORY = new util.ErrorFactory(SERVICE, SERVICE_NAME, ERROR_DESCRIPTION_MAP); /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var consoleLogger = new logger$1.Logger(SERVICE_NAME); consoleLogger.logLevel = logger$1.LogLevel.INFO; /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var apiInstance; var windowInstance; /** * This class holds a reference to various browser related objects injected by * set methods. */ var Api = /** @class */ (function () { function Api(window) { this.window = window; if (!window) { throw ERROR_FACTORY.create("no window" /* NO_WINDOW */); } this.performance = window.performance; this.PerformanceObserver = window.PerformanceObserver; this.windowLocation = window.location; this.navigator = window.navigator; this.document = window.document; if (this.navigator && this.navigator.cookieEnabled) { // If user blocks cookies on the browser, accessing localStorage will // throw an exception. this.localStorage = window.localStorage; } if (window.perfMetrics && window.perfMetrics.onFirstInputDelay) { this.onFirstInputDelay = window.perfMetrics.onFirstInputDelay; } } Api.prototype.getUrl = function () { // Do not capture the string query part of url. return this.windowLocation.href.split('?')[0]; }; Api.prototype.mark = function (name) { if (!this.performance || !this.performance.mark) { return; } this.performance.mark(name); }; Api.prototype.measure = function (measureName, mark1, mark2) { if (!this.performance || !this.performance.measure) { return; } this.performance.measure(measureName, mark1, mark2); }; Api.prototype.getEntriesByType = function (type) { if (!this.performance || !this.performance.getEntriesByType) { return []; } return this.performance.getEntriesByType(type); }; Api.prototype.getEntriesByName = function (name) { if (!this.performance || !this.performance.getEntriesByName) { return []; } return this.performance.getEntriesByName(name); }; Api.prototype.getTimeOrigin = function () { // Polyfill the time origin with performance.timing.navigationStart. return (this.performance && (this.performance.timeOrigin || this.performance.timing.navigationStart)); }; Api.prototype.requiredApisAvailable = function () { if (!fetch || !Promise || !this.navigator || !this.navigator.cookieEnabled) { consoleLogger.info('Firebase Performance cannot start if browser does not support fetch and Promise or cookie is disabled.'); return false; } if (!util.isIndexedDBAvailable()) { consoleLogger.info('IndexedDB is not supported by current browswer'); return false; } return true; }; Api.prototype.setupObserver = function (entryType, callback) { if (!this.PerformanceObserver) { return; } var observer = new this.PerformanceObserver(function (list) { for (var _i = 0, _a = list.getEntries(); _i < _a.length; _i++) { var entry = _a[_i]; // `entry` is a PerformanceEntry instance. callback(entry); } }); // Start observing the entry types you care about. observer.observe({ entryTypes: [entryType] }); }; Api.getInstance = function () { if (apiInstance === undefined) { apiInstance = new Api(windowInstance); } return apiInstance; }; return Api; }()); function setupApi(window) { windowInstance = window; } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ function mergeStrings(part1, part2) { var sizeDiff = part1.length - part2.length; if (sizeDiff < 0 || sizeDiff > 1) { throw ERROR_FACTORY.create("invalid String merger input" /* INVALID_STRING_MERGER_PARAMETER */); } var resultArray = []; for (var i = 0; i < part1.length; i++) { resultArray.push(part1.charAt(i)); if (part2.length > i) { resultArray.push(part2.charAt(i)); } } return resultArray.join(''); } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var settingsServiceInstance; var SettingsService = /** @class */ (function () { function SettingsService() { // The variable which controls logging of automatic traces and HTTP/S network monitoring. this.instrumentationEnabled = true; // The variable which controls logging of custom traces. this.dataCollectionEnabled = true; // Configuration flags set through remote config. this.loggingEnabled = false; // Sampling rate between 0 and 1. this.tracesSamplingRate = 1; this.networkRequestsSamplingRate = 1; // Address of logging service. this.logEndPointUrl = 'https://firebaselogging.googleapis.com/v0cc/log?format=json_proto'; // Performance event transport endpoint URL which should be compatible with proto3. // New Address for transport service, not configurable via Remote Config. this.flTransportEndpointUrl = mergeStrings('hts/frbslgigp.ogepscmv/ieo/eaylg', 'tp:/ieaeogn-agolai.o/1frlglgc/o'); this.transportKey = mergeStrings('AzSC8r6ReiGqFMyfvgow', 'Iayx0u-XT3vksVM-pIV'); // Source type for performance event logs. this.logSource = 462; // Flags which control per session logging of traces and network requests. this.logTraceAfterSampling = false; this.logNetworkAfterSampling = false; // TTL of config retrieved from remote config in hours. this.configTimeToLive = 12; } SettingsService.prototype.getAppId = function () { var appId = this.firebaseAppInstance && this.firebaseAppInstance.options && this.firebaseAppInstance.options.appId; if (!appId) { throw ERROR_FACTORY.create("no app id" /* NO_APP_ID */); } return appId; }; SettingsService.prototype.getProjectId = function () { var projectId = this.firebaseAppInstance && this.firebaseAppInstance.options && this.firebaseAppInstance.options.projectId; if (!projectId) { throw ERROR_FACTORY.create("no project id" /* NO_PROJECT_ID */); } return projectId; }; SettingsService.prototype.getApiKey = function () { var apiKey = this.firebaseAppInstance && this.firebaseAppInstance.options && this.firebaseAppInstance.options.apiKey; if (!apiKey) { throw ERROR_FACTORY.create("no api key" /* NO_API_KEY */); } return apiKey; }; SettingsService.prototype.getFlTransportFullUrl = function () { return this.flTransportEndpointUrl.concat('?key=', this.transportKey); }; SettingsService.getInstance = function () { if (settingsServiceInstance === undefined) { settingsServiceInstance = new SettingsService(); } return settingsServiceInstance; }; return SettingsService; }()); /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var iid; function getIidPromise() { var iidPromise = SettingsService.getInstance().installationsService.getId(); // eslint-disable-next-line @typescript-eslint/no-floating-promises iidPromise.then(function (iidVal) { iid = iidVal; }); return iidPromise; } // This method should be used after the iid is retrieved by getIidPromise method. function getIid() { return iid; } function getAuthTokenPromise() { var authTokenPromise = SettingsService.getInstance().installationsService.getToken(); // eslint-disable-next-line @typescript-eslint/no-floating-promises authTokenPromise.then(function (authTokenVal) { }); return authTokenPromise; } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var VisibilityState; (function (VisibilityState) { VisibilityState[VisibilityState["UNKNOWN"] = 0] = "UNKNOWN"; VisibilityState[VisibilityState["VISIBLE"] = 1] = "VISIBLE"; VisibilityState[VisibilityState["HIDDEN"] = 2] = "HIDDEN"; })(VisibilityState || (VisibilityState = {})); var RESERVED_ATTRIBUTE_PREFIXES = ['firebase_', 'google_', 'ga_']; var ATTRIBUTE_FORMAT_REGEX = new RegExp('^[a-zA-Z]\\w*$'); var MAX_ATTRIBUTE_NAME_LENGTH = 40; var MAX_ATTRIBUTE_VALUE_LENGTH = 100; function getServiceWorkerStatus() { var navigator = Api.getInstance().navigator; if ('serviceWorker' in navigator) { if (navigator.serviceWorker.controller) { return 2 /* CONTROLLED */; } else { return 3 /* UNCONTROLLED */; } } else { return 1 /* UNSUPPORTED */; } } function getVisibilityState() { var document = Api.getInstance().document; var visibilityState = document.visibilityState; switch (visibilityState) { case 'visible': return VisibilityState.VISIBLE; case 'hidden': return VisibilityState.HIDDEN; default: return VisibilityState.UNKNOWN; } } function getEffectiveConnectionType() { var navigator = Api.getInstance().navigator; var navigatorConnection = navigator.connection; var effectiveType = navigatorConnection && navigatorConnection.effectiveType; switch (effectiveType) { case 'slow-2g': return 1 /* CONNECTION_SLOW_2G */; case '2g': return 2 /* CONNECTION_2G */; case '3g': return 3 /* CONNECTION_3G */; case '4g': return 4 /* CONNECTION_4G */; default: return 0 /* UNKNOWN */; } } function isValidCustomAttributeName(name) { if (name.length === 0 || name.length > MAX_ATTRIBUTE_NAME_LENGTH) { return false; } var matchesReservedPrefix = RESERVED_ATTRIBUTE_PREFIXES.some(function (prefix) { return name.startsWith(prefix); }); return !matchesReservedPrefix && !!name.match(ATTRIBUTE_FORMAT_REGEX); } function isValidCustomAttributeValue(value) { return value.length !== 0 && value.length <= MAX_ATTRIBUTE_VALUE_LENGTH; } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var REMOTE_CONFIG_SDK_VERSION = '0.0.1'; // These values will be used if the remote config object is successfully // retrieved, but the template does not have these fields. var DEFAULT_CONFIGS = { loggingEnabled: true }; var FIS_AUTH_PREFIX = 'FIREBASE_INSTALLATIONS_AUTH'; function getConfig(iid) { var config = getStoredConfig(); if (config) { processConfig(config); return Promise.resolve(); } return getRemoteConfig(iid) .then(processConfig) .then(function (config) { return storeConfig(config); }, /** Do nothing for error, use defaults set in settings service. */ function () { }); } function getStoredConfig() { var localStorage = Api.getInstance().localStorage; if (!localStorage) { return; } var expiryString = localStorage.getItem(CONFIG_EXPIRY_LOCAL_STORAGE_KEY); if (!expiryString || !configValid(expiryString)) { return; } var configStringified = localStorage.getItem(CONFIG_LOCAL_STORAGE_KEY); if (!configStringified) { return; } try { var configResponse = JSON.parse(configStringified); return configResponse; } catch (_a) { return; } } function storeConfig(config) { var localStorage = Api.getInstance().localStorage; if (!config || !localStorage) { return; } localStorage.setItem(CONFIG_LOCAL_STORAGE_KEY, JSON.stringify(config)); localStorage.setItem(CONFIG_EXPIRY_LOCAL_STORAGE_KEY, String(Date.now() + SettingsService.getInstance().configTimeToLive * 60 * 60 * 1000)); } var COULD_NOT_GET_CONFIG_MSG = 'Could not fetch config, will use default configs'; function getRemoteConfig(iid) { // Perf needs auth token only to retrieve remote config. return getAuthTokenPromise() .then(function (authToken) { var projectId = SettingsService.getInstance().getProjectId(); var configEndPoint = "https://firebaseremoteconfig.googleapis.com/v1/projects/" + projectId + "/namespaces/fireperf:fetch?key=" + SettingsService.getInstance().getApiKey(); var request = new Request(configEndPoint, { method: 'POST', headers: { Authorization: FIS_AUTH_PREFIX + " " + authToken }, /* eslint-disable camelcase */ body: JSON.stringify({ app_instance_id: iid, app_instance_id_token: authToken, app_id: SettingsService.getInstance().getAppId(), app_version: SDK_VERSION, sdk_version: REMOTE_CONFIG_SDK_VERSION }) /* eslint-enable camelcase */ }); return fetch(request).then(function (response) { if (response.ok) { return response.json(); } // In case response is not ok. This will be caught by catch. throw ERROR_FACTORY.create("RC response not ok" /* RC_NOT_OK */); }); }) .catch(function () { consoleLogger.info(COULD_NOT_GET_CONFIG_MSG); return undefined; }); } /** * Processes config coming either from calling RC or from local storage. * This method only runs if call is successful or config in storage * is valid. */ function processConfig(config) { if (!config) { return config; } var settingsServiceInstance = SettingsService.getInstance(); var entries = config.entries || {}; if (entries.fpr_enabled !== undefined) { // TODO: Change the assignment of loggingEnabled once the received type is // known. settingsServiceInstance.loggingEnabled = String(entries.fpr_enabled) === 'true'; } else { // Config retrieved successfully, but there is no fpr_enabled in template. // Use secondary configs value. settingsServiceInstance.loggingEnabled = DEFAULT_CONFIGS.loggingEnabled; } if (entries.fpr_log_source) { settingsServiceInstance.logSource = Number(entries.fpr_log_source); } if (entries.fpr_log_endpoint_url) { settingsServiceInstance.logEndPointUrl = entries.fpr_log_endpoint_url; } // Key from Remote Config has to be non-empty string, otherwsie use local value. if (entries.fpr_log_transport_key) { settingsServiceInstance.transportKey = entries.fpr_log_transport_key; } if (entries.fpr_vc_network_request_sampling_rate !== undefined) { settingsServiceInstance.networkRequestsSamplingRate = Number(entries.fpr_vc_network_request_sampling_rate); } if (entries.fpr_vc_trace_sampling_rate !== undefined) { settingsServiceInstance.tracesSamplingRate = Number(entries.fpr_vc_trace_sampling_rate); } // Set the per session trace and network logging flags. settingsServiceInstance.logTraceAfterSampling = shouldLogAfterSampling(settingsServiceInstance.tracesSamplingRate); settingsServiceInstance.logNetworkAfterSampling = shouldLogAfterSampling(settingsServiceInstance.networkRequestsSamplingRate); return config; } function configValid(expiry) { return Number(expiry) > Date.now(); } function shouldLogAfterSampling(samplingRate) { return Math.random() <= samplingRate; } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var initializationStatus = 1 /* notInitialized */; var initializationPromise; function getInitializationPromise() { initializationStatus = 2 /* initializationPending */; initializationPromise = initializationPromise || initializePerf(); return initializationPromise; } function isPerfInitialized() { return initializationStatus === 3 /* initialized */; } function initializePerf() { return getDocumentReadyComplete() .then(function () { return getIidPromise(); }) .then(function (iid) { return getConfig(iid); }) .then(function () { return changeInitializationStatus(); }, function () { return changeInitializationStatus(); }); } /** * Returns a promise which resolves whenever the document readystate is complete or * immediately if it is called after page load complete. */ function getDocumentReadyComplete() { var document = Api.getInstance().document; return new Promise(function (resolve) { if (document && document.readyState !== 'complete') { var handler_1 = function () { if (document.readyState === 'complete') { document.removeEventListener('readystatechange', handler_1); resolve(); } }; document.addEventListener('readystatechange', handler_1); } else { resolve(); } }); } function changeInitializationStatus() { initializationStatus = 3 /* initialized */; } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var DEFAULT_SEND_INTERVAL_MS = 10 * 1000; var INITIAL_SEND_TIME_DELAY_MS = 5.5 * 1000; // If end point does not work, the call will be tried for these many times. var DEFAULT_REMAINING_TRIES = 3; var remainingTries = DEFAULT_REMAINING_TRIES; /* eslint-enable camelcase */ var queue = []; var isTransportSetup = false; function setupTransportService() { if (!isTransportSetup) { processQueue(INITIAL_SEND_TIME_DELAY_MS); isTransportSetup = true; } } function processQueue(timeOffset) { setTimeout(function () { // If there is no remainingTries left, stop retrying. if (remainingTries === 0) { return; } // If there are no events to process, wait for DEFAULT_SEND_INTERVAL_MS and try again. if (!queue.length) { return processQueue(DEFAULT_SEND_INTERVAL_MS); } dispatchQueueEvents(); }, timeOffset); } function dispatchQueueEvents() { // Capture a snapshot of the queue and empty the "official queue". var staged = tslib.__spreadArrays(queue); queue = []; /* eslint-disable camelcase */ // We will pass the JSON serialized event to the backend. var log_event = staged.map(function (evt) { return ({ source_extension_json_proto3: evt.message, event_time_ms: String(evt.eventTime) }); }); var data = { request_time_ms: String(Date.now()), client_info: { client_type: 1, js_client_info: {} }, log_source: SettingsService.getInstance().logSource, log_event: log_event }; /* eslint-enable camelcase */ sendEventsToFl(data, staged).catch(function () { // If the request fails for some reason, add the events that were attempted // back to the primary queue to retry later. queue = tslib.__spreadArrays(staged, queue); remainingTries--; consoleLogger.info("Tries left: " + remainingTries + "."); processQueue(DEFAULT_SEND_INTERVAL_MS); }); } function sendEventsToFl(data, staged) { return postToFlEndpoint(data) .then(function (res) { if (!res.ok) { consoleLogger.info('Call to Firebase backend failed.'); } return res.json(); }) .then(function (res) { // Find the next call wait time from the response. var transportWait = Number(res.nextRequestWaitMillis); var requestOffset = DEFAULT_SEND_INTERVAL_MS; if (!isNaN(transportWait)) { requestOffset = Math.max(transportWait, requestOffset); } // Delete request if response include RESPONSE_ACTION_UNKNOWN or DELETE_REQUEST action. // Otherwise, retry request using normal scheduling if response include RETRY_REQUEST_LATER. var logResponseDetails = res.logResponseDetails; if (Array.isArray(logResponseDetails) && logResponseDetails.length > 0 && logResponseDetails[0].responseAction === 'RETRY_REQUEST_LATER') { queue = tslib.__spreadArrays(staged, queue); consoleLogger.info("Retry transport request later."); } remainingTries = DEFAULT_REMAINING_TRIES; // Schedule the next process. processQueue(requestOffset); }); } function postToFlEndpoint(data) { var flTransportFullUrl = SettingsService.getInstance().getFlTransportFullUrl(); return fetch(flTransportFullUrl, { method: 'POST', body: JSON.stringify(data) }); } function addToQueue(evt) { if (!evt.eventTime || !evt.message) { throw ERROR_FACTORY.create("invalid cc log" /* INVALID_CC_LOG */); } // Add the new event to the queue. queue = tslib.__spreadArrays(queue, [evt]); } /** Log handler for cc service to send the performance logs to the server. */ function transportHandler( // eslint-disable-next-line @typescript-eslint/no-explicit-any serializer) { return function () { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } var message = serializer.apply(void 0, args); addToQueue({ message: message, eventTime: Date.now() }); }; } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* eslint-enble camelcase */ var logger; // This method is not called before initialization. function sendLog(resource, resourceType) { if (!logger) { logger = transportHandler(serializer); } logger(resource, resourceType); } function logTrace(trace) { var settingsService = SettingsService.getInstance(); // Do not log if trace is auto generated and instrumentation is disabled. if (!settingsService.instrumentationEnabled && trace.isAuto) { return; } // Do not log if trace is custom and data collection is disabled. if (!settingsService.dataCollectionEnabled && !trace.isAuto) { return; } // Do not log if required apis are not available. if (!Api.getInstance().requiredApisAvailable()) { return; } // Only log the page load auto traces if page is visible. if (trace.isAuto && getVisibilityState() !== VisibilityState.VISIBLE) { return; } if (isPerfInitialized()) { sendTraceLog(trace); } else { // Custom traces can be used before the initialization but logging // should wait until after. getInitializationPromise().then(function () { return sendTraceLog(trace); }, function () { return sendTraceLog(trace); }); } } function sendTraceLog(trace) { if (!getIid()) { return; } var settingsService = SettingsService.getInstance(); if (!settingsService.loggingEnabled || !settingsService.logTraceAfterSampling) { return; } setTimeout(function () { return sendLog(trace, 1 /* Trace */); }, 0); } function logNetworkRequest(networkRequest) { var settingsService = SettingsService.getInstance(); // Do not log network requests if instrumentation is disabled. if (!settingsService.instrumentationEnabled) { return; } // Do not log the js sdk's call to transport service domain to avoid unnecessary cycle. // Need to blacklist both old and new endpoints to avoid migration gap. var networkRequestUrl = networkRequest.url; // Blacklist old log endpoint and new transport endpoint. // Because Performance SDK doesn't instrument requests sent from SDK itself. var logEndpointUrl = settingsService.logEndPointUrl.split('?')[0]; var flEndpointUrl = settingsService.flTransportEndpointUrl.split('?')[0]; if (networkRequestUrl === logEndpointUrl || networkRequestUrl === flEndpointUrl) { return; } if (!settingsService.loggingEnabled || !settingsService.logNetworkAfterSampling) { return; } setTimeout(function () { return sendLog(networkRequest, 0 /* NetworkRequest */); }, 0); } function serializer(resource, resourceType) { if (resourceType === 0 /* NetworkRequest */) { return serializeNetworkRequest(resource); } return serializeTrace(resource); } function serializeNetworkRequest(networkRequest) { var networkRequestMetric = { url: networkRequest.url, http_method: networkRequest.httpMethod || 0, http_response_code: 200, response_payload_bytes: networkRequest.responsePayloadBytes, client_start_time_us: networkRequest.startTimeUs, time_to_response_initiated_us: networkRequest.timeToResponseInitiatedUs, time_to_response_completed_us: networkRequest.timeToResponseCompletedUs }; var perfMetric = { application_info: getApplicationInfo(), network_request_metric: networkRequestMetric }; return JSON.stringify(perfMetric); } function serializeTrace(trace) { var traceMetric = { name: trace.name, is_auto: trace.isAuto, client_start_time_us: trace.startTimeUs, duration_us: trace.durationUs }; if (Object.keys(trace.counters).length !== 0) { traceMetric.counters = trace.counters; } var customAttributes = trace.getAttributes(); if (Object.keys(customAttributes).length !== 0) { traceMetric.custom_attributes = customAttributes; } var perfMetric = { application_info: getApplicationInfo(), trace_metric: traceMetric }; return JSON.stringify(perfMetric); } function getApplicationInfo() { return { google_app_id: SettingsService.getInstance().getAppId(), app_instance_id: getIid(), web_app_info: { sdk_version: SDK_VERSION, page_url: Api.getInstance().getUrl(), service_worker_status: getServiceWorkerStatus(), visibility_state: getVisibilityState(), effective_connection_type: getEffectiveConnectionType() }, application_process_state: 0 }; } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var MAX_METRIC_NAME_LENGTH = 100; var RESERVED_AUTO_PREFIX = '_'; var oobMetrics = [ FIRST_PAINT_COUNTER_NAME, FIRST_CONTENTFUL_PAINT_COUNTER_NAME, FIRST_INPUT_DELAY_COUNTER_NAME ]; /** * Returns true if the metric is custom and does not start with reserved prefix, or if * the metric is one of out of the box page load trace metrics. */ function isValidMetricName(name, traceName) { if (name.length === 0 || name.length > MAX_METRIC_NAME_LENGTH) { return false; } return ((traceName && traceName.startsWith(OOB_TRACE_PAGE_LOAD_PREFIX) && oobMetrics.indexOf(name) > -1) || !name.startsWith(RESERVED_AUTO_PREFIX)); } /** * Converts the provided value to an integer value to be used in case of a metric. * @param providedValue Provided number value of the metric that needs to be converted to an integer. * * @returns Converted integer number to be set for the metric. */ function convertMetricValueToInteger(providedValue) { var valueAsInteger = Math.floor(providedValue); if (valueAsInteger < providedValue) { consoleLogger.info("Metric value should be an Integer, setting the value as : " + valueAsInteger + "."); } return valueAsInteger; } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var Trace = /** @class */ (function () { /** * @param name The name of the trace. * @param isAuto If the trace is auto-instrumented. * @param traceMeasureName The name of the measure marker in user timing specification. This field * is only set when the trace is built for logging when the user directly uses the user timing * api (performance.mark and performance.measure). */ function Trace(name, isAuto, traceMeasureName) { if (isAuto === void 0) { isAuto = false; } this.name = name; this.isAuto = isAuto; this.state = 1 /* UNINITIALIZED */; this.customAttributes = {}; this.counters = {}; this.api = Api.getInstance(); this.randomId = Math.floor(Math.random() * 1000000); if (!this.isAuto) { this.traceStartMark = TRACE_START_MARK_PREFIX + "-" + this.randomId + "-" + this.name; this.traceStopMark = TRACE_STOP_MARK_PREFIX + "-" + this.randomId + "-" + this.name; this.traceMeasure = traceMeasureName || TRACE_MEASURE_PREFIX + "-" + this.randomId + "-" + this.name; if (traceMeasureName) { // For the case of direct user timing traces, no start stop will happen. The measure object // is already available. this.calculateTraceMetrics(); } } } /** * Starts a trace. The measurement of the duration starts at this point. */ Trace.prototype.start = function () { if (this.state !== 1 /* UNINITIALIZED */) { throw ERROR_FACTORY.create("trace started" /* TRACE_STARTED_BEFORE */, { traceName: this.name }); } this.api.mark(this.traceStartMark); this.state = 2 /* RUNNING */; }; /** * Stops the trace. The measurement of the duration of the trace stops at this point and trace * is logged. */ Trace.prototype.stop = function () { if (this.state !== 2 /* RUNNING */) { throw ERROR_FACTORY.create("trace stopped" /* TRACE_STOPPED_BEFORE */, { traceName: this.name }); } this.state = 3 /* TERMINATED */; this.api.mark(this.traceStopMark); this.api.measure(this.traceMeasure, this.traceStartMark, this.traceStopMark); this.calculateTraceMetrics(); logTrace(this); }; /** * Records a trace with predetermined values. If this method is used a trace is created and logged * directly. No need to use start and stop methods. * @param startTime Trace start time since epoch in millisec * @param duration The duraction of the trace in millisec * @param options An object which can optionally hold maps of custom metrics and custom attributes */ Trace.prototype.record = function (startTime, duration, options) { if (startTime <= 0) { throw ERROR_FACTORY.create("nonpositive trace startTime" /* NONPOSITIVE_TRACE_START_TIME */, { traceName: this.name }); } if (duration <= 0) { throw ERROR_FACTORY.create("nonpositive trace duration" /* NONPOSITIVE_TRACE_DURATION */, { traceName: this.name }); } this.durationUs = Math.floor(duration * 1000); this.startTimeUs = Math.floor(startTime * 1000); if (options && options.attributes) { this.customAttributes = tslib.__assign({}, options.attributes); } if (options && options.metrics) { for (var _i = 0, _a = Object.keys(options.metrics); _i < _a.length; _i++) { var metric = _a[_i]; if (!isNaN(Number(options.metrics[metric]))) { this.counters[metric] = Number(Math.floor(options.metrics[metric])); } } } logTrace(this); }; /** * Increments a custom metric by a certain number or 1 if number not specified. Will create a new * custom metric if one with the given name does not exist. The value will be floored down to an * integer. * @param counter Name of the custom metric * @param numAsInteger Increment by value */ Trace.prototype.incrementMetric = function (counter, numAsInteger) { if (numAsInteger === void 0) { numAsInteger = 1; } if (this.counters[counter] === undefined) { this.putMetric(counter, numAsInteger); } else { this.putMetric(counter, this.counters[counter] + numAsInteger); } }; /** * Sets a custom metric to a specified value. Will create a new custom metric if one with the * given name does not exist. The value will be floored down to an integer. * @param counter Name of the custom metric * @param numAsInteger Set custom metric to this value */ Trace.prototype.putMetric = function (counter, numAsInteger) { if (isValidMetricName(counter, this.name)) { this.counters[counter] = convertMetricValueToInteger(numAsInteger); } else { throw ERROR_FACTORY.create("invalid custom metric name" /* INVALID_CUSTOM_METRIC_NAME */, { customMetricName: counter }); } }; /** * Returns the value of the custom metric by that name. If a custom metric with that name does * not exist will return zero. * @param counter */ Trace.prototype.getMetric = function (counter) { return this.counters[counter] || 0; }; /** * Sets a custom attribute of a trace to a certain value. * @param attr * @param value */ Trace.prototype.putAttribute = function (attr, value) { var isValidName = isValidCustomAttributeName(attr); var isValidValue = isValidCustomAttributeValue(value); if (isValidName && isValidValue) { this.customAttributes[attr] = value; return; } // Throw appropriate error when the attribute name or value is invalid. if (!isValidName) { throw ERROR_FACTORY.create("invalid attribute name" /* INVALID_ATTRIBUTE_NAME */, { attributeName: attr }); } if (!isValidValue) { throw ERROR_FACTORY.create("invalid attribute value" /* INVALID_ATTRIBUTE_VALUE */, { attributeValue: value }); } }; /** * Retrieves the value a custom attribute of a trace is set to. * @param attr */ Trace.prototype.getAttribute = function (attr) { return this.customAttributes[attr]; }; Trace.prototype.removeAttribute = function (attr) { if (this.customAttributes[attr] === undefined) { return; } delete this.customAttributes[attr]; }; Trace.prototype.getAttributes = function () { return tslib.__assign({}, this.customAttributes); }; Trace.prototype.setStartTime = function (startTime) { this.startTimeUs = startTime; }; Trace.prototype.setDuration = function (duration) { this.durationUs = duration; }; /** * Calculates and assigns the duration and start time of the trace using the measure performance * entry. */ Trace.prototype.calculateTraceMetrics = function () { var perfMeasureEntries = this.api.getEntriesByName(this.traceMeasure); var perfMeasureEntry = perfMeasureEntries && perfMeasureEntries[0]; if (perfMeasureEntry) { this.durationUs = Math.floor(perfMeasureEntry.duration * 1000); this.startTimeUs = Math.floor((perfMeasureEntry.startTime + this.api.getTimeOrigin()) * 1000); } }; /** * @param navigationTimings A single element array which contains the navigationTIming object of * the page load * @param paintTimings A array which contains paintTiming object of the page load * @param firstInputDelay First input delay in millisec */ Trace.createOobTrace = function (navigationTimings, paintTimings, firstInputDelay) { var route = Api.getInstance().getUrl(); if (!route) { return; } var trace = new Trace(OOB_TRACE_PAGE_LOAD_PREFIX + route, true); var timeOriginUs = Math.floor(Api.getInstance().getTimeOrigin() * 1000); trace.setStartTime(timeOriginUs); // navigationTimings includes only one element. if (navigationTimings && navigationTimings[0]) { trace.setDuration(Math.floor(navigationTimings[0].duration * 1000)); trace.putMetric('domInteractive', Math.floor(navigationTimings[0].domInteractive * 1000)); trace.putMetric('domContentLoadedEventEnd', Math.floor(navigationTimings[0].domContentLoadedEventEnd * 1000)); trace.putMetric('loadEventEnd', Math.floor(navigationTimings[0].loadEventEnd * 1000)); } var FIRST_PAINT = 'first-paint'; var FIRST_CONTENTFUL_PAINT = 'first-contentful-paint'; if (paintTimings) { var firstPaint = paintTimings.find(function (paintObject) { return paintObject.name === FIRST_PAINT; }); if (firstPaint && firstPaint.startTime) { trace.putMetric(FIRST_PAINT_COUNTER_NAME, Math.floor(firstPaint.startTime * 1000)); } var firstContentfulPaint = paintTimings.find(function (paintObject) { return paintObject.name === FIRST_CONTENTFUL_PAINT; }); if (firstContentfulPaint && firstContentfulPaint.startTime) { trace.putMetric(FIRST_CONTENTFUL_PAINT_COUNTER_NAME, Math.floor(firstContentfulPaint.startTime * 1000)); } if (firstInputDelay) { trace.putMetric(FIRST_INPUT_DELAY_COUNTER_NAME, Math.floor(firstInputDelay * 1000)); } } logTrace(trace); }; Trace.createUserTimingTrace = function (measureName) { var trace = new Trace(measureName, false, measureName); logTrace(trace); }; return Trace; }()); /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ function createNetworkRequestEntry(entry) { var performanceEntry = entry; if (!performanceEntry || performanceEntry.responseStart === undefined) { return; } var timeOrigin = Api.getInstance().getTimeOrigin(); var startTimeUs = Math.floor((performanceEntry.startTime + timeOrigin) * 1000); var timeToResponseInitiatedUs = performanceEntry.responseStart ? Math.floor((performanceEntry.responseStart - performanceEntry.startTime) * 1000) : undefined; var timeToResponseCompletedUs = Math.floor((performanceEntry.responseEnd - performanceEntry.startTime) * 1000); // Remove the query params from logged network request url. var url = performanceEntry.name && performanceEntry.name.split('?')[0]; var networkRequest = { url: url, responsePayloadBytes: performanceEntry.transferSize, startTimeUs: startTimeUs, timeToResponseInitiatedUs: timeToResponseInitiatedUs, timeToResponseCompletedUs: timeToResponseCompletedUs }; logNetworkRequest(networkRequest); } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var FID_WAIT_TIME_MS = 5000; function setupOobResources() { // Do not initialize unless iid is available. if (!getIid()) { return; } // The load event might not have fired yet, and that means performance navigation timing // object has a duration of 0. The setup should run after all current tasks in js queue. setTimeout(function () { return setupOobTraces(); }, 0); setTimeout(function () { return setupNetworkRequests(); }, 0); setTimeout(function () { return setupUserTimingTraces(); }, 0); } function setupNetworkRequests() { var api = Api.getInstance(); var resources = api.getEntriesByType('resource'); for (var _i = 0, resources_1 = resources; _i < resources_1.length; _i++) { var resource = resources_1[_i]; createNetworkRequestEntry(resource); } api.setupObserver('resource', createNetworkRequestEntry); } function setupOobTraces() { var api = Api.getInstance(); var navigationTimings = api.getEntriesByType('navigation'); var paintTimings = api.getEntriesByType('paint'); // If First Input Desly polyfill is added to the page, report the fid value. // https://github.com/GoogleChromeLabs/first-input-delay if (api.onFirstInputDelay) { // If the fid call back is not called for certain time, continue without it. // eslint-disable-next-line @typescript-eslint/no-explicit-any var timeoutId_1 = setTimeout(function () { Trace.createOobTrace(navigationTimings, paintTimings); timeoutId_1 = undefined; }, FID_WAIT_TIME_MS); api.onFirstInputDelay(function (fid) { if (timeoutId_1) { clearTimeout(timeoutId_1); Trace.createOobTrace(navigationTimings, paintTimings, fid); } }); } else { Trace.createOobTrace(navigationTimings, paintTimings); } } function setupUserTimingTraces() { var api = Api.getInstance(); // Run through the measure performance entries collected up to this point. var measures = api.getEntriesByType('measure'); for (var _i = 0, measures_1 = measures; _i < measures_1.length; _i++) { var measure = measures_1[_i]; createUserTimingTrace(measure); } // Setup an observer to capture the measures from this point on. api.setupObserver('measure', createUserTimingTrace); } function createUserTimingTrace(measure) { var measureName = measure.name; // Do not create a trace, if the user timing marks and measures are created by the sdk itself. if (measureName.substring(0, TRACE_MEASURE_PREFIX.length) === TRACE_MEASURE_PREFIX) { return; } Trace.createUserTimingTrace(measureName); } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var PerformanceController = /** @class */ (function () { function PerformanceController(app) { this.app = app; if (Api.getInstance().requiredApisAvailable()) { util.validateIndexedDBOpenable() .then(function (isAvailable) { if (isAvailable) { setupTransportService(); getInitializationPromise().then(setupOobResources, setupOobResources); } }) .catch(function (error) { consoleLogger.info("Environment doesn't support IndexedDB: " + error); }); } } PerformanceController.prototype.trace = function (name) { return new Trace(name); }; Object.defineProperty(PerformanceController.prototype, "instrumentationEnabled", { get: function () { return SettingsService.getInstance().instrumentationEnabled; }, set: function (val) { SettingsService.getInstance().instrumentationEnabled = val; }, enumerable: false, configurable: true }); Object.defineProperty(PerformanceController.prototype, "dataCollectionEnabled", { get: function () { return SettingsService.getInstance().dataCollectionEnabled; }, set: function (val) { SettingsService.getInstance().dataCollectionEnabled = val; }, enumerable: false, configurable: true }); return PerformanceController; }()); /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var DEFAULT_ENTRY_NAME = '[DEFAULT]'; function registerPerformance(instance) { var factoryMethod = function (app, installations) { if (app.name !== DEFAULT_ENTRY_NAME) { throw ERROR_FACTORY.create("FB not default" /* FB_NOT_DEFAULT */); } if (typeof window === 'undefined') { throw ERROR_FACTORY.create("no window" /* NO_WINDOW */); } setupApi(window); SettingsService.getInstance().firebaseAppInstance = app; SettingsService.getInstance().installationsService = installations; return new PerformanceController(app); }; // Register performance with firebase-app. instance.INTERNAL.registerComponent(new component.Component('performance', function (container) { /* Dependencies */ // getImmediate for FirebaseApp will always succeed var app = container.getProvider('app').getImmediate(); // The following call will always succeed because perf has `import '@firebase/installations'` var installations = container .getProvider('installations') .getImmediate(); return factoryMethod(app, installations); }, "PUBLIC" /* PUBLIC */)); instance.registerVersion(name, version); } registerPerformance(firebase__default['default']); exports.registerPerformance = registerPerformance; //# sourceMappingURL=index.cjs.js.map /***/ }), /***/ "./node_modules/@firebase/performance/node_modules/@firebase/component/dist/index.cjs.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, '__esModule', { value: true }); var tslib = __webpack_require__("./node_modules/@firebase/performance/node_modules/tslib/tslib.es6.js"); var util = __webpack_require__("./node_modules/@firebase/performance/node_modules/@firebase/util/dist/index.cjs.js"); /** * Component for service name T, e.g. `auth`, `auth-internal` */ var Component = /** @class */ (function () { /** * * @param name The public service name, e.g. app, auth, firestore, database * @param instanceFactory Service factory responsible for creating the public interface * @param type whether the service provided by the component is public or private */ function Component(name, instanceFactory, type) { this.name = name; this.instanceFactory = instanceFactory; this.type = type; this.multipleInstances = false; /** * Properties to be added to the service namespace */ this.serviceProps = {}; this.instantiationMode = "LAZY" /* LAZY */; } Component.prototype.setInstantiationMode = function (mode) { this.instantiationMode = mode; return this; }; Component.prototype.setMultipleInstances = function (multipleInstances) { this.multipleInstances = multipleInstances; return this; }; Component.prototype.setServiceProps = function (props) { this.serviceProps = props; return this; }; return Component; }()); /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var DEFAULT_ENTRY_NAME = '[DEFAULT]'; /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Provider for instance for service name T, e.g. 'auth', 'auth-internal' * NameServiceMapping[T] is an alias for the type of the instance */ var Provider = /** @class */ (function () { function Provider(name, container) { this.name = name; this.container = container; this.component = null; this.instances = new Map(); this.instancesDeferred = new Map(); } /** * @param identifier A provider can provide mulitple instances of a service * if this.component.multipleInstances is true. */ Provider.prototype.get = function (identifier) { if (identifier === void 0) { identifier = DEFAULT_ENTRY_NAME; } // if multipleInstances is not supported, use the default name var normalizedIdentifier = this.normalizeInstanceIdentifier(identifier); if (!this.instancesDeferred.has(normalizedIdentifier)) { var deferred = new util.Deferred(); this.instancesDeferred.set(normalizedIdentifier, deferred); // If the service instance is available, resolve the promise with it immediately try { var instance = this.getOrInitializeService(normalizedIdentifier); if (instance) { deferred.resolve(instance); } } catch (e) { // when the instance factory throws an exception during get(), it should not cause // a fatal error. We just return the unresolved promise in this case. } } return this.instancesDeferred.get(normalizedIdentifier).promise; }; Provider.prototype.getImmediate = function (options) { var _a = tslib.__assign({ identifier: DEFAULT_ENTRY_NAME, optional: false }, options), identifier = _a.identifier, optional = _a.optional; // if multipleInstances is not supported, use the default name var normalizedIdentifier = this.normalizeInstanceIdentifier(identifier); try { var instance = this.getOrInitializeService(normalizedIdentifier); if (!instance) { if (optional) { return null; } throw Error("Service " + this.name + " is not available"); } return instance; } catch (e) { if (optional) { return null; } else { throw e; } } }; Provider.prototype.getComponent = function () { return this.component; }; Provider.prototype.setComponent = function (component) { var e_1, _a; if (component.name !== this.name) { throw Error("Mismatching Component " + component.name + " for Provider " + this.name + "."); } if (this.component) { throw Error("Component for " + this.name + " has already been provided"); } this.component = component; // if the service is eager, initialize the default instance if (isComponentEager(component)) { try { this.getOrInitializeService(DEFAULT_ENTRY_NAME); } catch (e) { // when the instance factory for an eager Component throws an exception during the eager // initialization, it should not cause a fatal error. // TODO: Investigate if we need to make it configurable, because some component may want to cause // a fatal error in this case? } } try { // Create service instances for the pending promises and resolve them // NOTE: if this.multipleInstances is false, only the default instance will be created // and all promises with resolve with it regardless of the identifier. for (var _b = tslib.__values(this.instancesDeferred.entries()), _c = _b.next(); !_c.done; _c = _b.next()) { var _d = tslib.__read(_c.value, 2), instanceIdentifier = _d[0], instanceDeferred = _d[1]; var normalizedIdentifier = this.normalizeInstanceIdentifier(instanceIdentifier); try { // `getOrInitializeService()` should always return a valid instance since a component is guaranteed. use ! to make typescript happy. var instance = this.getOrInitializeService(normalizedIdentifier); instanceDeferred.resolve(instance); } catch (e) { // when the instance factory throws an exception, it should not cause // a fatal error. We just leave the promise unresolved. } } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (_c && !_c.done && (_a = _b.return)) _a.call(_b); } finally { if (e_1) throw e_1.error; } } }; Provider.prototype.clearInstance = function (identifier) { if (identifier === void 0) { identifier = DEFAULT_ENTRY_NAME; } this.instancesDeferred.delete(identifier); this.instances.delete(identifier); }; // app.delete() will call this method on every provider to delete the services // TODO: should we mark the provider as deleted? Provider.prototype.delete = function () { return tslib.__awaiter(this, void 0, void 0, function () { var services; return tslib.__generator(this, function (_a) { switch (_a.label) { case 0: services = Array.from(this.instances.values()); return [4 /*yield*/, Promise.all(tslib.__spread(services .filter(function (service) { return 'INTERNAL' in service; }) // legacy services // eslint-disable-next-line @typescript-eslint/no-explicit-any .map(function (service) { return service.INTERNAL.delete(); }), services .filter(function (service) { return '_delete' in service; }) // modularized services // eslint-disable-next-line @typescript-eslint/no-explicit-any .map(function (service) { return service._delete(); })))]; case 1: _a.sent(); return [2 /*return*/]; } }); }); }; Provider.prototype.isComponentSet = function () { return this.component != null; }; Provider.prototype.getOrInitializeService = function (identifier) { var instance = this.instances.get(identifier); if (!instance && this.component) { instance = this.component.instanceFactory(this.container, normalizeIdentifierForFactory(identifier)); this.instances.set(identifier, instance); } return instance || null; }; Provider.prototype.normalizeInstanceIdentifier = function (identifier) { if (this.component) { return this.component.multipleInstances ? identifier : DEFAULT_ENTRY_NAME; } else { return identifier; // assume multiple instances are supported before the component is provided. } }; return Provider; }()); // undefined should be passed to the service factory for the default instance function normalizeIdentifierForFactory(identifier) { return identifier === DEFAULT_ENTRY_NAME ? undefined : identifier; } function isComponentEager(component) { return component.instantiationMode === "EAGER" /* EAGER */; } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * ComponentContainer that provides Providers for service name T, e.g. `auth`, `auth-internal` */ var ComponentContainer = /** @class */ (function () { function ComponentContainer(name) { this.name = name; this.providers = new Map(); } /** * * @param component Component being added * @param overwrite When a component with the same name has already been registered, * if overwrite is true: overwrite the existing component with the new component and create a new * provider with the new component. It can be useful in tests where you want to use different mocks * for different tests. * if overwrite is false: throw an exception */ ComponentContainer.prototype.addComponent = function (component) { var provider = this.getProvider(component.name); if (provider.isComponentSet()) { throw new Error("Component " + component.name + " has already been registered with " + this.name); } provider.setComponent(component); }; ComponentContainer.prototype.addOrOverwriteComponent = function (component) { var provider = this.getProvider(component.name); if (provider.isComponentSet()) { // delete the existing provider from the container, so we can register the new component this.providers.delete(component.name); } this.addComponent(component); }; /** * getProvider provides a type safe interface where it can only be called with a field name * present in NameServiceMapping interface. * * Firebase SDKs providing services should extend NameServiceMapping interface to register * themselves. */ ComponentContainer.prototype.getProvider = function (name) { if (this.providers.has(name)) { return this.providers.get(name); } // create a Provider for a service that hasn't registered with Firebase var provider = new Provider(name, this); this.providers.set(name, provider); return provider; }; ComponentContainer.prototype.getProviders = function () { return Array.from(this.providers.values()); }; return ComponentContainer; }()); exports.Component = Component; exports.ComponentContainer = ComponentContainer; exports.Provider = Provider; //# sourceMappingURL=index.cjs.js.map /***/ }), /***/ "./node_modules/@firebase/performance/node_modules/@firebase/installations/dist/index.esm.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "registerInstallations", function() { return registerInstallations; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__firebase_app__ = __webpack_require__("./node_modules/@firebase/app/dist/index.cjs.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__firebase_app___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__firebase_app__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__firebase_component__ = __webpack_require__("./node_modules/@firebase/performance/node_modules/@firebase/component/dist/index.cjs.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__firebase_component___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1__firebase_component__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_tslib__ = __webpack_require__("./node_modules/@firebase/performance/node_modules/tslib/tslib.es6.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__firebase_util__ = __webpack_require__("./node_modules/@firebase/performance/node_modules/@firebase/util/dist/index.cjs.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__firebase_util___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3__firebase_util__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_idb__ = __webpack_require__("./node_modules/idb/build/idb.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_idb___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_idb__); var name = "@firebase/installations"; var version = "0.4.17"; /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var PENDING_TIMEOUT_MS = 10000; var PACKAGE_VERSION = "w:" + version; var INTERNAL_AUTH_VERSION = 'FIS_v2'; var INSTALLATIONS_API_URL = 'https://firebaseinstallations.googleapis.com/v1'; var TOKEN_EXPIRATION_BUFFER = 60 * 60 * 1000; // One hour var SERVICE = 'installations'; var SERVICE_NAME = 'Installations'; /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var _a; var ERROR_DESCRIPTION_MAP = (_a = {}, _a["missing-app-config-values" /* MISSING_APP_CONFIG_VALUES */] = 'Missing App configuration value: "{$valueName}"', _a["not-registered" /* NOT_REGISTERED */] = 'Firebase Installation is not registered.', _a["installation-not-found" /* INSTALLATION_NOT_FOUND */] = 'Firebase Installation not found.', _a["request-failed" /* REQUEST_FAILED */] = '{$requestName} request failed with error "{$serverCode} {$serverStatus}: {$serverMessage}"', _a["app-offline" /* APP_OFFLINE */] = 'Could not process request. Application offline.', _a["delete-pending-registration" /* DELETE_PENDING_REGISTRATION */] = "Can't delete installation while there is a pending registration request.", _a); var ERROR_FACTORY = new __WEBPACK_IMPORTED_MODULE_3__firebase_util__["ErrorFactory"](SERVICE, SERVICE_NAME, ERROR_DESCRIPTION_MAP); /** Returns true if error is a FirebaseError that is based on an error from the server. */ function isServerError(error) { return (error instanceof __WEBPACK_IMPORTED_MODULE_3__firebase_util__["FirebaseError"] && error.code.includes("request-failed" /* REQUEST_FAILED */)); } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ function getInstallationsEndpoint(_a) { var projectId = _a.projectId; return INSTALLATIONS_API_URL + "/projects/" + projectId + "/installations"; } function extractAuthTokenInfoFromResponse(response) { return { token: response.token, requestStatus: 2 /* COMPLETED */, expiresIn: getExpiresInFromResponseExpiresIn(response.expiresIn), creationTime: Date.now() }; } function getErrorFromResponse(requestName, response) { return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__awaiter"])(this, void 0, void 0, function () { var responseJson, errorData; return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__generator"])(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, response.json()]; case 1: responseJson = _a.sent(); errorData = responseJson.error; return [2 /*return*/, ERROR_FACTORY.create("request-failed" /* REQUEST_FAILED */, { requestName: requestName, serverCode: errorData.code, serverMessage: errorData.message, serverStatus: errorData.status })]; } }); }); } function getHeaders(_a) { var apiKey = _a.apiKey; return new Headers({ 'Content-Type': 'application/json', Accept: 'application/json', 'x-goog-api-key': apiKey }); } function getHeadersWithAuth(appConfig, _a) { var refreshToken = _a.refreshToken; var headers = getHeaders(appConfig); headers.append('Authorization', getAuthorizationHeader(refreshToken)); return headers; } /** * Calls the passed in fetch wrapper and returns the response. * If the returned response has a status of 5xx, re-runs the function once and * returns the response. */ function retryIfServerError(fn) { return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__awaiter"])(this, void 0, void 0, function () { var result; return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__generator"])(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, fn()]; case 1: result = _a.sent(); if (result.status >= 500 && result.status < 600) { // Internal Server Error. Retry request. return [2 /*return*/, fn()]; } return [2 /*return*/, result]; } }); }); } function getExpiresInFromResponseExpiresIn(responseExpiresIn) { // This works because the server will never respond with fractions of a second. return Number(responseExpiresIn.replace('s', '000')); } function getAuthorizationHeader(refreshToken) { return INTERNAL_AUTH_VERSION + " " + refreshToken; } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ function createInstallationRequest(appConfig, _a) { var fid = _a.fid; return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__awaiter"])(this, void 0, void 0, function () { var endpoint, headers, body, request, response, responseValue, registeredInstallationEntry; return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__generator"])(this, function (_b) { switch (_b.label) { case 0: endpoint = getInstallationsEndpoint(appConfig); headers = getHeaders(appConfig); body = { fid: fid, authVersion: INTERNAL_AUTH_VERSION, appId: appConfig.appId, sdkVersion: PACKAGE_VERSION }; request = { method: 'POST', headers: headers, body: JSON.stringify(body) }; return [4 /*yield*/, retryIfServerError(function () { return fetch(endpoint, request); })]; case 1: response = _b.sent(); if (!response.ok) return [3 /*break*/, 3]; return [4 /*yield*/, response.json()]; case 2: responseValue = _b.sent(); registeredInstallationEntry = { fid: responseValue.fid || fid, registrationStatus: 2 /* COMPLETED */, refreshToken: responseValue.refreshToken, authToken: extractAuthTokenInfoFromResponse(responseValue.authToken) }; return [2 /*return*/, registeredInstallationEntry]; case 3: return [4 /*yield*/, getErrorFromResponse('Create Installation', response)]; case 4: throw _b.sent(); } }); }); } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** Returns a promise that resolves after given time passes. */ function sleep(ms) { return new Promise(function (resolve) { setTimeout(resolve, ms); }); } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ function bufferToBase64UrlSafe(array) { var b64 = btoa(String.fromCharCode.apply(String, Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__spread"])(array))); return b64.replace(/\+/g, '-').replace(/\//g, '_'); } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var VALID_FID_PATTERN = /^[cdef][\w-]{21}$/; var INVALID_FID = ''; /** * Generates a new FID using random values from Web Crypto API. * Returns an empty string if FID generation fails for any reason. */ function generateFid() { try { // A valid FID has exactly 22 base64 characters, which is 132 bits, or 16.5 // bytes. our implementation generates a 17 byte array instead. var fidByteArray = new Uint8Array(17); var crypto_1 = self.crypto || self.msCrypto; crypto_1.getRandomValues(fidByteArray); // Replace the first 4 random bits with the constant FID header of 0b0111. fidByteArray[0] = 112 + (fidByteArray[0] % 16); var fid = encode(fidByteArray); return VALID_FID_PATTERN.test(fid) ? fid : INVALID_FID; } catch (_a) { // FID generation errored return INVALID_FID; } } /** Converts a FID Uint8Array to a base64 string representation. */ function encode(fidByteArray) { var b64String = bufferToBase64UrlSafe(fidByteArray); // Remove the 23rd character that was added because of the extra 4 bits at the // end of our 17 byte array, and the '=' padding. return b64String.substr(0, 22); } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** Returns a string key that can be used to identify the app. */ function getKey(appConfig) { return appConfig.appName + "!" + appConfig.appId; } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var fidChangeCallbacks = new Map(); /** * Calls the onIdChange callbacks with the new FID value, and broadcasts the * change to other tabs. */ function fidChanged(appConfig, fid) { var key = getKey(appConfig); callFidChangeCallbacks(key, fid); broadcastFidChange(key, fid); } function addCallback(appConfig, callback) { // Open the broadcast channel if it's not already open, // to be able to listen to change events from other tabs. getBroadcastChannel(); var key = getKey(appConfig); var callbackSet = fidChangeCallbacks.get(key); if (!callbackSet) { callbackSet = new Set(); fidChangeCallbacks.set(key, callbackSet); } callbackSet.add(callback); } function removeCallback(appConfig, callback) { var key = getKey(appConfig); var callbackSet = fidChangeCallbacks.get(key); if (!callbackSet) { return; } callbackSet.delete(callback); if (callbackSet.size === 0) { fidChangeCallbacks.delete(key); } // Close broadcast channel if there are no more callbacks. closeBroadcastChannel(); } function callFidChangeCallbacks(key, fid) { var e_1, _a; var callbacks = fidChangeCallbacks.get(key); if (!callbacks) { return; } try { for (var callbacks_1 = Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__values"])(callbacks), callbacks_1_1 = callbacks_1.next(); !callbacks_1_1.done; callbacks_1_1 = callbacks_1.next()) { var callback = callbacks_1_1.value; callback(fid); } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (callbacks_1_1 && !callbacks_1_1.done && (_a = callbacks_1.return)) _a.call(callbacks_1); } finally { if (e_1) throw e_1.error; } } } function broadcastFidChange(key, fid) { var channel = getBroadcastChannel(); if (channel) { channel.postMessage({ key: key, fid: fid }); } closeBroadcastChannel(); } var broadcastChannel = null; /** Opens and returns a BroadcastChannel if it is supported by the browser. */ function getBroadcastChannel() { if (!broadcastChannel && 'BroadcastChannel' in self) { broadcastChannel = new BroadcastChannel('[Firebase] FID Change'); broadcastChannel.onmessage = function (e) { callFidChangeCallbacks(e.data.key, e.data.fid); }; } return broadcastChannel; } function closeBroadcastChannel() { if (fidChangeCallbacks.size === 0 && broadcastChannel) { broadcastChannel.close(); broadcastChannel = null; } } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var DATABASE_NAME = 'firebase-installations-database'; var DATABASE_VERSION = 1; var OBJECT_STORE_NAME = 'firebase-installations-store'; var dbPromise = null; function getDbPromise() { if (!dbPromise) { dbPromise = Object(__WEBPACK_IMPORTED_MODULE_4_idb__["openDb"])(DATABASE_NAME, DATABASE_VERSION, function (upgradeDB) { // We don't use 'break' in this switch statement, the fall-through // behavior is what we want, because if there are multiple versions between // the old version and the current version, we want ALL the migrations // that correspond to those versions to run, not only the last one. // eslint-disable-next-line default-case switch (upgradeDB.oldVersion) { case 0: upgradeDB.createObjectStore(OBJECT_STORE_NAME); } }); } return dbPromise; } /** Assigns or overwrites the record for the given key with the given value. */ function set(appConfig, value) { return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__awaiter"])(this, void 0, void 0, function () { var key, db, tx, objectStore, oldValue; return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__generator"])(this, function (_a) { switch (_a.label) { case 0: key = getKey(appConfig); return [4 /*yield*/, getDbPromise()]; case 1: db = _a.sent(); tx = db.transaction(OBJECT_STORE_NAME, 'readwrite'); objectStore = tx.objectStore(OBJECT_STORE_NAME); return [4 /*yield*/, objectStore.get(key)]; case 2: oldValue = _a.sent(); return [4 /*yield*/, objectStore.put(value, key)]; case 3: _a.sent(); return [4 /*yield*/, tx.complete]; case 4: _a.sent(); if (!oldValue || oldValue.fid !== value.fid) { fidChanged(appConfig, value.fid); } return [2 /*return*/, value]; } }); }); } /** Removes record(s) from the objectStore that match the given key. */ function remove(appConfig) { return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__awaiter"])(this, void 0, void 0, function () { var key, db, tx; return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__generator"])(this, function (_a) { switch (_a.label) { case 0: key = getKey(appConfig); return [4 /*yield*/, getDbPromise()]; case 1: db = _a.sent(); tx = db.transaction(OBJECT_STORE_NAME, 'readwrite'); return [4 /*yield*/, tx.objectStore(OBJECT_STORE_NAME).delete(key)]; case 2: _a.sent(); return [4 /*yield*/, tx.complete]; case 3: _a.sent(); return [2 /*return*/]; } }); }); } /** * Atomically updates a record with the result of updateFn, which gets * called with the current value. If newValue is undefined, the record is * deleted instead. * @return Updated value */ function update(appConfig, updateFn) { return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__awaiter"])(this, void 0, void 0, function () { var key, db, tx, store, oldValue, newValue; return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__generator"])(this, function (_a) { switch (_a.label) { case 0: key = getKey(appConfig); return [4 /*yield*/, getDbPromise()]; case 1: db = _a.sent(); tx = db.transaction(OBJECT_STORE_NAME, 'readwrite'); store = tx.objectStore(OBJECT_STORE_NAME); return [4 /*yield*/, store.get(key)]; case 2: oldValue = _a.sent(); newValue = updateFn(oldValue); if (!(newValue === undefined)) return [3 /*break*/, 4]; return [4 /*yield*/, store.delete(key)]; case 3: _a.sent(); return [3 /*break*/, 6]; case 4: return [4 /*yield*/, store.put(newValue, key)]; case 5: _a.sent(); _a.label = 6; case 6: return [4 /*yield*/, tx.complete]; case 7: _a.sent(); if (newValue && (!oldValue || oldValue.fid !== newValue.fid)) { fidChanged(appConfig, newValue.fid); } return [2 /*return*/, newValue]; } }); }); } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Updates and returns the InstallationEntry from the database. * Also triggers a registration request if it is necessary and possible. */ function getInstallationEntry(appConfig) { return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__awaiter"])(this, void 0, void 0, function () { var registrationPromise, installationEntry; var _a; return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__generator"])(this, function (_b) { switch (_b.label) { case 0: return [4 /*yield*/, update(appConfig, function (oldEntry) { var installationEntry = updateOrCreateInstallationEntry(oldEntry); var entryWithPromise = triggerRegistrationIfNecessary(appConfig, installationEntry); registrationPromise = entryWithPromise.registrationPromise; return entryWithPromise.installationEntry; })]; case 1: installationEntry = _b.sent(); if (!(installationEntry.fid === INVALID_FID)) return [3 /*break*/, 3]; _a = {}; return [4 /*yield*/, registrationPromise]; case 2: // FID generation failed. Waiting for the FID from the server. return [2 /*return*/, (_a.installationEntry = _b.sent(), _a)]; case 3: return [2 /*return*/, { installationEntry: installationEntry, registrationPromise: registrationPromise }]; } }); }); } /** * Creates a new Installation Entry if one does not exist. * Also clears timed out pending requests. */ function updateOrCreateInstallationEntry(oldEntry) { var entry = oldEntry || { fid: generateFid(), registrationStatus: 0 /* NOT_STARTED */ }; return clearTimedOutRequest(entry); } /** * If the Firebase Installation is not registered yet, this will trigger the * registration and return an InProgressInstallationEntry. * * If registrationPromise does not exist, the installationEntry is guaranteed * to be registered. */ function triggerRegistrationIfNecessary(appConfig, installationEntry) { if (installationEntry.registrationStatus === 0 /* NOT_STARTED */) { if (!navigator.onLine) { // Registration required but app is offline. var registrationPromiseWithError = Promise.reject(ERROR_FACTORY.create("app-offline" /* APP_OFFLINE */)); return { installationEntry: installationEntry, registrationPromise: registrationPromiseWithError }; } // Try registering. Change status to IN_PROGRESS. var inProgressEntry = { fid: installationEntry.fid, registrationStatus: 1 /* IN_PROGRESS */, registrationTime: Date.now() }; var registrationPromise = registerInstallation(appConfig, inProgressEntry); return { installationEntry: inProgressEntry, registrationPromise: registrationPromise }; } else if (installationEntry.registrationStatus === 1 /* IN_PROGRESS */) { return { installationEntry: installationEntry, registrationPromise: waitUntilFidRegistration(appConfig) }; } else { return { installationEntry: installationEntry }; } } /** This will be executed only once for each new Firebase Installation. */ function registerInstallation(appConfig, installationEntry) { return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__awaiter"])(this, void 0, void 0, function () { var registeredInstallationEntry, e_1; return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__generator"])(this, function (_a) { switch (_a.label) { case 0: _a.trys.push([0, 2, , 7]); return [4 /*yield*/, createInstallationRequest(appConfig, installationEntry)]; case 1: registeredInstallationEntry = _a.sent(); return [2 /*return*/, set(appConfig, registeredInstallationEntry)]; case 2: e_1 = _a.sent(); if (!(isServerError(e_1) && e_1.serverCode === 409)) return [3 /*break*/, 4]; // Server returned a "FID can not be used" error. // Generate a new ID next time. return [4 /*yield*/, remove(appConfig)]; case 3: // Server returned a "FID can not be used" error. // Generate a new ID next time. _a.sent(); return [3 /*break*/, 6]; case 4: // Registration failed. Set FID as not registered. return [4 /*yield*/, set(appConfig, { fid: installationEntry.fid, registrationStatus: 0 /* NOT_STARTED */ })]; case 5: // Registration failed. Set FID as not registered. _a.sent(); _a.label = 6; case 6: throw e_1; case 7: return [2 /*return*/]; } }); }); } /** Call if FID registration is pending in another request. */ function waitUntilFidRegistration(appConfig) { return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__awaiter"])(this, void 0, void 0, function () { var entry, _a, installationEntry, registrationPromise; return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__generator"])(this, function (_b) { switch (_b.label) { case 0: return [4 /*yield*/, updateInstallationRequest(appConfig)]; case 1: entry = _b.sent(); _b.label = 2; case 2: if (!(entry.registrationStatus === 1 /* IN_PROGRESS */)) return [3 /*break*/, 5]; // createInstallation request still in progress. return [4 /*yield*/, sleep(100)]; case 3: // createInstallation request still in progress. _b.sent(); return [4 /*yield*/, updateInstallationRequest(appConfig)]; case 4: entry = _b.sent(); return [3 /*break*/, 2]; case 5: if (!(entry.registrationStatus === 0 /* NOT_STARTED */)) return [3 /*break*/, 7]; return [4 /*yield*/, getInstallationEntry(appConfig)]; case 6: _a = _b.sent(), installationEntry = _a.installationEntry, registrationPromise = _a.registrationPromise; if (registrationPromise) { return [2 /*return*/, registrationPromise]; } else { // if there is no registrationPromise, entry is registered. return [2 /*return*/, installationEntry]; } case 7: return [2 /*return*/, entry]; } }); }); } /** * Called only if there is a CreateInstallation request in progress. * * Updates the InstallationEntry in the DB based on the status of the * CreateInstallation request. * * Returns the updated InstallationEntry. */ function updateInstallationRequest(appConfig) { return update(appConfig, function (oldEntry) { if (!oldEntry) { throw ERROR_FACTORY.create("installation-not-found" /* INSTALLATION_NOT_FOUND */); } return clearTimedOutRequest(oldEntry); }); } function clearTimedOutRequest(entry) { if (hasInstallationRequestTimedOut(entry)) { return { fid: entry.fid, registrationStatus: 0 /* NOT_STARTED */ }; } return entry; } function hasInstallationRequestTimedOut(installationEntry) { return (installationEntry.registrationStatus === 1 /* IN_PROGRESS */ && installationEntry.registrationTime + PENDING_TIMEOUT_MS < Date.now()); } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ function generateAuthTokenRequest(_a, installationEntry) { var appConfig = _a.appConfig, platformLoggerProvider = _a.platformLoggerProvider; return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__awaiter"])(this, void 0, void 0, function () { var endpoint, headers, platformLogger, body, request, response, responseValue, completedAuthToken; return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__generator"])(this, function (_b) { switch (_b.label) { case 0: endpoint = getGenerateAuthTokenEndpoint(appConfig, installationEntry); headers = getHeadersWithAuth(appConfig, installationEntry); platformLogger = platformLoggerProvider.getImmediate({ optional: true }); if (platformLogger) { headers.append('x-firebase-client', platformLogger.getPlatformInfoString()); } body = { installation: { sdkVersion: PACKAGE_VERSION } }; request = { method: 'POST', headers: headers, body: JSON.stringify(body) }; return [4 /*yield*/, retryIfServerError(function () { return fetch(endpoint, request); })]; case 1: response = _b.sent(); if (!response.ok) return [3 /*break*/, 3]; return [4 /*yield*/, response.json()]; case 2: responseValue = _b.sent(); completedAuthToken = extractAuthTokenInfoFromResponse(responseValue); return [2 /*return*/, completedAuthToken]; case 3: return [4 /*yield*/, getErrorFromResponse('Generate Auth Token', response)]; case 4: throw _b.sent(); } }); }); } function getGenerateAuthTokenEndpoint(appConfig, _a) { var fid = _a.fid; return getInstallationsEndpoint(appConfig) + "/" + fid + "/authTokens:generate"; } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Returns a valid authentication token for the installation. Generates a new * token if one doesn't exist, is expired or about to expire. * * Should only be called if the Firebase Installation is registered. */ function refreshAuthToken(dependencies, forceRefresh) { if (forceRefresh === void 0) { forceRefresh = false; } return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__awaiter"])(this, void 0, void 0, function () { var tokenPromise, entry, authToken, _a; return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__generator"])(this, function (_b) { switch (_b.label) { case 0: return [4 /*yield*/, update(dependencies.appConfig, function (oldEntry) { if (!isEntryRegistered(oldEntry)) { throw ERROR_FACTORY.create("not-registered" /* NOT_REGISTERED */); } var oldAuthToken = oldEntry.authToken; if (!forceRefresh && isAuthTokenValid(oldAuthToken)) { // There is a valid token in the DB. return oldEntry; } else if (oldAuthToken.requestStatus === 1 /* IN_PROGRESS */) { // There already is a token request in progress. tokenPromise = waitUntilAuthTokenRequest(dependencies, forceRefresh); return oldEntry; } else { // No token or token expired. if (!navigator.onLine) { throw ERROR_FACTORY.create("app-offline" /* APP_OFFLINE */); } var inProgressEntry = makeAuthTokenRequestInProgressEntry(oldEntry); tokenPromise = fetchAuthTokenFromServer(dependencies, inProgressEntry); return inProgressEntry; } })]; case 1: entry = _b.sent(); if (!tokenPromise) return [3 /*break*/, 3]; return [4 /*yield*/, tokenPromise]; case 2: _a = _b.sent(); return [3 /*break*/, 4]; case 3: _a = entry.authToken; _b.label = 4; case 4: authToken = _a; return [2 /*return*/, authToken]; } }); }); } /** * Call only if FID is registered and Auth Token request is in progress. * * Waits until the current pending request finishes. If the request times out, * tries once in this thread as well. */ function waitUntilAuthTokenRequest(dependencies, forceRefresh) { return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__awaiter"])(this, void 0, void 0, function () { var entry, authToken; return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__generator"])(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, updateAuthTokenRequest(dependencies.appConfig)]; case 1: entry = _a.sent(); _a.label = 2; case 2: if (!(entry.authToken.requestStatus === 1 /* IN_PROGRESS */)) return [3 /*break*/, 5]; // generateAuthToken still in progress. return [4 /*yield*/, sleep(100)]; case 3: // generateAuthToken still in progress. _a.sent(); return [4 /*yield*/, updateAuthTokenRequest(dependencies.appConfig)]; case 4: entry = _a.sent(); return [3 /*break*/, 2]; case 5: authToken = entry.authToken; if (authToken.requestStatus === 0 /* NOT_STARTED */) { // The request timed out or failed in a different call. Try again. return [2 /*return*/, refreshAuthToken(dependencies, forceRefresh)]; } else { return [2 /*return*/, authToken]; } } }); }); } /** * Called only if there is a GenerateAuthToken request in progress. * * Updates the InstallationEntry in the DB based on the status of the * GenerateAuthToken request. * * Returns the updated InstallationEntry. */ function updateAuthTokenRequest(appConfig) { return update(appConfig, function (oldEntry) { if (!isEntryRegistered(oldEntry)) { throw ERROR_FACTORY.create("not-registered" /* NOT_REGISTERED */); } var oldAuthToken = oldEntry.authToken; if (hasAuthTokenRequestTimedOut(oldAuthToken)) { return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__assign"])(Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__assign"])({}, oldEntry), { authToken: { requestStatus: 0 /* NOT_STARTED */ } }); } return oldEntry; }); } function fetchAuthTokenFromServer(dependencies, installationEntry) { return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__awaiter"])(this, void 0, void 0, function () { var authToken, updatedInstallationEntry, e_1, updatedInstallationEntry; return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__generator"])(this, function (_a) { switch (_a.label) { case 0: _a.trys.push([0, 3, , 8]); return [4 /*yield*/, generateAuthTokenRequest(dependencies, installationEntry)]; case 1: authToken = _a.sent(); updatedInstallationEntry = Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__assign"])(Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__assign"])({}, installationEntry), { authToken: authToken }); return [4 /*yield*/, set(dependencies.appConfig, updatedInstallationEntry)]; case 2: _a.sent(); return [2 /*return*/, authToken]; case 3: e_1 = _a.sent(); if (!(isServerError(e_1) && (e_1.serverCode === 401 || e_1.serverCode === 404))) return [3 /*break*/, 5]; // Server returned a "FID not found" or a "Invalid authentication" error. // Generate a new ID next time. return [4 /*yield*/, remove(dependencies.appConfig)]; case 4: // Server returned a "FID not found" or a "Invalid authentication" error. // Generate a new ID next time. _a.sent(); return [3 /*break*/, 7]; case 5: updatedInstallationEntry = Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__assign"])(Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__assign"])({}, installationEntry), { authToken: { requestStatus: 0 /* NOT_STARTED */ } }); return [4 /*yield*/, set(dependencies.appConfig, updatedInstallationEntry)]; case 6: _a.sent(); _a.label = 7; case 7: throw e_1; case 8: return [2 /*return*/]; } }); }); } function isEntryRegistered(installationEntry) { return (installationEntry !== undefined && installationEntry.registrationStatus === 2 /* COMPLETED */); } function isAuthTokenValid(authToken) { return (authToken.requestStatus === 2 /* COMPLETED */ && !isAuthTokenExpired(authToken)); } function isAuthTokenExpired(authToken) { var now = Date.now(); return (now < authToken.creationTime || authToken.creationTime + authToken.expiresIn < now + TOKEN_EXPIRATION_BUFFER); } /** Returns an updated InstallationEntry with an InProgressAuthToken. */ function makeAuthTokenRequestInProgressEntry(oldEntry) { var inProgressAuthToken = { requestStatus: 1 /* IN_PROGRESS */, requestTime: Date.now() }; return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__assign"])(Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__assign"])({}, oldEntry), { authToken: inProgressAuthToken }); } function hasAuthTokenRequestTimedOut(authToken) { return (authToken.requestStatus === 1 /* IN_PROGRESS */ && authToken.requestTime + PENDING_TIMEOUT_MS < Date.now()); } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ function getId(dependencies) { return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__awaiter"])(this, void 0, void 0, function () { var _a, installationEntry, registrationPromise; return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__generator"])(this, function (_b) { switch (_b.label) { case 0: return [4 /*yield*/, getInstallationEntry(dependencies.appConfig)]; case 1: _a = _b.sent(), installationEntry = _a.installationEntry, registrationPromise = _a.registrationPromise; if (registrationPromise) { registrationPromise.catch(console.error); } else { // If the installation is already registered, update the authentication // token if needed. refreshAuthToken(dependencies).catch(console.error); } return [2 /*return*/, installationEntry.fid]; } }); }); } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ function getToken(dependencies, forceRefresh) { if (forceRefresh === void 0) { forceRefresh = false; } return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__awaiter"])(this, void 0, void 0, function () { var authToken; return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__generator"])(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, completeInstallationRegistration(dependencies.appConfig)]; case 1: _a.sent(); return [4 /*yield*/, refreshAuthToken(dependencies, forceRefresh)]; case 2: authToken = _a.sent(); return [2 /*return*/, authToken.token]; } }); }); } function completeInstallationRegistration(appConfig) { return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__awaiter"])(this, void 0, void 0, function () { var registrationPromise; return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__generator"])(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, getInstallationEntry(appConfig)]; case 1: registrationPromise = (_a.sent()).registrationPromise; if (!registrationPromise) return [3 /*break*/, 3]; // A createInstallation request is in progress. Wait until it finishes. return [4 /*yield*/, registrationPromise]; case 2: // A createInstallation request is in progress. Wait until it finishes. _a.sent(); _a.label = 3; case 3: return [2 /*return*/]; } }); }); } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ function deleteInstallationRequest(appConfig, installationEntry) { return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__awaiter"])(this, void 0, void 0, function () { var endpoint, headers, request, response; return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__generator"])(this, function (_a) { switch (_a.label) { case 0: endpoint = getDeleteEndpoint(appConfig, installationEntry); headers = getHeadersWithAuth(appConfig, installationEntry); request = { method: 'DELETE', headers: headers }; return [4 /*yield*/, retryIfServerError(function () { return fetch(endpoint, request); })]; case 1: response = _a.sent(); if (!!response.ok) return [3 /*break*/, 3]; return [4 /*yield*/, getErrorFromResponse('Delete Installation', response)]; case 2: throw _a.sent(); case 3: return [2 /*return*/]; } }); }); } function getDeleteEndpoint(appConfig, _a) { var fid = _a.fid; return getInstallationsEndpoint(appConfig) + "/" + fid; } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ function deleteInstallation(dependencies) { return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__awaiter"])(this, void 0, void 0, function () { var appConfig, entry; return Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__generator"])(this, function (_a) { switch (_a.label) { case 0: appConfig = dependencies.appConfig; return [4 /*yield*/, update(appConfig, function (oldEntry) { if (oldEntry && oldEntry.registrationStatus === 0 /* NOT_STARTED */) { // Delete the unregistered entry without sending a deleteInstallation request. return undefined; } return oldEntry; })]; case 1: entry = _a.sent(); if (!entry) return [3 /*break*/, 6]; if (!(entry.registrationStatus === 1 /* IN_PROGRESS */)) return [3 /*break*/, 2]; // Can't delete while trying to register. throw ERROR_FACTORY.create("delete-pending-registration" /* DELETE_PENDING_REGISTRATION */); case 2: if (!(entry.registrationStatus === 2 /* COMPLETED */)) return [3 /*break*/, 6]; if (!!navigator.onLine) return [3 /*break*/, 3]; throw ERROR_FACTORY.create("app-offline" /* APP_OFFLINE */); case 3: return [4 /*yield*/, deleteInstallationRequest(appConfig, entry)]; case 4: _a.sent(); return [4 /*yield*/, remove(appConfig)]; case 5: _a.sent(); _a.label = 6; case 6: return [2 /*return*/]; } }); }); } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Sets a new callback that will get called when Installation ID changes. * Returns an unsubscribe function that will remove the callback when called. */ function onIdChange(_a, callback) { var appConfig = _a.appConfig; addCallback(appConfig, callback); return function () { removeCallback(appConfig, callback); }; } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ function extractAppConfig(app) { var e_1, _a; if (!app || !app.options) { throw getMissingValueError('App Configuration'); } if (!app.name) { throw getMissingValueError('App Name'); } // Required app config keys var configKeys = [ 'projectId', 'apiKey', 'appId' ]; try { for (var configKeys_1 = Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["__values"])(configKeys), configKeys_1_1 = configKeys_1.next(); !configKeys_1_1.done; configKeys_1_1 = configKeys_1.next()) { var keyName = configKeys_1_1.value; if (!app.options[keyName]) { throw getMissingValueError(keyName); } } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (configKeys_1_1 && !configKeys_1_1.done && (_a = configKeys_1.return)) _a.call(configKeys_1); } finally { if (e_1) throw e_1.error; } } return { appName: app.name, projectId: app.options.projectId, apiKey: app.options.apiKey, appId: app.options.appId }; } function getMissingValueError(valueName) { return ERROR_FACTORY.create("missing-app-config-values" /* MISSING_APP_CONFIG_VALUES */, { valueName: valueName }); } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ function registerInstallations(instance) { var installationsName = 'installations'; instance.INTERNAL.registerComponent(new __WEBPACK_IMPORTED_MODULE_1__firebase_component__["Component"](installationsName, function (container) { var app = container.getProvider('app').getImmediate(); // Throws if app isn't configured properly. var appConfig = extractAppConfig(app); var platformLoggerProvider = container.getProvider('platform-logger'); var dependencies = { appConfig: appConfig, platformLoggerProvider: platformLoggerProvider }; var installations = { app: app, getId: function () { return getId(dependencies); }, getToken: function (forceRefresh) { return getToken(dependencies, forceRefresh); }, delete: function () { return deleteInstallation(dependencies); }, onIdChange: function (callback) { return onIdChange(dependencies, callback); } }; return installations; }, "PUBLIC" /* PUBLIC */)); instance.registerVersion(name, version); } registerInstallations(__WEBPACK_IMPORTED_MODULE_0__firebase_app___default.a); //# sourceMappingURL=index.esm.js.map /***/ }), /***/ "./node_modules/@firebase/performance/node_modules/@firebase/util/dist/index.cjs.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(global) { Object.defineProperty(exports, '__esModule', { value: true }); var tslib = __webpack_require__("./node_modules/@firebase/performance/node_modules/tslib/tslib.es6.js"); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * @fileoverview Firebase constants. Some of these (@defines) can be overridden at compile-time. */ var CONSTANTS = { /** * @define {boolean} Whether this is the client Node.js SDK. */ NODE_CLIENT: false, /** * @define {boolean} Whether this is the Admin Node.js SDK. */ NODE_ADMIN: false, /** * Firebase SDK Version */ SDK_VERSION: '${JSCORE_VERSION}' }; /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Throws an error if the provided assertion is falsy */ var assert = function (assertion, message) { if (!assertion) { throw assertionError(message); } }; /** * Returns an Error object suitable for throwing. */ var assertionError = function (message) { return new Error('Firebase Database (' + CONSTANTS.SDK_VERSION + ') INTERNAL ASSERT FAILED: ' + message); }; /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var stringToByteArray = function (str) { // TODO(user): Use native implementations if/when available var out = []; var p = 0; for (var i = 0; i < str.length; i++) { var c = str.charCodeAt(i); if (c < 128) { out[p++] = c; } else if (c < 2048) { out[p++] = (c >> 6) | 192; out[p++] = (c & 63) | 128; } else if ((c & 0xfc00) === 0xd800 && i + 1 < str.length && (str.charCodeAt(i + 1) & 0xfc00) === 0xdc00) { // Surrogate Pair c = 0x10000 + ((c & 0x03ff) << 10) + (str.charCodeAt(++i) & 0x03ff); out[p++] = (c >> 18) | 240; out[p++] = ((c >> 12) & 63) | 128; out[p++] = ((c >> 6) & 63) | 128; out[p++] = (c & 63) | 128; } else { out[p++] = (c >> 12) | 224; out[p++] = ((c >> 6) & 63) | 128; out[p++] = (c & 63) | 128; } } return out; }; /** * Turns an array of numbers into the string given by the concatenation of the * characters to which the numbers correspond. * @param bytes Array of numbers representing characters. * @return Stringification of the array. */ var byteArrayToString = function (bytes) { // TODO(user): Use native implementations if/when available var out = []; var pos = 0, c = 0; while (pos < bytes.length) { var c1 = bytes[pos++]; if (c1 < 128) { out[c++] = String.fromCharCode(c1); } else if (c1 > 191 && c1 < 224) { var c2 = bytes[pos++]; out[c++] = String.fromCharCode(((c1 & 31) << 6) | (c2 & 63)); } else if (c1 > 239 && c1 < 365) { // Surrogate Pair var c2 = bytes[pos++]; var c3 = bytes[pos++]; var c4 = bytes[pos++]; var u = (((c1 & 7) << 18) | ((c2 & 63) << 12) | ((c3 & 63) << 6) | (c4 & 63)) - 0x10000; out[c++] = String.fromCharCode(0xd800 + (u >> 10)); out[c++] = String.fromCharCode(0xdc00 + (u & 1023)); } else { var c2 = bytes[pos++]; var c3 = bytes[pos++]; out[c++] = String.fromCharCode(((c1 & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63)); } } return out.join(''); }; // We define it as an object literal instead of a class because a class compiled down to es5 can't // be treeshaked. https://github.com/rollup/rollup/issues/1691 // Static lookup maps, lazily populated by init_() var base64 = { /** * Maps bytes to characters. */ byteToCharMap_: null, /** * Maps characters to bytes. */ charToByteMap_: null, /** * Maps bytes to websafe characters. * @private */ byteToCharMapWebSafe_: null, /** * Maps websafe characters to bytes. * @private */ charToByteMapWebSafe_: null, /** * Our default alphabet, shared between * ENCODED_VALS and ENCODED_VALS_WEBSAFE */ ENCODED_VALS_BASE: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' + 'abcdefghijklmnopqrstuvwxyz' + '0123456789', /** * Our default alphabet. Value 64 (=) is special; it means "nothing." */ get ENCODED_VALS() { return this.ENCODED_VALS_BASE + '+/='; }, /** * Our websafe alphabet. */ get ENCODED_VALS_WEBSAFE() { return this.ENCODED_VALS_BASE + '-_.'; }, /** * Whether this browser supports the atob and btoa functions. This extension * started at Mozilla but is now implemented by many browsers. We use the * ASSUME_* variables to avoid pulling in the full useragent detection library * but still allowing the standard per-browser compilations. * */ HAS_NATIVE_SUPPORT: typeof atob === 'function', /** * Base64-encode an array of bytes. * * @param input An array of bytes (numbers with * value in [0, 255]) to encode. * @param webSafe Boolean indicating we should use the * alternative alphabet. * @return The base64 encoded string. */ encodeByteArray: function (input, webSafe) { if (!Array.isArray(input)) { throw Error('encodeByteArray takes an array as a parameter'); } this.init_(); var byteToCharMap = webSafe ? this.byteToCharMapWebSafe_ : this.byteToCharMap_; var output = []; for (var i = 0; i < input.length; i += 3) { var byte1 = input[i]; var haveByte2 = i + 1 < input.length; var byte2 = haveByte2 ? input[i + 1] : 0; var haveByte3 = i + 2 < input.length; var byte3 = haveByte3 ? input[i + 2] : 0; var outByte1 = byte1 >> 2; var outByte2 = ((byte1 & 0x03) << 4) | (byte2 >> 4); var outByte3 = ((byte2 & 0x0f) << 2) | (byte3 >> 6); var outByte4 = byte3 & 0x3f; if (!haveByte3) { outByte4 = 64; if (!haveByte2) { outByte3 = 64; } } output.push(byteToCharMap[outByte1], byteToCharMap[outByte2], byteToCharMap[outByte3], byteToCharMap[outByte4]); } return output.join(''); }, /** * Base64-encode a string. * * @param input A string to encode. * @param webSafe If true, we should use the * alternative alphabet. * @return The base64 encoded string. */ encodeString: function (input, webSafe) { // Shortcut for Mozilla browsers that implement // a native base64 encoder in the form of "btoa/atob" if (this.HAS_NATIVE_SUPPORT && !webSafe) { return btoa(input); } return this.encodeByteArray(stringToByteArray(input), webSafe); }, /** * Base64-decode a string. * * @param input to decode. * @param webSafe True if we should use the * alternative alphabet. * @return string representing the decoded value. */ decodeString: function (input, webSafe) { // Shortcut for Mozilla browsers that implement // a native base64 encoder in the form of "btoa/atob" if (this.HAS_NATIVE_SUPPORT && !webSafe) { return atob(input); } return byteArrayToString(this.decodeStringToByteArray(input, webSafe)); }, /** * Base64-decode a string. * * In base-64 decoding, groups of four characters are converted into three * bytes. If the encoder did not apply padding, the input length may not * be a multiple of 4. * * In this case, the last group will have fewer than 4 characters, and * padding will be inferred. If the group has one or two characters, it decodes * to one byte. If the group has three characters, it decodes to two bytes. * * @param input Input to decode. * @param webSafe True if we should use the web-safe alphabet. * @return bytes representing the decoded value. */ decodeStringToByteArray: function (input, webSafe) { this.init_(); var charToByteMap = webSafe ? this.charToByteMapWebSafe_ : this.charToByteMap_; var output = []; for (var i = 0; i < input.length;) { var byte1 = charToByteMap[input.charAt(i++)]; var haveByte2 = i < input.length; var byte2 = haveByte2 ? charToByteMap[input.charAt(i)] : 0; ++i; var haveByte3 = i < input.length; var byte3 = haveByte3 ? charToByteMap[input.charAt(i)] : 64; ++i; var haveByte4 = i < input.length; var byte4 = haveByte4 ? charToByteMap[input.charAt(i)] : 64; ++i; if (byte1 == null || byte2 == null || byte3 == null || byte4 == null) { throw Error(); } var outByte1 = (byte1 << 2) | (byte2 >> 4); output.push(outByte1); if (byte3 !== 64) { var outByte2 = ((byte2 << 4) & 0xf0) | (byte3 >> 2); output.push(outByte2); if (byte4 !== 64) { var outByte3 = ((byte3 << 6) & 0xc0) | byte4; output.push(outByte3); } } } return output; }, /** * Lazy static initialization function. Called before * accessing any of the static map variables. * @private */ init_: function () { if (!this.byteToCharMap_) { this.byteToCharMap_ = {}; this.charToByteMap_ = {}; this.byteToCharMapWebSafe_ = {}; this.charToByteMapWebSafe_ = {}; // We want quick mappings back and forth, so we precompute two maps. for (var i = 0; i < this.ENCODED_VALS.length; i++) { this.byteToCharMap_[i] = this.ENCODED_VALS.charAt(i); this.charToByteMap_[this.byteToCharMap_[i]] = i; this.byteToCharMapWebSafe_[i] = this.ENCODED_VALS_WEBSAFE.charAt(i); this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[i]] = i; // Be forgiving when decoding and correctly decode both encodings. if (i >= this.ENCODED_VALS_BASE.length) { this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(i)] = i; this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(i)] = i; } } } } }; /** * URL-safe base64 encoding */ var base64Encode = function (str) { var utf8Bytes = stringToByteArray(str); return base64.encodeByteArray(utf8Bytes, true); }; /** * URL-safe base64 decoding * * NOTE: DO NOT use the global atob() function - it does NOT support the * base64Url variant encoding. * * @param str To be decoded * @return Decoded result, if possible */ var base64Decode = function (str) { try { return base64.decodeString(str, true); } catch (e) { console.error('base64Decode failed: ', e); } return null; }; /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Do a deep-copy of basic JavaScript Objects or Arrays. */ function deepCopy(value) { return deepExtend(undefined, value); } /** * Copy properties from source to target (recursively allows extension * of Objects and Arrays). Scalar values in the target are over-written. * If target is undefined, an object of the appropriate type will be created * (and returned). * * We recursively copy all child properties of plain Objects in the source- so * that namespace- like dictionaries are merged. * * Note that the target can be a function, in which case the properties in * the source Object are copied onto it as static properties of the Function. */ function deepExtend(target, source) { if (!(source instanceof Object)) { return source; } switch (source.constructor) { case Date: // Treat Dates like scalars; if the target date object had any child // properties - they will be lost! var dateValue = source; return new Date(dateValue.getTime()); case Object: if (target === undefined) { target = {}; } break; case Array: // Always copy the array source and overwrite the target. target = []; break; default: // Not a plain Object - treat it as a scalar. return source; } for (var prop in source) { if (!source.hasOwnProperty(prop)) { continue; } target[prop] = deepExtend(target[prop], source[prop]); } return target; } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var Deferred = /** @class */ (function () { function Deferred() { var _this = this; this.reject = function () { }; this.resolve = function () { }; this.promise = new Promise(function (resolve, reject) { _this.resolve = resolve; _this.reject = reject; }); } /** * Our API internals are not promiseified and cannot because our callback APIs have subtle expectations around * invoking promises inline, which Promises are forbidden to do. This method accepts an optional node-style callback * and returns a node-style callback which will resolve or reject the Deferred's promise. */ Deferred.prototype.wrapCallback = function (callback) { var _this = this; return function (error, value) { if (error) { _this.reject(error); } else { _this.resolve(value); } if (typeof callback === 'function') { // Attaching noop handler just in case developer wasn't expecting // promises _this.promise.catch(function () { }); // Some of our callbacks don't expect a value and our own tests // assert that the parameter length is 1 if (callback.length === 1) { callback(error); } else { callback(error, value); } } }; }; return Deferred; }()); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Returns navigator.userAgent string or '' if it's not defined. * @return user agent string */ function getUA() { if (typeof navigator !== 'undefined' && typeof navigator['userAgent'] === 'string') { return navigator['userAgent']; } else { return ''; } } /** * Detect Cordova / PhoneGap / Ionic frameworks on a mobile device. * * Deliberately does not rely on checking `file://` URLs (as this fails PhoneGap * in the Ripple emulator) nor Cordova `onDeviceReady`, which would normally * wait for a callback. */ function isMobileCordova() { return (typeof window !== 'undefined' && // @ts-ignore Setting up an broadly applicable index signature for Window // just to deal with this case would probably be a bad idea. !!(window['cordova'] || window['phonegap'] || window['PhoneGap']) && /ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(getUA())); } /** * Detect Node.js. * * @return true if Node.js environment is detected. */ // Node detection logic from: https://github.com/iliakan/detect-node/ function isNode() { try { return (Object.prototype.toString.call(global.process) === '[object process]'); } catch (e) { return false; } } /** * Detect Browser Environment */ function isBrowser() { return typeof self === 'object' && self.self === self; } function isBrowserExtension() { var runtime = typeof chrome === 'object' ? chrome.runtime : typeof browser === 'object' ? browser.runtime : undefined; return typeof runtime === 'object' && runtime.id !== undefined; } /** * Detect React Native. * * @return true if ReactNative environment is detected. */ function isReactNative() { return (typeof navigator === 'object' && navigator['product'] === 'ReactNative'); } /** Detects Electron apps. */ function isElectron() { return getUA().indexOf('Electron/') >= 0; } /** Detects Internet Explorer. */ function isIE() { var ua = getUA(); return ua.indexOf('MSIE ') >= 0 || ua.indexOf('Trident/') >= 0; } /** Detects Universal Windows Platform apps. */ function isUWP() { return getUA().indexOf('MSAppHost/') >= 0; } /** * Detect whether the current SDK build is the Node version. * * @return true if it's the Node SDK build. */ function isNodeSdk() { return CONSTANTS.NODE_CLIENT === true || CONSTANTS.NODE_ADMIN === true; } /** Returns true if we are running in Safari. */ function isSafari() { return (!isNode() && navigator.userAgent.includes('Safari') && !navigator.userAgent.includes('Chrome')); } /** * This method checks if indexedDB is supported by current browser/service worker context * @return true if indexedDB is supported by current browser/service worker context */ function isIndexedDBAvailable() { return 'indexedDB' in self && indexedDB != null; } /** * This method validates browser context for indexedDB by opening a dummy indexedDB database and reject * if errors occur during the database open operation. */ function validateIndexedDBOpenable() { return new Promise(function (resolve, reject) { try { var preExist_1 = true; var DB_CHECK_NAME_1 = 'validate-browser-context-for-indexeddb-analytics-module'; var request_1 = window.indexedDB.open(DB_CHECK_NAME_1); request_1.onsuccess = function () { request_1.result.close(); // delete database only when it doesn't pre-exist if (!preExist_1) { window.indexedDB.deleteDatabase(DB_CHECK_NAME_1); } resolve(true); }; request_1.onupgradeneeded = function () { preExist_1 = false; }; request_1.onerror = function () { var _a; reject(((_a = request_1.error) === null || _a === void 0 ? void 0 : _a.message) || ''); }; } catch (error) { reject(error); } }); } /** * * This method checks whether cookie is enabled within current browser * @return true if cookie is enabled within current browser */ function areCookiesEnabled() { if (!navigator || !navigator.cookieEnabled) { return false; } return true; } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var ERROR_NAME = 'FirebaseError'; // Based on code from: // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error#Custom_Error_Types var FirebaseError = /** @class */ (function (_super) { tslib.__extends(FirebaseError, _super); function FirebaseError(code, message) { var _this = _super.call(this, message) || this; _this.code = code; _this.name = ERROR_NAME; // Fix For ES5 // https://github.com/Microsoft/TypeScript-wiki/blob/master/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work Object.setPrototypeOf(_this, FirebaseError.prototype); // Maintains proper stack trace for where our error was thrown. // Only available on V8. if (Error.captureStackTrace) { Error.captureStackTrace(_this, ErrorFactory.prototype.create); } return _this; } return FirebaseError; }(Error)); var ErrorFactory = /** @class */ (function () { function ErrorFactory(service, serviceName, errors) { this.service = service; this.serviceName = serviceName; this.errors = errors; } ErrorFactory.prototype.create = function (code) { var data = []; for (var _i = 1; _i < arguments.length; _i++) { data[_i - 1] = arguments[_i]; } var customData = data[0] || {}; var fullCode = this.service + "/" + code; var template = this.errors[code]; var message = template ? replaceTemplate(template, customData) : 'Error'; // Service Name: Error message (service/code). var fullMessage = this.serviceName + ": " + message + " (" + fullCode + ")."; var error = new FirebaseError(fullCode, fullMessage); // Keys with an underscore at the end of their name are not included in // error.data for some reason. // TODO: Replace with Object.entries when lib is updated to es2017. for (var _a = 0, _b = Object.keys(customData); _a < _b.length; _a++) { var key = _b[_a]; if (key.slice(-1) !== '_') { if (key in error) { console.warn("Overwriting FirebaseError base field \"" + key + "\" can cause unexpected behavior."); } error[key] = customData[key]; } } return error; }; return ErrorFactory; }()); function replaceTemplate(template, data) { return template.replace(PATTERN, function (_, key) { var value = data[key]; return value != null ? String(value) : "<" + key + "?>"; }); } var PATTERN = /\{\$([^}]+)}/g; /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Evaluates a JSON string into a javascript object. * * @param {string} str A string containing JSON. * @return {*} The javascript object representing the specified JSON. */ function jsonEval(str) { return JSON.parse(str); } /** * Returns JSON representing a javascript object. * @param {*} data Javascript object to be stringified. * @return {string} The JSON contents of the object. */ function stringify(data) { return JSON.stringify(data); } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Decodes a Firebase auth. token into constituent parts. * * Notes: * - May return with invalid / incomplete claims if there's no native base64 decoding support. * - Doesn't check if the token is actually valid. */ var decode = function (token) { var header = {}, claims = {}, data = {}, signature = ''; try { var parts = token.split('.'); header = jsonEval(base64Decode(parts[0]) || ''); claims = jsonEval(base64Decode(parts[1]) || ''); signature = parts[2]; data = claims['d'] || {}; delete claims['d']; } catch (e) { } return { header: header, claims: claims, data: data, signature: signature }; }; /** * Decodes a Firebase auth. token and checks the validity of its time-based claims. Will return true if the * token is within the time window authorized by the 'nbf' (not-before) and 'iat' (issued-at) claims. * * Notes: * - May return a false negative if there's no native base64 decoding support. * - Doesn't check if the token is actually valid. */ var isValidTimestamp = function (token) { var claims = decode(token).claims; var now = Math.floor(new Date().getTime() / 1000); var validSince = 0, validUntil = 0; if (typeof claims === 'object') { if (claims.hasOwnProperty('nbf')) { validSince = claims['nbf']; } else if (claims.hasOwnProperty('iat')) { validSince = claims['iat']; } if (claims.hasOwnProperty('exp')) { validUntil = claims['exp']; } else { // token will expire after 24h by default validUntil = validSince + 86400; } } return (!!now && !!validSince && !!validUntil && now >= validSince && now <= validUntil); }; /** * Decodes a Firebase auth. token and returns its issued at time if valid, null otherwise. * * Notes: * - May return null if there's no native base64 decoding support. * - Doesn't check if the token is actually valid. */ var issuedAtTime = function (token) { var claims = decode(token).claims; if (typeof claims === 'object' && claims.hasOwnProperty('iat')) { return claims['iat']; } return null; }; /** * Decodes a Firebase auth. token and checks the validity of its format. Expects a valid issued-at time. * * Notes: * - May return a false negative if there's no native base64 decoding support. * - Doesn't check if the token is actually valid. */ var isValidFormat = function (token) { var decoded = decode(token), claims = decoded.claims; return !!claims && typeof claims === 'object' && claims.hasOwnProperty('iat'); }; /** * Attempts to peer into an auth token and determine if it's an admin auth token by looking at the claims portion. * * Notes: * - May return a false negative if there's no native base64 decoding support. * - Doesn't check if the token is actually valid. */ var isAdmin = function (token) { var claims = decode(token).claims; return typeof claims === 'object' && claims['admin'] === true; }; /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ function contains(obj, key) { return Object.prototype.hasOwnProperty.call(obj, key); } function safeGet(obj, key) { if (Object.prototype.hasOwnProperty.call(obj, key)) { return obj[key]; } else { return undefined; } } function isEmpty(obj) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { return false; } } return true; } function map(obj, fn, contextObj) { var res = {}; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { res[key] = fn.call(contextObj, obj[key], key, obj); } } return res; } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Returns a querystring-formatted string (e.g. &arg=val&arg2=val2) from a * params object (e.g. {arg: 'val', arg2: 'val2'}) * Note: You must prepend it with ? when adding it to a URL. */ function querystring(querystringParams) { var params = []; var _loop_1 = function (key, value) { if (Array.isArray(value)) { value.forEach(function (arrayVal) { params.push(encodeURIComponent(key) + '=' + encodeURIComponent(arrayVal)); }); } else { params.push(encodeURIComponent(key) + '=' + encodeURIComponent(value)); } }; for (var _i = 0, _a = Object.entries(querystringParams); _i < _a.length; _i++) { var _b = _a[_i], key = _b[0], value = _b[1]; _loop_1(key, value); } return params.length ? '&' + params.join('&') : ''; } /** * Decodes a querystring (e.g. ?arg=val&arg2=val2) into a params object * (e.g. {arg: 'val', arg2: 'val2'}) */ function querystringDecode(querystring) { var obj = {}; var tokens = querystring.replace(/^\?/, '').split('&'); tokens.forEach(function (token) { if (token) { var key = token.split('='); obj[key[0]] = key[1]; } }); return obj; } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * @fileoverview SHA-1 cryptographic hash. * Variable names follow the notation in FIPS PUB 180-3: * http://csrc.nist.gov/publications/fips/fips180-3/fips180-3_final.pdf. * * Usage: * var sha1 = new sha1(); * sha1.update(bytes); * var hash = sha1.digest(); * * Performance: * Chrome 23: ~400 Mbit/s * Firefox 16: ~250 Mbit/s * */ /** * SHA-1 cryptographic hash constructor. * * The properties declared here are discussed in the above algorithm document. * @constructor * @final * @struct */ var Sha1 = /** @class */ (function () { function Sha1() { /** * Holds the previous values of accumulated variables a-e in the compress_ * function. * @private */ this.chain_ = []; /** * A buffer holding the partially computed hash result. * @private */ this.buf_ = []; /** * An array of 80 bytes, each a part of the message to be hashed. Referred to * as the message schedule in the docs. * @private */ this.W_ = []; /** * Contains data needed to pad messages less than 64 bytes. * @private */ this.pad_ = []; /** * @private {number} */ this.inbuf_ = 0; /** * @private {number} */ this.total_ = 0; this.blockSize = 512 / 8; this.pad_[0] = 128; for (var i = 1; i < this.blockSize; ++i) { this.pad_[i] = 0; } this.reset(); } Sha1.prototype.reset = function () { this.chain_[0] = 0x67452301; this.chain_[1] = 0xefcdab89; this.chain_[2] = 0x98badcfe; this.chain_[3] = 0x10325476; this.chain_[4] = 0xc3d2e1f0; this.inbuf_ = 0; this.total_ = 0; }; /** * Internal compress helper function. * @param buf Block to compress. * @param offset Offset of the block in the buffer. * @private */ Sha1.prototype.compress_ = function (buf, offset) { if (!offset) { offset = 0; } var W = this.W_; // get 16 big endian words if (typeof buf === 'string') { for (var i = 0; i < 16; i++) { // TODO(user): [bug 8140122] Recent versions of Safari for Mac OS and iOS // have a bug that turns the post-increment ++ operator into pre-increment // during JIT compilation. We have code that depends heavily on SHA-1 for // correctness and which is affected by this bug, so I've removed all uses // of post-increment ++ in which the result value is used. We can revert // this change once the Safari bug // (https://bugs.webkit.org/show_bug.cgi?id=109036) has been fixed and // most clients have been updated. W[i] = (buf.charCodeAt(offset) << 24) | (buf.charCodeAt(offset + 1) << 16) | (buf.charCodeAt(offset + 2) << 8) | buf.charCodeAt(offset + 3); offset += 4; } } else { for (var i = 0; i < 16; i++) { W[i] = (buf[offset] << 24) | (buf[offset + 1] << 16) | (buf[offset + 2] << 8) | buf[offset + 3]; offset += 4; } } // expand to 80 words for (var i = 16; i < 80; i++) { var t = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16]; W[i] = ((t << 1) | (t >>> 31)) & 0xffffffff; } var a = this.chain_[0]; var b = this.chain_[1]; var c = this.chain_[2]; var d = this.chain_[3]; var e = this.chain_[4]; var f, k; // TODO(user): Try to unroll this loop to speed up the computation. for (var i = 0; i < 80; i++) { if (i < 40) { if (i < 20) { f = d ^ (b & (c ^ d)); k = 0x5a827999; } else { f = b ^ c ^ d; k = 0x6ed9eba1; } } else { if (i < 60) { f = (b & c) | (d & (b | c)); k = 0x8f1bbcdc; } else { f = b ^ c ^ d; k = 0xca62c1d6; } } var t = (((a << 5) | (a >>> 27)) + f + e + k + W[i]) & 0xffffffff; e = d; d = c; c = ((b << 30) | (b >>> 2)) & 0xffffffff; b = a; a = t; } this.chain_[0] = (this.chain_[0] + a) & 0xffffffff; this.chain_[1] = (this.chain_[1] + b) & 0xffffffff; this.chain_[2] = (this.chain_[2] + c) & 0xffffffff; this.chain_[3] = (this.chain_[3] + d) & 0xffffffff; this.chain_[4] = (this.chain_[4] + e) & 0xffffffff; }; Sha1.prototype.update = function (bytes, length) { // TODO(johnlenz): tighten the function signature and remove this check if (bytes == null) { return; } if (length === undefined) { length = bytes.length; } var lengthMinusBlock = length - this.blockSize; var n = 0; // Using local instead of member variables gives ~5% speedup on Firefox 16. var buf = this.buf_; var inbuf = this.inbuf_; // The outer while loop should execute at most twice. while (n < length) { // When we have no data in the block to top up, we can directly process the // input buffer (assuming it contains sufficient data). This gives ~25% // speedup on Chrome 23 and ~15% speedup on Firefox 16, but requires that // the data is provided in large chunks (or in multiples of 64 bytes). if (inbuf === 0) { while (n <= lengthMinusBlock) { this.compress_(bytes, n); n += this.blockSize; } } if (typeof bytes === 'string') { while (n < length) { buf[inbuf] = bytes.charCodeAt(n); ++inbuf; ++n; if (inbuf === this.blockSize) { this.compress_(buf); inbuf = 0; // Jump to the outer loop so we use the full-block optimization. break; } } } else { while (n < length) { buf[inbuf] = bytes[n]; ++inbuf; ++n; if (inbuf === this.blockSize) { this.compress_(buf); inbuf = 0; // Jump to the outer loop so we use the full-block optimization. break; } } } } this.inbuf_ = inbuf; this.total_ += length; }; /** @override */ Sha1.prototype.digest = function () { var digest = []; var totalBits = this.total_ * 8; // Add pad 0x80 0x00*. if (this.inbuf_ < 56) { this.update(this.pad_, 56 - this.inbuf_); } else { this.update(this.pad_, this.blockSize - (this.inbuf_ - 56)); } // Add # bits. for (var i = this.blockSize - 1; i >= 56; i--) { this.buf_[i] = totalBits & 255; totalBits /= 256; // Don't use bit-shifting here! } this.compress_(this.buf_); var n = 0; for (var i = 0; i < 5; i++) { for (var j = 24; j >= 0; j -= 8) { digest[n] = (this.chain_[i] >> j) & 255; ++n; } } return digest; }; return Sha1; }()); /** * Helper to make a Subscribe function (just like Promise helps make a * Thenable). * * @param executor Function which can make calls to a single Observer * as a proxy. * @param onNoObservers Callback when count of Observers goes to zero. */ function createSubscribe(executor, onNoObservers) { var proxy = new ObserverProxy(executor, onNoObservers); return proxy.subscribe.bind(proxy); } /** * Implement fan-out for any number of Observers attached via a subscribe * function. */ var ObserverProxy = /** @class */ (function () { /** * @param executor Function which can make calls to a single Observer * as a proxy. * @param onNoObservers Callback when count of Observers goes to zero. */ function ObserverProxy(executor, onNoObservers) { var _this = this; this.observers = []; this.unsubscribes = []; this.observerCount = 0; // Micro-task scheduling by calling task.then(). this.task = Promise.resolve(); this.finalized = false; this.onNoObservers = onNoObservers; // Call the executor asynchronously so subscribers that are called // synchronously after the creation of the subscribe function // can still receive the very first value generated in the executor. this.task .then(function () { executor(_this); }) .catch(function (e) { _this.error(e); }); } ObserverProxy.prototype.next = function (value) { this.forEachObserver(function (observer) { observer.next(value); }); }; ObserverProxy.prototype.error = function (error) { this.forEachObserver(function (observer) { observer.error(error); }); this.close(error); }; ObserverProxy.prototype.complete = function () { this.forEachObserver(function (observer) { observer.complete(); }); this.close(); }; /** * Subscribe function that can be used to add an Observer to the fan-out list. * * - We require that no event is sent to a subscriber sychronously to their * call to subscribe(). */ ObserverProxy.prototype.subscribe = function (nextOrObserver, error, complete) { var _this = this; var observer; if (nextOrObserver === undefined && error === undefined && complete === undefined) { throw new Error('Missing Observer.'); } // Assemble an Observer object when passed as callback functions. if (implementsAnyMethods(nextOrObserver, [ 'next', 'error', 'complete' ])) { observer = nextOrObserver; } else { observer = { next: nextOrObserver, error: error, complete: complete }; } if (observer.next === undefined) { observer.next = noop; } if (observer.error === undefined) { observer.error = noop; } if (observer.complete === undefined) { observer.complete = noop; } var unsub = this.unsubscribeOne.bind(this, this.observers.length); // Attempt to subscribe to a terminated Observable - we // just respond to the Observer with the final error or complete // event. if (this.finalized) { // eslint-disable-next-line @typescript-eslint/no-floating-promises this.task.then(function () { try { if (_this.finalError) { observer.error(_this.finalError); } else { observer.complete(); } } catch (e) { // nothing } return; }); } this.observers.push(observer); return unsub; }; // Unsubscribe is synchronous - we guarantee that no events are sent to // any unsubscribed Observer. ObserverProxy.prototype.unsubscribeOne = function (i) { if (this.observers === undefined || this.observers[i] === undefined) { return; } delete this.observers[i]; this.observerCount -= 1; if (this.observerCount === 0 && this.onNoObservers !== undefined) { this.onNoObservers(this); } }; ObserverProxy.prototype.forEachObserver = function (fn) { if (this.finalized) { // Already closed by previous event....just eat the additional values. return; } // Since sendOne calls asynchronously - there is no chance that // this.observers will become undefined. for (var i = 0; i < this.observers.length; i++) { this.sendOne(i, fn); } }; // Call the Observer via one of it's callback function. We are careful to // confirm that the observe has not been unsubscribed since this asynchronous // function had been queued. ObserverProxy.prototype.sendOne = function (i, fn) { var _this = this; // Execute the callback asynchronously // eslint-disable-next-line @typescript-eslint/no-floating-promises this.task.then(function () { if (_this.observers !== undefined && _this.observers[i] !== undefined) { try { fn(_this.observers[i]); } catch (e) { // Ignore exceptions raised in Observers or missing methods of an // Observer. // Log error to console. b/31404806 if (typeof console !== 'undefined' && console.error) { console.error(e); } } } }); }; ObserverProxy.prototype.close = function (err) { var _this = this; if (this.finalized) { return; } this.finalized = true; if (err !== undefined) { this.finalError = err; } // Proxy is no longer needed - garbage collect references // eslint-disable-next-line @typescript-eslint/no-floating-promises this.task.then(function () { _this.observers = undefined; _this.onNoObservers = undefined; }); }; return ObserverProxy; }()); /** Turn synchronous function into one called asynchronously. */ // eslint-disable-next-line @typescript-eslint/ban-types function async(fn, onError) { return function () { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } Promise.resolve(true) .then(function () { fn.apply(void 0, args); }) .catch(function (error) { if (onError) { onError(error); } }); }; } /** * Return true if the object passed in implements any of the named methods. */ function implementsAnyMethods(obj, methods) { if (typeof obj !== 'object' || obj === null) { return false; } for (var _i = 0, methods_1 = methods; _i < methods_1.length; _i++) { var method = methods_1[_i]; if (method in obj && typeof obj[method] === 'function') { return true; } } return false; } function noop() { // do nothing } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Check to make sure the appropriate number of arguments are provided for a public function. * Throws an error if it fails. * * @param fnName The function name * @param minCount The minimum number of arguments to allow for the function call * @param maxCount The maximum number of argument to allow for the function call * @param argCount The actual number of arguments provided. */ var validateArgCount = function (fnName, minCount, maxCount, argCount) { var argError; if (argCount < minCount) { argError = 'at least ' + minCount; } else if (argCount > maxCount) { argError = maxCount === 0 ? 'none' : 'no more than ' + maxCount; } if (argError) { var error = fnName + ' failed: Was called with ' + argCount + (argCount === 1 ? ' argument.' : ' arguments.') + ' Expects ' + argError + '.'; throw new Error(error); } }; /** * Generates a string to prefix an error message about failed argument validation * * @param fnName The function name * @param argumentNumber The index of the argument * @param optional Whether or not the argument is optional * @return The prefix to add to the error thrown for validation. */ function errorPrefix(fnName, argumentNumber, optional) { var argName = ''; switch (argumentNumber) { case 1: argName = optional ? 'first' : 'First'; break; case 2: argName = optional ? 'second' : 'Second'; break; case 3: argName = optional ? 'third' : 'Third'; break; case 4: argName = optional ? 'fourth' : 'Fourth'; break; default: throw new Error('errorPrefix called with argumentNumber > 4. Need to update it?'); } var error = fnName + ' failed: '; error += argName + ' argument '; return error; } /** * @param fnName * @param argumentNumber * @param namespace * @param optional */ function validateNamespace(fnName, argumentNumber, namespace, optional) { if (optional && !namespace) { return; } if (typeof namespace !== 'string') { //TODO: I should do more validation here. We only allow certain chars in namespaces. throw new Error(errorPrefix(fnName, argumentNumber, optional) + 'must be a valid firebase namespace.'); } } function validateCallback(fnName, argumentNumber, // eslint-disable-next-line @typescript-eslint/ban-types callback, optional) { if (optional && !callback) { return; } if (typeof callback !== 'function') { throw new Error(errorPrefix(fnName, argumentNumber, optional) + 'must be a valid function.'); } } function validateContextObject(fnName, argumentNumber, context, optional) { if (optional && !context) { return; } if (typeof context !== 'object' || context === null) { throw new Error(errorPrefix(fnName, argumentNumber, optional) + 'must be a valid context object.'); } } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // Code originally came from goog.crypt.stringToUtf8ByteArray, but for some reason they // automatically replaced '\r\n' with '\n', and they didn't handle surrogate pairs, // so it's been modified. // Note that not all Unicode characters appear as single characters in JavaScript strings. // fromCharCode returns the UTF-16 encoding of a character - so some Unicode characters // use 2 characters in Javascript. All 4-byte UTF-8 characters begin with a first // character in the range 0xD800 - 0xDBFF (the first character of a so-called surrogate // pair). // See http://www.ecma-international.org/ecma-262/5.1/#sec-15.1.3 /** * @param {string} str * @return {Array} */ var stringToByteArray$1 = function (str) { var out = []; var p = 0; for (var i = 0; i < str.length; i++) { var c = str.charCodeAt(i); // Is this the lead surrogate in a surrogate pair? if (c >= 0xd800 && c <= 0xdbff) { var high = c - 0xd800; // the high 10 bits. i++; assert(i < str.length, 'Surrogate pair missing trail surrogate.'); var low = str.charCodeAt(i) - 0xdc00; // the low 10 bits. c = 0x10000 + (high << 10) + low; } if (c < 128) { out[p++] = c; } else if (c < 2048) { out[p++] = (c >> 6) | 192; out[p++] = (c & 63) | 128; } else if (c < 65536) { out[p++] = (c >> 12) | 224; out[p++] = ((c >> 6) & 63) | 128; out[p++] = (c & 63) | 128; } else { out[p++] = (c >> 18) | 240; out[p++] = ((c >> 12) & 63) | 128; out[p++] = ((c >> 6) & 63) | 128; out[p++] = (c & 63) | 128; } } return out; }; /** * Calculate length without actually converting; useful for doing cheaper validation. * @param {string} str * @return {number} */ var stringLength = function (str) { var p = 0; for (var i = 0; i < str.length; i++) { var c = str.charCodeAt(i); if (c < 128) { p++; } else if (c < 2048) { p += 2; } else if (c >= 0xd800 && c <= 0xdbff) { // Lead surrogate of a surrogate pair. The pair together will take 4 bytes to represent. p += 4; i++; // skip trail surrogate. } else { p += 3; } } return p; }; /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * The amount of milliseconds to exponentially increase. */ var DEFAULT_INTERVAL_MILLIS = 1000; /** * The factor to backoff by. * Should be a number greater than 1. */ var DEFAULT_BACKOFF_FACTOR = 2; /** * The maximum milliseconds to increase to. * * <p>Visible for testing */ var MAX_VALUE_MILLIS = 4 * 60 * 60 * 1000; // Four hours, like iOS and Android. /** * The percentage of backoff time to randomize by. * See * http://go/safe-client-behavior#step-1-determine-the-appropriate-retry-interval-to-handle-spike-traffic * for context. * * <p>Visible for testing */ var RANDOM_FACTOR = 0.5; /** * Based on the backoff method from * https://github.com/google/closure-library/blob/master/closure/goog/math/exponentialbackoff.js. * Extracted here so we don't need to pass metadata and a stateful ExponentialBackoff object around. */ function calculateBackoffMillis(backoffCount, intervalMillis, backoffFactor) { if (intervalMillis === void 0) { intervalMillis = DEFAULT_INTERVAL_MILLIS; } if (backoffFactor === void 0) { backoffFactor = DEFAULT_BACKOFF_FACTOR; } // Calculates an exponentially increasing value. // Deviation: calculates value from count and a constant interval, so we only need to save value // and count to restore state. var currBaseValue = intervalMillis * Math.pow(backoffFactor, backoffCount); // A random "fuzz" to avoid waves of retries. // Deviation: randomFactor is required. var randomWait = Math.round( // A fraction of the backoff value to add/subtract. // Deviation: changes multiplication order to improve readability. RANDOM_FACTOR * currBaseValue * // A random float (rounded to int by Math.round above) in the range [-1, 1]. Determines // if we add or subtract. (Math.random() - 0.5) * 2); // Limits backoff to max to avoid effectively permanent backoff. return Math.min(MAX_VALUE_MILLIS, currBaseValue + randomWait); } exports.CONSTANTS = CONSTANTS; exports.Deferred = Deferred; exports.ErrorFactory = ErrorFactory; exports.FirebaseError = FirebaseError; exports.MAX_VALUE_MILLIS = MAX_VALUE_MILLIS; exports.RANDOM_FACTOR = RANDOM_FACTOR; exports.Sha1 = Sha1; exports.areCookiesEnabled = areCookiesEnabled; exports.assert = assert; exports.assertionError = assertionError; exports.async = async; exports.base64 = base64; exports.base64Decode = base64Decode; exports.base64Encode = base64Encode; exports.calculateBackoffMillis = calculateBackoffMillis; exports.contains = contains; exports.createSubscribe = createSubscribe; exports.decode = decode; exports.deepCopy = deepCopy; exports.deepExtend = deepExtend; exports.errorPrefix = errorPrefix; exports.getUA = getUA; exports.isAdmin = isAdmin; exports.isBrowser = isBrowser; exports.isBrowserExtension = isBrowserExtension; exports.isElectron = isElectron; exports.isEmpty = isEmpty; exports.isIE = isIE; exports.isIndexedDBAvailable = isIndexedDBAvailable; exports.isMobileCordova = isMobileCordova; exports.isNode = isNode; exports.isNodeSdk = isNodeSdk; exports.isReactNative = isReactNative; exports.isSafari = isSafari; exports.isUWP = isUWP; exports.isValidFormat = isValidFormat; exports.isValidTimestamp = isValidTimestamp; exports.issuedAtTime = issuedAtTime; exports.jsonEval = jsonEval; exports.map = map; exports.querystring = querystring; exports.querystringDecode = querystringDecode; exports.safeGet = safeGet; exports.stringLength = stringLength; exports.stringToByteArray = stringToByteArray$1; exports.stringify = stringify; exports.validateArgCount = validateArgCount; exports.validateCallback = validateCallback; exports.validateContextObject = validateContextObject; exports.validateIndexedDBOpenable = validateIndexedDBOpenable; exports.validateNamespace = validateNamespace; //# sourceMappingURL=index.cjs.js.map /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__("./node_modules/webpack/buildin/global.js"))) /***/ }), /***/ "./node_modules/@firebase/performance/node_modules/tslib/tslib.es6.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); /* harmony export (immutable) */ __webpack_exports__["__extends"] = __extends; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__assign", function() { return __assign; }); /* harmony export (immutable) */ __webpack_exports__["__rest"] = __rest; /* harmony export (immutable) */ __webpack_exports__["__decorate"] = __decorate; /* harmony export (immutable) */ __webpack_exports__["__param"] = __param; /* harmony export (immutable) */ __webpack_exports__["__metadata"] = __metadata; /* harmony export (immutable) */ __webpack_exports__["__awaiter"] = __awaiter; /* harmony export (immutable) */ __webpack_exports__["__generator"] = __generator; /* harmony export (immutable) */ __webpack_exports__["__createBinding"] = __createBinding; /* harmony export (immutable) */ __webpack_exports__["__exportStar"] = __exportStar; /* harmony export (immutable) */ __webpack_exports__["__values"] = __values; /* harmony export (immutable) */ __webpack_exports__["__read"] = __read; /* harmony export (immutable) */ __webpack_exports__["__spread"] = __spread; /* harmony export (immutable) */ __webpack_exports__["__spreadArrays"] = __spreadArrays; /* harmony export (immutable) */ __webpack_exports__["__await"] = __await; /* harmony export (immutable) */ __webpack_exports__["__asyncGenerator"] = __asyncGenerator; /* harmony export (immutable) */ __webpack_exports__["__asyncDelegator"] = __asyncDelegator; /* harmony export (immutable) */ __webpack_exports__["__asyncValues"] = __asyncValues; /* harmony export (immutable) */ __webpack_exports__["__makeTemplateObject"] = __makeTemplateObject; /* harmony export (immutable) */ __webpack_exports__["__importStar"] = __importStar; /* harmony export (immutable) */ __webpack_exports__["__importDefault"] = __importDefault; /* harmony export (immutable) */ __webpack_exports__["__classPrivateFieldGet"] = __classPrivateFieldGet; /* harmony export (immutable) */ __webpack_exports__["__classPrivateFieldSet"] = __classPrivateFieldSet; /*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */ /* global Reflect, Promise */ var extendStatics = function(d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; function __extends(d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); } var __assign = function() { __assign = Object.assign || function __assign(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; } return __assign.apply(this, arguments); } function __rest(s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; } return t; } function __decorate(decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; } function __param(paramIndex, decorator) { return function (target, key) { decorator(target, key, paramIndex); } } function __metadata(metadataKey, metadataValue) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); } function __awaiter(thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); } function __generator(thisArg, body) { var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; function verb(n) { return function (v) { return step([n, v]); }; } function step(op) { if (f) throw new TypeError("Generator is already executing."); while (_) try { if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; if (y = 0, t) op = [op[0] & 2, t.value]; switch (op[0]) { case 0: case 1: t = op; break; case 4: _.label++; return { value: op[1], done: false }; case 5: _.label++; y = op[1]; op = [0]; continue; case 7: op = _.ops.pop(); _.trys.pop(); continue; default: if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } if (t[2]) _.ops.pop(); _.trys.pop(); continue; } op = body.call(thisArg, _); } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } } function __createBinding(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; } function __exportStar(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) exports[p] = m[p]; } function __values(o) { var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; if (m) return m.call(o); if (o && typeof o.length === "number") return { next: function () { if (o && i >= o.length) o = void 0; return { value: o && o[i++], done: !o }; } }; throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); } function __read(o, n) { var m = typeof Symbol === "function" && o[Symbol.iterator]; if (!m) return o; var i = m.call(o), r, ar = [], e; try { while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); } catch (error) { e = { error: error }; } finally { try { if (r && !r.done && (m = i["return"])) m.call(i); } finally { if (e) throw e.error; } } return ar; } function __spread() { for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); return ar; } function __spreadArrays() { for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; for (var r = Array(s), k = 0, i = 0; i < il; i++) for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) r[k] = a[j]; return r; }; function __await(v) { return this instanceof __await ? (this.v = v, this) : new __await(v); } function __asyncGenerator(thisArg, _arguments, generator) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var g = generator.apply(thisArg, _arguments || []), i, q = []; return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } function fulfill(value) { resume("next", value); } function reject(value) { resume("throw", value); } function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } } function __asyncDelegator(o) { var i, p; return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } } function __asyncValues(o) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var m = o[Symbol.asyncIterator], i; return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } } function __makeTemplateObject(cooked, raw) { if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } return cooked; }; function __importStar(mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; result.default = mod; return result; } function __importDefault(mod) { return (mod && mod.__esModule) ? mod : { default: mod }; } function __classPrivateFieldGet(receiver, privateMap) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return privateMap.get(receiver); } function __classPrivateFieldSet(receiver, privateMap, value) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to set private field on non-instance"); } privateMap.set(receiver, value); return value; } /***/ }), /***/ "./node_modules/@firebase/storage/dist/index.esm.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "registerStorage", function() { return registerStorage; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__firebase_app__ = __webpack_require__("./node_modules/@firebase/app/dist/index.cjs.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__firebase_app___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__firebase_app__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_tslib__ = __webpack_require__("./node_modules/@firebase/storage/node_modules/tslib/tslib.es6.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__firebase_component__ = __webpack_require__("./node_modules/@firebase/storage/node_modules/@firebase/component/dist/index.cjs.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__firebase_component___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2__firebase_component__); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * @fileoverview Constants used in the Firebase Storage library. */ /** * Domain name for firebase storage. */ var DEFAULT_HOST = 'firebasestorage.googleapis.com'; /** * The key in Firebase config json for the storage bucket. */ var CONFIG_STORAGE_BUCKET_KEY = 'storageBucket'; /** * 2 minutes * * The timeout for all operations except upload. */ var DEFAULT_MAX_OPERATION_RETRY_TIME = 2 * 60 * 1000; /** * 10 minutes * * The timeout for upload. */ var DEFAULT_MAX_UPLOAD_RETRY_TIME = 10 * 60 * 1000; /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var FirebaseStorageError = /** @class */ (function () { function FirebaseStorageError(code, message) { this.code_ = prependCode(code); this.message_ = 'Firebase Storage: ' + message; this.serverResponse_ = null; this.name_ = 'FirebaseError'; } FirebaseStorageError.prototype.codeProp = function () { return this.code; }; FirebaseStorageError.prototype.codeEquals = function (code) { return prependCode(code) === this.codeProp(); }; FirebaseStorageError.prototype.serverResponseProp = function () { return this.serverResponse_; }; FirebaseStorageError.prototype.setServerResponseProp = function (serverResponse) { this.serverResponse_ = serverResponse; }; Object.defineProperty(FirebaseStorageError.prototype, "name", { get: function () { return this.name_; }, enumerable: false, configurable: true }); Object.defineProperty(FirebaseStorageError.prototype, "code", { get: function () { return this.code_; }, enumerable: false, configurable: true }); Object.defineProperty(FirebaseStorageError.prototype, "message", { get: function () { if (this.serverResponse_) { return this.message_ + '\n' + this.serverResponse_; } else { return this.message_; } }, enumerable: false, configurable: true }); Object.defineProperty(FirebaseStorageError.prototype, "serverResponse", { get: function () { return this.serverResponse_; }, enumerable: false, configurable: true }); return FirebaseStorageError; }()); var Code = { // Shared between all platforms UNKNOWN: 'unknown', OBJECT_NOT_FOUND: 'object-not-found', BUCKET_NOT_FOUND: 'bucket-not-found', PROJECT_NOT_FOUND: 'project-not-found', QUOTA_EXCEEDED: 'quota-exceeded', UNAUTHENTICATED: 'unauthenticated', UNAUTHORIZED: 'unauthorized', RETRY_LIMIT_EXCEEDED: 'retry-limit-exceeded', INVALID_CHECKSUM: 'invalid-checksum', CANCELED: 'canceled', // JS specific INVALID_EVENT_NAME: 'invalid-event-name', INVALID_URL: 'invalid-url', INVALID_DEFAULT_BUCKET: 'invalid-default-bucket', NO_DEFAULT_BUCKET: 'no-default-bucket', CANNOT_SLICE_BLOB: 'cannot-slice-blob', SERVER_FILE_WRONG_SIZE: 'server-file-wrong-size', NO_DOWNLOAD_URL: 'no-download-url', INVALID_ARGUMENT: 'invalid-argument', INVALID_ARGUMENT_COUNT: 'invalid-argument-count', APP_DELETED: 'app-deleted', INVALID_ROOT_OPERATION: 'invalid-root-operation', INVALID_FORMAT: 'invalid-format', INTERNAL_ERROR: 'internal-error' }; function prependCode(code) { return 'storage/' + code; } function unknown() { var message = 'An unknown error occurred, please check the error payload for ' + 'server response.'; return new FirebaseStorageError(Code.UNKNOWN, message); } function objectNotFound(path) { return new FirebaseStorageError(Code.OBJECT_NOT_FOUND, "Object '" + path + "' does not exist."); } function quotaExceeded(bucket) { return new FirebaseStorageError(Code.QUOTA_EXCEEDED, "Quota for bucket '" + bucket + "' exceeded, please view quota on " + 'https://firebase.google.com/pricing/.'); } function unauthenticated() { var message = 'User is not authenticated, please authenticate using Firebase ' + 'Authentication and try again.'; return new FirebaseStorageError(Code.UNAUTHENTICATED, message); } function unauthorized(path) { return new FirebaseStorageError(Code.UNAUTHORIZED, "User does not have permission to access '" + path + "'."); } function retryLimitExceeded() { return new FirebaseStorageError(Code.RETRY_LIMIT_EXCEEDED, 'Max retry time for operation exceeded, please try again.'); } function canceled() { return new FirebaseStorageError(Code.CANCELED, 'User canceled the upload/download.'); } function invalidUrl(url) { return new FirebaseStorageError(Code.INVALID_URL, "Invalid URL '" + url + "'."); } function invalidDefaultBucket(bucket) { return new FirebaseStorageError(Code.INVALID_DEFAULT_BUCKET, "Invalid default bucket '" + bucket + "'."); } function cannotSliceBlob() { return new FirebaseStorageError(Code.CANNOT_SLICE_BLOB, 'Cannot slice blob for upload. Please retry the upload.'); } function serverFileWrongSize() { return new FirebaseStorageError(Code.SERVER_FILE_WRONG_SIZE, 'Server recorded incorrect upload file size, please retry the upload.'); } function noDownloadURL() { return new FirebaseStorageError(Code.NO_DOWNLOAD_URL, 'The given file does not have any download URLs.'); } function invalidArgument(index, fnName, message) { return new FirebaseStorageError(Code.INVALID_ARGUMENT, 'Invalid argument in `' + fnName + '` at index ' + index + ': ' + message); } function invalidArgumentCount(argMin, argMax, fnName, real) { var countPart; var plural; if (argMin === argMax) { countPart = argMin; plural = argMin === 1 ? 'argument' : 'arguments'; } else { countPart = 'between ' + argMin + ' and ' + argMax; plural = 'arguments'; } return new FirebaseStorageError(Code.INVALID_ARGUMENT_COUNT, 'Invalid argument count in `' + fnName + '`: Expected ' + countPart + ' ' + plural + ', received ' + real + '.'); } function appDeleted() { return new FirebaseStorageError(Code.APP_DELETED, 'The Firebase app was deleted.'); } /** * @param name The name of the operation that was invalid. */ function invalidRootOperation(name) { return new FirebaseStorageError(Code.INVALID_ROOT_OPERATION, "The operation '" + name + "' cannot be performed on a root reference, create a non-root " + "reference using child, such as .child('file.png')."); } /** * @param format The format that was not valid. * @param message A message describing the format violation. */ function invalidFormat(format, message) { return new FirebaseStorageError(Code.INVALID_FORMAT, "String does not match format '" + format + "': " + message); } /** * @param message A message describing the internal error. */ function internalError(message) { throw new FirebaseStorageError(Code.INTERNAL_ERROR, 'Internal error: ' + message); } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var StringFormat = { RAW: 'raw', BASE64: 'base64', BASE64URL: 'base64url', DATA_URL: 'data_url' }; function formatValidator(stringFormat) { switch (stringFormat) { case StringFormat.RAW: case StringFormat.BASE64: case StringFormat.BASE64URL: case StringFormat.DATA_URL: return; default: throw ('Expected one of the event types: [' + StringFormat.RAW + ', ' + StringFormat.BASE64 + ', ' + StringFormat.BASE64URL + ', ' + StringFormat.DATA_URL + '].'); } } /** * @struct */ var StringData = /** @class */ (function () { function StringData(data, contentType) { this.data = data; this.contentType = contentType || null; } return StringData; }()); function dataFromString(format, stringData) { switch (format) { case StringFormat.RAW: return new StringData(utf8Bytes_(stringData)); case StringFormat.BASE64: case StringFormat.BASE64URL: return new StringData(base64Bytes_(format, stringData)); case StringFormat.DATA_URL: return new StringData(dataURLBytes_(stringData), dataURLContentType_(stringData)); // do nothing } // assert(false); throw unknown(); } function utf8Bytes_(value) { var b = []; for (var i = 0; i < value.length; i++) { var c = value.charCodeAt(i); if (c <= 127) { b.push(c); } else { if (c <= 2047) { b.push(192 | (c >> 6), 128 | (c & 63)); } else { if ((c & 64512) === 55296) { // The start of a surrogate pair. var valid = i < value.length - 1 && (value.charCodeAt(i + 1) & 64512) === 56320; if (!valid) { // The second surrogate wasn't there. b.push(239, 191, 189); } else { var hi = c; var lo = value.charCodeAt(++i); c = 65536 | ((hi & 1023) << 10) | (lo & 1023); b.push(240 | (c >> 18), 128 | ((c >> 12) & 63), 128 | ((c >> 6) & 63), 128 | (c & 63)); } } else { if ((c & 64512) === 56320) { // Invalid low surrogate. b.push(239, 191, 189); } else { b.push(224 | (c >> 12), 128 | ((c >> 6) & 63), 128 | (c & 63)); } } } } } return new Uint8Array(b); } function percentEncodedBytes_(value) { var decoded; try { decoded = decodeURIComponent(value); } catch (e) { throw invalidFormat(StringFormat.DATA_URL, 'Malformed data URL.'); } return utf8Bytes_(decoded); } function base64Bytes_(format, value) { switch (format) { case StringFormat.BASE64: { var hasMinus = value.indexOf('-') !== -1; var hasUnder = value.indexOf('_') !== -1; if (hasMinus || hasUnder) { var invalidChar = hasMinus ? '-' : '_'; throw invalidFormat(format, "Invalid character '" + invalidChar + "' found: is it base64url encoded?"); } break; } case StringFormat.BASE64URL: { var hasPlus = value.indexOf('+') !== -1; var hasSlash = value.indexOf('/') !== -1; if (hasPlus || hasSlash) { var invalidChar = hasPlus ? '+' : '/'; throw invalidFormat(format, "Invalid character '" + invalidChar + "' found: is it base64 encoded?"); } value = value.replace(/-/g, '+').replace(/_/g, '/'); break; } // do nothing } var bytes; try { bytes = atob(value); } catch (e) { throw invalidFormat(format, 'Invalid character found'); } var array = new Uint8Array(bytes.length); for (var i = 0; i < bytes.length; i++) { array[i] = bytes.charCodeAt(i); } return array; } /** * @struct */ var DataURLParts = /** @class */ (function () { function DataURLParts(dataURL) { this.base64 = false; this.contentType = null; var matches = dataURL.match(/^data:([^,]+)?,/); if (matches === null) { throw invalidFormat(StringFormat.DATA_URL, "Must be formatted 'data:[<mediatype>][;base64],<data>"); } var middle = matches[1] || null; if (middle != null) { this.base64 = endsWith(middle, ';base64'); this.contentType = this.base64 ? middle.substring(0, middle.length - ';base64'.length) : middle; } this.rest = dataURL.substring(dataURL.indexOf(',') + 1); } return DataURLParts; }()); function dataURLBytes_(dataUrl) { var parts = new DataURLParts(dataUrl); if (parts.base64) { return base64Bytes_(StringFormat.BASE64, parts.rest); } else { return percentEncodedBytes_(parts.rest); } } function dataURLContentType_(dataUrl) { var parts = new DataURLParts(dataUrl); return parts.contentType; } function endsWith(s, end) { var longEnough = s.length >= end.length; if (!longEnough) { return false; } return s.substring(s.length - end.length) === end; } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var TaskEvent = { /** Triggered whenever the task changes or progress is updated. */ STATE_CHANGED: 'state_changed' }; var InternalTaskState = { RUNNING: 'running', PAUSING: 'pausing', PAUSED: 'paused', SUCCESS: 'success', CANCELING: 'canceling', CANCELED: 'canceled', ERROR: 'error' }; var TaskState = { /** The task is currently transferring data. */ RUNNING: 'running', /** The task was paused by the user. */ PAUSED: 'paused', /** The task completed successfully. */ SUCCESS: 'success', /** The task was canceled. */ CANCELED: 'canceled', /** The task failed with an error. */ ERROR: 'error' }; function taskStateFromInternalTaskState(state) { switch (state) { case InternalTaskState.RUNNING: case InternalTaskState.PAUSING: case InternalTaskState.CANCELING: return TaskState.RUNNING; case InternalTaskState.PAUSED: return TaskState.PAUSED; case InternalTaskState.SUCCESS: return TaskState.SUCCESS; case InternalTaskState.CANCELED: return TaskState.CANCELED; case InternalTaskState.ERROR: return TaskState.ERROR; default: // TODO(andysoto): assert(false); return TaskState.ERROR; } } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * @return False if the object is undefined or null, true otherwise. */ function isDef(p) { return p != null; } function isJustDef(p) { return p !== void 0; } // eslint-disable-next-line @typescript-eslint/ban-types function isFunction(p) { return typeof p === 'function'; } function isObject(p) { return typeof p === 'object'; } function isNonNullObject(p) { return isObject(p) && p !== null; } function isNonArrayObject(p) { return isObject(p) && !Array.isArray(p); } function isString(p) { return typeof p === 'string' || p instanceof String; } function isInteger(p) { return isNumber(p) && Number.isInteger(p); } function isNumber(p) { return typeof p === 'number' || p instanceof Number; } function isNativeBlob(p) { return isNativeBlobDefined() && p instanceof Blob; } function isNativeBlobDefined() { return typeof Blob !== 'undefined'; } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * @enum{number} */ var ErrorCode; (function (ErrorCode) { ErrorCode[ErrorCode["NO_ERROR"] = 0] = "NO_ERROR"; ErrorCode[ErrorCode["NETWORK_ERROR"] = 1] = "NETWORK_ERROR"; ErrorCode[ErrorCode["ABORT"] = 2] = "ABORT"; })(ErrorCode || (ErrorCode = {})); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * We use this instead of goog.net.XhrIo because goog.net.XhrIo is hyuuuuge and * doesn't work in React Native on Android. */ var NetworkXhrIo = /** @class */ (function () { function NetworkXhrIo() { var _this = this; this.sent_ = false; this.xhr_ = new XMLHttpRequest(); this.errorCode_ = ErrorCode.NO_ERROR; this.sendPromise_ = new Promise(function (resolve) { _this.xhr_.addEventListener('abort', function () { _this.errorCode_ = ErrorCode.ABORT; resolve(_this); }); _this.xhr_.addEventListener('error', function () { _this.errorCode_ = ErrorCode.NETWORK_ERROR; resolve(_this); }); _this.xhr_.addEventListener('load', function () { resolve(_this); }); }); } /** * @override */ NetworkXhrIo.prototype.send = function (url, method, body, headers) { if (this.sent_) { throw internalError('cannot .send() more than once'); } this.sent_ = true; this.xhr_.open(method, url, true); if (isDef(headers)) { for (var key in headers) { if (headers.hasOwnProperty(key)) { this.xhr_.setRequestHeader(key, headers[key].toString()); } } } if (isDef(body)) { this.xhr_.send(body); } else { this.xhr_.send(); } return this.sendPromise_; }; /** * @override */ NetworkXhrIo.prototype.getErrorCode = function () { if (!this.sent_) { throw internalError('cannot .getErrorCode() before sending'); } return this.errorCode_; }; /** * @override */ NetworkXhrIo.prototype.getStatus = function () { if (!this.sent_) { throw internalError('cannot .getStatus() before sending'); } try { return this.xhr_.status; } catch (e) { return -1; } }; /** * @override */ NetworkXhrIo.prototype.getResponseText = function () { if (!this.sent_) { throw internalError('cannot .getResponseText() before sending'); } return this.xhr_.responseText; }; /** * Aborts the request. * @override */ NetworkXhrIo.prototype.abort = function () { this.xhr_.abort(); }; /** * @override */ NetworkXhrIo.prototype.getResponseHeader = function (header) { return this.xhr_.getResponseHeader(header); }; /** * @override */ NetworkXhrIo.prototype.addUploadProgressListener = function (listener) { if (isDef(this.xhr_.upload)) { this.xhr_.upload.addEventListener('progress', listener); } }; /** * @override */ NetworkXhrIo.prototype.removeUploadProgressListener = function (listener) { if (isDef(this.xhr_.upload)) { this.xhr_.upload.removeEventListener('progress', listener); } }; return NetworkXhrIo; }()); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Factory-like class for creating XhrIo instances. */ var XhrIoPool = /** @class */ (function () { function XhrIoPool() { } XhrIoPool.prototype.createXhrIo = function () { return new NetworkXhrIo(); }; return XhrIoPool; }()); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ function getBlobBuilder() { if (typeof BlobBuilder !== 'undefined') { return BlobBuilder; } else if (typeof WebKitBlobBuilder !== 'undefined') { return WebKitBlobBuilder; } else { return undefined; } } /** * Concatenates one or more values together and converts them to a Blob. * * @param args The values that will make up the resulting blob. * @return The blob. */ function getBlob() { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } var BlobBuilder = getBlobBuilder(); if (BlobBuilder !== undefined) { var bb = new BlobBuilder(); for (var i = 0; i < args.length; i++) { bb.append(args[i]); } return bb.getBlob(); } else { if (isNativeBlobDefined()) { return new Blob(args); } else { throw Error("This browser doesn't seem to support creating Blobs"); } } } /** * Slices the blob. The returned blob contains data from the start byte * (inclusive) till the end byte (exclusive). Negative indices cannot be used. * * @param blob The blob to be sliced. * @param start Index of the starting byte. * @param end Index of the ending byte. * @return The blob slice or null if not supported. */ function sliceBlob(blob, start, end) { if (blob.webkitSlice) { return blob.webkitSlice(start, end); } else if (blob.mozSlice) { return blob.mozSlice(start, end); } else if (blob.slice) { return blob.slice(start, end); } return null; } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * @param opt_elideCopy If true, doesn't copy mutable input data * (e.g. Uint8Arrays). Pass true only if you know the objects will not be * modified after this blob's construction. */ var FbsBlob = /** @class */ (function () { function FbsBlob(data, elideCopy) { var size = 0; var blobType = ''; if (isNativeBlob(data)) { this.data_ = data; size = data.size; blobType = data.type; } else if (data instanceof ArrayBuffer) { if (elideCopy) { this.data_ = new Uint8Array(data); } else { this.data_ = new Uint8Array(data.byteLength); this.data_.set(new Uint8Array(data)); } size = this.data_.length; } else if (data instanceof Uint8Array) { if (elideCopy) { this.data_ = data; } else { this.data_ = new Uint8Array(data.length); this.data_.set(data); } size = data.length; } this.size_ = size; this.type_ = blobType; } FbsBlob.prototype.size = function () { return this.size_; }; FbsBlob.prototype.type = function () { return this.type_; }; FbsBlob.prototype.slice = function (startByte, endByte) { if (isNativeBlob(this.data_)) { var realBlob = this.data_; var sliced = sliceBlob(realBlob, startByte, endByte); if (sliced === null) { return null; } return new FbsBlob(sliced); } else { var slice = new Uint8Array(this.data_.buffer, startByte, endByte - startByte); return new FbsBlob(slice, true); } }; FbsBlob.getBlob = function () { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } if (isNativeBlobDefined()) { var blobby = args.map(function (val) { if (val instanceof FbsBlob) { return val.data_; } else { return val; } }); return new FbsBlob(getBlob.apply(null, blobby)); } else { var uint8Arrays = args.map(function (val) { if (isString(val)) { return dataFromString(StringFormat.RAW, val).data; } else { // Blobs don't exist, so this has to be a Uint8Array. return val.data_; } }); var finalLength_1 = 0; uint8Arrays.forEach(function (array) { finalLength_1 += array.byteLength; }); var merged_1 = new Uint8Array(finalLength_1); var index_1 = 0; uint8Arrays.forEach(function (array) { for (var i = 0; i < array.length; i++) { merged_1[index_1++] = array[i]; } }); return new FbsBlob(merged_1, true); } }; FbsBlob.prototype.uploadData = function () { return this.data_; }; return FbsBlob; }()); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * @struct */ var Location = /** @class */ (function () { function Location(bucket, path) { this.bucket = bucket; this.path_ = path; } Object.defineProperty(Location.prototype, "path", { get: function () { return this.path_; }, enumerable: false, configurable: true }); Object.defineProperty(Location.prototype, "isRoot", { get: function () { return this.path.length === 0; }, enumerable: false, configurable: true }); Location.prototype.fullServerUrl = function () { var encode = encodeURIComponent; return '/b/' + encode(this.bucket) + '/o/' + encode(this.path); }; Location.prototype.bucketOnlyServerUrl = function () { var encode = encodeURIComponent; return '/b/' + encode(this.bucket) + '/o'; }; Location.makeFromBucketSpec = function (bucketString) { var bucketLocation; try { bucketLocation = Location.makeFromUrl(bucketString); } catch (e) { // Not valid URL, use as-is. This lets you put bare bucket names in // config. return new Location(bucketString, ''); } if (bucketLocation.path === '') { return bucketLocation; } else { throw invalidDefaultBucket(bucketString); } }; Location.makeFromUrl = function (url) { var location = null; var bucketDomain = '([A-Za-z0-9.\\-_]+)'; function gsModify(loc) { if (loc.path.charAt(loc.path.length - 1) === '/') { loc.path_ = loc.path_.slice(0, -1); } } var gsPath = '(/(.*))?$'; var gsRegex = new RegExp('^gs://' + bucketDomain + gsPath, 'i'); var gsIndices = { bucket: 1, path: 3 }; function httpModify(loc) { loc.path_ = decodeURIComponent(loc.path); } var version = 'v[A-Za-z0-9_]+'; var firebaseStorageHost = DEFAULT_HOST.replace(/[.]/g, '\\.'); var firebaseStoragePath = '(/([^?#]*).*)?$'; var firebaseStorageRegExp = new RegExp("^https?://" + firebaseStorageHost + "/" + version + "/b/" + bucketDomain + "/o" + firebaseStoragePath, 'i'); var firebaseStorageIndices = { bucket: 1, path: 3 }; var cloudStorageHost = '(?:storage.googleapis.com|storage.cloud.google.com)'; var cloudStoragePath = '([^?#]*)'; var cloudStorageRegExp = new RegExp("^https?://" + cloudStorageHost + "/" + bucketDomain + "/" + cloudStoragePath, 'i'); var cloudStorageIndices = { bucket: 1, path: 2 }; var groups = [ { regex: gsRegex, indices: gsIndices, postModify: gsModify }, { regex: firebaseStorageRegExp, indices: firebaseStorageIndices, postModify: httpModify }, { regex: cloudStorageRegExp, indices: cloudStorageIndices, postModify: httpModify } ]; for (var i = 0; i < groups.length; i++) { var group = groups[i]; var captures = group.regex.exec(url); if (captures) { var bucketValue = captures[group.indices.bucket]; var pathValue = captures[group.indices.path]; if (!pathValue) { pathValue = ''; } location = new Location(bucketValue, pathValue); group.postModify(location); break; } } if (location == null) { throw invalidUrl(url); } return location; }; return Location; }()); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Returns the Object resulting from parsing the given JSON, or null if the * given string does not represent a JSON object. */ function jsonObjectOrNull(s) { var obj; try { obj = JSON.parse(s); } catch (e) { return null; } if (isNonArrayObject(obj)) { return obj; } else { return null; } } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * @fileoverview Contains helper methods for manipulating paths. */ /** * @return Null if the path is already at the root. */ function parent(path) { if (path.length === 0) { return null; } var index = path.lastIndexOf('/'); if (index === -1) { return ''; } var newPath = path.slice(0, index); return newPath; } function child(path, childPath) { var canonicalChildPath = childPath .split('/') .filter(function (component) { return component.length > 0; }) .join('/'); if (path.length === 0) { return canonicalChildPath; } else { return path + '/' + canonicalChildPath; } } /** * Returns the last component of a path. * '/foo/bar' -> 'bar' * '/foo/bar/baz/' -> 'baz/' * '/a' -> 'a' */ function lastComponent(path) { var index = path.lastIndexOf('/', path.length - 2); if (index === -1) { return path; } else { return path.slice(index + 1); } } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ function makeUrl(urlPart) { return "https://" + DEFAULT_HOST + "/v0" + urlPart; } function makeQueryString(params) { var encode = encodeURIComponent; var queryPart = '?'; for (var key in params) { if (params.hasOwnProperty(key)) { // @ts-ignore TODO: remove once typescript is upgraded to 3.5.x var nextPart = encode(key) + '=' + encode(params[key]); queryPart = queryPart + nextPart + '&'; } } // Chop off the extra '&' or '?' on the end queryPart = queryPart.slice(0, -1); return queryPart; } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ function noXform_(metadata, value) { return value; } /** * @struct */ var Mapping = /** @class */ (function () { function Mapping(server, local, writable, xform) { this.server = server; this.local = local || server; this.writable = !!writable; this.xform = xform || noXform_; } return Mapping; }()); var mappings_ = null; function xformPath(fullPath) { if (!isString(fullPath) || fullPath.length < 2) { return fullPath; } else { return lastComponent(fullPath); } } function getMappings() { if (mappings_) { return mappings_; } var mappings = []; mappings.push(new Mapping('bucket')); mappings.push(new Mapping('generation')); mappings.push(new Mapping('metageneration')); mappings.push(new Mapping('name', 'fullPath', true)); function mappingsXformPath(_metadata, fullPath) { return xformPath(fullPath); } var nameMapping = new Mapping('name'); nameMapping.xform = mappingsXformPath; mappings.push(nameMapping); /** * Coerces the second param to a number, if it is defined. */ function xformSize(_metadata, size) { if (isDef(size)) { return Number(size); } else { return size; } } var sizeMapping = new Mapping('size'); sizeMapping.xform = xformSize; mappings.push(sizeMapping); mappings.push(new Mapping('timeCreated')); mappings.push(new Mapping('updated')); mappings.push(new Mapping('md5Hash', null, true)); mappings.push(new Mapping('cacheControl', null, true)); mappings.push(new Mapping('contentDisposition', null, true)); mappings.push(new Mapping('contentEncoding', null, true)); mappings.push(new Mapping('contentLanguage', null, true)); mappings.push(new Mapping('contentType', null, true)); mappings.push(new Mapping('metadata', 'customMetadata', true)); mappings_ = mappings; return mappings_; } function addRef(metadata, service) { function generateRef() { var bucket = metadata['bucket']; var path = metadata['fullPath']; var loc = new Location(bucket, path); return service.makeStorageReference(loc); } Object.defineProperty(metadata, 'ref', { get: generateRef }); } function fromResource(service, resource, mappings) { var metadata = {}; metadata['type'] = 'file'; var len = mappings.length; for (var i = 0; i < len; i++) { var mapping = mappings[i]; metadata[mapping.local] = mapping.xform(metadata, resource[mapping.server]); } addRef(metadata, service); return metadata; } function fromResourceString(service, resourceString, mappings) { var obj = jsonObjectOrNull(resourceString); if (obj === null) { return null; } var resource = obj; return fromResource(service, resource, mappings); } function downloadUrlFromResourceString(metadata, resourceString) { var obj = jsonObjectOrNull(resourceString); if (obj === null) { return null; } if (!isString(obj['downloadTokens'])) { // This can happen if objects are uploaded through GCS and retrieved // through list, so we don't want to throw an Error. return null; } var tokens = obj['downloadTokens']; if (tokens.length === 0) { return null; } var encode = encodeURIComponent; var tokensList = tokens.split(','); var urls = tokensList.map(function (token) { var bucket = metadata['bucket']; var path = metadata['fullPath']; var urlPart = '/b/' + encode(bucket) + '/o/' + encode(path); var base = makeUrl(urlPart); var queryString = makeQueryString({ alt: 'media', token: token }); return base + queryString; }); return urls[0]; } function toResourceString(metadata, mappings) { var resource = {}; var len = mappings.length; for (var i = 0; i < len; i++) { var mapping = mappings[i]; if (mapping.writable) { resource[mapping.server] = metadata[mapping.local]; } } return JSON.stringify(resource); } function metadataValidator(p) { if (!isObject(p) || !p) { throw 'Expected Metadata object.'; } for (var key in p) { if (p.hasOwnProperty(key)) { var val = p[key]; if (key === 'customMetadata') { if (!isObject(val)) { throw 'Expected object for \'customMetadata\' mapping.'; } } else { if (isNonNullObject(val)) { throw "Mapping for '" + key + "' cannot be an object."; } } } } } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var MAX_RESULTS_KEY = 'maxResults'; var MAX_MAX_RESULTS = 1000; var PAGE_TOKEN_KEY = 'pageToken'; var PREFIXES_KEY = 'prefixes'; var ITEMS_KEY = 'items'; function fromBackendResponse(service, bucket, resource) { var listResult = { prefixes: [], items: [], nextPageToken: resource['nextPageToken'] }; if (resource[PREFIXES_KEY]) { for (var _i = 0, _a = resource[PREFIXES_KEY]; _i < _a.length; _i++) { var path = _a[_i]; var pathWithoutTrailingSlash = path.replace(/\/$/, ''); var reference = service.makeStorageReference(new Location(bucket, pathWithoutTrailingSlash)); listResult.prefixes.push(reference); } } if (resource[ITEMS_KEY]) { for (var _b = 0, _c = resource[ITEMS_KEY]; _b < _c.length; _b++) { var item = _c[_b]; var reference = service.makeStorageReference(new Location(bucket, item['name'])); listResult.items.push(reference); } } return listResult; } function fromResponseString(service, bucket, resourceString) { var obj = jsonObjectOrNull(resourceString); if (obj === null) { return null; } var resource = obj; return fromBackendResponse(service, bucket, resource); } function listOptionsValidator(p) { if (!isObject(p) || !p) { throw 'Expected ListOptions object.'; } for (var key in p) { if (key === MAX_RESULTS_KEY) { if (!isInteger(p[MAX_RESULTS_KEY]) || p[MAX_RESULTS_KEY] <= 0) { throw 'Expected maxResults to be a positive number.'; } if (p[MAX_RESULTS_KEY] > 1000) { throw "Expected maxResults to be less than or equal to " + MAX_MAX_RESULTS + "."; } } else if (key === PAGE_TOKEN_KEY) { if (p[PAGE_TOKEN_KEY] && !isString(p[PAGE_TOKEN_KEY])) { throw 'Expected pageToken to be string.'; } } else { throw 'Unknown option: ' + key; } } } var RequestInfo = /** @class */ (function () { function RequestInfo(url, method, /** * Returns the value with which to resolve the request's promise. Only called * if the request is successful. Throw from this function to reject the * returned Request's promise with the thrown error. * Note: The XhrIo passed to this function may be reused after this callback * returns. Do not keep a reference to it in any way. */ handler, timeout) { this.url = url; this.method = method; this.handler = handler; this.timeout = timeout; this.urlParams = {}; this.headers = {}; this.body = null; this.errorHandler = null; /** * Called with the current number of bytes uploaded and total size (-1 if not * computable) of the request body (i.e. used to report upload progress). */ this.progressCallback = null; this.successCodes = [200]; this.additionalRetryCodes = []; } return RequestInfo; }()); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Throws the UNKNOWN FirebaseStorageError if cndn is false. */ function handlerCheck(cndn) { if (!cndn) { throw unknown(); } } function metadataHandler(service, mappings) { function handler(xhr, text) { var metadata = fromResourceString(service, text, mappings); handlerCheck(metadata !== null); return metadata; } return handler; } function listHandler(service, bucket) { function handler(xhr, text) { var listResult = fromResponseString(service, bucket, text); handlerCheck(listResult !== null); return listResult; } return handler; } function downloadUrlHandler(service, mappings) { function handler(xhr, text) { var metadata = fromResourceString(service, text, mappings); handlerCheck(metadata !== null); return downloadUrlFromResourceString(metadata, text); } return handler; } function sharedErrorHandler(location) { function errorHandler(xhr, err) { var newErr; if (xhr.getStatus() === 401) { newErr = unauthenticated(); } else { if (xhr.getStatus() === 402) { newErr = quotaExceeded(location.bucket); } else { if (xhr.getStatus() === 403) { newErr = unauthorized(location.path); } else { newErr = err; } } } newErr.setServerResponseProp(err.serverResponseProp()); return newErr; } return errorHandler; } function objectErrorHandler(location) { var shared = sharedErrorHandler(location); function errorHandler(xhr, err) { var newErr = shared(xhr, err); if (xhr.getStatus() === 404) { newErr = objectNotFound(location.path); } newErr.setServerResponseProp(err.serverResponseProp()); return newErr; } return errorHandler; } function getMetadata(service, location, mappings) { var urlPart = location.fullServerUrl(); var url = makeUrl(urlPart); var method = 'GET'; var timeout = service.maxOperationRetryTime; var requestInfo = new RequestInfo(url, method, metadataHandler(service, mappings), timeout); requestInfo.errorHandler = objectErrorHandler(location); return requestInfo; } function list(service, location, delimiter, pageToken, maxResults) { var urlParams = {}; if (location.isRoot) { urlParams['prefix'] = ''; } else { urlParams['prefix'] = location.path + '/'; } if (delimiter && delimiter.length > 0) { urlParams['delimiter'] = delimiter; } if (pageToken) { urlParams['pageToken'] = pageToken; } if (maxResults) { urlParams['maxResults'] = maxResults; } var urlPart = location.bucketOnlyServerUrl(); var url = makeUrl(urlPart); var method = 'GET'; var timeout = service.maxOperationRetryTime; var requestInfo = new RequestInfo(url, method, listHandler(service, location.bucket), timeout); requestInfo.urlParams = urlParams; requestInfo.errorHandler = sharedErrorHandler(location); return requestInfo; } function getDownloadUrl(service, location, mappings) { var urlPart = location.fullServerUrl(); var url = makeUrl(urlPart); var method = 'GET'; var timeout = service.maxOperationRetryTime; var requestInfo = new RequestInfo(url, method, downloadUrlHandler(service, mappings), timeout); requestInfo.errorHandler = objectErrorHandler(location); return requestInfo; } function updateMetadata(service, location, metadata, mappings) { var urlPart = location.fullServerUrl(); var url = makeUrl(urlPart); var method = 'PATCH'; var body = toResourceString(metadata, mappings); var headers = { 'Content-Type': 'application/json; charset=utf-8' }; var timeout = service.maxOperationRetryTime; var requestInfo = new RequestInfo(url, method, metadataHandler(service, mappings), timeout); requestInfo.headers = headers; requestInfo.body = body; requestInfo.errorHandler = objectErrorHandler(location); return requestInfo; } function deleteObject(service, location) { var urlPart = location.fullServerUrl(); var url = makeUrl(urlPart); var method = 'DELETE'; var timeout = service.maxOperationRetryTime; function handler(_xhr, _text) { } var requestInfo = new RequestInfo(url, method, handler, timeout); requestInfo.successCodes = [200, 204]; requestInfo.errorHandler = objectErrorHandler(location); return requestInfo; } function determineContentType_(metadata, blob) { return ((metadata && metadata['contentType']) || (blob && blob.type()) || 'application/octet-stream'); } function metadataForUpload_(location, blob, metadata) { var metadataClone = Object.assign({}, metadata); metadataClone['fullPath'] = location.path; metadataClone['size'] = blob.size(); if (!metadataClone['contentType']) { metadataClone['contentType'] = determineContentType_(null, blob); } return metadataClone; } function multipartUpload(service, location, mappings, blob, metadata) { var urlPart = location.bucketOnlyServerUrl(); var headers = { 'X-Goog-Upload-Protocol': 'multipart' }; function genBoundary() { var str = ''; for (var i = 0; i < 2; i++) { str = str + Math.random().toString().slice(2); } return str; } var boundary = genBoundary(); headers['Content-Type'] = 'multipart/related; boundary=' + boundary; var metadata_ = metadataForUpload_(location, blob, metadata); var metadataString = toResourceString(metadata_, mappings); var preBlobPart = '--' + boundary + '\r\n' + 'Content-Type: application/json; charset=utf-8\r\n\r\n' + metadataString + '\r\n--' + boundary + '\r\n' + 'Content-Type: ' + metadata_['contentType'] + '\r\n\r\n'; var postBlobPart = '\r\n--' + boundary + '--'; var body = FbsBlob.getBlob(preBlobPart, blob, postBlobPart); if (body === null) { throw cannotSliceBlob(); } var urlParams = { name: metadata_['fullPath'] }; var url = makeUrl(urlPart); var method = 'POST'; var timeout = service.maxUploadRetryTime; var requestInfo = new RequestInfo(url, method, metadataHandler(service, mappings), timeout); requestInfo.urlParams = urlParams; requestInfo.headers = headers; requestInfo.body = body.uploadData(); requestInfo.errorHandler = sharedErrorHandler(location); return requestInfo; } /** * @param current The number of bytes that have been uploaded so far. * @param total The total number of bytes in the upload. * @param opt_finalized True if the server has finished the upload. * @param opt_metadata The upload metadata, should * only be passed if opt_finalized is true. * @struct */ var ResumableUploadStatus = /** @class */ (function () { function ResumableUploadStatus(current, total, finalized, metadata) { this.current = current; this.total = total; this.finalized = !!finalized; this.metadata = metadata || null; } return ResumableUploadStatus; }()); function checkResumeHeader_(xhr, allowed) { var status = null; try { status = xhr.getResponseHeader('X-Goog-Upload-Status'); } catch (e) { handlerCheck(false); } var allowedStatus = allowed || ['active']; handlerCheck(!!status && allowedStatus.indexOf(status) !== -1); return status; } function createResumableUpload(service, location, mappings, blob, metadata) { var urlPart = location.bucketOnlyServerUrl(); var metadataForUpload = metadataForUpload_(location, blob, metadata); var urlParams = { name: metadataForUpload['fullPath'] }; var url = makeUrl(urlPart); var method = 'POST'; var headers = { 'X-Goog-Upload-Protocol': 'resumable', 'X-Goog-Upload-Command': 'start', 'X-Goog-Upload-Header-Content-Length': blob.size(), 'X-Goog-Upload-Header-Content-Type': metadataForUpload['contentType'], 'Content-Type': 'application/json; charset=utf-8' }; var body = toResourceString(metadataForUpload, mappings); var timeout = service.maxUploadRetryTime; function handler(xhr) { checkResumeHeader_(xhr); var url; try { url = xhr.getResponseHeader('X-Goog-Upload-URL'); } catch (e) { handlerCheck(false); } handlerCheck(isString(url)); return url; } var requestInfo = new RequestInfo(url, method, handler, timeout); requestInfo.urlParams = urlParams; requestInfo.headers = headers; requestInfo.body = body; requestInfo.errorHandler = sharedErrorHandler(location); return requestInfo; } /** * @param url From a call to fbs.requests.createResumableUpload. */ function getResumableUploadStatus(service, location, url, blob) { var headers = { 'X-Goog-Upload-Command': 'query' }; function handler(xhr) { var status = checkResumeHeader_(xhr, ['active', 'final']); var sizeString = null; try { sizeString = xhr.getResponseHeader('X-Goog-Upload-Size-Received'); } catch (e) { handlerCheck(false); } if (!sizeString) { // null or empty string handlerCheck(false); } var size = Number(sizeString); handlerCheck(!isNaN(size)); return new ResumableUploadStatus(size, blob.size(), status === 'final'); } var method = 'POST'; var timeout = service.maxUploadRetryTime; var requestInfo = new RequestInfo(url, method, handler, timeout); requestInfo.headers = headers; requestInfo.errorHandler = sharedErrorHandler(location); return requestInfo; } /** * Any uploads via the resumable upload API must transfer a number of bytes * that is a multiple of this number. */ var resumableUploadChunkSize = 256 * 1024; /** * @param url From a call to fbs.requests.createResumableUpload. * @param chunkSize Number of bytes to upload. * @param status The previous status. * If not passed or null, we start from the beginning. * @throws fbs.Error If the upload is already complete, the passed in status * has a final size inconsistent with the blob, or the blob cannot be sliced * for upload. */ function continueResumableUpload(location, service, url, blob, chunkSize, mappings, status, progressCallback) { // TODO(andysoto): standardize on internal asserts // assert(!(opt_status && opt_status.finalized)); var status_ = new ResumableUploadStatus(0, 0); if (status) { status_.current = status.current; status_.total = status.total; } else { status_.current = 0; status_.total = blob.size(); } if (blob.size() !== status_.total) { throw serverFileWrongSize(); } var bytesLeft = status_.total - status_.current; var bytesToUpload = bytesLeft; if (chunkSize > 0) { bytesToUpload = Math.min(bytesToUpload, chunkSize); } var startByte = status_.current; var endByte = startByte + bytesToUpload; var uploadCommand = bytesToUpload === bytesLeft ? 'upload, finalize' : 'upload'; var headers = { 'X-Goog-Upload-Command': uploadCommand, 'X-Goog-Upload-Offset': status_.current }; var body = blob.slice(startByte, endByte); if (body === null) { throw cannotSliceBlob(); } function handler(xhr, text) { // TODO(andysoto): Verify the MD5 of each uploaded range: // the 'x-range-md5' header comes back with status code 308 responses. // We'll only be able to bail out though, because you can't re-upload a // range that you previously uploaded. var uploadStatus = checkResumeHeader_(xhr, ['active', 'final']); var newCurrent = status_.current + bytesToUpload; var size = blob.size(); var metadata; if (uploadStatus === 'final') { metadata = metadataHandler(service, mappings)(xhr, text); } else { metadata = null; } return new ResumableUploadStatus(newCurrent, size, uploadStatus === 'final', metadata); } var method = 'POST'; var timeout = service.maxUploadRetryTime; var requestInfo = new RequestInfo(url, method, handler, timeout); requestInfo.headers = headers; requestInfo.body = body.uploadData(); requestInfo.progressCallback = progressCallback || null; requestInfo.errorHandler = sharedErrorHandler(location); return requestInfo; } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * @struct */ var Observer = /** @class */ (function () { function Observer(nextOrObserver, error, complete) { var asFunctions = isFunction(nextOrObserver) || isDef(error) || isDef(complete); if (asFunctions) { this.next = nextOrObserver; this.error = error || null; this.complete = complete || null; } else { var observer = nextOrObserver; this.next = observer.next || null; this.error = observer.error || null; this.complete = observer.complete || null; } } return Observer; }()); var UploadTaskSnapshot = /** @class */ (function () { function UploadTaskSnapshot(bytesTransferred, totalBytes, state, metadata, task, ref) { this.bytesTransferred = bytesTransferred; this.totalBytes = totalBytes; this.state = state; this.metadata = metadata; this.task = task; this.ref = ref; } return UploadTaskSnapshot; }()); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * @param name Name of the function. * @param specs Argument specs. * @param passed The actual arguments passed to the function. * @throws {fbs.Error} If the arguments are invalid. */ function validate(name, specs, passed) { var minArgs = specs.length; var maxArgs = specs.length; for (var i = 0; i < specs.length; i++) { if (specs[i].optional) { minArgs = i; break; } } var validLength = minArgs <= passed.length && passed.length <= maxArgs; if (!validLength) { throw invalidArgumentCount(minArgs, maxArgs, name, passed.length); } for (var i = 0; i < passed.length; i++) { try { specs[i].validator(passed[i]); } catch (e) { if (e instanceof Error) { throw invalidArgument(i, name, e.message); } else { throw invalidArgument(i, name, e); } } } } /** * @struct */ var ArgSpec = /** @class */ (function () { function ArgSpec(validator, optional) { var self = this; this.validator = function (p) { if (self.optional && !isJustDef(p)) { return; } validator(p); }; this.optional = !!optional; } return ArgSpec; }()); function and_(v1, v2) { return function (p) { v1(p); v2(p); }; } function stringSpec(validator, optional) { function stringValidator(p) { if (!isString(p)) { throw 'Expected string.'; } } var chainedValidator; if (validator) { chainedValidator = and_(stringValidator, validator); } else { chainedValidator = stringValidator; } return new ArgSpec(chainedValidator, optional); } function uploadDataSpec() { function validator(p) { var valid = p instanceof Uint8Array || p instanceof ArrayBuffer || (isNativeBlobDefined() && p instanceof Blob); if (!valid) { throw 'Expected Blob or File.'; } } return new ArgSpec(validator); } function metadataSpec(optional) { return new ArgSpec(metadataValidator, optional); } function listOptionSpec(optional) { return new ArgSpec(listOptionsValidator, optional); } function nonNegativeNumberSpec() { function validator(p) { var valid = isNumber(p) && p >= 0; if (!valid) { throw 'Expected a number 0 or greater.'; } } return new ArgSpec(validator); } function looseObjectSpec(validator, optional) { function isLooseObjectValidator(p) { var isLooseObject = p === null || (isDef(p) && p instanceof Object); if (!isLooseObject) { throw 'Expected an Object.'; } if (validator !== undefined && validator !== null) { validator(p); } } return new ArgSpec(isLooseObjectValidator, optional); } function nullFunctionSpec(optional) { function validator(p) { var valid = p === null || isFunction(p); if (!valid) { throw 'Expected a Function.'; } } return new ArgSpec(validator, optional); } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Returns a function that invokes f with its arguments asynchronously as a * microtask, i.e. as soon as possible after the current script returns back * into browser code. */ // eslint-disable-next-line @typescript-eslint/ban-types function async(f) { return function () { var argsToForward = []; for (var _i = 0; _i < arguments.length; _i++) { argsToForward[_i] = arguments[_i]; } // eslint-disable-next-line @typescript-eslint/no-floating-promises Promise.resolve().then(function () { return f.apply(void 0, argsToForward); }); }; } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Represents a blob being uploaded. Can be used to pause/resume/cancel the * upload and manage callbacks for various events. */ var UploadTask = /** @class */ (function () { /** * @param ref The firebaseStorage.Reference object this task came * from, untyped to avoid cyclic dependencies. * @param blob The blob to upload. */ function UploadTask(ref, service, location, mappings, blob, metadata) { var _this = this; if (metadata === void 0) { metadata = null; } this.transferred_ = 0; this.needToFetchStatus_ = false; this.needToFetchMetadata_ = false; this.observers_ = []; this.error_ = null; this.uploadUrl_ = null; this.request_ = null; this.chunkMultiplier_ = 1; this.resolve_ = null; this.reject_ = null; this.ref_ = ref; this.service_ = service; this.location_ = location; this.blob_ = blob; this.metadata_ = metadata; this.mappings_ = mappings; this.resumable_ = this.shouldDoResumable_(this.blob_); this.state_ = InternalTaskState.RUNNING; this.errorHandler_ = function (error) { _this.request_ = null; _this.chunkMultiplier_ = 1; if (error.codeEquals(Code.CANCELED)) { _this.needToFetchStatus_ = true; _this.completeTransitions_(); } else { _this.error_ = error; _this.transition_(InternalTaskState.ERROR); } }; this.metadataErrorHandler_ = function (error) { _this.request_ = null; if (error.codeEquals(Code.CANCELED)) { _this.completeTransitions_(); } else { _this.error_ = error; _this.transition_(InternalTaskState.ERROR); } }; this.promise_ = new Promise(function (resolve, reject) { _this.resolve_ = resolve; _this.reject_ = reject; _this.start_(); }); // Prevent uncaught rejections on the internal promise from bubbling out // to the top level with a dummy handler. this.promise_.then(null, function () { }); } UploadTask.prototype.makeProgressCallback_ = function () { var _this = this; var sizeBefore = this.transferred_; return function (loaded) { return _this.updateProgress_(sizeBefore + loaded); }; }; UploadTask.prototype.shouldDoResumable_ = function (blob) { return blob.size() > 256 * 1024; }; UploadTask.prototype.start_ = function () { if (this.state_ !== InternalTaskState.RUNNING) { // This can happen if someone pauses us in a resume callback, for example. return; } if (this.request_ !== null) { return; } if (this.resumable_) { if (this.uploadUrl_ === null) { this.createResumable_(); } else { if (this.needToFetchStatus_) { this.fetchStatus_(); } else { if (this.needToFetchMetadata_) { // Happens if we miss the metadata on upload completion. this.fetchMetadata_(); } else { this.continueUpload_(); } } } } else { this.oneShotUpload_(); } }; UploadTask.prototype.resolveToken_ = function (callback) { var _this = this; // eslint-disable-next-line @typescript-eslint/no-floating-promises this.service_.getAuthToken().then(function (authToken) { switch (_this.state_) { case InternalTaskState.RUNNING: callback(authToken); break; case InternalTaskState.CANCELING: _this.transition_(InternalTaskState.CANCELED); break; case InternalTaskState.PAUSING: _this.transition_(InternalTaskState.PAUSED); break; } }); }; // TODO(andysoto): assert false UploadTask.prototype.createResumable_ = function () { var _this = this; this.resolveToken_(function (authToken) { var requestInfo = createResumableUpload(_this.service_, _this.location_, _this.mappings_, _this.blob_, _this.metadata_); var createRequest = _this.service_.makeRequest(requestInfo, authToken); _this.request_ = createRequest; createRequest.getPromise().then(function (url) { _this.request_ = null; _this.uploadUrl_ = url; _this.needToFetchStatus_ = false; _this.completeTransitions_(); }, _this.errorHandler_); }); }; UploadTask.prototype.fetchStatus_ = function () { var _this = this; // TODO(andysoto): assert(this.uploadUrl_ !== null); var url = this.uploadUrl_; this.resolveToken_(function (authToken) { var requestInfo = getResumableUploadStatus(_this.service_, _this.location_, url, _this.blob_); var statusRequest = _this.service_.makeRequest(requestInfo, authToken); _this.request_ = statusRequest; statusRequest.getPromise().then(function (status) { status = status; _this.request_ = null; _this.updateProgress_(status.current); _this.needToFetchStatus_ = false; if (status.finalized) { _this.needToFetchMetadata_ = true; } _this.completeTransitions_(); }, _this.errorHandler_); }); }; UploadTask.prototype.continueUpload_ = function () { var _this = this; var chunkSize = resumableUploadChunkSize * this.chunkMultiplier_; var status = new ResumableUploadStatus(this.transferred_, this.blob_.size()); // TODO(andysoto): assert(this.uploadUrl_ !== null); var url = this.uploadUrl_; this.resolveToken_(function (authToken) { var requestInfo; try { requestInfo = continueResumableUpload(_this.location_, _this.service_, url, _this.blob_, chunkSize, _this.mappings_, status, _this.makeProgressCallback_()); } catch (e) { _this.error_ = e; _this.transition_(InternalTaskState.ERROR); return; } var uploadRequest = _this.service_.makeRequest(requestInfo, authToken); _this.request_ = uploadRequest; uploadRequest .getPromise() .then(function (newStatus) { _this.increaseMultiplier_(); _this.request_ = null; _this.updateProgress_(newStatus.current); if (newStatus.finalized) { _this.metadata_ = newStatus.metadata; _this.transition_(InternalTaskState.SUCCESS); } else { _this.completeTransitions_(); } }, _this.errorHandler_); }); }; UploadTask.prototype.increaseMultiplier_ = function () { var currentSize = resumableUploadChunkSize * this.chunkMultiplier_; // Max chunk size is 32M. if (currentSize < 32 * 1024 * 1024) { this.chunkMultiplier_ *= 2; } }; UploadTask.prototype.fetchMetadata_ = function () { var _this = this; this.resolveToken_(function (authToken) { var requestInfo = getMetadata(_this.service_, _this.location_, _this.mappings_); var metadataRequest = _this.service_.makeRequest(requestInfo, authToken); _this.request_ = metadataRequest; metadataRequest.getPromise().then(function (metadata) { _this.request_ = null; _this.metadata_ = metadata; _this.transition_(InternalTaskState.SUCCESS); }, _this.metadataErrorHandler_); }); }; UploadTask.prototype.oneShotUpload_ = function () { var _this = this; this.resolveToken_(function (authToken) { var requestInfo = multipartUpload(_this.service_, _this.location_, _this.mappings_, _this.blob_, _this.metadata_); var multipartRequest = _this.service_.makeRequest(requestInfo, authToken); _this.request_ = multipartRequest; multipartRequest.getPromise().then(function (metadata) { _this.request_ = null; _this.metadata_ = metadata; _this.updateProgress_(_this.blob_.size()); _this.transition_(InternalTaskState.SUCCESS); }, _this.errorHandler_); }); }; UploadTask.prototype.updateProgress_ = function (transferred) { var old = this.transferred_; this.transferred_ = transferred; // A progress update can make the "transferred" value smaller (e.g. a // partial upload not completed by server, after which the "transferred" // value may reset to the value at the beginning of the request). if (this.transferred_ !== old) { this.notifyObservers_(); } }; UploadTask.prototype.transition_ = function (state) { if (this.state_ === state) { return; } switch (state) { case InternalTaskState.CANCELING: // TODO(andysoto): // assert(this.state_ === InternalTaskState.RUNNING || // this.state_ === InternalTaskState.PAUSING); this.state_ = state; if (this.request_ !== null) { this.request_.cancel(); } break; case InternalTaskState.PAUSING: // TODO(andysoto): // assert(this.state_ === InternalTaskState.RUNNING); this.state_ = state; if (this.request_ !== null) { this.request_.cancel(); } break; case InternalTaskState.RUNNING: // TODO(andysoto): // assert(this.state_ === InternalTaskState.PAUSED || // this.state_ === InternalTaskState.PAUSING); var wasPaused = this.state_ === InternalTaskState.PAUSED; this.state_ = state; if (wasPaused) { this.notifyObservers_(); this.start_(); } break; case InternalTaskState.PAUSED: // TODO(andysoto): // assert(this.state_ === InternalTaskState.PAUSING); this.state_ = state; this.notifyObservers_(); break; case InternalTaskState.CANCELED: // TODO(andysoto): // assert(this.state_ === InternalTaskState.PAUSED || // this.state_ === InternalTaskState.CANCELING); this.error_ = canceled(); this.state_ = state; this.notifyObservers_(); break; case InternalTaskState.ERROR: // TODO(andysoto): // assert(this.state_ === InternalTaskState.RUNNING || // this.state_ === InternalTaskState.PAUSING || // this.state_ === InternalTaskState.CANCELING); this.state_ = state; this.notifyObservers_(); break; case InternalTaskState.SUCCESS: // TODO(andysoto): // assert(this.state_ === InternalTaskState.RUNNING || // this.state_ === InternalTaskState.PAUSING || // this.state_ === InternalTaskState.CANCELING); this.state_ = state; this.notifyObservers_(); break; } }; UploadTask.prototype.completeTransitions_ = function () { switch (this.state_) { case InternalTaskState.PAUSING: this.transition_(InternalTaskState.PAUSED); break; case InternalTaskState.CANCELING: this.transition_(InternalTaskState.CANCELED); break; case InternalTaskState.RUNNING: this.start_(); break; } }; Object.defineProperty(UploadTask.prototype, "snapshot", { get: function () { var externalState = taskStateFromInternalTaskState(this.state_); return new UploadTaskSnapshot(this.transferred_, this.blob_.size(), externalState, this.metadata_, this, this.ref_); }, enumerable: false, configurable: true }); /** * Adds a callback for an event. * @param type The type of event to listen for. */ UploadTask.prototype.on = function (type, nextOrObserver, error, completed) { function typeValidator() { if (type !== TaskEvent.STATE_CHANGED) { throw "Expected one of the event types: [" + TaskEvent.STATE_CHANGED + "]."; } } var nextOrObserverMessage = 'Expected a function or an Object with one of ' + '`next`, `error`, `complete` properties.'; var nextValidator = nullFunctionSpec(true).validator; var observerValidator = looseObjectSpec(null, true).validator; // eslint-disable-next-line @typescript-eslint/no-explicit-any function nextOrObserverValidator(p) { try { nextValidator(p); return; } catch (e) { } try { observerValidator(p); var anyDefined = isJustDef(p['next']) || isJustDef(p['error']) || isJustDef(p['complete']); if (!anyDefined) { throw ''; } return; } catch (e) { throw nextOrObserverMessage; } } var specs = [ stringSpec(typeValidator), looseObjectSpec(nextOrObserverValidator, true), nullFunctionSpec(true), nullFunctionSpec(true) ]; validate('on', specs, arguments); var self = this; function makeBinder(specs) { function binder(nextOrObserver, error, complete) { if (specs !== null) { validate('on', specs, arguments); } var observer = new Observer(nextOrObserver, error, completed); self.addObserver_(observer); return function () { self.removeObserver_(observer); }; } return binder; } function binderNextOrObserverValidator(p) { if (p === null) { throw nextOrObserverMessage; } nextOrObserverValidator(p); } var binderSpecs = [ looseObjectSpec(binderNextOrObserverValidator), nullFunctionSpec(true), nullFunctionSpec(true) ]; var typeOnly = !(isJustDef(nextOrObserver) || isJustDef(error) || isJustDef(completed)); if (typeOnly) { return makeBinder(binderSpecs); } else { return makeBinder(null)(nextOrObserver, error, completed); } }; /** * This object behaves like a Promise, and resolves with its snapshot data * when the upload completes. * @param onFulfilled The fulfillment callback. Promise chaining works as normal. * @param onRejected The rejection callback. */ UploadTask.prototype.then = function (onFulfilled, onRejected) { // These casts are needed so that TypeScript can infer the types of the // resulting Promise. return this.promise_.then(onFulfilled, onRejected); }; /** * Equivalent to calling `then(null, onRejected)`. */ UploadTask.prototype.catch = function (onRejected) { return this.then(null, onRejected); }; /** * Adds the given observer. */ UploadTask.prototype.addObserver_ = function (observer) { this.observers_.push(observer); this.notifyObserver_(observer); }; /** * Removes the given observer. */ UploadTask.prototype.removeObserver_ = function (observer) { var i = this.observers_.indexOf(observer); if (i !== -1) { this.observers_.splice(i, 1); } }; UploadTask.prototype.notifyObservers_ = function () { var _this = this; this.finishPromise_(); var observers = this.observers_.slice(); observers.forEach(function (observer) { _this.notifyObserver_(observer); }); }; UploadTask.prototype.finishPromise_ = function () { if (this.resolve_ !== null) { var triggered = true; switch (taskStateFromInternalTaskState(this.state_)) { case TaskState.SUCCESS: async(this.resolve_.bind(null, this.snapshot))(); break; case TaskState.CANCELED: case TaskState.ERROR: var toCall = this.reject_; async(toCall.bind(null, this.error_))(); break; default: triggered = false; break; } if (triggered) { this.resolve_ = null; this.reject_ = null; } } }; UploadTask.prototype.notifyObserver_ = function (observer) { var externalState = taskStateFromInternalTaskState(this.state_); switch (externalState) { case TaskState.RUNNING: case TaskState.PAUSED: if (observer.next) { async(observer.next.bind(observer, this.snapshot))(); } break; case TaskState.SUCCESS: if (observer.complete) { async(observer.complete.bind(observer))(); } break; case TaskState.CANCELED: case TaskState.ERROR: if (observer.error) { async(observer.error.bind(observer, this.error_))(); } break; default: // TODO(andysoto): assert(false); if (observer.error) { async(observer.error.bind(observer, this.error_))(); } } }; /** * Resumes a paused task. Has no effect on a currently running or failed task. * @return True if the operation took effect, false if ignored. */ UploadTask.prototype.resume = function () { validate('resume', [], arguments); var valid = this.state_ === InternalTaskState.PAUSED || this.state_ === InternalTaskState.PAUSING; if (valid) { this.transition_(InternalTaskState.RUNNING); } return valid; }; /** * Pauses a currently running task. Has no effect on a paused or failed task. * @return True if the operation took effect, false if ignored. */ UploadTask.prototype.pause = function () { validate('pause', [], arguments); var valid = this.state_ === InternalTaskState.RUNNING; if (valid) { this.transition_(InternalTaskState.PAUSING); } return valid; }; /** * Cancels a currently running or paused task. Has no effect on a complete or * failed task. * @return True if the operation took effect, false if ignored. */ UploadTask.prototype.cancel = function () { validate('cancel', [], arguments); var valid = this.state_ === InternalTaskState.RUNNING || this.state_ === InternalTaskState.PAUSING; if (valid) { this.transition_(InternalTaskState.CANCELING); } return valid; }; return UploadTask; }()); /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Provides methods to interact with a bucket in the Firebase Storage service. * @param location An fbs.location, or the URL at * which to base this object, in one of the following forms: * gs://<bucket>/<object-path> * http[s]://firebasestorage.googleapis.com/ * <api-version>/b/<bucket>/o/<object-path> * Any query or fragment strings will be ignored in the http[s] * format. If no value is passed, the storage object will use a URL based on * the project ID of the base firebase.App instance. */ var Reference = /** @class */ (function () { function Reference(service, location) { this.service = service; if (location instanceof Location) { this.location = location; } else { this.location = Location.makeFromUrl(location); } } /** * @return The URL for the bucket and path this object references, * in the form gs://<bucket>/<object-path> * @override */ Reference.prototype.toString = function () { validate('toString', [], arguments); return 'gs://' + this.location.bucket + '/' + this.location.path; }; Reference.prototype.newRef = function (service, location) { return new Reference(service, location); }; Reference.prototype.mappings = function () { return getMappings(); }; /** * @return A reference to the object obtained by * appending childPath, removing any duplicate, beginning, or trailing * slashes. */ Reference.prototype.child = function (childPath) { validate('child', [stringSpec()], arguments); var newPath = child(this.location.path, childPath); var location = new Location(this.location.bucket, newPath); return this.newRef(this.service, location); }; Object.defineProperty(Reference.prototype, "parent", { /** * @return A reference to the parent of the * current object, or null if the current object is the root. */ get: function () { var newPath = parent(this.location.path); if (newPath === null) { return null; } var location = new Location(this.location.bucket, newPath); return this.newRef(this.service, location); }, enumerable: false, configurable: true }); Object.defineProperty(Reference.prototype, "root", { /** * @return An reference to the root of this * object's bucket. */ get: function () { var location = new Location(this.location.bucket, ''); return this.newRef(this.service, location); }, enumerable: false, configurable: true }); Object.defineProperty(Reference.prototype, "bucket", { get: function () { return this.location.bucket; }, enumerable: false, configurable: true }); Object.defineProperty(Reference.prototype, "fullPath", { get: function () { return this.location.path; }, enumerable: false, configurable: true }); Object.defineProperty(Reference.prototype, "name", { get: function () { return lastComponent(this.location.path); }, enumerable: false, configurable: true }); Object.defineProperty(Reference.prototype, "storage", { get: function () { return this.service; }, enumerable: false, configurable: true }); /** * Uploads a blob to this object's location. * @param data The blob to upload. * @return An UploadTask that lets you control and * observe the upload. */ Reference.prototype.put = function (data, metadata) { if (metadata === void 0) { metadata = null; } validate('put', [uploadDataSpec(), metadataSpec(true)], arguments); this.throwIfRoot_('put'); return new UploadTask(this, this.service, this.location, this.mappings(), new FbsBlob(data), metadata); }; /** * Uploads a string to this object's location. * @param value The string to upload. * @param format The format of the string to upload. * @return An UploadTask that lets you control and * observe the upload. */ Reference.prototype.putString = function (value, format, metadata) { if (format === void 0) { format = StringFormat.RAW; } validate('putString', [stringSpec(), stringSpec(formatValidator, true), metadataSpec(true)], arguments); this.throwIfRoot_('putString'); var data = dataFromString(format, value); var metadataClone = Object.assign({}, metadata); if (!isDef(metadataClone['contentType']) && isDef(data.contentType)) { metadataClone['contentType'] = data.contentType; } return new UploadTask(this, this.service, this.location, this.mappings(), new FbsBlob(data.data, true), metadataClone); }; /** * Deletes the object at this location. * @return A promise that resolves if the deletion succeeds. */ Reference.prototype.delete = function () { var _this = this; validate('delete', [], arguments); this.throwIfRoot_('delete'); return this.service.getAuthToken().then(function (authToken) { var requestInfo = deleteObject(_this.service, _this.location); return _this.service.makeRequest(requestInfo, authToken).getPromise(); }); }; /** * List all items (files) and prefixes (folders) under this storage reference. * * This is a helper method for calling list() repeatedly until there are * no more results. The default pagination size is 1000. * * Note: The results may not be consistent if objects are changed while this * operation is running. * * Warning: listAll may potentially consume too many resources if there are * too many results. * * @return A Promise that resolves with all the items and prefixes under * the current storage reference. `prefixes` contains references to * sub-directories and `items` contains references to objects in this * folder. `nextPageToken` is never returned. */ Reference.prototype.listAll = function () { validate('listAll', [], arguments); var accumulator = { prefixes: [], items: [] }; return this.listAllHelper(accumulator).then(function () { return accumulator; }); }; Reference.prototype.listAllHelper = function (accumulator, pageToken) { return Object(__WEBPACK_IMPORTED_MODULE_1_tslib__["__awaiter"])(this, void 0, void 0, function () { var opt, nextPage; var _a, _b; return Object(__WEBPACK_IMPORTED_MODULE_1_tslib__["__generator"])(this, function (_c) { switch (_c.label) { case 0: opt = { // maxResults is 1000 by default. pageToken: pageToken }; return [4 /*yield*/, this.list(opt)]; case 1: nextPage = _c.sent(); (_a = accumulator.prefixes).push.apply(_a, nextPage.prefixes); (_b = accumulator.items).push.apply(_b, nextPage.items); if (!(nextPage.nextPageToken != null)) return [3 /*break*/, 3]; return [4 /*yield*/, this.listAllHelper(accumulator, nextPage.nextPageToken)]; case 2: _c.sent(); _c.label = 3; case 3: return [2 /*return*/]; } }); }); }; /** * List items (files) and prefixes (folders) under this storage reference. * * List API is only available for Firebase Rules Version 2. * * GCS is a key-blob store. Firebase Storage imposes the semantic of '/' * delimited folder structure. * Refer to GCS's List API if you want to learn more. * * To adhere to Firebase Rules's Semantics, Firebase Storage does not * support objects whose paths end with "/" or contain two consecutive * "/"s. Firebase Storage List API will filter these unsupported objects. * list() may fail if there are too many unsupported objects in the bucket. * * @param options See ListOptions for details. * @return A Promise that resolves with the items and prefixes. * `prefixes` contains references to sub-folders and `items` * contains references to objects in this folder. `nextPageToken` * can be used to get the rest of the results. */ Reference.prototype.list = function (options) { validate('list', [listOptionSpec(true)], arguments); var self = this; return this.service.getAuthToken().then(function (authToken) { var op = options || {}; var requestInfo = list(self.service, self.location, /*delimiter= */ '/', op.pageToken, op.maxResults); return self.service.makeRequest(requestInfo, authToken).getPromise(); }); }; /** * A promise that resolves with the metadata for this object. If this * object doesn't exist or metadata cannot be retreived, the promise is * rejected. */ Reference.prototype.getMetadata = function () { var _this = this; validate('getMetadata', [], arguments); this.throwIfRoot_('getMetadata'); return this.service.getAuthToken().then(function (authToken) { var requestInfo = getMetadata(_this.service, _this.location, _this.mappings()); return _this.service.makeRequest(requestInfo, authToken).getPromise(); }); }; /** * Updates the metadata for this object. * @param metadata The new metadata for the object. * Only values that have been explicitly set will be changed. Explicitly * setting a value to null will remove the metadata. * @return A promise that resolves * with the new metadata for this object. * @see firebaseStorage.Reference.prototype.getMetadata */ Reference.prototype.updateMetadata = function (metadata) { var _this = this; validate('updateMetadata', [metadataSpec()], arguments); this.throwIfRoot_('updateMetadata'); return this.service.getAuthToken().then(function (authToken) { var requestInfo = updateMetadata(_this.service, _this.location, metadata, _this.mappings()); return _this.service.makeRequest(requestInfo, authToken).getPromise(); }); }; /** * @return A promise that resolves with the download * URL for this object. */ Reference.prototype.getDownloadURL = function () { var _this = this; validate('getDownloadURL', [], arguments); this.throwIfRoot_('getDownloadURL'); return this.service.getAuthToken().then(function (authToken) { var requestInfo = getDownloadUrl(_this.service, _this.location, _this.mappings()); return _this.service .makeRequest(requestInfo, authToken) .getPromise() .then(function (url) { if (url === null) { throw noDownloadURL(); } return url; }); }); }; Reference.prototype.throwIfRoot_ = function (name) { if (this.location.path === '') { throw invalidRootOperation(name); } }; return Reference; }()); /** * A request whose promise always fails. * @struct * @template T */ var FailRequest = /** @class */ (function () { function FailRequest(error) { this.promise_ = Promise.reject(error); } /** @inheritDoc */ FailRequest.prototype.getPromise = function () { return this.promise_; }; /** @inheritDoc */ FailRequest.prototype.cancel = function (_appDelete) { }; return FailRequest; }()); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * @param f May be invoked * before the function returns. * @param callback Get all the arguments passed to the function * passed to f, including the initial boolean. */ function start(f, // eslint-disable-next-line @typescript-eslint/no-explicit-any callback, timeout) { // TODO(andysoto): make this code cleaner (probably refactor into an actual // type instead of a bunch of functions with state shared in the closure) var waitSeconds = 1; // Would type this as "number" but that doesn't work for Node so ¯\_(ツ)_/¯ // TODO: find a way to exclude Node type definition for storage because storage only works in browser // eslint-disable-next-line @typescript-eslint/no-explicit-any var timeoutId = null; var hitTimeout = false; var cancelState = 0; function canceled() { return cancelState === 2; } var triggeredCallback = false; // TODO: This disable can be removed and the 'ignoreRestArgs' option added to // the no-explicit-any rule when ESlint releases it. // eslint-disable-next-line @typescript-eslint/no-explicit-any function triggerCallback() { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } if (!triggeredCallback) { triggeredCallback = true; callback.apply(null, args); } } function callWithDelay(millis) { timeoutId = setTimeout(function () { timeoutId = null; f(handler, canceled()); }, millis); } // TODO: This disable can be removed and the 'ignoreRestArgs' option added to // the no-explicit-any rule when ESlint releases it. // eslint-disable-next-line @typescript-eslint/no-explicit-any function handler(success) { var args = []; for (var _i = 1; _i < arguments.length; _i++) { args[_i - 1] = arguments[_i]; } if (triggeredCallback) { return; } if (success) { triggerCallback.call.apply(triggerCallback, Object(__WEBPACK_IMPORTED_MODULE_1_tslib__["__spreadArrays"])([null, success], args)); return; } var mustStop = canceled() || hitTimeout; if (mustStop) { triggerCallback.call.apply(triggerCallback, Object(__WEBPACK_IMPORTED_MODULE_1_tslib__["__spreadArrays"])([null, success], args)); return; } if (waitSeconds < 64) { /* TODO(andysoto): don't back off so quickly if we know we're offline. */ waitSeconds *= 2; } var waitMillis; if (cancelState === 1) { cancelState = 2; waitMillis = 0; } else { waitMillis = (waitSeconds + Math.random()) * 1000; } callWithDelay(waitMillis); } var stopped = false; function stop(wasTimeout) { if (stopped) { return; } stopped = true; if (triggeredCallback) { return; } if (timeoutId !== null) { if (!wasTimeout) { cancelState = 2; } clearTimeout(timeoutId); callWithDelay(0); } else { if (!wasTimeout) { cancelState = 1; } } } callWithDelay(0); setTimeout(function () { hitTimeout = true; stop(true); }, timeout); return stop; } /** * Stops the retry loop from repeating. * If the function is currently "in between" retries, it is invoked immediately * with the second parameter as "true". Otherwise, it will be invoked once more * after the current invocation finishes iff the current invocation would have * triggered another retry. */ function stop(id) { id(false); } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * @struct * @template T */ var NetworkRequest = /** @class */ (function () { function NetworkRequest(url, method, headers, body, successCodes, additionalRetryCodes, callback, errorCallback, timeout, progressCallback, pool) { var _this = this; this.pendingXhr_ = null; this.backoffId_ = null; this.canceled_ = false; this.appDelete_ = false; this.url_ = url; this.method_ = method; this.headers_ = headers; this.body_ = body; this.successCodes_ = successCodes.slice(); this.additionalRetryCodes_ = additionalRetryCodes.slice(); this.callback_ = callback; this.errorCallback_ = errorCallback; this.progressCallback_ = progressCallback; this.timeout_ = timeout; this.pool_ = pool; this.promise_ = new Promise(function (resolve, reject) { _this.resolve_ = resolve; _this.reject_ = reject; _this.start_(); }); } /** * Actually starts the retry loop. */ NetworkRequest.prototype.start_ = function () { var self = this; function doTheRequest(backoffCallback, canceled) { if (canceled) { backoffCallback(false, new RequestEndStatus(false, null, true)); return; } var xhr = self.pool_.createXhrIo(); self.pendingXhr_ = xhr; function progressListener(progressEvent) { var loaded = progressEvent.loaded; var total = progressEvent.lengthComputable ? progressEvent.total : -1; if (self.progressCallback_ !== null) { self.progressCallback_(loaded, total); } } if (self.progressCallback_ !== null) { xhr.addUploadProgressListener(progressListener); } // eslint-disable-next-line @typescript-eslint/no-floating-promises xhr .send(self.url_, self.method_, self.body_, self.headers_) .then(function (xhr) { if (self.progressCallback_ !== null) { xhr.removeUploadProgressListener(progressListener); } self.pendingXhr_ = null; xhr = xhr; var hitServer = xhr.getErrorCode() === ErrorCode.NO_ERROR; var status = xhr.getStatus(); if (!hitServer || self.isRetryStatusCode_(status)) { var wasCanceled = xhr.getErrorCode() === ErrorCode.ABORT; backoffCallback(false, new RequestEndStatus(false, null, wasCanceled)); return; } var successCode = self.successCodes_.indexOf(status) !== -1; backoffCallback(true, new RequestEndStatus(successCode, xhr)); }); } /** * @param requestWentThrough True if the request eventually went * through, false if it hit the retry limit or was canceled. */ function backoffDone(requestWentThrough, status) { var resolve = self.resolve_; var reject = self.reject_; var xhr = status.xhr; if (status.wasSuccessCode) { try { var result = self.callback_(xhr, xhr.getResponseText()); if (isJustDef(result)) { resolve(result); } else { resolve(); } } catch (e) { reject(e); } } else { if (xhr !== null) { var err = unknown(); err.setServerResponseProp(xhr.getResponseText()); if (self.errorCallback_) { reject(self.errorCallback_(xhr, err)); } else { reject(err); } } else { if (status.canceled) { var err = self.appDelete_ ? appDeleted() : canceled(); reject(err); } else { var err = retryLimitExceeded(); reject(err); } } } } if (this.canceled_) { backoffDone(false, new RequestEndStatus(false, null, true)); } else { this.backoffId_ = start(doTheRequest, backoffDone, this.timeout_); } }; /** @inheritDoc */ NetworkRequest.prototype.getPromise = function () { return this.promise_; }; /** @inheritDoc */ NetworkRequest.prototype.cancel = function (appDelete) { this.canceled_ = true; this.appDelete_ = appDelete || false; if (this.backoffId_ !== null) { stop(this.backoffId_); } if (this.pendingXhr_ !== null) { this.pendingXhr_.abort(); } }; NetworkRequest.prototype.isRetryStatusCode_ = function (status) { // The codes for which to retry came from this page: // https://cloud.google.com/storage/docs/exponential-backoff var isFiveHundredCode = status >= 500 && status < 600; var extraRetryCodes = [ // Request Timeout: web server didn't receive full request in time. 408, // Too Many Requests: you're getting rate-limited, basically. 429 ]; var isExtraRetryCode = extraRetryCodes.indexOf(status) !== -1; var isRequestSpecificRetryCode = this.additionalRetryCodes_.indexOf(status) !== -1; return isFiveHundredCode || isExtraRetryCode || isRequestSpecificRetryCode; }; return NetworkRequest; }()); /** * A collection of information about the result of a network request. * @param opt_canceled Defaults to false. * @struct */ var RequestEndStatus = /** @class */ (function () { function RequestEndStatus(wasSuccessCode, xhr, canceled) { this.wasSuccessCode = wasSuccessCode; this.xhr = xhr; this.canceled = !!canceled; } return RequestEndStatus; }()); function addAuthHeader_(headers, authToken) { if (authToken !== null && authToken.length > 0) { headers['Authorization'] = 'Firebase ' + authToken; } } function addVersionHeader_(headers) { var version = typeof __WEBPACK_IMPORTED_MODULE_0__firebase_app___default.a !== 'undefined' ? __WEBPACK_IMPORTED_MODULE_0__firebase_app___default.a.SDK_VERSION : 'AppManager'; headers['X-Firebase-Storage-Version'] = 'webjs/' + version; } function addGmpidHeader_(headers, appId) { if (appId) { headers['X-Firebase-GMPID'] = appId; } } /** * @template T */ function makeRequest(requestInfo, appId, authToken, pool) { var queryPart = makeQueryString(requestInfo.urlParams); var url = requestInfo.url + queryPart; var headers = Object.assign({}, requestInfo.headers); addGmpidHeader_(headers, appId); addAuthHeader_(headers, authToken); addVersionHeader_(headers); return new NetworkRequest(url, requestInfo.method, headers, requestInfo.body, requestInfo.successCodes, requestInfo.additionalRetryCodes, requestInfo.handler, requestInfo.errorHandler, requestInfo.timeout, requestInfo.progressCallback, pool); } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * A service that provides firebaseStorage.Reference instances. * @param opt_url gs:// url to a custom Storage Bucket * * @struct */ var StorageService = /** @class */ (function () { function StorageService(app, authProvider, pool, url) { var _a; this.bucket_ = null; this.appId_ = null; this.deleted_ = false; this.app_ = app; this.authProvider_ = authProvider; this.maxOperationRetryTime_ = DEFAULT_MAX_OPERATION_RETRY_TIME; this.maxUploadRetryTime_ = DEFAULT_MAX_UPLOAD_RETRY_TIME; this.requests_ = new Set(); this.pool_ = pool; if (url != null) { this.bucket_ = Location.makeFromBucketSpec(url); } else { this.bucket_ = StorageService.extractBucket_((_a = this.app_) === null || _a === void 0 ? void 0 : _a.options); } this.internals_ = new ServiceInternals(this); } StorageService.extractBucket_ = function (config) { var bucketString = config === null || config === void 0 ? void 0 : config[CONFIG_STORAGE_BUCKET_KEY]; if (bucketString == null) { return null; } return Location.makeFromBucketSpec(bucketString); }; StorageService.prototype.getAuthToken = function () { return Object(__WEBPACK_IMPORTED_MODULE_1_tslib__["__awaiter"])(this, void 0, void 0, function () { var auth, tokenData; return Object(__WEBPACK_IMPORTED_MODULE_1_tslib__["__generator"])(this, function (_a) { switch (_a.label) { case 0: auth = this.authProvider_.getImmediate({ optional: true }); if (!auth) return [3 /*break*/, 2]; return [4 /*yield*/, auth.getToken()]; case 1: tokenData = _a.sent(); if (tokenData !== null) { return [2 /*return*/, tokenData.accessToken]; } _a.label = 2; case 2: return [2 /*return*/, null]; } }); }); }; /** * Stop running requests and prevent more from being created. */ StorageService.prototype.deleteApp = function () { this.deleted_ = true; this.app_ = null; this.requests_.forEach(function (request) { return request.cancel(); }); this.requests_.clear(); }; /** * Returns a new firebaseStorage.Reference object referencing this StorageService * at the given Location. * @param loc The Location. * @return A firebaseStorage.Reference. */ StorageService.prototype.makeStorageReference = function (loc) { return new Reference(this, loc); }; StorageService.prototype.makeRequest = function (requestInfo, authToken) { var _this = this; if (!this.deleted_) { var request_1 = makeRequest(requestInfo, this.appId_, authToken, this.pool_); this.requests_.add(request_1); // Request removes itself from set when complete. request_1.getPromise().then(function () { return _this.requests_.delete(request_1); }, function () { return _this.requests_.delete(request_1); }); return request_1; } else { return new FailRequest(appDeleted()); } }; /** * Returns a firebaseStorage.Reference for the given path in the default * bucket. */ StorageService.prototype.ref = function (path) { function validator(path) { if (typeof path !== 'string') { throw 'Path is not a string.'; } if (/^[A-Za-z]+:\/\//.test(path)) { throw 'Expected child path but got a URL, use refFromURL instead.'; } } validate('ref', [stringSpec(validator, true)], arguments); if (this.bucket_ == null) { throw new Error('No Storage Bucket defined in Firebase Options.'); } var ref = new Reference(this, this.bucket_); if (path != null) { return ref.child(path); } else { return ref; } }; /** * Returns a firebaseStorage.Reference object for the given absolute URL, * which must be a gs:// or http[s]:// URL. */ StorageService.prototype.refFromURL = function (url) { function validator(p) { if (typeof p !== 'string') { throw 'Path is not a string.'; } if (!/^[A-Za-z]+:\/\//.test(p)) { throw 'Expected full URL but got a child path, use ref instead.'; } try { Location.makeFromUrl(p); } catch (e) { throw 'Expected valid full URL but got an invalid one.'; } } validate('refFromURL', [stringSpec(validator, false)], arguments); return new Reference(this, url); }; Object.defineProperty(StorageService.prototype, "maxUploadRetryTime", { get: function () { return this.maxUploadRetryTime_; }, enumerable: false, configurable: true }); StorageService.prototype.setMaxUploadRetryTime = function (time) { validate('setMaxUploadRetryTime', [nonNegativeNumberSpec()], arguments); this.maxUploadRetryTime_ = time; }; Object.defineProperty(StorageService.prototype, "maxOperationRetryTime", { get: function () { return this.maxOperationRetryTime_; }, enumerable: false, configurable: true }); StorageService.prototype.setMaxOperationRetryTime = function (time) { validate('setMaxOperationRetryTime', [nonNegativeNumberSpec()], arguments); this.maxOperationRetryTime_ = time; }; Object.defineProperty(StorageService.prototype, "app", { get: function () { return this.app_; }, enumerable: false, configurable: true }); Object.defineProperty(StorageService.prototype, "INTERNAL", { get: function () { return this.internals_; }, enumerable: false, configurable: true }); return StorageService; }()); /** * @struct */ var ServiceInternals = /** @class */ (function () { function ServiceInternals(service) { this.service_ = service; } /** * Called when the associated app is deleted. */ ServiceInternals.prototype.delete = function () { this.service_.deleteApp(); return Promise.resolve(); }; return ServiceInternals; }()); var name = "@firebase/storage"; var version = "0.3.43"; /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Type constant for Firebase Storage. */ var STORAGE_TYPE = 'storage'; function factory(container, url) { // Dependencies var app = container.getProvider('app').getImmediate(); var authProvider = container.getProvider('auth-internal'); return new StorageService(app, authProvider, new XhrIoPool(), url); } function registerStorage(instance) { var namespaceExports = { // no-inline TaskState: TaskState, TaskEvent: TaskEvent, StringFormat: StringFormat, Storage: StorageService, Reference: Reference }; instance.INTERNAL.registerComponent(new __WEBPACK_IMPORTED_MODULE_2__firebase_component__["Component"](STORAGE_TYPE, factory, "PUBLIC" /* PUBLIC */) .setServiceProps(namespaceExports) .setMultipleInstances(true)); instance.registerVersion(name, version); } registerStorage(__WEBPACK_IMPORTED_MODULE_0__firebase_app___default.a); //# sourceMappingURL=index.esm.js.map /***/ }), /***/ "./node_modules/@firebase/storage/node_modules/@firebase/component/dist/index.cjs.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, '__esModule', { value: true }); var tslib = __webpack_require__("./node_modules/@firebase/storage/node_modules/tslib/tslib.es6.js"); var util = __webpack_require__("./node_modules/@firebase/storage/node_modules/@firebase/util/dist/index.cjs.js"); /** * Component for service name T, e.g. `auth`, `auth-internal` */ var Component = /** @class */ (function () { /** * * @param name The public service name, e.g. app, auth, firestore, database * @param instanceFactory Service factory responsible for creating the public interface * @param type whether the service provided by the component is public or private */ function Component(name, instanceFactory, type) { this.name = name; this.instanceFactory = instanceFactory; this.type = type; this.multipleInstances = false; /** * Properties to be added to the service namespace */ this.serviceProps = {}; this.instantiationMode = "LAZY" /* LAZY */; } Component.prototype.setInstantiationMode = function (mode) { this.instantiationMode = mode; return this; }; Component.prototype.setMultipleInstances = function (multipleInstances) { this.multipleInstances = multipleInstances; return this; }; Component.prototype.setServiceProps = function (props) { this.serviceProps = props; return this; }; return Component; }()); /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var DEFAULT_ENTRY_NAME = '[DEFAULT]'; /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Provider for instance for service name T, e.g. 'auth', 'auth-internal' * NameServiceMapping[T] is an alias for the type of the instance */ var Provider = /** @class */ (function () { function Provider(name, container) { this.name = name; this.container = container; this.component = null; this.instances = new Map(); this.instancesDeferred = new Map(); } /** * @param identifier A provider can provide mulitple instances of a service * if this.component.multipleInstances is true. */ Provider.prototype.get = function (identifier) { if (identifier === void 0) { identifier = DEFAULT_ENTRY_NAME; } // if multipleInstances is not supported, use the default name var normalizedIdentifier = this.normalizeInstanceIdentifier(identifier); if (!this.instancesDeferred.has(normalizedIdentifier)) { var deferred = new util.Deferred(); this.instancesDeferred.set(normalizedIdentifier, deferred); // If the service instance is available, resolve the promise with it immediately try { var instance = this.getOrInitializeService(normalizedIdentifier); if (instance) { deferred.resolve(instance); } } catch (e) { // when the instance factory throws an exception during get(), it should not cause // a fatal error. We just return the unresolved promise in this case. } } return this.instancesDeferred.get(normalizedIdentifier).promise; }; Provider.prototype.getImmediate = function (options) { var _a = tslib.__assign({ identifier: DEFAULT_ENTRY_NAME, optional: false }, options), identifier = _a.identifier, optional = _a.optional; // if multipleInstances is not supported, use the default name var normalizedIdentifier = this.normalizeInstanceIdentifier(identifier); try { var instance = this.getOrInitializeService(normalizedIdentifier); if (!instance) { if (optional) { return null; } throw Error("Service " + this.name + " is not available"); } return instance; } catch (e) { if (optional) { return null; } else { throw e; } } }; Provider.prototype.getComponent = function () { return this.component; }; Provider.prototype.setComponent = function (component) { var e_1, _a; if (component.name !== this.name) { throw Error("Mismatching Component " + component.name + " for Provider " + this.name + "."); } if (this.component) { throw Error("Component for " + this.name + " has already been provided"); } this.component = component; // if the service is eager, initialize the default instance if (isComponentEager(component)) { try { this.getOrInitializeService(DEFAULT_ENTRY_NAME); } catch (e) { // when the instance factory for an eager Component throws an exception during the eager // initialization, it should not cause a fatal error. // TODO: Investigate if we need to make it configurable, because some component may want to cause // a fatal error in this case? } } try { // Create service instances for the pending promises and resolve them // NOTE: if this.multipleInstances is false, only the default instance will be created // and all promises with resolve with it regardless of the identifier. for (var _b = tslib.__values(this.instancesDeferred.entries()), _c = _b.next(); !_c.done; _c = _b.next()) { var _d = tslib.__read(_c.value, 2), instanceIdentifier = _d[0], instanceDeferred = _d[1]; var normalizedIdentifier = this.normalizeInstanceIdentifier(instanceIdentifier); try { // `getOrInitializeService()` should always return a valid instance since a component is guaranteed. use ! to make typescript happy. var instance = this.getOrInitializeService(normalizedIdentifier); instanceDeferred.resolve(instance); } catch (e) { // when the instance factory throws an exception, it should not cause // a fatal error. We just leave the promise unresolved. } } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (_c && !_c.done && (_a = _b.return)) _a.call(_b); } finally { if (e_1) throw e_1.error; } } }; Provider.prototype.clearInstance = function (identifier) { if (identifier === void 0) { identifier = DEFAULT_ENTRY_NAME; } this.instancesDeferred.delete(identifier); this.instances.delete(identifier); }; // app.delete() will call this method on every provider to delete the services // TODO: should we mark the provider as deleted? Provider.prototype.delete = function () { return tslib.__awaiter(this, void 0, void 0, function () { var services; return tslib.__generator(this, function (_a) { switch (_a.label) { case 0: services = Array.from(this.instances.values()); return [4 /*yield*/, Promise.all(tslib.__spread(services .filter(function (service) { return 'INTERNAL' in service; }) // legacy services // eslint-disable-next-line @typescript-eslint/no-explicit-any .map(function (service) { return service.INTERNAL.delete(); }), services .filter(function (service) { return '_delete' in service; }) // modularized services // eslint-disable-next-line @typescript-eslint/no-explicit-any .map(function (service) { return service._delete(); })))]; case 1: _a.sent(); return [2 /*return*/]; } }); }); }; Provider.prototype.isComponentSet = function () { return this.component != null; }; Provider.prototype.getOrInitializeService = function (identifier) { var instance = this.instances.get(identifier); if (!instance && this.component) { instance = this.component.instanceFactory(this.container, normalizeIdentifierForFactory(identifier)); this.instances.set(identifier, instance); } return instance || null; }; Provider.prototype.normalizeInstanceIdentifier = function (identifier) { if (this.component) { return this.component.multipleInstances ? identifier : DEFAULT_ENTRY_NAME; } else { return identifier; // assume multiple instances are supported before the component is provided. } }; return Provider; }()); // undefined should be passed to the service factory for the default instance function normalizeIdentifierForFactory(identifier) { return identifier === DEFAULT_ENTRY_NAME ? undefined : identifier; } function isComponentEager(component) { return component.instantiationMode === "EAGER" /* EAGER */; } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * ComponentContainer that provides Providers for service name T, e.g. `auth`, `auth-internal` */ var ComponentContainer = /** @class */ (function () { function ComponentContainer(name) { this.name = name; this.providers = new Map(); } /** * * @param component Component being added * @param overwrite When a component with the same name has already been registered, * if overwrite is true: overwrite the existing component with the new component and create a new * provider with the new component. It can be useful in tests where you want to use different mocks * for different tests. * if overwrite is false: throw an exception */ ComponentContainer.prototype.addComponent = function (component) { var provider = this.getProvider(component.name); if (provider.isComponentSet()) { throw new Error("Component " + component.name + " has already been registered with " + this.name); } provider.setComponent(component); }; ComponentContainer.prototype.addOrOverwriteComponent = function (component) { var provider = this.getProvider(component.name); if (provider.isComponentSet()) { // delete the existing provider from the container, so we can register the new component this.providers.delete(component.name); } this.addComponent(component); }; /** * getProvider provides a type safe interface where it can only be called with a field name * present in NameServiceMapping interface. * * Firebase SDKs providing services should extend NameServiceMapping interface to register * themselves. */ ComponentContainer.prototype.getProvider = function (name) { if (this.providers.has(name)) { return this.providers.get(name); } // create a Provider for a service that hasn't registered with Firebase var provider = new Provider(name, this); this.providers.set(name, provider); return provider; }; ComponentContainer.prototype.getProviders = function () { return Array.from(this.providers.values()); }; return ComponentContainer; }()); exports.Component = Component; exports.ComponentContainer = ComponentContainer; exports.Provider = Provider; //# sourceMappingURL=index.cjs.js.map /***/ }), /***/ "./node_modules/@firebase/storage/node_modules/@firebase/util/dist/index.cjs.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(global) { Object.defineProperty(exports, '__esModule', { value: true }); var tslib = __webpack_require__("./node_modules/@firebase/storage/node_modules/tslib/tslib.es6.js"); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * @fileoverview Firebase constants. Some of these (@defines) can be overridden at compile-time. */ var CONSTANTS = { /** * @define {boolean} Whether this is the client Node.js SDK. */ NODE_CLIENT: false, /** * @define {boolean} Whether this is the Admin Node.js SDK. */ NODE_ADMIN: false, /** * Firebase SDK Version */ SDK_VERSION: '${JSCORE_VERSION}' }; /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Throws an error if the provided assertion is falsy */ var assert = function (assertion, message) { if (!assertion) { throw assertionError(message); } }; /** * Returns an Error object suitable for throwing. */ var assertionError = function (message) { return new Error('Firebase Database (' + CONSTANTS.SDK_VERSION + ') INTERNAL ASSERT FAILED: ' + message); }; /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var stringToByteArray = function (str) { // TODO(user): Use native implementations if/when available var out = []; var p = 0; for (var i = 0; i < str.length; i++) { var c = str.charCodeAt(i); if (c < 128) { out[p++] = c; } else if (c < 2048) { out[p++] = (c >> 6) | 192; out[p++] = (c & 63) | 128; } else if ((c & 0xfc00) === 0xd800 && i + 1 < str.length && (str.charCodeAt(i + 1) & 0xfc00) === 0xdc00) { // Surrogate Pair c = 0x10000 + ((c & 0x03ff) << 10) + (str.charCodeAt(++i) & 0x03ff); out[p++] = (c >> 18) | 240; out[p++] = ((c >> 12) & 63) | 128; out[p++] = ((c >> 6) & 63) | 128; out[p++] = (c & 63) | 128; } else { out[p++] = (c >> 12) | 224; out[p++] = ((c >> 6) & 63) | 128; out[p++] = (c & 63) | 128; } } return out; }; /** * Turns an array of numbers into the string given by the concatenation of the * characters to which the numbers correspond. * @param bytes Array of numbers representing characters. * @return Stringification of the array. */ var byteArrayToString = function (bytes) { // TODO(user): Use native implementations if/when available var out = []; var pos = 0, c = 0; while (pos < bytes.length) { var c1 = bytes[pos++]; if (c1 < 128) { out[c++] = String.fromCharCode(c1); } else if (c1 > 191 && c1 < 224) { var c2 = bytes[pos++]; out[c++] = String.fromCharCode(((c1 & 31) << 6) | (c2 & 63)); } else if (c1 > 239 && c1 < 365) { // Surrogate Pair var c2 = bytes[pos++]; var c3 = bytes[pos++]; var c4 = bytes[pos++]; var u = (((c1 & 7) << 18) | ((c2 & 63) << 12) | ((c3 & 63) << 6) | (c4 & 63)) - 0x10000; out[c++] = String.fromCharCode(0xd800 + (u >> 10)); out[c++] = String.fromCharCode(0xdc00 + (u & 1023)); } else { var c2 = bytes[pos++]; var c3 = bytes[pos++]; out[c++] = String.fromCharCode(((c1 & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63)); } } return out.join(''); }; // We define it as an object literal instead of a class because a class compiled down to es5 can't // be treeshaked. https://github.com/rollup/rollup/issues/1691 // Static lookup maps, lazily populated by init_() var base64 = { /** * Maps bytes to characters. */ byteToCharMap_: null, /** * Maps characters to bytes. */ charToByteMap_: null, /** * Maps bytes to websafe characters. * @private */ byteToCharMapWebSafe_: null, /** * Maps websafe characters to bytes. * @private */ charToByteMapWebSafe_: null, /** * Our default alphabet, shared between * ENCODED_VALS and ENCODED_VALS_WEBSAFE */ ENCODED_VALS_BASE: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' + 'abcdefghijklmnopqrstuvwxyz' + '0123456789', /** * Our default alphabet. Value 64 (=) is special; it means "nothing." */ get ENCODED_VALS() { return this.ENCODED_VALS_BASE + '+/='; }, /** * Our websafe alphabet. */ get ENCODED_VALS_WEBSAFE() { return this.ENCODED_VALS_BASE + '-_.'; }, /** * Whether this browser supports the atob and btoa functions. This extension * started at Mozilla but is now implemented by many browsers. We use the * ASSUME_* variables to avoid pulling in the full useragent detection library * but still allowing the standard per-browser compilations. * */ HAS_NATIVE_SUPPORT: typeof atob === 'function', /** * Base64-encode an array of bytes. * * @param input An array of bytes (numbers with * value in [0, 255]) to encode. * @param webSafe Boolean indicating we should use the * alternative alphabet. * @return The base64 encoded string. */ encodeByteArray: function (input, webSafe) { if (!Array.isArray(input)) { throw Error('encodeByteArray takes an array as a parameter'); } this.init_(); var byteToCharMap = webSafe ? this.byteToCharMapWebSafe_ : this.byteToCharMap_; var output = []; for (var i = 0; i < input.length; i += 3) { var byte1 = input[i]; var haveByte2 = i + 1 < input.length; var byte2 = haveByte2 ? input[i + 1] : 0; var haveByte3 = i + 2 < input.length; var byte3 = haveByte3 ? input[i + 2] : 0; var outByte1 = byte1 >> 2; var outByte2 = ((byte1 & 0x03) << 4) | (byte2 >> 4); var outByte3 = ((byte2 & 0x0f) << 2) | (byte3 >> 6); var outByte4 = byte3 & 0x3f; if (!haveByte3) { outByte4 = 64; if (!haveByte2) { outByte3 = 64; } } output.push(byteToCharMap[outByte1], byteToCharMap[outByte2], byteToCharMap[outByte3], byteToCharMap[outByte4]); } return output.join(''); }, /** * Base64-encode a string. * * @param input A string to encode. * @param webSafe If true, we should use the * alternative alphabet. * @return The base64 encoded string. */ encodeString: function (input, webSafe) { // Shortcut for Mozilla browsers that implement // a native base64 encoder in the form of "btoa/atob" if (this.HAS_NATIVE_SUPPORT && !webSafe) { return btoa(input); } return this.encodeByteArray(stringToByteArray(input), webSafe); }, /** * Base64-decode a string. * * @param input to decode. * @param webSafe True if we should use the * alternative alphabet. * @return string representing the decoded value. */ decodeString: function (input, webSafe) { // Shortcut for Mozilla browsers that implement // a native base64 encoder in the form of "btoa/atob" if (this.HAS_NATIVE_SUPPORT && !webSafe) { return atob(input); } return byteArrayToString(this.decodeStringToByteArray(input, webSafe)); }, /** * Base64-decode a string. * * In base-64 decoding, groups of four characters are converted into three * bytes. If the encoder did not apply padding, the input length may not * be a multiple of 4. * * In this case, the last group will have fewer than 4 characters, and * padding will be inferred. If the group has one or two characters, it decodes * to one byte. If the group has three characters, it decodes to two bytes. * * @param input Input to decode. * @param webSafe True if we should use the web-safe alphabet. * @return bytes representing the decoded value. */ decodeStringToByteArray: function (input, webSafe) { this.init_(); var charToByteMap = webSafe ? this.charToByteMapWebSafe_ : this.charToByteMap_; var output = []; for (var i = 0; i < input.length;) { var byte1 = charToByteMap[input.charAt(i++)]; var haveByte2 = i < input.length; var byte2 = haveByte2 ? charToByteMap[input.charAt(i)] : 0; ++i; var haveByte3 = i < input.length; var byte3 = haveByte3 ? charToByteMap[input.charAt(i)] : 64; ++i; var haveByte4 = i < input.length; var byte4 = haveByte4 ? charToByteMap[input.charAt(i)] : 64; ++i; if (byte1 == null || byte2 == null || byte3 == null || byte4 == null) { throw Error(); } var outByte1 = (byte1 << 2) | (byte2 >> 4); output.push(outByte1); if (byte3 !== 64) { var outByte2 = ((byte2 << 4) & 0xf0) | (byte3 >> 2); output.push(outByte2); if (byte4 !== 64) { var outByte3 = ((byte3 << 6) & 0xc0) | byte4; output.push(outByte3); } } } return output; }, /** * Lazy static initialization function. Called before * accessing any of the static map variables. * @private */ init_: function () { if (!this.byteToCharMap_) { this.byteToCharMap_ = {}; this.charToByteMap_ = {}; this.byteToCharMapWebSafe_ = {}; this.charToByteMapWebSafe_ = {}; // We want quick mappings back and forth, so we precompute two maps. for (var i = 0; i < this.ENCODED_VALS.length; i++) { this.byteToCharMap_[i] = this.ENCODED_VALS.charAt(i); this.charToByteMap_[this.byteToCharMap_[i]] = i; this.byteToCharMapWebSafe_[i] = this.ENCODED_VALS_WEBSAFE.charAt(i); this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[i]] = i; // Be forgiving when decoding and correctly decode both encodings. if (i >= this.ENCODED_VALS_BASE.length) { this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(i)] = i; this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(i)] = i; } } } } }; /** * URL-safe base64 encoding */ var base64Encode = function (str) { var utf8Bytes = stringToByteArray(str); return base64.encodeByteArray(utf8Bytes, true); }; /** * URL-safe base64 decoding * * NOTE: DO NOT use the global atob() function - it does NOT support the * base64Url variant encoding. * * @param str To be decoded * @return Decoded result, if possible */ var base64Decode = function (str) { try { return base64.decodeString(str, true); } catch (e) { console.error('base64Decode failed: ', e); } return null; }; /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Do a deep-copy of basic JavaScript Objects or Arrays. */ function deepCopy(value) { return deepExtend(undefined, value); } /** * Copy properties from source to target (recursively allows extension * of Objects and Arrays). Scalar values in the target are over-written. * If target is undefined, an object of the appropriate type will be created * (and returned). * * We recursively copy all child properties of plain Objects in the source- so * that namespace- like dictionaries are merged. * * Note that the target can be a function, in which case the properties in * the source Object are copied onto it as static properties of the Function. */ function deepExtend(target, source) { if (!(source instanceof Object)) { return source; } switch (source.constructor) { case Date: // Treat Dates like scalars; if the target date object had any child // properties - they will be lost! var dateValue = source; return new Date(dateValue.getTime()); case Object: if (target === undefined) { target = {}; } break; case Array: // Always copy the array source and overwrite the target. target = []; break; default: // Not a plain Object - treat it as a scalar. return source; } for (var prop in source) { if (!source.hasOwnProperty(prop)) { continue; } target[prop] = deepExtend(target[prop], source[prop]); } return target; } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var Deferred = /** @class */ (function () { function Deferred() { var _this = this; this.reject = function () { }; this.resolve = function () { }; this.promise = new Promise(function (resolve, reject) { _this.resolve = resolve; _this.reject = reject; }); } /** * Our API internals are not promiseified and cannot because our callback APIs have subtle expectations around * invoking promises inline, which Promises are forbidden to do. This method accepts an optional node-style callback * and returns a node-style callback which will resolve or reject the Deferred's promise. */ Deferred.prototype.wrapCallback = function (callback) { var _this = this; return function (error, value) { if (error) { _this.reject(error); } else { _this.resolve(value); } if (typeof callback === 'function') { // Attaching noop handler just in case developer wasn't expecting // promises _this.promise.catch(function () { }); // Some of our callbacks don't expect a value and our own tests // assert that the parameter length is 1 if (callback.length === 1) { callback(error); } else { callback(error, value); } } }; }; return Deferred; }()); /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Returns navigator.userAgent string or '' if it's not defined. * @return user agent string */ function getUA() { if (typeof navigator !== 'undefined' && typeof navigator['userAgent'] === 'string') { return navigator['userAgent']; } else { return ''; } } /** * Detect Cordova / PhoneGap / Ionic frameworks on a mobile device. * * Deliberately does not rely on checking `file://` URLs (as this fails PhoneGap * in the Ripple emulator) nor Cordova `onDeviceReady`, which would normally * wait for a callback. */ function isMobileCordova() { return (typeof window !== 'undefined' && // @ts-ignore Setting up an broadly applicable index signature for Window // just to deal with this case would probably be a bad idea. !!(window['cordova'] || window['phonegap'] || window['PhoneGap']) && /ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(getUA())); } /** * Detect Node.js. * * @return true if Node.js environment is detected. */ // Node detection logic from: https://github.com/iliakan/detect-node/ function isNode() { try { return (Object.prototype.toString.call(global.process) === '[object process]'); } catch (e) { return false; } } /** * Detect Browser Environment */ function isBrowser() { return typeof self === 'object' && self.self === self; } function isBrowserExtension() { var runtime = typeof chrome === 'object' ? chrome.runtime : typeof browser === 'object' ? browser.runtime : undefined; return typeof runtime === 'object' && runtime.id !== undefined; } /** * Detect React Native. * * @return true if ReactNative environment is detected. */ function isReactNative() { return (typeof navigator === 'object' && navigator['product'] === 'ReactNative'); } /** Detects Electron apps. */ function isElectron() { return getUA().indexOf('Electron/') >= 0; } /** Detects Internet Explorer. */ function isIE() { var ua = getUA(); return ua.indexOf('MSIE ') >= 0 || ua.indexOf('Trident/') >= 0; } /** Detects Universal Windows Platform apps. */ function isUWP() { return getUA().indexOf('MSAppHost/') >= 0; } /** * Detect whether the current SDK build is the Node version. * * @return true if it's the Node SDK build. */ function isNodeSdk() { return CONSTANTS.NODE_CLIENT === true || CONSTANTS.NODE_ADMIN === true; } /** Returns true if we are running in Safari. */ function isSafari() { return (!isNode() && navigator.userAgent.includes('Safari') && !navigator.userAgent.includes('Chrome')); } /** * This method checks if indexedDB is supported by current browser/service worker context * @return true if indexedDB is supported by current browser/service worker context */ function isIndexedDBAvailable() { return 'indexedDB' in self && indexedDB != null; } /** * This method validates browser context for indexedDB by opening a dummy indexedDB database and reject * if errors occur during the database open operation. */ function validateIndexedDBOpenable() { return new Promise(function (resolve, reject) { try { var preExist_1 = true; var DB_CHECK_NAME_1 = 'validate-browser-context-for-indexeddb-analytics-module'; var request_1 = window.indexedDB.open(DB_CHECK_NAME_1); request_1.onsuccess = function () { request_1.result.close(); // delete database only when it doesn't pre-exist if (!preExist_1) { window.indexedDB.deleteDatabase(DB_CHECK_NAME_1); } resolve(true); }; request_1.onupgradeneeded = function () { preExist_1 = false; }; request_1.onerror = function () { var _a; reject(((_a = request_1.error) === null || _a === void 0 ? void 0 : _a.message) || ''); }; } catch (error) { reject(error); } }); } /** * * This method checks whether cookie is enabled within current browser * @return true if cookie is enabled within current browser */ function areCookiesEnabled() { if (!navigator || !navigator.cookieEnabled) { return false; } return true; } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var ERROR_NAME = 'FirebaseError'; // Based on code from: // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error#Custom_Error_Types var FirebaseError = /** @class */ (function (_super) { tslib.__extends(FirebaseError, _super); function FirebaseError(code, message) { var _this = _super.call(this, message) || this; _this.code = code; _this.name = ERROR_NAME; // Fix For ES5 // https://github.com/Microsoft/TypeScript-wiki/blob/master/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work Object.setPrototypeOf(_this, FirebaseError.prototype); // Maintains proper stack trace for where our error was thrown. // Only available on V8. if (Error.captureStackTrace) { Error.captureStackTrace(_this, ErrorFactory.prototype.create); } return _this; } return FirebaseError; }(Error)); var ErrorFactory = /** @class */ (function () { function ErrorFactory(service, serviceName, errors) { this.service = service; this.serviceName = serviceName; this.errors = errors; } ErrorFactory.prototype.create = function (code) { var data = []; for (var _i = 1; _i < arguments.length; _i++) { data[_i - 1] = arguments[_i]; } var customData = data[0] || {}; var fullCode = this.service + "/" + code; var template = this.errors[code]; var message = template ? replaceTemplate(template, customData) : 'Error'; // Service Name: Error message (service/code). var fullMessage = this.serviceName + ": " + message + " (" + fullCode + ")."; var error = new FirebaseError(fullCode, fullMessage); // Keys with an underscore at the end of their name are not included in // error.data for some reason. // TODO: Replace with Object.entries when lib is updated to es2017. for (var _a = 0, _b = Object.keys(customData); _a < _b.length; _a++) { var key = _b[_a]; if (key.slice(-1) !== '_') { if (key in error) { console.warn("Overwriting FirebaseError base field \"" + key + "\" can cause unexpected behavior."); } error[key] = customData[key]; } } return error; }; return ErrorFactory; }()); function replaceTemplate(template, data) { return template.replace(PATTERN, function (_, key) { var value = data[key]; return value != null ? String(value) : "<" + key + "?>"; }); } var PATTERN = /\{\$([^}]+)}/g; /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Evaluates a JSON string into a javascript object. * * @param {string} str A string containing JSON. * @return {*} The javascript object representing the specified JSON. */ function jsonEval(str) { return JSON.parse(str); } /** * Returns JSON representing a javascript object. * @param {*} data Javascript object to be stringified. * @return {string} The JSON contents of the object. */ function stringify(data) { return JSON.stringify(data); } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Decodes a Firebase auth. token into constituent parts. * * Notes: * - May return with invalid / incomplete claims if there's no native base64 decoding support. * - Doesn't check if the token is actually valid. */ var decode = function (token) { var header = {}, claims = {}, data = {}, signature = ''; try { var parts = token.split('.'); header = jsonEval(base64Decode(parts[0]) || ''); claims = jsonEval(base64Decode(parts[1]) || ''); signature = parts[2]; data = claims['d'] || {}; delete claims['d']; } catch (e) { } return { header: header, claims: claims, data: data, signature: signature }; }; /** * Decodes a Firebase auth. token and checks the validity of its time-based claims. Will return true if the * token is within the time window authorized by the 'nbf' (not-before) and 'iat' (issued-at) claims. * * Notes: * - May return a false negative if there's no native base64 decoding support. * - Doesn't check if the token is actually valid. */ var isValidTimestamp = function (token) { var claims = decode(token).claims; var now = Math.floor(new Date().getTime() / 1000); var validSince = 0, validUntil = 0; if (typeof claims === 'object') { if (claims.hasOwnProperty('nbf')) { validSince = claims['nbf']; } else if (claims.hasOwnProperty('iat')) { validSince = claims['iat']; } if (claims.hasOwnProperty('exp')) { validUntil = claims['exp']; } else { // token will expire after 24h by default validUntil = validSince + 86400; } } return (!!now && !!validSince && !!validUntil && now >= validSince && now <= validUntil); }; /** * Decodes a Firebase auth. token and returns its issued at time if valid, null otherwise. * * Notes: * - May return null if there's no native base64 decoding support. * - Doesn't check if the token is actually valid. */ var issuedAtTime = function (token) { var claims = decode(token).claims; if (typeof claims === 'object' && claims.hasOwnProperty('iat')) { return claims['iat']; } return null; }; /** * Decodes a Firebase auth. token and checks the validity of its format. Expects a valid issued-at time. * * Notes: * - May return a false negative if there's no native base64 decoding support. * - Doesn't check if the token is actually valid. */ var isValidFormat = function (token) { var decoded = decode(token), claims = decoded.claims; return !!claims && typeof claims === 'object' && claims.hasOwnProperty('iat'); }; /** * Attempts to peer into an auth token and determine if it's an admin auth token by looking at the claims portion. * * Notes: * - May return a false negative if there's no native base64 decoding support. * - Doesn't check if the token is actually valid. */ var isAdmin = function (token) { var claims = decode(token).claims; return typeof claims === 'object' && claims['admin'] === true; }; /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ function contains(obj, key) { return Object.prototype.hasOwnProperty.call(obj, key); } function safeGet(obj, key) { if (Object.prototype.hasOwnProperty.call(obj, key)) { return obj[key]; } else { return undefined; } } function isEmpty(obj) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { return false; } } return true; } function map(obj, fn, contextObj) { var res = {}; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { res[key] = fn.call(contextObj, obj[key], key, obj); } } return res; } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Returns a querystring-formatted string (e.g. &arg=val&arg2=val2) from a * params object (e.g. {arg: 'val', arg2: 'val2'}) * Note: You must prepend it with ? when adding it to a URL. */ function querystring(querystringParams) { var params = []; var _loop_1 = function (key, value) { if (Array.isArray(value)) { value.forEach(function (arrayVal) { params.push(encodeURIComponent(key) + '=' + encodeURIComponent(arrayVal)); }); } else { params.push(encodeURIComponent(key) + '=' + encodeURIComponent(value)); } }; for (var _i = 0, _a = Object.entries(querystringParams); _i < _a.length; _i++) { var _b = _a[_i], key = _b[0], value = _b[1]; _loop_1(key, value); } return params.length ? '&' + params.join('&') : ''; } /** * Decodes a querystring (e.g. ?arg=val&arg2=val2) into a params object * (e.g. {arg: 'val', arg2: 'val2'}) */ function querystringDecode(querystring) { var obj = {}; var tokens = querystring.replace(/^\?/, '').split('&'); tokens.forEach(function (token) { if (token) { var key = token.split('='); obj[key[0]] = key[1]; } }); return obj; } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * @fileoverview SHA-1 cryptographic hash. * Variable names follow the notation in FIPS PUB 180-3: * http://csrc.nist.gov/publications/fips/fips180-3/fips180-3_final.pdf. * * Usage: * var sha1 = new sha1(); * sha1.update(bytes); * var hash = sha1.digest(); * * Performance: * Chrome 23: ~400 Mbit/s * Firefox 16: ~250 Mbit/s * */ /** * SHA-1 cryptographic hash constructor. * * The properties declared here are discussed in the above algorithm document. * @constructor * @final * @struct */ var Sha1 = /** @class */ (function () { function Sha1() { /** * Holds the previous values of accumulated variables a-e in the compress_ * function. * @private */ this.chain_ = []; /** * A buffer holding the partially computed hash result. * @private */ this.buf_ = []; /** * An array of 80 bytes, each a part of the message to be hashed. Referred to * as the message schedule in the docs. * @private */ this.W_ = []; /** * Contains data needed to pad messages less than 64 bytes. * @private */ this.pad_ = []; /** * @private {number} */ this.inbuf_ = 0; /** * @private {number} */ this.total_ = 0; this.blockSize = 512 / 8; this.pad_[0] = 128; for (var i = 1; i < this.blockSize; ++i) { this.pad_[i] = 0; } this.reset(); } Sha1.prototype.reset = function () { this.chain_[0] = 0x67452301; this.chain_[1] = 0xefcdab89; this.chain_[2] = 0x98badcfe; this.chain_[3] = 0x10325476; this.chain_[4] = 0xc3d2e1f0; this.inbuf_ = 0; this.total_ = 0; }; /** * Internal compress helper function. * @param buf Block to compress. * @param offset Offset of the block in the buffer. * @private */ Sha1.prototype.compress_ = function (buf, offset) { if (!offset) { offset = 0; } var W = this.W_; // get 16 big endian words if (typeof buf === 'string') { for (var i = 0; i < 16; i++) { // TODO(user): [bug 8140122] Recent versions of Safari for Mac OS and iOS // have a bug that turns the post-increment ++ operator into pre-increment // during JIT compilation. We have code that depends heavily on SHA-1 for // correctness and which is affected by this bug, so I've removed all uses // of post-increment ++ in which the result value is used. We can revert // this change once the Safari bug // (https://bugs.webkit.org/show_bug.cgi?id=109036) has been fixed and // most clients have been updated. W[i] = (buf.charCodeAt(offset) << 24) | (buf.charCodeAt(offset + 1) << 16) | (buf.charCodeAt(offset + 2) << 8) | buf.charCodeAt(offset + 3); offset += 4; } } else { for (var i = 0; i < 16; i++) { W[i] = (buf[offset] << 24) | (buf[offset + 1] << 16) | (buf[offset + 2] << 8) | buf[offset + 3]; offset += 4; } } // expand to 80 words for (var i = 16; i < 80; i++) { var t = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16]; W[i] = ((t << 1) | (t >>> 31)) & 0xffffffff; } var a = this.chain_[0]; var b = this.chain_[1]; var c = this.chain_[2]; var d = this.chain_[3]; var e = this.chain_[4]; var f, k; // TODO(user): Try to unroll this loop to speed up the computation. for (var i = 0; i < 80; i++) { if (i < 40) { if (i < 20) { f = d ^ (b & (c ^ d)); k = 0x5a827999; } else { f = b ^ c ^ d; k = 0x6ed9eba1; } } else { if (i < 60) { f = (b & c) | (d & (b | c)); k = 0x8f1bbcdc; } else { f = b ^ c ^ d; k = 0xca62c1d6; } } var t = (((a << 5) | (a >>> 27)) + f + e + k + W[i]) & 0xffffffff; e = d; d = c; c = ((b << 30) | (b >>> 2)) & 0xffffffff; b = a; a = t; } this.chain_[0] = (this.chain_[0] + a) & 0xffffffff; this.chain_[1] = (this.chain_[1] + b) & 0xffffffff; this.chain_[2] = (this.chain_[2] + c) & 0xffffffff; this.chain_[3] = (this.chain_[3] + d) & 0xffffffff; this.chain_[4] = (this.chain_[4] + e) & 0xffffffff; }; Sha1.prototype.update = function (bytes, length) { // TODO(johnlenz): tighten the function signature and remove this check if (bytes == null) { return; } if (length === undefined) { length = bytes.length; } var lengthMinusBlock = length - this.blockSize; var n = 0; // Using local instead of member variables gives ~5% speedup on Firefox 16. var buf = this.buf_; var inbuf = this.inbuf_; // The outer while loop should execute at most twice. while (n < length) { // When we have no data in the block to top up, we can directly process the // input buffer (assuming it contains sufficient data). This gives ~25% // speedup on Chrome 23 and ~15% speedup on Firefox 16, but requires that // the data is provided in large chunks (or in multiples of 64 bytes). if (inbuf === 0) { while (n <= lengthMinusBlock) { this.compress_(bytes, n); n += this.blockSize; } } if (typeof bytes === 'string') { while (n < length) { buf[inbuf] = bytes.charCodeAt(n); ++inbuf; ++n; if (inbuf === this.blockSize) { this.compress_(buf); inbuf = 0; // Jump to the outer loop so we use the full-block optimization. break; } } } else { while (n < length) { buf[inbuf] = bytes[n]; ++inbuf; ++n; if (inbuf === this.blockSize) { this.compress_(buf); inbuf = 0; // Jump to the outer loop so we use the full-block optimization. break; } } } } this.inbuf_ = inbuf; this.total_ += length; }; /** @override */ Sha1.prototype.digest = function () { var digest = []; var totalBits = this.total_ * 8; // Add pad 0x80 0x00*. if (this.inbuf_ < 56) { this.update(this.pad_, 56 - this.inbuf_); } else { this.update(this.pad_, this.blockSize - (this.inbuf_ - 56)); } // Add # bits. for (var i = this.blockSize - 1; i >= 56; i--) { this.buf_[i] = totalBits & 255; totalBits /= 256; // Don't use bit-shifting here! } this.compress_(this.buf_); var n = 0; for (var i = 0; i < 5; i++) { for (var j = 24; j >= 0; j -= 8) { digest[n] = (this.chain_[i] >> j) & 255; ++n; } } return digest; }; return Sha1; }()); /** * Helper to make a Subscribe function (just like Promise helps make a * Thenable). * * @param executor Function which can make calls to a single Observer * as a proxy. * @param onNoObservers Callback when count of Observers goes to zero. */ function createSubscribe(executor, onNoObservers) { var proxy = new ObserverProxy(executor, onNoObservers); return proxy.subscribe.bind(proxy); } /** * Implement fan-out for any number of Observers attached via a subscribe * function. */ var ObserverProxy = /** @class */ (function () { /** * @param executor Function which can make calls to a single Observer * as a proxy. * @param onNoObservers Callback when count of Observers goes to zero. */ function ObserverProxy(executor, onNoObservers) { var _this = this; this.observers = []; this.unsubscribes = []; this.observerCount = 0; // Micro-task scheduling by calling task.then(). this.task = Promise.resolve(); this.finalized = false; this.onNoObservers = onNoObservers; // Call the executor asynchronously so subscribers that are called // synchronously after the creation of the subscribe function // can still receive the very first value generated in the executor. this.task .then(function () { executor(_this); }) .catch(function (e) { _this.error(e); }); } ObserverProxy.prototype.next = function (value) { this.forEachObserver(function (observer) { observer.next(value); }); }; ObserverProxy.prototype.error = function (error) { this.forEachObserver(function (observer) { observer.error(error); }); this.close(error); }; ObserverProxy.prototype.complete = function () { this.forEachObserver(function (observer) { observer.complete(); }); this.close(); }; /** * Subscribe function that can be used to add an Observer to the fan-out list. * * - We require that no event is sent to a subscriber sychronously to their * call to subscribe(). */ ObserverProxy.prototype.subscribe = function (nextOrObserver, error, complete) { var _this = this; var observer; if (nextOrObserver === undefined && error === undefined && complete === undefined) { throw new Error('Missing Observer.'); } // Assemble an Observer object when passed as callback functions. if (implementsAnyMethods(nextOrObserver, [ 'next', 'error', 'complete' ])) { observer = nextOrObserver; } else { observer = { next: nextOrObserver, error: error, complete: complete }; } if (observer.next === undefined) { observer.next = noop; } if (observer.error === undefined) { observer.error = noop; } if (observer.complete === undefined) { observer.complete = noop; } var unsub = this.unsubscribeOne.bind(this, this.observers.length); // Attempt to subscribe to a terminated Observable - we // just respond to the Observer with the final error or complete // event. if (this.finalized) { // eslint-disable-next-line @typescript-eslint/no-floating-promises this.task.then(function () { try { if (_this.finalError) { observer.error(_this.finalError); } else { observer.complete(); } } catch (e) { // nothing } return; }); } this.observers.push(observer); return unsub; }; // Unsubscribe is synchronous - we guarantee that no events are sent to // any unsubscribed Observer. ObserverProxy.prototype.unsubscribeOne = function (i) { if (this.observers === undefined || this.observers[i] === undefined) { return; } delete this.observers[i]; this.observerCount -= 1; if (this.observerCount === 0 && this.onNoObservers !== undefined) { this.onNoObservers(this); } }; ObserverProxy.prototype.forEachObserver = function (fn) { if (this.finalized) { // Already closed by previous event....just eat the additional values. return; } // Since sendOne calls asynchronously - there is no chance that // this.observers will become undefined. for (var i = 0; i < this.observers.length; i++) { this.sendOne(i, fn); } }; // Call the Observer via one of it's callback function. We are careful to // confirm that the observe has not been unsubscribed since this asynchronous // function had been queued. ObserverProxy.prototype.sendOne = function (i, fn) { var _this = this; // Execute the callback asynchronously // eslint-disable-next-line @typescript-eslint/no-floating-promises this.task.then(function () { if (_this.observers !== undefined && _this.observers[i] !== undefined) { try { fn(_this.observers[i]); } catch (e) { // Ignore exceptions raised in Observers or missing methods of an // Observer. // Log error to console. b/31404806 if (typeof console !== 'undefined' && console.error) { console.error(e); } } } }); }; ObserverProxy.prototype.close = function (err) { var _this = this; if (this.finalized) { return; } this.finalized = true; if (err !== undefined) { this.finalError = err; } // Proxy is no longer needed - garbage collect references // eslint-disable-next-line @typescript-eslint/no-floating-promises this.task.then(function () { _this.observers = undefined; _this.onNoObservers = undefined; }); }; return ObserverProxy; }()); /** Turn synchronous function into one called asynchronously. */ // eslint-disable-next-line @typescript-eslint/ban-types function async(fn, onError) { return function () { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } Promise.resolve(true) .then(function () { fn.apply(void 0, args); }) .catch(function (error) { if (onError) { onError(error); } }); }; } /** * Return true if the object passed in implements any of the named methods. */ function implementsAnyMethods(obj, methods) { if (typeof obj !== 'object' || obj === null) { return false; } for (var _i = 0, methods_1 = methods; _i < methods_1.length; _i++) { var method = methods_1[_i]; if (method in obj && typeof obj[method] === 'function') { return true; } } return false; } function noop() { // do nothing } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Check to make sure the appropriate number of arguments are provided for a public function. * Throws an error if it fails. * * @param fnName The function name * @param minCount The minimum number of arguments to allow for the function call * @param maxCount The maximum number of argument to allow for the function call * @param argCount The actual number of arguments provided. */ var validateArgCount = function (fnName, minCount, maxCount, argCount) { var argError; if (argCount < minCount) { argError = 'at least ' + minCount; } else if (argCount > maxCount) { argError = maxCount === 0 ? 'none' : 'no more than ' + maxCount; } if (argError) { var error = fnName + ' failed: Was called with ' + argCount + (argCount === 1 ? ' argument.' : ' arguments.') + ' Expects ' + argError + '.'; throw new Error(error); } }; /** * Generates a string to prefix an error message about failed argument validation * * @param fnName The function name * @param argumentNumber The index of the argument * @param optional Whether or not the argument is optional * @return The prefix to add to the error thrown for validation. */ function errorPrefix(fnName, argumentNumber, optional) { var argName = ''; switch (argumentNumber) { case 1: argName = optional ? 'first' : 'First'; break; case 2: argName = optional ? 'second' : 'Second'; break; case 3: argName = optional ? 'third' : 'Third'; break; case 4: argName = optional ? 'fourth' : 'Fourth'; break; default: throw new Error('errorPrefix called with argumentNumber > 4. Need to update it?'); } var error = fnName + ' failed: '; error += argName + ' argument '; return error; } /** * @param fnName * @param argumentNumber * @param namespace * @param optional */ function validateNamespace(fnName, argumentNumber, namespace, optional) { if (optional && !namespace) { return; } if (typeof namespace !== 'string') { //TODO: I should do more validation here. We only allow certain chars in namespaces. throw new Error(errorPrefix(fnName, argumentNumber, optional) + 'must be a valid firebase namespace.'); } } function validateCallback(fnName, argumentNumber, // eslint-disable-next-line @typescript-eslint/ban-types callback, optional) { if (optional && !callback) { return; } if (typeof callback !== 'function') { throw new Error(errorPrefix(fnName, argumentNumber, optional) + 'must be a valid function.'); } } function validateContextObject(fnName, argumentNumber, context, optional) { if (optional && !context) { return; } if (typeof context !== 'object' || context === null) { throw new Error(errorPrefix(fnName, argumentNumber, optional) + 'must be a valid context object.'); } } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // Code originally came from goog.crypt.stringToUtf8ByteArray, but for some reason they // automatically replaced '\r\n' with '\n', and they didn't handle surrogate pairs, // so it's been modified. // Note that not all Unicode characters appear as single characters in JavaScript strings. // fromCharCode returns the UTF-16 encoding of a character - so some Unicode characters // use 2 characters in Javascript. All 4-byte UTF-8 characters begin with a first // character in the range 0xD800 - 0xDBFF (the first character of a so-called surrogate // pair). // See http://www.ecma-international.org/ecma-262/5.1/#sec-15.1.3 /** * @param {string} str * @return {Array} */ var stringToByteArray$1 = function (str) { var out = []; var p = 0; for (var i = 0; i < str.length; i++) { var c = str.charCodeAt(i); // Is this the lead surrogate in a surrogate pair? if (c >= 0xd800 && c <= 0xdbff) { var high = c - 0xd800; // the high 10 bits. i++; assert(i < str.length, 'Surrogate pair missing trail surrogate.'); var low = str.charCodeAt(i) - 0xdc00; // the low 10 bits. c = 0x10000 + (high << 10) + low; } if (c < 128) { out[p++] = c; } else if (c < 2048) { out[p++] = (c >> 6) | 192; out[p++] = (c & 63) | 128; } else if (c < 65536) { out[p++] = (c >> 12) | 224; out[p++] = ((c >> 6) & 63) | 128; out[p++] = (c & 63) | 128; } else { out[p++] = (c >> 18) | 240; out[p++] = ((c >> 12) & 63) | 128; out[p++] = ((c >> 6) & 63) | 128; out[p++] = (c & 63) | 128; } } return out; }; /** * Calculate length without actually converting; useful for doing cheaper validation. * @param {string} str * @return {number} */ var stringLength = function (str) { var p = 0; for (var i = 0; i < str.length; i++) { var c = str.charCodeAt(i); if (c < 128) { p++; } else if (c < 2048) { p += 2; } else if (c >= 0xd800 && c <= 0xdbff) { // Lead surrogate of a surrogate pair. The pair together will take 4 bytes to represent. p += 4; i++; // skip trail surrogate. } else { p += 3; } } return p; }; /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * The amount of milliseconds to exponentially increase. */ var DEFAULT_INTERVAL_MILLIS = 1000; /** * The factor to backoff by. * Should be a number greater than 1. */ var DEFAULT_BACKOFF_FACTOR = 2; /** * The maximum milliseconds to increase to. * * <p>Visible for testing */ var MAX_VALUE_MILLIS = 4 * 60 * 60 * 1000; // Four hours, like iOS and Android. /** * The percentage of backoff time to randomize by. * See * http://go/safe-client-behavior#step-1-determine-the-appropriate-retry-interval-to-handle-spike-traffic * for context. * * <p>Visible for testing */ var RANDOM_FACTOR = 0.5; /** * Based on the backoff method from * https://github.com/google/closure-library/blob/master/closure/goog/math/exponentialbackoff.js. * Extracted here so we don't need to pass metadata and a stateful ExponentialBackoff object around. */ function calculateBackoffMillis(backoffCount, intervalMillis, backoffFactor) { if (intervalMillis === void 0) { intervalMillis = DEFAULT_INTERVAL_MILLIS; } if (backoffFactor === void 0) { backoffFactor = DEFAULT_BACKOFF_FACTOR; } // Calculates an exponentially increasing value. // Deviation: calculates value from count and a constant interval, so we only need to save value // and count to restore state. var currBaseValue = intervalMillis * Math.pow(backoffFactor, backoffCount); // A random "fuzz" to avoid waves of retries. // Deviation: randomFactor is required. var randomWait = Math.round( // A fraction of the backoff value to add/subtract. // Deviation: changes multiplication order to improve readability. RANDOM_FACTOR * currBaseValue * // A random float (rounded to int by Math.round above) in the range [-1, 1]. Determines // if we add or subtract. (Math.random() - 0.5) * 2); // Limits backoff to max to avoid effectively permanent backoff. return Math.min(MAX_VALUE_MILLIS, currBaseValue + randomWait); } exports.CONSTANTS = CONSTANTS; exports.Deferred = Deferred; exports.ErrorFactory = ErrorFactory; exports.FirebaseError = FirebaseError; exports.MAX_VALUE_MILLIS = MAX_VALUE_MILLIS; exports.RANDOM_FACTOR = RANDOM_FACTOR; exports.Sha1 = Sha1; exports.areCookiesEnabled = areCookiesEnabled; exports.assert = assert; exports.assertionError = assertionError; exports.async = async; exports.base64 = base64; exports.base64Decode = base64Decode; exports.base64Encode = base64Encode; exports.calculateBackoffMillis = calculateBackoffMillis; exports.contains = contains; exports.createSubscribe = createSubscribe; exports.decode = decode; exports.deepCopy = deepCopy; exports.deepExtend = deepExtend; exports.errorPrefix = errorPrefix; exports.getUA = getUA; exports.isAdmin = isAdmin; exports.isBrowser = isBrowser; exports.isBrowserExtension = isBrowserExtension; exports.isElectron = isElectron; exports.isEmpty = isEmpty; exports.isIE = isIE; exports.isIndexedDBAvailable = isIndexedDBAvailable; exports.isMobileCordova = isMobileCordova; exports.isNode = isNode; exports.isNodeSdk = isNodeSdk; exports.isReactNative = isReactNative; exports.isSafari = isSafari; exports.isUWP = isUWP; exports.isValidFormat = isValidFormat; exports.isValidTimestamp = isValidTimestamp; exports.issuedAtTime = issuedAtTime; exports.jsonEval = jsonEval; exports.map = map; exports.querystring = querystring; exports.querystringDecode = querystringDecode; exports.safeGet = safeGet; exports.stringLength = stringLength; exports.stringToByteArray = stringToByteArray$1; exports.stringify = stringify; exports.validateArgCount = validateArgCount; exports.validateCallback = validateCallback; exports.validateContextObject = validateContextObject; exports.validateIndexedDBOpenable = validateIndexedDBOpenable; exports.validateNamespace = validateNamespace; //# sourceMappingURL=index.cjs.js.map /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__("./node_modules/webpack/buildin/global.js"))) /***/ }), /***/ "./node_modules/@firebase/storage/node_modules/tslib/tslib.es6.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); /* harmony export (immutable) */ __webpack_exports__["__extends"] = __extends; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__assign", function() { return __assign; }); /* harmony export (immutable) */ __webpack_exports__["__rest"] = __rest; /* harmony export (immutable) */ __webpack_exports__["__decorate"] = __decorate; /* harmony export (immutable) */ __webpack_exports__["__param"] = __param; /* harmony export (immutable) */ __webpack_exports__["__metadata"] = __metadata; /* harmony export (immutable) */ __webpack_exports__["__awaiter"] = __awaiter; /* harmony export (immutable) */ __webpack_exports__["__generator"] = __generator; /* harmony export (immutable) */ __webpack_exports__["__createBinding"] = __createBinding; /* harmony export (immutable) */ __webpack_exports__["__exportStar"] = __exportStar; /* harmony export (immutable) */ __webpack_exports__["__values"] = __values; /* harmony export (immutable) */ __webpack_exports__["__read"] = __read; /* harmony export (immutable) */ __webpack_exports__["__spread"] = __spread; /* harmony export (immutable) */ __webpack_exports__["__spreadArrays"] = __spreadArrays; /* harmony export (immutable) */ __webpack_exports__["__await"] = __await; /* harmony export (immutable) */ __webpack_exports__["__asyncGenerator"] = __asyncGenerator; /* harmony export (immutable) */ __webpack_exports__["__asyncDelegator"] = __asyncDelegator; /* harmony export (immutable) */ __webpack_exports__["__asyncValues"] = __asyncValues; /* harmony export (immutable) */ __webpack_exports__["__makeTemplateObject"] = __makeTemplateObject; /* harmony export (immutable) */ __webpack_exports__["__importStar"] = __importStar; /* harmony export (immutable) */ __webpack_exports__["__importDefault"] = __importDefault; /* harmony export (immutable) */ __webpack_exports__["__classPrivateFieldGet"] = __classPrivateFieldGet; /* harmony export (immutable) */ __webpack_exports__["__classPrivateFieldSet"] = __classPrivateFieldSet; /*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */ /* global Reflect, Promise */ var extendStatics = function(d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; function __extends(d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); } var __assign = function() { __assign = Object.assign || function __assign(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; } return __assign.apply(this, arguments); } function __rest(s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; } return t; } function __decorate(decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; } function __param(paramIndex, decorator) { return function (target, key) { decorator(target, key, paramIndex); } } function __metadata(metadataKey, metadataValue) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); } function __awaiter(thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); } function __generator(thisArg, body) { var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; function verb(n) { return function (v) { return step([n, v]); }; } function step(op) { if (f) throw new TypeError("Generator is already executing."); while (_) try { if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; if (y = 0, t) op = [op[0] & 2, t.value]; switch (op[0]) { case 0: case 1: t = op; break; case 4: _.label++; return { value: op[1], done: false }; case 5: _.label++; y = op[1]; op = [0]; continue; case 7: op = _.ops.pop(); _.trys.pop(); continue; default: if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } if (t[2]) _.ops.pop(); _.trys.pop(); continue; } op = body.call(thisArg, _); } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } } function __createBinding(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; } function __exportStar(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) exports[p] = m[p]; } function __values(o) { var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; if (m) return m.call(o); if (o && typeof o.length === "number") return { next: function () { if (o && i >= o.length) o = void 0; return { value: o && o[i++], done: !o }; } }; throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); } function __read(o, n) { var m = typeof Symbol === "function" && o[Symbol.iterator]; if (!m) return o; var i = m.call(o), r, ar = [], e; try { while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); } catch (error) { e = { error: error }; } finally { try { if (r && !r.done && (m = i["return"])) m.call(i); } finally { if (e) throw e.error; } } return ar; } function __spread() { for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); return ar; } function __spreadArrays() { for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; for (var r = Array(s), k = 0, i = 0; i < il; i++) for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) r[k] = a[j]; return r; }; function __await(v) { return this instanceof __await ? (this.v = v, this) : new __await(v); } function __asyncGenerator(thisArg, _arguments, generator) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var g = generator.apply(thisArg, _arguments || []), i, q = []; return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } function fulfill(value) { resume("next", value); } function reject(value) { resume("throw", value); } function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } } function __asyncDelegator(o) { var i, p; return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } } function __asyncValues(o) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var m = o[Symbol.asyncIterator], i; return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } } function __makeTemplateObject(cooked, raw) { if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } return cooked; }; function __importStar(mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; result.default = mod; return result; } function __importDefault(mod) { return (mod && mod.__esModule) ? mod : { default: mod }; } function __classPrivateFieldGet(receiver, privateMap) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return privateMap.get(receiver); } function __classPrivateFieldSet(receiver, privateMap, value) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to set private field on non-instance"); } privateMap.set(receiver, value); return value; } /***/ }), /***/ "./node_modules/@firebase/webchannel-wrapper/dist/index.esm.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); /* WEBPACK VAR INJECTION */(function(global) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ErrorCode", function() { return ErrorCode; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EventType", function() { return EventType; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "WebChannel", function() { return WebChannel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "XhrIo", function() { return XhrIo; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createWebChannelTransport", function() { return createWebChannelTransport; }); /*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */ /* global Reflect, Promise */ var extendStatics = function(d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; function __extends(d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); } function __values(o) { var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; if (m) return m.call(o); if (o && typeof o.length === "number") return { next: function () { if (o && i >= o.length) o = void 0; return { value: o && o[i++], done: !o }; } }; throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); } var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; var g, goog = goog || {}, k = commonjsGlobal || self; function aa() { } function ba(a) { var b = typeof a; return "object" != b ? b : a ? Array.isArray(a) ? "array" : b : "null"; } function ca(a) { var b = ba(a); return "array" == b || "object" == b && "number" == typeof a.length; } function n(a) { var b = typeof a; return "object" == b && null != a || "function" == b; } function da(a) { return Object.prototype.hasOwnProperty.call(a, ea) && a[ea] || (a[ea] = ++fa); } var ea = "closure_uid_" + (1E9 * Math.random() >>> 0), fa = 0; function ha(a, b, c) { return a.call.apply(a.bind, arguments); } function ja(a, b, c) { if (!a) throw Error(); if (2 < arguments.length) { var d = Array.prototype.slice.call(arguments, 2); return function () { var e = Array.prototype.slice.call(arguments); Array.prototype.unshift.apply(e, d); return a.apply(b, e); }; } return function () { return a.apply(b, arguments); }; } function p(a, b, c) { Function.prototype.bind && -1 != Function.prototype.bind.toString().indexOf("native code") ? p = ha : p = ja; return p.apply(null, arguments); } function ka(a, b) { var c = Array.prototype.slice.call(arguments, 1); return function () { var d = c.slice(); d.push.apply(d, arguments); return a.apply(this, d); }; } var q = Date.now; function r(a, b) { function c() { } c.prototype = b.prototype; a.S = b.prototype; a.prototype = new c; a.prototype.constructor = a; } function u() { this.j = this.j; this.i = this.i; } var la = 0; u.prototype.j = !1; u.prototype.ja = function () { if (!this.j && (this.j = !0, this.G(), 0 != la)) { var a = da(this); } }; u.prototype.G = function () { if (this.i) for (; this.i.length;) this.i.shift()(); }; var na = Array.prototype.indexOf ? function (a, b) { return Array.prototype.indexOf.call(a, b, void 0); } : function (a, b) { if ("string" === typeof a) return "string" !== typeof b || 1 != b.length ? -1 : a.indexOf(b, 0); for (var c = 0; c < a.length; c++) if (c in a && a[c] === b) return c; return -1; }, oa = Array.prototype.forEach ? function (a, b, c) { Array.prototype.forEach.call(a, b, c); } : function (a, b, c) { for (var d = a.length, e = "string" === typeof a ? a.split("") : a, f = 0; f < d; f++) f in e && b.call(c, e[f], f, a); }; function pa(a) { a: { var b = qa; for (var c = a.length, d = "string" === typeof a ? a.split("") : a, e = 0; e < c; e++) if (e in d && b.call(void 0, d[e], e, a)) { b = e; break a; } b = -1; } return 0 > b ? null : "string" === typeof a ? a.charAt(b) : a[b]; } function ra(a) { return Array.prototype.concat.apply([], arguments); } function sa(a) { var b = a.length; if (0 < b) { for (var c = Array(b), d = 0; d < b; d++) c[d] = a[d]; return c; } return []; } function ta(a) { return /^[\s\xa0]*$/.test(a); } var ua = String.prototype.trim ? function (a) { return a.trim(); } : function (a) { return /^[\s\xa0]*([\s\S]*?)[\s\xa0]*$/.exec(a)[1]; }; function v(a, b) { return -1 != a.indexOf(b); } function xa(a, b) { return a < b ? -1 : a > b ? 1 : 0; } var w; a: { var ya = k.navigator; if (ya) { var za = ya.userAgent; if (za) { w = za; break a; } } w = ""; } function Aa(a, b, c) { for (var d in a) b.call(c, a[d], d, a); } function Ba(a) { var b = {}; for (var c in a) b[c] = a[c]; return b; } var Ca = "constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "); function Da(a, b) { var c, d; for (var e = 1; e < arguments.length; e++) { d = arguments[e]; for (c in d) a[c] = d[c]; for (var f = 0; f < Ca.length; f++) c = Ca[f], Object.prototype.hasOwnProperty.call(d, c) && (a[c] = d[c]); } } function Ea(a) { Ea[" "](a); return a; } Ea[" "] = aa; function Fa(a, b) { var c = Ga; return Object.prototype.hasOwnProperty.call(c, a) ? c[a] : c[a] = b(a); } var Ha = v(w, "Opera"), x = v(w, "Trident") || v(w, "MSIE"), Ia = v(w, "Edge"), Ja = Ia || x, Ka = v(w, "Gecko") && !(v(w.toLowerCase(), "webkit") && !v(w, "Edge")) && !(v(w, "Trident") || v(w, "MSIE")) && !v(w, "Edge"), La = v(w.toLowerCase(), "webkit") && !v(w, "Edge"); function Ma() { var a = k.document; return a ? a.documentMode : void 0; } var Na; a: { var Oa = "", Pa = function () { var a = w; if (Ka) return /rv:([^\);]+)(\)|;)/.exec(a); if (Ia) return /Edge\/([\d\.]+)/.exec(a); if (x) return /\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(a); if (La) return /WebKit\/(\S+)/.exec(a); if (Ha) return /(?:Version)[ \/]?(\S+)/.exec(a); }(); Pa && (Oa = Pa ? Pa[1] : ""); if (x) { var Qa = Ma(); if (null != Qa && Qa > parseFloat(Oa)) { Na = String(Qa); break a; } } Na = Oa; } var Ga = {}; function Ra(a) { return Fa(a, function () { { var b = 0; var e = ua(String(Na)).split("."), f = ua(String(a)).split("."), h = Math.max(e.length, f.length); for (var m = 0; 0 == b && m < h; m++) { var c = e[m] || "", d = f[m] || ""; do { c = /(\d*)(\D*)(.*)/.exec(c) || ["", "", "", ""]; d = /(\d*)(\D*)(.*)/.exec(d) || ["", "", "", ""]; if (0 == c[0].length && 0 == d[0].length) break; b = xa(0 == c[1].length ? 0 : parseInt(c[1], 10), 0 == d[1].length ? 0 : parseInt(d[1], 10)) || xa(0 == c[2].length, 0 == d[2].length) || xa(c[2], d[2]); c = c[3]; d = d[3]; } while (0 == b); } } return 0 <= b; }); } var Sa; if (k.document && x) { var Ta = Ma(); Sa = Ta ? Ta : parseInt(Na, 10) || void 0; } else Sa = void 0; var Ua = Sa; var Va = !x || 9 <= Number(Ua), Wa = x && !Ra("9"), Xa = function () { if (!k.addEventListener || !Object.defineProperty) return !1; var a = !1, b = Object.defineProperty({}, "passive", { get: function () { a = !0; } }); try { k.addEventListener("test", aa, b), k.removeEventListener("test", aa, b); } catch (c) { } return a; }(); function y(a, b) { this.type = a; this.a = this.target = b; this.defaultPrevented = !1; } y.prototype.b = function () { this.defaultPrevented = !0; }; function A(a, b) { y.call(this, a ? a.type : ""); this.relatedTarget = this.a = this.target = null; this.button = this.screenY = this.screenX = this.clientY = this.clientX = 0; this.key = ""; this.metaKey = this.shiftKey = this.altKey = this.ctrlKey = !1; this.pointerId = 0; this.pointerType = ""; this.c = null; if (a) { var c = this.type = a.type, d = a.changedTouches && a.changedTouches.length ? a.changedTouches[0] : null; this.target = a.target || a.srcElement; this.a = b; if (b = a.relatedTarget) { if (Ka) { a: { try { Ea(b.nodeName); var e = !0; break a; } catch (f) { } e = !1; } e || (b = null); } } else "mouseover" == c ? b = a.fromElement : "mouseout" == c && (b = a.toElement); this.relatedTarget = b; d ? (this.clientX = void 0 !== d.clientX ? d.clientX : d.pageX, this.clientY = void 0 !== d.clientY ? d.clientY : d.pageY, this.screenX = d.screenX || 0, this.screenY = d.screenY || 0) : (this.clientX = void 0 !== a.clientX ? a.clientX : a.pageX, this.clientY = void 0 !== a.clientY ? a.clientY : a.pageY, this.screenX = a.screenX || 0, this.screenY = a.screenY || 0); this.button = a.button; this.key = a.key || ""; this.ctrlKey = a.ctrlKey; this.altKey = a.altKey; this.shiftKey = a.shiftKey; this.metaKey = a.metaKey; this.pointerId = a.pointerId || 0; this.pointerType = "string" === typeof a.pointerType ? a.pointerType : Ya[a.pointerType] || ""; this.c = a; a.defaultPrevented && this.b(); } } r(A, y); var Ya = { 2: "touch", 3: "pen", 4: "mouse" }; A.prototype.b = function () { A.S.b.call(this); var a = this.c; if (a.preventDefault) a.preventDefault(); else if (a.returnValue = !1, Wa) try { if (a.ctrlKey || 112 <= a.keyCode && 123 >= a.keyCode) a.keyCode = -1; } catch (b) { } }; var C = "closure_listenable_" + (1E6 * Math.random() | 0), Za = 0; function $a(a, b, c, d, e) { this.listener = a; this.proxy = null; this.src = b; this.type = c; this.capture = !!d; this.ca = e; this.key = ++Za; this.Y = this.Z = !1; } function ab(a) { a.Y = !0; a.listener = null; a.proxy = null; a.src = null; a.ca = null; } function bb(a) { this.src = a; this.a = {}; this.b = 0; } bb.prototype.add = function (a, b, c, d, e) { var f = a.toString(); a = this.a[f]; a || (a = this.a[f] = [], this.b++); var h = cb(a, b, d, e); -1 < h ? (b = a[h], c || (b.Z = !1)) : (b = new $a(b, this.src, f, !!d, e), b.Z = c, a.push(b)); return b; }; function db(a, b) { var c = b.type; if (c in a.a) { var d = a.a[c], e = na(d, b), f; (f = 0 <= e) && Array.prototype.splice.call(d, e, 1); f && (ab(b), 0 == a.a[c].length && (delete a.a[c], a.b--)); } } function cb(a, b, c, d) { for (var e = 0; e < a.length; ++e) { var f = a[e]; if (!f.Y && f.listener == b && f.capture == !!c && f.ca == d) return e; } return -1; } var eb = "closure_lm_" + (1E6 * Math.random() | 0), fb = {}; function hb(a, b, c, d, e) { if (d && d.once) return ib(a, b, c, d, e); if (Array.isArray(b)) { for (var f = 0; f < b.length; f++) hb(a, b[f], c, d, e); return null; } c = jb(c); return a && a[C] ? a.va(b, c, n(d) ? !!d.capture : !!d, e) : kb(a, b, c, !1, d, e); } function kb(a, b, c, d, e, f) { if (!b) throw Error("Invalid event type"); var h = n(e) ? !!e.capture : !!e; if (h && !Va) return null; var m = lb(a); m || (a[eb] = m = new bb(a)); c = m.add(b, c, d, h, f); if (c.proxy) return c; d = mb(); c.proxy = d; d.src = a; d.listener = c; if (a.addEventListener) Xa || (e = h), void 0 === e && (e = !1), a.addEventListener(b.toString(), d, e); else if (a.attachEvent) a.attachEvent(nb(b.toString()), d); else if (a.addListener && a.removeListener) a.addListener(d); else throw Error("addEventListener and attachEvent are unavailable."); return c; } function mb() { var a = ob, b = Va ? function (c) { return a.call(b.src, b.listener, c); } : function (c) { c = a.call(b.src, b.listener, c); if (!c) return c; }; return b; } function ib(a, b, c, d, e) { if (Array.isArray(b)) { for (var f = 0; f < b.length; f++) ib(a, b[f], c, d, e); return null; } c = jb(c); return a && a[C] ? a.wa(b, c, n(d) ? !!d.capture : !!d, e) : kb(a, b, c, !0, d, e); } function pb(a, b, c, d, e) { if (Array.isArray(b)) for (var f = 0; f < b.length; f++) pb(a, b[f], c, d, e); else (d = n(d) ? !!d.capture : !!d, c = jb(c), a && a[C]) ? (a = a.c, b = String(b).toString(), b in a.a && (f = a.a[b], c = cb(f, c, d, e), -1 < c && (ab(f[c]), Array.prototype.splice.call(f, c, 1), 0 == f.length && (delete a.a[b], a.b--)))) : a && (a = lb(a)) && (b = a.a[b.toString()], a = -1, b && (a = cb(b, c, d, e)), (c = -1 < a ? b[a] : null) && rb(c)); } function rb(a) { if ("number" !== typeof a && a && !a.Y) { var b = a.src; if (b && b[C]) db(b.c, a); else { var c = a.type, d = a.proxy; b.removeEventListener ? b.removeEventListener(c, d, a.capture) : b.detachEvent ? b.detachEvent(nb(c), d) : b.addListener && b.removeListener && b.removeListener(d); (c = lb(b)) ? (db(c, a), 0 == c.b && (c.src = null, b[eb] = null)) : ab(a); } } } function nb(a) { return a in fb ? fb[a] : fb[a] = "on" + a; } function sb(a, b) { var c = a.listener, d = a.ca || a.src; a.Z && rb(a); return c.call(d, b); } function ob(a, b) { if (a.Y) return !0; if (!Va) { if (!b) a: { b = ["window", "event"]; for (var c = k, d = 0; d < b.length; d++) if (c = c[b[d]], null == c) { b = null; break a; } b = c; } b = new A(b, this); return sb(a, b); } return sb(a, new A(b, this)); } function lb(a) { a = a[eb]; return a instanceof bb ? a : null; } var tb = "__closure_events_fn_" + (1E9 * Math.random() >>> 0); function jb(a) { if ("function" == ba(a)) return a; a[tb] || (a[tb] = function (b) { return a.handleEvent(b); }); return a[tb]; } function D() { u.call(this); this.c = new bb(this); this.J = this; this.C = null; } r(D, u); D.prototype[C] = !0; g = D.prototype; g.addEventListener = function (a, b, c, d) { hb(this, a, b, c, d); }; g.removeEventListener = function (a, b, c, d) { pb(this, a, b, c, d); }; g.dispatchEvent = function (a) { var b, c = this.C; if (c) for (b = []; c; c = c.C) b.push(c); c = this.J; var d = a.type || a; if ("string" === typeof a) a = new y(a, c); else if (a instanceof y) a.target = a.target || c; else { var e = a; a = new y(d, c); Da(a, e); } e = !0; if (b) for (var f = b.length - 1; 0 <= f; f--) { var h = a.a = b[f]; e = ub(h, d, !0, a) && e; } h = a.a = c; e = ub(h, d, !0, a) && e; e = ub(h, d, !1, a) && e; if (b) for (f = 0; f < b.length; f++) h = a.a = b[f], e = ub(h, d, !1, a) && e; return e; }; g.G = function () { D.S.G.call(this); if (this.c) { var a = this.c, c; for (c in a.a) { for (var d = a.a[c], e = 0; e < d.length; e++) ab(d[e]); delete a.a[c]; a.b--; } } this.C = null; }; g.va = function (a, b, c, d) { return this.c.add(String(a), b, !1, c, d); }; g.wa = function (a, b, c, d) { return this.c.add(String(a), b, !0, c, d); }; function ub(a, b, c, d) { b = a.c.a[String(b)]; if (!b) return !0; b = b.concat(); for (var e = !0, f = 0; f < b.length; ++f) { var h = b[f]; if (h && !h.Y && h.capture == c) { var m = h.listener, l = h.ca || h.src; h.Z && db(a.c, h); e = !1 !== m.call(l, d) && e; } } return e && !d.defaultPrevented; } var vb = k.JSON.stringify; function wb() { this.b = this.a = null; } var yb = new /** @class */ (function () { function class_1(a, b, c) { this.f = c; this.c = a; this.g = b; this.b = 0; this.a = null; } class_1.prototype.get = function () { var a; 0 < this.b ? (this.b--, a = this.a, this.a = a.next, a.next = null) : a = this.c(); return a; }; return class_1; }())(function () { return new xb; }, function (a) { a.reset(); }, 100); wb.prototype.add = function (a, b) { var c = yb.get(); c.set(a, b); this.b ? this.b.next = c : this.a = c; this.b = c; }; function zb() { var a = Ab, b = null; a.a && (b = a.a, a.a = a.a.next, a.a || (a.b = null), b.next = null); return b; } function xb() { this.next = this.b = this.a = null; } xb.prototype.set = function (a, b) { this.a = a; this.b = b; this.next = null; }; xb.prototype.reset = function () { this.next = this.b = this.a = null; }; function Bb(a) { k.setTimeout(function () { throw a; }, 0); } function Cb(a, b) { Db || Eb(); Fb || (Db(), Fb = !0); Ab.add(a, b); } var Db; function Eb() { var a = k.Promise.resolve(void 0); Db = function () { a.then(Gb); }; } var Fb = !1, Ab = new wb; function Gb() { for (var a; a = zb();) { try { a.a.call(a.b); } catch (c) { Bb(c); } var b = yb; b.g(a); b.b < b.f && (b.b++, a.next = b.a, b.a = a); } Fb = !1; } function Hb(a, b) { D.call(this); this.b = a || 1; this.a = b || k; this.f = p(this.Ya, this); this.g = q(); } r(Hb, D); g = Hb.prototype; g.aa = !1; g.M = null; g.Ya = function () { if (this.aa) { var a = q() - this.g; 0 < a && a < .8 * this.b ? this.M = this.a.setTimeout(this.f, this.b - a) : (this.M && (this.a.clearTimeout(this.M), this.M = null), this.dispatchEvent("tick"), this.aa && (Ib(this), this.start())); } }; g.start = function () { this.aa = !0; this.M || (this.M = this.a.setTimeout(this.f, this.b), this.g = q()); }; function Ib(a) { a.aa = !1; a.M && (a.a.clearTimeout(a.M), a.M = null); } g.G = function () { Hb.S.G.call(this); Ib(this); delete this.a; }; function Jb(a, b, c) { if ("function" == ba(a)) c && (a = p(a, c)); else if (a && "function" == typeof a.handleEvent) a = p(a.handleEvent, a); else throw Error("Invalid listener argument"); return 2147483647 < Number(b) ? -1 : k.setTimeout(a, b || 0); } function Kb(a) { a.a = Jb(function () { a.a = null; a.c && (a.c = !1, Kb(a)); }, a.h); var b = a.b; a.b = null; a.g.apply(null, b); } var Lb = /** @class */ (function (_super) { __extends(Lb, _super); function Lb(a, b, c) { var _this = _super.call(this) || this; _this.g = null != c ? a.bind(c) : a; _this.h = b; _this.b = null; _this.c = !1; _this.a = null; return _this; } Lb.prototype.f = function (a) { this.b = arguments; this.a ? this.c = !0 : Kb(this); }; Lb.prototype.G = function () { _super.prototype.G.call(this); this.a && (k.clearTimeout(this.a), this.a = null, this.c = !1, this.b = null); }; return Lb; }(u)); function E(a) { u.call(this); this.b = a; this.a = {}; } r(E, u); var Mb = []; function Nb(a, b, c, d) { Array.isArray(c) || (c && (Mb[0] = c.toString()), c = Mb); for (var e = 0; e < c.length; e++) { var f = hb(b, c[e], d || a.handleEvent, !1, a.b || a); if (!f) break; a.a[f.key] = f; } } function Ob(a) { Aa(a.a, function (b, c) { this.a.hasOwnProperty(c) && rb(b); }, a); a.a = {}; } E.prototype.G = function () { E.S.G.call(this); Ob(this); }; E.prototype.handleEvent = function () { throw Error("EventHandler.handleEvent not implemented"); }; function Pb() { this.a = !0; } function Qb(a, b, c, d, e, f) { a.info(function () { if (a.a) if (f) { var h = ""; for (var m = f.split("&"), l = 0; l < m.length; l++) { var t = m[l].split("="); if (1 < t.length) { var B = t[0]; t = t[1]; var z = B.split("_"); h = 2 <= z.length && "type" == z[1] ? h + (B + "=" + t + "&") : h + (B + "=redacted&"); } } } else h = null; else h = f; return "XMLHTTP REQ (" + d + ") [attempt " + e + "]: " + b + "\n" + c + "\n" + h; }); } function Rb(a, b, c, d, e, f, h) { a.info(function () { return "XMLHTTP RESP (" + d + ") [ attempt " + e + "]: " + b + "\n" + c + "\n" + f + " " + h; }); } function F(a, b, c, d) { a.info(function () { return "XMLHTTP TEXT (" + b + "): " + Sb(a, c) + (d ? " " + d : ""); }); } function Tb(a, b) { a.info(function () { return "TIMEOUT: " + b; }); } Pb.prototype.info = function () { }; function Sb(a, b) { if (!a.a) return b; if (!b) return null; try { var c = JSON.parse(b); if (c) for (a = 0; a < c.length; a++) if (Array.isArray(c[a])) { var d = c[a]; if (!(2 > d.length)) { var e = d[1]; if (Array.isArray(e) && !(1 > e.length)) { var f = e[0]; if ("noop" != f && "stop" != f && "close" != f) for (var h = 1; h < e.length; h++) e[h] = ""; } } } return vb(c); } catch (m) { return b; } } var Ub = null; function Vb() { return Ub = Ub || new D; } function Wb(a) { y.call(this, "serverreachability", a); } r(Wb, y); function G(a) { var b = Vb(); b.dispatchEvent(new Wb(b, a)); } function Xb(a) { y.call(this, "statevent", a); } r(Xb, y); function H(a) { var b = Vb(); b.dispatchEvent(new Xb(b, a)); } function Yb(a) { y.call(this, "timingevent", a); } r(Yb, y); function I(a, b) { if ("function" != ba(a)) throw Error("Fn must not be null and must be a function"); return k.setTimeout(function () { a(); }, b); } var Zb = { NO_ERROR: 0, Za: 1, gb: 2, fb: 3, bb: 4, eb: 5, hb: 6, Da: 7, TIMEOUT: 8, kb: 9 }; var $b = { ab: "complete", ob: "success", Ea: "error", Da: "abort", mb: "ready", nb: "readystatechange", TIMEOUT: "timeout", ib: "incrementaldata", lb: "progress", cb: "downloadprogress", pb: "uploadprogress" }; function ac() { } ac.prototype.a = null; function bc(a) { var b; (b = a.a) || (b = a.a = {}); return b; } function cc() { } var J = { OPEN: "a", $a: "b", Ea: "c", jb: "d" }; function dc() { y.call(this, "d"); } r(dc, y); function ec() { y.call(this, "c"); } r(ec, y); var fc; function gc() { } r(gc, ac); fc = new gc; function K(a, b, c, d) { this.g = a; this.c = b; this.f = c; this.T = d || 1; this.J = new E(this); this.P = hc; a = Ja ? 125 : void 0; this.R = new Hb(a); this.B = null; this.b = !1; this.j = this.l = this.i = this.H = this.u = this.U = this.o = null; this.s = []; this.a = null; this.D = 0; this.h = this.m = null; this.N = -1; this.A = !1; this.O = 0; this.F = null; this.W = this.C = this.V = this.I = !1; } var hc = 45E3, ic = {}, jc = {}; g = K.prototype; g.setTimeout = function (a) { this.P = a; }; function kc(a, b, c) { a.H = 1; a.i = lc(L(b)); a.j = c; a.I = !0; mc(a, null); } function mc(a, b) { a.u = q(); M(a); a.l = L(a.i); var c = a.l, d = a.T; Array.isArray(d) || (d = [String(d)]); nc(c.b, "t", d); a.D = 0; a.a = oc(a.g, a.g.C ? b : null); 0 < a.O && (a.F = new Lb(p(a.Ca, a, a.a), a.O)); Nb(a.J, a.a, "readystatechange", a.Wa); b = a.B ? Ba(a.B) : {}; a.j ? (a.m || (a.m = "POST"), b["Content-Type"] = "application/x-www-form-urlencoded", a.a.ba(a.l, a.m, a.j, b)) : (a.m = "GET", a.a.ba(a.l, a.m, null, b)); G(1); Qb(a.c, a.m, a.l, a.f, a.T, a.j); } g.Wa = function (a) { a = a.target; var b = this.F; b && 3 == N(a) ? b.f() : this.Ca(a); }; g.Ca = function (a) { try { if (a == this.a) a: { var b = N(this.a), c = this.a.ua(), d = this.a.X(); if (!(3 > b || 3 == b && !Ja && !this.a.$())) { this.A || 4 != b || 7 == c || (8 == c || 0 >= d ? G(3) : G(2)); pc(this); var e = this.a.X(); this.N = e; var f = this.a.$(); this.b = 200 == e; Rb(this.c, this.m, this.l, this.f, this.T, b, e); if (this.b) { if (this.V && !this.C) { b: { if (this.a) { var h, m = this.a; if ((h = m.a ? m.a.getResponseHeader("X-HTTP-Initial-Response") : null) && !ta(h)) { var l = h; break b; } } l = null; } if (l) F(this.c, this.f, l, "Initial handshake response via X-HTTP-Initial-Response"), this.C = !0, qc(this, l); else { this.b = !1; this.h = 3; H(12); O(this); rc(this); break a; } } this.I ? (tc(this, b, f), Ja && this.b && 3 == b && (Nb(this.J, this.R, "tick", this.Va), this.R.start())) : (F(this.c, this.f, f, null), qc(this, f)); 4 == b && O(this); this.b && !this.A && (4 == b ? uc(this.g, this) : (this.b = !1, M(this))); } else 400 == e && 0 < f.indexOf("Unknown SID") ? (this.h = 3, H(12)) : (this.h = 0, H(13)), O(this), rc(this); } } } catch (t) { } finally { } }; function tc(a, b, c) { for (var d = !0; !a.A && a.D < c.length;) { var e = vc(a, c); if (e == jc) { 4 == b && (a.h = 4, H(14), d = !1); F(a.c, a.f, null, "[Incomplete Response]"); break; } else if (e == ic) { a.h = 4; H(15); F(a.c, a.f, c, "[Invalid Chunk]"); d = !1; break; } else F(a.c, a.f, e, null), qc(a, e); } 4 == b && 0 == c.length && (a.h = 1, H(16), d = !1); a.b = a.b && d; d ? 0 < c.length && !a.W && (a.W = !0, b = a.g, b.a == a && b.V && !b.F && (b.c.info("Great, no buffering proxy detected. Bytes received: " + c.length), xc(b), b.F = !0)) : (F(a.c, a.f, c, "[Invalid Chunked Response]"), O(a), rc(a)); } g.Va = function () { if (this.a) { var a = N(this.a), b = this.a.$(); this.D < b.length && (pc(this), tc(this, a, b), this.b && 4 != a && M(this)); } }; function vc(a, b) { var c = a.D, d = b.indexOf("\n", c); if (-1 == d) return jc; c = Number(b.substring(c, d)); if (isNaN(c)) return ic; d += 1; if (d + c > b.length) return jc; b = b.substr(d, c); a.D = d + c; return b; } g.cancel = function () { this.A = !0; O(this); }; function M(a) { a.U = q() + a.P; yc(a, a.P); } function yc(a, b) { if (null != a.o) throw Error("WatchDog timer not null"); a.o = I(p(a.Ua, a), b); } function pc(a) { a.o && (k.clearTimeout(a.o), a.o = null); } g.Ua = function () { this.o = null; var a = q(); 0 <= a - this.U ? (Tb(this.c, this.l), 2 != this.H && (G(3), H(17)), O(this), this.h = 2, rc(this)) : yc(this, this.U - a); }; function rc(a) { 0 == a.g.v || a.A || uc(a.g, a); } function O(a) { pc(a); var b = a.F; b && "function" == typeof b.ja && b.ja(); a.F = null; Ib(a.R); Ob(a.J); a.a && (b = a.a, a.a = null, b.abort(), b.ja()); } function qc(a, b) { try { var c = a.g; if (0 != c.v && (c.a == a || zc(c.b, a))) if (c.I = a.N, !a.C && zc(c.b, a) && 3 == c.v) { try { var d = c.ka.a.parse(b); } catch (sc) { d = null; } if (Array.isArray(d) && 3 == d.length) { var e = d; if (0 == e[0]) a: { if (!c.j) { if (c.a) if (c.a.u + 3E3 < a.u) Ac(c), Bc(c); else break a; Cc(c); H(18); } } else c.oa = e[1], 0 < c.oa - c.P && 37500 > e[2] && c.H && 0 == c.o && !c.m && (c.m = I(p(c.Ra, c), 6E3)); if (1 >= Dc(c.b) && c.ea) { try { c.ea(); } catch (sc) { } c.ea = void 0; } } else P(c, 11); } else if ((a.C || c.a == a) && Ac(c), !ta(b)) for (b = d = c.ka.a.parse(b), d = 0; d < b.length; d++) if (e = b[d], c.P = e[0], e = e[1], 2 == c.v) if ("c" == e[0]) { c.J = e[1]; c.ga = e[2]; var f = e[3]; null != f && (c.ha = f, c.c.info("VER=" + c.ha)); var h = e[4]; null != h && (c.pa = h, c.c.info("SVER=" + c.pa)); var m = e[5]; if (null != m && "number" === typeof m && 0 < m) { var l = 1.5 * m; c.D = l; c.c.info("backChannelRequestTimeoutMs_=" + l); } l = c; var t = a.a; if (t) { var B = t.a ? t.a.getResponseHeader("X-Client-Wire-Protocol") : null; if (B) { var z = l.b; !z.a && (v(B, "spdy") || v(B, "quic") || v(B, "h2")) && (z.f = z.g, z.a = new Set, z.b && (Ec(z, z.b), z.b = null)); } if (l.A) { var qb = t.a ? t.a.getResponseHeader("X-HTTP-Session-Id") : null; qb && (l.na = qb, Q(l.B, l.A, qb)); } } c.v = 3; c.f && c.f.ta(); c.V && (c.N = q() - a.u, c.c.info("Handshake RTT: " + c.N + "ms")); l = c; var va = a; l.la = Fc(l, l.C ? l.ga : null, l.fa); if (va.C) { Gc(l.b, va); var wa = va, wc = l.D; wc && wa.setTimeout(wc); wa.o && (pc(wa), M(wa)); l.a = va; } else Hc(l); 0 < c.g.length && Ic(c); } else "stop" != e[0] && "close" != e[0] || P(c, 7); else 3 == c.v && ("stop" == e[0] || "close" == e[0] ? "stop" == e[0] ? P(c, 7) : Jc(c) : "noop" != e[0] && c.f && c.f.sa(e), c.o = 0); G(4); } catch (sc) { } } function Kc(a) { if (a.K && "function" == typeof a.K) return a.K(); if ("string" === typeof a) return a.split(""); if (ca(a)) { for (var b = [], c = a.length, d = 0; d < c; d++) b.push(a[d]); return b; } b = []; c = 0; for (d in a) b[c++] = a[d]; return a = b; } function Lc(a, b) { if (a.forEach && "function" == typeof a.forEach) a.forEach(b, void 0); else if (ca(a) || "string" === typeof a) oa(a, b, void 0); else { if (a.L && "function" == typeof a.L) var c = a.L(); else if (a.K && "function" == typeof a.K) c = void 0; else if (ca(a) || "string" === typeof a) { c = []; for (var d = a.length, e = 0; e < d; e++) c.push(e); } else for (e in c = [], d = 0, a) c[d++] = e; d = Kc(a); e = d.length; for (var f = 0; f < e; f++) b.call(void 0, d[f], c && c[f], a); } } function R(a, b) { this.b = {}; this.a = []; this.c = 0; var c = arguments.length; if (1 < c) { if (c % 2) throw Error("Uneven number of arguments"); for (var d = 0; d < c; d += 2) this.set(arguments[d], arguments[d + 1]); } else if (a) if (a instanceof R) for (c = a.L(), d = 0; d < c.length; d++) this.set(c[d], a.get(c[d])); else for (d in a) this.set(d, a[d]); } g = R.prototype; g.K = function () { Mc(this); for (var a = [], b = 0; b < this.a.length; b++) a.push(this.b[this.a[b]]); return a; }; g.L = function () { Mc(this); return this.a.concat(); }; function Mc(a) { if (a.c != a.a.length) { for (var b = 0, c = 0; b < a.a.length;) { var d = a.a[b]; S(a.b, d) && (a.a[c++] = d); b++; } a.a.length = c; } if (a.c != a.a.length) { var e = {}; for (c = b = 0; b < a.a.length;) d = a.a[b], S(e, d) || (a.a[c++] = d, e[d] = 1), b++; a.a.length = c; } } g.get = function (a, b) { return S(this.b, a) ? this.b[a] : b; }; g.set = function (a, b) { S(this.b, a) || (this.c++, this.a.push(a)); this.b[a] = b; }; g.forEach = function (a, b) { for (var c = this.L(), d = 0; d < c.length; d++) { var e = c[d], f = this.get(e); a.call(b, f, e, this); } }; function S(a, b) { return Object.prototype.hasOwnProperty.call(a, b); } var Nc = /^(?:([^:/?#.]+):)?(?:\/\/(?:([^\\/?#]*)@)?([^\\/?#]*?)(?::([0-9]+))?(?=[\\/?#]|$))?([^?#]+)?(?:\?([^#]*))?(?:#([\s\S]*))?$/; function Oc(a, b) { if (a) { a = a.split("&"); for (var c = 0; c < a.length; c++) { var d = a[c].indexOf("="), e = null; if (0 <= d) { var f = a[c].substring(0, d); e = a[c].substring(d + 1); } else f = a[c]; b(f, e ? decodeURIComponent(e.replace(/\+/g, " ")) : ""); } } } function T(a, b) { this.c = this.j = this.f = ""; this.h = null; this.i = this.g = ""; this.a = !1; if (a instanceof T) { this.a = void 0 !== b ? b : a.a; Pc(this, a.f); this.j = a.j; Qc(this, a.c); Rc(this, a.h); this.g = a.g; b = a.b; var c = new U; c.c = b.c; b.a && (c.a = new R(b.a), c.b = b.b); Sc(this, c); this.i = a.i; } else a && (c = String(a).match(Nc)) ? (this.a = !!b, Pc(this, c[1] || "", !0), this.j = Tc(c[2] || ""), Qc(this, c[3] || "", !0), Rc(this, c[4]), this.g = Tc(c[5] || "", !0), Sc(this, c[6] || "", !0), this.i = Tc(c[7] || "")) : (this.a = !!b, this.b = new U(null, this.a)); } T.prototype.toString = function () { var a = [], b = this.f; b && a.push(Uc(b, Vc, !0), ":"); var c = this.c; if (c || "file" == b) a.push("//"), (b = this.j) && a.push(Uc(b, Vc, !0), "@"), a.push(encodeURIComponent(String(c)).replace(/%25([0-9a-fA-F]{2})/g, "%$1")), c = this.h, null != c && a.push(":", String(c)); if (c = this.g) this.c && "/" != c.charAt(0) && a.push("/"), a.push(Uc(c, "/" == c.charAt(0) ? Wc : Xc, !0)); (c = this.b.toString()) && a.push("?", c); (c = this.i) && a.push("#", Uc(c, Yc)); return a.join(""); }; function L(a) { return new T(a); } function Pc(a, b, c) { a.f = c ? Tc(b, !0) : b; a.f && (a.f = a.f.replace(/:$/, "")); } function Qc(a, b, c) { a.c = c ? Tc(b, !0) : b; } function Rc(a, b) { if (b) { b = Number(b); if (isNaN(b) || 0 > b) throw Error("Bad port number " + b); a.h = b; } else a.h = null; } function Sc(a, b, c) { b instanceof U ? (a.b = b, Zc(a.b, a.a)) : (c || (b = Uc(b, $c)), a.b = new U(b, a.a)); } function Q(a, b, c) { a.b.set(b, c); } function lc(a) { Q(a, "zx", Math.floor(2147483648 * Math.random()).toString(36) + Math.abs(Math.floor(2147483648 * Math.random()) ^ q()).toString(36)); return a; } function ad(a) { return a instanceof T ? L(a) : new T(a, void 0); } function bd(a, b, c, d) { var e = new T(null, void 0); a && Pc(e, a); b && Qc(e, b); c && Rc(e, c); d && (e.g = d); return e; } function Tc(a, b) { return a ? b ? decodeURI(a.replace(/%25/g, "%2525")) : decodeURIComponent(a) : ""; } function Uc(a, b, c) { return "string" === typeof a ? (a = encodeURI(a).replace(b, cd), c && (a = a.replace(/%25([0-9a-fA-F]{2})/g, "%$1")), a) : null; } function cd(a) { a = a.charCodeAt(0); return "%" + (a >> 4 & 15).toString(16) + (a & 15).toString(16); } var Vc = /[#\/\?@]/g, Xc = /[#\?:]/g, Wc = /[#\?]/g, $c = /[#\?@]/g, Yc = /#/g; function U(a, b) { this.b = this.a = null; this.c = a || null; this.f = !!b; } function V(a) { a.a || (a.a = new R, a.b = 0, a.c && Oc(a.c, function (b, c) { a.add(decodeURIComponent(b.replace(/\+/g, " ")), c); })); } g = U.prototype; g.add = function (a, b) { V(this); this.c = null; a = W(this, a); var c = this.a.get(a); c || this.a.set(a, c = []); c.push(b); this.b += 1; return this; }; function dd(a, b) { V(a); b = W(a, b); S(a.a.b, b) && (a.c = null, a.b -= a.a.get(b).length, a = a.a, S(a.b, b) && (delete a.b[b], a.c--, a.a.length > 2 * a.c && Mc(a))); } function ed(a, b) { V(a); b = W(a, b); return S(a.a.b, b); } g.forEach = function (a, b) { V(this); this.a.forEach(function (c, d) { oa(c, function (e) { a.call(b, e, d, this); }, this); }, this); }; g.L = function () { V(this); for (var a = this.a.K(), b = this.a.L(), c = [], d = 0; d < b.length; d++) for (var e = a[d], f = 0; f < e.length; f++) c.push(b[d]); return c; }; g.K = function (a) { V(this); var b = []; if ("string" === typeof a) ed(this, a) && (b = ra(b, this.a.get(W(this, a)))); else { a = this.a.K(); for (var c = 0; c < a.length; c++) b = ra(b, a[c]); } return b; }; g.set = function (a, b) { V(this); this.c = null; a = W(this, a); ed(this, a) && (this.b -= this.a.get(a).length); this.a.set(a, [b]); this.b += 1; return this; }; g.get = function (a, b) { if (!a) return b; a = this.K(a); return 0 < a.length ? String(a[0]) : b; }; function nc(a, b, c) { dd(a, b); 0 < c.length && (a.c = null, a.a.set(W(a, b), sa(c)), a.b += c.length); } g.toString = function () { if (this.c) return this.c; if (!this.a) return ""; for (var a = [], b = this.a.L(), c = 0; c < b.length; c++) { var d = b[c], e = encodeURIComponent(String(d)); d = this.K(d); for (var f = 0; f < d.length; f++) { var h = e; "" !== d[f] && (h += "=" + encodeURIComponent(String(d[f]))); a.push(h); } } return this.c = a.join("&"); }; function W(a, b) { b = String(b); a.f && (b = b.toLowerCase()); return b; } function Zc(a, b) { b && !a.f && (V(a), a.c = null, a.a.forEach(function (c, d) { var e = d.toLowerCase(); d != e && (dd(this, d), nc(this, e, c)); }, a)); a.f = b; } function fd(a, b) { this.b = a; this.a = b; } function gd(a) { this.g = a || hd; k.PerformanceNavigationTiming ? (a = k.performance.getEntriesByType("navigation"), a = 0 < a.length && ("hq" == a[0].nextHopProtocol || "h2" == a[0].nextHopProtocol)) : a = !!(k.ia && k.ia.ya && k.ia.ya() && k.ia.ya().qb); this.f = a ? this.g : 1; this.a = null; 1 < this.f && (this.a = new Set); this.b = null; this.c = []; } var hd = 10; function id(a) { return a.b ? !0 : a.a ? a.a.size >= a.f : !1; } function Dc(a) { return a.b ? 1 : a.a ? a.a.size : 0; } function zc(a, b) { return a.b ? a.b == b : a.a ? a.a.has(b) : !1; } function Ec(a, b) { a.a ? a.a.add(b) : a.b = b; } function Gc(a, b) { a.b && a.b == b ? a.b = null : a.a && a.a.has(b) && a.a.delete(b); } gd.prototype.cancel = function () { var e_1, _a; this.c = jd(this); if (this.b) this.b.cancel(), this.b = null; else if (this.a && 0 !== this.a.size) { try { for (var _b = __values(this.a.values()), _c = _b.next(); !_c.done; _c = _b.next()) { var a = _c.value; a.cancel(); } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (_c && !_c.done && (_a = _b.return)) _a.call(_b); } finally { if (e_1) throw e_1.error; } } this.a.clear(); } }; function jd(a) { var e_2, _a; if (null != a.b) return a.c.concat(a.b.s); if (null != a.a && 0 !== a.a.size) { var b = a.c; try { for (var _b = __values(a.a.values()), _c = _b.next(); !_c.done; _c = _b.next()) { var c = _c.value; b = b.concat(c.s); } } catch (e_2_1) { e_2 = { error: e_2_1 }; } finally { try { if (_c && !_c.done && (_a = _b.return)) _a.call(_b); } finally { if (e_2) throw e_2.error; } } return b; } return sa(a.c); } function kd() { } kd.prototype.stringify = function (a) { return k.JSON.stringify(a, void 0); }; kd.prototype.parse = function (a) { return k.JSON.parse(a, void 0); }; function ld() { this.a = new kd; } function md(a, b, c) { var d = c || ""; try { Lc(a, function (e, f) { var h = e; n(e) && (h = vb(e)); b.push(d + f + "=" + encodeURIComponent(h)); }); } catch (e) { throw b.push(d + "type=" + encodeURIComponent("_badmap")), e; } } function nd(a, b) { var c = new Pb; if (k.Image) { var d = new Image; d.onload = ka(od, c, d, "TestLoadImage: loaded", !0, b); d.onerror = ka(od, c, d, "TestLoadImage: error", !1, b); d.onabort = ka(od, c, d, "TestLoadImage: abort", !1, b); d.ontimeout = ka(od, c, d, "TestLoadImage: timeout", !1, b); k.setTimeout(function () { if (d.ontimeout) d.ontimeout(); }, 1E4); d.src = a; } else b(!1); } function od(a, b, c, d, e) { try { b.onload = null, b.onerror = null, b.onabort = null, b.ontimeout = null, e(d); } catch (f) { } } var pd = k.JSON.parse; function X(a) { D.call(this); this.headers = new R; this.H = a || null; this.b = !1; this.s = this.a = null; this.B = ""; this.h = 0; this.f = ""; this.g = this.A = this.l = this.u = !1; this.o = 0; this.m = null; this.I = qd; this.D = this.F = !1; } r(X, D); var qd = "", rd = /^https?$/i, sd = ["POST", "PUT"]; g = X.prototype; g.ba = function (a, b, c, d) { if (this.a) throw Error("[goog.net.XhrIo] Object is active with another request=" + this.B + "; newUri=" + a); b = b ? b.toUpperCase() : "GET"; this.B = a; this.f = ""; this.h = 0; this.u = !1; this.b = !0; this.a = new XMLHttpRequest; this.s = this.H ? bc(this.H) : bc(fc); this.a.onreadystatechange = p(this.za, this); try { this.A = !0, this.a.open(b, String(a), !0), this.A = !1; } catch (f) { td(this, f); return; } a = c || ""; var e = new R(this.headers); d && Lc(d, function (f, h) { e.set(h, f); }); d = pa(e.L()); c = k.FormData && a instanceof k.FormData; !(0 <= na(sd, b)) || d || c || e.set("Content-Type", "application/x-www-form-urlencoded;charset=utf-8"); e.forEach(function (f, h) { this.a.setRequestHeader(h, f); }, this); this.I && (this.a.responseType = this.I); "withCredentials" in this.a && this.a.withCredentials !== this.F && (this.a.withCredentials = this.F); try { ud(this), 0 < this.o && ((this.D = vd(this.a)) ? (this.a.timeout = this.o, this.a.ontimeout = p(this.xa, this)) : this.m = Jb(this.xa, this.o, this)), this.l = !0, this.a.send(a), this.l = !1; } catch (f) { td(this, f); } }; function vd(a) { return x && Ra(9) && "number" === typeof a.timeout && void 0 !== a.ontimeout; } function qa(a) { return "content-type" == a.toLowerCase(); } g.xa = function () { "undefined" != typeof goog && this.a && (this.f = "Timed out after " + this.o + "ms, aborting", this.h = 8, this.dispatchEvent("timeout"), this.abort(8)); }; function td(a, b) { a.b = !1; a.a && (a.g = !0, a.a.abort(), a.g = !1); a.f = b; a.h = 5; wd(a); xd(a); } function wd(a) { a.u || (a.u = !0, a.dispatchEvent("complete"), a.dispatchEvent("error")); } g.abort = function (a) { this.a && this.b && (this.b = !1, this.g = !0, this.a.abort(), this.g = !1, this.h = a || 7, this.dispatchEvent("complete"), this.dispatchEvent("abort"), xd(this)); }; g.G = function () { this.a && (this.b && (this.b = !1, this.g = !0, this.a.abort(), this.g = !1), xd(this, !0)); X.S.G.call(this); }; g.za = function () { this.j || (this.A || this.l || this.g ? yd(this) : this.Ta()); }; g.Ta = function () { yd(this); }; function yd(a) { if (a.b && "undefined" != typeof goog && (!a.s[1] || 4 != N(a) || 2 != a.X())) if (a.l && 4 == N(a)) Jb(a.za, 0, a); else if (a.dispatchEvent("readystatechange"), 4 == N(a)) { a.b = !1; try { var b = a.X(); a: switch (b) { case 200: case 201: case 202: case 204: case 206: case 304: case 1223: var c = !0; break a; default: c = !1; } var d; if (!(d = c)) { var e; if (e = 0 === b) { var f = String(a.B).match(Nc)[1] || null; if (!f && k.self && k.self.location) { var h = k.self.location.protocol; f = h.substr(0, h.length - 1); } e = !rd.test(f ? f.toLowerCase() : ""); } d = e; } if (d) a.dispatchEvent("complete"), a.dispatchEvent("success"); else { a.h = 6; try { var m = 2 < N(a) ? a.a.statusText : ""; } catch (l) { m = ""; } a.f = m + " [" + a.X() + "]"; wd(a); } } finally { xd(a); } } } function xd(a, b) { if (a.a) { ud(a); var c = a.a, d = a.s[0] ? aa : null; a.a = null; a.s = null; b || a.dispatchEvent("ready"); try { c.onreadystatechange = d; } catch (e) { } } } function ud(a) { a.a && a.D && (a.a.ontimeout = null); a.m && (k.clearTimeout(a.m), a.m = null); } function N(a) { return a.a ? a.a.readyState : 0; } g.X = function () { try { return 2 < N(this) ? this.a.status : -1; } catch (a) { return -1; } }; g.$ = function () { try { return this.a ? this.a.responseText : ""; } catch (a) { return ""; } }; g.Na = function (a) { if (this.a) { var b = this.a.responseText; a && 0 == b.indexOf(a) && (b = b.substring(a.length)); return pd(b); } }; g.ua = function () { return this.h; }; g.Qa = function () { return "string" === typeof this.f ? this.f : String(this.f); }; function zd(a) { var b = ""; Aa(a, function (c, d) { b += d; b += ":"; b += c; b += "\r\n"; }); return b; } function Ad(a, b, c) { a: { for (d in c) { var d = !1; break a; } d = !0; } d || (c = zd(c), "string" === typeof a ? (null != c && encodeURIComponent(String(c))) : Q(a, b, c)); } function Bd(a, b, c) { return c && c.internalChannelParams ? c.internalChannelParams[a] || b : b; } function Cd(a) { this.pa = 0; this.g = []; this.c = new Pb; this.ga = this.la = this.B = this.fa = this.a = this.na = this.A = this.W = this.i = this.O = this.l = null; this.La = this.R = 0; this.Ia = Bd("failFast", !1, a); this.H = this.m = this.j = this.h = this.f = null; this.T = !0; this.I = this.oa = this.P = -1; this.U = this.o = this.u = 0; this.Fa = Bd("baseRetryDelayMs", 5E3, a); this.Ma = Bd("retryDelaySeedMs", 1E4, a); this.Ja = Bd("forwardChannelMaxRetries", 2, a); this.ma = Bd("forwardChannelRequestTimeoutMs", 2E4, a); this.Ka = a && a.g || void 0; this.D = void 0; this.C = a && a.supportsCrossDomainXhr || !1; this.J = ""; this.b = new gd(a && a.concurrentRequestLimit); this.ka = new ld; this.da = a && a.fastHandshake || !1; this.Ga = a && a.b || !1; a && a.f && (this.c.a = !1); a && a.forceLongPolling && (this.T = !1); this.V = !this.da && this.T && a && a.c || !1; this.ea = void 0; this.N = 0; this.F = !1; this.s = null; } g = Cd.prototype; g.ha = 8; g.v = 1; function Jc(a) { Dd(a); if (3 == a.v) { var b = a.R++, c = L(a.B); Q(c, "SID", a.J); Q(c, "RID", b); Q(c, "TYPE", "terminate"); Ed(a, c); b = new K(a, a.c, b, void 0); b.H = 2; b.i = lc(L(c)); c = !1; k.navigator && k.navigator.sendBeacon && (c = k.navigator.sendBeacon(b.i.toString(), "")); !c && k.Image && ((new Image).src = b.i, c = !0); c || (b.a = oc(b.g, null), b.a.ba(b.i)); b.u = q(); M(b); } Fd(a); } function Bc(a) { a.a && (xc(a), a.a.cancel(), a.a = null); } function Dd(a) { Bc(a); a.j && (k.clearTimeout(a.j), a.j = null); Ac(a); a.b.cancel(); a.h && ("number" === typeof a.h && k.clearTimeout(a.h), a.h = null); } function Gd(a, b) { a.g.push(new fd(a.La++, b)); 3 == a.v && Ic(a); } function Ic(a) { id(a.b) || a.h || (a.h = !0, Cb(a.Ba, a), a.u = 0); } function Hd(a, b) { if (Dc(a.b) >= a.b.f - (a.h ? 1 : 0)) return !1; if (a.h) return a.g = b.s.concat(a.g), !0; if (1 == a.v || 2 == a.v || a.u >= (a.Ia ? 0 : a.Ja)) return !1; a.h = I(p(a.Ba, a, b), Id(a, a.u)); a.u++; return !0; } g.Ba = function (a) { if (this.h) if (this.h = null, 1 == this.v) { if (!a) { this.R = Math.floor(1E5 * Math.random()); a = this.R++; var b = new K(this, this.c, a, void 0), c = this.l; this.O && (c ? (c = Ba(c), Da(c, this.O)) : c = this.O); null === this.i && (b.B = c); var d; if (this.da) a: { for (var e = d = 0; e < this.g.length; e++) { b: { var f = this.g[e]; if ("__data__" in f.a && (f = f.a.__data__, "string" === typeof f)) { f = f.length; break b; } f = void 0; } if (void 0 === f) break; d += f; if (4096 < d) { d = e; break a; } if (4096 === d || e === this.g.length - 1) { d = e + 1; break a; } } d = 1E3; } else d = 1E3; d = Jd(this, b, d); e = L(this.B); Q(e, "RID", a); Q(e, "CVER", 22); this.A && Q(e, "X-HTTP-Session-Id", this.A); Ed(this, e); this.i && c && Ad(e, this.i, c); Ec(this.b, b); this.Ga && Q(e, "TYPE", "init"); this.da ? (Q(e, "$req", d), Q(e, "SID", "null"), b.V = !0, kc(b, e, null)) : kc(b, e, d); this.v = 2; } } else 3 == this.v && (a ? Kd(this, a) : 0 == this.g.length || id(this.b) || Kd(this)); }; function Kd(a, b) { var c; b ? c = b.f : c = a.R++; var d = L(a.B); Q(d, "SID", a.J); Q(d, "RID", c); Q(d, "AID", a.P); Ed(a, d); a.i && a.l && Ad(d, a.i, a.l); c = new K(a, a.c, c, a.u + 1); null === a.i && (c.B = a.l); b && (a.g = b.s.concat(a.g)); b = Jd(a, c, 1E3); c.setTimeout(Math.round(.5 * a.ma) + Math.round(.5 * a.ma * Math.random())); Ec(a.b, c); kc(c, d, b); } function Ed(a, b) { a.f && Lc({}, function (c, d) { Q(b, d, c); }); } function Jd(a, b, c) { c = Math.min(a.g.length, c); var d = a.f ? p(a.f.Ha, a.f, a) : null; a: for (var e = a.g, f = -1;;) { var h = ["count=" + c]; -1 == f ? 0 < c ? (f = e[0].b, h.push("ofs=" + f)) : f = 0 : h.push("ofs=" + f); for (var m = !0, l = 0; l < c; l++) { var t = e[l].b, B = e[l].a; t -= f; if (0 > t) f = Math.max(0, e[l].b - 100), m = !1; else try { md(B, h, "req" + t + "_"); } catch (z) { d && d(B); } } if (m) { d = h.join("&"); break a; } } a = a.g.splice(0, c); b.s = a; return d; } function Hc(a) { a.a || a.j || (a.U = 1, Cb(a.Aa, a), a.o = 0); } function Cc(a) { if (a.a || a.j || 3 <= a.o) return !1; a.U++; a.j = I(p(a.Aa, a), Id(a, a.o)); a.o++; return !0; } g.Aa = function () { this.j = null; Ld(this); if (this.V && !(this.F || null == this.a || 0 >= this.N)) { var a = 2 * this.N; this.c.info("BP detection timer enabled: " + a); this.s = I(p(this.Sa, this), a); } }; g.Sa = function () { this.s && (this.s = null, this.c.info("BP detection timeout reached."), this.c.info("Buffering proxy detected and switch to long-polling!"), this.H = !1, this.F = !0, Bc(this), Ld(this)); }; function xc(a) { null != a.s && (k.clearTimeout(a.s), a.s = null); } function Ld(a) { a.a = new K(a, a.c, "rpc", a.U); null === a.i && (a.a.B = a.l); a.a.O = 0; var b = L(a.la); Q(b, "RID", "rpc"); Q(b, "SID", a.J); Q(b, "CI", a.H ? "0" : "1"); Q(b, "AID", a.P); Ed(a, b); Q(b, "TYPE", "xmlhttp"); a.i && a.l && Ad(b, a.i, a.l); a.D && a.a.setTimeout(a.D); var c = a.a; a = a.ga; c.H = 1; c.i = lc(L(b)); c.j = null; c.I = !0; mc(c, a); } g.Ra = function () { null != this.m && (this.m = null, Bc(this), Cc(this), H(19)); }; function Ac(a) { null != a.m && (k.clearTimeout(a.m), a.m = null); } function uc(a, b) { var c = null; if (a.a == b) { Ac(a); xc(a); a.a = null; var d = 2; } else if (zc(a.b, b)) c = b.s, Gc(a.b, b), d = 1; else return; a.I = b.N; if (0 != a.v) if (b.b) if (1 == d) { c = b.j ? b.j.length : 0; b = q() - b.u; var e = a.u; d = Vb(); d.dispatchEvent(new Yb(d, c, b, e)); Ic(a); } else Hc(a); else if (e = b.h, 3 == e || 0 == e && 0 < a.I || !(1 == d && Hd(a, b) || 2 == d && Cc(a))) switch (c && 0 < c.length && (b = a.b, b.c = b.c.concat(c)), e) { case 1: P(a, 5); break; case 4: P(a, 10); break; case 3: P(a, 6); break; default: P(a, 2); } } function Id(a, b) { var c = a.Fa + Math.floor(Math.random() * a.Ma); a.f || (c *= 2); return c * b; } function P(a, b) { a.c.info("Error code " + b); if (2 == b) { var c = null; a.f && (c = null); var d = p(a.Xa, a); c || (c = new T("//www.google.com/images/cleardot.gif"), k.location && "http" == k.location.protocol || Pc(c, "https"), lc(c)); nd(c.toString(), d); } else H(2); a.v = 0; a.f && a.f.ra(b); Fd(a); Dd(a); } g.Xa = function (a) { a ? (this.c.info("Successfully pinged google.com"), H(2)) : (this.c.info("Failed to ping google.com"), H(1)); }; function Fd(a) { a.v = 0; a.I = -1; if (a.f) { if (0 != jd(a.b).length || 0 != a.g.length) a.b.c.length = 0, sa(a.g), a.g.length = 0; a.f.qa(); } } function Fc(a, b, c) { var d = ad(c); if ("" != d.c) b && Qc(d, b + "." + d.c), Rc(d, d.h); else { var e = k.location; d = bd(e.protocol, b ? b + "." + e.hostname : e.hostname, +e.port, c); } a.W && Aa(a.W, function (f, h) { Q(d, h, f); }); b = a.A; c = a.na; b && c && Q(d, b, c); Q(d, "VER", a.ha); Ed(a, d); return d; } function oc(a, b) { if (b && !a.C) throw Error("Can't create secondary domain capable XhrIo object."); b = new X(a.Ka); b.F = a.C; return b; } function Md() { } g = Md.prototype; g.ta = function () { }; g.sa = function () { }; g.ra = function () { }; g.qa = function () { }; g.Ha = function () { }; function Nd() { if (x && !(10 <= Number(Ua))) throw Error("Environmental error: no available transport."); } Nd.prototype.a = function (a, b) { return new Y(a, b); }; function Y(a, b) { D.call(this); this.a = new Cd(b); this.l = a; this.b = b && b.messageUrlParams || null; a = b && b.messageHeaders || null; b && b.clientProtocolHeaderRequired && (a ? a["X-Client-Protocol"] = "webchannel" : a = { "X-Client-Protocol": "webchannel" }); this.a.l = a; a = b && b.initMessageHeaders || null; b && b.messageContentType && (a ? a["X-WebChannel-Content-Type"] = b.messageContentType : a = { "X-WebChannel-Content-Type": b.messageContentType }); b && b.a && (a ? a["X-WebChannel-Client-Profile"] = b.a : a = { "X-WebChannel-Client-Profile": b.a }); this.a.O = a; (a = b && b.httpHeadersOverwriteParam) && !ta(a) && (this.a.i = a); this.h = b && b.supportsCrossDomainXhr || !1; this.g = b && b.sendRawJson || !1; (b = b && b.httpSessionIdParam) && !ta(b) && (this.a.A = b, a = this.b, null !== a && b in a && (a = this.b, b in a && delete a[b])); this.f = new Z(this); } r(Y, D); g = Y.prototype; g.addEventListener = function (a, b, c, d) { Y.S.addEventListener.call(this, a, b, c, d); }; g.removeEventListener = function (a, b, c, d) { Y.S.removeEventListener.call(this, a, b, c, d); }; g.Oa = function () { this.a.f = this.f; this.h && (this.a.C = !0); var a = this.a, b = this.l, c = this.b || void 0; H(0); a.fa = b; a.W = c || {}; a.H = a.T; a.B = Fc(a, null, a.fa); Ic(a); }; g.close = function () { Jc(this.a); }; g.Pa = function (a) { if ("string" === typeof a) { var b = {}; b.__data__ = a; Gd(this.a, b); } else this.g ? (b = {}, b.__data__ = vb(a), Gd(this.a, b)) : Gd(this.a, a); }; g.G = function () { this.a.f = null; delete this.f; Jc(this.a); delete this.a; Y.S.G.call(this); }; function Od(a) { dc.call(this); var b = a.__sm__; if (b) { a: { for (var c in b) { a = c; break a; } a = void 0; } (this.c = a) ? (a = this.c, this.data = null !== b && a in b ? b[a] : void 0) : this.data = b; } else this.data = a; } r(Od, dc); function Pd() { ec.call(this); this.status = 1; } r(Pd, ec); function Z(a) { this.a = a; } r(Z, Md); Z.prototype.ta = function () { this.a.dispatchEvent("a"); }; Z.prototype.sa = function (a) { this.a.dispatchEvent(new Od(a)); }; Z.prototype.ra = function (a) { this.a.dispatchEvent(new Pd(a)); }; Z.prototype.qa = function () { this.a.dispatchEvent("b"); }; /* Copyright 2017 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ Nd.prototype.createWebChannel = Nd.prototype.a; Y.prototype.send = Y.prototype.Pa; Y.prototype.open = Y.prototype.Oa; Y.prototype.close = Y.prototype.close; Zb.NO_ERROR = 0; Zb.TIMEOUT = 8; Zb.HTTP_ERROR = 6; $b.COMPLETE = "complete"; cc.EventType = J; J.OPEN = "a"; J.CLOSE = "b"; J.ERROR = "c"; J.MESSAGE = "d"; D.prototype.listen = D.prototype.va; X.prototype.listenOnce = X.prototype.wa; X.prototype.getLastError = X.prototype.Qa; X.prototype.getLastErrorCode = X.prototype.ua; X.prototype.getStatus = X.prototype.X; X.prototype.getResponseJson = X.prototype.Na; X.prototype.getResponseText = X.prototype.$; X.prototype.send = X.prototype.ba; var createWebChannelTransport = function () { return new Nd; }; var ErrorCode = Zb; var EventType = $b; var WebChannel = cc; var XhrIo = X; var esm = { createWebChannelTransport: createWebChannelTransport, ErrorCode: ErrorCode, EventType: EventType, WebChannel: WebChannel, XhrIo: XhrIo }; /* harmony default export */ __webpack_exports__["default"] = (esm); //# sourceMappingURL=index.esm.js.map /* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__("./node_modules/webpack/buildin/global.js"))) /***/ }), /***/ "./node_modules/@ng-bootstrap/ng-bootstrap/accordion/accordion-config.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NgbAccordionConfig; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); /** * Configuration service for the NgbAccordion component. * You can inject this service, typically in your root component, and customize the values of its properties in * order to provide default values for all the accordions used in the application. */ var NgbAccordionConfig = (function () { function NgbAccordionConfig() { this.closeOthers = false; } NgbAccordionConfig.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Injectable"] }, ]; /** @nocollapse */ NgbAccordionConfig.ctorParameters = function () { return []; }; return NgbAccordionConfig; }()); //# sourceMappingURL=accordion-config.js.map /***/ }), /***/ "./node_modules/@ng-bootstrap/ng-bootstrap/accordion/accordion.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return NgbPanelTitle; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return NgbPanelContent; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return NgbPanel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NgbAccordion; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_util__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/util/util.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__accordion_config__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/accordion/accordion-config.js"); var nextId = 0; /** * This directive should be used to wrap accordion panel titles that need to contain HTML markup or other directives. */ var NgbPanelTitle = (function () { function NgbPanelTitle(templateRef) { this.templateRef = templateRef; } NgbPanelTitle.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: 'ng-template[ngbPanelTitle]' },] }, ]; /** @nocollapse */ NgbPanelTitle.ctorParameters = function () { return [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["TemplateRef"], }, ]; }; return NgbPanelTitle; }()); /** * This directive must be used to wrap accordion panel content. */ var NgbPanelContent = (function () { function NgbPanelContent(templateRef) { this.templateRef = templateRef; } NgbPanelContent.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: 'ng-template[ngbPanelContent]' },] }, ]; /** @nocollapse */ NgbPanelContent.ctorParameters = function () { return [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["TemplateRef"], }, ]; }; return NgbPanelContent; }()); /** * The NgbPanel directive represents an individual panel with the title and collapsible * content */ var NgbPanel = (function () { function NgbPanel() { /** * A flag determining whether the panel is disabled or not. * When disabled, the panel cannot be toggled. */ this.disabled = false; /** * An optional id for the panel. The id should be unique. * If not provided, it will be auto-generated. */ this.id = "ngb-panel-" + nextId++; /** * A flag telling if the panel is currently open */ this.isOpen = false; } NgbPanel.prototype.ngAfterContentChecked = function () { // We are using @ContentChildren instead of @ContantChild as in the Angular version being used // only @ContentChildren allows us to specify the {descendants: false} option. // Without {descendants: false} we are hitting bugs described in: // https://github.com/ng-bootstrap/ng-bootstrap/issues/2240 this.titleTpl = this.titleTpls.first; this.contentTpl = this.contentTpls.first; }; NgbPanel.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: 'ngb-panel' },] }, ]; /** @nocollapse */ NgbPanel.ctorParameters = function () { return []; }; NgbPanel.propDecorators = { "disabled": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "id": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "title": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "type": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "titleTpls": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ContentChildren"], args: [NgbPanelTitle, { descendants: false },] },], "contentTpls": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ContentChildren"], args: [NgbPanelContent, { descendants: false },] },], }; return NgbPanel; }()); /** * The NgbAccordion directive is a collection of panels. * It can assure that only one panel can be opened at a time. */ var NgbAccordion = (function () { function NgbAccordion(config) { /** * An array or comma separated strings of panel identifiers that should be opened */ this.activeIds = []; /** * Whether the closed panels should be hidden without destroying them */ this.destroyOnHide = true; /** * A panel change event fired right before the panel toggle happens. See NgbPanelChangeEvent for payload details */ this.panelChange = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); this.type = config.type; this.closeOtherPanels = config.closeOthers; } /** * Programmatically toggle a panel with a given id. */ /** * Programmatically toggle a panel with a given id. */ NgbAccordion.prototype.toggle = /** * Programmatically toggle a panel with a given id. */ function (panelId) { var panel = this.panels.find(function (p) { return p.id === panelId; }); if (panel && !panel.disabled) { var defaultPrevented_1 = false; this.panelChange.emit({ panelId: panelId, nextState: !panel.isOpen, preventDefault: function () { defaultPrevented_1 = true; } }); if (!defaultPrevented_1) { panel.isOpen = !panel.isOpen; if (this.closeOtherPanels) { this._closeOthers(panelId); } this._updateActiveIds(); } } }; NgbAccordion.prototype.ngAfterContentChecked = function () { var _this = this; // active id updates if (Object(__WEBPACK_IMPORTED_MODULE_1__util_util__["e" /* isString */])(this.activeIds)) { this.activeIds = this.activeIds.split(/\s*,\s*/); } // update panels open states this.panels.forEach(function (panel) { return panel.isOpen = !panel.disabled && _this.activeIds.indexOf(panel.id) > -1; }); // closeOthers updates if (this.activeIds.length > 1 && this.closeOtherPanels) { this._closeOthers(this.activeIds[0]); this._updateActiveIds(); } }; NgbAccordion.prototype._closeOthers = function (panelId) { this.panels.forEach(function (panel) { if (panel.id !== panelId) { panel.isOpen = false; } }); }; NgbAccordion.prototype._updateActiveIds = function () { this.activeIds = this.panels.filter(function (panel) { return panel.isOpen && !panel.disabled; }).map(function (panel) { return panel.id; }); }; NgbAccordion.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"], args: [{ selector: 'ngb-accordion', exportAs: 'ngbAccordion', host: { 'class': 'accordion', 'role': 'tablist', '[attr.aria-multiselectable]': '!closeOtherPanels' }, template: "\n <ng-template ngFor let-panel [ngForOf]=\"panels\">\n <div class=\"card\">\n <div role=\"tab\" id=\"{{panel.id}}-header\"\n [class]=\"'card-header ' + (panel.type ? 'bg-'+panel.type: type ? 'bg-'+type : '')\" [class.active]=\"panel.isOpen\">\n <a href (click)=\"!!toggle(panel.id)\" [class.text-muted]=\"panel.disabled\" [attr.tabindex]=\"(panel.disabled ? '-1' : null)\"\n [attr.aria-expanded]=\"panel.isOpen\" [attr.aria-controls]=\"(panel.isOpen ? panel.id : null)\"\n [attr.aria-disabled]=\"panel.disabled\">\n {{panel.title}}<ng-template [ngTemplateOutlet]=\"panel.titleTpl?.templateRef\"></ng-template>\n </a>\n </div>\n <div id=\"{{panel.id}}\" role=\"tabpanel\" [attr.aria-labelledby]=\"panel.id + '-header'\"\n class=\"card-body collapse {{panel.isOpen ? 'show' : null}}\" *ngIf=\"!destroyOnHide || panel.isOpen\">\n <ng-template [ngTemplateOutlet]=\"panel.contentTpl?.templateRef\"></ng-template>\n </div>\n </div>\n </ng-template>\n " },] }, ]; /** @nocollapse */ NgbAccordion.ctorParameters = function () { return [ { type: __WEBPACK_IMPORTED_MODULE_2__accordion_config__["a" /* NgbAccordionConfig */], }, ]; }; NgbAccordion.propDecorators = { "panels": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ContentChildren"], args: [NgbPanel,] },], "activeIds": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "closeOtherPanels": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"], args: ['closeOthers',] },], "destroyOnHide": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "type": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "panelChange": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"] },], }; return NgbAccordion; }()); //# sourceMappingURL=accordion.js.map /***/ }), /***/ "./node_modules/@ng-bootstrap/ng-bootstrap/accordion/accordion.module.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NgbAccordionModule; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_common__ = __webpack_require__("./node_modules/@angular/common/esm2015/common.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__accordion__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/accordion/accordion.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__accordion_config__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/accordion/accordion-config.js"); /* unused harmony reexport NgbAccordion */ /* unused harmony reexport NgbPanel */ /* unused harmony reexport NgbPanelTitle */ /* unused harmony reexport NgbPanelContent */ /* unused harmony reexport NgbAccordionConfig */ var NGB_ACCORDION_DIRECTIVES = [__WEBPACK_IMPORTED_MODULE_2__accordion__["a" /* NgbAccordion */], __WEBPACK_IMPORTED_MODULE_2__accordion__["b" /* NgbPanel */], __WEBPACK_IMPORTED_MODULE_2__accordion__["d" /* NgbPanelTitle */], __WEBPACK_IMPORTED_MODULE_2__accordion__["c" /* NgbPanelContent */]]; var NgbAccordionModule = (function () { function NgbAccordionModule() { } NgbAccordionModule.forRoot = function () { return { ngModule: NgbAccordionModule, providers: [__WEBPACK_IMPORTED_MODULE_3__accordion_config__["a" /* NgbAccordionConfig */]] }; }; NgbAccordionModule.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["NgModule"], args: [{ declarations: NGB_ACCORDION_DIRECTIVES, exports: NGB_ACCORDION_DIRECTIVES, imports: [__WEBPACK_IMPORTED_MODULE_1__angular_common__["CommonModule"]] },] }, ]; /** @nocollapse */ NgbAccordionModule.ctorParameters = function () { return []; }; return NgbAccordionModule; }()); //# sourceMappingURL=accordion.module.js.map /***/ }), /***/ "./node_modules/@ng-bootstrap/ng-bootstrap/alert/alert-config.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NgbAlertConfig; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); /** * Configuration service for the NgbAlert component. * You can inject this service, typically in your root component, and customize the values of its properties in * order to provide default values for all the alerts used in the application. */ var NgbAlertConfig = (function () { function NgbAlertConfig() { this.dismissible = true; this.type = 'warning'; } NgbAlertConfig.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Injectable"] }, ]; /** @nocollapse */ NgbAlertConfig.ctorParameters = function () { return []; }; return NgbAlertConfig; }()); //# sourceMappingURL=alert-config.js.map /***/ }), /***/ "./node_modules/@ng-bootstrap/ng-bootstrap/alert/alert.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NgbAlert; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__alert_config__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/alert/alert-config.js"); /** * Alerts can be used to provide feedback messages. */ var NgbAlert = (function () { function NgbAlert(config) { /** * An event emitted when the close button is clicked. This event has no payload. Only relevant for dismissible alerts. */ this.close = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); this.dismissible = config.dismissible; this.type = config.type; } NgbAlert.prototype.closeHandler = function () { this.close.emit(null); }; NgbAlert.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"], args: [{ selector: 'ngb-alert', changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectionStrategy"].OnPush, template: "\n <div [class]=\"'alert alert-' + type + (dismissible ? ' alert-dismissible' : '')\" role=\"alert\">\n <button *ngIf=\"dismissible\" type=\"button\" class=\"close\" aria-label=\"Close\" (click)=\"closeHandler()\">\n <span aria-hidden=\"true\">×</span>\n </button>\n <ng-content></ng-content>\n </div>\n " },] }, ]; /** @nocollapse */ NgbAlert.ctorParameters = function () { return [ { type: __WEBPACK_IMPORTED_MODULE_1__alert_config__["a" /* NgbAlertConfig */], }, ]; }; NgbAlert.propDecorators = { "dismissible": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "type": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "close": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"] },], }; return NgbAlert; }()); //# sourceMappingURL=alert.js.map /***/ }), /***/ "./node_modules/@ng-bootstrap/ng-bootstrap/alert/alert.module.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NgbAlertModule; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_common__ = __webpack_require__("./node_modules/@angular/common/esm2015/common.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__alert__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/alert/alert.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__alert_config__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/alert/alert-config.js"); /* unused harmony reexport NgbAlert */ /* unused harmony reexport NgbAlertConfig */ var NgbAlertModule = (function () { function NgbAlertModule() { } NgbAlertModule.forRoot = function () { return { ngModule: NgbAlertModule, providers: [__WEBPACK_IMPORTED_MODULE_3__alert_config__["a" /* NgbAlertConfig */]] }; }; NgbAlertModule.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["NgModule"], args: [{ declarations: [__WEBPACK_IMPORTED_MODULE_2__alert__["a" /* NgbAlert */]], exports: [__WEBPACK_IMPORTED_MODULE_2__alert__["a" /* NgbAlert */]], imports: [__WEBPACK_IMPORTED_MODULE_1__angular_common__["CommonModule"]], entryComponents: [__WEBPACK_IMPORTED_MODULE_2__alert__["a" /* NgbAlert */]] },] }, ]; /** @nocollapse */ NgbAlertModule.ctorParameters = function () { return []; }; return NgbAlertModule; }()); //# sourceMappingURL=alert.module.js.map /***/ }), /***/ "./node_modules/@ng-bootstrap/ng-bootstrap/buttons/buttons.module.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NgbButtonsModule; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__label__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/buttons/label.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__checkbox__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/buttons/checkbox.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__radio__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/buttons/radio.js"); /* unused harmony reexport NgbButtonLabel */ /* unused harmony reexport NgbCheckBox */ /* unused harmony reexport NgbRadio */ /* unused harmony reexport NgbRadioGroup */ var NGB_BUTTON_DIRECTIVES = [__WEBPACK_IMPORTED_MODULE_1__label__["a" /* NgbButtonLabel */], __WEBPACK_IMPORTED_MODULE_2__checkbox__["a" /* NgbCheckBox */], __WEBPACK_IMPORTED_MODULE_3__radio__["b" /* NgbRadioGroup */], __WEBPACK_IMPORTED_MODULE_3__radio__["a" /* NgbRadio */]]; var NgbButtonsModule = (function () { function NgbButtonsModule() { } NgbButtonsModule.forRoot = function () { return { ngModule: NgbButtonsModule, providers: [] }; }; NgbButtonsModule.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["NgModule"], args: [{ declarations: NGB_BUTTON_DIRECTIVES, exports: NGB_BUTTON_DIRECTIVES },] }, ]; /** @nocollapse */ NgbButtonsModule.ctorParameters = function () { return []; }; return NgbButtonsModule; }()); //# sourceMappingURL=buttons.module.js.map /***/ }), /***/ "./node_modules/@ng-bootstrap/ng-bootstrap/buttons/checkbox.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NgbCheckBox; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_forms__ = __webpack_require__("./node_modules/@angular/forms/esm2015/forms.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__label__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/buttons/label.js"); var NGB_CHECKBOX_VALUE_ACCESSOR = { provide: __WEBPACK_IMPORTED_MODULE_1__angular_forms__["NG_VALUE_ACCESSOR"], useExisting: Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["forwardRef"])(function () { return NgbCheckBox; }), multi: true }; /** * Easily create Bootstrap-style checkbox buttons. A value of a checked button is bound to a variable * specified via ngModel. */ var NgbCheckBox = (function () { function NgbCheckBox(_label) { this._label = _label; /** * A flag indicating if a given checkbox button is disabled. */ this.disabled = false; /** * Value to be propagated as model when the checkbox is checked. */ this.valueChecked = true; /** * Value to be propagated as model when the checkbox is unchecked. */ this.valueUnChecked = false; this.onChange = function (_) { }; this.onTouched = function () { }; } Object.defineProperty(NgbCheckBox.prototype, "focused", { set: function (isFocused) { this._label.focused = isFocused; if (!isFocused) { this.onTouched(); } }, enumerable: true, configurable: true }); NgbCheckBox.prototype.onInputChange = function ($event) { var modelToPropagate = $event.target.checked ? this.valueChecked : this.valueUnChecked; this.onChange(modelToPropagate); this.onTouched(); this.writeValue(modelToPropagate); }; NgbCheckBox.prototype.registerOnChange = function (fn) { this.onChange = fn; }; NgbCheckBox.prototype.registerOnTouched = function (fn) { this.onTouched = fn; }; NgbCheckBox.prototype.setDisabledState = function (isDisabled) { this.disabled = isDisabled; this._label.disabled = isDisabled; }; NgbCheckBox.prototype.writeValue = function (value) { this.checked = value === this.valueChecked; this._label.active = this.checked; }; NgbCheckBox.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: '[ngbButton][type=checkbox]', host: { 'autocomplete': 'off', '[checked]': 'checked', '[disabled]': 'disabled', '(change)': 'onInputChange($event)', '(focus)': 'focused = true', '(blur)': 'focused = false' }, providers: [NGB_CHECKBOX_VALUE_ACCESSOR] },] }, ]; /** @nocollapse */ NgbCheckBox.ctorParameters = function () { return [ { type: __WEBPACK_IMPORTED_MODULE_2__label__["a" /* NgbButtonLabel */], }, ]; }; NgbCheckBox.propDecorators = { "disabled": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "valueChecked": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "valueUnChecked": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], }; return NgbCheckBox; }()); //# sourceMappingURL=checkbox.js.map /***/ }), /***/ "./node_modules/@ng-bootstrap/ng-bootstrap/buttons/label.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NgbButtonLabel; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var NgbButtonLabel = (function () { function NgbButtonLabel() { } NgbButtonLabel.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: '[ngbButtonLabel]', host: { '[class.btn]': 'true', '[class.active]': 'active', '[class.disabled]': 'disabled', '[class.focus]': 'focused' } },] }, ]; /** @nocollapse */ NgbButtonLabel.ctorParameters = function () { return []; }; return NgbButtonLabel; }()); //# sourceMappingURL=label.js.map /***/ }), /***/ "./node_modules/@ng-bootstrap/ng-bootstrap/buttons/radio.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return NgbRadioGroup; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NgbRadio; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_forms__ = __webpack_require__("./node_modules/@angular/forms/esm2015/forms.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__label__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/buttons/label.js"); var NGB_RADIO_VALUE_ACCESSOR = { provide: __WEBPACK_IMPORTED_MODULE_1__angular_forms__["NG_VALUE_ACCESSOR"], useExisting: Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["forwardRef"])(function () { return NgbRadioGroup; }), multi: true }; var nextId = 0; /** * Easily create Bootstrap-style radio buttons. A value of a selected button is bound to a variable * specified via ngModel. */ var NgbRadioGroup = (function () { function NgbRadioGroup() { this._radios = new Set(); this._value = null; /** * The name of the group. Unless enclosed inputs specify a name, this name is used as the name of the * enclosed inputs. If not specified, a name is generated automatically. */ this.name = "ngb-radio-" + nextId++; this.onChange = function (_) { }; this.onTouched = function () { }; } Object.defineProperty(NgbRadioGroup.prototype, "disabled", { get: function () { return this._disabled; }, set: function (isDisabled) { this.setDisabledState(isDisabled); }, enumerable: true, configurable: true }); NgbRadioGroup.prototype.onRadioChange = function (radio) { this.writeValue(radio.value); this.onChange(radio.value); }; NgbRadioGroup.prototype.onRadioValueUpdate = function () { this._updateRadiosValue(); }; NgbRadioGroup.prototype.register = function (radio) { this._radios.add(radio); }; NgbRadioGroup.prototype.registerOnChange = function (fn) { this.onChange = fn; }; NgbRadioGroup.prototype.registerOnTouched = function (fn) { this.onTouched = fn; }; NgbRadioGroup.prototype.setDisabledState = function (isDisabled) { this._disabled = isDisabled; this._updateRadiosDisabled(); }; NgbRadioGroup.prototype.unregister = function (radio) { this._radios.delete(radio); }; NgbRadioGroup.prototype.writeValue = function (value) { this._value = value; this._updateRadiosValue(); }; NgbRadioGroup.prototype._updateRadiosValue = function () { var _this = this; this._radios.forEach(function (radio) { return radio.updateValue(_this._value); }); }; NgbRadioGroup.prototype._updateRadiosDisabled = function () { this._radios.forEach(function (radio) { return radio.updateDisabled(); }); }; NgbRadioGroup.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: '[ngbRadioGroup]', host: { 'role': 'group' }, providers: [NGB_RADIO_VALUE_ACCESSOR] },] }, ]; /** @nocollapse */ NgbRadioGroup.ctorParameters = function () { return []; }; NgbRadioGroup.propDecorators = { "name": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], }; return NgbRadioGroup; }()); /** * Marks an input of type "radio" as part of the NgbRadioGroup. */ var NgbRadio = (function () { function NgbRadio(_group, _label, _renderer, _element) { this._group = _group; this._label = _label; this._renderer = _renderer; this._element = _element; this._value = null; this._group.register(this); } Object.defineProperty(NgbRadio.prototype, "value", { get: function () { return this._value; }, set: /** * You can specify model value of a given radio by binding to the value property. */ function (value) { this._value = value; var stringValue = value ? value.toString() : ''; this._renderer.setProperty(this._element.nativeElement, 'value', stringValue); this._group.onRadioValueUpdate(); }, enumerable: true, configurable: true }); Object.defineProperty(NgbRadio.prototype, "disabled", { get: function () { return this._group.disabled || this._disabled; }, set: /** * A flag indicating if a given radio button is disabled. */ function (isDisabled) { this._disabled = isDisabled !== false; this.updateDisabled(); }, enumerable: true, configurable: true }); Object.defineProperty(NgbRadio.prototype, "focused", { set: function (isFocused) { if (this._label) { this._label.focused = isFocused; } if (!isFocused) { this._group.onTouched(); } }, enumerable: true, configurable: true }); Object.defineProperty(NgbRadio.prototype, "checked", { get: function () { return this._checked; }, enumerable: true, configurable: true }); Object.defineProperty(NgbRadio.prototype, "nameAttr", { get: function () { return this.name || this._group.name; }, enumerable: true, configurable: true }); NgbRadio.prototype.ngOnDestroy = function () { this._group.unregister(this); }; NgbRadio.prototype.onChange = function () { this._group.onRadioChange(this); }; NgbRadio.prototype.updateValue = function (value) { this._checked = this.value === value; this._label.active = this._checked; }; NgbRadio.prototype.updateDisabled = function () { this._label.disabled = this.disabled; }; NgbRadio.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: '[ngbButton][type=radio]', host: { '[checked]': 'checked', '[disabled]': 'disabled', '[name]': 'nameAttr', '(change)': 'onChange()', '(focus)': 'focused = true', '(blur)': 'focused = false' } },] }, ]; /** @nocollapse */ NgbRadio.ctorParameters = function () { return [ { type: NgbRadioGroup, }, { type: __WEBPACK_IMPORTED_MODULE_2__label__["a" /* NgbButtonLabel */], }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Renderer2"], }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ElementRef"], }, ]; }; NgbRadio.propDecorators = { "name": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "value": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"], args: ['value',] },], "disabled": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"], args: ['disabled',] },], }; return NgbRadio; }()); //# sourceMappingURL=radio.js.map /***/ }), /***/ "./node_modules/@ng-bootstrap/ng-bootstrap/carousel/carousel-config.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NgbCarouselConfig; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); /** * Configuration service for the NgbCarousel component. * You can inject this service, typically in your root component, and customize the values of its properties in * order to provide default values for all the carousels used in the application. */ var NgbCarouselConfig = (function () { function NgbCarouselConfig() { this.interval = 5000; this.wrap = true; this.keyboard = true; } NgbCarouselConfig.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Injectable"] }, ]; /** @nocollapse */ NgbCarouselConfig.ctorParameters = function () { return []; }; return NgbCarouselConfig; }()); //# sourceMappingURL=carousel-config.js.map /***/ }), /***/ "./node_modules/@ng-bootstrap/ng-bootstrap/carousel/carousel.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export NgbSlide */ /* unused harmony export NgbCarousel */ /* unused harmony export NgbSlideEventDirection */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NGB_CAROUSEL_DIRECTIVES; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__carousel_config__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/carousel/carousel-config.js"); var nextId = 0; /** * Represents an individual slide to be used within a carousel. */ var NgbSlide = (function () { function NgbSlide(tplRef) { this.tplRef = tplRef; /** * Unique slide identifier. Must be unique for the entire document for proper accessibility support. * Will be auto-generated if not provided. */ this.id = "ngb-slide-" + nextId++; } NgbSlide.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: 'ng-template[ngbSlide]' },] }, ]; /** @nocollapse */ NgbSlide.ctorParameters = function () { return [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["TemplateRef"], }, ]; }; NgbSlide.propDecorators = { "id": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], }; return NgbSlide; }()); /** * Directive to easily create carousels based on Bootstrap's markup. */ var NgbCarousel = (function () { function NgbCarousel(config) { /** * A carousel slide event fired when the slide transition is completed. * See NgbSlideEvent for payload details */ this.slide = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); this.interval = config.interval; this.wrap = config.wrap; this.keyboard = config.keyboard; } NgbCarousel.prototype.ngAfterContentChecked = function () { var activeSlide = this._getSlideById(this.activeId); this.activeId = activeSlide ? activeSlide.id : (this.slides.length ? this.slides.first.id : null); }; NgbCarousel.prototype.ngOnInit = function () { this._startTimer(); }; NgbCarousel.prototype.ngOnChanges = function (changes) { if ('interval' in changes && !changes['interval'].isFirstChange()) { this._restartTimer(); } }; NgbCarousel.prototype.ngOnDestroy = function () { clearInterval(this._slideChangeInterval); }; /** * Navigate to a slide with the specified identifier. */ /** * Navigate to a slide with the specified identifier. */ NgbCarousel.prototype.select = /** * Navigate to a slide with the specified identifier. */ function (slideId) { this.cycleToSelected(slideId, this.getSlideEventDirection(this.activeId, slideId)); this._restartTimer(); }; /** * Navigate to the next slide. */ /** * Navigate to the next slide. */ NgbCarousel.prototype.prev = /** * Navigate to the next slide. */ function () { this.cycleToPrev(); this._restartTimer(); }; /** * Navigate to the next slide. */ /** * Navigate to the next slide. */ NgbCarousel.prototype.next = /** * Navigate to the next slide. */ function () { this.cycleToNext(); this._restartTimer(); }; /** * Stops the carousel from cycling through items. */ /** * Stops the carousel from cycling through items. */ NgbCarousel.prototype.pause = /** * Stops the carousel from cycling through items. */ function () { this._stopTimer(); }; /** * Restarts cycling through the carousel slides from left to right. */ /** * Restarts cycling through the carousel slides from left to right. */ NgbCarousel.prototype.cycle = /** * Restarts cycling through the carousel slides from left to right. */ function () { this._startTimer(); }; NgbCarousel.prototype.cycleToNext = function () { this.cycleToSelected(this._getNextSlide(this.activeId), NgbSlideEventDirection.LEFT); }; NgbCarousel.prototype.cycleToPrev = function () { this.cycleToSelected(this._getPrevSlide(this.activeId), NgbSlideEventDirection.RIGHT); }; NgbCarousel.prototype.cycleToSelected = function (slideIdx, direction) { var selectedSlide = this._getSlideById(slideIdx); if (selectedSlide) { if (selectedSlide.id !== this.activeId) { this.slide.emit({ prev: this.activeId, current: selectedSlide.id, direction: direction }); } this.activeId = selectedSlide.id; } }; NgbCarousel.prototype.getSlideEventDirection = function (currentActiveSlideId, nextActiveSlideId) { var currentActiveSlideIdx = this._getSlideIdxById(currentActiveSlideId); var nextActiveSlideIdx = this._getSlideIdxById(nextActiveSlideId); return currentActiveSlideIdx > nextActiveSlideIdx ? NgbSlideEventDirection.RIGHT : NgbSlideEventDirection.LEFT; }; NgbCarousel.prototype.keyPrev = function () { if (this.keyboard) { this.prev(); } }; NgbCarousel.prototype.keyNext = function () { if (this.keyboard) { this.next(); } }; NgbCarousel.prototype._restartTimer = function () { this._stopTimer(); this._startTimer(); }; NgbCarousel.prototype._startTimer = function () { var _this = this; if (this.interval > 0) { this._slideChangeInterval = setInterval(function () { _this.cycleToNext(); }, this.interval); } }; NgbCarousel.prototype._stopTimer = function () { clearInterval(this._slideChangeInterval); }; NgbCarousel.prototype._getSlideById = function (slideId) { var slideWithId = this.slides.filter(function (slide) { return slide.id === slideId; }); return slideWithId.length ? slideWithId[0] : null; }; NgbCarousel.prototype._getSlideIdxById = function (slideId) { return this.slides.toArray().indexOf(this._getSlideById(slideId)); }; NgbCarousel.prototype._getNextSlide = function (currentSlideId) { var slideArr = this.slides.toArray(); var currentSlideIdx = this._getSlideIdxById(currentSlideId); var isLastSlide = currentSlideIdx === slideArr.length - 1; return isLastSlide ? (this.wrap ? slideArr[0].id : slideArr[slideArr.length - 1].id) : slideArr[currentSlideIdx + 1].id; }; NgbCarousel.prototype._getPrevSlide = function (currentSlideId) { var slideArr = this.slides.toArray(); var currentSlideIdx = this._getSlideIdxById(currentSlideId); var isFirstSlide = currentSlideIdx === 0; return isFirstSlide ? (this.wrap ? slideArr[slideArr.length - 1].id : slideArr[0].id) : slideArr[currentSlideIdx - 1].id; }; NgbCarousel.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"], args: [{ selector: 'ngb-carousel', exportAs: 'ngbCarousel', host: { 'class': 'carousel slide', '[style.display]': '"block"', 'tabIndex': '0', '(mouseenter)': 'pause()', '(mouseleave)': 'cycle()', '(keydown.arrowLeft)': 'keyPrev()', '(keydown.arrowRight)': 'keyNext()' }, template: "\n <ol class=\"carousel-indicators\">\n <li *ngFor=\"let slide of slides\" [id]=\"slide.id\" [class.active]=\"slide.id === activeId\"\n (click)=\"cycleToSelected(slide.id, getSlideEventDirection(activeId, slide.id))\"></li>\n </ol>\n <div class=\"carousel-inner\">\n <div *ngFor=\"let slide of slides\" class=\"carousel-item\" [class.active]=\"slide.id === activeId\">\n <ng-template [ngTemplateOutlet]=\"slide.tplRef\"></ng-template>\n </div>\n </div>\n <a class=\"carousel-control-prev\" role=\"button\" (click)=\"cycleToPrev()\">\n <span class=\"carousel-control-prev-icon\" aria-hidden=\"true\"></span>\n <span class=\"sr-only\">Previous</span>\n </a>\n <a class=\"carousel-control-next\" role=\"button\" (click)=\"cycleToNext()\">\n <span class=\"carousel-control-next-icon\" aria-hidden=\"true\"></span>\n <span class=\"sr-only\">Next</span>\n </a>\n " },] }, ]; /** @nocollapse */ NgbCarousel.ctorParameters = function () { return [ { type: __WEBPACK_IMPORTED_MODULE_1__carousel_config__["a" /* NgbCarouselConfig */], }, ]; }; NgbCarousel.propDecorators = { "slides": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ContentChildren"], args: [NgbSlide,] },], "interval": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "wrap": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "keyboard": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "activeId": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "slide": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"] },], }; return NgbCarousel; }()); /** * Enum to define the carousel slide event direction */ /** * Enum to define the carousel slide event direction */ var NgbSlideEventDirection; /** * Enum to define the carousel slide event direction */ (function (NgbSlideEventDirection) { NgbSlideEventDirection[NgbSlideEventDirection["LEFT"] = 'left'] = "LEFT"; NgbSlideEventDirection[NgbSlideEventDirection["RIGHT"] = 'right'] = "RIGHT"; })(NgbSlideEventDirection || (NgbSlideEventDirection = {})); var NGB_CAROUSEL_DIRECTIVES = [NgbCarousel, NgbSlide]; //# sourceMappingURL=carousel.js.map /***/ }), /***/ "./node_modules/@ng-bootstrap/ng-bootstrap/carousel/carousel.module.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NgbCarouselModule; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_common__ = __webpack_require__("./node_modules/@angular/common/esm2015/common.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__carousel__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/carousel/carousel.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__carousel_config__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/carousel/carousel-config.js"); /* unused harmony reexport NgbCarousel */ /* unused harmony reexport NgbSlide */ /* unused harmony reexport NgbCarouselConfig */ var NgbCarouselModule = (function () { function NgbCarouselModule() { } NgbCarouselModule.forRoot = function () { return { ngModule: NgbCarouselModule, providers: [__WEBPACK_IMPORTED_MODULE_3__carousel_config__["a" /* NgbCarouselConfig */]] }; }; NgbCarouselModule.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["NgModule"], args: [{ declarations: __WEBPACK_IMPORTED_MODULE_2__carousel__["a" /* NGB_CAROUSEL_DIRECTIVES */], exports: __WEBPACK_IMPORTED_MODULE_2__carousel__["a" /* NGB_CAROUSEL_DIRECTIVES */], imports: [__WEBPACK_IMPORTED_MODULE_1__angular_common__["CommonModule"]] },] }, ]; /** @nocollapse */ NgbCarouselModule.ctorParameters = function () { return []; }; return NgbCarouselModule; }()); //# sourceMappingURL=carousel.module.js.map /***/ }), /***/ "./node_modules/@ng-bootstrap/ng-bootstrap/collapse/collapse.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NgbCollapse; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); /** * The NgbCollapse directive provides a simple way to hide and show an element with animations. */ var NgbCollapse = (function () { function NgbCollapse() { /** * A flag indicating collapsed (true) or open (false) state. */ this.collapsed = false; } NgbCollapse.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: '[ngbCollapse]', exportAs: 'ngbCollapse', host: { '[class.collapse]': 'true', '[class.show]': '!collapsed' } },] }, ]; /** @nocollapse */ NgbCollapse.ctorParameters = function () { return []; }; NgbCollapse.propDecorators = { "collapsed": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"], args: ['ngbCollapse',] },], }; return NgbCollapse; }()); //# sourceMappingURL=collapse.js.map /***/ }), /***/ "./node_modules/@ng-bootstrap/ng-bootstrap/collapse/collapse.module.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NgbCollapseModule; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__collapse__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/collapse/collapse.js"); /* unused harmony reexport NgbCollapse */ var NgbCollapseModule = (function () { function NgbCollapseModule() { } NgbCollapseModule.forRoot = function () { return { ngModule: NgbCollapseModule, providers: [] }; }; NgbCollapseModule.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["NgModule"], args: [{ declarations: [__WEBPACK_IMPORTED_MODULE_1__collapse__["a" /* NgbCollapse */]], exports: [__WEBPACK_IMPORTED_MODULE_1__collapse__["a" /* NgbCollapse */]] },] }, ]; /** @nocollapse */ NgbCollapseModule.ctorParameters = function () { return []; }; return NgbCollapseModule; }()); //# sourceMappingURL=collapse.module.js.map /***/ }), /***/ "./node_modules/@ng-bootstrap/ng-bootstrap/datepicker/datepicker-config.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NgbDatepickerConfig; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); /** * Configuration service for the NgbDatepicker component. * You can inject this service, typically in your root component, and customize the values of its properties in * order to provide default values for all the datepickers used in the application. */ var NgbDatepickerConfig = (function () { function NgbDatepickerConfig() { this.displayMonths = 1; this.firstDayOfWeek = 1; this.navigation = 'select'; this.outsideDays = 'visible'; this.showWeekdays = true; this.showWeekNumbers = false; } NgbDatepickerConfig.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Injectable"] }, ]; /** @nocollapse */ NgbDatepickerConfig.ctorParameters = function () { return []; }; return NgbDatepickerConfig; }()); //# sourceMappingURL=datepicker-config.js.map /***/ }), /***/ "./node_modules/@ng-bootstrap/ng-bootstrap/datepicker/datepicker-day-view.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NgbDatepickerDayView; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var NgbDatepickerDayView = (function () { function NgbDatepickerDayView() { } NgbDatepickerDayView.prototype.isMuted = function () { return !this.selected && (this.date.month !== this.currentMonth || this.disabled); }; NgbDatepickerDayView.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"], args: [{ selector: '[ngbDatepickerDayView]', changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectionStrategy"].OnPush, styles: ["\n :host {\n text-align: center;\n width: 2rem;\n height: 2rem;\n line-height: 2rem;\n border-radius: 0.25rem;\n background: transparent;\n }\n :host.outside {\n opacity: 0.5;\n }\n "], host: { 'class': 'btn-light', '[class.bg-primary]': 'selected', '[class.text-white]': 'selected', '[class.text-muted]': 'isMuted()', '[class.outside]': 'isMuted()', '[class.active]': 'focused' }, template: "{{ date.day }}" },] }, ]; /** @nocollapse */ NgbDatepickerDayView.ctorParameters = function () { return []; }; NgbDatepickerDayView.propDecorators = { "currentMonth": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "date": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "disabled": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "focused": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "selected": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], }; return NgbDatepickerDayView; }()); //# sourceMappingURL=datepicker-day-view.js.map /***/ }), /***/ "./node_modules/@ng-bootstrap/ng-bootstrap/datepicker/datepicker-i18n.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NgbDatepickerI18n; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return NgbDatepickerI18nDefault; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var WEEKDAYS_SHORT = ['Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa', 'Su']; var MONTHS_SHORT = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']; var MONTHS_FULL = [ 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' ]; /** * Type of the service supplying month and weekday names to to NgbDatepicker component. * See the i18n demo for how to extend this class and define a custom provider for i18n. */ var NgbDatepickerI18n = (function () { function NgbDatepickerI18n() { } NgbDatepickerI18n.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Injectable"] }, ]; /** @nocollapse */ NgbDatepickerI18n.ctorParameters = function () { return []; }; return NgbDatepickerI18n; }()); var NgbDatepickerI18nDefault = (function (_super) { __extends(NgbDatepickerI18nDefault, _super); function NgbDatepickerI18nDefault() { return _super !== null && _super.apply(this, arguments) || this; } NgbDatepickerI18nDefault.prototype.getWeekdayShortName = function (weekday) { return WEEKDAYS_SHORT[weekday - 1]; }; NgbDatepickerI18nDefault.prototype.getMonthShortName = function (month) { return MONTHS_SHORT[month - 1]; }; NgbDatepickerI18nDefault.prototype.getMonthFullName = function (month) { return MONTHS_FULL[month - 1]; }; NgbDatepickerI18nDefault.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Injectable"] }, ]; /** @nocollapse */ NgbDatepickerI18nDefault.ctorParameters = function () { return []; }; return NgbDatepickerI18nDefault; }(NgbDatepickerI18n)); //# sourceMappingURL=datepicker-i18n.js.map /***/ }), /***/ "./node_modules/@ng-bootstrap/ng-bootstrap/datepicker/datepicker-input.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NgbInputDatepicker; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_forms__ = __webpack_require__("./node_modules/@angular/forms/esm2015/forms.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__ngb_date__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/datepicker/ngb-date.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__datepicker__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/datepicker/datepicker.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__ngb_date_parser_formatter__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/datepicker/ngb-date-parser-formatter.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__util_positioning__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/util/positioning.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__ngb_date_adapter__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/datepicker/ngb-date-adapter.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__ngb_calendar__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/datepicker/ngb-calendar.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__datepicker_service__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/datepicker/datepicker-service.js"); var NGB_DATEPICKER_VALUE_ACCESSOR = { provide: __WEBPACK_IMPORTED_MODULE_1__angular_forms__["NG_VALUE_ACCESSOR"], useExisting: Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["forwardRef"])(function () { return NgbInputDatepicker; }), multi: true }; var NGB_DATEPICKER_VALIDATOR = { provide: __WEBPACK_IMPORTED_MODULE_1__angular_forms__["NG_VALIDATORS"], useExisting: Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["forwardRef"])(function () { return NgbInputDatepicker; }), multi: true }; /** * A directive that makes it possible to have datepickers on input fields. * Manages integration with the input field itself (data entry) and ngModel (validation etc.). */ var NgbInputDatepicker = (function () { function NgbInputDatepicker(_parserFormatter, _elRef, _vcRef, _renderer, _cfr, ngZone, _service, _calendar, _ngbDateAdapter) { var _this = this; this._parserFormatter = _parserFormatter; this._elRef = _elRef; this._vcRef = _vcRef; this._renderer = _renderer; this._cfr = _cfr; this._service = _service; this._calendar = _calendar; this._ngbDateAdapter = _ngbDateAdapter; this._cRef = null; this._disabled = false; /** * Indicates whether the datepicker popup should be closed automatically after date selection or not. * If the value is 'false', the popup can be closed via 'close()' or 'toggle()' methods. * * @since 1.1.0 */ this.autoClose = true; /** * Placement of a datepicker popup accepts: * "top", "top-left", "top-right", "bottom", "bottom-left", "bottom-right", * "left", "left-top", "left-bottom", "right", "right-top", "right-bottom" * and array of above values. */ this.placement = 'bottom-left'; /** * An event fired when user selects a date using keyboard or mouse. * The payload of the event is currently selected NgbDateStruct. * * @since 1.1.1 */ this.dateSelect = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); /** * An event fired when navigation happens and currently displayed month changes. * See NgbDatepickerNavigateEvent for the payload info. */ this.navigate = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); this._onChange = function (_) { }; this._onTouched = function () { }; this._validatorChange = function () { }; this._zoneSubscription = ngZone.onStable.subscribe(function () { if (_this._cRef) { Object(__WEBPACK_IMPORTED_MODULE_5__util_positioning__["a" /* positionElements */])(_this._elRef.nativeElement, _this._cRef.location.nativeElement, _this.placement, _this.container === 'body'); } }); } Object.defineProperty(NgbInputDatepicker.prototype, "disabled", { get: function () { return this._disabled; }, set: function (value) { this._disabled = value === '' || (value && value !== 'false'); if (this.isOpen()) { this._cRef.instance.setDisabledState(this._disabled); } }, enumerable: true, configurable: true }); NgbInputDatepicker.prototype.registerOnChange = function (fn) { this._onChange = fn; }; NgbInputDatepicker.prototype.registerOnTouched = function (fn) { this._onTouched = fn; }; NgbInputDatepicker.prototype.registerOnValidatorChange = function (fn) { this._validatorChange = fn; }; ; NgbInputDatepicker.prototype.setDisabledState = function (isDisabled) { this.disabled = isDisabled; }; NgbInputDatepicker.prototype.validate = function (c) { var value = c.value; if (value === null || value === undefined) { return null; } var ngbDate = this._fromDateStruct(this._ngbDateAdapter.fromModel(value)); if (!this._calendar.isValid(ngbDate)) { return { 'ngbDate': { invalid: c.value } }; } if (this.minDate && ngbDate.before(__WEBPACK_IMPORTED_MODULE_2__ngb_date__["a" /* NgbDate */].from(this.minDate))) { return { 'ngbDate': { requiredBefore: this.minDate } }; } if (this.maxDate && ngbDate.after(__WEBPACK_IMPORTED_MODULE_2__ngb_date__["a" /* NgbDate */].from(this.maxDate))) { return { 'ngbDate': { requiredAfter: this.maxDate } }; } }; NgbInputDatepicker.prototype.writeValue = function (value) { this._model = this._fromDateStruct(this._ngbDateAdapter.fromModel(value)); this._writeModelValue(this._model); }; NgbInputDatepicker.prototype.manualDateChange = function (value, updateView) { if (updateView === void 0) { updateView = false; } this._model = this._fromDateStruct(this._parserFormatter.parse(value)); this._onChange(this._model ? this._ngbDateAdapter.toModel(this._model) : (value === '' ? null : value)); if (updateView && this._model) { this._writeModelValue(this._model); } }; NgbInputDatepicker.prototype.isOpen = function () { return !!this._cRef; }; /** * Opens the datepicker with the selected date indicated by the ngModel value. */ /** * Opens the datepicker with the selected date indicated by the ngModel value. */ NgbInputDatepicker.prototype.open = /** * Opens the datepicker with the selected date indicated by the ngModel value. */ function () { var _this = this; if (!this.isOpen()) { var cf = this._cfr.resolveComponentFactory(__WEBPACK_IMPORTED_MODULE_3__datepicker__["a" /* NgbDatepicker */]); this._cRef = this._vcRef.createComponent(cf); this._applyPopupStyling(this._cRef.location.nativeElement); this._applyDatepickerInputs(this._cRef.instance); this._subscribeForDatepickerOutputs(this._cRef.instance); this._cRef.instance.ngOnInit(); this._cRef.instance.writeValue(this._ngbDateAdapter.toModel(this._model)); // date selection event handling this._cRef.instance.registerOnChange(function (selectedDate) { _this.writeValue(selectedDate); _this._onChange(selectedDate); }); // focus handling this._cRef.instance.focus(); this._cRef.instance.setDisabledState(this.disabled); if (this.container === 'body') { window.document.querySelector(this.container).appendChild(this._cRef.location.nativeElement); } } }; /** * Closes the datepicker popup. */ /** * Closes the datepicker popup. */ NgbInputDatepicker.prototype.close = /** * Closes the datepicker popup. */ function () { if (this.isOpen()) { this._vcRef.remove(this._vcRef.indexOf(this._cRef.hostView)); this._cRef = null; } }; /** * Toggles the datepicker popup (opens when closed and closes when opened). */ /** * Toggles the datepicker popup (opens when closed and closes when opened). */ NgbInputDatepicker.prototype.toggle = /** * Toggles the datepicker popup (opens when closed and closes when opened). */ function () { if (this.isOpen()) { this.close(); } else { this.open(); } }; /** * Navigates current view to provided date. * With default calendar we use ISO 8601: 'month' is 1=Jan ... 12=Dec. * If nothing or invalid date provided calendar will open current month. * Use 'startDate' input as an alternative */ /** * Navigates current view to provided date. * With default calendar we use ISO 8601: 'month' is 1=Jan ... 12=Dec. * If nothing or invalid date provided calendar will open current month. * Use 'startDate' input as an alternative */ NgbInputDatepicker.prototype.navigateTo = /** * Navigates current view to provided date. * With default calendar we use ISO 8601: 'month' is 1=Jan ... 12=Dec. * If nothing or invalid date provided calendar will open current month. * Use 'startDate' input as an alternative */ function (date) { if (this.isOpen()) { this._cRef.instance.navigateTo(date); } }; NgbInputDatepicker.prototype.onBlur = function () { this._onTouched(); }; NgbInputDatepicker.prototype.ngOnChanges = function (changes) { if (changes['minDate'] || changes['maxDate']) { this._validatorChange(); } }; NgbInputDatepicker.prototype.ngOnDestroy = function () { this.close(); this._zoneSubscription.unsubscribe(); }; NgbInputDatepicker.prototype._applyDatepickerInputs = function (datepickerInstance) { var _this = this; ['dayTemplate', 'displayMonths', 'firstDayOfWeek', 'markDisabled', 'minDate', 'maxDate', 'navigation', 'outsideDays', 'showNavigation', 'showWeekdays', 'showWeekNumbers'] .forEach(function (optionName) { if (_this[optionName] !== undefined) { datepickerInstance[optionName] = _this[optionName]; } }); datepickerInstance.startDate = this.startDate || this._model; }; NgbInputDatepicker.prototype._applyPopupStyling = function (nativeElement) { this._renderer.addClass(nativeElement, 'dropdown-menu'); this._renderer.setStyle(nativeElement, 'padding', '0'); this._renderer.addClass(nativeElement, 'show'); }; NgbInputDatepicker.prototype._subscribeForDatepickerOutputs = function (datepickerInstance) { var _this = this; datepickerInstance.navigate.subscribe(function (date) { return _this.navigate.emit(date); }); datepickerInstance.select.subscribe(function (date) { _this.dateSelect.emit(date); if (_this.autoClose) { _this.close(); } }); }; NgbInputDatepicker.prototype._writeModelValue = function (model) { this._renderer.setProperty(this._elRef.nativeElement, 'value', this._parserFormatter.format(model)); if (this.isOpen()) { this._cRef.instance.writeValue(this._ngbDateAdapter.toModel(model)); this._onTouched(); } }; NgbInputDatepicker.prototype._fromDateStruct = function (date) { var ngbDate = date ? new __WEBPACK_IMPORTED_MODULE_2__ngb_date__["a" /* NgbDate */](date.year, date.month, date.day) : null; return this._calendar.isValid(ngbDate) ? ngbDate : null; }; NgbInputDatepicker.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: 'input[ngbDatepicker]', exportAs: 'ngbDatepicker', host: { '(input)': 'manualDateChange($event.target.value)', '(change)': 'manualDateChange($event.target.value, true)', '(keyup.esc)': 'close()', '(blur)': 'onBlur()', '[disabled]': 'disabled' }, providers: [NGB_DATEPICKER_VALUE_ACCESSOR, NGB_DATEPICKER_VALIDATOR, __WEBPACK_IMPORTED_MODULE_8__datepicker_service__["a" /* NgbDatepickerService */]] },] }, ]; /** @nocollapse */ NgbInputDatepicker.ctorParameters = function () { return [ { type: __WEBPACK_IMPORTED_MODULE_4__ngb_date_parser_formatter__["b" /* NgbDateParserFormatter */], }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ElementRef"], }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ViewContainerRef"], }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Renderer2"], }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ComponentFactoryResolver"], }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["NgZone"], }, { type: __WEBPACK_IMPORTED_MODULE_8__datepicker_service__["a" /* NgbDatepickerService */], }, { type: __WEBPACK_IMPORTED_MODULE_7__ngb_calendar__["a" /* NgbCalendar */], }, { type: __WEBPACK_IMPORTED_MODULE_6__ngb_date_adapter__["a" /* NgbDateAdapter */], }, ]; }; NgbInputDatepicker.propDecorators = { "autoClose": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "dayTemplate": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "displayMonths": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "firstDayOfWeek": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "markDisabled": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "minDate": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "maxDate": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "navigation": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "outsideDays": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "placement": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "showWeekdays": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "showWeekNumbers": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "startDate": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "container": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "dateSelect": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"] },], "navigate": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"] },], "disabled": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], }; return NgbInputDatepicker; }()); //# sourceMappingURL=datepicker-input.js.map /***/ }), /***/ "./node_modules/@ng-bootstrap/ng-bootstrap/datepicker/datepicker-keymap-service.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NgbDatepickerKeyMapService; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__datepicker_service__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/datepicker/datepicker-service.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__ngb_calendar__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/datepicker/ngb-calendar.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__util_util__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/util/util.js"); var Key; (function (Key) { Key[Key["Enter"] = 13] = "Enter"; Key[Key["Space"] = 32] = "Space"; Key[Key["PageUp"] = 33] = "PageUp"; Key[Key["PageDown"] = 34] = "PageDown"; Key[Key["End"] = 35] = "End"; Key[Key["Home"] = 36] = "Home"; Key[Key["ArrowLeft"] = 37] = "ArrowLeft"; Key[Key["ArrowUp"] = 38] = "ArrowUp"; Key[Key["ArrowRight"] = 39] = "ArrowRight"; Key[Key["ArrowDown"] = 40] = "ArrowDown"; })(Key || (Key = {})); var NgbDatepickerKeyMapService = (function () { function NgbDatepickerKeyMapService(_service, _calendar) { var _this = this; this._service = _service; this._calendar = _calendar; _service.model$.subscribe(function (model) { _this._minDate = model.minDate; _this._maxDate = model.maxDate; _this._firstViewDate = model.firstDate; _this._lastViewDate = model.lastDate; }); } NgbDatepickerKeyMapService.prototype.processKey = function (event) { if (Key[Object(__WEBPACK_IMPORTED_MODULE_3__util_util__["i" /* toString */])(event.which)]) { switch (event.which) { case Key.PageUp: this._service.focusMove(event.shiftKey ? 'y' : 'm', -1); break; case Key.PageDown: this._service.focusMove(event.shiftKey ? 'y' : 'm', 1); break; case Key.End: this._service.focus(event.shiftKey ? this._maxDate : this._lastViewDate); break; case Key.Home: this._service.focus(event.shiftKey ? this._minDate : this._firstViewDate); break; case Key.ArrowLeft: this._service.focusMove('d', -1); break; case Key.ArrowUp: this._service.focusMove('d', -this._calendar.getDaysPerWeek()); break; case Key.ArrowRight: this._service.focusMove('d', 1); break; case Key.ArrowDown: this._service.focusMove('d', this._calendar.getDaysPerWeek()); break; case Key.Enter: case Key.Space: this._service.focusSelect(); break; default: return; } event.preventDefault(); event.stopPropagation(); } }; NgbDatepickerKeyMapService.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Injectable"] }, ]; /** @nocollapse */ NgbDatepickerKeyMapService.ctorParameters = function () { return [ { type: __WEBPACK_IMPORTED_MODULE_1__datepicker_service__["a" /* NgbDatepickerService */], }, { type: __WEBPACK_IMPORTED_MODULE_2__ngb_calendar__["a" /* NgbCalendar */], }, ]; }; return NgbDatepickerKeyMapService; }()); //# sourceMappingURL=datepicker-keymap-service.js.map /***/ }), /***/ "./node_modules/@ng-bootstrap/ng-bootstrap/datepicker/datepicker-month-view.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NgbDatepickerMonthView; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__ngb_date__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/datepicker/ngb-date.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__datepicker_i18n__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/datepicker/datepicker-i18n.js"); var NgbDatepickerMonthView = (function () { function NgbDatepickerMonthView(i18n) { this.i18n = i18n; this.select = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); } NgbDatepickerMonthView.prototype.doSelect = function (day) { if (!day.context.disabled && !this.isHidden(day)) { this.select.emit(__WEBPACK_IMPORTED_MODULE_1__ngb_date__["a" /* NgbDate */].from(day.date)); } }; NgbDatepickerMonthView.prototype.isCollapsed = function (week) { return this.outsideDays === 'collapsed' && week.days[0].date.month !== this.month.number && week.days[week.days.length - 1].date.month !== this.month.number; }; NgbDatepickerMonthView.prototype.isHidden = function (day) { return (this.outsideDays === 'hidden' || this.outsideDays === 'collapsed') && this.month.number !== day.date.month; }; NgbDatepickerMonthView.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"], args: [{ selector: 'ngb-datepicker-month-view', host: { 'class': 'd-block' }, styles: ["\n .ngb-dp-weekday, .ngb-dp-week-number {\n line-height: 2rem;\n }\n .ngb-dp-weekday {\n color: #5bc0de;\n }\n .ngb-dp-week {\n border-radius: 0.25rem;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n }\n .ngb-dp-weekdays {\n border-bottom: 1px solid rgba(0, 0, 0, 0.125);\n border-radius: 0rem;\n }\n .ngb-dp-day, .ngb-dp-weekday, .ngb-dp-week-number {\n width: 2rem;\n height: 2rem;\n }\n .ngb-dp-day {\n cursor: pointer;\n }\n .ngb-dp-day.disabled, .ngb-dp-day.hidden {\n cursor: default;\n }\n "], template: "\n <div *ngIf=\"showWeekdays\" class=\"ngb-dp-week ngb-dp-weekdays bg-light\">\n <div *ngIf=\"showWeekNumbers\" class=\"ngb-dp-weekday ngb-dp-showweek\"></div>\n <div *ngFor=\"let w of month.weekdays\" class=\"ngb-dp-weekday small text-center font-italic\">\n {{ i18n.getWeekdayShortName(w) }}\n </div>\n </div>\n <ng-template ngFor let-week [ngForOf]=\"month.weeks\">\n <div *ngIf=\"!isCollapsed(week)\" class=\"ngb-dp-week\">\n <div *ngIf=\"showWeekNumbers\" class=\"ngb-dp-week-number small text-center font-italic text-muted\">{{ week.number }}</div>\n <div *ngFor=\"let day of week.days\" (click)=\"doSelect(day)\" class=\"ngb-dp-day\" [class.disabled]=\"day.context.disabled\"\n [class.hidden]=\"isHidden(day)\">\n <ng-template [ngIf]=\"!isHidden(day)\">\n <ng-template [ngTemplateOutlet]=\"dayTemplate\" [ngTemplateOutletContext]=\"day.context\"></ng-template>\n </ng-template>\n </div>\n </div>\n </ng-template>\n " },] }, ]; /** @nocollapse */ NgbDatepickerMonthView.ctorParameters = function () { return [ { type: __WEBPACK_IMPORTED_MODULE_2__datepicker_i18n__["a" /* NgbDatepickerI18n */], }, ]; }; NgbDatepickerMonthView.propDecorators = { "dayTemplate": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "month": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "outsideDays": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "showWeekdays": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "showWeekNumbers": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "select": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"] },], }; return NgbDatepickerMonthView; }()); //# sourceMappingURL=datepicker-month-view.js.map /***/ }), /***/ "./node_modules/@ng-bootstrap/ng-bootstrap/datepicker/datepicker-navigation-select.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NgbDatepickerNavigationSelect; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__ngb_date__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/datepicker/ngb-date.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__util_util__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/util/util.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__datepicker_i18n__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/datepicker/datepicker-i18n.js"); var NgbDatepickerNavigationSelect = (function () { function NgbDatepickerNavigationSelect(i18n) { this.i18n = i18n; this.select = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); } NgbDatepickerNavigationSelect.prototype.changeMonth = function (month) { this.select.emit(new __WEBPACK_IMPORTED_MODULE_1__ngb_date__["a" /* NgbDate */](this.date.year, Object(__WEBPACK_IMPORTED_MODULE_2__util_util__["h" /* toInteger */])(month), 1)); }; NgbDatepickerNavigationSelect.prototype.changeYear = function (year) { this.select.emit(new __WEBPACK_IMPORTED_MODULE_1__ngb_date__["a" /* NgbDate */](Object(__WEBPACK_IMPORTED_MODULE_2__util_util__["h" /* toInteger */])(year), this.date.month, 1)); }; NgbDatepickerNavigationSelect.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"], args: [{ selector: 'ngb-datepicker-navigation-select', changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectionStrategy"].OnPush, styles: ["\n :host>select {\n /* to align with btn-sm */\n padding: 0.25rem 0.5rem;\n font-size: 0.875rem;\n line-height: 1.25;\n /* to cancel the custom height set by custom-select */\n height: inherit;\n width: 50%;\n display: inline-block;\n }\n "], template: "\n <select\n [disabled]=\"disabled\"\n class=\"custom-select\"\n [value]=\"date?.month\"\n (change)=\"changeMonth($event.target.value)\"\n tabindex=\"-1\">\n <option *ngFor=\"let m of months\" [value]=\"m\">{{ i18n.getMonthShortName(m) }}</option>\n </select><select\n [disabled]=\"disabled\"\n class=\"custom-select\"\n [value]=\"date?.year\"\n (change)=\"changeYear($event.target.value)\"\n tabindex=\"-1\">\n <option *ngFor=\"let y of years\" [value]=\"y\">{{ y }}</option>\n </select>\n " },] }, ]; /** @nocollapse */ NgbDatepickerNavigationSelect.ctorParameters = function () { return [ { type: __WEBPACK_IMPORTED_MODULE_3__datepicker_i18n__["a" /* NgbDatepickerI18n */], }, ]; }; NgbDatepickerNavigationSelect.propDecorators = { "date": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "disabled": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "months": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "years": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "select": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"] },], }; return NgbDatepickerNavigationSelect; }()); //# sourceMappingURL=datepicker-navigation-select.js.map /***/ }), /***/ "./node_modules/@ng-bootstrap/ng-bootstrap/datepicker/datepicker-navigation.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NgbDatepickerNavigation; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__datepicker_view_model__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/datepicker/datepicker-view-model.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__ngb_date__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/datepicker/ngb-date.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__datepicker_i18n__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/datepicker/datepicker-i18n.js"); // The -ms- and -webkit- element for the CSS can be removed if we are generating the CSS using SASS. var NgbDatepickerNavigation = (function () { function NgbDatepickerNavigation(i18n) { this.i18n = i18n; this.navigation = __WEBPACK_IMPORTED_MODULE_1__datepicker_view_model__["a" /* NavigationEvent */]; this.months = []; this.navigate = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); this.select = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); } NgbDatepickerNavigation.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"], args: [{ selector: 'ngb-datepicker-navigation', changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectionStrategy"].OnPush, styles: ["\n :host {\n height: 2rem;\n line-height: 1.85rem;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n }\n .ngb-dp-navigation-chevron::before {\n border-style: solid;\n border-width: 0.2em 0.2em 0 0;\n content: '';\n display: inline-block;\n width: 0.75em;\n height: 0.75em;\n transform: rotate(-135deg);\n -webkit-transform: rotate(-135deg);\n -ms-transform: rotate(-135deg);\n }\n .right .ngb-dp-navigation-chevron:before {\n -webkit-transform: rotate(45deg);\n -ms-transform: rotate(45deg);\n transform: rotate(45deg);\n }\n .ngb-dp-arrow {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-flex: 1 1 auto;\n -ms-flex: 1 1 auto;\n flex-basis: auto;\n flex-grow: 1;\n padding-right: 0px;\n padding-left: 0px;\n margin: 0px;\n width: 2rem;\n height: 2rem;\n }\n .ngb-dp-arrow.right {\n -webkit-box-pack: end;\n -ms-flex-pack: end;\n justify-content: flex-end;\n }\n .ngb-dp-arrow-btn {\n padding: 0rem 1rem;\n }\n .ngb-dp-month-name {\n font-size: larger;\n height: 2rem;\n line-height: 2rem;\n text-align: center;\n }\n .ngb-dp-navigation-select {\n -webkit-box-flex: 1 1 9rem;\n -ms-flex: 1 1 9rem;\n flex-grow: 1;\n flex-basis: 9rem;\n }\n "], template: "\n <div class=\"ngb-dp-arrow\">\n <button type=\"button\" class=\"btn btn-link ngb-dp-arrow-btn\"\n (click)=\"!!navigate.emit(navigation.PREV)\" [disabled]=\"prevDisabled\" tabindex=\"-1\">\n <span class=\"ngb-dp-navigation-chevron\"></span>\n </button>\n </div>\n <ngb-datepicker-navigation-select *ngIf=\"showSelect\" class=\"d-block ngb-dp-navigation-select\"\n [date]=\"date\"\n [disabled] = \"disabled\"\n [months]=\"selectBoxes.months\"\n [years]=\"selectBoxes.years\"\n (select)=\"select.emit($event)\">\n </ngb-datepicker-navigation-select>\n\n <ng-template *ngIf=\"!showSelect\" ngFor let-month [ngForOf]=\"months\" let-i=\"index\">\n <div class=\"ngb-dp-arrow\" *ngIf=\"i > 0\"></div>\n <div class=\"ngb-dp-month-name d-block\">\n {{ i18n.getMonthFullName(month.number) }} {{ month.year }}\n </div>\n <div class=\"ngb-dp-arrow\" *ngIf=\"i !== months.length - 1\"></div>\n </ng-template>\n <div class=\"ngb-dp-arrow right\">\n <button type=\"button\" class=\"btn btn-link ngb-dp-arrow-btn\"\n (click)=\"!!navigate.emit(navigation.NEXT)\" [disabled]=\"nextDisabled\" tabindex=\"-1\">\n <span class=\"ngb-dp-navigation-chevron\"></span>\n </button>\n </div>\n " },] }, ]; /** @nocollapse */ NgbDatepickerNavigation.ctorParameters = function () { return [ { type: __WEBPACK_IMPORTED_MODULE_3__datepicker_i18n__["a" /* NgbDatepickerI18n */], }, ]; }; NgbDatepickerNavigation.propDecorators = { "date": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "disabled": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "months": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "showSelect": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "prevDisabled": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "nextDisabled": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "selectBoxes": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "navigate": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"] },], "select": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"] },], }; return NgbDatepickerNavigation; }()); //# sourceMappingURL=datepicker-navigation.js.map /***/ }), /***/ "./node_modules/@ng-bootstrap/ng-bootstrap/datepicker/datepicker-service.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NgbDatepickerService; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__ngb_calendar__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/datepicker/ngb-calendar.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__ngb_date__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/datepicker/ngb-date.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__angular_core__ = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__util_util__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/util/util.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_rxjs_Subject__ = __webpack_require__("./node_modules/rxjs/_esm2015/Subject.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__datepicker_tools__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/datepicker/datepicker-tools.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_rxjs_operator_filter__ = __webpack_require__("./node_modules/rxjs/_esm2015/operator/filter.js"); var NgbDatepickerService = (function () { function NgbDatepickerService(_calendar) { this._calendar = _calendar; this._model$ = new __WEBPACK_IMPORTED_MODULE_4_rxjs_Subject__["Subject"](); this._select$ = new __WEBPACK_IMPORTED_MODULE_4_rxjs_Subject__["Subject"](); this._state = { disabled: false, displayMonths: 1, firstDayOfWeek: 1, focusVisible: false, months: [], navigation: 'select', prevDisabled: false, nextDisabled: false, selectBoxes: { years: [], months: [] }, selectedDate: null }; } Object.defineProperty(NgbDatepickerService.prototype, "model$", { get: function () { return __WEBPACK_IMPORTED_MODULE_6_rxjs_operator_filter__["a" /* filter */].call(this._model$.asObservable(), function (model) { return model.months.length > 0; }); }, enumerable: true, configurable: true }); Object.defineProperty(NgbDatepickerService.prototype, "select$", { get: function () { return __WEBPACK_IMPORTED_MODULE_6_rxjs_operator_filter__["a" /* filter */].call(this._select$.asObservable(), function (date) { return date !== null; }); }, enumerable: true, configurable: true }); Object.defineProperty(NgbDatepickerService.prototype, "disabled", { set: function (disabled) { if (this._state.disabled !== disabled) { this._nextState({ disabled: disabled }); } }, enumerable: true, configurable: true }); Object.defineProperty(NgbDatepickerService.prototype, "displayMonths", { set: function (displayMonths) { displayMonths = Object(__WEBPACK_IMPORTED_MODULE_3__util_util__["h" /* toInteger */])(displayMonths); if (Object(__WEBPACK_IMPORTED_MODULE_3__util_util__["c" /* isInteger */])(displayMonths) && displayMonths > 0 && this._state.displayMonths !== displayMonths) { this._nextState({ displayMonths: displayMonths }); } }, enumerable: true, configurable: true }); Object.defineProperty(NgbDatepickerService.prototype, "firstDayOfWeek", { set: function (firstDayOfWeek) { firstDayOfWeek = Object(__WEBPACK_IMPORTED_MODULE_3__util_util__["h" /* toInteger */])(firstDayOfWeek); if (Object(__WEBPACK_IMPORTED_MODULE_3__util_util__["c" /* isInteger */])(firstDayOfWeek) && firstDayOfWeek >= 0 && this._state.firstDayOfWeek !== firstDayOfWeek) { this._nextState({ firstDayOfWeek: firstDayOfWeek }); } }, enumerable: true, configurable: true }); Object.defineProperty(NgbDatepickerService.prototype, "focusVisible", { set: function (focusVisible) { if (this._state.focusVisible !== focusVisible && !this._state.disabled) { this._nextState({ focusVisible: focusVisible }); } }, enumerable: true, configurable: true }); Object.defineProperty(NgbDatepickerService.prototype, "maxDate", { set: function (date) { var maxDate = this.toValidDate(date, null); if (Object(__WEBPACK_IMPORTED_MODULE_5__datepicker_tools__["f" /* isChangedDate */])(this._state.maxDate, maxDate)) { this._nextState({ maxDate: maxDate }); } }, enumerable: true, configurable: true }); Object.defineProperty(NgbDatepickerService.prototype, "markDisabled", { set: function (markDisabled) { if (this._state.markDisabled !== markDisabled) { this._nextState({ markDisabled: markDisabled }); } }, enumerable: true, configurable: true }); Object.defineProperty(NgbDatepickerService.prototype, "minDate", { set: function (date) { var minDate = this.toValidDate(date, null); if (Object(__WEBPACK_IMPORTED_MODULE_5__datepicker_tools__["f" /* isChangedDate */])(this._state.minDate, minDate)) { this._nextState({ minDate: minDate }); } }, enumerable: true, configurable: true }); Object.defineProperty(NgbDatepickerService.prototype, "navigation", { set: function (navigation) { if (this._state.navigation !== navigation) { this._nextState({ navigation: navigation }); } }, enumerable: true, configurable: true }); NgbDatepickerService.prototype.focus = function (date) { if (!this._state.disabled && this._calendar.isValid(date) && Object(__WEBPACK_IMPORTED_MODULE_5__datepicker_tools__["f" /* isChangedDate */])(this._state.focusDate, date)) { this._nextState({ focusDate: date }); } }; NgbDatepickerService.prototype.focusMove = function (period, number) { this.focus(this._calendar.getNext(this._state.focusDate, period, number)); }; NgbDatepickerService.prototype.focusSelect = function () { if (Object(__WEBPACK_IMPORTED_MODULE_5__datepicker_tools__["g" /* isDateSelectable */])(this._state.focusDate, this._state)) { this.select(this._state.focusDate, { emitEvent: true }); } }; NgbDatepickerService.prototype.open = function (date) { var firstDate = this.toValidDate(date, this._calendar.getToday()); if (!this._state.disabled) { this._nextState({ firstDate: firstDate }); } }; NgbDatepickerService.prototype.select = function (date, options) { if (options === void 0) { options = {}; } var selectedDate = this.toValidDate(date, null); if (!this._state.disabled) { if (Object(__WEBPACK_IMPORTED_MODULE_5__datepicker_tools__["f" /* isChangedDate */])(this._state.selectedDate, selectedDate)) { this._nextState({ selectedDate: selectedDate }); } if (options.emitEvent && Object(__WEBPACK_IMPORTED_MODULE_5__datepicker_tools__["g" /* isDateSelectable */])(selectedDate, this._state)) { this._select$.next(selectedDate); } } }; NgbDatepickerService.prototype.toValidDate = function (date, defaultValue) { var ngbDate = __WEBPACK_IMPORTED_MODULE_1__ngb_date__["a" /* NgbDate */].from(date); if (defaultValue === undefined) { defaultValue = this._calendar.getToday(); } return this._calendar.isValid(ngbDate) ? ngbDate : defaultValue; }; NgbDatepickerService.prototype._nextState = function (patch) { var newState = this._updateState(patch); this._patchContexts(newState); this._state = newState; this._model$.next(this._state); }; NgbDatepickerService.prototype._patchContexts = function (state) { state.months.forEach(function (month) { month.weeks.forEach(function (week) { week.days.forEach(function (day) { // patch focus flag if (state.focusDate) { day.context.focused = state.focusDate.equals(day.date) && state.focusVisible; } // override context disabled if (state.disabled === true) { day.context.disabled = true; } // patch selection flag if (state.selectedDate !== undefined) { day.context.selected = state.selectedDate !== null && state.selectedDate.equals(day.date); } }); }); }); }; NgbDatepickerService.prototype._updateState = function (patch) { // patching fields var state = Object.assign({}, this._state, patch); var startDate = state.firstDate; // min/max dates changed if ('minDate' in patch || 'maxDate' in patch) { Object(__WEBPACK_IMPORTED_MODULE_5__datepicker_tools__["c" /* checkMinBeforeMax */])(state.minDate, state.maxDate); state.focusDate = Object(__WEBPACK_IMPORTED_MODULE_5__datepicker_tools__["b" /* checkDateInRange */])(state.focusDate, state.minDate, state.maxDate); state.firstDate = Object(__WEBPACK_IMPORTED_MODULE_5__datepicker_tools__["b" /* checkDateInRange */])(state.firstDate, state.minDate, state.maxDate); startDate = state.focusDate; } // disabled if ('disabled' in patch) { state.focusVisible = false; } // initial rebuild via 'select()' if ('selectedDate' in patch && this._state.months.length === 0) { startDate = state.selectedDate; } // focus date changed if ('focusDate' in patch) { state.focusDate = Object(__WEBPACK_IMPORTED_MODULE_5__datepicker_tools__["b" /* checkDateInRange */])(state.focusDate, state.minDate, state.maxDate); startDate = state.focusDate; // nothing to rebuild if only focus changed and it is still visible if (state.months.length !== 0 && !state.focusDate.before(state.firstDate) && !state.focusDate.after(state.lastDate)) { return state; } } // first date changed if ('firstDate' in patch) { state.firstDate = Object(__WEBPACK_IMPORTED_MODULE_5__datepicker_tools__["b" /* checkDateInRange */])(state.firstDate, state.minDate, state.maxDate); startDate = state.firstDate; } // rebuilding months if (startDate) { var forceRebuild = 'firstDayOfWeek' in patch || 'markDisabled' in patch || 'minDate' in patch || 'maxDate' in patch || 'disabled' in patch; var months = Object(__WEBPACK_IMPORTED_MODULE_5__datepicker_tools__["a" /* buildMonths */])(this._calendar, startDate, state, forceRebuild); // updating months and boundary dates state.months = months; state.firstDate = months.length > 0 ? months[0].firstDate : undefined; state.lastDate = months.length > 0 ? months[months.length - 1].lastDate : undefined; // reset selected date if 'markDisabled' returns true if ('selectedDate' in patch && !Object(__WEBPACK_IMPORTED_MODULE_5__datepicker_tools__["g" /* isDateSelectable */])(state.selectedDate, state)) { state.selectedDate = null; } // adjusting focus after months were built if ('firstDate' in patch) { if (state.focusDate === undefined || state.focusDate.before(state.firstDate) || state.focusDate.after(state.lastDate)) { state.focusDate = startDate; } } // adjusting months/years for the select box navigation var yearChanged = !this._state.firstDate || this._state.firstDate.year !== state.firstDate.year; var monthChanged = !this._state.firstDate || this._state.firstDate.month !== state.firstDate.month; if (state.navigation === 'select') { // years -> boundaries (min/max were changed) if ('minDate' in patch || 'maxDate' in patch || state.selectBoxes.years.length === 0 || yearChanged) { state.selectBoxes.years = Object(__WEBPACK_IMPORTED_MODULE_5__datepicker_tools__["e" /* generateSelectBoxYears */])(state.focusDate, state.minDate, state.maxDate); } // months -> when current year or boundaries change if ('minDate' in patch || 'maxDate' in patch || state.selectBoxes.months.length === 0 || yearChanged) { state.selectBoxes.months = Object(__WEBPACK_IMPORTED_MODULE_5__datepicker_tools__["d" /* generateSelectBoxMonths */])(this._calendar, state.focusDate, state.minDate, state.maxDate); } } else { state.selectBoxes = { years: [], months: [] }; } // updating navigation arrows -> boundaries change (min/max) or month/year changes if ((state.navigation === 'arrows' || state.navigation === 'select') && (monthChanged || yearChanged || 'minDate' in patch || 'maxDate' in patch || 'disabled' in patch)) { state.prevDisabled = state.disabled || Object(__WEBPACK_IMPORTED_MODULE_5__datepicker_tools__["i" /* prevMonthDisabled */])(this._calendar, state.firstDate, state.minDate); state.nextDisabled = state.disabled || Object(__WEBPACK_IMPORTED_MODULE_5__datepicker_tools__["h" /* nextMonthDisabled */])(this._calendar, state.lastDate, state.maxDate); } } return state; }; NgbDatepickerService.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_2__angular_core__["Injectable"] }, ]; /** @nocollapse */ NgbDatepickerService.ctorParameters = function () { return [ { type: __WEBPACK_IMPORTED_MODULE_0__ngb_calendar__["a" /* NgbCalendar */], }, ]; }; return NgbDatepickerService; }()); //# sourceMappingURL=datepicker-service.js.map /***/ }), /***/ "./node_modules/@ng-bootstrap/ng-bootstrap/datepicker/datepicker-tools.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["f"] = isChangedDate; /* unused harmony export dateComparator */ /* harmony export (immutable) */ __webpack_exports__["c"] = checkMinBeforeMax; /* harmony export (immutable) */ __webpack_exports__["b"] = checkDateInRange; /* harmony export (immutable) */ __webpack_exports__["g"] = isDateSelectable; /* harmony export (immutable) */ __webpack_exports__["d"] = generateSelectBoxMonths; /* harmony export (immutable) */ __webpack_exports__["e"] = generateSelectBoxYears; /* harmony export (immutable) */ __webpack_exports__["h"] = nextMonthDisabled; /* harmony export (immutable) */ __webpack_exports__["i"] = prevMonthDisabled; /* harmony export (immutable) */ __webpack_exports__["a"] = buildMonths; /* unused harmony export buildMonth */ /* unused harmony export getFirstViewDate */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__ngb_date__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/datepicker/ngb-date.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_util__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/util/util.js"); function isChangedDate(prev, next) { return !dateComparator(prev, next); } function dateComparator(prev, next) { return (!prev && !next) || (!!prev && !!next && prev.equals(next)); } function checkMinBeforeMax(minDate, maxDate) { if (maxDate && minDate && maxDate.before(minDate)) { throw new Error("'maxDate' " + maxDate + " should be greater than 'minDate' " + minDate); } } function checkDateInRange(date, minDate, maxDate) { if (date && minDate && date.before(minDate)) { return __WEBPACK_IMPORTED_MODULE_0__ngb_date__["a" /* NgbDate */].from(minDate); } if (date && maxDate && date.after(maxDate)) { return __WEBPACK_IMPORTED_MODULE_0__ngb_date__["a" /* NgbDate */].from(maxDate); } return date; } function isDateSelectable(date, state) { var minDate = state.minDate, maxDate = state.maxDate, disabled = state.disabled, markDisabled = state.markDisabled; // clang-format off return !(!Object(__WEBPACK_IMPORTED_MODULE_1__util_util__["b" /* isDefined */])(date) || disabled || (markDisabled && markDisabled(date, { year: date.year, month: date.month })) || (minDate && date.before(minDate)) || (maxDate && date.after(maxDate))); // clang-format on } function generateSelectBoxMonths(calendar, date, minDate, maxDate) { if (!date) { return []; } var months = calendar.getMonths(); if (minDate && date.year === minDate.year) { var index = months.findIndex(function (month) { return month === minDate.month; }); months = months.slice(index); } if (maxDate && date.year === maxDate.year) { var index = months.findIndex(function (month) { return month === maxDate.month; }); months = months.slice(0, index + 1); } return months; } function generateSelectBoxYears(date, minDate, maxDate) { if (!date) { return []; } var start = minDate && minDate.year || date.year - 10; var end = maxDate && maxDate.year || date.year + 10; return Array.from({ length: end - start + 1 }, function (e, i) { return start + i; }); } function nextMonthDisabled(calendar, date, maxDate) { return maxDate && calendar.getNext(date, 'm').after(maxDate); } function prevMonthDisabled(calendar, date, minDate) { var prevDate = calendar.getPrev(date, 'm'); return minDate && (prevDate.year === minDate.year && prevDate.month < minDate.month || prevDate.year < minDate.year && minDate.month === 1); } function buildMonths(calendar, date, state, force) { var displayMonths = state.displayMonths, months = state.months; var newMonths = []; var _loop_1 = function (i) { var newDate = calendar.getNext(date, 'm', i); var index = months.findIndex(function (month) { return month.firstDate.equals(newDate); }); if (force || index === -1) { newMonths.push(buildMonth(calendar, newDate, state)); } else { newMonths.push(months[index]); } }; for (var i = 0; i < displayMonths; i++) { _loop_1(i); } return newMonths; } function buildMonth(calendar, date, state) { var minDate = state.minDate, maxDate = state.maxDate, firstDayOfWeek = state.firstDayOfWeek, markDisabled = state.markDisabled; var month = { firstDate: null, lastDate: null, number: date.month, year: date.year, weeks: [], weekdays: [] }; date = getFirstViewDate(calendar, date, firstDayOfWeek); // month has weeks for (var week = 0; week < calendar.getWeeksPerMonth(); week++) { var days = []; // week has days for (var day = 0; day < calendar.getDaysPerWeek(); day++) { if (week === 0) { month.weekdays.push(calendar.getWeekday(date)); } var newDate = new __WEBPACK_IMPORTED_MODULE_0__ngb_date__["a" /* NgbDate */](date.year, date.month, date.day); var nextDate = calendar.getNext(newDate); // marking date as disabled var disabled = !!((minDate && newDate.before(minDate)) || (maxDate && newDate.after(maxDate))); if (!disabled && markDisabled) { disabled = markDisabled(newDate, { month: month.number, year: month.year }); } // saving first date of the month if (month.firstDate === null && newDate.month === month.number) { month.firstDate = newDate; } // saving last date of the month if (newDate.month === month.number && nextDate.month !== month.number) { month.lastDate = newDate; } days.push({ date: newDate, context: { date: { year: newDate.year, month: newDate.month, day: newDate.day }, currentMonth: month.number, disabled: disabled, focused: false, selected: false } }); date = nextDate; } month.weeks.push({ number: calendar.getWeekNumber(days.map(function (day) { return __WEBPACK_IMPORTED_MODULE_0__ngb_date__["a" /* NgbDate */].from(day.date); }), firstDayOfWeek), days: days }); } return month; } function getFirstViewDate(calendar, date, firstDayOfWeek) { var daysPerWeek = calendar.getDaysPerWeek(); var firstMonthDate = new __WEBPACK_IMPORTED_MODULE_0__ngb_date__["a" /* NgbDate */](date.year, date.month, 1); var dayOfWeek = calendar.getWeekday(firstMonthDate) % daysPerWeek; return calendar.getPrev(firstMonthDate, 'd', (daysPerWeek + dayOfWeek - firstDayOfWeek) % daysPerWeek); } //# sourceMappingURL=datepicker-tools.js.map /***/ }), /***/ "./node_modules/@ng-bootstrap/ng-bootstrap/datepicker/datepicker-view-model.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NavigationEvent; }); // clang-format on // clang-format on var NavigationEvent; // clang-format on (function (NavigationEvent) { NavigationEvent[NavigationEvent["PREV"] = 0] = "PREV"; NavigationEvent[NavigationEvent["NEXT"] = 1] = "NEXT"; })(NavigationEvent || (NavigationEvent = {})); //# sourceMappingURL=datepicker-view-model.js.map /***/ }), /***/ "./node_modules/@ng-bootstrap/ng-bootstrap/datepicker/datepicker.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NgbDatepicker; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_forms__ = __webpack_require__("./node_modules/@angular/forms/esm2015/forms.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__ngb_calendar__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/datepicker/ngb-calendar.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__ngb_date__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/datepicker/ngb-date.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__datepicker_service__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/datepicker/datepicker-service.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__datepicker_keymap_service__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/datepicker/datepicker-keymap-service.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__datepicker_view_model__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/datepicker/datepicker-view-model.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__datepicker_config__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/datepicker/datepicker-config.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__ngb_date_adapter__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/datepicker/ngb-date-adapter.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__datepicker_i18n__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/datepicker/datepicker-i18n.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__datepicker_tools__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/datepicker/datepicker-tools.js"); var NGB_DATEPICKER_VALUE_ACCESSOR = { provide: __WEBPACK_IMPORTED_MODULE_1__angular_forms__["NG_VALUE_ACCESSOR"], useExisting: Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["forwardRef"])(function () { return NgbDatepicker; }), multi: true }; /** * A lightweight and highly configurable datepicker directive */ var NgbDatepicker = (function () { function NgbDatepicker(_keyMapService, _service, _calendar, i18n, config, _cd, _elementRef, _ngbDateAdapter) { var _this = this; this._keyMapService = _keyMapService; this._service = _service; this._calendar = _calendar; this.i18n = i18n; this._cd = _cd; this._elementRef = _elementRef; this._ngbDateAdapter = _ngbDateAdapter; /** * An event fired when navigation happens and currently displayed month changes. * See NgbDatepickerNavigateEvent for the payload info. */ this.navigate = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); /** * An event fired when user selects a date using keyboard or mouse. * The payload of the event is currently selected NgbDateStruct. */ this.select = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); this.onChange = function (_) { }; this.onTouched = function () { }; ['dayTemplate', 'displayMonths', 'firstDayOfWeek', 'markDisabled', 'minDate', 'maxDate', 'navigation', 'outsideDays', 'showWeekdays', 'showWeekNumbers', 'startDate'] .forEach(function (input) { return _this[input] = config[input]; }); this._selectSubscription = _service.select$.subscribe(function (date) { _this.select.emit(date.toStruct()); }); this._subscription = _service.model$.subscribe(function (model) { var newDate = model.firstDate; var oldDate = _this.model ? _this.model.firstDate : null; var newSelectedDate = model.selectedDate; var oldSelectedDate = _this.model ? _this.model.selectedDate : null; _this.model = model; // handling selection change if (Object(__WEBPACK_IMPORTED_MODULE_10__datepicker_tools__["f" /* isChangedDate */])(newSelectedDate, oldSelectedDate)) { _this.onTouched(); _this.onChange(_this._ngbDateAdapter.toModel(newSelectedDate)); } // emitting navigation event if the first month changes if (!newDate.equals(oldDate)) { _this.navigate.emit({ current: oldDate ? { year: oldDate.year, month: oldDate.month } : null, next: { year: newDate.year, month: newDate.month } }); } _cd.markForCheck(); }); } /** * Manually focus the datepicker */ /** * Manually focus the datepicker */ NgbDatepicker.prototype.focus = /** * Manually focus the datepicker */ function () { this._elementRef.nativeElement.focus(); }; /** * Navigates current view to provided date. * With default calendar we use ISO 8601: 'month' is 1=Jan ... 12=Dec. * If nothing or invalid date provided calendar will open current month. * Use 'startDate' input as an alternative */ /** * Navigates current view to provided date. * With default calendar we use ISO 8601: 'month' is 1=Jan ... 12=Dec. * If nothing or invalid date provided calendar will open current month. * Use 'startDate' input as an alternative */ NgbDatepicker.prototype.navigateTo = /** * Navigates current view to provided date. * With default calendar we use ISO 8601: 'month' is 1=Jan ... 12=Dec. * If nothing or invalid date provided calendar will open current month. * Use 'startDate' input as an alternative */ function (date) { this._service.open(__WEBPACK_IMPORTED_MODULE_3__ngb_date__["a" /* NgbDate */].from(date)); }; NgbDatepicker.prototype.ngOnDestroy = function () { this._subscription.unsubscribe(); this._selectSubscription.unsubscribe(); }; NgbDatepicker.prototype.ngOnInit = function () { var _this = this; if (this.model === undefined) { ['displayMonths', 'markDisabled', 'firstDayOfWeek', 'navigation', 'minDate', 'maxDate'].forEach(function (input) { return _this._service[input] = _this[input]; }); this.navigateTo(this.startDate); } }; NgbDatepicker.prototype.ngOnChanges = function (changes) { var _this = this; ['displayMonths', 'markDisabled', 'firstDayOfWeek', 'navigation', 'minDate', 'maxDate'] .filter(function (input) { return input in changes; }) .forEach(function (input) { return _this._service[input] = _this[input]; }); if ('startDate' in changes) { this.navigateTo(this.startDate); } }; NgbDatepicker.prototype.onDateSelect = function (date) { this._service.focus(date); this._service.select(date, { emitEvent: true }); }; NgbDatepicker.prototype.onKeyDown = function (event) { this._keyMapService.processKey(event); }; NgbDatepicker.prototype.onNavigateDateSelect = function (date) { this._service.open(date); }; NgbDatepicker.prototype.onNavigateEvent = function (event) { switch (event) { case __WEBPACK_IMPORTED_MODULE_6__datepicker_view_model__["a" /* NavigationEvent */].PREV: this._service.open(this._calendar.getPrev(this.model.firstDate, 'm', 1)); break; case __WEBPACK_IMPORTED_MODULE_6__datepicker_view_model__["a" /* NavigationEvent */].NEXT: this._service.open(this._calendar.getNext(this.model.firstDate, 'm', 1)); break; } }; NgbDatepicker.prototype.registerOnChange = function (fn) { this.onChange = fn; }; NgbDatepicker.prototype.registerOnTouched = function (fn) { this.onTouched = fn; }; NgbDatepicker.prototype.setDisabledState = function (isDisabled) { this._service.disabled = isDisabled; }; NgbDatepicker.prototype.showFocus = function (focusVisible) { this._service.focusVisible = focusVisible; }; NgbDatepicker.prototype.writeValue = function (value) { this._service.select(__WEBPACK_IMPORTED_MODULE_3__ngb_date__["a" /* NgbDate */].from(this._ngbDateAdapter.fromModel(value))); }; NgbDatepicker.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"], args: [{ exportAs: 'ngbDatepicker', selector: 'ngb-datepicker', changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectionStrategy"].OnPush, host: { 'tabindex': '0', '[attr.tabindex]': 'model.disabled ? undefined : "0"', '(blur)': 'showFocus(false)', '(focus)': 'showFocus(true)', '(keydown)': 'onKeyDown($event)' }, styles: ["\n :host {\n border: 1px solid rgba(0, 0, 0, 0.125);\n border-radius: 0.25rem;\n display: inline-block;\n }\n .ngb-dp-month {\n pointer-events: none;\n }\n .ngb-dp-header {\n border-bottom: 0px;\n border-radius: .25rem 0.25rem 0rem 0rem;\n padding-top: 0.25rem;\n }\n ngb-datepicker-month-view {\n pointer-events: auto;\n }\n .ngb-dp-month-name {\n font-size: larger;\n height: 2rem;\n line-height: 2rem;\n text-align: center;\n }\n /deep/ .ngb-dp-month + .ngb-dp-month > ngb-datepicker-month-view > .ngb-dp-week {\n padding-left: 1rem;\n }\n /deep/ .ngb-dp-month + .ngb-dp-month > .ngb-dp-month-name {\n padding-left: 1rem;\n }\n /deep/ .ngb-dp-month:last-child .ngb-dp-week {\n padding-right: .25rem;\n }\n /deep/ .ngb-dp-month:first-child .ngb-dp-week {\n padding-left: .25rem;\n }\n /deep/ .ngb-dp-month > ngb-datepicker-month-view > .ngb-dp-week:last-child {\n padding-bottom: .25rem;\n }\n .ngb-dp-months {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n }\n "], template: "\n <ng-template #dt let-date=\"date\" let-currentMonth=\"currentMonth\" let-selected=\"selected\" let-disabled=\"disabled\" let-focused=\"focused\">\n <div ngbDatepickerDayView\n [date]=\"date\"\n [currentMonth]=\"currentMonth\"\n [selected]=\"selected\"\n [disabled]=\"disabled\"\n [focused]=\"focused\">\n </div>\n </ng-template>\n\n <div class=\"ngb-dp-header bg-light\">\n <ngb-datepicker-navigation *ngIf=\"navigation !== 'none'\"\n [date]=\"model.firstDate\"\n [months]=\"model.months\"\n [disabled]=\"model.disabled\"\n [showSelect]=\"model.navigation === 'select'\"\n [prevDisabled]=\"model.prevDisabled\"\n [nextDisabled]=\"model.nextDisabled\"\n [selectBoxes]=\"model.selectBoxes\"\n (navigate)=\"onNavigateEvent($event)\"\n (select)=\"onNavigateDateSelect($event)\">\n </ngb-datepicker-navigation>\n </div>\n\n <div class=\"ngb-dp-months\">\n <ng-template ngFor let-month [ngForOf]=\"model.months\" let-i=\"index\">\n <div class=\"ngb-dp-month d-block\">\n <div *ngIf=\"navigation === 'none' || (displayMonths > 1 && navigation === 'select')\"\n class=\"ngb-dp-month-name bg-light\">\n {{ i18n.getMonthFullName(month.number) }} {{ month.year }}\n </div>\n <ngb-datepicker-month-view\n [month]=\"month\"\n [dayTemplate]=\"dayTemplate || dt\"\n [showWeekdays]=\"showWeekdays\"\n [showWeekNumbers]=\"showWeekNumbers\"\n [outsideDays]=\"(displayMonths === 1 ? outsideDays : 'hidden')\"\n (select)=\"onDateSelect($event)\">\n </ngb-datepicker-month-view>\n </div>\n </ng-template>\n </div>\n ", providers: [NGB_DATEPICKER_VALUE_ACCESSOR, __WEBPACK_IMPORTED_MODULE_4__datepicker_service__["a" /* NgbDatepickerService */], __WEBPACK_IMPORTED_MODULE_5__datepicker_keymap_service__["a" /* NgbDatepickerKeyMapService */]] },] }, ]; /** @nocollapse */ NgbDatepicker.ctorParameters = function () { return [ { type: __WEBPACK_IMPORTED_MODULE_5__datepicker_keymap_service__["a" /* NgbDatepickerKeyMapService */], }, { type: __WEBPACK_IMPORTED_MODULE_4__datepicker_service__["a" /* NgbDatepickerService */], }, { type: __WEBPACK_IMPORTED_MODULE_2__ngb_calendar__["a" /* NgbCalendar */], }, { type: __WEBPACK_IMPORTED_MODULE_9__datepicker_i18n__["a" /* NgbDatepickerI18n */], }, { type: __WEBPACK_IMPORTED_MODULE_7__datepicker_config__["a" /* NgbDatepickerConfig */], }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectorRef"], }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ElementRef"], }, { type: __WEBPACK_IMPORTED_MODULE_8__ngb_date_adapter__["a" /* NgbDateAdapter */], }, ]; }; NgbDatepicker.propDecorators = { "dayTemplate": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "displayMonths": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "firstDayOfWeek": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "markDisabled": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "maxDate": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "minDate": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "navigation": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "outsideDays": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "showWeekdays": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "showWeekNumbers": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "startDate": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "navigate": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"] },], "select": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"] },], }; return NgbDatepicker; }()); //# sourceMappingURL=datepicker.js.map /***/ }), /***/ "./node_modules/@ng-bootstrap/ng-bootstrap/datepicker/datepicker.module.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return NgbDatepickerModule; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_common__ = __webpack_require__("./node_modules/@angular/common/esm2015/common.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__datepicker__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/datepicker/datepicker.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__datepicker_month_view__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/datepicker/datepicker-month-view.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__datepicker_navigation__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/datepicker/datepicker-navigation.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__datepicker_input__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/datepicker/datepicker-input.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__angular_forms__ = __webpack_require__("./node_modules/@angular/forms/esm2015/forms.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__datepicker_day_view__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/datepicker/datepicker-day-view.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__datepicker_i18n__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/datepicker/datepicker-i18n.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__ngb_calendar__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/datepicker/ngb-calendar.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__ngb_date_parser_formatter__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/datepicker/ngb-date-parser-formatter.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__ngb_date_adapter__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/datepicker/ngb-date-adapter.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__datepicker_navigation_select__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/datepicker/datepicker-navigation-select.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__datepicker_config__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/datepicker/datepicker-config.js"); /* unused harmony reexport NgbDatepicker */ /* unused harmony reexport NgbInputDatepicker */ /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return __WEBPACK_IMPORTED_MODULE_9__ngb_calendar__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__hijri_ngb_calendar_islamic_civil__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/datepicker/hijri/ngb-calendar-islamic-civil.js"); /* unused harmony reexport NgbCalendarIslamicCivil */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__hijri_ngb_calendar_islamic_umalqura__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/datepicker/hijri/ngb-calendar-islamic-umalqura.js"); /* unused harmony reexport NgbCalendarIslamicUmalqura */ /* unused harmony reexport NgbDatepickerMonthView */ /* unused harmony reexport NgbDatepickerDayView */ /* unused harmony reexport NgbDatepickerNavigation */ /* unused harmony reexport NgbDatepickerNavigationSelect */ /* unused harmony reexport NgbDatepickerConfig */ /* unused harmony reexport NgbDatepickerI18n */ /* unused harmony reexport NgbDateAdapter */ /* unused harmony reexport NgbDateParserFormatter */ var NgbDatepickerModule = (function () { function NgbDatepickerModule() { } NgbDatepickerModule.forRoot = function () { return { ngModule: NgbDatepickerModule, providers: [ { provide: __WEBPACK_IMPORTED_MODULE_9__ngb_calendar__["a" /* NgbCalendar */], useClass: __WEBPACK_IMPORTED_MODULE_9__ngb_calendar__["b" /* NgbCalendarGregorian */] }, { provide: __WEBPACK_IMPORTED_MODULE_8__datepicker_i18n__["a" /* NgbDatepickerI18n */], useClass: __WEBPACK_IMPORTED_MODULE_8__datepicker_i18n__["b" /* NgbDatepickerI18nDefault */] }, { provide: __WEBPACK_IMPORTED_MODULE_10__ngb_date_parser_formatter__["b" /* NgbDateParserFormatter */], useClass: __WEBPACK_IMPORTED_MODULE_10__ngb_date_parser_formatter__["a" /* NgbDateISOParserFormatter */] }, { provide: __WEBPACK_IMPORTED_MODULE_11__ngb_date_adapter__["a" /* NgbDateAdapter */], useClass: __WEBPACK_IMPORTED_MODULE_11__ngb_date_adapter__["b" /* NgbDateStructAdapter */] }, __WEBPACK_IMPORTED_MODULE_13__datepicker_config__["a" /* NgbDatepickerConfig */] ] }; }; NgbDatepickerModule.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["NgModule"], args: [{ declarations: [ __WEBPACK_IMPORTED_MODULE_2__datepicker__["a" /* NgbDatepicker */], __WEBPACK_IMPORTED_MODULE_3__datepicker_month_view__["a" /* NgbDatepickerMonthView */], __WEBPACK_IMPORTED_MODULE_4__datepicker_navigation__["a" /* NgbDatepickerNavigation */], __WEBPACK_IMPORTED_MODULE_12__datepicker_navigation_select__["a" /* NgbDatepickerNavigationSelect */], __WEBPACK_IMPORTED_MODULE_7__datepicker_day_view__["a" /* NgbDatepickerDayView */], __WEBPACK_IMPORTED_MODULE_5__datepicker_input__["a" /* NgbInputDatepicker */] ], exports: [__WEBPACK_IMPORTED_MODULE_2__datepicker__["a" /* NgbDatepicker */], __WEBPACK_IMPORTED_MODULE_5__datepicker_input__["a" /* NgbInputDatepicker */]], imports: [__WEBPACK_IMPORTED_MODULE_1__angular_common__["CommonModule"], __WEBPACK_IMPORTED_MODULE_6__angular_forms__["FormsModule"]], entryComponents: [__WEBPACK_IMPORTED_MODULE_2__datepicker__["a" /* NgbDatepicker */]] },] }, ]; /** @nocollapse */ NgbDatepickerModule.ctorParameters = function () { return []; }; return NgbDatepickerModule; }()); //# sourceMappingURL=datepicker.module.js.map /***/ }), /***/ "./node_modules/@ng-bootstrap/ng-bootstrap/datepicker/hijri/ngb-calendar-hijri.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NgbCalendarHijri; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__ngb_calendar__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/datepicker/ngb-calendar.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_core__ = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__util_util__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/util/util.js"); var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var NgbCalendarHijri = (function (_super) { __extends(NgbCalendarHijri, _super); function NgbCalendarHijri() { return _super !== null && _super.apply(this, arguments) || this; } NgbCalendarHijri.prototype.getDaysPerWeek = function () { return 7; }; NgbCalendarHijri.prototype.getMonths = function () { return [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]; }; NgbCalendarHijri.prototype.getWeeksPerMonth = function () { return 6; }; NgbCalendarHijri.prototype.isValid = function (date) { return date && Object(__WEBPACK_IMPORTED_MODULE_2__util_util__["d" /* isNumber */])(date.year) && Object(__WEBPACK_IMPORTED_MODULE_2__util_util__["d" /* isNumber */])(date.month) && Object(__WEBPACK_IMPORTED_MODULE_2__util_util__["d" /* isNumber */])(date.day) && !isNaN(this.toGregorian(date).getTime()); }; NgbCalendarHijri.prototype.setDay = function (date, day) { day = +day; var mDays = this.getDaysInIslamicMonth(date.month, date.year); if (day <= 0) { while (day <= 0) { date = this.setMonth(date, date.month - 1); mDays = this.getDaysInIslamicMonth(date.month, date.year); day += mDays; } } else if (day > mDays) { while (day > mDays) { day -= mDays; date = this.setMonth(date, date.month + 1); mDays = this.getDaysInIslamicMonth(date.month, date.year); } } date.day = day; return date; }; NgbCalendarHijri.prototype.setMonth = function (date, month) { month = +month; date.year = date.year + Math.floor((month - 1) / 12); date.month = Math.floor(((month - 1) % 12 + 12) % 12) + 1; return date; }; NgbCalendarHijri.prototype.setYear = function (date, yearValue) { date.year = +yearValue; return date; }; NgbCalendarHijri.prototype._isIslamicLeapYear = function (year) { return (14 + 11 * year) % 30 < 11; }; /** * Returns the start of Hijri Month. * `month` is 0 for Muharram, 1 for Safar, etc. * `year` is any Hijri year. */ /** * Returns the start of Hijri Month. * `month` is 0 for Muharram, 1 for Safar, etc. * `year` is any Hijri year. */ NgbCalendarHijri.prototype._getMonthStart = /** * Returns the start of Hijri Month. * `month` is 0 for Muharram, 1 for Safar, etc. * `year` is any Hijri year. */ function (year, month) { return Math.ceil(29.5 * month) + (year - 1) * 354 + Math.floor((3 + 11 * year) / 30.0); }; /** * Returns the start of Hijri year. * `year` is any Hijri year. */ /** * Returns the start of Hijri year. * `year` is any Hijri year. */ NgbCalendarHijri.prototype._getYearStart = /** * Returns the start of Hijri year. * `year` is any Hijri year. */ function (year) { return (year - 1) * 354 + Math.floor((3 + 11 * year) / 30.0); }; NgbCalendarHijri.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Injectable"] }, ]; /** @nocollapse */ NgbCalendarHijri.ctorParameters = function () { return []; }; return NgbCalendarHijri; }(__WEBPACK_IMPORTED_MODULE_0__ngb_calendar__["a" /* NgbCalendar */])); //# sourceMappingURL=ngb-calendar-hijri.js.map /***/ }), /***/ "./node_modules/@ng-bootstrap/ng-bootstrap/datepicker/hijri/ngb-calendar-islamic-civil.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NgbCalendarIslamicCivil; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__ngb_calendar_hijri__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/datepicker/hijri/ngb-calendar-hijri.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__ngb_date__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/datepicker/ngb-date.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__angular_core__ = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); function isGregorianLeapYear(date) { var year = date.getFullYear(); return year % 4 === 0 && year % 100 !== 0 || year % 400 === 0; } function mod(a, b) { return a - b * Math.floor(a / b); } /** * The civil calendar is one type of Hijri calendars used in islamic countries. * Uses a fixed cycle of alternating 29- and 30-day months, * with a leap day added to the last month of 11 out of every 30 years. * http://cldr.unicode.org/development/development-process/design-proposals/islamic-calendar-types * All the calculations here are based on the equations from "Calendrical Calculations" By Edward M. Reingold, Nachum * Dershowitz. */ var GREGORIAN_EPOCH = 1721425.5; var ISLAMIC_EPOCH = 1948439.5; var NgbCalendarIslamicCivil = (function (_super) { __extends(NgbCalendarIslamicCivil, _super); function NgbCalendarIslamicCivil() { return _super !== null && _super.apply(this, arguments) || this; } /** * Returns the equivalent islamic(civil) date value for a give input Gregorian date. * `gdate` is a JS Date to be converted to Hijri. */ /** * Returns the equivalent islamic(civil) date value for a give input Gregorian date. * `gdate` is a JS Date to be converted to Hijri. */ NgbCalendarIslamicCivil.prototype.fromGregorian = /** * Returns the equivalent islamic(civil) date value for a give input Gregorian date. * `gdate` is a JS Date to be converted to Hijri. */ function (gdate) { var date = new Date(gdate); var gYear = date.getFullYear(), gMonth = date.getMonth(), gDay = date.getDate(); var julianDay = GREGORIAN_EPOCH - 1 + 365 * (gYear - 1) + Math.floor((gYear - 1) / 4) + -Math.floor((gYear - 1) / 100) + Math.floor((gYear - 1) / 400) + Math.floor((367 * (gMonth + 1) - 362) / 12 + (gMonth + 1 <= 2 ? 0 : isGregorianLeapYear(date) ? -1 : -2) + gDay); julianDay = Math.floor(julianDay) + 0.5; var days = julianDay - ISLAMIC_EPOCH; var hYear = Math.floor((30 * days + 10646) / 10631.0); var hMonth = Math.ceil((days - 29 - this._getYearStart(hYear)) / 29.5); hMonth = Math.min(hMonth, 11); var hDay = Math.ceil(days - this._getMonthStart(hYear, hMonth)) + 1; return new __WEBPACK_IMPORTED_MODULE_1__ngb_date__["a" /* NgbDate */](hYear, hMonth + 1, hDay); }; /** * Returns the equivalent JS date value for a give input islamic(civil) date. * `hijriDate` is an islamic(civil) date to be converted to Gregorian. */ /** * Returns the equivalent JS date value for a give input islamic(civil) date. * `hijriDate` is an islamic(civil) date to be converted to Gregorian. */ NgbCalendarIslamicCivil.prototype.toGregorian = /** * Returns the equivalent JS date value for a give input islamic(civil) date. * `hijriDate` is an islamic(civil) date to be converted to Gregorian. */ function (hijriDate) { var hYear = hijriDate.year; var hMonth = hijriDate.month - 1; var hDate = hijriDate.day; var julianDay = hDate + Math.ceil(29.5 * hMonth) + (hYear - 1) * 354 + Math.floor((3 + 11 * hYear) / 30) + ISLAMIC_EPOCH - 1; var wjd = Math.floor(julianDay - 0.5) + 0.5, depoch = wjd - GREGORIAN_EPOCH, quadricent = Math.floor(depoch / 146097), dqc = mod(depoch, 146097), cent = Math.floor(dqc / 36524), dcent = mod(dqc, 36524), quad = Math.floor(dcent / 1461), dquad = mod(dcent, 1461), yindex = Math.floor(dquad / 365); var year = quadricent * 400 + cent * 100 + quad * 4 + yindex; if (!(cent === 4 || yindex === 4)) { year++; } var gYearStart = GREGORIAN_EPOCH + 365 * (year - 1) + Math.floor((year - 1) / 4) - Math.floor((year - 1) / 100) + Math.floor((year - 1) / 400); var yearday = wjd - gYearStart; var tjd = GREGORIAN_EPOCH - 1 + 365 * (year - 1) + Math.floor((year - 1) / 4) - Math.floor((year - 1) / 100) + Math.floor((year - 1) / 400) + Math.floor(739 / 12 + (isGregorianLeapYear(new Date(year, 3, 1)) ? -1 : -2) + 1); var leapadj = wjd < tjd ? 0 : isGregorianLeapYear(new Date(year, 3, 1)) ? 1 : 2; var month = Math.floor(((yearday + leapadj) * 12 + 373) / 367); var tjd2 = GREGORIAN_EPOCH - 1 + 365 * (year - 1) + Math.floor((year - 1) / 4) - Math.floor((year - 1) / 100) + Math.floor((year - 1) / 400) + Math.floor((367 * month - 362) / 12 + (month <= 2 ? 0 : isGregorianLeapYear(new Date(year, month - 1, 1)) ? -1 : -2) + 1); var day = wjd - tjd2 + 1; return new Date(year, month - 1, day); }; /** * Returns the number of days in a specific Hijri month. * `month` is 1 for Muharram, 2 for Safar, etc. * `year` is any Hijri year. */ /** * Returns the number of days in a specific Hijri month. * `month` is 1 for Muharram, 2 for Safar, etc. * `year` is any Hijri year. */ NgbCalendarIslamicCivil.prototype.getDaysInIslamicMonth = /** * Returns the number of days in a specific Hijri month. * `month` is 1 for Muharram, 2 for Safar, etc. * `year` is any Hijri year. */ function (month, year) { year = year + Math.floor(month / 13); month = ((month - 1) % 12) + 1; var length = 29 + month % 2; if (month === 12 && this._isIslamicLeapYear(year)) { length++; } return length; }; NgbCalendarIslamicCivil.prototype.getNext = function (date, period, number) { if (period === void 0) { period = 'd'; } if (number === void 0) { number = 1; } date = __WEBPACK_IMPORTED_MODULE_1__ngb_date__["a" /* NgbDate */].from(date); switch (period) { case 'y': date = this.setYear(date, date.year + number); date.month = 1; date.day = 1; return date; case 'm': date = this.setMonth(date, date.month + number); date.day = 1; return date; case 'd': return this.setDay(date, date.day + number); default: return date; } }; NgbCalendarIslamicCivil.prototype.getPrev = function (date, period, number) { if (period === void 0) { period = 'd'; } if (number === void 0) { number = 1; } return this.getNext(date, period, -number); }; NgbCalendarIslamicCivil.prototype.getWeekday = function (date) { var day = this.toGregorian(date).getDay(); // in JS Date Sun=0, in ISO 8601 Sun=7 return day === 0 ? 7 : day; }; NgbCalendarIslamicCivil.prototype.getWeekNumber = function (week, firstDayOfWeek) { // in JS Date Sun=0, in ISO 8601 Sun=7 if (firstDayOfWeek === 7) { firstDayOfWeek = 0; } var thursdayIndex = (4 + 7 - firstDayOfWeek) % 7; var date = week[thursdayIndex]; var jsDate = this.toGregorian(date); jsDate.setDate(jsDate.getDate() + 4 - (jsDate.getDay() || 7)); // Thursday var time = jsDate.getTime(); var MuhDate = this.toGregorian(new __WEBPACK_IMPORTED_MODULE_1__ngb_date__["a" /* NgbDate */](date.year, 1, 1)); // Compare with Muharram 1 return Math.floor(Math.round((time - MuhDate.getTime()) / 86400000) / 7) + 1; }; NgbCalendarIslamicCivil.prototype.getToday = function () { return this.fromGregorian(new Date()); }; NgbCalendarIslamicCivil.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_2__angular_core__["Injectable"] }, ]; /** @nocollapse */ NgbCalendarIslamicCivil.ctorParameters = function () { return []; }; return NgbCalendarIslamicCivil; }(__WEBPACK_IMPORTED_MODULE_0__ngb_calendar_hijri__["a" /* NgbCalendarHijri */])); //# sourceMappingURL=ngb-calendar-islamic-civil.js.map /***/ }), /***/ "./node_modules/@ng-bootstrap/ng-bootstrap/datepicker/hijri/ngb-calendar-islamic-umalqura.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export NgbCalendarIslamicUmalqura */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__ngb_calendar_islamic_civil__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/datepicker/hijri/ngb-calendar-islamic-civil.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__ngb_calendar_hijri__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/datepicker/hijri/ngb-calendar-hijri.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__ngb_date__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/datepicker/ngb-date.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__angular_core__ = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** * Umalqura calendar is one type of Hijri calendars used in islamic countries. * This Calendar is used by Saudi Arabia for administrative purpose. * Unlike tabular calendars, the algorithm involves astronomical calculation, but it's still deterministic. * http://cldr.unicode.org/development/development-process/design-proposals/islamic-calendar-types */ var GREGORIAN_FIRST_DATE = new Date(1882, 10, 12); var GREGORIAN_LAST_DATE = new Date(2174, 10, 25); var HIJRI_BEGIN = 1300; var HIJRI_END = 1600; var ONE_DAY = 1000 * 60 * 60 * 24; var ISLAMIC_CIVIL = new __WEBPACK_IMPORTED_MODULE_0__ngb_calendar_islamic_civil__["a" /* NgbCalendarIslamicCivil */](); var MONTH_LENGTH = [ '101010101010', '110101010100', '111011001001', '011011010100', '011011101010', '001101101100', '101010101101', '010101010101', '011010101001', '011110010010', '101110101001', '010111010100', '101011011010', '010101011100', '110100101101', '011010010101', '011101001010', '101101010100', '101101101010', '010110101101', '010010101110', '101001001111', '010100010111', '011010001011', '011010100101', '101011010101', '001011010110', '100101011011', '010010011101', '101001001101', '110100100110', '110110010101', '010110101100', '100110110110', '001010111010', '101001011011', '010100101011', '101010010101', '011011001010', '101011101001', '001011110100', '100101110110', '001010110110', '100101010110', '101011001010', '101110100100', '101111010010', '010111011001', '001011011100', '100101101101', '010101001101', '101010100101', '101101010010', '101110100101', '010110110100', '100110110110', '010101010111', '001010010111', '010101001011', '011010100011', '011101010010', '101101100101', '010101101010', '101010101011', '010100101011', '110010010101', '110101001010', '110110100101', '010111001010', '101011010110', '100101010111', '010010101011', '100101001011', '101010100101', '101101010010', '101101101010', '010101110101', '001001110110', '100010110111', '010001011011', '010101010101', '010110101001', '010110110100', '100111011010', '010011011101', '001001101110', '100100110110', '101010101010', '110101010100', '110110110010', '010111010101', '001011011010', '100101011011', '010010101011', '101001010101', '101101001001', '101101100100', '101101110001', '010110110100', '101010110101', '101001010101', '110100100101', '111010010010', '111011001001', '011011010100', '101011101001', '100101101011', '010010101011', '101010010011', '110101001001', '110110100100', '110110110010', '101010111001', '010010111010', '101001011011', '010100101011', '101010010101', '101100101010', '101101010101', '010101011100', '010010111101', '001000111101', '100100011101', '101010010101', '101101001010', '101101011010', '010101101101', '001010110110', '100100111011', '010010011011', '011001010101', '011010101001', '011101010100', '101101101010', '010101101100', '101010101101', '010101010101', '101100101001', '101110010010', '101110101001', '010111010100', '101011011010', '010101011010', '101010101011', '010110010101', '011101001001', '011101100100', '101110101010', '010110110101', '001010110110', '101001010110', '111001001101', '101100100101', '101101010010', '101101101010', '010110101101', '001010101110', '100100101111', '010010010111', '011001001011', '011010100101', '011010101100', '101011010110', '010101011101', '010010011101', '101001001101', '110100010110', '110110010101', '010110101010', '010110110101', '001011011010', '100101011011', '010010101101', '010110010101', '011011001010', '011011100100', '101011101010', '010011110101', '001010110110', '100101010110', '101010101010', '101101010100', '101111010010', '010111011001', '001011101010', '100101101101', '010010101101', '101010010101', '101101001010', '101110100101', '010110110010', '100110110101', '010011010110', '101010010111', '010101000111', '011010010011', '011101001001', '101101010101', '010101101010', '101001101011', '010100101011', '101010001011', '110101000110', '110110100011', '010111001010', '101011010110', '010011011011', '001001101011', '100101001011', '101010100101', '101101010010', '101101101001', '010101110101', '000101110110', '100010110111', '001001011011', '010100101011', '010101100101', '010110110100', '100111011010', '010011101101', '000101101101', '100010110110', '101010100110', '110101010010', '110110101001', '010111010100', '101011011010', '100101011011', '010010101011', '011001010011', '011100101001', '011101100010', '101110101001', '010110110010', '101010110101', '010101010101', '101100100101', '110110010010', '111011001001', '011011010010', '101011101001', '010101101011', '010010101011', '101001010101', '110100101001', '110101010100', '110110101010', '100110110101', '010010111010', '101000111011', '010010011011', '101001001101', '101010101010', '101011010101', '001011011010', '100101011101', '010001011110', '101000101110', '110010011010', '110101010101', '011010110010', '011010111001', '010010111010', '101001011101', '010100101101', '101010010101', '101101010010', '101110101000', '101110110100', '010110111001', '001011011010', '100101011010', '101101001010', '110110100100', '111011010001', '011011101000', '101101101010', '010101101101', '010100110101', '011010010101', '110101001010', '110110101000', '110111010100', '011011011010', '010101011011', '001010011101', '011000101011', '101100010101', '101101001010', '101110010101', '010110101010', '101010101110', '100100101110', '110010001111', '010100100111', '011010010101', '011010101010', '101011010110', '010101011101', '001010011101' ]; function getDaysDiff(date1, date2) { var diff = Math.abs(date1.getTime() - date2.getTime()); return Math.round(diff / ONE_DAY); } var NgbCalendarIslamicUmalqura = (function (_super) { __extends(NgbCalendarIslamicUmalqura, _super); function NgbCalendarIslamicUmalqura() { return _super !== null && _super.apply(this, arguments) || this; } /** * Returns the equivalent islamic(Umalqura) date value for a give input Gregorian date. * `gdate` is s JS Date to be converted to Hijri. */ /** * Returns the equivalent islamic(Umalqura) date value for a give input Gregorian date. * `gdate` is s JS Date to be converted to Hijri. */ NgbCalendarIslamicUmalqura.prototype.fromGregorian = /** * Returns the equivalent islamic(Umalqura) date value for a give input Gregorian date. * `gdate` is s JS Date to be converted to Hijri. */ function (gDate) { var hDay = 1, hMonth = 0, hYear = 1300; var daysDiff = getDaysDiff(gDate, GREGORIAN_FIRST_DATE); if (gDate.getTime() - GREGORIAN_FIRST_DATE.getTime() >= 0 && gDate.getTime() - GREGORIAN_LAST_DATE.getTime() <= 0) { var year = 1300; for (var i = 0; i < MONTH_LENGTH.length; i++, year++) { for (var j = 0; j < 12; j++) { var numOfDays = +MONTH_LENGTH[i][j] + 29; if (daysDiff <= numOfDays) { hDay = daysDiff + 1; if (hDay > numOfDays) { hDay = 1; j++; } if (j > 11) { j = 0; year++; } hMonth = j; hYear = year; return new __WEBPACK_IMPORTED_MODULE_2__ngb_date__["a" /* NgbDate */](hYear, hMonth + 1, hDay); } daysDiff = daysDiff - numOfDays; } } } else { return ISLAMIC_CIVIL.fromGregorian(gDate); } }; /** * Converts the current Hijri date to Gregorian. */ /** * Converts the current Hijri date to Gregorian. */ NgbCalendarIslamicUmalqura.prototype.toGregorian = /** * Converts the current Hijri date to Gregorian. */ function (hijriDate) { var hYear = hijriDate.year; var hMonth = hijriDate.month - 1; var hDay = hijriDate.day; var gDate = new Date(GREGORIAN_FIRST_DATE); var dayDiff = hDay - 1; if (hYear >= HIJRI_BEGIN && hYear <= HIJRI_END) { for (var y = 0; y < hYear - HIJRI_BEGIN; y++) { for (var m = 0; m < 12; m++) { dayDiff += +MONTH_LENGTH[y][m] + 29; } } for (var m = 0; m < hMonth; m++) { dayDiff += +MONTH_LENGTH[hYear - HIJRI_BEGIN][m] + 29; } gDate.setDate(GREGORIAN_FIRST_DATE.getDate() + dayDiff); } else { gDate = ISLAMIC_CIVIL.toGregorian(hijriDate); } return gDate; }; /** * Returns the number of days in a specific Hijri month. * `month` is 1 for Muharram, 2 for Safar, etc. * `year` is any Hijri year. */ /** * Returns the number of days in a specific Hijri month. * `month` is 1 for Muharram, 2 for Safar, etc. * `year` is any Hijri year. */ NgbCalendarIslamicUmalqura.prototype.getDaysInIslamicMonth = /** * Returns the number of days in a specific Hijri month. * `month` is 1 for Muharram, 2 for Safar, etc. * `year` is any Hijri year. */ function (month, year) { if (year >= HIJRI_BEGIN && year <= HIJRI_END) { var pos = year - HIJRI_BEGIN; return MONTH_LENGTH[pos].charAt(month - 1) === '1' ? 30 : 29; } return ISLAMIC_CIVIL.getDaysInIslamicMonth(month, year); }; NgbCalendarIslamicUmalqura.prototype.getNext = function (date, period, number) { if (period === void 0) { period = 'd'; } if (number === void 0) { number = 1; } date = __WEBPACK_IMPORTED_MODULE_2__ngb_date__["a" /* NgbDate */].from(date); switch (period) { case 'y': date = this.setYear(date, date.year + number); date.month = 1; date.day = 1; return date; case 'm': date = this.setMonth(date, date.month + number); date.day = 1; return date; case 'd': return this.setDay(date, date.day + number); default: return date; } }; NgbCalendarIslamicUmalqura.prototype.getPrev = function (date, period, number) { if (period === void 0) { period = 'd'; } if (number === void 0) { number = 1; } return this.getNext(date, period, -number); }; NgbCalendarIslamicUmalqura.prototype.getWeekday = function (date) { var day = this.toGregorian(date).getDay(); // in JS Date Sun=0, in ISO 8601 Sun=7 return day === 0 ? 7 : day; }; NgbCalendarIslamicUmalqura.prototype.getWeekNumber = function (week, firstDayOfWeek) { // in JS Date Sun=0, in ISO 8601 Sun=7 if (firstDayOfWeek === 7) { firstDayOfWeek = 0; } var thursdayIndex = (4 + 7 - firstDayOfWeek) % 7; var date = week[thursdayIndex]; var jsDate = this.toGregorian(date); jsDate.setDate(jsDate.getDate() + 4 - (jsDate.getDay() || 7)); // Thursday var time = jsDate.getTime(); var MuhDate = this.toGregorian(new __WEBPACK_IMPORTED_MODULE_2__ngb_date__["a" /* NgbDate */](date.year, 1, 1)); // Compare with Muharram 1 return Math.floor(Math.round((time - MuhDate.getTime()) / ONE_DAY) / 7) + 1; }; NgbCalendarIslamicUmalqura.prototype.getToday = function () { return this.fromGregorian(new Date()); }; NgbCalendarIslamicUmalqura.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_3__angular_core__["Injectable"] }, ]; /** @nocollapse */ NgbCalendarIslamicUmalqura.ctorParameters = function () { return []; }; return NgbCalendarIslamicUmalqura; }(__WEBPACK_IMPORTED_MODULE_1__ngb_calendar_hijri__["a" /* NgbCalendarHijri */])); //# sourceMappingURL=ngb-calendar-islamic-umalqura.js.map /***/ }), /***/ "./node_modules/@ng-bootstrap/ng-bootstrap/datepicker/ngb-calendar.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NgbCalendar; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return NgbCalendarGregorian; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__ngb_date__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/datepicker/ngb-date.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_core__ = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__util_util__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/util/util.js"); var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); function fromJSDate(jsDate) { return new __WEBPACK_IMPORTED_MODULE_0__ngb_date__["a" /* NgbDate */](jsDate.getFullYear(), jsDate.getMonth() + 1, jsDate.getDate()); } function toJSDate(date) { var jsDate = new Date(date.year, date.month - 1, date.day, 12); // this is done avoid 30 -> 1930 conversion if (!isNaN(jsDate.getTime())) { jsDate.setFullYear(date.year); } return jsDate; } var NgbCalendar = (function () { function NgbCalendar() { } NgbCalendar.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Injectable"] }, ]; /** @nocollapse */ NgbCalendar.ctorParameters = function () { return []; }; return NgbCalendar; }()); var NgbCalendarGregorian = (function (_super) { __extends(NgbCalendarGregorian, _super); function NgbCalendarGregorian() { return _super !== null && _super.apply(this, arguments) || this; } NgbCalendarGregorian.prototype.getDaysPerWeek = function () { return 7; }; NgbCalendarGregorian.prototype.getMonths = function () { return [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]; }; NgbCalendarGregorian.prototype.getWeeksPerMonth = function () { return 6; }; NgbCalendarGregorian.prototype.getNext = function (date, period, number) { if (period === void 0) { period = 'd'; } if (number === void 0) { number = 1; } var jsDate = toJSDate(date); switch (period) { case 'y': return new __WEBPACK_IMPORTED_MODULE_0__ngb_date__["a" /* NgbDate */](date.year + number, 1, 1); case 'm': jsDate = new Date(date.year, date.month + number - 1, 1, 12); break; case 'd': jsDate.setDate(jsDate.getDate() + number); break; default: return date; } return fromJSDate(jsDate); }; NgbCalendarGregorian.prototype.getPrev = function (date, period, number) { if (period === void 0) { period = 'd'; } if (number === void 0) { number = 1; } return this.getNext(date, period, -number); }; NgbCalendarGregorian.prototype.getWeekday = function (date) { var jsDate = toJSDate(date); var day = jsDate.getDay(); // in JS Date Sun=0, in ISO 8601 Sun=7 return day === 0 ? 7 : day; }; NgbCalendarGregorian.prototype.getWeekNumber = function (week, firstDayOfWeek) { // in JS Date Sun=0, in ISO 8601 Sun=7 if (firstDayOfWeek === 7) { firstDayOfWeek = 0; } var thursdayIndex = (4 + 7 - firstDayOfWeek) % 7; var date = week[thursdayIndex]; var jsDate = toJSDate(date); jsDate.setDate(jsDate.getDate() + 4 - (jsDate.getDay() || 7)); // Thursday var time = jsDate.getTime(); jsDate.setMonth(0); // Compare with Jan 1 jsDate.setDate(1); return Math.floor(Math.round((time - jsDate.getTime()) / 86400000) / 7) + 1; }; NgbCalendarGregorian.prototype.getToday = function () { return fromJSDate(new Date()); }; NgbCalendarGregorian.prototype.isValid = function (date) { if (!date || !Object(__WEBPACK_IMPORTED_MODULE_2__util_util__["c" /* isInteger */])(date.year) || !Object(__WEBPACK_IMPORTED_MODULE_2__util_util__["c" /* isInteger */])(date.month) || !Object(__WEBPACK_IMPORTED_MODULE_2__util_util__["c" /* isInteger */])(date.day)) { return false; } var jsDate = toJSDate(date); return !isNaN(jsDate.getTime()) && jsDate.getFullYear() === date.year && jsDate.getMonth() + 1 === date.month && jsDate.getDate() === date.day; }; NgbCalendarGregorian.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Injectable"] }, ]; /** @nocollapse */ NgbCalendarGregorian.ctorParameters = function () { return []; }; return NgbCalendarGregorian; }(NgbCalendar)); //# sourceMappingURL=ngb-calendar.js.map /***/ }), /***/ "./node_modules/@ng-bootstrap/ng-bootstrap/datepicker/ngb-date-adapter.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NgbDateAdapter; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return NgbDateStructAdapter; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** * Abstract type serving as a DI token for the service converting from your application Date model to internal * NgbDateStruct model. * A default implementation converting from and to NgbDateStruct is provided for retro-compatibility, * but you can provide another implementation to use an alternative format, ie for using with native Date Object. */ var NgbDateAdapter = (function () { function NgbDateAdapter() { } NgbDateAdapter.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Injectable"] }, ]; /** @nocollapse */ NgbDateAdapter.ctorParameters = function () { return []; }; return NgbDateAdapter; }()); var NgbDateStructAdapter = (function (_super) { __extends(NgbDateStructAdapter, _super); function NgbDateStructAdapter() { return _super !== null && _super.apply(this, arguments) || this; } /** * Converts a NgbDateStruct value into NgbDateStruct value * @param {NgbDateStruct} value * @return {NgbDateStruct} */ /** * Converts a NgbDateStruct value into NgbDateStruct value * @param {NgbDateStruct} value * @return {NgbDateStruct} */ NgbDateStructAdapter.prototype.fromModel = /** * Converts a NgbDateStruct value into NgbDateStruct value * @param {NgbDateStruct} value * @return {NgbDateStruct} */ function (date) { return (date && date.year && date.month && date.day) ? { year: date.year, month: date.month, day: date.day } : null; }; /** * Converts a NgbDateStruct value into NgbDateStruct value * @param {NgbDateStruct} value * @return {NgbDateStruct} */ /** * Converts a NgbDateStruct value into NgbDateStruct value * @param {NgbDateStruct} value * @return {NgbDateStruct} */ NgbDateStructAdapter.prototype.toModel = /** * Converts a NgbDateStruct value into NgbDateStruct value * @param {NgbDateStruct} value * @return {NgbDateStruct} */ function (date) { return (date && date.year && date.month && date.day) ? { year: date.year, month: date.month, day: date.day } : null; }; NgbDateStructAdapter.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Injectable"] }, ]; /** @nocollapse */ NgbDateStructAdapter.ctorParameters = function () { return []; }; return NgbDateStructAdapter; }(NgbDateAdapter)); //# sourceMappingURL=ngb-date-adapter.js.map /***/ }), /***/ "./node_modules/@ng-bootstrap/ng-bootstrap/datepicker/ngb-date-parser-formatter.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return NgbDateParserFormatter; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NgbDateISOParserFormatter; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__util_util__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/util/util.js"); var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** * Abstract type serving as a DI token for the service parsing and formatting dates for the NgbInputDatepicker * directive. A default implementation using the ISO 8601 format is provided, but you can provide another implementation * to use an alternative format. */ var /** * Abstract type serving as a DI token for the service parsing and formatting dates for the NgbInputDatepicker * directive. A default implementation using the ISO 8601 format is provided, but you can provide another implementation * to use an alternative format. */ NgbDateParserFormatter = (function () { function NgbDateParserFormatter() { } return NgbDateParserFormatter; }()); /** * Abstract type serving as a DI token for the service parsing and formatting dates for the NgbInputDatepicker * directive. A default implementation using the ISO 8601 format is provided, but you can provide another implementation * to use an alternative format. */ var NgbDateISOParserFormatter = (function (_super) { __extends(NgbDateISOParserFormatter, _super); function NgbDateISOParserFormatter() { return _super !== null && _super.apply(this, arguments) || this; } NgbDateISOParserFormatter.prototype.parse = function (value) { if (value) { var dateParts = value.trim().split('-'); if (dateParts.length === 1 && Object(__WEBPACK_IMPORTED_MODULE_0__util_util__["d" /* isNumber */])(dateParts[0])) { return { year: Object(__WEBPACK_IMPORTED_MODULE_0__util_util__["h" /* toInteger */])(dateParts[0]), month: null, day: null }; } else if (dateParts.length === 2 && Object(__WEBPACK_IMPORTED_MODULE_0__util_util__["d" /* isNumber */])(dateParts[0]) && Object(__WEBPACK_IMPORTED_MODULE_0__util_util__["d" /* isNumber */])(dateParts[1])) { return { year: Object(__WEBPACK_IMPORTED_MODULE_0__util_util__["h" /* toInteger */])(dateParts[0]), month: Object(__WEBPACK_IMPORTED_MODULE_0__util_util__["h" /* toInteger */])(dateParts[1]), day: null }; } else if (dateParts.length === 3 && Object(__WEBPACK_IMPORTED_MODULE_0__util_util__["d" /* isNumber */])(dateParts[0]) && Object(__WEBPACK_IMPORTED_MODULE_0__util_util__["d" /* isNumber */])(dateParts[1]) && Object(__WEBPACK_IMPORTED_MODULE_0__util_util__["d" /* isNumber */])(dateParts[2])) { return { year: Object(__WEBPACK_IMPORTED_MODULE_0__util_util__["h" /* toInteger */])(dateParts[0]), month: Object(__WEBPACK_IMPORTED_MODULE_0__util_util__["h" /* toInteger */])(dateParts[1]), day: Object(__WEBPACK_IMPORTED_MODULE_0__util_util__["h" /* toInteger */])(dateParts[2]) }; } } return null; }; NgbDateISOParserFormatter.prototype.format = function (date) { return date ? date.year + "-" + (Object(__WEBPACK_IMPORTED_MODULE_0__util_util__["d" /* isNumber */])(date.month) ? Object(__WEBPACK_IMPORTED_MODULE_0__util_util__["f" /* padNumber */])(date.month) : '') + "-" + (Object(__WEBPACK_IMPORTED_MODULE_0__util_util__["d" /* isNumber */])(date.day) ? Object(__WEBPACK_IMPORTED_MODULE_0__util_util__["f" /* padNumber */])(date.day) : '') : ''; }; return NgbDateISOParserFormatter; }(NgbDateParserFormatter)); //# sourceMappingURL=ngb-date-parser-formatter.js.map /***/ }), /***/ "./node_modules/@ng-bootstrap/ng-bootstrap/datepicker/ngb-date.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NgbDate; }); var NgbDate = (function () { function NgbDate(year, month, day) { this.year = year; this.month = month; this.day = day; } NgbDate.from = function (date) { return date ? new NgbDate(date.year, date.month, date.day ? date.day : 1) : null; }; NgbDate.prototype.equals = function (other) { return other && this.year === other.year && this.month === other.month && this.day === other.day; }; NgbDate.prototype.before = function (other) { if (!other) { return false; } if (this.year === other.year) { if (this.month === other.month) { return this.day === other.day ? false : this.day < other.day; } else { return this.month < other.month; } } else { return this.year < other.year; } }; NgbDate.prototype.after = function (other) { if (!other) { return false; } if (this.year === other.year) { if (this.month === other.month) { return this.day === other.day ? false : this.day > other.day; } else { return this.month > other.month; } } else { return this.year > other.year; } }; NgbDate.prototype.toStruct = function () { return { year: this.year, month: this.month, day: this.day }; }; NgbDate.prototype.toString = function () { return this.year + "-" + this.month + "-" + this.day; }; return NgbDate; }()); //# sourceMappingURL=ngb-date.js.map /***/ }), /***/ "./node_modules/@ng-bootstrap/ng-bootstrap/dropdown/dropdown-config.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NgbDropdownConfig; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); /** * Configuration service for the NgbDropdown directive. * You can inject this service, typically in your root component, and customize the values of its properties in * order to provide default values for all the dropdowns used in the application. */ var NgbDropdownConfig = (function () { function NgbDropdownConfig() { this.autoClose = true; this.placement = 'bottom-left'; } NgbDropdownConfig.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Injectable"] }, ]; /** @nocollapse */ NgbDropdownConfig.ctorParameters = function () { return []; }; return NgbDropdownConfig; }()); //# sourceMappingURL=dropdown-config.js.map /***/ }), /***/ "./node_modules/@ng-bootstrap/ng-bootstrap/dropdown/dropdown.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return NgbDropdownMenu; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return NgbDropdownAnchor; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return NgbDropdownToggle; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NgbDropdown; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__dropdown_config__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/dropdown/dropdown-config.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__util_positioning__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/util/positioning.js"); var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** */ var NgbDropdownMenu = (function () { function NgbDropdownMenu(dropdown, _elementRef, _renderer) { this.dropdown = dropdown; this._elementRef = _elementRef; this._renderer = _renderer; this.placement = 'bottom'; this.isOpen = false; } NgbDropdownMenu.prototype.isEventFrom = function ($event) { return this._elementRef.nativeElement.contains($event.target); }; NgbDropdownMenu.prototype.position = function (triggerEl, placement) { this.applyPlacement(Object(__WEBPACK_IMPORTED_MODULE_2__util_positioning__["a" /* positionElements */])(triggerEl, this._elementRef.nativeElement, placement)); }; NgbDropdownMenu.prototype.applyPlacement = function (_placement) { // remove the current placement classes this._renderer.removeClass(this._elementRef.nativeElement.parentNode, 'dropup'); this._renderer.removeClass(this._elementRef.nativeElement.parentNode, 'dropdown'); this.placement = _placement; /** * apply the new placement * in case of top use up-arrow or down-arrow otherwise */ if (_placement.search('^top') !== -1) { this._renderer.addClass(this._elementRef.nativeElement.parentNode, 'dropup'); } else { this._renderer.addClass(this._elementRef.nativeElement.parentNode, 'dropdown'); } }; NgbDropdownMenu.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: '[ngbDropdownMenu]', host: { '[class.dropdown-menu]': 'true', '[class.show]': 'dropdown.isOpen()', '[attr.x-placement]': 'placement' } },] }, ]; /** @nocollapse */ NgbDropdownMenu.ctorParameters = function () { return [ { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Inject"], args: [Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["forwardRef"])(function () { return NgbDropdown; }),] },] }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ElementRef"], }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Renderer2"], }, ]; }; return NgbDropdownMenu; }()); /** * Marks an element to which dropdown menu will be anchored. This is a simple version * of the NgbDropdownToggle directive. It plays the same role as NgbDropdownToggle but * doesn't listen to click events to toggle dropdown menu thus enabling support for * events other than click. * * @since 1.1.0 */ var NgbDropdownAnchor = (function () { function NgbDropdownAnchor(dropdown, _elementRef) { this.dropdown = dropdown; this._elementRef = _elementRef; this.anchorEl = _elementRef.nativeElement; } NgbDropdownAnchor.prototype.isEventFrom = function ($event) { return this._elementRef.nativeElement.contains($event.target); }; NgbDropdownAnchor.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: '[ngbDropdownAnchor]', host: { 'class': 'dropdown-toggle', 'aria-haspopup': 'true', '[attr.aria-expanded]': 'dropdown.isOpen()' } },] }, ]; /** @nocollapse */ NgbDropdownAnchor.ctorParameters = function () { return [ { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Inject"], args: [Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["forwardRef"])(function () { return NgbDropdown; }),] },] }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ElementRef"], }, ]; }; return NgbDropdownAnchor; }()); /** * Allows the dropdown to be toggled via click. This directive is optional: you can use NgbDropdownAnchor as an * alternative. */ var NgbDropdownToggle = (function (_super) { __extends(NgbDropdownToggle, _super); function NgbDropdownToggle(dropdown, elementRef) { return _super.call(this, dropdown, elementRef) || this; } NgbDropdownToggle.prototype.toggleOpen = function () { this.dropdown.toggle(); }; NgbDropdownToggle.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: '[ngbDropdownToggle]', host: { 'class': 'dropdown-toggle', 'aria-haspopup': 'true', '[attr.aria-expanded]': 'dropdown.isOpen()', '(click)': 'toggleOpen()' }, providers: [{ provide: NgbDropdownAnchor, useExisting: Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["forwardRef"])(function () { return NgbDropdownToggle; }) }] },] }, ]; /** @nocollapse */ NgbDropdownToggle.ctorParameters = function () { return [ { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Inject"], args: [Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["forwardRef"])(function () { return NgbDropdown; }),] },] }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ElementRef"], }, ]; }; return NgbDropdownToggle; }(NgbDropdownAnchor)); /** * Transforms a node into a dropdown. */ var NgbDropdown = (function () { function NgbDropdown(config, ngZone) { var _this = this; /** * Defines whether or not the dropdown-menu is open initially. */ this._open = false; /** * An event fired when the dropdown is opened or closed. * Event's payload equals whether dropdown is open. */ this.openChange = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); this.placement = config.placement; this.autoClose = config.autoClose; this._zoneSubscription = ngZone.onStable.subscribe(function () { _this._positionMenu(); }); } NgbDropdown.prototype.ngOnInit = function () { if (this._menu) { this._menu.applyPlacement(Array.isArray(this.placement) ? (this.placement[0]) : this.placement); } }; /** * Checks if the dropdown menu is open or not. */ /** * Checks if the dropdown menu is open or not. */ NgbDropdown.prototype.isOpen = /** * Checks if the dropdown menu is open or not. */ function () { return this._open; }; /** * Opens the dropdown menu of a given navbar or tabbed navigation. */ /** * Opens the dropdown menu of a given navbar or tabbed navigation. */ NgbDropdown.prototype.open = /** * Opens the dropdown menu of a given navbar or tabbed navigation. */ function () { if (!this._open) { this._open = true; this._positionMenu(); this.openChange.emit(true); } }; /** * Closes the dropdown menu of a given navbar or tabbed navigation. */ /** * Closes the dropdown menu of a given navbar or tabbed navigation. */ NgbDropdown.prototype.close = /** * Closes the dropdown menu of a given navbar or tabbed navigation. */ function () { if (this._open) { this._open = false; this.openChange.emit(false); } }; /** * Toggles the dropdown menu of a given navbar or tabbed navigation. */ /** * Toggles the dropdown menu of a given navbar or tabbed navigation. */ NgbDropdown.prototype.toggle = /** * Toggles the dropdown menu of a given navbar or tabbed navigation. */ function () { if (this.isOpen()) { this.close(); } else { this.open(); } }; NgbDropdown.prototype.closeFromClick = function ($event) { if (this.autoClose && $event.button !== 2 && !this._isEventFromToggle($event)) { if (this.autoClose === true) { this.close(); } else if (this.autoClose === 'inside' && this._isEventFromMenu($event)) { this.close(); } else if (this.autoClose === 'outside' && !this._isEventFromMenu($event)) { this.close(); } } }; NgbDropdown.prototype.closeFromOutsideEsc = function () { if (this.autoClose) { this.close(); } }; NgbDropdown.prototype.ngOnDestroy = function () { this._zoneSubscription.unsubscribe(); }; NgbDropdown.prototype._isEventFromToggle = function ($event) { return this._anchor.isEventFrom($event); }; NgbDropdown.prototype._isEventFromMenu = function ($event) { return this._menu ? this._menu.isEventFrom($event) : false; }; NgbDropdown.prototype._positionMenu = function () { if (this.isOpen() && this._menu) { this._menu.position(this._anchor.anchorEl, this.placement); } }; NgbDropdown.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: '[ngbDropdown]', exportAs: 'ngbDropdown', host: { '[class.show]': 'isOpen()', '(keyup.esc)': 'closeFromOutsideEsc()', '(document:click)': 'closeFromClick($event)' } },] }, ]; /** @nocollapse */ NgbDropdown.ctorParameters = function () { return [ { type: __WEBPACK_IMPORTED_MODULE_1__dropdown_config__["a" /* NgbDropdownConfig */], }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["NgZone"], }, ]; }; NgbDropdown.propDecorators = { "_menu": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ContentChild"], args: [NgbDropdownMenu,] },], "_anchor": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ContentChild"], args: [NgbDropdownAnchor,] },], "autoClose": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "_open": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"], args: ['open',] },], "placement": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "openChange": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"] },], }; return NgbDropdown; }()); //# sourceMappingURL=dropdown.js.map /***/ }), /***/ "./node_modules/@ng-bootstrap/ng-bootstrap/dropdown/dropdown.module.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NgbDropdownModule; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__dropdown__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/dropdown/dropdown.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__dropdown_config__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/dropdown/dropdown-config.js"); /* unused harmony reexport NgbDropdown */ /* unused harmony reexport NgbDropdownToggle */ /* unused harmony reexport NgbDropdownMenu */ /* unused harmony reexport NgbDropdownConfig */ var NGB_DROPDOWN_DIRECTIVES = [__WEBPACK_IMPORTED_MODULE_1__dropdown__["a" /* NgbDropdown */], __WEBPACK_IMPORTED_MODULE_1__dropdown__["b" /* NgbDropdownAnchor */], __WEBPACK_IMPORTED_MODULE_1__dropdown__["d" /* NgbDropdownToggle */], __WEBPACK_IMPORTED_MODULE_1__dropdown__["c" /* NgbDropdownMenu */]]; var NgbDropdownModule = (function () { function NgbDropdownModule() { } NgbDropdownModule.forRoot = function () { return { ngModule: NgbDropdownModule, providers: [__WEBPACK_IMPORTED_MODULE_2__dropdown_config__["a" /* NgbDropdownConfig */]] }; }; NgbDropdownModule.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["NgModule"], args: [{ declarations: NGB_DROPDOWN_DIRECTIVES, exports: NGB_DROPDOWN_DIRECTIVES },] }, ]; /** @nocollapse */ NgbDropdownModule.ctorParameters = function () { return []; }; return NgbDropdownModule; }()); //# sourceMappingURL=dropdown.module.js.map /***/ }), /***/ "./node_modules/@ng-bootstrap/ng-bootstrap/index.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export NgbRootModule */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return NgbModule; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__accordion_accordion_module__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/accordion/accordion.module.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__alert_alert_module__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/alert/alert.module.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__buttons_buttons_module__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/buttons/buttons.module.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__carousel_carousel_module__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/carousel/carousel.module.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__collapse_collapse_module__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/collapse/collapse.module.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__datepicker_datepicker_module__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/datepicker/datepicker.module.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__dropdown_dropdown_module__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/dropdown/dropdown.module.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__modal_modal_module__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/modal/modal.module.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__pagination_pagination_module__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/pagination/pagination.module.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__popover_popover_module__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/popover/popover.module.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__progressbar_progressbar_module__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/progressbar/progressbar.module.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__rating_rating_module__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/rating/rating.module.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__tabset_tabset_module__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/tabset/tabset.module.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__timepicker_timepicker_module__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/timepicker/timepicker.module.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__tooltip_tooltip_module__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/tooltip/tooltip.module.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__typeahead_typeahead_module__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/typeahead/typeahead.module.js"); /* unused harmony reexport NgbAccordionModule */ /* unused harmony reexport NgbAccordionConfig */ /* unused harmony reexport NgbAccordion */ /* unused harmony reexport NgbPanel */ /* unused harmony reexport NgbPanelTitle */ /* unused harmony reexport NgbPanelContent */ /* unused harmony reexport NgbAlertModule */ /* unused harmony reexport NgbAlertConfig */ /* unused harmony reexport NgbAlert */ /* unused harmony reexport NgbButtonsModule */ /* unused harmony reexport NgbCheckBox */ /* unused harmony reexport NgbRadioGroup */ /* unused harmony reexport NgbCarouselModule */ /* unused harmony reexport NgbCarouselConfig */ /* unused harmony reexport NgbCarousel */ /* unused harmony reexport NgbSlide */ /* unused harmony reexport NgbCollapseModule */ /* unused harmony reexport NgbCollapse */ /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return __WEBPACK_IMPORTED_MODULE_6__datepicker_datepicker_module__["a"]; }); /* unused harmony reexport NgbCalendarIslamicCivil */ /* unused harmony reexport NgbCalendarIslamicUmalqura */ /* unused harmony reexport NgbDatepickerModule */ /* unused harmony reexport NgbDatepickerI18n */ /* unused harmony reexport NgbDatepickerConfig */ /* unused harmony reexport NgbDateParserFormatter */ /* unused harmony reexport NgbDateAdapter */ /* unused harmony reexport NgbDatepicker */ /* unused harmony reexport NgbInputDatepicker */ /* unused harmony reexport NgbDropdownModule */ /* unused harmony reexport NgbDropdownConfig */ /* unused harmony reexport NgbDropdown */ /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return __WEBPACK_IMPORTED_MODULE_8__modal_modal_module__["a"]; }); /* unused harmony reexport NgbModal */ /* unused harmony reexport NgbActiveModal */ /* unused harmony reexport NgbModalRef */ /* unused harmony reexport ModalDismissReasons */ /* unused harmony reexport NgbPaginationModule */ /* unused harmony reexport NgbPaginationConfig */ /* unused harmony reexport NgbPagination */ /* unused harmony reexport NgbPopoverModule */ /* unused harmony reexport NgbPopoverConfig */ /* unused harmony reexport NgbPopover */ /* unused harmony reexport NgbProgressbarModule */ /* unused harmony reexport NgbProgressbarConfig */ /* unused harmony reexport NgbProgressbar */ /* unused harmony reexport NgbRatingModule */ /* unused harmony reexport NgbRatingConfig */ /* unused harmony reexport NgbRating */ /* unused harmony reexport NgbTabsetModule */ /* unused harmony reexport NgbTabsetConfig */ /* unused harmony reexport NgbTabset */ /* unused harmony reexport NgbTab */ /* unused harmony reexport NgbTabContent */ /* unused harmony reexport NgbTabTitle */ /* unused harmony reexport NgbTimepickerModule */ /* unused harmony reexport NgbTimepickerConfig */ /* unused harmony reexport NgbTimepicker */ /* unused harmony reexport NgbTooltipModule */ /* unused harmony reexport NgbTooltipConfig */ /* unused harmony reexport NgbTooltip */ /* unused harmony reexport NgbHighlight */ /* unused harmony reexport NgbTypeaheadModule */ /* unused harmony reexport NgbTypeaheadConfig */ /* unused harmony reexport NgbTypeahead */ var NGB_MODULES = [ __WEBPACK_IMPORTED_MODULE_1__accordion_accordion_module__["a" /* NgbAccordionModule */], __WEBPACK_IMPORTED_MODULE_2__alert_alert_module__["a" /* NgbAlertModule */], __WEBPACK_IMPORTED_MODULE_3__buttons_buttons_module__["a" /* NgbButtonsModule */], __WEBPACK_IMPORTED_MODULE_4__carousel_carousel_module__["a" /* NgbCarouselModule */], __WEBPACK_IMPORTED_MODULE_5__collapse_collapse_module__["a" /* NgbCollapseModule */], __WEBPACK_IMPORTED_MODULE_6__datepicker_datepicker_module__["b" /* NgbDatepickerModule */], __WEBPACK_IMPORTED_MODULE_7__dropdown_dropdown_module__["a" /* NgbDropdownModule */], __WEBPACK_IMPORTED_MODULE_8__modal_modal_module__["a" /* NgbModalModule */], __WEBPACK_IMPORTED_MODULE_9__pagination_pagination_module__["a" /* NgbPaginationModule */], __WEBPACK_IMPORTED_MODULE_10__popover_popover_module__["a" /* NgbPopoverModule */], __WEBPACK_IMPORTED_MODULE_11__progressbar_progressbar_module__["a" /* NgbProgressbarModule */], __WEBPACK_IMPORTED_MODULE_12__rating_rating_module__["a" /* NgbRatingModule */], __WEBPACK_IMPORTED_MODULE_13__tabset_tabset_module__["a" /* NgbTabsetModule */], __WEBPACK_IMPORTED_MODULE_14__timepicker_timepicker_module__["a" /* NgbTimepickerModule */], __WEBPACK_IMPORTED_MODULE_15__tooltip_tooltip_module__["a" /* NgbTooltipModule */], __WEBPACK_IMPORTED_MODULE_16__typeahead_typeahead_module__["a" /* NgbTypeaheadModule */] ]; var NgbRootModule = (function () { function NgbRootModule() { } NgbRootModule.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["NgModule"], args: [{ imports: [ __WEBPACK_IMPORTED_MODULE_2__alert_alert_module__["a" /* NgbAlertModule */].forRoot(), __WEBPACK_IMPORTED_MODULE_3__buttons_buttons_module__["a" /* NgbButtonsModule */].forRoot(), __WEBPACK_IMPORTED_MODULE_5__collapse_collapse_module__["a" /* NgbCollapseModule */].forRoot(), __WEBPACK_IMPORTED_MODULE_11__progressbar_progressbar_module__["a" /* NgbProgressbarModule */].forRoot(), __WEBPACK_IMPORTED_MODULE_15__tooltip_tooltip_module__["a" /* NgbTooltipModule */].forRoot(), __WEBPACK_IMPORTED_MODULE_16__typeahead_typeahead_module__["a" /* NgbTypeaheadModule */].forRoot(), __WEBPACK_IMPORTED_MODULE_1__accordion_accordion_module__["a" /* NgbAccordionModule */].forRoot(), __WEBPACK_IMPORTED_MODULE_4__carousel_carousel_module__["a" /* NgbCarouselModule */].forRoot(), __WEBPACK_IMPORTED_MODULE_6__datepicker_datepicker_module__["b" /* NgbDatepickerModule */].forRoot(), __WEBPACK_IMPORTED_MODULE_7__dropdown_dropdown_module__["a" /* NgbDropdownModule */].forRoot(), __WEBPACK_IMPORTED_MODULE_8__modal_modal_module__["a" /* NgbModalModule */].forRoot(), __WEBPACK_IMPORTED_MODULE_9__pagination_pagination_module__["a" /* NgbPaginationModule */].forRoot(), __WEBPACK_IMPORTED_MODULE_10__popover_popover_module__["a" /* NgbPopoverModule */].forRoot(), __WEBPACK_IMPORTED_MODULE_11__progressbar_progressbar_module__["a" /* NgbProgressbarModule */].forRoot(), __WEBPACK_IMPORTED_MODULE_12__rating_rating_module__["a" /* NgbRatingModule */].forRoot(), __WEBPACK_IMPORTED_MODULE_13__tabset_tabset_module__["a" /* NgbTabsetModule */].forRoot(), __WEBPACK_IMPORTED_MODULE_14__timepicker_timepicker_module__["a" /* NgbTimepickerModule */].forRoot(), __WEBPACK_IMPORTED_MODULE_15__tooltip_tooltip_module__["a" /* NgbTooltipModule */].forRoot() ], exports: NGB_MODULES },] }, ]; /** @nocollapse */ NgbRootModule.ctorParameters = function () { return []; }; return NgbRootModule; }()); var NgbModule = (function () { function NgbModule() { } NgbModule.forRoot = function () { return { ngModule: NgbRootModule }; }; NgbModule.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["NgModule"], args: [{ imports: NGB_MODULES, exports: NGB_MODULES },] }, ]; /** @nocollapse */ NgbModule.ctorParameters = function () { return []; }; return NgbModule; }()); //# sourceMappingURL=index.js.map /***/ }), /***/ "./node_modules/@ng-bootstrap/ng-bootstrap/modal/modal-backdrop.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NgbModalBackdrop; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var NgbModalBackdrop = (function () { function NgbModalBackdrop() { } NgbModalBackdrop.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"], args: [{ selector: 'ngb-modal-backdrop', template: '', host: { '[class]': '"modal-backdrop fade show" + (backdropClass ? " " + backdropClass : "")' } },] }, ]; /** @nocollapse */ NgbModalBackdrop.ctorParameters = function () { return []; }; NgbModalBackdrop.propDecorators = { "backdropClass": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], }; return NgbModalBackdrop; }()); //# sourceMappingURL=modal-backdrop.js.map /***/ }), /***/ "./node_modules/@ng-bootstrap/ng-bootstrap/modal/modal-dismiss-reasons.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ModalDismissReasons; }); var ModalDismissReasons; (function (ModalDismissReasons) { ModalDismissReasons[ModalDismissReasons["BACKDROP_CLICK"] = 0] = "BACKDROP_CLICK"; ModalDismissReasons[ModalDismissReasons["ESC"] = 1] = "ESC"; })(ModalDismissReasons || (ModalDismissReasons = {})); //# sourceMappingURL=modal-dismiss-reasons.js.map /***/ }), /***/ "./node_modules/@ng-bootstrap/ng-bootstrap/modal/modal-ref.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NgbActiveModal; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return NgbModalRef; }); /** * A reference to an active (currently opened) modal. Instances of this class * can be injected into components passed as modal content. */ var /** * A reference to an active (currently opened) modal. Instances of this class * can be injected into components passed as modal content. */ NgbActiveModal = (function () { function NgbActiveModal() { } /** * Can be used to close a modal, passing an optional result. */ /** * Can be used to close a modal, passing an optional result. */ NgbActiveModal.prototype.close = /** * Can be used to close a modal, passing an optional result. */ function (result) { }; /** * Can be used to dismiss a modal, passing an optional reason. */ /** * Can be used to dismiss a modal, passing an optional reason. */ NgbActiveModal.prototype.dismiss = /** * Can be used to dismiss a modal, passing an optional reason. */ function (reason) { }; return NgbActiveModal; }()); /** * A reference to an active (currently opened) modal. Instances of this class * can be injected into components passed as modal content. */ /** * A reference to a newly opened modal. */ var /** * A reference to a newly opened modal. */ NgbModalRef = (function () { function NgbModalRef(_windowCmptRef, _contentRef, _backdropCmptRef, _beforeDismiss) { var _this = this; this._windowCmptRef = _windowCmptRef; this._contentRef = _contentRef; this._backdropCmptRef = _backdropCmptRef; this._beforeDismiss = _beforeDismiss; _windowCmptRef.instance.dismissEvent.subscribe(function (reason) { _this.dismiss(reason); }); this.result = new Promise(function (resolve, reject) { _this._resolve = resolve; _this._reject = reject; }); this.result.then(null, function () { }); } Object.defineProperty(NgbModalRef.prototype, "componentInstance", { /** * The instance of component used as modal's content. * Undefined when a TemplateRef is used as modal's content. */ get: /** * The instance of component used as modal's content. * Undefined when a TemplateRef is used as modal's content. */ function () { if (this._contentRef.componentRef) { return this._contentRef.componentRef.instance; } }, // only needed to keep TS1.8 compatibility set: // only needed to keep TS1.8 compatibility function (instance) { }, enumerable: true, configurable: true }); /** * Can be used to close a modal, passing an optional result. */ /** * Can be used to close a modal, passing an optional result. */ NgbModalRef.prototype.close = /** * Can be used to close a modal, passing an optional result. */ function (result) { if (this._windowCmptRef) { this._resolve(result); this._removeModalElements(); } }; /** * Can be used to dismiss a modal, passing an optional reason. */ /** * Can be used to dismiss a modal, passing an optional reason. */ NgbModalRef.prototype.dismiss = /** * Can be used to dismiss a modal, passing an optional reason. */ function (reason) { if (this._windowCmptRef) { if (!this._beforeDismiss || this._beforeDismiss() !== false) { this._reject(reason); this._removeModalElements(); } } }; NgbModalRef.prototype._removeModalElements = function () { var windowNativeEl = this._windowCmptRef.location.nativeElement; windowNativeEl.parentNode.removeChild(windowNativeEl); this._windowCmptRef.destroy(); if (this._backdropCmptRef) { var backdropNativeEl = this._backdropCmptRef.location.nativeElement; backdropNativeEl.parentNode.removeChild(backdropNativeEl); this._backdropCmptRef.destroy(); } if (this._contentRef && this._contentRef.viewRef) { this._contentRef.viewRef.destroy(); } this._windowCmptRef = null; this._backdropCmptRef = null; this._contentRef = null; }; return NgbModalRef; }()); /** * A reference to a newly opened modal. */ //# sourceMappingURL=modal-ref.js.map /***/ }), /***/ "./node_modules/@ng-bootstrap/ng-bootstrap/modal/modal-stack.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NgbModalStack; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_common__ = __webpack_require__("./node_modules/@angular/common/esm2015/common.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_core__ = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__util_popup__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/util/popup.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__util_util__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/util/util.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__modal_backdrop__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/modal/modal-backdrop.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__modal_window__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/modal/modal-window.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__modal_ref__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/modal/modal-ref.js"); var NgbModalStack = (function () { function NgbModalStack(_applicationRef, _injector, _componentFactoryResolver, document) { this._applicationRef = _applicationRef; this._injector = _injector; this._componentFactoryResolver = _componentFactoryResolver; this._windowAttributes = ['backdrop', 'centered', 'keyboard', 'size', 'windowClass']; this._backdropAttributes = ['backdropClass']; this._document = document; } NgbModalStack.prototype.open = function (moduleCFR, contentInjector, content, options) { var containerEl = Object(__WEBPACK_IMPORTED_MODULE_3__util_util__["b" /* isDefined */])(options.container) ? this._document.querySelector(options.container) : this._document.body; if (!containerEl) { throw new Error("The specified modal container \"" + (options.container || 'body') + "\" was not found in the DOM."); } var activeModal = new __WEBPACK_IMPORTED_MODULE_6__modal_ref__["a" /* NgbActiveModal */](); var contentRef = this._getContentRef(moduleCFR, options.injector || contentInjector, content, activeModal); var backdropCmptRef = options.backdrop !== false ? this._attachBackdrop(containerEl) : null; var windowCmptRef = this._attachWindowComponent(containerEl, contentRef); var ngbModalRef = new __WEBPACK_IMPORTED_MODULE_6__modal_ref__["b" /* NgbModalRef */](windowCmptRef, contentRef, backdropCmptRef, options.beforeDismiss); activeModal.close = function (result) { ngbModalRef.close(result); }; activeModal.dismiss = function (reason) { ngbModalRef.dismiss(reason); }; this._applyWindowOptions(windowCmptRef.instance, options); if (backdropCmptRef && backdropCmptRef.instance) { this._applyBackdropOptions(backdropCmptRef.instance, options); } return ngbModalRef; }; NgbModalStack.prototype._attachBackdrop = function (containerEl) { var backdropFactory = this._componentFactoryResolver.resolveComponentFactory(__WEBPACK_IMPORTED_MODULE_4__modal_backdrop__["a" /* NgbModalBackdrop */]); var backdropCmptRef = backdropFactory.create(this._injector); this._applicationRef.attachView(backdropCmptRef.hostView); containerEl.appendChild(backdropCmptRef.location.nativeElement); return backdropCmptRef; }; NgbModalStack.prototype._attachWindowComponent = function (containerEl, contentRef) { var windowFactory = this._componentFactoryResolver.resolveComponentFactory(__WEBPACK_IMPORTED_MODULE_5__modal_window__["a" /* NgbModalWindow */]); var windowCmptRef = windowFactory.create(this._injector, contentRef.nodes); this._applicationRef.attachView(windowCmptRef.hostView); containerEl.appendChild(windowCmptRef.location.nativeElement); return windowCmptRef; }; NgbModalStack.prototype._applyWindowOptions = function (windowInstance, options) { this._windowAttributes.forEach(function (optionName) { if (Object(__WEBPACK_IMPORTED_MODULE_3__util_util__["b" /* isDefined */])(options[optionName])) { windowInstance[optionName] = options[optionName]; } }); }; NgbModalStack.prototype._applyBackdropOptions = function (backdropInstance, options) { this._backdropAttributes.forEach(function (optionName) { if (Object(__WEBPACK_IMPORTED_MODULE_3__util_util__["b" /* isDefined */])(options[optionName])) { backdropInstance[optionName] = options[optionName]; } }); }; NgbModalStack.prototype._getContentRef = function (moduleCFR, contentInjector, content, context) { if (!content) { return new __WEBPACK_IMPORTED_MODULE_2__util_popup__["a" /* ContentRef */]([]); } else if (content instanceof __WEBPACK_IMPORTED_MODULE_1__angular_core__["TemplateRef"]) { return this._createFromTemplateRef(content, context); } else if (Object(__WEBPACK_IMPORTED_MODULE_3__util_util__["e" /* isString */])(content)) { return this._createFromString(content); } else { return this._createFromComponent(moduleCFR, contentInjector, content, context); } }; NgbModalStack.prototype._createFromTemplateRef = function (content, context) { var viewRef = content.createEmbeddedView(context); this._applicationRef.attachView(viewRef); return new __WEBPACK_IMPORTED_MODULE_2__util_popup__["a" /* ContentRef */]([viewRef.rootNodes], viewRef); }; NgbModalStack.prototype._createFromString = function (content) { var component = this._document.createTextNode("" + content); return new __WEBPACK_IMPORTED_MODULE_2__util_popup__["a" /* ContentRef */]([[component]]); }; NgbModalStack.prototype._createFromComponent = function (moduleCFR, contentInjector, content, context) { var contentCmptFactory = moduleCFR.resolveComponentFactory(content); var modalContentInjector = __WEBPACK_IMPORTED_MODULE_1__angular_core__["ReflectiveInjector"].resolveAndCreate([{ provide: __WEBPACK_IMPORTED_MODULE_6__modal_ref__["a" /* NgbActiveModal */], useValue: context }], contentInjector); var componentRef = contentCmptFactory.create(modalContentInjector); this._applicationRef.attachView(componentRef.hostView); return new __WEBPACK_IMPORTED_MODULE_2__util_popup__["a" /* ContentRef */]([[componentRef.location.nativeElement]], componentRef.hostView, componentRef); }; NgbModalStack.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Injectable"] }, ]; /** @nocollapse */ NgbModalStack.ctorParameters = function () { return [ { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["ApplicationRef"], }, { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Injector"], }, { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["ComponentFactoryResolver"], }, { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Inject"], args: [__WEBPACK_IMPORTED_MODULE_0__angular_common__["DOCUMENT"],] },] }, ]; }; return NgbModalStack; }()); //# sourceMappingURL=modal-stack.js.map /***/ }), /***/ "./node_modules/@ng-bootstrap/ng-bootstrap/modal/modal-window.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NgbModalWindow; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_common__ = __webpack_require__("./node_modules/@angular/common/esm2015/common.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_core__ = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__modal_dismiss_reasons__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/modal/modal-dismiss-reasons.js"); var NgbModalWindow = (function () { function NgbModalWindow(document, _elRef, _renderer) { this._elRef = _elRef; this._renderer = _renderer; this.backdrop = true; this.keyboard = true; this.dismissEvent = new __WEBPACK_IMPORTED_MODULE_1__angular_core__["EventEmitter"](); this._document = document; } NgbModalWindow.prototype.backdropClick = function ($event) { if (this.backdrop === true && this._elRef.nativeElement === $event.target) { this.dismiss(__WEBPACK_IMPORTED_MODULE_2__modal_dismiss_reasons__["a" /* ModalDismissReasons */].BACKDROP_CLICK); } }; NgbModalWindow.prototype.escKey = function ($event) { if (this.keyboard && !$event.defaultPrevented) { this.dismiss(__WEBPACK_IMPORTED_MODULE_2__modal_dismiss_reasons__["a" /* ModalDismissReasons */].ESC); } }; NgbModalWindow.prototype.dismiss = function (reason) { this.dismissEvent.emit(reason); }; NgbModalWindow.prototype.ngOnInit = function () { this._elWithFocus = this._document.activeElement; this._renderer.addClass(this._document.body, 'modal-open'); }; NgbModalWindow.prototype.ngAfterViewInit = function () { if (!this._elRef.nativeElement.contains(document.activeElement)) { this._elRef.nativeElement['focus'].apply(this._elRef.nativeElement, []); } }; NgbModalWindow.prototype.ngOnDestroy = function () { var body = this._document.body; var elWithFocus = this._elWithFocus; var elementToFocus; if (elWithFocus && elWithFocus['focus'] && body.contains(elWithFocus)) { elementToFocus = elWithFocus; } else { elementToFocus = body; } elementToFocus['focus'].apply(elementToFocus, []); this._elWithFocus = null; this._renderer.removeClass(body, 'modal-open'); }; NgbModalWindow.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Component"], args: [{ selector: 'ngb-modal-window', host: { '[class]': '"modal fade show d-block" + (windowClass ? " " + windowClass : "")', 'role': 'dialog', 'tabindex': '-1', '(keyup.esc)': 'escKey($event)', '(click)': 'backdropClick($event)' }, template: "\n <div [class]=\"'modal-dialog' + (size ? ' modal-' + size : '') + (centered ? ' modal-dialog-centered' : '')\" role=\"document\">\n <div class=\"modal-content\"><ng-content></ng-content></div>\n </div>\n " },] }, ]; /** @nocollapse */ NgbModalWindow.ctorParameters = function () { return [ { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Inject"], args: [__WEBPACK_IMPORTED_MODULE_0__angular_common__["DOCUMENT"],] },] }, { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["ElementRef"], }, { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Renderer2"], }, ]; }; NgbModalWindow.propDecorators = { "backdrop": [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Input"] },], "centered": [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Input"] },], "keyboard": [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Input"] },], "size": [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Input"] },], "windowClass": [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Input"] },], "dismissEvent": [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Output"], args: ['dismiss',] },], }; return NgbModalWindow; }()); //# sourceMappingURL=modal-window.js.map /***/ }), /***/ "./node_modules/@ng-bootstrap/ng-bootstrap/modal/modal.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NgbModal; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__modal_stack__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/modal/modal-stack.js"); /** * A service to open modal windows. Creating a modal is straightforward: create a template and pass it as an argument to * the "open" method! */ var NgbModal = (function () { function NgbModal(_moduleCFR, _injector, _modalStack) { this._moduleCFR = _moduleCFR; this._injector = _injector; this._modalStack = _modalStack; } /** * Opens a new modal window with the specified content and using supplied options. Content can be provided * as a TemplateRef or a component type. If you pass a component type as content than instances of those * components can be injected with an instance of the NgbActiveModal class. You can use methods on the * NgbActiveModal class to close / dismiss modals from "inside" of a component. */ /** * Opens a new modal window with the specified content and using supplied options. Content can be provided * as a TemplateRef or a component type. If you pass a component type as content than instances of those * components can be injected with an instance of the NgbActiveModal class. You can use methods on the * NgbActiveModal class to close / dismiss modals from "inside" of a component. */ NgbModal.prototype.open = /** * Opens a new modal window with the specified content and using supplied options. Content can be provided * as a TemplateRef or a component type. If you pass a component type as content than instances of those * components can be injected with an instance of the NgbActiveModal class. You can use methods on the * NgbActiveModal class to close / dismiss modals from "inside" of a component. */ function (content, options) { if (options === void 0) { options = {}; } return this._modalStack.open(this._moduleCFR, this._injector, content, options); }; NgbModal.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Injectable"] }, ]; /** @nocollapse */ NgbModal.ctorParameters = function () { return [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ComponentFactoryResolver"], }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Injector"], }, { type: __WEBPACK_IMPORTED_MODULE_1__modal_stack__["a" /* NgbModalStack */], }, ]; }; return NgbModal; }()); //# sourceMappingURL=modal.js.map /***/ }), /***/ "./node_modules/@ng-bootstrap/ng-bootstrap/modal/modal.module.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NgbModalModule; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__modal_backdrop__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/modal/modal-backdrop.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__modal_window__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/modal/modal-window.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__modal_stack__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/modal/modal-stack.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__modal__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/modal/modal.js"); /* unused harmony reexport NgbModal */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__modal_ref__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/modal/modal-ref.js"); /* unused harmony reexport NgbModalRef */ /* unused harmony reexport NgbActiveModal */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__modal_dismiss_reasons__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/modal/modal-dismiss-reasons.js"); /* unused harmony reexport ModalDismissReasons */ var NgbModalModule = (function () { function NgbModalModule() { } NgbModalModule.forRoot = function () { return { ngModule: NgbModalModule, providers: [__WEBPACK_IMPORTED_MODULE_4__modal__["a" /* NgbModal */], __WEBPACK_IMPORTED_MODULE_3__modal_stack__["a" /* NgbModalStack */]] }; }; NgbModalModule.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["NgModule"], args: [{ declarations: [__WEBPACK_IMPORTED_MODULE_1__modal_backdrop__["a" /* NgbModalBackdrop */], __WEBPACK_IMPORTED_MODULE_2__modal_window__["a" /* NgbModalWindow */]], entryComponents: [__WEBPACK_IMPORTED_MODULE_1__modal_backdrop__["a" /* NgbModalBackdrop */], __WEBPACK_IMPORTED_MODULE_2__modal_window__["a" /* NgbModalWindow */]], providers: [__WEBPACK_IMPORTED_MODULE_4__modal__["a" /* NgbModal */]] },] }, ]; /** @nocollapse */ NgbModalModule.ctorParameters = function () { return []; }; return NgbModalModule; }()); //# sourceMappingURL=modal.module.js.map /***/ }), /***/ "./node_modules/@ng-bootstrap/ng-bootstrap/pagination/pagination-config.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NgbPaginationConfig; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); /** * Configuration service for the NgbPagination component. * You can inject this service, typically in your root component, and customize the values of its properties in * order to provide default values for all the paginations used in the application. */ var NgbPaginationConfig = (function () { function NgbPaginationConfig() { this.disabled = false; this.boundaryLinks = false; this.directionLinks = true; this.ellipses = true; this.maxSize = 0; this.pageSize = 10; this.rotate = false; } NgbPaginationConfig.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Injectable"] }, ]; /** @nocollapse */ NgbPaginationConfig.ctorParameters = function () { return []; }; return NgbPaginationConfig; }()); //# sourceMappingURL=pagination-config.js.map /***/ }), /***/ "./node_modules/@ng-bootstrap/ng-bootstrap/pagination/pagination.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NgbPagination; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_util__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/util/util.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__pagination_config__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/pagination/pagination-config.js"); /** * A directive that will take care of visualising a pagination bar and enable / disable buttons correctly! */ var NgbPagination = (function () { function NgbPagination(config) { this.pageCount = 0; this.pages = []; /** * Current page. Page numbers start with 1 */ this.page = 1; /** * An event fired when the page is changed. * Event's payload equals to the newly selected page. * Will fire only if collection size is set and all values are valid. * Page numbers start with 1 */ this.pageChange = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](true); this.disabled = config.disabled; this.boundaryLinks = config.boundaryLinks; this.directionLinks = config.directionLinks; this.ellipses = config.ellipses; this.maxSize = config.maxSize; this.pageSize = config.pageSize; this.rotate = config.rotate; this.size = config.size; } NgbPagination.prototype.hasPrevious = function () { return this.page > 1; }; NgbPagination.prototype.hasNext = function () { return this.page < this.pageCount; }; NgbPagination.prototype.selectPage = function (pageNumber) { this._updatePages(pageNumber); }; NgbPagination.prototype.ngOnChanges = function (changes) { this._updatePages(this.page); }; NgbPagination.prototype.isEllipsis = function (pageNumber) { return pageNumber === -1; }; /** * Appends ellipses and first/last page number to the displayed pages */ /** * Appends ellipses and first/last page number to the displayed pages */ NgbPagination.prototype._applyEllipses = /** * Appends ellipses and first/last page number to the displayed pages */ function (start, end) { if (this.ellipses) { if (start > 0) { if (start > 1) { this.pages.unshift(-1); } this.pages.unshift(1); } if (end < this.pageCount) { if (end < (this.pageCount - 1)) { this.pages.push(-1); } this.pages.push(this.pageCount); } } }; /** * Rotates page numbers based on maxSize items visible. * Currently selected page stays in the middle: * * Ex. for selected page = 6: * [5,*6*,7] for maxSize = 3 * [4,5,*6*,7] for maxSize = 4 */ /** * Rotates page numbers based on maxSize items visible. * Currently selected page stays in the middle: * * Ex. for selected page = 6: * [5,*6*,7] for maxSize = 3 * [4,5,*6*,7] for maxSize = 4 */ NgbPagination.prototype._applyRotation = /** * Rotates page numbers based on maxSize items visible. * Currently selected page stays in the middle: * * Ex. for selected page = 6: * [5,*6*,7] for maxSize = 3 * [4,5,*6*,7] for maxSize = 4 */ function () { var start = 0; var end = this.pageCount; var leftOffset = Math.floor(this.maxSize / 2); var rightOffset = this.maxSize % 2 === 0 ? leftOffset - 1 : leftOffset; if (this.page <= leftOffset) { // very beginning, no rotation -> [0..maxSize] end = this.maxSize; } else if (this.pageCount - this.page < leftOffset) { // very end, no rotation -> [len-maxSize..len] start = this.pageCount - this.maxSize; } else { // rotate start = this.page - leftOffset - 1; end = this.page + rightOffset; } return [start, end]; }; /** * Paginates page numbers based on maxSize items per page */ /** * Paginates page numbers based on maxSize items per page */ NgbPagination.prototype._applyPagination = /** * Paginates page numbers based on maxSize items per page */ function () { var page = Math.ceil(this.page / this.maxSize) - 1; var start = page * this.maxSize; var end = start + this.maxSize; return [start, end]; }; NgbPagination.prototype._setPageInRange = function (newPageNo) { var prevPageNo = this.page; this.page = Object(__WEBPACK_IMPORTED_MODULE_1__util_util__["a" /* getValueInRange */])(newPageNo, this.pageCount, 1); if (this.page !== prevPageNo && Object(__WEBPACK_IMPORTED_MODULE_1__util_util__["d" /* isNumber */])(this.collectionSize)) { this.pageChange.emit(this.page); } }; NgbPagination.prototype._updatePages = function (newPage) { this.pageCount = Math.ceil(this.collectionSize / this.pageSize); if (!Object(__WEBPACK_IMPORTED_MODULE_1__util_util__["d" /* isNumber */])(this.pageCount)) { this.pageCount = 0; } // fill-in model needed to render pages this.pages.length = 0; for (var i = 1; i <= this.pageCount; i++) { this.pages.push(i); } // set page within 1..max range this._setPageInRange(newPage); // apply maxSize if necessary if (this.maxSize > 0 && this.pageCount > this.maxSize) { var start = 0; var end = this.pageCount; // either paginating or rotating page numbers if (this.rotate) { _a = this._applyRotation(), start = _a[0], end = _a[1]; } else { _b = this._applyPagination(), start = _b[0], end = _b[1]; } this.pages = this.pages.slice(start, end); // adding ellipses this._applyEllipses(start, end); } var _a, _b; }; NgbPagination.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"], args: [{ selector: 'ngb-pagination', changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectionStrategy"].OnPush, host: { 'role': 'navigation' }, template: "\n <ul [class]=\"'pagination' + (size ? ' pagination-' + size : '')\">\n <li *ngIf=\"boundaryLinks\" class=\"page-item\"\n [class.disabled]=\"!hasPrevious() || disabled\">\n <a aria-label=\"First\" class=\"page-link\" href (click)=\"!!selectPage(1)\" [attr.tabindex]=\"(hasPrevious() ? null : '-1')\">\n <span aria-hidden=\"true\">««</span>\n </a>\n </li>\n\n <li *ngIf=\"directionLinks\" class=\"page-item\"\n [class.disabled]=\"!hasPrevious() || disabled\">\n <a aria-label=\"Previous\" class=\"page-link\" href (click)=\"!!selectPage(page-1)\" [attr.tabindex]=\"(hasPrevious() ? null : '-1')\">\n <span aria-hidden=\"true\">«</span>\n </a>\n </li>\n <li *ngFor=\"let pageNumber of pages\" class=\"page-item\" [class.active]=\"pageNumber === page\"\n [class.disabled]=\"isEllipsis(pageNumber) || disabled\">\n <a *ngIf=\"isEllipsis(pageNumber)\" class=\"page-link\">...</a>\n <a *ngIf=\"!isEllipsis(pageNumber)\" class=\"page-link\" href (click)=\"!!selectPage(pageNumber)\">\n {{pageNumber}}\n <span *ngIf=\"pageNumber === page\" class=\"sr-only\">(current)</span>\n </a>\n </li>\n <li *ngIf=\"directionLinks\" class=\"page-item\" [class.disabled]=\"!hasNext() || disabled\">\n <a aria-label=\"Next\" class=\"page-link\" href (click)=\"!!selectPage(page+1)\" [attr.tabindex]=\"(hasNext() ? null : '-1')\">\n <span aria-hidden=\"true\">»</span>\n </a>\n </li>\n\n <li *ngIf=\"boundaryLinks\" class=\"page-item\" [class.disabled]=\"!hasNext() || disabled\">\n <a aria-label=\"Last\" class=\"page-link\" href (click)=\"!!selectPage(pageCount)\" [attr.tabindex]=\"(hasNext() ? null : '-1')\">\n <span aria-hidden=\"true\">»»</span>\n </a>\n </li>\n </ul>\n " },] }, ]; /** @nocollapse */ NgbPagination.ctorParameters = function () { return [ { type: __WEBPACK_IMPORTED_MODULE_2__pagination_config__["a" /* NgbPaginationConfig */], }, ]; }; NgbPagination.propDecorators = { "disabled": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "boundaryLinks": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "directionLinks": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "ellipses": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "rotate": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "collectionSize": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "maxSize": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "page": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "pageSize": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "pageChange": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"] },], "size": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], }; return NgbPagination; }()); //# sourceMappingURL=pagination.js.map /***/ }), /***/ "./node_modules/@ng-bootstrap/ng-bootstrap/pagination/pagination.module.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NgbPaginationModule; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_common__ = __webpack_require__("./node_modules/@angular/common/esm2015/common.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__pagination__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/pagination/pagination.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__pagination_config__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/pagination/pagination-config.js"); /* unused harmony reexport NgbPagination */ /* unused harmony reexport NgbPaginationConfig */ var NgbPaginationModule = (function () { function NgbPaginationModule() { } NgbPaginationModule.forRoot = function () { return { ngModule: NgbPaginationModule, providers: [__WEBPACK_IMPORTED_MODULE_3__pagination_config__["a" /* NgbPaginationConfig */]] }; }; NgbPaginationModule.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["NgModule"], args: [{ declarations: [__WEBPACK_IMPORTED_MODULE_2__pagination__["a" /* NgbPagination */]], exports: [__WEBPACK_IMPORTED_MODULE_2__pagination__["a" /* NgbPagination */]], imports: [__WEBPACK_IMPORTED_MODULE_1__angular_common__["CommonModule"]] },] }, ]; /** @nocollapse */ NgbPaginationModule.ctorParameters = function () { return []; }; return NgbPaginationModule; }()); //# sourceMappingURL=pagination.module.js.map /***/ }), /***/ "./node_modules/@ng-bootstrap/ng-bootstrap/popover/popover-config.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NgbPopoverConfig; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); /** * Configuration service for the NgbPopover directive. * You can inject this service, typically in your root component, and customize the values of its properties in * order to provide default values for all the popovers used in the application. */ var NgbPopoverConfig = (function () { function NgbPopoverConfig() { this.placement = 'top'; this.triggers = 'click'; this.disablePopover = false; } NgbPopoverConfig.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Injectable"] }, ]; /** @nocollapse */ NgbPopoverConfig.ctorParameters = function () { return []; }; return NgbPopoverConfig; }()); //# sourceMappingURL=popover-config.js.map /***/ }), /***/ "./node_modules/@ng-bootstrap/ng-bootstrap/popover/popover.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return NgbPopoverWindow; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NgbPopover; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_triggers__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/util/triggers.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__util_positioning__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/util/positioning.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__util_popup__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/util/popup.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__popover_config__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/popover/popover-config.js"); var nextId = 0; var NgbPopoverWindow = (function () { function NgbPopoverWindow(_element, _renderer) { this._element = _element; this._renderer = _renderer; this.placement = 'top'; } NgbPopoverWindow.prototype.applyPlacement = function (_placement) { // remove the current placement classes this._renderer.removeClass(this._element.nativeElement, 'bs-popover-' + this.placement.toString().split('-')[0]); this._renderer.removeClass(this._element.nativeElement, 'bs-popover-' + this.placement.toString()); // set the new placement classes this.placement = _placement; // apply the new placement this._renderer.addClass(this._element.nativeElement, 'bs-popover-' + this.placement.toString().split('-')[0]); this._renderer.addClass(this._element.nativeElement, 'bs-popover-' + this.placement.toString()); }; NgbPopoverWindow.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"], args: [{ selector: 'ngb-popover-window', changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectionStrategy"].OnPush, host: { '[class]': '"popover bs-popover-" + placement.split("-")[0]+" bs-popover-" + placement', 'role': 'tooltip', '[id]': 'id' }, template: "\n <div class=\"arrow\"></div>\n <h3 class=\"popover-header\">{{title}}</h3><div class=\"popover-body\"><ng-content></ng-content></div>", styles: ["\n :host.bs-popover-top .arrow, :host.bs-popover-bottom .arrow {\n left: 50%;\n margin-left: -5px;\n }\n\n :host.bs-popover-top-left .arrow, :host.bs-popover-bottom-left .arrow {\n left: 2em;\n }\n\n :host.bs-popover-top-right .arrow, :host.bs-popover-bottom-right .arrow {\n left: auto;\n right: 2em;\n }\n\n :host.bs-popover-left .arrow, :host.bs-popover-right .arrow {\n top: 50%;\n margin-top: -5px;\n }\n \n :host.bs-popover-left-top .arrow, :host.bs-popover-right-top .arrow {\n top: 0.7em;\n }\n\n :host.bs-popover-left-bottom .arrow, :host.bs-popover-right-bottom .arrow {\n top: auto;\n bottom: 0.7em;\n }\n "] },] }, ]; /** @nocollapse */ NgbPopoverWindow.ctorParameters = function () { return [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ElementRef"], }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Renderer2"], }, ]; }; NgbPopoverWindow.propDecorators = { "placement": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "title": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "id": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], }; return NgbPopoverWindow; }()); /** * A lightweight, extensible directive for fancy popover creation. */ var NgbPopover = (function () { function NgbPopover(_elementRef, _renderer, injector, componentFactoryResolver, viewContainerRef, config, ngZone) { var _this = this; this._elementRef = _elementRef; this._renderer = _renderer; /** * Emits an event when the popover is shown */ this.shown = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); /** * Emits an event when the popover is hidden */ this.hidden = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); this._ngbPopoverWindowId = "ngb-popover-" + nextId++; this.placement = config.placement; this.triggers = config.triggers; this.container = config.container; this.disablePopover = config.disablePopover; this._popupService = new __WEBPACK_IMPORTED_MODULE_3__util_popup__["b" /* PopupService */](NgbPopoverWindow, injector, viewContainerRef, _renderer, componentFactoryResolver); this._zoneSubscription = ngZone.onStable.subscribe(function () { if (_this._windowRef) { _this._windowRef.instance.applyPlacement(Object(__WEBPACK_IMPORTED_MODULE_2__util_positioning__["a" /* positionElements */])(_this._elementRef.nativeElement, _this._windowRef.location.nativeElement, _this.placement, _this.container === 'body')); } }); } /** * Opens an element’s popover. This is considered a “manual” triggering of the popover. * The context is an optional value to be injected into the popover template when it is created. */ /** * Opens an element’s popover. This is considered a “manual” triggering of the popover. * The context is an optional value to be injected into the popover template when it is created. */ NgbPopover.prototype.open = /** * Opens an element’s popover. This is considered a “manual” triggering of the popover. * The context is an optional value to be injected into the popover template when it is created. */ function (context) { if (!this._windowRef && !this.disablePopover) { this._windowRef = this._popupService.open(this.ngbPopover, context); this._windowRef.instance.title = this.popoverTitle; this._windowRef.instance.id = this._ngbPopoverWindowId; this._renderer.setAttribute(this._elementRef.nativeElement, 'aria-describedby', this._ngbPopoverWindowId); if (this.container === 'body') { window.document.querySelector(this.container).appendChild(this._windowRef.location.nativeElement); } // apply styling to set basic css-classes on target element, before going for positioning this._windowRef.changeDetectorRef.detectChanges(); this._windowRef.changeDetectorRef.markForCheck(); // position popover along the element this._windowRef.instance.applyPlacement(Object(__WEBPACK_IMPORTED_MODULE_2__util_positioning__["a" /* positionElements */])(this._elementRef.nativeElement, this._windowRef.location.nativeElement, this.placement, this.container === 'body')); this.shown.emit(); } }; /** * Closes an element’s popover. This is considered a “manual” triggering of the popover. */ /** * Closes an element’s popover. This is considered a “manual” triggering of the popover. */ NgbPopover.prototype.close = /** * Closes an element’s popover. This is considered a “manual” triggering of the popover. */ function () { if (this._windowRef) { this._renderer.removeAttribute(this._elementRef.nativeElement, 'aria-describedby'); this._popupService.close(); this._windowRef = null; this.hidden.emit(); } }; /** * Toggles an element’s popover. This is considered a “manual” triggering of the popover. */ /** * Toggles an element’s popover. This is considered a “manual” triggering of the popover. */ NgbPopover.prototype.toggle = /** * Toggles an element’s popover. This is considered a “manual” triggering of the popover. */ function () { if (this._windowRef) { this.close(); } else { this.open(); } }; /** * Returns whether or not the popover is currently being shown */ /** * Returns whether or not the popover is currently being shown */ NgbPopover.prototype.isOpen = /** * Returns whether or not the popover is currently being shown */ function () { return this._windowRef != null; }; NgbPopover.prototype.ngOnInit = function () { this._unregisterListenersFn = Object(__WEBPACK_IMPORTED_MODULE_1__util_triggers__["a" /* listenToTriggers */])(this._renderer, this._elementRef.nativeElement, this.triggers, this.open.bind(this), this.close.bind(this), this.toggle.bind(this)); }; NgbPopover.prototype.ngOnDestroy = function () { this.close(); this._unregisterListenersFn(); this._zoneSubscription.unsubscribe(); }; NgbPopover.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: '[ngbPopover]', exportAs: 'ngbPopover' },] }, ]; /** @nocollapse */ NgbPopover.ctorParameters = function () { return [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ElementRef"], }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Renderer2"], }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Injector"], }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ComponentFactoryResolver"], }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ViewContainerRef"], }, { type: __WEBPACK_IMPORTED_MODULE_4__popover_config__["a" /* NgbPopoverConfig */], }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["NgZone"], }, ]; }; NgbPopover.propDecorators = { "ngbPopover": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "popoverTitle": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "placement": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "triggers": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "container": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "disablePopover": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "shown": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"] },], "hidden": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"] },], }; return NgbPopover; }()); //# sourceMappingURL=popover.js.map /***/ }), /***/ "./node_modules/@ng-bootstrap/ng-bootstrap/popover/popover.module.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NgbPopoverModule; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__popover__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/popover/popover.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__popover_config__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/popover/popover-config.js"); /* unused harmony reexport NgbPopover */ /* unused harmony reexport NgbPopoverConfig */ var NgbPopoverModule = (function () { function NgbPopoverModule() { } NgbPopoverModule.forRoot = function () { return { ngModule: NgbPopoverModule, providers: [__WEBPACK_IMPORTED_MODULE_2__popover_config__["a" /* NgbPopoverConfig */]] }; }; NgbPopoverModule.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["NgModule"], args: [{ declarations: [__WEBPACK_IMPORTED_MODULE_1__popover__["a" /* NgbPopover */], __WEBPACK_IMPORTED_MODULE_1__popover__["b" /* NgbPopoverWindow */]], exports: [__WEBPACK_IMPORTED_MODULE_1__popover__["a" /* NgbPopover */]], entryComponents: [__WEBPACK_IMPORTED_MODULE_1__popover__["b" /* NgbPopoverWindow */]] },] }, ]; /** @nocollapse */ NgbPopoverModule.ctorParameters = function () { return []; }; return NgbPopoverModule; }()); //# sourceMappingURL=popover.module.js.map /***/ }), /***/ "./node_modules/@ng-bootstrap/ng-bootstrap/progressbar/progressbar-config.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NgbProgressbarConfig; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); /** * Configuration service for the NgbProgressbar component. * You can inject this service, typically in your root component, and customize the values of its properties in * order to provide default values for all the progress bars used in the application. */ var NgbProgressbarConfig = (function () { function NgbProgressbarConfig() { this.max = 100; this.animated = false; this.striped = false; this.showValue = false; } NgbProgressbarConfig.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Injectable"] }, ]; /** @nocollapse */ NgbProgressbarConfig.ctorParameters = function () { return []; }; return NgbProgressbarConfig; }()); //# sourceMappingURL=progressbar-config.js.map /***/ }), /***/ "./node_modules/@ng-bootstrap/ng-bootstrap/progressbar/progressbar.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NgbProgressbar; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_util__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/util/util.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__progressbar_config__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/progressbar/progressbar-config.js"); /** * Directive that can be used to provide feedback on the progress of a workflow or an action. */ var NgbProgressbar = (function () { function NgbProgressbar(config) { /** * Current value to be displayed in the progressbar. Should be smaller or equal to "max" value. */ this.value = 0; this.max = config.max; this.animated = config.animated; this.striped = config.striped; this.type = config.type; this.showValue = config.showValue; this.height = config.height; } NgbProgressbar.prototype.getValue = function () { return Object(__WEBPACK_IMPORTED_MODULE_1__util_util__["a" /* getValueInRange */])(this.value, this.max); }; NgbProgressbar.prototype.getPercentValue = function () { return 100 * this.getValue() / this.max; }; NgbProgressbar.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"], args: [{ selector: 'ngb-progressbar', changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectionStrategy"].OnPush, template: "\n <div class=\"progress\" [style.height]=\"height\">\n <div class=\"progress-bar{{type ? ' bg-' + type : ''}}{{animated ? ' progress-bar-animated' : ''}}{{striped ?\n ' progress-bar-striped' : ''}}\" role=\"progressbar\" [style.width.%]=\"getPercentValue()\"\n [attr.aria-valuenow]=\"getValue()\" aria-valuemin=\"0\" [attr.aria-valuemax]=\"max\">\n <span *ngIf=\"showValue\">{{getPercentValue()}}%</span><ng-content></ng-content>\n </div>\n </div>\n " },] }, ]; /** @nocollapse */ NgbProgressbar.ctorParameters = function () { return [ { type: __WEBPACK_IMPORTED_MODULE_2__progressbar_config__["a" /* NgbProgressbarConfig */], }, ]; }; NgbProgressbar.propDecorators = { "max": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "animated": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "striped": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "showValue": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "type": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "value": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "height": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], }; return NgbProgressbar; }()); //# sourceMappingURL=progressbar.js.map /***/ }), /***/ "./node_modules/@ng-bootstrap/ng-bootstrap/progressbar/progressbar.module.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NgbProgressbarModule; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_common__ = __webpack_require__("./node_modules/@angular/common/esm2015/common.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__progressbar__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/progressbar/progressbar.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__progressbar_config__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/progressbar/progressbar-config.js"); /* unused harmony reexport NgbProgressbar */ /* unused harmony reexport NgbProgressbarConfig */ var NgbProgressbarModule = (function () { function NgbProgressbarModule() { } NgbProgressbarModule.forRoot = function () { return { ngModule: NgbProgressbarModule, providers: [__WEBPACK_IMPORTED_MODULE_3__progressbar_config__["a" /* NgbProgressbarConfig */]] }; }; NgbProgressbarModule.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["NgModule"], args: [{ declarations: [__WEBPACK_IMPORTED_MODULE_2__progressbar__["a" /* NgbProgressbar */]], exports: [__WEBPACK_IMPORTED_MODULE_2__progressbar__["a" /* NgbProgressbar */]], imports: [__WEBPACK_IMPORTED_MODULE_1__angular_common__["CommonModule"]] },] }, ]; /** @nocollapse */ NgbProgressbarModule.ctorParameters = function () { return []; }; return NgbProgressbarModule; }()); //# sourceMappingURL=progressbar.module.js.map /***/ }), /***/ "./node_modules/@ng-bootstrap/ng-bootstrap/rating/rating-config.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NgbRatingConfig; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); /** * Configuration service for the NgbRating component. * You can inject this service, typically in your root component, and customize the values of its properties in * order to provide default values for all the ratings used in the application. */ var NgbRatingConfig = (function () { function NgbRatingConfig() { this.max = 10; this.readonly = false; this.resettable = false; } NgbRatingConfig.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Injectable"] }, ]; /** @nocollapse */ NgbRatingConfig.ctorParameters = function () { return []; }; return NgbRatingConfig; }()); //# sourceMappingURL=rating-config.js.map /***/ }), /***/ "./node_modules/@ng-bootstrap/ng-bootstrap/rating/rating.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NgbRating; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__rating_config__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/rating/rating-config.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__util_util__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/util/util.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__angular_forms__ = __webpack_require__("./node_modules/@angular/forms/esm2015/forms.js"); var Key; (function (Key) { Key[Key["End"] = 35] = "End"; Key[Key["Home"] = 36] = "Home"; Key[Key["ArrowLeft"] = 37] = "ArrowLeft"; Key[Key["ArrowUp"] = 38] = "ArrowUp"; Key[Key["ArrowRight"] = 39] = "ArrowRight"; Key[Key["ArrowDown"] = 40] = "ArrowDown"; })(Key || (Key = {})); var NGB_RATING_VALUE_ACCESSOR = { provide: __WEBPACK_IMPORTED_MODULE_3__angular_forms__["NG_VALUE_ACCESSOR"], useExisting: Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["forwardRef"])(function () { return NgbRating; }), multi: true }; /** * Rating directive that will take care of visualising a star rating bar. */ var NgbRating = (function () { function NgbRating(config, _changeDetectorRef) { this._changeDetectorRef = _changeDetectorRef; this.contexts = []; this.disabled = false; /** * An event fired when a user is hovering over a given rating. * Event's payload equals to the rating being hovered over. */ this.hover = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); /** * An event fired when a user stops hovering over a given rating. * Event's payload equals to the rating of the last item being hovered over. */ this.leave = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); /** * An event fired when a user selects a new rating. * Event's payload equals to the newly selected rating. */ this.rateChange = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](true); this.onChange = function (_) { }; this.onTouched = function () { }; this.max = config.max; this.readonly = config.readonly; } NgbRating.prototype.ariaValueText = function () { return this.nextRate + " out of " + this.max; }; NgbRating.prototype.enter = function (value) { if (!this.readonly && !this.disabled) { this._updateState(value); } this.hover.emit(value); }; NgbRating.prototype.handleBlur = function () { this.onTouched(); }; NgbRating.prototype.handleClick = function (value) { this.update(this.resettable && this.rate === value ? 0 : value); }; NgbRating.prototype.handleKeyDown = function (event) { if (Key[Object(__WEBPACK_IMPORTED_MODULE_2__util_util__["i" /* toString */])(event.which)]) { event.preventDefault(); switch (event.which) { case Key.ArrowDown: case Key.ArrowLeft: this.update(this.rate - 1); break; case Key.ArrowUp: case Key.ArrowRight: this.update(this.rate + 1); break; case Key.Home: this.update(0); break; case Key.End: this.update(this.max); break; } } }; NgbRating.prototype.ngOnChanges = function (changes) { if (changes['rate']) { this.update(this.rate); } }; NgbRating.prototype.ngOnInit = function () { this.contexts = Array.from({ length: this.max }, function (v, k) { return ({ fill: 0, index: k }); }); this._updateState(this.rate); }; NgbRating.prototype.registerOnChange = function (fn) { this.onChange = fn; }; NgbRating.prototype.registerOnTouched = function (fn) { this.onTouched = fn; }; NgbRating.prototype.reset = function () { this.leave.emit(this.nextRate); this._updateState(this.rate); }; NgbRating.prototype.setDisabledState = function (isDisabled) { this.disabled = isDisabled; }; NgbRating.prototype.update = function (value, internalChange) { if (internalChange === void 0) { internalChange = true; } var newRate = Object(__WEBPACK_IMPORTED_MODULE_2__util_util__["a" /* getValueInRange */])(value, this.max, 0); if (!this.readonly && !this.disabled && this.rate !== newRate) { this.rate = newRate; this.rateChange.emit(this.rate); } if (internalChange) { this.onChange(this.rate); this.onTouched(); } this._updateState(this.rate); }; NgbRating.prototype.writeValue = function (value) { this.update(value, false); this._changeDetectorRef.markForCheck(); }; NgbRating.prototype._getFillValue = function (index) { var diff = this.nextRate - index; if (diff >= 1) { return 100; } if (diff < 1 && diff > 0) { return Number.parseInt((diff * 100).toFixed(2)); } return 0; }; NgbRating.prototype._updateState = function (nextValue) { var _this = this; this.nextRate = nextValue; this.contexts.forEach(function (context, index) { return context.fill = _this._getFillValue(index); }); }; NgbRating.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"], args: [{ selector: 'ngb-rating', changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectionStrategy"].OnPush, host: { 'class': 'd-inline-flex', 'tabindex': '0', 'role': 'slider', 'aria-valuemin': '0', '[attr.aria-valuemax]': 'max', '[attr.aria-valuenow]': 'nextRate', '[attr.aria-valuetext]': 'ariaValueText()', '[attr.aria-disabled]': 'readonly ? true : null', '(blur)': 'handleBlur()', '(keydown)': 'handleKeyDown($event)', '(mouseleave)': 'reset()' }, template: "\n <ng-template #t let-fill=\"fill\">{{ fill === 100 ? '★' : '☆' }}</ng-template>\n <ng-template ngFor [ngForOf]=\"contexts\" let-index=\"index\">\n <span class=\"sr-only\">({{ index < nextRate ? '*' : ' ' }})</span>\n <span (mouseenter)=\"enter(index + 1)\" (click)=\"handleClick(index + 1)\" [style.cursor]=\"readonly || disabled ? 'default' : 'pointer'\">\n <ng-template [ngTemplateOutlet]=\"starTemplate || t\" [ngTemplateOutletContext]=\"contexts[index]\"></ng-template>\n </span>\n </ng-template>\n ", providers: [NGB_RATING_VALUE_ACCESSOR] },] }, ]; /** @nocollapse */ NgbRating.ctorParameters = function () { return [ { type: __WEBPACK_IMPORTED_MODULE_1__rating_config__["a" /* NgbRatingConfig */], }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectorRef"], }, ]; }; NgbRating.propDecorators = { "max": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "rate": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "readonly": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "resettable": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "starTemplate": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ContentChild"], args: [__WEBPACK_IMPORTED_MODULE_0__angular_core__["TemplateRef"],] },], "hover": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"] },], "leave": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"] },], "rateChange": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"] },], }; return NgbRating; }()); //# sourceMappingURL=rating.js.map /***/ }), /***/ "./node_modules/@ng-bootstrap/ng-bootstrap/rating/rating.module.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NgbRatingModule; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_common__ = __webpack_require__("./node_modules/@angular/common/esm2015/common.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__rating_config__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/rating/rating-config.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__rating__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/rating/rating.js"); /* unused harmony reexport NgbRating */ /* unused harmony reexport NgbRatingConfig */ var NgbRatingModule = (function () { function NgbRatingModule() { } NgbRatingModule.forRoot = function () { return { ngModule: NgbRatingModule, providers: [__WEBPACK_IMPORTED_MODULE_2__rating_config__["a" /* NgbRatingConfig */]] }; }; NgbRatingModule.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["NgModule"], args: [{ declarations: [__WEBPACK_IMPORTED_MODULE_3__rating__["a" /* NgbRating */]], exports: [__WEBPACK_IMPORTED_MODULE_3__rating__["a" /* NgbRating */]], imports: [__WEBPACK_IMPORTED_MODULE_1__angular_common__["CommonModule"]] },] }, ]; /** @nocollapse */ NgbRatingModule.ctorParameters = function () { return []; }; return NgbRatingModule; }()); //# sourceMappingURL=rating.module.js.map /***/ }), /***/ "./node_modules/@ng-bootstrap/ng-bootstrap/tabset/tabset-config.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NgbTabsetConfig; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); /** * Configuration service for the NgbTabset component. * You can inject this service, typically in your root component, and customize the values of its properties in * order to provide default values for all the tabsets used in the application. */ var NgbTabsetConfig = (function () { function NgbTabsetConfig() { this.justify = 'start'; this.orientation = 'horizontal'; this.type = 'tabs'; } NgbTabsetConfig.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Injectable"] }, ]; /** @nocollapse */ NgbTabsetConfig.ctorParameters = function () { return []; }; return NgbTabsetConfig; }()); //# sourceMappingURL=tabset-config.js.map /***/ }), /***/ "./node_modules/@ng-bootstrap/ng-bootstrap/tabset/tabset.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return NgbTabTitle; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return NgbTabContent; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NgbTab; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return NgbTabset; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__tabset_config__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/tabset/tabset-config.js"); var nextId = 0; /** * This directive should be used to wrap tab titles that need to contain HTML markup or other directives. */ var NgbTabTitle = (function () { function NgbTabTitle(templateRef) { this.templateRef = templateRef; } NgbTabTitle.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: 'ng-template[ngbTabTitle]' },] }, ]; /** @nocollapse */ NgbTabTitle.ctorParameters = function () { return [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["TemplateRef"], }, ]; }; return NgbTabTitle; }()); /** * This directive must be used to wrap content to be displayed in a tab. */ var NgbTabContent = (function () { function NgbTabContent(templateRef) { this.templateRef = templateRef; } NgbTabContent.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: 'ng-template[ngbTabContent]' },] }, ]; /** @nocollapse */ NgbTabContent.ctorParameters = function () { return [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["TemplateRef"], }, ]; }; return NgbTabContent; }()); /** * A directive representing an individual tab. */ var NgbTab = (function () { function NgbTab() { /** * Unique tab identifier. Must be unique for the entire document for proper accessibility support. */ this.id = "ngb-tab-" + nextId++; /** * Allows toggling disabled state of a given state. Disabled tabs can't be selected. */ this.disabled = false; } NgbTab.prototype.ngAfterContentChecked = function () { // We are using @ContentChildren instead of @ContantChild as in the Angular version being used // only @ContentChildren allows us to specify the {descendants: false} option. // Without {descendants: false} we are hitting bugs described in: // https://github.com/ng-bootstrap/ng-bootstrap/issues/2240 this.titleTpl = this.titleTpls.first; this.contentTpl = this.contentTpls.first; }; NgbTab.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: 'ngb-tab' },] }, ]; /** @nocollapse */ NgbTab.ctorParameters = function () { return []; }; NgbTab.propDecorators = { "id": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "title": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "disabled": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "titleTpls": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ContentChildren"], args: [NgbTabTitle, { descendants: false },] },], "contentTpls": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ContentChildren"], args: [NgbTabContent, { descendants: false },] },], }; return NgbTab; }()); /** * A component that makes it easy to create tabbed interface. */ var NgbTabset = (function () { function NgbTabset(config) { /** * Whether the closed tabs should be hidden without destroying them */ this.destroyOnHide = true; /** * A tab change event fired right before the tab selection happens. See NgbTabChangeEvent for payload details */ this.tabChange = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); this.type = config.type; this.justify = config.justify; this.orientation = config.orientation; } Object.defineProperty(NgbTabset.prototype, "justify", { set: /** * The horizontal alignment of the nav with flexbox utilities. Can be one of 'start', 'center', 'end', 'fill' or * 'justified' * The default value is 'start'. */ function (className) { if (className === 'fill' || className === 'justified') { this.justifyClass = "nav-" + className; } else { this.justifyClass = "justify-content-" + className; } }, enumerable: true, configurable: true }); /** * Selects the tab with the given id and shows its associated pane. * Any other tab that was previously selected becomes unselected and its associated pane is hidden. */ /** * Selects the tab with the given id and shows its associated pane. * Any other tab that was previously selected becomes unselected and its associated pane is hidden. */ NgbTabset.prototype.select = /** * Selects the tab with the given id and shows its associated pane. * Any other tab that was previously selected becomes unselected and its associated pane is hidden. */ function (tabId) { var selectedTab = this._getTabById(tabId); if (selectedTab && !selectedTab.disabled && this.activeId !== selectedTab.id) { var defaultPrevented_1 = false; this.tabChange.emit({ activeId: this.activeId, nextId: selectedTab.id, preventDefault: function () { defaultPrevented_1 = true; } }); if (!defaultPrevented_1) { this.activeId = selectedTab.id; } } }; NgbTabset.prototype.ngAfterContentChecked = function () { // auto-correct activeId that might have been set incorrectly as input var activeTab = this._getTabById(this.activeId); this.activeId = activeTab ? activeTab.id : (this.tabs.length ? this.tabs.first.id : null); }; NgbTabset.prototype._getTabById = function (id) { var tabsWithId = this.tabs.filter(function (tab) { return tab.id === id; }); return tabsWithId.length ? tabsWithId[0] : null; }; NgbTabset.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"], args: [{ selector: 'ngb-tabset', exportAs: 'ngbTabset', template: "\n <ul [class]=\"'nav nav-' + type + (orientation == 'horizontal'? ' ' + justifyClass : ' flex-column')\" role=\"tablist\">\n <li class=\"nav-item\" *ngFor=\"let tab of tabs\">\n <a [id]=\"tab.id\" class=\"nav-link\" [class.active]=\"tab.id === activeId\" [class.disabled]=\"tab.disabled\"\n href (click)=\"!!select(tab.id)\" role=\"tab\" [attr.tabindex]=\"(tab.disabled ? '-1': undefined)\"\n [attr.aria-controls]=\"(!destroyOnHide || tab.id === activeId ? tab.id + '-panel' : null)\"\n [attr.aria-expanded]=\"tab.id === activeId\" [attr.aria-disabled]=\"tab.disabled\">\n {{tab.title}}<ng-template [ngTemplateOutlet]=\"tab.titleTpl?.templateRef\"></ng-template>\n </a>\n </li>\n </ul>\n <div class=\"tab-content\">\n <ng-template ngFor let-tab [ngForOf]=\"tabs\">\n <div\n class=\"tab-pane {{tab.id === activeId ? 'active' : null}}\"\n *ngIf=\"!destroyOnHide || tab.id === activeId\"\n role=\"tabpanel\"\n [attr.aria-labelledby]=\"tab.id\" id=\"{{tab.id}}-panel\"\n [attr.aria-expanded]=\"tab.id === activeId\">\n <ng-template [ngTemplateOutlet]=\"tab.contentTpl?.templateRef\"></ng-template>\n </div>\n </ng-template>\n </div>\n " },] }, ]; /** @nocollapse */ NgbTabset.ctorParameters = function () { return [ { type: __WEBPACK_IMPORTED_MODULE_1__tabset_config__["a" /* NgbTabsetConfig */], }, ]; }; NgbTabset.propDecorators = { "tabs": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ContentChildren"], args: [NgbTab,] },], "activeId": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "destroyOnHide": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "justify": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "orientation": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "type": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "tabChange": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"] },], }; return NgbTabset; }()); //# sourceMappingURL=tabset.js.map /***/ }), /***/ "./node_modules/@ng-bootstrap/ng-bootstrap/tabset/tabset.module.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NgbTabsetModule; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_common__ = __webpack_require__("./node_modules/@angular/common/esm2015/common.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__tabset__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/tabset/tabset.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__tabset_config__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/tabset/tabset-config.js"); /* unused harmony reexport NgbTabset */ /* unused harmony reexport NgbTab */ /* unused harmony reexport NgbTabContent */ /* unused harmony reexport NgbTabTitle */ /* unused harmony reexport NgbTabsetConfig */ var NGB_TABSET_DIRECTIVES = [__WEBPACK_IMPORTED_MODULE_2__tabset__["d" /* NgbTabset */], __WEBPACK_IMPORTED_MODULE_2__tabset__["a" /* NgbTab */], __WEBPACK_IMPORTED_MODULE_2__tabset__["b" /* NgbTabContent */], __WEBPACK_IMPORTED_MODULE_2__tabset__["c" /* NgbTabTitle */]]; var NgbTabsetModule = (function () { function NgbTabsetModule() { } NgbTabsetModule.forRoot = function () { return { ngModule: NgbTabsetModule, providers: [__WEBPACK_IMPORTED_MODULE_3__tabset_config__["a" /* NgbTabsetConfig */]] }; }; NgbTabsetModule.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["NgModule"], args: [{ declarations: NGB_TABSET_DIRECTIVES, exports: NGB_TABSET_DIRECTIVES, imports: [__WEBPACK_IMPORTED_MODULE_1__angular_common__["CommonModule"]] },] }, ]; /** @nocollapse */ NgbTabsetModule.ctorParameters = function () { return []; }; return NgbTabsetModule; }()); //# sourceMappingURL=tabset.module.js.map /***/ }), /***/ "./node_modules/@ng-bootstrap/ng-bootstrap/timepicker/ngb-time.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NgbTime; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__util_util__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/util/util.js"); var NgbTime = (function () { function NgbTime(hour, minute, second) { this.hour = Object(__WEBPACK_IMPORTED_MODULE_0__util_util__["h" /* toInteger */])(hour); this.minute = Object(__WEBPACK_IMPORTED_MODULE_0__util_util__["h" /* toInteger */])(minute); this.second = Object(__WEBPACK_IMPORTED_MODULE_0__util_util__["h" /* toInteger */])(second); } NgbTime.prototype.changeHour = function (step) { if (step === void 0) { step = 1; } this.updateHour((isNaN(this.hour) ? 0 : this.hour) + step); }; NgbTime.prototype.updateHour = function (hour) { if (Object(__WEBPACK_IMPORTED_MODULE_0__util_util__["d" /* isNumber */])(hour)) { this.hour = (hour < 0 ? 24 + hour : hour) % 24; } else { this.hour = NaN; } }; NgbTime.prototype.changeMinute = function (step) { if (step === void 0) { step = 1; } this.updateMinute((isNaN(this.minute) ? 0 : this.minute) + step); }; NgbTime.prototype.updateMinute = function (minute) { if (Object(__WEBPACK_IMPORTED_MODULE_0__util_util__["d" /* isNumber */])(minute)) { this.minute = minute % 60 < 0 ? 60 + minute % 60 : minute % 60; this.changeHour(Math.floor(minute / 60)); } else { this.minute = NaN; } }; NgbTime.prototype.changeSecond = function (step) { if (step === void 0) { step = 1; } this.updateSecond((isNaN(this.second) ? 0 : this.second) + step); }; NgbTime.prototype.updateSecond = function (second) { if (Object(__WEBPACK_IMPORTED_MODULE_0__util_util__["d" /* isNumber */])(second)) { this.second = second < 0 ? 60 + second % 60 : second % 60; this.changeMinute(Math.floor(second / 60)); } else { this.second = NaN; } }; NgbTime.prototype.isValid = function (checkSecs) { if (checkSecs === void 0) { checkSecs = true; } return Object(__WEBPACK_IMPORTED_MODULE_0__util_util__["d" /* isNumber */])(this.hour) && Object(__WEBPACK_IMPORTED_MODULE_0__util_util__["d" /* isNumber */])(this.minute) && (checkSecs ? Object(__WEBPACK_IMPORTED_MODULE_0__util_util__["d" /* isNumber */])(this.second) : true); }; NgbTime.prototype.toString = function () { return (this.hour || 0) + ":" + (this.minute || 0) + ":" + (this.second || 0); }; return NgbTime; }()); //# sourceMappingURL=ngb-time.js.map /***/ }), /***/ "./node_modules/@ng-bootstrap/ng-bootstrap/timepicker/timepicker-config.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NgbTimepickerConfig; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); /** * Configuration service for the NgbTimepicker component. * You can inject this service, typically in your root component, and customize the values of its properties in * order to provide default values for all the timepickers used in the application. */ var NgbTimepickerConfig = (function () { function NgbTimepickerConfig() { this.meridian = false; this.spinners = true; this.seconds = false; this.hourStep = 1; this.minuteStep = 1; this.secondStep = 1; this.disabled = false; this.readonlyInputs = false; this.size = 'medium'; } NgbTimepickerConfig.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Injectable"] }, ]; /** @nocollapse */ NgbTimepickerConfig.ctorParameters = function () { return []; }; return NgbTimepickerConfig; }()); //# sourceMappingURL=timepicker-config.js.map /***/ }), /***/ "./node_modules/@ng-bootstrap/ng-bootstrap/timepicker/timepicker.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NgbTimepicker; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_forms__ = __webpack_require__("./node_modules/@angular/forms/esm2015/forms.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__util_util__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/util/util.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__ngb_time__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/timepicker/ngb-time.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__timepicker_config__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/timepicker/timepicker-config.js"); var NGB_TIMEPICKER_VALUE_ACCESSOR = { provide: __WEBPACK_IMPORTED_MODULE_1__angular_forms__["NG_VALUE_ACCESSOR"], useExisting: Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["forwardRef"])(function () { return NgbTimepicker; }), multi: true }; /** * A lightweight & configurable timepicker directive. */ var NgbTimepicker = (function () { function NgbTimepicker(config) { this.onChange = function (_) { }; this.onTouched = function () { }; this.meridian = config.meridian; this.spinners = config.spinners; this.seconds = config.seconds; this.hourStep = config.hourStep; this.minuteStep = config.minuteStep; this.secondStep = config.secondStep; this.disabled = config.disabled; this.readonlyInputs = config.readonlyInputs; this.size = config.size; } NgbTimepicker.prototype.writeValue = function (value) { this.model = value ? new __WEBPACK_IMPORTED_MODULE_3__ngb_time__["a" /* NgbTime */](value.hour, value.minute, value.second) : new __WEBPACK_IMPORTED_MODULE_3__ngb_time__["a" /* NgbTime */](); if (!this.seconds && (!value || !Object(__WEBPACK_IMPORTED_MODULE_2__util_util__["d" /* isNumber */])(value.second))) { this.model.second = 0; } }; NgbTimepicker.prototype.registerOnChange = function (fn) { this.onChange = fn; }; NgbTimepicker.prototype.registerOnTouched = function (fn) { this.onTouched = fn; }; NgbTimepicker.prototype.setDisabledState = function (isDisabled) { this.disabled = isDisabled; }; NgbTimepicker.prototype.changeHour = function (step) { this.model.changeHour(step); this.propagateModelChange(); }; NgbTimepicker.prototype.changeMinute = function (step) { this.model.changeMinute(step); this.propagateModelChange(); }; NgbTimepicker.prototype.changeSecond = function (step) { this.model.changeSecond(step); this.propagateModelChange(); }; NgbTimepicker.prototype.updateHour = function (newVal) { var isPM = this.model.hour >= 12; var enteredHour = Object(__WEBPACK_IMPORTED_MODULE_2__util_util__["h" /* toInteger */])(newVal); if (this.meridian && (isPM && enteredHour < 12 || !isPM && enteredHour === 12)) { this.model.updateHour(enteredHour + 12); } else { this.model.updateHour(enteredHour); } this.propagateModelChange(); }; NgbTimepicker.prototype.updateMinute = function (newVal) { this.model.updateMinute(Object(__WEBPACK_IMPORTED_MODULE_2__util_util__["h" /* toInteger */])(newVal)); this.propagateModelChange(); }; NgbTimepicker.prototype.updateSecond = function (newVal) { this.model.updateSecond(Object(__WEBPACK_IMPORTED_MODULE_2__util_util__["h" /* toInteger */])(newVal)); this.propagateModelChange(); }; NgbTimepicker.prototype.toggleMeridian = function () { if (this.meridian) { this.changeHour(12); } }; NgbTimepicker.prototype.formatHour = function (value) { if (Object(__WEBPACK_IMPORTED_MODULE_2__util_util__["d" /* isNumber */])(value)) { if (this.meridian) { return Object(__WEBPACK_IMPORTED_MODULE_2__util_util__["f" /* padNumber */])(value % 12 === 0 ? 12 : value % 12); } else { return Object(__WEBPACK_IMPORTED_MODULE_2__util_util__["f" /* padNumber */])(value % 24); } } else { return Object(__WEBPACK_IMPORTED_MODULE_2__util_util__["f" /* padNumber */])(NaN); } }; NgbTimepicker.prototype.formatMinSec = function (value) { return Object(__WEBPACK_IMPORTED_MODULE_2__util_util__["f" /* padNumber */])(value); }; NgbTimepicker.prototype.setFormControlSize = function () { return { 'form-control-sm': this.size === 'small', 'form-control-lg': this.size === 'large' }; }; NgbTimepicker.prototype.setButtonSize = function () { return { 'btn-sm': this.size === 'small', 'btn-lg': this.size === 'large' }; }; NgbTimepicker.prototype.ngOnChanges = function (changes) { if (changes['seconds'] && !this.seconds && this.model && !Object(__WEBPACK_IMPORTED_MODULE_2__util_util__["d" /* isNumber */])(this.model.second)) { this.model.second = 0; this.propagateModelChange(false); } }; NgbTimepicker.prototype.propagateModelChange = function (touched) { if (touched === void 0) { touched = true; } if (touched) { this.onTouched(); } if (this.model.isValid(this.seconds)) { this.onChange({ hour: this.model.hour, minute: this.model.minute, second: this.model.second }); } else { this.onChange(null); } }; NgbTimepicker.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"], args: [{ selector: 'ngb-timepicker', styles: ["\n .ngb-tp {\n display: -ms-flexbox;\n display: flex;\n -ms-flex-align: center;\n align-items: center;\n }\n\n .ngb-tp-hour, .ngb-tp-minute, .ngb-tp-second, .ngb-tp-meridian {\n display: -ms-flexbox;\n display: flex;\n -ms-flex-direction: column;\n flex-direction: column;\n -ms-flex-align: center;\n align-items: center;\n -ms-flex-pack: distribute;\n justify-content: space-around;\n }\n\n .ngb-tp-spacer {\n width: 1em;\n text-align: center;\n }\n\n .chevron::before {\n border-style: solid;\n border-width: 0.29em 0.29em 0 0;\n content: '';\n display: inline-block;\n height: 0.69em;\n left: 0.05em;\n position: relative;\n top: 0.15em;\n transform: rotate(-45deg);\n -webkit-transform: rotate(-45deg);\n -ms-transform: rotate(-45deg);\n vertical-align: middle;\n width: 0.71em;\n }\n\n .chevron.bottom:before {\n top: -.3em;\n -webkit-transform: rotate(135deg);\n -ms-transform: rotate(135deg);\n transform: rotate(135deg);\n }\n\n input {\n text-align: center;\n display: inline-block;\n width: auto;\n }\n "], template: "\n <fieldset [disabled]=\"disabled\" [class.disabled]=\"disabled\">\n <div class=\"ngb-tp\">\n <div class=\"ngb-tp-hour\">\n <button *ngIf=\"spinners\" type=\"button\" class=\"btn btn-link\" [ngClass]=\"setButtonSize()\" (click)=\"changeHour(hourStep)\"\n [disabled]=\"disabled\" [class.disabled]=\"disabled\">\n <span class=\"chevron\"></span>\n <span class=\"sr-only\">Increment hours</span>\n </button>\n <input type=\"text\" class=\"form-control\" [ngClass]=\"setFormControlSize()\" maxlength=\"2\" size=\"2\" placeholder=\"HH\"\n [value]=\"formatHour(model?.hour)\" (change)=\"updateHour($event.target.value)\"\n [readonly]=\"readonlyInputs\" [disabled]=\"disabled\" aria-label=\"Hours\">\n <button *ngIf=\"spinners\" type=\"button\" class=\"btn btn-link\" [ngClass]=\"setButtonSize()\" (click)=\"changeHour(-hourStep)\"\n [disabled]=\"disabled\" [class.disabled]=\"disabled\">\n <span class=\"chevron bottom\"></span>\n <span class=\"sr-only\">Decrement hours</span>\n </button>\n </div>\n <div class=\"ngb-tp-spacer\">:</div>\n <div class=\"ngb-tp-minute\">\n <button *ngIf=\"spinners\" type=\"button\" class=\"btn btn-link\" [ngClass]=\"setButtonSize()\" (click)=\"changeMinute(minuteStep)\"\n [disabled]=\"disabled\" [class.disabled]=\"disabled\">\n <span class=\"chevron\"></span>\n <span class=\"sr-only\">Increment minutes</span>\n </button>\n <input type=\"text\" class=\"form-control\" [ngClass]=\"setFormControlSize()\" maxlength=\"2\" size=\"2\" placeholder=\"MM\"\n [value]=\"formatMinSec(model?.minute)\" (change)=\"updateMinute($event.target.value)\"\n [readonly]=\"readonlyInputs\" [disabled]=\"disabled\" aria-label=\"Minutes\">\n <button *ngIf=\"spinners\" type=\"button\" class=\"btn btn-link\" [ngClass]=\"setButtonSize()\" (click)=\"changeMinute(-minuteStep)\"\n [disabled]=\"disabled\" [class.disabled]=\"disabled\">\n <span class=\"chevron bottom\"></span>\n <span class=\"sr-only\">Decrement minutes</span>\n </button>\n </div>\n <div *ngIf=\"seconds\" class=\"ngb-tp-spacer\">:</div>\n <div *ngIf=\"seconds\" class=\"ngb-tp-second\">\n <button *ngIf=\"spinners\" type=\"button\" class=\"btn btn-link\" [ngClass]=\"setButtonSize()\" (click)=\"changeSecond(secondStep)\"\n [disabled]=\"disabled\" [class.disabled]=\"disabled\">\n <span class=\"chevron\"></span>\n <span class=\"sr-only\">Increment seconds</span>\n </button>\n <input type=\"text\" class=\"form-control\" [ngClass]=\"setFormControlSize()\" maxlength=\"2\" size=\"2\" placeholder=\"SS\"\n [value]=\"formatMinSec(model?.second)\" (change)=\"updateSecond($event.target.value)\"\n [readonly]=\"readonlyInputs\" [disabled]=\"disabled\" aria-label=\"Seconds\">\n <button *ngIf=\"spinners\" type=\"button\" class=\"btn btn-link\" [ngClass]=\"setButtonSize()\" (click)=\"changeSecond(-secondStep)\"\n [disabled]=\"disabled\" [class.disabled]=\"disabled\">\n <span class=\"chevron bottom\"></span>\n <span class=\"sr-only\">Decrement seconds</span>\n </button>\n </div>\n <div *ngIf=\"meridian\" class=\"ngb-tp-spacer\"></div>\n <div *ngIf=\"meridian\" class=\"ngb-tp-meridian\">\n <button type=\"button\" class=\"btn btn-outline-primary\" [ngClass]=\"setButtonSize()\"\n [disabled]=\"disabled\" [class.disabled]=\"disabled\"\n (click)=\"toggleMeridian()\">{{model?.hour >= 12 ? 'PM' : 'AM'}}</button>\n </div>\n </div>\n </fieldset>\n ", providers: [NGB_TIMEPICKER_VALUE_ACCESSOR] },] }, ]; /** @nocollapse */ NgbTimepicker.ctorParameters = function () { return [ { type: __WEBPACK_IMPORTED_MODULE_4__timepicker_config__["a" /* NgbTimepickerConfig */], }, ]; }; NgbTimepicker.propDecorators = { "meridian": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "spinners": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "seconds": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "hourStep": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "minuteStep": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "secondStep": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "readonlyInputs": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "size": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], }; return NgbTimepicker; }()); //# sourceMappingURL=timepicker.js.map /***/ }), /***/ "./node_modules/@ng-bootstrap/ng-bootstrap/timepicker/timepicker.module.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NgbTimepickerModule; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_common__ = __webpack_require__("./node_modules/@angular/common/esm2015/common.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__timepicker__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/timepicker/timepicker.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__timepicker_config__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/timepicker/timepicker-config.js"); /* unused harmony reexport NgbTimepicker */ /* unused harmony reexport NgbTimepickerConfig */ var NgbTimepickerModule = (function () { function NgbTimepickerModule() { } NgbTimepickerModule.forRoot = function () { return { ngModule: NgbTimepickerModule, providers: [__WEBPACK_IMPORTED_MODULE_3__timepicker_config__["a" /* NgbTimepickerConfig */]] }; }; NgbTimepickerModule.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["NgModule"], args: [{ declarations: [__WEBPACK_IMPORTED_MODULE_2__timepicker__["a" /* NgbTimepicker */]], exports: [__WEBPACK_IMPORTED_MODULE_2__timepicker__["a" /* NgbTimepicker */]], imports: [__WEBPACK_IMPORTED_MODULE_1__angular_common__["CommonModule"]] },] }, ]; /** @nocollapse */ NgbTimepickerModule.ctorParameters = function () { return []; }; return NgbTimepickerModule; }()); //# sourceMappingURL=timepicker.module.js.map /***/ }), /***/ "./node_modules/@ng-bootstrap/ng-bootstrap/tooltip/tooltip-config.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NgbTooltipConfig; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); /** * Configuration service for the NgbTooltip directive. * You can inject this service, typically in your root component, and customize the values of its properties in * order to provide default values for all the tooltips used in the application. */ var NgbTooltipConfig = (function () { function NgbTooltipConfig() { this.placement = 'top'; this.triggers = 'hover'; this.disableTooltip = false; } NgbTooltipConfig.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Injectable"] }, ]; /** @nocollapse */ NgbTooltipConfig.ctorParameters = function () { return []; }; return NgbTooltipConfig; }()); //# sourceMappingURL=tooltip-config.js.map /***/ }), /***/ "./node_modules/@ng-bootstrap/ng-bootstrap/tooltip/tooltip.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return NgbTooltipWindow; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NgbTooltip; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_triggers__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/util/triggers.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__util_positioning__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/util/positioning.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__util_popup__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/util/popup.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__tooltip_config__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/tooltip/tooltip-config.js"); var nextId = 0; var NgbTooltipWindow = (function () { function NgbTooltipWindow(_element, _renderer) { this._element = _element; this._renderer = _renderer; this.placement = 'top'; } NgbTooltipWindow.prototype.applyPlacement = function (_placement) { // remove the current placement classes this._renderer.removeClass(this._element.nativeElement, 'bs-tooltip-' + this.placement.toString().split('-')[0]); this._renderer.removeClass(this._element.nativeElement, 'bs-tooltip-' + this.placement.toString()); // set the new placement classes this.placement = _placement; // apply the new placement this._renderer.addClass(this._element.nativeElement, 'bs-tooltip-' + this.placement.toString().split('-')[0]); this._renderer.addClass(this._element.nativeElement, 'bs-tooltip-' + this.placement.toString()); }; NgbTooltipWindow.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"], args: [{ selector: 'ngb-tooltip-window', changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectionStrategy"].OnPush, host: { '[class]': '"tooltip show bs-tooltip-" + placement.split("-")[0]+" bs-tooltip-" + placement', 'role': 'tooltip', '[id]': 'id' }, template: "<div class=\"arrow\"></div><div class=\"tooltip-inner\"><ng-content></ng-content></div>", styles: ["\n :host.bs-tooltip-top .arrow, :host.bs-tooltip-bottom .arrow {\n left: calc(50% - 0.4rem);\n }\n\n :host.bs-tooltip-top-left .arrow, :host.bs-tooltip-bottom-left .arrow {\n left: 1em;\n }\n\n :host.bs-tooltip-top-right .arrow, :host.bs-tooltip-bottom-right .arrow {\n left: auto;\n right: 0.8rem;\n }\n\n :host.bs-tooltip-left .arrow, :host.bs-tooltip-right .arrow {\n top: calc(50% - 0.4rem);\n }\n \n :host.bs-tooltip-left-top .arrow, :host.bs-tooltip-right-top .arrow {\n top: 0.4rem;\n }\n\n :host.bs-tooltip-left-bottom .arrow, :host.bs-tooltip-right-bottom .arrow {\n top: auto;\n bottom: 0.4rem;\n }\n "] },] }, ]; /** @nocollapse */ NgbTooltipWindow.ctorParameters = function () { return [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ElementRef"], }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Renderer2"], }, ]; }; NgbTooltipWindow.propDecorators = { "placement": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "id": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], }; return NgbTooltipWindow; }()); /** * A lightweight, extensible directive for fancy tooltip creation. */ var NgbTooltip = (function () { function NgbTooltip(_elementRef, _renderer, injector, componentFactoryResolver, viewContainerRef, config, ngZone) { var _this = this; this._elementRef = _elementRef; this._renderer = _renderer; /** * Emits an event when the tooltip is shown */ this.shown = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); /** * Emits an event when the tooltip is hidden */ this.hidden = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); this._ngbTooltipWindowId = "ngb-tooltip-" + nextId++; this.placement = config.placement; this.triggers = config.triggers; this.container = config.container; this.disableTooltip = config.disableTooltip; this._popupService = new __WEBPACK_IMPORTED_MODULE_3__util_popup__["b" /* PopupService */](NgbTooltipWindow, injector, viewContainerRef, _renderer, componentFactoryResolver); this._zoneSubscription = ngZone.onStable.subscribe(function () { if (_this._windowRef) { _this._windowRef.instance.applyPlacement(Object(__WEBPACK_IMPORTED_MODULE_2__util_positioning__["a" /* positionElements */])(_this._elementRef.nativeElement, _this._windowRef.location.nativeElement, _this.placement, _this.container === 'body')); } }); } Object.defineProperty(NgbTooltip.prototype, "ngbTooltip", { get: function () { return this._ngbTooltip; }, set: /** * Content to be displayed as tooltip. If falsy, the tooltip won't open. */ function (value) { this._ngbTooltip = value; if (!value && this._windowRef) { this.close(); } }, enumerable: true, configurable: true }); /** * Opens an element’s tooltip. This is considered a “manual” triggering of the tooltip. * The context is an optional value to be injected into the tooltip template when it is created. */ /** * Opens an element’s tooltip. This is considered a “manual” triggering of the tooltip. * The context is an optional value to be injected into the tooltip template when it is created. */ NgbTooltip.prototype.open = /** * Opens an element’s tooltip. This is considered a “manual” triggering of the tooltip. * The context is an optional value to be injected into the tooltip template when it is created. */ function (context) { if (!this._windowRef && this._ngbTooltip && !this.disableTooltip) { this._windowRef = this._popupService.open(this._ngbTooltip, context); this._windowRef.instance.id = this._ngbTooltipWindowId; this._renderer.setAttribute(this._elementRef.nativeElement, 'aria-describedby', this._ngbTooltipWindowId); if (this.container === 'body') { window.document.querySelector(this.container).appendChild(this._windowRef.location.nativeElement); } this._windowRef.instance.placement = Array.isArray(this.placement) ? this.placement[0] : this.placement; // apply styling to set basic css-classes on target element, before going for positioning this._windowRef.changeDetectorRef.detectChanges(); this._windowRef.changeDetectorRef.markForCheck(); // position tooltip along the element this._windowRef.instance.applyPlacement(Object(__WEBPACK_IMPORTED_MODULE_2__util_positioning__["a" /* positionElements */])(this._elementRef.nativeElement, this._windowRef.location.nativeElement, this.placement, this.container === 'body')); this.shown.emit(); } }; /** * Closes an element’s tooltip. This is considered a “manual” triggering of the tooltip. */ /** * Closes an element’s tooltip. This is considered a “manual” triggering of the tooltip. */ NgbTooltip.prototype.close = /** * Closes an element’s tooltip. This is considered a “manual” triggering of the tooltip. */ function () { if (this._windowRef != null) { this._renderer.removeAttribute(this._elementRef.nativeElement, 'aria-describedby'); this._popupService.close(); this._windowRef = null; this.hidden.emit(); } }; /** * Toggles an element’s tooltip. This is considered a “manual” triggering of the tooltip. */ /** * Toggles an element’s tooltip. This is considered a “manual” triggering of the tooltip. */ NgbTooltip.prototype.toggle = /** * Toggles an element’s tooltip. This is considered a “manual” triggering of the tooltip. */ function () { if (this._windowRef) { this.close(); } else { this.open(); } }; /** * Returns whether or not the tooltip is currently being shown */ /** * Returns whether or not the tooltip is currently being shown */ NgbTooltip.prototype.isOpen = /** * Returns whether or not the tooltip is currently being shown */ function () { return this._windowRef != null; }; NgbTooltip.prototype.ngOnInit = function () { this._unregisterListenersFn = Object(__WEBPACK_IMPORTED_MODULE_1__util_triggers__["a" /* listenToTriggers */])(this._renderer, this._elementRef.nativeElement, this.triggers, this.open.bind(this), this.close.bind(this), this.toggle.bind(this)); }; NgbTooltip.prototype.ngOnDestroy = function () { this.close(); // This check is needed as it might happen that ngOnDestroy is called before ngOnInit // under certain conditions, see: https://github.com/ng-bootstrap/ng-bootstrap/issues/2199 if (this._unregisterListenersFn) { this._unregisterListenersFn(); } this._zoneSubscription.unsubscribe(); }; NgbTooltip.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: '[ngbTooltip]', exportAs: 'ngbTooltip' },] }, ]; /** @nocollapse */ NgbTooltip.ctorParameters = function () { return [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ElementRef"], }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Renderer2"], }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Injector"], }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ComponentFactoryResolver"], }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ViewContainerRef"], }, { type: __WEBPACK_IMPORTED_MODULE_4__tooltip_config__["a" /* NgbTooltipConfig */], }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["NgZone"], }, ]; }; NgbTooltip.propDecorators = { "placement": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "triggers": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "container": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "disableTooltip": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "shown": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"] },], "hidden": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"] },], "ngbTooltip": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], }; return NgbTooltip; }()); //# sourceMappingURL=tooltip.js.map /***/ }), /***/ "./node_modules/@ng-bootstrap/ng-bootstrap/tooltip/tooltip.module.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NgbTooltipModule; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__tooltip__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/tooltip/tooltip.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__tooltip_config__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/tooltip/tooltip-config.js"); /* unused harmony reexport NgbTooltipConfig */ /* unused harmony reexport NgbTooltip */ var NgbTooltipModule = (function () { function NgbTooltipModule() { } NgbTooltipModule.forRoot = function () { return { ngModule: NgbTooltipModule, providers: [__WEBPACK_IMPORTED_MODULE_2__tooltip_config__["a" /* NgbTooltipConfig */]] }; }; NgbTooltipModule.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["NgModule"], args: [{ declarations: [__WEBPACK_IMPORTED_MODULE_1__tooltip__["a" /* NgbTooltip */], __WEBPACK_IMPORTED_MODULE_1__tooltip__["b" /* NgbTooltipWindow */]], exports: [__WEBPACK_IMPORTED_MODULE_1__tooltip__["a" /* NgbTooltip */]], entryComponents: [__WEBPACK_IMPORTED_MODULE_1__tooltip__["b" /* NgbTooltipWindow */]] },] }, ]; /** @nocollapse */ NgbTooltipModule.ctorParameters = function () { return []; }; return NgbTooltipModule; }()); //# sourceMappingURL=tooltip.module.js.map /***/ }), /***/ "./node_modules/@ng-bootstrap/ng-bootstrap/typeahead/highlight.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NgbHighlight; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_util__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/util/util.js"); var NgbHighlight = (function () { function NgbHighlight() { this.highlightClass = 'ngb-highlight'; } NgbHighlight.prototype.ngOnChanges = function (changes) { var resultStr = Object(__WEBPACK_IMPORTED_MODULE_1__util_util__["i" /* toString */])(this.result); var resultLC = resultStr.toLowerCase(); var termLC = Object(__WEBPACK_IMPORTED_MODULE_1__util_util__["i" /* toString */])(this.term).toLowerCase(); var currentIdx = 0; if (termLC.length > 0) { this.parts = resultLC.split(new RegExp("(" + Object(__WEBPACK_IMPORTED_MODULE_1__util_util__["g" /* regExpEscape */])(termLC) + ")")).map(function (part) { var originalPart = resultStr.substr(currentIdx, part.length); currentIdx += part.length; return originalPart; }); } else { this.parts = [resultStr]; } }; NgbHighlight.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"], args: [{ selector: 'ngb-highlight', changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectionStrategy"].OnPush, template: "<ng-template ngFor [ngForOf]=\"parts\" let-part let-isOdd=\"odd\">" + "<span *ngIf=\"isOdd\" class=\"{{highlightClass}}\">{{part}}</span><ng-template [ngIf]=\"!isOdd\">{{part}}</ng-template>" + "</ng-template>", // template needs to be formatted in a certain way so we don't add empty text nodes styles: ["\n .ngb-highlight {\n font-weight: bold;\n }\n "] },] }, ]; /** @nocollapse */ NgbHighlight.ctorParameters = function () { return []; }; NgbHighlight.propDecorators = { "highlightClass": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "result": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "term": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], }; return NgbHighlight; }()); //# sourceMappingURL=highlight.js.map /***/ }), /***/ "./node_modules/@ng-bootstrap/ng-bootstrap/typeahead/typeahead-config.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NgbTypeaheadConfig; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); /** * Configuration service for the NgbTypeahead component. * You can inject this service, typically in your root component, and customize the values of its properties in * order to provide default values for all the typeaheads used in the application. */ var NgbTypeaheadConfig = (function () { function NgbTypeaheadConfig() { this.editable = true; this.focusFirst = true; this.showHint = false; this.placement = 'bottom-left'; } NgbTypeaheadConfig.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Injectable"] }, ]; /** @nocollapse */ NgbTypeaheadConfig.ctorParameters = function () { return []; }; return NgbTypeaheadConfig; }()); //# sourceMappingURL=typeahead-config.js.map /***/ }), /***/ "./node_modules/@ng-bootstrap/ng-bootstrap/typeahead/typeahead-window.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NgbTypeaheadWindow; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_util__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/util/util.js"); var NgbTypeaheadWindow = (function () { function NgbTypeaheadWindow() { this.activeIdx = 0; /** * Flag indicating if the first row should be active initially */ this.focusFirst = true; /** * A function used to format a given result before display. This function should return a formatted string without any * HTML markup */ this.formatter = __WEBPACK_IMPORTED_MODULE_1__util_util__["i" /* toString */]; /** * Event raised when user selects a particular result row */ this.selectEvent = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); this.activeChangeEvent = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); } NgbTypeaheadWindow.prototype.hasActive = function () { return this.activeIdx > -1 && this.activeIdx < this.results.length; }; NgbTypeaheadWindow.prototype.getActive = function () { return this.results[this.activeIdx]; }; NgbTypeaheadWindow.prototype.markActive = function (activeIdx) { this.activeIdx = activeIdx; this._activeChanged(); }; NgbTypeaheadWindow.prototype.next = function () { if (this.activeIdx === this.results.length - 1) { this.activeIdx = this.focusFirst ? (this.activeIdx + 1) % this.results.length : -1; } else { this.activeIdx++; } this._activeChanged(); }; NgbTypeaheadWindow.prototype.prev = function () { if (this.activeIdx < 0) { this.activeIdx = this.results.length - 1; } else if (this.activeIdx === 0) { this.activeIdx = this.focusFirst ? this.results.length - 1 : -1; } else { this.activeIdx--; } this._activeChanged(); }; NgbTypeaheadWindow.prototype.resetActive = function () { this.activeIdx = this.focusFirst ? 0 : -1; this._activeChanged(); }; NgbTypeaheadWindow.prototype.select = function (item) { this.selectEvent.emit(item); }; NgbTypeaheadWindow.prototype.ngOnInit = function () { this.resetActive(); }; NgbTypeaheadWindow.prototype._activeChanged = function () { this.activeChangeEvent.emit(this.activeIdx >= 0 ? this.id + '-' + this.activeIdx : undefined); }; NgbTypeaheadWindow.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"], args: [{ selector: 'ngb-typeahead-window', exportAs: 'ngbTypeaheadWindow', host: { 'class': 'dropdown-menu show', 'role': 'listbox', '[id]': 'id' }, template: "\n <ng-template #rt let-result=\"result\" let-term=\"term\" let-formatter=\"formatter\">\n <ngb-highlight [result]=\"formatter(result)\" [term]=\"term\"></ngb-highlight>\n </ng-template>\n <ng-template ngFor [ngForOf]=\"results\" let-result let-idx=\"index\">\n <button type=\"button\" class=\"dropdown-item\" role=\"option\"\n [id]=\"id + '-' + idx\"\n [class.active]=\"idx === activeIdx\"\n (mouseenter)=\"markActive(idx)\"\n (click)=\"select(result)\">\n <ng-template [ngTemplateOutlet]=\"resultTemplate || rt\"\n [ngTemplateOutletContext]=\"{result: result, term: term, formatter: formatter}\"></ng-template>\n </button>\n </ng-template>\n " },] }, ]; /** @nocollapse */ NgbTypeaheadWindow.ctorParameters = function () { return []; }; NgbTypeaheadWindow.propDecorators = { "id": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "focusFirst": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "results": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "term": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "formatter": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "resultTemplate": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "selectEvent": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"], args: ['select',] },], "activeChangeEvent": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"], args: ['activeChange',] },], }; return NgbTypeaheadWindow; }()); //# sourceMappingURL=typeahead-window.js.map /***/ }), /***/ "./node_modules/@ng-bootstrap/ng-bootstrap/typeahead/typeahead.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NgbTypeahead; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_forms__ = __webpack_require__("./node_modules/@angular/forms/esm2015/forms.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_rxjs_BehaviorSubject__ = __webpack_require__("./node_modules/rxjs/_esm2015/BehaviorSubject.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_rxjs_operator_let__ = __webpack_require__("./node_modules/rxjs/_esm2015/operator/let.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_rxjs_operator_do__ = __webpack_require__("./node_modules/rxjs/_esm2015/operator/do.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_rxjs_operator_switchMap__ = __webpack_require__("./node_modules/rxjs/_esm2015/operator/switchMap.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_rxjs_observable_fromEvent__ = __webpack_require__("./node_modules/rxjs/_esm2015/observable/fromEvent.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__util_positioning__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/util/positioning.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__typeahead_window__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/typeahead/typeahead-window.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__util_popup__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/util/popup.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__util_util__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/util/util.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__typeahead_config__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/typeahead/typeahead-config.js"); var Key; (function (Key) { Key[Key["Tab"] = 9] = "Tab"; Key[Key["Enter"] = 13] = "Enter"; Key[Key["Escape"] = 27] = "Escape"; Key[Key["ArrowUp"] = 38] = "ArrowUp"; Key[Key["ArrowDown"] = 40] = "ArrowDown"; })(Key || (Key = {})); var NGB_TYPEAHEAD_VALUE_ACCESSOR = { provide: __WEBPACK_IMPORTED_MODULE_1__angular_forms__["NG_VALUE_ACCESSOR"], useExisting: Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["forwardRef"])(function () { return NgbTypeahead; }), multi: true }; var nextWindowId = 0; /** * NgbTypeahead directive provides a simple way of creating powerful typeaheads from any text input */ var NgbTypeahead = (function () { function NgbTypeahead(_elementRef, _viewContainerRef, _renderer, _injector, componentFactoryResolver, config, ngZone) { var _this = this; this._elementRef = _elementRef; this._viewContainerRef = _viewContainerRef; this._renderer = _renderer; this._injector = _injector; /** Placement of a typeahead accepts: * "top", "top-left", "top-right", "bottom", "bottom-left", "bottom-right", * "left", "left-top", "left-bottom", "right", "right-top", "right-bottom" * and array of above values. */ this.placement = 'bottom-left'; /** * An event emitted when a match is selected. Event payload is of type NgbTypeaheadSelectItemEvent. */ this.selectItem = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); this.popupId = "ngb-typeahead-" + nextWindowId++; this._onTouched = function () { }; this._onChange = function (_) { }; this.container = config.container; this.editable = config.editable; this.focusFirst = config.focusFirst; this.showHint = config.showHint; this.placement = config.placement; this._valueChanges = Object(__WEBPACK_IMPORTED_MODULE_6_rxjs_observable_fromEvent__["fromEvent"])(_elementRef.nativeElement, 'input', function ($event) { return $event.target.value; }); this._resubscribeTypeahead = new __WEBPACK_IMPORTED_MODULE_2_rxjs_BehaviorSubject__["BehaviorSubject"](null); this._popupService = new __WEBPACK_IMPORTED_MODULE_9__util_popup__["b" /* PopupService */](__WEBPACK_IMPORTED_MODULE_8__typeahead_window__["a" /* NgbTypeaheadWindow */], _injector, _viewContainerRef, _renderer, componentFactoryResolver); this._zoneSubscription = ngZone.onStable.subscribe(function () { if (_this.isPopupOpen()) { Object(__WEBPACK_IMPORTED_MODULE_7__util_positioning__["a" /* positionElements */])(_this._elementRef.nativeElement, _this._windowRef.location.nativeElement, _this.placement, _this.container === 'body'); } }); } NgbTypeahead.prototype.ngOnInit = function () { var _this = this; var inputValues$ = __WEBPACK_IMPORTED_MODULE_4_rxjs_operator_do__["a" /* _do */].call(this._valueChanges, function (value) { _this._inputValueBackup = value; if (_this.editable) { _this._onChange(value); } }); var results$ = __WEBPACK_IMPORTED_MODULE_3_rxjs_operator_let__["a" /* letProto */].call(inputValues$, this.ngbTypeahead); var processedResults$ = __WEBPACK_IMPORTED_MODULE_4_rxjs_operator_do__["a" /* _do */].call(results$, function () { if (!_this.editable) { _this._onChange(undefined); } }); var userInput$ = __WEBPACK_IMPORTED_MODULE_5_rxjs_operator_switchMap__["a" /* switchMap */].call(this._resubscribeTypeahead, function () { return processedResults$; }); this._subscription = this._subscribeToUserInput(userInput$); }; NgbTypeahead.prototype.ngOnDestroy = function () { this._closePopup(); this._unsubscribeFromUserInput(); this._zoneSubscription.unsubscribe(); }; NgbTypeahead.prototype.registerOnChange = function (fn) { this._onChange = fn; }; NgbTypeahead.prototype.registerOnTouched = function (fn) { this._onTouched = fn; }; NgbTypeahead.prototype.writeValue = function (value) { this._writeInputValue(this._formatItemForInput(value)); }; NgbTypeahead.prototype.setDisabledState = function (isDisabled) { this._renderer.setProperty(this._elementRef.nativeElement, 'disabled', isDisabled); }; NgbTypeahead.prototype.onDocumentClick = function (event) { if (event.target !== this._elementRef.nativeElement) { this.dismissPopup(); } }; /** * Dismisses typeahead popup window */ /** * Dismisses typeahead popup window */ NgbTypeahead.prototype.dismissPopup = /** * Dismisses typeahead popup window */ function () { if (this.isPopupOpen()) { this._closePopup(); this._writeInputValue(this._inputValueBackup); } }; /** * Returns true if the typeahead popup window is displayed */ /** * Returns true if the typeahead popup window is displayed */ NgbTypeahead.prototype.isPopupOpen = /** * Returns true if the typeahead popup window is displayed */ function () { return this._windowRef != null; }; NgbTypeahead.prototype.handleBlur = function () { this._resubscribeTypeahead.next(null); this._onTouched(); }; NgbTypeahead.prototype.handleKeyDown = function (event) { if (!this.isPopupOpen()) { return; } if (Key[Object(__WEBPACK_IMPORTED_MODULE_10__util_util__["i" /* toString */])(event.which)]) { switch (event.which) { case Key.ArrowDown: event.preventDefault(); this._windowRef.instance.next(); this._showHint(); break; case Key.ArrowUp: event.preventDefault(); this._windowRef.instance.prev(); this._showHint(); break; case Key.Enter: case Key.Tab: var result = this._windowRef.instance.getActive(); if (Object(__WEBPACK_IMPORTED_MODULE_10__util_util__["b" /* isDefined */])(result)) { event.preventDefault(); event.stopPropagation(); this._selectResult(result); } this._closePopup(); break; case Key.Escape: event.preventDefault(); this._resubscribeTypeahead.next(null); this.dismissPopup(); break; } } }; NgbTypeahead.prototype._openPopup = function () { var _this = this; if (!this.isPopupOpen()) { this._inputValueBackup = this._elementRef.nativeElement.value; this._windowRef = this._popupService.open(); this._windowRef.instance.id = this.popupId; this._windowRef.instance.selectEvent.subscribe(function (result) { return _this._selectResultClosePopup(result); }); this._windowRef.instance.activeChangeEvent.subscribe(function (activeId) { return _this.activeDescendant = activeId; }); if (this.container === 'body') { window.document.querySelector(this.container).appendChild(this._windowRef.location.nativeElement); } } }; NgbTypeahead.prototype._closePopup = function () { this._popupService.close(); this._windowRef = null; this.activeDescendant = undefined; }; NgbTypeahead.prototype._selectResult = function (result) { var defaultPrevented = false; this.selectItem.emit({ item: result, preventDefault: function () { defaultPrevented = true; } }); this._resubscribeTypeahead.next(null); if (!defaultPrevented) { this.writeValue(result); this._onChange(result); } }; NgbTypeahead.prototype._selectResultClosePopup = function (result) { this._selectResult(result); this._closePopup(); }; NgbTypeahead.prototype._showHint = function () { if (this.showHint && this._windowRef.instance.hasActive() && this._inputValueBackup != null) { var userInputLowerCase = this._inputValueBackup.toLowerCase(); var formattedVal = this._formatItemForInput(this._windowRef.instance.getActive()); if (userInputLowerCase === formattedVal.substr(0, this._inputValueBackup.length).toLowerCase()) { this._writeInputValue(this._inputValueBackup + formattedVal.substr(this._inputValueBackup.length)); this._elementRef.nativeElement['setSelectionRange'].apply(this._elementRef.nativeElement, [this._inputValueBackup.length, formattedVal.length]); } else { this.writeValue(this._windowRef.instance.getActive()); } } }; NgbTypeahead.prototype._formatItemForInput = function (item) { return item && this.inputFormatter ? this.inputFormatter(item) : Object(__WEBPACK_IMPORTED_MODULE_10__util_util__["i" /* toString */])(item); }; NgbTypeahead.prototype._writeInputValue = function (value) { this._renderer.setProperty(this._elementRef.nativeElement, 'value', Object(__WEBPACK_IMPORTED_MODULE_10__util_util__["i" /* toString */])(value)); }; NgbTypeahead.prototype._subscribeToUserInput = function (userInput$) { var _this = this; return userInput$.subscribe(function (results) { if (!results || results.length === 0) { _this._closePopup(); } else { _this._openPopup(); _this._windowRef.instance.focusFirst = _this.focusFirst; _this._windowRef.instance.results = results; _this._windowRef.instance.term = _this._elementRef.nativeElement.value; if (_this.resultFormatter) { _this._windowRef.instance.formatter = _this.resultFormatter; } if (_this.resultTemplate) { _this._windowRef.instance.resultTemplate = _this.resultTemplate; } _this._windowRef.instance.resetActive(); // The observable stream we are subscribing to might have async steps // and if a component containing typeahead is using the OnPush strategy // the change detection turn wouldn't be invoked automatically. // The observable stream we are subscribing to might have async steps // and if a component containing typeahead is using the OnPush strategy // the change detection turn wouldn't be invoked automatically. _this._windowRef.changeDetectorRef.detectChanges(); _this._showHint(); } }); }; NgbTypeahead.prototype._unsubscribeFromUserInput = function () { if (this._subscription) { this._subscription.unsubscribe(); } this._subscription = null; }; NgbTypeahead.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: 'input[ngbTypeahead]', exportAs: 'ngbTypeahead', host: { '(blur)': 'handleBlur()', '[class.open]': 'isPopupOpen()', '(document:click)': 'onDocumentClick($event)', '(keydown)': 'handleKeyDown($event)', 'autocomplete': 'off', 'autocapitalize': 'off', 'autocorrect': 'off', 'role': 'combobox', 'aria-multiline': 'false', '[attr.aria-autocomplete]': 'showHint ? "both" : "list"', '[attr.aria-activedescendant]': 'activeDescendant', '[attr.aria-owns]': 'isPopupOpen() ? popupId : null', '[attr.aria-expanded]': 'isPopupOpen()' }, providers: [NGB_TYPEAHEAD_VALUE_ACCESSOR] },] }, ]; /** @nocollapse */ NgbTypeahead.ctorParameters = function () { return [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ElementRef"], }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ViewContainerRef"], }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Renderer2"], }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Injector"], }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ComponentFactoryResolver"], }, { type: __WEBPACK_IMPORTED_MODULE_11__typeahead_config__["a" /* NgbTypeaheadConfig */], }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["NgZone"], }, ]; }; NgbTypeahead.propDecorators = { "container": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "editable": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "focusFirst": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "inputFormatter": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "ngbTypeahead": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "resultFormatter": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "resultTemplate": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "showHint": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "placement": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "selectItem": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"] },], }; return NgbTypeahead; }()); //# sourceMappingURL=typeahead.js.map /***/ }), /***/ "./node_modules/@ng-bootstrap/ng-bootstrap/typeahead/typeahead.module.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NgbTypeaheadModule; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_common__ = __webpack_require__("./node_modules/@angular/common/esm2015/common.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__highlight__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/typeahead/highlight.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__typeahead_window__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/typeahead/typeahead-window.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__typeahead__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/typeahead/typeahead.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__typeahead_config__ = __webpack_require__("./node_modules/@ng-bootstrap/ng-bootstrap/typeahead/typeahead-config.js"); /* unused harmony reexport NgbHighlight */ /* unused harmony reexport NgbTypeaheadWindow */ /* unused harmony reexport NgbTypeaheadConfig */ /* unused harmony reexport NgbTypeahead */ var NgbTypeaheadModule = (function () { function NgbTypeaheadModule() { } NgbTypeaheadModule.forRoot = function () { return { ngModule: NgbTypeaheadModule, providers: [__WEBPACK_IMPORTED_MODULE_5__typeahead_config__["a" /* NgbTypeaheadConfig */]] }; }; NgbTypeaheadModule.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["NgModule"], args: [{ declarations: [__WEBPACK_IMPORTED_MODULE_4__typeahead__["a" /* NgbTypeahead */], __WEBPACK_IMPORTED_MODULE_2__highlight__["a" /* NgbHighlight */], __WEBPACK_IMPORTED_MODULE_3__typeahead_window__["a" /* NgbTypeaheadWindow */]], exports: [__WEBPACK_IMPORTED_MODULE_4__typeahead__["a" /* NgbTypeahead */], __WEBPACK_IMPORTED_MODULE_2__highlight__["a" /* NgbHighlight */]], imports: [__WEBPACK_IMPORTED_MODULE_1__angular_common__["CommonModule"]], entryComponents: [__WEBPACK_IMPORTED_MODULE_3__typeahead_window__["a" /* NgbTypeaheadWindow */]] },] }, ]; /** @nocollapse */ NgbTypeaheadModule.ctorParameters = function () { return []; }; return NgbTypeaheadModule; }()); //# sourceMappingURL=typeahead.module.js.map /***/ }), /***/ "./node_modules/@ng-bootstrap/ng-bootstrap/util/popup.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ContentRef; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return PopupService; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var ContentRef = (function () { function ContentRef(nodes, viewRef, componentRef) { this.nodes = nodes; this.viewRef = viewRef; this.componentRef = componentRef; } return ContentRef; }()); var PopupService = (function () { function PopupService(_type, _injector, _viewContainerRef, _renderer, _componentFactoryResolver) { this._type = _type; this._injector = _injector; this._viewContainerRef = _viewContainerRef; this._renderer = _renderer; this._componentFactoryResolver = _componentFactoryResolver; } PopupService.prototype.open = function (content, context) { if (!this._windowRef) { this._contentRef = this._getContentRef(content, context); this._windowRef = this._viewContainerRef.createComponent(this._componentFactoryResolver.resolveComponentFactory(this._type), 0, this._injector, this._contentRef.nodes); } return this._windowRef; }; PopupService.prototype.close = function () { if (this._windowRef) { this._viewContainerRef.remove(this._viewContainerRef.indexOf(this._windowRef.hostView)); this._windowRef = null; if (this._contentRef.viewRef) { this._viewContainerRef.remove(this._viewContainerRef.indexOf(this._contentRef.viewRef)); this._contentRef = null; } } }; PopupService.prototype._getContentRef = function (content, context) { if (!content) { return new ContentRef([]); } else if (content instanceof __WEBPACK_IMPORTED_MODULE_0__angular_core__["TemplateRef"]) { var viewRef = this._viewContainerRef.createEmbeddedView(content, context); return new ContentRef([viewRef.rootNodes], viewRef); } else { return new ContentRef([[this._renderer.createText("" + content)]]); } }; return PopupService; }()); //# sourceMappingURL=popup.js.map /***/ }), /***/ "./node_modules/@ng-bootstrap/ng-bootstrap/util/positioning.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export Positioning */ /* harmony export (immutable) */ __webpack_exports__["a"] = positionElements; // previous version: // https://github.com/angular-ui/bootstrap/blob/07c31d0731f7cb068a1932b8e01d2312b796b4ec/src/position/position.js var // previous version: // https://github.com/angular-ui/bootstrap/blob/07c31d0731f7cb068a1932b8e01d2312b796b4ec/src/position/position.js Positioning = (function () { function Positioning() { } Positioning.prototype.getAllStyles = function (element) { return window.getComputedStyle(element); }; Positioning.prototype.getStyle = function (element, prop) { return this.getAllStyles(element)[prop]; }; Positioning.prototype.isStaticPositioned = function (element) { return (this.getStyle(element, 'position') || 'static') === 'static'; }; Positioning.prototype.offsetParent = function (element) { var offsetParentEl = element.offsetParent || document.documentElement; while (offsetParentEl && offsetParentEl !== document.documentElement && this.isStaticPositioned(offsetParentEl)) { offsetParentEl = offsetParentEl.offsetParent; } return offsetParentEl || document.documentElement; }; Positioning.prototype.position = function (element, round) { if (round === void 0) { round = true; } var elPosition; var parentOffset = { width: 0, height: 0, top: 0, bottom: 0, left: 0, right: 0 }; if (this.getStyle(element, 'position') === 'fixed') { elPosition = element.getBoundingClientRect(); } else { var offsetParentEl = this.offsetParent(element); elPosition = this.offset(element, false); if (offsetParentEl !== document.documentElement) { parentOffset = this.offset(offsetParentEl, false); } parentOffset.top += offsetParentEl.clientTop; parentOffset.left += offsetParentEl.clientLeft; } elPosition.top -= parentOffset.top; elPosition.bottom -= parentOffset.top; elPosition.left -= parentOffset.left; elPosition.right -= parentOffset.left; if (round) { elPosition.top = Math.round(elPosition.top); elPosition.bottom = Math.round(elPosition.bottom); elPosition.left = Math.round(elPosition.left); elPosition.right = Math.round(elPosition.right); } return elPosition; }; Positioning.prototype.offset = function (element, round) { if (round === void 0) { round = true; } var elBcr = element.getBoundingClientRect(); var viewportOffset = { top: window.pageYOffset - document.documentElement.clientTop, left: window.pageXOffset - document.documentElement.clientLeft }; var elOffset = { height: elBcr.height || element.offsetHeight, width: elBcr.width || element.offsetWidth, top: elBcr.top + viewportOffset.top, bottom: elBcr.bottom + viewportOffset.top, left: elBcr.left + viewportOffset.left, right: elBcr.right + viewportOffset.left }; if (round) { elOffset.height = Math.round(elOffset.height); elOffset.width = Math.round(elOffset.width); elOffset.top = Math.round(elOffset.top); elOffset.bottom = Math.round(elOffset.bottom); elOffset.left = Math.round(elOffset.left); elOffset.right = Math.round(elOffset.right); } return elOffset; }; Positioning.prototype.positionElements = function (hostElement, targetElement, placement, appendToBody) { var hostElPosition = appendToBody ? this.offset(hostElement, false) : this.position(hostElement, false); var targetElStyles = this.getAllStyles(targetElement); var targetElBCR = targetElement.getBoundingClientRect(); var placementPrimary = placement.split('-')[0] || 'top'; var placementSecondary = placement.split('-')[1] || 'center'; var targetElPosition = { 'height': targetElBCR.height || targetElement.offsetHeight, 'width': targetElBCR.width || targetElement.offsetWidth, 'top': 0, 'bottom': targetElBCR.height || targetElement.offsetHeight, 'left': 0, 'right': targetElBCR.width || targetElement.offsetWidth }; switch (placementPrimary) { case 'top': targetElPosition.top = hostElPosition.top - (targetElement.offsetHeight + parseFloat(targetElStyles.marginBottom)); break; case 'bottom': targetElPosition.top = hostElPosition.top + hostElPosition.height; break; case 'left': targetElPosition.left = hostElPosition.left - (targetElement.offsetWidth + parseFloat(targetElStyles.marginRight)); break; case 'right': targetElPosition.left = hostElPosition.left + hostElPosition.width; break; } switch (placementSecondary) { case 'top': targetElPosition.top = hostElPosition.top; break; case 'bottom': targetElPosition.top = hostElPosition.top + hostElPosition.height - targetElement.offsetHeight; break; case 'left': targetElPosition.left = hostElPosition.left; break; case 'right': targetElPosition.left = hostElPosition.left + hostElPosition.width - targetElement.offsetWidth; break; case 'center': if (placementPrimary === 'top' || placementPrimary === 'bottom') { targetElPosition.left = hostElPosition.left + hostElPosition.width / 2 - targetElement.offsetWidth / 2; } else { targetElPosition.top = hostElPosition.top + hostElPosition.height / 2 - targetElement.offsetHeight / 2; } break; } targetElPosition.top = Math.round(targetElPosition.top); targetElPosition.bottom = Math.round(targetElPosition.bottom); targetElPosition.left = Math.round(targetElPosition.left); targetElPosition.right = Math.round(targetElPosition.right); return targetElPosition; }; // get the availble placements of the target element in the viewport dependeing on the host element // get the availble placements of the target element in the viewport dependeing on the host element Positioning.prototype.getAvailablePlacements = // get the availble placements of the target element in the viewport dependeing on the host element function (hostElement, targetElement) { var availablePlacements = []; var hostElemClientRect = hostElement.getBoundingClientRect(); var targetElemClientRect = targetElement.getBoundingClientRect(); var html = document.documentElement; // left: check if target width can be placed between host left and viewport start and also height of target is // inside viewport if (targetElemClientRect.width < hostElemClientRect.left) { // check for left only if ((hostElemClientRect.top + hostElemClientRect.height / 2 - targetElement.offsetHeight / 2) > 0) { availablePlacements.splice(availablePlacements.length, 1, 'left'); } // check for left-top and left-bottom this.setSecondaryPlacementForLeftRight(hostElemClientRect, targetElemClientRect, 'left', availablePlacements); } // top: target height is less than host top if (targetElemClientRect.height < hostElemClientRect.top) { availablePlacements.splice(availablePlacements.length, 1, 'top'); this.setSecondaryPlacementForTopBottom(hostElemClientRect, targetElemClientRect, 'top', availablePlacements); } // right: check if target width can be placed between host right and viewport end and also height of target is // inside viewport if ((window.innerWidth || html.clientWidth) - hostElemClientRect.right > targetElemClientRect.width) { // check for right only if ((hostElemClientRect.top + hostElemClientRect.height / 2 - targetElement.offsetHeight / 2) > 0) { availablePlacements.splice(availablePlacements.length, 1, 'right'); } // check for right-top and right-bottom this.setSecondaryPlacementForLeftRight(hostElemClientRect, targetElemClientRect, 'right', availablePlacements); } // bottom: check if there is enough space between host bottom and viewport end for target height if ((window.innerHeight || html.clientHeight) - hostElemClientRect.bottom > targetElemClientRect.height) { availablePlacements.splice(availablePlacements.length, 1, 'bottom'); this.setSecondaryPlacementForTopBottom(hostElemClientRect, targetElemClientRect, 'bottom', availablePlacements); } return availablePlacements; }; /** * check if secondary placement for left and right are available i.e. left-top, left-bottom, right-top, right-bottom * primaryplacement: left|right * availablePlacementArr: array in which available placemets to be set */ /** * check if secondary placement for left and right are available i.e. left-top, left-bottom, right-top, right-bottom * primaryplacement: left|right * availablePlacementArr: array in which available placemets to be set */ Positioning.prototype.setSecondaryPlacementForLeftRight = /** * check if secondary placement for left and right are available i.e. left-top, left-bottom, right-top, right-bottom * primaryplacement: left|right * availablePlacementArr: array in which available placemets to be set */ function (hostElemClientRect, targetElemClientRect, primaryPlacement, availablePlacementArr) { var html = document.documentElement; // check for left-bottom if (targetElemClientRect.height <= hostElemClientRect.bottom) { availablePlacementArr.splice(availablePlacementArr.length, 1, primaryPlacement + '-bottom'); } if ((window.innerHeight || html.clientHeight) - hostElemClientRect.top >= targetElemClientRect.height) { availablePlacementArr.splice(availablePlacementArr.length, 1, primaryPlacement + '-top'); } }; /** * check if secondary placement for top and bottom are available i.e. top-left, top-right, bottom-left, bottom-right * primaryplacement: top|bottom * availablePlacementArr: array in which available placemets to be set */ /** * check if secondary placement for top and bottom are available i.e. top-left, top-right, bottom-left, bottom-right * primaryplacement: top|bottom * availablePlacementArr: array in which available placemets to be set */ Positioning.prototype.setSecondaryPlacementForTopBottom = /** * check if secondary placement for top and bottom are available i.e. top-left, top-right, bottom-left, bottom-right * primaryplacement: top|bottom * availablePlacementArr: array in which available placemets to be set */ function (hostElemClientRect, targetElemClientRect, primaryPlacement, availablePlacementArr) { var html = document.documentElement; // check for left-bottom if ((window.innerWidth || html.clientWidth) - hostElemClientRect.left >= targetElemClientRect.width) { availablePlacementArr.splice(availablePlacementArr.length, 1, primaryPlacement + '-left'); } if (targetElemClientRect.width <= hostElemClientRect.right) { availablePlacementArr.splice(availablePlacementArr.length, 1, primaryPlacement + '-right'); } }; return Positioning; }()); // previous version: // https://github.com/angular-ui/bootstrap/blob/07c31d0731f7cb068a1932b8e01d2312b796b4ec/src/position/position.js var positionService = new Positioning(); /* * Accept the placement array and applies the appropriate placement dependent on the viewport. * Returns the applied placement. * In case of auto placement, placements are selected in order 'top', 'bottom', 'left', 'right'. * */ function positionElements(hostElement, targetElement, placement, appendToBody) { var placementVals = Array.isArray(placement) ? placement : [placement]; // replace auto placement with other placements var hasAuto = placementVals.findIndex(function (val) { return val === 'auto'; }); if (hasAuto >= 0) { ['top', 'right', 'bottom', 'left'].forEach(function (obj) { if (placementVals.find(function (val) { return val.search('^' + obj + '|^' + obj + '-') !== -1; }) == null) { placementVals.splice(hasAuto++, 1, obj); } }); } // coordinates where to position var topVal = 0, leftVal = 0; var appliedPlacement; // get available placements var availablePlacements = positionService.getAvailablePlacements(hostElement, targetElement); var _loop_1 = function (item, index) { // check if passed placement is present in the available placement or otherwise apply the last placement in the // passed placement list if ((availablePlacements.find(function (val) { return val === item; }) != null) || (placementVals.length === index + 1)) { appliedPlacement = item; var pos = positionService.positionElements(hostElement, targetElement, item, appendToBody); topVal = pos.top; leftVal = pos.left; return "break"; } }; // iterate over all the passed placements for (var _i = 0, _a = toItemIndexes(placementVals); _i < _a.length; _i++) { var _b = _a[_i], item = _b.item, index = _b.index; var state_1 = _loop_1(item, index); if (state_1 === "break") break; } targetElement.style.top = topVal + "px"; targetElement.style.left = leftVal + "px"; return appliedPlacement; } // function to get index and item of an array function toItemIndexes(a) { return a.map(function (item, index) { return ({ item: item, index: index }); }); } //# sourceMappingURL=positioning.js.map /***/ }), /***/ "./node_modules/@ng-bootstrap/ng-bootstrap/util/triggers.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export Trigger */ /* unused harmony export parseTriggers */ /* harmony export (immutable) */ __webpack_exports__["a"] = listenToTriggers; /* unused harmony export ɵ0 */ var Trigger = (function () { function Trigger(open, close) { this.open = open; this.close = close; if (!close) { this.close = open; } } Trigger.prototype.isManual = function () { return this.open === 'manual' || this.close === 'manual'; }; return Trigger; }()); var DEFAULT_ALIASES = { 'hover': ['mouseenter', 'mouseleave'] }; function parseTriggers(triggers, aliases) { if (aliases === void 0) { aliases = DEFAULT_ALIASES; } var trimmedTriggers = (triggers || '').trim(); if (trimmedTriggers.length === 0) { return []; } var parsedTriggers = trimmedTriggers.split(/\s+/).map(function (trigger) { return trigger.split(':'); }).map(function (triggerPair) { var alias = aliases[triggerPair[0]] || triggerPair; return new Trigger(alias[0], alias[1]); }); var manualTriggers = parsedTriggers.filter(function (triggerPair) { return triggerPair.isManual(); }); if (manualTriggers.length > 1) { throw 'Triggers parse error: only one manual trigger is allowed'; } if (manualTriggers.length === 1 && parsedTriggers.length > 1) { throw 'Triggers parse error: manual trigger can\'t be mixed with other triggers'; } return parsedTriggers; } var noopFn = function () { }; var ɵ0 = noopFn; function listenToTriggers(renderer, nativeElement, triggers, openFn, closeFn, toggleFn) { var parsedTriggers = parseTriggers(triggers); var listeners = []; if (parsedTriggers.length === 1 && parsedTriggers[0].isManual()) { return noopFn; } parsedTriggers.forEach(function (trigger) { if (trigger.open === trigger.close) { listeners.push(renderer.listen(nativeElement, trigger.open, toggleFn)); } else { listeners.push(renderer.listen(nativeElement, trigger.open, openFn), renderer.listen(nativeElement, trigger.close, closeFn)); } }); return function () { listeners.forEach(function (unsubscribeFn) { return unsubscribeFn(); }); }; } //# sourceMappingURL=triggers.js.map /***/ }), /***/ "./node_modules/@ng-bootstrap/ng-bootstrap/util/util.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["h"] = toInteger; /* harmony export (immutable) */ __webpack_exports__["i"] = toString; /* harmony export (immutable) */ __webpack_exports__["a"] = getValueInRange; /* harmony export (immutable) */ __webpack_exports__["e"] = isString; /* harmony export (immutable) */ __webpack_exports__["d"] = isNumber; /* harmony export (immutable) */ __webpack_exports__["c"] = isInteger; /* harmony export (immutable) */ __webpack_exports__["b"] = isDefined; /* harmony export (immutable) */ __webpack_exports__["f"] = padNumber; /* harmony export (immutable) */ __webpack_exports__["g"] = regExpEscape; function toInteger(value) { return parseInt("" + value, 10); } function toString(value) { return (value !== undefined && value !== null) ? "" + value : ''; } function getValueInRange(value, max, min) { if (min === void 0) { min = 0; } return Math.max(Math.min(value, max), min); } function isString(value) { return typeof value === 'string'; } function isNumber(value) { return !isNaN(toInteger(value)); } function isInteger(value) { return typeof value === 'number' && isFinite(value) && Math.floor(value) === value; } function isDefined(value) { return value !== undefined && value !== null; } function padNumber(value) { if (isNumber(value)) { return ("0" + value).slice(-2); } else { return ''; } } function regExpEscape(text) { return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&'); } //# sourceMappingURL=util.js.map /***/ }), /***/ "./node_modules/@ng-select/ng-select/esm2015/ng-select.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export NgSelectComponent */ /* unused harmony export NG_SELECT_DEFAULT_CONFIG */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NgSelectModule; }); /* unused harmony export ɵn */ /* unused harmony export ɵj */ /* unused harmony export ɵo */ /* unused harmony export ɵm */ /* unused harmony export ɵf */ /* unused harmony export ɵe */ /* unused harmony export ɵc */ /* unused harmony export ɵi */ /* unused harmony export ɵd */ /* unused harmony export ɵg */ /* unused harmony export ɵb */ /* unused harmony export ɵa */ /* unused harmony export ɵh */ /* unused harmony export ɵk */ /* unused harmony export ɵl */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_rxjs_observable_fromEventPattern__ = __webpack_require__("./node_modules/rxjs/_esm2015/observable/fromEventPattern.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_rxjs_operators__ = __webpack_require__("./node_modules/rxjs/_esm2015/operators.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_rxjs_Subject__ = __webpack_require__("./node_modules/rxjs/_esm2015/Subject.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__angular_forms__ = __webpack_require__("./node_modules/@angular/forms/esm2015/forms.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_rxjs_observable_merge__ = __webpack_require__("./node_modules/rxjs/_esm2015/observable/merge.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__angular_common__ = __webpack_require__("./node_modules/@angular/common/esm2015/common.js"); /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ class NgOptionTemplateDirective { /** * @param {?} template */ constructor(template) { this.template = template; } } NgOptionTemplateDirective.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: '[ng-option-tmp]' },] }, ]; /** @nocollapse */ NgOptionTemplateDirective.ctorParameters = () => [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["TemplateRef"], }, ]; class NgOptgroupTemplateDirective { /** * @param {?} template */ constructor(template) { this.template = template; } } NgOptgroupTemplateDirective.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: '[ng-optgroup-tmp]' },] }, ]; /** @nocollapse */ NgOptgroupTemplateDirective.ctorParameters = () => [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["TemplateRef"], }, ]; class NgLabelTemplateDirective { /** * @param {?} template */ constructor(template) { this.template = template; } } NgLabelTemplateDirective.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: '[ng-label-tmp]' },] }, ]; /** @nocollapse */ NgLabelTemplateDirective.ctorParameters = () => [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["TemplateRef"], }, ]; class NgMultiLabelTemplateDirective { /** * @param {?} template */ constructor(template) { this.template = template; } } NgMultiLabelTemplateDirective.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: '[ng-multi-label-tmp]' },] }, ]; /** @nocollapse */ NgMultiLabelTemplateDirective.ctorParameters = () => [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["TemplateRef"], }, ]; class NgHeaderTemplateDirective { /** * @param {?} template */ constructor(template) { this.template = template; } } NgHeaderTemplateDirective.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: '[ng-header-tmp]' },] }, ]; /** @nocollapse */ NgHeaderTemplateDirective.ctorParameters = () => [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["TemplateRef"], }, ]; class NgFooterTemplateDirective { /** * @param {?} template */ constructor(template) { this.template = template; } } NgFooterTemplateDirective.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: '[ng-footer-tmp]' },] }, ]; /** @nocollapse */ NgFooterTemplateDirective.ctorParameters = () => [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["TemplateRef"], }, ]; class NgNotFoundTemplateDirective { /** * @param {?} template */ constructor(template) { this.template = template; } } NgNotFoundTemplateDirective.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: '[ng-notfound-tmp]' },] }, ]; /** @nocollapse */ NgNotFoundTemplateDirective.ctorParameters = () => [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["TemplateRef"], }, ]; class NgTypeToSearchTemplateDirective { /** * @param {?} template */ constructor(template) { this.template = template; } } NgTypeToSearchTemplateDirective.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: '[ng-typetosearch-tmp]' },] }, ]; /** @nocollapse */ NgTypeToSearchTemplateDirective.ctorParameters = () => [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["TemplateRef"], }, ]; class NgLoadingTextTemplateDirective { /** * @param {?} template */ constructor(template) { this.template = template; } } NgLoadingTextTemplateDirective.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: '[ng-loadingtext-tmp]' },] }, ]; /** @nocollapse */ NgLoadingTextTemplateDirective.ctorParameters = () => [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["TemplateRef"], }, ]; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ class ConsoleService { /** * @param {?} message * @return {?} */ warn(message) { console.warn(message); } } ConsoleService.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Injectable"] }, ]; /** @nocollapse */ ConsoleService.ctorParameters = () => []; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @param {?} value * @return {?} */ function isDefined(value) { return value !== null && value !== undefined; } /** * @param {?} value * @return {?} */ function isObject(value) { return isDefined(value) && typeof value === 'object'; } /** * @param {?} value * @return {?} */ function isPromise(value) { return value instanceof Promise; } /** * @param {?} value * @return {?} */ function isFunction(value) { return value instanceof Function; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ const diacritics = { '\u24B6': 'A', '\uFF21': 'A', '\u00C0': 'A', '\u00C1': 'A', '\u00C2': 'A', '\u1EA6': 'A', '\u1EA4': 'A', '\u1EAA': 'A', '\u1EA8': 'A', '\u00C3': 'A', '\u0100': 'A', '\u0102': 'A', '\u1EB0': 'A', '\u1EAE': 'A', '\u1EB4': 'A', '\u1EB2': 'A', '\u0226': 'A', '\u01E0': 'A', '\u00C4': 'A', '\u01DE': 'A', '\u1EA2': 'A', '\u00C5': 'A', '\u01FA': 'A', '\u01CD': 'A', '\u0200': 'A', '\u0202': 'A', '\u1EA0': 'A', '\u1EAC': 'A', '\u1EB6': 'A', '\u1E00': 'A', '\u0104': 'A', '\u023A': 'A', '\u2C6F': 'A', '\uA732': 'AA', '\u00C6': 'AE', '\u01FC': 'AE', '\u01E2': 'AE', '\uA734': 'AO', '\uA736': 'AU', '\uA738': 'AV', '\uA73A': 'AV', '\uA73C': 'AY', '\u24B7': 'B', '\uFF22': 'B', '\u1E02': 'B', '\u1E04': 'B', '\u1E06': 'B', '\u0243': 'B', '\u0182': 'B', '\u0181': 'B', '\u24B8': 'C', '\uFF23': 'C', '\u0106': 'C', '\u0108': 'C', '\u010A': 'C', '\u010C': 'C', '\u00C7': 'C', '\u1E08': 'C', '\u0187': 'C', '\u023B': 'C', '\uA73E': 'C', '\u24B9': 'D', '\uFF24': 'D', '\u1E0A': 'D', '\u010E': 'D', '\u1E0C': 'D', '\u1E10': 'D', '\u1E12': 'D', '\u1E0E': 'D', '\u0110': 'D', '\u018B': 'D', '\u018A': 'D', '\u0189': 'D', '\uA779': 'D', '\u01F1': 'DZ', '\u01C4': 'DZ', '\u01F2': 'Dz', '\u01C5': 'Dz', '\u24BA': 'E', '\uFF25': 'E', '\u00C8': 'E', '\u00C9': 'E', '\u00CA': 'E', '\u1EC0': 'E', '\u1EBE': 'E', '\u1EC4': 'E', '\u1EC2': 'E', '\u1EBC': 'E', '\u0112': 'E', '\u1E14': 'E', '\u1E16': 'E', '\u0114': 'E', '\u0116': 'E', '\u00CB': 'E', '\u1EBA': 'E', '\u011A': 'E', '\u0204': 'E', '\u0206': 'E', '\u1EB8': 'E', '\u1EC6': 'E', '\u0228': 'E', '\u1E1C': 'E', '\u0118': 'E', '\u1E18': 'E', '\u1E1A': 'E', '\u0190': 'E', '\u018E': 'E', '\u24BB': 'F', '\uFF26': 'F', '\u1E1E': 'F', '\u0191': 'F', '\uA77B': 'F', '\u24BC': 'G', '\uFF27': 'G', '\u01F4': 'G', '\u011C': 'G', '\u1E20': 'G', '\u011E': 'G', '\u0120': 'G', '\u01E6': 'G', '\u0122': 'G', '\u01E4': 'G', '\u0193': 'G', '\uA7A0': 'G', '\uA77D': 'G', '\uA77E': 'G', '\u24BD': 'H', '\uFF28': 'H', '\u0124': 'H', '\u1E22': 'H', '\u1E26': 'H', '\u021E': 'H', '\u1E24': 'H', '\u1E28': 'H', '\u1E2A': 'H', '\u0126': 'H', '\u2C67': 'H', '\u2C75': 'H', '\uA78D': 'H', '\u24BE': 'I', '\uFF29': 'I', '\u00CC': 'I', '\u00CD': 'I', '\u00CE': 'I', '\u0128': 'I', '\u012A': 'I', '\u012C': 'I', '\u0130': 'I', '\u00CF': 'I', '\u1E2E': 'I', '\u1EC8': 'I', '\u01CF': 'I', '\u0208': 'I', '\u020A': 'I', '\u1ECA': 'I', '\u012E': 'I', '\u1E2C': 'I', '\u0197': 'I', '\u24BF': 'J', '\uFF2A': 'J', '\u0134': 'J', '\u0248': 'J', '\u24C0': 'K', '\uFF2B': 'K', '\u1E30': 'K', '\u01E8': 'K', '\u1E32': 'K', '\u0136': 'K', '\u1E34': 'K', '\u0198': 'K', '\u2C69': 'K', '\uA740': 'K', '\uA742': 'K', '\uA744': 'K', '\uA7A2': 'K', '\u24C1': 'L', '\uFF2C': 'L', '\u013F': 'L', '\u0139': 'L', '\u013D': 'L', '\u1E36': 'L', '\u1E38': 'L', '\u013B': 'L', '\u1E3C': 'L', '\u1E3A': 'L', '\u0141': 'L', '\u023D': 'L', '\u2C62': 'L', '\u2C60': 'L', '\uA748': 'L', '\uA746': 'L', '\uA780': 'L', '\u01C7': 'LJ', '\u01C8': 'Lj', '\u24C2': 'M', '\uFF2D': 'M', '\u1E3E': 'M', '\u1E40': 'M', '\u1E42': 'M', '\u2C6E': 'M', '\u019C': 'M', '\u24C3': 'N', '\uFF2E': 'N', '\u01F8': 'N', '\u0143': 'N', '\u00D1': 'N', '\u1E44': 'N', '\u0147': 'N', '\u1E46': 'N', '\u0145': 'N', '\u1E4A': 'N', '\u1E48': 'N', '\u0220': 'N', '\u019D': 'N', '\uA790': 'N', '\uA7A4': 'N', '\u01CA': 'NJ', '\u01CB': 'Nj', '\u24C4': 'O', '\uFF2F': 'O', '\u00D2': 'O', '\u00D3': 'O', '\u00D4': 'O', '\u1ED2': 'O', '\u1ED0': 'O', '\u1ED6': 'O', '\u1ED4': 'O', '\u00D5': 'O', '\u1E4C': 'O', '\u022C': 'O', '\u1E4E': 'O', '\u014C': 'O', '\u1E50': 'O', '\u1E52': 'O', '\u014E': 'O', '\u022E': 'O', '\u0230': 'O', '\u00D6': 'O', '\u022A': 'O', '\u1ECE': 'O', '\u0150': 'O', '\u01D1': 'O', '\u020C': 'O', '\u020E': 'O', '\u01A0': 'O', '\u1EDC': 'O', '\u1EDA': 'O', '\u1EE0': 'O', '\u1EDE': 'O', '\u1EE2': 'O', '\u1ECC': 'O', '\u1ED8': 'O', '\u01EA': 'O', '\u01EC': 'O', '\u00D8': 'O', '\u01FE': 'O', '\u0186': 'O', '\u019F': 'O', '\uA74A': 'O', '\uA74C': 'O', '\u01A2': 'OI', '\uA74E': 'OO', '\u0222': 'OU', '\u24C5': 'P', '\uFF30': 'P', '\u1E54': 'P', '\u1E56': 'P', '\u01A4': 'P', '\u2C63': 'P', '\uA750': 'P', '\uA752': 'P', '\uA754': 'P', '\u24C6': 'Q', '\uFF31': 'Q', '\uA756': 'Q', '\uA758': 'Q', '\u024A': 'Q', '\u24C7': 'R', '\uFF32': 'R', '\u0154': 'R', '\u1E58': 'R', '\u0158': 'R', '\u0210': 'R', '\u0212': 'R', '\u1E5A': 'R', '\u1E5C': 'R', '\u0156': 'R', '\u1E5E': 'R', '\u024C': 'R', '\u2C64': 'R', '\uA75A': 'R', '\uA7A6': 'R', '\uA782': 'R', '\u24C8': 'S', '\uFF33': 'S', '\u1E9E': 'S', '\u015A': 'S', '\u1E64': 'S', '\u015C': 'S', '\u1E60': 'S', '\u0160': 'S', '\u1E66': 'S', '\u1E62': 'S', '\u1E68': 'S', '\u0218': 'S', '\u015E': 'S', '\u2C7E': 'S', '\uA7A8': 'S', '\uA784': 'S', '\u24C9': 'T', '\uFF34': 'T', '\u1E6A': 'T', '\u0164': 'T', '\u1E6C': 'T', '\u021A': 'T', '\u0162': 'T', '\u1E70': 'T', '\u1E6E': 'T', '\u0166': 'T', '\u01AC': 'T', '\u01AE': 'T', '\u023E': 'T', '\uA786': 'T', '\uA728': 'TZ', '\u24CA': 'U', '\uFF35': 'U', '\u00D9': 'U', '\u00DA': 'U', '\u00DB': 'U', '\u0168': 'U', '\u1E78': 'U', '\u016A': 'U', '\u1E7A': 'U', '\u016C': 'U', '\u00DC': 'U', '\u01DB': 'U', '\u01D7': 'U', '\u01D5': 'U', '\u01D9': 'U', '\u1EE6': 'U', '\u016E': 'U', '\u0170': 'U', '\u01D3': 'U', '\u0214': 'U', '\u0216': 'U', '\u01AF': 'U', '\u1EEA': 'U', '\u1EE8': 'U', '\u1EEE': 'U', '\u1EEC': 'U', '\u1EF0': 'U', '\u1EE4': 'U', '\u1E72': 'U', '\u0172': 'U', '\u1E76': 'U', '\u1E74': 'U', '\u0244': 'U', '\u24CB': 'V', '\uFF36': 'V', '\u1E7C': 'V', '\u1E7E': 'V', '\u01B2': 'V', '\uA75E': 'V', '\u0245': 'V', '\uA760': 'VY', '\u24CC': 'W', '\uFF37': 'W', '\u1E80': 'W', '\u1E82': 'W', '\u0174': 'W', '\u1E86': 'W', '\u1E84': 'W', '\u1E88': 'W', '\u2C72': 'W', '\u24CD': 'X', '\uFF38': 'X', '\u1E8A': 'X', '\u1E8C': 'X', '\u24CE': 'Y', '\uFF39': 'Y', '\u1EF2': 'Y', '\u00DD': 'Y', '\u0176': 'Y', '\u1EF8': 'Y', '\u0232': 'Y', '\u1E8E': 'Y', '\u0178': 'Y', '\u1EF6': 'Y', '\u1EF4': 'Y', '\u01B3': 'Y', '\u024E': 'Y', '\u1EFE': 'Y', '\u24CF': 'Z', '\uFF3A': 'Z', '\u0179': 'Z', '\u1E90': 'Z', '\u017B': 'Z', '\u017D': 'Z', '\u1E92': 'Z', '\u1E94': 'Z', '\u01B5': 'Z', '\u0224': 'Z', '\u2C7F': 'Z', '\u2C6B': 'Z', '\uA762': 'Z', '\u24D0': 'a', '\uFF41': 'a', '\u1E9A': 'a', '\u00E0': 'a', '\u00E1': 'a', '\u00E2': 'a', '\u1EA7': 'a', '\u1EA5': 'a', '\u1EAB': 'a', '\u1EA9': 'a', '\u00E3': 'a', '\u0101': 'a', '\u0103': 'a', '\u1EB1': 'a', '\u1EAF': 'a', '\u1EB5': 'a', '\u1EB3': 'a', '\u0227': 'a', '\u01E1': 'a', '\u00E4': 'a', '\u01DF': 'a', '\u1EA3': 'a', '\u00E5': 'a', '\u01FB': 'a', '\u01CE': 'a', '\u0201': 'a', '\u0203': 'a', '\u1EA1': 'a', '\u1EAD': 'a', '\u1EB7': 'a', '\u1E01': 'a', '\u0105': 'a', '\u2C65': 'a', '\u0250': 'a', '\uA733': 'aa', '\u00E6': 'ae', '\u01FD': 'ae', '\u01E3': 'ae', '\uA735': 'ao', '\uA737': 'au', '\uA739': 'av', '\uA73B': 'av', '\uA73D': 'ay', '\u24D1': 'b', '\uFF42': 'b', '\u1E03': 'b', '\u1E05': 'b', '\u1E07': 'b', '\u0180': 'b', '\u0183': 'b', '\u0253': 'b', '\u24D2': 'c', '\uFF43': 'c', '\u0107': 'c', '\u0109': 'c', '\u010B': 'c', '\u010D': 'c', '\u00E7': 'c', '\u1E09': 'c', '\u0188': 'c', '\u023C': 'c', '\uA73F': 'c', '\u2184': 'c', '\u24D3': 'd', '\uFF44': 'd', '\u1E0B': 'd', '\u010F': 'd', '\u1E0D': 'd', '\u1E11': 'd', '\u1E13': 'd', '\u1E0F': 'd', '\u0111': 'd', '\u018C': 'd', '\u0256': 'd', '\u0257': 'd', '\uA77A': 'd', '\u01F3': 'dz', '\u01C6': 'dz', '\u24D4': 'e', '\uFF45': 'e', '\u00E8': 'e', '\u00E9': 'e', '\u00EA': 'e', '\u1EC1': 'e', '\u1EBF': 'e', '\u1EC5': 'e', '\u1EC3': 'e', '\u1EBD': 'e', '\u0113': 'e', '\u1E15': 'e', '\u1E17': 'e', '\u0115': 'e', '\u0117': 'e', '\u00EB': 'e', '\u1EBB': 'e', '\u011B': 'e', '\u0205': 'e', '\u0207': 'e', '\u1EB9': 'e', '\u1EC7': 'e', '\u0229': 'e', '\u1E1D': 'e', '\u0119': 'e', '\u1E19': 'e', '\u1E1B': 'e', '\u0247': 'e', '\u025B': 'e', '\u01DD': 'e', '\u24D5': 'f', '\uFF46': 'f', '\u1E1F': 'f', '\u0192': 'f', '\uA77C': 'f', '\u24D6': 'g', '\uFF47': 'g', '\u01F5': 'g', '\u011D': 'g', '\u1E21': 'g', '\u011F': 'g', '\u0121': 'g', '\u01E7': 'g', '\u0123': 'g', '\u01E5': 'g', '\u0260': 'g', '\uA7A1': 'g', '\u1D79': 'g', '\uA77F': 'g', '\u24D7': 'h', '\uFF48': 'h', '\u0125': 'h', '\u1E23': 'h', '\u1E27': 'h', '\u021F': 'h', '\u1E25': 'h', '\u1E29': 'h', '\u1E2B': 'h', '\u1E96': 'h', '\u0127': 'h', '\u2C68': 'h', '\u2C76': 'h', '\u0265': 'h', '\u0195': 'hv', '\u24D8': 'i', '\uFF49': 'i', '\u00EC': 'i', '\u00ED': 'i', '\u00EE': 'i', '\u0129': 'i', '\u012B': 'i', '\u012D': 'i', '\u00EF': 'i', '\u1E2F': 'i', '\u1EC9': 'i', '\u01D0': 'i', '\u0209': 'i', '\u020B': 'i', '\u1ECB': 'i', '\u012F': 'i', '\u1E2D': 'i', '\u0268': 'i', '\u0131': 'i', '\u24D9': 'j', '\uFF4A': 'j', '\u0135': 'j', '\u01F0': 'j', '\u0249': 'j', '\u24DA': 'k', '\uFF4B': 'k', '\u1E31': 'k', '\u01E9': 'k', '\u1E33': 'k', '\u0137': 'k', '\u1E35': 'k', '\u0199': 'k', '\u2C6A': 'k', '\uA741': 'k', '\uA743': 'k', '\uA745': 'k', '\uA7A3': 'k', '\u24DB': 'l', '\uFF4C': 'l', '\u0140': 'l', '\u013A': 'l', '\u013E': 'l', '\u1E37': 'l', '\u1E39': 'l', '\u013C': 'l', '\u1E3D': 'l', '\u1E3B': 'l', '\u017F': 'l', '\u0142': 'l', '\u019A': 'l', '\u026B': 'l', '\u2C61': 'l', '\uA749': 'l', '\uA781': 'l', '\uA747': 'l', '\u01C9': 'lj', '\u24DC': 'm', '\uFF4D': 'm', '\u1E3F': 'm', '\u1E41': 'm', '\u1E43': 'm', '\u0271': 'm', '\u026F': 'm', '\u24DD': 'n', '\uFF4E': 'n', '\u01F9': 'n', '\u0144': 'n', '\u00F1': 'n', '\u1E45': 'n', '\u0148': 'n', '\u1E47': 'n', '\u0146': 'n', '\u1E4B': 'n', '\u1E49': 'n', '\u019E': 'n', '\u0272': 'n', '\u0149': 'n', '\uA791': 'n', '\uA7A5': 'n', '\u01CC': 'nj', '\u24DE': 'o', '\uFF4F': 'o', '\u00F2': 'o', '\u00F3': 'o', '\u00F4': 'o', '\u1ED3': 'o', '\u1ED1': 'o', '\u1ED7': 'o', '\u1ED5': 'o', '\u00F5': 'o', '\u1E4D': 'o', '\u022D': 'o', '\u1E4F': 'o', '\u014D': 'o', '\u1E51': 'o', '\u1E53': 'o', '\u014F': 'o', '\u022F': 'o', '\u0231': 'o', '\u00F6': 'o', '\u022B': 'o', '\u1ECF': 'o', '\u0151': 'o', '\u01D2': 'o', '\u020D': 'o', '\u020F': 'o', '\u01A1': 'o', '\u1EDD': 'o', '\u1EDB': 'o', '\u1EE1': 'o', '\u1EDF': 'o', '\u1EE3': 'o', '\u1ECD': 'o', '\u1ED9': 'o', '\u01EB': 'o', '\u01ED': 'o', '\u00F8': 'o', '\u01FF': 'o', '\u0254': 'o', '\uA74B': 'o', '\uA74D': 'o', '\u0275': 'o', '\u01A3': 'oi', '\u0223': 'ou', '\uA74F': 'oo', '\u24DF': 'p', '\uFF50': 'p', '\u1E55': 'p', '\u1E57': 'p', '\u01A5': 'p', '\u1D7D': 'p', '\uA751': 'p', '\uA753': 'p', '\uA755': 'p', '\u24E0': 'q', '\uFF51': 'q', '\u024B': 'q', '\uA757': 'q', '\uA759': 'q', '\u24E1': 'r', '\uFF52': 'r', '\u0155': 'r', '\u1E59': 'r', '\u0159': 'r', '\u0211': 'r', '\u0213': 'r', '\u1E5B': 'r', '\u1E5D': 'r', '\u0157': 'r', '\u1E5F': 'r', '\u024D': 'r', '\u027D': 'r', '\uA75B': 'r', '\uA7A7': 'r', '\uA783': 'r', '\u24E2': 's', '\uFF53': 's', '\u00DF': 's', '\u015B': 's', '\u1E65': 's', '\u015D': 's', '\u1E61': 's', '\u0161': 's', '\u1E67': 's', '\u1E63': 's', '\u1E69': 's', '\u0219': 's', '\u015F': 's', '\u023F': 's', '\uA7A9': 's', '\uA785': 's', '\u1E9B': 's', '\u24E3': 't', '\uFF54': 't', '\u1E6B': 't', '\u1E97': 't', '\u0165': 't', '\u1E6D': 't', '\u021B': 't', '\u0163': 't', '\u1E71': 't', '\u1E6F': 't', '\u0167': 't', '\u01AD': 't', '\u0288': 't', '\u2C66': 't', '\uA787': 't', '\uA729': 'tz', '\u24E4': 'u', '\uFF55': 'u', '\u00F9': 'u', '\u00FA': 'u', '\u00FB': 'u', '\u0169': 'u', '\u1E79': 'u', '\u016B': 'u', '\u1E7B': 'u', '\u016D': 'u', '\u00FC': 'u', '\u01DC': 'u', '\u01D8': 'u', '\u01D6': 'u', '\u01DA': 'u', '\u1EE7': 'u', '\u016F': 'u', '\u0171': 'u', '\u01D4': 'u', '\u0215': 'u', '\u0217': 'u', '\u01B0': 'u', '\u1EEB': 'u', '\u1EE9': 'u', '\u1EEF': 'u', '\u1EED': 'u', '\u1EF1': 'u', '\u1EE5': 'u', '\u1E73': 'u', '\u0173': 'u', '\u1E77': 'u', '\u1E75': 'u', '\u0289': 'u', '\u24E5': 'v', '\uFF56': 'v', '\u1E7D': 'v', '\u1E7F': 'v', '\u028B': 'v', '\uA75F': 'v', '\u028C': 'v', '\uA761': 'vy', '\u24E6': 'w', '\uFF57': 'w', '\u1E81': 'w', '\u1E83': 'w', '\u0175': 'w', '\u1E87': 'w', '\u1E85': 'w', '\u1E98': 'w', '\u1E89': 'w', '\u2C73': 'w', '\u24E7': 'x', '\uFF58': 'x', '\u1E8B': 'x', '\u1E8D': 'x', '\u24E8': 'y', '\uFF59': 'y', '\u1EF3': 'y', '\u00FD': 'y', '\u0177': 'y', '\u1EF9': 'y', '\u0233': 'y', '\u1E8F': 'y', '\u00FF': 'y', '\u1EF7': 'y', '\u1E99': 'y', '\u1EF5': 'y', '\u01B4': 'y', '\u024F': 'y', '\u1EFF': 'y', '\u24E9': 'z', '\uFF5A': 'z', '\u017A': 'z', '\u1E91': 'z', '\u017C': 'z', '\u017E': 'z', '\u1E93': 'z', '\u1E95': 'z', '\u01B6': 'z', '\u0225': 'z', '\u0240': 'z', '\u2C6C': 'z', '\uA763': 'z', '\u0386': '\u0391', '\u0388': '\u0395', '\u0389': '\u0397', '\u038A': '\u0399', '\u03AA': '\u0399', '\u038C': '\u039F', '\u038E': '\u03A5', '\u03AB': '\u03A5', '\u038F': '\u03A9', '\u03AC': '\u03B1', '\u03AD': '\u03B5', '\u03AE': '\u03B7', '\u03AF': '\u03B9', '\u03CA': '\u03B9', '\u0390': '\u03B9', '\u03CC': '\u03BF', '\u03CD': '\u03C5', '\u03CB': '\u03C5', '\u03B0': '\u03C5', '\u03C9': '\u03C9', '\u03C2': '\u03C3' }; /** * @param {?} text * @return {?} */ function stripSpecialChars(text) { const /** @type {?} */ match = (a) => { return diacritics[a] || a; }; return text.replace(/[^\u0000-\u007E]/g, match); } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @return {?} */ function newId() { // First character is an 'a', it's good practice to tag id to begin with a letter return 'axxxxxxxxxxx'.replace(/[x]/g, function (_) { // tslint:disable-next-line:no-bitwise const /** @type {?} */ val = Math.random() * 16 | 0; return val.toString(16); }); } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ class ItemsList { /** * @param {?} _ngSelect */ constructor(_ngSelect) { this._ngSelect = _ngSelect; this._items = []; this._filteredItems = []; this._markedIndex = -1; this._selected = []; } /** * @return {?} */ get items() { return this._items; } /** * @return {?} */ get filteredItems() { return this._filteredItems; } /** * @return {?} */ get value() { return this._selected; } /** * @return {?} */ get markedItem() { return this._filteredItems[this._markedIndex]; } /** * @return {?} */ get markedIndex() { return this._markedIndex; } /** * @return {?} */ get noItemsToSelect() { return this._ngSelect.hideSelected && this._items.length === this._selected.length; } /** * @return {?} */ get maxItemsSelected() { return this._ngSelect.multiple && this._ngSelect.maxSelectedItems <= this._selected.length; } /** * @return {?} */ get lastSelectedItem() { return this._selected[this._selected.length - 1]; } /** * @param {?} items * @return {?} */ setItems(items) { this._items = items.map((item, index) => this.mapItem(item, index)); if (this._ngSelect.groupBy) { this._groups = this._groupBy(this._items, this._ngSelect.groupBy); this._items = this._flatten(this._groups); } else { this._groups = new Map(); this._groups.set(undefined, this._items); } this._filteredItems = [...this._items]; } /** * @param {?} item * @return {?} */ select(item) { if (item.selected || this.maxItemsSelected) { return; } if (!this._ngSelect.multiple) { this.clearSelected(); } this._selected.push(item); item.selected = true; if (this._ngSelect.hideSelected) { this._filteredItems = this._filteredItems.filter(x => x !== item); } } /** * @param {?} value * @return {?} */ findItem(value) { if (this._ngSelect.bindValue) { return this._items.find(item => !item.hasChildren && this.resolveNested(item.value, this._ngSelect.bindValue) === value); } const /** @type {?} */ option = this._items.find(x => x.value === value); const /** @type {?} */ findBy = this._ngSelect.compareWith ? (item) => this._ngSelect.compareWith(item.value, value) : (item) => !item.hasChildren && item.label && item.label === this.resolveNested(value, this._ngSelect.bindLabel); return option || this._items.find(item => findBy(item)); } /** * @param {?} item * @return {?} */ unselect(item) { this._selected = this._selected.filter(x => x !== item); item.selected = false; if (this._ngSelect.hideSelected) { this._filteredItems.splice(item.index, 0, item); this._filteredItems = [...this._filteredItems.sort((a, b) => (a.index - b.index))]; } } /** * @param {?} item * @return {?} */ addItem(item) { const /** @type {?} */ option = this.mapItem(item, this._items.length); this._items.push(option); this._filteredItems.push(option); return option; } /** * @return {?} */ clearSelected() { this._selected.forEach((item) => { item.selected = false; item.marked = false; }); this._selected = []; if (this._ngSelect.hideSelected) { this.resetItems(); } } /** * @param {?} term * @return {?} */ findByLabel(term) { term = stripSpecialChars(term).toLocaleLowerCase(); return this.filteredItems.find(item => { const /** @type {?} */ label = stripSpecialChars(item.label).toLocaleLowerCase(); return label.substr(0, term.length) === term; }); } /** * @param {?} term * @return {?} */ filter(term) { if (!term) { this.resetItems(); return; } this._filteredItems = []; term = this._ngSelect.searchFn ? term : stripSpecialChars(term).toLocaleLowerCase(); const /** @type {?} */ match = this._ngSelect.searchFn || this._defaultSearchFn; for (const /** @type {?} */ key of Array.from(this._groups.keys())) { const /** @type {?} */ matchedItems = []; for (const /** @type {?} */ item of this._groups.get(key)) { if (this._ngSelect.hideSelected && this._selected.indexOf(item) > -1) { continue; } const /** @type {?} */ searchItem = this._ngSelect.searchFn ? item.value : item; if (match(term, searchItem)) { matchedItems.push(item); } } if (matchedItems.length > 0) { const [last] = matchedItems.slice(-1); if (last.parent) { const /** @type {?} */ head = this._items.find(x => x === last.parent); this._filteredItems.push(head); } this._filteredItems.push(...matchedItems); } } } /** * @return {?} */ resetItems() { if (this._filteredItems.length === this._items.length) { return; } this._filteredItems = this._ngSelect.hideSelected ? this._items.filter(x => this._selected.indexOf(x) === -1) : this._items; } /** * @return {?} */ unmarkItem() { this._markedIndex = -1; } /** * @return {?} */ markNextItem() { this._stepToItem(+1); } /** * @return {?} */ markPreviousItem() { this._stepToItem(-1); } /** * @param {?} item * @return {?} */ markItem(item) { this._markedIndex = this._filteredItems.indexOf(item); } /** * @param {?=} markDefault * @return {?} */ markSelectedOrDefault(markDefault) { if (this._filteredItems.length === 0) { return; } const /** @type {?} */ indexOfLastSelected = this._ngSelect.hideSelected ? -1 : this._filteredItems.indexOf(this.lastSelectedItem); if (this.lastSelectedItem && indexOfLastSelected > -1) { this._markedIndex = indexOfLastSelected; } else { this._markedIndex = markDefault ? this.filteredItems.findIndex(x => !x.disabled) : -1; } } /** * @param {?} option * @param {?} key * @return {?} */ resolveNested(option, key) { if (!isObject(option)) { return option; } if (key.indexOf('.') === -1) { return option[key]; } else { let /** @type {?} */ keys = key.split('.'); let /** @type {?} */ value = option; for (let /** @type {?} */ i = 0, /** @type {?} */ len = keys.length; i < len; ++i) { if (value == null) { return null; } value = value[keys[i]]; } return value; } } /** * @param {?} item * @param {?} index * @return {?} */ mapItem(item, index) { let /** @type {?} */ label = ''; if (isDefined(item.label)) { label = item.label; } else { label = this.resolveNested(item, this._ngSelect.bindLabel); label = isDefined(label) ? label.toString() : ''; } const /** @type {?} */ value = isDefined(item.$ngOptionValue) ? item.$ngOptionValue : item; return { index: index, label: label, value: value, disabled: item.disabled, htmlId: newId() }; } /** * @return {?} */ mapSelectedItems() { this._selected.forEach((selected, i) => { const /** @type {?} */ value = this._ngSelect.bindValue ? selected.value[this._ngSelect.bindValue] : selected.value; const /** @type {?} */ item = this.findItem(value); if (item && selected !== item) { item.selected = true; this._selected[i] = item; } }); if (this._ngSelect.hideSelected) { this._filteredItems = this.filteredItems.filter(x => this._selected.indexOf(x) === -1); } } /** * @param {?} search * @param {?} opt * @return {?} */ _defaultSearchFn(search, opt) { const /** @type {?} */ label = stripSpecialChars(opt.label).toLocaleLowerCase(); return label.indexOf(search) > -1; } /** * @param {?} steps * @return {?} */ _getNextItemIndex(steps) { if (steps > 0) { return (this._markedIndex === this._filteredItems.length - 1) ? 0 : (this._markedIndex + 1); } return (this._markedIndex <= 0) ? (this._filteredItems.length - 1) : (this._markedIndex - 1); } /** * @param {?} steps * @return {?} */ _stepToItem(steps) { if (this._filteredItems.length === 0 || this._filteredItems.every(x => x.disabled)) { return; } this._markedIndex = this._getNextItemIndex(steps); if (this.markedItem.disabled) { this._stepToItem(steps); } } /** * @param {?} items * @param {?} prop * @return {?} */ _groupBy(items, prop) { const /** @type {?} */ isFn = isFunction(this._ngSelect.groupBy); const /** @type {?} */ groups = items.reduce((grouped, item) => { const /** @type {?} */ key = isFn ? (/** @type {?} */ (prop)).apply(this, [item.value]) : item.value[/** @type {?} */ (prop)]; const /** @type {?} */ group = grouped.get(key); if (group) { group.push(item); } else { grouped.set(key, [item]); } return grouped; }, new Map()); return groups; } /** * @param {?} groups * @return {?} */ _flatten(groups) { const /** @type {?} */ isFn = isFunction(this._ngSelect.groupBy); let /** @type {?} */ i = 0; return Array.from(groups.keys()).reduce((items, key) => { const /** @type {?} */ parent = { label: key, hasChildren: true, index: i, disabled: !this._ngSelect.selectableGroup, htmlId: newId() }; const /** @type {?} */ groupKey = isFn ? this._ngSelect.bindLabel : this._ngSelect.groupBy; parent.value = { [groupKey]: key }; items.push(parent); i++; const /** @type {?} */ children = groups.get(key).map(x => { x.parent = parent; x.hasChildren = false; i++; return x; }); items.push(...children); return items; }, []); } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @record */ /** @enum {number} */ const KeyCode = { Tab: 9, Enter: 13, Esc: 27, Space: 32, ArrowUp: 38, ArrowDown: 40, Backspace: 8, }; KeyCode[KeyCode.Tab] = "Tab"; KeyCode[KeyCode.Enter] = "Enter"; KeyCode[KeyCode.Esc] = "Esc"; KeyCode[KeyCode.Space] = "Space"; KeyCode[KeyCode.ArrowUp] = "ArrowUp"; KeyCode[KeyCode.ArrowDown] = "ArrowDown"; KeyCode[KeyCode.Backspace] = "Backspace"; /** * @record */ /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ class WindowService { /** * @param {?} fn * @return {?} */ requestAnimationFrame(fn) { return window.requestAnimationFrame(fn); } /** * @param {?} handler * @param {?} timeout * @return {?} */ setTimeout(handler, timeout) { return window.setTimeout(handler, timeout); } } WindowService.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Injectable"] }, ]; /** @nocollapse */ WindowService.ctorParameters = () => []; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @record */ /** * @record */ class VirtualScrollService { /** * @param {?} d * @param {?} dropdownEl * @param {?} bufferAmount * @return {?} */ calculateItems(d, dropdownEl, bufferAmount) { const /** @type {?} */ scrollHeight = d.childHeight * d.itemsLength; if (dropdownEl.scrollTop > scrollHeight) { dropdownEl.scrollTop = scrollHeight; } const /** @type {?} */ scrollTop = Math.max(0, dropdownEl.scrollTop); const /** @type {?} */ indexByScrollTop = scrollTop / scrollHeight * d.itemsLength; let /** @type {?} */ end = Math.min(d.itemsLength, Math.ceil(indexByScrollTop) + (d.itemsPerCol + 1)); const /** @type {?} */ maxStartEnd = end; const /** @type {?} */ maxStart = Math.max(0, maxStartEnd - d.itemsPerCol - 1); let /** @type {?} */ start = Math.min(maxStart, Math.floor(indexByScrollTop)); let /** @type {?} */ topPadding = d.childHeight * Math.ceil(start) - (d.childHeight * Math.min(start, bufferAmount)); topPadding = !isNaN(topPadding) ? topPadding : 0; start = !isNaN(start) ? start : -1; end = !isNaN(end) ? end : -1; start -= bufferAmount; start = Math.max(0, start); end += bufferAmount; end = Math.min(d.itemsLength, end); return { topPadding: topPadding, scrollHeight: scrollHeight, start: start, end: end }; } /** * @param {?} itemsLength * @param {?} index * @param {?} panelEl * @param {?} contentEl * @return {?} */ calculateDimensions(itemsLength, index, panelEl, contentEl) { const /** @type {?} */ panelRect = panelEl.getBoundingClientRect(); const /** @type {?} */ itemRect = contentEl.children[index] ? contentEl.children[index].getBoundingClientRect() : { width: panelRect.width, height: panelRect.height, top: 0, }; const /** @type {?} */ itemsPerCol = Math.max(1, Math.floor(panelRect.height / itemRect.height)); return { itemsLength: itemsLength, viewWidth: panelRect.width, viewHeight: panelRect.height, childWidth: itemRect.width, childHeight: itemRect.height, itemsPerCol: itemsPerCol, }; } } VirtualScrollService.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Injectable"] }, ]; /** @nocollapse */ VirtualScrollService.ctorParameters = () => []; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ const TOP_CSS_CLASS = 'ng-select-top'; const BOTTOM_CSS_CLASS = 'ng-select-bottom'; class NgDropdownPanelComponent { /** * @param {?} _ngSelect * @param {?} _renderer * @param {?} _elementRef * @param {?} _zone * @param {?} _virtualScrollService * @param {?} _window */ constructor(_ngSelect, _renderer, _elementRef, _zone, _virtualScrollService, _window) { this._renderer = _renderer; this._elementRef = _elementRef; this._zone = _zone; this._virtualScrollService = _virtualScrollService; this._window = _window; this.items = []; this.position = 'auto'; this.bufferAmount = 4; this.virtualScroll = false; this.update = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); this.scrollToEnd = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); this.outsideClick = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); this._destroy$ = new __WEBPACK_IMPORTED_MODULE_3_rxjs_Subject__["Subject"](); this._startupLoop = true; this._isScrolledToMarked = false; this._scrollToEndFired = false; this._disposeScrollListener = () => { }; this._disposeDocumentResizeListener = () => { }; this._selectElement = _ngSelect.elementRef.nativeElement; this._itemsList = _ngSelect.itemsList; } /** * @param {?} $event * @return {?} */ handleMousedown($event) { const /** @type {?} */ target = /** @type {?} */ ($event.target); if (target.tagName === 'INPUT') { return; } $event.preventDefault(); $event.stopPropagation(); } /** * @return {?} */ ngOnInit() { this._handleScroll(); Object(__WEBPACK_IMPORTED_MODULE_1_rxjs_observable_fromEventPattern__["a" /* fromEventPattern */])((handler) => document.addEventListener('mousedown', handler, true)) .pipe(Object(__WEBPACK_IMPORTED_MODULE_2_rxjs_operators__["takeUntil"])(this._destroy$)) .subscribe(($event) => this._handleOutsideClick($event)); } /** * @param {?} changes * @return {?} */ ngOnChanges(changes) { if (changes["items"]) { this._isScrolledToMarked = false; this._handleItemsChange(changes["items"]); } } /** * @return {?} */ ngOnDestroy() { this._disposeDocumentResizeListener(); this._disposeScrollListener(); this._destroy$.next(); this._destroy$.complete(); if (this.appendTo) { this._renderer.removeChild(this._elementRef.nativeElement.parentNode, this._elementRef.nativeElement); } } /** * @return {?} */ ngAfterContentInit() { this._whenContentReady().then(() => { if (this.appendTo) { this._appendDropdown(); this._handleDocumentResize(); } this.updateDropdownPosition(); }); } /** * @return {?} */ refresh() { return new Promise((resolve) => { this._zone.runOutsideAngular(() => { this._window.requestAnimationFrame(() => { this._updateItems().then(resolve); }); }); }); } /** * @param {?} item * @return {?} */ scrollInto(item) { if (!item) { return; } const /** @type {?} */ index = this.items.indexOf(item); if (index < 0 || index >= this.items.length) { return; } const /** @type {?} */ d = this._calculateDimensions(this.virtualScroll ? 0 : index); const /** @type {?} */ scrollEl = this.scrollElementRef.nativeElement; const /** @type {?} */ buffer = Math.floor(d.viewHeight / d.childHeight) - 1; if (this.virtualScroll) { scrollEl.scrollTop = (index * d.childHeight) - (d.childHeight * Math.min(index, buffer)); } else { const /** @type {?} */ contentEl = this.contentElementRef.nativeElement; const /** @type {?} */ childrenHeight = Array.from(contentEl.children).slice(0, index).reduce((c, n) => c + n.clientHeight, 0); scrollEl.scrollTop = childrenHeight - (d.childHeight * Math.min(index, buffer)); } } /** * @return {?} */ scrollIntoTag() { const /** @type {?} */ el = this.scrollElementRef.nativeElement; const /** @type {?} */ d = this._calculateDimensions(); el.scrollTop = d.childHeight * (d.itemsLength + 1); } /** * @return {?} */ updateDropdownPosition() { const /** @type {?} */ dropdownEl = this._elementRef.nativeElement; this._currentPosition = this._calculateCurrentPosition(dropdownEl); const /** @type {?} */ selectEl = this._selectElement; if (this._currentPosition === 'top') { this._renderer.addClass(dropdownEl, TOP_CSS_CLASS); this._renderer.removeClass(dropdownEl, BOTTOM_CSS_CLASS); this._renderer.addClass(selectEl, TOP_CSS_CLASS); this._renderer.removeClass(selectEl, BOTTOM_CSS_CLASS); } else { this._renderer.addClass(dropdownEl, BOTTOM_CSS_CLASS); this._renderer.removeClass(dropdownEl, TOP_CSS_CLASS); this._renderer.addClass(selectEl, BOTTOM_CSS_CLASS); this._renderer.removeClass(selectEl, TOP_CSS_CLASS); } if (this.appendTo) { this._updateAppendedDropdownPosition(); } dropdownEl.style.opacity = '1'; } /** * @param {?} $event * @return {?} */ _handleOutsideClick($event) { if (this._selectElement.contains($event.target)) { return; } const /** @type {?} */ dropdown = this._elementRef.nativeElement; if (dropdown.contains($event.target)) { return; } this.outsideClick.emit(); } /** * @return {?} */ _handleScroll() { this._disposeScrollListener = this._renderer.listen(this.scrollElementRef.nativeElement, 'scroll', () => { this.refresh(); this._fireScrollToEnd(); }); } /** * @param {?} items * @return {?} */ _handleItemsChange(items) { this._scrollToEndFired = false; this._previousStart = undefined; this._previousEnd = undefined; if (items !== undefined && items.previousValue === undefined || (items.previousValue !== undefined && items.previousValue.length === 0)) { this._startupLoop = true; } this.items = items.currentValue || []; this.refresh().then(() => { if (this.appendTo && this._currentPosition === 'top') { this._updateAppendedDropdownPosition(); } }); } /** * @return {?} */ _updateItems() { __WEBPACK_IMPORTED_MODULE_0__angular_core__["NgZone"].assertNotInAngularZone(); if (!this.virtualScroll) { this._zone.run(() => { this.update.emit(this.items.slice()); this._scrollToMarked(); }); return Promise.resolve(); } const /** @type {?} */ loop = (resolve) => { const /** @type {?} */ d = this._calculateDimensions(); const /** @type {?} */ res = this._virtualScrollService.calculateItems(d, this.scrollElementRef.nativeElement, this.bufferAmount || 0); (/** @type {?} */ (this.paddingElementRef.nativeElement)).style.height = `${res.scrollHeight}px`; const /** @type {?} */ transform = 'translateY(' + res.topPadding + 'px)'; (/** @type {?} */ (this.contentElementRef.nativeElement)).style.transform = transform; if (res.start !== this._previousStart || res.end !== this._previousEnd) { this._zone.run(() => { this.update.emit(this.items.slice(res.start, res.end)); }); this._previousStart = res.start; this._previousEnd = res.end; if (this._startupLoop === true) { loop(resolve); } } else if (this._startupLoop === true) { this._startupLoop = false; this._scrollToMarked(); resolve(); } }; return new Promise((resolve) => loop(resolve)); } /** * @return {?} */ _fireScrollToEnd() { if (this._scrollToEndFired) { return; } const /** @type {?} */ scroll = this.scrollElementRef.nativeElement; const /** @type {?} */ panel = this._elementRef.nativeElement; const /** @type {?} */ padding = this.virtualScroll ? this.paddingElementRef.nativeElement : this.contentElementRef.nativeElement; if (scroll.scrollTop + panel.clientHeight >= padding.clientHeight) { this.scrollToEnd.emit(); this._scrollToEndFired = true; } } /** * @param {?=} index * @return {?} */ _calculateDimensions(index = 0) { return this._virtualScrollService.calculateDimensions(this.items.length, index, this.scrollElementRef.nativeElement, this.contentElementRef.nativeElement); } /** * @return {?} */ _handleDocumentResize() { if (!this.appendTo) { return; } this._disposeDocumentResizeListener = this._renderer.listen('window', 'resize', () => { this._updateAppendedDropdownPosition(); }); } /** * @return {?} */ _scrollToMarked() { if (this._isScrolledToMarked) { return; } this._isScrolledToMarked = true; this.scrollInto(this._itemsList.markedItem); } /** * @param {?} dropdownEl * @return {?} */ _calculateCurrentPosition(dropdownEl) { if (this.position !== 'auto') { return this.position; } const /** @type {?} */ selectRect = this._selectElement.getBoundingClientRect(); const /** @type {?} */ scrollTop = document.documentElement.scrollTop || document.body.scrollTop; const /** @type {?} */ offsetTop = selectRect.top + window.pageYOffset; const /** @type {?} */ height = selectRect.height; const /** @type {?} */ dropdownHeight = dropdownEl.getBoundingClientRect().height; if (offsetTop + height + dropdownHeight > scrollTop + document.documentElement.clientHeight) { return 'top'; } else { return 'bottom'; } } /** * @return {?} */ _appendDropdown() { const /** @type {?} */ parent = document.querySelector(this.appendTo); if (!parent) { throw new Error(`appendTo selector ${this.appendTo} did not found any parent element`); } parent.appendChild(this._elementRef.nativeElement); } /** * @return {?} */ _updateAppendedDropdownPosition() { const /** @type {?} */ parent = document.querySelector(this.appendTo) || document.body; const /** @type {?} */ selectRect = this._selectElement.getBoundingClientRect(); const /** @type {?} */ dropdownPanel = this._elementRef.nativeElement; const /** @type {?} */ boundingRect = parent.getBoundingClientRect(); const /** @type {?} */ offsetTop = selectRect.top - boundingRect.top; const /** @type {?} */ offsetLeft = selectRect.left - boundingRect.left; const /** @type {?} */ topDelta = this._currentPosition === 'bottom' ? selectRect.height : -dropdownPanel.clientHeight; dropdownPanel.style.top = offsetTop + topDelta + 'px'; dropdownPanel.style.bottom = 'auto'; dropdownPanel.style.left = offsetLeft + 'px'; dropdownPanel.style.width = selectRect.width + 'px'; dropdownPanel.style.minWidth = selectRect.width + 'px'; } /** * @return {?} */ _whenContentReady() { if (this.items.length === 0) { return Promise.resolve(); } const /** @type {?} */ dropdownEl = this._elementRef.nativeElement; const /** @type {?} */ ready = (resolve) => { const /** @type {?} */ ngOption = dropdownEl.querySelector('.ng-option'); if (ngOption) { resolve(); return; } this._zone.runOutsideAngular(() => { setTimeout(() => ready(resolve), 5); }); }; return new Promise((resolve) => ready(resolve)); } } NgDropdownPanelComponent.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"], args: [{ changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectionStrategy"].OnPush, encapsulation: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ViewEncapsulation"].None, selector: 'ng-dropdown-panel', template: ` <div *ngIf="headerTemplate" class="ng-dropdown-header"> <ng-container [ngTemplateOutlet]="headerTemplate"></ng-container> </div> <div #scroll class="ng-dropdown-panel-items scroll-host"> <div #padding [class.total-padding]="virtualScroll"></div> <div #content [class.scrollable-content]="virtualScroll && items.length > 0"> <ng-content></ng-content> </div> </div> <div *ngIf="footerTemplate" class="ng-dropdown-footer"> <ng-container [ngTemplateOutlet]="footerTemplate"></ng-container> </div> `, styles: [`.ng-dropdown-panel{-webkit-box-sizing:border-box;box-sizing:border-box;position:absolute;opacity:0;width:100%;z-index:1050;-webkit-overflow-scrolling:touch}.ng-dropdown-panel .ng-dropdown-panel-items{display:block;height:auto;-webkit-box-sizing:border-box;box-sizing:border-box;max-height:240px;overflow-y:auto}.ng-dropdown-panel .ng-dropdown-panel-items .ng-optgroup{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ng-dropdown-panel .ng-dropdown-panel-items .ng-option{-webkit-box-sizing:border-box;box-sizing:border-box;cursor:pointer;display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ng-dropdown-panel .ng-dropdown-panel-items .ng-option .highlighted{font-weight:700;text-decoration:underline}.ng-dropdown-panel .ng-dropdown-panel-items .ng-option.disabled{cursor:default}.ng-dropdown-panel .scroll-host{overflow:hidden;overflow-y:auto;position:relative;display:block;-webkit-overflow-scrolling:touch}.ng-dropdown-panel .scrollable-content{top:0;left:0;width:100%;height:100%;position:absolute}.ng-dropdown-panel .total-padding{width:1px;opacity:0}`] },] }, ]; /** @nocollapse */ NgDropdownPanelComponent.ctorParameters = () => [ { type: NgSelectComponent, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Inject"], args: [Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["forwardRef"])(() => NgSelectComponent),] },] }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Renderer2"], }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ElementRef"], }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["NgZone"], }, { type: VirtualScrollService, }, { type: WindowService, }, ]; NgDropdownPanelComponent.propDecorators = { "items": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "position": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "appendTo": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "bufferAmount": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "virtualScroll": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "headerTemplate": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "footerTemplate": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "update": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"] },], "scrollToEnd": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"] },], "outsideClick": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"] },], "contentElementRef": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ViewChild"], args: ['content', { read: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ElementRef"] },] },], "scrollElementRef": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ViewChild"], args: ['scroll', { read: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ElementRef"] },] },], "paddingElementRef": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ViewChild"], args: ['padding', { read: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ElementRef"] },] },], "handleMousedown": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["HostListener"], args: ['mousedown', ['$event'],] },], }; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ class NgOptionComponent { /** * @param {?} elementRef */ constructor(elementRef) { this.elementRef = elementRef; this.stateChange$ = new __WEBPACK_IMPORTED_MODULE_3_rxjs_Subject__["Subject"](); this._disabled = false; } /** * @return {?} */ get disabled() { return this._disabled; } /** * @param {?} value * @return {?} */ set disabled(value) { this._disabled = this._isDisabled(value); } /** * @param {?} changes * @return {?} */ ngOnChanges(changes) { if (changes["disabled"]) { this.stateChange$.next({ value: this.value, disabled: this._disabled }); } } /** * @param {?} value * @return {?} */ _isDisabled(value) { return value != null && `${value}` !== 'false'; } } NgOptionComponent.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"], args: [{ selector: 'ng-option', changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectionStrategy"].OnPush, template: `<ng-content></ng-content>` },] }, ]; /** @nocollapse */ NgOptionComponent.ctorParameters = () => [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ElementRef"], }, ]; NgOptionComponent.propDecorators = { "value": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "disabled": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], }; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ const NG_SELECT_DEFAULT_CONFIG = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["InjectionToken"]('ng-select-default-options'); class NgSelectComponent { /** * @param {?} config * @param {?} classes * @param {?} _cd * @param {?} _console * @param {?} _zone * @param {?} _window * @param {?} elementRef */ constructor(config, classes, _cd, _console, _zone, _window, elementRef) { this.classes = classes; this._cd = _cd; this._console = _console; this._zone = _zone; this._window = _window; this.elementRef = elementRef; // inputs this.items = []; this.clearable = true; this.markFirst = true; this.dropdownPosition = 'auto'; this.loading = false; this.closeOnSelect = true; this.hideSelected = false; this.selectOnTab = false; this.bufferAmount = 4; this.virtualScroll = false; this.selectableGroup = false; this.searchFn = null; this.clearSearchOnAdd = true; this.labelForId = ''; this.multiple = false; this.addTag = false; this.searchable = true; // output events this.blurEvent = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); this.focusEvent = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); this.changeEvent = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); this.openEvent = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); this.closeEvent = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); this.searchEvent = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); this.clearEvent = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); this.addEvent = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); this.removeEvent = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); this.scrollToEnd = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); this.isOpen = false; this.isDisabled = false; this.itemsList = new ItemsList(this); this.viewPortItems = []; this.filterValue = null; this.dropdownId = newId(); this.selectedItemId = 0; this._defaultLabel = 'label'; this._pressedKeys = []; this._destroy$ = new __WEBPACK_IMPORTED_MODULE_3_rxjs_Subject__["Subject"](); this._keyPress$ = new __WEBPACK_IMPORTED_MODULE_3_rxjs_Subject__["Subject"](); this._onChange = (_) => { }; this._onTouched = () => { }; this.clearItem = (item) => { const /** @type {?} */ option = this.selectedItems.find(x => x.value === item); this.unselect(option); }; this._mergeGlobalConfig(config); } /** * @return {?} */ get compareWith() { return this._compareWith; } /** * @param {?} fn * @return {?} */ set compareWith(fn) { if (!isFunction(fn)) { throw Error('`compareWith` must be a function.'); } this._compareWith = fn; } /** * @return {?} */ get filtered() { return !!this.filterValue && this.searchable; } ; /** * @return {?} */ get selectedItems() { return this.itemsList.value; } /** * @return {?} */ get selectedValues() { return this.selectedItems.map(x => x.value); } /** * @return {?} */ get hasValue() { return this.selectedItems.length > 0; } /** * @return {?} */ ngOnInit() { this._handleKeyPresses(); } /** * @param {?} changes * @return {?} */ ngOnChanges(changes) { if (changes["multiple"]) { this.itemsList.clearSelected(); } if (changes["items"]) { this._setItems(changes["items"].currentValue || []); } } /** * @return {?} */ ngAfterViewInit() { if (this.items && this.items.length === 0) { this._setItemsFromNgOptions(); } } /** * @return {?} */ ngOnDestroy() { this._destroy$.next(); this._destroy$.complete(); } /** * @param {?} $event * @return {?} */ handleKeyDown($event) { if (KeyCode[$event.which]) { switch ($event.which) { case KeyCode.ArrowDown: this._handleArrowDown($event); break; case KeyCode.ArrowUp: this._handleArrowUp($event); break; case KeyCode.Space: this._handleSpace($event); break; case KeyCode.Enter: this._handleEnter($event); break; case KeyCode.Tab: this._handleTab($event); break; case KeyCode.Esc: this.close(); break; case KeyCode.Backspace: this._handleBackspace(); break; } } else if ($event.key && $event.key.length === 1) { this._keyPress$.next($event.key.toLocaleLowerCase()); } } /** * @param {?} $event * @return {?} */ handleMousedown($event) { $event.stopPropagation(); $event.preventDefault(); const /** @type {?} */ target = /** @type {?} */ ($event.target); if (target.className === 'ng-clear') { this.handleClearClick(); return; } if (target.className === 'ng-arrow') { this.handleArrowClick(); return; } if (!this._focused) { this.focus(); } if (target.className.includes('ng-value-icon')) { return; } if (this.searchable) { this.open(); } else { this.toggle(); } } /** * @return {?} */ handleArrowClick() { if (this.isOpen) { this.close(); } else { this.open(); } } /** * @return {?} */ handleClearClick() { if (this.hasValue) { this.clearModel(); } this._clearSearch(); this.focus(); if (this._isTypeahead) { this.typeahead.next(null); } this.clearEvent.emit(); } /** * @return {?} */ clearModel() { if (!this.clearable) { return; } this.itemsList.clearSelected(); this._updateNgModel(); } /** * @param {?} value * @return {?} */ writeValue(value) { this.itemsList.clearSelected(); this._handleWriteValue(value); this._cd.markForCheck(); } /** * @param {?} fn * @return {?} */ registerOnChange(fn) { this._onChange = fn; } /** * @param {?} fn * @return {?} */ registerOnTouched(fn) { this._onTouched = fn; } /** * @param {?} isDisabled * @return {?} */ setDisabledState(isDisabled) { this.isDisabled = isDisabled; this._cd.markForCheck(); } /** * @return {?} */ toggle() { if (!this.isOpen) { this.open(); } else { this.close(); } } /** * @return {?} */ open() { if (this.isDisabled || this.isOpen || this.itemsList.maxItemsSelected) { return; } if (!this._isTypeahead && !this.addTag && this.itemsList.noItemsToSelect) { return; } this.isOpen = true; this.itemsList.markSelectedOrDefault(this.markFirst); this.openEvent.emit(); if (!this.filterValue) { this.focus(); } this.detectChanges(); } /** * @return {?} */ close() { if (!this.isOpen) { return; } this.isOpen = false; this._clearSearch(); this._onTouched(); this.closeEvent.emit(); this._cd.markForCheck(); } /** * @param {?} item * @return {?} */ toggleItem(item) { if (!item || item.disabled || this.isDisabled) { return; } if (this.multiple && item.selected) { this.unselect(item); } else { this.select(item); } } /** * @param {?} item * @return {?} */ select(item) { this.itemsList.select(item); if (this.clearSearchOnAdd) { this._clearSearch(); } this.addEvent.emit(item.value); if (this.closeOnSelect || this.itemsList.noItemsToSelect) { this.close(); } this._updateNgModel(); } /** * @return {?} */ focus() { if (!this.filterInput) { return; } this._zone.runOutsideAngular(() => { this._window.setTimeout(() => { this.filterInput.nativeElement.focus(); }, 5); }); } /** * @param {?} item * @return {?} */ unselect(item) { this.itemsList.unselect(item); this._updateNgModel(); this.removeEvent.emit(item); } /** * @return {?} */ selectTag() { let /** @type {?} */ tag; if (isFunction(this.addTag)) { tag = (/** @type {?} */ (this.addTag))(this.filterValue); } else { tag = this._primitive ? this.filterValue : { [this.bindLabel]: this.filterValue }; } if (isPromise(tag)) { tag.then(item => this.select(this.itemsList.addItem(item))) .catch(() => { }); } else if (tag) { this.select(this.itemsList.addItem(tag)); } } /** * @return {?} */ showClear() { return this.clearable && (this.hasValue || this.filterValue) && !this.isDisabled; } /** * @return {?} */ showAddTag() { return this.addTag && this.filterValue && !this.selectedItems.some(x => x.label.toLowerCase() === this.filterValue.toLowerCase()) && !this.loading; } /** * @return {?} */ showNoItemsFound() { const /** @type {?} */ empty = this.itemsList.filteredItems.length === 0; return ((empty && !this._isTypeahead && !this.loading) || (empty && this._isTypeahead && this.filterValue && !this.loading)) && !this.showAddTag(); } /** * @return {?} */ showTypeToSearch() { const /** @type {?} */ empty = this.itemsList.filteredItems.length === 0; return empty && this._isTypeahead && !this.filterValue && !this.loading; } /** * @param {?} term * @return {?} */ filter(term) { this.filterValue = term; this.open(); if (this._isTypeahead) { this.typeahead.next(this.filterValue); } else { this.itemsList.filter(this.filterValue); this.itemsList.markSelectedOrDefault(this.markFirst); } } /** * @return {?} */ onInputFocus() { (/** @type {?} */ (this.elementRef.nativeElement)).classList.add('ng-select-focused'); this.focusEvent.emit(null); this._focused = true; } /** * @return {?} */ onInputBlur() { (/** @type {?} */ (this.elementRef.nativeElement)).classList.remove('ng-select-focused'); this.blurEvent.emit(null); if (!this.isOpen && !this.isDisabled) { this._onTouched(); } this._focused = false; } /** * @param {?} item * @return {?} */ onItemHover(item) { if (item.disabled) { return; } this.itemsList.markItem(item); } /** * @return {?} */ detectChanges() { if (!(/** @type {?} */ (this._cd)).destroyed) { this._cd.detectChanges(); } } /** * @return {?} */ updateDropdownPosition() { if (this.dropdownPanel) { this.dropdownPanel.updateDropdownPosition(); } } /** * @param {?} items * @return {?} */ _setItems(items) { const /** @type {?} */ firstItem = items[0]; this.bindLabel = this.bindLabel || this._defaultLabel; this._primitive = !isObject(firstItem); this.itemsList.setItems(items); if (items.length > 0 && this.hasValue) { this.itemsList.mapSelectedItems(); } if (this._isTypeahead || this.isOpen) { this.itemsList.markSelectedOrDefault(this.markFirst); } } /** * @return {?} */ _setItemsFromNgOptions() { const /** @type {?} */ handleNgOptions = (options) => { this.items = options.map(option => ({ $ngOptionValue: option.value, label: option.elementRef.nativeElement.innerHTML, disabled: option.disabled })); this.itemsList.setItems(this.items); if (this.hasValue) { this.itemsList.mapSelectedItems(); } this.detectChanges(); }; const /** @type {?} */ handleOptionChange = () => { const /** @type {?} */ changedOrDestroyed = Object(__WEBPACK_IMPORTED_MODULE_5_rxjs_observable_merge__["a" /* merge */])(this.ngOptions.changes, this._destroy$); Object(__WEBPACK_IMPORTED_MODULE_5_rxjs_observable_merge__["a" /* merge */])(...this.ngOptions.map(option => option.stateChange$)) .pipe(Object(__WEBPACK_IMPORTED_MODULE_2_rxjs_operators__["takeUntil"])(changedOrDestroyed)) .subscribe(option => { const /** @type {?} */ item = this.itemsList.findItem(option.value); item.disabled = option.disabled; this._cd.markForCheck(); }); }; this.ngOptions.changes .pipe(Object(__WEBPACK_IMPORTED_MODULE_2_rxjs_operators__["startWith"])(this.ngOptions), Object(__WEBPACK_IMPORTED_MODULE_2_rxjs_operators__["takeUntil"])(this._destroy$)) .subscribe(options => { handleNgOptions(options); handleOptionChange(); }); } /** * @param {?} value * @return {?} */ _isValidWriteValue(value) { if (!isDefined(value) || (this.multiple && value === '') || Array.isArray(value) && value.length === 0) { return false; } const /** @type {?} */ validateBinding = (item) => { if (isObject(item) && this.bindValue) { this._console.warn(`Binding object(${JSON.stringify(item)}) with bindValue is not allowed.`); return false; } return true; }; if (this.multiple) { if (!Array.isArray(value)) { this._console.warn('Multiple select ngModel should be array.'); return false; } return value.every(item => validateBinding(item)); } else { return validateBinding(value); } } /** * @param {?} ngModel * @return {?} */ _handleWriteValue(ngModel) { if (!this._isValidWriteValue(ngModel)) { return; } const /** @type {?} */ select = (val) => { let /** @type {?} */ item = this.itemsList.findItem(val); if (item) { this.itemsList.select(item); } else { const /** @type {?} */ isValObject = isObject(val); const /** @type {?} */ isPrimitive = !isValObject && !this.bindValue; if ((isValObject || isPrimitive)) { this.itemsList.select(this.itemsList.mapItem(val, null)); } else if (this.bindValue) { item = { [this.bindLabel]: null, [this.bindValue]: val }; this.itemsList.select(this.itemsList.mapItem(item, null)); } } }; if (this.multiple) { (/** @type {?} */ (ngModel)).forEach(item => { select(item); }); } else { select(ngModel); } } /** * @return {?} */ _handleKeyPresses() { if (this.searchable) { return; } this._keyPress$ .pipe(Object(__WEBPACK_IMPORTED_MODULE_2_rxjs_operators__["takeUntil"])(this._destroy$), Object(__WEBPACK_IMPORTED_MODULE_2_rxjs_operators__["tap"])(letter => this._pressedKeys.push(letter)), Object(__WEBPACK_IMPORTED_MODULE_2_rxjs_operators__["debounceTime"])(200), Object(__WEBPACK_IMPORTED_MODULE_2_rxjs_operators__["filter"])(() => this._pressedKeys.length > 0), Object(__WEBPACK_IMPORTED_MODULE_2_rxjs_operators__["map"])(() => this._pressedKeys.join(''))) .subscribe(term => { const /** @type {?} */ item = this.itemsList.findByLabel(term); if (item) { if (this.isOpen) { this.itemsList.markItem(item); this._cd.markForCheck(); } else { this.select(item); } } this._pressedKeys = []; }); } /** * @return {?} */ _updateNgModel() { const /** @type {?} */ model = []; for (const /** @type {?} */ item of this.selectedItems) { if (this.bindValue) { let /** @type {?} */ resolvedValue = null; if (item.hasChildren) { resolvedValue = item.value[this.groupBy]; } else { resolvedValue = this.itemsList.resolveNested(item.value, this.bindValue); } model.push(resolvedValue); } else { model.push(item.value); } } if (this.multiple) { this._onChange(model); this.changeEvent.emit(this.selectedItems.map(x => x.value)); } else { this._onChange(isDefined(model[0]) ? model[0] : null); this.changeEvent.emit(this.selectedItems[0] && this.selectedItems[0].value); } this._cd.markForCheck(); } /** * @return {?} */ _clearSearch() { if (!this.filterValue) { return; } this.filterValue = null; this.itemsList.resetItems(); } /** * @return {?} */ _scrollToMarked() { if (!this.isOpen || !this.dropdownPanel) { return; } this.dropdownPanel.scrollInto(this.itemsList.markedItem); } /** * @return {?} */ _scrollToTag() { if (!this.isOpen || !this.dropdownPanel) { return; } this.dropdownPanel.scrollIntoTag(); } /** * @param {?} $event * @return {?} */ _handleTab($event) { if (!this.isOpen) { return; } if (this.selectOnTab) { if (this.itemsList.markedItem) { this.toggleItem(this.itemsList.markedItem); $event.preventDefault(); } else if (this.showAddTag()) { this.selectTag(); $event.preventDefault(); } else { this.close(); } } else { this.close(); } } /** * @param {?} $event * @return {?} */ _handleEnter($event) { if (this.isOpen) { if (this.itemsList.markedItem) { this.toggleItem(this.itemsList.markedItem); } else if (this.addTag) { this.selectTag(); } } else { this.open(); } $event.preventDefault(); $event.stopPropagation(); } /** * @param {?} $event * @return {?} */ _handleSpace($event) { if (this.isOpen) { return; } this.open(); $event.preventDefault(); } /** * @param {?} $event * @return {?} */ _handleArrowDown($event) { if (this.nextItemIsTag(+1)) { this.itemsList.unmarkItem(); this._scrollToTag(); } else { this.itemsList.markNextItem(); this._scrollToMarked(); } this.open(); $event.preventDefault(); } /** * @param {?} $event * @return {?} */ _handleArrowUp($event) { if (!this.isOpen) { return; } if (this.nextItemIsTag(-1)) { this.itemsList.unmarkItem(); this._scrollToTag(); } else { this.itemsList.markPreviousItem(); this._scrollToMarked(); } $event.preventDefault(); } /** * @param {?} nextStep * @return {?} */ nextItemIsTag(nextStep) { const /** @type {?} */ nextIndex = this.itemsList.markedIndex + nextStep; return this.addTag && this.filterValue && this.itemsList.markedItem && (nextIndex < 0 || nextIndex === this.itemsList.filteredItems.length); } /** * @return {?} */ _handleBackspace() { if (this.filterValue || !this.clearable || !this.hasValue) { return; } if (this.multiple) { this.unselect(this.itemsList.lastSelectedItem); } else { this.clearModel(); } } /** * @return {?} */ get _isTypeahead() { return this.typeahead && this.typeahead.observers.length > 0; } /** * @param {?} config * @return {?} */ _mergeGlobalConfig(config) { this.notFoundText = this.notFoundText || config.notFoundText; this.typeToSearchText = this.typeToSearchText || config.typeToSearchText; this.addTagText = this.addTagText || config.addTagText; this.loadingText = this.loadingText || config.loadingText; this.clearAllText = this.clearAllText || config.clearAllText; } } NgSelectComponent.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"], args: [{ selector: 'ng-select', template: `<div (mousedown)="handleMousedown($event)" [class.ng-has-value]="hasValue" class="ng-select-container"> <div class="ng-value-container"> <div class="ng-placeholder">{{placeholder}}</div> <ng-container *ngIf="!multiLabelTemplate && selectedItems.length > 0"> <div [class.ng-value-disabled]="item.disabled" class="ng-value" *ngFor="let item of selectedItems"> <ng-template #defaultLabelTemplate> <span class="ng-value-icon left" (click)="unselect(item);" aria-hidden="true">×</span> <span class="ng-value-label">{{item.label}}</span> </ng-template> <ng-template [ngTemplateOutlet]="labelTemplate || defaultLabelTemplate" [ngTemplateOutletContext]="{ item: item.value, clear: clearItem, label: item.label }"> </ng-template> </div> </ng-container> <ng-template *ngIf="multiLabelTemplate && selectedValues.length > 0" [ngTemplateOutlet]="multiLabelTemplate" [ngTemplateOutletContext]="{ items: selectedValues, clear: clearItem }"> </ng-template> <div class="ng-input"> <input #filterInput type="text" autocomplete="{{dropdownId}}" [id]="labelForId" [readOnly]="!searchable" [disabled]="isDisabled" [value]="filterValue" (input)="filter(filterInput.value)" (focus)="onInputFocus()" (blur)="onInputBlur()" (change)="$event.stopPropagation()" role="combobox" [attr.aria-expanded]="isOpen" [attr.aria-owns]="isOpen ? dropdownId : null" [attr.aria-activedescendant]="isOpen ? itemsList?.markedItem?.htmlId : null"> </div> </div> <div class="ng-spinner-loader" *ngIf="loading"></div> <span *ngIf="showClear()" class="ng-clear-wrapper" title="{{clearAllText}}"> <span class="ng-clear" aria-hidden="true">×</span> </span> <span class="ng-arrow-wrapper"> <span class="ng-arrow"></span> </span> </div> <ng-dropdown-panel *ngIf="isOpen" class="ng-dropdown-panel" [virtualScroll]="virtualScroll" [bufferAmount]="bufferAmount" [appendTo]="appendTo" [position]="dropdownPosition" [headerTemplate]="headerTemplate" [footerTemplate]="footerTemplate" [items]="itemsList.filteredItems" (update)="viewPortItems = $event" (scrollToEnd)="scrollToEnd.emit($event)" (outsideClick)="close()" [class.ng-select-multiple]="multiple" [ngClass]="classes" [id]="dropdownId"> <ng-container> <div class="ng-option" [attr.role]="item.hasChildren ? 'group' : 'option'" (click)="toggleItem(item)" (mousedown)="$event.preventDefault()" (mouseover)="onItemHover(item)" *ngFor="let item of viewPortItems" [class.ng-option-disabled]="item.disabled" [class.ng-option-selected]="item.selected" [class.ng-optgroup]="item.hasChildren" [class.ng-option]="!item.hasChildren" [class.ng-option-child]="!!item.parent" [class.ng-option-marked]="item === itemsList.markedItem" id="{{item?.htmlId || null}}"> <ng-template #defaultOptionTemplate> <span class="ng-option-label">{{item.label}}</span> </ng-template> <ng-template [ngTemplateOutlet]="item.hasChildren ? (optgroupTemplate || defaultOptionTemplate) : (optionTemplate || defaultOptionTemplate)" [ngTemplateOutletContext]="{ item: item.value, index: item.index, searchTerm: filterValue }"> </ng-template> </div> <div class="ng-option" [class.ng-option-marked]="!itemsList.markedItem" (mouseover)="itemsList.unmarkItem()" role="option" (click)="selectTag()" *ngIf="showAddTag()"> <span><span class="ng-tag-label">{{addTagText}}</span>"{{filterValue}}"</span> </div> </ng-container> <ng-container *ngIf="showNoItemsFound()"> <ng-template #defaultNotFoundTemplate> <div class="ng-option ng-option-disabled">{{notFoundText}}</div> </ng-template> <ng-template [ngTemplateOutlet]="notFoundTemplate || defaultNotFoundTemplate" [ngTemplateOutletContext]="{ searchTerm: filterValue }"> </ng-template> </ng-container> <ng-container *ngIf="showTypeToSearch()"> <ng-template #defaultTypeToSearchTemplate> <div class="ng-option ng-option-disabled">{{typeToSearchText}}</div> </ng-template> <ng-template [ngTemplateOutlet]="typeToSearchTemplate || defaultTypeToSearchTemplate"> </ng-template> </ng-container> <ng-container *ngIf="loading && itemsList.filteredItems.length === 0"> <ng-template #defaultLoadingTextTemplate> <div class="ng-option ng-option-disabled">{{loadingText}}</div> </ng-template> <ng-template [ngTemplateOutlet]="loadingTextTemplate || defaultLoadingTextTemplate" [ngTemplateOutletContext]="{ searchTerm: filterValue }"> </ng-template> </ng-container> </ng-dropdown-panel> `, styles: [`.ng-select{position:relative;display:block;-webkit-box-sizing:border-box;box-sizing:border-box}.ng-select div,.ng-select input,.ng-select span{-webkit-box-sizing:border-box;box-sizing:border-box}.ng-select [hidden]{display:none}.ng-select.ng-select-searchable .ng-select-container .ng-value-container .ng-input{opacity:1}.ng-select.ng-select-opened .ng-select-container{z-index:1001}.ng-select.ng-select-disabled .ng-select-container .ng-value-container .ng-placeholder,.ng-select.ng-select-disabled .ng-select-container .ng-value-container .ng-value{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.ng-select.ng-select-disabled .ng-arrow-wrapper{cursor:default}.ng-select.ng-select-filtered .ng-placeholder{display:none}.ng-select .ng-select-container{color:#333;cursor:default;display:-webkit-box;display:-ms-flexbox;display:flex;outline:0;overflow:hidden;position:relative;width:100%}.ng-select .ng-select-container .ng-value-container{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-flex:1;-ms-flex:1;flex:1}.ng-select .ng-select-container .ng-value-container .ng-input{opacity:0}.ng-select .ng-select-container .ng-value-container .ng-input>input{-webkit-box-sizing:content-box;box-sizing:content-box;background:none;border:0;-webkit-box-shadow:none;box-shadow:none;outline:0;cursor:default;width:100%}.ng-select .ng-select-container .ng-value-container .ng-input>input::-ms-clear{display:none}.ng-select .ng-select-container .ng-value-container .ng-input>input[readonly]{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.ng-select.ng-select-single.ng-select-filtered .ng-select-container .ng-value-container .ng-value{visibility:hidden}.ng-select.ng-select-single .ng-select-container .ng-value-container,.ng-select.ng-select-single .ng-select-container .ng-value-container .ng-value{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ng-select.ng-select-single .ng-select-container .ng-value-container .ng-value .ng-value-icon{display:none}.ng-select.ng-select-single .ng-select-container .ng-value-container .ng-input{position:absolute;left:0;width:100%}.ng-select.ng-select-multiple.ng-select-disabled>.ng-select-container .ng-value-container .ng-value .ng-value-icon{display:none}.ng-select.ng-select-multiple .ng-select-container .ng-value-container{-ms-flex-wrap:wrap;flex-wrap:wrap}.ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-value{white-space:nowrap}.ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-value.ng-value-disabled .ng-value-icon{display:none}.ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-value .ng-value-icon{cursor:pointer}.ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-input{-webkit-box-flex:1;-ms-flex:1;flex:1;z-index:2}.ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-placeholder{position:absolute;z-index:1}.ng-select .ng-clear-wrapper{cursor:pointer;position:relative;width:17px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.ng-select .ng-clear-wrapper .ng-clear{display:inline-block;font-size:18px;line-height:1}.ng-select .ng-spinner-loader{border-radius:50%;width:17px;height:17px;margin-right:5px;font-size:10px;position:relative;text-indent:-9999em;border-top:2px solid rgba(66,66,66,.2);border-right:2px solid rgba(66,66,66,.2);border-bottom:2px solid rgba(66,66,66,.2);border-left:2px solid #424242;-webkit-transform:translateZ(0);transform:translateZ(0);-webkit-animation:.8s linear infinite load8;animation:.8s linear infinite load8}.ng-select .ng-spinner-loader:after{border-radius:50%;width:17px;height:17px}@-webkit-keyframes load8{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes load8{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}.ng-select .ng-arrow-wrapper{cursor:pointer;position:relative;text-align:center;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.ng-select .ng-arrow-wrapper .ng-arrow{display:inline-block;height:0;width:0;position:relative}`], providers: [{ provide: __WEBPACK_IMPORTED_MODULE_4__angular_forms__["NG_VALUE_ACCESSOR"], useExisting: Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["forwardRef"])(() => NgSelectComponent), multi: true }], encapsulation: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ViewEncapsulation"].None, changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectionStrategy"].OnPush, host: { 'role': 'listbox', 'class': 'ng-select', '[class.ng-select-single]': '!multiple', } },] }, ]; /** @nocollapse */ NgSelectComponent.ctorParameters = () => [ { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Inject"], args: [NG_SELECT_DEFAULT_CONFIG,] },] }, { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Attribute"], args: ['class',] },] }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectorRef"], }, { type: ConsoleService, }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["NgZone"], }, { type: WindowService, }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ElementRef"], }, ]; NgSelectComponent.propDecorators = { "items": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "bindLabel": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "bindValue": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "clearable": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "markFirst": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "placeholder": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "notFoundText": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "typeToSearchText": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "addTagText": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "loadingText": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "clearAllText": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "dropdownPosition": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "appendTo": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "loading": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "closeOnSelect": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "hideSelected": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "selectOnTab": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "maxSelectedItems": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "groupBy": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "bufferAmount": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "virtualScroll": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "selectableGroup": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "searchFn": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "clearSearchOnAdd": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "labelForId": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "typeahead": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["HostBinding"], args: ['class.ng-select-typeahead',] },], "multiple": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["HostBinding"], args: ['class.ng-select-multiple',] },], "addTag": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["HostBinding"], args: ['class.ng-select-taggable',] },], "searchable": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["HostBinding"], args: ['class.ng-select-searchable',] },], "compareWith": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "blurEvent": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"], args: ['blur',] },], "focusEvent": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"], args: ['focus',] },], "changeEvent": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"], args: ['change',] },], "openEvent": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"], args: ['open',] },], "closeEvent": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"], args: ['close',] },], "searchEvent": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"], args: ['search',] },], "clearEvent": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"], args: ['clear',] },], "addEvent": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"], args: ['add',] },], "removeEvent": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"], args: ['remove',] },], "scrollToEnd": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"], args: ['scrollToEnd',] },], "optionTemplate": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ContentChild"], args: [NgOptionTemplateDirective, { read: __WEBPACK_IMPORTED_MODULE_0__angular_core__["TemplateRef"] },] },], "optgroupTemplate": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ContentChild"], args: [NgOptgroupTemplateDirective, { read: __WEBPACK_IMPORTED_MODULE_0__angular_core__["TemplateRef"] },] },], "labelTemplate": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ContentChild"], args: [NgLabelTemplateDirective, { read: __WEBPACK_IMPORTED_MODULE_0__angular_core__["TemplateRef"] },] },], "multiLabelTemplate": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ContentChild"], args: [NgMultiLabelTemplateDirective, { read: __WEBPACK_IMPORTED_MODULE_0__angular_core__["TemplateRef"] },] },], "headerTemplate": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ContentChild"], args: [NgHeaderTemplateDirective, { read: __WEBPACK_IMPORTED_MODULE_0__angular_core__["TemplateRef"] },] },], "footerTemplate": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ContentChild"], args: [NgFooterTemplateDirective, { read: __WEBPACK_IMPORTED_MODULE_0__angular_core__["TemplateRef"] },] },], "notFoundTemplate": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ContentChild"], args: [NgNotFoundTemplateDirective, { read: __WEBPACK_IMPORTED_MODULE_0__angular_core__["TemplateRef"] },] },], "typeToSearchTemplate": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ContentChild"], args: [NgTypeToSearchTemplateDirective, { read: __WEBPACK_IMPORTED_MODULE_0__angular_core__["TemplateRef"] },] },], "loadingTextTemplate": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ContentChild"], args: [NgLoadingTextTemplateDirective, { read: __WEBPACK_IMPORTED_MODULE_0__angular_core__["TemplateRef"] },] },], "dropdownPanel": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ViewChild"], args: [Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["forwardRef"])(() => NgDropdownPanelComponent),] },], "ngOptions": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ContentChildren"], args: [NgOptionComponent, { descendants: true },] },], "filterInput": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ViewChild"], args: ['filterInput',] },], "isOpen": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["HostBinding"], args: ['class.ng-select-opened',] },], "isDisabled": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["HostBinding"], args: ['class.ng-select-disabled',] },], "filtered": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["HostBinding"], args: ['class.ng-select-filtered',] },], "handleKeyDown": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["HostListener"], args: ['keydown', ['$event'],] },], }; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ class NgOptionHighlightDirective { /** * @param {?} elementRef * @param {?} renderer */ constructor(elementRef, renderer) { this.elementRef = elementRef; this.renderer = renderer; this.element = this.elementRef.nativeElement; } /** * @param {?} changes * @return {?} */ ngOnChanges(changes) { if (isDefined(changes["term"].currentValue) && isDefined(this.label)) { this._highlightLabelWithSearchTerm(); } } /** * @return {?} */ ngAfterViewInit() { this.label = this.element.innerHTML; } /** * @return {?} */ _highlightLabelWithSearchTerm() { const /** @type {?} */ label = this.label; if (!this.term) { this._setInnerHtml(label); return; } const /** @type {?} */ indexOfTerm = stripSpecialChars(label) .toLowerCase() .indexOf(stripSpecialChars(this.term).toLowerCase()); if (indexOfTerm > -1) { this._setInnerHtml(label.substring(0, indexOfTerm) + `<span class="highlighted">${label.substr(indexOfTerm, this.term.length)}</span>` + label.substring(indexOfTerm + this.term.length, label.length)); } else { this._setInnerHtml(label); } } /** * @param {?} html * @return {?} */ _setInnerHtml(html) { this.renderer.setProperty(this.elementRef.nativeElement, 'innerHTML', html); } } NgOptionHighlightDirective.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: '[ngOptionHighlight]' },] }, ]; /** @nocollapse */ NgOptionHighlightDirective.ctorParameters = () => [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ElementRef"], }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Renderer2"], }, ]; NgOptionHighlightDirective.propDecorators = { "term": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"], args: ['ngOptionHighlight',] },], }; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ const ɵ0 = { notFoundText: 'No items found', typeToSearchText: 'Type to search', addTagText: 'Add item', loadingText: 'Loading...', clearAllText: 'Clear all', disableVirtualScroll: false }; class NgSelectModule { } NgSelectModule.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["NgModule"], args: [{ declarations: [ NgDropdownPanelComponent, NgOptionComponent, NgSelectComponent, NgOptionHighlightDirective, NgOptgroupTemplateDirective, NgOptionTemplateDirective, NgLabelTemplateDirective, NgMultiLabelTemplateDirective, NgHeaderTemplateDirective, NgFooterTemplateDirective, NgNotFoundTemplateDirective, NgTypeToSearchTemplateDirective, NgLoadingTextTemplateDirective ], imports: [ __WEBPACK_IMPORTED_MODULE_6__angular_common__["CommonModule"] ], exports: [ NgSelectComponent, NgOptionComponent, NgOptionHighlightDirective, NgOptgroupTemplateDirective, NgOptionTemplateDirective, NgLabelTemplateDirective, NgMultiLabelTemplateDirective, NgHeaderTemplateDirective, NgFooterTemplateDirective, NgNotFoundTemplateDirective, NgTypeToSearchTemplateDirective, NgLoadingTextTemplateDirective ], providers: [ ConsoleService, WindowService, VirtualScrollService, { provide: NG_SELECT_DEFAULT_CONFIG, useValue: ɵ0 } ] },] }, ]; /** @nocollapse */ NgSelectModule.ctorParameters = () => []; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * Generated bundle index. Do not edit. */ //# sourceMappingURL=ng-select.js.map /***/ }), /***/ "./node_modules/@orkisz/angular2-logger/dist/es5/core/level.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var Level; (function (Level) { Level[Level["OFF"] = 0] = "OFF"; Level[Level["ERROR"] = 1] = "ERROR"; Level[Level["WARN"] = 2] = "WARN"; Level[Level["INFO"] = 3] = "INFO"; Level[Level["DEBUG"] = 4] = "DEBUG"; Level[Level["LOG"] = 5] = "LOG"; })(Level = exports.Level || (exports.Level = {})); //# sourceMappingURL=level.js.map /***/ }), /***/ "./node_modules/@orkisz/angular2-logger/dist/es5/core/logger.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var __param = (this && this.__param) || function (paramIndex, decorator) { return function (target, key) { decorator(target, key, paramIndex); } }; Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var level_1 = __webpack_require__("./node_modules/@orkisz/angular2-logger/dist/es5/core/level.js"); var Options = (function () { function Options() { } return Options; }()); exports.Options = Options; var CONSOLE_DEBUG_METHOD = console["debug"] ? "debug" : "log"; var DEFAULT_OPTIONS = { level: level_1.Level.WARN, global: true, globalAs: "logger", store: false, storeAs: "angular2.logger.level" }; var Logger = (function () { function Logger(options) { var _this = this; this.Level = level_1.Level; this._loadLevel = function () { return level_1.Level[localStorage.getItem(_this._storeAs)]; }; this.global = function () { return window[_this._globalAs] = _this; }; this.isErrorEnabled = function () { return _this.level >= level_1.Level.ERROR; }; this.isWarnEnabled = function () { return _this.level >= level_1.Level.WARN; }; this.isInfoEnabled = function () { return _this.level >= level_1.Level.INFO; }; this.isDebugEnabled = function () { return _this.level >= level_1.Level.DEBUG; }; this.isLogEnabled = function () { return _this.level >= level_1.Level.LOG; }; var _a = Object.assign({}, DEFAULT_OPTIONS, options), level = _a.level, global = _a.global, globalAs = _a.globalAs, store = _a.store, storeAs = _a.storeAs; this._level = level; this._globalAs = globalAs; this._storeAs = storeAs; global && this.global(); if (store || this._loadLevel()) this.store(); } Logger.prototype._storeLevel = function (level) { localStorage[this._storeAs] = level; }; Logger.prototype.error = function (message) { var optionalParams = []; for (var _i = 1; _i < arguments.length; _i++) { optionalParams[_i - 1] = arguments[_i]; } this.isErrorEnabled() && console.error.apply(console, arguments); }; Logger.prototype.warn = function (message) { var optionalParams = []; for (var _i = 1; _i < arguments.length; _i++) { optionalParams[_i - 1] = arguments[_i]; } this.isWarnEnabled() && console.warn.apply(console, arguments); }; Logger.prototype.info = function (message) { var optionalParams = []; for (var _i = 1; _i < arguments.length; _i++) { optionalParams[_i - 1] = arguments[_i]; } this.isInfoEnabled() && console.info.apply(console, arguments); }; Logger.prototype.debug = function (message) { var optionalParams = []; for (var _i = 1; _i < arguments.length; _i++) { optionalParams[_i - 1] = arguments[_i]; } this.isDebugEnabled() && console[CONSOLE_DEBUG_METHOD].apply(console, arguments); }; Logger.prototype.log = function (message) { var optionalParams = []; for (var _i = 1; _i < arguments.length; _i++) { optionalParams[_i - 1] = arguments[_i]; } this.isLogEnabled() && console.log.apply(console, arguments); }; Logger.prototype.store = function () { this._store = true; var storedLevel = this._loadLevel(); if (storedLevel) { this._level = storedLevel; } else { this._storeLevel(this.level); } return this; }; Logger.prototype.unstore = function () { this._store = false; localStorage.removeItem(this._storeAs); return this; }; Object.defineProperty(Logger.prototype, "level", { get: function () { return this._level; }, set: function (level) { this._store && this._storeLevel(level); this._level = level; }, enumerable: true, configurable: true }); Logger = __decorate([ core_1.Injectable(), __param(0, core_1.Optional()), __metadata("design:paramtypes", [Options]) ], Logger); return Logger; }()); exports.Logger = Logger; //# sourceMappingURL=logger.js.map /***/ }), /***/ "./node_modules/@orkisz/angular2-logger/dist/es5/core/providers.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var logger_1 = __webpack_require__("./node_modules/@orkisz/angular2-logger/dist/es5/core/logger.js"); var level_1 = __webpack_require__("./node_modules/@orkisz/angular2-logger/dist/es5/core/level.js"); exports.OFF_LOGGER_PROVIDERS = [{ provide: logger_1.Options, useValue: { level: level_1.Level.OFF } }, logger_1.Logger]; exports.ERROR_LOGGER_PROVIDERS = [{ provide: logger_1.Options, useValue: { level: level_1.Level.ERROR } }, logger_1.Logger]; exports.WARN_LOGGER_PROVIDERS = [{ provide: logger_1.Options, useValue: { level: level_1.Level.WARN } }, logger_1.Logger]; exports.INFO_LOGGER_PROVIDERS = [{ provide: logger_1.Options, useValue: { level: level_1.Level.INFO } }, logger_1.Logger]; exports.DEBUG_LOGGER_PROVIDERS = [{ provide: logger_1.Options, useValue: { level: level_1.Level.DEBUG } }, logger_1.Logger]; exports.LOG_LOGGER_PROVIDERS = [{ provide: logger_1.Options, useValue: { level: level_1.Level.LOG } }, logger_1.Logger]; //# sourceMappingURL=providers.js.map /***/ }), /***/ "./node_modules/@orkisz/angular2-logger/dist/es5/index.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; function __export(m) { for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; } Object.defineProperty(exports, "__esModule", { value: true }); __export(__webpack_require__("./node_modules/@orkisz/angular2-logger/dist/es5/core/level.js")); __export(__webpack_require__("./node_modules/@orkisz/angular2-logger/dist/es5/core/logger.js")); __export(__webpack_require__("./node_modules/@orkisz/angular2-logger/dist/es5/core/providers.js")); //# sourceMappingURL=index.js.map /***/ }), /***/ "./node_modules/@swimlane/ngx-charts/node_modules/d3-scale/index.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__src_band__ = __webpack_require__("./node_modules/@swimlane/ngx-charts/node_modules/d3-scale/src/band.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "scaleBand", function() { return __WEBPACK_IMPORTED_MODULE_0__src_band__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "scalePoint", function() { return __WEBPACK_IMPORTED_MODULE_0__src_band__["b"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__src_identity__ = __webpack_require__("./node_modules/@swimlane/ngx-charts/node_modules/d3-scale/src/identity.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "scaleIdentity", function() { return __WEBPACK_IMPORTED_MODULE_1__src_identity__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__src_linear__ = __webpack_require__("./node_modules/@swimlane/ngx-charts/node_modules/d3-scale/src/linear.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "scaleLinear", function() { return __WEBPACK_IMPORTED_MODULE_2__src_linear__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__src_log__ = __webpack_require__("./node_modules/@swimlane/ngx-charts/node_modules/d3-scale/src/log.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "scaleLog", function() { return __WEBPACK_IMPORTED_MODULE_3__src_log__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__src_ordinal__ = __webpack_require__("./node_modules/@swimlane/ngx-charts/node_modules/d3-scale/src/ordinal.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "scaleOrdinal", function() { return __WEBPACK_IMPORTED_MODULE_4__src_ordinal__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "scaleImplicit", function() { return __WEBPACK_IMPORTED_MODULE_4__src_ordinal__["b"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__src_pow__ = __webpack_require__("./node_modules/@swimlane/ngx-charts/node_modules/d3-scale/src/pow.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "scalePow", function() { return __WEBPACK_IMPORTED_MODULE_5__src_pow__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "scaleSqrt", function() { return __WEBPACK_IMPORTED_MODULE_5__src_pow__["b"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__src_quantile__ = __webpack_require__("./node_modules/@swimlane/ngx-charts/node_modules/d3-scale/src/quantile.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "scaleQuantile", function() { return __WEBPACK_IMPORTED_MODULE_6__src_quantile__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__src_quantize__ = __webpack_require__("./node_modules/@swimlane/ngx-charts/node_modules/d3-scale/src/quantize.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "scaleQuantize", function() { return __WEBPACK_IMPORTED_MODULE_7__src_quantize__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__src_threshold__ = __webpack_require__("./node_modules/@swimlane/ngx-charts/node_modules/d3-scale/src/threshold.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "scaleThreshold", function() { return __WEBPACK_IMPORTED_MODULE_8__src_threshold__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__src_time__ = __webpack_require__("./node_modules/@swimlane/ngx-charts/node_modules/d3-scale/src/time.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "scaleTime", function() { return __WEBPACK_IMPORTED_MODULE_9__src_time__["b"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__src_utcTime__ = __webpack_require__("./node_modules/@swimlane/ngx-charts/node_modules/d3-scale/src/utcTime.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "scaleUtc", function() { return __WEBPACK_IMPORTED_MODULE_10__src_utcTime__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__src_category10__ = __webpack_require__("./node_modules/@swimlane/ngx-charts/node_modules/d3-scale/src/category10.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "schemeCategory10", function() { return __WEBPACK_IMPORTED_MODULE_11__src_category10__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__src_category20b__ = __webpack_require__("./node_modules/@swimlane/ngx-charts/node_modules/d3-scale/src/category20b.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "schemeCategory20b", function() { return __WEBPACK_IMPORTED_MODULE_12__src_category20b__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__src_category20c__ = __webpack_require__("./node_modules/@swimlane/ngx-charts/node_modules/d3-scale/src/category20c.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "schemeCategory20c", function() { return __WEBPACK_IMPORTED_MODULE_13__src_category20c__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__src_category20__ = __webpack_require__("./node_modules/@swimlane/ngx-charts/node_modules/d3-scale/src/category20.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "schemeCategory20", function() { return __WEBPACK_IMPORTED_MODULE_14__src_category20__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__src_cubehelix__ = __webpack_require__("./node_modules/@swimlane/ngx-charts/node_modules/d3-scale/src/cubehelix.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "interpolateCubehelixDefault", function() { return __WEBPACK_IMPORTED_MODULE_15__src_cubehelix__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__src_rainbow__ = __webpack_require__("./node_modules/@swimlane/ngx-charts/node_modules/d3-scale/src/rainbow.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "interpolateRainbow", function() { return __WEBPACK_IMPORTED_MODULE_16__src_rainbow__["b"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "interpolateWarm", function() { return __WEBPACK_IMPORTED_MODULE_16__src_rainbow__["c"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "interpolateCool", function() { return __WEBPACK_IMPORTED_MODULE_16__src_rainbow__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_17__src_viridis__ = __webpack_require__("./node_modules/@swimlane/ngx-charts/node_modules/d3-scale/src/viridis.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "interpolateViridis", function() { return __WEBPACK_IMPORTED_MODULE_17__src_viridis__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "interpolateMagma", function() { return __WEBPACK_IMPORTED_MODULE_17__src_viridis__["c"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "interpolateInferno", function() { return __WEBPACK_IMPORTED_MODULE_17__src_viridis__["b"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "interpolatePlasma", function() { return __WEBPACK_IMPORTED_MODULE_17__src_viridis__["d"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_18__src_sequential__ = __webpack_require__("./node_modules/@swimlane/ngx-charts/node_modules/d3-scale/src/sequential.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "scaleSequential", function() { return __WEBPACK_IMPORTED_MODULE_18__src_sequential__["a"]; }); /***/ }), /***/ "./node_modules/@swimlane/ngx-charts/node_modules/d3-scale/src/array.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return map; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return slice; }); var array = Array.prototype; var map = array.map; var slice = array.slice; /***/ }), /***/ "./node_modules/@swimlane/ngx-charts/node_modules/d3-scale/src/band.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = band; /* harmony export (immutable) */ __webpack_exports__["b"] = point; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_d3_array__ = __webpack_require__("./node_modules/d3-array/index.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__ordinal__ = __webpack_require__("./node_modules/@swimlane/ngx-charts/node_modules/d3-scale/src/ordinal.js"); function band() { var scale = Object(__WEBPACK_IMPORTED_MODULE_1__ordinal__["a" /* default */])().unknown(undefined), domain = scale.domain, ordinalRange = scale.range, range = [0, 1], step, bandwidth, round = false, paddingInner = 0, paddingOuter = 0, align = 0.5; delete scale.unknown; function rescale() { var n = domain().length, reverse = range[1] < range[0], start = range[reverse - 0], stop = range[1 - reverse]; step = (stop - start) / Math.max(1, n - paddingInner + paddingOuter * 2); if (round) step = Math.floor(step); start += (stop - start - step * (n - paddingInner)) * align; bandwidth = step * (1 - paddingInner); if (round) start = Math.round(start), bandwidth = Math.round(bandwidth); var values = Object(__WEBPACK_IMPORTED_MODULE_0_d3_array__["range"])(n).map(function(i) { return start + step * i; }); return ordinalRange(reverse ? values.reverse() : values); } scale.domain = function(_) { return arguments.length ? (domain(_), rescale()) : domain(); }; scale.range = function(_) { return arguments.length ? (range = [+_[0], +_[1]], rescale()) : range.slice(); }; scale.rangeRound = function(_) { return range = [+_[0], +_[1]], round = true, rescale(); }; scale.bandwidth = function() { return bandwidth; }; scale.step = function() { return step; }; scale.round = function(_) { return arguments.length ? (round = !!_, rescale()) : round; }; scale.padding = function(_) { return arguments.length ? (paddingInner = paddingOuter = Math.max(0, Math.min(1, _)), rescale()) : paddingInner; }; scale.paddingInner = function(_) { return arguments.length ? (paddingInner = Math.max(0, Math.min(1, _)), rescale()) : paddingInner; }; scale.paddingOuter = function(_) { return arguments.length ? (paddingOuter = Math.max(0, Math.min(1, _)), rescale()) : paddingOuter; }; scale.align = function(_) { return arguments.length ? (align = Math.max(0, Math.min(1, _)), rescale()) : align; }; scale.copy = function() { return band() .domain(domain()) .range(range) .round(round) .paddingInner(paddingInner) .paddingOuter(paddingOuter) .align(align); }; return rescale(); } function pointish(scale) { var copy = scale.copy; scale.padding = scale.paddingOuter; delete scale.paddingInner; delete scale.paddingOuter; scale.copy = function() { return pointish(copy()); }; return scale; } function point() { return pointish(band().paddingInner(1)); } /***/ }), /***/ "./node_modules/@swimlane/ngx-charts/node_modules/d3-scale/src/category10.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__colors__ = __webpack_require__("./node_modules/@swimlane/ngx-charts/node_modules/d3-scale/src/colors.js"); /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__colors__["a" /* default */])("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf")); /***/ }), /***/ "./node_modules/@swimlane/ngx-charts/node_modules/d3-scale/src/category20.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__colors__ = __webpack_require__("./node_modules/@swimlane/ngx-charts/node_modules/d3-scale/src/colors.js"); /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__colors__["a" /* default */])("1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5")); /***/ }), /***/ "./node_modules/@swimlane/ngx-charts/node_modules/d3-scale/src/category20b.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__colors__ = __webpack_require__("./node_modules/@swimlane/ngx-charts/node_modules/d3-scale/src/colors.js"); /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__colors__["a" /* default */])("393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6")); /***/ }), /***/ "./node_modules/@swimlane/ngx-charts/node_modules/d3-scale/src/category20c.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__colors__ = __webpack_require__("./node_modules/@swimlane/ngx-charts/node_modules/d3-scale/src/colors.js"); /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__colors__["a" /* default */])("3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9")); /***/ }), /***/ "./node_modules/@swimlane/ngx-charts/node_modules/d3-scale/src/colors.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony default export */ __webpack_exports__["a"] = (function(s) { return s.match(/.{6}/g).map(function(x) { return "#" + x; }); }); /***/ }), /***/ "./node_modules/@swimlane/ngx-charts/node_modules/d3-scale/src/constant.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony default export */ __webpack_exports__["a"] = (function(x) { return function() { return x; }; }); /***/ }), /***/ "./node_modules/@swimlane/ngx-charts/node_modules/d3-scale/src/continuous.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["c"] = deinterpolateLinear; /* harmony export (immutable) */ __webpack_exports__["a"] = copy; /* harmony export (immutable) */ __webpack_exports__["b"] = continuous; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_d3_array__ = __webpack_require__("./node_modules/d3-array/index.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_d3_interpolate__ = __webpack_require__("./node_modules/d3-interpolate/index.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__array__ = __webpack_require__("./node_modules/@swimlane/ngx-charts/node_modules/d3-scale/src/array.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__constant__ = __webpack_require__("./node_modules/@swimlane/ngx-charts/node_modules/d3-scale/src/constant.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__number__ = __webpack_require__("./node_modules/@swimlane/ngx-charts/node_modules/d3-scale/src/number.js"); var unit = [0, 1]; function deinterpolateLinear(a, b) { return (b -= (a = +a)) ? function(x) { return (x - a) / b; } : Object(__WEBPACK_IMPORTED_MODULE_3__constant__["a" /* default */])(b); } function deinterpolateClamp(deinterpolate) { return function(a, b) { var d = deinterpolate(a = +a, b = +b); return function(x) { return x <= a ? 0 : x >= b ? 1 : d(x); }; }; } function reinterpolateClamp(reinterpolate) { return function(a, b) { var r = reinterpolate(a = +a, b = +b); return function(t) { return t <= 0 ? a : t >= 1 ? b : r(t); }; }; } function bimap(domain, range, deinterpolate, reinterpolate) { var d0 = domain[0], d1 = domain[1], r0 = range[0], r1 = range[1]; if (d1 < d0) d0 = deinterpolate(d1, d0), r0 = reinterpolate(r1, r0); else d0 = deinterpolate(d0, d1), r0 = reinterpolate(r0, r1); return function(x) { return r0(d0(x)); }; } function polymap(domain, range, deinterpolate, reinterpolate) { var j = Math.min(domain.length, range.length) - 1, d = new Array(j), r = new Array(j), i = -1; // Reverse descending domains. if (domain[j] < domain[0]) { domain = domain.slice().reverse(); range = range.slice().reverse(); } while (++i < j) { d[i] = deinterpolate(domain[i], domain[i + 1]); r[i] = reinterpolate(range[i], range[i + 1]); } return function(x) { var i = Object(__WEBPACK_IMPORTED_MODULE_0_d3_array__["bisect"])(domain, x, 1, j) - 1; return r[i](d[i](x)); }; } function copy(source, target) { return target .domain(source.domain()) .range(source.range()) .interpolate(source.interpolate()) .clamp(source.clamp()); } // deinterpolate(a, b)(x) takes a domain value x in [a,b] and returns the corresponding parameter t in [0,1]. // reinterpolate(a, b)(t) takes a parameter t in [0,1] and returns the corresponding domain value x in [a,b]. function continuous(deinterpolate, reinterpolate) { var domain = unit, range = unit, interpolate = __WEBPACK_IMPORTED_MODULE_1_d3_interpolate__["interpolate"], clamp = false, piecewise, output, input; function rescale() { piecewise = Math.min(domain.length, range.length) > 2 ? polymap : bimap; output = input = null; return scale; } function scale(x) { return (output || (output = piecewise(domain, range, clamp ? deinterpolateClamp(deinterpolate) : deinterpolate, interpolate)))(+x); } scale.invert = function(y) { return (input || (input = piecewise(range, domain, deinterpolateLinear, clamp ? reinterpolateClamp(reinterpolate) : reinterpolate)))(+y); }; scale.domain = function(_) { return arguments.length ? (domain = __WEBPACK_IMPORTED_MODULE_2__array__["a" /* map */].call(_, __WEBPACK_IMPORTED_MODULE_4__number__["a" /* default */]), rescale()) : domain.slice(); }; scale.range = function(_) { return arguments.length ? (range = __WEBPACK_IMPORTED_MODULE_2__array__["b" /* slice */].call(_), rescale()) : range.slice(); }; scale.rangeRound = function(_) { return range = __WEBPACK_IMPORTED_MODULE_2__array__["b" /* slice */].call(_), interpolate = __WEBPACK_IMPORTED_MODULE_1_d3_interpolate__["interpolateRound"], rescale(); }; scale.clamp = function(_) { return arguments.length ? (clamp = !!_, rescale()) : clamp; }; scale.interpolate = function(_) { return arguments.length ? (interpolate = _, rescale()) : interpolate; }; return rescale(); } /***/ }), /***/ "./node_modules/@swimlane/ngx-charts/node_modules/d3-scale/src/cubehelix.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_d3_color__ = __webpack_require__("./node_modules/d3-color/index.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_d3_interpolate__ = __webpack_require__("./node_modules/d3-interpolate/index.js"); /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_1_d3_interpolate__["interpolateCubehelixLong"])(Object(__WEBPACK_IMPORTED_MODULE_0_d3_color__["cubehelix"])(300, 0.5, 0.0), Object(__WEBPACK_IMPORTED_MODULE_0_d3_color__["cubehelix"])(-240, 0.5, 1.0))); /***/ }), /***/ "./node_modules/@swimlane/ngx-charts/node_modules/d3-scale/src/identity.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = identity; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__array__ = __webpack_require__("./node_modules/@swimlane/ngx-charts/node_modules/d3-scale/src/array.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__linear__ = __webpack_require__("./node_modules/@swimlane/ngx-charts/node_modules/d3-scale/src/linear.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__number__ = __webpack_require__("./node_modules/@swimlane/ngx-charts/node_modules/d3-scale/src/number.js"); function identity() { var domain = [0, 1]; function scale(x) { return +x; } scale.invert = scale; scale.domain = scale.range = function(_) { return arguments.length ? (domain = __WEBPACK_IMPORTED_MODULE_0__array__["a" /* map */].call(_, __WEBPACK_IMPORTED_MODULE_2__number__["a" /* default */]), scale) : domain.slice(); }; scale.copy = function() { return identity().domain(domain); }; return Object(__WEBPACK_IMPORTED_MODULE_1__linear__["b" /* linearish */])(scale); } /***/ }), /***/ "./node_modules/@swimlane/ngx-charts/node_modules/d3-scale/src/linear.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["b"] = linearish; /* harmony export (immutable) */ __webpack_exports__["a"] = linear; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_d3_array__ = __webpack_require__("./node_modules/d3-array/index.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_d3_interpolate__ = __webpack_require__("./node_modules/d3-interpolate/index.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__continuous__ = __webpack_require__("./node_modules/@swimlane/ngx-charts/node_modules/d3-scale/src/continuous.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__tickFormat__ = __webpack_require__("./node_modules/@swimlane/ngx-charts/node_modules/d3-scale/src/tickFormat.js"); function linearish(scale) { var domain = scale.domain; scale.ticks = function(count) { var d = domain(); return Object(__WEBPACK_IMPORTED_MODULE_0_d3_array__["ticks"])(d[0], d[d.length - 1], count == null ? 10 : count); }; scale.tickFormat = function(count, specifier) { return Object(__WEBPACK_IMPORTED_MODULE_3__tickFormat__["a" /* default */])(domain(), count, specifier); }; scale.nice = function(count) { if (count == null) count = 10; var d = domain(), i0 = 0, i1 = d.length - 1, start = d[i0], stop = d[i1], step; if (stop < start) { step = start, start = stop, stop = step; step = i0, i0 = i1, i1 = step; } step = Object(__WEBPACK_IMPORTED_MODULE_0_d3_array__["tickIncrement"])(start, stop, count); if (step > 0) { start = Math.floor(start / step) * step; stop = Math.ceil(stop / step) * step; step = Object(__WEBPACK_IMPORTED_MODULE_0_d3_array__["tickIncrement"])(start, stop, count); } else if (step < 0) { start = Math.ceil(start * step) / step; stop = Math.floor(stop * step) / step; step = Object(__WEBPACK_IMPORTED_MODULE_0_d3_array__["tickIncrement"])(start, stop, count); } if (step > 0) { d[i0] = Math.floor(start / step) * step; d[i1] = Math.ceil(stop / step) * step; domain(d); } else if (step < 0) { d[i0] = Math.ceil(start * step) / step; d[i1] = Math.floor(stop * step) / step; domain(d); } return scale; }; return scale; } function linear() { var scale = Object(__WEBPACK_IMPORTED_MODULE_2__continuous__["b" /* default */])(__WEBPACK_IMPORTED_MODULE_2__continuous__["c" /* deinterpolateLinear */], __WEBPACK_IMPORTED_MODULE_1_d3_interpolate__["interpolateNumber"]); scale.copy = function() { return Object(__WEBPACK_IMPORTED_MODULE_2__continuous__["a" /* copy */])(scale, linear()); }; return linearish(scale); } /***/ }), /***/ "./node_modules/@swimlane/ngx-charts/node_modules/d3-scale/src/log.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = log; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_d3_array__ = __webpack_require__("./node_modules/d3-array/index.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_d3_format__ = __webpack_require__("./node_modules/d3-format/index.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__constant__ = __webpack_require__("./node_modules/@swimlane/ngx-charts/node_modules/d3-scale/src/constant.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__nice__ = __webpack_require__("./node_modules/@swimlane/ngx-charts/node_modules/d3-scale/src/nice.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__continuous__ = __webpack_require__("./node_modules/@swimlane/ngx-charts/node_modules/d3-scale/src/continuous.js"); function deinterpolate(a, b) { return (b = Math.log(b / a)) ? function(x) { return Math.log(x / a) / b; } : Object(__WEBPACK_IMPORTED_MODULE_2__constant__["a" /* default */])(b); } function reinterpolate(a, b) { return a < 0 ? function(t) { return -Math.pow(-b, t) * Math.pow(-a, 1 - t); } : function(t) { return Math.pow(b, t) * Math.pow(a, 1 - t); }; } function pow10(x) { return isFinite(x) ? +("1e" + x) : x < 0 ? 0 : x; } function powp(base) { return base === 10 ? pow10 : base === Math.E ? Math.exp : function(x) { return Math.pow(base, x); }; } function logp(base) { return base === Math.E ? Math.log : base === 10 && Math.log10 || base === 2 && Math.log2 || (base = Math.log(base), function(x) { return Math.log(x) / base; }); } function reflect(f) { return function(x) { return -f(-x); }; } function log() { var scale = Object(__WEBPACK_IMPORTED_MODULE_4__continuous__["b" /* default */])(deinterpolate, reinterpolate).domain([1, 10]), domain = scale.domain, base = 10, logs = logp(10), pows = powp(10); function rescale() { logs = logp(base), pows = powp(base); if (domain()[0] < 0) logs = reflect(logs), pows = reflect(pows); return scale; } scale.base = function(_) { return arguments.length ? (base = +_, rescale()) : base; }; scale.domain = function(_) { return arguments.length ? (domain(_), rescale()) : domain(); }; scale.ticks = function(count) { var d = domain(), u = d[0], v = d[d.length - 1], r; if (r = v < u) i = u, u = v, v = i; var i = logs(u), j = logs(v), p, k, t, n = count == null ? 10 : +count, z = []; if (!(base % 1) && j - i < n) { i = Math.round(i) - 1, j = Math.round(j) + 1; if (u > 0) for (; i < j; ++i) { for (k = 1, p = pows(i); k < base; ++k) { t = p * k; if (t < u) continue; if (t > v) break; z.push(t); } } else for (; i < j; ++i) { for (k = base - 1, p = pows(i); k >= 1; --k) { t = p * k; if (t < u) continue; if (t > v) break; z.push(t); } } } else { z = Object(__WEBPACK_IMPORTED_MODULE_0_d3_array__["ticks"])(i, j, Math.min(j - i, n)).map(pows); } return r ? z.reverse() : z; }; scale.tickFormat = function(count, specifier) { if (specifier == null) specifier = base === 10 ? ".0e" : ","; if (typeof specifier !== "function") specifier = Object(__WEBPACK_IMPORTED_MODULE_1_d3_format__["format"])(specifier); if (count === Infinity) return specifier; if (count == null) count = 10; var k = Math.max(1, base * count / scale.ticks().length); // TODO fast estimate? return function(d) { var i = d / pows(Math.round(logs(d))); if (i * base < base - 0.5) i *= base; return i <= k ? specifier(d) : ""; }; }; scale.nice = function() { return domain(Object(__WEBPACK_IMPORTED_MODULE_3__nice__["a" /* default */])(domain(), { floor: function(x) { return pows(Math.floor(logs(x))); }, ceil: function(x) { return pows(Math.ceil(logs(x))); } })); }; scale.copy = function() { return Object(__WEBPACK_IMPORTED_MODULE_4__continuous__["a" /* copy */])(scale, log().base(base)); }; return scale; } /***/ }), /***/ "./node_modules/@swimlane/ngx-charts/node_modules/d3-scale/src/nice.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony default export */ __webpack_exports__["a"] = (function(domain, interval) { domain = domain.slice(); var i0 = 0, i1 = domain.length - 1, x0 = domain[i0], x1 = domain[i1], t; if (x1 < x0) { t = i0, i0 = i1, i1 = t; t = x0, x0 = x1, x1 = t; } domain[i0] = interval.floor(x0); domain[i1] = interval.ceil(x1); return domain; }); /***/ }), /***/ "./node_modules/@swimlane/ngx-charts/node_modules/d3-scale/src/number.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony default export */ __webpack_exports__["a"] = (function(x) { return +x; }); /***/ }), /***/ "./node_modules/@swimlane/ngx-charts/node_modules/d3-scale/src/ordinal.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return implicit; }); /* harmony export (immutable) */ __webpack_exports__["a"] = ordinal; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_d3_collection__ = __webpack_require__("./node_modules/d3-collection/index.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__array__ = __webpack_require__("./node_modules/@swimlane/ngx-charts/node_modules/d3-scale/src/array.js"); var implicit = {name: "implicit"}; function ordinal(range) { var index = Object(__WEBPACK_IMPORTED_MODULE_0_d3_collection__["a" /* map */])(), domain = [], unknown = implicit; range = range == null ? [] : __WEBPACK_IMPORTED_MODULE_1__array__["b" /* slice */].call(range); function scale(d) { var key = d + "", i = index.get(key); if (!i) { if (unknown !== implicit) return unknown; index.set(key, i = domain.push(d)); } return range[(i - 1) % range.length]; } scale.domain = function(_) { if (!arguments.length) return domain.slice(); domain = [], index = Object(__WEBPACK_IMPORTED_MODULE_0_d3_collection__["a" /* map */])(); var i = -1, n = _.length, d, key; while (++i < n) if (!index.has(key = (d = _[i]) + "")) index.set(key, domain.push(d)); return scale; }; scale.range = function(_) { return arguments.length ? (range = __WEBPACK_IMPORTED_MODULE_1__array__["b" /* slice */].call(_), scale) : range.slice(); }; scale.unknown = function(_) { return arguments.length ? (unknown = _, scale) : unknown; }; scale.copy = function() { return ordinal() .domain(domain) .range(range) .unknown(unknown); }; return scale; } /***/ }), /***/ "./node_modules/@swimlane/ngx-charts/node_modules/d3-scale/src/pow.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = pow; /* harmony export (immutable) */ __webpack_exports__["b"] = sqrt; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__constant__ = __webpack_require__("./node_modules/@swimlane/ngx-charts/node_modules/d3-scale/src/constant.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__linear__ = __webpack_require__("./node_modules/@swimlane/ngx-charts/node_modules/d3-scale/src/linear.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__continuous__ = __webpack_require__("./node_modules/@swimlane/ngx-charts/node_modules/d3-scale/src/continuous.js"); function raise(x, exponent) { return x < 0 ? -Math.pow(-x, exponent) : Math.pow(x, exponent); } function pow() { var exponent = 1, scale = Object(__WEBPACK_IMPORTED_MODULE_2__continuous__["b" /* default */])(deinterpolate, reinterpolate), domain = scale.domain; function deinterpolate(a, b) { return (b = raise(b, exponent) - (a = raise(a, exponent))) ? function(x) { return (raise(x, exponent) - a) / b; } : Object(__WEBPACK_IMPORTED_MODULE_0__constant__["a" /* default */])(b); } function reinterpolate(a, b) { b = raise(b, exponent) - (a = raise(a, exponent)); return function(t) { return raise(a + b * t, 1 / exponent); }; } scale.exponent = function(_) { return arguments.length ? (exponent = +_, domain(domain())) : exponent; }; scale.copy = function() { return Object(__WEBPACK_IMPORTED_MODULE_2__continuous__["a" /* copy */])(scale, pow().exponent(exponent)); }; return Object(__WEBPACK_IMPORTED_MODULE_1__linear__["b" /* linearish */])(scale); } function sqrt() { return pow().exponent(0.5); } /***/ }), /***/ "./node_modules/@swimlane/ngx-charts/node_modules/d3-scale/src/quantile.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = quantile; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_d3_array__ = __webpack_require__("./node_modules/d3-array/index.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__array__ = __webpack_require__("./node_modules/@swimlane/ngx-charts/node_modules/d3-scale/src/array.js"); function quantile() { var domain = [], range = [], thresholds = []; function rescale() { var i = 0, n = Math.max(1, range.length); thresholds = new Array(n - 1); while (++i < n) thresholds[i - 1] = Object(__WEBPACK_IMPORTED_MODULE_0_d3_array__["quantile"])(domain, i / n); return scale; } function scale(x) { if (!isNaN(x = +x)) return range[Object(__WEBPACK_IMPORTED_MODULE_0_d3_array__["bisect"])(thresholds, x)]; } scale.invertExtent = function(y) { var i = range.indexOf(y); return i < 0 ? [NaN, NaN] : [ i > 0 ? thresholds[i - 1] : domain[0], i < thresholds.length ? thresholds[i] : domain[domain.length - 1] ]; }; scale.domain = function(_) { if (!arguments.length) return domain.slice(); domain = []; for (var i = 0, n = _.length, d; i < n; ++i) if (d = _[i], d != null && !isNaN(d = +d)) domain.push(d); domain.sort(__WEBPACK_IMPORTED_MODULE_0_d3_array__["ascending"]); return rescale(); }; scale.range = function(_) { return arguments.length ? (range = __WEBPACK_IMPORTED_MODULE_1__array__["b" /* slice */].call(_), rescale()) : range.slice(); }; scale.quantiles = function() { return thresholds.slice(); }; scale.copy = function() { return quantile() .domain(domain) .range(range); }; return scale; } /***/ }), /***/ "./node_modules/@swimlane/ngx-charts/node_modules/d3-scale/src/quantize.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = quantize; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_d3_array__ = __webpack_require__("./node_modules/d3-array/index.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__array__ = __webpack_require__("./node_modules/@swimlane/ngx-charts/node_modules/d3-scale/src/array.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__linear__ = __webpack_require__("./node_modules/@swimlane/ngx-charts/node_modules/d3-scale/src/linear.js"); function quantize() { var x0 = 0, x1 = 1, n = 1, domain = [0.5], range = [0, 1]; function scale(x) { if (x <= x) return range[Object(__WEBPACK_IMPORTED_MODULE_0_d3_array__["bisect"])(domain, x, 0, n)]; } function rescale() { var i = -1; domain = new Array(n); while (++i < n) domain[i] = ((i + 1) * x1 - (i - n) * x0) / (n + 1); return scale; } scale.domain = function(_) { return arguments.length ? (x0 = +_[0], x1 = +_[1], rescale()) : [x0, x1]; }; scale.range = function(_) { return arguments.length ? (n = (range = __WEBPACK_IMPORTED_MODULE_1__array__["b" /* slice */].call(_)).length - 1, rescale()) : range.slice(); }; scale.invertExtent = function(y) { var i = range.indexOf(y); return i < 0 ? [NaN, NaN] : i < 1 ? [x0, domain[0]] : i >= n ? [domain[n - 1], x1] : [domain[i - 1], domain[i]]; }; scale.copy = function() { return quantize() .domain([x0, x1]) .range(range); }; return Object(__WEBPACK_IMPORTED_MODULE_2__linear__["b" /* linearish */])(scale); } /***/ }), /***/ "./node_modules/@swimlane/ngx-charts/node_modules/d3-scale/src/rainbow.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return warm; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return cool; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_d3_color__ = __webpack_require__("./node_modules/d3-color/index.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_d3_interpolate__ = __webpack_require__("./node_modules/d3-interpolate/index.js"); var warm = Object(__WEBPACK_IMPORTED_MODULE_1_d3_interpolate__["interpolateCubehelixLong"])(Object(__WEBPACK_IMPORTED_MODULE_0_d3_color__["cubehelix"])(-100, 0.75, 0.35), Object(__WEBPACK_IMPORTED_MODULE_0_d3_color__["cubehelix"])(80, 1.50, 0.8)); var cool = Object(__WEBPACK_IMPORTED_MODULE_1_d3_interpolate__["interpolateCubehelixLong"])(Object(__WEBPACK_IMPORTED_MODULE_0_d3_color__["cubehelix"])(260, 0.75, 0.35), Object(__WEBPACK_IMPORTED_MODULE_0_d3_color__["cubehelix"])(80, 1.50, 0.8)); var rainbow = Object(__WEBPACK_IMPORTED_MODULE_0_d3_color__["cubehelix"])(); /* harmony default export */ __webpack_exports__["b"] = (function(t) { if (t < 0 || t > 1) t -= Math.floor(t); var ts = Math.abs(t - 0.5); rainbow.h = 360 * t - 100; rainbow.s = 1.5 - 1.5 * ts; rainbow.l = 0.8 - 0.9 * ts; return rainbow + ""; }); /***/ }), /***/ "./node_modules/@swimlane/ngx-charts/node_modules/d3-scale/src/sequential.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = sequential; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__linear__ = __webpack_require__("./node_modules/@swimlane/ngx-charts/node_modules/d3-scale/src/linear.js"); function sequential(interpolator) { var x0 = 0, x1 = 1, clamp = false; function scale(x) { var t = (x - x0) / (x1 - x0); return interpolator(clamp ? Math.max(0, Math.min(1, t)) : t); } scale.domain = function(_) { return arguments.length ? (x0 = +_[0], x1 = +_[1], scale) : [x0, x1]; }; scale.clamp = function(_) { return arguments.length ? (clamp = !!_, scale) : clamp; }; scale.interpolator = function(_) { return arguments.length ? (interpolator = _, scale) : interpolator; }; scale.copy = function() { return sequential(interpolator).domain([x0, x1]).clamp(clamp); }; return Object(__WEBPACK_IMPORTED_MODULE_0__linear__["b" /* linearish */])(scale); } /***/ }), /***/ "./node_modules/@swimlane/ngx-charts/node_modules/d3-scale/src/threshold.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = threshold; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_d3_array__ = __webpack_require__("./node_modules/d3-array/index.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__array__ = __webpack_require__("./node_modules/@swimlane/ngx-charts/node_modules/d3-scale/src/array.js"); function threshold() { var domain = [0.5], range = [0, 1], n = 1; function scale(x) { if (x <= x) return range[Object(__WEBPACK_IMPORTED_MODULE_0_d3_array__["bisect"])(domain, x, 0, n)]; } scale.domain = function(_) { return arguments.length ? (domain = __WEBPACK_IMPORTED_MODULE_1__array__["b" /* slice */].call(_), n = Math.min(domain.length, range.length - 1), scale) : domain.slice(); }; scale.range = function(_) { return arguments.length ? (range = __WEBPACK_IMPORTED_MODULE_1__array__["b" /* slice */].call(_), n = Math.min(domain.length, range.length - 1), scale) : range.slice(); }; scale.invertExtent = function(y) { var i = range.indexOf(y); return [domain[i - 1], domain[i]]; }; scale.copy = function() { return threshold() .domain(domain) .range(range); }; return scale; } /***/ }), /***/ "./node_modules/@swimlane/ngx-charts/node_modules/d3-scale/src/tickFormat.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_d3_array__ = __webpack_require__("./node_modules/d3-array/index.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_d3_format__ = __webpack_require__("./node_modules/d3-format/index.js"); /* harmony default export */ __webpack_exports__["a"] = (function(domain, count, specifier) { var start = domain[0], stop = domain[domain.length - 1], step = Object(__WEBPACK_IMPORTED_MODULE_0_d3_array__["tickStep"])(start, stop, count == null ? 10 : count), precision; specifier = Object(__WEBPACK_IMPORTED_MODULE_1_d3_format__["formatSpecifier"])(specifier == null ? ",f" : specifier); switch (specifier.type) { case "s": { var value = Math.max(Math.abs(start), Math.abs(stop)); if (specifier.precision == null && !isNaN(precision = Object(__WEBPACK_IMPORTED_MODULE_1_d3_format__["precisionPrefix"])(step, value))) specifier.precision = precision; return Object(__WEBPACK_IMPORTED_MODULE_1_d3_format__["formatPrefix"])(specifier, value); } case "": case "e": case "g": case "p": case "r": { if (specifier.precision == null && !isNaN(precision = Object(__WEBPACK_IMPORTED_MODULE_1_d3_format__["precisionRound"])(step, Math.max(Math.abs(start), Math.abs(stop))))) specifier.precision = precision - (specifier.type === "e"); break; } case "f": case "%": { if (specifier.precision == null && !isNaN(precision = Object(__WEBPACK_IMPORTED_MODULE_1_d3_format__["precisionFixed"])(step))) specifier.precision = precision - (specifier.type === "%") * 2; break; } } return Object(__WEBPACK_IMPORTED_MODULE_1_d3_format__["format"])(specifier); }); /***/ }), /***/ "./node_modules/@swimlane/ngx-charts/node_modules/d3-scale/src/time.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = calendar; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_d3_array__ = __webpack_require__("./node_modules/d3-array/index.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_d3_interpolate__ = __webpack_require__("./node_modules/d3-interpolate/index.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_d3_time__ = __webpack_require__("./node_modules/d3-time/index.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_d3_time_format__ = __webpack_require__("./node_modules/d3-time-format/index.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__array__ = __webpack_require__("./node_modules/@swimlane/ngx-charts/node_modules/d3-scale/src/array.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__continuous__ = __webpack_require__("./node_modules/@swimlane/ngx-charts/node_modules/d3-scale/src/continuous.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__nice__ = __webpack_require__("./node_modules/@swimlane/ngx-charts/node_modules/d3-scale/src/nice.js"); var durationSecond = 1000, durationMinute = durationSecond * 60, durationHour = durationMinute * 60, durationDay = durationHour * 24, durationWeek = durationDay * 7, durationMonth = durationDay * 30, durationYear = durationDay * 365; function date(t) { return new Date(t); } function number(t) { return t instanceof Date ? +t : +new Date(+t); } function calendar(year, month, week, day, hour, minute, second, millisecond, format) { var scale = Object(__WEBPACK_IMPORTED_MODULE_5__continuous__["b" /* default */])(__WEBPACK_IMPORTED_MODULE_5__continuous__["c" /* deinterpolateLinear */], __WEBPACK_IMPORTED_MODULE_1_d3_interpolate__["interpolateNumber"]), invert = scale.invert, domain = scale.domain; var formatMillisecond = format(".%L"), formatSecond = format(":%S"), formatMinute = format("%I:%M"), formatHour = format("%I %p"), formatDay = format("%a %d"), formatWeek = format("%b %d"), formatMonth = format("%B"), formatYear = format("%Y"); var tickIntervals = [ [second, 1, durationSecond], [second, 5, 5 * durationSecond], [second, 15, 15 * durationSecond], [second, 30, 30 * durationSecond], [minute, 1, durationMinute], [minute, 5, 5 * durationMinute], [minute, 15, 15 * durationMinute], [minute, 30, 30 * durationMinute], [ hour, 1, durationHour ], [ hour, 3, 3 * durationHour ], [ hour, 6, 6 * durationHour ], [ hour, 12, 12 * durationHour ], [ day, 1, durationDay ], [ day, 2, 2 * durationDay ], [ week, 1, durationWeek ], [ month, 1, durationMonth ], [ month, 3, 3 * durationMonth ], [ year, 1, durationYear ] ]; function tickFormat(date) { return (second(date) < date ? formatMillisecond : minute(date) < date ? formatSecond : hour(date) < date ? formatMinute : day(date) < date ? formatHour : month(date) < date ? (week(date) < date ? formatDay : formatWeek) : year(date) < date ? formatMonth : formatYear)(date); } function tickInterval(interval, start, stop, step) { if (interval == null) interval = 10; // If a desired tick count is specified, pick a reasonable tick interval // based on the extent of the domain and a rough estimate of tick size. // Otherwise, assume interval is already a time interval and use it. if (typeof interval === "number") { var target = Math.abs(stop - start) / interval, i = Object(__WEBPACK_IMPORTED_MODULE_0_d3_array__["bisector"])(function(i) { return i[2]; }).right(tickIntervals, target); if (i === tickIntervals.length) { step = Object(__WEBPACK_IMPORTED_MODULE_0_d3_array__["tickStep"])(start / durationYear, stop / durationYear, interval); interval = year; } else if (i) { i = tickIntervals[target / tickIntervals[i - 1][2] < tickIntervals[i][2] / target ? i - 1 : i]; step = i[1]; interval = i[0]; } else { step = Math.max(Object(__WEBPACK_IMPORTED_MODULE_0_d3_array__["tickStep"])(start, stop, interval), 1); interval = millisecond; } } return step == null ? interval : interval.every(step); } scale.invert = function(y) { return new Date(invert(y)); }; scale.domain = function(_) { return arguments.length ? domain(__WEBPACK_IMPORTED_MODULE_4__array__["a" /* map */].call(_, number)) : domain().map(date); }; scale.ticks = function(interval, step) { var d = domain(), t0 = d[0], t1 = d[d.length - 1], r = t1 < t0, t; if (r) t = t0, t0 = t1, t1 = t; t = tickInterval(interval, t0, t1, step); t = t ? t.range(t0, t1 + 1) : []; // inclusive stop return r ? t.reverse() : t; }; scale.tickFormat = function(count, specifier) { return specifier == null ? tickFormat : format(specifier); }; scale.nice = function(interval, step) { var d = domain(); return (interval = tickInterval(interval, d[0], d[d.length - 1], step)) ? domain(Object(__WEBPACK_IMPORTED_MODULE_6__nice__["a" /* default */])(d, interval)) : scale; }; scale.copy = function() { return Object(__WEBPACK_IMPORTED_MODULE_5__continuous__["a" /* copy */])(scale, calendar(year, month, week, day, hour, minute, second, millisecond, format)); }; return scale; } /* harmony default export */ __webpack_exports__["b"] = (function() { return calendar(__WEBPACK_IMPORTED_MODULE_2_d3_time__["k" /* timeYear */], __WEBPACK_IMPORTED_MODULE_2_d3_time__["f" /* timeMonth */], __WEBPACK_IMPORTED_MODULE_2_d3_time__["j" /* timeWeek */], __WEBPACK_IMPORTED_MODULE_2_d3_time__["a" /* timeDay */], __WEBPACK_IMPORTED_MODULE_2_d3_time__["b" /* timeHour */], __WEBPACK_IMPORTED_MODULE_2_d3_time__["d" /* timeMinute */], __WEBPACK_IMPORTED_MODULE_2_d3_time__["g" /* timeSecond */], __WEBPACK_IMPORTED_MODULE_2_d3_time__["c" /* timeMillisecond */], __WEBPACK_IMPORTED_MODULE_3_d3_time_format__["timeFormat"]).domain([new Date(2000, 0, 1), new Date(2000, 0, 2)]); }); /***/ }), /***/ "./node_modules/@swimlane/ngx-charts/node_modules/d3-scale/src/utcTime.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__time__ = __webpack_require__("./node_modules/@swimlane/ngx-charts/node_modules/d3-scale/src/time.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_d3_time_format__ = __webpack_require__("./node_modules/d3-time-format/index.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_d3_time__ = __webpack_require__("./node_modules/d3-time/index.js"); /* harmony default export */ __webpack_exports__["a"] = (function() { return Object(__WEBPACK_IMPORTED_MODULE_0__time__["a" /* calendar */])(__WEBPACK_IMPORTED_MODULE_2_d3_time__["v" /* utcYear */], __WEBPACK_IMPORTED_MODULE_2_d3_time__["q" /* utcMonth */], __WEBPACK_IMPORTED_MODULE_2_d3_time__["u" /* utcWeek */], __WEBPACK_IMPORTED_MODULE_2_d3_time__["l" /* utcDay */], __WEBPACK_IMPORTED_MODULE_2_d3_time__["m" /* utcHour */], __WEBPACK_IMPORTED_MODULE_2_d3_time__["o" /* utcMinute */], __WEBPACK_IMPORTED_MODULE_2_d3_time__["r" /* utcSecond */], __WEBPACK_IMPORTED_MODULE_2_d3_time__["n" /* utcMillisecond */], __WEBPACK_IMPORTED_MODULE_1_d3_time_format__["utcFormat"]).domain([Date.UTC(2000, 0, 1), Date.UTC(2000, 0, 2)]); }); /***/ }), /***/ "./node_modules/@swimlane/ngx-charts/node_modules/d3-scale/src/viridis.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return magma; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return inferno; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return plasma; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__colors__ = __webpack_require__("./node_modules/@swimlane/ngx-charts/node_modules/d3-scale/src/colors.js"); function ramp(range) { var n = range.length; return function(t) { return range[Math.max(0, Math.min(n - 1, Math.floor(t * n)))]; }; } /* harmony default export */ __webpack_exports__["a"] = (ramp(Object(__WEBPACK_IMPORTED_MODULE_0__colors__["a" /* default */])("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725"))); var magma = ramp(Object(__WEBPACK_IMPORTED_MODULE_0__colors__["a" /* default */])("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")); var inferno = ramp(Object(__WEBPACK_IMPORTED_MODULE_0__colors__["a" /* default */])("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")); var plasma = ramp(Object(__WEBPACK_IMPORTED_MODULE_0__colors__["a" /* default */])("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921")); /***/ }), /***/ "./node_modules/@swimlane/ngx-charts/release/index.js": /***/ (function(module, exports, __webpack_require__) { /** * ngx-charts v"7.4.0" (https://github.com/swimlane/ngx-charts) * Copyright 2016 * Licensed under MIT */ (function webpackUniversalModuleDefinition(root, factory) { if(true) module.exports = factory(__webpack_require__("./node_modules/@angular/animations/esm2015/animations.js"), __webpack_require__("./node_modules/@angular/common/esm2015/common.js"), __webpack_require__("./node_modules/@angular/core/esm2015/core.js"), __webpack_require__("./node_modules/@angular/platform-browser/esm2015/platform-browser.js"), __webpack_require__("./node_modules/d3-array/index.js"), __webpack_require__("./node_modules/d3-brush/index.js"), __webpack_require__("./node_modules/d3-color/index.js"), __webpack_require__("./node_modules/d3-force/index.js"), __webpack_require__("./node_modules/d3-format/index.js"), __webpack_require__("./node_modules/d3-hierarchy/index.js"), __webpack_require__("./node_modules/d3-interpolate/index.js"), __webpack_require__("./node_modules/@swimlane/ngx-charts/node_modules/d3-scale/index.js"), __webpack_require__("./node_modules/d3-selection/index.js"), __webpack_require__("./node_modules/d3-shape/index.js"), __webpack_require__("./node_modules/d3-time-format/index.js")); else if(typeof define === 'function' && define.amd) define("ngx-charts", ["@angular/animations", "@angular/common", "@angular/core", "@angular/platform-browser", "d3-array", "d3-brush", "d3-color", "d3-force", "d3-format", "d3-hierarchy", "d3-interpolate", "d3-scale", "d3-selection", "d3-shape", "d3-time-format"], factory); else if(typeof exports === 'object') exports["ngx-charts"] = factory(require("@angular/animations"), require("@angular/common"), require("@angular/core"), require("@angular/platform-browser"), require("d3-array"), require("d3-brush"), require("d3-color"), require("d3-force"), require("d3-format"), require("d3-hierarchy"), require("d3-interpolate"), require("d3-scale"), require("d3-selection"), require("d3-shape"), require("d3-time-format")); else root["ngx-charts"] = factory(root["@angular/animations"], root["@angular/common"], root["@angular/core"], root["@angular/platform-browser"], root["d3-array"], root["d3-brush"], root["d3-color"], root["d3-force"], root["d3-format"], root["d3-hierarchy"], root["d3-interpolate"], root["d3-scale"], root["d3-selection"], root["d3-shape"], root["d3-time-format"]); })(typeof self !== 'undefined' ? self : this, function(__WEBPACK_EXTERNAL_MODULE__angular_animations__, __WEBPACK_EXTERNAL_MODULE__angular_common__, __WEBPACK_EXTERNAL_MODULE__angular_core__, __WEBPACK_EXTERNAL_MODULE__angular_platform_browser__, __WEBPACK_EXTERNAL_MODULE_d3_array__, __WEBPACK_EXTERNAL_MODULE_d3_brush__, __WEBPACK_EXTERNAL_MODULE_d3_color__, __WEBPACK_EXTERNAL_MODULE_d3_force__, __WEBPACK_EXTERNAL_MODULE_d3_format__, __WEBPACK_EXTERNAL_MODULE_d3_hierarchy__, __WEBPACK_EXTERNAL_MODULE_d3_interpolate__, __WEBPACK_EXTERNAL_MODULE_d3_scale__, __WEBPACK_EXTERNAL_MODULE_d3_selection__, __WEBPACK_EXTERNAL_MODULE_d3_shape__, __WEBPACK_EXTERNAL_MODULE_d3_time_format__) { return /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { /******/ configurable: false, /******/ enumerable: true, /******/ get: getter /******/ }); /******/ } /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = "./src/index.ts"); /******/ }) /************************************************************************/ /******/ ({ /***/ "./node_modules/css-loader/index.js!./node_modules/postcss-loader/index.js!./node_modules/sass-loader/lib/loader.js??ref--3-4!./src/bar-chart/bar-label.component.scss": /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__("./node_modules/css-loader/lib/css-base.js")(false); // imports // module exports.push([module.i, ".textDataLabel {\n font-size: 11px; }\n", ""]); // exports /***/ }), /***/ "./node_modules/css-loader/index.js!./node_modules/postcss-loader/index.js!./node_modules/sass-loader/lib/loader.js??ref--3-4!./src/common/base-chart.component.scss": /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__("./node_modules/css-loader/lib/css-base.js")(false); // imports // module exports.push([module.i, ".ngx-charts {\n float: left;\n overflow: visible; }\n .ngx-charts .circle,\n .ngx-charts .bar,\n .ngx-charts .arc {\n cursor: pointer; }\n .ngx-charts .bar.active, .ngx-charts .bar:hover,\n .ngx-charts .cell.active,\n .ngx-charts .cell:hover,\n .ngx-charts .arc.active,\n .ngx-charts .arc:hover,\n .ngx-charts .card.active,\n .ngx-charts .card:hover {\n opacity: 0.8;\n -webkit-transition: opacity 100ms ease-in-out;\n transition: opacity 100ms ease-in-out; }\n .ngx-charts .bar:focus,\n .ngx-charts .cell:focus,\n .ngx-charts .arc:focus,\n .ngx-charts .card:focus {\n outline: none; }\n .ngx-charts g:focus {\n outline: none; }\n .ngx-charts .line-series.inactive,\n .ngx-charts .line-series-range.inactive,\n .ngx-charts .polar-series-path.inactive,\n .ngx-charts .polar-series-area.inactive,\n .ngx-charts .area-series.inactive {\n -webkit-transition: opacity 100ms ease-in-out;\n transition: opacity 100ms ease-in-out;\n opacity: .2; }\n .ngx-charts .line-highlight {\n display: none; }\n .ngx-charts .line-highlight.active {\n display: block; }\n .ngx-charts .area {\n opacity: 0.6; }\n .ngx-charts .circle:hover {\n cursor: pointer; }\n .ngx-charts .label {\n font-size: 12px;\n font-weight: normal; }\n .ngx-charts .tooltip-anchor {\n fill: black; }\n .ngx-charts .gridline-path {\n stroke: #ddd;\n stroke-width: 1;\n fill: none; }\n .ngx-charts .refline-path {\n stroke: #a8b2c7;\n stroke-width: 1;\n stroke-dasharray: 5;\n stroke-dashoffset: 5; }\n .ngx-charts .refline-label {\n font-size: 9px; }\n .ngx-charts .reference-area {\n fill-opacity: 0.05;\n fill: #000; }\n .ngx-charts .gridline-path-dotted {\n stroke: #ddd;\n stroke-width: 1;\n fill: none;\n stroke-dasharray: 1, 20;\n stroke-dashoffset: 3; }\n .ngx-charts .grid-panel rect {\n fill: none; }\n .ngx-charts .grid-panel.odd rect {\n fill: rgba(0, 0, 0, 0.05); }\n", ""]); // exports /***/ }), /***/ "./node_modules/css-loader/index.js!./node_modules/postcss-loader/index.js!./node_modules/sass-loader/lib/loader.js??ref--3-4!./src/common/legend/advanced-legend.component.scss": /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__("./node_modules/css-loader/lib/css-base.js")(false); // imports // module exports.push([module.i, ".advanced-pie-legend {\n float: left;\n position: relative;\n top: 50%;\n -webkit-transform: translate(0, -50%);\n transform: translate(0, -50%); }\n .advanced-pie-legend .total-value {\n font-size: 36px; }\n .advanced-pie-legend .total-label {\n font-size: 24px;\n margin-bottom: 19px; }\n .advanced-pie-legend .legend-items-container {\n width: 100%; }\n .advanced-pie-legend .legend-items-container .legend-items {\n white-space: nowrap;\n overflow: auto; }\n .advanced-pie-legend .legend-items-container .legend-items .legend-item {\n margin-right: 20px;\n display: inline-block;\n cursor: pointer; }\n .advanced-pie-legend .legend-items-container .legend-items .legend-item:focus {\n outline: none; }\n .advanced-pie-legend .legend-items-container .legend-items .legend-item:hover {\n color: #000;\n -webkit-transition: 0.2s;\n transition: 0.2s; }\n .advanced-pie-legend .legend-items-container .legend-items .legend-item .item-value {\n font-size: 24px;\n margin-top: -6px;\n margin-left: 11px; }\n .advanced-pie-legend .legend-items-container .legend-items .legend-item .item-label {\n font-size: 14px;\n opacity: 0.7;\n margin-left: 11px;\n margin-top: -6px; }\n .advanced-pie-legend .legend-items-container .legend-items .legend-item .item-percent {\n font-size: 24px;\n opacity: 0.7;\n margin-left: 11px; }\n .advanced-pie-legend .legend-items-container .legend-items .legend-item .item-color {\n width: 4px;\n height: 42px;\n float: left;\n margin-right: 7px; }\n", ""]); // exports /***/ }), /***/ "./node_modules/css-loader/index.js!./node_modules/postcss-loader/index.js!./node_modules/sass-loader/lib/loader.js??ref--3-4!./src/common/legend/legend.component.scss": /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__("./node_modules/css-loader/lib/css-base.js")(false); // imports // module exports.push([module.i, ".chart-legend {\n display: inline-block;\n padding: 0;\n width: auto !important; }\n .chart-legend .legend-title {\n white-space: nowrap;\n overflow: hidden;\n margin-left: 10px;\n margin-bottom: 5px;\n font-size: 14px;\n font-weight: bold; }\n .chart-legend ul, .chart-legend li {\n padding: 0;\n margin: 0;\n list-style: none; }\n .chart-legend .legend-wrap {\n width: calc(100% - 10px); }\n .chart-legend .legend-labels {\n line-height: 85%;\n list-style: none;\n text-align: left;\n float: left;\n width: 100%;\n border-radius: 3px;\n overflow-y: auto;\n overflow-x: hidden;\n white-space: nowrap;\n background: rgba(0, 0, 0, 0.05); }\n .chart-legend .legend-label {\n cursor: pointer;\n font-size: 90%;\n margin: 8px;\n color: #AFB7C8; }\n .chart-legend .legend-label:hover {\n color: #000;\n -webkit-transition: 0.2s;\n transition: 0.2s; }\n .chart-legend .legend-label .active .legend-label-text {\n color: #000; }\n .chart-legend .legend-label-color {\n display: inline-block;\n height: 15px;\n width: 15px;\n margin-right: 5px;\n color: #5b646b;\n border-radius: 3px; }\n .chart-legend .legend-label-text {\n display: inline-block;\n vertical-align: top;\n line-height: 15px;\n font-size: 12px;\n width: calc(100% - 20px);\n text-overflow: ellipsis;\n white-space: nowrap;\n overflow: hidden; }\n .chart-legend .legend-title-text {\n vertical-align: bottom;\n display: inline-block;\n line-height: 16px;\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis; }\n", ""]); // exports /***/ }), /***/ "./node_modules/css-loader/index.js!./node_modules/postcss-loader/index.js!./node_modules/sass-loader/lib/loader.js??ref--3-4!./src/common/legend/scale-legend.component.scss": /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__("./node_modules/css-loader/lib/css-base.js")(false); // imports // module exports.push([module.i, ".chart-legend {\n display: inline-block;\n padding: 0;\n width: auto !important; }\n .chart-legend .scale-legend {\n text-align: center;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-orient: vertical;\n -webkit-box-direction: normal;\n -ms-flex-direction: column;\n flex-direction: column; }\n .chart-legend .scale-legend-wrap {\n display: inline-block;\n -webkit-box-flex: 1;\n -ms-flex: 1;\n flex: 1;\n width: 30px;\n border-radius: 5px;\n margin: 0 auto; }\n .chart-legend .scale-legend-label {\n font-size: 12px; }\n", ""]); // exports /***/ }), /***/ "./node_modules/css-loader/index.js!./node_modules/postcss-loader/index.js!./node_modules/sass-loader/lib/loader.js??ref--3-4!./src/common/timeline/timeline.component.scss": /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__("./node_modules/css-loader/lib/css-base.js")(false); // imports // module exports.push([module.i, ".timeline .brush-background {\n fill: rgba(0, 0, 0, 0.05); }\n\n.timeline .brush .selection {\n fill: rgba(0, 0, 0, 0.1);\n stroke-width: 1px;\n stroke: #888888; }\n\n.timeline .brush .handle {\n fill-opacity: 0; }\n\n.timeline .embedded-chart {\n opacity: 0.6; }\n", ""]); // exports /***/ }), /***/ "./node_modules/css-loader/index.js!./node_modules/postcss-loader/index.js!./node_modules/sass-loader/lib/loader.js??ref--3-4!./src/common/tooltip/tooltip.component.scss": /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__("./node_modules/css-loader/lib/css-base.js")(false); // imports // module exports.push([module.i, ".ngx-charts-tooltip-content {\n position: fixed;\n border-radius: 3px;\n z-index: 5000;\n display: block;\n font-weight: normal;\n opacity: 0;\n pointer-events: none !important; }\n .ngx-charts-tooltip-content.type-popover {\n background: #fff;\n color: #060709;\n border: 1px solid #72809b;\n -webkit-box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.2), 0 1px 1px 0 rgba(0, 0, 0, 0.14), 0 2px 1px -1px rgba(0, 0, 0, 0.12);\n box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.2), 0 1px 1px 0 rgba(0, 0, 0, 0.14), 0 2px 1px -1px rgba(0, 0, 0, 0.12);\n font-size: 13px;\n padding: 4px; }\n .ngx-charts-tooltip-content.type-popover .tooltip-caret {\n position: absolute;\n z-index: 5001;\n width: 0;\n height: 0; }\n .ngx-charts-tooltip-content.type-popover .tooltip-caret.position-left {\n border-top: 7px solid transparent;\n border-bottom: 7px solid transparent;\n border-left: 7px solid #fff; }\n .ngx-charts-tooltip-content.type-popover .tooltip-caret.position-top {\n border-left: 7px solid transparent;\n border-right: 7px solid transparent;\n border-top: 7px solid #fff; }\n .ngx-charts-tooltip-content.type-popover .tooltip-caret.position-right {\n border-top: 7px solid transparent;\n border-bottom: 7px solid transparent;\n border-right: 7px solid #fff; }\n .ngx-charts-tooltip-content.type-popover .tooltip-caret.position-bottom {\n border-left: 7px solid transparent;\n border-right: 7px solid transparent;\n border-bottom: 7px solid #fff; }\n .ngx-charts-tooltip-content.type-tooltip {\n color: #fff;\n background: rgba(0, 0, 0, 0.75);\n font-size: 12px;\n padding: 0 10px;\n text-align: center;\n pointer-events: auto; }\n .ngx-charts-tooltip-content.type-tooltip .tooltip-caret.position-left {\n border-top: 7px solid transparent;\n border-bottom: 7px solid transparent;\n border-left: 7px solid rgba(0, 0, 0, 0.75); }\n .ngx-charts-tooltip-content.type-tooltip .tooltip-caret.position-top {\n border-left: 7px solid transparent;\n border-right: 7px solid transparent;\n border-top: 7px solid rgba(0, 0, 0, 0.75); }\n .ngx-charts-tooltip-content.type-tooltip .tooltip-caret.position-right {\n border-top: 7px solid transparent;\n border-bottom: 7px solid transparent;\n border-right: 7px solid rgba(0, 0, 0, 0.75); }\n .ngx-charts-tooltip-content.type-tooltip .tooltip-caret.position-bottom {\n border-left: 7px solid transparent;\n border-right: 7px solid transparent;\n border-bottom: 7px solid rgba(0, 0, 0, 0.75); }\n .ngx-charts-tooltip-content .tooltip-label {\n display: block;\n line-height: 1em;\n padding: 8px 5px 5px 5px;\n font-size: 1em; }\n .ngx-charts-tooltip-content .tooltip-val {\n display: block;\n font-size: 1.3em;\n line-height: 1em;\n padding: 0 5px 8px 5px; }\n .ngx-charts-tooltip-content .tooltip-caret {\n position: absolute;\n z-index: 5001;\n width: 0;\n height: 0; }\n .ngx-charts-tooltip-content.position-right {\n -webkit-transform: translate3d(10px, 0, 0);\n transform: translate3d(10px, 0, 0); }\n .ngx-charts-tooltip-content.position-left {\n -webkit-transform: translate3d(-10px, 0, 0);\n transform: translate3d(-10px, 0, 0); }\n .ngx-charts-tooltip-content.position-top {\n -webkit-transform: translate3d(0, -10px, 0);\n transform: translate3d(0, -10px, 0); }\n .ngx-charts-tooltip-content.position-bottom {\n -webkit-transform: translate3d(0, 10px, 0);\n transform: translate3d(0, 10px, 0); }\n .ngx-charts-tooltip-content.animate {\n opacity: 1;\n -webkit-transition: opacity 0.3s, -webkit-transform 0.3s;\n transition: opacity 0.3s, -webkit-transform 0.3s;\n transition: opacity 0.3s, transform 0.3s;\n transition: opacity 0.3s, transform 0.3s, -webkit-transform 0.3s;\n -webkit-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0);\n pointer-events: auto; }\n\n.area-tooltip-container {\n padding: 5px 0;\n pointer-events: none; }\n\n.tooltip-item {\n text-align: left;\n line-height: 1.2em;\n padding: 5px 0; }\n .tooltip-item .tooltip-item-color {\n display: inline-block;\n height: 12px;\n width: 12px;\n margin-right: 5px;\n color: #5b646b;\n border-radius: 3px; }\n", ""]); // exports /***/ }), /***/ "./node_modules/css-loader/index.js!./node_modules/postcss-loader/index.js!./node_modules/sass-loader/lib/loader.js??ref--3-4!./src/force-directed-graph/force-directed-graph.component.scss": /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__("./node_modules/css-loader/lib/css-base.js")(false); // imports // module exports.push([module.i, ".force-directed-graph .edge {\n stroke: #333; }\n", ""]); // exports /***/ }), /***/ "./node_modules/css-loader/index.js!./node_modules/postcss-loader/index.js!./node_modules/sass-loader/lib/loader.js??ref--3-4!./src/gauge/gauge.component.scss": /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__("./node_modules/css-loader/lib/css-base.js")(false); // imports // module exports.push([module.i, ".gauge .background-arc path {\n fill: rgba(0, 0, 0, 0.05); }\n\n.gauge .gauge-tick path {\n stroke: #666; }\n\n.gauge .gauge-tick text {\n font-size: 12px;\n fill: #666;\n font-weight: bold; }\n\n.gauge .gauge-tick-large path {\n stroke-width: 2px; }\n\n.gauge .gauge-tick-small path {\n stroke-width: 1px; }\n", ""]); // exports /***/ }), /***/ "./node_modules/css-loader/index.js!./node_modules/postcss-loader/index.js!./node_modules/sass-loader/lib/loader.js??ref--3-4!./src/gauge/linear-gauge.component.scss": /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__("./node_modules/css-loader/lib/css-base.js")(false); // imports // module exports.push([module.i, ".linear-gauge {\n cursor: pointer; }\n .linear-gauge .background-bar path {\n fill: rgba(0, 0, 0, 0.05); }\n .linear-gauge .units {\n fill: #666; }\n", ""]); // exports /***/ }), /***/ "./node_modules/css-loader/index.js!./node_modules/postcss-loader/index.js!./node_modules/sass-loader/lib/loader.js??ref--3-4!./src/number-card/card.component.scss": /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__("./node_modules/css-loader/lib/css-base.js")(false); // imports // module exports.push([module.i, "ngx-charts-number-card .cell .trimmed-label {\n font-size: 12px;\n pointer-events: none;\n overflow: hidden;\n text-align: left;\n line-height: 1em; }\n ngx-charts-number-card .cell .trimmed-label p {\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n width: 100%;\n padding: 0;\n margin: 0; }\n\nngx-charts-number-card .cell .value-text {\n pointer-events: none; }\n\nngx-charts-number-card .number-card.clickable .cell .card, ngx-charts-number-card .number-card.clickable .cell .card-band {\n cursor: pointer; }\n", ""]); // exports /***/ }), /***/ "./node_modules/css-loader/index.js!./node_modules/postcss-loader/index.js!./node_modules/sass-loader/lib/loader.js??ref--3-4!./src/pie-chart/advanced-pie-chart.component.scss": /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__("./node_modules/css-loader/lib/css-base.js")(false); // imports // module exports.push([module.i, ".advanced-pie {\n display: inline-block;\n float: left; }\n\n.advanced-pie-legend-wrapper {\n display: inline-block; }\n", ""]); // exports /***/ }), /***/ "./node_modules/css-loader/index.js!./node_modules/postcss-loader/index.js!./node_modules/sass-loader/lib/loader.js??ref--3-4!./src/pie-chart/pie-chart.component.scss": /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__("./node_modules/css-loader/lib/css-base.js")(false); // imports // module exports.push([module.i, ".pie-label {\n font-size: 11px; }\n .pie-label.animation {\n -webkit-animation: 750ms ease-in fadeIn;\n animation: 750ms ease-in fadeIn; }\n\n@-webkit-keyframes fadeIn {\n from {\n opacity: 0; }\n to {\n opacity: 1; } }\n\n@keyframes fadeIn {\n from {\n opacity: 0; }\n to {\n opacity: 1; } }\n\n.pie-label-line {\n stroke-dasharray: 100%; }\n .pie-label-line.animation {\n -webkit-animation: 3s linear drawOut;\n animation: 3s linear drawOut;\n -webkit-transition: d 750ms;\n transition: d 750ms; }\n\n@-webkit-keyframes drawOut {\n from {\n stroke-dashoffset: 100%; }\n to {\n stroke-dashoffset: 0; } }\n\n@keyframes drawOut {\n from {\n stroke-dashoffset: 100%; }\n to {\n stroke-dashoffset: 0; } }\n", ""]); // exports /***/ }), /***/ "./node_modules/css-loader/index.js!./node_modules/postcss-loader/index.js!./node_modules/sass-loader/lib/loader.js??ref--3-4!./src/pie-chart/pie-grid.component.scss": /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__("./node_modules/css-loader/lib/css-base.js")(false); // imports // module exports.push([module.i, ".pie-grid .arc1 {\n opacity: 0.4; }\n\n.pie-grid .percent-label {\n font-size: 16px;\n font-weight: 400; }\n", ""]); // exports /***/ }), /***/ "./node_modules/css-loader/index.js!./node_modules/postcss-loader/index.js!./node_modules/sass-loader/lib/loader.js??ref--3-4!./src/polar-chart/polar-chart.component.scss": /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__("./node_modules/css-loader/lib/css-base.js")(false); // imports // module exports.push([module.i, ".polar-chart .polar-chart-background {\n fill: none; }\n\n.polar-chart .radial-gridline-path {\n stroke-dasharray: 10 10;\n fill: none; }\n\n.polar-chart .pie-label-line {\n stroke: #2f3646; }\n\n.polar-charts-series .polar-series-area {\n pointer-events: none; }\n\n.polar-series-path {\n pointer-events: none; }\n", ""]); // exports /***/ }), /***/ "./node_modules/css-loader/index.js!./node_modules/postcss-loader/index.js!./node_modules/sass-loader/lib/loader.js??ref--3-4!./src/tree-map/tree-map.component.scss": /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__("./node_modules/css-loader/lib/css-base.js")(false); // imports // module exports.push([module.i, ".tree-map .treemap-val {\n font-size: 1.3em;\n padding-top: 5px;\n display: inline-block; }\n\n.tree-map .label p {\n display: table-cell;\n text-align: center;\n line-height: 1.2em;\n vertical-align: middle; }\n", ""]); // exports /***/ }), /***/ "./node_modules/css-loader/lib/css-base.js": /***/ (function(module, exports) { /* MIT License http://www.opensource.org/licenses/mit-license.php Author Tobias Koppers @sokra */ // css base code, injected by the css-loader module.exports = function(useSourceMap) { var list = []; // return the list of modules as css string list.toString = function toString() { return this.map(function (item) { var content = cssWithMappingToString(item, useSourceMap); if(item[2]) { return "@media " + item[2] + "{" + content + "}"; } else { return content; } }).join(""); }; // import a list of modules into the list list.i = function(modules, mediaQuery) { if(typeof modules === "string") modules = [[null, modules, ""]]; var alreadyImportedModules = {}; for(var i = 0; i < this.length; i++) { var id = this[i][0]; if(typeof id === "number") alreadyImportedModules[id] = true; } for(i = 0; i < modules.length; i++) { var item = modules[i]; // skip already imported module // this implementation is not 100% perfect for weird media query combinations // when a module is imported multiple times with different media queries. // I hope this will never occur (Hey this way we have smaller bundles) if(typeof item[0] !== "number" || !alreadyImportedModules[item[0]]) { if(mediaQuery && !item[2]) { item[2] = mediaQuery; } else if(mediaQuery) { item[2] = "(" + item[2] + ") and (" + mediaQuery + ")"; } list.push(item); } } }; return list; }; function cssWithMappingToString(item, useSourceMap) { var content = item[1] || ''; var cssMapping = item[3]; if (!cssMapping) { return content; } if (useSourceMap && typeof btoa === 'function') { var sourceMapping = toComment(cssMapping); var sourceURLs = cssMapping.sources.map(function (source) { return '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */' }); return [content].concat(sourceURLs).concat([sourceMapping]).join('\n'); } return [content].join('\n'); } // Adapted from convert-source-map (MIT) function toComment(sourceMap) { // eslint-disable-next-line no-undef var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))); var data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64; return '/*# ' + data + ' */'; } /***/ }), /***/ "./node_modules/rxjs/Observable.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; var root_1 = __webpack_require__("./node_modules/rxjs/util/root.js"); var toSubscriber_1 = __webpack_require__("./node_modules/rxjs/util/toSubscriber.js"); var observable_1 = __webpack_require__("./node_modules/rxjs/symbol/observable.js"); var pipe_1 = __webpack_require__("./node_modules/rxjs/util/pipe.js"); /** * A representation of any set of values over any amount of time. This is the most basic building block * of RxJS. * * @class Observable<T> */ var Observable = (function () { /** * @constructor * @param {Function} subscribe the function that is called when the Observable is * initially subscribed to. This function is given a Subscriber, to which new values * can be `next`ed, or an `error` method can be called to raise an error, or * `complete` can be called to notify of a successful completion. */ function Observable(subscribe) { this._isScalar = false; if (subscribe) { this._subscribe = subscribe; } } /** * Creates a new Observable, with this Observable as the source, and the passed * operator defined as the new observable's operator. * @method lift * @param {Operator} operator the operator defining the operation to take on the observable * @return {Observable} a new observable with the Operator applied */ Observable.prototype.lift = function (operator) { var observable = new Observable(); observable.source = this; observable.operator = operator; return observable; }; /** * Invokes an execution of an Observable and registers Observer handlers for notifications it will emit. * * <span class="informal">Use it when you have all these Observables, but still nothing is happening.</span> * * `subscribe` is not a regular operator, but a method that calls Observable's internal `subscribe` function. It * might be for example a function that you passed to a {@link create} static factory, but most of the time it is * a library implementation, which defines what and when will be emitted by an Observable. This means that calling * `subscribe` is actually the moment when Observable starts its work, not when it is created, as it is often * thought. * * Apart from starting the execution of an Observable, this method allows you to listen for values * that an Observable emits, as well as for when it completes or errors. You can achieve this in two * following ways. * * The first way is creating an object that implements {@link Observer} interface. It should have methods * defined by that interface, but note that it should be just a regular JavaScript object, which you can create * yourself in any way you want (ES6 class, classic function constructor, object literal etc.). In particular do * not attempt to use any RxJS implementation details to create Observers - you don't need them. Remember also * that your object does not have to implement all methods. If you find yourself creating a method that doesn't * do anything, you can simply omit it. Note however, that if `error` method is not provided, all errors will * be left uncaught. * * The second way is to give up on Observer object altogether and simply provide callback functions in place of its methods. * This means you can provide three functions as arguments to `subscribe`, where first function is equivalent * of a `next` method, second of an `error` method and third of a `complete` method. Just as in case of Observer, * if you do not need to listen for something, you can omit a function, preferably by passing `undefined` or `null`, * since `subscribe` recognizes these functions by where they were placed in function call. When it comes * to `error` function, just as before, if not provided, errors emitted by an Observable will be thrown. * * Whatever style of calling `subscribe` you use, in both cases it returns a Subscription object. * This object allows you to call `unsubscribe` on it, which in turn will stop work that an Observable does and will clean * up all resources that an Observable used. Note that cancelling a subscription will not call `complete` callback * provided to `subscribe` function, which is reserved for a regular completion signal that comes from an Observable. * * Remember that callbacks provided to `subscribe` are not guaranteed to be called asynchronously. * It is an Observable itself that decides when these functions will be called. For example {@link of} * by default emits all its values synchronously. Always check documentation for how given Observable * will behave when subscribed and if its default behavior can be modified with a {@link Scheduler}. * * @example <caption>Subscribe with an Observer</caption> * const sumObserver = { * sum: 0, * next(value) { * console.log('Adding: ' + value); * this.sum = this.sum + value; * }, * error() { // We actually could just remove this method, * }, // since we do not really care about errors right now. * complete() { * console.log('Sum equals: ' + this.sum); * } * }; * * Rx.Observable.of(1, 2, 3) // Synchronously emits 1, 2, 3 and then completes. * .subscribe(sumObserver); * * // Logs: * // "Adding: 1" * // "Adding: 2" * // "Adding: 3" * // "Sum equals: 6" * * * @example <caption>Subscribe with functions</caption> * let sum = 0; * * Rx.Observable.of(1, 2, 3) * .subscribe( * function(value) { * console.log('Adding: ' + value); * sum = sum + value; * }, * undefined, * function() { * console.log('Sum equals: ' + sum); * } * ); * * // Logs: * // "Adding: 1" * // "Adding: 2" * // "Adding: 3" * // "Sum equals: 6" * * * @example <caption>Cancel a subscription</caption> * const subscription = Rx.Observable.interval(1000).subscribe( * num => console.log(num), * undefined, * () => console.log('completed!') // Will not be called, even * ); // when cancelling subscription * * * setTimeout(() => { * subscription.unsubscribe(); * console.log('unsubscribed!'); * }, 2500); * * // Logs: * // 0 after 1s * // 1 after 2s * // "unsubscribed!" after 2.5s * * * @param {Observer|Function} observerOrNext (optional) Either an observer with methods to be called, * or the first of three possible handlers, which is the handler for each value emitted from the subscribed * Observable. * @param {Function} error (optional) A handler for a terminal event resulting from an error. If no error handler is provided, * the error will be thrown as unhandled. * @param {Function} complete (optional) A handler for a terminal event resulting from successful completion. * @return {ISubscription} a subscription reference to the registered handlers * @method subscribe */ Observable.prototype.subscribe = function (observerOrNext, error, complete) { var operator = this.operator; var sink = toSubscriber_1.toSubscriber(observerOrNext, error, complete); if (operator) { operator.call(sink, this.source); } else { sink.add(this.source || !sink.syncErrorThrowable ? this._subscribe(sink) : this._trySubscribe(sink)); } if (sink.syncErrorThrowable) { sink.syncErrorThrowable = false; if (sink.syncErrorThrown) { throw sink.syncErrorValue; } } return sink; }; Observable.prototype._trySubscribe = function (sink) { try { return this._subscribe(sink); } catch (err) { sink.syncErrorThrown = true; sink.syncErrorValue = err; sink.error(err); } }; /** * @method forEach * @param {Function} next a handler for each value emitted by the observable * @param {PromiseConstructor} [PromiseCtor] a constructor function used to instantiate the Promise * @return {Promise} a promise that either resolves on observable completion or * rejects with the handled error */ Observable.prototype.forEach = function (next, PromiseCtor) { var _this = this; if (!PromiseCtor) { if (root_1.root.Rx && root_1.root.Rx.config && root_1.root.Rx.config.Promise) { PromiseCtor = root_1.root.Rx.config.Promise; } else if (root_1.root.Promise) { PromiseCtor = root_1.root.Promise; } } if (!PromiseCtor) { throw new Error('no Promise impl found'); } return new PromiseCtor(function (resolve, reject) { // Must be declared in a separate statement to avoid a RefernceError when // accessing subscription below in the closure due to Temporal Dead Zone. var subscription; subscription = _this.subscribe(function (value) { if (subscription) { // if there is a subscription, then we can surmise // the next handling is asynchronous. Any errors thrown // need to be rejected explicitly and unsubscribe must be // called manually try { next(value); } catch (err) { reject(err); subscription.unsubscribe(); } } else { // if there is NO subscription, then we're getting a nexted // value synchronously during subscription. We can just call it. // If it errors, Observable's `subscribe` will ensure the // unsubscription logic is called, then synchronously rethrow the error. // After that, Promise will trap the error and send it // down the rejection path. next(value); } }, reject, resolve); }); }; /** @deprecated internal use only */ Observable.prototype._subscribe = function (subscriber) { return this.source.subscribe(subscriber); }; /** * An interop point defined by the es7-observable spec https://github.com/zenparsing/es-observable * @method Symbol.observable * @return {Observable} this instance of the observable */ Observable.prototype[observable_1.observable] = function () { return this; }; /* tslint:enable:max-line-length */ /** * Used to stitch together functional operators into a chain. * @method pipe * @return {Observable} the Observable result of all of the operators having * been called in the order they were passed in. * * @example * * import { map, filter, scan } from 'rxjs/operators'; * * Rx.Observable.interval(1000) * .pipe( * filter(x => x % 2 === 0), * map(x => x + x), * scan((acc, x) => acc + x) * ) * .subscribe(x => console.log(x)) */ Observable.prototype.pipe = function () { var operations = []; for (var _i = 0; _i < arguments.length; _i++) { operations[_i - 0] = arguments[_i]; } if (operations.length === 0) { return this; } return pipe_1.pipeFromArray(operations)(this); }; /* tslint:enable:max-line-length */ Observable.prototype.toPromise = function (PromiseCtor) { var _this = this; if (!PromiseCtor) { if (root_1.root.Rx && root_1.root.Rx.config && root_1.root.Rx.config.Promise) { PromiseCtor = root_1.root.Rx.config.Promise; } else if (root_1.root.Promise) { PromiseCtor = root_1.root.Promise; } } if (!PromiseCtor) { throw new Error('no Promise impl found'); } return new PromiseCtor(function (resolve, reject) { var value; _this.subscribe(function (x) { return value = x; }, function (err) { return reject(err); }, function () { return resolve(value); }); }); }; // HACK: Since TypeScript inherits static properties too, we have to // fight against TypeScript here so Subject can have a different static create signature /** * Creates a new cold Observable by calling the Observable constructor * @static true * @owner Observable * @method create * @param {Function} subscribe? the subscriber function to be passed to the Observable constructor * @return {Observable} a new cold observable */ Observable.create = function (subscribe) { return new Observable(subscribe); }; return Observable; }()); exports.Observable = Observable; //# sourceMappingURL=Observable.js.map /***/ }), /***/ "./node_modules/rxjs/Observer.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.empty = { closed: true, next: function (value) { }, error: function (err) { throw err; }, complete: function () { } }; //# sourceMappingURL=Observer.js.map /***/ }), /***/ "./node_modules/rxjs/Scheduler.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * An execution context and a data structure to order tasks and schedule their * execution. Provides a notion of (potentially virtual) time, through the * `now()` getter method. * * Each unit of work in a Scheduler is called an {@link Action}. * * ```ts * class Scheduler { * now(): number; * schedule(work, delay?, state?): Subscription; * } * ``` * * @class Scheduler */ var Scheduler = (function () { function Scheduler(SchedulerAction, now) { if (now === void 0) { now = Scheduler.now; } this.SchedulerAction = SchedulerAction; this.now = now; } /** * Schedules a function, `work`, for execution. May happen at some point in * the future, according to the `delay` parameter, if specified. May be passed * some context object, `state`, which will be passed to the `work` function. * * The given arguments will be processed an stored as an Action object in a * queue of actions. * * @param {function(state: ?T): ?Subscription} work A function representing a * task, or some unit of work to be executed by the Scheduler. * @param {number} [delay] Time to wait before executing the work, where the * time unit is implicit and defined by the Scheduler itself. * @param {T} [state] Some contextual data that the `work` function uses when * called by the Scheduler. * @return {Subscription} A subscription in order to be able to unsubscribe * the scheduled work. */ Scheduler.prototype.schedule = function (work, delay, state) { if (delay === void 0) { delay = 0; } return new this.SchedulerAction(this, work).schedule(state, delay); }; Scheduler.now = Date.now ? Date.now : function () { return +new Date(); }; return Scheduler; }()); exports.Scheduler = Scheduler; //# sourceMappingURL=Scheduler.js.map /***/ }), /***/ "./node_modules/rxjs/Subscriber.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; var isFunction_1 = __webpack_require__("./node_modules/rxjs/util/isFunction.js"); var Subscription_1 = __webpack_require__("./node_modules/rxjs/Subscription.js"); var Observer_1 = __webpack_require__("./node_modules/rxjs/Observer.js"); var rxSubscriber_1 = __webpack_require__("./node_modules/rxjs/symbol/rxSubscriber.js"); /** * Implements the {@link Observer} interface and extends the * {@link Subscription} class. While the {@link Observer} is the public API for * consuming the values of an {@link Observable}, all Observers get converted to * a Subscriber, in order to provide Subscription-like capabilities such as * `unsubscribe`. Subscriber is a common type in RxJS, and crucial for * implementing operators, but it is rarely used as a public API. * * @class Subscriber<T> */ var Subscriber = (function (_super) { __extends(Subscriber, _super); /** * @param {Observer|function(value: T): void} [destinationOrNext] A partially * defined Observer or a `next` callback function. * @param {function(e: ?any): void} [error] The `error` callback of an * Observer. * @param {function(): void} [complete] The `complete` callback of an * Observer. */ function Subscriber(destinationOrNext, error, complete) { _super.call(this); this.syncErrorValue = null; this.syncErrorThrown = false; this.syncErrorThrowable = false; this.isStopped = false; switch (arguments.length) { case 0: this.destination = Observer_1.empty; break; case 1: if (!destinationOrNext) { this.destination = Observer_1.empty; break; } if (typeof destinationOrNext === 'object') { // HACK(benlesh): To resolve an issue where Node users may have multiple // copies of rxjs in their node_modules directory. if (isTrustedSubscriber(destinationOrNext)) { var trustedSubscriber = destinationOrNext[rxSubscriber_1.rxSubscriber](); this.syncErrorThrowable = trustedSubscriber.syncErrorThrowable; this.destination = trustedSubscriber; trustedSubscriber.add(this); } else { this.syncErrorThrowable = true; this.destination = new SafeSubscriber(this, destinationOrNext); } break; } default: this.syncErrorThrowable = true; this.destination = new SafeSubscriber(this, destinationOrNext, error, complete); break; } } Subscriber.prototype[rxSubscriber_1.rxSubscriber] = function () { return this; }; /** * A static factory for a Subscriber, given a (potentially partial) definition * of an Observer. * @param {function(x: ?T): void} [next] The `next` callback of an Observer. * @param {function(e: ?any): void} [error] The `error` callback of an * Observer. * @param {function(): void} [complete] The `complete` callback of an * Observer. * @return {Subscriber<T>} A Subscriber wrapping the (partially defined) * Observer represented by the given arguments. */ Subscriber.create = function (next, error, complete) { var subscriber = new Subscriber(next, error, complete); subscriber.syncErrorThrowable = false; return subscriber; }; /** * The {@link Observer} callback to receive notifications of type `next` from * the Observable, with a value. The Observable may call this method 0 or more * times. * @param {T} [value] The `next` value. * @return {void} */ Subscriber.prototype.next = function (value) { if (!this.isStopped) { this._next(value); } }; /** * The {@link Observer} callback to receive notifications of type `error` from * the Observable, with an attached {@link Error}. Notifies the Observer that * the Observable has experienced an error condition. * @param {any} [err] The `error` exception. * @return {void} */ Subscriber.prototype.error = function (err) { if (!this.isStopped) { this.isStopped = true; this._error(err); } }; /** * The {@link Observer} callback to receive a valueless notification of type * `complete` from the Observable. Notifies the Observer that the Observable * has finished sending push-based notifications. * @return {void} */ Subscriber.prototype.complete = function () { if (!this.isStopped) { this.isStopped = true; this._complete(); } }; Subscriber.prototype.unsubscribe = function () { if (this.closed) { return; } this.isStopped = true; _super.prototype.unsubscribe.call(this); }; Subscriber.prototype._next = function (value) { this.destination.next(value); }; Subscriber.prototype._error = function (err) { this.destination.error(err); this.unsubscribe(); }; Subscriber.prototype._complete = function () { this.destination.complete(); this.unsubscribe(); }; /** @deprecated internal use only */ Subscriber.prototype._unsubscribeAndRecycle = function () { var _a = this, _parent = _a._parent, _parents = _a._parents; this._parent = null; this._parents = null; this.unsubscribe(); this.closed = false; this.isStopped = false; this._parent = _parent; this._parents = _parents; return this; }; return Subscriber; }(Subscription_1.Subscription)); exports.Subscriber = Subscriber; /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var SafeSubscriber = (function (_super) { __extends(SafeSubscriber, _super); function SafeSubscriber(_parentSubscriber, observerOrNext, error, complete) { _super.call(this); this._parentSubscriber = _parentSubscriber; var next; var context = this; if (isFunction_1.isFunction(observerOrNext)) { next = observerOrNext; } else if (observerOrNext) { next = observerOrNext.next; error = observerOrNext.error; complete = observerOrNext.complete; if (observerOrNext !== Observer_1.empty) { context = Object.create(observerOrNext); if (isFunction_1.isFunction(context.unsubscribe)) { this.add(context.unsubscribe.bind(context)); } context.unsubscribe = this.unsubscribe.bind(this); } } this._context = context; this._next = next; this._error = error; this._complete = complete; } SafeSubscriber.prototype.next = function (value) { if (!this.isStopped && this._next) { var _parentSubscriber = this._parentSubscriber; if (!_parentSubscriber.syncErrorThrowable) { this.__tryOrUnsub(this._next, value); } else if (this.__tryOrSetError(_parentSubscriber, this._next, value)) { this.unsubscribe(); } } }; SafeSubscriber.prototype.error = function (err) { if (!this.isStopped) { var _parentSubscriber = this._parentSubscriber; if (this._error) { if (!_parentSubscriber.syncErrorThrowable) { this.__tryOrUnsub(this._error, err); this.unsubscribe(); } else { this.__tryOrSetError(_parentSubscriber, this._error, err); this.unsubscribe(); } } else if (!_parentSubscriber.syncErrorThrowable) { this.unsubscribe(); throw err; } else { _parentSubscriber.syncErrorValue = err; _parentSubscriber.syncErrorThrown = true; this.unsubscribe(); } } }; SafeSubscriber.prototype.complete = function () { var _this = this; if (!this.isStopped) { var _parentSubscriber = this._parentSubscriber; if (this._complete) { var wrappedComplete = function () { return _this._complete.call(_this._context); }; if (!_parentSubscriber.syncErrorThrowable) { this.__tryOrUnsub(wrappedComplete); this.unsubscribe(); } else { this.__tryOrSetError(_parentSubscriber, wrappedComplete); this.unsubscribe(); } } else { this.unsubscribe(); } } }; SafeSubscriber.prototype.__tryOrUnsub = function (fn, value) { try { fn.call(this._context, value); } catch (err) { this.unsubscribe(); throw err; } }; SafeSubscriber.prototype.__tryOrSetError = function (parent, fn, value) { try { fn.call(this._context, value); } catch (err) { parent.syncErrorValue = err; parent.syncErrorThrown = true; return true; } return false; }; /** @deprecated internal use only */ SafeSubscriber.prototype._unsubscribe = function () { var _parentSubscriber = this._parentSubscriber; this._context = null; this._parentSubscriber = null; _parentSubscriber.unsubscribe(); }; return SafeSubscriber; }(Subscriber)); function isTrustedSubscriber(obj) { return obj instanceof Subscriber || ('syncErrorThrowable' in obj && obj[rxSubscriber_1.rxSubscriber]); } //# sourceMappingURL=Subscriber.js.map /***/ }), /***/ "./node_modules/rxjs/Subscription.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; var isArray_1 = __webpack_require__("./node_modules/rxjs/util/isArray.js"); var isObject_1 = __webpack_require__("./node_modules/rxjs/util/isObject.js"); var isFunction_1 = __webpack_require__("./node_modules/rxjs/util/isFunction.js"); var tryCatch_1 = __webpack_require__("./node_modules/rxjs/util/tryCatch.js"); var errorObject_1 = __webpack_require__("./node_modules/rxjs/util/errorObject.js"); var UnsubscriptionError_1 = __webpack_require__("./node_modules/rxjs/util/UnsubscriptionError.js"); /** * Represents a disposable resource, such as the execution of an Observable. A * Subscription has one important method, `unsubscribe`, that takes no argument * and just disposes the resource held by the subscription. * * Additionally, subscriptions may be grouped together through the `add()` * method, which will attach a child Subscription to the current Subscription. * When a Subscription is unsubscribed, all its children (and its grandchildren) * will be unsubscribed as well. * * @class Subscription */ var Subscription = (function () { /** * @param {function(): void} [unsubscribe] A function describing how to * perform the disposal of resources when the `unsubscribe` method is called. */ function Subscription(unsubscribe) { /** * A flag to indicate whether this Subscription has already been unsubscribed. * @type {boolean} */ this.closed = false; this._parent = null; this._parents = null; this._subscriptions = null; if (unsubscribe) { this._unsubscribe = unsubscribe; } } /** * Disposes the resources held by the subscription. May, for instance, cancel * an ongoing Observable execution or cancel any other type of work that * started when the Subscription was created. * @return {void} */ Subscription.prototype.unsubscribe = function () { var hasErrors = false; var errors; if (this.closed) { return; } var _a = this, _parent = _a._parent, _parents = _a._parents, _unsubscribe = _a._unsubscribe, _subscriptions = _a._subscriptions; this.closed = true; this._parent = null; this._parents = null; // null out _subscriptions first so any child subscriptions that attempt // to remove themselves from this subscription will noop this._subscriptions = null; var index = -1; var len = _parents ? _parents.length : 0; // if this._parent is null, then so is this._parents, and we // don't have to remove ourselves from any parent subscriptions. while (_parent) { _parent.remove(this); // if this._parents is null or index >= len, // then _parent is set to null, and the loop exits _parent = ++index < len && _parents[index] || null; } if (isFunction_1.isFunction(_unsubscribe)) { var trial = tryCatch_1.tryCatch(_unsubscribe).call(this); if (trial === errorObject_1.errorObject) { hasErrors = true; errors = errors || (errorObject_1.errorObject.e instanceof UnsubscriptionError_1.UnsubscriptionError ? flattenUnsubscriptionErrors(errorObject_1.errorObject.e.errors) : [errorObject_1.errorObject.e]); } } if (isArray_1.isArray(_subscriptions)) { index = -1; len = _subscriptions.length; while (++index < len) { var sub = _subscriptions[index]; if (isObject_1.isObject(sub)) { var trial = tryCatch_1.tryCatch(sub.unsubscribe).call(sub); if (trial === errorObject_1.errorObject) { hasErrors = true; errors = errors || []; var err = errorObject_1.errorObject.e; if (err instanceof UnsubscriptionError_1.UnsubscriptionError) { errors = errors.concat(flattenUnsubscriptionErrors(err.errors)); } else { errors.push(err); } } } } } if (hasErrors) { throw new UnsubscriptionError_1.UnsubscriptionError(errors); } }; /** * Adds a tear down to be called during the unsubscribe() of this * Subscription. * * If the tear down being added is a subscription that is already * unsubscribed, is the same reference `add` is being called on, or is * `Subscription.EMPTY`, it will not be added. * * If this subscription is already in an `closed` state, the passed * tear down logic will be executed immediately. * * @param {TeardownLogic} teardown The additional logic to execute on * teardown. * @return {Subscription} Returns the Subscription used or created to be * added to the inner subscriptions list. This Subscription can be used with * `remove()` to remove the passed teardown logic from the inner subscriptions * list. */ Subscription.prototype.add = function (teardown) { if (!teardown || (teardown === Subscription.EMPTY)) { return Subscription.EMPTY; } if (teardown === this) { return this; } var subscription = teardown; switch (typeof teardown) { case 'function': subscription = new Subscription(teardown); case 'object': if (subscription.closed || typeof subscription.unsubscribe !== 'function') { return subscription; } else if (this.closed) { subscription.unsubscribe(); return subscription; } else if (typeof subscription._addParent !== 'function' /* quack quack */) { var tmp = subscription; subscription = new Subscription(); subscription._subscriptions = [tmp]; } break; default: throw new Error('unrecognized teardown ' + teardown + ' added to Subscription.'); } var subscriptions = this._subscriptions || (this._subscriptions = []); subscriptions.push(subscription); subscription._addParent(this); return subscription; }; /** * Removes a Subscription from the internal list of subscriptions that will * unsubscribe during the unsubscribe process of this Subscription. * @param {Subscription} subscription The subscription to remove. * @return {void} */ Subscription.prototype.remove = function (subscription) { var subscriptions = this._subscriptions; if (subscriptions) { var subscriptionIndex = subscriptions.indexOf(subscription); if (subscriptionIndex !== -1) { subscriptions.splice(subscriptionIndex, 1); } } }; Subscription.prototype._addParent = function (parent) { var _a = this, _parent = _a._parent, _parents = _a._parents; if (!_parent || _parent === parent) { // If we don't have a parent, or the new parent is the same as the // current parent, then set this._parent to the new parent. this._parent = parent; } else if (!_parents) { // If there's already one parent, but not multiple, allocate an Array to // store the rest of the parent Subscriptions. this._parents = [parent]; } else if (_parents.indexOf(parent) === -1) { // Only add the new parent to the _parents list if it's not already there. _parents.push(parent); } }; Subscription.EMPTY = (function (empty) { empty.closed = true; return empty; }(new Subscription())); return Subscription; }()); exports.Subscription = Subscription; function flattenUnsubscriptionErrors(errors) { return errors.reduce(function (errs, err) { return errs.concat((err instanceof UnsubscriptionError_1.UnsubscriptionError) ? err.errors : err); }, []); } //# sourceMappingURL=Subscription.js.map /***/ }), /***/ "./node_modules/rxjs/observable/FromEventObservable.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; var Observable_1 = __webpack_require__("./node_modules/rxjs/Observable.js"); var tryCatch_1 = __webpack_require__("./node_modules/rxjs/util/tryCatch.js"); var isFunction_1 = __webpack_require__("./node_modules/rxjs/util/isFunction.js"); var errorObject_1 = __webpack_require__("./node_modules/rxjs/util/errorObject.js"); var Subscription_1 = __webpack_require__("./node_modules/rxjs/Subscription.js"); var toString = Object.prototype.toString; function isNodeStyleEventEmitter(sourceObj) { return !!sourceObj && typeof sourceObj.addListener === 'function' && typeof sourceObj.removeListener === 'function'; } function isJQueryStyleEventEmitter(sourceObj) { return !!sourceObj && typeof sourceObj.on === 'function' && typeof sourceObj.off === 'function'; } function isNodeList(sourceObj) { return !!sourceObj && toString.call(sourceObj) === '[object NodeList]'; } function isHTMLCollection(sourceObj) { return !!sourceObj && toString.call(sourceObj) === '[object HTMLCollection]'; } function isEventTarget(sourceObj) { return !!sourceObj && typeof sourceObj.addEventListener === 'function' && typeof sourceObj.removeEventListener === 'function'; } /** * We need this JSDoc comment for affecting ESDoc. * @extends {Ignored} * @hide true */ var FromEventObservable = (function (_super) { __extends(FromEventObservable, _super); function FromEventObservable(sourceObj, eventName, selector, options) { _super.call(this); this.sourceObj = sourceObj; this.eventName = eventName; this.selector = selector; this.options = options; } /* tslint:enable:max-line-length */ /** * Creates an Observable that emits events of a specific type coming from the * given event target. * * <span class="informal">Creates an Observable from DOM events, or Node.js * EventEmitter events or others.</span> * * <img src="./img/fromEvent.png" width="100%"> * * `fromEvent` accepts as a first argument event target, which is an object with methods * for registering event handler functions. As a second argument it takes string that indicates * type of event we want to listen for. `fromEvent` supports selected types of event targets, * which are described in detail below. If your event target does not match any of the ones listed, * you should use {@link fromEventPattern}, which can be used on arbitrary APIs. * When it comes to APIs supported by `fromEvent`, their methods for adding and removing event * handler functions have different names, but they all accept a string describing event type * and function itself, which will be called whenever said event happens. * * Every time resulting Observable is subscribed, event handler function will be registered * to event target on given event type. When that event fires, value * passed as a first argument to registered function will be emitted by output Observable. * When Observable is unsubscribed, function will be unregistered from event target. * * Note that if event target calls registered function with more than one argument, second * and following arguments will not appear in resulting stream. In order to get access to them, * you can pass to `fromEvent` optional project function, which will be called with all arguments * passed to event handler. Output Observable will then emit value returned by project function, * instead of the usual value. * * Remember that event targets listed below are checked via duck typing. It means that * no matter what kind of object you have and no matter what environment you work in, * you can safely use `fromEvent` on that object if it exposes described methods (provided * of course they behave as was described above). So for example if Node.js library exposes * event target which has the same method names as DOM EventTarget, `fromEvent` is still * a good choice. * * If the API you use is more callback then event handler oriented (subscribed * callback function fires only once and thus there is no need to manually * unregister it), you should use {@link bindCallback} or {@link bindNodeCallback} * instead. * * `fromEvent` supports following types of event targets: * * **DOM EventTarget** * * This is an object with `addEventListener` and `removeEventListener` methods. * * In the browser, `addEventListener` accepts - apart from event type string and event * handler function arguments - optional third parameter, which is either an object or boolean, * both used for additional configuration how and when passed function will be called. When * `fromEvent` is used with event target of that type, you can provide this values * as third parameter as well. * * **Node.js EventEmitter** * * An object with `addListener` and `removeListener` methods. * * **JQuery-style event target** * * An object with `on` and `off` methods * * **DOM NodeList** * * List of DOM Nodes, returned for example by `document.querySelectorAll` or `Node.childNodes`. * * Although this collection is not event target in itself, `fromEvent` will iterate over all Nodes * it contains and install event handler function in every of them. When returned Observable * is unsubscribed, function will be removed from all Nodes. * * **DOM HtmlCollection** * * Just as in case of NodeList it is a collection of DOM nodes. Here as well event handler function is * installed and removed in each of elements. * * * @example <caption>Emits clicks happening on the DOM document</caption> * var clicks = Rx.Observable.fromEvent(document, 'click'); * clicks.subscribe(x => console.log(x)); * * // Results in: * // MouseEvent object logged to console every time a click * // occurs on the document. * * * @example <caption>Use addEventListener with capture option</caption> * var clicksInDocument = Rx.Observable.fromEvent(document, 'click', true); // note optional configuration parameter * // which will be passed to addEventListener * var clicksInDiv = Rx.Observable.fromEvent(someDivInDocument, 'click'); * * clicksInDocument.subscribe(() => console.log('document')); * clicksInDiv.subscribe(() => console.log('div')); * * // By default events bubble UP in DOM tree, so normally * // when we would click on div in document * // "div" would be logged first and then "document". * // Since we specified optional `capture` option, document * // will catch event when it goes DOWN DOM tree, so console * // will log "document" and then "div". * * @see {@link bindCallback} * @see {@link bindNodeCallback} * @see {@link fromEventPattern} * * @param {EventTargetLike} target The DOM EventTarget, Node.js * EventEmitter, JQuery-like event target, NodeList or HTMLCollection to attach the event handler to. * @param {string} eventName The event name of interest, being emitted by the * `target`. * @param {EventListenerOptions} [options] Options to pass through to addEventListener * @param {SelectorMethodSignature<T>} [selector] An optional function to * post-process results. It takes the arguments from the event handler and * should return a single value. * @return {Observable<T>} * @static true * @name fromEvent * @owner Observable */ FromEventObservable.create = function (target, eventName, options, selector) { if (isFunction_1.isFunction(options)) { selector = options; options = undefined; } return new FromEventObservable(target, eventName, selector, options); }; FromEventObservable.setupSubscription = function (sourceObj, eventName, handler, subscriber, options) { var unsubscribe; if (isNodeList(sourceObj) || isHTMLCollection(sourceObj)) { for (var i = 0, len = sourceObj.length; i < len; i++) { FromEventObservable.setupSubscription(sourceObj[i], eventName, handler, subscriber, options); } } else if (isEventTarget(sourceObj)) { var source_1 = sourceObj; sourceObj.addEventListener(eventName, handler, options); unsubscribe = function () { return source_1.removeEventListener(eventName, handler, options); }; } else if (isJQueryStyleEventEmitter(sourceObj)) { var source_2 = sourceObj; sourceObj.on(eventName, handler); unsubscribe = function () { return source_2.off(eventName, handler); }; } else if (isNodeStyleEventEmitter(sourceObj)) { var source_3 = sourceObj; sourceObj.addListener(eventName, handler); unsubscribe = function () { return source_3.removeListener(eventName, handler); }; } else { throw new TypeError('Invalid event target'); } subscriber.add(new Subscription_1.Subscription(unsubscribe)); }; /** @deprecated internal use only */ FromEventObservable.prototype._subscribe = function (subscriber) { var sourceObj = this.sourceObj; var eventName = this.eventName; var options = this.options; var selector = this.selector; var handler = selector ? function () { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i - 0] = arguments[_i]; } var result = tryCatch_1.tryCatch(selector).apply(void 0, args); if (result === errorObject_1.errorObject) { subscriber.error(errorObject_1.errorObject.e); } else { subscriber.next(result); } } : function (e) { return subscriber.next(e); }; FromEventObservable.setupSubscription(sourceObj, eventName, handler, subscriber, options); }; return FromEventObservable; }(Observable_1.Observable)); exports.FromEventObservable = FromEventObservable; //# sourceMappingURL=FromEventObservable.js.map /***/ }), /***/ "./node_modules/rxjs/observable/fromEvent.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; var FromEventObservable_1 = __webpack_require__("./node_modules/rxjs/observable/FromEventObservable.js"); exports.fromEvent = FromEventObservable_1.FromEventObservable.create; //# sourceMappingURL=fromEvent.js.map /***/ }), /***/ "./node_modules/rxjs/operators/debounceTime.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; var Subscriber_1 = __webpack_require__("./node_modules/rxjs/Subscriber.js"); var async_1 = __webpack_require__("./node_modules/rxjs/scheduler/async.js"); /** * Emits a value from the source Observable only after a particular time span * has passed without another source emission. * * <span class="informal">It's like {@link delay}, but passes only the most * recent value from each burst of emissions.</span> * * <img src="./img/debounceTime.png" width="100%"> * * `debounceTime` delays values emitted by the source Observable, but drops * previous pending delayed emissions if a new value arrives on the source * Observable. This operator keeps track of the most recent value from the * source Observable, and emits that only when `dueTime` enough time has passed * without any other value appearing on the source Observable. If a new value * appears before `dueTime` silence occurs, the previous value will be dropped * and will not be emitted on the output Observable. * * This is a rate-limiting operator, because it is impossible for more than one * value to be emitted in any time window of duration `dueTime`, but it is also * a delay-like operator since output emissions do not occur at the same time as * they did on the source Observable. Optionally takes a {@link IScheduler} for * managing timers. * * @example <caption>Emit the most recent click after a burst of clicks</caption> * var clicks = Rx.Observable.fromEvent(document, 'click'); * var result = clicks.debounceTime(1000); * result.subscribe(x => console.log(x)); * * @see {@link auditTime} * @see {@link debounce} * @see {@link delay} * @see {@link sampleTime} * @see {@link throttleTime} * * @param {number} dueTime The timeout duration in milliseconds (or the time * unit determined internally by the optional `scheduler`) for the window of * time required to wait for emission silence before emitting the most recent * source value. * @param {Scheduler} [scheduler=async] The {@link IScheduler} to use for * managing the timers that handle the timeout for each value. * @return {Observable} An Observable that delays the emissions of the source * Observable by the specified `dueTime`, and may drop some values if they occur * too frequently. * @method debounceTime * @owner Observable */ function debounceTime(dueTime, scheduler) { if (scheduler === void 0) { scheduler = async_1.async; } return function (source) { return source.lift(new DebounceTimeOperator(dueTime, scheduler)); }; } exports.debounceTime = debounceTime; var DebounceTimeOperator = (function () { function DebounceTimeOperator(dueTime, scheduler) { this.dueTime = dueTime; this.scheduler = scheduler; } DebounceTimeOperator.prototype.call = function (subscriber, source) { return source.subscribe(new DebounceTimeSubscriber(subscriber, this.dueTime, this.scheduler)); }; return DebounceTimeOperator; }()); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var DebounceTimeSubscriber = (function (_super) { __extends(DebounceTimeSubscriber, _super); function DebounceTimeSubscriber(destination, dueTime, scheduler) { _super.call(this, destination); this.dueTime = dueTime; this.scheduler = scheduler; this.debouncedSubscription = null; this.lastValue = null; this.hasValue = false; } DebounceTimeSubscriber.prototype._next = function (value) { this.clearDebounce(); this.lastValue = value; this.hasValue = true; this.add(this.debouncedSubscription = this.scheduler.schedule(dispatchNext, this.dueTime, this)); }; DebounceTimeSubscriber.prototype._complete = function () { this.debouncedNext(); this.destination.complete(); }; DebounceTimeSubscriber.prototype.debouncedNext = function () { this.clearDebounce(); if (this.hasValue) { this.destination.next(this.lastValue); this.lastValue = null; this.hasValue = false; } }; DebounceTimeSubscriber.prototype.clearDebounce = function () { var debouncedSubscription = this.debouncedSubscription; if (debouncedSubscription !== null) { this.remove(debouncedSubscription); debouncedSubscription.unsubscribe(); this.debouncedSubscription = null; } }; return DebounceTimeSubscriber; }(Subscriber_1.Subscriber)); function dispatchNext(subscriber) { subscriber.debouncedNext(); } //# sourceMappingURL=debounceTime.js.map /***/ }), /***/ "./node_modules/rxjs/scheduler/Action.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; var Subscription_1 = __webpack_require__("./node_modules/rxjs/Subscription.js"); /** * A unit of work to be executed in a {@link Scheduler}. An action is typically * created from within a Scheduler and an RxJS user does not need to concern * themselves about creating and manipulating an Action. * * ```ts * class Action<T> extends Subscription { * new (scheduler: Scheduler, work: (state?: T) => void); * schedule(state?: T, delay: number = 0): Subscription; * } * ``` * * @class Action<T> */ var Action = (function (_super) { __extends(Action, _super); function Action(scheduler, work) { _super.call(this); } /** * Schedules this action on its parent Scheduler for execution. May be passed * some context object, `state`. May happen at some point in the future, * according to the `delay` parameter, if specified. * @param {T} [state] Some contextual data that the `work` function uses when * called by the Scheduler. * @param {number} [delay] Time to wait before executing the work, where the * time unit is implicit and defined by the Scheduler. * @return {void} */ Action.prototype.schedule = function (state, delay) { if (delay === void 0) { delay = 0; } return this; }; return Action; }(Subscription_1.Subscription)); exports.Action = Action; //# sourceMappingURL=Action.js.map /***/ }), /***/ "./node_modules/rxjs/scheduler/AsyncAction.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; var root_1 = __webpack_require__("./node_modules/rxjs/util/root.js"); var Action_1 = __webpack_require__("./node_modules/rxjs/scheduler/Action.js"); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var AsyncAction = (function (_super) { __extends(AsyncAction, _super); function AsyncAction(scheduler, work) { _super.call(this, scheduler, work); this.scheduler = scheduler; this.work = work; this.pending = false; } AsyncAction.prototype.schedule = function (state, delay) { if (delay === void 0) { delay = 0; } if (this.closed) { return this; } // Always replace the current state with the new state. this.state = state; // Set the pending flag indicating that this action has been scheduled, or // has recursively rescheduled itself. this.pending = true; var id = this.id; var scheduler = this.scheduler; // // Important implementation note: // // Actions only execute once by default, unless rescheduled from within the // scheduled callback. This allows us to implement single and repeat // actions via the same code path, without adding API surface area, as well // as mimic traditional recursion but across asynchronous boundaries. // // However, JS runtimes and timers distinguish between intervals achieved by // serial `setTimeout` calls vs. a single `setInterval` call. An interval of // serial `setTimeout` calls can be individually delayed, which delays // scheduling the next `setTimeout`, and so on. `setInterval` attempts to // guarantee the interval callback will be invoked more precisely to the // interval period, regardless of load. // // Therefore, we use `setInterval` to schedule single and repeat actions. // If the action reschedules itself with the same delay, the interval is not // canceled. If the action doesn't reschedule, or reschedules with a // different delay, the interval will be canceled after scheduled callback // execution. // if (id != null) { this.id = this.recycleAsyncId(scheduler, id, delay); } this.delay = delay; // If this action has already an async Id, don't request a new one. this.id = this.id || this.requestAsyncId(scheduler, this.id, delay); return this; }; AsyncAction.prototype.requestAsyncId = function (scheduler, id, delay) { if (delay === void 0) { delay = 0; } return root_1.root.setInterval(scheduler.flush.bind(scheduler, this), delay); }; AsyncAction.prototype.recycleAsyncId = function (scheduler, id, delay) { if (delay === void 0) { delay = 0; } // If this action is rescheduled with the same delay time, don't clear the interval id. if (delay !== null && this.delay === delay && this.pending === false) { return id; } // Otherwise, if the action's delay time is different from the current delay, // or the action has been rescheduled before it's executed, clear the interval id return root_1.root.clearInterval(id) && undefined || undefined; }; /** * Immediately executes this action and the `work` it contains. * @return {any} */ AsyncAction.prototype.execute = function (state, delay) { if (this.closed) { return new Error('executing a cancelled action'); } this.pending = false; var error = this._execute(state, delay); if (error) { return error; } else if (this.pending === false && this.id != null) { // Dequeue if the action didn't reschedule itself. Don't call // unsubscribe(), because the action could reschedule later. // For example: // ``` // scheduler.schedule(function doWork(counter) { // /* ... I'm a busy worker bee ... */ // var originalAction = this; // /* wait 100ms before rescheduling the action */ // setTimeout(function () { // originalAction.schedule(counter + 1); // }, 100); // }, 1000); // ``` this.id = this.recycleAsyncId(this.scheduler, this.id, null); } }; AsyncAction.prototype._execute = function (state, delay) { var errored = false; var errorValue = undefined; try { this.work(state); } catch (e) { errored = true; errorValue = !!e && e || new Error(e); } if (errored) { this.unsubscribe(); return errorValue; } }; /** @deprecated internal use only */ AsyncAction.prototype._unsubscribe = function () { var id = this.id; var scheduler = this.scheduler; var actions = scheduler.actions; var index = actions.indexOf(this); this.work = null; this.state = null; this.pending = false; this.scheduler = null; if (index !== -1) { actions.splice(index, 1); } if (id != null) { this.id = this.recycleAsyncId(scheduler, id, null); } this.delay = null; }; return AsyncAction; }(Action_1.Action)); exports.AsyncAction = AsyncAction; //# sourceMappingURL=AsyncAction.js.map /***/ }), /***/ "./node_modules/rxjs/scheduler/AsyncScheduler.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; var Scheduler_1 = __webpack_require__("./node_modules/rxjs/Scheduler.js"); var AsyncScheduler = (function (_super) { __extends(AsyncScheduler, _super); function AsyncScheduler() { _super.apply(this, arguments); this.actions = []; /** * A flag to indicate whether the Scheduler is currently executing a batch of * queued actions. * @type {boolean} */ this.active = false; /** * An internal ID used to track the latest asynchronous task such as those * coming from `setTimeout`, `setInterval`, `requestAnimationFrame`, and * others. * @type {any} */ this.scheduled = undefined; } AsyncScheduler.prototype.flush = function (action) { var actions = this.actions; if (this.active) { actions.push(action); return; } var error; this.active = true; do { if (error = action.execute(action.state, action.delay)) { break; } } while (action = actions.shift()); // exhaust the scheduler queue this.active = false; if (error) { while (action = actions.shift()) { action.unsubscribe(); } throw error; } }; return AsyncScheduler; }(Scheduler_1.Scheduler)); exports.AsyncScheduler = AsyncScheduler; //# sourceMappingURL=AsyncScheduler.js.map /***/ }), /***/ "./node_modules/rxjs/scheduler/async.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; var AsyncAction_1 = __webpack_require__("./node_modules/rxjs/scheduler/AsyncAction.js"); var AsyncScheduler_1 = __webpack_require__("./node_modules/rxjs/scheduler/AsyncScheduler.js"); /** * * Async Scheduler * * <span class="informal">Schedule task as if you used setTimeout(task, duration)</span> * * `async` scheduler schedules tasks asynchronously, by putting them on the JavaScript * event loop queue. It is best used to delay tasks in time or to schedule tasks repeating * in intervals. * * If you just want to "defer" task, that is to perform it right after currently * executing synchronous code ends (commonly achieved by `setTimeout(deferredTask, 0)`), * better choice will be the {@link asap} scheduler. * * @example <caption>Use async scheduler to delay task</caption> * const task = () => console.log('it works!'); * * Rx.Scheduler.async.schedule(task, 2000); * * // After 2 seconds logs: * // "it works!" * * * @example <caption>Use async scheduler to repeat task in intervals</caption> * function task(state) { * console.log(state); * this.schedule(state + 1, 1000); // `this` references currently executing Action, * // which we reschedule with new state and delay * } * * Rx.Scheduler.async.schedule(task, 3000, 0); * * // Logs: * // 0 after 3s * // 1 after 4s * // 2 after 5s * // 3 after 6s * * @static true * @name async * @owner Scheduler */ exports.async = new AsyncScheduler_1.AsyncScheduler(AsyncAction_1.AsyncAction); //# sourceMappingURL=async.js.map /***/ }), /***/ "./node_modules/rxjs/symbol/observable.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; var root_1 = __webpack_require__("./node_modules/rxjs/util/root.js"); function getSymbolObservable(context) { var $$observable; var Symbol = context.Symbol; if (typeof Symbol === 'function') { if (Symbol.observable) { $$observable = Symbol.observable; } else { $$observable = Symbol('observable'); Symbol.observable = $$observable; } } else { $$observable = '@@observable'; } return $$observable; } exports.getSymbolObservable = getSymbolObservable; exports.observable = getSymbolObservable(root_1.root); /** * @deprecated use observable instead */ exports.$$observable = exports.observable; //# sourceMappingURL=observable.js.map /***/ }), /***/ "./node_modules/rxjs/symbol/rxSubscriber.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; var root_1 = __webpack_require__("./node_modules/rxjs/util/root.js"); var Symbol = root_1.root.Symbol; exports.rxSubscriber = (typeof Symbol === 'function' && typeof Symbol.for === 'function') ? Symbol.for('rxSubscriber') : '@@rxSubscriber'; /** * @deprecated use rxSubscriber instead */ exports.$$rxSubscriber = exports.rxSubscriber; //# sourceMappingURL=rxSubscriber.js.map /***/ }), /***/ "./node_modules/rxjs/util/UnsubscriptionError.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; /** * An error thrown when one or more errors have occurred during the * `unsubscribe` of a {@link Subscription}. */ var UnsubscriptionError = (function (_super) { __extends(UnsubscriptionError, _super); function UnsubscriptionError(errors) { _super.call(this); this.errors = errors; var err = Error.call(this, errors ? errors.length + " errors occurred during unsubscription:\n " + errors.map(function (err, i) { return ((i + 1) + ") " + err.toString()); }).join('\n ') : ''); this.name = err.name = 'UnsubscriptionError'; this.stack = err.stack; this.message = err.message; } return UnsubscriptionError; }(Error)); exports.UnsubscriptionError = UnsubscriptionError; //# sourceMappingURL=UnsubscriptionError.js.map /***/ }), /***/ "./node_modules/rxjs/util/errorObject.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; // typeof any so that it we don't have to cast when comparing a result to the error object exports.errorObject = { e: {} }; //# sourceMappingURL=errorObject.js.map /***/ }), /***/ "./node_modules/rxjs/util/isArray.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.isArray = Array.isArray || (function (x) { return x && typeof x.length === 'number'; }); //# sourceMappingURL=isArray.js.map /***/ }), /***/ "./node_modules/rxjs/util/isFunction.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; function isFunction(x) { return typeof x === 'function'; } exports.isFunction = isFunction; //# sourceMappingURL=isFunction.js.map /***/ }), /***/ "./node_modules/rxjs/util/isObject.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; function isObject(x) { return x != null && typeof x === 'object'; } exports.isObject = isObject; //# sourceMappingURL=isObject.js.map /***/ }), /***/ "./node_modules/rxjs/util/noop.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /* tslint:disable:no-empty */ function noop() { } exports.noop = noop; //# sourceMappingURL=noop.js.map /***/ }), /***/ "./node_modules/rxjs/util/pipe.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; var noop_1 = __webpack_require__("./node_modules/rxjs/util/noop.js"); /* tslint:enable:max-line-length */ function pipe() { var fns = []; for (var _i = 0; _i < arguments.length; _i++) { fns[_i - 0] = arguments[_i]; } return pipeFromArray(fns); } exports.pipe = pipe; /* @internal */ function pipeFromArray(fns) { if (!fns) { return noop_1.noop; } if (fns.length === 1) { return fns[0]; } return function piped(input) { return fns.reduce(function (prev, fn) { return fn(prev); }, input); }; } exports.pipeFromArray = pipeFromArray; //# sourceMappingURL=pipe.js.map /***/ }), /***/ "./node_modules/rxjs/util/root.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(global) { // CommonJS / Node have global context exposed as "global" variable. // We don't want to include the whole node.d.ts this this compilation unit so we'll just fake // the global "global" var for now. var __window = typeof window !== 'undefined' && window; var __self = typeof self !== 'undefined' && typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope && self; var __global = typeof global !== 'undefined' && global; var _root = __window || __global || __self; exports.root = _root; // Workaround Closure Compiler restriction: The body of a goog.module cannot use throw. // This is needed when used with angular/tsickle which inserts a goog.module statement. // Wrap in IIFE (function () { if (!_root) { throw new Error('RxJS could not find any global context (window, self, global)'); } })(); //# sourceMappingURL=root.js.map /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__("./node_modules/webpack/buildin/global.js"))) /***/ }), /***/ "./node_modules/rxjs/util/toSubscriber.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; var Subscriber_1 = __webpack_require__("./node_modules/rxjs/Subscriber.js"); var rxSubscriber_1 = __webpack_require__("./node_modules/rxjs/symbol/rxSubscriber.js"); var Observer_1 = __webpack_require__("./node_modules/rxjs/Observer.js"); function toSubscriber(nextOrObserver, error, complete) { if (nextOrObserver) { if (nextOrObserver instanceof Subscriber_1.Subscriber) { return nextOrObserver; } if (nextOrObserver[rxSubscriber_1.rxSubscriber]) { return nextOrObserver[rxSubscriber_1.rxSubscriber](); } } if (!nextOrObserver && !error && !complete) { return new Subscriber_1.Subscriber(Observer_1.empty); } return new Subscriber_1.Subscriber(nextOrObserver, error, complete); } exports.toSubscriber = toSubscriber; //# sourceMappingURL=toSubscriber.js.map /***/ }), /***/ "./node_modules/rxjs/util/tryCatch.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; var errorObject_1 = __webpack_require__("./node_modules/rxjs/util/errorObject.js"); var tryCatchTarget; function tryCatcher() { try { return tryCatchTarget.apply(this, arguments); } catch (e) { errorObject_1.errorObject.e = e; return errorObject_1.errorObject; } } function tryCatch(fn) { tryCatchTarget = fn; return tryCatcher; } exports.tryCatch = tryCatch; ; //# sourceMappingURL=tryCatch.js.map /***/ }), /***/ "./node_modules/webpack/buildin/global.js": /***/ (function(module, exports) { var g; // This works in non-strict mode g = (function() { return this; })(); try { // This works if eval is allowed (see CSP) g = g || Function("return this")() || (1,eval)("this"); } catch(e) { // This works if the window reference is available if(typeof window === "object") g = window; } // g can still be undefined, but nothing to do about it... // We return undefined, instead of nothing here, so it's // easier to handle this case. if(!global) { ...} module.exports = g; /***/ }), /***/ "./src/area-chart/area-chart-normalized.component.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return AreaChartNormalizedComponent; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("@angular/core"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_d3_scale__ = __webpack_require__("d3-scale"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_d3_scale___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_d3_scale__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_d3_shape__ = __webpack_require__("d3-shape"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_d3_shape___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_d3_shape__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__common_view_dimensions_helper__ = __webpack_require__("./src/common/view-dimensions.helper.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__common_color_helper__ = __webpack_require__("./src/common/color.helper.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__common_base_chart_component__ = __webpack_require__("./src/common/base-chart.component.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__utils_id__ = __webpack_require__("./src/utils/id.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__common_domain_helper__ = __webpack_require__("./src/common/domain.helper.ts"); var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var AreaChartNormalizedComponent = /** @class */ (function (_super) { __extends(AreaChartNormalizedComponent, _super); function AreaChartNormalizedComponent() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.legend = false; _this.legendTitle = 'Legend'; _this.showGridLines = true; _this.curve = __WEBPACK_IMPORTED_MODULE_2_d3_shape__["curveLinear"]; _this.activeEntries = []; _this.roundDomains = false; _this.tooltipDisabled = false; _this.activate = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); _this.deactivate = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); _this.margin = [10, 20, 10, 20]; _this.xAxisHeight = 0; _this.yAxisWidth = 0; _this.timelineHeight = 50; _this.timelinePadding = 10; return _this; } AreaChartNormalizedComponent.prototype.update = function () { var _this = this; _super.prototype.update.call(this); this.dims = Object(__WEBPACK_IMPORTED_MODULE_3__common_view_dimensions_helper__["a" /* calculateViewDimensions */])({ width: this.width, height: this.height, margins: this.margin, showXAxis: this.xAxis, showYAxis: this.yAxis, xAxisHeight: this.xAxisHeight, yAxisWidth: this.yAxisWidth, showXLabel: this.showXAxisLabel, showYLabel: this.showYAxisLabel, showLegend: this.legend, legendType: this.schemeType }); if (this.timeline) { this.dims.height -= (this.timelineHeight + this.margin[2] + this.timelinePadding); } this.xDomain = this.getXDomain(); if (this.filteredDomain) { this.xDomain = this.filteredDomain; } this.yDomain = this.getYDomain(); this.seriesDomain = this.getSeriesDomain(); this.xScale = this.getXScale(this.xDomain, this.dims.width); this.yScale = this.getYScale(this.yDomain, this.dims.height); var _loop_1 = function (i) { var val = this_1.xSet[i]; var d0 = 0; var total = 0; for (var _i = 0, _a = this_1.results; _i < _a.length; _i++) { var group = _a[_i]; var d = group.series.find(function (item) { var a = item.name; var b = val; if (_this.scaleType === 'time') { a = a.valueOf(); b = b.valueOf(); } return a === b; }); if (d) { total += d.value; } } for (var _b = 0, _c = this_1.results; _b < _c.length; _b++) { var group = _c[_b]; var d = group.series.find(function (item) { var a = item.name; var b = val; if (_this.scaleType === 'time') { a = a.valueOf(); b = b.valueOf(); } return a === b; }); if (d) { d.d0 = d0; d.d1 = d0 + d.value; d0 += d.value; } else { d = { name: val, value: 0, d0: d0, d1: d0 }; group.series.push(d); } if (total > 0) { d.d0 = (d.d0 * 100) / total; d.d1 = (d.d1 * 100) / total; } else { d.d0 = 0; d.d1 = 0; } } }; var this_1 = this; for (var i = 0; i < this.xSet.length; i++) { _loop_1(i); } this.updateTimeline(); this.setColors(); this.legendOptions = this.getLegendOptions(); this.transform = "translate(" + this.dims.xOffset + " , " + this.margin[0] + ")"; this.clipPathId = 'clip' + Object(__WEBPACK_IMPORTED_MODULE_6__utils_id__["a" /* id */])().toString(); this.clipPath = "url(#" + this.clipPathId + ")"; }; AreaChartNormalizedComponent.prototype.updateTimeline = function () { if (this.timeline) { this.timelineWidth = this.dims.width; this.timelineXDomain = this.getXDomain(); this.timelineXScale = this.getXScale(this.timelineXDomain, this.timelineWidth); this.timelineYScale = this.getYScale(this.yDomain, this.timelineHeight); this.timelineTransform = "translate(" + this.dims.xOffset + ", " + -this.margin[2] + ")"; } }; AreaChartNormalizedComponent.prototype.getXDomain = function () { var values = Object(__WEBPACK_IMPORTED_MODULE_7__common_domain_helper__["a" /* getUniqueXDomainValues */])(this.results); this.scaleType = this.getScaleType(values); var domain = []; if (this.scaleType === 'time') { var min = Math.min.apply(Math, values); var max = Math.max.apply(Math, values); domain = [new Date(min), new Date(max)]; this.xSet = values.slice().sort(function (a, b) { var aDate = a.getTime(); var bDate = b.getTime(); if (aDate > bDate) return 1; if (bDate > aDate) return -1; return 0; }); } else if (this.scaleType === 'linear') { values = values.map(function (v) { return Number(v); }); var min = Math.min.apply(Math, values); var max = Math.max.apply(Math, values); domain = [min, max]; // Use compare function to sort numbers numerically this.xSet = values.slice().sort(function (a, b) { return (a - b); }); } else { domain = values; this.xSet = values; } return domain; }; AreaChartNormalizedComponent.prototype.getYDomain = function () { return [0, 100]; }; AreaChartNormalizedComponent.prototype.getSeriesDomain = function () { return this.results.map(function (d) { return d.name; }); }; AreaChartNormalizedComponent.prototype.getXScale = function (domain, width) { var scale; if (this.scaleType === 'time') { scale = Object(__WEBPACK_IMPORTED_MODULE_1_d3_scale__["scaleTime"])(); } else if (this.scaleType === 'linear') { scale = Object(__WEBPACK_IMPORTED_MODULE_1_d3_scale__["scaleLinear"])(); } else if (this.scaleType === 'ordinal') { scale = Object(__WEBPACK_IMPORTED_MODULE_1_d3_scale__["scalePoint"])() .padding(0.1); } scale .range([0, width]) .domain(domain); return this.roundDomains ? scale.nice() : scale; }; AreaChartNormalizedComponent.prototype.getYScale = function (domain, height) { var scale = Object(__WEBPACK_IMPORTED_MODULE_1_d3_scale__["scaleLinear"])() .range([height, 0]) .domain(domain); return this.roundDomains ? scale.nice() : scale; }; AreaChartNormalizedComponent.prototype.getScaleType = function (values) { var date = true; var num = true; for (var _i = 0, values_1 = values; _i < values_1.length; _i++) { var value = values_1[_i]; if (!this.isDate(value)) { date = false; } if (typeof value !== 'number') { num = false; } } if (date) { return 'time'; } if (num) { return 'linear'; } return 'ordinal'; }; AreaChartNormalizedComponent.prototype.isDate = function (value) { if (value instanceof Date) { return true; } return false; }; AreaChartNormalizedComponent.prototype.updateDomain = function (domain) { this.filteredDomain = domain; this.xDomain = this.filteredDomain; this.xScale = this.getXScale(this.xDomain, this.dims.width); }; AreaChartNormalizedComponent.prototype.updateHoveredVertical = function (item) { this.hoveredVertical = item.value; this.deactivateAll(); }; AreaChartNormalizedComponent.prototype.hideCircles = function () { this.hoveredVertical = null; this.deactivateAll(); }; AreaChartNormalizedComponent.prototype.onClick = function (data, series) { if (series) { data.series = series.name; } this.select.emit(data); }; AreaChartNormalizedComponent.prototype.trackBy = function (index, item) { return item.name; }; AreaChartNormalizedComponent.prototype.setColors = function () { var domain; if (this.schemeType === 'ordinal') { domain = this.seriesDomain; } else { domain = this.yDomain; } this.colors = new __WEBPACK_IMPORTED_MODULE_4__common_color_helper__["a" /* ColorHelper */](this.scheme, this.schemeType, domain, this.customColors); }; AreaChartNormalizedComponent.prototype.getLegendOptions = function () { var opts = { scaleType: this.schemeType, colors: undefined, domain: [], title: undefined }; if (opts.scaleType === 'ordinal') { opts.domain = this.seriesDomain; opts.colors = this.colors; opts.title = this.legendTitle; } else { opts.domain = this.yDomain; opts.colors = this.colors.scale; } return opts; }; AreaChartNormalizedComponent.prototype.updateYAxisWidth = function (_a) { var width = _a.width; this.yAxisWidth = width; this.update(); }; AreaChartNormalizedComponent.prototype.updateXAxisHeight = function (_a) { var height = _a.height; this.xAxisHeight = height; this.update(); }; AreaChartNormalizedComponent.prototype.onActivate = function (item) { var idx = this.activeEntries.findIndex(function (d) { return d.name === item.name && d.value === item.value; }); if (idx > -1) { return; } this.activeEntries = [item].concat(this.activeEntries); this.activate.emit({ value: item, entries: this.activeEntries }); }; AreaChartNormalizedComponent.prototype.onDeactivate = function (item) { var idx = this.activeEntries.findIndex(function (d) { return d.name === item.name && d.value === item.value; }); this.activeEntries.splice(idx, 1); this.activeEntries = this.activeEntries.slice(); this.deactivate.emit({ value: item, entries: this.activeEntries }); }; AreaChartNormalizedComponent.prototype.deactivateAll = function () { this.activeEntries = this.activeEntries.slice(); for (var _i = 0, _a = this.activeEntries; _i < _a.length; _i++) { var entry = _a[_i]; this.deactivate.emit({ value: entry, entries: [] }); } this.activeEntries = []; }; __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], AreaChartNormalizedComponent.prototype, "legend", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", String) ], AreaChartNormalizedComponent.prototype, "legendTitle", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], AreaChartNormalizedComponent.prototype, "xAxis", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], AreaChartNormalizedComponent.prototype, "yAxis", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], AreaChartNormalizedComponent.prototype, "showXAxisLabel", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], AreaChartNormalizedComponent.prototype, "showYAxisLabel", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], AreaChartNormalizedComponent.prototype, "xAxisLabel", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], AreaChartNormalizedComponent.prototype, "yAxisLabel", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], AreaChartNormalizedComponent.prototype, "timeline", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], AreaChartNormalizedComponent.prototype, "gradient", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], AreaChartNormalizedComponent.prototype, "showGridLines", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], AreaChartNormalizedComponent.prototype, "curve", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Array) ], AreaChartNormalizedComponent.prototype, "activeEntries", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", String) ], AreaChartNormalizedComponent.prototype, "schemeType", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], AreaChartNormalizedComponent.prototype, "xAxisTickFormatting", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], AreaChartNormalizedComponent.prototype, "yAxisTickFormatting", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Array) ], AreaChartNormalizedComponent.prototype, "xAxisTicks", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Array) ], AreaChartNormalizedComponent.prototype, "yAxisTicks", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], AreaChartNormalizedComponent.prototype, "roundDomains", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], AreaChartNormalizedComponent.prototype, "tooltipDisabled", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"]) ], AreaChartNormalizedComponent.prototype, "activate", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"]) ], AreaChartNormalizedComponent.prototype, "deactivate", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["ContentChild"])('tooltipTemplate'), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["TemplateRef"]) ], AreaChartNormalizedComponent.prototype, "tooltipTemplate", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["ContentChild"])('seriesTooltipTemplate'), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["TemplateRef"]) ], AreaChartNormalizedComponent.prototype, "seriesTooltipTemplate", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["HostListener"])('mouseleave'), __metadata("design:type", Function), __metadata("design:paramtypes", []), __metadata("design:returntype", void 0) ], AreaChartNormalizedComponent.prototype, "hideCircles", null); AreaChartNormalizedComponent = __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ selector: 'ngx-charts-area-chart-normalized', template: "\n <ngx-charts-chart\n [view]=\"[width, height]\"\n [showLegend]=\"legend\"\n [legendOptions]=\"legendOptions\"\n [activeEntries]=\"activeEntries\"\n [animations]=\"animations\"\n (legendLabelClick)=\"onClick($event)\"\n (legendLabelActivate)=\"onActivate($event)\"\n (legendLabelDeactivate)=\"onDeactivate($event)\">\n <svg:defs>\n <svg:clipPath [attr.id]=\"clipPathId\">\n <svg:rect\n [attr.width]=\"dims.width + 10\"\n [attr.height]=\"dims.height + 10\"\n [attr.transform]=\"'translate(-5, -5)'\"/>\n </svg:clipPath>\n </svg:defs>\n <svg:g [attr.transform]=\"transform\" class=\"area-chart chart\">\n <svg:g ngx-charts-x-axis\n *ngIf=\"xAxis\"\n [xScale]=\"xScale\"\n [dims]=\"dims\"\n [showGridLines]=\"showGridLines\"\n [showLabel]=\"showXAxisLabel\"\n [labelText]=\"xAxisLabel\"\n [tickFormatting]=\"xAxisTickFormatting\"\n [ticks]=\"xAxisTicks\"\n (dimensionsChanged)=\"updateXAxisHeight($event)\">\n </svg:g>\n <svg:g ngx-charts-y-axis\n *ngIf=\"yAxis\"\n [yScale]=\"yScale\"\n [dims]=\"dims\"\n [showGridLines]=\"showGridLines\"\n [showLabel]=\"showYAxisLabel\"\n [labelText]=\"yAxisLabel\"\n [tickFormatting]=\"yAxisTickFormatting\"\n [ticks]=\"yAxisTicks\"\n (dimensionsChanged)=\"updateYAxisWidth($event)\">\n </svg:g>\n <svg:g [attr.clip-path]=\"clipPath\">\n <svg:g *ngFor=\"let series of results; trackBy:trackBy\">\n <svg:g ngx-charts-area-series\n [xScale]=\"xScale\"\n [yScale]=\"yScale\"\n [colors]=\"colors\"\n [data]=\"series\"\n [scaleType]=\"scaleType\"\n [activeEntries]=\"activeEntries\"\n [gradient]=\"gradient\"\n normalized=\"true\"\n [curve]=\"curve\"\n [animations]=\"animations\"\n />\n </svg:g>\n\n <svg:g *ngIf=\"!tooltipDisabled\" (mouseleave)=\"hideCircles()\">\n <svg:g ngx-charts-tooltip-area\n [dims]=\"dims\"\n [xSet]=\"xSet\"\n [xScale]=\"xScale\"\n [yScale]=\"yScale\"\n [results]=\"results\"\n [colors]=\"colors\"\n [showPercentage]=\"true\"\n [tooltipDisabled]=\"tooltipDisabled\"\n [tooltipTemplate]=\"seriesTooltipTemplate\"\n (hover)=\"updateHoveredVertical($event)\"\n />\n\n <svg:g *ngFor=\"let series of results\">\n <svg:g ngx-charts-circle-series\n type=\"stacked\"\n [xScale]=\"xScale\"\n [yScale]=\"yScale\"\n [colors]=\"colors\"\n [activeEntries]=\"activeEntries\"\n [data]=\"series\"\n [scaleType]=\"scaleType\"\n [visibleValue]=\"hoveredVertical\"\n [tooltipDisabled]=\"tooltipDisabled\"\n [tooltipTemplate]=\"tooltipTemplate\"\n (select)=\"onClick($event, series)\"\n (activate)=\"onActivate($event)\"\n (deactivate)=\"onDeactivate($event)\"\n />\n </svg:g>\n </svg:g>\n </svg:g>\n </svg:g>\n <svg:g ngx-charts-timeline\n *ngIf=\"timeline && scaleType != 'ordinal'\"\n [attr.transform]=\"timelineTransform\"\n [results]=\"results\"\n [view]=\"[timelineWidth, height]\"\n [height]=\"timelineHeight\"\n [scheme]=\"scheme\"\n [customColors]=\"customColors\"\n [legend]=\"legend\"\n [scaleType]=\"scaleType\"\n (onDomainChange)=\"updateDomain($event)\">\n <svg:g *ngFor=\"let series of results; trackBy:trackBy\">\n <svg:g ngx-charts-area-series\n [xScale]=\"timelineXScale\"\n [yScale]=\"timelineYScale\"\n [colors]=\"colors\"\n [data]=\"series\"\n [scaleType]=\"scaleType\"\n [gradient]=\"gradient\"\n normalized=\"true\"\n [curve]=\"curve\"\n [animations]=\"animations\"\n />\n </svg:g>\n </svg:g>\n </ngx-charts-chart>\n ", changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectionStrategy"].OnPush, styles: [__webpack_require__("./src/common/base-chart.component.scss")], encapsulation: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ViewEncapsulation"].None }) ], AreaChartNormalizedComponent); return AreaChartNormalizedComponent; }(__WEBPACK_IMPORTED_MODULE_5__common_base_chart_component__["a" /* BaseChartComponent */])); /***/ }), /***/ "./src/area-chart/area-chart-stacked.component.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return AreaChartStackedComponent; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("@angular/core"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_d3_scale__ = __webpack_require__("d3-scale"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_d3_scale___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_d3_scale__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_d3_shape__ = __webpack_require__("d3-shape"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_d3_shape___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_d3_shape__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__common_view_dimensions_helper__ = __webpack_require__("./src/common/view-dimensions.helper.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__common_color_helper__ = __webpack_require__("./src/common/color.helper.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__common_base_chart_component__ = __webpack_require__("./src/common/base-chart.component.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__utils_id__ = __webpack_require__("./src/utils/id.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__common_domain_helper__ = __webpack_require__("./src/common/domain.helper.ts"); var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var AreaChartStackedComponent = /** @class */ (function (_super) { __extends(AreaChartStackedComponent, _super); function AreaChartStackedComponent() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.legend = false; _this.legendTitle = 'Legend'; _this.showGridLines = true; _this.curve = __WEBPACK_IMPORTED_MODULE_2_d3_shape__["curveLinear"]; _this.activeEntries = []; _this.roundDomains = false; _this.tooltipDisabled = false; _this.activate = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); _this.deactivate = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); _this.margin = [10, 20, 10, 20]; _this.xAxisHeight = 0; _this.yAxisWidth = 0; _this.timelineHeight = 50; _this.timelinePadding = 10; return _this; } AreaChartStackedComponent.prototype.update = function () { var _this = this; _super.prototype.update.call(this); this.dims = Object(__WEBPACK_IMPORTED_MODULE_3__common_view_dimensions_helper__["a" /* calculateViewDimensions */])({ width: this.width, height: this.height, margins: this.margin, showXAxis: this.xAxis, showYAxis: this.yAxis, xAxisHeight: this.xAxisHeight, yAxisWidth: this.yAxisWidth, showXLabel: this.showXAxisLabel, showYLabel: this.showYAxisLabel, showLegend: this.legend, legendType: this.schemeType }); if (this.timeline) { this.dims.height -= (this.timelineHeight + this.margin[2] + this.timelinePadding); } this.xDomain = this.getXDomain(); if (this.filteredDomain) { this.xDomain = this.filteredDomain; } this.yDomain = this.getYDomain(); this.seriesDomain = this.getSeriesDomain(); this.xScale = this.getXScale(this.xDomain, this.dims.width); this.yScale = this.getYScale(this.yDomain, this.dims.height); var _loop_1 = function (i) { var val = this_1.xSet[i]; var d0 = 0; for (var _i = 0, _a = this_1.results; _i < _a.length; _i++) { var group = _a[_i]; var d = group.series.find(function (item) { var a = item.name; var b = val; if (_this.scaleType === 'time') { a = a.valueOf(); b = b.valueOf(); } return a === b; }); if (d) { d.d0 = d0; d.d1 = d0 + d.value; d0 += d.value; } else { d = { name: val, value: 0, d0: d0, d1: d0 }; group.series.push(d); } } }; var this_1 = this; for (var i = 0; i < this.xSet.length; i++) { _loop_1(i); } this.updateTimeline(); this.setColors(); this.legendOptions = this.getLegendOptions(); this.transform = "translate(" + this.dims.xOffset + " , " + this.margin[0] + ")"; this.clipPathId = 'clip' + Object(__WEBPACK_IMPORTED_MODULE_6__utils_id__["a" /* id */])().toString(); this.clipPath = "url(#" + this.clipPathId + ")"; }; AreaChartStackedComponent.prototype.updateTimeline = function () { if (this.timeline) { this.timelineWidth = this.dims.width; this.timelineXDomain = this.getXDomain(); this.timelineXScale = this.getXScale(this.timelineXDomain, this.timelineWidth); this.timelineYScale = this.getYScale(this.yDomain, this.timelineHeight); this.timelineTransform = "translate(" + this.dims.xOffset + ", " + -this.margin[2] + ")"; } }; AreaChartStackedComponent.prototype.getXDomain = function () { var values = Object(__WEBPACK_IMPORTED_MODULE_7__common_domain_helper__["a" /* getUniqueXDomainValues */])(this.results); this.scaleType = this.getScaleType(values); var domain = []; if (this.scaleType === 'linear') { values = values.map(function (v) { return Number(v); }); } var min; var max; if (this.scaleType === 'time' || this.scaleType === 'linear') { min = this.xScaleMin ? this.xScaleMin : Math.min.apply(Math, values); max = this.xScaleMax ? this.xScaleMax : Math.max.apply(Math, values); } if (this.scaleType === 'time') { domain = [new Date(min), new Date(max)]; this.xSet = values.slice().sort(function (a, b) { var aDate = a.getTime(); var bDate = b.getTime(); if (aDate > bDate) return 1; if (bDate > aDate) return -1; return 0; }); } else if (this.scaleType === 'linear') { domain = [min, max]; // Use compare function to sort numbers numerically this.xSet = values.slice().sort(function (a, b) { return (a - b); }); } else { domain = values; this.xSet = values; } return domain; }; AreaChartStackedComponent.prototype.getYDomain = function () { var _this = this; var domain = []; var _loop_2 = function (i) { var val = this_2.xSet[i]; var sum = 0; for (var _i = 0, _a = this_2.results; _i < _a.length; _i++) { var group = _a[_i]; var d = group.series.find(function (item) { var a = item.name; var b = val; if (_this.scaleType === 'time') { a = a.valueOf(); b = b.valueOf(); } return a === b; }); if (d) { sum += d.value; } } domain.push(sum); }; var this_2 = this; for (var i = 0; i < this.xSet.length; i++) { _loop_2(i); } var min = this.yScaleMin ? this.yScaleMin : Math.min.apply(Math, [0].concat(domain)); var max = this.yScaleMax ? this.yScaleMax : Math.max.apply(Math, domain); return [min, max]; }; AreaChartStackedComponent.prototype.getSeriesDomain = function () { return this.results.map(function (d) { return d.name; }); }; AreaChartStackedComponent.prototype.getXScale = function (domain, width) { var scale; if (this.scaleType === 'time') { scale = Object(__WEBPACK_IMPORTED_MODULE_1_d3_scale__["scaleTime"])(); } else if (this.scaleType === 'linear') { scale = Object(__WEBPACK_IMPORTED_MODULE_1_d3_scale__["scaleLinear"])(); } else if (this.scaleType === 'ordinal') { scale = Object(__WEBPACK_IMPORTED_MODULE_1_d3_scale__["scalePoint"])() .padding(0.1); } scale .range([0, width]) .domain(domain); return this.roundDomains ? scale.nice() : scale; }; AreaChartStackedComponent.prototype.getYScale = function (domain, height) { var scale = Object(__WEBPACK_IMPORTED_MODULE_1_d3_scale__["scaleLinear"])() .range([height, 0]) .domain(domain); return this.roundDomains ? scale.nice() : scale; }; AreaChartStackedComponent.prototype.getScaleType = function (values) { var date = true; var num = true; for (var _i = 0, values_1 = values; _i < values_1.length; _i++) { var value = values_1[_i]; if (!this.isDate(value)) { date = false; } if (typeof value !== 'number') { num = false; } } if (date) { return 'time'; } if (num) { return 'linear'; } return 'ordinal'; }; AreaChartStackedComponent.prototype.isDate = function (value) { if (value instanceof Date) { return true; } return false; }; AreaChartStackedComponent.prototype.updateDomain = function (domain) { this.filteredDomain = domain; this.xDomain = this.filteredDomain; this.xScale = this.getXScale(this.xDomain, this.dims.width); }; AreaChartStackedComponent.prototype.updateHoveredVertical = function (item) { this.hoveredVertical = item.value; this.deactivateAll(); }; AreaChartStackedComponent.prototype.hideCircles = function () { this.hoveredVertical = null; this.deactivateAll(); }; AreaChartStackedComponent.prototype.onClick = function (data, series) { if (series) { data.series = series.name; } this.select.emit(data); }; AreaChartStackedComponent.prototype.trackBy = function (index, item) { return item.name; }; AreaChartStackedComponent.prototype.setColors = function () { var domain; if (this.schemeType === 'ordinal') { domain = this.seriesDomain; } else { domain = this.yDomain; } this.colors = new __WEBPACK_IMPORTED_MODULE_4__common_color_helper__["a" /* ColorHelper */](this.scheme, this.schemeType, domain, this.customColors); }; AreaChartStackedComponent.prototype.getLegendOptions = function () { var opts = { scaleType: this.schemeType, colors: undefined, domain: [], title: undefined }; if (opts.scaleType === 'ordinal') { opts.domain = this.seriesDomain; opts.colors = this.colors; opts.title = this.legendTitle; } else { opts.domain = this.yDomain; opts.colors = this.colors.scale; } return opts; }; AreaChartStackedComponent.prototype.updateYAxisWidth = function (_a) { var width = _a.width; this.yAxisWidth = width; this.update(); }; AreaChartStackedComponent.prototype.updateXAxisHeight = function (_a) { var height = _a.height; this.xAxisHeight = height; this.update(); }; AreaChartStackedComponent.prototype.onActivate = function (item) { var idx = this.activeEntries.findIndex(function (d) { return d.name === item.name && d.value === item.value; }); if (idx > -1) { return; } this.activeEntries = [item].concat(this.activeEntries); this.activate.emit({ value: item, entries: this.activeEntries }); }; AreaChartStackedComponent.prototype.onDeactivate = function (item) { var idx = this.activeEntries.findIndex(function (d) { return d.name === item.name && d.value === item.value; }); this.activeEntries.splice(idx, 1); this.activeEntries = this.activeEntries.slice(); this.deactivate.emit({ value: item, entries: this.activeEntries }); }; AreaChartStackedComponent.prototype.deactivateAll = function () { this.activeEntries = this.activeEntries.slice(); for (var _i = 0, _a = this.activeEntries; _i < _a.length; _i++) { var entry = _a[_i]; this.deactivate.emit({ value: entry, entries: [] }); } this.activeEntries = []; }; __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], AreaChartStackedComponent.prototype, "legend", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", String) ], AreaChartStackedComponent.prototype, "legendTitle", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], AreaChartStackedComponent.prototype, "xAxis", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], AreaChartStackedComponent.prototype, "yAxis", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], AreaChartStackedComponent.prototype, "showXAxisLabel", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], AreaChartStackedComponent.prototype, "showYAxisLabel", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], AreaChartStackedComponent.prototype, "xAxisLabel", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], AreaChartStackedComponent.prototype, "yAxisLabel", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], AreaChartStackedComponent.prototype, "timeline", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], AreaChartStackedComponent.prototype, "gradient", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], AreaChartStackedComponent.prototype, "showGridLines", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], AreaChartStackedComponent.prototype, "curve", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Array) ], AreaChartStackedComponent.prototype, "activeEntries", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", String) ], AreaChartStackedComponent.prototype, "schemeType", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], AreaChartStackedComponent.prototype, "xAxisTickFormatting", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], AreaChartStackedComponent.prototype, "yAxisTickFormatting", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Array) ], AreaChartStackedComponent.prototype, "xAxisTicks", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Array) ], AreaChartStackedComponent.prototype, "yAxisTicks", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], AreaChartStackedComponent.prototype, "roundDomains", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], AreaChartStackedComponent.prototype, "tooltipDisabled", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], AreaChartStackedComponent.prototype, "xScaleMin", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], AreaChartStackedComponent.prototype, "xScaleMax", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Number) ], AreaChartStackedComponent.prototype, "yScaleMin", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Number) ], AreaChartStackedComponent.prototype, "yScaleMax", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"]) ], AreaChartStackedComponent.prototype, "activate", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"]) ], AreaChartStackedComponent.prototype, "deactivate", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["ContentChild"])('tooltipTemplate'), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["TemplateRef"]) ], AreaChartStackedComponent.prototype, "tooltipTemplate", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["ContentChild"])('seriesTooltipTemplate'), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["TemplateRef"]) ], AreaChartStackedComponent.prototype, "seriesTooltipTemplate", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["HostListener"])('mouseleave'), __metadata("design:type", Function), __metadata("design:paramtypes", []), __metadata("design:returntype", void 0) ], AreaChartStackedComponent.prototype, "hideCircles", null); AreaChartStackedComponent = __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ selector: 'ngx-charts-area-chart-stacked', template: "\n <ngx-charts-chart\n [view]=\"[width, height]\"\n [showLegend]=\"legend\"\n [legendOptions]=\"legendOptions\"\n [activeEntries]=\"activeEntries\"\n [animations]=\"animations\"\n (legendLabelClick)=\"onClick($event)\"\n (legendLabelActivate)=\"onActivate($event)\"\n (legendLabelDeactivate)=\"onDeactivate($event)\">\n <svg:defs>\n <svg:clipPath [attr.id]=\"clipPathId\">\n <svg:rect\n [attr.width]=\"dims.width + 10\"\n [attr.height]=\"dims.height + 10\"\n [attr.transform]=\"'translate(-5, -5)'\"/>\n </svg:clipPath>\n </svg:defs>\n <svg:g [attr.transform]=\"transform\" class=\"area-chart chart\">\n <svg:g ngx-charts-x-axis\n *ngIf=\"xAxis\"\n [xScale]=\"xScale\"\n [dims]=\"dims\"\n [showGridLines]=\"showGridLines\"\n [showLabel]=\"showXAxisLabel\"\n [labelText]=\"xAxisLabel\"\n [tickFormatting]=\"xAxisTickFormatting\"\n [ticks]=\"xAxisTicks\"\n (dimensionsChanged)=\"updateXAxisHeight($event)\">\n </svg:g>\n <svg:g ngx-charts-y-axis\n *ngIf=\"yAxis\"\n [yScale]=\"yScale\"\n [dims]=\"dims\"\n [showGridLines]=\"showGridLines\"\n [showLabel]=\"showYAxisLabel\"\n [labelText]=\"yAxisLabel\"\n [tickFormatting]=\"yAxisTickFormatting\"\n [ticks]=\"yAxisTicks\"\n (dimensionsChanged)=\"updateYAxisWidth($event)\">\n </svg:g>\n <svg:g [attr.clip-path]=\"clipPath\">\n <svg:g *ngFor=\"let series of results; trackBy:trackBy\">\n <svg:g ngx-charts-area-series\n [xScale]=\"xScale\"\n [yScale]=\"yScale\"\n [colors]=\"colors\"\n [data]=\"series\"\n [scaleType]=\"scaleType\"\n [gradient]=\"gradient\"\n [activeEntries]=\"activeEntries\"\n stacked=\"true\"\n [curve]=\"curve\"\n [animations]=\"animations\"\n />\n </svg:g>\n\n <svg:g *ngIf=\"!tooltipDisabled\" (mouseleave)=\"hideCircles()\">\n <svg:g ngx-charts-tooltip-area\n [dims]=\"dims\"\n [xSet]=\"xSet\"\n [xScale]=\"xScale\"\n [yScale]=\"yScale\"\n [results]=\"results\"\n [colors]=\"colors\"\n [tooltipDisabled]=\"tooltipDisabled\"\n [tooltipTemplate]=\"seriesTooltipTemplate\"\n (hover)=\"updateHoveredVertical($event)\"\n />\n\n <svg:g *ngFor=\"let series of results; trackBy:trackBy\">\n <svg:g ngx-charts-circle-series\n type=\"stacked\"\n [xScale]=\"xScale\"\n [yScale]=\"yScale\"\n [colors]=\"colors\"\n [activeEntries]=\"activeEntries\"\n [data]=\"series\"\n [scaleType]=\"scaleType\"\n [visibleValue]=\"hoveredVertical\"\n [tooltipDisabled]=\"tooltipDisabled\"\n [tooltipTemplate]=\"tooltipTemplate\"\n (select)=\"onClick($event, series)\"\n (activate)=\"onActivate($event)\"\n (deactivate)=\"onDeactivate($event)\"\n />\n </svg:g>\n </svg:g>\n </svg:g>\n </svg:g>\n <svg:g ngx-charts-timeline\n *ngIf=\"timeline && scaleType != 'ordinal'\"\n [attr.transform]=\"timelineTransform\"\n [results]=\"results\"\n [view]=\"[timelineWidth, height]\"\n [height]=\"timelineHeight\"\n [scheme]=\"scheme\"\n [customColors]=\"customColors\"\n [legend]=\"legend\"\n [scaleType]=\"scaleType\"\n (onDomainChange)=\"updateDomain($event)\">\n <svg:g *ngFor=\"let series of results; trackBy:trackBy\">\n <svg:g ngx-charts-area-series\n [xScale]=\"timelineXScale\"\n [yScale]=\"timelineYScale\"\n [colors]=\"colors\"\n [data]=\"series\"\n [scaleType]=\"scaleType\"\n [gradient]=\"gradient\"\n stacked=\"true\"\n [curve]=\"curve\"\n [animations]=\"animations\"\n />\n </svg:g>\n </svg:g>\n </ngx-charts-chart>\n ", changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectionStrategy"].OnPush, styles: [__webpack_require__("./src/common/base-chart.component.scss")], encapsulation: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ViewEncapsulation"].None }) ], AreaChartStackedComponent); return AreaChartStackedComponent; }(__WEBPACK_IMPORTED_MODULE_5__common_base_chart_component__["a" /* BaseChartComponent */])); /***/ }), /***/ "./src/area-chart/area-chart.component.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return AreaChartComponent; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("@angular/core"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_d3_scale__ = __webpack_require__("d3-scale"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_d3_scale___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_d3_scale__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_d3_shape__ = __webpack_require__("d3-shape"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_d3_shape___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_d3_shape__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__common_view_dimensions_helper__ = __webpack_require__("./src/common/view-dimensions.helper.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__common_color_helper__ = __webpack_require__("./src/common/color.helper.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__common_base_chart_component__ = __webpack_require__("./src/common/base-chart.component.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__utils_id__ = __webpack_require__("./src/utils/id.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__common_domain_helper__ = __webpack_require__("./src/common/domain.helper.ts"); var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var AreaChartComponent = /** @class */ (function (_super) { __extends(AreaChartComponent, _super); function AreaChartComponent() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.legendTitle = 'Legend'; _this.baseValue = 'auto'; _this.showGridLines = true; _this.curve = __WEBPACK_IMPORTED_MODULE_2_d3_shape__["curveLinear"]; _this.activeEntries = []; _this.roundDomains = false; _this.tooltipDisabled = false; _this.activate = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); _this.deactivate = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); _this.margin = [10, 20, 10, 20]; _this.xAxisHeight = 0; _this.yAxisWidth = 0; _this.timelineHeight = 50; _this.timelinePadding = 10; return _this; } AreaChartComponent.prototype.update = function () { _super.prototype.update.call(this); this.dims = Object(__WEBPACK_IMPORTED_MODULE_3__common_view_dimensions_helper__["a" /* calculateViewDimensions */])({ width: this.width, height: this.height, margins: this.margin, showXAxis: this.xAxis, showYAxis: this.yAxis, xAxisHeight: this.xAxisHeight, yAxisWidth: this.yAxisWidth, showXLabel: this.showXAxisLabel, showYLabel: this.showYAxisLabel, showLegend: this.legend, legendType: this.schemeType }); if (this.timeline) { this.dims.height -= (this.timelineHeight + this.margin[2] + this.timelinePadding); } this.xDomain = this.getXDomain(); if (this.filteredDomain) { this.xDomain = this.filteredDomain; } this.yDomain = this.getYDomain(); this.seriesDomain = this.getSeriesDomain(); this.xScale = this.getXScale(this.xDomain, this.dims.width); this.yScale = this.getYScale(this.yDomain, this.dims.height); this.updateTimeline(); this.setColors(); this.legendOptions = this.getLegendOptions(); this.transform = "translate(" + this.dims.xOffset + ", " + this.margin[0] + ")"; this.clipPathId = 'clip' + Object(__WEBPACK_IMPORTED_MODULE_6__utils_id__["a" /* id */])().toString(); this.clipPath = "url(#" + this.clipPathId + ")"; }; AreaChartComponent.prototype.updateTimeline = function () { if (this.timeline) { this.timelineWidth = this.dims.width; this.timelineXDomain = this.getXDomain(); this.timelineXScale = this.getXScale(this.timelineXDomain, this.timelineWidth); this.timelineYScale = this.getYScale(this.yDomain, this.timelineHeight); this.timelineTransform = "translate(" + this.dims.xOffset + ", " + -this.margin[2] + ")"; } }; AreaChartComponent.prototype.getXDomain = function () { var values = Object(__WEBPACK_IMPORTED_MODULE_7__common_domain_helper__["a" /* getUniqueXDomainValues */])(this.results); this.scaleType = this.getScaleType(values); var domain = []; if (this.scaleType === 'linear') { values = values.map(function (v) { return Number(v); }); } var min; var max; if (this.scaleType === 'time' || this.scaleType === 'linear') { min = this.xScaleMin ? this.xScaleMin : Math.min.apply(Math, values); max = this.xScaleMax ? this.xScaleMax : Math.max.apply(Math, values); } if (this.scaleType === 'time') { domain = [new Date(min), new Date(max)]; this.xSet = values.slice().sort(function (a, b) { var aDate = a.getTime(); var bDate = b.getTime(); if (aDate > bDate) return 1; if (bDate > aDate) return -1; return 0; }); } else if (this.scaleType === 'linear') { domain = [min, max]; // Use compare function to sort numbers numerically this.xSet = values.slice().sort(function (a, b) { return (a - b); }); } else { domain = values; this.xSet = values; } return domain; }; AreaChartComponent.prototype.getYDomain = function () { var domain = []; for (var _i = 0, _a = this.results; _i < _a.length; _i++) { var results = _a[_i]; for (var _b = 0, _c = results.series; _b < _c.length; _b++) { var d = _c[_b]; if (!domain.includes(d.value)) { domain.push(d.value); } } } var values = domain.slice(); if (!this.autoScale) { values.push(0); } if (this.baseValue !== 'auto') { values.push(this.baseValue); } var min = this.yScaleMin ? this.yScaleMin : Math.min.apply(Math, values); var max = this.yScaleMax ? this.yScaleMax : Math.max.apply(Math, values); return [min, max]; }; AreaChartComponent.prototype.getSeriesDomain = function () { return this.results.map(function (d) { return d.name; }); }; AreaChartComponent.prototype.getXScale = function (domain, width) { var scale; if (this.scaleType === 'time') { scale = Object(__WEBPACK_IMPORTED_MODULE_1_d3_scale__["scaleTime"])(); } else if (this.scaleType === 'linear') { scale = Object(__WEBPACK_IMPORTED_MODULE_1_d3_scale__["scaleLinear"])(); } else if (this.scaleType === 'ordinal') { scale = Object(__WEBPACK_IMPORTED_MODULE_1_d3_scale__["scalePoint"])() .padding(0.1); } scale.range([0, width]) .domain(domain); return this.roundDomains ? scale.nice() : scale; }; AreaChartComponent.prototype.getYScale = function (domain, height) { var scale = Object(__WEBPACK_IMPORTED_MODULE_1_d3_scale__["scaleLinear"])() .range([height, 0]) .domain(domain); return this.roundDomains ? scale.nice() : scale; }; AreaChartComponent.prototype.getScaleType = function (values) { var date = true; var num = true; for (var _i = 0, values_1 = values; _i < values_1.length; _i++) { var value = values_1[_i]; if (!this.isDate(value)) { date = false; } if (typeof value !== 'number') { num = false; } } if (date) { return 'time'; } if (num) { return 'linear'; } return 'ordinal'; }; AreaChartComponent.prototype.isDate = function (value) { if (value instanceof Date) { return true; } return false; }; AreaChartComponent.prototype.updateDomain = function (domain) { this.filteredDomain = domain; this.xDomain = this.filteredDomain; this.xScale = this.getXScale(this.xDomain, this.dims.width); }; AreaChartComponent.prototype.updateHoveredVertical = function (item) { this.hoveredVertical = item.value; this.deactivateAll(); }; AreaChartComponent.prototype.hideCircles = function () { this.hoveredVertical = null; this.deactivateAll(); }; AreaChartComponent.prototype.onClick = function (data, series) { if (series) { data.series = series.name; } this.select.emit(data); }; AreaChartComponent.prototype.trackBy = function (index, item) { return item.name; }; AreaChartComponent.prototype.setColors = function () { var domain; if (this.schemeType === 'ordinal') { domain = this.seriesDomain; } else { domain = this.yDomain; } this.colors = new __WEBPACK_IMPORTED_MODULE_4__common_color_helper__["a" /* ColorHelper */](this.scheme, this.schemeType, domain, this.customColors); }; AreaChartComponent.prototype.getLegendOptions = function () { var opts = { scaleType: this.schemeType, colors: undefined, domain: [], title: undefined }; if (opts.scaleType === 'ordinal') { opts.domain = this.seriesDomain; opts.colors = this.colors; opts.title = this.legendTitle; } else { opts.domain = this.yDomain; opts.colors = this.colors.scale; } return opts; }; AreaChartComponent.prototype.updateYAxisWidth = function (_a) { var width = _a.width; this.yAxisWidth = width; this.update(); }; AreaChartComponent.prototype.updateXAxisHeight = function (_a) { var height = _a.height; this.xAxisHeight = height; this.update(); }; AreaChartComponent.prototype.onActivate = function (item) { var idx = this.activeEntries.findIndex(function (d) { return d.name === item.name && d.value === item.value; }); if (idx > -1) { return; } this.activeEntries = [item].concat(this.activeEntries); this.activate.emit({ value: item, entries: this.activeEntries }); }; AreaChartComponent.prototype.onDeactivate = function (item) { var idx = this.activeEntries.findIndex(function (d) { return d.name === item.name && d.value === item.value; }); this.activeEntries.splice(idx, 1); this.activeEntries = this.activeEntries.slice(); this.deactivate.emit({ value: item, entries: this.activeEntries }); }; AreaChartComponent.prototype.deactivateAll = function () { this.activeEntries = this.activeEntries.slice(); for (var _i = 0, _a = this.activeEntries; _i < _a.length; _i++) { var entry = _a[_i]; this.deactivate.emit({ value: entry, entries: [] }); } this.activeEntries = []; }; __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], AreaChartComponent.prototype, "legend", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", String) ], AreaChartComponent.prototype, "legendTitle", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], AreaChartComponent.prototype, "state", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], AreaChartComponent.prototype, "xAxis", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], AreaChartComponent.prototype, "yAxis", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], AreaChartComponent.prototype, "baseValue", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], AreaChartComponent.prototype, "autoScale", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], AreaChartComponent.prototype, "showXAxisLabel", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], AreaChartComponent.prototype, "showYAxisLabel", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], AreaChartComponent.prototype, "xAxisLabel", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], AreaChartComponent.prototype, "yAxisLabel", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], AreaChartComponent.prototype, "timeline", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], AreaChartComponent.prototype, "gradient", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], AreaChartComponent.prototype, "showGridLines", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], AreaChartComponent.prototype, "curve", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Array) ], AreaChartComponent.prototype, "activeEntries", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", String) ], AreaChartComponent.prototype, "schemeType", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], AreaChartComponent.prototype, "xAxisTickFormatting", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], AreaChartComponent.prototype, "yAxisTickFormatting", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Array) ], AreaChartComponent.prototype, "xAxisTicks", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Array) ], AreaChartComponent.prototype, "yAxisTicks", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], AreaChartComponent.prototype, "roundDomains", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], AreaChartComponent.prototype, "tooltipDisabled", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], AreaChartComponent.prototype, "xScaleMin", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], AreaChartComponent.prototype, "xScaleMax", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Number) ], AreaChartComponent.prototype, "yScaleMin", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Number) ], AreaChartComponent.prototype, "yScaleMax", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"]) ], AreaChartComponent.prototype, "activate", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"]) ], AreaChartComponent.prototype, "deactivate", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["ContentChild"])('tooltipTemplate'), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["TemplateRef"]) ], AreaChartComponent.prototype, "tooltipTemplate", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["ContentChild"])('seriesTooltipTemplate'), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["TemplateRef"]) ], AreaChartComponent.prototype, "seriesTooltipTemplate", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["HostListener"])('mouseleave'), __metadata("design:type", Function), __metadata("design:paramtypes", []), __metadata("design:returntype", void 0) ], AreaChartComponent.prototype, "hideCircles", null); AreaChartComponent = __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ selector: 'ngx-charts-area-chart', template: "\n <ngx-charts-chart\n [view]=\"[width, height]\"\n [showLegend]=\"legend\"\n [legendOptions]=\"legendOptions\"\n [activeEntries]=\"activeEntries\"\n [animations]=\"animations\"\n (legendLabelClick)=\"onClick($event)\"\n (legendLabelActivate)=\"onActivate($event)\"\n (legendLabelDeactivate)=\"onDeactivate($event)\">\n <svg:defs>\n <svg:clipPath [attr.id]=\"clipPathId\">\n <svg:rect\n [attr.width]=\"dims.width + 10\"\n [attr.height]=\"dims.height + 10\"\n [attr.transform]=\"'translate(-5, -5)'\"/>\n </svg:clipPath>\n </svg:defs>\n <svg:g [attr.transform]=\"transform\" class=\"area-chart chart\">\n <svg:g ngx-charts-x-axis\n *ngIf=\"xAxis\"\n [xScale]=\"xScale\"\n [dims]=\"dims\"\n [showGridLines]=\"showGridLines\"\n [showLabel]=\"showXAxisLabel\"\n [labelText]=\"xAxisLabel\"\n [tickFormatting]=\"xAxisTickFormatting\"\n [ticks]=\"xAxisTicks\"\n (dimensionsChanged)=\"updateXAxisHeight($event)\">\n </svg:g>\n <svg:g ngx-charts-y-axis\n *ngIf=\"yAxis\"\n [yScale]=\"yScale\"\n [dims]=\"dims\"\n [showGridLines]=\"showGridLines\"\n [showLabel]=\"showYAxisLabel\"\n [labelText]=\"yAxisLabel\"\n [tickFormatting]=\"yAxisTickFormatting\"\n [ticks]=\"yAxisTicks\"\n (dimensionsChanged)=\"updateYAxisWidth($event)\">\n </svg:g>\n <svg:g [attr.clip-path]=\"clipPath\">\n <svg:g *ngFor=\"let series of results; trackBy:trackBy\">\n <svg:g ngx-charts-area-series\n [xScale]=\"xScale\"\n [yScale]=\"yScale\"\n [baseValue]=\"baseValue\"\n [colors]=\"colors\"\n [data]=\"series\"\n [activeEntries]=\"activeEntries\"\n [scaleType]=\"scaleType\"\n [gradient]=\"gradient\"\n [curve]=\"curve\"\n [animations]=\"animations\"\n />\n </svg:g>\n\n <svg:g *ngIf=\"!tooltipDisabled\" (mouseleave)=\"hideCircles()\">\n <svg:g ngx-charts-tooltip-area\n [dims]=\"dims\"\n [xSet]=\"xSet\"\n [xScale]=\"xScale\"\n [yScale]=\"yScale\"\n [results]=\"results\"\n [colors]=\"colors\"\n [tooltipDisabled]=\"tooltipDisabled\"\n [tooltipTemplate]=\"seriesTooltipTemplate\"\n (hover)=\"updateHoveredVertical($event)\"\n />\n\n <svg:g *ngFor=\"let series of results\">\n <svg:g ngx-charts-circle-series\n [xScale]=\"xScale\"\n [yScale]=\"yScale\"\n [colors]=\"colors\"\n [activeEntries]=\"activeEntries\"\n [data]=\"series\"\n [scaleType]=\"scaleType\"\n [visibleValue]=\"hoveredVertical\"\n [tooltipDisabled]=\"tooltipDisabled\"\n [tooltipTemplate]=\"tooltipTemplate\"\n (select)=\"onClick($event, series)\"\n (activate)=\"onActivate($event)\"\n (deactivate)=\"onDeactivate($event)\"\n />\n </svg:g>\n </svg:g>\n </svg:g>\n </svg:g>\n <svg:g ngx-charts-timeline\n *ngIf=\"timeline && scaleType != 'ordinal'\"\n [attr.transform]=\"timelineTransform\"\n [results]=\"results\"\n [view]=\"[timelineWidth, height]\"\n [height]=\"timelineHeight\"\n [scheme]=\"scheme\"\n [customColors]=\"customColors\"\n [legend]=\"legend\"\n [scaleType]=\"scaleType\"\n (onDomainChange)=\"updateDomain($event)\">\n <svg:g *ngFor=\"let series of results; trackBy:trackBy\">\n <svg:g ngx-charts-area-series\n [xScale]=\"timelineXScale\"\n [yScale]=\"timelineYScale\"\n [baseValue]=\"baseValue\"\n [colors]=\"colors\"\n [data]=\"series\"\n [scaleType]=\"scaleType\"\n [gradient]=\"gradient\"\n [curve]=\"curve\"\n [animations]=\"animations\"\n />\n </svg:g>\n </svg:g>\n </ngx-charts-chart>\n ", changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectionStrategy"].OnPush, styles: [__webpack_require__("./src/common/base-chart.component.scss")], encapsulation: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ViewEncapsulation"].None }) ], AreaChartComponent); return AreaChartComponent; }(__WEBPACK_IMPORTED_MODULE_5__common_base_chart_component__["a" /* BaseChartComponent */])); /***/ }), /***/ "./src/area-chart/area-chart.module.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return AreaChartModule; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("@angular/core"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__area_chart_component__ = __webpack_require__("./src/area-chart/area-chart.component.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__area_chart_normalized_component__ = __webpack_require__("./src/area-chart/area-chart-normalized.component.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__area_chart_stacked_component__ = __webpack_require__("./src/area-chart/area-chart-stacked.component.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__area_series_component__ = __webpack_require__("./src/area-chart/area-series.component.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__common_chart_common_module__ = __webpack_require__("./src/common/chart-common.module.ts"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return __WEBPACK_IMPORTED_MODULE_1__area_chart_component__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return __WEBPACK_IMPORTED_MODULE_2__area_chart_normalized_component__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return __WEBPACK_IMPORTED_MODULE_3__area_chart_stacked_component__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return __WEBPACK_IMPORTED_MODULE_4__area_series_component__["a"]; }); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var AreaChartModule = /** @class */ (function () { function AreaChartModule() { } AreaChartModule = __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["NgModule"])({ imports: [__WEBPACK_IMPORTED_MODULE_5__common_chart_common_module__["a" /* ChartCommonModule */]], declarations: [ __WEBPACK_IMPORTED_MODULE_1__area_chart_component__["a" /* AreaChartComponent */], __WEBPACK_IMPORTED_MODULE_2__area_chart_normalized_component__["a" /* AreaChartNormalizedComponent */], __WEBPACK_IMPORTED_MODULE_3__area_chart_stacked_component__["a" /* AreaChartStackedComponent */], __WEBPACK_IMPORTED_MODULE_4__area_series_component__["a" /* AreaSeriesComponent */] ], exports: [ __WEBPACK_IMPORTED_MODULE_1__area_chart_component__["a" /* AreaChartComponent */], __WEBPACK_IMPORTED_MODULE_2__area_chart_normalized_component__["a" /* AreaChartNormalizedComponent */], __WEBPACK_IMPORTED_MODULE_3__area_chart_stacked_component__["a" /* AreaChartStackedComponent */], __WEBPACK_IMPORTED_MODULE_4__area_series_component__["a" /* AreaSeriesComponent */] ] }) ], AreaChartModule); return AreaChartModule; }()); /***/ }), /***/ "./src/area-chart/area-series.component.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return AreaSeriesComponent; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("@angular/core"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_d3_shape__ = __webpack_require__("d3-shape"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_d3_shape___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_d3_shape__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__utils_sort__ = __webpack_require__("./src/utils/sort.ts"); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var AreaSeriesComponent = /** @class */ (function () { function AreaSeriesComponent() { this.baseValue = 'auto'; this.stacked = false; this.normalized = false; this.animations = true; this.select = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); } AreaSeriesComponent.prototype.ngOnChanges = function (changes) { this.update(); }; AreaSeriesComponent.prototype.update = function () { var _this = this; this.updateGradient(); var currentArea; var startingArea; var xProperty = function (d) { var label = d.name; return _this.xScale(label); }; if (this.stacked || this.normalized) { currentArea = Object(__WEBPACK_IMPORTED_MODULE_1_d3_shape__["area"])() .x(xProperty) .y0(function (d, i) { return _this.yScale(d.d0); }) .y1(function (d, i) { return _this.yScale(d.d1); }); startingArea = Object(__WEBPACK_IMPORTED_MODULE_1_d3_shape__["area"])() .x(xProperty) .y0(function (d) { return _this.yScale.range()[0]; }) .y1(function (d) { return _this.yScale.range()[0]; }); } else { currentArea = Object(__WEBPACK_IMPORTED_MODULE_1_d3_shape__["area"])() .x(xProperty) .y0(function () { return _this.baseValue === 'auto' ? _this.yScale.range()[0] : _this.yScale(_this.baseValue); }) .y1(function (d) { return _this.yScale(d.value); }); startingArea = Object(__WEBPACK_IMPORTED_MODULE_1_d3_shape__["area"])() .x(xProperty) .y0(function (d) { return _this.baseValue === 'auto' ? _this.yScale.range()[0] : _this.yScale(_this.baseValue); }) .y1(function (d) { return _this.baseValue === 'auto' ? _this.yScale.range()[0] : _this.yScale(_this.baseValue); }); } currentArea.curve(this.curve); startingArea.curve(this.curve); this.opacity = .8; var data = this.data.series; if (this.scaleType === 'linear') { data = Object(__WEBPACK_IMPORTED_MODULE_2__utils_sort__["c" /* sortLinear */])(data, 'name'); } else if (this.scaleType === 'time') { data = Object(__WEBPACK_IMPORTED_MODULE_2__utils_sort__["b" /* sortByTime */])(data, 'name'); } else { data = Object(__WEBPACK_IMPORTED_MODULE_2__utils_sort__["a" /* sortByDomain */])(data, 'name', 'asc', this.xScale.domain()); } this.path = currentArea(data); this.startingPath = startingArea(data); }; AreaSeriesComponent.prototype.updateGradient = function () { if (this.colors.scaleType === 'linear') { this.hasGradient = true; if (this.stacked || this.normalized) { var d0values = this.data.series.map(function (d) { return d.d0; }); var d1values = this.data.series.map(function (d) { return d.d1; }); var max = Math.max.apply(Math, d1values); var min = Math.min.apply(Math, d0values); this.gradientStops = this.colors.getLinearGradientStops(max, min); } else { var values = this.data.series.map(function (d) { return d.value; }); var max = Math.max.apply(Math, values); this.gradientStops = this.colors.getLinearGradientStops(max); } } else { this.hasGradient = false; this.gradientStops = undefined; } }; AreaSeriesComponent.prototype.isActive = function (entry) { if (!this.activeEntries) return false; var item = this.activeEntries.find(function (d) { return entry.name === d.name; }); return item !== undefined; }; AreaSeriesComponent.prototype.isInactive = function (entry) { if (!this.activeEntries || this.activeEntries.length === 0) return false; var item = this.activeEntries.find(function (d) { return entry.name === d.name; }); return item === undefined; }; __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], AreaSeriesComponent.prototype, "data", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], AreaSeriesComponent.prototype, "xScale", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], AreaSeriesComponent.prototype, "yScale", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], AreaSeriesComponent.prototype, "baseValue", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], AreaSeriesComponent.prototype, "colors", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], AreaSeriesComponent.prototype, "scaleType", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], AreaSeriesComponent.prototype, "stacked", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], AreaSeriesComponent.prototype, "normalized", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], AreaSeriesComponent.prototype, "gradient", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], AreaSeriesComponent.prototype, "curve", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Array) ], AreaSeriesComponent.prototype, "activeEntries", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], AreaSeriesComponent.prototype, "animations", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", Object) ], AreaSeriesComponent.prototype, "select", void 0); AreaSeriesComponent = __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ selector: 'g[ngx-charts-area-series]', template: "\n <svg:g ngx-charts-area\n class=\"area-series\"\n [data]=\"data\"\n [path]=\"path\"\n [fill]=\"colors.getColor(data.name)\"\n [stops]=\"gradientStops\"\n [startingPath]=\"startingPath\"\n [opacity]=\"opacity\"\n [gradient]=\"gradient || hasGradient\"\n [animations]=\"animations\"\n [class.active]=\"isActive(data)\"\n [class.inactive]=\"isInactive(data)\"\n />\n ", changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectionStrategy"].OnPush }) ], AreaSeriesComponent); return AreaSeriesComponent; }()); /***/ }), /***/ "./src/area-chart/index.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__area_chart_module__ = __webpack_require__("./src/area-chart/area-chart.module.ts"); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "a", function() { return __WEBPACK_IMPORTED_MODULE_0__area_chart_module__["a"]; }); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "b", function() { return __WEBPACK_IMPORTED_MODULE_0__area_chart_module__["b"]; }); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "c", function() { return __WEBPACK_IMPORTED_MODULE_0__area_chart_module__["c"]; }); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "d", function() { return __WEBPACK_IMPORTED_MODULE_0__area_chart_module__["d"]; }); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "e", function() { return __WEBPACK_IMPORTED_MODULE_0__area_chart_module__["e"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__area_chart_component__ = __webpack_require__("./src/area-chart/area-chart.component.ts"); /* unused harmony namespace reexport */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__area_chart_normalized_component__ = __webpack_require__("./src/area-chart/area-chart-normalized.component.ts"); /* unused harmony namespace reexport */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__area_chart_stacked_component__ = __webpack_require__("./src/area-chart/area-chart-stacked.component.ts"); /* unused harmony namespace reexport */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__area_series_component__ = __webpack_require__("./src/area-chart/area-series.component.ts"); /* unused harmony namespace reexport */ /***/ }), /***/ "./src/bar-chart/bar-chart.module.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return BarChartModule; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("@angular/core"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__common_chart_common_module__ = __webpack_require__("./src/common/chart-common.module.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__bar_component__ = __webpack_require__("./src/bar-chart/bar.component.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__bar_horizontal_component__ = __webpack_require__("./src/bar-chart/bar-horizontal.component.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__bar_horizontal_2d_component__ = __webpack_require__("./src/bar-chart/bar-horizontal-2d.component.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__bar_horizontal_normalized_component__ = __webpack_require__("./src/bar-chart/bar-horizontal-normalized.component.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__bar_horizontal_stacked_component__ = __webpack_require__("./src/bar-chart/bar-horizontal-stacked.component.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__bar_vertical_component__ = __webpack_require__("./src/bar-chart/bar-vertical.component.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__bar_vertical_2d_component__ = __webpack_require__("./src/bar-chart/bar-vertical-2d.component.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__bar_vertical_normalized_component__ = __webpack_require__("./src/bar-chart/bar-vertical-normalized.component.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__bar_vertical_stacked_component__ = __webpack_require__("./src/bar-chart/bar-vertical-stacked.component.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__series_horizontal_component__ = __webpack_require__("./src/bar-chart/series-horizontal.component.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__series_vertical_component__ = __webpack_require__("./src/bar-chart/series-vertical.component.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__bar_label_component__ = __webpack_require__("./src/bar-chart/bar-label.component.ts"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return __WEBPACK_IMPORTED_MODULE_13__bar_label_component__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return __WEBPACK_IMPORTED_MODULE_2__bar_component__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return __WEBPACK_IMPORTED_MODULE_3__bar_horizontal_component__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return __WEBPACK_IMPORTED_MODULE_4__bar_horizontal_2d_component__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return __WEBPACK_IMPORTED_MODULE_5__bar_horizontal_normalized_component__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return __WEBPACK_IMPORTED_MODULE_6__bar_horizontal_stacked_component__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return __WEBPACK_IMPORTED_MODULE_7__bar_vertical_component__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return __WEBPACK_IMPORTED_MODULE_8__bar_vertical_2d_component__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return __WEBPACK_IMPORTED_MODULE_9__bar_vertical_normalized_component__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return __WEBPACK_IMPORTED_MODULE_10__bar_vertical_stacked_component__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "l", function() { return __WEBPACK_IMPORTED_MODULE_11__series_horizontal_component__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "m", function() { return __WEBPACK_IMPORTED_MODULE_12__series_vertical_component__["b"]; }); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var BarChartModule = /** @class */ (function () { function BarChartModule() { } BarChartModule = __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["NgModule"])({ imports: [__WEBPACK_IMPORTED_MODULE_1__common_chart_common_module__["a" /* ChartCommonModule */]], declarations: [ __WEBPACK_IMPORTED_MODULE_2__bar_component__["a" /* BarComponent */], __WEBPACK_IMPORTED_MODULE_3__bar_horizontal_component__["a" /* BarHorizontalComponent */], __WEBPACK_IMPORTED_MODULE_4__bar_horizontal_2d_component__["a" /* BarHorizontal2DComponent */], __WEBPACK_IMPORTED_MODULE_5__bar_horizontal_normalized_component__["a" /* BarHorizontalNormalizedComponent */], __WEBPACK_IMPORTED_MODULE_6__bar_horizontal_stacked_component__["a" /* BarHorizontalStackedComponent */], __WEBPACK_IMPORTED_MODULE_7__bar_vertical_component__["a" /* BarVerticalComponent */], __WEBPACK_IMPORTED_MODULE_8__bar_vertical_2d_component__["a" /* BarVertical2DComponent */], __WEBPACK_IMPORTED_MODULE_9__bar_vertical_normalized_component__["a" /* BarVerticalNormalizedComponent */], __WEBPACK_IMPORTED_MODULE_10__bar_vertical_stacked_component__["a" /* BarVerticalStackedComponent */], __WEBPACK_IMPORTED_MODULE_13__bar_label_component__["a" /* BarLabelComponent */], __WEBPACK_IMPORTED_MODULE_11__series_horizontal_component__["a" /* SeriesHorizontal */], __WEBPACK_IMPORTED_MODULE_12__series_vertical_component__["b" /* SeriesVerticalComponent */] ], exports: [ __WEBPACK_IMPORTED_MODULE_2__bar_component__["a" /* BarComponent */], __WEBPACK_IMPORTED_MODULE_3__bar_horizontal_component__["a" /* BarHorizontalComponent */], __WEBPACK_IMPORTED_MODULE_4__bar_horizontal_2d_component__["a" /* BarHorizontal2DComponent */], __WEBPACK_IMPORTED_MODULE_5__bar_horizontal_normalized_component__["a" /* BarHorizontalNormalizedComponent */], __WEBPACK_IMPORTED_MODULE_6__bar_horizontal_stacked_component__["a" /* BarHorizontalStackedComponent */], __WEBPACK_IMPORTED_MODULE_7__bar_vertical_component__["a" /* BarVerticalComponent */], __WEBPACK_IMPORTED_MODULE_8__bar_vertical_2d_component__["a" /* BarVertical2DComponent */], __WEBPACK_IMPORTED_MODULE_9__bar_vertical_normalized_component__["a" /* BarVerticalNormalizedComponent */], __WEBPACK_IMPORTED_MODULE_10__bar_vertical_stacked_component__["a" /* BarVerticalStackedComponent */], __WEBPACK_IMPORTED_MODULE_13__bar_label_component__["a" /* BarLabelComponent */], __WEBPACK_IMPORTED_MODULE_11__series_horizontal_component__["a" /* SeriesHorizontal */], __WEBPACK_IMPORTED_MODULE_12__series_vertical_component__["b" /* SeriesVerticalComponent */] ] }) ], BarChartModule); return BarChartModule; }()); /***/ }), /***/ "./src/bar-chart/bar-horizontal-2d.component.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return BarHorizontal2DComponent; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("@angular/core"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_animations__ = __webpack_require__("@angular/animations"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_animations___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1__angular_animations__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_d3_scale__ = __webpack_require__("d3-scale"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_d3_scale___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_d3_scale__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__common_view_dimensions_helper__ = __webpack_require__("./src/common/view-dimensions.helper.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__common_color_helper__ = __webpack_require__("./src/common/color.helper.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__common_base_chart_component__ = __webpack_require__("./src/common/base-chart.component.ts"); var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var BarHorizontal2DComponent = /** @class */ (function (_super) { __extends(BarHorizontal2DComponent, _super); function BarHorizontal2DComponent() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.legend = false; _this.legendTitle = 'Legend'; _this.tooltipDisabled = false; _this.showGridLines = true; _this.activeEntries = []; _this.groupPadding = 16; _this.barPadding = 8; _this.roundDomains = false; _this.roundEdges = true; _this.showDataLabel = false; _this.activate = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); _this.deactivate = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); _this.margin = [10, 20, 10, 20]; _this.xAxisHeight = 0; _this.yAxisWidth = 0; _this.dataLabelMaxWidth = { negative: 0, positive: 0 }; return _this; } BarHorizontal2DComponent.prototype.update = function () { _super.prototype.update.call(this); if (!this.showDataLabel) { this.dataLabelMaxWidth = { negative: 0, positive: 0 }; } this.margin = [10, 20 + this.dataLabelMaxWidth.positive, 10, 20 + this.dataLabelMaxWidth.negative]; this.dims = Object(__WEBPACK_IMPORTED_MODULE_3__common_view_dimensions_helper__["a" /* calculateViewDimensions */])({ width: this.width, height: this.height, margins: this.margin, showXAxis: this.xAxis, showYAxis: this.yAxis, xAxisHeight: this.xAxisHeight, yAxisWidth: this.yAxisWidth, showXLabel: this.showXAxisLabel, showYLabel: this.showYAxisLabel, showLegend: this.legend, legendType: this.schemeType }); this.formatDates(); this.groupDomain = this.getGroupDomain(); this.innerDomain = this.getInnerDomain(); this.valuesDomain = this.getValueDomain(); this.groupScale = this.getGroupScale(); this.innerScale = this.getInnerScale(); this.valueScale = this.getValueScale(); this.setColors(); this.legendOptions = this.getLegendOptions(); this.transform = "translate(" + this.dims.xOffset + " , " + this.margin[0] + ")"; }; BarHorizontal2DComponent.prototype.getGroupScale = function () { var spacing = this.groupDomain.length / (this.dims.height / this.groupPadding + 1); return Object(__WEBPACK_IMPORTED_MODULE_2_d3_scale__["scaleBand"])() .rangeRound([0, this.dims.height]) .paddingInner(spacing) .paddingOuter(spacing / 2) .domain(this.groupDomain); }; BarHorizontal2DComponent.prototype.getInnerScale = function () { var height = this.groupScale.bandwidth(); var spacing = this.innerDomain.length / (height / this.barPadding + 1); return Object(__WEBPACK_IMPORTED_MODULE_2_d3_scale__["scaleBand"])() .rangeRound([0, height]) .paddingInner(spacing) .domain(this.innerDomain); }; BarHorizontal2DComponent.prototype.getValueScale = function () { var scale = Object(__WEBPACK_IMPORTED_MODULE_2_d3_scale__["scaleLinear"])() .range([0, this.dims.width]) .domain(this.valuesDomain); return this.roundDomains ? scale.nice() : scale; }; BarHorizontal2DComponent.prototype.getGroupDomain = function () { var domain = []; for (var _i = 0, _a = this.results; _i < _a.length; _i++) { var group = _a[_i]; if (!domain.includes(group.name)) { domain.push(group.name); } } return domain; }; BarHorizontal2DComponent.prototype.getInnerDomain = function () { var domain = []; for (var _i = 0, _a = this.results; _i < _a.length; _i++) { var group = _a[_i]; for (var _b = 0, _c = group.series; _b < _c.length; _b++) { var d = _c[_b]; if (!domain.includes(d.name)) { domain.push(d.name); } } } return domain; }; BarHorizontal2DComponent.prototype.getValueDomain = function () { var domain = []; for (var _i = 0, _a = this.results; _i < _a.length; _i++) { var group = _a[_i]; for (var _b = 0, _c = group.series; _b < _c.length; _b++) { var d = _c[_b]; if (!domain.includes(d.value)) { domain.push(d.value); } } } var min = Math.min.apply(Math, [0].concat(domain)); var max = this.xScaleMax ? Math.max.apply(Math, [this.xScaleMax].concat(domain)) : Math.max.apply(Math, domain); return [min, max]; }; BarHorizontal2DComponent.prototype.groupTransform = function (group) { return "translate(0, " + this.groupScale(group.name) + ")"; }; BarHorizontal2DComponent.prototype.onClick = function (data, group) { if (group) { data.series = group.name; } this.select.emit(data); }; BarHorizontal2DComponent.prototype.trackBy = function (index, item) { return item.name; }; BarHorizontal2DComponent.prototype.setColors = function () { var domain; if (this.schemeType === 'ordinal') { domain = this.innerDomain; } else { domain = this.valuesDomain; } this.colors = new __WEBPACK_IMPORTED_MODULE_4__common_color_helper__["a" /* ColorHelper */](this.scheme, this.schemeType, domain, this.customColors); }; BarHorizontal2DComponent.prototype.getLegendOptions = function () { var opts = { scaleType: this.schemeType, colors: undefined, domain: [], title: undefined }; if (opts.scaleType === 'ordinal') { opts.domain = this.innerDomain; opts.colors = this.colors; opts.title = this.legendTitle; } else { opts.domain = this.valuesDomain; opts.colors = this.colors.scale; } return opts; }; BarHorizontal2DComponent.prototype.updateYAxisWidth = function (_a) { var width = _a.width; this.yAxisWidth = width; this.update(); }; BarHorizontal2DComponent.prototype.updateXAxisHeight = function (_a) { var height = _a.height; this.xAxisHeight = height; this.update(); }; BarHorizontal2DComponent.prototype.onDataLabelMaxWidthChanged = function (event, groupIndex) { var _this = this; if (event.size.negative) { this.dataLabelMaxWidth.negative = Math.max(this.dataLabelMaxWidth.negative, event.size.width); } else { this.dataLabelMaxWidth.positive = Math.max(this.dataLabelMaxWidth.positive, event.size.width); } if (groupIndex === (this.results.length - 1)) { setTimeout(function () { return _this.update(); }); } }; BarHorizontal2DComponent.prototype.onActivate = function (event, group) { var item = Object.assign({}, event); if (group) { item.series = group.name; } var idx = this.activeEntries.findIndex(function (d) { return d.name === item.name && d.value === item.value && d.series === item.series; }); if (idx > -1) { return; } this.activeEntries = [item].concat(this.activeEntries); this.activate.emit({ value: item, entries: this.activeEntries }); }; BarHorizontal2DComponent.prototype.onDeactivate = function (event, group) { var item = Object.assign({}, event); if (group) { item.series = group.name; } var idx = this.activeEntries.findIndex(function (d) { return d.name === item.name && d.value === item.value && d.series === item.series; }); this.activeEntries.splice(idx, 1); this.activeEntries = this.activeEntries.slice(); this.deactivate.emit({ value: item, entries: this.activeEntries }); }; __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarHorizontal2DComponent.prototype, "legend", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", String) ], BarHorizontal2DComponent.prototype, "legendTitle", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarHorizontal2DComponent.prototype, "xAxis", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarHorizontal2DComponent.prototype, "yAxis", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarHorizontal2DComponent.prototype, "showXAxisLabel", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarHorizontal2DComponent.prototype, "showYAxisLabel", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarHorizontal2DComponent.prototype, "xAxisLabel", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarHorizontal2DComponent.prototype, "yAxisLabel", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], BarHorizontal2DComponent.prototype, "tooltipDisabled", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], BarHorizontal2DComponent.prototype, "gradient", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], BarHorizontal2DComponent.prototype, "showGridLines", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Array) ], BarHorizontal2DComponent.prototype, "activeEntries", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", String) ], BarHorizontal2DComponent.prototype, "schemeType", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarHorizontal2DComponent.prototype, "xAxisTickFormatting", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarHorizontal2DComponent.prototype, "yAxisTickFormatting", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Array) ], BarHorizontal2DComponent.prototype, "xAxisTicks", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Array) ], BarHorizontal2DComponent.prototype, "yAxisTicks", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarHorizontal2DComponent.prototype, "groupPadding", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarHorizontal2DComponent.prototype, "barPadding", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], BarHorizontal2DComponent.prototype, "roundDomains", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], BarHorizontal2DComponent.prototype, "roundEdges", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Number) ], BarHorizontal2DComponent.prototype, "xScaleMax", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], BarHorizontal2DComponent.prototype, "showDataLabel", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarHorizontal2DComponent.prototype, "dataLabelFormatting", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"]) ], BarHorizontal2DComponent.prototype, "activate", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"]) ], BarHorizontal2DComponent.prototype, "deactivate", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["ContentChild"])('tooltipTemplate'), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["TemplateRef"]) ], BarHorizontal2DComponent.prototype, "tooltipTemplate", void 0); BarHorizontal2DComponent = __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ selector: 'ngx-charts-bar-horizontal-2d', template: "\n <ngx-charts-chart\n [view]=\"[width, height]\"\n [showLegend]=\"legend\"\n [legendOptions]=\"legendOptions\"\n [activeEntries]=\"activeEntries\"\n [animations]=\"animations\"\n (legendLabelActivate)=\"onActivate($event)\"\n (legendLabelDeactivate)=\"onDeactivate($event)\"\n (legendLabelClick)=\"onClick($event)\">\n <svg:g [attr.transform]=\"transform\" class=\"bar-chart chart\">\n <svg:g ngx-charts-grid-panel-series\n [xScale]=\"valueScale\"\n [yScale]=\"groupScale\"\n [data]=\"results\"\n [dims]=\"dims\"\n orient=\"horizontal\">\n </svg:g>\n <svg:g ngx-charts-x-axis\n *ngIf=\"xAxis\"\n [xScale]=\"valueScale\"\n [dims]=\"dims\"\n [showGridLines]=\"showGridLines\"\n [showLabel]=\"showXAxisLabel\"\n [labelText]=\"xAxisLabel\"\n [tickFormatting]=\"xAxisTickFormatting\"\n [ticks]=\"xAxisTicks\"\n (dimensionsChanged)=\"updateXAxisHeight($event)\">\n </svg:g>\n <svg:g ngx-charts-y-axis\n *ngIf=\"yAxis\"\n [yScale]=\"groupScale\"\n [dims]=\"dims\"\n [showLabel]=\"showYAxisLabel\"\n [labelText]=\"yAxisLabel\"\n [tickFormatting]=\"yAxisTickFormatting\"\n [ticks]=\"yAxisTicks\"\n [yAxisOffset]=\"dataLabelMaxWidth.negative\"\n (dimensionsChanged)=\"updateYAxisWidth($event)\">\n </svg:g>\n <svg:g\n *ngFor=\"let group of results; let index = index; trackBy:trackBy\"\n [@animationState]=\"'active'\"\n [attr.transform]=\"groupTransform(group)\">\n <svg:g ngx-charts-series-horizontal\n [xScale]=\"valueScale\"\n [activeEntries]=\"activeEntries\"\n [yScale]=\"innerScale\"\n [colors]=\"colors\"\n [series]=\"group.series\"\n [dims]=\"dims\"\n [gradient]=\"gradient\"\n [tooltipDisabled]=\"tooltipDisabled\"\n [tooltipTemplate]=\"tooltipTemplate\"\n [seriesName]=\"group.name\"\n [roundEdges]=\"roundEdges\"\n [animations]=\"animations\"\n [showDataLabel]=\"showDataLabel\"\n [dataLabelFormatting]=\"dataLabelFormatting\"\n (select)=\"onClick($event, group)\"\n (activate)=\"onActivate($event, group)\"\n (deactivate)=\"onDeactivate($event, group)\"\n (dataLabelWidthChanged)=\"onDataLabelMaxWidthChanged($event, index)\"\n />\n </svg:g>\n </svg:g>\n </ngx-charts-chart>\n ", changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectionStrategy"].OnPush, styles: [__webpack_require__("./src/common/base-chart.component.scss")], encapsulation: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ViewEncapsulation"].None, animations: [ Object(__WEBPACK_IMPORTED_MODULE_1__angular_animations__["trigger"])('animationState', [ Object(__WEBPACK_IMPORTED_MODULE_1__angular_animations__["transition"])(':leave', [ Object(__WEBPACK_IMPORTED_MODULE_1__angular_animations__["style"])({ opacity: 1, transform: '*', }), Object(__WEBPACK_IMPORTED_MODULE_1__angular_animations__["animate"])(500, Object(__WEBPACK_IMPORTED_MODULE_1__angular_animations__["style"])({ opacity: 0, transform: 'scale(0)' })) ]) ]) ] }) ], BarHorizontal2DComponent); return BarHorizontal2DComponent; }(__WEBPACK_IMPORTED_MODULE_5__common_base_chart_component__["a" /* BaseChartComponent */])); /***/ }), /***/ "./src/bar-chart/bar-horizontal-normalized.component.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return BarHorizontalNormalizedComponent; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("@angular/core"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_animations__ = __webpack_require__("@angular/animations"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_animations___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1__angular_animations__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_d3_scale__ = __webpack_require__("d3-scale"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_d3_scale___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_d3_scale__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__common_view_dimensions_helper__ = __webpack_require__("./src/common/view-dimensions.helper.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__common_color_helper__ = __webpack_require__("./src/common/color.helper.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__common_base_chart_component__ = __webpack_require__("./src/common/base-chart.component.ts"); var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var BarHorizontalNormalizedComponent = /** @class */ (function (_super) { __extends(BarHorizontalNormalizedComponent, _super); function BarHorizontalNormalizedComponent() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.legend = false; _this.legendTitle = 'Legend'; _this.tooltipDisabled = false; _this.showGridLines = true; _this.activeEntries = []; _this.barPadding = 8; _this.roundDomains = false; _this.activate = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); _this.deactivate = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); _this.margin = [10, 20, 10, 20]; _this.xAxisHeight = 0; _this.yAxisWidth = 0; return _this; } BarHorizontalNormalizedComponent.prototype.update = function () { _super.prototype.update.call(this); this.dims = Object(__WEBPACK_IMPORTED_MODULE_3__common_view_dimensions_helper__["a" /* calculateViewDimensions */])({ width: this.width, height: this.height, margins: this.margin, showXAxis: this.xAxis, showYAxis: this.yAxis, xAxisHeight: this.xAxisHeight, yAxisWidth: this.yAxisWidth, showXLabel: this.showXAxisLabel, showYLabel: this.showYAxisLabel, showLegend: this.legend, legendType: this.schemeType }); this.formatDates(); this.groupDomain = this.getGroupDomain(); this.innerDomain = this.getInnerDomain(); this.valueDomain = this.getValueDomain(); this.xScale = this.getXScale(); this.yScale = this.getYScale(); this.setColors(); this.legendOptions = this.getLegendOptions(); this.transform = "translate(" + this.dims.xOffset + " , " + this.margin[0] + ")"; }; BarHorizontalNormalizedComponent.prototype.getGroupDomain = function () { var domain = []; for (var _i = 0, _a = this.results; _i < _a.length; _i++) { var group = _a[_i]; if (!domain.includes(group.name)) { domain.push(group.name); } } return domain; }; BarHorizontalNormalizedComponent.prototype.getInnerDomain = function () { var domain = []; for (var _i = 0, _a = this.results; _i < _a.length; _i++) { var group = _a[_i]; for (var _b = 0, _c = group.series; _b < _c.length; _b++) { var d = _c[_b]; if (!domain.includes(d.name)) { domain.push(d.name); } } } return domain; }; BarHorizontalNormalizedComponent.prototype.getValueDomain = function () { return [0, 100]; }; BarHorizontalNormalizedComponent.prototype.getYScale = function () { var spacing = this.groupDomain.length / (this.dims.height / this.barPadding + 1); return Object(__WEBPACK_IMPORTED_MODULE_2_d3_scale__["scaleBand"])() .rangeRound([0, this.dims.height]) .paddingInner(spacing) .domain(this.groupDomain); }; BarHorizontalNormalizedComponent.prototype.getXScale = function () { var scale = Object(__WEBPACK_IMPORTED_MODULE_2_d3_scale__["scaleLinear"])() .range([0, this.dims.width]) .domain(this.valueDomain); return this.roundDomains ? scale.nice() : scale; }; BarHorizontalNormalizedComponent.prototype.groupTransform = function (group) { return "translate(0, " + this.yScale(group.name) + ")"; }; BarHorizontalNormalizedComponent.prototype.onClick = function (data, group) { if (group) { data.series = group.name; } this.select.emit(data); }; BarHorizontalNormalizedComponent.prototype.trackBy = function (index, item) { return item.name; }; BarHorizontalNormalizedComponent.prototype.setColors = function () { var domain; if (this.schemeType === 'ordinal') { domain = this.innerDomain; } else { domain = this.valueDomain; } this.colors = new __WEBPACK_IMPORTED_MODULE_4__common_color_helper__["a" /* ColorHelper */](this.scheme, this.schemeType, domain, this.customColors); }; BarHorizontalNormalizedComponent.prototype.getLegendOptions = function () { var opts = { scaleType: this.schemeType, colors: undefined, domain: [], title: undefined }; if (opts.scaleType === 'ordinal') { opts.domain = this.innerDomain; opts.colors = this.colors; opts.title = this.legendTitle; } else { opts.domain = this.valueDomain; opts.colors = this.colors.scale; } return opts; }; BarHorizontalNormalizedComponent.prototype.updateYAxisWidth = function (_a) { var width = _a.width; this.yAxisWidth = width; this.update(); }; BarHorizontalNormalizedComponent.prototype.updateXAxisHeight = function (_a) { var height = _a.height; this.xAxisHeight = height; this.update(); }; BarHorizontalNormalizedComponent.prototype.onActivate = function (event, group) { var item = Object.assign({}, event); if (group) { item.series = group.name; } var idx = this.activeEntries.findIndex(function (d) { return d.name === item.name && d.value === item.value && d.series === item.series; }); if (idx > -1) { return; } this.activeEntries = [item].concat(this.activeEntries); this.activate.emit({ value: item, entries: this.activeEntries }); }; BarHorizontalNormalizedComponent.prototype.onDeactivate = function (event, group) { var item = Object.assign({}, event); if (group) { item.series = group.name; } var idx = this.activeEntries.findIndex(function (d) { return d.name === item.name && d.value === item.value && d.series === item.series; }); this.activeEntries.splice(idx, 1); this.activeEntries = this.activeEntries.slice(); this.deactivate.emit({ value: item, entries: this.activeEntries }); }; __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarHorizontalNormalizedComponent.prototype, "legend", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", String) ], BarHorizontalNormalizedComponent.prototype, "legendTitle", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarHorizontalNormalizedComponent.prototype, "xAxis", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarHorizontalNormalizedComponent.prototype, "yAxis", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarHorizontalNormalizedComponent.prototype, "showXAxisLabel", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarHorizontalNormalizedComponent.prototype, "showYAxisLabel", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarHorizontalNormalizedComponent.prototype, "xAxisLabel", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarHorizontalNormalizedComponent.prototype, "yAxisLabel", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], BarHorizontalNormalizedComponent.prototype, "tooltipDisabled", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], BarHorizontalNormalizedComponent.prototype, "gradient", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], BarHorizontalNormalizedComponent.prototype, "showGridLines", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Array) ], BarHorizontalNormalizedComponent.prototype, "activeEntries", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", String) ], BarHorizontalNormalizedComponent.prototype, "schemeType", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarHorizontalNormalizedComponent.prototype, "xAxisTickFormatting", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarHorizontalNormalizedComponent.prototype, "yAxisTickFormatting", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Array) ], BarHorizontalNormalizedComponent.prototype, "xAxisTicks", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Array) ], BarHorizontalNormalizedComponent.prototype, "yAxisTicks", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarHorizontalNormalizedComponent.prototype, "barPadding", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], BarHorizontalNormalizedComponent.prototype, "roundDomains", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"]) ], BarHorizontalNormalizedComponent.prototype, "activate", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"]) ], BarHorizontalNormalizedComponent.prototype, "deactivate", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["ContentChild"])('tooltipTemplate'), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["TemplateRef"]) ], BarHorizontalNormalizedComponent.prototype, "tooltipTemplate", void 0); BarHorizontalNormalizedComponent = __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ selector: 'ngx-charts-bar-horizontal-normalized', template: "\n <ngx-charts-chart\n [view]=\"[width, height]\"\n [showLegend]=\"legend\"\n [legendOptions]=\"legendOptions\"\n [activeEntries]=\"activeEntries\"\n [animations]=\"animations\"\n (legendLabelActivate)=\"onActivate($event)\"\n (legendLabelDeactivate)=\"onDeactivate($event)\"\n (legendLabelClick)=\"onClick($event)\">\n <svg:g [attr.transform]=\"transform\" class=\"bar-chart chart\">\n <svg:g ngx-charts-x-axis\n *ngIf=\"xAxis\"\n [xScale]=\"xScale\"\n [dims]=\"dims\"\n [showGridLines]=\"showGridLines\"\n [showLabel]=\"showXAxisLabel\"\n [labelText]=\"xAxisLabel\"\n [tickFormatting]=\"xAxisTickFormatting\"\n [ticks]=\"xAxisTicks\"\n (dimensionsChanged)=\"updateXAxisHeight($event)\">\n </svg:g>\n <svg:g ngx-charts-y-axis\n *ngIf=\"yAxis\"\n [yScale]=\"yScale\"\n [dims]=\"dims\"\n [showLabel]=\"showYAxisLabel\"\n [labelText]=\"yAxisLabel\"\n [tickFormatting]=\"yAxisTickFormatting\"\n [ticks]=\"yAxisTicks\"\n (dimensionsChanged)=\"updateYAxisWidth($event)\">\n </svg:g>\n <svg:g\n *ngFor=\"let group of results; trackBy:trackBy\"\n [@animationState]=\"'active'\"\n [attr.transform]=\"groupTransform(group)\">\n <svg:g ngx-charts-series-horizontal\n type=\"normalized\"\n [xScale]=\"xScale\"\n [yScale]=\"yScale\"\n [activeEntries]=\"activeEntries\"\n [colors]=\"colors\"\n [series]=\"group.series\"\n [dims]=\"dims\"\n [gradient]=\"gradient\"\n [tooltipDisabled]=\"tooltipDisabled\"\n [tooltipTemplate]=\"tooltipTemplate\"\n [seriesName]=\"group.name\"\n [animations]=\"animations\"\n (select)=\"onClick($event, group)\"\n (activate)=\"onActivate($event, group)\"\n (deactivate)=\"onDeactivate($event, group)\"\n />\n </svg:g>\n </svg:g>\n </ngx-charts-chart>\n ", changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectionStrategy"].OnPush, styles: [__webpack_require__("./src/common/base-chart.component.scss")], encapsulation: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ViewEncapsulation"].None, animations: [ Object(__WEBPACK_IMPORTED_MODULE_1__angular_animations__["trigger"])('animationState', [ Object(__WEBPACK_IMPORTED_MODULE_1__angular_animations__["transition"])(':leave', [ Object(__WEBPACK_IMPORTED_MODULE_1__angular_animations__["style"])({ opacity: 1, transform: '*', }), Object(__WEBPACK_IMPORTED_MODULE_1__angular_animations__["animate"])(500, Object(__WEBPACK_IMPORTED_MODULE_1__angular_animations__["style"])({ opacity: 0, transform: 'scale(0)' })) ]) ]) ] }) ], BarHorizontalNormalizedComponent); return BarHorizontalNormalizedComponent; }(__WEBPACK_IMPORTED_MODULE_5__common_base_chart_component__["a" /* BaseChartComponent */])); /***/ }), /***/ "./src/bar-chart/bar-horizontal-stacked.component.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return BarHorizontalStackedComponent; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("@angular/core"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_animations__ = __webpack_require__("@angular/animations"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_animations___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1__angular_animations__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_d3_scale__ = __webpack_require__("d3-scale"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_d3_scale___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_d3_scale__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__common_view_dimensions_helper__ = __webpack_require__("./src/common/view-dimensions.helper.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__common_color_helper__ = __webpack_require__("./src/common/color.helper.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__common_base_chart_component__ = __webpack_require__("./src/common/base-chart.component.ts"); var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var BarHorizontalStackedComponent = /** @class */ (function (_super) { __extends(BarHorizontalStackedComponent, _super); function BarHorizontalStackedComponent() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.legend = false; _this.legendTitle = 'Legend'; _this.tooltipDisabled = false; _this.showGridLines = true; _this.activeEntries = []; _this.barPadding = 8; _this.roundDomains = false; _this.showDataLabel = false; _this.activate = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); _this.deactivate = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); _this.margin = [10, 20, 10, 20]; _this.xAxisHeight = 0; _this.yAxisWidth = 0; _this.dataLabelMaxWidth = { negative: 0, positive: 0 }; return _this; } BarHorizontalStackedComponent.prototype.update = function () { _super.prototype.update.call(this); if (!this.showDataLabel) { this.dataLabelMaxWidth = { negative: 0, positive: 0 }; } this.margin = [10, 20 + this.dataLabelMaxWidth.positive, 10, 20 + this.dataLabelMaxWidth.negative]; this.dims = Object(__WEBPACK_IMPORTED_MODULE_3__common_view_dimensions_helper__["a" /* calculateViewDimensions */])({ width: this.width, height: this.height, margins: this.margin, showXAxis: this.xAxis, showYAxis: this.yAxis, xAxisHeight: this.xAxisHeight, yAxisWidth: this.yAxisWidth, showXLabel: this.showXAxisLabel, showYLabel: this.showYAxisLabel, showLegend: this.legend, legendType: this.schemeType }); this.formatDates(); this.groupDomain = this.getGroupDomain(); this.innerDomain = this.getInnerDomain(); this.valueDomain = this.getValueDomain(); this.xScale = this.getXScale(); this.yScale = this.getYScale(); this.setColors(); this.legendOptions = this.getLegendOptions(); this.transform = "translate(" + this.dims.xOffset + " , " + this.margin[0] + ")"; }; BarHorizontalStackedComponent.prototype.getGroupDomain = function () { var domain = []; for (var _i = 0, _a = this.results; _i < _a.length; _i++) { var group = _a[_i]; if (!domain.includes(group.name)) { domain.push(group.name); } } return domain; }; BarHorizontalStackedComponent.prototype.getInnerDomain = function () { var domain = []; for (var _i = 0, _a = this.results; _i < _a.length; _i++) { var group = _a[_i]; for (var _b = 0, _c = group.series; _b < _c.length; _b++) { var d = _c[_b]; if (!domain.includes(d.name)) { domain.push(d.name); } } } return domain; }; BarHorizontalStackedComponent.prototype.getValueDomain = function () { var domain = []; var smallest = 0; var biggest = 0; for (var _i = 0, _a = this.results; _i < _a.length; _i++) { var group = _a[_i]; var smallestSum = 0; var biggestSum = 0; for (var _b = 0, _c = group.series; _b < _c.length; _b++) { var d = _c[_b]; if (d.value < 0) { smallestSum += d.value; } else { biggestSum += d.value; } smallest = d.value < smallest ? d.value : smallest; biggest = d.value > biggest ? d.value : biggest; } domain.push(smallestSum); domain.push(biggestSum); } domain.push(smallest); domain.push(biggest); var min = Math.min.apply(Math, [0].concat(domain)); var max = this.xScaleMax ? Math.max.apply(Math, [this.xScaleMax].concat(domain)) : Math.max.apply(Math, domain); return [min, max]; }; BarHorizontalStackedComponent.prototype.getYScale = function () { var spacing = this.groupDomain.length / (this.dims.height / this.barPadding + 1); return Object(__WEBPACK_IMPORTED_MODULE_2_d3_scale__["scaleBand"])() .rangeRound([0, this.dims.height]) .paddingInner(spacing) .domain(this.groupDomain); }; BarHorizontalStackedComponent.prototype.getXScale = function () { var scale = Object(__WEBPACK_IMPORTED_MODULE_2_d3_scale__["scaleLinear"])() .range([0, this.dims.width]) .domain(this.valueDomain); return this.roundDomains ? scale.nice() : scale; }; BarHorizontalStackedComponent.prototype.groupTransform = function (group) { return "translate(0, " + this.yScale(group.name) + ")"; }; BarHorizontalStackedComponent.prototype.onClick = function (data, group) { if (group) { data.series = group.name; } this.select.emit(data); }; BarHorizontalStackedComponent.prototype.trackBy = function (index, item) { return item.name; }; BarHorizontalStackedComponent.prototype.setColors = function () { var domain; if (this.schemeType === 'ordinal') { domain = this.innerDomain; } else { domain = this.valueDomain; } this.colors = new __WEBPACK_IMPORTED_MODULE_4__common_color_helper__["a" /* ColorHelper */](this.scheme, this.schemeType, domain, this.customColors); }; BarHorizontalStackedComponent.prototype.getLegendOptions = function () { var opts = { scaleType: this.schemeType, colors: undefined, domain: [], title: undefined }; if (opts.scaleType === 'ordinal') { opts.domain = this.innerDomain; opts.colors = this.colors; opts.title = this.legendTitle; } else { opts.domain = this.valueDomain; opts.colors = this.colors.scale; } return opts; }; BarHorizontalStackedComponent.prototype.updateYAxisWidth = function (_a) { var width = _a.width; this.yAxisWidth = width; this.update(); }; BarHorizontalStackedComponent.prototype.updateXAxisHeight = function (_a) { var height = _a.height; this.xAxisHeight = height; this.update(); }; BarHorizontalStackedComponent.prototype.onDataLabelMaxWidthChanged = function (event, groupIndex) { var _this = this; if (event.size.negative) { this.dataLabelMaxWidth.negative = Math.max(this.dataLabelMaxWidth.negative, event.size.width); } else { this.dataLabelMaxWidth.positive = Math.max(this.dataLabelMaxWidth.positive, event.size.width); } if (groupIndex === (this.results.length - 1)) { setTimeout(function () { return _this.update(); }); } }; BarHorizontalStackedComponent.prototype.onActivate = function (event, group) { var item = Object.assign({}, event); if (group) { item.series = group.name; } var idx = this.activeEntries.findIndex(function (d) { return d.name === item.name && d.value === item.value && d.series === item.series; }); if (idx > -1) { return; } this.activeEntries = [item].concat(this.activeEntries); this.activate.emit({ value: item, entries: this.activeEntries }); }; BarHorizontalStackedComponent.prototype.onDeactivate = function (event, group) { var item = Object.assign({}, event); if (group) { item.series = group.name; } var idx = this.activeEntries.findIndex(function (d) { return d.name === item.name && d.value === item.value && d.series === item.series; }); this.activeEntries.splice(idx, 1); this.activeEntries = this.activeEntries.slice(); this.deactivate.emit({ value: item, entries: this.activeEntries }); }; __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarHorizontalStackedComponent.prototype, "legend", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", String) ], BarHorizontalStackedComponent.prototype, "legendTitle", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarHorizontalStackedComponent.prototype, "xAxis", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarHorizontalStackedComponent.prototype, "yAxis", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarHorizontalStackedComponent.prototype, "showXAxisLabel", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarHorizontalStackedComponent.prototype, "showYAxisLabel", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarHorizontalStackedComponent.prototype, "xAxisLabel", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarHorizontalStackedComponent.prototype, "yAxisLabel", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], BarHorizontalStackedComponent.prototype, "tooltipDisabled", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], BarHorizontalStackedComponent.prototype, "gradient", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], BarHorizontalStackedComponent.prototype, "showGridLines", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Array) ], BarHorizontalStackedComponent.prototype, "activeEntries", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", String) ], BarHorizontalStackedComponent.prototype, "schemeType", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarHorizontalStackedComponent.prototype, "xAxisTickFormatting", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarHorizontalStackedComponent.prototype, "yAxisTickFormatting", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Array) ], BarHorizontalStackedComponent.prototype, "xAxisTicks", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Array) ], BarHorizontalStackedComponent.prototype, "yAxisTicks", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarHorizontalStackedComponent.prototype, "barPadding", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], BarHorizontalStackedComponent.prototype, "roundDomains", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Number) ], BarHorizontalStackedComponent.prototype, "xScaleMax", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], BarHorizontalStackedComponent.prototype, "showDataLabel", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarHorizontalStackedComponent.prototype, "dataLabelFormatting", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"]) ], BarHorizontalStackedComponent.prototype, "activate", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"]) ], BarHorizontalStackedComponent.prototype, "deactivate", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["ContentChild"])('tooltipTemplate'), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["TemplateRef"]) ], BarHorizontalStackedComponent.prototype, "tooltipTemplate", void 0); BarHorizontalStackedComponent = __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ selector: 'ngx-charts-bar-horizontal-stacked', template: "\n <ngx-charts-chart\n [view]=\"[width, height]\"\n [showLegend]=\"legend\"\n [legendOptions]=\"legendOptions\"\n [activeEntries]=\"activeEntries\"\n [animations]=\"animations\"\n (legendLabelActivate)=\"onActivate($event)\"\n (legendLabelDeactivate)=\"onDeactivate($event)\"\n (legendLabelClick)=\"onClick($event)\">\n <svg:g [attr.transform]=\"transform\" class=\"bar-chart chart\">\n <svg:g ngx-charts-x-axis\n *ngIf=\"xAxis\"\n [xScale]=\"xScale\"\n [dims]=\"dims\"\n [showGridLines]=\"showGridLines\"\n [showLabel]=\"showXAxisLabel\"\n [labelText]=\"xAxisLabel\"\n [tickFormatting]=\"xAxisTickFormatting\"\n [ticks]=\"xAxisTicks\"\n (dimensionsChanged)=\"updateXAxisHeight($event)\">\n </svg:g>\n <svg:g ngx-charts-y-axis\n *ngIf=\"yAxis\"\n [yScale]=\"yScale\"\n [dims]=\"dims\"\n [showLabel]=\"showYAxisLabel\"\n [labelText]=\"yAxisLabel\"\n [tickFormatting]=\"yAxisTickFormatting\"\n [ticks]=\"yAxisTicks\"\n [yAxisOffset]=\"dataLabelMaxWidth.negative\"\n (dimensionsChanged)=\"updateYAxisWidth($event)\">\n </svg:g>\n <svg:g\n *ngFor=\"let group of results; let index = index; trackBy:trackBy\"\n [@animationState]=\"'active'\"\n [attr.transform]=\"groupTransform(group)\">\n <svg:g ngx-charts-series-horizontal\n type=\"stacked\"\n [xScale]=\"xScale\"\n [yScale]=\"yScale\"\n [colors]=\"colors\"\n [series]=\"group.series\"\n [activeEntries]=\"activeEntries\"\n [dims]=\"dims\"\n [gradient]=\"gradient\"\n [tooltipDisabled]=\"tooltipDisabled\"\n [tooltipTemplate]=\"tooltipTemplate\"\n [seriesName]=\"group.name\"\n [animations]=\"animations\"\n [showDataLabel]=\"showDataLabel\"\n [dataLabelFormatting]=\"dataLabelFormatting\"\n (select)=\"onClick($event, group)\"\n (activate)=\"onActivate($event, group)\"\n (deactivate)=\"onDeactivate($event, group)\"\n (dataLabelWidthChanged)=\"onDataLabelMaxWidthChanged($event, index)\"\n />\n </svg:g>\n </svg:g>\n </ngx-charts-chart>\n ", changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectionStrategy"].OnPush, styles: [__webpack_require__("./src/common/base-chart.component.scss")], encapsulation: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ViewEncapsulation"].None, animations: [ Object(__WEBPACK_IMPORTED_MODULE_1__angular_animations__["trigger"])('animationState', [ Object(__WEBPACK_IMPORTED_MODULE_1__angular_animations__["transition"])(':leave', [ Object(__WEBPACK_IMPORTED_MODULE_1__angular_animations__["style"])({ opacity: 1, transform: '*', }), Object(__WEBPACK_IMPORTED_MODULE_1__angular_animations__["animate"])(500, Object(__WEBPACK_IMPORTED_MODULE_1__angular_animations__["style"])({ opacity: 0, transform: 'scale(0)' })) ]) ]) ] }) ], BarHorizontalStackedComponent); return BarHorizontalStackedComponent; }(__WEBPACK_IMPORTED_MODULE_5__common_base_chart_component__["a" /* BaseChartComponent */])); /***/ }), /***/ "./src/bar-chart/bar-horizontal.component.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return BarHorizontalComponent; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("@angular/core"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_d3_scale__ = __webpack_require__("d3-scale"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_d3_scale___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_d3_scale__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__common_view_dimensions_helper__ = __webpack_require__("./src/common/view-dimensions.helper.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__common_color_helper__ = __webpack_require__("./src/common/color.helper.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__common_base_chart_component__ = __webpack_require__("./src/common/base-chart.component.ts"); var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var BarHorizontalComponent = /** @class */ (function (_super) { __extends(BarHorizontalComponent, _super); function BarHorizontalComponent() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.legend = false; _this.legendTitle = 'Legend'; _this.tooltipDisabled = false; _this.showGridLines = true; _this.activeEntries = []; _this.barPadding = 8; _this.roundDomains = false; _this.roundEdges = true; _this.showDataLabel = false; _this.activate = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); _this.deactivate = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); _this.margin = [10, 20, 10, 20]; _this.xAxisHeight = 0; _this.yAxisWidth = 0; _this.dataLabelMaxWidth = { negative: 0, positive: 0 }; return _this; } BarHorizontalComponent.prototype.update = function () { _super.prototype.update.call(this); if (!this.showDataLabel) { this.dataLabelMaxWidth = { negative: 0, positive: 0 }; } this.margin = [10, 20 + this.dataLabelMaxWidth.positive, 10, 20 + this.dataLabelMaxWidth.negative]; this.dims = Object(__WEBPACK_IMPORTED_MODULE_2__common_view_dimensions_helper__["a" /* calculateViewDimensions */])({ width: this.width, height: this.height, margins: this.margin, showXAxis: this.xAxis, showYAxis: this.yAxis, xAxisHeight: this.xAxisHeight, yAxisWidth: this.yAxisWidth, showXLabel: this.showXAxisLabel, showYLabel: this.showYAxisLabel, showLegend: this.legend, legendType: this.schemeType }); this.xScale = this.getXScale(); this.yScale = this.getYScale(); this.setColors(); this.legendOptions = this.getLegendOptions(); this.transform = "translate(" + this.dims.xOffset + " , " + this.margin[0] + ")"; }; BarHorizontalComponent.prototype.getXScale = function () { this.xDomain = this.getXDomain(); var scale = Object(__WEBPACK_IMPORTED_MODULE_1_d3_scale__["scaleLinear"])() .range([0, this.dims.width]) .domain(this.xDomain); return this.roundDomains ? scale.nice() : scale; }; BarHorizontalComponent.prototype.getYScale = function () { this.yDomain = this.getYDomain(); var spacing = this.yDomain.length / (this.dims.height / this.barPadding + 1); return Object(__WEBPACK_IMPORTED_MODULE_1_d3_scale__["scaleBand"])() .rangeRound([0, this.dims.height]) .paddingInner(spacing) .domain(this.yDomain); }; BarHorizontalComponent.prototype.getXDomain = function () { var values = this.results.map(function (d) { return d.value; }); var min = this.xScaleMin ? Math.min.apply(Math, [this.xScaleMin].concat(values)) : Math.min.apply(Math, [0].concat(values)); var max = this.xScaleMax ? Math.max.apply(Math, [this.xScaleMax].concat(values)) : Math.max.apply(Math, values); return [min, max]; }; BarHorizontalComponent.prototype.getYDomain = function () { return this.results.map(function (d) { return d.name; }); }; BarHorizontalComponent.prototype.onClick = function (data) { this.select.emit(data); }; BarHorizontalComponent.prototype.setColors = function () { var domain; if (this.schemeType === 'ordinal') { domain = this.yDomain; } else { domain = this.xDomain; } this.colors = new __WEBPACK_IMPORTED_MODULE_3__common_color_helper__["a" /* ColorHelper */](this.scheme, this.schemeType, domain, this.customColors); }; BarHorizontalComponent.prototype.getLegendOptions = function () { var opts = { scaleType: this.schemeType, colors: undefined, domain: [], title: undefined }; if (opts.scaleType === 'ordinal') { opts.domain = this.yDomain; opts.colors = this.colors; opts.title = this.legendTitle; } else { opts.domain = this.xDomain; opts.colors = this.colors.scale; } return opts; }; BarHorizontalComponent.prototype.updateYAxisWidth = function (_a) { var width = _a.width; this.yAxisWidth = width; this.update(); }; BarHorizontalComponent.prototype.updateXAxisHeight = function (_a) { var height = _a.height; this.xAxisHeight = height; this.update(); }; BarHorizontalComponent.prototype.onDataLabelMaxWidthChanged = function (event) { var _this = this; if (event.size.negative) { this.dataLabelMaxWidth.negative = Math.max(this.dataLabelMaxWidth.negative, event.size.width); } else { this.dataLabelMaxWidth.positive = Math.max(this.dataLabelMaxWidth.positive, event.size.width); } if (event.index === (this.results.length - 1)) { setTimeout(function () { return _this.update(); }); } }; BarHorizontalComponent.prototype.onActivate = function (item) { var idx = this.activeEntries.findIndex(function (d) { return d.name === item.name && d.value === item.value && d.series === item.series; }); if (idx > -1) { return; } this.activeEntries = [item].concat(this.activeEntries); this.activate.emit({ value: item, entries: this.activeEntries }); }; BarHorizontalComponent.prototype.onDeactivate = function (item) { var idx = this.activeEntries.findIndex(function (d) { return d.name === item.name && d.value === item.value && d.series === item.series; }); this.activeEntries.splice(idx, 1); this.activeEntries = this.activeEntries.slice(); this.deactivate.emit({ value: item, entries: this.activeEntries }); }; __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarHorizontalComponent.prototype, "legend", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", String) ], BarHorizontalComponent.prototype, "legendTitle", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarHorizontalComponent.prototype, "xAxis", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarHorizontalComponent.prototype, "yAxis", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarHorizontalComponent.prototype, "showXAxisLabel", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarHorizontalComponent.prototype, "showYAxisLabel", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarHorizontalComponent.prototype, "xAxisLabel", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarHorizontalComponent.prototype, "yAxisLabel", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], BarHorizontalComponent.prototype, "tooltipDisabled", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], BarHorizontalComponent.prototype, "gradient", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], BarHorizontalComponent.prototype, "showGridLines", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Array) ], BarHorizontalComponent.prototype, "activeEntries", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", String) ], BarHorizontalComponent.prototype, "schemeType", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarHorizontalComponent.prototype, "xAxisTickFormatting", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarHorizontalComponent.prototype, "yAxisTickFormatting", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Array) ], BarHorizontalComponent.prototype, "xAxisTicks", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Array) ], BarHorizontalComponent.prototype, "yAxisTicks", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarHorizontalComponent.prototype, "barPadding", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], BarHorizontalComponent.prototype, "roundDomains", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], BarHorizontalComponent.prototype, "roundEdges", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Number) ], BarHorizontalComponent.prototype, "xScaleMax", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Number) ], BarHorizontalComponent.prototype, "xScaleMin", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], BarHorizontalComponent.prototype, "showDataLabel", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarHorizontalComponent.prototype, "dataLabelFormatting", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"]) ], BarHorizontalComponent.prototype, "activate", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"]) ], BarHorizontalComponent.prototype, "deactivate", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["ContentChild"])('tooltipTemplate'), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["TemplateRef"]) ], BarHorizontalComponent.prototype, "tooltipTemplate", void 0); BarHorizontalComponent = __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ selector: 'ngx-charts-bar-horizontal', template: "\n <ngx-charts-chart\n [view]=\"[width, height]\"\n [showLegend]=\"legend\"\n [legendOptions]=\"legendOptions\"\n [activeEntries]=\"activeEntries\"\n [animations]=\"animations\"\n (legendLabelClick)=\"onClick($event)\"\n (legendLabelActivate)=\"onActivate($event)\"\n (legendLabelDeactivate)=\"onDeactivate($event)\">\n <svg:g [attr.transform]=\"transform\" class=\"bar-chart chart\">\n <svg:g ngx-charts-x-axis\n *ngIf=\"xAxis\"\n [xScale]=\"xScale\"\n [dims]=\"dims\"\n [showGridLines]=\"showGridLines\"\n [showLabel]=\"showXAxisLabel\"\n [labelText]=\"xAxisLabel\"\n [tickFormatting]=\"xAxisTickFormatting\"\n [ticks]=\"xAxisTicks\"\n (dimensionsChanged)=\"updateXAxisHeight($event)\">\n </svg:g>\n <svg:g ngx-charts-y-axis\n *ngIf=\"yAxis\"\n [yScale]=\"yScale\"\n [dims]=\"dims\"\n [showLabel]=\"showYAxisLabel\"\n [labelText]=\"yAxisLabel\"\n [tickFormatting]=\"yAxisTickFormatting\"\n [ticks]=\"yAxisTicks\"\n [yAxisOffset]=\"dataLabelMaxWidth.negative\"\n (dimensionsChanged)=\"updateYAxisWidth($event)\">\n </svg:g>\n <svg:g ngx-charts-series-horizontal\n [xScale]=\"xScale\"\n [yScale]=\"yScale\"\n [colors]=\"colors\"\n [series]=\"results\"\n [dims]=\"dims\"\n [gradient]=\"gradient\"\n [tooltipDisabled]=\"tooltipDisabled\"\n [tooltipTemplate]=\"tooltipTemplate\"\n [activeEntries]=\"activeEntries\"\n [roundEdges]=\"roundEdges\"\n [animations]=\"animations\"\n [showDataLabel]=\"showDataLabel\"\n [dataLabelFormatting]=\"dataLabelFormatting\"\n (select)=\"onClick($event)\"\n (activate)=\"onActivate($event)\"\n (deactivate)=\"onDeactivate($event)\"\n (dataLabelWidthChanged)=\"onDataLabelMaxWidthChanged($event)\"\n >\n </svg:g>\n </svg:g>\n </ngx-charts-chart>\n ", changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectionStrategy"].OnPush, styles: [__webpack_require__("./src/common/base-chart.component.scss")], encapsulation: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ViewEncapsulation"].None }) ], BarHorizontalComponent); return BarHorizontalComponent; }(__WEBPACK_IMPORTED_MODULE_4__common_base_chart_component__["a" /* BaseChartComponent */])); /***/ }), /***/ "./src/bar-chart/bar-label.component.scss": /***/ (function(module, exports, __webpack_require__) { var result = __webpack_require__("./node_modules/css-loader/index.js!./node_modules/postcss-loader/index.js!./node_modules/sass-loader/lib/loader.js??ref--3-4!./src/bar-chart/bar-label.component.scss"); if (typeof result === "string") { module.exports = result; } else { module.exports = result.toString(); } /***/ }), /***/ "./src/bar-chart/bar-label.component.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return BarLabelComponent; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("@angular/core"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1____ = __webpack_require__("./src/index.ts"); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var BarLabelComponent = /** @class */ (function () { function BarLabelComponent(element) { this.dimensionsChanged = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); this.horizontalPadding = 2; this.verticalPadding = 5; this.element = element.nativeElement; } BarLabelComponent.prototype.ngOnChanges = function (changes) { this.update(); }; BarLabelComponent.prototype.getSize = function () { var h = this.element.getBoundingClientRect().height; var w = this.element.getBoundingClientRect().width; return { height: h, width: w, negative: this.value < 0 }; }; BarLabelComponent.prototype.ngAfterViewInit = function () { this.dimensionsChanged.emit(this.getSize()); }; BarLabelComponent.prototype.update = function () { if (this.valueFormatting) { this.formatedValue = this.valueFormatting(this.value); } else { this.formatedValue = Object(__WEBPACK_IMPORTED_MODULE_1____["formatLabel"])(this.value); } if (this.orientation === 'horizontal') { this.x = this.barX + this.barWidth; // if the value is negative then it's on the left of the x0. // we need to put the data label in front of the bar if (this.value < 0) { this.x = this.x - this.horizontalPadding; this.textAnchor = 'end'; } else { this.x = this.x + this.horizontalPadding; this.textAnchor = 'start'; } this.y = this.barY + this.barHeight / 2; } else { // orientation must be "vertical" this.x = this.barX + this.barWidth / 2; this.y = this.barY + this.barHeight; if (this.value < 0) { this.y = this.y + this.verticalPadding; this.textAnchor = 'end'; } else { this.y = this.y - this.verticalPadding; this.textAnchor = 'start'; } this.transform = "rotate(-45, " + this.x + " , " + this.y + ")"; } }; __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarLabelComponent.prototype, "value", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarLabelComponent.prototype, "valueFormatting", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarLabelComponent.prototype, "barX", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarLabelComponent.prototype, "barY", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarLabelComponent.prototype, "barWidth", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarLabelComponent.prototype, "barHeight", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarLabelComponent.prototype, "orientation", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"]) ], BarLabelComponent.prototype, "dimensionsChanged", void 0); BarLabelComponent = __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ selector: 'g[ngx-charts-bar-label]', template: " \n <svg:text \n class=\"textDataLabel\" \n alignment-baseline=\"middle\" \n [attr.text-anchor]=\"textAnchor\"\n [attr.transform]=\"transform\"\n [attr.x]=\"x\" \n [attr.y]=\"y\">\n {{formatedValue}} \n </svg:text> \n\n ", styles: [__webpack_require__("./src/bar-chart/bar-label.component.scss")], changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectionStrategy"].OnPush }), __metadata("design:paramtypes", [__WEBPACK_IMPORTED_MODULE_0__angular_core__["ElementRef"]]) ], BarLabelComponent); return BarLabelComponent; }()); /***/ }), /***/ "./src/bar-chart/bar-vertical-2d.component.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return BarVertical2DComponent; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("@angular/core"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_animations__ = __webpack_require__("@angular/animations"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_animations___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1__angular_animations__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_d3_scale__ = __webpack_require__("d3-scale"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_d3_scale___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_d3_scale__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__common_view_dimensions_helper__ = __webpack_require__("./src/common/view-dimensions.helper.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__common_color_helper__ = __webpack_require__("./src/common/color.helper.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__common_base_chart_component__ = __webpack_require__("./src/common/base-chart.component.ts"); var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var BarVertical2DComponent = /** @class */ (function (_super) { __extends(BarVertical2DComponent, _super); function BarVertical2DComponent() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.legend = false; _this.legendTitle = 'Legend'; _this.tooltipDisabled = false; _this.scaleType = 'ordinal'; _this.showGridLines = true; _this.activeEntries = []; _this.groupPadding = 16; _this.barPadding = 8; _this.roundDomains = false; _this.roundEdges = true; _this.showDataLabel = false; _this.activate = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); _this.deactivate = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); _this.margin = [10, 20, 10, 20]; _this.xAxisHeight = 0; _this.yAxisWidth = 0; _this.dataLabelMaxHeight = { negative: 0, positive: 0 }; return _this; } BarVertical2DComponent.prototype.update = function () { _super.prototype.update.call(this); if (!this.showDataLabel) { this.dataLabelMaxHeight = { negative: 0, positive: 0 }; } this.margin = [10 + this.dataLabelMaxHeight.positive, 20, 10 + this.dataLabelMaxHeight.negative, 20]; this.dims = Object(__WEBPACK_IMPORTED_MODULE_3__common_view_dimensions_helper__["a" /* calculateViewDimensions */])({ width: this.width, height: this.height, margins: this.margin, showXAxis: this.xAxis, showYAxis: this.yAxis, xAxisHeight: this.xAxisHeight, yAxisWidth: this.yAxisWidth, showXLabel: this.showXAxisLabel, showYLabel: this.showYAxisLabel, showLegend: this.legend, legendType: this.schemeType }); if (this.showDataLabel) { this.dims.height -= this.dataLabelMaxHeight.negative; } this.formatDates(); this.groupDomain = this.getGroupDomain(); this.innerDomain = this.getInnerDomain(); this.valuesDomain = this.getValueDomain(); this.groupScale = this.getGroupScale(); this.innerScale = this.getInnerScale(); this.valueScale = this.getValueScale(); this.setColors(); this.legendOptions = this.getLegendOptions(); this.transform = "translate(" + this.dims.xOffset + " , " + (this.margin[0] + this.dataLabelMaxHeight.negative) + ")"; }; BarVertical2DComponent.prototype.onDataLabelMaxHeightChanged = function (event, groupIndex) { var _this = this; if (event.size.negative) { this.dataLabelMaxHeight.negative = Math.max(this.dataLabelMaxHeight.negative, event.size.height); } else { this.dataLabelMaxHeight.positive = Math.max(this.dataLabelMaxHeight.positive, event.size.height); } if (groupIndex === (this.results.length - 1)) { setTimeout(function () { return _this.update(); }); } }; BarVertical2DComponent.prototype.getGroupScale = function () { var spacing = this.groupDomain.length / (this.dims.height / this.groupPadding + 1); return Object(__WEBPACK_IMPORTED_MODULE_2_d3_scale__["scaleBand"])() .rangeRound([0, this.dims.width]) .paddingInner(spacing) .paddingOuter(spacing / 2) .domain(this.groupDomain); }; BarVertical2DComponent.prototype.getInnerScale = function () { var width = this.groupScale.bandwidth(); var spacing = this.innerDomain.length / (width / this.barPadding + 1); return Object(__WEBPACK_IMPORTED_MODULE_2_d3_scale__["scaleBand"])() .rangeRound([0, width]) .paddingInner(spacing) .domain(this.innerDomain); }; BarVertical2DComponent.prototype.getValueScale = function () { var scale = Object(__WEBPACK_IMPORTED_MODULE_2_d3_scale__["scaleLinear"])() .range([this.dims.height, 0]) .domain(this.valuesDomain); return this.roundDomains ? scale.nice() : scale; }; BarVertical2DComponent.prototype.getGroupDomain = function () { var domain = []; for (var _i = 0, _a = this.results; _i < _a.length; _i++) { var group = _a[_i]; if (!domain.includes(group.name)) { domain.push(group.name); } } return domain; }; BarVertical2DComponent.prototype.getInnerDomain = function () { var domain = []; for (var _i = 0, _a = this.results; _i < _a.length; _i++) { var group = _a[_i]; for (var _b = 0, _c = group.series; _b < _c.length; _b++) { var d = _c[_b]; if (!domain.includes(d.name)) { domain.push(d.name); } } } return domain; }; BarVertical2DComponent.prototype.getValueDomain = function () { var domain = []; for (var _i = 0, _a = this.results; _i < _a.length; _i++) { var group = _a[_i]; for (var _b = 0, _c = group.series; _b < _c.length; _b++) { var d = _c[_b]; if (!domain.includes(d.value)) { domain.push(d.value); } } } var min = Math.min.apply(Math, [0].concat(domain)); var max = this.yScaleMax ? Math.max.apply(Math, [this.yScaleMax].concat(domain)) : Math.max.apply(Math, domain); return [min, max]; }; BarVertical2DComponent.prototype.groupTransform = function (group) { return "translate(" + this.groupScale(group.name) + ", 0)"; }; BarVertical2DComponent.prototype.onClick = function (data, group) { if (group) { data.series = group.name; } this.select.emit(data); }; BarVertical2DComponent.prototype.trackBy = function (index, item) { return item.name; }; BarVertical2DComponent.prototype.setColors = function () { var domain; if (this.schemeType === 'ordinal') { domain = this.innerDomain; } else { domain = this.valuesDomain; } this.colors = new __WEBPACK_IMPORTED_MODULE_4__common_color_helper__["a" /* ColorHelper */](this.scheme, this.schemeType, domain, this.customColors); }; BarVertical2DComponent.prototype.getLegendOptions = function () { var opts = { scaleType: this.schemeType, colors: undefined, domain: [], title: undefined }; if (opts.scaleType === 'ordinal') { opts.domain = this.innerDomain; opts.colors = this.colors; opts.title = this.legendTitle; } else { opts.domain = this.valuesDomain; opts.colors = this.colors.scale; } return opts; }; BarVertical2DComponent.prototype.updateYAxisWidth = function (_a) { var width = _a.width; this.yAxisWidth = width; this.update(); }; BarVertical2DComponent.prototype.updateXAxisHeight = function (_a) { var height = _a.height; this.xAxisHeight = height; this.update(); }; BarVertical2DComponent.prototype.onActivate = function (event, group) { var item = Object.assign({}, event); if (group) { item.series = group.name; } var idx = this.activeEntries.findIndex(function (d) { return d.name === item.name && d.value === item.value && d.series === item.series; }); if (idx > -1) { return; } this.activeEntries = [item].concat(this.activeEntries); this.activate.emit({ value: item, entries: this.activeEntries }); }; BarVertical2DComponent.prototype.onDeactivate = function (event, group) { var item = Object.assign({}, event); if (group) { item.series = group.name; } var idx = this.activeEntries.findIndex(function (d) { return d.name === item.name && d.value === item.value && d.series === item.series; }); this.activeEntries.splice(idx, 1); this.activeEntries = this.activeEntries.slice(); this.deactivate.emit({ value: item, entries: this.activeEntries }); }; __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarVertical2DComponent.prototype, "legend", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", String) ], BarVertical2DComponent.prototype, "legendTitle", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarVertical2DComponent.prototype, "xAxis", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarVertical2DComponent.prototype, "yAxis", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarVertical2DComponent.prototype, "showXAxisLabel", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarVertical2DComponent.prototype, "showYAxisLabel", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarVertical2DComponent.prototype, "xAxisLabel", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarVertical2DComponent.prototype, "yAxisLabel", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], BarVertical2DComponent.prototype, "tooltipDisabled", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarVertical2DComponent.prototype, "scaleType", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], BarVertical2DComponent.prototype, "gradient", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], BarVertical2DComponent.prototype, "showGridLines", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Array) ], BarVertical2DComponent.prototype, "activeEntries", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", String) ], BarVertical2DComponent.prototype, "schemeType", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarVertical2DComponent.prototype, "xAxisTickFormatting", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarVertical2DComponent.prototype, "yAxisTickFormatting", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Array) ], BarVertical2DComponent.prototype, "xAxisTicks", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Array) ], BarVertical2DComponent.prototype, "yAxisTicks", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarVertical2DComponent.prototype, "groupPadding", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarVertical2DComponent.prototype, "barPadding", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], BarVertical2DComponent.prototype, "roundDomains", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], BarVertical2DComponent.prototype, "roundEdges", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Number) ], BarVertical2DComponent.prototype, "yScaleMax", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], BarVertical2DComponent.prototype, "showDataLabel", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarVertical2DComponent.prototype, "dataLabelFormatting", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"]) ], BarVertical2DComponent.prototype, "activate", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"]) ], BarVertical2DComponent.prototype, "deactivate", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["ContentChild"])('tooltipTemplate'), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["TemplateRef"]) ], BarVertical2DComponent.prototype, "tooltipTemplate", void 0); BarVertical2DComponent = __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ selector: 'ngx-charts-bar-vertical-2d', template: "\n <ngx-charts-chart\n [view]=\"[width, height]\"\n [showLegend]=\"legend\"\n [legendOptions]=\"legendOptions\"\n [activeEntries]=\"activeEntries\"\n [animations]=\"animations\"\n (legendLabelActivate)=\"onActivate($event)\"\n (legendLabelDeactivate)=\"onDeactivate($event)\"\n (legendLabelClick)=\"onClick($event)\">\n <svg:g [attr.transform]=\"transform\" class=\"bar-chart chart\">\n <svg:g ngx-charts-grid-panel-series\n [xScale]=\"groupScale\"\n [yScale]=\"valueScale\"\n [data]=\"results\"\n [dims]=\"dims\"\n orient=\"vertical\">\n </svg:g>\n <svg:g ngx-charts-x-axis\n *ngIf=\"xAxis\"\n [xScale]=\"groupScale\"\n [dims]=\"dims\"\n [showLabel]=\"showXAxisLabel\"\n [labelText]=\"xAxisLabel\"\n [tickFormatting]=\"xAxisTickFormatting\"\n [ticks]=\"xAxisTicks\"\n [xAxisOffset]=\"dataLabelMaxHeight.negative\"\n (dimensionsChanged)=\"updateXAxisHeight($event)\">\n </svg:g>\n <svg:g ngx-charts-y-axis\n *ngIf=\"yAxis\"\n [yScale]=\"valueScale\"\n [dims]=\"dims\"\n [showGridLines]=\"showGridLines\"\n [showLabel]=\"showYAxisLabel\"\n [labelText]=\"yAxisLabel\"\n [tickFormatting]=\"yAxisTickFormatting\"\n [ticks]=\"yAxisTicks\"\n (dimensionsChanged)=\"updateYAxisWidth($event)\">\n </svg:g>\n <svg:g ngx-charts-series-vertical\n *ngFor=\"let group of results; let index = index; trackBy:trackBy\"\n [@animationState]=\"'active'\"\n [attr.transform]=\"groupTransform(group)\"\n [activeEntries]=\"activeEntries\"\n [xScale]=\"innerScale\"\n [yScale]=\"valueScale\"\n [colors]=\"colors\"\n [series]=\"group.series\"\n [dims]=\"dims\"\n [gradient]=\"gradient\"\n [tooltipDisabled]=\"tooltipDisabled\"\n [tooltipTemplate]=\"tooltipTemplate\"\n [showDataLabel]=\"showDataLabel\"\n [dataLabelFormatting]=\"dataLabelFormatting\"\n [seriesName]=\"group.name\"\n [roundEdges]=\"roundEdges\"\n [animations]=\"animations\"\n (select)=\"onClick($event, group)\"\n (activate)=\"onActivate($event, group)\"\n (deactivate)=\"onDeactivate($event, group)\"\n (dataLabelHeightChanged)=\"onDataLabelMaxHeightChanged($event, index)\"\n />\n </svg:g>\n </ngx-charts-chart>\n ", styles: [__webpack_require__("./src/common/base-chart.component.scss")], encapsulation: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ViewEncapsulation"].None, changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectionStrategy"].OnPush, animations: [ Object(__WEBPACK_IMPORTED_MODULE_1__angular_animations__["trigger"])('animationState', [ Object(__WEBPACK_IMPORTED_MODULE_1__angular_animations__["transition"])(':leave', [ Object(__WEBPACK_IMPORTED_MODULE_1__angular_animations__["style"])({ opacity: 1, transform: '*', }), Object(__WEBPACK_IMPORTED_MODULE_1__angular_animations__["animate"])(500, Object(__WEBPACK_IMPORTED_MODULE_1__angular_animations__["style"])({ opacity: 0, transform: 'scale(0)' })) ]) ]) ] }) ], BarVertical2DComponent); return BarVertical2DComponent; }(__WEBPACK_IMPORTED_MODULE_5__common_base_chart_component__["a" /* BaseChartComponent */])); /***/ }), /***/ "./src/bar-chart/bar-vertical-normalized.component.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return BarVerticalNormalizedComponent; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("@angular/core"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_animations__ = __webpack_require__("@angular/animations"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_animations___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1__angular_animations__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_d3_scale__ = __webpack_require__("d3-scale"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_d3_scale___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_d3_scale__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__common_view_dimensions_helper__ = __webpack_require__("./src/common/view-dimensions.helper.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__common_color_helper__ = __webpack_require__("./src/common/color.helper.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__common_base_chart_component__ = __webpack_require__("./src/common/base-chart.component.ts"); var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var BarVerticalNormalizedComponent = /** @class */ (function (_super) { __extends(BarVerticalNormalizedComponent, _super); function BarVerticalNormalizedComponent() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.legend = false; _this.legendTitle = 'Legend'; _this.tooltipDisabled = false; _this.showGridLines = true; _this.activeEntries = []; _this.barPadding = 8; _this.roundDomains = false; _this.activate = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); _this.deactivate = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); _this.margin = [10, 20, 10, 20]; _this.xAxisHeight = 0; _this.yAxisWidth = 0; return _this; } BarVerticalNormalizedComponent.prototype.update = function () { _super.prototype.update.call(this); this.dims = Object(__WEBPACK_IMPORTED_MODULE_3__common_view_dimensions_helper__["a" /* calculateViewDimensions */])({ width: this.width, height: this.height, margins: this.margin, showXAxis: this.xAxis, showYAxis: this.yAxis, xAxisHeight: this.xAxisHeight, yAxisWidth: this.yAxisWidth, showXLabel: this.showXAxisLabel, showYLabel: this.showYAxisLabel, showLegend: this.legend, legendType: this.schemeType }); this.formatDates(); this.groupDomain = this.getGroupDomain(); this.innerDomain = this.getInnerDomain(); this.valueDomain = this.getValueDomain(); this.xScale = this.getXScale(); this.yScale = this.getYScale(); this.setColors(); this.legendOptions = this.getLegendOptions(); this.transform = "translate(" + this.dims.xOffset + " , " + this.margin[0] + ")"; }; BarVerticalNormalizedComponent.prototype.getGroupDomain = function () { var domain = []; for (var _i = 0, _a = this.results; _i < _a.length; _i++) { var group = _a[_i]; if (!domain.includes(group.name)) { domain.push(group.name); } } return domain; }; BarVerticalNormalizedComponent.prototype.getInnerDomain = function () { var domain = []; for (var _i = 0, _a = this.results; _i < _a.length; _i++) { var group = _a[_i]; for (var _b = 0, _c = group.series; _b < _c.length; _b++) { var d = _c[_b]; if (!domain.includes(d.name)) { domain.push(d.name); } } } return domain; }; BarVerticalNormalizedComponent.prototype.getValueDomain = function () { return [0, 100]; }; BarVerticalNormalizedComponent.prototype.getXScale = function () { var spacing = this.groupDomain.length / (this.dims.width / this.barPadding + 1); return Object(__WEBPACK_IMPORTED_MODULE_2_d3_scale__["scaleBand"])() .rangeRound([0, this.dims.width]) .paddingInner(spacing) .domain(this.groupDomain); }; BarVerticalNormalizedComponent.prototype.getYScale = function () { var scale = Object(__WEBPACK_IMPORTED_MODULE_2_d3_scale__["scaleLinear"])() .range([this.dims.height, 0]) .domain(this.valueDomain); return this.roundDomains ? scale.nice() : scale; }; BarVerticalNormalizedComponent.prototype.groupTransform = function (group) { return "translate(" + this.xScale(group.name) + ", 0)"; }; BarVerticalNormalizedComponent.prototype.onClick = function (data, group) { if (group) { data.series = group.name; } this.select.emit(data); }; BarVerticalNormalizedComponent.prototype.trackBy = function (index, item) { return item.name; }; BarVerticalNormalizedComponent.prototype.setColors = function () { var domain; if (this.schemeType === 'ordinal') { domain = this.innerDomain; } else { domain = this.valueDomain; } this.colors = new __WEBPACK_IMPORTED_MODULE_4__common_color_helper__["a" /* ColorHelper */](this.scheme, this.schemeType, domain, this.customColors); }; BarVerticalNormalizedComponent.prototype.getLegendOptions = function () { var opts = { scaleType: this.schemeType, colors: undefined, domain: [], title: undefined }; if (opts.scaleType === 'ordinal') { opts.domain = this.innerDomain; opts.colors = this.colors; opts.title = this.legendTitle; } else { opts.domain = this.valueDomain; opts.colors = this.colors.scale; } return opts; }; BarVerticalNormalizedComponent.prototype.updateYAxisWidth = function (_a) { var width = _a.width; this.yAxisWidth = width; this.update(); }; BarVerticalNormalizedComponent.prototype.updateXAxisHeight = function (_a) { var height = _a.height; this.xAxisHeight = height; this.update(); }; BarVerticalNormalizedComponent.prototype.onActivate = function (event, group) { var item = Object.assign({}, event); if (group) { item.series = group.name; } var idx = this.activeEntries.findIndex(function (d) { return d.name === item.name && d.value === item.value && d.series === item.series; }); if (idx > -1) { return; } this.activeEntries = [item].concat(this.activeEntries); this.activate.emit({ value: item, entries: this.activeEntries }); }; BarVerticalNormalizedComponent.prototype.onDeactivate = function (event, group) { var item = Object.assign({}, event); if (group) { item.series = group.name; } var idx = this.activeEntries.findIndex(function (d) { return d.name === item.name && d.value === item.value && d.series === item.series; }); this.activeEntries.splice(idx, 1); this.activeEntries = this.activeEntries.slice(); this.deactivate.emit({ value: item, entries: this.activeEntries }); }; __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarVerticalNormalizedComponent.prototype, "legend", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", String) ], BarVerticalNormalizedComponent.prototype, "legendTitle", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarVerticalNormalizedComponent.prototype, "xAxis", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarVerticalNormalizedComponent.prototype, "yAxis", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarVerticalNormalizedComponent.prototype, "showXAxisLabel", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarVerticalNormalizedComponent.prototype, "showYAxisLabel", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarVerticalNormalizedComponent.prototype, "xAxisLabel", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarVerticalNormalizedComponent.prototype, "yAxisLabel", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], BarVerticalNormalizedComponent.prototype, "tooltipDisabled", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], BarVerticalNormalizedComponent.prototype, "gradient", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], BarVerticalNormalizedComponent.prototype, "showGridLines", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Array) ], BarVerticalNormalizedComponent.prototype, "activeEntries", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", String) ], BarVerticalNormalizedComponent.prototype, "schemeType", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarVerticalNormalizedComponent.prototype, "xAxisTickFormatting", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarVerticalNormalizedComponent.prototype, "yAxisTickFormatting", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Array) ], BarVerticalNormalizedComponent.prototype, "xAxisTicks", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Array) ], BarVerticalNormalizedComponent.prototype, "yAxisTicks", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarVerticalNormalizedComponent.prototype, "barPadding", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], BarVerticalNormalizedComponent.prototype, "roundDomains", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"]) ], BarVerticalNormalizedComponent.prototype, "activate", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"]) ], BarVerticalNormalizedComponent.prototype, "deactivate", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["ContentChild"])('tooltipTemplate'), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["TemplateRef"]) ], BarVerticalNormalizedComponent.prototype, "tooltipTemplate", void 0); BarVerticalNormalizedComponent = __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ selector: 'ngx-charts-bar-vertical-normalized', template: "\n <ngx-charts-chart\n [view]=\"[width, height]\"\n [showLegend]=\"legend\"\n [legendOptions]=\"legendOptions\"\n [activeEntries]=\"activeEntries\"\n [animations]=\"animations\"\n (legendLabelActivate)=\"onActivate($event)\"\n (legendLabelDeactivate)=\"onDeactivate($event)\"\n (legendLabelClick)=\"onClick($event)\">\n <svg:g [attr.transform]=\"transform\" class=\"bar-chart chart\">\n <svg:g ngx-charts-x-axis\n *ngIf=\"xAxis\"\n [xScale]=\"xScale\"\n [dims]=\"dims\"\n [showLabel]=\"showXAxisLabel\"\n [labelText]=\"xAxisLabel\"\n [tickFormatting]=\"xAxisTickFormatting\"\n [ticks]=\"xAxisTicks\"\n (dimensionsChanged)=\"updateXAxisHeight($event)\">\n </svg:g>\n <svg:g ngx-charts-y-axis\n *ngIf=\"yAxis\"\n [yScale]=\"yScale\"\n [dims]=\"dims\"\n [showGridLines]=\"showGridLines\"\n [showLabel]=\"showYAxisLabel\"\n [labelText]=\"yAxisLabel\"\n [tickFormatting]=\"yAxisTickFormatting\"\n [ticks]=\"yAxisTicks\"\n (dimensionsChanged)=\"updateYAxisWidth($event)\">\n </svg:g>\n <svg:g\n *ngFor=\"let group of results; trackBy:trackBy\"\n [@animationState]=\"'active'\"\n [attr.transform]=\"groupTransform(group)\">\n <svg:g ngx-charts-series-vertical\n type=\"normalized\"\n [xScale]=\"xScale\"\n [yScale]=\"yScale\"\n [activeEntries]=\"activeEntries\"\n [colors]=\"colors\"\n [series]=\"group.series\"\n [dims]=\"dims\"\n [gradient]=\"gradient\"\n [tooltipDisabled]=\"tooltipDisabled\"\n [tooltipTemplate]=\"tooltipTemplate\"\n [seriesName]=\"group.name\"\n [animations]=\"animations\"\n (select)=\"onClick($event, group)\"\n (activate)=\"onActivate($event, group)\"\n (deactivate)=\"onDeactivate($event, group)\"\n />\n </svg:g>\n </svg:g>\n </ngx-charts-chart>\n ", styles: [__webpack_require__("./src/common/base-chart.component.scss")], encapsulation: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ViewEncapsulation"].None, changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectionStrategy"].OnPush, animations: [ Object(__WEBPACK_IMPORTED_MODULE_1__angular_animations__["trigger"])('animationState', [ Object(__WEBPACK_IMPORTED_MODULE_1__angular_animations__["transition"])(':leave', [ Object(__WEBPACK_IMPORTED_MODULE_1__angular_animations__["style"])({ opacity: 1, transform: '*', }), Object(__WEBPACK_IMPORTED_MODULE_1__angular_animations__["animate"])(500, Object(__WEBPACK_IMPORTED_MODULE_1__angular_animations__["style"])({ opacity: 0, transform: 'scale(0)' })) ]) ]) ] }) ], BarVerticalNormalizedComponent); return BarVerticalNormalizedComponent; }(__WEBPACK_IMPORTED_MODULE_5__common_base_chart_component__["a" /* BaseChartComponent */])); /***/ }), /***/ "./src/bar-chart/bar-vertical-stacked.component.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return BarVerticalStackedComponent; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("@angular/core"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_animations__ = __webpack_require__("@angular/animations"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_animations___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1__angular_animations__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_d3_scale__ = __webpack_require__("d3-scale"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_d3_scale___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_d3_scale__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__common_view_dimensions_helper__ = __webpack_require__("./src/common/view-dimensions.helper.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__common_color_helper__ = __webpack_require__("./src/common/color.helper.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__common_base_chart_component__ = __webpack_require__("./src/common/base-chart.component.ts"); var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var BarVerticalStackedComponent = /** @class */ (function (_super) { __extends(BarVerticalStackedComponent, _super); function BarVerticalStackedComponent() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.legend = false; _this.legendTitle = 'Legend'; _this.tooltipDisabled = false; _this.showGridLines = true; _this.activeEntries = []; _this.barPadding = 8; _this.roundDomains = false; _this.showDataLabel = false; _this.activate = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); _this.deactivate = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); _this.margin = [10, 20, 10, 20]; _this.xAxisHeight = 0; _this.yAxisWidth = 0; _this.dataLabelMaxHeight = { negative: 0, positive: 0 }; return _this; } BarVerticalStackedComponent.prototype.update = function () { _super.prototype.update.call(this); if (!this.showDataLabel) { this.dataLabelMaxHeight = { negative: 0, positive: 0 }; } this.margin = [10 + this.dataLabelMaxHeight.positive, 20, 10 + this.dataLabelMaxHeight.negative, 20]; this.dims = Object(__WEBPACK_IMPORTED_MODULE_3__common_view_dimensions_helper__["a" /* calculateViewDimensions */])({ width: this.width, height: this.height, margins: this.margin, showXAxis: this.xAxis, showYAxis: this.yAxis, xAxisHeight: this.xAxisHeight, yAxisWidth: this.yAxisWidth, showXLabel: this.showXAxisLabel, showYLabel: this.showYAxisLabel, showLegend: this.legend, legendType: this.schemeType }); if (this.showDataLabel) { this.dims.height -= this.dataLabelMaxHeight.negative; } this.formatDates(); this.groupDomain = this.getGroupDomain(); this.innerDomain = this.getInnerDomain(); this.valueDomain = this.getValueDomain(); this.xScale = this.getXScale(); this.yScale = this.getYScale(); this.setColors(); this.legendOptions = this.getLegendOptions(); this.transform = "translate(" + this.dims.xOffset + " , " + (this.margin[0] + this.dataLabelMaxHeight.negative) + ")"; }; BarVerticalStackedComponent.prototype.getGroupDomain = function () { var domain = []; for (var _i = 0, _a = this.results; _i < _a.length; _i++) { var group = _a[_i]; if (!domain.includes(group.name)) { domain.push(group.name); } } return domain; }; BarVerticalStackedComponent.prototype.getInnerDomain = function () { var domain = []; for (var _i = 0, _a = this.results; _i < _a.length; _i++) { var group = _a[_i]; for (var _b = 0, _c = group.series; _b < _c.length; _b++) { var d = _c[_b]; if (!domain.includes(d.name)) { domain.push(d.name); } } } return domain; }; BarVerticalStackedComponent.prototype.getValueDomain = function () { var domain = []; var smallest = 0; var biggest = 0; for (var _i = 0, _a = this.results; _i < _a.length; _i++) { var group = _a[_i]; var smallestSum = 0; var biggestSum = 0; for (var _b = 0, _c = group.series; _b < _c.length; _b++) { var d = _c[_b]; if (d.value < 0) { smallestSum += d.value; } else { biggestSum += d.value; } smallest = d.value < smallest ? d.value : smallest; biggest = d.value > biggest ? d.value : biggest; } domain.push(smallestSum); domain.push(biggestSum); } domain.push(smallest); domain.push(biggest); var min = Math.min.apply(Math, [0].concat(domain)); var max = this.yScaleMax ? Math.max.apply(Math, [this.yScaleMax].concat(domain)) : Math.max.apply(Math, domain); return [min, max]; }; BarVerticalStackedComponent.prototype.getXScale = function () { var spacing = this.groupDomain.length / (this.dims.width / this.barPadding + 1); return Object(__WEBPACK_IMPORTED_MODULE_2_d3_scale__["scaleBand"])() .rangeRound([0, this.dims.width]) .paddingInner(spacing) .domain(this.groupDomain); }; BarVerticalStackedComponent.prototype.getYScale = function () { var scale = Object(__WEBPACK_IMPORTED_MODULE_2_d3_scale__["scaleLinear"])() .range([this.dims.height, 0]) .domain(this.valueDomain); return this.roundDomains ? scale.nice() : scale; }; BarVerticalStackedComponent.prototype.onDataLabelMaxHeightChanged = function (event, groupIndex) { var _this = this; if (event.size.negative) { this.dataLabelMaxHeight.negative = Math.max(this.dataLabelMaxHeight.negative, event.size.height); } else { this.dataLabelMaxHeight.positive = Math.max(this.dataLabelMaxHeight.positive, event.size.height); } if (groupIndex === (this.results.length - 1)) { setTimeout(function () { return _this.update(); }); } }; BarVerticalStackedComponent.prototype.groupTransform = function (group) { return "translate(" + this.xScale(group.name) + ", 0)"; }; BarVerticalStackedComponent.prototype.onClick = function (data, group) { if (group) { data.series = group.name; } this.select.emit(data); }; BarVerticalStackedComponent.prototype.trackBy = function (index, item) { return item.name; }; BarVerticalStackedComponent.prototype.setColors = function () { var domain; if (this.schemeType === 'ordinal') { domain = this.innerDomain; } else { domain = this.valueDomain; } this.colors = new __WEBPACK_IMPORTED_MODULE_4__common_color_helper__["a" /* ColorHelper */](this.scheme, this.schemeType, domain, this.customColors); }; BarVerticalStackedComponent.prototype.getLegendOptions = function () { var opts = { scaleType: this.schemeType, colors: undefined, domain: [], title: undefined }; if (opts.scaleType === 'ordinal') { opts.domain = this.innerDomain; opts.colors = this.colors; opts.title = this.legendTitle; } else { opts.domain = this.valueDomain; opts.colors = this.colors.scale; } return opts; }; BarVerticalStackedComponent.prototype.updateYAxisWidth = function (_a) { var width = _a.width; this.yAxisWidth = width; this.update(); }; BarVerticalStackedComponent.prototype.updateXAxisHeight = function (_a) { var height = _a.height; this.xAxisHeight = height; this.update(); }; BarVerticalStackedComponent.prototype.onActivate = function (event, group) { var item = Object.assign({}, event); if (group) { item.series = group.name; } var idx = this.activeEntries.findIndex(function (d) { return d.name === item.name && d.value === item.value && d.series === item.series; }); if (idx > -1) { return; } this.activeEntries = [item].concat(this.activeEntries); this.activate.emit({ value: item, entries: this.activeEntries }); }; BarVerticalStackedComponent.prototype.onDeactivate = function (event, group) { var item = Object.assign({}, event); if (group) { item.series = group.name; } var idx = this.activeEntries.findIndex(function (d) { return d.name === item.name && d.value === item.value && d.series === item.series; }); this.activeEntries.splice(idx, 1); this.activeEntries = this.activeEntries.slice(); this.deactivate.emit({ value: item, entries: this.activeEntries }); }; __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarVerticalStackedComponent.prototype, "legend", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", String) ], BarVerticalStackedComponent.prototype, "legendTitle", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarVerticalStackedComponent.prototype, "xAxis", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarVerticalStackedComponent.prototype, "yAxis", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarVerticalStackedComponent.prototype, "showXAxisLabel", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarVerticalStackedComponent.prototype, "showYAxisLabel", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarVerticalStackedComponent.prototype, "xAxisLabel", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarVerticalStackedComponent.prototype, "yAxisLabel", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], BarVerticalStackedComponent.prototype, "tooltipDisabled", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], BarVerticalStackedComponent.prototype, "gradient", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], BarVerticalStackedComponent.prototype, "showGridLines", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Array) ], BarVerticalStackedComponent.prototype, "activeEntries", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", String) ], BarVerticalStackedComponent.prototype, "schemeType", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarVerticalStackedComponent.prototype, "xAxisTickFormatting", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarVerticalStackedComponent.prototype, "yAxisTickFormatting", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Array) ], BarVerticalStackedComponent.prototype, "xAxisTicks", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Array) ], BarVerticalStackedComponent.prototype, "yAxisTicks", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarVerticalStackedComponent.prototype, "barPadding", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], BarVerticalStackedComponent.prototype, "roundDomains", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Number) ], BarVerticalStackedComponent.prototype, "yScaleMax", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], BarVerticalStackedComponent.prototype, "showDataLabel", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarVerticalStackedComponent.prototype, "dataLabelFormatting", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"]) ], BarVerticalStackedComponent.prototype, "activate", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"]) ], BarVerticalStackedComponent.prototype, "deactivate", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["ContentChild"])('tooltipTemplate'), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["TemplateRef"]) ], BarVerticalStackedComponent.prototype, "tooltipTemplate", void 0); BarVerticalStackedComponent = __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ selector: 'ngx-charts-bar-vertical-stacked', template: "\n <ngx-charts-chart\n [view]=\"[width, height]\"\n [showLegend]=\"legend\"\n [legendOptions]=\"legendOptions\"\n [activeEntries]=\"activeEntries\"\n [animations]=\"animations\"\n (legendLabelActivate)=\"onActivate($event)\"\n (legendLabelDeactivate)=\"onDeactivate($event)\"\n (legendLabelClick)=\"onClick($event)\">\n <svg:g [attr.transform]=\"transform\" class=\"bar-chart chart\">\n <svg:g ngx-charts-x-axis\n *ngIf=\"xAxis\"\n [xScale]=\"xScale\"\n [dims]=\"dims\"\n [showLabel]=\"showXAxisLabel\"\n [labelText]=\"xAxisLabel\"\n [tickFormatting]=\"xAxisTickFormatting\"\n [ticks]=\"xAxisTicks\"\n [xAxisOffset]=\"dataLabelMaxHeight.negative\"\n (dimensionsChanged)=\"updateXAxisHeight($event)\">\n </svg:g>\n <svg:g ngx-charts-y-axis\n *ngIf=\"yAxis\"\n [yScale]=\"yScale\"\n [dims]=\"dims\"\n [showGridLines]=\"showGridLines\"\n [showLabel]=\"showYAxisLabel\"\n [labelText]=\"yAxisLabel\"\n [tickFormatting]=\"yAxisTickFormatting\"\n [ticks]=\"yAxisTicks\"\n (dimensionsChanged)=\"updateYAxisWidth($event)\">\n </svg:g>\n <svg:g\n *ngFor=\"let group of results; let index = index; trackBy:trackBy\"\n [@animationState]=\"'active'\"\n [attr.transform]=\"groupTransform(group)\">\n <svg:g ngx-charts-series-vertical\n type=\"stacked\"\n [xScale]=\"xScale\"\n [yScale]=\"yScale\"\n [activeEntries]=\"activeEntries\"\n [colors]=\"colors\"\n [series]=\"group.series\"\n [dims]=\"dims\"\n [gradient]=\"gradient\"\n [tooltipDisabled]=\"tooltipDisabled\"\n [tooltipTemplate]=\"tooltipTemplate\"\n [showDataLabel]=\"showDataLabel\"\n [dataLabelFormatting]=\"dataLabelFormatting\"\n [seriesName]=\"group.name\"\n [animations]=\"animations\"\n (select)=\"onClick($event, group)\"\n (activate)=\"onActivate($event, group)\"\n (deactivate)=\"onDeactivate($event, group)\"\n (dataLabelHeightChanged)=\"onDataLabelMaxHeightChanged($event, index)\"\n />\n </svg:g>\n </svg:g>\n </ngx-charts-chart>\n ", styles: [__webpack_require__("./src/common/base-chart.component.scss")], encapsulation: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ViewEncapsulation"].None, changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectionStrategy"].OnPush, animations: [ Object(__WEBPACK_IMPORTED_MODULE_1__angular_animations__["trigger"])('animationState', [ Object(__WEBPACK_IMPORTED_MODULE_1__angular_animations__["transition"])(':leave', [ Object(__WEBPACK_IMPORTED_MODULE_1__angular_animations__["style"])({ opacity: 1, transform: '*', }), Object(__WEBPACK_IMPORTED_MODULE_1__angular_animations__["animate"])(500, Object(__WEBPACK_IMPORTED_MODULE_1__angular_animations__["style"])({ opacity: 0, transform: 'scale(0)' })) ]) ]) ] }) ], BarVerticalStackedComponent); return BarVerticalStackedComponent; }(__WEBPACK_IMPORTED_MODULE_5__common_base_chart_component__["a" /* BaseChartComponent */])); /***/ }), /***/ "./src/bar-chart/bar-vertical.component.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return BarVerticalComponent; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("@angular/core"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_d3_scale__ = __webpack_require__("d3-scale"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_d3_scale___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_d3_scale__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__common_view_dimensions_helper__ = __webpack_require__("./src/common/view-dimensions.helper.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__common_color_helper__ = __webpack_require__("./src/common/color.helper.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__common_base_chart_component__ = __webpack_require__("./src/common/base-chart.component.ts"); var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var BarVerticalComponent = /** @class */ (function (_super) { __extends(BarVerticalComponent, _super); function BarVerticalComponent() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.legend = false; _this.legendTitle = 'Legend'; _this.tooltipDisabled = false; _this.showGridLines = true; _this.activeEntries = []; _this.barPadding = 8; _this.roundDomains = false; _this.roundEdges = true; _this.showDataLabel = false; _this.activate = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); _this.deactivate = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); _this.margin = [10, 20, 10, 20]; _this.xAxisHeight = 0; _this.yAxisWidth = 0; _this.dataLabelMaxHeight = { negative: 0, positive: 0 }; return _this; } BarVerticalComponent.prototype.update = function () { _super.prototype.update.call(this); if (!this.showDataLabel) { this.dataLabelMaxHeight = { negative: 0, positive: 0 }; } this.margin = [10 + this.dataLabelMaxHeight.positive, 20, 10 + this.dataLabelMaxHeight.negative, 20]; this.dims = Object(__WEBPACK_IMPORTED_MODULE_2__common_view_dimensions_helper__["a" /* calculateViewDimensions */])({ width: this.width, height: this.height, margins: this.margin, showXAxis: this.xAxis, showYAxis: this.yAxis, xAxisHeight: this.xAxisHeight, yAxisWidth: this.yAxisWidth, showXLabel: this.showXAxisLabel, showYLabel: this.showYAxisLabel, showLegend: this.legend, legendType: this.schemeType }); if (this.showDataLabel) { this.dims.height -= this.dataLabelMaxHeight.negative; } this.xScale = this.getXScale(); this.yScale = this.getYScale(); this.setColors(); this.legendOptions = this.getLegendOptions(); this.transform = "translate(" + this.dims.xOffset + " , " + (this.margin[0] + this.dataLabelMaxHeight.negative) + ")"; }; BarVerticalComponent.prototype.getXScale = function () { this.xDomain = this.getXDomain(); var spacing = this.xDomain.length / (this.dims.width / this.barPadding + 1); return Object(__WEBPACK_IMPORTED_MODULE_1_d3_scale__["scaleBand"])() .rangeRound([0, this.dims.width]) .paddingInner(spacing) .domain(this.xDomain); }; BarVerticalComponent.prototype.getYScale = function () { this.yDomain = this.getYDomain(); var scale = Object(__WEBPACK_IMPORTED_MODULE_1_d3_scale__["scaleLinear"])() .range([this.dims.height, 0]) .domain(this.yDomain); return this.roundDomains ? scale.nice() : scale; }; BarVerticalComponent.prototype.getXDomain = function () { return this.results.map(function (d) { return d.name; }); }; BarVerticalComponent.prototype.getYDomain = function () { var values = this.results.map(function (d) { return d.value; }); var min = this.yScaleMin ? Math.min.apply(Math, [this.yScaleMin].concat(values)) : Math.min.apply(Math, [0].concat(values)); var max = this.yScaleMax ? Math.max.apply(Math, [this.yScaleMax].concat(values)) : Math.max.apply(Math, values); return [min, max]; }; BarVerticalComponent.prototype.onClick = function (data) { this.select.emit(data); }; BarVerticalComponent.prototype.setColors = function () { var domain; if (this.schemeType === 'ordinal') { domain = this.xDomain; } else { domain = this.yDomain; } this.colors = new __WEBPACK_IMPORTED_MODULE_3__common_color_helper__["a" /* ColorHelper */](this.scheme, this.schemeType, domain, this.customColors); }; BarVerticalComponent.prototype.getLegendOptions = function () { var opts = { scaleType: this.schemeType, colors: undefined, domain: [], title: undefined }; if (opts.scaleType === 'ordinal') { opts.domain = this.xDomain; opts.colors = this.colors; opts.title = this.legendTitle; } else { opts.domain = this.yDomain; opts.colors = this.colors.scale; } return opts; }; BarVerticalComponent.prototype.updateYAxisWidth = function (_a) { var width = _a.width; this.yAxisWidth = width; this.update(); }; BarVerticalComponent.prototype.updateXAxisHeight = function (_a) { var height = _a.height; this.xAxisHeight = height; this.update(); }; BarVerticalComponent.prototype.onDataLabelMaxHeightChanged = function (event) { var _this = this; if (event.size.negative) { this.dataLabelMaxHeight.negative = Math.max(this.dataLabelMaxHeight.negative, event.size.height); } else { this.dataLabelMaxHeight.positive = Math.max(this.dataLabelMaxHeight.positive, event.size.height); } if (event.index === (this.results.length - 1)) { setTimeout(function () { return _this.update(); }); } }; BarVerticalComponent.prototype.onActivate = function (item) { var idx = this.activeEntries.findIndex(function (d) { return d.name === item.name && d.value === item.value && d.series === item.series; }); if (idx > -1) { return; } this.activeEntries = [item].concat(this.activeEntries); this.activate.emit({ value: item, entries: this.activeEntries }); }; BarVerticalComponent.prototype.onDeactivate = function (item) { var idx = this.activeEntries.findIndex(function (d) { return d.name === item.name && d.value === item.value && d.series === item.series; }); this.activeEntries.splice(idx, 1); this.activeEntries = this.activeEntries.slice(); this.deactivate.emit({ value: item, entries: this.activeEntries }); }; __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarVerticalComponent.prototype, "legend", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", String) ], BarVerticalComponent.prototype, "legendTitle", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarVerticalComponent.prototype, "xAxis", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarVerticalComponent.prototype, "yAxis", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarVerticalComponent.prototype, "showXAxisLabel", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarVerticalComponent.prototype, "showYAxisLabel", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarVerticalComponent.prototype, "xAxisLabel", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarVerticalComponent.prototype, "yAxisLabel", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], BarVerticalComponent.prototype, "tooltipDisabled", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], BarVerticalComponent.prototype, "gradient", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], BarVerticalComponent.prototype, "showGridLines", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Array) ], BarVerticalComponent.prototype, "activeEntries", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", String) ], BarVerticalComponent.prototype, "schemeType", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarVerticalComponent.prototype, "xAxisTickFormatting", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarVerticalComponent.prototype, "yAxisTickFormatting", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Array) ], BarVerticalComponent.prototype, "xAxisTicks", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Array) ], BarVerticalComponent.prototype, "yAxisTicks", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarVerticalComponent.prototype, "barPadding", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], BarVerticalComponent.prototype, "roundDomains", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], BarVerticalComponent.prototype, "roundEdges", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Number) ], BarVerticalComponent.prototype, "yScaleMax", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Number) ], BarVerticalComponent.prototype, "yScaleMin", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], BarVerticalComponent.prototype, "showDataLabel", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarVerticalComponent.prototype, "dataLabelFormatting", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"]) ], BarVerticalComponent.prototype, "activate", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"]) ], BarVerticalComponent.prototype, "deactivate", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["ContentChild"])('tooltipTemplate'), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["TemplateRef"]) ], BarVerticalComponent.prototype, "tooltipTemplate", void 0); BarVerticalComponent = __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ selector: 'ngx-charts-bar-vertical', template: "\n <ngx-charts-chart\n [view]=\"[width, height]\"\n [showLegend]=\"legend\"\n [legendOptions]=\"legendOptions\"\n [activeEntries]=\"activeEntries\"\n [animations]=\"animations\"\n (legendLabelClick)=\"onClick($event)\"\n (legendLabelActivate)=\"onActivate($event)\"\n (legendLabelDeactivate)=\"onDeactivate($event)\">\n <svg:g [attr.transform]=\"transform\" class=\"bar-chart chart\">\n <svg:g ngx-charts-x-axis\n *ngIf=\"xAxis\"\n [xScale]=\"xScale\"\n [dims]=\"dims\"\n [showLabel]=\"showXAxisLabel\"\n [labelText]=\"xAxisLabel\"\n [tickFormatting]=\"xAxisTickFormatting\"\n [ticks]=\"xAxisTicks\"\n [xAxisOffset]=\"dataLabelMaxHeight.negative\"\n (dimensionsChanged)=\"updateXAxisHeight($event)\">\n </svg:g>\n <svg:g ngx-charts-y-axis\n *ngIf=\"yAxis\"\n [yScale]=\"yScale\"\n [dims]=\"dims\"\n [showGridLines]=\"showGridLines\"\n [showLabel]=\"showYAxisLabel\"\n [labelText]=\"yAxisLabel\"\n [tickFormatting]=\"yAxisTickFormatting\"\n [ticks]=\"yAxisTicks\"\n (dimensionsChanged)=\"updateYAxisWidth($event)\">\n </svg:g>\n <svg:g ngx-charts-series-vertical\n [xScale]=\"xScale\"\n [yScale]=\"yScale\"\n [colors]=\"colors\"\n [series]=\"results\"\n [dims]=\"dims\"\n [gradient]=\"gradient\"\n [tooltipDisabled]=\"tooltipDisabled\"\n [tooltipTemplate]=\"tooltipTemplate\"\n [showDataLabel]=\"showDataLabel\"\n [dataLabelFormatting]=\"dataLabelFormatting\"\n [activeEntries]=\"activeEntries\"\n [roundEdges]=\"roundEdges\"\n [animations]=\"animations\"\n (activate)=\"onActivate($event)\"\n (deactivate)=\"onDeactivate($event)\"\n (select)=\"onClick($event)\"\n (dataLabelHeightChanged)=\"onDataLabelMaxHeightChanged($event)\"\n > \n </svg:g>\n </svg:g>\n </ngx-charts-chart>\n ", changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectionStrategy"].OnPush, styles: [__webpack_require__("./src/common/base-chart.component.scss")], encapsulation: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ViewEncapsulation"].None }) ], BarVerticalComponent); return BarVerticalComponent; }(__WEBPACK_IMPORTED_MODULE_4__common_base_chart_component__["a" /* BaseChartComponent */])); /***/ }), /***/ "./src/bar-chart/bar.component.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return BarComponent; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("@angular/core"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_d3_selection__ = __webpack_require__("d3-selection"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_d3_selection___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_d3_selection__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__common_shape_helper__ = __webpack_require__("./src/common/shape.helper.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__utils_id__ = __webpack_require__("./src/utils/id.ts"); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var BarComponent = /** @class */ (function () { function BarComponent(element) { this.roundEdges = true; this.gradient = false; this.offset = 0; this.isActive = false; this.animations = true; this.select = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); this.activate = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); this.deactivate = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); this.initialized = false; this.hasGradient = false; this.element = element.nativeElement; } BarComponent.prototype.ngOnChanges = function (changes) { if (!this.initialized) { this.loadAnimation(); this.initialized = true; } else { this.update(); } }; BarComponent.prototype.update = function () { this.gradientId = 'grad' + Object(__WEBPACK_IMPORTED_MODULE_3__utils_id__["a" /* id */])().toString(); this.gradientFill = "url(#" + this.gradientId + ")"; if (this.gradient || this.stops) { this.gradientStops = this.getGradient(); this.hasGradient = true; } else { this.hasGradient = false; } this.updatePathEl(); }; BarComponent.prototype.loadAnimation = function () { this.path = this.getStartingPath(); setTimeout(this.update.bind(this), 100); }; BarComponent.prototype.updatePathEl = function () { var node = Object(__WEBPACK_IMPORTED_MODULE_1_d3_selection__["select"])(this.element).select('.bar'); var path = this.getPath(); if (this.animations) { node.transition().duration(500) .attr('d', path); } else { node.attr('d', path); } }; BarComponent.prototype.getGradient = function () { if (this.stops) { return this.stops; } return [ { offset: 0, color: this.fill, opacity: this.getStartOpacity() }, { offset: 100, color: this.fill, opacity: 1 } ]; }; BarComponent.prototype.getStartingPath = function () { if (!this.animations) { return this.getPath(); } var radius = this.getRadius(); var path; if (this.roundEdges) { if (this.orientation === 'vertical') { radius = Math.min(this.height, radius); path = Object(__WEBPACK_IMPORTED_MODULE_2__common_shape_helper__["a" /* roundedRect */])(this.x, this.y + this.height, this.width, 1, 0, this.edges); } else if (this.orientation === 'horizontal') { radius = Math.min(this.width, radius); path = Object(__WEBPACK_IMPORTED_MODULE_2__common_shape_helper__["a" /* roundedRect */])(this.x, this.y, 1, this.height, 0, this.edges); } } else { if (this.orientation === 'vertical') { path = Object(__WEBPACK_IMPORTED_MODULE_2__common_shape_helper__["a" /* roundedRect */])(this.x, this.y + this.height, this.width, 1, 0, this.edges); } else if (this.orientation === 'horizontal') { path = Object(__WEBPACK_IMPORTED_MODULE_2__common_shape_helper__["a" /* roundedRect */])(this.x, this.y, 1, this.height, 0, this.edges); } } return path; }; BarComponent.prototype.getPath = function () { var radius = this.getRadius(); var path; if (this.roundEdges) { if (this.orientation === 'vertical') { radius = Math.min(this.height, radius); path = Object(__WEBPACK_IMPORTED_MODULE_2__common_shape_helper__["a" /* roundedRect */])(this.x, this.y, this.width, this.height, radius, this.edges); } else if (this.orientation === 'horizontal') { radius = Math.min(this.width, radius); path = Object(__WEBPACK_IMPORTED_MODULE_2__common_shape_helper__["a" /* roundedRect */])(this.x, this.y, this.width, this.height, radius, this.edges); } } else { path = Object(__WEBPACK_IMPORTED_MODULE_2__common_shape_helper__["a" /* roundedRect */])(this.x, this.y, this.width, this.height, radius, this.edges); } return path; }; BarComponent.prototype.getRadius = function () { var radius = 0; if (this.roundEdges && this.height > 5 && this.width > 5) { radius = Math.floor(Math.min(5, this.height / 2, this.width / 2)); } return radius; }; BarComponent.prototype.getStartOpacity = function () { if (this.roundEdges) { return 0.2; } else { return 0.5; } }; Object.defineProperty(BarComponent.prototype, "edges", { get: function () { var edges = [false, false, false, false]; if (this.roundEdges) { if (this.orientation === 'vertical') { if (this.data.value > 0) { edges = [true, true, false, false]; } else { edges = [false, false, true, true]; } } else if (this.orientation === 'horizontal') { if (this.data.value > 0) { edges = [false, true, false, true]; } else { edges = [true, false, true, false]; } } } return edges; }, enumerable: true, configurable: true }); BarComponent.prototype.onMouseEnter = function () { this.activate.emit(this.data); }; BarComponent.prototype.onMouseLeave = function () { this.deactivate.emit(this.data); }; __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarComponent.prototype, "fill", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarComponent.prototype, "data", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarComponent.prototype, "width", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarComponent.prototype, "height", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarComponent.prototype, "x", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarComponent.prototype, "y", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarComponent.prototype, "orientation", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], BarComponent.prototype, "roundEdges", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], BarComponent.prototype, "gradient", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BarComponent.prototype, "offset", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], BarComponent.prototype, "isActive", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Array) ], BarComponent.prototype, "stops", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], BarComponent.prototype, "animations", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", Object) ], BarComponent.prototype, "select", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", Object) ], BarComponent.prototype, "activate", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", Object) ], BarComponent.prototype, "deactivate", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["HostListener"])('mouseenter'), __metadata("design:type", Function), __metadata("design:paramtypes", []), __metadata("design:returntype", void 0) ], BarComponent.prototype, "onMouseEnter", null); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["HostListener"])('mouseleave'), __metadata("design:type", Function), __metadata("design:paramtypes", []), __metadata("design:returntype", void 0) ], BarComponent.prototype, "onMouseLeave", null); BarComponent = __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ selector: 'g[ngx-charts-bar]', template: "\n <svg:defs *ngIf=\"hasGradient\">\n <svg:g ngx-charts-svg-linear-gradient\n [orientation]=\"orientation\"\n [name]=\"gradientId\"\n [stops]=\"gradientStops\"\n />\n </svg:defs>\n <svg:path\n class=\"bar\"\n stroke=\"none\"\n [class.active]=\"isActive\"\n [attr.d]=\"path\"\n [attr.fill]=\"hasGradient ? gradientFill : fill\"\n (click)=\"select.emit(data)\"\n />\n ", changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectionStrategy"].OnPush }), __metadata("design:paramtypes", [__WEBPACK_IMPORTED_MODULE_0__angular_core__["ElementRef"]]) ], BarComponent); return BarComponent; }()); /***/ }), /***/ "./src/bar-chart/index.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__bar_chart_module__ = __webpack_require__("./src/bar-chart/bar-chart.module.ts"); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "a", function() { return __WEBPACK_IMPORTED_MODULE_0__bar_chart_module__["a"]; }); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "b", function() { return __WEBPACK_IMPORTED_MODULE_0__bar_chart_module__["b"]; }); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "c", function() { return __WEBPACK_IMPORTED_MODULE_0__bar_chart_module__["c"]; }); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "d", function() { return __WEBPACK_IMPORTED_MODULE_0__bar_chart_module__["d"]; }); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "e", function() { return __WEBPACK_IMPORTED_MODULE_0__bar_chart_module__["e"]; }); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "f", function() { return __WEBPACK_IMPORTED_MODULE_0__bar_chart_module__["f"]; }); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "g", function() { return __WEBPACK_IMPORTED_MODULE_0__bar_chart_module__["g"]; }); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "h", function() { return __WEBPACK_IMPORTED_MODULE_0__bar_chart_module__["h"]; }); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "i", function() { return __WEBPACK_IMPORTED_MODULE_0__bar_chart_module__["i"]; }); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "j", function() { return __WEBPACK_IMPORTED_MODULE_0__bar_chart_module__["j"]; }); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "k", function() { return __WEBPACK_IMPORTED_MODULE_0__bar_chart_module__["k"]; }); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "m", function() { return __WEBPACK_IMPORTED_MODULE_0__bar_chart_module__["l"]; }); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "n", function() { return __WEBPACK_IMPORTED_MODULE_0__bar_chart_module__["m"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__bar_component__ = __webpack_require__("./src/bar-chart/bar.component.ts"); /* unused harmony namespace reexport */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__bar_horizontal_component__ = __webpack_require__("./src/bar-chart/bar-horizontal.component.ts"); /* unused harmony namespace reexport */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__bar_horizontal_2d_component__ = __webpack_require__("./src/bar-chart/bar-horizontal-2d.component.ts"); /* unused harmony namespace reexport */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__bar_horizontal_normalized_component__ = __webpack_require__("./src/bar-chart/bar-horizontal-normalized.component.ts"); /* unused harmony namespace reexport */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__bar_horizontal_stacked_component__ = __webpack_require__("./src/bar-chart/bar-horizontal-stacked.component.ts"); /* unused harmony namespace reexport */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__series_horizontal_component__ = __webpack_require__("./src/bar-chart/series-horizontal.component.ts"); /* unused harmony namespace reexport */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__bar_vertical_component__ = __webpack_require__("./src/bar-chart/bar-vertical.component.ts"); /* unused harmony namespace reexport */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__bar_vertical_2d_component__ = __webpack_require__("./src/bar-chart/bar-vertical-2d.component.ts"); /* unused harmony namespace reexport */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__bar_vertical_normalized_component__ = __webpack_require__("./src/bar-chart/bar-vertical-normalized.component.ts"); /* unused harmony namespace reexport */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__bar_vertical_stacked_component__ = __webpack_require__("./src/bar-chart/bar-vertical-stacked.component.ts"); /* unused harmony namespace reexport */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__series_vertical_component__ = __webpack_require__("./src/bar-chart/series-vertical.component.ts"); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "l", function() { return __WEBPACK_IMPORTED_MODULE_11__series_vertical_component__["a"]; }); /***/ }), /***/ "./src/bar-chart/series-horizontal.component.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return SeriesHorizontal; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("@angular/core"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_animations__ = __webpack_require__("@angular/animations"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_animations___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1__angular_animations__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__common_label_helper__ = __webpack_require__("./src/common/label.helper.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__series_vertical_component__ = __webpack_require__("./src/bar-chart/series-vertical.component.ts"); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var SeriesHorizontal = /** @class */ (function () { function SeriesHorizontal() { this.barsForDataLabels = []; this.type = 'standard'; this.tooltipDisabled = false; this.animations = true; this.showDataLabel = false; this.select = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); this.activate = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); this.deactivate = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); this.dataLabelWidthChanged = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); } SeriesHorizontal.prototype.ngOnChanges = function (changes) { this.update(); }; SeriesHorizontal.prototype.update = function () { var _this = this; this.updateTooltipSettings(); var d0 = (_a = {}, _a[__WEBPACK_IMPORTED_MODULE_3__series_vertical_component__["a" /* D0Types */].positive] = 0, _a[__WEBPACK_IMPORTED_MODULE_3__series_vertical_component__["a" /* D0Types */].negative] = 0, _a); var d0Type; d0Type = __WEBPACK_IMPORTED_MODULE_3__series_vertical_component__["a" /* D0Types */].positive; var total; if (this.type === 'normalized') { total = this.series.map(function (d) { return d.value; }).reduce(function (sum, d) { return sum + d; }, 0); } var xScaleMin = Math.max(this.xScale.domain()[0], 0); this.bars = this.series.map(function (d, index) { var value = d.value; var label = d.name; var formattedLabel = Object(__WEBPACK_IMPORTED_MODULE_2__common_label_helper__["a" /* formatLabel */])(label); var roundEdges = _this.roundEdges; d0Type = value > 0 ? __WEBPACK_IMPORTED_MODULE_3__series_vertical_component__["a" /* D0Types */].positive : __WEBPACK_IMPORTED_MODULE_3__series_vertical_component__["a" /* D0Types */].negative; var bar = { value: value, label: label, roundEdges: roundEdges, data: d, formattedLabel: formattedLabel }; bar.height = _this.yScale.bandwidth(); if (_this.type === 'standard') { bar.width = Math.abs(_this.xScale(value) - _this.xScale(xScaleMin)); if (value < 0) { bar.x = _this.xScale(value); } else { bar.x = _this.xScale(xScaleMin); } bar.y = _this.yScale(label); } else if (_this.type === 'stacked') { var offset0 = d0[d0Type]; var offset1 = offset0 + value; d0[d0Type] += value; bar.width = _this.xScale(offset1) - _this.xScale(offset0); bar.x = _this.xScale(offset0); bar.y = 0; bar.offset0 = offset0; bar.offset1 = offset1; } else if (_this.type === 'normalized') { var offset0 = d0[d0Type]; var offset1 = offset0 + value; d0[d0Type] += value; if (total > 0) { offset0 = (offset0 * 100) / total; offset1 = (offset1 * 100) / total; } else { offset0 = 0; offset1 = 0; } bar.width = _this.xScale(offset1) - _this.xScale(offset0); bar.x = _this.xScale(offset0); bar.y = 0; bar.offset0 = offset0; bar.offset1 = offset1; value = (offset1 - offset0).toFixed(2) + '%'; } if (_this.colors.scaleType === 'ordinal') { bar.color = _this.colors.getColor(label); } else { if (_this.type === 'standard') { bar.color = _this.colors.getColor(value); bar.gradientStops = _this.colors.getLinearGradientStops(value); } else { bar.color = _this.colors.getColor(bar.offset1); bar.gradientStops = _this.colors.getLinearGradientStops(bar.offset1, bar.offset0); } } var tooltipLabel = formattedLabel; if (_this.seriesName) { tooltipLabel = _this.seriesName + " \u2022 " + formattedLabel; bar.data.series = _this.seriesName; } bar.tooltipText = _this.tooltipDisabled ? undefined : "\n <span class=\"tooltip-label\">" + tooltipLabel + "</span>\n <span class=\"tooltip-val\">" + value.toLocaleString() + "</span>\n "; return bar; }); this.updateDataLabels(); var _a; }; SeriesHorizontal.prototype.updateDataLabels = function () { var _this = this; if (this.type === 'stacked') { this.barsForDataLabels = []; var section = {}; section.series = this.seriesName; var totalPositive = this.series.map(function (d) { return d.value; }).reduce(function (sum, d) { return d > 0 ? sum + d : sum; }, 0); var totalNegative = this.series.map(function (d) { return d.value; }).reduce(function (sum, d) { return d < 0 ? sum + d : sum; }, 0); section.total = totalPositive + totalNegative; section.x = 0; section.y = 0; // if total is positive then we show it on the right, otherwise on the left if (section.total > 0) { section.width = this.xScale(totalPositive); } else { section.width = this.xScale(totalNegative); } section.height = this.yScale.bandwidth(); this.barsForDataLabels.push(section); } else { this.barsForDataLabels = this.series.map(function (d) { var section = {}; section.series = _this.seriesName ? _this.seriesName : d.name; section.total = d.value; section.x = _this.xScale(0); section.y = _this.yScale(d.name); section.width = _this.xScale(section.total) - _this.xScale(0); section.height = _this.yScale.bandwidth(); return section; }); } }; SeriesHorizontal.prototype.updateTooltipSettings = function () { this.tooltipPlacement = this.tooltipDisabled ? undefined : 'top'; this.tooltipType = this.tooltipDisabled ? undefined : 'tooltip'; }; SeriesHorizontal.prototype.isActive = function (entry) { if (!this.activeEntries) return false; var item = this.activeEntries.find(function (d) { return entry.name === d.name && entry.series === d.series; }); return item !== undefined; }; SeriesHorizontal.prototype.trackBy = function (index, bar) { return bar.label; }; SeriesHorizontal.prototype.trackDataLabelBy = function (index, barLabel) { return index + '#' + barLabel.series + '#' + barLabel.total; }; SeriesHorizontal.prototype.click = function (data) { this.select.emit(data); }; __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], SeriesHorizontal.prototype, "dims", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], SeriesHorizontal.prototype, "type", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], SeriesHorizontal.prototype, "series", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], SeriesHorizontal.prototype, "xScale", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], SeriesHorizontal.prototype, "yScale", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], SeriesHorizontal.prototype, "colors", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], SeriesHorizontal.prototype, "tooltipDisabled", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], SeriesHorizontal.prototype, "gradient", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Array) ], SeriesHorizontal.prototype, "activeEntries", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", String) ], SeriesHorizontal.prototype, "seriesName", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["TemplateRef"]) ], SeriesHorizontal.prototype, "tooltipTemplate", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], SeriesHorizontal.prototype, "roundEdges", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], SeriesHorizontal.prototype, "animations", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], SeriesHorizontal.prototype, "showDataLabel", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], SeriesHorizontal.prototype, "dataLabelFormatting", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", Object) ], SeriesHorizontal.prototype, "select", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", Object) ], SeriesHorizontal.prototype, "activate", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", Object) ], SeriesHorizontal.prototype, "deactivate", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", Object) ], SeriesHorizontal.prototype, "dataLabelWidthChanged", void 0); SeriesHorizontal = __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ selector: 'g[ngx-charts-series-horizontal]', template: "\n <svg:g ngx-charts-bar\n *ngFor=\"let bar of bars; trackBy:trackBy\"\n [@animationState]=\"'active'\"\n [width]=\"bar.width\"\n [height]=\"bar.height\"\n [x]=\"bar.x\"\n [y]=\"bar.y\"\n [fill]=\"bar.color\"\n [stops]=\"bar.gradientStops\"\n [data]=\"bar.data\"\n [orientation]=\"'horizontal'\"\n [roundEdges]=\"bar.roundEdges\"\n (select)=\"click($event)\"\n [gradient]=\"gradient\"\n [isActive]=\"isActive(bar.data)\"\n [animations]=\"animations\"\n (activate)=\"activate.emit($event)\"\n (deactivate)=\"deactivate.emit($event)\"\n ngx-tooltip\n [tooltipDisabled]=\"tooltipDisabled\"\n [tooltipPlacement]=\"tooltipPlacement\"\n [tooltipType]=\"tooltipType\"\n [tooltipTitle]=\"tooltipTemplate ? undefined : bar.tooltipText\"\n [tooltipTemplate]=\"tooltipTemplate\"\n [tooltipContext]=\"bar.data\">\n </svg:g>\n <svg:g *ngIf=\"showDataLabel\">\n <svg:g ngx-charts-bar-label *ngFor=\"let b of barsForDataLabels; let i = index; trackBy:trackDataLabelBy\" \n [barX]=\"b.x\"\n [barY]=\"b.y\"\n [barWidth]=\"b.width\"\n [barHeight]=\"b.height\"\n [value]=\"b.total\"\n [valueFormatting]=\"dataLabelFormatting\"\n [orientation]=\"'horizontal'\"\n (dimensionsChanged)=\"dataLabelWidthChanged.emit({size:$event, index:i})\" \n />\n </svg:g> \n ", changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectionStrategy"].OnPush, animations: [ Object(__WEBPACK_IMPORTED_MODULE_1__angular_animations__["trigger"])('animationState', [ Object(__WEBPACK_IMPORTED_MODULE_1__angular_animations__["transition"])(':leave', [ Object(__WEBPACK_IMPORTED_MODULE_1__angular_animations__["style"])({ opacity: 1 }), Object(__WEBPACK_IMPORTED_MODULE_1__angular_animations__["animate"])(500, Object(__WEBPACK_IMPORTED_MODULE_1__angular_animations__["style"])({ opacity: 0 })) ]) ]) ] }) ], SeriesHorizontal); return SeriesHorizontal; }()); /***/ }), /***/ "./src/bar-chart/series-vertical.component.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return D0Types; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return SeriesVerticalComponent; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("@angular/core"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_animations__ = __webpack_require__("@angular/animations"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_animations___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1__angular_animations__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__common_label_helper__ = __webpack_require__("./src/common/label.helper.ts"); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var D0Types; (function (D0Types) { D0Types["positive"] = "positive"; D0Types["negative"] = "negative"; })(D0Types || (D0Types = {})); var SeriesVerticalComponent = /** @class */ (function () { function SeriesVerticalComponent() { this.type = 'standard'; this.tooltipDisabled = false; this.animations = true; this.showDataLabel = false; this.select = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); this.activate = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); this.deactivate = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); this.dataLabelHeightChanged = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); this.barsForDataLabels = []; } SeriesVerticalComponent.prototype.ngOnChanges = function (changes) { this.update(); }; SeriesVerticalComponent.prototype.update = function () { var _this = this; this.updateTooltipSettings(); var width; if (this.series.length) { width = this.xScale.bandwidth(); } var yScaleMin = Math.max(this.yScale.domain()[0], 0); var d0 = (_a = {}, _a[D0Types.positive] = 0, _a[D0Types.negative] = 0, _a); var d0Type = D0Types.positive; var total; if (this.type === 'normalized') { total = this.series.map(function (d) { return d.value; }).reduce(function (sum, d) { return sum + d; }, 0); } this.bars = this.series.map(function (d, index) { var value = d.value; var label = d.name; var formattedLabel = Object(__WEBPACK_IMPORTED_MODULE_2__common_label_helper__["a" /* formatLabel */])(label); var roundEdges = _this.roundEdges; d0Type = value > 0 ? D0Types.positive : D0Types.negative; var bar = { value: value, label: label, roundEdges: roundEdges, data: d, width: width, formattedLabel: formattedLabel, height: 0, x: 0, y: 0, }; if (_this.type === 'standard') { bar.height = Math.abs(_this.yScale(value) - _this.yScale(yScaleMin)); bar.x = _this.xScale(label); if (value < 0) { bar.y = _this.yScale(0); } else { bar.y = _this.yScale(value); } } else if (_this.type === 'stacked') { var offset0 = d0[d0Type]; var offset1 = offset0 + value; d0[d0Type] += value; bar.height = _this.yScale(offset0) - _this.yScale(offset1); bar.x = 0; bar.y = _this.yScale(offset1); bar.offset0 = offset0; bar.offset1 = offset1; } else if (_this.type === 'normalized') { var offset0 = d0[d0Type]; var offset1 = offset0 + value; d0[d0Type] += value; if (total > 0) { offset0 = (offset0 * 100) / total; offset1 = (offset1 * 100) / total; } else { offset0 = 0; offset1 = 0; } bar.height = _this.yScale(offset0) - _this.yScale(offset1); bar.x = 0; bar.y = _this.yScale(offset1); bar.offset0 = offset0; bar.offset1 = offset1; value = (offset1 - offset0).toFixed(2) + '%'; } if (_this.colors.scaleType === 'ordinal') { bar.color = _this.colors.getColor(label); } else { if (_this.type === 'standard') { bar.color = _this.colors.getColor(value); bar.gradientStops = _this.colors.getLinearGradientStops(value); } else { bar.color = _this.colors.getColor(bar.offset1); bar.gradientStops = _this.colors.getLinearGradientStops(bar.offset1, bar.offset0); } } var tooltipLabel = formattedLabel; if (_this.seriesName) { tooltipLabel = _this.seriesName + " \u2022 " + formattedLabel; bar.data.series = _this.seriesName; } bar.tooltipText = _this.tooltipDisabled ? undefined : "\n <span class=\"tooltip-label\">" + tooltipLabel + "</span>\n <span class=\"tooltip-val\">" + value.toLocaleString() + "</span>\n "; return bar; }); this.updateDataLabels(); var _a; }; SeriesVerticalComponent.prototype.updateDataLabels = function () { var _this = this; if (this.type === 'stacked') { this.barsForDataLabels = []; var section = {}; section.series = this.seriesName; var totalPositive = this.series.map(function (d) { return d.value; }).reduce(function (sum, d) { return d > 0 ? sum + d : sum; }, 0); var totalNegative = this.series.map(function (d) { return d.value; }).reduce(function (sum, d) { return d < 0 ? sum + d : sum; }, 0); section.total = totalPositive + totalNegative; section.x = 0; section.y = 0; if (section.total > 0) { section.height = this.yScale(totalPositive); } else { section.height = this.yScale(totalNegative); } section.width = this.xScale.bandwidth(); this.barsForDataLabels.push(section); } else { this.barsForDataLabels = this.series.map(function (d) { var section = {}; section.series = _this.seriesName ? _this.seriesName : d.name; section.total = d.value; section.x = _this.xScale(d.name); section.y = _this.yScale(0); section.height = _this.yScale(section.total) - _this.yScale(0); section.width = _this.xScale.bandwidth(); return section; }); } }; SeriesVerticalComponent.prototype.updateTooltipSettings = function () { this.tooltipPlacement = this.tooltipDisabled ? undefined : 'top'; this.tooltipType = this.tooltipDisabled ? undefined : 'tooltip'; }; SeriesVerticalComponent.prototype.isActive = function (entry) { if (!this.activeEntries) return false; var item = this.activeEntries.find(function (d) { return entry.name === d.name && entry.series === d.series; }); return item !== undefined; }; SeriesVerticalComponent.prototype.onClick = function (data) { this.select.emit(data); }; SeriesVerticalComponent.prototype.trackBy = function (index, bar) { return bar.label; }; SeriesVerticalComponent.prototype.trackDataLabelBy = function (index, barLabel) { return index + '#' + barLabel.series + '#' + barLabel.total; }; __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], SeriesVerticalComponent.prototype, "dims", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], SeriesVerticalComponent.prototype, "type", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], SeriesVerticalComponent.prototype, "series", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], SeriesVerticalComponent.prototype, "xScale", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], SeriesVerticalComponent.prototype, "yScale", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], SeriesVerticalComponent.prototype, "colors", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], SeriesVerticalComponent.prototype, "gradient", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Array) ], SeriesVerticalComponent.prototype, "activeEntries", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", String) ], SeriesVerticalComponent.prototype, "seriesName", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], SeriesVerticalComponent.prototype, "tooltipDisabled", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["TemplateRef"]) ], SeriesVerticalComponent.prototype, "tooltipTemplate", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], SeriesVerticalComponent.prototype, "roundEdges", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], SeriesVerticalComponent.prototype, "animations", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], SeriesVerticalComponent.prototype, "showDataLabel", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], SeriesVerticalComponent.prototype, "dataLabelFormatting", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", Object) ], SeriesVerticalComponent.prototype, "select", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", Object) ], SeriesVerticalComponent.prototype, "activate", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", Object) ], SeriesVerticalComponent.prototype, "deactivate", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", Object) ], SeriesVerticalComponent.prototype, "dataLabelHeightChanged", void 0); SeriesVerticalComponent = __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ selector: 'g[ngx-charts-series-vertical]', template: "\n <svg:g ngx-charts-bar\n *ngFor=\"let bar of bars; trackBy: trackBy\"\n [@animationState]=\"'active'\"\n [@.disabled]=\"!animations\"\n [width]=\"bar.width\"\n [height]=\"bar.height\"\n [x]=\"bar.x\"\n [y]=\"bar.y\"\n [fill]=\"bar.color\"\n [stops]=\"bar.gradientStops\"\n [data]=\"bar.data\"\n [orientation]=\"'vertical'\"\n [roundEdges]=\"bar.roundEdges\"\n [gradient]=\"gradient\"\n [isActive]=\"isActive(bar.data)\"\n (select)=\"onClick($event)\"\n (activate)=\"activate.emit($event)\"\n (deactivate)=\"deactivate.emit($event)\"\n ngx-tooltip\n [tooltipDisabled]=\"tooltipDisabled\"\n [tooltipPlacement]=\"tooltipPlacement\"\n [tooltipType]=\"tooltipType\"\n [tooltipTitle]=\"tooltipTemplate ? undefined : bar.tooltipText\"\n [tooltipTemplate]=\"tooltipTemplate\"\n [tooltipContext]=\"bar.data\"\n [animations]=\"animations\">\n </svg:g>\n <svg:g *ngIf=\"showDataLabel\">\n <svg:g ngx-charts-bar-label *ngFor=\"let b of barsForDataLabels; let i = index; trackBy:trackDataLabelBy\" \n [barX]=\"b.x\"\n [barY]=\"b.y\"\n [barWidth]=\"b.width\"\n [barHeight]=\"b.height\"\n [value]=\"b.total\"\n [valueFormatting]=\"dataLabelFormatting\"\n [orientation]=\"'vertical'\"\n (dimensionsChanged)=\"dataLabelHeightChanged.emit({size:$event, index:i})\"\n />\n </svg:g> \n ", changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectionStrategy"].OnPush, animations: [ Object(__WEBPACK_IMPORTED_MODULE_1__angular_animations__["trigger"])('animationState', [ Object(__WEBPACK_IMPORTED_MODULE_1__angular_animations__["transition"])(':leave', [ Object(__WEBPACK_IMPORTED_MODULE_1__angular_animations__["style"])({ opacity: 1 }), Object(__WEBPACK_IMPORTED_MODULE_1__angular_animations__["animate"])(500, Object(__WEBPACK_IMPORTED_MODULE_1__angular_animations__["style"])({ opacity: 0 })) ]) ]) ] }) ], SeriesVerticalComponent); return SeriesVerticalComponent; }()); /***/ }), /***/ "./src/bubble-chart/bubble-chart.component.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return BubbleChartComponent; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("@angular/core"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_animations__ = __webpack_require__("@angular/animations"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_animations___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1__angular_animations__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_d3_scale__ = __webpack_require__("d3-scale"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_d3_scale___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_d3_scale__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__common_base_chart_component__ = __webpack_require__("./src/common/base-chart.component.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__common_view_dimensions_helper__ = __webpack_require__("./src/common/view-dimensions.helper.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__common_color_helper__ = __webpack_require__("./src/common/color.helper.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__bubble_chart_utils__ = __webpack_require__("./src/bubble-chart/bubble-chart.utils.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__utils_id__ = __webpack_require__("./src/utils/id.ts"); var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var BubbleChartComponent = /** @class */ (function (_super) { __extends(BubbleChartComponent, _super); function BubbleChartComponent() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.showGridLines = true; _this.legend = false; _this.legendTitle = 'Legend'; _this.xAxis = true; _this.yAxis = true; _this.roundDomains = false; _this.maxRadius = 10; _this.minRadius = 3; _this.schemeType = 'ordinal'; _this.legendPosition = 'right'; _this.tooltipDisabled = false; _this.activate = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); _this.deactivate = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); _this.scaleType = 'linear'; _this.margin = [10, 20, 10, 20]; _this.bubblePadding = [0, 0, 0, 0]; _this.xAxisHeight = 0; _this.yAxisWidth = 0; _this.activeEntries = []; return _this; } BubbleChartComponent.prototype.update = function () { _super.prototype.update.call(this); this.dims = Object(__WEBPACK_IMPORTED_MODULE_4__common_view_dimensions_helper__["a" /* calculateViewDimensions */])({ width: this.width, height: this.height, margins: this.margin, showXAxis: this.xAxis, showYAxis: this.yAxis, xAxisHeight: this.xAxisHeight, yAxisWidth: this.yAxisWidth, showXLabel: this.showXAxisLabel, showYLabel: this.showYAxisLabel, showLegend: this.legend, legendType: this.schemeType }); this.seriesDomain = this.results.map(function (d) { return d.name; }); this.rDomain = this.getRDomain(); this.xDomain = this.getXDomain(); this.yDomain = this.getYDomain(); this.transform = "translate(" + this.dims.xOffset + "," + this.margin[0] + ")"; var colorDomain = this.schemeType === 'ordinal' ? this.seriesDomain : this.rDomain; this.colors = new __WEBPACK_IMPORTED_MODULE_5__common_color_helper__["a" /* ColorHelper */](this.scheme, this.schemeType, colorDomain, this.customColors); this.data = this.results; this.minRadius = Math.max(this.minRadius, 1); this.maxRadius = Math.max(this.maxRadius, 1); this.rScale = this.getRScale(this.rDomain, [this.minRadius, this.maxRadius]); this.bubblePadding = [0, 0, 0, 0]; this.setScales(); this.bubblePadding = this.getBubblePadding(); this.setScales(); this.legendOptions = this.getLegendOptions(); this.clipPathId = 'clip' + Object(__WEBPACK_IMPORTED_MODULE_7__utils_id__["a" /* id */])().toString(); this.clipPath = "url(#" + this.clipPathId + ")"; }; BubbleChartComponent.prototype.hideCircles = function () { this.deactivateAll(); }; BubbleChartComponent.prototype.onClick = function (data, series) { if (series) { data.series = series.name; } this.select.emit(data); }; BubbleChartComponent.prototype.getBubblePadding = function () { var yMin = 0; var xMin = 0; var yMax = this.dims.height; var xMax = this.dims.width; for (var _i = 0, _a = this.data; _i < _a.length; _i++) { var s = _a[_i]; for (var _b = 0, _c = s.series; _b < _c.length; _b++) { var d = _c[_b]; var r = this.rScale(d.r); var cx = (this.xScaleType === 'linear') ? this.xScale(Number(d.x)) : this.xScale(d.x); var cy = (this.yScaleType === 'linear') ? this.yScale(Number(d.y)) : this.yScale(d.y); xMin = Math.max(r - cx, xMin); yMin = Math.max(r - cy, yMin); yMax = Math.max(cy + r, yMax); xMax = Math.max(cx + r, xMax); } } xMax = Math.max(xMax - this.dims.width, 0); yMax = Math.max(yMax - this.dims.height, 0); return [yMin, xMax, yMax, xMin]; }; BubbleChartComponent.prototype.setScales = function () { var width = this.dims.width; if (this.xScaleMin === undefined && this.xScaleMax === undefined) { width = width - this.bubblePadding[1]; } var height = this.dims.height; if (this.yScaleMin === undefined && this.yScaleMax === undefined) { height = height - this.bubblePadding[2]; } this.xScale = this.getXScale(this.xDomain, width); this.yScale = this.getYScale(this.yDomain, height); }; BubbleChartComponent.prototype.getYScale = function (domain, height) { return Object(__WEBPACK_IMPORTED_MODULE_6__bubble_chart_utils__["b" /* getScale */])(domain, [height, this.bubblePadding[0]], this.yScaleType, this.roundDomains); }; BubbleChartComponent.prototype.getXScale = function (domain, width) { return Object(__WEBPACK_IMPORTED_MODULE_6__bubble_chart_utils__["b" /* getScale */])(domain, [this.bubblePadding[3], width], this.xScaleType, this.roundDomains); }; BubbleChartComponent.prototype.getRScale = function (domain, range) { var scale = Object(__WEBPACK_IMPORTED_MODULE_2_d3_scale__["scaleLinear"])() .range(range) .domain(domain); return this.roundDomains ? scale.nice() : scale; }; BubbleChartComponent.prototype.getLegendOptions = function () { var opts = { scaleType: this.schemeType, colors: undefined, domain: [], position: this.legendPosition, title: undefined }; if (opts.scaleType === 'ordinal') { opts.domain = this.seriesDomain; opts.colors = this.colors; opts.title = this.legendTitle; } else { opts.domain = this.rDomain; opts.colors = this.colors.scale; } return opts; }; BubbleChartComponent.prototype.getXDomain = function () { var values = []; for (var _i = 0, _a = this.results; _i < _a.length; _i++) { var results = _a[_i]; for (var _b = 0, _c = results.series; _b < _c.length; _b++) { var d = _c[_b]; if (!values.includes(d.x)) { values.push(d.x); } } } this.xScaleType = Object(__WEBPACK_IMPORTED_MODULE_6__bubble_chart_utils__["c" /* getScaleType */])(values); return Object(__WEBPACK_IMPORTED_MODULE_6__bubble_chart_utils__["a" /* getDomain */])(values, this.xScaleType, this.autoScale, this.xScaleMin, this.xScaleMax); }; BubbleChartComponent.prototype.getYDomain = function () { var values = []; for (var _i = 0, _a = this.results; _i < _a.length; _i++) { var results = _a[_i]; for (var _b = 0, _c = results.series; _b < _c.length; _b++) { var d = _c[_b]; if (!values.includes(d.y)) { values.push(d.y); } } } this.yScaleType = Object(__WEBPACK_IMPORTED_MODULE_6__bubble_chart_utils__["c" /* getScaleType */])(values); return Object(__WEBPACK_IMPORTED_MODULE_6__bubble_chart_utils__["a" /* getDomain */])(values, this.yScaleType, this.autoScale, this.yScaleMin, this.yScaleMax); }; BubbleChartComponent.prototype.getRDomain = function () { var min = Infinity; var max = -Infinity; for (var _i = 0, _a = this.results; _i < _a.length; _i++) { var results = _a[_i]; for (var _b = 0, _c = results.series; _b < _c.length; _b++) { var d = _c[_b]; var value = Number(d.r) || 1; min = Math.min(min, value); max = Math.max(max, value); } } return [min, max]; }; BubbleChartComponent.prototype.updateYAxisWidth = function (_a) { var width = _a.width; this.yAxisWidth = width; this.update(); }; BubbleChartComponent.prototype.updateXAxisHeight = function (_a) { var height = _a.height; this.xAxisHeight = height; this.update(); }; BubbleChartComponent.prototype.onActivate = function (item) { var idx = this.activeEntries.findIndex(function (d) { return d.name === item.name; }); if (idx > -1) { return; } this.activeEntries = [item].concat(this.activeEntries); this.activate.emit({ value: item, entries: this.activeEntries }); }; BubbleChartComponent.prototype.onDeactivate = function (item) { var idx = this.activeEntries.findIndex(function (d) { return d.name === item.name; }); this.activeEntries.splice(idx, 1); this.activeEntries = this.activeEntries.slice(); this.deactivate.emit({ value: item, entries: this.activeEntries }); }; BubbleChartComponent.prototype.deactivateAll = function () { this.activeEntries = this.activeEntries.slice(); for (var _i = 0, _a = this.activeEntries; _i < _a.length; _i++) { var entry = _a[_i]; this.deactivate.emit({ value: entry, entries: [] }); } this.activeEntries = []; }; BubbleChartComponent.prototype.trackBy = function (index, item) { return item.name; }; __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], BubbleChartComponent.prototype, "showGridLines", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BubbleChartComponent.prototype, "legend", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", String) ], BubbleChartComponent.prototype, "legendTitle", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], BubbleChartComponent.prototype, "xAxis", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], BubbleChartComponent.prototype, "yAxis", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], BubbleChartComponent.prototype, "showXAxisLabel", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], BubbleChartComponent.prototype, "showYAxisLabel", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", String) ], BubbleChartComponent.prototype, "xAxisLabel", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", String) ], BubbleChartComponent.prototype, "yAxisLabel", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BubbleChartComponent.prototype, "xAxisTickFormatting", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BubbleChartComponent.prototype, "yAxisTickFormatting", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Array) ], BubbleChartComponent.prototype, "xAxisTicks", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Array) ], BubbleChartComponent.prototype, "yAxisTicks", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], BubbleChartComponent.prototype, "roundDomains", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BubbleChartComponent.prototype, "maxRadius", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BubbleChartComponent.prototype, "minRadius", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], BubbleChartComponent.prototype, "autoScale", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BubbleChartComponent.prototype, "schemeType", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", String) ], BubbleChartComponent.prototype, "legendPosition", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], BubbleChartComponent.prototype, "tooltipDisabled", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BubbleChartComponent.prototype, "xScaleMin", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BubbleChartComponent.prototype, "xScaleMax", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BubbleChartComponent.prototype, "yScaleMin", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BubbleChartComponent.prototype, "yScaleMax", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"]) ], BubbleChartComponent.prototype, "activate", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"]) ], BubbleChartComponent.prototype, "deactivate", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["ContentChild"])('tooltipTemplate'), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["TemplateRef"]) ], BubbleChartComponent.prototype, "tooltipTemplate", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["HostListener"])('mouseleave'), __metadata("design:type", Function), __metadata("design:paramtypes", []), __metadata("design:returntype", void 0) ], BubbleChartComponent.prototype, "hideCircles", null); BubbleChartComponent = __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ selector: 'ngx-charts-bubble-chart', template: "\n <ngx-charts-chart\n [view]=\"[width, height]\"\n [showLegend]=\"legend\"\n [activeEntries]=\"activeEntries\"\n [legendOptions]=\"legendOptions\"\n [animations]=\"animations\"\n (legendLabelClick)=\"onClick($event)\"\n (legendLabelActivate)=\"onActivate($event)\"\n (legendLabelDeactivate)=\"onDeactivate($event)\">\n <svg:defs>\n <svg:clipPath [attr.id]=\"clipPathId\">\n <svg:rect\n [attr.width]=\"dims.width + 10\"\n [attr.height]=\"dims.height + 10\"\n [attr.transform]=\"'translate(-5, -5)'\"/>\n </svg:clipPath>\n </svg:defs>\n <svg:g [attr.transform]=\"transform\" class=\"bubble-chart chart\">\n <svg:g ngx-charts-x-axis\n *ngIf=\"xAxis\"\n [showGridLines]=\"showGridLines\"\n [dims]=\"dims\"\n [xScale]=\"xScale\"\n [showLabel]=\"showXAxisLabel\"\n [labelText]=\"xAxisLabel\"\n [tickFormatting]=\"xAxisTickFormatting\"\n [ticks]=\"xAxisTicks\"\n (dimensionsChanged)=\"updateXAxisHeight($event)\"/>\n <svg:g ngx-charts-y-axis\n *ngIf=\"yAxis\"\n [showGridLines]=\"showGridLines\"\n [yScale]=\"yScale\"\n [dims]=\"dims\"\n [showLabel]=\"showYAxisLabel\"\n [labelText]=\"yAxisLabel\"\n [tickFormatting]=\"yAxisTickFormatting\"\n [ticks]=\"yAxisTicks\"\n (dimensionsChanged)=\"updateYAxisWidth($event)\"/>\n <svg:rect\n class=\"bubble-chart-area\"\n x=\"0\"\n y=\"0\"\n [attr.width]=\"dims.width\"\n [attr.height]=\"dims.height\"\n style=\"fill: rgb(255, 0, 0); opacity: 0; cursor: 'auto';\"\n (mouseenter)=\"deactivateAll()\"\n />\n <svg:g [attr.clip-path]=\"clipPath\">\n <svg:g *ngFor=\"let series of data; trackBy:trackBy\" [@animationState]=\"'active'\">\n <svg:g ngx-charts-bubble-series\n [xScale]=\"xScale\"\n [yScale]=\"yScale\"\n [rScale]=\"rScale\"\n [xScaleType]=\"xScaleType\"\n [yScaleType]=\"yScaleType\"\n [xAxisLabel]=\"xAxisLabel\"\n [yAxisLabel]=\"yAxisLabel\"\n [colors]=\"colors\"\n [data]=\"series\"\n [activeEntries]=\"activeEntries\"\n [tooltipDisabled]=\"tooltipDisabled\"\n [tooltipTemplate]=\"tooltipTemplate\"\n (select)=\"onClick($event, series)\"\n (activate)=\"onActivate($event)\"\n (deactivate)=\"onDeactivate($event)\" />\n </svg:g>\n </svg:g>\n </svg:g>\n </ngx-charts-chart>\n ", styles: [__webpack_require__("./src/common/base-chart.component.scss")], changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectionStrategy"].OnPush, encapsulation: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ViewEncapsulation"].None, animations: [ Object(__WEBPACK_IMPORTED_MODULE_1__angular_animations__["trigger"])('animationState', [ Object(__WEBPACK_IMPORTED_MODULE_1__angular_animations__["transition"])(':leave', [ Object(__WEBPACK_IMPORTED_MODULE_1__angular_animations__["style"])({ opacity: 1, }), Object(__WEBPACK_IMPORTED_MODULE_1__angular_animations__["animate"])(500, Object(__WEBPACK_IMPORTED_MODULE_1__angular_animations__["style"])({ opacity: 0 })) ]) ]) ] }) ], BubbleChartComponent); return BubbleChartComponent; }(__WEBPACK_IMPORTED_MODULE_3__common_base_chart_component__["a" /* BaseChartComponent */])); /***/ }), /***/ "./src/bubble-chart/bubble-chart.module.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return BubbleChartModule; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("@angular/core"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__common_chart_common_module__ = __webpack_require__("./src/common/chart-common.module.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__bubble_chart_component__ = __webpack_require__("./src/bubble-chart/bubble-chart.component.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__bubble_series_component__ = __webpack_require__("./src/bubble-chart/bubble-series.component.ts"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return __WEBPACK_IMPORTED_MODULE_2__bubble_chart_component__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return __WEBPACK_IMPORTED_MODULE_3__bubble_series_component__["a"]; }); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var BubbleChartModule = /** @class */ (function () { function BubbleChartModule() { } BubbleChartModule = __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["NgModule"])({ imports: [__WEBPACK_IMPORTED_MODULE_1__common_chart_common_module__["a" /* ChartCommonModule */]], declarations: [ __WEBPACK_IMPORTED_MODULE_2__bubble_chart_component__["a" /* BubbleChartComponent */], __WEBPACK_IMPORTED_MODULE_3__bubble_series_component__["a" /* BubbleSeriesComponent */] ], exports: [ __WEBPACK_IMPORTED_MODULE_2__bubble_chart_component__["a" /* BubbleChartComponent */], __WEBPACK_IMPORTED_MODULE_3__bubble_series_component__["a" /* BubbleSeriesComponent */] ] }) ], BubbleChartModule); return BubbleChartModule; }()); /***/ }), /***/ "./src/bubble-chart/bubble-chart.utils.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["c"] = getScaleType; /* harmony export (immutable) */ __webpack_exports__["a"] = getDomain; /* harmony export (immutable) */ __webpack_exports__["b"] = getScale; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_d3_scale__ = __webpack_require__("d3-scale"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_d3_scale___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_d3_scale__); function getScaleType(values) { var date = true; var num = true; for (var _i = 0, values_1 = values; _i < values_1.length; _i++) { var value = values_1[_i]; if (!isDate(value)) { date = false; } if (typeof value !== 'number') { num = false; } } if (date) return 'time'; if (num) return 'linear'; return 'ordinal'; } function isDate(value) { if (value instanceof Date) { return true; } return false; } function getDomain(values, scaleType, autoScale, minVal, maxVal) { var domain = []; if (scaleType === 'linear') { values = values.map(function (v) { return Number(v); }); if (!autoScale) { values.push(0); } } if (scaleType === 'time' || scaleType === 'linear') { var min = minVal ? minVal : Math.min.apply(Math, values); var max = maxVal ? maxVal : Math.max.apply(Math, values); domain = [min, max]; } else { domain = values; } return domain; } function getScale(domain, range, scaleType, roundDomains) { var scale; if (scaleType === 'time') { scale = Object(__WEBPACK_IMPORTED_MODULE_0_d3_scale__["scaleTime"])() .range(range) .domain(domain); } else if (scaleType === 'linear') { scale = Object(__WEBPACK_IMPORTED_MODULE_0_d3_scale__["scaleLinear"])() .range(range) .domain(domain); if (roundDomains) { scale = scale.nice(); } } else if (scaleType === 'ordinal') { scale = Object(__WEBPACK_IMPORTED_MODULE_0_d3_scale__["scalePoint"])() .range([range[0], range[1]]) .domain(domain); } return scale; } /***/ }), /***/ "./src/bubble-chart/bubble-series.component.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return BubbleSeriesComponent; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("@angular/core"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_animations__ = __webpack_require__("@angular/animations"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_animations___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1__angular_animations__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__common_label_helper__ = __webpack_require__("./src/common/label.helper.ts"); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var BubbleSeriesComponent = /** @class */ (function () { function BubbleSeriesComponent() { this.tooltipDisabled = false; this.select = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); this.activate = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); this.deactivate = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); } BubbleSeriesComponent.prototype.ngOnChanges = function (changes) { this.update(); }; BubbleSeriesComponent.prototype.update = function () { this.circles = this.getCircles(); }; BubbleSeriesComponent.prototype.getCircles = function () { var _this = this; var seriesName = this.data.name; return this.data.series.map(function (d, i) { if (typeof d.y !== 'undefined' && typeof d.x !== 'undefined') { var y = d.y; var x = d.x; var r = d.r; var radius = _this.rScale(r || 1); var tooltipLabel = Object(__WEBPACK_IMPORTED_MODULE_2__common_label_helper__["a" /* formatLabel */])(d.name); var cx = (_this.xScaleType === 'linear') ? _this.xScale(Number(x)) : _this.xScale(x); var cy = (_this.yScaleType === 'linear') ? _this.yScale(Number(y)) : _this.yScale(y); var color = (_this.colors.scaleType === 'linear') ? _this.colors.getColor(r) : _this.colors.getColor(seriesName); var isActive = !_this.activeEntries.length ? true : _this.isActive({ name: seriesName }); var opacity = isActive ? 1 : 0.3; var data = { series: seriesName, name: d.name, value: d.y, x: d.x, radius: d.r }; return { data: data, x: x, y: y, r: r, classNames: ["circle-data-" + i], value: y, label: x, cx: cx, cy: cy, radius: radius, tooltipLabel: tooltipLabel, color: color, opacity: opacity, seriesName: seriesName, isActive: isActive, transform: "translate(" + cx + "," + cy + ")" }; } }).filter(function (circle) { return circle !== undefined; }); }; BubbleSeriesComponent.prototype.getTooltipText = function (circle) { var hasRadius = typeof circle.r !== 'undefined'; var hasTooltipLabel = circle.tooltipLabel && circle.tooltipLabel.length; var hasSeriesName = circle.seriesName && circle.seriesName.length; var radiusValue = hasRadius ? Object(__WEBPACK_IMPORTED_MODULE_2__common_label_helper__["a" /* formatLabel */])(circle.r) : ''; var xAxisLabel = this.xAxisLabel && this.xAxisLabel !== '' ? this.xAxisLabel + ":" : ''; var yAxisLabel = this.yAxisLabel && this.yAxisLabel !== '' ? this.yAxisLabel + ":" : ''; var x = Object(__WEBPACK_IMPORTED_MODULE_2__common_label_helper__["a" /* formatLabel */])(circle.x); var y = Object(__WEBPACK_IMPORTED_MODULE_2__common_label_helper__["a" /* formatLabel */])(circle.y); var name = (hasSeriesName && hasTooltipLabel) ? circle.seriesName + " \u2022 " + circle.tooltipLabel : circle.seriesName + circle.tooltipLabel; var tooltipTitle = (hasSeriesName || hasTooltipLabel) ? "<span class=\"tooltip-label\">" + name + "</span>" : ''; return "\n " + tooltipTitle + "\n <span class=\"tooltip-label\">\n <label>" + xAxisLabel + "</label> " + x + "<br />\n <label>" + yAxisLabel + "</label> " + y + "\n </span>\n <span class=\"tooltip-val\">\n " + radiusValue + "\n </span>\n "; }; BubbleSeriesComponent.prototype.onClick = function (value, label) { this.select.emit({ name: label, value: value }); }; BubbleSeriesComponent.prototype.isActive = function (entry) { if (!this.activeEntries) return false; var item = this.activeEntries.find(function (d) { return entry.name === d.name; }); return item !== undefined; }; BubbleSeriesComponent.prototype.isVisible = function (circle) { if (this.activeEntries.length > 0) { return this.isActive({ name: circle.seriesName }); } return circle.opacity !== 0; }; BubbleSeriesComponent.prototype.activateCircle = function (circle) { circle.barVisible = true; this.activate.emit({ name: this.data.name }); }; BubbleSeriesComponent.prototype.deactivateCircle = function (circle) { circle.barVisible = false; this.deactivate.emit({ name: this.data.name }); }; BubbleSeriesComponent.prototype.trackBy = function (index, circle) { return circle.data.series + " " + circle.data.name; }; __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BubbleSeriesComponent.prototype, "data", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BubbleSeriesComponent.prototype, "xScale", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BubbleSeriesComponent.prototype, "yScale", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BubbleSeriesComponent.prototype, "rScale", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BubbleSeriesComponent.prototype, "xScaleType", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BubbleSeriesComponent.prototype, "yScaleType", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BubbleSeriesComponent.prototype, "colors", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BubbleSeriesComponent.prototype, "visibleValue", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Array) ], BubbleSeriesComponent.prototype, "activeEntries", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", String) ], BubbleSeriesComponent.prototype, "xAxisLabel", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", String) ], BubbleSeriesComponent.prototype, "yAxisLabel", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], BubbleSeriesComponent.prototype, "tooltipDisabled", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["TemplateRef"]) ], BubbleSeriesComponent.prototype, "tooltipTemplate", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", Object) ], BubbleSeriesComponent.prototype, "select", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", Object) ], BubbleSeriesComponent.prototype, "activate", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", Object) ], BubbleSeriesComponent.prototype, "deactivate", void 0); BubbleSeriesComponent = __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ selector: 'g[ngx-charts-bubble-series]', template: "\n <svg:g *ngFor=\"let circle of circles; trackBy: trackBy\">\n <svg:g [attr.transform]=\"circle.transform\">\n <svg:g ngx-charts-circle\n [@animationState]=\"'active'\"\n class=\"circle\"\n [cx]=\"0\"\n [cy]=\"0\"\n [r]=\"circle.radius\"\n [fill]=\"circle.color\"\n [style.opacity]=\"circle.opacity\"\n [class.active]=\"circle.isActive\"\n [pointerEvents]=\"'all'\"\n [data]=\"circle.value\"\n [classNames]=\"circle.classNames\"\n (select)=\"onClick($event, circle.label)\"\n (activate)=\"activateCircle(circle)\"\n (deactivate)=\"deactivateCircle(circle)\"\n ngx-tooltip\n [tooltipDisabled]=\"tooltipDisabled\"\n [tooltipPlacement]=\"'top'\"\n [tooltipType]=\"'tooltip'\"\n [tooltipTitle]=\"tooltipTemplate ? undefined : getTooltipText(circle)\"\n [tooltipTemplate]=\"tooltipTemplate\"\n [tooltipContext]=\"circle.data\"\n />\n </svg:g>\n </svg:g>\n ", changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectionStrategy"].OnPush, animations: [ Object(__WEBPACK_IMPORTED_MODULE_1__angular_animations__["trigger"])('animationState', [ Object(__WEBPACK_IMPORTED_MODULE_1__angular_animations__["transition"])(':enter', [ Object(__WEBPACK_IMPORTED_MODULE_1__angular_animations__["style"])({ opacity: 0, transform: 'scale(0)' }), Object(__WEBPACK_IMPORTED_MODULE_1__angular_animations__["animate"])(250, Object(__WEBPACK_IMPORTED_MODULE_1__angular_animations__["style"])({ opacity: 1, transform: 'scale(1)' })) ]) ]) ] }) ], BubbleSeriesComponent); return BubbleSeriesComponent; }()); /***/ }), /***/ "./src/bubble-chart/index.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__bubble_chart_module__ = __webpack_require__("./src/bubble-chart/bubble-chart.module.ts"); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "a", function() { return __WEBPACK_IMPORTED_MODULE_0__bubble_chart_module__["a"]; }); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "b", function() { return __WEBPACK_IMPORTED_MODULE_0__bubble_chart_module__["b"]; }); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "c", function() { return __WEBPACK_IMPORTED_MODULE_0__bubble_chart_module__["c"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__bubble_chart_component__ = __webpack_require__("./src/bubble-chart/bubble-chart.component.ts"); /* unused harmony namespace reexport */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__bubble_series_component__ = __webpack_require__("./src/bubble-chart/bubble-series.component.ts"); /* unused harmony namespace reexport */ /***/ }), /***/ "./src/common/area.component.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return AreaComponent; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("@angular/core"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_d3_selection__ = __webpack_require__("d3-selection"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_d3_selection___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_d3_selection__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__utils_id__ = __webpack_require__("./src/utils/id.ts"); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var AreaComponent = /** @class */ (function () { function AreaComponent(element) { this.opacity = 1; this.startOpacity = 0.5; this.endOpacity = 1; this.gradient = false; this.animations = true; this.select = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); this.initialized = false; this.hasGradient = false; this.element = element.nativeElement; } AreaComponent.prototype.ngOnChanges = function (changes) { if (!this.initialized) { this.loadAnimation(); this.initialized = true; } else { this.update(); } }; AreaComponent.prototype.update = function () { this.gradientId = 'grad' + Object(__WEBPACK_IMPORTED_MODULE_2__utils_id__["a" /* id */])().toString(); this.gradientFill = "url(#" + this.gradientId + ")"; if (this.gradient || this.stops) { this.gradientStops = this.getGradient(); this.hasGradient = true; } else { this.hasGradient = false; } this.updatePathEl(); }; AreaComponent.prototype.loadAnimation = function () { this.areaPath = this.startingPath; setTimeout(this.update.bind(this), 100); }; AreaComponent.prototype.updatePathEl = function () { var node = Object(__WEBPACK_IMPORTED_MODULE_1_d3_selection__["select"])(this.element).select('.area'); if (this.animations) { node.transition().duration(750) .attr('d', this.path); } else { node.attr('d', this.path); } }; AreaComponent.prototype.getGradient = function () { if (this.stops) { return this.stops; } return [ { offset: 0, color: this.fill, opacity: this.startOpacity }, { offset: 100, color: this.fill, opacity: this.endOpacity } ]; }; __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], AreaComponent.prototype, "data", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], AreaComponent.prototype, "path", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], AreaComponent.prototype, "startingPath", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], AreaComponent.prototype, "fill", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], AreaComponent.prototype, "opacity", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], AreaComponent.prototype, "startOpacity", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], AreaComponent.prototype, "endOpacity", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], AreaComponent.prototype, "activeLabel", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], AreaComponent.prototype, "gradient", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Array) ], AreaComponent.prototype, "stops", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], AreaComponent.prototype, "animations", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", Object) ], AreaComponent.prototype, "select", void 0); AreaComponent = __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ selector: 'g[ngx-charts-area]', template: "\n <svg:defs *ngIf=\"gradient\">\n <svg:g ngx-charts-svg-linear-gradient\n orientation=\"vertical\"\n [name]=\"gradientId\"\n [stops]=\"gradientStops\"\n />\n </svg:defs>\n <svg:path\n class=\"area\"\n [attr.d]=\"areaPath\"\n [attr.fill]=\"gradient ? gradientFill : fill\"\n [style.opacity]=\"opacity\"\n />\n ", changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectionStrategy"].OnPush }), __metadata("design:paramtypes", [__WEBPACK_IMPORTED_MODULE_0__angular_core__["ElementRef"]]) ], AreaComponent); return AreaComponent; }()); /***/ }), /***/ "./src/common/axes/axes.module.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return AxesModule; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("@angular/core"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__axis_label_component__ = __webpack_require__("./src/common/axes/axis-label.component.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__x_axis_component__ = __webpack_require__("./src/common/axes/x-axis.component.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__x_axis_ticks_component__ = __webpack_require__("./src/common/axes/x-axis-ticks.component.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__y_axis_component__ = __webpack_require__("./src/common/axes/y-axis.component.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__y_axis_ticks_component__ = __webpack_require__("./src/common/axes/y-axis-ticks.component.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__angular_common__ = __webpack_require__("@angular/common"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__angular_common___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_6__angular_common__); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var AxesModule = /** @class */ (function () { function AxesModule() { } AxesModule = __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["NgModule"])({ imports: [__WEBPACK_IMPORTED_MODULE_6__angular_common__["CommonModule"]], declarations: [__WEBPACK_IMPORTED_MODULE_1__axis_label_component__["a" /* AxisLabelComponent */], __WEBPACK_IMPORTED_MODULE_2__x_axis_component__["a" /* XAxisComponent */], __WEBPACK_IMPORTED_MODULE_3__x_axis_ticks_component__["a" /* XAxisTicksComponent */], __WEBPACK_IMPORTED_MODULE_4__y_axis_component__["a" /* YAxisComponent */], __WEBPACK_IMPORTED_MODULE_5__y_axis_ticks_component__["a" /* YAxisTicksComponent */]], exports: [__WEBPACK_IMPORTED_MODULE_1__axis_label_component__["a" /* AxisLabelComponent */], __WEBPACK_IMPORTED_MODULE_2__x_axis_component__["a" /* XAxisComponent */], __WEBPACK_IMPORTED_MODULE_3__x_axis_ticks_component__["a" /* XAxisTicksComponent */], __WEBPACK_IMPORTED_MODULE_4__y_axis_component__["a" /* YAxisComponent */], __WEBPACK_IMPORTED_MODULE_5__y_axis_ticks_component__["a" /* YAxisTicksComponent */]] }) ], AxesModule); return AxesModule; }()); /***/ }), /***/ "./src/common/axes/axis-label.component.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return AxisLabelComponent; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("@angular/core"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var AxisLabelComponent = /** @class */ (function () { function AxisLabelComponent(element) { this.textHeight = 25; this.margin = 5; this.element = element.nativeElement; } AxisLabelComponent.prototype.ngOnChanges = function (changes) { this.update(); }; AxisLabelComponent.prototype.update = function () { this.strokeWidth = '0.01'; this.textAnchor = 'middle'; this.transform = ''; switch (this.orient) { case 'top': this.y = this.offset; this.x = this.width / 2; break; case 'bottom': this.y = this.offset; this.x = this.width / 2; break; case 'left': this.y = -(this.offset + this.textHeight + this.margin); this.x = -this.height / 2; this.transform = 'rotate(270)'; break; case 'right': this.y = this.offset + this.margin; this.x = -this.height / 2; this.transform = 'rotate(270)'; break; default: } }; __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], AxisLabelComponent.prototype, "orient", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], AxisLabelComponent.prototype, "label", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], AxisLabelComponent.prototype, "offset", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], AxisLabelComponent.prototype, "width", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], AxisLabelComponent.prototype, "height", void 0); AxisLabelComponent = __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ selector: 'g[ngx-charts-axis-label]', template: "\n <svg:text\n [attr.stroke-width]=\"strokeWidth\"\n [attr.x]=\"x\"\n [attr.y]=\"y\"\n [attr.text-anchor]=\"textAnchor\"\n [attr.transform]=\"transform\">\n {{label}}\n </svg:text>\n ", changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectionStrategy"].OnPush }), __metadata("design:paramtypes", [__WEBPACK_IMPORTED_MODULE_0__angular_core__["ElementRef"]]) ], AxisLabelComponent); return AxisLabelComponent; }()); /***/ }), /***/ "./src/common/axes/ticks.helper.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = reduceTicks; function reduceTicks(ticks, maxTicks) { if (ticks.length > maxTicks) { var reduced = []; var modulus = Math.floor(ticks.length / maxTicks); for (var i = 0; i < ticks.length; i++) { if (i % modulus === 0) { reduced.push(ticks[i]); } } ticks = reduced; } return ticks; } /***/ }), /***/ "./src/common/axes/x-axis-ticks.component.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return XAxisTicksComponent; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("@angular/core"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__trim_label_helper__ = __webpack_require__("./src/common/trim-label.helper.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__ticks_helper__ = __webpack_require__("./src/common/axes/ticks.helper.ts"); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var XAxisTicksComponent = /** @class */ (function () { function XAxisTicksComponent() { this.tickArguments = [5]; this.tickStroke = '#ccc'; this.showGridLines = false; this.dimensionsChanged = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); this.verticalSpacing = 20; this.rotateLabels = false; this.innerTickSize = 6; this.outerTickSize = 6; this.tickPadding = 3; this.textAnchor = 'middle'; this.maxTicksLength = 0; this.maxAllowedLength = 16; this.height = 0; this.trimLabel = __WEBPACK_IMPORTED_MODULE_1__trim_label_helper__["a" /* trimLabel */]; } XAxisTicksComponent.prototype.ngOnChanges = function (changes) { this.update(); }; XAxisTicksComponent.prototype.ngAfterViewInit = function () { var _this = this; setTimeout(function () { return _this.updateDims(); }); }; XAxisTicksComponent.prototype.updateDims = function () { var _this = this; var height = parseInt(this.ticksElement.nativeElement.getBoundingClientRect().height, 10); if (height !== this.height) { this.height = height; this.dimensionsChanged.emit({ height: height }); setTimeout(function () { return _this.updateDims(); }); } }; XAxisTicksComponent.prototype.update = function () { var _this = this; var scale = this.scale; this.ticks = this.getTicks(); if (this.tickFormatting) { this.tickFormat = this.tickFormatting; } else if (scale.tickFormat) { this.tickFormat = scale.tickFormat.apply(scale, this.tickArguments); } else { this.tickFormat = function (d) { if (d.constructor.name === 'Date') { return d.toLocaleDateString(); } return d.toLocaleString(); }; } var angle = this.getRotationAngle(this.ticks); this.adjustedScale = this.scale.bandwidth ? function (d) { return this.scale(d) + this.scale.bandwidth() * 0.5; } : this.scale; this.textTransform = ''; if (angle !== 0) { this.textTransform = "rotate(" + angle + ")"; this.textAnchor = 'end'; this.verticalSpacing = 10; } else { this.textAnchor = 'middle'; } setTimeout(function () { return _this.updateDims(); }); }; XAxisTicksComponent.prototype.getRotationAngle = function (ticks) { var angle = 0; for (var i = 0; i < ticks.length; i++) { var tick = this.tickFormat(ticks[i]).toString(); if (tick.length > this.maxTicksLength) { this.maxTicksLength = tick.length; } } var len = Math.min(this.maxTicksLength, this.maxAllowedLength); var charWidth = 8; // need to measure this var wordWidth = len * charWidth; var baseWidth = wordWidth; var maxBaseWidth = Math.floor(this.width / ticks.length); // calculate optimal angle while (baseWidth > maxBaseWidth && angle > -90) { angle -= 30; baseWidth = Math.cos(angle * (Math.PI / 180)) * wordWidth; } return angle; }; XAxisTicksComponent.prototype.getTicks = function () { var ticks; var maxTicks = this.getMaxTicks(20); var maxScaleTicks = this.getMaxTicks(100); if (this.tickValues) { ticks = this.tickValues; } else if (this.scale.ticks) { ticks = this.scale.ticks.apply(this.scale, [maxScaleTicks]); } else { ticks = this.scale.domain(); ticks = Object(__WEBPACK_IMPORTED_MODULE_2__ticks_helper__["a" /* reduceTicks */])(ticks, maxTicks); } return ticks; }; XAxisTicksComponent.prototype.getMaxTicks = function (tickWidth) { return Math.floor(this.width / tickWidth); }; XAxisTicksComponent.prototype.tickTransform = function (tick) { return 'translate(' + this.adjustedScale(tick) + ',' + this.verticalSpacing + ')'; }; XAxisTicksComponent.prototype.gridLineTransform = function () { return "translate(0," + (-this.verticalSpacing - 5) + ")"; }; __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], XAxisTicksComponent.prototype, "scale", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], XAxisTicksComponent.prototype, "orient", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], XAxisTicksComponent.prototype, "tickArguments", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Array) ], XAxisTicksComponent.prototype, "tickValues", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], XAxisTicksComponent.prototype, "tickStroke", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], XAxisTicksComponent.prototype, "tickFormatting", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], XAxisTicksComponent.prototype, "showGridLines", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], XAxisTicksComponent.prototype, "gridLineHeight", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], XAxisTicksComponent.prototype, "width", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", Object) ], XAxisTicksComponent.prototype, "dimensionsChanged", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["ViewChild"])('ticksel'), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["ElementRef"]) ], XAxisTicksComponent.prototype, "ticksElement", void 0); XAxisTicksComponent = __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ selector: 'g[ngx-charts-x-axis-ticks]', template: "\n <svg:g #ticksel>\n <svg:g *ngFor=\"let tick of ticks\" class=\"tick\"\n [attr.transform]=\"tickTransform(tick)\">\n <title>{{tickFormat(tick)}}</title>\n <svg:text\n stroke-width=\"0.01\"\n [attr.text-anchor]=\"textAnchor\"\n [attr.transform]=\"textTransform\"\n [style.font-size]=\"'12px'\">\n {{trimLabel(tickFormat(tick))}}\n </svg:text>\n </svg:g>\n </svg:g>\n\n <svg:g *ngFor=\"let tick of ticks\"\n [attr.transform]=\"tickTransform(tick)\">\n <svg:g *ngIf=\"showGridLines\"\n [attr.transform]=\"gridLineTransform()\">\n <svg:line\n class=\"gridline-path gridline-path-vertical\"\n [attr.y1]=\"-gridLineHeight\"\n y2=\"0\" />\n </svg:g>\n </svg:g>\n ", changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectionStrategy"].OnPush }), __metadata("design:paramtypes", []) ], XAxisTicksComponent); return XAxisTicksComponent; }()); /***/ }), /***/ "./src/common/axes/x-axis.component.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return XAxisComponent; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("@angular/core"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__x_axis_ticks_component__ = __webpack_require__("./src/common/axes/x-axis-ticks.component.ts"); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var XAxisComponent = /** @class */ (function () { function XAxisComponent() { this.showGridLines = false; this.xOrient = 'bottom'; this.xAxisOffset = 0; this.dimensionsChanged = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); this.xAxisClassName = 'x axis'; this.labelOffset = 0; this.fill = 'none'; this.stroke = 'stroke'; this.tickStroke = '#ccc'; this.strokeWidth = 'none'; this.padding = 5; } XAxisComponent.prototype.ngOnChanges = function (changes) { this.update(); }; XAxisComponent.prototype.update = function () { this.transform = "translate(0," + (this.xAxisOffset + this.padding + this.dims.height) + ")"; if (typeof this.xAxisTickCount !== 'undefined') { this.tickArguments = [this.xAxisTickCount]; } }; XAxisComponent.prototype.emitTicksHeight = function (_a) { var _this = this; var height = _a.height; var newLabelOffset = height + 25 + 5; if (newLabelOffset !== this.labelOffset) { this.labelOffset = newLabelOffset; setTimeout(function () { _this.dimensionsChanged.emit({ height: height }); }, 0); } }; __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], XAxisComponent.prototype, "xScale", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], XAxisComponent.prototype, "dims", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], XAxisComponent.prototype, "tickFormatting", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], XAxisComponent.prototype, "showGridLines", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], XAxisComponent.prototype, "showLabel", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], XAxisComponent.prototype, "labelText", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Array) ], XAxisComponent.prototype, "ticks", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], XAxisComponent.prototype, "xAxisTickInterval", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], XAxisComponent.prototype, "xAxisTickCount", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", String) ], XAxisComponent.prototype, "xOrient", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Number) ], XAxisComponent.prototype, "xAxisOffset", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", Object) ], XAxisComponent.prototype, "dimensionsChanged", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["ViewChild"])(__WEBPACK_IMPORTED_MODULE_1__x_axis_ticks_component__["a" /* XAxisTicksComponent */]), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_1__x_axis_ticks_component__["a" /* XAxisTicksComponent */]) ], XAxisComponent.prototype, "ticksComponent", void 0); XAxisComponent = __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ selector: 'g[ngx-charts-x-axis]', template: "\n <svg:g\n [attr.class]=\"xAxisClassName\"\n [attr.transform]=\"transform\">\n <svg:g ngx-charts-x-axis-ticks\n *ngIf=\"xScale\"\n [tickFormatting]=\"tickFormatting\"\n [tickArguments]=\"tickArguments\"\n [tickStroke]=\"tickStroke\"\n [scale]=\"xScale\"\n [orient]=\"xOrient\"\n [showGridLines]=\"showGridLines\"\n [gridLineHeight]=\"dims.height\"\n [width]=\"dims.width\"\n [tickValues]=\"ticks\"\n (dimensionsChanged)=\"emitTicksHeight($event)\"\n />\n <svg:g ngx-charts-axis-label\n *ngIf=\"showLabel\"\n [label]=\"labelText\"\n [offset]=\"labelOffset\"\n [orient]=\"'bottom'\"\n [height]=\"dims.height\"\n [width]=\"dims.width\">\n </svg:g>\n </svg:g>\n ", changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectionStrategy"].OnPush }) ], XAxisComponent); return XAxisComponent; }()); /***/ }), /***/ "./src/common/axes/y-axis-ticks.component.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return YAxisTicksComponent; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("@angular/core"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__trim_label_helper__ = __webpack_require__("./src/common/trim-label.helper.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__ticks_helper__ = __webpack_require__("./src/common/axes/ticks.helper.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__common_shape_helper__ = __webpack_require__("./src/common/shape.helper.ts"); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var YAxisTicksComponent = /** @class */ (function () { function YAxisTicksComponent() { this.tickArguments = [5]; this.tickStroke = '#ccc'; this.showGridLines = false; this.showRefLabels = false; this.showRefLines = false; this.dimensionsChanged = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); this.innerTickSize = 6; this.tickPadding = 3; this.verticalSpacing = 20; this.textAnchor = 'middle'; this.width = 0; this.outerTickSize = 6; this.rotateLabels = false; this.referenceLineLength = 0; this.trimLabel = __WEBPACK_IMPORTED_MODULE_1__trim_label_helper__["a" /* trimLabel */]; } YAxisTicksComponent.prototype.ngOnChanges = function (changes) { this.update(); }; YAxisTicksComponent.prototype.ngAfterViewInit = function () { var _this = this; setTimeout(function () { return _this.updateDims(); }); }; YAxisTicksComponent.prototype.updateDims = function () { var _this = this; var width = parseInt(this.ticksElement.nativeElement.getBoundingClientRect().width, 10); if (width !== this.width) { this.width = width; this.dimensionsChanged.emit({ width: width }); setTimeout(function () { return _this.updateDims(); }); } }; YAxisTicksComponent.prototype.update = function () { var _this = this; var scale; var sign = this.orient === 'top' || this.orient === 'right' ? -1 : 1; this.tickSpacing = Math.max(this.innerTickSize, 0) + this.tickPadding; scale = this.scale; this.ticks = this.getTicks(); if (this.tickFormatting) { this.tickFormat = this.tickFormatting; } else if (scale.tickFormat) { this.tickFormat = scale.tickFormat.apply(scale, this.tickArguments); } else { this.tickFormat = function (d) { if (d.constructor.name === 'Date') { return d.toLocaleDateString(); } return d.toLocaleString(); }; } this.adjustedScale = scale.bandwidth ? function (d) { return scale(d) + scale.bandwidth() * 0.5; } : scale; if (this.showRefLines && this.referenceLines) { this.setReferencelines(); } switch (this.orient) { case 'top': this.transform = function (tick) { return 'translate(' + this.adjustedScale(tick) + ',0)'; }; this.textAnchor = 'middle'; this.y2 = this.innerTickSize * sign; this.y1 = this.tickSpacing * sign; this.dy = sign < 0 ? '0em' : '.71em'; break; case 'bottom': this.transform = function (tick) { return 'translate(' + this.adjustedScale(tick) + ',0)'; }; this.textAnchor = 'middle'; this.y2 = this.innerTickSize * sign; this.y1 = this.tickSpacing * sign; this.dy = sign < 0 ? '0em' : '.71em'; break; case 'left': this.transform = function (tick) { return 'translate(0,' + this.adjustedScale(tick) + ')'; }; this.textAnchor = 'end'; this.x2 = this.innerTickSize * -sign; this.x1 = this.tickSpacing * -sign; this.dy = '.32em'; break; case 'right': this.transform = function (tick) { return 'translate(0,' + this.adjustedScale(tick) + ')'; }; this.textAnchor = 'start'; this.x2 = this.innerTickSize * -sign; this.x1 = this.tickSpacing * -sign; this.dy = '.32em'; break; default: } setTimeout(function () { return _this.updateDims(); }); }; YAxisTicksComponent.prototype.setReferencelines = function () { this.refMin = this.adjustedScale(Math.min.apply(null, this.referenceLines.map(function (item) { return item.value; }))); this.refMax = this.adjustedScale(Math.max.apply(null, this.referenceLines.map(function (item) { return item.value; }))); this.referenceLineLength = this.referenceLines.length; this.referenceAreaPath = Object(__WEBPACK_IMPORTED_MODULE_3__common_shape_helper__["a" /* roundedRect */])(0, this.refMax, this.gridLineWidth, this.refMin - this.refMax, 0, [false, false, false, false]); }; YAxisTicksComponent.prototype.getTicks = function () { var ticks; var maxTicks = this.getMaxTicks(20); var maxScaleTicks = this.getMaxTicks(50); if (this.tickValues) { ticks = this.tickValues; } else if (this.scale.ticks) { ticks = this.scale.ticks.apply(this.scale, [maxScaleTicks]); } else { ticks = this.scale.domain(); ticks = Object(__WEBPACK_IMPORTED_MODULE_2__ticks_helper__["a" /* reduceTicks */])(ticks, maxTicks); } return ticks; }; YAxisTicksComponent.prototype.getMaxTicks = function (tickHeight) { return Math.floor(this.height / tickHeight); }; YAxisTicksComponent.prototype.tickTransform = function (tick) { return "translate(" + this.adjustedScale(tick) + "," + this.verticalSpacing + ")"; }; YAxisTicksComponent.prototype.gridLineTransform = function () { return "translate(5,0)"; }; __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], YAxisTicksComponent.prototype, "scale", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], YAxisTicksComponent.prototype, "orient", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], YAxisTicksComponent.prototype, "tickArguments", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Array) ], YAxisTicksComponent.prototype, "tickValues", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], YAxisTicksComponent.prototype, "tickStroke", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], YAxisTicksComponent.prototype, "tickFormatting", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], YAxisTicksComponent.prototype, "showGridLines", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], YAxisTicksComponent.prototype, "gridLineWidth", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], YAxisTicksComponent.prototype, "height", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], YAxisTicksComponent.prototype, "referenceLines", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], YAxisTicksComponent.prototype, "showRefLabels", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], YAxisTicksComponent.prototype, "showRefLines", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", Object) ], YAxisTicksComponent.prototype, "dimensionsChanged", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["ViewChild"])('ticksel'), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["ElementRef"]) ], YAxisTicksComponent.prototype, "ticksElement", void 0); YAxisTicksComponent = __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ selector: 'g[ngx-charts-y-axis-ticks]', template: "\n <svg:g #ticksel>\n <svg:g *ngFor=\"let tick of ticks\" class=\"tick\"\n [attr.transform]=\"transform(tick)\" >\n <title>{{tickFormat(tick)}}</title>\n <svg:text\n stroke-width=\"0.01\"\n [attr.dy]=\"dy\"\n [attr.x]=\"x1\"\n [attr.y]=\"y1\"\n [attr.text-anchor]=\"textAnchor\"\n [style.font-size]=\"'12px'\">\n {{trimLabel(tickFormat(tick))}}\n </svg:text>\n </svg:g>\n </svg:g>\n\n <svg:path *ngIf=\"referenceLineLength > 1 && refMax && refMin && showRefLines\"\n class=\"reference-area\"\n [attr.d]=\"referenceAreaPath\"\n [attr.transform]=\"gridLineTransform()\"\n />\n <svg:g *ngFor=\"let tick of ticks\"\n [attr.transform]=\"transform(tick)\">\n <svg:g\n *ngIf=\"showGridLines\"\n [attr.transform]=\"gridLineTransform()\">\n <svg:line *ngIf=\"orient === 'left'\"\n class=\"gridline-path gridline-path-horizontal\"\n x1=\"0\"\n [attr.x2]=\"gridLineWidth\" />\n <svg:line *ngIf=\"orient === 'right'\"\n class=\"gridline-path gridline-path-horizontal\"\n x1=\"0\"\n [attr.x2]=\"-gridLineWidth\" />\n </svg:g>\n </svg:g>\n\n <svg:g *ngFor=\"let refLine of referenceLines\">\n <svg:g *ngIf=\"showRefLines\" [attr.transform]=\"transform(refLine.value)\">\n <svg:line class=\"refline-path gridline-path-horizontal\"\n x1=\"0\"\n [attr.x2]=\"gridLineWidth\"\n [attr.transform]=\"gridLineTransform()\"/>\n <svg:g *ngIf=\"showRefLabels\">\n <title>{{trimLabel(tickFormat(refLine.value))}}</title>\n <svg:text\n class=\"refline-label\"\n [attr.dy]=\"dy\"\n [attr.y]=\"-6\"\n [attr.x]=\"gridLineWidth\"\n [attr.text-anchor]=\"textAnchor\" >\n {{refLine.name}}\n </svg:text>\n </svg:g>\n </svg:g>\n </svg:g>\n ", changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectionStrategy"].OnPush }), __metadata("design:paramtypes", []) ], YAxisTicksComponent); return YAxisTicksComponent; }()); /***/ }), /***/ "./src/common/axes/y-axis.component.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return YAxisComponent; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("@angular/core"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__y_axis_ticks_component__ = __webpack_require__("./src/common/axes/y-axis-ticks.component.ts"); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var YAxisComponent = /** @class */ (function () { function YAxisComponent() { this.showGridLines = false; this.yOrient = 'left'; this.yAxisOffset = 0; this.dimensionsChanged = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); this.yAxisClassName = 'y axis'; this.labelOffset = 15; this.fill = 'none'; this.stroke = '#CCC'; this.tickStroke = '#CCC'; this.strokeWidth = 1; this.padding = 5; } YAxisComponent.prototype.ngOnChanges = function (changes) { this.update(); }; YAxisComponent.prototype.update = function () { this.offset = -(this.yAxisOffset + this.padding); if (this.yOrient === 'right') { this.labelOffset = 65; this.transform = "translate(" + (this.offset + this.dims.width) + " , 0)"; } else { this.offset = this.offset; this.transform = "translate(" + this.offset + " , 0)"; } if (this.yAxisTickCount !== undefined) { this.tickArguments = [this.yAxisTickCount]; } }; YAxisComponent.prototype.emitTicksWidth = function (_a) { var _this = this; var width = _a.width; if (width !== this.labelOffset && this.yOrient === 'right') { this.labelOffset = width + this.labelOffset; setTimeout(function () { _this.dimensionsChanged.emit({ width: width }); }, 0); } else if (width !== this.labelOffset) { this.labelOffset = width; setTimeout(function () { _this.dimensionsChanged.emit({ width: width }); }, 0); } }; __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], YAxisComponent.prototype, "yScale", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], YAxisComponent.prototype, "dims", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], YAxisComponent.prototype, "tickFormatting", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Array) ], YAxisComponent.prototype, "ticks", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], YAxisComponent.prototype, "showGridLines", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], YAxisComponent.prototype, "showLabel", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], YAxisComponent.prototype, "labelText", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], YAxisComponent.prototype, "yAxisTickInterval", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], YAxisComponent.prototype, "yAxisTickCount", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", String) ], YAxisComponent.prototype, "yOrient", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], YAxisComponent.prototype, "referenceLines", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], YAxisComponent.prototype, "showRefLines", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], YAxisComponent.prototype, "showRefLabels", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Number) ], YAxisComponent.prototype, "yAxisOffset", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", Object) ], YAxisComponent.prototype, "dimensionsChanged", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["ViewChild"])(__WEBPACK_IMPORTED_MODULE_1__y_axis_ticks_component__["a" /* YAxisTicksComponent */]), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_1__y_axis_ticks_component__["a" /* YAxisTicksComponent */]) ], YAxisComponent.prototype, "ticksComponent", void 0); YAxisComponent = __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ selector: 'g[ngx-charts-y-axis]', template: "\n <svg:g\n [attr.class]=\"yAxisClassName\"\n [attr.transform]=\"transform\">\n <svg:g ngx-charts-y-axis-ticks\n *ngIf=\"yScale\"\n [tickFormatting]=\"tickFormatting\"\n [tickArguments]=\"tickArguments\"\n [tickValues]=\"ticks\"\n [tickStroke]=\"tickStroke\"\n [scale]=\"yScale\"\n [orient]=\"yOrient\"\n [showGridLines]=\"showGridLines\"\n [gridLineWidth]=\"dims.width\"\n [referenceLines]=\"referenceLines\"\n [showRefLines]=\"showRefLines\"\n [showRefLabels]=\"showRefLabels\"\n [height]=\"dims.height\"\n (dimensionsChanged)=\"emitTicksWidth($event)\"\n />\n\n <svg:g ngx-charts-axis-label\n *ngIf=\"showLabel\"\n [label]=\"labelText\"\n [offset]=\"labelOffset\"\n [orient]=\"yOrient\"\n [height]=\"dims.height\"\n [width]=\"dims.width\">\n </svg:g>\n </svg:g>\n ", changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectionStrategy"].OnPush }) ], YAxisComponent); return YAxisComponent; }()); /***/ }), /***/ "./src/common/base-chart.component.scss": /***/ (function(module, exports, __webpack_require__) { var result = __webpack_require__("./node_modules/css-loader/index.js!./node_modules/postcss-loader/index.js!./node_modules/sass-loader/lib/loader.js??ref--3-4!./src/common/base-chart.component.scss"); if (typeof result === "string") { module.exports = result; } else { module.exports = result.toString(); } /***/ }), /***/ "./src/common/base-chart.component.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return BaseChartComponent; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("@angular/core"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_rxjs_observable_fromEvent__ = __webpack_require__("./node_modules/rxjs/observable/fromEvent.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_rxjs_observable_fromEvent___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_rxjs_observable_fromEvent__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_rxjs_operators_debounceTime__ = __webpack_require__("./node_modules/rxjs/operators/debounceTime.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_rxjs_operators_debounceTime___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_rxjs_operators_debounceTime__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__utils__ = __webpack_require__("./src/utils/index.ts"); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var BaseChartComponent = /** @class */ (function () { function BaseChartComponent(chartElement, zone, cd) { this.chartElement = chartElement; this.zone = zone; this.cd = cd; this.scheme = 'cool'; this.schemeType = 'ordinal'; this.animations = true; this.select = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); } BaseChartComponent.prototype.ngAfterViewInit = function () { this.bindWindowResizeEvent(); // listen for visibility of the element for hidden by default scenario this.visibilityObserver = new __WEBPACK_IMPORTED_MODULE_3__utils__["a" /* VisibilityObserver */](this.chartElement, this.zone); this.visibilityObserver.visible.subscribe(this.update.bind(this)); }; BaseChartComponent.prototype.ngOnDestroy = function () { this.unbindEvents(); if (this.visibilityObserver) { this.visibilityObserver.visible.unsubscribe(); this.visibilityObserver.destroy(); } }; BaseChartComponent.prototype.ngOnChanges = function (changes) { this.update(); }; BaseChartComponent.prototype.update = function () { if (this.results) { this.results = this.cloneData(this.results); } else { this.results = []; } if (this.view) { this.width = this.view[0]; this.height = this.view[1]; } else { var dims = this.getContainerDims(); if (dims) { this.width = dims.width; this.height = dims.height; } } // default values if width or height are 0 or undefined if (!this.width) { this.width = 600; } if (!this.height) { this.height = 400; } this.width = ~~this.width; this.height = ~~this.height; if (this.cd) { this.cd.markForCheck(); } }; BaseChartComponent.prototype.getContainerDims = function () { var width; var height; var hostElem = this.chartElement.nativeElement; if (hostElem.parentNode !== null) { // Get the container dimensions var dims = hostElem.parentNode.getBoundingClientRect(); width = dims.width; height = dims.height; } if (width && height) { return { width: width, height: height }; } return null; }; /** * Converts all date objects that appear as name * into formatted date strings */ BaseChartComponent.prototype.formatDates = function () { for (var i = 0; i < this.results.length; i++) { var g = this.results[i]; if (g.name instanceof Date) { g.name = g.name.toLocaleDateString(); } if (g.series) { for (var j = 0; j < g.series.length; j++) { var d = g.series[j]; if (d.name instanceof Date) { d.name = d.name.toLocaleDateString(); } } } } }; BaseChartComponent.prototype.unbindEvents = function () { if (this.resizeSubscription) { this.resizeSubscription.unsubscribe(); } }; BaseChartComponent.prototype.bindWindowResizeEvent = function () { var _this = this; var source = Object(__WEBPACK_IMPORTED_MODULE_1_rxjs_observable_fromEvent__["fromEvent"])(window, 'resize', null, null); var subscription = source.pipe(Object(__WEBPACK_IMPORTED_MODULE_2_rxjs_operators_debounceTime__["debounceTime"])(200)).subscribe(function (e) { _this.update(); if (_this.cd) { _this.cd.markForCheck(); } }); this.resizeSubscription = subscription; }; /** * Clones the data into a new object * * @private * @param {any} data * @returns {*} * * @memberOf BaseChart */ BaseChartComponent.prototype.cloneData = function (data) { var results = []; for (var _i = 0, data_1 = data; _i < data_1.length; _i++) { var item = data_1[_i]; var copy = { name: item['name'] }; if (item['value'] !== undefined) { copy['value'] = item['value']; } if (item['series'] !== undefined) { copy['series'] = []; for (var _a = 0, _b = item['series']; _a < _b.length; _a++) { var seriesItem = _b[_a]; var seriesItemCopy = Object.assign({}, seriesItem); copy['series'].push(seriesItemCopy); } } if (item['extra'] !== undefined) { copy['extra'] = JSON.parse(JSON.stringify(item['extra'])); } results.push(copy); } return results; }; __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BaseChartComponent.prototype, "results", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Array) ], BaseChartComponent.prototype, "view", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BaseChartComponent.prototype, "scheme", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", String) ], BaseChartComponent.prototype, "schemeType", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], BaseChartComponent.prototype, "customColors", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], BaseChartComponent.prototype, "animations", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", Object) ], BaseChartComponent.prototype, "select", void 0); BaseChartComponent = __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ selector: 'base-chart', template: "<div></div>" }), __metadata("design:paramtypes", [__WEBPACK_IMPORTED_MODULE_0__angular_core__["ElementRef"], __WEBPACK_IMPORTED_MODULE_0__angular_core__["NgZone"], __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectorRef"]]) ], BaseChartComponent); return BaseChartComponent; }()); /***/ }), /***/ "./src/common/chart-common.module.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ChartCommonModule; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("@angular/core"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_common__ = __webpack_require__("@angular/common"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_common___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1__angular_common__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__charts_chart_component__ = __webpack_require__("./src/common/charts/chart.component.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__legend__ = __webpack_require__("./src/common/legend/index.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__base_chart_component__ = __webpack_require__("./src/common/base-chart.component.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__axes_axes_module__ = __webpack_require__("./src/common/axes/axes.module.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__tooltip__ = __webpack_require__("./src/common/tooltip/index.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__circle_series_component__ = __webpack_require__("./src/common/circle-series.component.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__circle_component__ = __webpack_require__("./src/common/circle.component.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__grid_panel_component__ = __webpack_require__("./src/common/grid-panel.component.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__grid_panel_series_component__ = __webpack_require__("./src/common/grid-panel-series.component.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__svg_linear_gradient_component__ = __webpack_require__("./src/common/svg-linear-gradient.component.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__svg_radial_gradient_component__ = __webpack_require__("./src/common/svg-radial-gradient.component.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__timeline__ = __webpack_require__("./src/common/timeline/index.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__area_component__ = __webpack_require__("./src/common/area.component.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__tooltip_area_component__ = __webpack_require__("./src/common/tooltip-area.component.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__count__ = __webpack_require__("./src/common/count/index.ts"); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var COMPONENTS = [ __WEBPACK_IMPORTED_MODULE_14__area_component__["a" /* AreaComponent */], __WEBPACK_IMPORTED_MODULE_4__base_chart_component__["a" /* BaseChartComponent */], __WEBPACK_IMPORTED_MODULE_16__count__["a" /* CountUpDirective */], __WEBPACK_IMPORTED_MODULE_15__tooltip_area_component__["a" /* TooltipArea */], __WEBPACK_IMPORTED_MODULE_2__charts_chart_component__["a" /* ChartComponent */], __WEBPACK_IMPORTED_MODULE_3__legend__["b" /* LegendComponent */], __WEBPACK_IMPORTED_MODULE_3__legend__["c" /* LegendEntryComponent */], __WEBPACK_IMPORTED_MODULE_3__legend__["d" /* ScaleLegendComponent */], __WEBPACK_IMPORTED_MODULE_8__circle_component__["a" /* CircleComponent */], __WEBPACK_IMPORTED_MODULE_7__circle_series_component__["a" /* CircleSeriesComponent */], __WEBPACK_IMPORTED_MODULE_9__grid_panel_component__["a" /* GridPanelComponent */], __WEBPACK_IMPORTED_MODULE_10__grid_panel_series_component__["a" /* GridPanelSeriesComponent */], __WEBPACK_IMPORTED_MODULE_11__svg_linear_gradient_component__["a" /* SvgLinearGradientComponent */], __WEBPACK_IMPORTED_MODULE_12__svg_radial_gradient_component__["a" /* SvgRadialGradientComponent */], __WEBPACK_IMPORTED_MODULE_13__timeline__["a" /* Timeline */], __WEBPACK_IMPORTED_MODULE_3__legend__["a" /* AdvancedLegendComponent */] ]; var ChartCommonModule = /** @class */ (function () { function ChartCommonModule() { } ChartCommonModule = __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["NgModule"])({ providers: [ __WEBPACK_IMPORTED_MODULE_1__angular_common__["Location"], { provide: __WEBPACK_IMPORTED_MODULE_1__angular_common__["LocationStrategy"], useClass: __WEBPACK_IMPORTED_MODULE_1__angular_common__["PathLocationStrategy"] } ], imports: [ __WEBPACK_IMPORTED_MODULE_1__angular_common__["CommonModule"], __WEBPACK_IMPORTED_MODULE_5__axes_axes_module__["a" /* AxesModule */], __WEBPACK_IMPORTED_MODULE_6__tooltip__["f" /* TooltipModule */] ], declarations: COMPONENTS.slice(), exports: [ __WEBPACK_IMPORTED_MODULE_1__angular_common__["CommonModule"], __WEBPACK_IMPORTED_MODULE_5__axes_axes_module__["a" /* AxesModule */], __WEBPACK_IMPORTED_MODULE_6__tooltip__["f" /* TooltipModule */] ].concat(COMPONENTS) }) ], ChartCommonModule); return ChartCommonModule; }()); /***/ }), /***/ "./src/common/charts/chart.component.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ChartComponent; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("@angular/core"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_animations__ = __webpack_require__("@angular/animations"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_animations___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1__angular_animations__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__tooltip__ = __webpack_require__("./src/common/tooltip/index.ts"); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var ChartComponent = /** @class */ (function () { function ChartComponent(vcr, tooltipService) { this.vcr = vcr; this.tooltipService = tooltipService; this.showLegend = false; this.animations = true; this.legendLabelClick = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); this.legendLabelActivate = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); this.legendLabelDeactivate = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); this.tooltipService.injectionService.setRootViewContainer(this.vcr); } ChartComponent.prototype.ngOnChanges = function (changes) { this.update(); }; ChartComponent.prototype.update = function () { var legendColumns = 0; if (this.showLegend) { this.legendType = this.getLegendType(); if (this.legendType === 'scaleLegend') { legendColumns = 1; } else { legendColumns = 2; } } var chartColumns = 12 - legendColumns; this.chartWidth = ~~(this.view[0] * chartColumns / 12.0); this.legendWidth = ~~(this.view[0] * legendColumns / 12.0); }; ChartComponent.prototype.getLegendType = function () { if (this.legendOptions.scaleType === 'linear') { return 'scaleLegend'; } else { return 'legend'; } }; __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], ChartComponent.prototype, "view", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], ChartComponent.prototype, "showLegend", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], ChartComponent.prototype, "legendOptions", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], ChartComponent.prototype, "data", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], ChartComponent.prototype, "legendData", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], ChartComponent.prototype, "legendType", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], ChartComponent.prototype, "colors", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Array) ], ChartComponent.prototype, "activeEntries", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], ChartComponent.prototype, "animations", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"]) ], ChartComponent.prototype, "legendLabelClick", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"]) ], ChartComponent.prototype, "legendLabelActivate", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"]) ], ChartComponent.prototype, "legendLabelDeactivate", void 0); ChartComponent = __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ providers: [__WEBPACK_IMPORTED_MODULE_2__tooltip__["g" /* TooltipService */]], selector: 'ngx-charts-chart', template: "\n <div\n class=\"ngx-charts-outer\"\n [style.width.px]=\"view[0]\"\n [@animationState]=\"'active'\"\n [@.disabled]=\"!animations\">\n <svg\n class=\"ngx-charts\"\n [attr.width]=\"chartWidth\"\n [attr.height]=\"view[1]\">\n <ng-content></ng-content>\n </svg>\n <ngx-charts-scale-legend\n *ngIf=\"showLegend && legendType === 'scaleLegend'\"\n class=\"chart-legend\"\n [valueRange]=\"legendOptions.domain\"\n [colors]=\"legendOptions.colors\"\n [height]=\"view[1]\"\n [width]=\"legendWidth\">\n </ngx-charts-scale-legend>\n <ngx-charts-legend\n *ngIf=\"showLegend && legendType === 'legend'\"\n class=\"chart-legend\"\n [data]=\"legendOptions.domain\"\n [title]=\"legendOptions.title\"\n [colors]=\"legendOptions.colors\"\n [height]=\"view[1]\"\n [width]=\"legendWidth\"\n [activeEntries]=\"activeEntries\"\n (labelClick)=\"legendLabelClick.emit($event)\"\n (labelActivate)=\"legendLabelActivate.emit($event)\"\n (labelDeactivate)=\"legendLabelDeactivate.emit($event)\">\n </ngx-charts-legend>\n </div>\n ", changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectionStrategy"].OnPush, animations: [ Object(__WEBPACK_IMPORTED_MODULE_1__angular_animations__["trigger"])('animationState', [ Object(__WEBPACK_IMPORTED_MODULE_1__angular_animations__["transition"])(':enter', [ Object(__WEBPACK_IMPORTED_MODULE_1__angular_animations__["style"])({ opacity: 0 }), Object(__WEBPACK_IMPORTED_MODULE_1__angular_animations__["animate"])('500ms 100ms', Object(__WEBPACK_IMPORTED_MODULE_1__angular_animations__["style"])({ opacity: 1 })) ]) ]) ] }), __metadata("design:paramtypes", [__WEBPACK_IMPORTED_MODULE_0__angular_core__["ViewContainerRef"], __WEBPACK_IMPORTED_MODULE_2__tooltip__["g" /* TooltipService */]]) ], ChartComponent); return ChartComponent; }()); /***/ }), /***/ "./src/common/charts/index.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__chart_component__ = __webpack_require__("./src/common/charts/chart.component.ts"); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "a", function() { return __WEBPACK_IMPORTED_MODULE_0__chart_component__["a"]; }); /***/ }), /***/ "./src/common/circle-series.component.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return CircleSeriesComponent; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("@angular/core"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_animations__ = __webpack_require__("@angular/animations"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_animations___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1__angular_animations__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__common_label_helper__ = __webpack_require__("./src/common/label.helper.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__utils_id__ = __webpack_require__("./src/utils/id.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4____ = __webpack_require__("./src/common/index.ts"); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var CircleSeriesComponent = /** @class */ (function () { function CircleSeriesComponent() { this.type = 'standard'; this.tooltipDisabled = false; this.select = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); this.activate = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); this.deactivate = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); this.barVisible = false; } CircleSeriesComponent.prototype.ngOnInit = function () { this.gradientId = 'grad' + Object(__WEBPACK_IMPORTED_MODULE_3__utils_id__["a" /* id */])().toString(); this.gradientFill = "url(#" + this.gradientId + ")"; }; CircleSeriesComponent.prototype.ngOnChanges = function (changes) { this.update(); }; CircleSeriesComponent.prototype.update = function () { this.circle = this.getActiveCircle(); }; CircleSeriesComponent.prototype.getActiveCircle = function () { var _this = this; var indexActiveDataPoint = this.data.series.findIndex(function (d) { var label = d.name; return label && _this.visibleValue && label.toString() === _this.visibleValue.toString() && d.value !== undefined; }); if (indexActiveDataPoint === -1) { // No valid point is 'active/hovered over' at this moment. return undefined; } return this.mapDataPointToCircle(this.data.series[indexActiveDataPoint], indexActiveDataPoint); }; CircleSeriesComponent.prototype.mapDataPointToCircle = function (d, i) { var seriesName = this.data.name; var value = d.value; var label = d.name; var tooltipLabel = Object(__WEBPACK_IMPORTED_MODULE_2__common_label_helper__["a" /* formatLabel */])(label); var cx; if (this.scaleType === 'time') { cx = this.xScale(label); } else if (this.scaleType === 'linear') { cx = this.xScale(Number(label)); } else { cx = this.xScale(label); } var cy = this.yScale(this.type === 'standard' ? value : d.d1); var radius = 5; var height = this.yScale.range()[0] - cy; var opacity = 1; var color; if (this.colors.scaleType === 'linear') { if (this.type === 'standard') { color = this.colors.getColor(value); } else { color = this.colors.getColor(d.d1); } } else { color = this.colors.getColor(seriesName); } var data = { series: seriesName, value: value, name: label }; return { classNames: ["circle-data-" + i], value: value, label: label, data: data, cx: cx, cy: cy, radius: radius, height: height, tooltipLabel: tooltipLabel, color: color, opacity: opacity, seriesName: seriesName, gradientStops: this.getGradientStops(color), min: d.min, max: d.max }; }; CircleSeriesComponent.prototype.getTooltipText = function (_a) { var tooltipLabel = _a.tooltipLabel, value = _a.value, seriesName = _a.seriesName, min = _a.min, max = _a.max; return "\n <span class=\"tooltip-label\">" + seriesName + " \u2022 " + tooltipLabel + "</span>\n <span class=\"tooltip-val\">" + value.toLocaleString() + this.getTooltipMinMaxText(min, max) + "</span>\n "; }; CircleSeriesComponent.prototype.getTooltipMinMaxText = function (min, max) { if (min !== undefined || max !== undefined) { var result = ' ('; if (min !== undefined) { if (max === undefined) { result += '≥'; } result += min.toLocaleString(); if (max !== undefined) { result += ' - '; } } else if (max !== undefined) { result += '≤'; } if (max !== undefined) { result += max.toLocaleString(); } result += ')'; return result; } else { return ''; } }; CircleSeriesComponent.prototype.getGradientStops = function (color) { return [ { offset: 0, color: color, opacity: 0.2 }, { offset: 100, color: color, opacity: 1 } ]; }; CircleSeriesComponent.prototype.onClick = function (value, label) { this.select.emit({ name: label, value: value }); }; CircleSeriesComponent.prototype.isActive = function (entry) { if (!this.activeEntries) return false; var item = this.activeEntries.find(function (d) { return entry.name === d.name; }); return item !== undefined; }; CircleSeriesComponent.prototype.activateCircle = function () { this.barVisible = true; this.activate.emit({ name: this.data.name }); }; CircleSeriesComponent.prototype.deactivateCircle = function () { this.barVisible = false; this.circle.opacity = 0; this.deactivate.emit({ name: this.data.name }); }; __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], CircleSeriesComponent.prototype, "data", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], CircleSeriesComponent.prototype, "type", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], CircleSeriesComponent.prototype, "xScale", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], CircleSeriesComponent.prototype, "yScale", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_4____["i" /* ColorHelper */]) ], CircleSeriesComponent.prototype, "colors", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], CircleSeriesComponent.prototype, "scaleType", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], CircleSeriesComponent.prototype, "visibleValue", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Array) ], CircleSeriesComponent.prototype, "activeEntries", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], CircleSeriesComponent.prototype, "tooltipDisabled", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["TemplateRef"]) ], CircleSeriesComponent.prototype, "tooltipTemplate", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", Object) ], CircleSeriesComponent.prototype, "select", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", Object) ], CircleSeriesComponent.prototype, "activate", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", Object) ], CircleSeriesComponent.prototype, "deactivate", void 0); CircleSeriesComponent = __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ selector: 'g[ngx-charts-circle-series]', template: "\n <svg:g *ngIf=\"circle\">\n <defs>\n <svg:g ngx-charts-svg-linear-gradient\n orientation=\"vertical\"\n [name]=\"gradientId\"\n [stops]=\"circle.gradientStops\"\n />\n </defs>\n <svg:rect\n *ngIf=\"barVisible && type === 'standard'\"\n [@animationState]=\"'active'\"\n [attr.x]=\"circle.cx - circle.radius\"\n [attr.y]=\"circle.cy\"\n [attr.width]=\"circle.radius * 2\"\n [attr.height]=\"circle.height\"\n [attr.fill]=\"gradientFill\"\n class=\"tooltip-bar\"\n />\n <svg:g ngx-charts-circle\n class=\"circle\"\n [cx]=\"circle.cx\"\n [cy]=\"circle.cy\"\n [r]=\"circle.radius\"\n [fill]=\"circle.color\"\n [class.active]=\"isActive({name: circle.seriesName})\"\n [pointerEvents]=\"circle.value === 0 ? 'none': 'all'\"\n [data]=\"circle.value\"\n [classNames]=\"circle.classNames\"\n (select)=\"onClick($event, circle.label)\"\n (activate)=\"activateCircle()\"\n (deactivate)=\"deactivateCircle()\"\n ngx-tooltip\n [tooltipDisabled]=\"tooltipDisabled\"\n [tooltipPlacement]=\"'top'\"\n [tooltipType]=\"'tooltip'\"\n [tooltipTitle]=\"tooltipTemplate ? undefined : getTooltipText(circle)\"\n [tooltipTemplate]=\"tooltipTemplate\"\n [tooltipContext]=\"circle.data\"\n />\n </svg:g>\n ", changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectionStrategy"].OnPush, animations: [ Object(__WEBPACK_IMPORTED_MODULE_1__angular_animations__["trigger"])('animationState', [ Object(__WEBPACK_IMPORTED_MODULE_1__angular_animations__["transition"])(':enter', [ Object(__WEBPACK_IMPORTED_MODULE_1__angular_animations__["style"])({ opacity: 0, }), Object(__WEBPACK_IMPORTED_MODULE_1__angular_animations__["animate"])(250, Object(__WEBPACK_IMPORTED_MODULE_1__angular_animations__["style"])({ opacity: 1 })) ]) ]) ] }) ], CircleSeriesComponent); return CircleSeriesComponent; }()); /***/ }), /***/ "./src/common/circle.component.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return CircleComponent; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("@angular/core"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var CircleComponent = /** @class */ (function () { function CircleComponent() { this.select = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); this.activate = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); this.deactivate = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); } CircleComponent.prototype.onClick = function () { this.select.emit(this.data); }; CircleComponent.prototype.onMouseEnter = function () { this.activate.emit(this.data); }; CircleComponent.prototype.onMouseLeave = function () { this.deactivate.emit(this.data); }; CircleComponent.prototype.ngOnChanges = function (changes) { this.classNames = Array.isArray(this.classNames) ? this.classNames.join(' ') : ''; this.classNames += 'circle'; }; __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], CircleComponent.prototype, "cx", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], CircleComponent.prototype, "cy", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], CircleComponent.prototype, "r", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], CircleComponent.prototype, "fill", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], CircleComponent.prototype, "stroke", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], CircleComponent.prototype, "data", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], CircleComponent.prototype, "classNames", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], CircleComponent.prototype, "circleOpacity", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], CircleComponent.prototype, "pointerEvents", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", Object) ], CircleComponent.prototype, "select", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", Object) ], CircleComponent.prototype, "activate", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", Object) ], CircleComponent.prototype, "deactivate", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["HostListener"])('click'), __metadata("design:type", Function), __metadata("design:paramtypes", []), __metadata("design:returntype", void 0) ], CircleComponent.prototype, "onClick", null); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["HostListener"])('mouseenter'), __metadata("design:type", Function), __metadata("design:paramtypes", []), __metadata("design:returntype", void 0) ], CircleComponent.prototype, "onMouseEnter", null); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["HostListener"])('mouseleave'), __metadata("design:type", Function), __metadata("design:paramtypes", []), __metadata("design:returntype", void 0) ], CircleComponent.prototype, "onMouseLeave", null); CircleComponent = __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ selector: 'g[ngx-charts-circle]', template: "\n <svg:circle\n [attr.cx]=\"cx\"\n [attr.cy]=\"cy\"\n [attr.r]=\"r\"\n [attr.fill]=\"fill\"\n [attr.stroke]=\"stroke\"\n [attr.opacity]=\"circleOpacity\"\n [attr.class]=\"classNames\"\n [attr.pointer-events]=\"pointerEvents\"\n />\n ", changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectionStrategy"].OnPush }) ], CircleComponent); return CircleComponent; }()); /***/ }), /***/ "./src/common/color.helper.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ColorHelper; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_d3_array__ = __webpack_require__("d3-array"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_d3_array___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_d3_array__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_d3_scale__ = __webpack_require__("d3-scale"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_d3_scale___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_d3_scale__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__utils_color_sets__ = __webpack_require__("./src/utils/color-sets.ts"); var ColorHelper = /** @class */ (function () { function ColorHelper(scheme, type, domain, customColors) { if (typeof (scheme) === 'string') { scheme = __WEBPACK_IMPORTED_MODULE_2__utils_color_sets__["a" /* colorSets */].find(function (cs) { return cs.name === scheme; }); } this.colorDomain = scheme.domain; this.scaleType = type; this.domain = domain; this.customColors = customColors; this.scale = this.generateColorScheme(scheme, type, this.domain); } ColorHelper.prototype.generateColorScheme = function (scheme, type, domain) { if (typeof (scheme) === 'string') { scheme = __WEBPACK_IMPORTED_MODULE_2__utils_color_sets__["a" /* colorSets */].find(function (cs) { return cs.name === scheme; }); } var colorScale; if (type === 'quantile') { colorScale = Object(__WEBPACK_IMPORTED_MODULE_1_d3_scale__["scaleQuantile"])() .range(scheme.domain) .domain(domain); } else if (type === 'ordinal') { colorScale = Object(__WEBPACK_IMPORTED_MODULE_1_d3_scale__["scaleOrdinal"])() .range(scheme.domain) .domain(domain); } else if (type === 'linear') { // linear schemes must have at least 2 colors var colorDomain = scheme.domain.slice(); if (colorDomain.length === 1) { colorDomain.push(colorDomain[0]); this.colorDomain = colorDomain; } var points = Object(__WEBPACK_IMPORTED_MODULE_0_d3_array__["range"])(0, 1, 1.0 / colorDomain.length); colorScale = Object(__WEBPACK_IMPORTED_MODULE_1_d3_scale__["scaleLinear"])() .domain(points) .range(colorDomain); } return colorScale; }; ColorHelper.prototype.getColor = function (value) { if (this.scaleType === 'linear') { var valueScale = Object(__WEBPACK_IMPORTED_MODULE_1_d3_scale__["scaleLinear"])() .domain(this.domain) .range([0, 1]); return (this.scale(valueScale(value))); } else { if (typeof this.customColors === 'function') { return this.customColors(value); } var formattedValue_1 = value.toString(); var found = void 0; // todo type customColors if (this.customColors && this.customColors.length > 0) { found = this.customColors.find(function (mapping) { return mapping.name.toLowerCase() === formattedValue_1.toLowerCase(); }); } if (found) { return found.value; } else { return this.scale(value); } } }; ColorHelper.prototype.getLinearGradientStops = function (value, start) { if (start === undefined) { start = this.domain[0]; } var valueScale = Object(__WEBPACK_IMPORTED_MODULE_1_d3_scale__["scaleLinear"])() .domain(this.domain) .range([0, 1]); var colorValueScale = Object(__WEBPACK_IMPORTED_MODULE_1_d3_scale__["scaleBand"])() .domain(this.colorDomain) .range([0, 1]); var endColor = this.getColor(value); // generate the stops var startVal = valueScale(start); var startColor = this.getColor(start); var endVal = valueScale(value); var i = 1; var currentVal = startVal; var stops = []; stops.push({ color: startColor, offset: startVal, originalOffset: startVal, opacity: 1 }); while (currentVal < endVal && i < this.colorDomain.length) { var color = this.colorDomain[i]; var offset = colorValueScale(color); if (offset <= startVal) { i++; continue; } if (offset.toFixed(4) >= (endVal - colorValueScale.bandwidth()).toFixed(4)) { break; } stops.push({ color: color, offset: offset, opacity: 1 }); currentVal = offset; i++; } if (stops[stops.length - 1].offset < 100) { stops.push({ color: endColor, offset: endVal, opacity: 1 }); } if (endVal === startVal) { stops[0].offset = 0; stops[1].offset = 100; } else { // normalize the offsets into percentages if (stops[stops.length - 1].offset !== 100) { for (var _i = 0, stops_1 = stops; _i < stops_1.length; _i++) { var s = stops_1[_i]; s.offset = ((s.offset - startVal) / (endVal - startVal)) * 100; } } } return stops; }; return ColorHelper; }()); /***/ }), /***/ "./src/common/count/count.directive.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return CountUpDirective; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("@angular/core"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__count_helper__ = __webpack_require__("./src/common/count/count.helper.ts"); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; /** * Count up component * * Loosely inspired by: * - https://github.com/izupet/angular2-counto * - https://inorganik.github.io/countUp.js/ * * @export * @class CountUpDirective */ var CountUpDirective = /** @class */ (function () { function CountUpDirective(cd, element) { this.cd = cd; this.countDuration = 1; this.countPrefix = ''; this.countSuffix = ''; this.countChange = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); this.countFinish = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); this.value = ''; this._countDecimals = 0; this._countTo = 0; this._countFrom = 0; this.nativeElement = element.nativeElement; } Object.defineProperty(CountUpDirective.prototype, "countDecimals", { get: function () { if (this._countDecimals) return this._countDecimals; return Object(__WEBPACK_IMPORTED_MODULE_1__count_helper__["b" /* decimalChecker */])(this.countTo); }, set: function (val) { this._countDecimals = val; }, enumerable: true, configurable: true }); Object.defineProperty(CountUpDirective.prototype, "countTo", { get: function () { return this._countTo; }, set: function (val) { this._countTo = parseFloat(val); this.start(); }, enumerable: true, configurable: true }); Object.defineProperty(CountUpDirective.prototype, "countFrom", { get: function () { return this._countFrom; }, set: function (val) { this._countFrom = parseFloat(val); this.start(); }, enumerable: true, configurable: true }); CountUpDirective.prototype.ngOnDestroy = function () { cancelAnimationFrame(this.animationReq); }; CountUpDirective.prototype.start = function () { var _this = this; cancelAnimationFrame(this.animationReq); var valueFormatting = this.valueFormatting || (function (data) { return "" + _this.countPrefix + data.value.toLocaleString() + _this.countSuffix; }); var callback = function (_a) { var value = _a.value, progress = _a.progress, finished = _a.finished; _this.value = valueFormatting({ value: value }); _this.cd.markForCheck(); if (!finished) _this.countChange.emit({ value: value, progress: progress }); if (finished) _this.countFinish.emit({ value: value, progress: progress }); }; this.animationReq = Object(__WEBPACK_IMPORTED_MODULE_1__count_helper__["a" /* count */])(this.countFrom, this.countTo, this.countDecimals, this.countDuration, callback); }; __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Number) ], CountUpDirective.prototype, "countDuration", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", String) ], CountUpDirective.prototype, "countPrefix", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", String) ], CountUpDirective.prototype, "countSuffix", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], CountUpDirective.prototype, "valueFormatting", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Number), __metadata("design:paramtypes", [Number]) ], CountUpDirective.prototype, "countDecimals", null); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object), __metadata("design:paramtypes", [Object]) ], CountUpDirective.prototype, "countTo", null); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object), __metadata("design:paramtypes", [Object]) ], CountUpDirective.prototype, "countFrom", null); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", Object) ], CountUpDirective.prototype, "countChange", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", Object) ], CountUpDirective.prototype, "countFinish", void 0); CountUpDirective = __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ selector: '[ngx-charts-count-up]', template: "{{value}}" }), __metadata("design:paramtypes", [__WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectorRef"], __WEBPACK_IMPORTED_MODULE_0__angular_core__["ElementRef"]]) ], CountUpDirective); return CountUpDirective; }()); /***/ }), /***/ "./src/common/count/count.helper.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = count; /* harmony export (immutable) */ __webpack_exports__["b"] = decimalChecker; // Robert Penner's easeOutExpo function easeOutExpo(t, b, c, d) { return c * (-Math.pow(2, -10 * t / d) + 1) * 1024 / 1023 + b; } /** * Counts from a number to the end incrementally. * * @export * @param {any} countFrom * @param {any} countTo * @param {any} countDecimals * @param {any} countDuration * @param {any} callback * @returns */ function count(countFrom, countTo, countDecimals, countDuration, callback) { var startVal = Number(countFrom); var endVal = Number(countTo); var countDown = (startVal > endVal); var decimals = Math.max(0, countDecimals); var dec = Math.pow(10, decimals); var duration = Number(countDuration) * 1000; var startTime; function runCount(timestamp) { var frameVal; var progress = timestamp - startTime; if (countDown) { frameVal = startVal - easeOutExpo(progress, 0, startVal - endVal, duration); } else { frameVal = easeOutExpo(progress, startVal, endVal - startVal, duration); } if (countDown) { frameVal = (frameVal < endVal) ? endVal : frameVal; } else { frameVal = (frameVal > endVal) ? endVal : frameVal; } frameVal = Math.round(frameVal * dec) / dec; var tick = progress < duration; callback({ value: frameVal, progress: progress, timestamp: timestamp, finished: !tick }); if (tick) { return requestAnimationFrame(function (val) { return runCount(val); }); } } return requestAnimationFrame(function (timestamp) { startTime = timestamp; return runCount(timestamp); }); } /** * Determine decimals places * * @export * @param {any} countTo * @returns */ function decimalChecker(countTo) { var endVal = Number(countTo); if (endVal % 1 !== 0 && Math.abs(endVal) <= 10) { return 2; } return 0; } /***/ }), /***/ "./src/common/count/index.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__count_directive__ = __webpack_require__("./src/common/count/count.directive.ts"); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "a", function() { return __WEBPACK_IMPORTED_MODULE_0__count_directive__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__count_helper__ = __webpack_require__("./src/common/count/count.helper.ts"); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "b", function() { return __WEBPACK_IMPORTED_MODULE_1__count_helper__["a"]; }); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "c", function() { return __WEBPACK_IMPORTED_MODULE_1__count_helper__["b"]; }); /***/ }), /***/ "./src/common/domain.helper.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = getUniqueXDomainValues; /** * Based on the data, return an array with unique values. * * @export * @returns array * @param results */ function getUniqueXDomainValues(results) { var valueSet = new Set(); for (var _i = 0, results_1 = results; _i < results_1.length; _i++) { var result = results_1[_i]; for (var _a = 0, _b = result.series; _a < _b.length; _a++) { var d = _b[_a]; valueSet.add(d.name); } } return Array.from(valueSet); } /***/ }), /***/ "./src/common/grid-layout.helper.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["b"] = gridSize; /* harmony export (immutable) */ __webpack_exports__["a"] = gridLayout; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_d3_scale__ = __webpack_require__("d3-scale"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_d3_scale___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_d3_scale__); function gridSize(dims, len, minWidth) { var rows = 1; var cols = len; var width = dims.width; if (width > minWidth) { while (width / cols < minWidth) { rows += 1; cols = Math.ceil(len / rows); } } return [cols, rows]; } function gridLayout(dims, data, minWidth, designatedTotal) { var xScale = Object(__WEBPACK_IMPORTED_MODULE_0_d3_scale__["scaleBand"])(); var yScale = Object(__WEBPACK_IMPORTED_MODULE_0_d3_scale__["scaleBand"])(); var width = dims.width; var height = dims.height; var _a = gridSize(dims, data.length, minWidth), columns = _a[0], rows = _a[1]; var xDomain = []; var yDomain = []; for (var i = 0; i < rows; i++) { yDomain.push(i); } for (var i = 0; i < columns; i++) { xDomain.push(i); } xScale.domain(xDomain); yScale.domain(yDomain); xScale.rangeRound([0, width], 0.1); yScale.rangeRound([0, height], 0.1); var res = []; var total = designatedTotal ? designatedTotal : getTotal(data); var cardWidth = xScale.bandwidth(); var cardHeight = yScale.bandwidth(); for (var i = 0; i < data.length; i++) { res[i] = {}; res[i].data = { name: data[i] ? data[i].name : '', value: data[i] ? data[i].value : undefined, extra: data[i] ? data[i].extra : undefined, }; res[i].x = xScale(i % columns); res[i].y = yScale(Math.floor(i / columns)); res[i].width = cardWidth; res[i].height = cardHeight; res[i].data.percent = (total > 0) ? res[i].data.value / total : 0; res[i].data.total = total; } return res; } function getTotal(results) { return results .map(function (d) { return d ? d.value : 0; }) .reduce(function (sum, val) { return sum + val; }, 0); } /***/ }), /***/ "./src/common/grid-panel-series.component.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return GridPanelSeriesComponent; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("@angular/core"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var GridPanelSeriesComponent = /** @class */ (function () { function GridPanelSeriesComponent() { } GridPanelSeriesComponent.prototype.ngOnChanges = function (changes) { this.update(); }; GridPanelSeriesComponent.prototype.update = function () { this.gridPanels = this.getGridPanels(); }; GridPanelSeriesComponent.prototype.getGridPanels = function () { var _this = this; return this.data.map(function (d, i) { var offset; var width; var height; var x; var y; var className = 'odd'; if (_this.orient === 'vertical') { var position = _this.xScale(d.name); var positionIndex = Number.parseInt((position / _this.xScale.step()).toString()); if (positionIndex % 2 === 1) { className = 'even'; } offset = _this.xScale.bandwidth() * _this.xScale.paddingInner(); width = _this.xScale.bandwidth() + offset; height = _this.dims.height; x = _this.xScale(d.name) - offset / 2; y = 0; } else if (_this.orient === 'horizontal') { var position = _this.yScale(d.name); var positionIndex = Number.parseInt((position / _this.yScale.step()).toString()); if (positionIndex % 2 === 1) { className = 'even'; } offset = _this.yScale.bandwidth() * _this.yScale.paddingInner(); width = _this.dims.width; height = _this.yScale.bandwidth() + offset; x = 0; y = _this.yScale(d.name) - offset / 2; } return { name: d.name, class: className, height: height, width: width, x: x, y: y }; }); }; __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], GridPanelSeriesComponent.prototype, "data", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], GridPanelSeriesComponent.prototype, "dims", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], GridPanelSeriesComponent.prototype, "xScale", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], GridPanelSeriesComponent.prototype, "yScale", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], GridPanelSeriesComponent.prototype, "orient", void 0); GridPanelSeriesComponent = __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ selector: 'g[ngx-charts-grid-panel-series]', template: "\n <svg:g ngx-charts-grid-panel *ngFor=\"let gridPanel of gridPanels\"\n [height]=\"gridPanel.height\"\n [width]=\"gridPanel.width\"\n [x]=\"gridPanel.x\"\n [y]=\"gridPanel.y\"\n [class.grid-panel]=\"true\"\n [class.odd]=\"gridPanel.class === 'odd'\"\n [class.even]=\"gridPanel.class === 'even'\">\n </svg:g>\n ", changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectionStrategy"].OnPush }) ], GridPanelSeriesComponent); return GridPanelSeriesComponent; }()); /***/ }), /***/ "./src/common/grid-panel.component.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return GridPanelComponent; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("@angular/core"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var GridPanelComponent = /** @class */ (function () { function GridPanelComponent() { } __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], GridPanelComponent.prototype, "path", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], GridPanelComponent.prototype, "width", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], GridPanelComponent.prototype, "height", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], GridPanelComponent.prototype, "x", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], GridPanelComponent.prototype, "y", void 0); GridPanelComponent = __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ selector: 'g[ngx-charts-grid-panel]', template: "\n <svg:rect\n [attr.height]=\"height\"\n [attr.width]=\"width\"\n [attr.x]=\"x\"\n [attr.y]=\"y\"\n stroke=\"none\"\n class=\"gridpanel\"\n />\n ", changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectionStrategy"].OnPush }) ], GridPanelComponent); return GridPanelComponent; }()); /***/ }), /***/ "./src/common/index.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__chart_common_module__ = __webpack_require__("./src/common/chart-common.module.ts"); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "e", function() { return __WEBPACK_IMPORTED_MODULE_0__chart_common_module__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__legend__ = __webpack_require__("./src/common/legend/index.ts"); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "a", function() { return __WEBPACK_IMPORTED_MODULE_1__legend__["a"]; }); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "m", function() { return __WEBPACK_IMPORTED_MODULE_1__legend__["b"]; }); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "n", function() { return __WEBPACK_IMPORTED_MODULE_1__legend__["c"]; }); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "o", function() { return __WEBPACK_IMPORTED_MODULE_1__legend__["d"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__tooltip__ = __webpack_require__("./src/common/tooltip/index.ts"); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "b", function() { return __WEBPACK_IMPORTED_MODULE_2__tooltip__["a"]; }); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "p", function() { return __WEBPACK_IMPORTED_MODULE_2__tooltip__["b"]; }); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "q", function() { return __WEBPACK_IMPORTED_MODULE_2__tooltip__["c"]; }); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "v", function() { return __WEBPACK_IMPORTED_MODULE_2__tooltip__["d"]; }); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "w", function() { return __WEBPACK_IMPORTED_MODULE_2__tooltip__["e"]; }); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "x", function() { return __WEBPACK_IMPORTED_MODULE_2__tooltip__["f"]; }); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "y", function() { return __WEBPACK_IMPORTED_MODULE_2__tooltip__["g"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__count__ = __webpack_require__("./src/common/count/index.ts"); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "j", function() { return __WEBPACK_IMPORTED_MODULE_3__count__["a"]; }); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "A", function() { return __WEBPACK_IMPORTED_MODULE_3__count__["b"]; }); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "B", function() { return __WEBPACK_IMPORTED_MODULE_3__count__["c"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__timeline__ = __webpack_require__("./src/common/timeline/index.ts"); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "t", function() { return __WEBPACK_IMPORTED_MODULE_4__timeline__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__color_helper__ = __webpack_require__("./src/common/color.helper.ts"); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "i", function() { return __WEBPACK_IMPORTED_MODULE_5__color_helper__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__charts__ = __webpack_require__("./src/common/charts/index.ts"); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "f", function() { return __WEBPACK_IMPORTED_MODULE_6__charts__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__area_component__ = __webpack_require__("./src/common/area.component.ts"); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "c", function() { return __WEBPACK_IMPORTED_MODULE_7__area_component__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__base_chart_component__ = __webpack_require__("./src/common/base-chart.component.ts"); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "d", function() { return __WEBPACK_IMPORTED_MODULE_8__base_chart_component__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__circle_component__ = __webpack_require__("./src/common/circle.component.ts"); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "g", function() { return __WEBPACK_IMPORTED_MODULE_9__circle_component__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__circle_series_component__ = __webpack_require__("./src/common/circle-series.component.ts"); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "h", function() { return __WEBPACK_IMPORTED_MODULE_10__circle_series_component__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__grid_layout_helper__ = __webpack_require__("./src/common/grid-layout.helper.ts"); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "D", function() { return __WEBPACK_IMPORTED_MODULE_11__grid_layout_helper__["a"]; }); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "E", function() { return __WEBPACK_IMPORTED_MODULE_11__grid_layout_helper__["b"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__grid_panel_component__ = __webpack_require__("./src/common/grid-panel.component.ts"); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "k", function() { return __WEBPACK_IMPORTED_MODULE_12__grid_panel_component__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__grid_panel_series_component__ = __webpack_require__("./src/common/grid-panel-series.component.ts"); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "l", function() { return __WEBPACK_IMPORTED_MODULE_13__grid_panel_series_component__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__svg_linear_gradient_component__ = __webpack_require__("./src/common/svg-linear-gradient.component.ts"); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "r", function() { return __WEBPACK_IMPORTED_MODULE_14__svg_linear_gradient_component__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__svg_radial_gradient_component__ = __webpack_require__("./src/common/svg-radial-gradient.component.ts"); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "s", function() { return __WEBPACK_IMPORTED_MODULE_15__svg_radial_gradient_component__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__tooltip_area_component__ = __webpack_require__("./src/common/tooltip-area.component.ts"); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "u", function() { return __WEBPACK_IMPORTED_MODULE_16__tooltip_area_component__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_17__tick_format_helper__ = __webpack_require__("./src/common/tick-format.helper.ts"); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "F", function() { return __WEBPACK_IMPORTED_MODULE_17__tick_format_helper__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_18__trim_label_helper__ = __webpack_require__("./src/common/trim-label.helper.ts"); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "G", function() { return __WEBPACK_IMPORTED_MODULE_18__trim_label_helper__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_19__view_dimensions_helper__ = __webpack_require__("./src/common/view-dimensions.helper.ts"); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "z", function() { return __WEBPACK_IMPORTED_MODULE_19__view_dimensions_helper__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_20__label_helper__ = __webpack_require__("./src/common/label.helper.ts"); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "C", function() { return __WEBPACK_IMPORTED_MODULE_20__label_helper__["a"]; }); /***/ }), /***/ "./src/common/label.helper.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = formatLabel; /** * Formats a label given a date, number or string. * * @export * @param {*} label * @returns {string} */ function formatLabel(label) { if (label instanceof Date) { label = label.toLocaleDateString(); } else { label = label.toLocaleString(); } return label; } /***/ }), /***/ "./src/common/legend/advanced-legend.component.scss": /***/ (function(module, exports, __webpack_require__) { var result = __webpack_require__("./node_modules/css-loader/index.js!./node_modules/postcss-loader/index.js!./node_modules/sass-loader/lib/loader.js??ref--3-4!./src/common/legend/advanced-legend.component.scss"); if (typeof result === "string") { module.exports = result; } else { module.exports = result.toString(); } /***/ }), /***/ "./src/common/legend/advanced-legend.component.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return AdvancedLegendComponent; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("@angular/core"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__trim_label_helper__ = __webpack_require__("./src/common/trim-label.helper.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__label_helper__ = __webpack_require__("./src/common/label.helper.ts"); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var AdvancedLegendComponent = /** @class */ (function () { function AdvancedLegendComponent() { this.label = 'Total'; this.animations = true; this.select = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); this.activate = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); this.deactivate = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); this.legendItems = []; this.valueFormatting = function (value) { return value; }; this.labelFormatting = function (label) { return label; }; this.percentageFormatting = function (percentage) { return percentage; }; } AdvancedLegendComponent.prototype.ngOnChanges = function (changes) { this.update(); }; AdvancedLegendComponent.prototype.getTotal = function () { return this.data .map(function (d) { return d.value; }) .reduce(function (sum, d) { return sum + d; }, 0); }; AdvancedLegendComponent.prototype.update = function () { this.total = this.getTotal(); this.roundedTotal = this.total; this.legendItems = this.getLegendItems(); }; AdvancedLegendComponent.prototype.getLegendItems = function () { var _this = this; return this.data.map(function (d, index) { var label = Object(__WEBPACK_IMPORTED_MODULE_2__label_helper__["a" /* formatLabel */])(d.name); var value = d.value; var color = _this.colors.getColor(label); var percentage = (_this.total > 0) ? value / _this.total * 100 : 0; return { value: _this.valueFormatting(value), color: color, label: Object(__WEBPACK_IMPORTED_MODULE_1__trim_label_helper__["a" /* trimLabel */])(_this.labelFormatting(label), 20), originalLabel: d.name, percentage: _this.percentageFormatting(percentage) }; }); }; AdvancedLegendComponent.prototype.trackBy = function (item) { return item.formattedLabel; }; __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Number) ], AdvancedLegendComponent.prototype, "width", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], AdvancedLegendComponent.prototype, "data", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], AdvancedLegendComponent.prototype, "colors", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", String) ], AdvancedLegendComponent.prototype, "label", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], AdvancedLegendComponent.prototype, "animations", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"]) ], AdvancedLegendComponent.prototype, "select", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"]) ], AdvancedLegendComponent.prototype, "activate", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"]) ], AdvancedLegendComponent.prototype, "deactivate", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Function) ], AdvancedLegendComponent.prototype, "valueFormatting", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Function) ], AdvancedLegendComponent.prototype, "labelFormatting", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Function) ], AdvancedLegendComponent.prototype, "percentageFormatting", void 0); AdvancedLegendComponent = __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ selector: 'ngx-charts-advanced-legend', template: "\n <div class=\"advanced-pie-legend\"\n [style.width.px]=\"width\">\n <div\n *ngIf=\"animations\"\n class=\"total-value\"\n ngx-charts-count-up\n [countTo]=\"roundedTotal\">\n </div>\n <div *ngIf=\"!animations\">\n {{roundedTotal}}\n </div>\n <div class=\"total-label\">\n {{label}}\n </div>\n <div class=\"legend-items-container\">\n <div class=\"legend-items\">\n <div\n *ngFor=\"let legendItem of legendItems; trackBy:trackBy\"\n tabindex=\"-1\"\n class=\"legend-item\"\n (mouseenter)=\"activate.emit(legendItem.label)\"\n (mouseleave)=\"deactivate.emit(legendItem.label)\"\n (click)=\"select.emit({ name: legendItem.label, value: legendItem.value })\">\n <div\n class=\"item-color\"\n [style.background]=\"legendItem.color\">\n </div>\n <div *ngIf=\"animations\"\n class=\"item-value\"\n ngx-charts-count-up\n [countTo]=\"legendItem.value\">\n </div>\n <div *ngIf=\"!animations\" class=\"item-value\">\n {{legendItem.value}}\n </div>\n <div class=\"item-label\">{{legendItem.label}}</div>\n <div *ngIf=\"animations\"\n class=\"item-percent\"\n ngx-charts-count-up\n [countTo]=\"legendItem.percentage\"\n [countSuffix]=\"'%'\">\n </div>\n <div *ngIf=\"!animations\"\n class=\"item-percent\">\n {{legendItem.percentage.toLocaleString()}}%\n </div>\n </div>\n </div>\n </div>\n </div>\n ", styles: [__webpack_require__("./src/common/legend/advanced-legend.component.scss")], encapsulation: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ViewEncapsulation"].None, changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectionStrategy"].OnPush }) ], AdvancedLegendComponent); return AdvancedLegendComponent; }()); /***/ }), /***/ "./src/common/legend/index.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__legend_component__ = __webpack_require__("./src/common/legend/legend.component.ts"); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "b", function() { return __WEBPACK_IMPORTED_MODULE_0__legend_component__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__scale_legend_component__ = __webpack_require__("./src/common/legend/scale-legend.component.ts"); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "d", function() { return __WEBPACK_IMPORTED_MODULE_1__scale_legend_component__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__legend_entry_component__ = __webpack_require__("./src/common/legend/legend-entry.component.ts"); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "c", function() { return __WEBPACK_IMPORTED_MODULE_2__legend_entry_component__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__advanced_legend_component__ = __webpack_require__("./src/common/legend/advanced-legend.component.ts"); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "a", function() { return __WEBPACK_IMPORTED_MODULE_3__advanced_legend_component__["a"]; }); /***/ }), /***/ "./src/common/legend/legend-entry.component.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return LegendEntryComponent; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("@angular/core"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var LegendEntryComponent = /** @class */ (function () { function LegendEntryComponent() { this.isActive = false; this.select = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); this.activate = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); this.deactivate = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); this.toggle = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); } Object.defineProperty(LegendEntryComponent.prototype, "trimmedLabel", { get: function () { return this.formattedLabel || '(empty)'; }, enumerable: true, configurable: true }); LegendEntryComponent.prototype.onMouseEnter = function () { this.activate.emit({ name: this.label }); }; LegendEntryComponent.prototype.onMouseLeave = function () { this.deactivate.emit({ name: this.label }); }; __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", String) ], LegendEntryComponent.prototype, "color", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], LegendEntryComponent.prototype, "label", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", String) ], LegendEntryComponent.prototype, "formattedLabel", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], LegendEntryComponent.prototype, "isActive", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"]) ], LegendEntryComponent.prototype, "select", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"]) ], LegendEntryComponent.prototype, "activate", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"]) ], LegendEntryComponent.prototype, "deactivate", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"]) ], LegendEntryComponent.prototype, "toggle", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["HostListener"])('mouseenter'), __metadata("design:type", Function), __metadata("design:paramtypes", []), __metadata("design:returntype", void 0) ], LegendEntryComponent.prototype, "onMouseEnter", null); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["HostListener"])('mouseleave'), __metadata("design:type", Function), __metadata("design:paramtypes", []), __metadata("design:returntype", void 0) ], LegendEntryComponent.prototype, "onMouseLeave", null); LegendEntryComponent = __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ selector: 'ngx-charts-legend-entry', template: "\n <span \n [title]=\"formattedLabel\"\n tabindex=\"-1\"\n [class.active]=\"isActive\"\n (click)=\"select.emit(formattedLabel)\">\n <span\n class=\"legend-label-color\"\n [style.background-color]=\"color\"\n (click)=\"toggle.emit(formattedLabel)\">\n </span>\n <span class=\"legend-label-text\">\n {{trimmedLabel}}\n </span>\n </span>\n ", changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectionStrategy"].OnPush }) ], LegendEntryComponent); return LegendEntryComponent; }()); /***/ }), /***/ "./src/common/legend/legend.component.scss": /***/ (function(module, exports, __webpack_require__) { var result = __webpack_require__("./node_modules/css-loader/index.js!./node_modules/postcss-loader/index.js!./node_modules/sass-loader/lib/loader.js??ref--3-4!./src/common/legend/legend.component.scss"); if (typeof result === "string") { module.exports = result; } else { module.exports = result.toString(); } /***/ }), /***/ "./src/common/legend/legend.component.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return LegendComponent; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("@angular/core"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__label_helper__ = __webpack_require__("./src/common/label.helper.ts"); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var LegendComponent = /** @class */ (function () { function LegendComponent(cd) { this.cd = cd; this.labelClick = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); this.labelActivate = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); this.labelDeactivate = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); this.legendEntries = []; } LegendComponent.prototype.ngOnChanges = function (changes) { this.update(); }; LegendComponent.prototype.update = function () { this.cd.markForCheck(); this.legendEntries = this.getLegendEntries(); }; LegendComponent.prototype.getLegendEntries = function () { var items = []; var _loop_1 = function (label) { var formattedLabel = Object(__WEBPACK_IMPORTED_MODULE_1__label_helper__["a" /* formatLabel */])(label); var idx = items.findIndex(function (i) { return i.label === formattedLabel; }); if (idx === -1) { items.push({ label: label, formattedLabel: formattedLabel, color: this_1.colors.getColor(label) }); } }; var this_1 = this; for (var _i = 0, _a = this.data; _i < _a.length; _i++) { var label = _a[_i]; _loop_1(label); } return items; }; LegendComponent.prototype.isActive = function (entry) { if (!this.activeEntries) return false; var item = this.activeEntries.find(function (d) { return entry.label === d.name; }); return item !== undefined; }; LegendComponent.prototype.activate = function (item) { this.labelActivate.emit(item); }; LegendComponent.prototype.deactivate = function (item) { this.labelDeactivate.emit(item); }; LegendComponent.prototype.trackBy = function (index, item) { return item.label; }; __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], LegendComponent.prototype, "data", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], LegendComponent.prototype, "title", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], LegendComponent.prototype, "colors", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], LegendComponent.prototype, "height", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], LegendComponent.prototype, "width", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], LegendComponent.prototype, "activeEntries", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"]) ], LegendComponent.prototype, "labelClick", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"]) ], LegendComponent.prototype, "labelActivate", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"]) ], LegendComponent.prototype, "labelDeactivate", void 0); LegendComponent = __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ selector: 'ngx-charts-legend', template: "\n <div [style.width.px]=\"width\">\n <header class=\"legend-title\" *ngIf=\"title?.length > 0\">\n <span class=\"legend-title-text\">{{title}}</span>\n </header>\n <div class=\"legend-wrap\">\n <ul class=\"legend-labels\"\n [style.max-height.px]=\"height - 45\">\n <li\n *ngFor=\"let entry of legendEntries; trackBy: trackBy\"\n class=\"legend-label\">\n <ngx-charts-legend-entry\n [label]=\"entry.label\"\n [formattedLabel]=\"entry.formattedLabel\"\n [color]=\"entry.color\"\n [isActive]=\"isActive(entry)\"\n (select)=\"labelClick.emit($event)\"\n (activate)=\"activate($event)\"\n (deactivate)=\"deactivate($event)\">\n </ngx-charts-legend-entry>\n </li>\n </ul>\n </div>\n </div>\n ", styles: [__webpack_require__("./src/common/legend/legend.component.scss")], encapsulation: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ViewEncapsulation"].None, changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectionStrategy"].OnPush }), __metadata("design:paramtypes", [__WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectorRef"]]) ], LegendComponent); return LegendComponent; }()); /***/ }), /***/ "./src/common/legend/scale-legend.component.scss": /***/ (function(module, exports, __webpack_require__) { var result = __webpack_require__("./node_modules/css-loader/index.js!./node_modules/postcss-loader/index.js!./node_modules/sass-loader/lib/loader.js??ref--3-4!./src/common/legend/scale-legend.component.scss"); if (typeof result === "string") { module.exports = result; } else { module.exports = result.toString(); } /***/ }), /***/ "./src/common/legend/scale-legend.component.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ScaleLegendComponent; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("@angular/core"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_platform_browser__ = __webpack_require__("@angular/platform-browser"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_platform_browser___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1__angular_platform_browser__); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var ScaleLegendComponent = /** @class */ (function () { function ScaleLegendComponent(sanitizer) { this.sanitizer = sanitizer; } ScaleLegendComponent.prototype.ngOnChanges = function (changes) { var gradientValues = this.gradientString(this.colors.range(), this.colors.domain()); this.gradient = this.sanitizer.bypassSecurityTrustStyle("linear-gradient(to bottom, " + gradientValues + ")"); }; /** * Generates the string used in the gradient stylesheet properties * @param {array} colors array of colors * @param {array} splits array of splits on a scale of (0, 1) * @return {string} */ ScaleLegendComponent.prototype.gradientString = function (colors, splits) { // add the 100% splits.push(1); var pairs = []; colors.reverse().forEach(function (c, i) { pairs.push(c + " " + Math.round(splits[i] * 100) + "%"); }); return pairs.join(', '); }; __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], ScaleLegendComponent.prototype, "valueRange", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], ScaleLegendComponent.prototype, "colors", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], ScaleLegendComponent.prototype, "height", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], ScaleLegendComponent.prototype, "width", void 0); ScaleLegendComponent = __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ selector: 'ngx-charts-scale-legend', template: "\n <div\n class=\"scale-legend\"\n [style.height.px]=\"height\"\n [style.width.px]=\"width\">\n <div class=\"scale-legend-label\">\n <span>{{ valueRange[1].toLocaleString() }}</span>\n </div>\n <div\n class=\"scale-legend-wrap\"\n [style.background]=\"gradient\">\n </div>\n <div class=\"scale-legend-label\">\n <span>{{ valueRange[0].toLocaleString() }}</span>\n </div>\n </div>\n ", styles: [__webpack_require__("./src/common/legend/scale-legend.component.scss")], encapsulation: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ViewEncapsulation"].None, changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectionStrategy"].OnPush }), __metadata("design:paramtypes", [__WEBPACK_IMPORTED_MODULE_1__angular_platform_browser__["DomSanitizer"]]) ], ScaleLegendComponent); return ScaleLegendComponent; }()); /***/ }), /***/ "./src/common/shape.helper.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = roundedRect; /** * Generates a rounded rectanglar path * * @export * @param {*} x, y, w, h, r, tl, tr, bl, br * @returns {string} */ function roundedRect(x, y, w, h, r, _a) { var tl = _a[0], tr = _a[1], bl = _a[2], br = _a[3]; var retval = ''; w = Math.floor(w); h = Math.floor(h); w = w === 0 ? 1 : w; h = h === 0 ? 1 : h; retval = "M" + [x + r, y]; retval += "h" + (w - 2 * r); if (tr) { retval += "a" + [r, r] + " 0 0 1 " + [r, r]; } else { retval += "h" + r + "v" + r; } retval += "v" + (h - 2 * r); if (br) { retval += "a" + [r, r] + " 0 0 1 " + [-r, r]; } else { retval += "v" + r + "h" + -r; } retval += "h" + (2 * r - w); if (bl) { retval += "a" + [r, r] + " 0 0 1 " + [-r, -r]; } else { retval += "h" + -r + "v" + -r; } retval += "v" + (2 * r - h); if (tl) { retval += "a" + [r, r] + " 0 0 1 " + [r, -r]; } else { retval += "v" + -r + "h" + r; } retval += "z"; return retval; } /***/ }), /***/ "./src/common/svg-linear-gradient.component.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return SvgLinearGradientComponent; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("@angular/core"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var SvgLinearGradientComponent = /** @class */ (function () { function SvgLinearGradientComponent() { this.orientation = 'vertical'; } SvgLinearGradientComponent.prototype.ngOnChanges = function (changes) { this.x1 = '0%'; this.x2 = '0%'; this.y1 = '0%'; this.y2 = '0%'; if (this.orientation === 'horizontal') { this.x2 = '100%'; } else if (this.orientation === 'vertical') { this.y1 = '100%'; } }; __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], SvgLinearGradientComponent.prototype, "orientation", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], SvgLinearGradientComponent.prototype, "name", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Array) ], SvgLinearGradientComponent.prototype, "stops", void 0); SvgLinearGradientComponent = __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ selector: 'g[ngx-charts-svg-linear-gradient]', template: "\n <svg:linearGradient\n [id]=\"name\"\n [attr.x1]=\"x1\"\n [attr.y1]=\"y1\"\n [attr.x2]=\"x2\"\n [attr.y2]=\"y2\">\n <svg:stop *ngFor=\"let stop of stops\"\n [attr.offset]=\"stop.offset + '%'\"\n [style.stop-color]=\"stop.color\"\n [style.stop-opacity]=\"stop.opacity\"\n />\n </svg:linearGradient>\n ", changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectionStrategy"].OnPush }) ], SvgLinearGradientComponent); return SvgLinearGradientComponent; }()); /***/ }), /***/ "./src/common/svg-radial-gradient.component.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return SvgRadialGradientComponent; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("@angular/core"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var SvgRadialGradientComponent = /** @class */ (function () { function SvgRadialGradientComponent() { this.endOpacity = 1; this.cx = 0; this.cy = 0; } Object.defineProperty(SvgRadialGradientComponent.prototype, "stops", { get: function () { return this.stopsInput || this.stopsDefault; }, set: function (value) { this.stopsInput = value; }, enumerable: true, configurable: true }); SvgRadialGradientComponent.prototype.ngOnChanges = function (changes) { this.r = '30%'; if (('color' in changes) || ('startOpacity' in changes) || ('endOpacity' in changes)) { this.stopsDefault = [{ offset: 0, color: this.color, opacity: this.startOpacity }, { offset: 100, color: this.color, opacity: this.endOpacity }]; } }; __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", String) ], SvgRadialGradientComponent.prototype, "color", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", String) ], SvgRadialGradientComponent.prototype, "name", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Number) ], SvgRadialGradientComponent.prototype, "startOpacity", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], SvgRadialGradientComponent.prototype, "endOpacity", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Number) ], SvgRadialGradientComponent.prototype, "cx", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Number) ], SvgRadialGradientComponent.prototype, "cy", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Array), __metadata("design:paramtypes", [Array]) ], SvgRadialGradientComponent.prototype, "stops", null); SvgRadialGradientComponent = __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ selector: 'g[ngx-charts-svg-radial-gradient]', template: "\n <svg:radialGradient\n [id]=\"name\"\n [attr.cx]=\"cx\"\n [attr.cy]=\"cy\"\n [attr.r]=\"r\"\n gradientUnits=\"userSpaceOnUse\">\n <svg:stop *ngFor=\"let stop of stops\"\n [attr.offset]=\"stop.offset + '%'\"\n [style.stop-color]=\"stop.color\"\n [style.stop-opacity]=\"stop.opacity\"\n />\n </svg:radialGradient>\n ", changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectionStrategy"].OnPush }) ], SvgRadialGradientComponent); return SvgRadialGradientComponent; }()); /***/ }), /***/ "./src/common/tick-format.helper.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = tickFormat; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_d3_time_format__ = __webpack_require__("d3-time-format"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_d3_time_format___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_d3_time_format__); function tickFormat(fieldType, groupByType) { return function (label) { if (label === 'No Value' || label === 'Other') { return label; } if (fieldType === 'date' && groupByType === 'groupBy') { var formatter = Object(__WEBPACK_IMPORTED_MODULE_0_d3_time_format__["timeFormat"])('MM/DD/YYYY'); return formatter(label); } return label.toString(); }; } /***/ }), /***/ "./src/common/timeline/index.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__timeline_component__ = __webpack_require__("./src/common/timeline/timeline.component.ts"); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "a", function() { return __WEBPACK_IMPORTED_MODULE_0__timeline_component__["a"]; }); /***/ }), /***/ "./src/common/timeline/timeline.component.scss": /***/ (function(module, exports, __webpack_require__) { var result = __webpack_require__("./node_modules/css-loader/index.js!./node_modules/postcss-loader/index.js!./node_modules/sass-loader/lib/loader.js??ref--3-4!./src/common/timeline/timeline.component.scss"); if (typeof result === "string") { module.exports = result; } else { module.exports = result.toString(); } /***/ }), /***/ "./src/common/timeline/timeline.component.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Timeline; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("@angular/core"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_d3_brush__ = __webpack_require__("d3-brush"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_d3_brush___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_d3_brush__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_d3_scale__ = __webpack_require__("d3-scale"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_d3_scale___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_d3_scale__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_d3_selection__ = __webpack_require__("d3-selection"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_d3_selection___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_d3_selection__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__utils__ = __webpack_require__("./src/utils/index.ts"); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var Timeline = /** @class */ (function () { function Timeline(element, cd) { this.cd = cd; this.height = 50; this.select = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); this.onDomainChange = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); this.initialized = false; this.element = element.nativeElement; } Timeline.prototype.ngOnChanges = function (changes) { this.update(); if (!this.initialized) { this.addBrush(); this.initialized = true; } }; Timeline.prototype.update = function () { this.dims = this.getDims(); this.height = this.dims.height; var offsetY = this.view[1] - this.height; this.xDomain = this.getXDomain(); this.xScale = this.getXScale(); if (this.brush) { this.updateBrush(); } this.transform = "translate(0 , " + offsetY + ")"; this.filterId = 'filter' + Object(__WEBPACK_IMPORTED_MODULE_4__utils__["b" /* id */])().toString(); this.filter = "url(#" + this.filterId + ")"; this.cd.markForCheck(); }; Timeline.prototype.getXDomain = function () { var values = []; for (var _i = 0, _a = this.results; _i < _a.length; _i++) { var results = _a[_i]; for (var _b = 0, _c = results.series; _b < _c.length; _b++) { var d = _c[_b]; if (!values.includes(d.name)) { values.push(d.name); } } } var domain = []; if (this.scaleType === 'time') { var min = Math.min.apply(Math, values); var max = Math.max.apply(Math, values); domain = [min, max]; } else if (this.scaleType === 'linear') { values = values.map(function (v) { return Number(v); }); var min = Math.min.apply(Math, values); var max = Math.max.apply(Math, values); domain = [min, max]; } else { domain = values; } return domain; }; Timeline.prototype.getXScale = function () { var scale; if (this.scaleType === 'time') { scale = Object(__WEBPACK_IMPORTED_MODULE_2_d3_scale__["scaleTime"])() .range([0, this.dims.width]) .domain(this.xDomain); } else if (this.scaleType === 'linear') { scale = Object(__WEBPACK_IMPORTED_MODULE_2_d3_scale__["scaleLinear"])() .range([0, this.dims.width]) .domain(this.xDomain); } else if (this.scaleType === 'ordinal') { scale = Object(__WEBPACK_IMPORTED_MODULE_2_d3_scale__["scalePoint"])() .range([0, this.dims.width]) .padding(0.1) .domain(this.xDomain); } return scale; }; Timeline.prototype.addBrush = function () { var _this = this; if (this.brush) return; var height = this.height; var width = this.view[0]; this.brush = Object(__WEBPACK_IMPORTED_MODULE_1_d3_brush__["brushX"])() .extent([[0, 0], [width, height]]) .on('brush end', function () { var selection = __WEBPACK_IMPORTED_MODULE_3_d3_selection__["event"].selection || _this.xScale.range(); var newDomain = selection.map(_this.xScale.invert); _this.onDomainChange.emit(newDomain); _this.cd.markForCheck(); }); Object(__WEBPACK_IMPORTED_MODULE_3_d3_selection__["select"])(this.element) .select('.brush') .call(this.brush); }; Timeline.prototype.updateBrush = function () { if (!this.brush) return; var height = this.height; var width = this.view[0]; this.brush.extent([[0, 0], [width, height]]); Object(__WEBPACK_IMPORTED_MODULE_3_d3_selection__["select"])(this.element) .select('.brush') .call(this.brush); // clear hardcoded properties so they can be defined by CSS Object(__WEBPACK_IMPORTED_MODULE_3_d3_selection__["select"])(this.element).select('.selection') .attr('fill', undefined) .attr('stroke', undefined) .attr('fill-opacity', undefined); this.cd.markForCheck(); }; Timeline.prototype.getDims = function () { var width = this.view[0]; var dims = { width: width, height: this.height }; return dims; }; __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], Timeline.prototype, "view", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], Timeline.prototype, "state", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], Timeline.prototype, "results", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], Timeline.prototype, "scheme", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], Timeline.prototype, "customColors", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], Timeline.prototype, "legend", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], Timeline.prototype, "miniChart", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], Timeline.prototype, "autoScale", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], Timeline.prototype, "scaleType", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Number) ], Timeline.prototype, "height", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", Object) ], Timeline.prototype, "select", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", Object) ], Timeline.prototype, "onDomainChange", void 0); Timeline = __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ selector: 'g[ngx-charts-timeline]', template: "\n <svg:g\n class=\"timeline\"\n [attr.transform]=\"transform\">\n <svg:filter [attr.id]=\"filterId\">\n <svg:feColorMatrix in=\"SourceGraphic\"\n type=\"matrix\"\n values=\"0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\" />\n </svg:filter>\n <svg:g class=\"embedded-chart\">\n <ng-content></ng-content>\n </svg:g>\n <svg:rect x=\"0\"\n [attr.width]=\"view[0]\"\n y=\"0\"\n [attr.height]=\"height\"\n class=\"brush-background\"\n />\n <svg:g class=\"brush\"></svg:g>\n </svg:g>\n ", styles: [__webpack_require__("./src/common/timeline/timeline.component.scss")], encapsulation: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ViewEncapsulation"].None, changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectionStrategy"].OnPush }), __metadata("design:paramtypes", [__WEBPACK_IMPORTED_MODULE_0__angular_core__["ElementRef"], __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectorRef"]]) ], Timeline); return Timeline; }()); /***/ }), /***/ "./src/common/tooltip-area.component.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return TooltipArea; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("@angular/core"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_animations__ = __webpack_require__("@angular/animations"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_animations___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1__angular_animations__); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var TooltipArea = /** @class */ (function () { function TooltipArea(renderer) { this.renderer = renderer; this.anchorOpacity = 0; this.anchorPos = -1; this.anchorValues = []; this.showPercentage = false; this.tooltipDisabled = false; this.hover = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); } TooltipArea.prototype.getValues = function (xVal) { var results = []; for (var _i = 0, _a = this.results; _i < _a.length; _i++) { var group = _a[_i]; var item = group.series.find(function (d) { return d.name.toString() === xVal.toString(); }); var groupName = group.name; if (groupName instanceof Date) { groupName = groupName.toLocaleDateString(); } if (item) { var label = item.name; var val = item.value; if (this.showPercentage) { val = (item.d1 - item.d0).toFixed(2) + '%'; } var color = void 0; if (this.colors.scaleType === 'linear') { var v = val; if (item.d1) { v = item.d1; } color = this.colors.getColor(v); } else { color = this.colors.getColor(group.name); } results.push({ value: val, name: label, series: groupName, min: item.min, max: item.max, color: color }); } } return results; }; TooltipArea.prototype.mouseMove = function (event) { var xPos = event.pageX - event.target.getBoundingClientRect().left; var closestIndex = this.findClosestPointIndex(xPos); var closestPoint = this.xSet[closestIndex]; this.anchorPos = this.xScale(closestPoint); this.anchorPos = Math.max(0, this.anchorPos); this.anchorPos = Math.min(this.dims.width, this.anchorPos); this.anchorValues = this.getValues(closestPoint); if (this.anchorPos !== this.lastAnchorPos) { var ev = new MouseEvent('mouseleave', { bubbles: false }); this.renderer.invokeElementMethod(this.tooltipAnchor.nativeElement, 'dispatchEvent', [ev]); this.anchorOpacity = 0.7; this.hover.emit({ value: closestPoint }); this.showTooltip(); this.lastAnchorPos = this.anchorPos; } }; TooltipArea.prototype.findClosestPointIndex = function (xPos) { var minIndex = 0; var maxIndex = this.xSet.length - 1; var minDiff = Number.MAX_VALUE; var closestIndex = 0; while (minIndex <= maxIndex) { var currentIndex = (minIndex + maxIndex) / 2 | 0; var currentElement = this.xScale(this.xSet[currentIndex]); var curDiff = Math.abs(currentElement - xPos); if (curDiff < minDiff) { minDiff = curDiff; closestIndex = currentIndex; } if (currentElement < xPos) { minIndex = currentIndex + 1; } else if (currentElement > xPos) { maxIndex = currentIndex - 1; } else { minDiff = 0; closestIndex = currentIndex; break; } } return closestIndex; }; TooltipArea.prototype.showTooltip = function () { var event = new MouseEvent('mouseenter', { bubbles: false }); this.renderer.invokeElementMethod(this.tooltipAnchor.nativeElement, 'dispatchEvent', [event]); }; TooltipArea.prototype.hideTooltip = function () { var event = new MouseEvent('mouseleave', { bubbles: false }); this.renderer.invokeElementMethod(this.tooltipAnchor.nativeElement, 'dispatchEvent', [event]); this.anchorOpacity = 0; this.lastAnchorPos = -1; }; TooltipArea.prototype.getToolTipText = function (tooltipItem) { var result = ''; if (tooltipItem.series !== undefined) { result += tooltipItem.series; } else { result += '???'; } result += ': '; if (tooltipItem.value !== undefined) { result += tooltipItem.value.toLocaleString(); } if (tooltipItem.min !== undefined || tooltipItem.max !== undefined) { result += ' ('; if (tooltipItem.min !== undefined) { if (tooltipItem.max === undefined) { result += '≥'; } result += tooltipItem.min.toLocaleString(); if (tooltipItem.max !== undefined) { result += ' - '; } } else if (tooltipItem.max !== undefined) { result += '≤'; } if (tooltipItem.max !== undefined) { result += tooltipItem.max.toLocaleString(); } result += ')'; } return result; }; __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], TooltipArea.prototype, "dims", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], TooltipArea.prototype, "xSet", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], TooltipArea.prototype, "xScale", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], TooltipArea.prototype, "yScale", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], TooltipArea.prototype, "results", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], TooltipArea.prototype, "colors", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], TooltipArea.prototype, "showPercentage", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], TooltipArea.prototype, "tooltipDisabled", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["TemplateRef"]) ], TooltipArea.prototype, "tooltipTemplate", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", Object) ], TooltipArea.prototype, "hover", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["ViewChild"])('tooltipAnchor'), __metadata("design:type", Object) ], TooltipArea.prototype, "tooltipAnchor", void 0); TooltipArea = __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ selector: 'g[ngx-charts-tooltip-area]', template: "\n <svg:g>\n <svg:rect\n class=\"tooltip-area\"\n [attr.x]=\"0\"\n y=\"0\"\n [attr.width]=\"dims.width\"\n [attr.height]=\"dims.height\"\n style=\"opacity: 0; cursor: 'auto';\"\n (mousemove)=\"mouseMove($event)\"\n (mouseleave)=\"hideTooltip()\"\n />\n <xhtml:ng-template #defaultTooltipTemplate let-model=\"model\">\n <xhtml:div class=\"area-tooltip-container\">\n <xhtml:div\n *ngFor=\"let tooltipItem of model\"\n class=\"tooltip-item\">\n <span\n class=\"tooltip-item-color\"\n [style.background-color]=\"tooltipItem.color\">\n </span>\n {{getToolTipText(tooltipItem)}}\n </xhtml:div>\n </xhtml:div>\n </xhtml:ng-template>\n <svg:rect\n #tooltipAnchor\n [@animationState]=\"anchorOpacity !== 0 ? 'active' : 'inactive'\"\n class=\"tooltip-anchor\"\n [attr.x]=\"anchorPos\"\n y=\"0\"\n [attr.width]=\"1\"\n [attr.height]=\"dims.height\"\n [style.opacity]=\"anchorOpacity\"\n [style.pointer-events]=\"'none'\"\n ngx-tooltip\n [tooltipDisabled]=\"tooltipDisabled\"\n [tooltipPlacement]=\"'right'\"\n [tooltipType]=\"'tooltip'\"\n [tooltipSpacing]=\"15\"\n [tooltipTemplate]=\"tooltipTemplate ? tooltipTemplate: defaultTooltipTemplate\"\n [tooltipContext]=\"anchorValues\"\n [tooltipImmediateExit]=\"true\"\n />\n </svg:g>\n ", changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectionStrategy"].OnPush, animations: [ Object(__WEBPACK_IMPORTED_MODULE_1__angular_animations__["trigger"])('animationState', [ Object(__WEBPACK_IMPORTED_MODULE_1__angular_animations__["transition"])('inactive => active', [ Object(__WEBPACK_IMPORTED_MODULE_1__angular_animations__["style"])({ opacity: 0, }), Object(__WEBPACK_IMPORTED_MODULE_1__angular_animations__["animate"])(250, Object(__WEBPACK_IMPORTED_MODULE_1__angular_animations__["style"])({ opacity: 0.7 })) ]), Object(__WEBPACK_IMPORTED_MODULE_1__angular_animations__["transition"])('active => inactive', [ Object(__WEBPACK_IMPORTED_MODULE_1__angular_animations__["style"])({ opacity: 0.7, }), Object(__WEBPACK_IMPORTED_MODULE_1__angular_animations__["animate"])(250, Object(__WEBPACK_IMPORTED_MODULE_1__angular_animations__["style"])({ opacity: 0 })) ]) ]) ] }), __metadata("design:paramtypes", [__WEBPACK_IMPORTED_MODULE_0__angular_core__["Renderer"]]) ], TooltipArea); return TooltipArea; }()); /***/ }), /***/ "./src/common/tooltip/alignment.type.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return AlignmentTypes; }); var AlignmentTypes; (function (AlignmentTypes) { AlignmentTypes[AlignmentTypes["left"] = 'left'] = "left"; AlignmentTypes[AlignmentTypes["center"] = 'center'] = "center"; AlignmentTypes[AlignmentTypes["right"] = 'right'] = "right"; })(AlignmentTypes || (AlignmentTypes = {})); /***/ }), /***/ "./src/common/tooltip/index.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tooltip_module__ = __webpack_require__("./src/common/tooltip/tooltip.module.ts"); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "f", function() { return __WEBPACK_IMPORTED_MODULE_0__tooltip_module__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__tooltip_service__ = __webpack_require__("./src/common/tooltip/tooltip.service.ts"); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "g", function() { return __WEBPACK_IMPORTED_MODULE_1__tooltip_service__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__tooltip_component__ = __webpack_require__("./src/common/tooltip/tooltip.component.ts"); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "d", function() { return __WEBPACK_IMPORTED_MODULE_2__tooltip_component__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__tooltip_directive__ = __webpack_require__("./src/common/tooltip/tooltip.directive.ts"); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "e", function() { return __WEBPACK_IMPORTED_MODULE_3__tooltip_directive__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__style_type__ = __webpack_require__("./src/common/tooltip/style.type.ts"); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "c", function() { return __WEBPACK_IMPORTED_MODULE_4__style_type__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__alignment_type__ = __webpack_require__("./src/common/tooltip/alignment.type.ts"); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "a", function() { return __WEBPACK_IMPORTED_MODULE_5__alignment_type__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__show_type__ = __webpack_require__("./src/common/tooltip/show.type.ts"); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "b", function() { return __WEBPACK_IMPORTED_MODULE_6__show_type__["a"]; }); /***/ }), /***/ "./src/common/tooltip/injection-registery.service.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return InjectionRegistery; }); var InjectionRegistery = /** @class */ (function () { function InjectionRegistery(injectionService) { this.injectionService = injectionService; this.defaults = {}; this.components = new Map(); } InjectionRegistery.prototype.getByType = function (type) { if (type === void 0) { type = this.type; } return this.components.get(type); }; InjectionRegistery.prototype.create = function (bindings) { return this.createByType(this.type, bindings); }; InjectionRegistery.prototype.createByType = function (type, bindings) { bindings = this.assignDefaults(bindings); var component = this.injectComponent(type, bindings); this.register(type, component); return component; }; InjectionRegistery.prototype.destroy = function (instance) { var compsByType = this.components.get(instance.componentType); if (compsByType) { var idx = compsByType.indexOf(instance); if (idx > -1) { var component = compsByType[idx]; component.destroy(); compsByType.splice(idx, 1); } } }; InjectionRegistery.prototype.destroyAll = function () { this.destroyByType(this.type); }; InjectionRegistery.prototype.destroyByType = function (type) { var comps = this.components.get(type); if (comps) { for (var _i = 0, comps_1 = comps; _i < comps_1.length; _i++) { var comp = comps_1[_i]; this.destroy(comp); } } }; InjectionRegistery.prototype.assignDefaults = function (bindings) { var _a = this.defaults, inputs = _a.inputs, outputs = _a.outputs; if (!bindings.inputs && !bindings.outputs) { bindings = { inputs: bindings }; } if (inputs) { bindings.inputs = Object.assign(inputs, bindings.inputs); } if (outputs) { bindings.outputs = Object.assign(outputs, bindings.outputs); } return bindings; }; InjectionRegistery.prototype.injectComponent = function (type, bindings) { return this.injectionService.appendComponent(type, bindings); }; InjectionRegistery.prototype.register = function (type, component) { if (!this.components.has(type)) { this.components.set(type, []); } var types = this.components.get(type); types.push(component); }; return InjectionRegistery; }()); /***/ }), /***/ "./src/common/tooltip/injection.service.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return InjectionService; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("@angular/core"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; /** * Injection service is a helper to append components * dynamically to a known location in the DOM, most * noteably for dialogs/tooltips appending to body. * * @export * @class InjectionService */ var InjectionService = /** @class */ (function () { function InjectionService(applicationRef, componentFactoryResolver, injector) { this.applicationRef = applicationRef; this.componentFactoryResolver = componentFactoryResolver; this.injector = injector; } /** * Gets the root view container to inject the component to. * * @returns {ComponentRef<any>} * * @memberOf InjectionService */ InjectionService.prototype.getRootViewContainer = function () { var rootComponents = this.applicationRef.components; // fix cannot read length of undefined if (rootComponents) { if (rootComponents.length) return rootComponents[0]; } if (this._container) return this._container; throw new Error('View Container not found! ngUpgrade needs to manually set this via setRootViewContainer.'); }; /** * Overrides the default root view container. This is useful for * things like ngUpgrade that doesn't have a ApplicationRef root. * * @param {any} container * * @memberOf InjectionService */ InjectionService.prototype.setRootViewContainer = function (container) { this._container = container; }; /** * Gets the html element for a component ref. * * @param {ComponentRef<any>} componentRef * @returns {HTMLElement} * * @memberOf InjectionService */ InjectionService.prototype.getComponentRootNode = function (componentRef) { // the top most component root node has no `hostView` if (!componentRef.hostView) return componentRef.element.nativeElement; return componentRef.hostView.rootNodes[0]; }; /** * Gets the root component container html element. * * @returns {HTMLElement} * * @memberOf InjectionService */ InjectionService.prototype.getRootViewContainerNode = function () { return this.getComponentRootNode(this.getRootViewContainer()); }; /** * Projects the bindings onto the component * * @param {ComponentRef<any>} component * @param {*} options * @returns {ComponentRef<any>} * * @memberOf InjectionService */ InjectionService.prototype.projectComponentBindings = function (component, bindings) { if (bindings) { if (bindings.inputs !== undefined) { var bindingKeys = Object.getOwnPropertyNames(bindings.inputs); for (var _i = 0, bindingKeys_1 = bindingKeys; _i < bindingKeys_1.length; _i++) { var bindingName = bindingKeys_1[_i]; component.instance[bindingName] = bindings.inputs[bindingName]; } } if (bindings.outputs !== undefined) { var eventKeys = Object.getOwnPropertyNames(bindings.outputs); for (var _a = 0, eventKeys_1 = eventKeys; _a < eventKeys_1.length; _a++) { var eventName = eventKeys_1[_a]; component.instance[eventName] = bindings.outputs[eventName]; } } } return component; }; /** * Appends a component to a adjacent location * * @template T * @param {Type<T>} componentClass * @param {*} [options={}] * @param {Element} [location=this.getRootViewContainerNode()] * @returns {ComponentRef<any>} * * @memberOf InjectionService */ InjectionService.prototype.appendComponent = function (componentClass, bindings, location) { if (bindings === void 0) { bindings = {}; } if (location === void 0) { location = this.getRootViewContainerNode(); } var componentFactory = this.componentFactoryResolver.resolveComponentFactory(componentClass); var componentRef = componentFactory.create(this.injector); var appRef = this.applicationRef; var componentRootNode = this.getComponentRootNode(componentRef); // project the options passed to the component instance this.projectComponentBindings(componentRef, bindings); appRef.attachView(componentRef.hostView); componentRef.onDestroy(function () { appRef.detachView(componentRef.hostView); }); // use the renderer to append the element for univseral support var renderer = componentRef.instance.renderer; renderer.projectNodes(location, [componentRootNode]); return componentRef; }; InjectionService = __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Injectable"])(), __metadata("design:paramtypes", [__WEBPACK_IMPORTED_MODULE_0__angular_core__["ApplicationRef"], __WEBPACK_IMPORTED_MODULE_0__angular_core__["ComponentFactoryResolver"], __WEBPACK_IMPORTED_MODULE_0__angular_core__["Injector"]]) ], InjectionService); return InjectionService; }()); /***/ }), /***/ "./src/common/tooltip/position/index.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__placement_type__ = __webpack_require__("./src/common/tooltip/position/placement.type.ts"); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "a", function() { return __WEBPACK_IMPORTED_MODULE_0__placement_type__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__position__ = __webpack_require__("./src/common/tooltip/position/position.ts"); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "b", function() { return __WEBPACK_IMPORTED_MODULE_1__position__["a"]; }); /***/ }), /***/ "./src/common/tooltip/position/placement.type.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return PlacementTypes; }); var PlacementTypes; (function (PlacementTypes) { PlacementTypes[PlacementTypes["top"] = 'top'] = "top"; PlacementTypes[PlacementTypes["bottom"] = 'bottom'] = "bottom"; PlacementTypes[PlacementTypes["left"] = 'left'] = "left"; PlacementTypes[PlacementTypes["right"] = 'right'] = "right"; })(PlacementTypes || (PlacementTypes = {})); /***/ }), /***/ "./src/common/tooltip/position/position.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return PositionHelper; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__placement_type__ = __webpack_require__("./src/common/tooltip/position/placement.type.ts"); var caretOffset = 7; function verticalPosition(elDimensions, popoverDimensions, alignment) { if (alignment === 'top') { return elDimensions.top - caretOffset; } if (alignment === 'bottom') { return elDimensions.top + elDimensions.height - popoverDimensions.height + caretOffset; } if (alignment === 'center') { return elDimensions.top + elDimensions.height / 2 - popoverDimensions.height / 2; } return undefined; } function horizontalPosition(elDimensions, popoverDimensions, alignment) { if (alignment === 'left') { return elDimensions.left - caretOffset; } if (alignment === 'right') { return elDimensions.left + elDimensions.width - popoverDimensions.width + caretOffset; } if (alignment === 'center') { return elDimensions.left + elDimensions.width / 2 - popoverDimensions.width / 2; } return undefined; } /** * Position helper for the popover directive. * * @export * @class PositionHelper */ var PositionHelper = /** @class */ (function () { function PositionHelper() { } /** * Calculate vertical alignment position * * @static * @param {any} elDimensions * @param {any} popoverDimensions * @param {any} alignment * @returns {number} * * @memberOf PositionHelper */ PositionHelper.calculateVerticalAlignment = function (elDimensions, popoverDimensions, alignment) { var result = verticalPosition(elDimensions, popoverDimensions, alignment); if (result + popoverDimensions.height > window.innerHeight) { result = window.innerHeight - popoverDimensions.height; } return result; }; /** * Calculate vertical caret position * * @static * @param {any} elDimensions * @param {any} popoverDimensions * @param {any} caretDimensions * @param {any} alignment * @returns {number} * * @memberOf PositionHelper */ PositionHelper.calculateVerticalCaret = function (elDimensions, popoverDimensions, caretDimensions, alignment) { var result; if (alignment === 'top') { result = elDimensions.height / 2 - caretDimensions.height / 2 + caretOffset; } if (alignment === 'bottom') { result = popoverDimensions.height - elDimensions.height / 2 - caretDimensions.height / 2 - caretOffset; } if (alignment === 'center') { result = popoverDimensions.height / 2 - caretDimensions.height / 2; } var popoverPosition = verticalPosition(elDimensions, popoverDimensions, alignment); if (popoverPosition + popoverDimensions.height > window.innerHeight) { result += (popoverPosition + popoverDimensions.height - window.innerHeight); } return result; }; /** * Calculate horz alignment position * * @static * @param {any} elDimensions * @param {any} popoverDimensions * @param {any} alignment * @returns {number} * * @memberOf PositionHelper */ PositionHelper.calculateHorizontalAlignment = function (elDimensions, popoverDimensions, alignment) { var result = horizontalPosition(elDimensions, popoverDimensions, alignment); if (result + popoverDimensions.width > window.innerWidth) { result = window.innerWidth - popoverDimensions.width; } return result; }; /** * Calculate horz caret position * * @static * @param {any} elDimensions * @param {any} popoverDimensions * @param {any} caretDimensions * @param {any} alignment * @returns {number} * * @memberOf PositionHelper */ PositionHelper.calculateHorizontalCaret = function (elDimensions, popoverDimensions, caretDimensions, alignment) { var result; if (alignment === 'left') { result = elDimensions.width / 2 - caretDimensions.width / 2 + caretOffset; } if (alignment === 'right') { result = popoverDimensions.width - elDimensions.width / 2 - caretDimensions.width / 2 - caretOffset; } if (alignment === 'center') { result = popoverDimensions.width / 2 - caretDimensions.width / 2; } var popoverPosition = horizontalPosition(elDimensions, popoverDimensions, alignment); if (popoverPosition + popoverDimensions.width > window.innerWidth) { result += (popoverPosition + popoverDimensions.width - window.innerWidth); } return result; }; /** * Checks if the element's position should be flipped * * @static * @param {any} elDimensions * @param {any} popoverDimensions * @param {any} placement * @param {any} alignment * @param {any} spacing * @returns {boolean} * * @memberOf PositionHelper */ PositionHelper.shouldFlip = function (elDimensions, popoverDimensions, placement, alignment, spacing) { var flip = false; if (placement === 'right') { var popoverPosition = horizontalPosition(elDimensions, popoverDimensions, alignment); if (popoverPosition + popoverDimensions.width + spacing > window.innerWidth) { flip = true; } } if (placement === 'left') { var popoverPosition = horizontalPosition(elDimensions, popoverDimensions, alignment); if (popoverPosition - spacing < 0) { flip = true; } } if (placement === 'top') { if (elDimensions.top - popoverDimensions.height - spacing < 0) { flip = true; } } if (placement === 'bottom') { var popoverPosition = verticalPosition(elDimensions, popoverDimensions, alignment); if (popoverPosition + popoverDimensions.height + spacing > window.innerHeight) { flip = true; } } return flip; }; /** * Position caret * * @static * @param {any} placement * @param {any} elmDim * @param {any} hostDim * @param {any} caretDimensions * @param {any} alignment * @returns {*} * * @memberOf PositionHelper */ PositionHelper.positionCaret = function (placement, elmDim, hostDim, caretDimensions, alignment) { var top = 0; var left = 0; if (placement === __WEBPACK_IMPORTED_MODULE_0__placement_type__["a" /* PlacementTypes */].right) { left = -7; top = PositionHelper.calculateVerticalCaret(hostDim, elmDim, caretDimensions, alignment); } else if (placement === __WEBPACK_IMPORTED_MODULE_0__placement_type__["a" /* PlacementTypes */].left) { left = elmDim.width; top = PositionHelper.calculateVerticalCaret(hostDim, elmDim, caretDimensions, alignment); } else if (placement === __WEBPACK_IMPORTED_MODULE_0__placement_type__["a" /* PlacementTypes */].top) { top = elmDim.height; left = PositionHelper.calculateHorizontalCaret(hostDim, elmDim, caretDimensions, alignment); } else if (placement === __WEBPACK_IMPORTED_MODULE_0__placement_type__["a" /* PlacementTypes */].bottom) { top = -7; left = PositionHelper.calculateHorizontalCaret(hostDim, elmDim, caretDimensions, alignment); } return { top: top, left: left }; }; /** * Position content * * @static * @param {any} placement * @param {any} elmDim * @param {any} hostDim * @param {any} spacing * @param {any} alignment * @returns {*} * * @memberOf PositionHelper */ PositionHelper.positionContent = function (placement, elmDim, hostDim, spacing, alignment) { var top = 0; var left = 0; if (placement === __WEBPACK_IMPORTED_MODULE_0__placement_type__["a" /* PlacementTypes */].right) { left = hostDim.left + hostDim.width + spacing; top = PositionHelper.calculateVerticalAlignment(hostDim, elmDim, alignment); } else if (placement === __WEBPACK_IMPORTED_MODULE_0__placement_type__["a" /* PlacementTypes */].left) { left = hostDim.left - elmDim.width - spacing; top = PositionHelper.calculateVerticalAlignment(hostDim, elmDim, alignment); } else if (placement === __WEBPACK_IMPORTED_MODULE_0__placement_type__["a" /* PlacementTypes */].top) { top = hostDim.top - elmDim.height - spacing; left = PositionHelper.calculateHorizontalAlignment(hostDim, elmDim, alignment); } else if (placement === __WEBPACK_IMPORTED_MODULE_0__placement_type__["a" /* PlacementTypes */].bottom) { top = hostDim.top + hostDim.height + spacing; left = PositionHelper.calculateHorizontalAlignment(hostDim, elmDim, alignment); } return { top: top, left: left }; }; /** * Determine placement based on flip * * @static * @param {any} placement * @param {any} elmDim * @param {any} hostDim * @param {any} spacing * @param {any} alignment * @returns {*} * * @memberOf PositionHelper */ PositionHelper.determinePlacement = function (placement, elmDim, hostDim, spacing, alignment) { var shouldFlip = PositionHelper.shouldFlip(hostDim, elmDim, placement, alignment, spacing); if (shouldFlip) { if (placement === __WEBPACK_IMPORTED_MODULE_0__placement_type__["a" /* PlacementTypes */].right) { return __WEBPACK_IMPORTED_MODULE_0__placement_type__["a" /* PlacementTypes */].left; } else if (placement === __WEBPACK_IMPORTED_MODULE_0__placement_type__["a" /* PlacementTypes */].left) { return __WEBPACK_IMPORTED_MODULE_0__placement_type__["a" /* PlacementTypes */].right; } else if (placement === __WEBPACK_IMPORTED_MODULE_0__placement_type__["a" /* PlacementTypes */].top) { return __WEBPACK_IMPORTED_MODULE_0__placement_type__["a" /* PlacementTypes */].bottom; } else if (placement === __WEBPACK_IMPORTED_MODULE_0__placement_type__["a" /* PlacementTypes */].bottom) { return __WEBPACK_IMPORTED_MODULE_0__placement_type__["a" /* PlacementTypes */].top; } } return placement; }; return PositionHelper; }()); /***/ }), /***/ "./src/common/tooltip/show.type.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ShowTypes; }); var ShowTypes; (function (ShowTypes) { ShowTypes[ShowTypes["all"] = 'all'] = "all"; ShowTypes[ShowTypes["focus"] = 'focus'] = "focus"; ShowTypes[ShowTypes["mouseover"] = 'mouseover'] = "mouseover"; })(ShowTypes || (ShowTypes = {})); /***/ }), /***/ "./src/common/tooltip/style.type.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return StyleTypes; }); var StyleTypes; (function (StyleTypes) { StyleTypes[StyleTypes["popover"] = 'popover'] = "popover"; StyleTypes[StyleTypes["tooltip"] = 'tooltip'] = "tooltip"; })(StyleTypes || (StyleTypes = {})); /***/ }), /***/ "./src/common/tooltip/tooltip.component.scss": /***/ (function(module, exports, __webpack_require__) { var result = __webpack_require__("./node_modules/css-loader/index.js!./node_modules/postcss-loader/index.js!./node_modules/sass-loader/lib/loader.js??ref--3-4!./src/common/tooltip/tooltip.component.scss"); if (typeof result === "string") { module.exports = result; } else { module.exports = result.toString(); } /***/ }), /***/ "./src/common/tooltip/tooltip.component.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return TooltipContentComponent; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("@angular/core"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__utils_throttle__ = __webpack_require__("./src/utils/throttle.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__position__ = __webpack_require__("./src/common/tooltip/position/index.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__style_type__ = __webpack_require__("./src/common/tooltip/style.type.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__alignment_type__ = __webpack_require__("./src/common/tooltip/alignment.type.ts"); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var TooltipContentComponent = /** @class */ (function () { function TooltipContentComponent(element, renderer) { this.element = element; this.renderer = renderer; } Object.defineProperty(TooltipContentComponent.prototype, "cssClasses", { get: function () { var clz = 'ngx-charts-tooltip-content'; clz += " position-" + this.placement; clz += " type-" + this.type; clz += " " + this.cssClass; return clz; }, enumerable: true, configurable: true }); TooltipContentComponent.prototype.ngAfterViewInit = function () { setTimeout(this.position.bind(this)); }; TooltipContentComponent.prototype.position = function () { var _this = this; var nativeElm = this.element.nativeElement; var hostDim = this.host.nativeElement.getBoundingClientRect(); // if no dims were found, never show if (!hostDim.height && !hostDim.width) return; var elmDim = nativeElm.getBoundingClientRect(); this.checkFlip(hostDim, elmDim); this.positionContent(nativeElm, hostDim, elmDim); if (this.showCaret) { this.positionCaret(hostDim, elmDim); } // animate its entry setTimeout(function () { return _this.renderer.setElementClass(nativeElm, 'animate', true); }, 1); }; TooltipContentComponent.prototype.positionContent = function (nativeElm, hostDim, elmDim) { var _a = __WEBPACK_IMPORTED_MODULE_2__position__["b" /* PositionHelper */].positionContent(this.placement, elmDim, hostDim, this.spacing, this.alignment), top = _a.top, left = _a.left; this.renderer.setElementStyle(nativeElm, 'top', top + "px"); this.renderer.setElementStyle(nativeElm, 'left', left + "px"); }; TooltipContentComponent.prototype.positionCaret = function (hostDim, elmDim) { var caretElm = this.caretElm.nativeElement; var caretDimensions = caretElm.getBoundingClientRect(); var _a = __WEBPACK_IMPORTED_MODULE_2__position__["b" /* PositionHelper */].positionCaret(this.placement, elmDim, hostDim, caretDimensions, this.alignment), top = _a.top, left = _a.left; this.renderer.setElementStyle(caretElm, 'top', top + "px"); this.renderer.setElementStyle(caretElm, 'left', left + "px"); }; TooltipContentComponent.prototype.checkFlip = function (hostDim, elmDim) { this.placement = __WEBPACK_IMPORTED_MODULE_2__position__["b" /* PositionHelper */].determinePlacement(this.placement, elmDim, hostDim, this.spacing, this.alignment); }; TooltipContentComponent.prototype.onWindowResize = function () { this.position(); }; __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], TooltipContentComponent.prototype, "host", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], TooltipContentComponent.prototype, "showCaret", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Number) ], TooltipContentComponent.prototype, "type", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Number) ], TooltipContentComponent.prototype, "placement", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Number) ], TooltipContentComponent.prototype, "alignment", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Number) ], TooltipContentComponent.prototype, "spacing", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", String) ], TooltipContentComponent.prototype, "cssClass", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", String) ], TooltipContentComponent.prototype, "title", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], TooltipContentComponent.prototype, "template", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], TooltipContentComponent.prototype, "context", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["ViewChild"])('caretElm'), __metadata("design:type", Object) ], TooltipContentComponent.prototype, "caretElm", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["HostBinding"])('class'), __metadata("design:type", String), __metadata("design:paramtypes", []) ], TooltipContentComponent.prototype, "cssClasses", null); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["HostListener"])('window:resize'), Object(__WEBPACK_IMPORTED_MODULE_1__utils_throttle__["a" /* throttleable */])(100), __metadata("design:type", Function), __metadata("design:paramtypes", []), __metadata("design:returntype", void 0) ], TooltipContentComponent.prototype, "onWindowResize", null); TooltipContentComponent = __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ selector: 'ngx-tooltip-content', template: "\n <div>\n <span\n #caretElm\n [hidden]=\"!showCaret\"\n class=\"tooltip-caret position-{{this.placement}}\">\n </span>\n <div class=\"tooltip-content\">\n <span *ngIf=\"!title\">\n <ng-template\n [ngTemplateOutlet]=\"template\"\n [ngTemplateOutletContext]=\"{ model: context }\">\n </ng-template>\n </span>\n <span\n *ngIf=\"title\"\n [innerHTML]=\"title\">\n </span>\n </div>\n </div>\n ", encapsulation: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ViewEncapsulation"].None, styles: [__webpack_require__("./src/common/tooltip/tooltip.component.scss")] }), __metadata("design:paramtypes", [__WEBPACK_IMPORTED_MODULE_0__angular_core__["ElementRef"], __WEBPACK_IMPORTED_MODULE_0__angular_core__["Renderer"]]) ], TooltipContentComponent); return TooltipContentComponent; }()); /***/ }), /***/ "./src/common/tooltip/tooltip.directive.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return TooltipDirective; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("@angular/core"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__position__ = __webpack_require__("./src/common/tooltip/position/index.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__style_type__ = __webpack_require__("./src/common/tooltip/style.type.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__alignment_type__ = __webpack_require__("./src/common/tooltip/alignment.type.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__show_type__ = __webpack_require__("./src/common/tooltip/show.type.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__tooltip_service__ = __webpack_require__("./src/common/tooltip/tooltip.service.ts"); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var TooltipDirective = /** @class */ (function () { function TooltipDirective(tooltipService, viewContainerRef, renderer) { this.tooltipService = tooltipService; this.viewContainerRef = viewContainerRef; this.renderer = renderer; this.tooltipCssClass = ''; this.tooltipTitle = ''; this.tooltipAppendToBody = true; this.tooltipSpacing = 10; this.tooltipDisabled = false; this.tooltipShowCaret = true; this.tooltipPlacement = __WEBPACK_IMPORTED_MODULE_1__position__["a" /* PlacementTypes */].top; this.tooltipAlignment = __WEBPACK_IMPORTED_MODULE_3__alignment_type__["a" /* AlignmentTypes */].center; this.tooltipType = __WEBPACK_IMPORTED_MODULE_2__style_type__["a" /* StyleTypes */].popover; this.tooltipCloseOnClickOutside = true; this.tooltipCloseOnMouseLeave = true; this.tooltipHideTimeout = 300; this.tooltipShowTimeout = 100; this.tooltipShowEvent = __WEBPACK_IMPORTED_MODULE_4__show_type__["a" /* ShowTypes */].all; this.tooltipImmediateExit = false; this.show = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); this.hide = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); } Object.defineProperty(TooltipDirective.prototype, "listensForFocus", { get: function () { return this.tooltipShowEvent === __WEBPACK_IMPORTED_MODULE_4__show_type__["a" /* ShowTypes */].all || this.tooltipShowEvent === __WEBPACK_IMPORTED_MODULE_4__show_type__["a" /* ShowTypes */].focus; }, enumerable: true, configurable: true }); Object.defineProperty(TooltipDirective.prototype, "listensForHover", { get: function () { return this.tooltipShowEvent === __WEBPACK_IMPORTED_MODULE_4__show_type__["a" /* ShowTypes */].all || this.tooltipShowEvent === __WEBPACK_IMPORTED_MODULE_4__show_type__["a" /* ShowTypes */].mouseover; }, enumerable: true, configurable: true }); TooltipDirective.prototype.ngOnDestroy = function () { this.hideTooltip(true); }; TooltipDirective.prototype.onFocus = function () { if (this.listensForFocus) { this.showTooltip(); } }; TooltipDirective.prototype.onBlur = function () { if (this.listensForFocus) { this.hideTooltip(true); } }; TooltipDirective.prototype.onMouseEnter = function () { if (this.listensForHover) { this.showTooltip(); } }; TooltipDirective.prototype.onMouseLeave = function (target) { if (this.listensForHover && this.tooltipCloseOnMouseLeave) { clearTimeout(this.timeout); if (this.component) { var contentDom = this.component.instance.element.nativeElement; var contains = contentDom.contains(target); if (contains) return; } this.hideTooltip(this.tooltipImmediateExit); } }; TooltipDirective.prototype.onMouseClick = function () { if (this.listensForHover) { this.hideTooltip(true); } }; TooltipDirective.prototype.showTooltip = function (immediate) { var _this = this; if (this.component || this.tooltipDisabled) return; var time = immediate ? 0 : this.tooltipShowTimeout; clearTimeout(this.timeout); this.timeout = setTimeout(function () { _this.tooltipService.destroyAll(); var options = _this.createBoundOptions(); _this.component = _this.tooltipService.create(options); // add a tiny timeout to avoid event re-triggers setTimeout(function () { if (_this.component) { _this.addHideListeners(_this.component.instance.element.nativeElement); } }, 10); _this.show.emit(true); }, time); }; TooltipDirective.prototype.addHideListeners = function (tooltip) { var _this = this; // on mouse enter, cancel the hide triggered by the leave this.mouseEnterContentEvent = this.renderer.listen(tooltip, 'mouseenter', function () { clearTimeout(_this.timeout); }); // content mouse leave listener if (this.tooltipCloseOnMouseLeave) { this.mouseLeaveContentEvent = this.renderer.listen(tooltip, 'mouseleave', function () { _this.hideTooltip(_this.tooltipImmediateExit); }); } // content close on click outside if (this.tooltipCloseOnClickOutside) { this.documentClickEvent = this.renderer.listen(document, 'click', function (event) { var contains = tooltip.contains(event.target); if (!contains) _this.hideTooltip(); }); } }; TooltipDirective.prototype.hideTooltip = function (immediate) { var _this = this; if (immediate === void 0) { immediate = false; } if (!this.component) return; var destroyFn = function () { // remove events if (_this.mouseLeaveContentEvent) _this.mouseLeaveContentEvent(); if (_this.mouseEnterContentEvent) _this.mouseEnterContentEvent(); if (_this.documentClickEvent) _this.documentClickEvent(); // emit events _this.hide.emit(true); // destroy component _this.tooltipService.destroy(_this.component); _this.component = undefined; }; clearTimeout(this.timeout); if (!immediate) { this.timeout = setTimeout(destroyFn, this.tooltipHideTimeout); } else { destroyFn(); } }; TooltipDirective.prototype.createBoundOptions = function () { return { title: this.tooltipTitle, template: this.tooltipTemplate, host: this.viewContainerRef.element, placement: this.tooltipPlacement, alignment: this.tooltipAlignment, type: this.tooltipType, showCaret: this.tooltipShowCaret, cssClass: this.tooltipCssClass, spacing: this.tooltipSpacing, context: this.tooltipContext }; }; __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", String) ], TooltipDirective.prototype, "tooltipCssClass", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", String) ], TooltipDirective.prototype, "tooltipTitle", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], TooltipDirective.prototype, "tooltipAppendToBody", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Number) ], TooltipDirective.prototype, "tooltipSpacing", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], TooltipDirective.prototype, "tooltipDisabled", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], TooltipDirective.prototype, "tooltipShowCaret", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Number) ], TooltipDirective.prototype, "tooltipPlacement", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Number) ], TooltipDirective.prototype, "tooltipAlignment", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Number) ], TooltipDirective.prototype, "tooltipType", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], TooltipDirective.prototype, "tooltipCloseOnClickOutside", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], TooltipDirective.prototype, "tooltipCloseOnMouseLeave", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Number) ], TooltipDirective.prototype, "tooltipHideTimeout", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Number) ], TooltipDirective.prototype, "tooltipShowTimeout", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], TooltipDirective.prototype, "tooltipTemplate", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Number) ], TooltipDirective.prototype, "tooltipShowEvent", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], TooltipDirective.prototype, "tooltipContext", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], TooltipDirective.prototype, "tooltipImmediateExit", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", Object) ], TooltipDirective.prototype, "show", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", Object) ], TooltipDirective.prototype, "hide", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["HostListener"])('focusin'), __metadata("design:type", Function), __metadata("design:paramtypes", []), __metadata("design:returntype", void 0) ], TooltipDirective.prototype, "onFocus", null); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["HostListener"])('blur'), __metadata("design:type", Function), __metadata("design:paramtypes", []), __metadata("design:returntype", void 0) ], TooltipDirective.prototype, "onBlur", null); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["HostListener"])('mouseenter'), __metadata("design:type", Function), __metadata("design:paramtypes", []), __metadata("design:returntype", void 0) ], TooltipDirective.prototype, "onMouseEnter", null); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["HostListener"])('mouseleave', ['$event.target']), __metadata("design:type", Function), __metadata("design:paramtypes", [Object]), __metadata("design:returntype", void 0) ], TooltipDirective.prototype, "onMouseLeave", null); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["HostListener"])('click'), __metadata("design:type", Function), __metadata("design:paramtypes", []), __metadata("design:returntype", void 0) ], TooltipDirective.prototype, "onMouseClick", null); TooltipDirective = __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"])({ selector: '[ngx-tooltip]' }), __metadata("design:paramtypes", [__WEBPACK_IMPORTED_MODULE_5__tooltip_service__["a" /* TooltipService */], __WEBPACK_IMPORTED_MODULE_0__angular_core__["ViewContainerRef"], __WEBPACK_IMPORTED_MODULE_0__angular_core__["Renderer"]]) ], TooltipDirective); return TooltipDirective; }()); /***/ }), /***/ "./src/common/tooltip/tooltip.module.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return TooltipModule; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("@angular/core"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_common__ = __webpack_require__("@angular/common"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_common___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1__angular_common__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__tooltip_directive__ = __webpack_require__("./src/common/tooltip/tooltip.directive.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__tooltip_component__ = __webpack_require__("./src/common/tooltip/tooltip.component.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__tooltip_service__ = __webpack_require__("./src/common/tooltip/tooltip.service.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__injection_service__ = __webpack_require__("./src/common/tooltip/injection.service.ts"); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var TooltipModule = /** @class */ (function () { function TooltipModule() { } TooltipModule = __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["NgModule"])({ declarations: [__WEBPACK_IMPORTED_MODULE_3__tooltip_component__["a" /* TooltipContentComponent */], __WEBPACK_IMPORTED_MODULE_2__tooltip_directive__["a" /* TooltipDirective */]], providers: [__WEBPACK_IMPORTED_MODULE_5__injection_service__["a" /* InjectionService */], __WEBPACK_IMPORTED_MODULE_4__tooltip_service__["a" /* TooltipService */]], exports: [__WEBPACK_IMPORTED_MODULE_3__tooltip_component__["a" /* TooltipContentComponent */], __WEBPACK_IMPORTED_MODULE_2__tooltip_directive__["a" /* TooltipDirective */]], imports: [__WEBPACK_IMPORTED_MODULE_1__angular_common__["CommonModule"]], entryComponents: [__WEBPACK_IMPORTED_MODULE_3__tooltip_component__["a" /* TooltipContentComponent */]] }) ], TooltipModule); return TooltipModule; }()); /***/ }), /***/ "./src/common/tooltip/tooltip.service.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return TooltipService; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("@angular/core"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__injection_service__ = __webpack_require__("./src/common/tooltip/injection.service.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__injection_registery_service__ = __webpack_require__("./src/common/tooltip/injection-registery.service.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__tooltip_component__ = __webpack_require__("./src/common/tooltip/tooltip.component.ts"); var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var TooltipService = /** @class */ (function (_super) { __extends(TooltipService, _super); function TooltipService(injectionService) { var _this = _super.call(this, injectionService) || this; _this.injectionService = injectionService; _this.type = __WEBPACK_IMPORTED_MODULE_3__tooltip_component__["a" /* TooltipContentComponent */]; return _this; } TooltipService = __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Injectable"])(), __metadata("design:paramtypes", [__WEBPACK_IMPORTED_MODULE_1__injection_service__["a" /* InjectionService */]]) ], TooltipService); return TooltipService; }(__WEBPACK_IMPORTED_MODULE_2__injection_registery_service__["a" /* InjectionRegistery */])); /***/ }), /***/ "./src/common/trim-label.helper.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = trimLabel; function trimLabel(s, max) { if (max === void 0) { max = 16; } if (typeof s !== 'string') { if (typeof s === 'number') { return s + ''; } else { return ''; } } s = s.trim(); if (s.length <= max) { return s; } else { return s.slice(0, max) + "..."; } } /***/ }), /***/ "./src/common/view-dimensions.helper.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = calculateViewDimensions; function calculateViewDimensions(_a) { var width = _a.width, height = _a.height, margins = _a.margins, _b = _a.showXAxis, showXAxis = _b === void 0 ? false : _b, _c = _a.showYAxis, showYAxis = _c === void 0 ? false : _c, _d = _a.xAxisHeight, xAxisHeight = _d === void 0 ? 0 : _d, _e = _a.yAxisWidth, yAxisWidth = _e === void 0 ? 0 : _e, _f = _a.showXLabel, showXLabel = _f === void 0 ? false : _f, _g = _a.showYLabel, showYLabel = _g === void 0 ? false : _g, _h = _a.showLegend, showLegend = _h === void 0 ? false : _h, _j = _a.legendType, legendType = _j === void 0 ? 'ordinal' : _j, _k = _a.columns, columns = _k === void 0 ? 12 : _k; var xOffset = margins[3]; var chartWidth = width; var chartHeight = height - margins[0] - margins[2]; if (showLegend) { if (legendType === 'ordinal') { columns -= 2; } else { columns -= 1; } } chartWidth = chartWidth * columns / 12; chartWidth = chartWidth - margins[1] - margins[3]; if (showXAxis) { chartHeight -= 5; chartHeight -= xAxisHeight; if (showXLabel) { // text height + spacing between axis label and tick labels var offset = 25 + 5; chartHeight -= offset; } } if (showYAxis) { chartWidth -= 5; chartWidth -= yAxisWidth; xOffset += yAxisWidth; xOffset += 10; if (showYLabel) { // text height + spacing between axis label and tick labels var offset = 25 + 5; chartWidth -= offset; xOffset += offset; } } chartWidth = Math.max(0, chartWidth); chartHeight = Math.max(0, chartHeight); return { width: ~~chartWidth, height: ~~chartHeight, xOffset: ~~xOffset }; } /***/ }), /***/ "./src/force-directed-graph/force-directed-graph.component.scss": /***/ (function(module, exports, __webpack_require__) { var result = __webpack_require__("./node_modules/css-loader/index.js!./node_modules/postcss-loader/index.js!./node_modules/sass-loader/lib/loader.js??ref--3-4!./src/force-directed-graph/force-directed-graph.component.scss"); if (typeof result === "string") { module.exports = result; } else { module.exports = result.toString(); } /***/ }), /***/ "./src/force-directed-graph/force-directed-graph.component.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ForceDirectedGraphComponent; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("@angular/core"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_d3_force__ = __webpack_require__("d3-force"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_d3_force___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_d3_force__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__common_charts_chart_component__ = __webpack_require__("./src/common/charts/chart.component.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__common_base_chart_component__ = __webpack_require__("./src/common/base-chart.component.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__common_view_dimensions_helper__ = __webpack_require__("./src/common/view-dimensions.helper.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__common_color_helper__ = __webpack_require__("./src/common/color.helper.ts"); var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var ForceDirectedGraphComponent = /** @class */ (function (_super) { __extends(ForceDirectedGraphComponent, _super); function ForceDirectedGraphComponent() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.force = Object(__WEBPACK_IMPORTED_MODULE_1_d3_force__["forceSimulation"])() .force('charge', Object(__WEBPACK_IMPORTED_MODULE_1_d3_force__["forceManyBody"])()) .force('collide', Object(__WEBPACK_IMPORTED_MODULE_1_d3_force__["forceCollide"])(5)) .force('x', Object(__WEBPACK_IMPORTED_MODULE_1_d3_force__["forceX"])()) .force('y', Object(__WEBPACK_IMPORTED_MODULE_1_d3_force__["forceY"])()); _this.forceLink = Object(__WEBPACK_IMPORTED_MODULE_1_d3_force__["forceLink"])().id(function (node) { return node.value; }); _this.legendTitle = 'Legend'; _this.nodes = []; _this.links = []; _this.activeEntries = []; _this.tooltipDisabled = false; _this.activate = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); _this.deactivate = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); _this.margin = [0, 0, 0, 0]; _this.results = []; _this.groupResultsBy = function (node) { return node.value; }; return _this; } ForceDirectedGraphComponent.prototype.update = function () { _super.prototype.update.call(this); // center graph this.dims = Object(__WEBPACK_IMPORTED_MODULE_4__common_view_dimensions_helper__["a" /* calculateViewDimensions */])({ width: this.width, height: this.height, margins: this.margin, showLegend: this.legend, }); this.seriesDomain = this.getSeriesDomain(); this.setColors(); this.legendOptions = this.getLegendOptions(); this.transform = "\n translate(" + (this.dims.xOffset + this.dims.width / 2) + ", " + (this.margin[0] + this.dims.height / 2) + ")\n "; if (this.force) { this.force.nodes(this.nodes) .force('link', this.forceLink.links(this.links)) .alpha(0.5).restart(); } }; ForceDirectedGraphComponent.prototype.onClick = function (data) { this.select.emit(data); }; ForceDirectedGraphComponent.prototype.onActivate = function (event) { if (this.activeEntries.indexOf(event) > -1) return; this.activeEntries = [event].concat(this.activeEntries); this.activate.emit({ value: event, entries: this.activeEntries }); }; ForceDirectedGraphComponent.prototype.onDeactivate = function (event) { var idx = this.activeEntries.indexOf(event); this.activeEntries.splice(idx, 1); this.activeEntries = this.activeEntries.slice(); this.deactivate.emit({ value: event, entries: this.activeEntries }); }; ForceDirectedGraphComponent.prototype.getSeriesDomain = function () { var _this = this; return this.nodes.map(function (d) { return _this.groupResultsBy(d); }) .reduce(function (nodes, node) { return nodes.includes(node) ? nodes : nodes.concat([node]); }, []) .sort(); }; ForceDirectedGraphComponent.prototype.trackLinkBy = function (index, link) { return link.index; }; ForceDirectedGraphComponent.prototype.trackNodeBy = function (index, node) { return node.value; }; ForceDirectedGraphComponent.prototype.setColors = function () { this.colors = new __WEBPACK_IMPORTED_MODULE_5__common_color_helper__["a" /* ColorHelper */](this.scheme, 'ordinal', this.seriesDomain, this.customColors); }; ForceDirectedGraphComponent.prototype.getLegendOptions = function () { return { scaleType: 'ordinal', domain: this.seriesDomain, colors: this.colors, title: this.legendTitle }; }; // Easier to use Angular2 event management than use d3.drag ForceDirectedGraphComponent.prototype.onDragStart = function (node, $event) { this.force.alphaTarget(0.3).restart(); this.draggingNode = node; this.draggingStart = { x: $event.x - node.x, y: $event.y - node.y }; this.draggingNode.fx = $event.x - this.draggingStart.x; this.draggingNode.fy = $event.y - this.draggingStart.y; }; ForceDirectedGraphComponent.prototype.onDrag = function ($event) { if (!this.draggingNode) return; this.draggingNode.fx = $event.x - this.draggingStart.x; this.draggingNode.fy = $event.y - this.draggingStart.y; }; ForceDirectedGraphComponent.prototype.onDragEnd = function ($event) { if (!this.draggingNode) return; this.force.alphaTarget(0); this.draggingNode.fx = undefined; this.draggingNode.fy = undefined; this.draggingNode = undefined; }; __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], ForceDirectedGraphComponent.prototype, "force", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], ForceDirectedGraphComponent.prototype, "forceLink", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], ForceDirectedGraphComponent.prototype, "legend", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", String) ], ForceDirectedGraphComponent.prototype, "legendTitle", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Array) ], ForceDirectedGraphComponent.prototype, "nodes", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Array) ], ForceDirectedGraphComponent.prototype, "links", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Array) ], ForceDirectedGraphComponent.prototype, "activeEntries", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], ForceDirectedGraphComponent.prototype, "tooltipDisabled", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"]) ], ForceDirectedGraphComponent.prototype, "activate", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"]) ], ForceDirectedGraphComponent.prototype, "deactivate", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["ContentChild"])('linkTemplate'), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["TemplateRef"]) ], ForceDirectedGraphComponent.prototype, "linkTemplate", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["ContentChild"])('nodeTemplate'), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["TemplateRef"]) ], ForceDirectedGraphComponent.prototype, "nodeTemplate", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["ContentChild"])('tooltipTemplate'), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["TemplateRef"]) ], ForceDirectedGraphComponent.prototype, "tooltipTemplate", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["ViewChild"])(__WEBPACK_IMPORTED_MODULE_2__common_charts_chart_component__["a" /* ChartComponent */], { read: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ElementRef"] }), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["ElementRef"]) ], ForceDirectedGraphComponent.prototype, "chart", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Function) ], ForceDirectedGraphComponent.prototype, "groupResultsBy", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["HostListener"])('document:mousemove', ['$event']), __metadata("design:type", Function), __metadata("design:paramtypes", [MouseEvent]), __metadata("design:returntype", void 0) ], ForceDirectedGraphComponent.prototype, "onDrag", null); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["HostListener"])('document:mouseup', ['$event']), __metadata("design:type", Function), __metadata("design:paramtypes", [MouseEvent]), __metadata("design:returntype", void 0) ], ForceDirectedGraphComponent.prototype, "onDragEnd", null); ForceDirectedGraphComponent = __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ selector: 'ngx-charts-force-directed-graph', template: "\n <ngx-charts-chart\n [view]=\"[width, height]\"\n [showLegend]=\"legend\"\n [legendOptions]=\"legendOptions\"\n [animations]=\"animations\"\n (legendLabelClick)=\"onClick($event)\"\n (legendLabelActivate)=\"onActivate($event)\"\n (legendLabelDeactivate)=\"onDeactivate($event)\">\n <svg:g [attr.transform]=\"transform\" class=\"force-directed-graph chart\">\n <svg:g class=\"links\">\n <svg:g *ngFor=\"let link of links; trackBy:trackLinkBy\">\n <ng-template *ngIf=\"linkTemplate\"\n [ngTemplateOutlet]=\"linkTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: link }\">\n </ng-template>\n <svg:line *ngIf=\"!linkTemplate\"\n strokeWidth=\"1\" class=\"edge\"\n [attr.x1]=\"link.source.x\"\n [attr.y1]=\"link.source.y\"\n [attr.x2]=\"link.target.x\"\n [attr.y2]=\"link.target.y\"\n />\n </svg:g>\n </svg:g>\n <svg:g class=\"nodes\">\n <svg:g *ngFor=\"let node of nodes; trackBy:trackNodeBy\"\n [attr.transform]=\"'translate(' + node.x + ',' + node.y + ')'\"\n [attr.fill]=\"colors.getColor(groupResultsBy(node))\"\n [attr.stroke]=\"colors.getColor(groupResultsBy(node))\"\n (mousedown)=\"onDragStart(node, $event)\"\n (click)=\"onClick({name: node.value})\"\n ngx-tooltip\n [tooltipDisabled]=\"tooltipDisabled\"\n [tooltipPlacement]=\"'top'\"\n [tooltipType]=\"'tooltip'\"\n [tooltipTitle]=\"tooltipTemplate ? undefined : node.value\"\n [tooltipTemplate]=\"tooltipTemplate\"\n [tooltipContext]=\"node\">\n <ng-template *ngIf=\"nodeTemplate\"\n [ngTemplateOutlet]=\"nodeTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: node }\">\n </ng-template>\n <svg:circle *ngIf=\"!nodeTemplate\" r=\"5\" />\n </svg:g>\n </svg:g>\n </svg:g>\n </ngx-charts-chart>\n ", styles: [ __webpack_require__("./src/common/base-chart.component.scss"), __webpack_require__("./src/force-directed-graph/force-directed-graph.component.scss") ], encapsulation: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ViewEncapsulation"].None, changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectionStrategy"].OnPush, }) ], ForceDirectedGraphComponent); return ForceDirectedGraphComponent; }(__WEBPACK_IMPORTED_MODULE_3__common_base_chart_component__["a" /* BaseChartComponent */])); /***/ }), /***/ "./src/force-directed-graph/force-directed-graph.module.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return ForceDirectedGraphModule; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("@angular/core"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__force_directed_graph_component__ = __webpack_require__("./src/force-directed-graph/force-directed-graph.component.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__common_chart_common_module__ = __webpack_require__("./src/common/chart-common.module.ts"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return __WEBPACK_IMPORTED_MODULE_1__force_directed_graph_component__["a"]; }); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var ForceDirectedGraphModule = /** @class */ (function () { function ForceDirectedGraphModule() { } ForceDirectedGraphModule = __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["NgModule"])({ imports: [__WEBPACK_IMPORTED_MODULE_2__common_chart_common_module__["a" /* ChartCommonModule */]], declarations: [ __WEBPACK_IMPORTED_MODULE_1__force_directed_graph_component__["a" /* ForceDirectedGraphComponent */], ], exports: [ __WEBPACK_IMPORTED_MODULE_1__force_directed_graph_component__["a" /* ForceDirectedGraphComponent */], ] }) ], ForceDirectedGraphModule); return ForceDirectedGraphModule; }()); /***/ }), /***/ "./src/force-directed-graph/index.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__force_directed_graph_module__ = __webpack_require__("./src/force-directed-graph/force-directed-graph.module.ts"); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "a", function() { return __WEBPACK_IMPORTED_MODULE_0__force_directed_graph_module__["a"]; }); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "b", function() { return __WEBPACK_IMPORTED_MODULE_0__force_directed_graph_module__["b"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__force_directed_graph_component__ = __webpack_require__("./src/force-directed-graph/force-directed-graph.component.ts"); /* unused harmony namespace reexport */ /***/ }), /***/ "./src/gauge/gauge-arc.component.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return GaugeArcComponent; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("@angular/core"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__common_label_helper__ = __webpack_require__("./src/common/label.helper.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__common_color_helper__ = __webpack_require__("./src/common/color.helper.ts"); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var GaugeArcComponent = /** @class */ (function () { function GaugeArcComponent() { this.isActive = false; this.tooltipDisabled = false; this.animations = true; this.select = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); this.activate = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); this.deactivate = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); } GaugeArcComponent.prototype.tooltipText = function (arc) { var label = Object(__WEBPACK_IMPORTED_MODULE_1__common_label_helper__["a" /* formatLabel */])(arc.data.name); var val; if (this.valueFormatting) { val = this.valueFormatting(arc.data.value); } else { val = Object(__WEBPACK_IMPORTED_MODULE_1__common_label_helper__["a" /* formatLabel */])(arc.data.value); } return "\n <span class=\"tooltip-label\">" + label + "</span>\n <span class=\"tooltip-val\">" + val + "</span>\n "; }; __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], GaugeArcComponent.prototype, "backgroundArc", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], GaugeArcComponent.prototype, "valueArc", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], GaugeArcComponent.prototype, "cornerRadius", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_2__common_color_helper__["a" /* ColorHelper */]) ], GaugeArcComponent.prototype, "colors", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], GaugeArcComponent.prototype, "isActive", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], GaugeArcComponent.prototype, "tooltipDisabled", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Function) ], GaugeArcComponent.prototype, "valueFormatting", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["TemplateRef"]) ], GaugeArcComponent.prototype, "tooltipTemplate", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], GaugeArcComponent.prototype, "animations", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", Object) ], GaugeArcComponent.prototype, "select", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", Object) ], GaugeArcComponent.prototype, "activate", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", Object) ], GaugeArcComponent.prototype, "deactivate", void 0); GaugeArcComponent = __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ selector: 'g[ngx-charts-gauge-arc]', template: "\n <svg:g ngx-charts-pie-arc\n class=\"background-arc\"\n [startAngle]=\"0\"\n [endAngle]=\"backgroundArc.endAngle\"\n [innerRadius]=\"backgroundArc.innerRadius\"\n [outerRadius]=\"backgroundArc.outerRadius\"\n [cornerRadius]=\"cornerRadius\"\n [data]=\"backgroundArc.data\"\n [animate]=\"false\"\n [pointerEvents]=\"false\">\n </svg:g>\n <svg:g ngx-charts-pie-arc\n [startAngle]=\"0\"\n [endAngle]=\"valueArc.endAngle\"\n [innerRadius]=\"valueArc.innerRadius\"\n [outerRadius]=\"valueArc.outerRadius\"\n [cornerRadius]=\"cornerRadius\"\n [fill]=\"colors.getColor(valueArc.data.name)\"\n [data]=\"valueArc.data\"\n [animate]=\"animations\"\n [isActive]=\"isActive\"\n (select)=\"select.emit($event)\"\n (activate)=\"activate.emit($event)\"\n (deactivate)=\"deactivate.emit($event)\"\n ngx-tooltip\n [tooltipDisabled]=\"tooltipDisabled\"\n [tooltipPlacement]=\"'top'\"\n [tooltipType]=\"'tooltip'\"\n [tooltipTitle]=\"tooltipTemplate ? undefined : tooltipText(valueArc)\"\n [tooltipTemplate]=\"tooltipTemplate\"\n [tooltipContext]=\"valueArc.data\">\n </svg:g>\n ", changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectionStrategy"].OnPush, }) ], GaugeArcComponent); return GaugeArcComponent; }()); /***/ }), /***/ "./src/gauge/gauge-axis.component.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return GaugeAxisComponent; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("@angular/core"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_d3_shape__ = __webpack_require__("d3-shape"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_d3_shape___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_d3_shape__); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var GaugeAxisComponent = /** @class */ (function () { function GaugeAxisComponent() { this.rotate = ''; } GaugeAxisComponent.prototype.ngOnChanges = function (changes) { this.update(); }; GaugeAxisComponent.prototype.update = function () { this.rotationAngle = -90 + this.startAngle; this.rotate = "rotate(" + this.rotationAngle + ")"; this.ticks = this.getTicks(); }; GaugeAxisComponent.prototype.getTicks = function () { var bigTickSegment = this.angleSpan / this.bigSegments; var smallTickSegment = bigTickSegment / (this.smallSegments); var tickLength = 20; var ticks = { big: [], small: [] }; var startDistance = this.radius + 10; var textDist = startDistance + tickLength + 10; for (var i = 0; i <= this.bigSegments; i++) { var angleDeg = i * bigTickSegment; var angle = angleDeg * Math.PI / 180; var textAnchor = this.getTextAnchor(angleDeg); var skip = false; if (i === 0 && this.angleSpan === 360) { skip = true; } if (!skip) { var text = Number.parseFloat(this.valueScale.invert(angleDeg).toString()).toLocaleString(); if (this.tickFormatting) { text = this.tickFormatting(text); } ticks.big.push({ line: this.getTickPath(startDistance, tickLength, angle), textAnchor: textAnchor, text: text, textTransform: "\n translate(" + textDist * Math.cos(angle) + ", " + textDist * Math.sin(angle) + ") rotate(" + -this.rotationAngle + ")\n " }); } if (i === this.bigSegments) { continue; } for (var j = 1; j <= this.smallSegments; j++) { var smallAngleDeg = angleDeg + j * smallTickSegment; var smallAngle = smallAngleDeg * Math.PI / 180; ticks.small.push({ line: this.getTickPath(startDistance, tickLength / 2, smallAngle) }); } } return ticks; }; GaugeAxisComponent.prototype.getTextAnchor = function (angle) { // [0, 45] = 'middle'; // [46, 135] = 'start'; // [136, 225] = 'middle'; // [226, 315] = 'end'; angle = (this.startAngle + angle) % 360; var textAnchor = 'middle'; if (angle > 45 && angle <= 135) { textAnchor = 'start'; } else if (angle > 225 && angle <= 315) { textAnchor = 'end'; } return textAnchor; }; GaugeAxisComponent.prototype.getTickPath = function (startDistance, tickLength, angle) { var y1 = startDistance * Math.sin(angle); var y2 = (startDistance + tickLength) * Math.sin(angle); var x1 = startDistance * Math.cos(angle); var x2 = (startDistance + tickLength) * Math.cos(angle); var points = [{ x: x1, y: y1 }, { x: x2, y: y2 }]; var lineGenerator = Object(__WEBPACK_IMPORTED_MODULE_1_d3_shape__["line"])().x(function (d) { return d.x; }).y(function (d) { return d.y; }); return lineGenerator(points); }; __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], GaugeAxisComponent.prototype, "bigSegments", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], GaugeAxisComponent.prototype, "smallSegments", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], GaugeAxisComponent.prototype, "min", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], GaugeAxisComponent.prototype, "max", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Number) ], GaugeAxisComponent.prototype, "angleSpan", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Number) ], GaugeAxisComponent.prototype, "startAngle", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], GaugeAxisComponent.prototype, "radius", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], GaugeAxisComponent.prototype, "valueScale", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], GaugeAxisComponent.prototype, "tickFormatting", void 0); GaugeAxisComponent = __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ selector: 'g[ngx-charts-gauge-axis]', template: "\n <svg:g [attr.transform]=\"rotate\">\n <svg:g *ngFor=\"let tick of ticks.big\"\n class=\"gauge-tick gauge-tick-large\">\n <svg:path [attr.d]=\"tick.line\" />\n </svg:g>\n <svg:g *ngFor=\"let tick of ticks.big\"\n class=\"gauge-tick gauge-tick-large\">\n <svg:text\n [style.textAnchor]=\"tick.textAnchor\"\n [attr.transform]=\"tick.textTransform\"\n alignment-baseline=\"central\">\n {{tick.text}}\n </svg:text>\n </svg:g>\n <svg:g *ngFor=\"let tick of ticks.small\"\n class=\"gauge-tick gauge-tick-small\">\n <svg:path [attr.d]=\"tick.line\" />\n </svg:g>\n </svg:g>\n ", changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectionStrategy"].OnPush }) ], GaugeAxisComponent); return GaugeAxisComponent; }()); /***/ }), /***/ "./src/gauge/gauge.component.scss": /***/ (function(module, exports, __webpack_require__) { var result = __webpack_require__("./node_modules/css-loader/index.js!./node_modules/postcss-loader/index.js!./node_modules/sass-loader/lib/loader.js??ref--3-4!./src/gauge/gauge.component.scss"); if (typeof result === "string") { module.exports = result; } else { module.exports = result.toString(); } /***/ }), /***/ "./src/gauge/gauge.component.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return GaugeComponent; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("@angular/core"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_d3_scale__ = __webpack_require__("d3-scale"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_d3_scale___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_d3_scale__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__common_base_chart_component__ = __webpack_require__("./src/common/base-chart.component.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__common_view_dimensions_helper__ = __webpack_require__("./src/common/view-dimensions.helper.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__common_color_helper__ = __webpack_require__("./src/common/color.helper.ts"); var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var GaugeComponent = /** @class */ (function (_super) { __extends(GaugeComponent, _super); function GaugeComponent() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.legend = false; _this.legendTitle = 'Legend'; _this.min = 0; _this.max = 100; _this.bigSegments = 10; _this.smallSegments = 5; _this.showAxis = true; _this.startAngle = -120; _this.angleSpan = 240; _this.activeEntries = []; _this.tooltipDisabled = false; _this.activate = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); _this.deactivate = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); _this.resizeScale = 1; _this.rotation = ''; _this.textTransform = 'scale(1, 1)'; _this.cornerRadius = 10; return _this; } GaugeComponent.prototype.ngAfterViewInit = function () { var _this = this; _super.prototype.ngAfterViewInit.call(this); setTimeout(function () { return _this.scaleText(); }); }; GaugeComponent.prototype.update = function () { var _this = this; _super.prototype.update.call(this); if (!this.showAxis) { if (!this.margin) { this.margin = [10, 20, 10, 20]; } } else { if (!this.margin) { this.margin = [60, 100, 60, 100]; } } // make the starting angle positive if (this.startAngle < 0) { this.startAngle = (this.startAngle % 360) + 360; } this.angleSpan = Math.min(this.angleSpan, 360); this.dims = Object(__WEBPACK_IMPORTED_MODULE_3__common_view_dimensions_helper__["a" /* calculateViewDimensions */])({ width: this.width, height: this.height, margins: this.margin, showLegend: this.legend }); this.domain = this.getDomain(); this.valueDomain = this.getValueDomain(); this.valueScale = this.getValueScale(); this.displayValue = this.getDisplayValue(); this.outerRadius = Math.min(this.dims.width, this.dims.height) / 2; this.arcs = this.getArcs(); this.setColors(); this.legendOptions = this.getLegendOptions(); var xOffset = this.margin[3] + this.dims.width / 2; var yOffset = this.margin[0] + this.dims.height / 2; this.transform = "translate(" + xOffset + ", " + yOffset + ")"; this.rotation = "rotate(" + this.startAngle + ")"; setTimeout(function () { return _this.scaleText(); }, 50); }; GaugeComponent.prototype.getArcs = function () { var arcs = []; var availableRadius = this.outerRadius * 0.7; var radiusPerArc = Math.min(availableRadius / this.results.length, 10); var arcWidth = radiusPerArc * 0.7; this.textRadius = this.outerRadius - this.results.length * radiusPerArc; this.cornerRadius = Math.floor(arcWidth / 2); var i = 0; for (var _i = 0, _a = this.results; _i < _a.length; _i++) { var d = _a[_i]; var outerRadius = this.outerRadius - (i * radiusPerArc); var innerRadius = outerRadius - arcWidth; var backgroundArc = { endAngle: this.angleSpan * Math.PI / 180, innerRadius: innerRadius, outerRadius: outerRadius, data: { value: this.max, name: d.name } }; var valueArc = { endAngle: Math.min(this.valueScale(d.value), this.angleSpan) * Math.PI / 180, innerRadius: innerRadius, outerRadius: outerRadius, data: { value: d.value, name: d.name } }; var arc = { backgroundArc: backgroundArc, valueArc: valueArc }; arcs.push(arc); i++; } return arcs; }; GaugeComponent.prototype.getDomain = function () { return this.results.map(function (d) { return d.name; }); }; GaugeComponent.prototype.getValueDomain = function () { var values = this.results.map(function (d) { return d.value; }); var dataMin = Math.min.apply(Math, values); var dataMax = Math.max.apply(Math, values); if (this.min !== undefined) { this.min = Math.min(this.min, dataMin); } else { this.min = dataMin; } if (this.max !== undefined) { this.max = Math.max(this.max, dataMax); } else { this.max = dataMax; } return [this.min, this.max]; }; GaugeComponent.prototype.getValueScale = function () { return Object(__WEBPACK_IMPORTED_MODULE_1_d3_scale__["scaleLinear"])() .range([0, this.angleSpan]) .nice() .domain(this.valueDomain); }; GaugeComponent.prototype.getDisplayValue = function () { var value = this.results.map(function (d) { return d.value; }).reduce(function (a, b) { return a + b; }, 0); if (this.textValue && 0 !== this.textValue.length) { return this.textValue.toLocaleString(); } if (this.valueFormatting) { return this.valueFormatting(value); } return value.toLocaleString(); }; GaugeComponent.prototype.scaleText = function (repeat) { var _this = this; if (repeat === void 0) { repeat = true; } var width = this.textEl.nativeElement.getBoundingClientRect().width; var oldScale = this.resizeScale; if (width === 0) { this.resizeScale = 1; } else { var availableSpace = this.textRadius; this.resizeScale = Math.floor((availableSpace / (width / this.resizeScale)) * 100) / 100; } if (this.resizeScale !== oldScale) { this.textTransform = "scale(" + this.resizeScale + ", " + this.resizeScale + ")"; this.cd.markForCheck(); if (repeat) { setTimeout(function () { return _this.scaleText(false); }, 50); } } }; GaugeComponent.prototype.onClick = function (data) { this.select.emit(data); }; GaugeComponent.prototype.getLegendOptions = function () { return { scaleType: 'ordinal', colors: this.colors, domain: this.domain, title: this.legendTitle }; }; GaugeComponent.prototype.setColors = function () { this.colors = new __WEBPACK_IMPORTED_MODULE_4__common_color_helper__["a" /* ColorHelper */](this.scheme, 'ordinal', this.domain, this.customColors); }; GaugeComponent.prototype.onActivate = function (item) { var idx = this.activeEntries.findIndex(function (d) { return d.name === item.name && d.value === item.value; }); if (idx > -1) { return; } this.activeEntries = [item].concat(this.activeEntries); this.activate.emit({ value: item, entries: this.activeEntries }); }; GaugeComponent.prototype.onDeactivate = function (item) { var idx = this.activeEntries.findIndex(function (d) { return d.name === item.name && d.value === item.value; }); this.activeEntries.splice(idx, 1); this.activeEntries = this.activeEntries.slice(); this.deactivate.emit({ value: item, entries: this.activeEntries }); }; GaugeComponent.prototype.isActive = function (entry) { if (!this.activeEntries) return false; var item = this.activeEntries.find(function (d) { return entry.name === d.name && entry.series === d.series; }); return item !== undefined; }; GaugeComponent.prototype.trackBy = function (index, item) { return item.valueArc.data.name; }; __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], GaugeComponent.prototype, "legend", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", String) ], GaugeComponent.prototype, "legendTitle", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Number) ], GaugeComponent.prototype, "min", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Number) ], GaugeComponent.prototype, "max", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", String) ], GaugeComponent.prototype, "textValue", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", String) ], GaugeComponent.prototype, "units", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Number) ], GaugeComponent.prototype, "bigSegments", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Number) ], GaugeComponent.prototype, "smallSegments", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Array) ], GaugeComponent.prototype, "results", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], GaugeComponent.prototype, "showAxis", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Number) ], GaugeComponent.prototype, "startAngle", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Number) ], GaugeComponent.prototype, "angleSpan", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Array) ], GaugeComponent.prototype, "activeEntries", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], GaugeComponent.prototype, "axisTickFormatting", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], GaugeComponent.prototype, "tooltipDisabled", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Function) ], GaugeComponent.prototype, "valueFormatting", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Array) ], GaugeComponent.prototype, "margin", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"]) ], GaugeComponent.prototype, "activate", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"]) ], GaugeComponent.prototype, "deactivate", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["ContentChild"])('tooltipTemplate'), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["TemplateRef"]) ], GaugeComponent.prototype, "tooltipTemplate", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["ViewChild"])('textEl'), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["ElementRef"]) ], GaugeComponent.prototype, "textEl", void 0); GaugeComponent = __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ selector: 'ngx-charts-gauge', template: "\n <ngx-charts-chart\n [view]=\"[width, height]\"\n [showLegend]=\"legend\"\n [legendOptions]=\"legendOptions\"\n [activeEntries]=\"activeEntries\"\n [animations]=\"animations\"\n (legendLabelClick)=\"onClick($event)\"\n (legendLabelActivate)=\"onActivate($event)\"\n (legendLabelDeactivate)=\"onDeactivate($event)\">\n <svg:g [attr.transform]=\"transform\" class=\"gauge chart\">\n <svg:g *ngFor=\"let arc of arcs; trackBy:trackBy\" [attr.transform]=\"rotation\">\n <svg:g ngx-charts-gauge-arc\n [backgroundArc]=\"arc.backgroundArc\"\n [valueArc]=\"arc.valueArc\"\n [cornerRadius]=\"cornerRadius\"\n [colors]=\"colors\"\n [isActive]=\"isActive(arc.valueArc.data)\"\n [tooltipDisabled]=\"tooltipDisabled\"\n [tooltipTemplate]=\"tooltipTemplate\"\n [valueFormatting]=\"valueFormatting\"\n [animations]=\"animations\"\n (select)=\"onClick($event)\"\n (activate)=\"onActivate($event)\"\n (deactivate)=\"onDeactivate($event)\">\n </svg:g>\n </svg:g>\n\n <svg:g ngx-charts-gauge-axis\n *ngIf=\"showAxis\"\n [bigSegments]=\"bigSegments\"\n [smallSegments]=\"smallSegments\"\n [min]=\"min\"\n [max]=\"max\"\n [radius]=\"outerRadius\"\n [angleSpan]=\"angleSpan\"\n [valueScale]=\"valueScale\"\n [startAngle]=\"startAngle\"\n [tickFormatting]=\"axisTickFormatting\">\n </svg:g>\n\n <svg:text #textEl\n [style.textAnchor]=\"'middle'\"\n [attr.transform]=\"textTransform\"\n alignment-baseline=\"central\">\n <tspan x=\"0\" dy=\"0\">{{displayValue}}</tspan>\n <tspan x=\"0\" dy=\"1.2em\">{{units}}</tspan>\n </svg:text>\n\n </svg:g>\n </ngx-charts-chart>\n ", styles: [ __webpack_require__("./src/common/base-chart.component.scss"), __webpack_require__("./src/gauge/gauge.component.scss") ], encapsulation: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ViewEncapsulation"].None, changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectionStrategy"].OnPush, }) ], GaugeComponent); return GaugeComponent; }(__WEBPACK_IMPORTED_MODULE_2__common_base_chart_component__["a" /* BaseChartComponent */])); /***/ }), /***/ "./src/gauge/gauge.module.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return GaugeModule; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("@angular/core"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__common_chart_common_module__ = __webpack_require__("./src/common/chart-common.module.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__linear_gauge_component__ = __webpack_require__("./src/gauge/linear-gauge.component.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__gauge_component__ = __webpack_require__("./src/gauge/gauge.component.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__gauge_arc_component__ = __webpack_require__("./src/gauge/gauge-arc.component.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__gauge_axis_component__ = __webpack_require__("./src/gauge/gauge-axis.component.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__pie_chart_pie_chart_module__ = __webpack_require__("./src/pie-chart/pie-chart.module.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__bar_chart_bar_chart_module__ = __webpack_require__("./src/bar-chart/bar-chart.module.ts"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return __WEBPACK_IMPORTED_MODULE_3__gauge_component__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return __WEBPACK_IMPORTED_MODULE_4__gauge_arc_component__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return __WEBPACK_IMPORTED_MODULE_5__gauge_axis_component__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return __WEBPACK_IMPORTED_MODULE_2__linear_gauge_component__["a"]; }); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var GaugeModule = /** @class */ (function () { function GaugeModule() { } GaugeModule = __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["NgModule"])({ imports: [__WEBPACK_IMPORTED_MODULE_1__common_chart_common_module__["a" /* ChartCommonModule */], __WEBPACK_IMPORTED_MODULE_6__pie_chart_pie_chart_module__["d" /* PieChartModule */], __WEBPACK_IMPORTED_MODULE_7__bar_chart_bar_chart_module__["a" /* BarChartModule */]], declarations: [ __WEBPACK_IMPORTED_MODULE_2__linear_gauge_component__["a" /* LinearGaugeComponent */], __WEBPACK_IMPORTED_MODULE_3__gauge_component__["a" /* GaugeComponent */], __WEBPACK_IMPORTED_MODULE_4__gauge_arc_component__["a" /* GaugeArcComponent */], __WEBPACK_IMPORTED_MODULE_5__gauge_axis_component__["a" /* GaugeAxisComponent */] ], exports: [ __WEBPACK_IMPORTED_MODULE_2__linear_gauge_component__["a" /* LinearGaugeComponent */], __WEBPACK_IMPORTED_MODULE_3__gauge_component__["a" /* GaugeComponent */], __WEBPACK_IMPORTED_MODULE_4__gauge_arc_component__["a" /* GaugeArcComponent */], __WEBPACK_IMPORTED_MODULE_5__gauge_axis_component__["a" /* GaugeAxisComponent */] ] }) ], GaugeModule); return GaugeModule; }()); /***/ }), /***/ "./src/gauge/index.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__gauge_module__ = __webpack_require__("./src/gauge/gauge.module.ts"); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "a", function() { return __WEBPACK_IMPORTED_MODULE_0__gauge_module__["a"]; }); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "b", function() { return __WEBPACK_IMPORTED_MODULE_0__gauge_module__["b"]; }); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "c", function() { return __WEBPACK_IMPORTED_MODULE_0__gauge_module__["c"]; }); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "d", function() { return __WEBPACK_IMPORTED_MODULE_0__gauge_module__["d"]; }); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "e", function() { return __WEBPACK_IMPORTED_MODULE_0__gauge_module__["e"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__gauge_component__ = __webpack_require__("./src/gauge/gauge.component.ts"); /* unused harmony namespace reexport */ /***/ }), /***/ "./src/gauge/linear-gauge.component.scss": /***/ (function(module, exports, __webpack_require__) { var result = __webpack_require__("./node_modules/css-loader/index.js!./node_modules/postcss-loader/index.js!./node_modules/sass-loader/lib/loader.js??ref--3-4!./src/gauge/linear-gauge.component.scss"); if (typeof result === "string") { module.exports = result; } else { module.exports = result.toString(); } /***/ }), /***/ "./src/gauge/linear-gauge.component.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return LinearGaugeComponent; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("@angular/core"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_d3_scale__ = __webpack_require__("d3-scale"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_d3_scale___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_d3_scale__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__common_base_chart_component__ = __webpack_require__("./src/common/base-chart.component.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__common_view_dimensions_helper__ = __webpack_require__("./src/common/view-dimensions.helper.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__common_color_helper__ = __webpack_require__("./src/common/color.helper.ts"); var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var LinearGaugeComponent = /** @class */ (function (_super) { __extends(LinearGaugeComponent, _super); function LinearGaugeComponent() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.min = 0; _this.max = 100; _this.value = 0; _this.margin = [10, 20, 10, 20]; _this.valueResizeScale = 1; _this.unitsResizeScale = 1; _this.valueTextTransform = ''; _this.valueTranslate = ''; _this.unitsTextTransform = ''; _this.unitsTranslate = ''; return _this; } LinearGaugeComponent.prototype.ngAfterViewInit = function () { var _this = this; _super.prototype.ngAfterViewInit.call(this); setTimeout(function () { _this.scaleText('value'); _this.scaleText('units'); }); }; LinearGaugeComponent.prototype.update = function () { var _this = this; _super.prototype.update.call(this); this.hasPreviousValue = this.previousValue !== undefined; this.max = Math.max(this.max, this.value); this.min = Math.min(this.min, this.value); if (this.hasPreviousValue) { this.max = Math.max(this.max, this.previousValue); this.min = Math.min(this.min, this.previousValue); } this.dims = Object(__WEBPACK_IMPORTED_MODULE_3__common_view_dimensions_helper__["a" /* calculateViewDimensions */])({ width: this.width, height: this.height, margins: this.margin }); this.valueDomain = this.getValueDomain(); this.valueScale = this.getValueScale(); this.displayValue = this.getDisplayValue(); this.setColors(); var xOffset = this.margin[3] + this.dims.width / 2; var yOffset = this.margin[0] + this.dims.height / 2; this.transform = "translate(" + xOffset + ", " + yOffset + ")"; this.transformLine = "translate(" + (this.margin[3] + this.valueScale(this.previousValue)) + ", " + yOffset + ")"; this.valueTranslate = "translate(0, -15)"; this.unitsTranslate = "translate(0, 15)"; setTimeout(function () { return _this.scaleText('value'); }, 50); setTimeout(function () { return _this.scaleText('units'); }, 50); }; LinearGaugeComponent.prototype.getValueDomain = function () { return [this.min, this.max]; }; LinearGaugeComponent.prototype.getValueScale = function () { return Object(__WEBPACK_IMPORTED_MODULE_1_d3_scale__["scaleLinear"])() .range([0, this.dims.width]) .domain(this.valueDomain); }; LinearGaugeComponent.prototype.getDisplayValue = function () { if (this.valueFormatting) { return this.valueFormatting(this.value); } return this.value.toLocaleString(); }; LinearGaugeComponent.prototype.scaleText = function (element, repeat) { var _this = this; if (repeat === void 0) { repeat = true; } var el; var resizeScale; if (element === 'value') { el = this.valueTextEl; resizeScale = this.valueResizeScale; } else { el = this.unitsTextEl; resizeScale = this.unitsResizeScale; } var _a = el.nativeElement.getBoundingClientRect(), width = _a.width, height = _a.height; if (width === 0 || height === 0) return; var oldScale = resizeScale; var availableWidth = this.dims.width; var availableHeight = Math.max(this.dims.height / 2 - 15, 0); var resizeScaleWidth = Math.floor((availableWidth / (width / resizeScale)) * 100) / 100; var resizeScaleHeight = Math.floor((availableHeight / (height / resizeScale)) * 100) / 100; resizeScale = Math.min(resizeScaleHeight, resizeScaleWidth); if (resizeScale !== oldScale) { if (element === 'value') { this.valueResizeScale = resizeScale; this.valueTextTransform = "scale(" + resizeScale + ", " + resizeScale + ")"; } else { this.unitsResizeScale = resizeScale; this.unitsTextTransform = "scale(" + resizeScale + ", " + resizeScale + ")"; } this.cd.markForCheck(); if (repeat) { setTimeout(function () { _this.scaleText(element, false); }, 50); } } }; LinearGaugeComponent.prototype.onClick = function () { this.select.emit({ name: 'Value', value: this.value }); }; LinearGaugeComponent.prototype.setColors = function () { this.colors = new __WEBPACK_IMPORTED_MODULE_4__common_color_helper__["a" /* ColorHelper */](this.scheme, 'ordinal', [this.value], this.customColors); }; __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Number) ], LinearGaugeComponent.prototype, "min", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Number) ], LinearGaugeComponent.prototype, "max", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Number) ], LinearGaugeComponent.prototype, "value", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", String) ], LinearGaugeComponent.prototype, "units", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], LinearGaugeComponent.prototype, "previousValue", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], LinearGaugeComponent.prototype, "valueFormatting", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["ViewChild"])('valueTextEl'), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["ElementRef"]) ], LinearGaugeComponent.prototype, "valueTextEl", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["ViewChild"])('unitsTextEl'), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["ElementRef"]) ], LinearGaugeComponent.prototype, "unitsTextEl", void 0); LinearGaugeComponent = __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ selector: 'ngx-charts-linear-gauge', template: "\n <ngx-charts-chart\n [view]=\"[width, height]\"\n [showLegend]=\"false\"\n [animations]=\"animations\"\n (click)=\"onClick()\">\n <svg:g class=\"linear-gauge chart\">\n <svg:g ngx-charts-bar\n class=\"background-bar\"\n [width]=\"dims.width\"\n [height]=\"3\"\n [x]=\"margin[3]\"\n [y]=\"dims.height / 2 + margin[0] - 2\"\n [data]=\"{}\"\n [orientation]=\"'horizontal'\"\n [roundEdges]=\"true\"\n [animations]=\"animations\">\n </svg:g>\n <svg:g ngx-charts-bar\n [width]=\"valueScale(value)\"\n [height]=\"3\"\n [x]=\"margin[3]\"\n [y]=\"dims.height / 2 + margin[0] - 2\"\n [fill]=\"colors.getColor(units)\"\n [data]=\"{}\"\n [orientation]=\"'horizontal'\"\n [roundEdges]=\"true\"\n [animations]=\"animations\">\n </svg:g>\n\n <svg:line\n *ngIf=\"hasPreviousValue\"\n [attr.transform]=\"transformLine\"\n x1=\"0\"\n y1=\"5\"\n x2=\"0\"\n y2=\"15\"\n [attr.stroke]=\"colors.getColor(units)\"\n />\n\n <svg:line\n *ngIf=\"hasPreviousValue\"\n [attr.transform]=\"transformLine\"\n x1=\"0\"\n y1=\"-5\"\n x2=\"0\"\n y2=\"-15\"\n [attr.stroke]=\"colors.getColor(units)\"\n />\n\n <svg:g [attr.transform]=\"transform\">\n <svg:g [attr.transform]=\"valueTranslate\">\n <svg:text #valueTextEl\n class=\"value\"\n [style.textAnchor]=\"'middle'\"\n [attr.transform]=\"valueTextTransform\"\n alignment-baseline=\"after-edge\">\n {{displayValue}}\n </svg:text>\n </svg:g>\n\n <svg:g [attr.transform]=\"unitsTranslate\">\n <svg:text #unitsTextEl\n class=\"units\"\n [style.textAnchor]=\"'middle'\"\n [attr.transform]=\"unitsTextTransform\"\n alignment-baseline=\"before-edge\">\n {{units}}\n </svg:text>\n </svg:g>\n </svg:g>\n </svg:g>\n </ngx-charts-chart>\n ", styles: [ __webpack_require__("./src/common/base-chart.component.scss"), __webpack_require__("./src/gauge/linear-gauge.component.scss") ], encapsulation: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ViewEncapsulation"].None, changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectionStrategy"].OnPush, }) ], LinearGaugeComponent); return LinearGaugeComponent; }(__WEBPACK_IMPORTED_MODULE_2__common_base_chart_component__["a" /* BaseChartComponent */])); /***/ }), /***/ "./src/heat-map/heat-map-cell-series.component.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return HeatCellSeriesComponent; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("@angular/core"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__common_label_helper__ = __webpack_require__("./src/common/label.helper.ts"); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var HeatCellSeriesComponent = /** @class */ (function () { function HeatCellSeriesComponent() { this.tooltipDisabled = false; this.animations = true; this.select = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); } HeatCellSeriesComponent.prototype.ngOnInit = function () { if (!this.tooltipText) { this.tooltipText = this.getTooltipText; } }; HeatCellSeriesComponent.prototype.ngOnChanges = function (changes) { this.update(); }; HeatCellSeriesComponent.prototype.update = function () { this.cells = this.getCells(); }; HeatCellSeriesComponent.prototype.getCells = function () { var _this = this; var cells = []; this.data.map(function (row) { row.series.map(function (cell) { var value = cell.value; cells.push({ row: row, cell: cell, x: _this.xScale(row.name), y: _this.yScale(cell.name), width: _this.xScale.bandwidth(), height: _this.yScale.bandwidth(), fill: _this.colors.getColor(value), data: value, label: Object(__WEBPACK_IMPORTED_MODULE_1__common_label_helper__["a" /* formatLabel */])(cell.name), series: row.name }); }); }); return cells; }; HeatCellSeriesComponent.prototype.getTooltipText = function (_a) { var label = _a.label, data = _a.data, series = _a.series; return "\n <span class=\"tooltip-label\">" + series + " \u2022 " + label + "</span>\n <span class=\"tooltip-val\">" + data.toLocaleString() + "</span>\n "; }; HeatCellSeriesComponent.prototype.trackBy = function (index, item) { return item.tooltipText; }; HeatCellSeriesComponent.prototype.onClick = function (value, label, series) { this.select.emit({ name: label, value: value, series: series }); }; __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], HeatCellSeriesComponent.prototype, "data", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], HeatCellSeriesComponent.prototype, "colors", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], HeatCellSeriesComponent.prototype, "xScale", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], HeatCellSeriesComponent.prototype, "yScale", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], HeatCellSeriesComponent.prototype, "gradient", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], HeatCellSeriesComponent.prototype, "tooltipDisabled", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], HeatCellSeriesComponent.prototype, "tooltipText", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["TemplateRef"]) ], HeatCellSeriesComponent.prototype, "tooltipTemplate", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], HeatCellSeriesComponent.prototype, "animations", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", Object) ], HeatCellSeriesComponent.prototype, "select", void 0); HeatCellSeriesComponent = __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ selector: 'g[ngx-charts-heat-map-cell-series]', template: "\n <svg:g\n ngx-charts-heat-map-cell\n *ngFor=\"let c of cells; trackBy:trackBy\"\n [x]=\"c.x\"\n [y]=\"c.y\"\n [width]=\"c.width\"\n [height]=\"c.height\"\n [fill]=\"c.fill\"\n [data]=\"c.data\"\n (select)=\"onClick($event, c.label, c.series)\"\n [gradient]=\"gradient\"\n [animations]=\"animations\"\n ngx-tooltip\n [tooltipDisabled]=\"tooltipDisabled\"\n [tooltipPlacement]=\"'top'\"\n [tooltipType]=\"'tooltip'\"\n [tooltipTitle]=\"tooltipTemplate ? undefined : tooltipText(c)\"\n [tooltipTemplate]=\"tooltipTemplate\"\n [tooltipContext]=\"{series: c.series, name: c.label, value: c.data}\">\n </svg:g>\n ", changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectionStrategy"].OnPush, }) ], HeatCellSeriesComponent); return HeatCellSeriesComponent; }()); /***/ }), /***/ "./src/heat-map/heat-map-cell.component.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return HeatMapCellComponent; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("@angular/core"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_d3_selection__ = __webpack_require__("d3-selection"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_d3_selection___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_d3_selection__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__utils_id__ = __webpack_require__("./src/utils/id.ts"); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var HeatMapCellComponent = /** @class */ (function () { function HeatMapCellComponent(element) { this.gradient = false; this.animations = true; this.select = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); this.element = element.nativeElement; } HeatMapCellComponent.prototype.ngOnChanges = function (changes) { this.transform = "translate(" + this.x + " , " + this.y + ")"; this.startOpacity = 0.3; this.gradientId = 'grad' + Object(__WEBPACK_IMPORTED_MODULE_2__utils_id__["a" /* id */])().toString(); this.gradientUrl = "url(#" + this.gradientId + ")"; this.gradientStops = this.getGradientStops(); if (this.animations) { this.loadAnimation(); } }; HeatMapCellComponent.prototype.getGradientStops = function () { return [ { offset: 0, color: this.fill, opacity: this.startOpacity }, { offset: 100, color: this.fill, opacity: 1 } ]; }; HeatMapCellComponent.prototype.loadAnimation = function () { var node = Object(__WEBPACK_IMPORTED_MODULE_1_d3_selection__["select"])(this.element).select('.cell'); node.attr('opacity', 0); this.animateToCurrentForm(); }; HeatMapCellComponent.prototype.animateToCurrentForm = function () { var node = Object(__WEBPACK_IMPORTED_MODULE_1_d3_selection__["select"])(this.element).select('.cell'); node.transition().duration(750) .attr('opacity', 1); }; HeatMapCellComponent.prototype.onClick = function () { this.select.emit(this.data); }; __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], HeatMapCellComponent.prototype, "fill", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], HeatMapCellComponent.prototype, "x", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], HeatMapCellComponent.prototype, "y", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], HeatMapCellComponent.prototype, "width", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], HeatMapCellComponent.prototype, "height", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], HeatMapCellComponent.prototype, "data", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], HeatMapCellComponent.prototype, "label", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], HeatMapCellComponent.prototype, "gradient", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], HeatMapCellComponent.prototype, "animations", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", Object) ], HeatMapCellComponent.prototype, "select", void 0); HeatMapCellComponent = __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ selector: 'g[ngx-charts-heat-map-cell]', template: "\n <svg:g [attr.transform]=\"transform\" class=\"cell\">\n <defs *ngIf=\"gradient\">\n <svg:g ngx-charts-svg-linear-gradient\n orientation=\"vertical\"\n [name]=\"gradientId\"\n [stops]=\"gradientStops\"\n />\n </defs>\n <svg:rect\n [attr.fill]=\"gradient ? gradientUrl : fill\"\n rx=\"3\"\n [attr.width]=\"width\"\n [attr.height]=\"height\"\n class=\"cell\"\n style=\"cursor: pointer\"\n (click)=\"onClick()\"\n />\n </svg:g>\n ", changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectionStrategy"].OnPush }), __metadata("design:paramtypes", [__WEBPACK_IMPORTED_MODULE_0__angular_core__["ElementRef"]]) ], HeatMapCellComponent); return HeatMapCellComponent; }()); /***/ }), /***/ "./src/heat-map/heat-map.component.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return HeatMapComponent; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("@angular/core"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_d3_scale__ = __webpack_require__("d3-scale"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_d3_scale___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_d3_scale__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__common_base_chart_component__ = __webpack_require__("./src/common/base-chart.component.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__common_view_dimensions_helper__ = __webpack_require__("./src/common/view-dimensions.helper.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__common_color_helper__ = __webpack_require__("./src/common/color.helper.ts"); var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var HeatMapComponent = /** @class */ (function (_super) { __extends(HeatMapComponent, _super); function HeatMapComponent() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.legendTitle = 'Legend'; _this.innerPadding = 8; _this.tooltipDisabled = false; _this.margin = [10, 20, 10, 20]; _this.xAxisHeight = 0; _this.yAxisWidth = 0; _this.scaleType = 'linear'; return _this; } HeatMapComponent.prototype.update = function () { _super.prototype.update.call(this); this.formatDates(); this.xDomain = this.getXDomain(); this.yDomain = this.getYDomain(); this.valueDomain = this.getValueDomain(); this.scaleType = this.getScaleType(this.valueDomain); this.dims = Object(__WEBPACK_IMPORTED_MODULE_3__common_view_dimensions_helper__["a" /* calculateViewDimensions */])({ width: this.width, height: this.height, margins: this.margin, showXAxis: this.xAxis, showYAxis: this.yAxis, xAxisHeight: this.xAxisHeight, yAxisWidth: this.yAxisWidth, showXLabel: this.showXAxisLabel, showYLabel: this.showYAxisLabel, showLegend: this.legend, legendType: this.scaleType }); if (this.scaleType === 'linear') { var min = Math.min.apply(Math, [0].concat(this.valueDomain)); var max = Math.max.apply(Math, this.valueDomain); this.valueDomain = [min, max]; } this.xScale = this.getXScale(); this.yScale = this.getYScale(); this.setColors(); this.legendOptions = this.getLegendOptions(); this.transform = "translate(" + this.dims.xOffset + " , " + this.margin[0] + ")"; this.rects = this.getRects(); }; HeatMapComponent.prototype.getXDomain = function () { var domain = []; for (var _i = 0, _a = this.results; _i < _a.length; _i++) { var group = _a[_i]; if (!domain.includes(group.name)) { domain.push(group.name); } } return domain; }; HeatMapComponent.prototype.getYDomain = function () { var domain = []; for (var _i = 0, _a = this.results; _i < _a.length; _i++) { var group = _a[_i]; for (var _b = 0, _c = group.series; _b < _c.length; _b++) { var d = _c[_b]; if (!domain.includes(d.name)) { domain.push(d.name); } } } return domain; }; HeatMapComponent.prototype.getValueDomain = function () { var domain = []; for (var _i = 0, _a = this.results; _i < _a.length; _i++) { var group = _a[_i]; for (var _b = 0, _c = group.series; _b < _c.length; _b++) { var d = _c[_b]; if (!domain.includes(d.value)) { domain.push(d.value); } } } return domain; }; /** * Converts the input to gap paddingInner in fraction * Supports the following inputs: * Numbers: 8 * Strings: "8", "8px", "8%" * Arrays: [8,2], "8,2", "[8,2]" * Mixed: [8,"2%"], ["8px","2%"], "8,2%", "[8,2%]" * * @param {(string | number | Array<string | number>)} value * @param {number} [index=0] * @param {number} N * @param {number} L * @returns {number} * * @memberOf HeatMapComponent */ HeatMapComponent.prototype.getDimension = function (value, index, N, L) { if (index === void 0) { index = 0; } if (typeof value === 'string') { value = value .replace('[', '') .replace(']', '') .replace('px', '') .replace('\'', ''); if (value.includes(',')) { value = value.split(','); } } if (Array.isArray(value) && typeof index === 'number') { return this.getDimension(value[index], null, N, L); } if (typeof value === 'string' && value.includes('%')) { return +value.replace('%', '') / 100; } return N / (L / +value + 1); }; HeatMapComponent.prototype.getXScale = function () { var f = this.getDimension(this.innerPadding, 0, this.xDomain.length, this.dims.width); return Object(__WEBPACK_IMPORTED_MODULE_1_d3_scale__["scaleBand"])() .rangeRound([0, this.dims.width]) .domain(this.xDomain) .paddingInner(f); }; HeatMapComponent.prototype.getYScale = function () { var f = this.getDimension(this.innerPadding, 1, this.yDomain.length, this.dims.height); return Object(__WEBPACK_IMPORTED_MODULE_1_d3_scale__["scaleBand"])() .rangeRound([this.dims.height, 0]) .domain(this.yDomain) .paddingInner(f); }; HeatMapComponent.prototype.getRects = function () { var _this = this; var rects = []; this.xDomain.map(function (xVal) { _this.yDomain.map(function (yVal) { rects.push({ x: _this.xScale(xVal), y: _this.yScale(yVal), rx: 3, width: _this.xScale.bandwidth(), height: _this.yScale.bandwidth(), fill: 'rgba(200,200,200,0.03)' }); }); }); return rects; }; HeatMapComponent.prototype.onClick = function (data) { this.select.emit(data); }; HeatMapComponent.prototype.getScaleType = function (values) { var num = true; for (var _i = 0, values_1 = values; _i < values_1.length; _i++) { var value = values_1[_i]; if (typeof value !== 'number') { num = false; } } if (num) return 'linear'; return 'ordinal'; }; HeatMapComponent.prototype.setColors = function () { this.colors = new __WEBPACK_IMPORTED_MODULE_4__common_color_helper__["a" /* ColorHelper */](this.scheme, this.scaleType, this.valueDomain); }; HeatMapComponent.prototype.getLegendOptions = function () { return { scaleType: this.scaleType, domain: this.valueDomain, colors: this.scaleType === 'ordinal' ? this.colors : this.colors.scale, title: this.scaleType === 'ordinal' ? this.legendTitle : undefined }; }; HeatMapComponent.prototype.updateYAxisWidth = function (_a) { var width = _a.width; this.yAxisWidth = width; this.update(); }; HeatMapComponent.prototype.updateXAxisHeight = function (_a) { var height = _a.height; this.xAxisHeight = height; this.update(); }; __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], HeatMapComponent.prototype, "legend", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", String) ], HeatMapComponent.prototype, "legendTitle", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], HeatMapComponent.prototype, "xAxis", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], HeatMapComponent.prototype, "yAxis", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], HeatMapComponent.prototype, "showXAxisLabel", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], HeatMapComponent.prototype, "showYAxisLabel", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], HeatMapComponent.prototype, "xAxisLabel", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], HeatMapComponent.prototype, "yAxisLabel", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], HeatMapComponent.prototype, "gradient", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], HeatMapComponent.prototype, "innerPadding", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], HeatMapComponent.prototype, "xAxisTickFormatting", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], HeatMapComponent.prototype, "yAxisTickFormatting", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Array) ], HeatMapComponent.prototype, "xAxisTicks", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Array) ], HeatMapComponent.prototype, "yAxisTicks", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], HeatMapComponent.prototype, "tooltipDisabled", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], HeatMapComponent.prototype, "tooltipText", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["ContentChild"])('tooltipTemplate'), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["TemplateRef"]) ], HeatMapComponent.prototype, "tooltipTemplate", void 0); HeatMapComponent = __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ selector: 'ngx-charts-heat-map', template: "\n <ngx-charts-chart\n [view]=\"[width, height]\"\n [showLegend]=\"legend\"\n [animations]=\"animations\"\n [legendOptions]=\"legendOptions\"\n (legendLabelClick)=\"onClick($event)\">\n <svg:g [attr.transform]=\"transform\" class=\"heat-map chart\">\n <svg:g ngx-charts-x-axis\n *ngIf=\"xAxis\"\n [xScale]=\"xScale\"\n [dims]=\"dims\"\n [showLabel]=\"showXAxisLabel\"\n [labelText]=\"xAxisLabel\"\n [tickFormatting]=\"xAxisTickFormatting\"\n [ticks]=\"xAxisTicks\"\n (dimensionsChanged)=\"updateXAxisHeight($event)\">\n </svg:g>\n <svg:g ngx-charts-y-axis\n *ngIf=\"yAxis\"\n [yScale]=\"yScale\"\n [dims]=\"dims\"\n [showLabel]=\"showYAxisLabel\"\n [labelText]=\"yAxisLabel\"\n [tickFormatting]=\"yAxisTickFormatting\"\n [ticks]=\"yAxisTicks\"\n (dimensionsChanged)=\"updateYAxisWidth($event)\">\n </svg:g>\n <svg:rect *ngFor=\"let rect of rects\"\n [attr.x]=\"rect.x\"\n [attr.y]=\"rect.y\"\n [attr.rx]=\"rect.rx\"\n [attr.width]=\"rect.width\"\n [attr.height]=\"rect.height\"\n [attr.fill]=\"rect.fill\"\n />\n <svg:g ngx-charts-heat-map-cell-series\n [xScale]=\"xScale\"\n [yScale]=\"yScale\"\n [colors]=\"colors\"\n [data]=\"results\"\n [gradient]=\"gradient\"\n [animations]=\"animations\"\n [tooltipDisabled]=\"tooltipDisabled\"\n [tooltipTemplate]=\"tooltipTemplate\"\n [tooltipText]=\"tooltipText\"\n (select)=\"onClick($event)\"\n />\n </svg:g>\n </ngx-charts-chart>\n ", changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectionStrategy"].OnPush, styles: [__webpack_require__("./src/common/base-chart.component.scss")], encapsulation: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ViewEncapsulation"].None }) ], HeatMapComponent); return HeatMapComponent; }(__WEBPACK_IMPORTED_MODULE_2__common_base_chart_component__["a" /* BaseChartComponent */])); /***/ }), /***/ "./src/heat-map/heat-map.module.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return HeatMapModule; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("@angular/core"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__common_chart_common_module__ = __webpack_require__("./src/common/chart-common.module.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__heat_map_cell_component__ = __webpack_require__("./src/heat-map/heat-map-cell.component.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__heat_map_cell_series_component__ = __webpack_require__("./src/heat-map/heat-map-cell-series.component.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__heat_map_component__ = __webpack_require__("./src/heat-map/heat-map.component.ts"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return __WEBPACK_IMPORTED_MODULE_2__heat_map_cell_component__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return __WEBPACK_IMPORTED_MODULE_3__heat_map_cell_series_component__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return __WEBPACK_IMPORTED_MODULE_4__heat_map_component__["a"]; }); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var HeatMapModule = /** @class */ (function () { function HeatMapModule() { } HeatMapModule = __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["NgModule"])({ imports: [__WEBPACK_IMPORTED_MODULE_1__common_chart_common_module__["a" /* ChartCommonModule */]], declarations: [ __WEBPACK_IMPORTED_MODULE_2__heat_map_cell_component__["a" /* HeatMapCellComponent */], __WEBPACK_IMPORTED_MODULE_3__heat_map_cell_series_component__["a" /* HeatCellSeriesComponent */], __WEBPACK_IMPORTED_MODULE_4__heat_map_component__["a" /* HeatMapComponent */] ], exports: [ __WEBPACK_IMPORTED_MODULE_2__heat_map_cell_component__["a" /* HeatMapCellComponent */], __WEBPACK_IMPORTED_MODULE_3__heat_map_cell_series_component__["a" /* HeatCellSeriesComponent */], __WEBPACK_IMPORTED_MODULE_4__heat_map_component__["a" /* HeatMapComponent */] ] }) ], HeatMapModule); return HeatMapModule; }()); /***/ }), /***/ "./src/heat-map/index.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__heat_map_module__ = __webpack_require__("./src/heat-map/heat-map.module.ts"); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "a", function() { return __WEBPACK_IMPORTED_MODULE_0__heat_map_module__["a"]; }); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "b", function() { return __WEBPACK_IMPORTED_MODULE_0__heat_map_module__["b"]; }); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "c", function() { return __WEBPACK_IMPORTED_MODULE_0__heat_map_module__["c"]; }); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "d", function() { return __WEBPACK_IMPORTED_MODULE_0__heat_map_module__["d"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__heat_map_component__ = __webpack_require__("./src/heat-map/heat-map.component.ts"); /* unused harmony namespace reexport */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__heat_map_cell_component__ = __webpack_require__("./src/heat-map/heat-map-cell.component.ts"); /* unused harmony namespace reexport */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__heat_map_cell_series_component__ = __webpack_require__("./src/heat-map/heat-map-cell-series.component.ts"); /* unused harmony namespace reexport */ /***/ }), /***/ "./src/index.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__ngx_charts_module__ = __webpack_require__("./src/ngx-charts.module.ts"); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "NgxChartsModule", function() { return __WEBPACK_IMPORTED_MODULE_0__ngx_charts_module__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__common__ = __webpack_require__("./src/common/index.ts"); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "ChartCommonModule", function() { return __WEBPACK_IMPORTED_MODULE_1__common__["e"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "ColorHelper", function() { return __WEBPACK_IMPORTED_MODULE_1__common__["i"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "ChartComponent", function() { return __WEBPACK_IMPORTED_MODULE_1__common__["f"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "AreaComponent", function() { return __WEBPACK_IMPORTED_MODULE_1__common__["c"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "BaseChartComponent", function() { return __WEBPACK_IMPORTED_MODULE_1__common__["d"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "CircleComponent", function() { return __WEBPACK_IMPORTED_MODULE_1__common__["g"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "CircleSeriesComponent", function() { return __WEBPACK_IMPORTED_MODULE_1__common__["h"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "gridSize", function() { return __WEBPACK_IMPORTED_MODULE_1__common__["E"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "gridLayout", function() { return __WEBPACK_IMPORTED_MODULE_1__common__["D"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "GridPanelComponent", function() { return __WEBPACK_IMPORTED_MODULE_1__common__["k"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "GridPanelSeriesComponent", function() { return __WEBPACK_IMPORTED_MODULE_1__common__["l"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "SvgLinearGradientComponent", function() { return __WEBPACK_IMPORTED_MODULE_1__common__["r"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "SvgRadialGradientComponent", function() { return __WEBPACK_IMPORTED_MODULE_1__common__["s"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "TooltipArea", function() { return __WEBPACK_IMPORTED_MODULE_1__common__["u"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "tickFormat", function() { return __WEBPACK_IMPORTED_MODULE_1__common__["F"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "trimLabel", function() { return __WEBPACK_IMPORTED_MODULE_1__common__["G"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "calculateViewDimensions", function() { return __WEBPACK_IMPORTED_MODULE_1__common__["z"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "formatLabel", function() { return __WEBPACK_IMPORTED_MODULE_1__common__["C"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "LegendComponent", function() { return __WEBPACK_IMPORTED_MODULE_1__common__["m"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "ScaleLegendComponent", function() { return __WEBPACK_IMPORTED_MODULE_1__common__["o"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "LegendEntryComponent", function() { return __WEBPACK_IMPORTED_MODULE_1__common__["n"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "AdvancedLegendComponent", function() { return __WEBPACK_IMPORTED_MODULE_1__common__["a"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "TooltipModule", function() { return __WEBPACK_IMPORTED_MODULE_1__common__["x"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "TooltipService", function() { return __WEBPACK_IMPORTED_MODULE_1__common__["y"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "TooltipContentComponent", function() { return __WEBPACK_IMPORTED_MODULE_1__common__["v"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "TooltipDirective", function() { return __WEBPACK_IMPORTED_MODULE_1__common__["w"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "StyleTypes", function() { return __WEBPACK_IMPORTED_MODULE_1__common__["q"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "AlignmentTypes", function() { return __WEBPACK_IMPORTED_MODULE_1__common__["b"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "ShowTypes", function() { return __WEBPACK_IMPORTED_MODULE_1__common__["p"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "CountUpDirective", function() { return __WEBPACK_IMPORTED_MODULE_1__common__["j"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "count", function() { return __WEBPACK_IMPORTED_MODULE_1__common__["A"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "decimalChecker", function() { return __WEBPACK_IMPORTED_MODULE_1__common__["B"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "Timeline", function() { return __WEBPACK_IMPORTED_MODULE_1__common__["t"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__area_chart__ = __webpack_require__("./src/area-chart/index.ts"); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "AreaChartComponent", function() { return __WEBPACK_IMPORTED_MODULE_2__area_chart__["a"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "AreaChartNormalizedComponent", function() { return __WEBPACK_IMPORTED_MODULE_2__area_chart__["c"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "AreaChartStackedComponent", function() { return __WEBPACK_IMPORTED_MODULE_2__area_chart__["d"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "AreaSeriesComponent", function() { return __WEBPACK_IMPORTED_MODULE_2__area_chart__["e"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "AreaChartModule", function() { return __WEBPACK_IMPORTED_MODULE_2__area_chart__["b"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__bar_chart__ = __webpack_require__("./src/bar-chart/index.ts"); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "BarLabelComponent", function() { return __WEBPACK_IMPORTED_MODULE_3__bar_chart__["g"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "BarComponent", function() { return __WEBPACK_IMPORTED_MODULE_3__bar_chart__["b"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "BarHorizontalComponent", function() { return __WEBPACK_IMPORTED_MODULE_3__bar_chart__["d"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "BarHorizontal2DComponent", function() { return __WEBPACK_IMPORTED_MODULE_3__bar_chart__["c"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "BarHorizontalNormalizedComponent", function() { return __WEBPACK_IMPORTED_MODULE_3__bar_chart__["e"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "BarHorizontalStackedComponent", function() { return __WEBPACK_IMPORTED_MODULE_3__bar_chart__["f"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "BarVerticalComponent", function() { return __WEBPACK_IMPORTED_MODULE_3__bar_chart__["i"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "BarVertical2DComponent", function() { return __WEBPACK_IMPORTED_MODULE_3__bar_chart__["h"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "BarVerticalNormalizedComponent", function() { return __WEBPACK_IMPORTED_MODULE_3__bar_chart__["j"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "BarVerticalStackedComponent", function() { return __WEBPACK_IMPORTED_MODULE_3__bar_chart__["k"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "SeriesHorizontal", function() { return __WEBPACK_IMPORTED_MODULE_3__bar_chart__["m"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "SeriesVerticalComponent", function() { return __WEBPACK_IMPORTED_MODULE_3__bar_chart__["n"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "BarChartModule", function() { return __WEBPACK_IMPORTED_MODULE_3__bar_chart__["a"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "D0Types", function() { return __WEBPACK_IMPORTED_MODULE_3__bar_chart__["l"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__bubble_chart__ = __webpack_require__("./src/bubble-chart/index.ts"); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "BubbleChartComponent", function() { return __WEBPACK_IMPORTED_MODULE_4__bubble_chart__["a"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "BubbleSeriesComponent", function() { return __WEBPACK_IMPORTED_MODULE_4__bubble_chart__["c"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "BubbleChartModule", function() { return __WEBPACK_IMPORTED_MODULE_4__bubble_chart__["b"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__force_directed_graph__ = __webpack_require__("./src/force-directed-graph/index.ts"); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "ForceDirectedGraphComponent", function() { return __WEBPACK_IMPORTED_MODULE_5__force_directed_graph__["a"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "ForceDirectedGraphModule", function() { return __WEBPACK_IMPORTED_MODULE_5__force_directed_graph__["b"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__heat_map__ = __webpack_require__("./src/heat-map/index.ts"); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "HeatMapCellComponent", function() { return __WEBPACK_IMPORTED_MODULE_6__heat_map__["b"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "HeatCellSeriesComponent", function() { return __WEBPACK_IMPORTED_MODULE_6__heat_map__["a"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "HeatMapComponent", function() { return __WEBPACK_IMPORTED_MODULE_6__heat_map__["c"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "HeatMapModule", function() { return __WEBPACK_IMPORTED_MODULE_6__heat_map__["d"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__line_chart__ = __webpack_require__("./src/line-chart/index.ts"); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "LineComponent", function() { return __WEBPACK_IMPORTED_MODULE_7__line_chart__["c"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "LineChartComponent", function() { return __WEBPACK_IMPORTED_MODULE_7__line_chart__["a"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "LineSeriesComponent", function() { return __WEBPACK_IMPORTED_MODULE_7__line_chart__["d"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "LineChartModule", function() { return __WEBPACK_IMPORTED_MODULE_7__line_chart__["b"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__polar_chart__ = __webpack_require__("./src/polar-chart/index.ts"); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "PolarChartComponent", function() { return __WEBPACK_IMPORTED_MODULE_8__polar_chart__["a"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "PolarSeriesComponent", function() { return __WEBPACK_IMPORTED_MODULE_8__polar_chart__["c"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "PolarChartModule", function() { return __WEBPACK_IMPORTED_MODULE_8__polar_chart__["b"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__number_card__ = __webpack_require__("./src/number-card/index.ts"); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "CardComponent", function() { return __WEBPACK_IMPORTED_MODULE_9__number_card__["a"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "CardSeriesComponent", function() { return __WEBPACK_IMPORTED_MODULE_9__number_card__["b"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "NumberCardComponent", function() { return __WEBPACK_IMPORTED_MODULE_9__number_card__["c"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "NumberCardModule", function() { return __WEBPACK_IMPORTED_MODULE_9__number_card__["d"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__pie_chart__ = __webpack_require__("./src/pie-chart/index.ts"); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "AdvancedPieChartComponent", function() { return __WEBPACK_IMPORTED_MODULE_10__pie_chart__["a"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "PieLabelComponent", function() { return __WEBPACK_IMPORTED_MODULE_10__pie_chart__["g"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "PieArcComponent", function() { return __WEBPACK_IMPORTED_MODULE_10__pie_chart__["b"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "PieChartComponent", function() { return __WEBPACK_IMPORTED_MODULE_10__pie_chart__["c"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "PieGridComponent", function() { return __WEBPACK_IMPORTED_MODULE_10__pie_chart__["e"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "PieGridSeriesComponent", function() { return __WEBPACK_IMPORTED_MODULE_10__pie_chart__["f"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "PieSeriesComponent", function() { return __WEBPACK_IMPORTED_MODULE_10__pie_chart__["h"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "PieChartModule", function() { return __WEBPACK_IMPORTED_MODULE_10__pie_chart__["d"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__tree_map__ = __webpack_require__("./src/tree-map/index.ts"); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "TreeMapCellComponent", function() { return __WEBPACK_IMPORTED_MODULE_11__tree_map__["a"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "TreeMapCellSeriesComponent", function() { return __WEBPACK_IMPORTED_MODULE_11__tree_map__["b"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "TreeMapComponent", function() { return __WEBPACK_IMPORTED_MODULE_11__tree_map__["c"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "TreeMapModule", function() { return __WEBPACK_IMPORTED_MODULE_11__tree_map__["d"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__gauge__ = __webpack_require__("./src/gauge/index.ts"); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "GaugeComponent", function() { return __WEBPACK_IMPORTED_MODULE_12__gauge__["c"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "GaugeArcComponent", function() { return __WEBPACK_IMPORTED_MODULE_12__gauge__["a"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "GaugeAxisComponent", function() { return __WEBPACK_IMPORTED_MODULE_12__gauge__["b"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "LinearGaugeComponent", function() { return __WEBPACK_IMPORTED_MODULE_12__gauge__["e"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "GaugeModule", function() { return __WEBPACK_IMPORTED_MODULE_12__gauge__["d"]; }); /***/ }), /***/ "./src/line-chart/index.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__line_chart_module__ = __webpack_require__("./src/line-chart/line-chart.module.ts"); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "a", function() { return __WEBPACK_IMPORTED_MODULE_0__line_chart_module__["a"]; }); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "b", function() { return __WEBPACK_IMPORTED_MODULE_0__line_chart_module__["b"]; }); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "c", function() { return __WEBPACK_IMPORTED_MODULE_0__line_chart_module__["c"]; }); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "d", function() { return __WEBPACK_IMPORTED_MODULE_0__line_chart_module__["d"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__line_chart_component__ = __webpack_require__("./src/line-chart/line-chart.component.ts"); /* unused harmony namespace reexport */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__line_component__ = __webpack_require__("./src/line-chart/line.component.ts"); /* unused harmony namespace reexport */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__line_series_component__ = __webpack_require__("./src/line-chart/line-series.component.ts"); /* unused harmony namespace reexport */ /***/ }), /***/ "./src/line-chart/line-chart.component.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return LineChartComponent; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("@angular/core"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_animations__ = __webpack_require__("@angular/animations"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_animations___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1__angular_animations__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_d3_scale__ = __webpack_require__("d3-scale"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_d3_scale___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_d3_scale__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_d3_shape__ = __webpack_require__("d3-shape"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_d3_shape___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_d3_shape__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__common_view_dimensions_helper__ = __webpack_require__("./src/common/view-dimensions.helper.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__common_color_helper__ = __webpack_require__("./src/common/color.helper.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__common_base_chart_component__ = __webpack_require__("./src/common/base-chart.component.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__utils_id__ = __webpack_require__("./src/utils/id.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__common_domain_helper__ = __webpack_require__("./src/common/domain.helper.ts"); var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var LineChartComponent = /** @class */ (function (_super) { __extends(LineChartComponent, _super); function LineChartComponent() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.legendTitle = 'Legend'; _this.showGridLines = true; _this.curve = __WEBPACK_IMPORTED_MODULE_3_d3_shape__["curveLinear"]; _this.activeEntries = []; _this.roundDomains = false; _this.tooltipDisabled = false; _this.showRefLines = false; _this.showRefLabels = true; _this.activate = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); _this.deactivate = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); _this.margin = [10, 20, 10, 20]; _this.xAxisHeight = 0; _this.yAxisWidth = 0; _this.timelineHeight = 50; _this.timelinePadding = 10; return _this; } LineChartComponent.prototype.update = function () { _super.prototype.update.call(this); this.dims = Object(__WEBPACK_IMPORTED_MODULE_4__common_view_dimensions_helper__["a" /* calculateViewDimensions */])({ width: this.width, height: this.height, margins: this.margin, showXAxis: this.xAxis, showYAxis: this.yAxis, xAxisHeight: this.xAxisHeight, yAxisWidth: this.yAxisWidth, showXLabel: this.showXAxisLabel, showYLabel: this.showYAxisLabel, showLegend: this.legend, legendType: this.schemeType, }); if (this.timeline) { this.dims.height -= (this.timelineHeight + this.margin[2] + this.timelinePadding); } this.xDomain = this.getXDomain(); if (this.filteredDomain) { this.xDomain = this.filteredDomain; } this.yDomain = this.getYDomain(); this.seriesDomain = this.getSeriesDomain(); this.xScale = this.getXScale(this.xDomain, this.dims.width); this.yScale = this.getYScale(this.yDomain, this.dims.height); this.updateTimeline(); this.setColors(); this.legendOptions = this.getLegendOptions(); this.transform = "translate(" + this.dims.xOffset + " , " + this.margin[0] + ")"; this.clipPathId = 'clip' + Object(__WEBPACK_IMPORTED_MODULE_7__utils_id__["a" /* id */])().toString(); this.clipPath = "url(#" + this.clipPathId + ")"; }; LineChartComponent.prototype.updateTimeline = function () { if (this.timeline) { this.timelineWidth = this.dims.width; this.timelineXDomain = this.getXDomain(); this.timelineXScale = this.getXScale(this.timelineXDomain, this.timelineWidth); this.timelineYScale = this.getYScale(this.yDomain, this.timelineHeight); this.timelineTransform = "translate(" + this.dims.xOffset + ", " + -this.margin[2] + ")"; } }; LineChartComponent.prototype.getXDomain = function () { var values = Object(__WEBPACK_IMPORTED_MODULE_8__common_domain_helper__["a" /* getUniqueXDomainValues */])(this.results); this.scaleType = this.getScaleType(values); var domain = []; if (this.scaleType === 'linear') { values = values.map(function (v) { return Number(v); }); } var min; var max; if (this.scaleType === 'time' || this.scaleType === 'linear') { min = this.xScaleMin ? this.xScaleMin : Math.min.apply(Math, values); max = this.xScaleMax ? this.xScaleMax : Math.max.apply(Math, values); } if (this.scaleType === 'time') { domain = [new Date(min), new Date(max)]; this.xSet = values.slice().sort(function (a, b) { var aDate = a.getTime(); var bDate = b.getTime(); if (aDate > bDate) return 1; if (bDate > aDate) return -1; return 0; }); } else if (this.scaleType === 'linear') { domain = [min, max]; // Use compare function to sort numbers numerically this.xSet = values.slice().sort(function (a, b) { return (a - b); }); } else { domain = values; this.xSet = values; } return domain; }; LineChartComponent.prototype.getYDomain = function () { var domain = []; for (var _i = 0, _a = this.results; _i < _a.length; _i++) { var results = _a[_i]; for (var _b = 0, _c = results.series; _b < _c.length; _b++) { var d = _c[_b]; if (domain.indexOf(d.value) < 0) { domain.push(d.value); } if (d.min !== undefined) { this.hasRange = true; if (domain.indexOf(d.min) < 0) { domain.push(d.min); } } if (d.max !== undefined) { this.hasRange = true; if (domain.indexOf(d.max) < 0) { domain.push(d.max); } } } } var values = domain.slice(); if (!this.autoScale) { values.push(0); } var min = this.yScaleMin ? this.yScaleMin : Math.min.apply(Math, values); var max = this.yScaleMax ? this.yScaleMax : Math.max.apply(Math, values); return [min, max]; }; LineChartComponent.prototype.getSeriesDomain = function () { return this.results.map(function (d) { return d.name; }); }; LineChartComponent.prototype.getXScale = function (domain, width) { var scale; if (this.scaleType === 'time') { scale = Object(__WEBPACK_IMPORTED_MODULE_2_d3_scale__["scaleTime"])() .range([0, width]) .domain(domain); } else if (this.scaleType === 'linear') { scale = Object(__WEBPACK_IMPORTED_MODULE_2_d3_scale__["scaleLinear"])() .range([0, width]) .domain(domain); if (this.roundDomains) { scale = scale.nice(); } } else if (this.scaleType === 'ordinal') { scale = Object(__WEBPACK_IMPORTED_MODULE_2_d3_scale__["scalePoint"])() .range([0, width]) .padding(0.1) .domain(domain); } return scale; }; LineChartComponent.prototype.getYScale = function (domain, height) { var scale = Object(__WEBPACK_IMPORTED_MODULE_2_d3_scale__["scaleLinear"])() .range([height, 0]) .domain(domain); return this.roundDomains ? scale.nice() : scale; }; LineChartComponent.prototype.getScaleType = function (values) { var date = true; var num = true; for (var _i = 0, values_1 = values; _i < values_1.length; _i++) { var value = values_1[_i]; if (!this.isDate(value)) { date = false; } if (typeof value !== 'number') { num = false; } } if (date) return 'time'; if (num) return 'linear'; return 'ordinal'; }; LineChartComponent.prototype.isDate = function (value) { if (value instanceof Date) { return true; } return false; }; LineChartComponent.prototype.updateDomain = function (domain) { this.filteredDomain = domain; this.xDomain = this.filteredDomain; this.xScale = this.getXScale(this.xDomain, this.dims.width); }; LineChartComponent.prototype.updateHoveredVertical = function (item) { this.hoveredVertical = item.value; this.deactivateAll(); }; LineChartComponent.prototype.hideCircles = function () { this.hoveredVertical = null; this.deactivateAll(); }; LineChartComponent.prototype.onClick = function (data, series) { if (series) { data.series = series.name; } this.select.emit(data); }; LineChartComponent.prototype.trackBy = function (index, item) { return item.name; }; LineChartComponent.prototype.setColors = function () { var domain; if (this.schemeType === 'ordinal') { domain = this.seriesDomain; } else { domain = this.yDomain; } this.colors = new __WEBPACK_IMPORTED_MODULE_5__common_color_helper__["a" /* ColorHelper */](this.scheme, this.schemeType, domain, this.customColors); }; LineChartComponent.prototype.getLegendOptions = function () { var opts = { scaleType: this.schemeType, colors: undefined, domain: [], title: undefined }; if (opts.scaleType === 'ordinal') { opts.domain = this.seriesDomain; opts.colors = this.colors; opts.title = this.legendTitle; } else { opts.domain = this.yDomain; opts.colors = this.colors.scale; } return opts; }; LineChartComponent.prototype.updateYAxisWidth = function (_a) { var width = _a.width; this.yAxisWidth = width; this.update(); }; LineChartComponent.prototype.updateXAxisHeight = function (_a) { var height = _a.height; this.xAxisHeight = height; this.update(); }; LineChartComponent.prototype.onActivate = function (item) { this.deactivateAll(); var idx = this.activeEntries.findIndex(function (d) { return d.name === item.name && d.value === item.value; }); if (idx > -1) { return; } this.activeEntries = [item]; this.activate.emit({ value: item, entries: this.activeEntries }); }; LineChartComponent.prototype.onDeactivate = function (item) { var idx = this.activeEntries.findIndex(function (d) { return d.name === item.name && d.value === item.value; }); this.activeEntries.splice(idx, 1); this.activeEntries = this.activeEntries.slice(); this.deactivate.emit({ value: item, entries: this.activeEntries }); }; LineChartComponent.prototype.deactivateAll = function () { this.activeEntries = this.activeEntries.slice(); for (var _i = 0, _a = this.activeEntries; _i < _a.length; _i++) { var entry = _a[_i]; this.deactivate.emit({ value: entry, entries: [] }); } this.activeEntries = []; }; __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], LineChartComponent.prototype, "legend", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", String) ], LineChartComponent.prototype, "legendTitle", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], LineChartComponent.prototype, "xAxis", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], LineChartComponent.prototype, "yAxis", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], LineChartComponent.prototype, "showXAxisLabel", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], LineChartComponent.prototype, "showYAxisLabel", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], LineChartComponent.prototype, "xAxisLabel", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], LineChartComponent.prototype, "yAxisLabel", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], LineChartComponent.prototype, "autoScale", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], LineChartComponent.prototype, "timeline", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], LineChartComponent.prototype, "gradient", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], LineChartComponent.prototype, "showGridLines", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], LineChartComponent.prototype, "curve", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Array) ], LineChartComponent.prototype, "activeEntries", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", String) ], LineChartComponent.prototype, "schemeType", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Number) ], LineChartComponent.prototype, "rangeFillOpacity", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], LineChartComponent.prototype, "xAxisTickFormatting", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], LineChartComponent.prototype, "yAxisTickFormatting", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Array) ], LineChartComponent.prototype, "xAxisTicks", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Array) ], LineChartComponent.prototype, "yAxisTicks", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], LineChartComponent.prototype, "roundDomains", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], LineChartComponent.prototype, "tooltipDisabled", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], LineChartComponent.prototype, "showRefLines", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], LineChartComponent.prototype, "referenceLines", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], LineChartComponent.prototype, "showRefLabels", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], LineChartComponent.prototype, "xScaleMin", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], LineChartComponent.prototype, "xScaleMax", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Number) ], LineChartComponent.prototype, "yScaleMin", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Number) ], LineChartComponent.prototype, "yScaleMax", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"]) ], LineChartComponent.prototype, "activate", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"]) ], LineChartComponent.prototype, "deactivate", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["ContentChild"])('tooltipTemplate'), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["TemplateRef"]) ], LineChartComponent.prototype, "tooltipTemplate", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["ContentChild"])('seriesTooltipTemplate'), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["TemplateRef"]) ], LineChartComponent.prototype, "seriesTooltipTemplate", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["HostListener"])('mouseleave'), __metadata("design:type", Function), __metadata("design:paramtypes", []), __metadata("design:returntype", void 0) ], LineChartComponent.prototype, "hideCircles", null); LineChartComponent = __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ selector: 'ngx-charts-line-chart', template: "\n <ngx-charts-chart\n [view]=\"[width, height]\"\n [showLegend]=\"legend\"\n [legendOptions]=\"legendOptions\"\n [activeEntries]=\"activeEntries\"\n [animations]=\"animations\"\n (legendLabelClick)=\"onClick($event)\"\n (legendLabelActivate)=\"onActivate($event)\"\n (legendLabelDeactivate)=\"onDeactivate($event)\">\n <svg:defs>\n <svg:clipPath [attr.id]=\"clipPathId\">\n <svg:rect\n [attr.width]=\"dims.width + 10\"\n [attr.height]=\"dims.height + 10\"\n [attr.transform]=\"'translate(-5, -5)'\"/>\n </svg:clipPath>\n </svg:defs>\n <svg:g [attr.transform]=\"transform\" class=\"line-chart chart\">\n <svg:g ngx-charts-x-axis\n *ngIf=\"xAxis\"\n [xScale]=\"xScale\"\n [dims]=\"dims\"\n [showGridLines]=\"showGridLines\"\n [showLabel]=\"showXAxisLabel\"\n [labelText]=\"xAxisLabel\"\n [tickFormatting]=\"xAxisTickFormatting\"\n [ticks]=\"xAxisTicks\"\n (dimensionsChanged)=\"updateXAxisHeight($event)\">\n </svg:g>\n <svg:g ngx-charts-y-axis\n *ngIf=\"yAxis\"\n [yScale]=\"yScale\"\n [dims]=\"dims\"\n [showGridLines]=\"showGridLines\"\n [showLabel]=\"showYAxisLabel\"\n [labelText]=\"yAxisLabel\"\n [tickFormatting]=\"yAxisTickFormatting\"\n [ticks]=\"yAxisTicks\"\n [referenceLines]=\"referenceLines\"\n [showRefLines]=\"showRefLines\"\n [showRefLabels]=\"showRefLabels\"\n (dimensionsChanged)=\"updateYAxisWidth($event)\">\n </svg:g>\n <svg:g [attr.clip-path]=\"clipPath\">\n <svg:g *ngFor=\"let series of results; trackBy:trackBy\" [@animationState]=\"'active'\">\n <svg:g ngx-charts-line-series\n [xScale]=\"xScale\"\n [yScale]=\"yScale\"\n [colors]=\"colors\"\n [data]=\"series\"\n [activeEntries]=\"activeEntries\"\n [scaleType]=\"scaleType\"\n [curve]=\"curve\"\n [rangeFillOpacity]=\"rangeFillOpacity\"\n [hasRange]=\"hasRange\"\n [animations]=\"animations\"\n />\n </svg:g>\n\n <svg:g *ngIf=\"!tooltipDisabled\" (mouseleave)=\"hideCircles()\">\n <svg:g ngx-charts-tooltip-area\n [dims]=\"dims\"\n [xSet]=\"xSet\"\n [xScale]=\"xScale\"\n [yScale]=\"yScale\"\n [results]=\"results\"\n [colors]=\"colors\"\n [tooltipDisabled]=\"tooltipDisabled\"\n [tooltipTemplate]=\"seriesTooltipTemplate\"\n (hover)=\"updateHoveredVertical($event)\"\n />\n\n <svg:g *ngFor=\"let series of results\">\n <svg:g ngx-charts-circle-series\n [xScale]=\"xScale\"\n [yScale]=\"yScale\"\n [colors]=\"colors\"\n [data]=\"series\"\n [scaleType]=\"scaleType\"\n [visibleValue]=\"hoveredVertical\"\n [activeEntries]=\"activeEntries\"\n [tooltipDisabled]=\"tooltipDisabled\"\n [tooltipTemplate]=\"tooltipTemplate\"\n (select)=\"onClick($event, series)\"\n (activate)=\"onActivate($event)\"\n (deactivate)=\"onDeactivate($event)\"\n />\n </svg:g>\n </svg:g>\n </svg:g>\n </svg:g>\n <svg:g ngx-charts-timeline\n *ngIf=\"timeline && scaleType != 'ordinal'\"\n [attr.transform]=\"timelineTransform\"\n [results]=\"results\"\n [view]=\"[timelineWidth, height]\"\n [height]=\"timelineHeight\"\n [scheme]=\"scheme\"\n [customColors]=\"customColors\"\n [scaleType]=\"scaleType\"\n [legend]=\"legend\"\n (onDomainChange)=\"updateDomain($event)\">\n <svg:g *ngFor=\"let series of results; trackBy:trackBy\">\n <svg:g ngx-charts-line-series\n [xScale]=\"timelineXScale\"\n [yScale]=\"timelineYScale\"\n [colors]=\"colors\"\n [data]=\"series\"\n [scaleType]=\"scaleType\"\n [curve]=\"curve\"\n [hasRange]=\"hasRange\"\n [animations]=\"animations\"\n />\n </svg:g>\n </svg:g>\n </ngx-charts-chart>\n ", styles: [__webpack_require__("./src/common/base-chart.component.scss")], encapsulation: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ViewEncapsulation"].None, changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectionStrategy"].OnPush, animations: [ Object(__WEBPACK_IMPORTED_MODULE_1__angular_animations__["trigger"])('animationState', [ Object(__WEBPACK_IMPORTED_MODULE_1__angular_animations__["transition"])(':leave', [ Object(__WEBPACK_IMPORTED_MODULE_1__angular_animations__["style"])({ opacity: 1, }), Object(__WEBPACK_IMPORTED_MODULE_1__angular_animations__["animate"])(500, Object(__WEBPACK_IMPORTED_MODULE_1__angular_animations__["style"])({ opacity: 0 })) ]) ]) ] }) ], LineChartComponent); return LineChartComponent; }(__WEBPACK_IMPORTED_MODULE_6__common_base_chart_component__["a" /* BaseChartComponent */])); /***/ }), /***/ "./src/line-chart/line-chart.module.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return LineChartModule; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("@angular/core"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__common_chart_common_module__ = __webpack_require__("./src/common/chart-common.module.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__line_component__ = __webpack_require__("./src/line-chart/line.component.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__line_chart_component__ = __webpack_require__("./src/line-chart/line-chart.component.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__line_series_component__ = __webpack_require__("./src/line-chart/line-series.component.ts"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return __WEBPACK_IMPORTED_MODULE_2__line_component__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return __WEBPACK_IMPORTED_MODULE_3__line_chart_component__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return __WEBPACK_IMPORTED_MODULE_4__line_series_component__["a"]; }); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var LineChartModule = /** @class */ (function () { function LineChartModule() { } LineChartModule = __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["NgModule"])({ imports: [__WEBPACK_IMPORTED_MODULE_1__common_chart_common_module__["a" /* ChartCommonModule */]], declarations: [ __WEBPACK_IMPORTED_MODULE_2__line_component__["a" /* LineComponent */], __WEBPACK_IMPORTED_MODULE_3__line_chart_component__["a" /* LineChartComponent */], __WEBPACK_IMPORTED_MODULE_4__line_series_component__["a" /* LineSeriesComponent */] ], exports: [ __WEBPACK_IMPORTED_MODULE_2__line_component__["a" /* LineComponent */], __WEBPACK_IMPORTED_MODULE_3__line_chart_component__["a" /* LineChartComponent */], __WEBPACK_IMPORTED_MODULE_4__line_series_component__["a" /* LineSeriesComponent */] ] }) ], LineChartModule); return LineChartModule; }()); /***/ }), /***/ "./src/line-chart/line-series.component.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return LineSeriesComponent; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("@angular/core"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_d3_shape__ = __webpack_require__("d3-shape"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_d3_shape___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_d3_shape__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__utils_id__ = __webpack_require__("./src/utils/id.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__utils_sort__ = __webpack_require__("./src/utils/sort.ts"); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var LineSeriesComponent = /** @class */ (function () { function LineSeriesComponent() { this.animations = true; } LineSeriesComponent.prototype.ngOnChanges = function (changes) { this.update(); }; LineSeriesComponent.prototype.update = function () { this.updateGradients(); var data = this.sortData(this.data.series); var lineGen = this.getLineGenerator(); this.path = lineGen(data) || ''; var areaGen = this.getAreaGenerator(); this.areaPath = areaGen(data) || ''; if (this.hasRange) { var range = this.getRangeGenerator(); this.outerPath = range(data) || ''; } if (this.hasGradient) { this.stroke = this.gradientUrl; var values = this.data.series.map(function (d) { return d.value; }); var max = Math.max.apply(Math, values); var min = Math.min.apply(Math, values); if (max === min) { this.stroke = this.colors.getColor(max); } } else { this.stroke = this.colors.getColor(this.data.name); } }; LineSeriesComponent.prototype.getLineGenerator = function () { var _this = this; return Object(__WEBPACK_IMPORTED_MODULE_1_d3_shape__["line"])() .x(function (d) { var label = d.name; var value; if (_this.scaleType === 'time') { value = _this.xScale(label); } else if (_this.scaleType === 'linear') { value = _this.xScale(Number(label)); } else { value = _this.xScale(label); } return value; }) .y(function (d) { return _this.yScale(d.value); }) .curve(this.curve); }; LineSeriesComponent.prototype.getRangeGenerator = function () { var _this = this; return Object(__WEBPACK_IMPORTED_MODULE_1_d3_shape__["area"])() .x(function (d) { var label = d.name; var value; if (_this.scaleType === 'time') { value = _this.xScale(label); } else if (_this.scaleType === 'linear') { value = _this.xScale(Number(label)); } else { value = _this.xScale(label); } return value; }) .y0(function (d) { return _this.yScale(d.min ? d.min : d.value); }) .y1(function (d) { return _this.yScale(d.max ? d.max : d.value); }) .curve(this.curve); }; LineSeriesComponent.prototype.getAreaGenerator = function () { var _this = this; var xProperty = function (d) { var label = d.name; return _this.xScale(label); }; return Object(__WEBPACK_IMPORTED_MODULE_1_d3_shape__["area"])() .x(xProperty) .y0(function () { return _this.yScale.range()[0]; }) .y1(function (d) { return _this.yScale(d.value); }) .curve(this.curve); }; LineSeriesComponent.prototype.sortData = function (data) { if (this.scaleType === 'linear') { data = Object(__WEBPACK_IMPORTED_MODULE_3__utils_sort__["c" /* sortLinear */])(data, 'name'); } else if (this.scaleType === 'time') { data = Object(__WEBPACK_IMPORTED_MODULE_3__utils_sort__["b" /* sortByTime */])(data, 'name'); } else { data = Object(__WEBPACK_IMPORTED_MODULE_3__utils_sort__["a" /* sortByDomain */])(data, 'name', 'asc', this.xScale.domain()); } return data; }; LineSeriesComponent.prototype.updateGradients = function () { if (this.colors.scaleType === 'linear') { this.hasGradient = true; this.gradientId = 'grad' + Object(__WEBPACK_IMPORTED_MODULE_2__utils_id__["a" /* id */])().toString(); this.gradientUrl = "url(#" + this.gradientId + ")"; var values = this.data.series.map(function (d) { return d.value; }); var max = Math.max.apply(Math, values); var min = Math.min.apply(Math, values); this.gradientStops = this.colors.getLinearGradientStops(max, min); this.areaGradientStops = this.colors.getLinearGradientStops(max); } else { this.hasGradient = false; this.gradientStops = undefined; this.areaGradientStops = undefined; } }; LineSeriesComponent.prototype.isActive = function (entry) { if (!this.activeEntries) return false; var item = this.activeEntries.find(function (d) { return entry.name === d.name; }); return item !== undefined; }; LineSeriesComponent.prototype.isInactive = function (entry) { if (!this.activeEntries || this.activeEntries.length === 0) return false; var item = this.activeEntries.find(function (d) { return entry.name === d.name; }); return item === undefined; }; __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], LineSeriesComponent.prototype, "data", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], LineSeriesComponent.prototype, "xScale", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], LineSeriesComponent.prototype, "yScale", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], LineSeriesComponent.prototype, "colors", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], LineSeriesComponent.prototype, "scaleType", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], LineSeriesComponent.prototype, "curve", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Array) ], LineSeriesComponent.prototype, "activeEntries", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Number) ], LineSeriesComponent.prototype, "rangeFillOpacity", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], LineSeriesComponent.prototype, "hasRange", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], LineSeriesComponent.prototype, "animations", void 0); LineSeriesComponent = __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ selector: 'g[ngx-charts-line-series]', template: "\n <svg:g>\n <defs>\n <svg:g ngx-charts-svg-linear-gradient *ngIf=\"hasGradient\"\n orientation=\"vertical\"\n [name]=\"gradientId\"\n [stops]=\"gradientStops\"\n />\n </defs>\n <svg:g ngx-charts-area\n class=\"line-highlight\"\n [data]=\"data\"\n [path]=\"areaPath\"\n [fill]=\"hasGradient ? gradientUrl : colors.getColor(data.name)\"\n [opacity]=\"0.25\"\n [startOpacity]=\"0\"\n [gradient]=\"true\"\n [stops]=\"areaGradientStops\"\n [class.active]=\"isActive(data)\"\n [class.inactive]=\"isInactive(data)\"\n />\n <svg:g ngx-charts-line\n class=\"line-series\"\n [data]=\"data\"\n [path]=\"path\"\n [stroke]=\"stroke\"\n [animations]=\"animations\"\n [class.active]=\"isActive(data)\"\n [class.inactive]=\"isInactive(data)\"\n />\n <svg:g ngx-charts-area\n *ngIf=\"hasRange\"\n class=\"line-series-range\"\n [data]=\"data\"\n [path]=\"outerPath\"\n [fill]=\"hasGradient ? gradientUrl : colors.getColor(data.name)\"\n [class.active]=\"isActive(data)\"\n [class.inactive]=\"isInactive(data)\"\n [opacity]=\"rangeFillOpacity\"\n [animations]=\"animations\"\n />\n </svg:g>\n ", changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectionStrategy"].OnPush }) ], LineSeriesComponent); return LineSeriesComponent; }()); /***/ }), /***/ "./src/line-chart/line.component.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return LineComponent; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("@angular/core"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_animations__ = __webpack_require__("@angular/animations"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_animations___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1__angular_animations__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_d3_selection__ = __webpack_require__("d3-selection"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_d3_selection___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_d3_selection__); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var LineComponent = /** @class */ (function () { function LineComponent(element) { this.element = element; this.fill = 'none'; this.animations = true; this.select = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); this.initialized = false; } LineComponent.prototype.ngOnChanges = function (changes) { if (!this.initialized) { this.initialized = true; this.initialPath = this.path; } else { this.updatePathEl(); } }; LineComponent.prototype.updatePathEl = function () { var node = Object(__WEBPACK_IMPORTED_MODULE_2_d3_selection__["select"])(this.element.nativeElement).select('.line'); if (this.animations) { node .transition().duration(750) .attr('d', this.path); } else { node.attr('d', this.path); } }; __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], LineComponent.prototype, "path", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], LineComponent.prototype, "stroke", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], LineComponent.prototype, "data", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", String) ], LineComponent.prototype, "fill", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], LineComponent.prototype, "animations", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", Object) ], LineComponent.prototype, "select", void 0); LineComponent = __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ selector: 'g[ngx-charts-line]', template: "\n <svg:path\n [@animationState]=\"'active'\"\n class=\"line\"\n [attr.d]=\"initialPath\"\n [attr.fill]=\"fill\"\n [attr.stroke]=\"stroke\"\n stroke-width=\"1.5px\"\n />\n ", changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectionStrategy"].OnPush, animations: [ Object(__WEBPACK_IMPORTED_MODULE_1__angular_animations__["trigger"])('animationState', [ Object(__WEBPACK_IMPORTED_MODULE_1__angular_animations__["transition"])(':enter', [ Object(__WEBPACK_IMPORTED_MODULE_1__angular_animations__["style"])({ strokeDasharray: 2000, strokeDashoffset: 2000, }), Object(__WEBPACK_IMPORTED_MODULE_1__angular_animations__["animate"])(1000, Object(__WEBPACK_IMPORTED_MODULE_1__angular_animations__["style"])({ strokeDashoffset: 0 })) ]) ]) ] }), __metadata("design:paramtypes", [__WEBPACK_IMPORTED_MODULE_0__angular_core__["ElementRef"]]) ], LineComponent); return LineComponent; }()); /***/ }), /***/ "./src/ngx-charts.module.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NgxChartsModule; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__polyfills__ = __webpack_require__("./src/polyfills.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_core__ = __webpack_require__("@angular/core"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1__angular_core__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__common_chart_common_module__ = __webpack_require__("./src/common/chart-common.module.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__area_chart_area_chart_module__ = __webpack_require__("./src/area-chart/area-chart.module.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__bar_chart_bar_chart_module__ = __webpack_require__("./src/bar-chart/bar-chart.module.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__bubble_chart_bubble_chart_module__ = __webpack_require__("./src/bubble-chart/bubble-chart.module.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__force_directed_graph_force_directed_graph_module__ = __webpack_require__("./src/force-directed-graph/force-directed-graph.module.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__heat_map_heat_map_module__ = __webpack_require__("./src/heat-map/heat-map.module.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__line_chart_line_chart_module__ = __webpack_require__("./src/line-chart/line-chart.module.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__polar_chart_polar_chart_module__ = __webpack_require__("./src/polar-chart/polar-chart.module.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__number_card_number_card_module__ = __webpack_require__("./src/number-card/number-card.module.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__pie_chart_pie_chart_module__ = __webpack_require__("./src/pie-chart/pie-chart.module.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__tree_map_tree_map_module__ = __webpack_require__("./src/tree-map/tree-map.module.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__gauge_gauge_module__ = __webpack_require__("./src/gauge/gauge.module.ts"); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var NgxChartsModule = /** @class */ (function () { function NgxChartsModule() { } NgxChartsModule = __decorate([ Object(__WEBPACK_IMPORTED_MODULE_1__angular_core__["NgModule"])({ exports: [ __WEBPACK_IMPORTED_MODULE_2__common_chart_common_module__["a" /* ChartCommonModule */], __WEBPACK_IMPORTED_MODULE_3__area_chart_area_chart_module__["b" /* AreaChartModule */], __WEBPACK_IMPORTED_MODULE_4__bar_chart_bar_chart_module__["a" /* BarChartModule */], __WEBPACK_IMPORTED_MODULE_5__bubble_chart_bubble_chart_module__["b" /* BubbleChartModule */], __WEBPACK_IMPORTED_MODULE_6__force_directed_graph_force_directed_graph_module__["b" /* ForceDirectedGraphModule */], __WEBPACK_IMPORTED_MODULE_7__heat_map_heat_map_module__["d" /* HeatMapModule */], __WEBPACK_IMPORTED_MODULE_8__line_chart_line_chart_module__["b" /* LineChartModule */], __WEBPACK_IMPORTED_MODULE_9__polar_chart_polar_chart_module__["b" /* PolarChartModule */], __WEBPACK_IMPORTED_MODULE_10__number_card_number_card_module__["d" /* NumberCardModule */], __WEBPACK_IMPORTED_MODULE_11__pie_chart_pie_chart_module__["d" /* PieChartModule */], __WEBPACK_IMPORTED_MODULE_12__tree_map_tree_map_module__["d" /* TreeMapModule */], __WEBPACK_IMPORTED_MODULE_13__gauge_gauge_module__["d" /* GaugeModule */] ] }) ], NgxChartsModule); return NgxChartsModule; }()); /***/ }), /***/ "./src/number-card/card-series.component.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return CardSeriesComponent; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("@angular/core"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__utils_color_utils__ = __webpack_require__("./src/utils/color-utils.ts"); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var CardSeriesComponent = /** @class */ (function () { function CardSeriesComponent() { this.innerPadding = 15; this.emptyColor = 'rgba(0, 0, 0, 0)'; this.animations = true; this.select = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); } CardSeriesComponent.prototype.ngOnChanges = function (changes) { this.update(); }; CardSeriesComponent.prototype.update = function () { if (this.data.length > 2) { var valueFormatting_1 = this.valueFormatting || (function (card) { return card.value.toLocaleString(); }); var sortedLengths = this.data .map(function (d) { var hasValue = d && d.data && typeof d.data.value !== 'undefined' && d.data.value !== null; return hasValue ? valueFormatting_1({ data: d.data, label: d ? d.data.name : '', value: (d && d.data) ? d.data.value : '' }).length : 0; }) .sort(function (a, b) { return b - a; }); var idx = Math.ceil(this.data.length / 2); this.medianSize = sortedLengths[idx]; } var cards = this.getCards(); this.cards = cards.filter(function (d) { return d.data.value !== null; }); this.emptySlots = cards.filter(function (d) { return d.data.value === null; }); }; CardSeriesComponent.prototype.getCards = function () { var _this = this; var yPadding = typeof this.innerPadding === 'number' ? this.innerPadding : this.innerPadding[0] + this.innerPadding[2]; var xPadding = typeof this.innerPadding === 'number' ? this.innerPadding : this.innerPadding[1] + this.innerPadding[3]; return this.data .map(function (d, index) { var label = d.data.name; if (label && label.constructor.name === 'Date') { label = label.toLocaleDateString(); } else { label = label ? label.toLocaleString() : label; } d.data.name = label; var value = d.data.value; var valueColor = label ? _this.colors.getColor(label) : _this.emptyColor; var color = _this.cardColor || valueColor || '#000'; return { x: d.x, y: d.y, width: d.width - xPadding, height: d.height - yPadding, color: color, bandColor: _this.bandColor || valueColor, textColor: _this.textColor || Object(__WEBPACK_IMPORTED_MODULE_1__utils_color_utils__["a" /* invertColor */])(color), label: label, data: d.data, tooltipText: label + ": " + value }; }); }; CardSeriesComponent.prototype.trackBy = function (index, card) { return card.label; }; CardSeriesComponent.prototype.onClick = function (data) { this.select.emit(data); }; __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Array) ], CardSeriesComponent.prototype, "data", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Array) ], CardSeriesComponent.prototype, "slots", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], CardSeriesComponent.prototype, "dims", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], CardSeriesComponent.prototype, "colors", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], CardSeriesComponent.prototype, "innerPadding", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], CardSeriesComponent.prototype, "cardColor", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], CardSeriesComponent.prototype, "bandColor", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], CardSeriesComponent.prototype, "emptyColor", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], CardSeriesComponent.prototype, "textColor", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], CardSeriesComponent.prototype, "valueFormatting", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], CardSeriesComponent.prototype, "labelFormatting", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], CardSeriesComponent.prototype, "animations", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", Object) ], CardSeriesComponent.prototype, "select", void 0); CardSeriesComponent = __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ selector: 'g[ngx-charts-card-series]', template: "\n <svg:rect\n *ngFor=\"let c of emptySlots; trackBy:trackBy\"\n class=\"card-empty\"\n [attr.x]=\"c.x\"\n [attr.y]=\"c.y\"\n [style.fill]=\"emptyColor\"\n [attr.width]=\"c.width\"\n [attr.height]=\"c.height\"\n rx=\"3\"\n ry=\"3\"\n />\n <svg:g ngx-charts-card *ngFor=\"let c of cards; trackBy:trackBy\"\n [x]=\"c.x\"\n [y]=\"c.y\"\n [width]=\"c.width\"\n [height]=\"c.height\"\n [color]=\"c.color\"\n [bandColor]=\"c.bandColor\"\n [textColor]=\"c.textColor\"\n [data]=\"c.data\"\n [medianSize]=\"medianSize\"\n [valueFormatting]=\"valueFormatting\"\n [labelFormatting]=\"labelFormatting\"\n [animations]=\"animations\"\n (select)=\"onClick($event)\"\n />\n ", changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectionStrategy"].OnPush }) ], CardSeriesComponent); return CardSeriesComponent; }()); /***/ }), /***/ "./src/number-card/card.component.scss": /***/ (function(module, exports, __webpack_require__) { var result = __webpack_require__("./node_modules/css-loader/index.js!./node_modules/postcss-loader/index.js!./node_modules/sass-loader/lib/loader.js??ref--3-4!./src/number-card/card.component.scss"); if (typeof result === "string") { module.exports = result; } else { module.exports = result.toString(); } /***/ }), /***/ "./src/number-card/card.component.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return CardComponent; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("@angular/core"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__common_trim_label_helper__ = __webpack_require__("./src/common/trim-label.helper.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__common_shape_helper__ = __webpack_require__("./src/common/shape.helper.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__common_count__ = __webpack_require__("./src/common/count/index.ts"); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var CardComponent = /** @class */ (function () { function CardComponent(element, cd, zone) { this.cd = cd; this.zone = zone; this.animations = true; this.select = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); this.value = ''; this.textFontSize = 12; this.textTransform = ''; this.initialized = false; this.bandHeight = 10; this.textPadding = [10, 20, 5, 20]; this.labelFontSize = 15; this.element = element.nativeElement; } CardComponent.prototype.ngOnChanges = function (changes) { this.update(); }; CardComponent.prototype.ngOnDestroy = function () { cancelAnimationFrame(this.animationReq); }; CardComponent.prototype.update = function () { var _this = this; this.zone.run(function () { var hasValue = _this.data && typeof _this.data.value !== 'undefined'; var valueFormatting = _this.valueFormatting || (function (card) { return card.value.toLocaleString(); }); var labelFormatting = _this.labelFormatting || (function (card) { return Object(__WEBPACK_IMPORTED_MODULE_1__common_trim_label_helper__["a" /* trimLabel */])(card.label, 55); }); _this.transform = "translate(" + _this.x + " , " + _this.y + ")"; _this.textWidth = Math.max(0, _this.width) - _this.textPadding[1] - _this.textPadding[3]; _this.cardWidth = Math.max(0, _this.width); _this.cardHeight = Math.max(0, _this.height); _this.label = _this.data ? _this.data.name : ''; var cardData = { label: _this.label, data: _this.data, value: _this.data.value }; _this.formattedLabel = labelFormatting(cardData); _this.transformBand = "translate(0 , " + (_this.cardHeight - _this.bandHeight) + ")"; var value = hasValue ? valueFormatting(cardData) : ''; _this.value = _this.paddedValue(value); _this.setPadding(); _this.bandPath = Object(__WEBPACK_IMPORTED_MODULE_2__common_shape_helper__["a" /* roundedRect */])(0, 0, _this.cardWidth, _this.bandHeight, 3, [false, false, true, true]); setTimeout(function () { _this.scaleText(); _this.value = value; if (hasValue && !_this.initialized) { setTimeout(function () { return _this.startCount(); }, 20); } }, 8); }); }; CardComponent.prototype.paddedValue = function (value) { if (this.medianSize && this.medianSize > value.length) { value += '\u2007'.repeat(this.medianSize - value.length); } return value; }; CardComponent.prototype.startCount = function () { var _this = this; if (!this.initialized && this.animations) { cancelAnimationFrame(this.animationReq); var val_1 = this.data.value; var decs = Object(__WEBPACK_IMPORTED_MODULE_3__common_count__["c" /* decimalChecker */])(val_1); var valueFormatting_1 = this.valueFormatting || (function (card) { return card.value.toLocaleString(); }); var callback = function (_a) { var value = _a.value, finished = _a.finished; _this.zone.run(function () { value = finished ? val_1 : value; _this.value = valueFormatting_1({ label: _this.label, data: _this.data, value: value }); if (!finished) { _this.value = _this.paddedValue(_this.value); } _this.cd.markForCheck(); }); }; this.animationReq = Object(__WEBPACK_IMPORTED_MODULE_3__common_count__["b" /* count */])(0, val_1, decs, 1, callback); this.initialized = true; } }; CardComponent.prototype.scaleText = function () { var _this = this; this.zone.run(function () { var _a = _this.textEl.nativeElement.getBoundingClientRect(), width = _a.width, height = _a.height; if (width === 0 || height === 0) { return; } var textPadding = _this.textPadding[1] = _this.textPadding[3] = _this.cardWidth / 8; var availableWidth = _this.cardWidth - 2 * textPadding; var availableHeight = _this.cardHeight / 3; var resizeScale = Math.min(availableWidth / width, availableHeight / height); _this.textFontSize = Math.floor(_this.textFontSize * resizeScale); _this.labelFontSize = Math.min(_this.textFontSize, 15); _this.setPadding(); _this.cd.markForCheck(); }); }; CardComponent.prototype.setPadding = function () { this.textPadding[1] = this.textPadding[3] = this.cardWidth / 8; var padding = this.cardHeight / 2; this.textPadding[0] = padding - this.textFontSize - this.labelFontSize / 2; this.textPadding[2] = padding - this.labelFontSize; }; CardComponent.prototype.onClick = function () { this.select.emit({ name: this.data.name, value: this.data.value }); }; __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], CardComponent.prototype, "color", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], CardComponent.prototype, "bandColor", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], CardComponent.prototype, "textColor", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], CardComponent.prototype, "x", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], CardComponent.prototype, "y", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], CardComponent.prototype, "width", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], CardComponent.prototype, "height", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], CardComponent.prototype, "label", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], CardComponent.prototype, "data", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Number) ], CardComponent.prototype, "medianSize", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], CardComponent.prototype, "valueFormatting", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], CardComponent.prototype, "labelFormatting", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], CardComponent.prototype, "animations", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", Object) ], CardComponent.prototype, "select", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["ViewChild"])('textEl'), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["ElementRef"]) ], CardComponent.prototype, "textEl", void 0); CardComponent = __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ selector: 'g[ngx-charts-card]', template: "\n <svg:g\n [attr.transform]=\"transform\"\n class=\"cell\"\n (click)=\"onClick()\">\n <svg:rect\n class=\"card\"\n [style.fill]=\"color\"\n [attr.width]=\"cardWidth\"\n [attr.height]=\"cardHeight\"\n rx=\"3\"\n ry=\"3\"\n />\n <svg:path\n *ngIf=\"bandColor && bandColor !== color\"\n class=\"card-band\"\n [attr.fill]=\"bandColor\"\n [attr.transform]=\"transformBand\"\n stroke=\"none\"\n [attr.d]=\"bandPath\"\n />\n <title>{{label}}</title>\n <svg:foreignObject\n class=\"trimmed-label\"\n x=\"5\"\n [attr.x]=\"textPadding[3]\"\n [attr.y]=\"cardHeight - textPadding[2]\"\n [attr.width]=\"textWidth\"\n [attr.height]=\"labelFontSize + textPadding[2]\"\n alignment-baseline=\"hanging\">\n <xhtml:p\n [style.color]=\"textColor\"\n [style.fontSize.px]=\"labelFontSize\"\n [style.lineHeight.px]=\"labelFontSize\"\n [innerHTML]=\"formattedLabel\">\n </xhtml:p>\n </svg:foreignObject>\n <svg:text #textEl\n class=\"value-text\"\n [attr.x]=\"textPadding[3]\"\n [attr.y]=\"textPadding[0]\"\n [style.fill]=\"textColor\"\n text-anchor=\"start\"\n alignment-baseline=\"hanging\"\n [style.font-size.pt]=\"textFontSize\">\n {{value}}\n </svg:text>\n </svg:g>\n ", changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectionStrategy"].OnPush }), __metadata("design:paramtypes", [__WEBPACK_IMPORTED_MODULE_0__angular_core__["ElementRef"], __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectorRef"], __WEBPACK_IMPORTED_MODULE_0__angular_core__["NgZone"]]) ], CardComponent); return CardComponent; }()); /***/ }), /***/ "./src/number-card/index.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__number_card_module__ = __webpack_require__("./src/number-card/number-card.module.ts"); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "a", function() { return __WEBPACK_IMPORTED_MODULE_0__number_card_module__["a"]; }); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "b", function() { return __WEBPACK_IMPORTED_MODULE_0__number_card_module__["b"]; }); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "c", function() { return __WEBPACK_IMPORTED_MODULE_0__number_card_module__["c"]; }); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "d", function() { return __WEBPACK_IMPORTED_MODULE_0__number_card_module__["d"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__number_card_component__ = __webpack_require__("./src/number-card/number-card.component.ts"); /* unused harmony namespace reexport */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__card_component__ = __webpack_require__("./src/number-card/card.component.ts"); /* unused harmony namespace reexport */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__card_series_component__ = __webpack_require__("./src/number-card/card-series.component.ts"); /* unused harmony namespace reexport */ /***/ }), /***/ "./src/number-card/number-card.component.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NumberCardComponent; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("@angular/core"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__common_base_chart_component__ = __webpack_require__("./src/common/base-chart.component.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__common_view_dimensions_helper__ = __webpack_require__("./src/common/view-dimensions.helper.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__common_color_helper__ = __webpack_require__("./src/common/color.helper.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__common_grid_layout_helper__ = __webpack_require__("./src/common/grid-layout.helper.ts"); var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var NumberCardComponent = /** @class */ (function (_super) { __extends(NumberCardComponent, _super); function NumberCardComponent() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.emptyColor = 'rgba(0, 0, 0, 0)'; _this.innerPadding = 15; _this.margin = [10, 10, 10, 10]; return _this; } Object.defineProperty(NumberCardComponent.prototype, "clickable", { get: function () { return !!this.select.observers.length; }, enumerable: true, configurable: true }); NumberCardComponent.prototype.update = function () { _super.prototype.update.call(this); this.dims = Object(__WEBPACK_IMPORTED_MODULE_2__common_view_dimensions_helper__["a" /* calculateViewDimensions */])({ width: this.width, height: this.height, margins: this.margin }); this.domain = this.getDomain(); this.setColors(); this.transform = "translate(" + this.dims.xOffset + " , " + this.margin[0] + ")"; var size = Object(__WEBPACK_IMPORTED_MODULE_4__common_grid_layout_helper__["b" /* gridSize */])(this.dims, this.results.length, 150); var N = size[0] * size[1]; var data = this.results.slice(); while (data.length < N) { data.push({ value: null }); } this.data = Object(__WEBPACK_IMPORTED_MODULE_4__common_grid_layout_helper__["a" /* gridLayout */])(this.dims, data, 150, this.designatedTotal); }; NumberCardComponent.prototype.getDomain = function () { return this.results.map(function (d) { return d.name; }); }; NumberCardComponent.prototype.onClick = function (data) { this.select.emit(data); }; NumberCardComponent.prototype.setColors = function () { this.colors = new __WEBPACK_IMPORTED_MODULE_3__common_color_helper__["a" /* ColorHelper */](this.scheme, 'ordinal', this.domain, this.customColors); }; __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", String) ], NumberCardComponent.prototype, "cardColor", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", String) ], NumberCardComponent.prototype, "bandColor", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", String) ], NumberCardComponent.prototype, "emptyColor", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], NumberCardComponent.prototype, "innerPadding", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", String) ], NumberCardComponent.prototype, "textColor", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], NumberCardComponent.prototype, "valueFormatting", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], NumberCardComponent.prototype, "labelFormatting", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Number) ], NumberCardComponent.prototype, "designatedTotal", void 0); NumberCardComponent = __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ selector: 'ngx-charts-number-card', template: "\n <ngx-charts-chart\n [view]=\"[width, height]\"\n [showLegend]=\"false\"\n [animations]=\"animations\">\n <svg:g [attr.transform]=\"transform\" class=\"number-card chart\" [class.clickable]=\"clickable\">\n <svg:g ngx-charts-card-series\n [colors]=\"colors\"\n [cardColor]=\"cardColor\"\n [bandColor]=\"bandColor\"\n [textColor]=\"textColor\"\n [emptyColor]=\"emptyColor\"\n [data]=\"data\"\n [dims]=\"dims\"\n [innerPadding]=\"innerPadding\"\n [valueFormatting]=\"valueFormatting\"\n [labelFormatting]=\"labelFormatting\"\n [animations]=\"animations\"\n (select)=\"onClick($event)\"\n />\n </svg:g>\n </ngx-charts-chart>\n ", styles: [ __webpack_require__("./src/common/base-chart.component.scss"), __webpack_require__("./src/number-card/card.component.scss") ], encapsulation: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ViewEncapsulation"].None, changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectionStrategy"].OnPush }) ], NumberCardComponent); return NumberCardComponent; }(__WEBPACK_IMPORTED_MODULE_1__common_base_chart_component__["a" /* BaseChartComponent */])); /***/ }), /***/ "./src/number-card/number-card.module.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return NumberCardModule; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("@angular/core"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__common_chart_common_module__ = __webpack_require__("./src/common/chart-common.module.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__card_component__ = __webpack_require__("./src/number-card/card.component.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__card_series_component__ = __webpack_require__("./src/number-card/card-series.component.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__number_card_component__ = __webpack_require__("./src/number-card/number-card.component.ts"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return __WEBPACK_IMPORTED_MODULE_2__card_component__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return __WEBPACK_IMPORTED_MODULE_3__card_series_component__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return __WEBPACK_IMPORTED_MODULE_4__number_card_component__["a"]; }); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var NumberCardModule = /** @class */ (function () { function NumberCardModule() { } NumberCardModule = __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["NgModule"])({ imports: [__WEBPACK_IMPORTED_MODULE_1__common_chart_common_module__["a" /* ChartCommonModule */]], declarations: [ __WEBPACK_IMPORTED_MODULE_2__card_component__["a" /* CardComponent */], __WEBPACK_IMPORTED_MODULE_3__card_series_component__["a" /* CardSeriesComponent */], __WEBPACK_IMPORTED_MODULE_4__number_card_component__["a" /* NumberCardComponent */] ], exports: [ __WEBPACK_IMPORTED_MODULE_2__card_component__["a" /* CardComponent */], __WEBPACK_IMPORTED_MODULE_3__card_series_component__["a" /* CardSeriesComponent */], __WEBPACK_IMPORTED_MODULE_4__number_card_component__["a" /* NumberCardComponent */] ] }) ], NumberCardModule); return NumberCardModule; }()); /***/ }), /***/ "./src/pie-chart/advanced-pie-chart.component.scss": /***/ (function(module, exports, __webpack_require__) { var result = __webpack_require__("./node_modules/css-loader/index.js!./node_modules/postcss-loader/index.js!./node_modules/sass-loader/lib/loader.js??ref--3-4!./src/pie-chart/advanced-pie-chart.component.scss"); if (typeof result === "string") { module.exports = result; } else { module.exports = result.toString(); } /***/ }), /***/ "./src/pie-chart/advanced-pie-chart.component.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return AdvancedPieChartComponent; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("@angular/core"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__common_view_dimensions_helper__ = __webpack_require__("./src/common/view-dimensions.helper.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__common_color_helper__ = __webpack_require__("./src/common/color.helper.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__common_base_chart_component__ = __webpack_require__("./src/common/base-chart.component.ts"); var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var AdvancedPieChartComponent = /** @class */ (function (_super) { __extends(AdvancedPieChartComponent, _super); function AdvancedPieChartComponent() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.activeEntries = []; _this.tooltipDisabled = false; _this.label = 'Total'; _this.activate = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); _this.deactivate = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); _this.margin = [20, 20, 20, 20]; _this.valueFormatting = function (value) { return value; }; _this.nameFormatting = function (label) { return label; }; _this.percentageFormatting = function (percentage) { return percentage; }; return _this; } AdvancedPieChartComponent.prototype.update = function () { _super.prototype.update.call(this); this.dims = Object(__WEBPACK_IMPORTED_MODULE_1__common_view_dimensions_helper__["a" /* calculateViewDimensions */])({ width: this.width * 4 / 12.0, height: this.height, margins: this.margin }); this.domain = this.getDomain(); this.setColors(); var xOffset = this.dims.width / 2; var yOffset = this.margin[0] + this.dims.height / 2; this.legendWidth = this.width - this.dims.width - this.margin[1]; this.outerRadius = Math.min(this.dims.width, this.dims.height) / 2.5; this.innerRadius = this.outerRadius * 0.75; this.transform = "translate(" + xOffset + " , " + yOffset + ")"; }; AdvancedPieChartComponent.prototype.getDomain = function () { return this.results.map(function (d) { return d.name; }); }; AdvancedPieChartComponent.prototype.onClick = function (data) { this.select.emit(data); }; AdvancedPieChartComponent.prototype.setColors = function () { this.colors = new __WEBPACK_IMPORTED_MODULE_2__common_color_helper__["a" /* ColorHelper */](this.scheme, 'ordinal', this.domain, this.customColors); }; AdvancedPieChartComponent.prototype.onActivate = function (event) { if (this.activeEntries.indexOf(event) > -1) return; this.activeEntries = [event].concat(this.activeEntries); this.activate.emit({ value: event, entries: this.activeEntries }); }; AdvancedPieChartComponent.prototype.onDeactivate = function (event) { var idx = this.activeEntries.indexOf(event); this.activeEntries.splice(idx, 1); this.activeEntries = this.activeEntries.slice(); this.deactivate.emit({ value: event, entries: this.activeEntries }); }; __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], AdvancedPieChartComponent.prototype, "gradient", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Array) ], AdvancedPieChartComponent.prototype, "activeEntries", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], AdvancedPieChartComponent.prototype, "tooltipDisabled", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], AdvancedPieChartComponent.prototype, "tooltipText", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", String) ], AdvancedPieChartComponent.prototype, "label", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"]) ], AdvancedPieChartComponent.prototype, "activate", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"]) ], AdvancedPieChartComponent.prototype, "deactivate", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["ContentChild"])('tooltipTemplate'), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["TemplateRef"]) ], AdvancedPieChartComponent.prototype, "tooltipTemplate", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Function) ], AdvancedPieChartComponent.prototype, "valueFormatting", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Function) ], AdvancedPieChartComponent.prototype, "nameFormatting", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Function) ], AdvancedPieChartComponent.prototype, "percentageFormatting", void 0); AdvancedPieChartComponent = __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ selector: 'ngx-charts-advanced-pie-chart', template: "\n <div\n [style.width.px]=\"width\"\n [style.height.px]=\"height\">\n <div class=\"advanced-pie chart\"\n [style.width.px]=\"dims.width\"\n [style.height.px]=\"dims.height\">\n <ngx-charts-chart\n [view]=\"[width, height]\"\n [showLegend]=\"false\"\n [animations]=\"animations\">\n <svg:g\n [attr.transform]=\"transform\"\n class=\"pie chart\">\n <svg:g ngx-charts-pie-series\n [colors]=\"colors\"\n [series]=\"results\"\n [innerRadius]=\"innerRadius\"\n [activeEntries]=\"activeEntries\"\n [outerRadius]=\"outerRadius\"\n [gradient]=\"gradient\"\n [tooltipDisabled]=\"tooltipDisabled\"\n [tooltipTemplate]=\"tooltipTemplate\"\n [tooltipText]=\"tooltipText\"\n (select)=\"onClick($event)\"\n [animations]=\"animations\">\n </svg:g>\n </svg:g>\n </ngx-charts-chart>\n </div>\n <div\n class=\"advanced-pie-legend-wrapper\"\n [style.width.px]=\"width - dims.width\"\n [style.height.px]=\"height\">\n <ngx-charts-advanced-legend\n [data]=\"results\"\n [colors]=\"colors\"\n [width]=\"width - dims.width - margin[1]\"\n [label]=\"label\"\n [animations]=\"animations\"\n [valueFormatting]=\"valueFormatting\"\n [labelFormatting]=\"nameFormatting\"\n [percentageFormatting]=\"percentageFormatting\"\n (select)=\"onClick($event)\"\n (activate)=\"onActivate($event)\"\n (deactivate)=\"onDeactivate($event)\">\n </ngx-charts-advanced-legend>\n </div>\n </div>\n ", styles: [ __webpack_require__("./src/common/base-chart.component.scss"), __webpack_require__("./src/pie-chart/advanced-pie-chart.component.scss") ], encapsulation: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ViewEncapsulation"].None, changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectionStrategy"].OnPush }) ], AdvancedPieChartComponent); return AdvancedPieChartComponent; }(__WEBPACK_IMPORTED_MODULE_3__common_base_chart_component__["a" /* BaseChartComponent */])); /***/ }), /***/ "./src/pie-chart/index.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__pie_chart_module__ = __webpack_require__("./src/pie-chart/pie-chart.module.ts"); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "a", function() { return __WEBPACK_IMPORTED_MODULE_0__pie_chart_module__["a"]; }); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "b", function() { return __WEBPACK_IMPORTED_MODULE_0__pie_chart_module__["b"]; }); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "c", function() { return __WEBPACK_IMPORTED_MODULE_0__pie_chart_module__["c"]; }); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "d", function() { return __WEBPACK_IMPORTED_MODULE_0__pie_chart_module__["d"]; }); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "e", function() { return __WEBPACK_IMPORTED_MODULE_0__pie_chart_module__["e"]; }); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "f", function() { return __WEBPACK_IMPORTED_MODULE_0__pie_chart_module__["f"]; }); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "g", function() { return __WEBPACK_IMPORTED_MODULE_0__pie_chart_module__["g"]; }); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "h", function() { return __WEBPACK_IMPORTED_MODULE_0__pie_chart_module__["h"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__pie_chart_component__ = __webpack_require__("./src/pie-chart/pie-chart.component.ts"); /* unused harmony namespace reexport */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__pie_arc_component__ = __webpack_require__("./src/pie-chart/pie-arc.component.ts"); /* unused harmony namespace reexport */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__pie_grid_component__ = __webpack_require__("./src/pie-chart/pie-grid.component.ts"); /* unused harmony namespace reexport */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__pie_series_component__ = __webpack_require__("./src/pie-chart/pie-series.component.ts"); /* unused harmony namespace reexport */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__pie_label_component__ = __webpack_require__("./src/pie-chart/pie-label.component.ts"); /* unused harmony namespace reexport */ /* unused harmony namespace reexport */ /***/ }), /***/ "./src/pie-chart/pie-arc.component.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return PieArcComponent; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("@angular/core"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_d3_interpolate__ = __webpack_require__("d3-interpolate"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_d3_interpolate___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_d3_interpolate__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_d3_selection__ = __webpack_require__("d3-selection"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_d3_selection___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_d3_selection__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_d3_shape__ = __webpack_require__("d3-shape"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_d3_shape___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_d3_shape__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__utils_id__ = __webpack_require__("./src/utils/id.ts"); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var PieArcComponent = /** @class */ (function () { function PieArcComponent(element) { this.startAngle = 0; this.endAngle = Math.PI * 2; this.cornerRadius = 0; this.explodeSlices = false; this.gradient = false; this.animate = true; this.pointerEvents = true; this.isActive = false; this.select = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); this.activate = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); this.deactivate = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); this.initialized = false; this.element = element.nativeElement; } PieArcComponent.prototype.ngOnChanges = function (changes) { this.update(); }; PieArcComponent.prototype.update = function () { var calc = this.calculateArc(); this.path = calc.startAngle(this.startAngle).endAngle(this.endAngle)(); this.startOpacity = 0.5; this.radialGradientId = 'linearGrad' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_id__["a" /* id */])().toString(); this.gradientFill = "url(#" + this.radialGradientId + ")"; if (this.animate) { if (this.initialized) { this.updateAnimation(); } else { this.loadAnimation(); this.initialized = true; } } }; PieArcComponent.prototype.calculateArc = function () { var outerRadius = this.outerRadius; if (this.explodeSlices && this.innerRadius === 0) { outerRadius = this.outerRadius * this.value / this.max; } return Object(__WEBPACK_IMPORTED_MODULE_3_d3_shape__["arc"])() .innerRadius(this.innerRadius) .outerRadius(outerRadius) .cornerRadius(this.cornerRadius); }; PieArcComponent.prototype.loadAnimation = function () { var node = Object(__WEBPACK_IMPORTED_MODULE_2_d3_selection__["select"])(this.element) .selectAll('.arc') .data([{ startAngle: this.startAngle, endAngle: this.endAngle }]); var calc = this.calculateArc(); node .transition() .attrTween('d', function (d) { this._current = this._current || d; var copyOfD = Object.assign({}, d); copyOfD.endAngle = copyOfD.startAngle; var interpolater = Object(__WEBPACK_IMPORTED_MODULE_1_d3_interpolate__["interpolate"])(copyOfD, copyOfD); this._current = interpolater(0); return function (t) { return calc(interpolater(t)); }; }) .transition().duration(750) .attrTween('d', function (d) { this._current = this._current || d; var interpolater = Object(__WEBPACK_IMPORTED_MODULE_1_d3_interpolate__["interpolate"])(this._current, d); this._current = interpolater(0); return function (t) { return calc(interpolater(t)); }; }); }; PieArcComponent.prototype.updateAnimation = function () { var node = Object(__WEBPACK_IMPORTED_MODULE_2_d3_selection__["select"])(this.element) .selectAll('.arc') .data([{ startAngle: this.startAngle, endAngle: this.endAngle }]); var calc = this.calculateArc(); node .transition().duration(750) .attrTween('d', function (d) { this._current = this._current || d; var interpolater = Object(__WEBPACK_IMPORTED_MODULE_1_d3_interpolate__["interpolate"])(this._current, d); this._current = interpolater(0); return function (t) { return calc(interpolater(t)); }; }); }; PieArcComponent.prototype.onClick = function () { this.select.emit(this.data); }; __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], PieArcComponent.prototype, "fill", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Number) ], PieArcComponent.prototype, "startAngle", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Number) ], PieArcComponent.prototype, "endAngle", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], PieArcComponent.prototype, "innerRadius", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], PieArcComponent.prototype, "outerRadius", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Number) ], PieArcComponent.prototype, "cornerRadius", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], PieArcComponent.prototype, "value", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], PieArcComponent.prototype, "max", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], PieArcComponent.prototype, "data", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], PieArcComponent.prototype, "explodeSlices", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], PieArcComponent.prototype, "gradient", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], PieArcComponent.prototype, "animate", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], PieArcComponent.prototype, "pointerEvents", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], PieArcComponent.prototype, "isActive", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", Object) ], PieArcComponent.prototype, "select", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", Object) ], PieArcComponent.prototype, "activate", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", Object) ], PieArcComponent.prototype, "deactivate", void 0); PieArcComponent = __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ selector: 'g[ngx-charts-pie-arc]', template: "\n <svg:g class=\"arc-group\">\n <svg:defs *ngIf=\"gradient\">\n <svg:g ngx-charts-svg-radial-gradient\n [color]=\"fill\"\n orientation=\"vertical\"\n [name]=\"radialGradientId\"\n [startOpacity]=\"startOpacity\"\n />\n </svg:defs>\n <svg:path\n [attr.d]=\"path\"\n class=\"arc\"\n [class.active]=\"isActive\"\n [attr.fill]=\"gradient ? gradientFill : fill\"\n (click)=\"onClick()\"\n (mouseenter)=\"activate.emit(data)\"\n (mouseleave)=\"deactivate.emit(data)\"\n [style.pointer-events]=\"pointerEvents ? 'auto' : 'none'\"\n />\n </svg:g>\n ", changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectionStrategy"].OnPush, }), __metadata("design:paramtypes", [__WEBPACK_IMPORTED_MODULE_0__angular_core__["ElementRef"]]) ], PieArcComponent); return PieArcComponent; }()); /***/ }), /***/ "./src/pie-chart/pie-chart.component.scss": /***/ (function(module, exports, __webpack_require__) { var result = __webpack_require__("./node_modules/css-loader/index.js!./node_modules/postcss-loader/index.js!./node_modules/sass-loader/lib/loader.js??ref--3-4!./src/pie-chart/pie-chart.component.scss"); if (typeof result === "string") { module.exports = result; } else { module.exports = result.toString(); } /***/ }), /***/ "./src/pie-chart/pie-chart.component.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return PieChartComponent; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("@angular/core"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__common_view_dimensions_helper__ = __webpack_require__("./src/common/view-dimensions.helper.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__common_color_helper__ = __webpack_require__("./src/common/color.helper.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__common_base_chart_component__ = __webpack_require__("./src/common/base-chart.component.ts"); var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var PieChartComponent = /** @class */ (function (_super) { __extends(PieChartComponent, _super); function PieChartComponent() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.labels = false; _this.legend = false; _this.legendTitle = 'Legend'; _this.explodeSlices = false; _this.doughnut = false; _this.arcWidth = 0.25; _this.activeEntries = []; _this.tooltipDisabled = false; _this.trimLabels = true; _this.maxLabelLength = 10; _this.select = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); _this.activate = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); _this.deactivate = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); _this.margin = [20, 20, 20, 20]; return _this; } PieChartComponent.prototype.update = function () { var _this = this; _super.prototype.update.call(this); if (this.labels) { this.margin = [30, 80, 30, 80]; } this.dims = Object(__WEBPACK_IMPORTED_MODULE_1__common_view_dimensions_helper__["a" /* calculateViewDimensions */])({ width: this.width, height: this.height, margins: this.margin, showLegend: this.legend, }); var xOffset = this.margin[3] + this.dims.width / 2; var yOffset = this.margin[0] + this.dims.height / 2; this.translation = "translate(" + xOffset + ", " + yOffset + ")"; this.outerRadius = Math.min(this.dims.width, this.dims.height); if (this.labels) { // make room for labels this.outerRadius /= 3; } else { this.outerRadius /= 2; } this.innerRadius = 0; if (this.doughnut) { this.innerRadius = this.outerRadius * (1 - this.arcWidth); } this.domain = this.getDomain(); // sort data according to domain this.data = this.results.sort(function (a, b) { return _this.domain.indexOf(a.name) - _this.domain.indexOf(b.name); }); this.setColors(); this.legendOptions = this.getLegendOptions(); }; PieChartComponent.prototype.getDomain = function () { var items = []; this.results.map(function (d) { var label = d.name; if (label.constructor.name === 'Date') { label = label.toLocaleDateString(); } else { label = label.toLocaleString(); } if (items.indexOf(label) === -1) { items.push(label); } }); return items; }; PieChartComponent.prototype.onClick = function (data) { this.select.emit(data); }; PieChartComponent.prototype.setColors = function () { this.colors = new __WEBPACK_IMPORTED_MODULE_2__common_color_helper__["a" /* ColorHelper */](this.scheme, 'ordinal', this.domain, this.customColors); }; PieChartComponent.prototype.getLegendOptions = function () { return { scaleType: 'ordinal', domain: this.domain, colors: this.colors, title: this.legendTitle }; }; PieChartComponent.prototype.onActivate = function (item) { var idx = this.activeEntries.findIndex(function (d) { return d.name === item.name && d.value === item.value; }); if (idx > -1) { return; } this.activeEntries = [item].concat(this.activeEntries); this.activate.emit({ value: item, entries: this.activeEntries }); }; PieChartComponent.prototype.onDeactivate = function (item) { var idx = this.activeEntries.findIndex(function (d) { return d.name === item.name && d.value === item.value; }); this.activeEntries.splice(idx, 1); this.activeEntries = this.activeEntries.slice(); this.deactivate.emit({ value: item, entries: this.activeEntries }); }; __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], PieChartComponent.prototype, "labels", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], PieChartComponent.prototype, "legend", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", String) ], PieChartComponent.prototype, "legendTitle", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], PieChartComponent.prototype, "explodeSlices", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], PieChartComponent.prototype, "doughnut", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], PieChartComponent.prototype, "arcWidth", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], PieChartComponent.prototype, "gradient", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Array) ], PieChartComponent.prototype, "activeEntries", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], PieChartComponent.prototype, "tooltipDisabled", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], PieChartComponent.prototype, "labelFormatting", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], PieChartComponent.prototype, "trimLabels", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Number) ], PieChartComponent.prototype, "maxLabelLength", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], PieChartComponent.prototype, "tooltipText", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", Object) ], PieChartComponent.prototype, "select", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"]) ], PieChartComponent.prototype, "activate", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"]) ], PieChartComponent.prototype, "deactivate", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["ContentChild"])('tooltipTemplate'), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["TemplateRef"]) ], PieChartComponent.prototype, "tooltipTemplate", void 0); PieChartComponent = __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ selector: 'ngx-charts-pie-chart', template: "\n <ngx-charts-chart\n [view]=\"[width, height]\"\n [showLegend]=\"legend\"\n [legendOptions]=\"legendOptions\"\n [activeEntries]=\"activeEntries\"\n [animations]=\"animations\"\n (legendLabelActivate)=\"onActivate($event)\"\n (legendLabelDeactivate)=\"onDeactivate($event)\"\n (legendLabelClick)=\"onClick($event)\">\n <svg:g [attr.transform]=\"translation\" class=\"pie-chart chart\">\n <svg:g ngx-charts-pie-series\n [colors]=\"colors\"\n [series]=\"data\"\n [showLabels]=\"labels\"\n [labelFormatting]=\"labelFormatting\"\n [trimLabels]=\"trimLabels\"\n [maxLabelLength]=\"maxLabelLength\"\n [activeEntries]=\"activeEntries\"\n [innerRadius]=\"innerRadius\"\n [outerRadius]=\"outerRadius\"\n [explodeSlices]=\"explodeSlices\"\n [gradient]=\"gradient\"\n [animations]=\"animations\"\n [tooltipDisabled]=\"tooltipDisabled\"\n [tooltipTemplate]=\"tooltipTemplate\"\n [tooltipText]=\"tooltipText\"\n (select)=\"onClick($event)\"\n (activate)=\"onActivate($event)\"\n (deactivate)=\"onDeactivate($event)\"\n />\n </svg:g>\n </ngx-charts-chart>\n ", styles: [ __webpack_require__("./src/common/base-chart.component.scss"), __webpack_require__("./src/pie-chart/pie-chart.component.scss") ], encapsulation: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ViewEncapsulation"].None, changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectionStrategy"].OnPush }) ], PieChartComponent); return PieChartComponent; }(__WEBPACK_IMPORTED_MODULE_3__common_base_chart_component__["a" /* BaseChartComponent */])); /***/ }), /***/ "./src/pie-chart/pie-chart.module.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return PieChartModule; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("@angular/core"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__common_chart_common_module__ = __webpack_require__("./src/common/chart-common.module.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__advanced_pie_chart_component__ = __webpack_require__("./src/pie-chart/advanced-pie-chart.component.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__pie_label_component__ = __webpack_require__("./src/pie-chart/pie-label.component.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__pie_arc_component__ = __webpack_require__("./src/pie-chart/pie-arc.component.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__pie_chart_component__ = __webpack_require__("./src/pie-chart/pie-chart.component.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__pie_grid_component__ = __webpack_require__("./src/pie-chart/pie-grid.component.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__pie_grid_series_component__ = __webpack_require__("./src/pie-chart/pie-grid-series.component.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__pie_series_component__ = __webpack_require__("./src/pie-chart/pie-series.component.ts"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return __WEBPACK_IMPORTED_MODULE_2__advanced_pie_chart_component__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return __WEBPACK_IMPORTED_MODULE_3__pie_label_component__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return __WEBPACK_IMPORTED_MODULE_4__pie_arc_component__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return __WEBPACK_IMPORTED_MODULE_5__pie_chart_component__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return __WEBPACK_IMPORTED_MODULE_6__pie_grid_component__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return __WEBPACK_IMPORTED_MODULE_7__pie_grid_series_component__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return __WEBPACK_IMPORTED_MODULE_8__pie_series_component__["a"]; }); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var PieChartModule = /** @class */ (function () { function PieChartModule() { } PieChartModule = __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["NgModule"])({ imports: [__WEBPACK_IMPORTED_MODULE_1__common_chart_common_module__["a" /* ChartCommonModule */]], declarations: [ __WEBPACK_IMPORTED_MODULE_2__advanced_pie_chart_component__["a" /* AdvancedPieChartComponent */], __WEBPACK_IMPORTED_MODULE_3__pie_label_component__["a" /* PieLabelComponent */], __WEBPACK_IMPORTED_MODULE_4__pie_arc_component__["a" /* PieArcComponent */], __WEBPACK_IMPORTED_MODULE_5__pie_chart_component__["a" /* PieChartComponent */], __WEBPACK_IMPORTED_MODULE_6__pie_grid_component__["a" /* PieGridComponent */], __WEBPACK_IMPORTED_MODULE_7__pie_grid_series_component__["a" /* PieGridSeriesComponent */], __WEBPACK_IMPORTED_MODULE_8__pie_series_component__["a" /* PieSeriesComponent */] ], exports: [ __WEBPACK_IMPORTED_MODULE_2__advanced_pie_chart_component__["a" /* AdvancedPieChartComponent */], __WEBPACK_IMPORTED_MODULE_3__pie_label_component__["a" /* PieLabelComponent */], __WEBPACK_IMPORTED_MODULE_4__pie_arc_component__["a" /* PieArcComponent */], __WEBPACK_IMPORTED_MODULE_5__pie_chart_component__["a" /* PieChartComponent */], __WEBPACK_IMPORTED_MODULE_6__pie_grid_component__["a" /* PieGridComponent */], __WEBPACK_IMPORTED_MODULE_7__pie_grid_series_component__["a" /* PieGridSeriesComponent */], __WEBPACK_IMPORTED_MODULE_8__pie_series_component__["a" /* PieSeriesComponent */] ] }) ], PieChartModule); return PieChartModule; }()); /***/ }), /***/ "./src/pie-chart/pie-grid-series.component.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return PieGridSeriesComponent; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("@angular/core"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_d3_shape__ = __webpack_require__("d3-shape"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_d3_shape___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_d3_shape__); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var PieGridSeriesComponent = /** @class */ (function () { function PieGridSeriesComponent(element) { this.innerRadius = 70; this.outerRadius = 80; this.animations = true; this.select = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); this.element = element.nativeElement; } PieGridSeriesComponent.prototype.ngOnChanges = function (changes) { this.update(); }; PieGridSeriesComponent.prototype.update = function () { this.layout = Object(__WEBPACK_IMPORTED_MODULE_1_d3_shape__["pie"])() .value(function (d) { return d.data.value; }).sort(null); this.arcs = this.getArcs(); }; PieGridSeriesComponent.prototype.getArcs = function () { var _this = this; return this.layout(this.data).map(function (arc, index) { var label = arc.data.data.name; var other = arc.data.data.other; if (index === 0) { arc.startAngle = 0; } var color = _this.colors(label); return { data: arc.data.data, class: 'arc ' + 'arc' + index, fill: color, startAngle: other ? 0 : arc.startAngle, endAngle: arc.endAngle, animate: _this.animations && !other, pointerEvents: !other }; }); }; PieGridSeriesComponent.prototype.onClick = function (data) { this.select.emit({ name: this.data[0].data.name, value: this.data[0].data.value }); }; PieGridSeriesComponent.prototype.trackBy = function (index, item) { return item.data.name; }; PieGridSeriesComponent.prototype.label = function (arc) { return arc.data.name; }; PieGridSeriesComponent.prototype.color = function (arc) { return this.colors(this.label(arc)); }; __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], PieGridSeriesComponent.prototype, "colors", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], PieGridSeriesComponent.prototype, "data", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], PieGridSeriesComponent.prototype, "innerRadius", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], PieGridSeriesComponent.prototype, "outerRadius", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], PieGridSeriesComponent.prototype, "animations", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", Object) ], PieGridSeriesComponent.prototype, "select", void 0); PieGridSeriesComponent = __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ selector: 'g[ngx-charts-pie-grid-series]', template: "\n <svg:g class=\"pie-grid-arcs\">\n <svg:g ngx-charts-pie-arc *ngFor=\"let arc of arcs; trackBy:trackBy\"\n [attr.class]=\"arc.class\"\n [startAngle]=\"arc.startAngle\"\n [endAngle]=\"arc.endAngle\"\n [innerRadius]=\"innerRadius\"\n [outerRadius]=\"outerRadius\"\n [fill]=\"color(arc)\"\n [value]=\"arc.data.value\"\n [data]=\"arc.data\"\n [gradient]=\"false\"\n [pointerEvents]=\"arc.pointerEvents\"\n [animate]=\"arc.animate\"\n (select)=\"onClick($event)\">\n </svg:g>\n </svg:g>\n ", changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectionStrategy"].OnPush, }), __metadata("design:paramtypes", [__WEBPACK_IMPORTED_MODULE_0__angular_core__["ElementRef"]]) ], PieGridSeriesComponent); return PieGridSeriesComponent; }()); /***/ }), /***/ "./src/pie-chart/pie-grid.component.scss": /***/ (function(module, exports, __webpack_require__) { var result = __webpack_require__("./node_modules/css-loader/index.js!./node_modules/postcss-loader/index.js!./node_modules/sass-loader/lib/loader.js??ref--3-4!./src/pie-chart/pie-grid.component.scss"); if (typeof result === "string") { module.exports = result; } else { module.exports = result.toString(); } /***/ }), /***/ "./src/pie-chart/pie-grid.component.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return PieGridComponent; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("@angular/core"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_d3_array__ = __webpack_require__("d3-array"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_d3_array___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_d3_array__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_d3_format__ = __webpack_require__("d3-format"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_d3_format___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_d3_format__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__common_view_dimensions_helper__ = __webpack_require__("./src/common/view-dimensions.helper.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__common_color_helper__ = __webpack_require__("./src/common/color.helper.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__common_base_chart_component__ = __webpack_require__("./src/common/base-chart.component.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__common_trim_label_helper__ = __webpack_require__("./src/common/trim-label.helper.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__common_grid_layout_helper__ = __webpack_require__("./src/common/grid-layout.helper.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__common_label_helper__ = __webpack_require__("./src/common/label.helper.ts"); var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var PieGridComponent = /** @class */ (function (_super) { __extends(PieGridComponent, _super); function PieGridComponent() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.tooltipDisabled = false; _this.label = 'Total'; _this.minWidth = 150; _this.margin = [20, 20, 20, 20]; return _this; } PieGridComponent.prototype.update = function () { _super.prototype.update.call(this); this.dims = Object(__WEBPACK_IMPORTED_MODULE_3__common_view_dimensions_helper__["a" /* calculateViewDimensions */])({ width: this.width, height: this.height, margins: this.margin }); this.domain = this.getDomain(); this.data = Object(__WEBPACK_IMPORTED_MODULE_7__common_grid_layout_helper__["a" /* gridLayout */])(this.dims, this.results, this.minWidth, this.designatedTotal); this.transform = "translate(" + this.margin[3] + " , " + this.margin[0] + ")"; this.series = this.getSeries(); this.setColors(); this.tooltipText = this.tooltipText || this.defaultTooltipText; }; PieGridComponent.prototype.defaultTooltipText = function (_a) { var data = _a.data; var label = Object(__WEBPACK_IMPORTED_MODULE_6__common_trim_label_helper__["a" /* trimLabel */])(Object(__WEBPACK_IMPORTED_MODULE_8__common_label_helper__["a" /* formatLabel */])(data.name)); var val = data.value.toLocaleString(); return "\n <span class=\"tooltip-label\">" + label + "</span>\n <span class=\"tooltip-val\">" + val + "</span>\n "; }; PieGridComponent.prototype.getDomain = function () { return this.results.map(function (d) { return d.name; }); }; PieGridComponent.prototype.getSeries = function () { var _this = this; var total = this.designatedTotal ? this.designatedTotal : this.getTotal(); return this.data.map(function (d) { var baselineLabelHeight = 20; var padding = 10; var name = d.data.name; var label = Object(__WEBPACK_IMPORTED_MODULE_8__common_label_helper__["a" /* formatLabel */])(name); var value = d.data.value; var radius = (Object(__WEBPACK_IMPORTED_MODULE_1_d3_array__["min"])([d.width - padding, d.height - baselineLabelHeight]) / 2) - 5; var innerRadius = radius * 0.9; var count = 0; var colors = function () { count += 1; if (count === 1) { return 'rgba(100,100,100,0.3)'; } else { return _this.colorScale.getColor(label); } }; var xPos = d.x + (d.width - padding) / 2; var yPos = d.y + (d.height - baselineLabelHeight) / 2; return { transform: "translate(" + xPos + ", " + yPos + ")", colors: colors, innerRadius: innerRadius, outerRadius: radius, name: name, label: Object(__WEBPACK_IMPORTED_MODULE_6__common_trim_label_helper__["a" /* trimLabel */])(label), total: value, value: value, percent: Object(__WEBPACK_IMPORTED_MODULE_2_d3_format__["format"])('.1%')(d.data.percent), data: [d, { data: { other: true, value: total - value, name: d.data.name } }] }; }); }; PieGridComponent.prototype.getTotal = function () { return this.results .map(function (d) { return d.value; }) .reduce(function (sum, d) { return sum + d; }, 0); }; PieGridComponent.prototype.onClick = function (data) { this.select.emit(data); }; PieGridComponent.prototype.setColors = function () { this.colorScale = new __WEBPACK_IMPORTED_MODULE_4__common_color_helper__["a" /* ColorHelper */](this.scheme, 'ordinal', this.domain, this.customColors); }; __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Number) ], PieGridComponent.prototype, "designatedTotal", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], PieGridComponent.prototype, "tooltipDisabled", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Function) ], PieGridComponent.prototype, "tooltipText", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", String) ], PieGridComponent.prototype, "label", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Number) ], PieGridComponent.prototype, "minWidth", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["ContentChild"])('tooltipTemplate'), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["TemplateRef"]) ], PieGridComponent.prototype, "tooltipTemplate", void 0); PieGridComponent = __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ selector: 'ngx-charts-pie-grid', template: "\n <ngx-charts-chart\n [view]=\"[width, height]\"\n [showLegend]=\"false\"\n [animations]=\"animations\">\n <svg:g [attr.transform]=\"transform\" class=\"pie-grid chart\">\n <svg:g\n *ngFor=\"let series of series\"\n class=\"pie-grid-item\"\n [attr.transform]=\"series.transform\">\n <svg:g ngx-charts-pie-grid-series\n [colors]=\"series.colors\"\n [data]=\"series.data\"\n [innerRadius]=\"series.innerRadius\"\n [outerRadius]=\"series.outerRadius\"\n [animations]=\"animations\"\n (select)=\"onClick($event)\"\n ngx-tooltip\n [tooltipDisabled]=\"tooltipDisabled\"\n [tooltipPlacement]=\"'top'\"\n [tooltipType]=\"'tooltip'\"\n [tooltipTitle]=\"tooltipTemplate ? undefined : tooltipText({data: series})\"\n [tooltipTemplate]=\"tooltipTemplate\"\n [tooltipContext]=\"series.data[0].data\"\n />\n <svg:text *ngIf=\"animations\"\n class=\"label percent-label\"\n dy=\"-0.5em\"\n x=\"0\"\n y=\"5\"\n ngx-charts-count-up\n [countTo]=\"series.percent\"\n [countSuffix]=\"'%'\"\n text-anchor=\"middle\">\n </svg:text>\n <svg:text *ngIf=\"!animations\"\n class=\"label percent-label\"\n dy=\"-0.5em\"\n x=\"0\"\n y=\"5\"\n text-anchor=\"middle\">\n {{series.percent.toLocaleString()}}\n </svg:text>\n <svg:text\n class=\"label\"\n dy=\"0.5em\"\n x=\"0\"\n y=\"5\"\n text-anchor=\"middle\">\n {{series.label}}\n </svg:text>\n <svg:text *ngIf=\"animations\"\n class=\"label\"\n dy=\"1.23em\"\n x=\"0\"\n [attr.y]=\"series.outerRadius\"\n text-anchor=\"middle\"\n ngx-charts-count-up\n [countTo]=\"series.total\"\n [countPrefix]=\"label + ': '\">\n </svg:text>\n <svg:text *ngIf=\"!animations\"\n class=\"label\"\n dy=\"1.23em\"\n x=\"0\"\n [attr.y]=\"series.outerRadius\"\n text-anchor=\"middle\">\n {{label}}: {{series.total.toLocaleString()}}\n </svg:text>\n </svg:g>\n </svg:g>\n </ngx-charts-chart>\n ", styles: [ __webpack_require__("./src/common/base-chart.component.scss"), __webpack_require__("./src/pie-chart/pie-grid.component.scss") ], encapsulation: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ViewEncapsulation"].None, changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectionStrategy"].OnPush, }) ], PieGridComponent); return PieGridComponent; }(__WEBPACK_IMPORTED_MODULE_5__common_base_chart_component__["a" /* BaseChartComponent */])); /***/ }), /***/ "./src/pie-chart/pie-label.component.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return PieLabelComponent; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("@angular/core"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_d3_shape__ = __webpack_require__("d3-shape"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_d3_shape___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_d3_shape__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__common_trim_label_helper__ = __webpack_require__("./src/common/trim-label.helper.ts"); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var PieLabelComponent = /** @class */ (function () { function PieLabelComponent() { this.animations = true; this.labelTrim = true; this.labelTrimSize = 10; this.isIE = /(edge|msie|trident)/i.test(navigator.userAgent); this.trimLabel = __WEBPACK_IMPORTED_MODULE_2__common_trim_label_helper__["a" /* trimLabel */]; } PieLabelComponent.prototype.ngOnChanges = function (changes) { this.update(); }; PieLabelComponent.prototype.update = function () { var startRadius = this.radius; if (this.explodeSlices) { startRadius = this.radius * this.value / this.max; } var innerArc = Object(__WEBPACK_IMPORTED_MODULE_1_d3_shape__["arc"])() .innerRadius(startRadius) .outerRadius(startRadius); // Calculate innerPos then scale outer position to match label position var innerPos = innerArc.centroid(this.data); var scale = this.data.pos[1] / innerPos[1]; if (this.data.pos[1] === 0 || innerPos[1] === 0) { scale = 1; } var outerPos = [scale * innerPos[0], scale * innerPos[1]]; this.line = "M" + innerPos + "L" + outerPos + "L" + this.data.pos; }; Object.defineProperty(PieLabelComponent.prototype, "textX", { get: function () { return this.data.pos[0]; }, enumerable: true, configurable: true }); Object.defineProperty(PieLabelComponent.prototype, "textY", { get: function () { return this.data.pos[1]; }, enumerable: true, configurable: true }); Object.defineProperty(PieLabelComponent.prototype, "styleTransform", { get: function () { return this.isIE ? null : "translate3d(" + this.textX + "px," + this.textY + "px, 0)"; }, enumerable: true, configurable: true }); Object.defineProperty(PieLabelComponent.prototype, "attrTransform", { get: function () { return !this.isIE ? null : "translate(" + this.textX + "," + this.textY + ")"; }, enumerable: true, configurable: true }); Object.defineProperty(PieLabelComponent.prototype, "textTransition", { get: function () { return (this.isIE || !this.animations) ? null : 'transform 0.75s'; }, enumerable: true, configurable: true }); PieLabelComponent.prototype.textAnchor = function () { return this.midAngle(this.data) < Math.PI ? 'start' : 'end'; }; PieLabelComponent.prototype.midAngle = function (d) { return d.startAngle + (d.endAngle - d.startAngle) / 2; }; __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], PieLabelComponent.prototype, "data", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], PieLabelComponent.prototype, "radius", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], PieLabelComponent.prototype, "label", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], PieLabelComponent.prototype, "color", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], PieLabelComponent.prototype, "max", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], PieLabelComponent.prototype, "value", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], PieLabelComponent.prototype, "explodeSlices", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], PieLabelComponent.prototype, "animations", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], PieLabelComponent.prototype, "labelTrim", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Number) ], PieLabelComponent.prototype, "labelTrimSize", void 0); PieLabelComponent = __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ selector: 'g[ngx-charts-pie-label]', template: "\n <title>{{label}}</title>\n <svg:g\n [attr.transform]=\"attrTransform\"\n [style.transform]=\"styleTransform\"\n [style.transition]=\"textTransition\">\n <svg:text\n class=\"pie-label\"\n [class.animation]=\"animations\"\n dy=\".35em\"\n [style.textAnchor]=\"textAnchor()\"\n [style.shapeRendering]=\"'crispEdges'\">\n {{labelTrim ? trimLabel(label, labelTrimSize) : label}}\n </svg:text>\n </svg:g>\n <svg:path\n [attr.d]=\"line\"\n [attr.stroke]=\"color\"\n fill=\"none\"\n class=\"pie-label-line line\"\n [class.animation]=\"animations\">\n </svg:path>\n ", changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectionStrategy"].OnPush }), __metadata("design:paramtypes", []) ], PieLabelComponent); return PieLabelComponent; }()); /***/ }), /***/ "./src/pie-chart/pie-series.component.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return PieSeriesComponent; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("@angular/core"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_d3_array__ = __webpack_require__("d3-array"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_d3_array___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_d3_array__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_d3_shape__ = __webpack_require__("d3-shape"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_d3_shape___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_d3_shape__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__common_label_helper__ = __webpack_require__("./src/common/label.helper.ts"); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var PieSeriesComponent = /** @class */ (function () { function PieSeriesComponent() { this.series = []; this.innerRadius = 60; this.outerRadius = 80; this.trimLabels = true; this.maxLabelLength = 10; this.tooltipDisabled = false; this.animations = true; this.select = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); this.activate = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); this.deactivate = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); } PieSeriesComponent.prototype.ngOnChanges = function (changes) { this.update(); }; PieSeriesComponent.prototype.update = function () { var pieGenerator = Object(__WEBPACK_IMPORTED_MODULE_2_d3_shape__["pie"])() .value(function (d) { return d.value; }) .sort(null); var arcData = pieGenerator(this.series); this.max = Object(__WEBPACK_IMPORTED_MODULE_1_d3_array__["max"])(arcData, function (d) { return d.value; }); this.data = this.calculateLabelPositions(arcData); this.tooltipText = this.tooltipText || this.defaultTooltipText; }; PieSeriesComponent.prototype.midAngle = function (d) { return d.startAngle + (d.endAngle - d.startAngle) / 2; }; PieSeriesComponent.prototype.outerArc = function () { var factor = 1.5; return Object(__WEBPACK_IMPORTED_MODULE_2_d3_shape__["arc"])() .innerRadius(this.outerRadius * factor) .outerRadius(this.outerRadius * factor); }; PieSeriesComponent.prototype.calculateLabelPositions = function (pieData) { var _this = this; var factor = 1.5; var minDistance = 10; var labelPositions = pieData; labelPositions.forEach(function (d) { d.pos = _this.outerArc().centroid(d); d.pos[0] = factor * _this.outerRadius * (_this.midAngle(d) < Math.PI ? 1 : -1); }); for (var i = 0; i < labelPositions.length - 1; i++) { var a = labelPositions[i]; for (var j = i + 1; j < labelPositions.length; j++) { var b = labelPositions[j]; // if they're on the same side if (b.pos[0] * a.pos[0] > 0) { // if they're overlapping var o = minDistance - Math.abs(b.pos[1] - a.pos[1]); if (o > 0) { // push the second up or down b.pos[1] += Math.sign(b.pos[0]) * o; } } } } return labelPositions; }; PieSeriesComponent.prototype.labelVisible = function (myArc) { return this.showLabels && (myArc.endAngle - myArc.startAngle > Math.PI / 30); }; PieSeriesComponent.prototype.labelText = function (myArc) { if (this.labelFormatting) { return this.labelFormatting(myArc.data.name); } return this.label(myArc); }; PieSeriesComponent.prototype.label = function (myArc) { return Object(__WEBPACK_IMPORTED_MODULE_3__common_label_helper__["a" /* formatLabel */])(myArc.data.name); }; PieSeriesComponent.prototype.defaultTooltipText = function (myArc) { var label = this.label(myArc); var val = Object(__WEBPACK_IMPORTED_MODULE_3__common_label_helper__["a" /* formatLabel */])(myArc.data.value); return "\n <span class=\"tooltip-label\">" + label + "</span>\n <span class=\"tooltip-val\">" + val + "</span>\n "; }; PieSeriesComponent.prototype.color = function (myArc) { return this.colors.getColor(this.label(myArc)); }; PieSeriesComponent.prototype.trackBy = function (index, item) { return item.data.name; }; PieSeriesComponent.prototype.onClick = function (data) { this.select.emit(data); }; PieSeriesComponent.prototype.isActive = function (entry) { if (!this.activeEntries) return false; var item = this.activeEntries.find(function (d) { return entry.name === d.name && entry.series === d.series; }); return item !== undefined; }; __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], PieSeriesComponent.prototype, "colors", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], PieSeriesComponent.prototype, "series", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], PieSeriesComponent.prototype, "dims", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], PieSeriesComponent.prototype, "innerRadius", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], PieSeriesComponent.prototype, "outerRadius", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], PieSeriesComponent.prototype, "explodeSlices", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], PieSeriesComponent.prototype, "showLabels", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], PieSeriesComponent.prototype, "gradient", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Array) ], PieSeriesComponent.prototype, "activeEntries", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], PieSeriesComponent.prototype, "labelFormatting", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], PieSeriesComponent.prototype, "trimLabels", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Number) ], PieSeriesComponent.prototype, "maxLabelLength", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Function) ], PieSeriesComponent.prototype, "tooltipText", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], PieSeriesComponent.prototype, "tooltipDisabled", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["TemplateRef"]) ], PieSeriesComponent.prototype, "tooltipTemplate", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], PieSeriesComponent.prototype, "animations", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", Object) ], PieSeriesComponent.prototype, "select", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", Object) ], PieSeriesComponent.prototype, "activate", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", Object) ], PieSeriesComponent.prototype, "deactivate", void 0); PieSeriesComponent = __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ selector: 'g[ngx-charts-pie-series]', template: "\n <svg:g *ngFor=\"let arc of data; trackBy:trackBy\">\n <svg:g ngx-charts-pie-label\n *ngIf=\"labelVisible(arc)\"\n [data]=\"arc\"\n [radius]=\"outerRadius\"\n [color]=\"color(arc)\"\n [label]=\"labelText(arc)\"\n [labelTrim]=\"trimLabels\"\n [labelTrimSize]=\"maxLabelLength\"\n [max]=\"max\"\n [value]=\"arc.value\"\n [explodeSlices]=\"explodeSlices\"\n [animations]=\"animations\">\n </svg:g>\n <svg:g\n ngx-charts-pie-arc\n [startAngle]=\"arc.startAngle\"\n [endAngle]=\"arc.endAngle\"\n [innerRadius]=\"innerRadius\"\n [outerRadius]=\"outerRadius\"\n [fill]=\"color(arc)\"\n [value]=\"arc.data.value\"\n [gradient]=\"gradient\"\n [data]=\"arc.data\"\n [max]=\"max\"\n [explodeSlices]=\"explodeSlices\"\n [isActive]=\"isActive(arc.data)\"\n [animate]=\"animations\"\n (select)=\"onClick($event)\"\n (activate)=\"activate.emit($event)\"\n (deactivate)=\"deactivate.emit($event)\"\n ngx-tooltip\n [tooltipDisabled]=\"tooltipDisabled\"\n [tooltipPlacement]=\"'top'\"\n [tooltipType]=\"'tooltip'\"\n [tooltipTitle]=\"tooltipTemplate ? undefined : tooltipText(arc)\"\n [tooltipTemplate]=\"tooltipTemplate\"\n [tooltipContext]=\"arc.data\">\n </svg:g>\n </svg:g>\n ", changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectionStrategy"].OnPush, }) ], PieSeriesComponent); return PieSeriesComponent; }()); /***/ }), /***/ "./src/polar-chart/index.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__polar_chart_module__ = __webpack_require__("./src/polar-chart/polar-chart.module.ts"); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "a", function() { return __WEBPACK_IMPORTED_MODULE_0__polar_chart_module__["a"]; }); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "b", function() { return __WEBPACK_IMPORTED_MODULE_0__polar_chart_module__["b"]; }); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "c", function() { return __WEBPACK_IMPORTED_MODULE_0__polar_chart_module__["c"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__polar_chart_component__ = __webpack_require__("./src/polar-chart/polar-chart.component.ts"); /* unused harmony namespace reexport */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__polar_series_component__ = __webpack_require__("./src/polar-chart/polar-series.component.ts"); /* unused harmony namespace reexport */ /***/ }), /***/ "./src/polar-chart/polar-chart.component.scss": /***/ (function(module, exports, __webpack_require__) { var result = __webpack_require__("./node_modules/css-loader/index.js!./node_modules/postcss-loader/index.js!./node_modules/sass-loader/lib/loader.js??ref--3-4!./src/polar-chart/polar-chart.component.scss"); if (typeof result === "string") { module.exports = result; } else { module.exports = result.toString(); } /***/ }), /***/ "./src/polar-chart/polar-chart.component.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return PolarChartComponent; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("@angular/core"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_animations__ = __webpack_require__("@angular/animations"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_animations___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1__angular_animations__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_d3_scale__ = __webpack_require__("d3-scale"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_d3_scale___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_d3_scale__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_d3_shape__ = __webpack_require__("d3-shape"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_d3_shape___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_d3_shape__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__common_view_dimensions_helper__ = __webpack_require__("./src/common/view-dimensions.helper.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__common_color_helper__ = __webpack_require__("./src/common/color.helper.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__common_base_chart_component__ = __webpack_require__("./src/common/base-chart.component.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__utils_types__ = __webpack_require__("./src/utils/types.ts"); var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __assign = (this && this.__assign) || Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var twoPI = 2 * Math.PI; var PolarChartComponent = /** @class */ (function (_super) { __extends(PolarChartComponent, _super); function PolarChartComponent() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.legendTitle = 'Legend'; _this.showGridLines = true; _this.curve = __WEBPACK_IMPORTED_MODULE_3_d3_shape__["curveCardinalClosed"]; _this.activeEntries = []; _this.rangeFillOpacity = 0.15; _this.roundDomains = false; _this.tooltipDisabled = false; _this.showSeriesOnHover = true; _this.gradient = false; _this.yAxisMinScale = 0; _this.activate = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); _this.deactivate = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); _this.margin = [10, 20, 10, 20]; _this.xAxisHeight = 0; _this.yAxisWidth = 0; return _this; } PolarChartComponent.prototype.update = function () { _super.prototype.update.call(this); this.setDims(); this.setScales(); this.setColors(); this.legendOptions = this.getLegendOptions(); this.setTicks(); }; PolarChartComponent.prototype.setDims = function () { this.dims = Object(__WEBPACK_IMPORTED_MODULE_4__common_view_dimensions_helper__["a" /* calculateViewDimensions */])({ width: this.width, height: this.height, margins: this.margin, showXAxis: this.xAxis, showYAxis: this.yAxis, xAxisHeight: this.xAxisHeight, yAxisWidth: this.yAxisWidth, showXLabel: this.showXAxisLabel, showYLabel: this.showYAxisLabel, showLegend: this.legend, legendType: this.schemeType }); var halfWidth = ~~(this.dims.width / 2); var halfHeight = ~~(this.dims.height / 2); var outerRadius = this.outerRadius = Math.min(halfHeight / 1.5, halfWidth / 1.5); var yOffset = Math.max(0, halfHeight - outerRadius); this.yAxisDims = __assign({}, this.dims, { width: halfWidth }); this.transform = "translate(" + this.dims.xOffset + ", " + this.margin[0] + ")"; this.transformYAxis = "translate(0, " + yOffset + ")"; this.labelOffset = this.dims.height + 40; this.transformPlot = "translate(" + halfWidth + ", " + halfHeight + ")"; }; PolarChartComponent.prototype.setScales = function () { var xValues = this.getXValues(); this.scaleType = this.getScaleType(xValues); this.xDomain = this.filteredDomain || this.getXDomain(xValues); this.yDomain = this.getYDomain(); this.seriesDomain = this.getSeriesDomain(); this.xScale = this.getXScale(this.xDomain, twoPI); this.yScale = this.getYScale(this.yDomain, this.outerRadius); this.yAxisScale = this.getYScale(this.yDomain.reverse(), this.outerRadius); }; PolarChartComponent.prototype.setTicks = function () { var _this = this; var tickFormat; if (this.xAxisTickFormatting) { tickFormat = this.xAxisTickFormatting; } else if (this.xScale.tickFormat) { tickFormat = this.xScale.tickFormat.apply(this.xScale, [5]); } else { tickFormat = function (d) { if (Object(__WEBPACK_IMPORTED_MODULE_7__utils_types__["a" /* isDate */])(d)) { return d.toLocaleDateString(); } return d.toLocaleString(); }; } var outerRadius = this.outerRadius; var s = 1.1; this.thetaTicks = this.xDomain.map(function (d) { var startAngle = _this.xScale(d); var dd = s * outerRadius * (startAngle > Math.PI ? -1 : 1); var label = tickFormat(d); var startPos = [outerRadius * Math.sin(startAngle), -outerRadius * Math.cos(startAngle)]; var pos = [dd, s * startPos[1]]; return { innerRadius: 0, outerRadius: outerRadius, startAngle: startAngle, endAngle: startAngle, value: outerRadius, label: label, startPos: startPos, pos: pos }; }); var minDistance = 10; /* from pie chart, abstract out -*/ for (var i = 0; i < this.thetaTicks.length - 1; i++) { var a = this.thetaTicks[i]; for (var j = i + 1; j < this.thetaTicks.length; j++) { var b = this.thetaTicks[j]; // if they're on the same side if (b.pos[0] * a.pos[0] > 0) { // if they're overlapping var o = minDistance - Math.abs(b.pos[1] - a.pos[1]); if (o > 0) { // push the second up or down b.pos[1] += Math.sign(b.pos[0]) * o; } } } } this.radiusTicks = this.yAxisScale .ticks(~~(this.dims.height / 50)) .map(function (d) { return _this.yScale(d); }); }; PolarChartComponent.prototype.getXValues = function () { var values = []; for (var _i = 0, _a = this.results; _i < _a.length; _i++) { var results = _a[_i]; for (var _b = 0, _c = results.series; _b < _c.length; _b++) { var d = _c[_b]; if (!values.includes(d.name)) { values.push(d.name); } } } return values; }; PolarChartComponent.prototype.getXDomain = function (values) { if (values === void 0) { values = this.getXValues(); } if (this.scaleType === 'time') { var min = Math.min.apply(Math, values); var max = Math.max.apply(Math, values); return [min, max]; } else if (this.scaleType === 'linear') { values = values.map(function (v) { return Number(v); }); var min = Math.min.apply(Math, values); var max = Math.max.apply(Math, values); return [min, max]; } return values; }; PolarChartComponent.prototype.getYValues = function () { var domain = []; for (var _i = 0, _a = this.results; _i < _a.length; _i++) { var results = _a[_i]; for (var _b = 0, _c = results.series; _b < _c.length; _b++) { var d = _c[_b]; if (domain.indexOf(d.value) < 0) { domain.push(d.value); } if (d.min !== undefined) { if (domain.indexOf(d.min) < 0) { domain.push(d.min); } } if (d.max !== undefined) { if (domain.indexOf(d.max) < 0) { domain.push(d.max); } } } } return domain; }; PolarChartComponent.prototype.getYDomain = function (domain) { if (domain === void 0) { domain = this.getYValues(); } var min = Math.min.apply(Math, domain); var max = Math.max.apply(Math, [this.yAxisMinScale].concat(domain)); min = Math.max(0, min); if (!this.autoScale) { min = Math.min(0, min); } return [min, max]; }; PolarChartComponent.prototype.getSeriesDomain = function () { return this.results.map(function (d) { return d.name; }); }; PolarChartComponent.prototype.getXScale = function (domain, width) { switch (this.scaleType) { case 'time': return Object(__WEBPACK_IMPORTED_MODULE_2_d3_scale__["scaleTime"])() .range([0, width]) .domain(domain); case 'linear': var scale = Object(__WEBPACK_IMPORTED_MODULE_2_d3_scale__["scaleLinear"])() .range([0, width]) .domain(domain); return this.roundDomains ? scale.nice() : scale; default: return Object(__WEBPACK_IMPORTED_MODULE_2_d3_scale__["scalePoint"])() .range([0, width - twoPI / domain.length]) .padding(0) .domain(domain); } }; PolarChartComponent.prototype.getYScale = function (domain, height) { var scale = Object(__WEBPACK_IMPORTED_MODULE_2_d3_scale__["scaleLinear"])() .range([0, height]) .domain(domain); return this.roundDomains ? scale.nice() : scale; }; PolarChartComponent.prototype.getScaleType = function (values) { var date = true; var num = true; for (var _i = 0, values_1 = values; _i < values_1.length; _i++) { var value = values_1[_i]; if (!Object(__WEBPACK_IMPORTED_MODULE_7__utils_types__["a" /* isDate */])(value)) { date = false; } if (!Object(__WEBPACK_IMPORTED_MODULE_7__utils_types__["b" /* isNumber */])(value)) { num = false; } } if (date) return 'time'; if (num) return 'linear'; return 'ordinal'; }; PolarChartComponent.prototype.onClick = function (data, series) { if (series) { data.series = series.name; } this.select.emit(data); }; PolarChartComponent.prototype.setColors = function () { var domain = (this.schemeType === 'ordinal') ? this.seriesDomain : this.yDomain.reverse(); this.colors = new __WEBPACK_IMPORTED_MODULE_5__common_color_helper__["a" /* ColorHelper */](this.scheme, this.schemeType, domain, this.customColors); }; PolarChartComponent.prototype.getLegendOptions = function () { if (this.schemeType === 'ordinal') { return { scaleType: this.schemeType, colors: this.colors, domain: this.seriesDomain, title: this.legendTitle }; } return { scaleType: this.schemeType, colors: this.colors.scale, domain: this.yDomain, title: undefined }; }; PolarChartComponent.prototype.updateYAxisWidth = function (_a) { var width = _a.width; this.yAxisWidth = width; this.update(); }; PolarChartComponent.prototype.updateXAxisHeight = function (_a) { var height = _a.height; this.xAxisHeight = height; this.update(); }; PolarChartComponent.prototype.onActivate = function (item) { var idx = this.activeEntries.findIndex(function (d) { return d.name === item.name && d.value === item.value; }); if (idx > -1) { return; } this.activeEntries = this.showSeriesOnHover ? [item].concat(this.activeEntries) : this.activeEntries; this.activate.emit({ value: item, entries: this.activeEntries }); }; PolarChartComponent.prototype.onDeactivate = function (item) { var idx = this.activeEntries.findIndex(function (d) { return d.name === item.name && d.value === item.value; }); this.activeEntries.splice(idx, 1); this.activeEntries = this.activeEntries.slice(); this.deactivate.emit({ value: item, entries: this.activeEntries }); }; PolarChartComponent.prototype.deactivateAll = function () { this.activeEntries = this.activeEntries.slice(); for (var _i = 0, _a = this.activeEntries; _i < _a.length; _i++) { var entry = _a[_i]; this.deactivate.emit({ value: entry, entries: [] }); } this.activeEntries = []; }; PolarChartComponent.prototype.trackBy = function (index, item) { return item.name; }; __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], PolarChartComponent.prototype, "legend", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", String) ], PolarChartComponent.prototype, "legendTitle", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], PolarChartComponent.prototype, "xAxis", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], PolarChartComponent.prototype, "yAxis", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], PolarChartComponent.prototype, "showXAxisLabel", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], PolarChartComponent.prototype, "showYAxisLabel", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", String) ], PolarChartComponent.prototype, "xAxisLabel", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", String) ], PolarChartComponent.prototype, "yAxisLabel", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], PolarChartComponent.prototype, "autoScale", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], PolarChartComponent.prototype, "showGridLines", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], PolarChartComponent.prototype, "curve", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Array) ], PolarChartComponent.prototype, "activeEntries", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", String) ], PolarChartComponent.prototype, "schemeType", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Number) ], PolarChartComponent.prototype, "rangeFillOpacity", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Function) ], PolarChartComponent.prototype, "xAxisTickFormatting", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Function) ], PolarChartComponent.prototype, "yAxisTickFormatting", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], PolarChartComponent.prototype, "roundDomains", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], PolarChartComponent.prototype, "tooltipDisabled", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], PolarChartComponent.prototype, "showSeriesOnHover", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], PolarChartComponent.prototype, "gradient", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Number) ], PolarChartComponent.prototype, "yAxisMinScale", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"]) ], PolarChartComponent.prototype, "activate", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"]) ], PolarChartComponent.prototype, "deactivate", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["ContentChild"])('tooltipTemplate'), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["TemplateRef"]) ], PolarChartComponent.prototype, "tooltipTemplate", void 0); PolarChartComponent = __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ selector: 'ngx-charts-polar-chart', template: "\n <ngx-charts-chart\n [view]=\"[width, height]\"\n [showLegend]=\"legend\"\n [legendOptions]=\"legendOptions\"\n [activeEntries]=\"activeEntries\"\n [animations]=\"animations\"\n (legendLabelClick)=\"onClick($event)\"\n (legendLabelActivate)=\"onActivate($event)\"\n (legendLabelDeactivate)=\"onDeactivate($event)\">\n <svg:g class=\"polar-chart chart\" [attr.transform]=\"transform\">\n <svg:g [attr.transform]=\"transformPlot\">\n <svg:circle\n class=\"polar-chart-background\"\n cx=\"0\" cy=\"0\"\n [attr.r]=\"this.outerRadius\" />\n <svg:g *ngIf=\"showGridLines\">\n <svg:circle\n *ngFor=\"let r of radiusTicks\"\n class=\"gridline-path radial-gridline-path\"\n cx=\"0\" cy=\"0\"\n [attr.r]=\"r\" />\n </svg:g>\n <svg:g *ngIf=\"xAxis\">\n <svg:g ngx-charts-pie-label\n *ngFor=\"let tick of thetaTicks\"\n [data]=\"tick\"\n [radius]=\"outerRadius\"\n [label]=\"tick.label\"\n [max]=\"outerRadius\"\n [value]=\"showGridLines ? 1 : outerRadius\"\n [explodeSlices]=\"true\"\n [animations]=\"animations\">\n </svg:g>\n </svg:g>\n </svg:g>\n <svg:g ngx-charts-y-axis\n [attr.transform]=\"transformYAxis\"\n *ngIf=\"yAxis\"\n [yScale]=\"yAxisScale\"\n [dims]=\"yAxisDims\"\n [showGridLines]=\"showGridLines\"\n [showLabel]=\"showYAxisLabel\"\n [labelText]=\"yAxisLabel\"\n [tickFormatting]=\"yAxisTickFormatting\"\n (dimensionsChanged)=\"updateYAxisWidth($event)\">\n </svg:g>\n <svg:g ngx-charts-axis-label\n *ngIf=\"xAxis && showXAxisLabel\"\n [label]=\"xAxisLabel\"\n [offset]=\"labelOffset\"\n [orient]=\"'bottom'\"\n [height]=\"dims.height\"\n [width]=\"dims.width\">\n </svg:g>\n <svg:g [attr.transform]=\"transformPlot\">\n <svg:g *ngFor=\"let series of results; trackBy:trackBy\" [@animationState]=\"'active'\">\n <svg:g ngx-charts-polar-series\n [gradient]=\"gradient\"\n [xScale]=\"xScale\"\n [yScale]=\"yScale\"\n [colors]=\"colors\"\n [data]=\"series\"\n [activeEntries]=\"activeEntries\"\n [scaleType]=\"scaleType\"\n [curve]=\"curve\"\n [rangeFillOpacity]=\"rangeFillOpacity\"\n [animations]=\"animations\"\n [tooltipDisabled]=\"tooltipDisabled\"\n [tooltipTemplate]=\"tooltipTemplate\"\n />\n </svg:g>\n </svg:g>\n </svg:g>\n </ngx-charts-chart>\n ", styles: [ __webpack_require__("./src/common/base-chart.component.scss"), __webpack_require__("./src/pie-chart/pie-chart.component.scss"), __webpack_require__("./src/polar-chart/polar-chart.component.scss") ], encapsulation: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ViewEncapsulation"].None, changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectionStrategy"].OnPush, animations: [ Object(__WEBPACK_IMPORTED_MODULE_1__angular_animations__["trigger"])('animationState', [ Object(__WEBPACK_IMPORTED_MODULE_1__angular_animations__["transition"])(':leave', [ Object(__WEBPACK_IMPORTED_MODULE_1__angular_animations__["style"])({ opacity: 1, }), Object(__WEBPACK_IMPORTED_MODULE_1__angular_animations__["animate"])(500, Object(__WEBPACK_IMPORTED_MODULE_1__angular_animations__["style"])({ opacity: 0 })) ]) ]) ] }) ], PolarChartComponent); return PolarChartComponent; }(__WEBPACK_IMPORTED_MODULE_6__common_base_chart_component__["a" /* BaseChartComponent */])); /***/ }), /***/ "./src/polar-chart/polar-chart.module.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return PolarChartModule; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("@angular/core"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__common_chart_common_module__ = __webpack_require__("./src/common/chart-common.module.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__polar_chart_component__ = __webpack_require__("./src/polar-chart/polar-chart.component.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__polar_series_component__ = __webpack_require__("./src/polar-chart/polar-series.component.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__pie_chart___ = __webpack_require__("./src/pie-chart/index.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__line_chart___ = __webpack_require__("./src/line-chart/index.ts"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return __WEBPACK_IMPORTED_MODULE_2__polar_chart_component__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return __WEBPACK_IMPORTED_MODULE_3__polar_series_component__["a"]; }); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var PolarChartModule = /** @class */ (function () { function PolarChartModule() { } PolarChartModule = __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["NgModule"])({ imports: [__WEBPACK_IMPORTED_MODULE_1__common_chart_common_module__["a" /* ChartCommonModule */], __WEBPACK_IMPORTED_MODULE_4__pie_chart___["d" /* PieChartModule */], __WEBPACK_IMPORTED_MODULE_5__line_chart___["b" /* LineChartModule */]], declarations: [ __WEBPACK_IMPORTED_MODULE_2__polar_chart_component__["a" /* PolarChartComponent */], __WEBPACK_IMPORTED_MODULE_3__polar_series_component__["a" /* PolarSeriesComponent */] ], exports: [ __WEBPACK_IMPORTED_MODULE_2__polar_chart_component__["a" /* PolarChartComponent */], __WEBPACK_IMPORTED_MODULE_3__polar_series_component__["a" /* PolarSeriesComponent */] ] }) ], PolarChartModule); return PolarChartModule; }()); /***/ }), /***/ "./src/polar-chart/polar-series.component.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return PolarSeriesComponent; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("@angular/core"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_d3_shape__ = __webpack_require__("d3-shape"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_d3_shape___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_d3_shape__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__utils_id__ = __webpack_require__("./src/utils/id.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__utils_sort__ = __webpack_require__("./src/utils/sort.ts"); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var PolarSeriesComponent = /** @class */ (function () { function PolarSeriesComponent() { this.tooltipDisabled = false; this.gradient = false; this.animations = true; this.circleRadius = 3; } PolarSeriesComponent.prototype.ngOnChanges = function (changes) { this.update(); }; PolarSeriesComponent.prototype.update = function () { var _this = this; this.updateGradients(); var line = this.getLineGenerator(); var data = this.sortData(this.data.series); var seriesName = this.data.name; var linearScaleType = this.colors.scaleType === 'linear'; var min = this.yScale.domain()[0]; this.seriesColor = this.colors.getColor(linearScaleType ? min : seriesName); this.path = line(data) || ''; this.circles = data.map(function (d) { var a = _this.getAngle(d); var r = _this.getRadius(d); var value = d.value; var color = _this.colors.getColor(linearScaleType ? Math.abs(value) : seriesName); var cData = { series: seriesName, value: value, name: d.name }; return { data: cData, cx: r * Math.sin(a), cy: -r * Math.cos(a), value: value, color: color, label: d.name }; }); this.active = this.isActive(this.data); this.inactive = this.isInactive(this.data); this.tooltipText = this.tooltipText || (function (c) { return _this.defaultTooltipText(c); }); }; PolarSeriesComponent.prototype.getAngle = function (d) { var label = d.name; if (this.scaleType === 'time') { return this.xScale(label); } else if (this.scaleType === 'linear') { return this.xScale(Number(label)); } return this.xScale(label); }; PolarSeriesComponent.prototype.getRadius = function (d) { return this.yScale(d.value); }; PolarSeriesComponent.prototype.getLineGenerator = function () { var _this = this; return Object(__WEBPACK_IMPORTED_MODULE_1_d3_shape__["radialLine"])() .angle(function (d) { return _this.getAngle(d); }) .radius(function (d) { return _this.getRadius(d); }) .curve(this.curve); }; PolarSeriesComponent.prototype.sortData = function (data) { if (this.scaleType === 'linear') { return Object(__WEBPACK_IMPORTED_MODULE_3__utils_sort__["c" /* sortLinear */])(data, 'name'); } else if (this.scaleType === 'time') { return Object(__WEBPACK_IMPORTED_MODULE_3__utils_sort__["b" /* sortByTime */])(data, 'name'); } return Object(__WEBPACK_IMPORTED_MODULE_3__utils_sort__["a" /* sortByDomain */])(data, 'name', 'asc', this.xScale.domain()); }; PolarSeriesComponent.prototype.isActive = function (entry) { if (!this.activeEntries) return false; var item = this.activeEntries.find(function (d) { return entry.name === d.name; }); return item !== undefined; }; PolarSeriesComponent.prototype.isInactive = function (entry) { if (!this.activeEntries || this.activeEntries.length === 0) return false; var item = this.activeEntries.find(function (d) { return entry.name === d.name; }); return item === undefined; }; PolarSeriesComponent.prototype.defaultTooltipText = function (_a) { var label = _a.label, value = _a.value; return "\n <span class=\"tooltip-label\">" + this.data.name + " \u2022 " + label + "</span>\n <span class=\"tooltip-val\">" + value.toLocaleString() + "</span>\n "; }; PolarSeriesComponent.prototype.updateGradients = function () { this.hasGradient = this.gradient || this.colors.scaleType === 'linear'; if (!this.hasGradient) { return; } this.gradientId = 'grad' + Object(__WEBPACK_IMPORTED_MODULE_2__utils_id__["a" /* id */])().toString(); this.gradientUrl = "url(#" + this.gradientId + ")"; if (this.colors.scaleType === 'linear') { var values = this.data.series.map(function (d) { return d.value; }); var max = Math.max.apply(Math, values); var min = Math.min.apply(Math, values); this.gradientStops = this.colors.getLinearGradientStops(max, min); } else { this.gradientStops = undefined; } }; __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], PolarSeriesComponent.prototype, "name", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], PolarSeriesComponent.prototype, "data", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], PolarSeriesComponent.prototype, "xScale", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], PolarSeriesComponent.prototype, "yScale", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], PolarSeriesComponent.prototype, "colors", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], PolarSeriesComponent.prototype, "scaleType", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], PolarSeriesComponent.prototype, "curve", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Array) ], PolarSeriesComponent.prototype, "activeEntries", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Number) ], PolarSeriesComponent.prototype, "rangeFillOpacity", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], PolarSeriesComponent.prototype, "tooltipDisabled", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Function) ], PolarSeriesComponent.prototype, "tooltipText", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], PolarSeriesComponent.prototype, "gradient", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["TemplateRef"]) ], PolarSeriesComponent.prototype, "tooltipTemplate", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], PolarSeriesComponent.prototype, "animations", void 0); PolarSeriesComponent = __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ selector: 'g[ngx-charts-polar-series]', template: "\n <svg:g class=\"polar-charts-series\">\n <defs>\n <svg:g ngx-charts-svg-radial-gradient *ngIf=\"hasGradient\"\n orientation=\"vertical\"\n [color]=\"seriesColor\"\n [name]=\"gradientId\"\n [startOpacity]=\"0.25\"\n [endOpacity]=\"1\"\n [stops]=\"gradientStops\"\n />\n </defs>\n <svg:g ngx-charts-line\n class=\"polar-series-path\"\n [path]=\"path\"\n [stroke]=\"hasGradient ? gradientUrl : seriesColor\"\n [class.active]=\"active\"\n [class.inactive]=\"inactive\"\n [attr.fill-opacity]=\"rangeFillOpacity\"\n [fill]=\"hasGradient ? gradientUrl : seriesColor\"\n [animations]=\"animations\"\n />\n <svg:g ngx-charts-circle\n *ngFor=\"let circle of circles\"\n class=\"circle\"\n [cx]=\"circle.cx\"\n [cy]=\"circle.cy\"\n [r]=\"circleRadius\"\n [fill]=\"circle.color\"\n [style.opacity]=\"inactive ? 0.2 : 1\"\n ngx-tooltip\n [tooltipDisabled]=\"tooltipDisabled\"\n [tooltipPlacement]=\"'top'\"\n tooltipType=\"tooltip\"\n [tooltipTitle]=\"tooltipTemplate ? undefined : tooltipText(circle)\"\n [tooltipTemplate]=\"tooltipTemplate\"\n [tooltipContext]=\"circle.data\">\n </svg:g>\n </svg:g>\n ", changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectionStrategy"].OnPush }) ], PolarSeriesComponent); return PolarSeriesComponent; }()); /***/ }), /***/ "./src/polyfills.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export ngxChartsPolyfills */ // The export is needed here to generate a valid polyfills.metadata.json file function ngxChartsPolyfills() { // IE11 fix // Ref: https://github.com/swimlane/ngx-charts/issues/386 if (typeof (SVGElement) !== 'undefined' && typeof SVGElement.prototype.contains === 'undefined') { SVGElement.prototype.contains = HTMLDivElement.prototype.contains; } } ngxChartsPolyfills(); /***/ }), /***/ "./src/tree-map/index.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tree_map_module__ = __webpack_require__("./src/tree-map/tree-map.module.ts"); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "a", function() { return __WEBPACK_IMPORTED_MODULE_0__tree_map_module__["a"]; }); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "b", function() { return __WEBPACK_IMPORTED_MODULE_0__tree_map_module__["b"]; }); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "c", function() { return __WEBPACK_IMPORTED_MODULE_0__tree_map_module__["c"]; }); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "d", function() { return __WEBPACK_IMPORTED_MODULE_0__tree_map_module__["d"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__tree_map_component__ = __webpack_require__("./src/tree-map/tree-map.component.ts"); /* unused harmony namespace reexport */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__tree_map_cell_component__ = __webpack_require__("./src/tree-map/tree-map-cell.component.ts"); /* unused harmony namespace reexport */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__tree_map_cell_series_component__ = __webpack_require__("./src/tree-map/tree-map-cell-series.component.ts"); /* unused harmony namespace reexport */ /***/ }), /***/ "./src/tree-map/tree-map-cell-series.component.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return TreeMapCellSeriesComponent; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("@angular/core"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var TreeMapCellSeriesComponent = /** @class */ (function () { function TreeMapCellSeriesComponent() { this.gradient = false; this.tooltipDisabled = false; this.animations = true; this.select = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); } TreeMapCellSeriesComponent.prototype.ngOnChanges = function (changes) { this.cells = this.getCells(); }; TreeMapCellSeriesComponent.prototype.getCells = function () { var _this = this; return this.data.children .filter(function (d) { return d.depth === 1; }) .map(function (d, index) { var label = d.id; var data = { name: label, value: d.value }; return { data: data, x: d.x0, y: d.y0, width: d.x1 - d.x0, height: d.y1 - d.y0, fill: _this.colors.getColor(label), label: label, value: d.value, valueType: d.valueType }; }); }; TreeMapCellSeriesComponent.prototype.getTooltipText = function (_a) { var label = _a.label, value = _a.value; return "\n <span class=\"tooltip-label\">" + label + "</span>\n <span class=\"tooltip-val\">" + value.toLocaleString() + "</span>\n "; }; TreeMapCellSeriesComponent.prototype.onClick = function (data) { this.select.emit(data); }; TreeMapCellSeriesComponent.prototype.trackBy = function (index, item) { return item.label; }; __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], TreeMapCellSeriesComponent.prototype, "data", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], TreeMapCellSeriesComponent.prototype, "dims", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], TreeMapCellSeriesComponent.prototype, "colors", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], TreeMapCellSeriesComponent.prototype, "valueFormatting", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], TreeMapCellSeriesComponent.prototype, "labelFormatting", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], TreeMapCellSeriesComponent.prototype, "gradient", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], TreeMapCellSeriesComponent.prototype, "tooltipDisabled", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["TemplateRef"]) ], TreeMapCellSeriesComponent.prototype, "tooltipTemplate", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], TreeMapCellSeriesComponent.prototype, "animations", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", Object) ], TreeMapCellSeriesComponent.prototype, "select", void 0); TreeMapCellSeriesComponent = __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ selector: 'g[ngx-charts-tree-map-cell-series]', template: "\n <svg:g ngx-charts-tree-map-cell *ngFor=\"let c of cells; trackBy:trackBy\"\n [data]=\"c\"\n [x]=\"c.x\"\n [y]=\"c.y\"\n [width]=\"c.width\"\n [height]=\"c.height\"\n [fill]=\"c.fill\"\n [label]=\"c.label\"\n [value]=\"c.value\"\n [valueType]=\"c.valueType\"\n [valueFormatting]=\"valueFormatting\"\n [labelFormatting]=\"labelFormatting\"\n [gradient]=\"gradient\"\n [animations]=\"animations\"\n (select)=\"onClick($event)\"\n ngx-tooltip\n [tooltipDisabled]=\"tooltipDisabled\"\n [tooltipPlacement]=\"'top'\"\n [tooltipType]=\"'tooltip'\"\n [tooltipTitle]=\"tooltipTemplate ? undefined : getTooltipText(c)\"\n [tooltipTemplate]=\"tooltipTemplate\"\n [tooltipContext]=\"c.data\">\n </svg:g>\n ", changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectionStrategy"].OnPush }) ], TreeMapCellSeriesComponent); return TreeMapCellSeriesComponent; }()); /***/ }), /***/ "./src/tree-map/tree-map-cell.component.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return TreeMapCellComponent; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("@angular/core"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_d3_selection__ = __webpack_require__("d3-selection"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_d3_selection___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_d3_selection__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__utils_color_utils__ = __webpack_require__("./src/utils/color-utils.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__common_trim_label_helper__ = __webpack_require__("./src/common/trim-label.helper.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__utils_id__ = __webpack_require__("./src/utils/id.ts"); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var TreeMapCellComponent = /** @class */ (function () { function TreeMapCellComponent(element) { this.gradient = false; this.animations = true; this.select = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); this.initialized = false; this.element = element.nativeElement; } TreeMapCellComponent.prototype.ngOnChanges = function () { this.update(); this.valueFormatting = this.valueFormatting || (function (cell) { return cell.value.toLocaleString(); }); var labelFormatting = this.labelFormatting || (function (cell) { return Object(__WEBPACK_IMPORTED_MODULE_3__common_trim_label_helper__["a" /* trimLabel */])(cell.label, 55); }); var cellData = { data: this.data, label: this.label, value: this.value }; this.formattedValue = this.valueFormatting(cellData); this.formattedLabel = labelFormatting(cellData); this.gradientId = 'grad' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_id__["a" /* id */])().toString(); this.gradientUrl = "url(#" + this.gradientId + ")"; this.gradientStops = this.getGradientStops(); }; TreeMapCellComponent.prototype.update = function () { if (this.initialized) { this.animateToCurrentForm(); } else { if (this.animations) { this.loadAnimation(); } this.initialized = true; } }; TreeMapCellComponent.prototype.loadAnimation = function () { var node = Object(__WEBPACK_IMPORTED_MODULE_1_d3_selection__["select"])(this.element).select('.cell'); node .attr('opacity', 0) .attr('x', this.x) .attr('y', this.y); this.animateToCurrentForm(); }; TreeMapCellComponent.prototype.getTextColor = function () { return Object(__WEBPACK_IMPORTED_MODULE_2__utils_color_utils__["a" /* invertColor */])(this.fill); }; TreeMapCellComponent.prototype.animateToCurrentForm = function () { var node = Object(__WEBPACK_IMPORTED_MODULE_1_d3_selection__["select"])(this.element).select('.cell'); if (this.animations) { node.transition().duration(750) .attr('opacity', 1) .attr('x', this.x) .attr('y', this.y) .attr('width', this.width) .attr('height', this.height); } else { node .attr('opacity', 1) .attr('x', this.x) .attr('y', this.y) .attr('width', this.width) .attr('height', this.height); } }; TreeMapCellComponent.prototype.onClick = function () { this.select.emit({ name: this.label, value: this.value }); }; TreeMapCellComponent.prototype.getGradientStops = function () { return [ { offset: 0, color: this.fill, opacity: 0.3 }, { offset: 100, color: this.fill, opacity: 1 } ]; }; __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], TreeMapCellComponent.prototype, "data", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], TreeMapCellComponent.prototype, "fill", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], TreeMapCellComponent.prototype, "x", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], TreeMapCellComponent.prototype, "y", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], TreeMapCellComponent.prototype, "width", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], TreeMapCellComponent.prototype, "height", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], TreeMapCellComponent.prototype, "label", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], TreeMapCellComponent.prototype, "value", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], TreeMapCellComponent.prototype, "valueType", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], TreeMapCellComponent.prototype, "valueFormatting", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], TreeMapCellComponent.prototype, "labelFormatting", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], TreeMapCellComponent.prototype, "gradient", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], TreeMapCellComponent.prototype, "animations", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", Object) ], TreeMapCellComponent.prototype, "select", void 0); TreeMapCellComponent = __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ selector: 'g[ngx-charts-tree-map-cell]', template: "\n <svg:g>\n <defs *ngIf=\"gradient\">\n <svg:g ngx-charts-svg-linear-gradient\n orientation=\"vertical\"\n [name]=\"gradientId\"\n [stops]=\"gradientStops\"\n />\n </defs>\n <svg:rect\n [attr.fill]=\"gradient ? gradientUrl : fill\"\n [attr.width]=\"width\"\n [attr.height]=\"height\"\n [attr.x]=\"x\"\n [attr.y]=\"y\"\n [style.cursor]=\"'pointer'\"\n class=\"cell\"\n (click)=\"onClick()\"\n />\n <svg:foreignObject\n *ngIf=\"width >= 70 && height >= 35\"\n [attr.x]=\"x\"\n [attr.y]=\"y\"\n [attr.width]=\"width\"\n [attr.height]=\"height\"\n class=\"label\"\n [style.pointer-events]=\"'none'\">\n <xhtml:p\n [style.color]=\"getTextColor()\"\n [style.height]=\"height + 'px'\"\n [style.width]=\"width + 'px'\">\n <xhtml:span class=\"treemap-label\" [innerHTML]=\"formattedLabel\">\n </xhtml:span>\n <xhtml:br />\n <xhtml:span *ngIf=\"animations\"\n class=\"treemap-val\" \n ngx-charts-count-up \n [countTo]=\"value\"\n [valueFormatting]=\"valueFormatting\">\n </xhtml:span>\n <xhtml:span *ngIf=\"!animations\"\n class=\"treemap-val\">\n {{formattedValue}}\n </xhtml:span>\n </xhtml:p>\n </svg:foreignObject>\n </svg:g>\n ", changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectionStrategy"].OnPush }), __metadata("design:paramtypes", [__WEBPACK_IMPORTED_MODULE_0__angular_core__["ElementRef"]]) ], TreeMapCellComponent); return TreeMapCellComponent; }()); /***/ }), /***/ "./src/tree-map/tree-map.component.scss": /***/ (function(module, exports, __webpack_require__) { var result = __webpack_require__("./node_modules/css-loader/index.js!./node_modules/postcss-loader/index.js!./node_modules/sass-loader/lib/loader.js??ref--3-4!./src/tree-map/tree-map.component.scss"); if (typeof result === "string") { module.exports = result; } else { module.exports = result.toString(); } /***/ }), /***/ "./src/tree-map/tree-map.component.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return TreeMapComponent; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("@angular/core"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_d3_hierarchy__ = __webpack_require__("d3-hierarchy"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_d3_hierarchy___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_d3_hierarchy__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__common_base_chart_component__ = __webpack_require__("./src/common/base-chart.component.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__common_view_dimensions_helper__ = __webpack_require__("./src/common/view-dimensions.helper.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__common_color_helper__ = __webpack_require__("./src/common/color.helper.ts"); var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var TreeMapComponent = /** @class */ (function (_super) { __extends(TreeMapComponent, _super); function TreeMapComponent() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.tooltipDisabled = false; _this.gradient = false; _this.select = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); _this.margin = [10, 10, 10, 10]; return _this; } TreeMapComponent.prototype.update = function () { _super.prototype.update.call(this); this.dims = Object(__WEBPACK_IMPORTED_MODULE_3__common_view_dimensions_helper__["a" /* calculateViewDimensions */])({ width: this.width, height: this.height, margins: this.margin }); this.domain = this.getDomain(); this.treemap = Object(__WEBPACK_IMPORTED_MODULE_1_d3_hierarchy__["treemap"])() .size([this.dims.width, this.dims.height]); var rootNode = { name: 'root', value: 0, isRoot: true }; var root = Object(__WEBPACK_IMPORTED_MODULE_1_d3_hierarchy__["stratify"])() .id(function (d) { var label = d.name; if (label.constructor.name === 'Date') { label = label.toLocaleDateString(); } else { label = label.toLocaleString(); } return label; }) .parentId(function (d) { return d.isRoot ? null : 'root'; })([rootNode].concat(this.results)) .sum(function (d) { return d.value; }); this.data = this.treemap(root); this.setColors(); this.transform = "translate(" + this.dims.xOffset + " , " + this.margin[0] + ")"; }; TreeMapComponent.prototype.getDomain = function () { return this.results.map(function (d) { return d.name; }); }; TreeMapComponent.prototype.onClick = function (data) { this.select.emit(data); }; TreeMapComponent.prototype.setColors = function () { this.colors = new __WEBPACK_IMPORTED_MODULE_4__common_color_helper__["a" /* ColorHelper */](this.scheme, 'ordinal', this.domain, this.customColors); }; __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], TreeMapComponent.prototype, "results", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], TreeMapComponent.prototype, "tooltipDisabled", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], TreeMapComponent.prototype, "valueFormatting", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Object) ], TreeMapComponent.prototype, "labelFormatting", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"])(), __metadata("design:type", Boolean) ], TreeMapComponent.prototype, "gradient", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", Object) ], TreeMapComponent.prototype, "select", void 0); __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["ContentChild"])('tooltipTemplate'), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["TemplateRef"]) ], TreeMapComponent.prototype, "tooltipTemplate", void 0); TreeMapComponent = __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ selector: 'ngx-charts-tree-map', template: "\n <ngx-charts-chart\n [view]=\"[width, height]\"\n [showLegend]=\"false\"\n [animations]=\"animations\">\n <svg:g [attr.transform]=\"transform\" class=\"tree-map chart\">\n <svg:g ngx-charts-tree-map-cell-series\n [colors]=\"colors\"\n [data]=\"data\"\n [dims]=\"dims\"\n [tooltipDisabled]=\"tooltipDisabled\"\n [tooltipTemplate]=\"tooltipTemplate\"\n [valueFormatting]=\"valueFormatting\"\n [labelFormatting]=\"labelFormatting\"\n [gradient]=\"gradient\"\n [animations]=\"animations\"\n (select)=\"onClick($event)\"\n />\n </svg:g>\n </ngx-charts-chart>\n ", styles: [__webpack_require__("./src/tree-map/tree-map.component.scss")], encapsulation: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ViewEncapsulation"].None, changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectionStrategy"].OnPush }) ], TreeMapComponent); return TreeMapComponent; }(__WEBPACK_IMPORTED_MODULE_2__common_base_chart_component__["a" /* BaseChartComponent */])); /***/ }), /***/ "./src/tree-map/tree-map.module.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return TreeMapModule; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("@angular/core"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__common_chart_common_module__ = __webpack_require__("./src/common/chart-common.module.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__tree_map_cell_component__ = __webpack_require__("./src/tree-map/tree-map-cell.component.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__tree_map_cell_series_component__ = __webpack_require__("./src/tree-map/tree-map-cell-series.component.ts"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__tree_map_component__ = __webpack_require__("./src/tree-map/tree-map.component.ts"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return __WEBPACK_IMPORTED_MODULE_2__tree_map_cell_component__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return __WEBPACK_IMPORTED_MODULE_3__tree_map_cell_series_component__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return __WEBPACK_IMPORTED_MODULE_4__tree_map_component__["a"]; }); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var TreeMapModule = /** @class */ (function () { function TreeMapModule() { } TreeMapModule = __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["NgModule"])({ imports: [__WEBPACK_IMPORTED_MODULE_1__common_chart_common_module__["a" /* ChartCommonModule */]], declarations: [ __WEBPACK_IMPORTED_MODULE_2__tree_map_cell_component__["a" /* TreeMapCellComponent */], __WEBPACK_IMPORTED_MODULE_3__tree_map_cell_series_component__["a" /* TreeMapCellSeriesComponent */], __WEBPACK_IMPORTED_MODULE_4__tree_map_component__["a" /* TreeMapComponent */] ], exports: [ __WEBPACK_IMPORTED_MODULE_2__tree_map_cell_component__["a" /* TreeMapCellComponent */], __WEBPACK_IMPORTED_MODULE_3__tree_map_cell_series_component__["a" /* TreeMapCellSeriesComponent */], __WEBPACK_IMPORTED_MODULE_4__tree_map_component__["a" /* TreeMapComponent */] ] }) ], TreeMapModule); return TreeMapModule; }()); /***/ }), /***/ "./src/utils/color-sets.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return colorSets; }); var colorSets = [ { name: 'vivid', selectable: true, group: 'Ordinal', domain: [ '#647c8a', '#3f51b5', '#2196f3', '#00b862', '#afdf0a', '#a7b61a', '#f3e562', '#ff9800', '#ff5722', '#ff4514' ] }, { name: 'natural', selectable: true, group: 'Ordinal', domain: [ '#bf9d76', '#e99450', '#d89f59', '#f2dfa7', '#a5d7c6', '#7794b1', '#afafaf', '#707160', '#ba9383', '#d9d5c3' ] }, { name: 'cool', selectable: true, group: 'Ordinal', domain: [ '#a8385d', '#7aa3e5', '#a27ea8', '#aae3f5', '#adcded', '#a95963', '#8796c0', '#7ed3ed', '#50abcc', '#ad6886' ] }, { name: 'fire', selectable: true, group: 'Ordinal', domain: [ '#ff3d00', '#bf360c', '#ff8f00', '#ff6f00', '#ff5722', '#e65100', '#ffca28', '#ffab00' ] }, { name: 'solar', selectable: true, group: 'Continuous', domain: [ '#fff8e1', '#ffecb3', '#ffe082', '#ffd54f', '#ffca28', '#ffc107', '#ffb300', '#ffa000', '#ff8f00', '#ff6f00' ] }, { name: 'air', selectable: true, group: 'Continuous', domain: [ '#e1f5fe', '#b3e5fc', '#81d4fa', '#4fc3f7', '#29b6f6', '#03a9f4', '#039be5', '#0288d1', '#0277bd', '#01579b' ] }, { name: 'aqua', selectable: true, group: 'Continuous', domain: [ '#e0f7fa', '#b2ebf2', '#80deea', '#4dd0e1', '#26c6da', '#00bcd4', '#00acc1', '#0097a7', '#00838f', '#006064' ] }, { name: 'flame', selectable: false, group: 'Ordinal', domain: [ '#A10A28', '#D3342D', '#EF6D49', '#FAAD67', '#FDDE90', '#DBED91', '#A9D770', '#6CBA67', '#2C9653', '#146738' ] }, { name: 'ocean', selectable: false, group: 'Ordinal', domain: [ '#1D68FB', '#33C0FC', '#4AFFFE', '#AFFFFF', '#FFFC63', '#FDBD2D', '#FC8A25', '#FA4F1E', '#FA141B', '#BA38D1' ] }, { name: 'forest', selectable: false, group: 'Ordinal', domain: [ '#55C22D', '#C1F33D', '#3CC099', '#AFFFFF', '#8CFC9D', '#76CFFA', '#BA60FB', '#EE6490', '#C42A1C', '#FC9F32' ] }, { name: 'horizon', selectable: false, group: 'Ordinal', domain: [ '#2597FB', '#65EBFD', '#99FDD0', '#FCEE4B', '#FEFCFA', '#FDD6E3', '#FCB1A8', '#EF6F7B', '#CB96E8', '#EFDEE0' ] }, { name: 'neons', selectable: false, group: 'Ordinal', domain: [ '#FF3333', '#FF33FF', '#CC33FF', '#0000FF', '#33CCFF', '#33FFFF', '#33FF66', '#CCFF33', '#FFCC00', '#FF6600' ] }, { name: 'picnic', selectable: false, group: 'Ordinal', domain: [ '#FAC51D', '#66BD6D', '#FAA026', '#29BB9C', '#E96B56', '#55ACD2', '#B7332F', '#2C83C9', '#9166B8', '#92E7E8' ] }, { name: 'night', selectable: false, group: 'Ordinal', domain: [ '#2B1B5A', '#501356', '#183356', '#28203F', '#391B3C', '#1E2B3C', '#120634', '#2D0432', '#051932', '#453080', '#75267D', '#2C507D', '#4B3880', '#752F7D', '#35547D' ] }, { name: 'nightLights', selectable: false, group: 'Ordinal', domain: [ '#4e31a5', '#9c25a7', '#3065ab', '#57468b', '#904497', '#46648b', '#32118d', '#a00fb3', '#1052a2', '#6e51bd', '#b63cc3', '#6c97cb', '#8671c1', '#b455be', '#7496c3' ] } ]; /***/ }), /***/ "./src/utils/color-utils.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export hexToRgb */ /* harmony export (immutable) */ __webpack_exports__["a"] = invertColor; /* unused harmony export shadeRGBColor */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_d3_color__ = __webpack_require__("d3-color"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_d3_color___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_d3_color__); /** * Converts a hex to RGB * * @export * @param {string} hex * @returns {*} */ function hexToRgb(value) { // deprecated, use d3.color() return __WEBPACK_IMPORTED_MODULE_0_d3_color__["rgb"](value); } /** * Accepts a color (string) and returns a inverted hex color (string) * http://stackoverflow.com/questions/9600295/automatically-change-text-color-to-assure-readability * * @export * @param {any} value * @returns {string} */ function invertColor(value) { var color = __WEBPACK_IMPORTED_MODULE_0_d3_color__["rgb"](value); var r = color.r, g = color.g, b = color.b, opacity = color.opacity; if (opacity === 0) { return color.toString(); } var yiq = ((r * 299) + (g * 587) + (b * 114)) / 1000; var depth = (yiq >= 128) ? -.8 : .8; return shadeRGBColor(color, depth); } /** * Given a rgb, it will darken/lighten * http://stackoverflow.com/questions/5560248/programmatically-lighten-or-darken-a-hex-color-or-rgb-and-blend-colors * * @export * @param {any} { r, g, b } * @param {any} percent * @returns */ function shadeRGBColor(_a, percent) { var r = _a.r, g = _a.g, b = _a.b; var t = percent < 0 ? 0 : 255; var p = percent < 0 ? percent * -1 : percent; r = (Math.round((t - r) * p) + r); g = (Math.round((t - g) * p) + g); b = (Math.round((t - b) * p) + b); return "rgb(" + r + ", " + g + ", " + b + ")"; } /***/ }), /***/ "./src/utils/id.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = id; var cache = {}; /** * Generates a short id. * * Description: * A 4-character alphanumeric sequence (364 = 1.6 million) * This should only be used for JavaScript specific models. * http://stackoverflow.com/questions/6248666/how-to-generate-short-uid-like-ax4j9z-in-js * * Example: `ebgf` */ function id() { var newId = ('0000' + (Math.random() * Math.pow(36, 4) << 0).toString(36)).slice(-4); // append a 'a' because neo gets mad newId = "a" + newId; // ensure not already used if (!cache[newId]) { cache[newId] = true; return newId; } return id(); } /***/ }), /***/ "./src/utils/index.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__id__ = __webpack_require__("./src/utils/id.ts"); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "b", function() { return __WEBPACK_IMPORTED_MODULE_0__id__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__color_sets__ = __webpack_require__("./src/utils/color-sets.ts"); /* unused harmony namespace reexport */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__sort__ = __webpack_require__("./src/utils/sort.ts"); /* unused harmony namespace reexport */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__throttle__ = __webpack_require__("./src/utils/throttle.ts"); /* unused harmony namespace reexport */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__color_utils__ = __webpack_require__("./src/utils/color-utils.ts"); /* unused harmony namespace reexport */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__visibility_observer__ = __webpack_require__("./src/utils/visibility-observer.ts"); /* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "a", function() { return __WEBPACK_IMPORTED_MODULE_5__visibility_observer__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__types__ = __webpack_require__("./src/utils/types.ts"); /* unused harmony namespace reexport */ /***/ }), /***/ "./src/utils/sort.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["c"] = sortLinear; /* harmony export (immutable) */ __webpack_exports__["a"] = sortByDomain; /* harmony export (immutable) */ __webpack_exports__["b"] = sortByTime; function sortLinear(data, property, direction) { if (direction === void 0) { direction = 'asc'; } return data.sort(function (a, b) { if (direction === 'asc') { return a[property] - b[property]; } else { return b[property] - a[property]; } }); } function sortByDomain(data, property, direction, domain) { if (direction === void 0) { direction = 'asc'; } return data.sort(function (a, b) { var aVal = a[property]; var bVal = b[property]; var aIdx = domain.indexOf(aVal); var bIdx = domain.indexOf(bVal); if (direction === 'asc') { return aIdx - bIdx; } else { return bIdx - aIdx; } }); } function sortByTime(data, property, direction) { if (direction === void 0) { direction = 'asc'; } return data.sort(function (a, b) { var aDate = a[property].getTime(); var bDate = b[property].getTime(); if (direction === 'asc') { if (aDate > bDate) return 1; if (bDate > aDate) return -1; return 0; } else { if (aDate > bDate) return -1; if (bDate > aDate) return 1; return 0; } }); } /***/ }), /***/ "./src/utils/throttle.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export throttle */ /* harmony export (immutable) */ __webpack_exports__["a"] = throttleable; /** * Throttle a function * * @export * @param {*} func * @param {number} wait * @param {*} [options] * @returns */ function throttle(func, wait, options) { options = options || {}; var context; var args; var result; var timeout = null; var previous = 0; function later() { previous = options.leading === false ? 0 : +new Date(); timeout = null; result = func.apply(context, args); } return function () { var now = +new Date(); if (!previous && options.leading === false) { previous = now; } var remaining = wait - (now - previous); context = this; args = arguments; if (remaining <= 0) { clearTimeout(timeout); timeout = null; previous = now; result = func.apply(context, args); } else if (!timeout && options.trailing !== false) { timeout = setTimeout(later, remaining); } return result; }; } /** * Throttle decorator * * class MyClass { * throttleable(10) * myFn() { ... } * } * * @export * @param {number} duration * @param {*} [options] * @returns */ function throttleable(duration, options) { return function innerDecorator(target, key, descriptor) { return { configurable: true, enumerable: descriptor.enumerable, get: function getter() { Object.defineProperty(this, key, { configurable: true, enumerable: descriptor.enumerable, value: throttle(descriptor.value, duration, options) }); return this[key]; } }; }; } /***/ }), /***/ "./src/utils/types.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = isDate; /* harmony export (immutable) */ __webpack_exports__["b"] = isNumber; function isDate(value) { return toString.call(value) === '[object Date]'; } function isNumber(value) { return typeof value === 'number'; } /***/ }), /***/ "./src/utils/visibility-observer.ts": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return VisibilityObserver; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("@angular/core"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; /** * Visibility Observer */ var VisibilityObserver = /** @class */ (function () { function VisibilityObserver(element, zone) { this.element = element; this.zone = zone; this.visible = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); this.isVisible = false; this.runCheck(); } VisibilityObserver.prototype.destroy = function () { clearTimeout(this.timeout); }; VisibilityObserver.prototype.onVisibilityChange = function () { var _this = this; // trigger zone recalc for columns this.zone.run(function () { _this.isVisible = true; _this.visible.emit(true); }); }; VisibilityObserver.prototype.runCheck = function () { var _this = this; var check = function () { if (!_this.element) { return; } // https://davidwalsh.name/offsetheight-visibility var _a = _this.element.nativeElement, offsetHeight = _a.offsetHeight, offsetWidth = _a.offsetWidth; if (offsetHeight && offsetWidth) { clearTimeout(_this.timeout); _this.onVisibilityChange(); } else { clearTimeout(_this.timeout); _this.zone.runOutsideAngular(function () { _this.timeout = setTimeout(function () { return check(); }, 100); }); } }; this.zone.runOutsideAngular(function () { _this.timeout = setTimeout(function () { return check(); }); }); }; __decorate([ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Output"])(), __metadata("design:type", __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"]) ], VisibilityObserver.prototype, "visible", void 0); return VisibilityObserver; }()); /***/ }), /***/ "@angular/animations": /***/ (function(module, exports) { module.exports = __WEBPACK_EXTERNAL_MODULE__angular_animations__; /***/ }), /***/ "@angular/common": /***/ (function(module, exports) { module.exports = __WEBPACK_EXTERNAL_MODULE__angular_common__; /***/ }), /***/ "@angular/core": /***/ (function(module, exports) { module.exports = __WEBPACK_EXTERNAL_MODULE__angular_core__; /***/ }), /***/ "@angular/platform-browser": /***/ (function(module, exports) { module.exports = __WEBPACK_EXTERNAL_MODULE__angular_platform_browser__; /***/ }), /***/ "d3-array": /***/ (function(module, exports) { module.exports = __WEBPACK_EXTERNAL_MODULE_d3_array__; /***/ }), /***/ "d3-brush": /***/ (function(module, exports) { module.exports = __WEBPACK_EXTERNAL_MODULE_d3_brush__; /***/ }), /***/ "d3-color": /***/ (function(module, exports) { module.exports = __WEBPACK_EXTERNAL_MODULE_d3_color__; /***/ }), /***/ "d3-force": /***/ (function(module, exports) { module.exports = __WEBPACK_EXTERNAL_MODULE_d3_force__; /***/ }), /***/ "d3-format": /***/ (function(module, exports) { module.exports = __WEBPACK_EXTERNAL_MODULE_d3_format__; /***/ }), /***/ "d3-hierarchy": /***/ (function(module, exports) { module.exports = __WEBPACK_EXTERNAL_MODULE_d3_hierarchy__; /***/ }), /***/ "d3-interpolate": /***/ (function(module, exports) { module.exports = __WEBPACK_EXTERNAL_MODULE_d3_interpolate__; /***/ }), /***/ "d3-scale": /***/ (function(module, exports) { module.exports = __WEBPACK_EXTERNAL_MODULE_d3_scale__; /***/ }), /***/ "d3-selection": /***/ (function(module, exports) { module.exports = __WEBPACK_EXTERNAL_MODULE_d3_selection__; /***/ }), /***/ "d3-shape": /***/ (function(module, exports) { module.exports = __WEBPACK_EXTERNAL_MODULE_d3_shape__; /***/ }), /***/ "d3-time-format": /***/ (function(module, exports) { module.exports = __WEBPACK_EXTERNAL_MODULE_d3_time_format__; /***/ }) /******/ }); }); //# sourceMappingURL=index.map /***/ }), /***/ "./node_modules/@swimlane/ngx-datatable/release/index.js": /***/ (function(module, exports, __webpack_require__) { /** * angular2-data-table v"11.3.2" (https://github.com/swimlane/angular2-data-table) * Copyright 2016 * Licensed under MIT */ (function webpackUniversalModuleDefinition(root, factory) { if(true) module.exports = factory(__webpack_require__("./node_modules/@angular/common/esm2015/common.js"), __webpack_require__("./node_modules/@angular/core/esm2015/core.js"), __webpack_require__("./node_modules/@angular/platform-browser/esm2015/platform-browser.js"), __webpack_require__("./node_modules/rxjs/_esm2015/BehaviorSubject.js"), __webpack_require__("./node_modules/rxjs/_esm2015/observable/fromEvent.js"), __webpack_require__("./node_modules/rxjs/_esm2015/operators.js")); else if(typeof define === 'function' && define.amd) define("ngxDatatable", ["@angular/common", "@angular/core", "@angular/platform-browser", "rxjs/BehaviorSubject", "rxjs/observable/fromEvent", "rxjs/operators"], factory); else if(typeof exports === 'object') exports["ngxDatatable"] = factory(require("@angular/common"), require("@angular/core"), require("@angular/platform-browser"), require("rxjs/BehaviorSubject"), require("rxjs/observable/fromEvent"), require("rxjs/operators")); else root["ngxDatatable"] = factory(root["@angular/common"], root["@angular/core"], root["@angular/platform-browser"], root["rxjs/BehaviorSubject"], root["rxjs/observable/fromEvent"], root["rxjs/operators"]); })(this, function(__WEBPACK_EXTERNAL_MODULE__angular_common__, __WEBPACK_EXTERNAL_MODULE__angular_core__, __WEBPACK_EXTERNAL_MODULE__angular_platform_browser__, __WEBPACK_EXTERNAL_MODULE_rxjs_BehaviorSubject__, __WEBPACK_EXTERNAL_MODULE_rxjs_observable_fromEvent__, __WEBPACK_EXTERNAL_MODULE_rxjs_operators__) { return /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { /******/ configurable: false, /******/ enumerable: true, /******/ get: getter /******/ }); /******/ } /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = "./src/index.ts"); /******/ }) /************************************************************************/ /******/ ({ /***/ "./node_modules/css-loader/index.js!./node_modules/postcss-loader/index.js!./node_modules/sass-loader/lib/loader.js?{\"sourceMap\":true}!./src/components/datatable.component.scss": /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__("./node_modules/css-loader/lib/css-base.js")(undefined); // imports // module exports.push([module.i, ".ngx-datatable {\n display: block;\n overflow: hidden;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n position: relative;\n -webkit-transform: translate3d(0, 0, 0);\n /**\n * Vertical Scrolling Adjustments\n */\n /**\n * Horizontal Scrolling Adjustments\n */\n /**\n * Fixed Header Height Adjustments\n */\n /**\n * Fixed row height adjustments\n */\n /**\n * Shared Styles\n */\n /**\n * Header Styles\n */\n /**\n * Body Styles\n */\n /**\n * Footer Styles\n */ }\n .ngx-datatable [hidden] {\n display: none !important; }\n .ngx-datatable *, .ngx-datatable *:before, .ngx-datatable *:after {\n -webkit-box-sizing: border-box;\n box-sizing: border-box; }\n .ngx-datatable.scroll-vertical .datatable-body {\n overflow-y: auto; }\n .ngx-datatable.scroll-vertical .datatable-body .datatable-row-wrapper {\n position: absolute; }\n .ngx-datatable.scroll-horz .datatable-body {\n overflow-x: auto;\n -webkit-overflow-scrolling: touch; }\n .ngx-datatable.fixed-header .datatable-header .datatable-header-inner {\n white-space: nowrap; }\n .ngx-datatable.fixed-header .datatable-header .datatable-header-inner .datatable-header-cell {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis; }\n .ngx-datatable.fixed-row .datatable-scroll {\n white-space: nowrap; }\n .ngx-datatable.fixed-row .datatable-scroll .datatable-body-row {\n white-space: nowrap; }\n .ngx-datatable.fixed-row .datatable-scroll .datatable-body-row .datatable-body-cell {\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis; }\n .ngx-datatable.fixed-row .datatable-scroll .datatable-body-row .datatable-body-group-cell {\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis; }\n .ngx-datatable .datatable-body-row,\n .ngx-datatable .datatable-row-center,\n .ngx-datatable .datatable-header-inner {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-orient: horizontal;\n -webkit-box-direction: normal;\n -ms-flex-direction: row;\n flex-direction: row;\n -ms-flex-flow: row;\n -o-flex-flow: row;\n flex-flow: row; }\n .ngx-datatable .datatable-body-cell,\n .ngx-datatable .datatable-header-cell {\n overflow-x: hidden;\n vertical-align: top;\n display: inline-block;\n line-height: 1.625; }\n .ngx-datatable .datatable-body-cell:focus,\n .ngx-datatable .datatable-header-cell:focus {\n outline: none; }\n .ngx-datatable .datatable-row-left,\n .ngx-datatable .datatable-row-right {\n z-index: 9; }\n .ngx-datatable .datatable-row-left,\n .ngx-datatable .datatable-row-center,\n .ngx-datatable .datatable-row-group,\n .ngx-datatable .datatable-row-right {\n position: relative; }\n .ngx-datatable .datatable-header {\n display: block;\n overflow: hidden; }\n .ngx-datatable .datatable-header .datatable-header-inner {\n -webkit-box-align: stretch;\n -ms-flex-align: stretch;\n align-items: stretch;\n -webkit-align-items: stretch; }\n .ngx-datatable .datatable-header .datatable-header-cell {\n position: relative;\n display: inline-block; }\n .ngx-datatable .datatable-header .datatable-header-cell.sortable .datatable-header-cell-wrapper {\n cursor: pointer; }\n .ngx-datatable .datatable-header .datatable-header-cell.longpress .datatable-header-cell-wrapper {\n cursor: move; }\n .ngx-datatable .datatable-header .datatable-header-cell .sort-btn {\n line-height: 100%;\n vertical-align: middle;\n display: inline-block;\n cursor: pointer; }\n .ngx-datatable .datatable-header .datatable-header-cell .resize-handle, .ngx-datatable .datatable-header .datatable-header-cell .resize-handle--not-resizable {\n display: inline-block;\n position: absolute;\n right: 0;\n top: 0;\n bottom: 0;\n width: 5px;\n padding: 0 4px;\n visibility: hidden; }\n .ngx-datatable .datatable-header .datatable-header-cell .resize-handle {\n cursor: ew-resize; }\n .ngx-datatable .datatable-header .datatable-header-cell.resizeable:hover .resize-handle {\n visibility: visible; }\n .ngx-datatable .datatable-header .datatable-header-cell:hover .resize-handle--not-resizable {\n visibility: visible; }\n .ngx-datatable .datatable-header .datatable-header-cell .datatable-header-cell-template-wrap {\n height: inherit; }\n .ngx-datatable .datatable-body {\n position: relative;\n z-index: 10;\n display: block; }\n .ngx-datatable .datatable-body .datatable-scroll {\n display: inline-block; }\n .ngx-datatable .datatable-body .datatable-row-detail {\n overflow-y: hidden; }\n .ngx-datatable .datatable-body .datatable-row-wrapper {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-orient: vertical;\n -webkit-box-direction: normal;\n -ms-flex-direction: column;\n flex-direction: column; }\n .ngx-datatable .datatable-body .datatable-body-row {\n outline: none; }\n .ngx-datatable .datatable-body .datatable-body-row > div {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex; }\n .ngx-datatable .datatable-footer {\n display: block;\n width: 100%; }\n .ngx-datatable .datatable-footer .datatable-footer-inner {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n width: 100%; }\n .ngx-datatable .datatable-footer .selected-count .page-count {\n -webkit-box-flex: 1;\n -ms-flex: 1 1 40%;\n flex: 1 1 40%; }\n .ngx-datatable .datatable-footer .selected-count .datatable-pager {\n -webkit-box-flex: 1;\n -ms-flex: 1 1 60%;\n flex: 1 1 60%; }\n .ngx-datatable .datatable-footer .page-count {\n -webkit-box-flex: 1;\n -ms-flex: 1 1 20%;\n flex: 1 1 20%; }\n .ngx-datatable .datatable-footer .datatable-pager {\n -webkit-box-flex: 1;\n -ms-flex: 1 1 80%;\n flex: 1 1 80%;\n text-align: right; }\n .ngx-datatable .datatable-footer .datatable-pager .pager,\n .ngx-datatable .datatable-footer .datatable-pager .pager li {\n padding: 0;\n margin: 0;\n display: inline-block;\n list-style: none; }\n .ngx-datatable .datatable-footer .datatable-pager .pager li, .ngx-datatable .datatable-footer .datatable-pager .pager li a {\n outline: none; }\n .ngx-datatable .datatable-footer .datatable-pager .pager li a {\n cursor: pointer;\n display: inline-block; }\n .ngx-datatable .datatable-footer .datatable-pager .pager li.disabled a {\n cursor: not-allowed; }\n", ""]); // exports /***/ }), /***/ "./node_modules/css-loader/lib/css-base.js": /***/ (function(module, exports) { /* MIT License http://www.opensource.org/licenses/mit-license.php Author Tobias Koppers @sokra */ // css base code, injected by the css-loader module.exports = function(useSourceMap) { var list = []; // return the list of modules as css string list.toString = function toString() { return this.map(function (item) { var content = cssWithMappingToString(item, useSourceMap); if(item[2]) { return "@media " + item[2] + "{" + content + "}"; } else { return content; } }).join(""); }; // import a list of modules into the list list.i = function(modules, mediaQuery) { if(typeof modules === "string") modules = [[null, modules, ""]]; var alreadyImportedModules = {}; for(var i = 0; i < this.length; i++) { var id = this[i][0]; if(typeof id === "number") alreadyImportedModules[id] = true; } for(i = 0; i < modules.length; i++) { var item = modules[i]; // skip already imported module // this implementation is not 100% perfect for weird media query combinations // when a module is imported multiple times with different media queries. // I hope this will never occur (Hey this way we have smaller bundles) if(typeof item[0] !== "number" || !alreadyImportedModules[item[0]]) { if(mediaQuery && !item[2]) { item[2] = mediaQuery; } else if(mediaQuery) { item[2] = "(" + item[2] + ") and (" + mediaQuery + ")"; } list.push(item); } } }; return list; }; function cssWithMappingToString(item, useSourceMap) { var content = item[1] || ''; var cssMapping = item[3]; if (!cssMapping) { return content; } if (useSourceMap && typeof btoa === 'function') { var sourceMapping = toComment(cssMapping); var sourceURLs = cssMapping.sources.map(function (source) { return '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */' }); return [content].concat(sourceURLs).concat([sourceMapping]).join('\n'); } return [content].join('\n'); } // Adapted from convert-source-map (MIT) function toComment(sourceMap) { // eslint-disable-next-line no-undef var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))); var data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64; return '/*# ' + data + ' */'; } /***/ }), /***/ "./node_modules/webpack/buildin/global.js": /***/ (function(module, exports) { var g; // This works in non-strict mode g = (function() { return this; })(); try { // This works if eval is allowed (see CSP) g = g || Function("return this")() || (1,eval)("this"); } catch(e) { // This works if the window reference is available if(typeof window === "object") g = window; } // g can still be undefined, but nothing to do about it... // We return undefined, instead of nothing here, so it's // easier to handle this case. if(!global) { ...} module.exports = g; /***/ }), /***/ "./src/components/body/body-cell.component.ts": /***/ (function(module, exports, __webpack_require__) { "use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("@angular/core"); var utils_1 = __webpack_require__("./src/utils/index.ts"); var types_1 = __webpack_require__("./src/types/index.ts"); var events_1 = __webpack_require__("./src/events.ts"); var DataTableBodyCellComponent = /** @class */ (function () { function DataTableBodyCellComponent(element, cd) { this.cd = cd; this.activate = new core_1.EventEmitter(); this.isFocused = false; this.onCheckboxChangeFn = this.onCheckboxChange.bind(this); this.activateFn = this.activate.emit.bind(this.activate); this.cellContext = { onCheckboxChangeFn: this.onCheckboxChangeFn, activateFn: this.activateFn, row: this.row, group: this.group, value: this.value, column: this.column, rowHeight: this.rowHeight, isSelected: this.isSelected, rowIndex: this.rowIndex }; this._element = element.nativeElement; } Object.defineProperty(DataTableBodyCellComponent.prototype, "group", { get: function () { return this._group; }, set: function (group) { this._group = group; this.cellContext.group = group; this.checkValueUpdates(); this.cd.markForCheck(); }, enumerable: true, configurable: true }); Object.defineProperty(DataTableBodyCellComponent.prototype, "rowHeight", { get: function () { return this._rowHeight; }, set: function (val) { this._rowHeight = val; this.cellContext.rowHeight = val; this.checkValueUpdates(); this.cd.markForCheck(); }, enumerable: true, configurable: true }); Object.defineProperty(DataTableBodyCellComponent.prototype, "isSelected", { get: function () { return this._isSelected; }, set: function (val) { this._isSelected = val; this.cellContext.isSelected = val; this.cd.markForCheck(); }, enumerable: true, configurable: true }); Object.defineProperty(DataTableBodyCellComponent.prototype, "expanded", { get: function () { return this._expanded; }, set: function (val) { this._expanded = val; this.cellContext.expanded = val; this.cd.markForCheck(); }, enumerable: true, configurable: true }); Object.defineProperty(DataTableBodyCellComponent.prototype, "rowIndex", { get: function () { return this._rowIndex; }, set: function (val) { this._rowIndex = val; this.cellContext.rowIndex = val; this.checkValueUpdates(); this.cd.markForCheck(); }, enumerable: true, configurable: true }); Object.defineProperty(DataTableBodyCellComponent.prototype, "column", { get: function () { return this._column; }, set: function (column) { this._column = column; this.cellContext.column = column; this.checkValueUpdates(); this.cd.markForCheck(); }, enumerable: true, configurable: true }); Object.defineProperty(DataTableBodyCellComponent.prototype, "row", { get: function () { return this._row; }, set: function (row) { this._row = row; this.cellContext.row = row; this.checkValueUpdates(); this.cd.markForCheck(); }, enumerable: true, configurable: true }); Object.defineProperty(DataTableBodyCellComponent.prototype, "sorts", { get: function () { return this._sorts; }, set: function (val) { this._sorts = val; this.calcSortDir = this.calcSortDir(val); }, enumerable: true, configurable: true }); Object.defineProperty(DataTableBodyCellComponent.prototype, "columnCssClasses", { get: function () { var cls = 'datatable-body-cell'; if (this.column.cellClass) { if (typeof this.column.cellClass === 'string') { cls += ' ' + this.column.cellClass; } else if (typeof this.column.cellClass === 'function') { var res = this.column.cellClass({ row: this.row, group: this.group, column: this.column, value: this.value, rowHeight: this.rowHeight }); if (typeof res === 'string') { cls += res; } else if (typeof res === 'object') { var keys = Object.keys(res); for (var _i = 0, keys_1 = keys; _i < keys_1.length; _i++) { var k = keys_1[_i]; if (res[k] === true) cls += " " + k; } } } } if (!this.sortDir) cls += ' sort-active'; if (this.isFocused) cls += ' active'; if (this.sortDir === types_1.SortDirection.asc) cls += ' sort-asc'; if (this.sortDir === types_1.SortDirection.desc) cls += ' sort-desc'; return cls; }, enumerable: true, configurable: true }); Object.defineProperty(DataTableBodyCellComponent.prototype, "width", { get: function () { return this.column.width; }, enumerable: true, configurable: true }); Object.defineProperty(DataTableBodyCellComponent.prototype, "height", { get: function () { var height = this.rowHeight; if (isNaN(height)) return height; return height + 'px'; }, enumerable: true, configurable: true }); DataTableBodyCellComponent.prototype.ngDoCheck = function () { this.checkValueUpdates(); }; DataTableBodyCellComponent.prototype.ngOnDestroy = function () { if (this.cellTemplate) { this.cellTemplate.clear(); } }; DataTableBodyCellComponent.prototype.checkValueUpdates = function () { var value = ''; if (!this.row || !this.column) { value = ''; } else { var val = this.column.$$valueGetter(this.row, this.column.prop); var userPipe = this.column.pipe; if (userPipe) { value = userPipe.transform(val); } else if (value !== undefined) { value = val; } } if (this.value !== value) { this.value = value; this.cellContext.value = value; this.sanitizedValue = value !== null && value !== undefined ? this.stripHtml(value) : value; this.cd.markForCheck(); } }; DataTableBodyCellComponent.prototype.onFocus = function () { this.isFocused = true; }; DataTableBodyCellComponent.prototype.onBlur = function () { this.isFocused = false; }; DataTableBodyCellComponent.prototype.onClick = function (event) { this.activate.emit({ type: 'click', event: event, row: this.row, group: this.group, rowHeight: this.rowHeight, column: this.column, value: this.value, cellElement: this._element }); }; DataTableBodyCellComponent.prototype.onDblClick = function (event) { this.activate.emit({ type: 'dblclick', event: event, row: this.row, group: this.group, rowHeight: this.rowHeight, column: this.column, value: this.value, cellElement: this._element }); }; DataTableBodyCellComponent.prototype.onKeyDown = function (event) { var keyCode = event.keyCode; var isTargetCell = event.target === this._element; var isAction = keyCode === utils_1.Keys.return || keyCode === utils_1.Keys.down || keyCode === utils_1.Keys.up || keyCode === utils_1.Keys.left || keyCode === utils_1.Keys.right; if (isAction && isTargetCell) { event.preventDefault(); event.stopPropagation(); this.activate.emit({ type: 'keydown', event: event, row: this.row, group: this.group, rowHeight: this.rowHeight, column: this.column, value: this.value, cellElement: this._element }); } }; DataTableBodyCellComponent.prototype.onCheckboxChange = function (event) { this.activate.emit({ type: 'checkbox', event: event, row: this.row, group: this.group, rowHeight: this.rowHeight, column: this.column, value: this.value, cellElement: this._element }); }; DataTableBodyCellComponent.prototype.calcSortDir = function (sorts) { var _this = this; if (!sorts) return; var sort = sorts.find(function (s) { return s.prop === _this.column.prop; }); if (sort) return sort.dir; }; DataTableBodyCellComponent.prototype.stripHtml = function (html) { if (!html.replace) return html; return html.replace(/<\/?[^>]+(>|$)/g, ''); }; __decorate([ core_1.Input(), __metadata("design:type", Object) ], DataTableBodyCellComponent.prototype, "displayCheck", void 0); __decorate([ core_1.Input(), __metadata("design:type", Object), __metadata("design:paramtypes", [Object]) ], DataTableBodyCellComponent.prototype, "group", null); __decorate([ core_1.Input(), __metadata("design:type", Number), __metadata("design:paramtypes", [Number]) ], DataTableBodyCellComponent.prototype, "rowHeight", null); __decorate([ core_1.Input(), __metadata("design:type", Boolean), __metadata("design:paramtypes", [Boolean]) ], DataTableBodyCellComponent.prototype, "isSelected", null); __decorate([ core_1.Input(), __metadata("design:type", Boolean), __metadata("design:paramtypes", [Boolean]) ], DataTableBodyCellComponent.prototype, "expanded", null); __decorate([ core_1.Input(), __metadata("design:type", Number), __metadata("design:paramtypes", [Number]) ], DataTableBodyCellComponent.prototype, "rowIndex", null); __decorate([ core_1.Input(), __metadata("design:type", Object), __metadata("design:paramtypes", [Object]) ], DataTableBodyCellComponent.prototype, "column", null); __decorate([ core_1.Input(), __metadata("design:type", Object), __metadata("design:paramtypes", [Object]) ], DataTableBodyCellComponent.prototype, "row", null); __decorate([ core_1.Input(), __metadata("design:type", Array), __metadata("design:paramtypes", [Array]) ], DataTableBodyCellComponent.prototype, "sorts", null); __decorate([ core_1.Output(), __metadata("design:type", core_1.EventEmitter) ], DataTableBodyCellComponent.prototype, "activate", void 0); __decorate([ core_1.ViewChild('cellTemplate', { read: core_1.ViewContainerRef }), __metadata("design:type", core_1.ViewContainerRef) ], DataTableBodyCellComponent.prototype, "cellTemplate", void 0); __decorate([ core_1.HostBinding('class'), __metadata("design:type", Object), __metadata("design:paramtypes", []) ], DataTableBodyCellComponent.prototype, "columnCssClasses", null); __decorate([ core_1.HostBinding('style.width.px'), __metadata("design:type", Number), __metadata("design:paramtypes", []) ], DataTableBodyCellComponent.prototype, "width", null); __decorate([ core_1.HostBinding('style.height'), __metadata("design:type", Object), __metadata("design:paramtypes", []) ], DataTableBodyCellComponent.prototype, "height", null); __decorate([ core_1.HostListener('focus'), __metadata("design:type", Function), __metadata("design:paramtypes", []), __metadata("design:returntype", void 0) ], DataTableBodyCellComponent.prototype, "onFocus", null); __decorate([ core_1.HostListener('blur'), __metadata("design:type", Function), __metadata("design:paramtypes", []), __metadata("design:returntype", void 0) ], DataTableBodyCellComponent.prototype, "onBlur", null); __decorate([ core_1.HostListener('click', ['$event']), __metadata("design:type", Function), __metadata("design:paramtypes", [Object]), __metadata("design:returntype", void 0) ], DataTableBodyCellComponent.prototype, "onClick", null); __decorate([ core_1.HostListener('dblclick', ['$event']), __metadata("design:type", Function), __metadata("design:paramtypes", [Object]), __metadata("design:returntype", void 0) ], DataTableBodyCellComponent.prototype, "onDblClick", null); __decorate([ core_1.HostListener('keydown', ['$event']), __metadata("design:type", Function), __metadata("design:paramtypes", [Object]), __metadata("design:returntype", void 0) ], DataTableBodyCellComponent.prototype, "onKeyDown", null); DataTableBodyCellComponent = __decorate([ core_1.Component({ selector: 'datatable-body-cell', changeDetection: core_1.ChangeDetectionStrategy.OnPush, template: "\n <div class=\"datatable-body-cell-label\">\n <label\n *ngIf=\"column.checkboxable && (!displayCheck || displayCheck(row, column, value))\"\n class=\"datatable-checkbox\">\n <input\n type=\"checkbox\"\n [checked]=\"isSelected\"\n (click)=\"onCheckboxChange($event)\"\n />\n </label>\n <span\n *ngIf=\"!column.cellTemplate\"\n [title]=\"sanitizedValue\"\n [innerHTML]=\"value\">\n </span>\n <ng-template #cellTemplate\n *ngIf=\"column.cellTemplate\"\n [ngTemplateOutlet]=\"column.cellTemplate\"\n [ngTemplateOutletContext]=\"cellContext\">\n </ng-template>\n </div>\n " }), __metadata("design:paramtypes", [core_1.ElementRef, core_1.ChangeDetectorRef]) ], DataTableBodyCellComponent); return DataTableBodyCellComponent; }()); exports.DataTableBodyCellComponent = DataTableBodyCellComponent; /***/ }), /***/ "./src/components/body/body-group-header-template.directive.ts": /***/ (function(module, exports, __webpack_require__) { "use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("@angular/core"); var DatatableGroupHeaderTemplateDirective = /** @class */ (function () { function DatatableGroupHeaderTemplateDirective(template) { this.template = template; } DatatableGroupHeaderTemplateDirective = __decorate([ core_1.Directive({ selector: '[ngx-datatable-group-header-template]' }), __metadata("design:paramtypes", [core_1.TemplateRef]) ], DatatableGroupHeaderTemplateDirective); return DatatableGroupHeaderTemplateDirective; }()); exports.DatatableGroupHeaderTemplateDirective = DatatableGroupHeaderTemplateDirective; /***/ }), /***/ "./src/components/body/body-group-header.directive.ts": /***/ (function(module, exports, __webpack_require__) { "use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("@angular/core"); var body_group_header_template_directive_1 = __webpack_require__("./src/components/body/body-group-header-template.directive.ts"); var DatatableGroupHeaderDirective = /** @class */ (function () { function DatatableGroupHeaderDirective() { /** * Row height is required when virtual scroll is enabled. */ this.rowHeight = 0; /** * Track toggling of group visibility */ this.toggle = new core_1.EventEmitter(); } /** * Toggle the expansion of a group */ DatatableGroupHeaderDirective.prototype.toggleExpandGroup = function (group) { this.toggle.emit({ type: 'group', value: group }); }; /** * Expand all groups */ DatatableGroupHeaderDirective.prototype.expandAllGroups = function () { this.toggle.emit({ type: 'all', value: true }); }; /** * Collapse all groups */ DatatableGroupHeaderDirective.prototype.collapseAllGroups = function () { this.toggle.emit({ type: 'all', value: false }); }; __decorate([ core_1.Input(), __metadata("design:type", Object) ], DatatableGroupHeaderDirective.prototype, "rowHeight", void 0); __decorate([ core_1.Input(), core_1.ContentChild(body_group_header_template_directive_1.DatatableGroupHeaderTemplateDirective, { read: core_1.TemplateRef }), __metadata("design:type", core_1.TemplateRef) ], DatatableGroupHeaderDirective.prototype, "template", void 0); __decorate([ core_1.Output(), __metadata("design:type", core_1.EventEmitter) ], DatatableGroupHeaderDirective.prototype, "toggle", void 0); DatatableGroupHeaderDirective = __decorate([ core_1.Directive({ selector: 'ngx-datatable-group-header' }) ], DatatableGroupHeaderDirective); return DatatableGroupHeaderDirective; }()); exports.DatatableGroupHeaderDirective = DatatableGroupHeaderDirective; /***/ }), /***/ "./src/components/body/body-row-wrapper.component.ts": /***/ (function(module, exports, __webpack_require__) { "use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("@angular/core"); var events_1 = __webpack_require__("./src/events.ts"); var DataTableRowWrapperComponent = /** @class */ (function () { function DataTableRowWrapperComponent(cd, differs) { this.cd = cd; this.differs = differs; this.rowContextmenu = new core_1.EventEmitter(false); this.groupContext = { group: this.row, expanded: this.expanded, rowIndex: this.rowIndex }; this.rowContext = { row: this.row, expanded: this.expanded, rowIndex: this.rowIndex }; this._expanded = false; this.rowDiffer = differs.find({}).create(); } Object.defineProperty(DataTableRowWrapperComponent.prototype, "rowIndex", { get: function () { return this._rowIndex; }, set: function (val) { this._rowIndex = val; this.rowContext.rowIndex = val; this.groupContext.rowIndex = val; this.cd.markForCheck(); }, enumerable: true, configurable: true }); Object.defineProperty(DataTableRowWrapperComponent.prototype, "expanded", { get: function () { return this._expanded; }, set: function (val) { this._expanded = val; this.groupContext.expanded = val; this.rowContext.expanded = val; this.cd.markForCheck(); }, enumerable: true, configurable: true }); DataTableRowWrapperComponent.prototype.ngDoCheck = function () { if (this.rowDiffer.diff(this.row)) { this.rowContext.row = this.row; this.groupContext.group = this.row; this.cd.markForCheck(); } }; DataTableRowWrapperComponent.prototype.onContextmenu = function ($event) { this.rowContextmenu.emit({ event: $event, row: this.row }); }; DataTableRowWrapperComponent.prototype.getGroupHeaderStyle = function (group) { var styles = {}; styles['transform'] = 'translate3d(' + this.offsetX + 'px, 0px, 0px)'; styles['backface-visibility'] = 'hidden'; styles['width'] = this.innerWidth; return styles; }; __decorate([ core_1.Input(), __metadata("design:type", Number) ], DataTableRowWrapperComponent.prototype, "innerWidth", void 0); __decorate([ core_1.Input(), __metadata("design:type", Object) ], DataTableRowWrapperComponent.prototype, "rowDetail", void 0); __decorate([ core_1.Input(), __metadata("design:type", Object) ], DataTableRowWrapperComponent.prototype, "groupHeader", void 0); __decorate([ core_1.Input(), __metadata("design:type", Number) ], DataTableRowWrapperComponent.prototype, "offsetX", void 0); __decorate([ core_1.Input(), __metadata("design:type", Object) ], DataTableRowWrapperComponent.prototype, "detailRowHeight", void 0); __decorate([ core_1.Input(), __metadata("design:type", Object) ], DataTableRowWrapperComponent.prototype, "row", void 0); __decorate([ core_1.Input(), __metadata("design:type", Object) ], DataTableRowWrapperComponent.prototype, "groupedRows", void 0); __decorate([ core_1.Output(), __metadata("design:type", Object) ], DataTableRowWrapperComponent.prototype, "rowContextmenu", void 0); __decorate([ core_1.Input(), __metadata("design:type", Number), __metadata("design:paramtypes", [Number]) ], DataTableRowWrapperComponent.prototype, "rowIndex", null); __decorate([ core_1.Input(), __metadata("design:type", Boolean), __metadata("design:paramtypes", [Boolean]) ], DataTableRowWrapperComponent.prototype, "expanded", null); __decorate([ core_1.HostListener('contextmenu', ['$event']), __metadata("design:type", Function), __metadata("design:paramtypes", [Object]), __metadata("design:returntype", void 0) ], DataTableRowWrapperComponent.prototype, "onContextmenu", null); DataTableRowWrapperComponent = __decorate([ core_1.Component({ selector: 'datatable-row-wrapper', changeDetection: core_1.ChangeDetectionStrategy.OnPush, template: "\n <div \n *ngIf=\"groupHeader && groupHeader.template\"\n class=\"datatable-group-header\"\n [ngStyle]=\"getGroupHeaderStyle()\">\n <ng-template\n *ngIf=\"groupHeader && groupHeader.template\"\n [ngTemplateOutlet]=\"groupHeader.template\"\n [ngTemplateOutletContext]=\"groupContext\">\n </ng-template>\n </div>\n <ng-content \n *ngIf=\"(groupHeader && groupHeader.template && expanded) || \n (!groupHeader || !groupHeader.template)\">\n </ng-content>\n <div\n *ngIf=\"rowDetail && rowDetail.template && expanded\"\n [style.height.px]=\"detailRowHeight\"\n class=\"datatable-row-detail\">\n <ng-template\n *ngIf=\"rowDetail && rowDetail.template\"\n [ngTemplateOutlet]=\"rowDetail.template\"\n [ngTemplateOutletContext]=\"rowContext\">\n </ng-template>\n </div>\n ", host: { class: 'datatable-row-wrapper' } }), __metadata("design:paramtypes", [core_1.ChangeDetectorRef, core_1.KeyValueDiffers]) ], DataTableRowWrapperComponent); return DataTableRowWrapperComponent; }()); exports.DataTableRowWrapperComponent = DataTableRowWrapperComponent; /***/ }), /***/ "./src/components/body/body-row.component.ts": /***/ (function(module, exports, __webpack_require__) { "use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var __param = (this && this.__param) || function (paramIndex, decorator) { return function (target, key) { decorator(target, key, paramIndex); } }; Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("@angular/core"); var utils_1 = __webpack_require__("./src/utils/index.ts"); var services_1 = __webpack_require__("./src/services/index.ts"); var events_1 = __webpack_require__("./src/events.ts"); var DataTableBodyRowComponent = /** @class */ (function () { function DataTableBodyRowComponent(differs, scrollbarHelper, cd, element) { this.differs = differs; this.scrollbarHelper = scrollbarHelper; this.cd = cd; this.activate = new core_1.EventEmitter(); this._groupStyles = { left: {}, center: {}, right: {} }; this._element = element.nativeElement; this._rowDiffer = differs.find({}).create(); } Object.defineProperty(DataTableBodyRowComponent.prototype, "columns", { get: function () { return this._columns; }, set: function (val) { this._columns = val; this.recalculateColumns(val); this.buildStylesByGroup(); }, enumerable: true, configurable: true }); Object.defineProperty(DataTableBodyRowComponent.prototype, "innerWidth", { get: function () { return this._innerWidth; }, set: function (val) { if (this._columns) { var colByPin = utils_1.columnsByPin(this._columns); this._columnGroupWidths = utils_1.columnGroupWidths(colByPin, colByPin); } this._innerWidth = val; this.recalculateColumns(); this.buildStylesByGroup(); }, enumerable: true, configurable: true }); Object.defineProperty(DataTableBodyRowComponent.prototype, "offsetX", { get: function () { return this._offsetX; }, set: function (val) { this._offsetX = val; this.buildStylesByGroup(); }, enumerable: true, configurable: true }); Object.defineProperty(DataTableBodyRowComponent.prototype, "cssClass", { get: function () { var cls = 'datatable-body-row'; if (this.isSelected) cls += ' active'; if (this.rowIndex % 2 !== 0) cls += ' datatable-row-odd'; if (this.rowIndex % 2 === 0) cls += ' datatable-row-even'; if (this.rowClass) { var res = this.rowClass(this.row); if (typeof res === 'string') { cls += " " + res; } else if (typeof res === 'object') { var keys = Object.keys(res); for (var _i = 0, keys_1 = keys; _i < keys_1.length; _i++) { var k = keys_1[_i]; if (res[k] === true) cls += " " + k; } } } return cls; }, enumerable: true, configurable: true }); Object.defineProperty(DataTableBodyRowComponent.prototype, "columnsTotalWidths", { get: function () { return this._columnGroupWidths.total; }, enumerable: true, configurable: true }); DataTableBodyRowComponent.prototype.ngDoCheck = function () { if (this._rowDiffer.diff(this.row)) { this.cd.markForCheck(); } }; DataTableBodyRowComponent.prototype.trackByGroups = function (index, colGroup) { return colGroup.type; }; DataTableBodyRowComponent.prototype.columnTrackingFn = function (index, column) { return column.$$id; }; DataTableBodyRowComponent.prototype.buildStylesByGroup = function () { this._groupStyles['left'] = this.calcStylesByGroup('left'); this._groupStyles['center'] = this.calcStylesByGroup('center'); this._groupStyles['right'] = this.calcStylesByGroup('right'); this.cd.markForCheck(); }; DataTableBodyRowComponent.prototype.calcStylesByGroup = function (group) { var widths = this._columnGroupWidths; var offsetX = this.offsetX; var styles = { width: widths[group] + "px" }; if (group === 'left') { utils_1.translateXY(styles, offsetX, 0); } else if (group === 'right') { var bodyWidth = parseInt(this.innerWidth + '', 0); var totalDiff = widths.total - bodyWidth; var offsetDiff = totalDiff - offsetX; var offset = (offsetDiff + this.scrollbarHelper.width) * -1; utils_1.translateXY(styles, offset, 0); } return styles; }; DataTableBodyRowComponent.prototype.onActivate = function (event, index) { event.cellIndex = index; event.rowElement = this._element; this.activate.emit(event); }; DataTableBodyRowComponent.prototype.onKeyDown = function (event) { var keyCode = event.keyCode; var isTargetRow = event.target === this._element; var isAction = keyCode === utils_1.Keys.return || keyCode === utils_1.Keys.down || keyCode === utils_1.Keys.up || keyCode === utils_1.Keys.left || keyCode === utils_1.Keys.right; if (isAction && isTargetRow) { event.preventDefault(); event.stopPropagation(); this.activate.emit({ type: 'keydown', event: event, row: this.row, rowElement: this._element }); } }; DataTableBodyRowComponent.prototype.onMouseenter = function (event) { this.activate.emit({ type: 'mouseenter', event: event, row: this.row, rowElement: this._element }); }; DataTableBodyRowComponent.prototype.recalculateColumns = function (val) { if (val === void 0) { val = this.columns; } this._columns = val; var colsByPin = utils_1.columnsByPin(this._columns); this._columnsByPin = utils_1.columnsByPinArr(this._columns); this._columnGroupWidths = utils_1.columnGroupWidths(colsByPin, this._columns); }; __decorate([ core_1.Input(), __metadata("design:type", Array), __metadata("design:paramtypes", [Array]) ], DataTableBodyRowComponent.prototype, "columns", null); __decorate([ core_1.Input(), __metadata("design:type", Number), __metadata("design:paramtypes", [Number]) ], DataTableBodyRowComponent.prototype, "innerWidth", null); __decorate([ core_1.Input(), __metadata("design:type", Boolean) ], DataTableBodyRowComponent.prototype, "expanded", void 0); __decorate([ core_1.Input(), __metadata("design:type", Object) ], DataTableBodyRowComponent.prototype, "rowClass", void 0); __decorate([ core_1.Input(), __metadata("design:type", Object) ], DataTableBodyRowComponent.prototype, "row", void 0); __decorate([ core_1.Input(), __metadata("design:type", Object) ], DataTableBodyRowComponent.prototype, "group", void 0); __decorate([ core_1.Input(), __metadata("design:type", Boolean) ], DataTableBodyRowComponent.prototype, "isSelected", void 0); __decorate([ core_1.Input(), __metadata("design:type", Number) ], DataTableBodyRowComponent.prototype, "rowIndex", void 0); __decorate([ core_1.Input(), __metadata("design:type", Object) ], DataTableBodyRowComponent.prototype, "displayCheck", void 0); __decorate([ core_1.Input(), __metadata("design:type", Number), __metadata("design:paramtypes", [Number]) ], DataTableBodyRowComponent.prototype, "offsetX", null); __decorate([ core_1.HostBinding('class'), __metadata("design:type", Object), __metadata("design:paramtypes", []) ], DataTableBodyRowComponent.prototype, "cssClass", null); __decorate([ core_1.HostBinding('style.height.px'), core_1.Input(), __metadata("design:type", Number) ], DataTableBodyRowComponent.prototype, "rowHeight", void 0); __decorate([ core_1.HostBinding('style.width.px'), __metadata("design:type", String), __metadata("design:paramtypes", []) ], DataTableBodyRowComponent.prototype, "columnsTotalWidths", null); __decorate([ core_1.Output(), __metadata("design:type", core_1.EventEmitter) ], DataTableBodyRowComponent.prototype, "activate", void 0); __decorate([ core_1.HostListener('keydown', ['$event']), __metadata("design:type", Function), __metadata("design:paramtypes", [Object]), __metadata("design:returntype", void 0) ], DataTableBodyRowComponent.prototype, "onKeyDown", null); __decorate([ core_1.HostListener('mouseenter', ['$event']), __metadata("design:type", Function), __metadata("design:paramtypes", [Object]), __metadata("design:returntype", void 0) ], DataTableBodyRowComponent.prototype, "onMouseenter", null); DataTableBodyRowComponent = __decorate([ core_1.Component({ selector: 'datatable-body-row', changeDetection: core_1.ChangeDetectionStrategy.OnPush, template: "\n <div\n *ngFor=\"let colGroup of _columnsByPin; let i = index; trackBy: trackByGroups\"\n class=\"datatable-row-{{colGroup.type}} datatable-row-group\"\n [ngStyle]=\"_groupStyles[colGroup.type]\">\n <datatable-body-cell\n *ngFor=\"let column of colGroup.columns; let ii = index; trackBy: columnTrackingFn\"\n tabindex=\"-1\"\n [row]=\"row\"\n [group]=\"group\"\n [expanded]=\"expanded\"\n [isSelected]=\"isSelected\"\n [rowIndex]=\"rowIndex\"\n [column]=\"column\"\n [rowHeight]=\"rowHeight\"\n [displayCheck]=\"displayCheck\"\n (activate)=\"onActivate($event, ii)\">\n </datatable-body-cell>\n </div>\n " }), __param(1, core_1.SkipSelf()), __metadata("design:paramtypes", [core_1.KeyValueDiffers, services_1.ScrollbarHelper, core_1.ChangeDetectorRef, core_1.ElementRef]) ], DataTableBodyRowComponent); return DataTableBodyRowComponent; }()); exports.DataTableBodyRowComponent = DataTableBodyRowComponent; /***/ }), /***/ "./src/components/body/body.component.ts": /***/ (function(module, exports, __webpack_require__) { "use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("@angular/core"); var utils_1 = __webpack_require__("./src/utils/index.ts"); var types_1 = __webpack_require__("./src/types/index.ts"); var scroller_component_1 = __webpack_require__("./src/components/body/scroller.component.ts"); var DataTableBodyComponent = /** @class */ (function () { /** * Creates an instance of DataTableBodyComponent. */ function DataTableBodyComponent(cd) { var _this = this; this.cd = cd; this.selected = []; this.scroll = new core_1.EventEmitter(); this.page = new core_1.EventEmitter(); this.activate = new core_1.EventEmitter(); this.select = new core_1.EventEmitter(); this.detailToggle = new core_1.EventEmitter(); this.rowContextmenu = new core_1.EventEmitter(false); this.rowHeightsCache = new utils_1.RowHeightCache(); this.temp = []; this.offsetY = 0; this.indexes = {}; this.rowIndexes = new Map(); this.rowExpansions = new Map(); /** * Get the height of the detail row. */ this.getDetailRowHeight = function (row, index) { if (!_this.rowDetail) return 0; var rowHeight = _this.rowDetail.rowHeight; return typeof rowHeight === 'function' ? rowHeight(row, index) : rowHeight; }; // declare fn here so we can get access to the `this` property this.rowTrackingFn = function (index, row) { var idx = this.getRowIndex(row); if (this.trackByProp) { return idx + "-" + this.trackByProp; } else { return idx; } }.bind(this); } Object.defineProperty(DataTableBodyComponent.prototype, "pageSize", { get: function () { return this._pageSize; }, set: function (val) { this._pageSize = val; this.recalcLayout(); }, enumerable: true, configurable: true }); Object.defineProperty(DataTableBodyComponent.prototype, "rows", { get: function () { return this._rows; }, set: function (val) { this._rows = val; this.rowExpansions.clear(); this.recalcLayout(); }, enumerable: true, configurable: true }); Object.defineProperty(DataTableBodyComponent.prototype, "columns", { get: function () { return this._columns; }, set: function (val) { this._columns = val; var colsByPin = utils_1.columnsByPin(val); this.columnGroupWidths = utils_1.columnGroupWidths(colsByPin, val); }, enumerable: true, configurable: true }); Object.defineProperty(DataTableBodyComponent.prototype, "offset", { get: function () { return this._offset; }, set: function (val) { this._offset = val; this.recalcLayout(); }, enumerable: true, configurable: true }); Object.defineProperty(DataTableBodyComponent.prototype, "rowCount", { get: function () { return this._rowCount; }, set: function (val) { this._rowCount = val; this.recalcLayout(); }, enumerable: true, configurable: true }); Object.defineProperty(DataTableBodyComponent.prototype, "bodyWidth", { get: function () { if (this.scrollbarH) { return this.innerWidth + 'px'; } else { return '100%'; } }, enumerable: true, configurable: true }); Object.defineProperty(DataTableBodyComponent.prototype, "bodyHeight", { get: function () { return this._bodyHeight; }, set: function (val) { if (this.scrollbarV) { this._bodyHeight = val + 'px'; } else { this._bodyHeight = 'auto'; } this.recalcLayout(); }, enumerable: true, configurable: true }); Object.defineProperty(DataTableBodyComponent.prototype, "selectEnabled", { /** * Returns if selection is enabled. */ get: function () { return !!this.selectionType; }, enumerable: true, configurable: true }); Object.defineProperty(DataTableBodyComponent.prototype, "scrollHeight", { /** * Property that would calculate the height of scroll bar * based on the row heights cache for virtual scroll. Other scenarios * calculate scroll height automatically (as height will be undefined). */ get: function () { if (this.scrollbarV && this.rowCount) { return this.rowHeightsCache.query(this.rowCount - 1); } // avoid TS7030: Not all code paths return a value. return undefined; }, enumerable: true, configurable: true }); /** * Called after the constructor, initializing input properties */ DataTableBodyComponent.prototype.ngOnInit = function () { var _this = this; if (this.rowDetail) { this.listener = this.rowDetail.toggle .subscribe(function (_a) { var type = _a.type, value = _a.value; if (type === 'row') _this.toggleRowExpansion(value); if (type === 'all') _this.toggleAllRows(value); // Refresh rows after toggle // Fixes #883 _this.updateIndexes(); _this.updateRows(); _this.cd.markForCheck(); }); } if (this.groupHeader) { this.listener = this.groupHeader.toggle .subscribe(function (_a) { var type = _a.type, value = _a.value; if (type === 'group') _this.toggleRowExpansion(value); if (type === 'all') _this.toggleAllRows(value); // Refresh rows after toggle // Fixes #883 _this.updateIndexes(); _this.updateRows(); _this.cd.markForCheck(); }); } }; /** * Called once, before the instance is destroyed. */ DataTableBodyComponent.prototype.ngOnDestroy = function () { if (this.rowDetail) this.listener.unsubscribe(); if (this.groupHeader) this.listener.unsubscribe(); }; /** * Updates the Y offset given a new offset. */ DataTableBodyComponent.prototype.updateOffsetY = function (offset) { // scroller is missing on empty table if (!this.scroller) return; if (this.scrollbarV && offset) { // First get the row Index that we need to move to. var rowIndex = this.pageSize * offset; offset = this.rowHeightsCache.query(rowIndex - 1); } this.scroller.setOffset(offset || 0); }; /** * Body was scrolled, this is mainly useful for * when a user is server-side pagination via virtual scroll. */ DataTableBodyComponent.prototype.onBodyScroll = function (event) { var scrollYPos = event.scrollYPos; var scrollXPos = event.scrollXPos; // if scroll change, trigger update // this is mainly used for header cell positions if (this.offsetY !== scrollYPos || this.offsetX !== scrollXPos) { this.scroll.emit({ offsetY: scrollYPos, offsetX: scrollXPos }); } this.offsetY = scrollYPos; this.offsetX = scrollXPos; this.updateIndexes(); this.updatePage(event.direction); this.updateRows(); }; /** * Updates the page given a direction. */ DataTableBodyComponent.prototype.updatePage = function (direction) { var offset = this.indexes.first / this.pageSize; if (direction === 'up') { offset = Math.ceil(offset); } else if (direction === 'down') { offset = Math.floor(offset); } if (direction !== undefined && !isNaN(offset)) { this.page.emit({ offset: offset }); } }; /** * Updates the rows in the view port */ DataTableBodyComponent.prototype.updateRows = function () { var _a = this.indexes, first = _a.first, last = _a.last; var rowIndex = first; var idx = 0; var temp = []; this.rowIndexes.clear(); // if grouprowsby has been specified treat row paging // parameters as group paging parameters ie if limit 10 has been // specified treat it as 10 groups rather than 10 rows if (this.groupedRows) { var maxRowsPerGroup = 3; // if there is only one group set the maximum number of // rows per group the same as the total number of rows if (this.groupedRows.length === 1) { maxRowsPerGroup = this.groupedRows[0].value.length; } while (rowIndex < last && rowIndex < this.groupedRows.length) { // Add the groups into this page var group = this.groupedRows[rowIndex]; temp[idx] = group; idx++; // Group index in this context rowIndex++; } } else { while (rowIndex < last && rowIndex < this.rowCount) { var row = this.rows[rowIndex]; if (row) { this.rowIndexes.set(row, rowIndex); temp[idx] = row; } idx++; rowIndex++; } } this.temp = temp; this.cd.detectChanges(); }; /** * Get the row height */ DataTableBodyComponent.prototype.getRowHeight = function (row) { var height; // if its a function return it if (typeof this.rowHeight === 'function') { height = this.rowHeight(row); } else { height = this.rowHeight; } return height; }; /** * @param group the group with all rows */ DataTableBodyComponent.prototype.getGroupHeight = function (group) { var rowHeight = 0; if (group.value) { for (var index = 0; index < group.value.length; index++) { rowHeight += this.getRowAndDetailHeight(group.value[index]); } } return rowHeight; }; /** * Calculate row height based on the expanded state of the row. */ DataTableBodyComponent.prototype.getRowAndDetailHeight = function (row) { var rowHeight = this.getRowHeight(row); var expanded = this.rowExpansions.get(row); // Adding detail row height if its expanded. if (expanded === 1) { rowHeight += this.getDetailRowHeight(row); } return rowHeight; }; /** * Calculates the styles for the row so that the rows can be moved in 2D space * during virtual scroll inside the DOM. In the below case the Y position is * manipulated. As an example, if the height of row 0 is 30 px and row 1 is * 100 px then following styles are generated: * * transform: translate3d(0px, 0px, 0px); -> row0 * transform: translate3d(0px, 30px, 0px); -> row1 * transform: translate3d(0px, 130px, 0px); -> row2 * * Row heights have to be calculated based on the row heights cache as we wont * be able to determine which row is of what height before hand. In the above * case the positionY of the translate3d for row2 would be the sum of all the * heights of the rows before it (i.e. row0 and row1). * * @param {*} rows The row that needs to be placed in the 2D space. * @returns {*} Returns the CSS3 style to be applied * * @memberOf DataTableBodyComponent */ DataTableBodyComponent.prototype.getRowsStyles = function (rows) { var styles = {}; // only add styles for the group if there is a group if (this.groupedRows) { styles['width'] = this.columnGroupWidths.total; } if (this.scrollbarV) { var idx = 0; if (this.groupedRows) { // Get the latest row rowindex in a group var row = rows[rows.length - 1]; idx = row ? this.getRowIndex(row) : 0; } else { idx = this.getRowIndex(rows); } // const pos = idx * rowHeight; // The position of this row would be the sum of all row heights // until the previous row position. var pos = this.rowHeightsCache.query(idx - 1); utils_1.translateXY(styles, 0, pos); } return styles; }; /** * Hides the loading indicator */ DataTableBodyComponent.prototype.hideIndicator = function () { var _this = this; setTimeout(function () { return _this.loadingIndicator = false; }, 500); }; /** * Updates the index of the rows in the viewport */ DataTableBodyComponent.prototype.updateIndexes = function () { var first = 0; var last = 0; if (this.scrollbarV) { if (this.virtualization) { // Calculation of the first and last indexes will be based on where the // scrollY position would be at. The last index would be the one // that shows up inside the view port the last. var height = parseInt(this.bodyHeight, 0); first = this.rowHeightsCache.getRowIndex(this.offsetY); last = this.rowHeightsCache.getRowIndex(height + this.offsetY) + 1; } else { // If virtual rows are not needed // We render all in one go first = 0; last = this.rowCount; } } else { // The server is handling paging and will pass an array that begins with the // element at a specified offset. first should always be 0 with external paging. if (!this.externalPaging) { first = Math.max(this.offset * this.pageSize, 0); } last = Math.min((first + this.pageSize), this.rowCount); } this.indexes = { first: first, last: last }; }; /** * Refreshes the full Row Height cache. Should be used * when the entire row array state has changed. */ DataTableBodyComponent.prototype.refreshRowHeightCache = function () { if (!this.scrollbarV) return; // clear the previous row height cache if already present. // this is useful during sorts, filters where the state of the // rows array is changed. this.rowHeightsCache.clearCache(); // Initialize the tree only if there are rows inside the tree. if (this.rows && this.rows.length) { this.rowHeightsCache.initCache({ rows: this.rows, rowHeight: this.rowHeight, detailRowHeight: this.getDetailRowHeight, externalVirtual: this.scrollbarV && this.externalPaging, rowCount: this.rowCount, rowIndexes: this.rowIndexes, rowExpansions: this.rowExpansions }); } }; /** * Gets the index for the view port */ DataTableBodyComponent.prototype.getAdjustedViewPortIndex = function () { // Capture the row index of the first row that is visible on the viewport. // If the scroll bar is just below the row which is highlighted then make that as the // first index. var viewPortFirstRowIndex = this.indexes.first; if (this.scrollbarV) { var offsetScroll = this.rowHeightsCache.query(viewPortFirstRowIndex - 1); return offsetScroll <= this.offsetY ? viewPortFirstRowIndex - 1 : viewPortFirstRowIndex; } return viewPortFirstRowIndex; }; /** * Toggle the Expansion of the row i.e. if the row is expanded then it will * collapse and vice versa. Note that the expanded status is stored as * a part of the row object itself as we have to preserve the expanded row * status in case of sorting and filtering of the row set. */ DataTableBodyComponent.prototype.toggleRowExpansion = function (row) { // Capture the row index of the first row that is visible on the viewport. var viewPortFirstRowIndex = this.getAdjustedViewPortIndex(); var expanded = this.rowExpansions.get(row); // If the detailRowHeight is auto --> only in case of non-virtualized scroll if (this.scrollbarV) { var detailRowHeight = this.getDetailRowHeight(row) * (expanded ? -1 : 1); // const idx = this.rowIndexes.get(row) || 0; var idx = this.getRowIndex(row); this.rowHeightsCache.update(idx, detailRowHeight); } // Update the toggled row and update thive nevere heights in the cache. expanded = expanded ^= 1; this.rowExpansions.set(row, expanded); this.detailToggle.emit({ rows: [row], currentIndex: viewPortFirstRowIndex }); }; /** * Expand/Collapse all the rows no matter what their state is. */ DataTableBodyComponent.prototype.toggleAllRows = function (expanded) { // clear prev expansions this.rowExpansions.clear(); var rowExpanded = expanded ? 1 : 0; // Capture the row index of the first row that is visible on the viewport. var viewPortFirstRowIndex = this.getAdjustedViewPortIndex(); for (var _i = 0, _a = this.rows; _i < _a.length; _i++) { var row = _a[_i]; this.rowExpansions.set(row, rowExpanded); } if (this.scrollbarV) { // Refresh the full row heights cache since every row was affected. this.recalcLayout(); } // Emit all rows that have been expanded. this.detailToggle.emit({ rows: this.rows, currentIndex: viewPortFirstRowIndex }); }; /** * Recalculates the table */ DataTableBodyComponent.prototype.recalcLayout = function () { this.refreshRowHeightCache(); this.updateIndexes(); this.updateRows(); }; /** * Tracks the column */ DataTableBodyComponent.prototype.columnTrackingFn = function (index, column) { return column.$$id; }; /** * Gets the row pinning group styles */ DataTableBodyComponent.prototype.stylesByGroup = function (group) { var widths = this.columnGroupWidths; var offsetX = this.offsetX; var styles = { width: widths[group] + "px" }; if (group === 'left') { utils_1.translateXY(styles, offsetX, 0); } else if (group === 'right') { var bodyWidth = parseInt(this.innerWidth + '', 0); var totalDiff = widths.total - bodyWidth; var offsetDiff = totalDiff - offsetX; var offset = offsetDiff * -1; utils_1.translateXY(styles, offset, 0); } return styles; }; /** * Returns if the row was expanded and set default row expansion when row expansion is empty */ DataTableBodyComponent.prototype.getRowExpanded = function (row) { if (this.rowExpansions.size === 0 && this.groupExpansionDefault) { for (var _i = 0, _a = this.groupedRows; _i < _a.length; _i++) { var group = _a[_i]; this.rowExpansions.set(group, 1); } } var expanded = this.rowExpansions.get(row); return expanded === 1; }; /** * Gets the row index given a row */ DataTableBodyComponent.prototype.getRowIndex = function (row) { return this.rowIndexes.get(row) || 0; }; __decorate([ core_1.Input(), __metadata("design:type", Boolean) ], DataTableBodyComponent.prototype, "scrollbarV", void 0); __decorate([ core_1.Input(), __metadata("design:type", Boolean) ], DataTableBodyComponent.prototype, "scrollbarH", void 0); __decorate([ core_1.Input(), __metadata("design:type", Boolean) ], DataTableBodyComponent.prototype, "loadingIndicator", void 0); __decorate([ core_1.Input(), __metadata("design:type", Boolean) ], DataTableBodyComponent.prototype, "externalPaging", void 0); __decorate([ core_1.Input(), __metadata("design:type", Object) ], DataTableBodyComponent.prototype, "rowHeight", void 0); __decorate([ core_1.Input(), __metadata("design:type", Number) ], DataTableBodyComponent.prototype, "offsetX", void 0); __decorate([ core_1.Input(), __metadata("design:type", String) ], DataTableBodyComponent.prototype, "emptyMessage", void 0); __decorate([ core_1.Input(), __metadata("design:type", String) ], DataTableBodyComponent.prototype, "selectionType", void 0); __decorate([ core_1.Input(), __metadata("design:type", Array) ], DataTableBodyComponent.prototype, "selected", void 0); __decorate([ core_1.Input(), __metadata("design:type", Object) ], DataTableBodyComponent.prototype, "rowIdentity", void 0); __decorate([ core_1.Input(), __metadata("design:type", Object) ], DataTableBodyComponent.prototype, "rowDetail", void 0); __decorate([ core_1.Input(), __metadata("design:type", Object) ], DataTableBodyComponent.prototype, "groupHeader", void 0); __decorate([ core_1.Input(), __metadata("design:type", Object) ], DataTableBodyComponent.prototype, "selectCheck", void 0); __decorate([ core_1.Input(), __metadata("design:type", Object) ], DataTableBodyComponent.prototype, "displayCheck", void 0); __decorate([ core_1.Input(), __metadata("design:type", String) ], DataTableBodyComponent.prototype, "trackByProp", void 0); __decorate([ core_1.Input(), __metadata("design:type", Object) ], DataTableBodyComponent.prototype, "rowClass", void 0); __decorate([ core_1.Input(), __metadata("design:type", Object) ], DataTableBodyComponent.prototype, "groupedRows", void 0); __decorate([ core_1.Input(), __metadata("design:type", Boolean) ], DataTableBodyComponent.prototype, "groupExpansionDefault", void 0); __decorate([ core_1.Input(), __metadata("design:type", Number) ], DataTableBodyComponent.prototype, "innerWidth", void 0); __decorate([ core_1.Input(), __metadata("design:type", String) ], DataTableBodyComponent.prototype, "groupRowsBy", void 0); __decorate([ core_1.Input(), __metadata("design:type", Boolean) ], DataTableBodyComponent.prototype, "virtualization", void 0); __decorate([ core_1.Input(), __metadata("design:type", Boolean) ], DataTableBodyComponent.prototype, "summaryRow", void 0); __decorate([ core_1.Input(), __metadata("design:type", String) ], DataTableBodyComponent.prototype, "summaryPosition", void 0); __decorate([ core_1.Input(), __metadata("design:type", Number) ], DataTableBodyComponent.prototype, "summaryHeight", void 0); __decorate([ core_1.Input(), __metadata("design:type", Number), __metadata("design:paramtypes", [Number]) ], DataTableBodyComponent.prototype, "pageSize", null); __decorate([ core_1.Input(), __metadata("design:type", Array), __metadata("design:paramtypes", [Array]) ], DataTableBodyComponent.prototype, "rows", null); __decorate([ core_1.Input(), __metadata("design:type", Array), __metadata("design:paramtypes", [Array]) ], DataTableBodyComponent.prototype, "columns", null); __decorate([ core_1.Input(), __metadata("design:type", Number), __metadata("design:paramtypes", [Number]) ], DataTableBodyComponent.prototype, "offset", null); __decorate([ core_1.Input(), __metadata("design:type", Number), __metadata("design:paramtypes", [Number]) ], DataTableBodyComponent.prototype, "rowCount", null); __decorate([ core_1.HostBinding('style.width'), __metadata("design:type", String), __metadata("design:paramtypes", []) ], DataTableBodyComponent.prototype, "bodyWidth", null); __decorate([ core_1.Input(), core_1.HostBinding('style.height'), __metadata("design:type", Object), __metadata("design:paramtypes", [Object]) ], DataTableBodyComponent.prototype, "bodyHeight", null); __decorate([ core_1.Output(), __metadata("design:type", core_1.EventEmitter) ], DataTableBodyComponent.prototype, "scroll", void 0); __decorate([ core_1.Output(), __metadata("design:type", core_1.EventEmitter) ], DataTableBodyComponent.prototype, "page", void 0); __decorate([ core_1.Output(), __metadata("design:type", core_1.EventEmitter) ], DataTableBodyComponent.prototype, "activate", void 0); __decorate([ core_1.Output(), __metadata("design:type", core_1.EventEmitter) ], DataTableBodyComponent.prototype, "select", void 0); __decorate([ core_1.Output(), __metadata("design:type", core_1.EventEmitter) ], DataTableBodyComponent.prototype, "detailToggle", void 0); __decorate([ core_1.Output(), __metadata("design:type", Object) ], DataTableBodyComponent.prototype, "rowContextmenu", void 0); __decorate([ core_1.ViewChild(scroller_component_1.ScrollerComponent), __metadata("design:type", scroller_component_1.ScrollerComponent) ], DataTableBodyComponent.prototype, "scroller", void 0); DataTableBodyComponent = __decorate([ core_1.Component({ selector: 'datatable-body', template: "\n <datatable-selection\n #selector\n [selected]=\"selected\"\n [rows]=\"rows\"\n [selectCheck]=\"selectCheck\"\n [selectEnabled]=\"selectEnabled\"\n [selectionType]=\"selectionType\"\n [rowIdentity]=\"rowIdentity\"\n (select)=\"select.emit($event)\"\n (activate)=\"activate.emit($event)\">\n <datatable-progress\n *ngIf=\"loadingIndicator\">\n </datatable-progress>\n <datatable-scroller\n *ngIf=\"rows?.length\"\n [scrollbarV]=\"scrollbarV\"\n [scrollbarH]=\"scrollbarH\"\n [scrollHeight]=\"scrollHeight\"\n [scrollWidth]=\"columnGroupWidths?.total\"\n (scroll)=\"onBodyScroll($event)\">\n <datatable-summary-row\n *ngIf=\"summaryRow && summaryPosition === 'top'\"\n [rowHeight]=\"summaryHeight\"\n [offsetX]=\"offsetX\"\n [innerWidth]=\"innerWidth\"\n [rows]=\"rows\"\n [columns]=\"columns\">\n </datatable-summary-row>\n <datatable-row-wrapper\n [groupedRows]=\"groupedRows\"\n *ngFor=\"let group of temp; let i = index; trackBy: rowTrackingFn;\"\n [innerWidth]=\"innerWidth\"\n [ngStyle]=\"getRowsStyles(group)\"\n [rowDetail]=\"rowDetail\"\n [groupHeader]=\"groupHeader\"\n [offsetX]=\"offsetX\"\n [detailRowHeight]=\"getDetailRowHeight(group[i],i)\"\n [row]=\"group\"\n [expanded]=\"getRowExpanded(group)\"\n [rowIndex]=\"getRowIndex(group[i])\"\n (rowContextmenu)=\"rowContextmenu.emit($event)\">\n <datatable-body-row\n *ngIf=\"!groupedRows; else groupedRowsTemplate\"\n tabindex=\"-1\"\n [isSelected]=\"selector.getRowSelected(group)\"\n [innerWidth]=\"innerWidth\"\n [offsetX]=\"offsetX\"\n [columns]=\"columns\"\n [rowHeight]=\"getRowHeight(group)\"\n [row]=\"group\"\n [rowIndex]=\"getRowIndex(group)\"\n [expanded]=\"getRowExpanded(group)\"\n [rowClass]=\"rowClass\"\n [displayCheck]=\"displayCheck\"\n (activate)=\"selector.onActivate($event, indexes.first + i)\">\n </datatable-body-row>\n <ng-template #groupedRowsTemplate>\n <datatable-body-row\n *ngFor=\"let row of group.value; let i = index; trackBy: rowTrackingFn;\"\n tabindex=\"-1\"\n [isSelected]=\"selector.getRowSelected(row)\"\n [innerWidth]=\"innerWidth\"\n [offsetX]=\"offsetX\"\n [columns]=\"columns\"\n [rowHeight]=\"getRowHeight(row)\"\n [row]=\"row\"\n [group]=\"group.value\"\n [rowIndex]=\"getRowIndex(row)\"\n [expanded]=\"getRowExpanded(row)\"\n [rowClass]=\"rowClass\"\n (activate)=\"selector.onActivate($event, i)\">\n </datatable-body-row>\n </ng-template>\n </datatable-row-wrapper>\n <datatable-summary-row\n *ngIf=\"summaryRow && summaryPosition === 'bottom'\"\n [rowHeight]=\"summaryHeight\"\n [offsetX]=\"offsetX\"\n [innerWidth]=\"innerWidth\"\n [rows]=\"rows\"\n [columns]=\"columns\">\n </datatable-summary-row>\n </datatable-scroller>\n <div\n class=\"empty-row\"\n *ngIf=\"!rows?.length && !loadingIndicator\"\n [innerHTML]=\"emptyMessage\">\n </div>\n </datatable-selection>\n ", changeDetection: core_1.ChangeDetectionStrategy.OnPush, host: { class: 'datatable-body' } }), __metadata("design:paramtypes", [core_1.ChangeDetectorRef]) ], DataTableBodyComponent); return DataTableBodyComponent; }()); exports.DataTableBodyComponent = DataTableBodyComponent; /***/ }), /***/ "./src/components/body/index.ts": /***/ (function(module, exports, __webpack_require__) { "use strict"; function __export(m) { for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; } Object.defineProperty(exports, "__esModule", { value: true }); __export(__webpack_require__("./src/components/body/body.component.ts")); __export(__webpack_require__("./src/components/body/body-cell.component.ts")); __export(__webpack_require__("./src/components/body/body-row.component.ts")); __export(__webpack_require__("./src/components/body/progress-bar.component.ts")); __export(__webpack_require__("./src/components/body/scroller.component.ts")); __export(__webpack_require__("./src/components/body/body-row-wrapper.component.ts")); __export(__webpack_require__("./src/components/body/selection.component.ts")); __export(__webpack_require__("./src/components/body/body-group-header.directive.ts")); __export(__webpack_require__("./src/components/body/body-group-header-template.directive.ts")); __export(__webpack_require__("./src/components/body/summary/index.ts")); /***/ }), /***/ "./src/components/body/progress-bar.component.ts": /***/ (function(module, exports, __webpack_require__) { "use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("@angular/core"); var ProgressBarComponent = /** @class */ (function () { function ProgressBarComponent() { } ProgressBarComponent = __decorate([ core_1.Component({ selector: 'datatable-progress', template: "\n <div class=\"progress-linear\" role=\"progressbar\">\n <div class=\"container\">\n <div class=\"bar\"></div>\n </div>\n </div>\n ", changeDetection: core_1.ChangeDetectionStrategy.OnPush }) ], ProgressBarComponent); return ProgressBarComponent; }()); exports.ProgressBarComponent = ProgressBarComponent; /***/ }), /***/ "./src/components/body/scroller.component.ts": /***/ (function(module, exports, __webpack_require__) { "use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("@angular/core"); var ScrollerComponent = /** @class */ (function () { function ScrollerComponent(ngZone, element, renderer) { this.ngZone = ngZone; this.renderer = renderer; this.scrollbarV = false; this.scrollbarH = false; this.scroll = new core_1.EventEmitter(); this.scrollYPos = 0; this.scrollXPos = 0; this.prevScrollYPos = 0; this.prevScrollXPos = 0; this.element = element.nativeElement; } ScrollerComponent.prototype.ngOnInit = function () { var _this = this; // manual bind so we don't always listen if (this.scrollbarV || this.scrollbarH) { var renderer = this.renderer; this.parentElement = renderer.parentNode(renderer.parentNode(this.element)); this.ngZone.runOutsideAngular(function () { _this.parentElement.addEventListener('scroll', _this.onScrolled.bind(_this)); }); } }; ScrollerComponent.prototype.ngOnDestroy = function () { if (this.scrollbarV || this.scrollbarH) { this.parentElement.removeEventListener('scroll', this.onScrolled.bind(this)); } }; ScrollerComponent.prototype.setOffset = function (offsetY) { if (this.parentElement) { this.parentElement.scrollTop = offsetY; } }; ScrollerComponent.prototype.onScrolled = function (event) { var _this = this; var dom = event.currentTarget; requestAnimationFrame(function () { _this.scrollYPos = dom.scrollTop; _this.scrollXPos = dom.scrollLeft; _this.updateOffset(); }); }; ScrollerComponent.prototype.updateOffset = function () { var direction; if (this.scrollYPos < this.prevScrollYPos) { direction = 'down'; } else if (this.scrollYPos > this.prevScrollYPos) { direction = 'up'; } this.scroll.emit({ direction: direction, scrollYPos: this.scrollYPos, scrollXPos: this.scrollXPos }); this.prevScrollYPos = this.scrollYPos; this.prevScrollXPos = this.scrollXPos; }; __decorate([ core_1.Input(), __metadata("design:type", Boolean) ], ScrollerComponent.prototype, "scrollbarV", void 0); __decorate([ core_1.Input(), __metadata("design:type", Boolean) ], ScrollerComponent.prototype, "scrollbarH", void 0); __decorate([ core_1.HostBinding('style.height.px'), core_1.Input(), __metadata("design:type", Number) ], ScrollerComponent.prototype, "scrollHeight", void 0); __decorate([ core_1.HostBinding('style.width.px'), core_1.Input(), __metadata("design:type", Number) ], ScrollerComponent.prototype, "scrollWidth", void 0); __decorate([ core_1.Output(), __metadata("design:type", core_1.EventEmitter) ], ScrollerComponent.prototype, "scroll", void 0); ScrollerComponent = __decorate([ core_1.Component({ selector: 'datatable-scroller', template: "\n <ng-content></ng-content>\n ", host: { class: 'datatable-scroll' }, changeDetection: core_1.ChangeDetectionStrategy.OnPush }), __metadata("design:paramtypes", [core_1.NgZone, core_1.ElementRef, core_1.Renderer2]) ], ScrollerComponent); return ScrollerComponent; }()); exports.ScrollerComponent = ScrollerComponent; /***/ }), /***/ "./src/components/body/selection.component.ts": /***/ (function(module, exports, __webpack_require__) { "use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("@angular/core"); var utils_1 = __webpack_require__("./src/utils/index.ts"); var types_1 = __webpack_require__("./src/types/index.ts"); var DataTableSelectionComponent = /** @class */ (function () { function DataTableSelectionComponent() { this.activate = new core_1.EventEmitter(); this.select = new core_1.EventEmitter(); } DataTableSelectionComponent.prototype.selectRow = function (event, index, row) { if (!this.selectEnabled) return; var chkbox = this.selectionType === types_1.SelectionType.checkbox; var multi = this.selectionType === types_1.SelectionType.multi; var multiClick = this.selectionType === types_1.SelectionType.multiClick; var selected = []; if (multi || chkbox || multiClick) { if (event.shiftKey) { selected = utils_1.selectRowsBetween([], this.rows, index, this.prevIndex, this.getRowSelectedIdx.bind(this)); } else if (event.ctrlKey || event.metaKey || multiClick || chkbox) { selected = utils_1.selectRows(this.selected.slice(), row, this.getRowSelectedIdx.bind(this)); } else { selected = utils_1.selectRows([], row, this.getRowSelectedIdx.bind(this)); } } else { selected = utils_1.selectRows([], row, this.getRowSelectedIdx.bind(this)); } if (typeof this.selectCheck === 'function') { selected = selected.filter(this.selectCheck.bind(this)); } this.selected.splice(0, this.selected.length); (_a = this.selected).push.apply(_a, selected); this.prevIndex = index; this.select.emit({ selected: selected }); var _a; }; DataTableSelectionComponent.prototype.onActivate = function (model, index) { var type = model.type, event = model.event, row = model.row; var chkbox = this.selectionType === types_1.SelectionType.checkbox; var select = (!chkbox && (type === 'click' || type === 'dblclick')) || (chkbox && type === 'checkbox'); if (select) { this.selectRow(event, index, row); } else if (type === 'keydown') { if (event.keyCode === utils_1.Keys.return) { this.selectRow(event, index, row); } else { this.onKeyboardFocus(model); } } this.activate.emit(model); }; DataTableSelectionComponent.prototype.onKeyboardFocus = function (model) { var keyCode = model.event.keyCode; var shouldFocus = keyCode === utils_1.Keys.up || keyCode === utils_1.Keys.down || keyCode === utils_1.Keys.right || keyCode === utils_1.Keys.left; if (shouldFocus) { var isCellSelection = this.selectionType === types_1.SelectionType.cell; if (!model.cellElement || !isCellSelection) { this.focusRow(model.rowElement, keyCode); } else if (isCellSelection) { this.focusCell(model.cellElement, model.rowElement, keyCode, model.cellIndex); } } }; DataTableSelectionComponent.prototype.focusRow = function (rowElement, keyCode) { var nextRowElement = this.getPrevNextRow(rowElement, keyCode); if (nextRowElement) nextRowElement.focus(); }; DataTableSelectionComponent.prototype.getPrevNextRow = function (rowElement, keyCode) { var parentElement = rowElement.parentElement; if (parentElement) { var focusElement = void 0; if (keyCode === utils_1.Keys.up) { focusElement = parentElement.previousElementSibling; } else if (keyCode === utils_1.Keys.down) { focusElement = parentElement.nextElementSibling; } if (focusElement && focusElement.children.length) { return focusElement.children[0]; } } }; DataTableSelectionComponent.prototype.focusCell = function (cellElement, rowElement, keyCode, cellIndex) { var nextCellElement; if (keyCode === utils_1.Keys.left) { nextCellElement = cellElement.previousElementSibling; } else if (keyCode === utils_1.Keys.right) { nextCellElement = cellElement.nextElementSibling; } else if (keyCode === utils_1.Keys.up || keyCode === utils_1.Keys.down) { var nextRowElement = this.getPrevNextRow(rowElement, keyCode); if (nextRowElement) { var children = nextRowElement.getElementsByClassName('datatable-body-cell'); if (children.length) nextCellElement = children[cellIndex]; } } if (nextCellElement) nextCellElement.focus(); }; DataTableSelectionComponent.prototype.getRowSelected = function (row) { return this.getRowSelectedIdx(row, this.selected) > -1; }; DataTableSelectionComponent.prototype.getRowSelectedIdx = function (row, selected) { var _this = this; if (!selected || !selected.length) return -1; var rowId = this.rowIdentity(row); return selected.findIndex(function (r) { var id = _this.rowIdentity(r); return id === rowId; }); }; __decorate([ core_1.Input(), __metadata("design:type", Array) ], DataTableSelectionComponent.prototype, "rows", void 0); __decorate([ core_1.Input(), __metadata("design:type", Array) ], DataTableSelectionComponent.prototype, "selected", void 0); __decorate([ core_1.Input(), __metadata("design:type", Boolean) ], DataTableSelectionComponent.prototype, "selectEnabled", void 0); __decorate([ core_1.Input(), __metadata("design:type", String) ], DataTableSelectionComponent.prototype, "selectionType", void 0); __decorate([ core_1.Input(), __metadata("design:type", Object) ], DataTableSelectionComponent.prototype, "rowIdentity", void 0); __decorate([ core_1.Input(), __metadata("design:type", Object) ], DataTableSelectionComponent.prototype, "selectCheck", void 0); __decorate([ core_1.Output(), __metadata("design:type", core_1.EventEmitter) ], DataTableSelectionComponent.prototype, "activate", void 0); __decorate([ core_1.Output(), __metadata("design:type", core_1.EventEmitter) ], DataTableSelectionComponent.prototype, "select", void 0); DataTableSelectionComponent = __decorate([ core_1.Component({ selector: 'datatable-selection', template: "\n <ng-content></ng-content>\n ", changeDetection: core_1.ChangeDetectionStrategy.OnPush }) ], DataTableSelectionComponent); return DataTableSelectionComponent; }()); exports.DataTableSelectionComponent = DataTableSelectionComponent; /***/ }), /***/ "./src/components/body/summary/index.ts": /***/ (function(module, exports, __webpack_require__) { "use strict"; function __export(m) { for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; } Object.defineProperty(exports, "__esModule", { value: true }); __export(__webpack_require__("./src/components/body/summary/summary-row.component.ts")); /***/ }), /***/ "./src/components/body/summary/summary-row.component.ts": /***/ (function(module, exports, __webpack_require__) { "use strict"; var __assign = (this && this.__assign) || Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("@angular/core"); function defaultSumFunc(cells) { return cells .filter(function (cell) { return !!cell; }) .reduce(function (res, cell) { return res + cell; }); } var DataTableSummaryRowComponent = /** @class */ (function () { function DataTableSummaryRowComponent() { this.summaryRow = {}; } DataTableSummaryRowComponent.prototype.ngOnChanges = function () { if (!this.columns || !this.rows) { return; } this.updateInternalColumns(); this.updateValues(); }; DataTableSummaryRowComponent.prototype.updateInternalColumns = function () { this._internalColumns = this.columns.map(function (col) { return (__assign({}, col, { cellTemplate: col.summaryTemplate })); }); }; DataTableSummaryRowComponent.prototype.updateValues = function () { var _this = this; this.summaryRow = {}; this.columns .filter(function (col) { return !col.summaryTemplate; }) .forEach(function (col) { var cellsFromSingleColumn = _this.rows.map(function (row) { return row[col.prop]; }); var sumFunc = col.summaryFunc || defaultSumFunc; _this.summaryRow[col.prop] = col.pipe ? col.pipe.transform(sumFunc(cellsFromSingleColumn)) : sumFunc(cellsFromSingleColumn); }); }; __decorate([ core_1.Input(), __metadata("design:type", Array) ], DataTableSummaryRowComponent.prototype, "rows", void 0); __decorate([ core_1.Input(), __metadata("design:type", Array) ], DataTableSummaryRowComponent.prototype, "columns", void 0); __decorate([ core_1.Input(), __metadata("design:type", Number) ], DataTableSummaryRowComponent.prototype, "rowHeight", void 0); __decorate([ core_1.Input(), __metadata("design:type", Number) ], DataTableSummaryRowComponent.prototype, "offsetX", void 0); __decorate([ core_1.Input(), __metadata("design:type", Number) ], DataTableSummaryRowComponent.prototype, "innerWidth", void 0); DataTableSummaryRowComponent = __decorate([ core_1.Component({ selector: 'datatable-summary-row', template: "\n <datatable-body-row\n *ngIf=\"summaryRow && _internalColumns\"\n tabindex=\"-1\"\n [innerWidth]=\"innerWidth\"\n [offsetX]=\"offsetX\"\n [columns]=\"_internalColumns\"\n [rowHeight]=\"rowHeight\"\n [row]=\"summaryRow\"\n [rowIndex]=\"-1\">\n </datatable-body-row>\n ", host: { class: 'datatable-summary-row' } }) ], DataTableSummaryRowComponent); return DataTableSummaryRowComponent; }()); exports.DataTableSummaryRowComponent = DataTableSummaryRowComponent; /***/ }), /***/ "./src/components/columns/column-cell.directive.ts": /***/ (function(module, exports, __webpack_require__) { "use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("@angular/core"); var DataTableColumnCellDirective = /** @class */ (function () { function DataTableColumnCellDirective(template) { this.template = template; } DataTableColumnCellDirective = __decorate([ core_1.Directive({ selector: '[ngx-datatable-cell-template]' }), __metadata("design:paramtypes", [core_1.TemplateRef]) ], DataTableColumnCellDirective); return DataTableColumnCellDirective; }()); exports.DataTableColumnCellDirective = DataTableColumnCellDirective; /***/ }), /***/ "./src/components/columns/column-header.directive.ts": /***/ (function(module, exports, __webpack_require__) { "use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("@angular/core"); var DataTableColumnHeaderDirective = /** @class */ (function () { function DataTableColumnHeaderDirective(template) { this.template = template; } DataTableColumnHeaderDirective = __decorate([ core_1.Directive({ selector: '[ngx-datatable-header-template]' }), __metadata("design:paramtypes", [core_1.TemplateRef]) ], DataTableColumnHeaderDirective); return DataTableColumnHeaderDirective; }()); exports.DataTableColumnHeaderDirective = DataTableColumnHeaderDirective; /***/ }), /***/ "./src/components/columns/column.directive.ts": /***/ (function(module, exports, __webpack_require__) { "use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("@angular/core"); var column_header_directive_1 = __webpack_require__("./src/components/columns/column-header.directive.ts"); var column_cell_directive_1 = __webpack_require__("./src/components/columns/column-cell.directive.ts"); var DataTableColumnDirective = /** @class */ (function () { function DataTableColumnDirective() { } __decorate([ core_1.Input(), __metadata("design:type", String) ], DataTableColumnDirective.prototype, "name", void 0); __decorate([ core_1.Input(), __metadata("design:type", Object) ], DataTableColumnDirective.prototype, "prop", void 0); __decorate([ core_1.Input(), __metadata("design:type", Object) ], DataTableColumnDirective.prototype, "frozenLeft", void 0); __decorate([ core_1.Input(), __metadata("design:type", Object) ], DataTableColumnDirective.prototype, "frozenRight", void 0); __decorate([ core_1.Input(), __metadata("design:type", Number) ], DataTableColumnDirective.prototype, "flexGrow", void 0); __decorate([ core_1.Input(), __metadata("design:type", Boolean) ], DataTableColumnDirective.prototype, "resizeable", void 0); __decorate([ core_1.Input(), __metadata("design:type", Object) ], DataTableColumnDirective.prototype, "comparator", void 0); __decorate([ core_1.Input(), __metadata("design:type", Object) ], DataTableColumnDirective.prototype, "pipe", void 0); __decorate([ core_1.Input(), __metadata("design:type", Boolean) ], DataTableColumnDirective.prototype, "sortable", void 0); __decorate([ core_1.Input(), __metadata("design:type", Boolean) ], DataTableColumnDirective.prototype, "draggable", void 0); __decorate([ core_1.Input(), __metadata("design:type", Boolean) ], DataTableColumnDirective.prototype, "canAutoResize", void 0); __decorate([ core_1.Input(), __metadata("design:type", Number) ], DataTableColumnDirective.prototype, "minWidth", void 0); __decorate([ core_1.Input(), __metadata("design:type", Number) ], DataTableColumnDirective.prototype, "width", void 0); __decorate([ core_1.Input(), __metadata("design:type", Number) ], DataTableColumnDirective.prototype, "maxWidth", void 0); __decorate([ core_1.Input(), __metadata("design:type", Boolean) ], DataTableColumnDirective.prototype, "checkboxable", void 0); __decorate([ core_1.Input(), __metadata("design:type", Boolean) ], DataTableColumnDirective.prototype, "headerCheckboxable", void 0); __decorate([ core_1.Input(), __metadata("design:type", Object) ], DataTableColumnDirective.prototype, "headerClass", void 0); __decorate([ core_1.Input(), __metadata("design:type", Object) ], DataTableColumnDirective.prototype, "cellClass", void 0); __decorate([ core_1.Input(), __metadata("design:type", Function) ], DataTableColumnDirective.prototype, "summaryFunc", void 0); __decorate([ core_1.Input(), __metadata("design:type", core_1.TemplateRef) ], DataTableColumnDirective.prototype, "summaryTemplate", void 0); __decorate([ core_1.Input(), core_1.ContentChild(column_cell_directive_1.DataTableColumnCellDirective, { read: core_1.TemplateRef }), __metadata("design:type", core_1.TemplateRef) ], DataTableColumnDirective.prototype, "cellTemplate", void 0); __decorate([ core_1.Input(), core_1.ContentChild(column_header_directive_1.DataTableColumnHeaderDirective, { read: core_1.TemplateRef }), __metadata("design:type", core_1.TemplateRef) ], DataTableColumnDirective.prototype, "headerTemplate", void 0); DataTableColumnDirective = __decorate([ core_1.Directive({ selector: 'ngx-datatable-column' }) ], DataTableColumnDirective); return DataTableColumnDirective; }()); exports.DataTableColumnDirective = DataTableColumnDirective; /***/ }), /***/ "./src/components/columns/index.ts": /***/ (function(module, exports, __webpack_require__) { "use strict"; function __export(m) { for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; } Object.defineProperty(exports, "__esModule", { value: true }); __export(__webpack_require__("./src/components/columns/column.directive.ts")); __export(__webpack_require__("./src/components/columns/column-header.directive.ts")); __export(__webpack_require__("./src/components/columns/column-cell.directive.ts")); /***/ }), /***/ "./src/components/datatable.component.scss": /***/ (function(module, exports, __webpack_require__) { var result = __webpack_require__("./node_modules/css-loader/index.js!./node_modules/postcss-loader/index.js!./node_modules/sass-loader/lib/loader.js?{\"sourceMap\":true}!./src/components/datatable.component.scss"); if (typeof result === "string") { module.exports = result; } else { module.exports = result.toString(); } /***/ }), /***/ "./src/components/datatable.component.ts": /***/ (function(module, exports, __webpack_require__) { "use strict"; var __assign = (this && this.__assign) || Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var __param = (this && this.__param) || function (paramIndex, decorator) { return function (target, key) { decorator(target, key, paramIndex); } }; Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("@angular/core"); var utils_1 = __webpack_require__("./src/utils/index.ts"); var services_1 = __webpack_require__("./src/services/index.ts"); var types_1 = __webpack_require__("./src/types/index.ts"); var body_1 = __webpack_require__("./src/components/body/index.ts"); var body_group_header_directive_1 = __webpack_require__("./src/components/body/body-group-header.directive.ts"); var columns_1 = __webpack_require__("./src/components/columns/index.ts"); var row_detail_1 = __webpack_require__("./src/components/row-detail/index.ts"); var footer_1 = __webpack_require__("./src/components/footer/index.ts"); var header_1 = __webpack_require__("./src/components/header/index.ts"); var BehaviorSubject_1 = __webpack_require__("rxjs/BehaviorSubject"); var DatatableComponent = /** @class */ (function () { function DatatableComponent(scrollbarHelper, dimensionsHelper, cd, element, differs) { this.scrollbarHelper = scrollbarHelper; this.dimensionsHelper = dimensionsHelper; this.cd = cd; /** * List of row objects that should be * represented as selected in the grid. * Default value: `[]` */ this.selected = []; /** * Enable vertical scrollbars */ this.scrollbarV = false; /** * Enable horz scrollbars */ this.scrollbarH = false; /** * The row height; which is necessary * to calculate the height for the lazy rendering. */ this.rowHeight = 30; /** * Type of column width distribution formula. * Example: flex, force, standard */ this.columnMode = types_1.ColumnMode.standard; /** * The minimum header height in pixels. * Pass a falsey for no header */ this.headerHeight = 30; /** * The minimum footer height in pixels. * Pass falsey for no footer */ this.footerHeight = 0; /** * If the table should use external paging * otherwise its assumed that all data is preloaded. */ this.externalPaging = false; /** * If the table should use external sorting or * the built-in basic sorting. */ this.externalSorting = false; /** * Show the linear loading bar. * Default value: `false` */ this.loadingIndicator = false; /** * Enable/Disable ability to re-order columns * by dragging them. */ this.reorderable = true; /** * The type of sorting */ this.sortType = types_1.SortType.single; /** * Array of sorted columns by property and type. * Default value: `[]` */ this.sorts = []; /** * Css class overrides */ this.cssClasses = { sortAscending: 'datatable-icon-up', sortDescending: 'datatable-icon-down', pagerLeftArrow: 'datatable-icon-left', pagerRightArrow: 'datatable-icon-right', pagerPrevious: 'datatable-icon-prev', pagerNext: 'datatable-icon-skip' }; /** * Message overrides for localization * * emptyMessage [default] = 'No data to display' * totalMessage [default] = 'total' * selectedMessage [default] = 'selected' */ this.messages = { // Message to show when array is presented // but contains no values emptyMessage: 'No data to display', // Footer total message totalMessage: 'total', // Footer selected message selectedMessage: 'selected' }; /** * This will be used when displaying or selecting rows. * when tracking/comparing them, we'll use the value of this fn, * * (`fn(x) === fn(y)` instead of `x === y`) */ this.rowIdentity = (function (x) { return x; }); /** * A boolean you can use to set the detault behaviour of rows and groups * whether they will start expanded or not. If ommited the default is NOT expanded. * */ this.groupExpansionDefault = false; /** * Property to which you can use for determining select all * rows on current page or not. * * @type {boolean} * @memberOf DatatableComponent */ this.selectAllRowsOnPage = false; /** * A flag for row virtualization on / off */ this.virtualization = true; /** * A flag for switching summary row on / off */ this.summaryRow = false; /** * A height of summary row */ this.summaryHeight = this.rowHeight; /** * A property holds a summary row position: top/bottom */ this.summaryPosition = 'top'; /** * Body was scrolled typically in a `scrollbarV:true` scenario. */ this.scroll = new core_1.EventEmitter(); /** * A cell or row was focused via keyboard or mouse click. */ this.activate = new core_1.EventEmitter(); /** * A cell or row was selected. */ this.select = new core_1.EventEmitter(); /** * Column sort was invoked. */ this.sort = new core_1.EventEmitter(); /** * The table was paged either triggered by the pager or the body scroll. */ this.page = new core_1.EventEmitter(); /** * Columns were re-ordered. */ this.reorder = new core_1.EventEmitter(); /** * Column was resized. */ this.resize = new core_1.EventEmitter(); /** * The context menu was invoked on the table. * type indicates whether the header or the body was clicked. * content contains either the column or the row that was clicked. */ this.tableContextmenu = new core_1.EventEmitter(false); this.rowCount = 0; this._offsetX = new BehaviorSubject_1.BehaviorSubject(0); this._count = 0; this._offset = 0; // get ref to elm for measuring this.element = element.nativeElement; this.rowDiffer = differs.find({}).create(); } Object.defineProperty(DatatableComponent.prototype, "rows", { /** * Gets the rows. */ get: function () { return this._rows; }, /** * Rows that are displayed in the table. */ set: function (val) { this._rows = val; if (val) { this._internalRows = val.slice(); } // auto sort on new updates if (!this.externalSorting) { this.sortInternalRows(); } // recalculate sizes/etc this.recalculate(); if (this._rows && this._groupRowsBy) { // If a column has been specified in _groupRowsBy created a new array with the data grouped by that row this.groupedRows = this.groupArrayBy(this._rows, this._groupRowsBy); } this.cd.markForCheck(); }, enumerable: true, configurable: true }); Object.defineProperty(DatatableComponent.prototype, "groupRowsBy", { get: function () { return this._groupRowsBy; }, /** * This attribute allows the user to set the name of the column to group the data with */ set: function (val) { if (val) { this._groupRowsBy = val; if (this._rows && this._groupRowsBy) { // cretes a new array with the data grouped this.groupedRows = this.groupArrayBy(this._rows, this._groupRowsBy); } } }, enumerable: true, configurable: true }); Object.defineProperty(DatatableComponent.prototype, "columns", { /** * Get the columns. */ get: function () { return this._columns; }, /** * Columns to be displayed. */ set: function (val) { if (val) { this._internalColumns = val.slice(); utils_1.setColumnDefaults(this._internalColumns); this.recalculateColumns(); } this._columns = val; }, enumerable: true, configurable: true }); Object.defineProperty(DatatableComponent.prototype, "limit", { /** * Gets the limit. */ get: function () { return this._limit; }, /** * The page size to be shown. * Default value: `undefined` */ set: function (val) { this._limit = val; // recalculate sizes/etc this.recalculate(); }, enumerable: true, configurable: true }); Object.defineProperty(DatatableComponent.prototype, "count", { /** * Gets the count. */ get: function () { return this._count; }, /** * The total count of all rows. * Default value: `0` */ set: function (val) { this._count = val; // recalculate sizes/etc this.recalculate(); }, enumerable: true, configurable: true }); Object.defineProperty(DatatableComponent.prototype, "offset", { get: function () { return Math.max(Math.min(this._offset, Math.ceil(this.rowCount / this.pageSize) - 1), 0); }, /** * The current offset ( page - 1 ) shown. * Default value: `0` */ set: function (val) { this._offset = val; }, enumerable: true, configurable: true }); Object.defineProperty(DatatableComponent.prototype, "isFixedHeader", { /** * CSS class applied if the header height if fixed height. */ get: function () { var headerHeight = this.headerHeight; return (typeof headerHeight === 'string') ? headerHeight !== 'auto' : true; }, enumerable: true, configurable: true }); Object.defineProperty(DatatableComponent.prototype, "isFixedRow", { /** * CSS class applied to the root element if * the row heights are fixed heights. */ get: function () { var rowHeight = this.rowHeight; return (typeof rowHeight === 'string') ? rowHeight !== 'auto' : true; }, enumerable: true, configurable: true }); Object.defineProperty(DatatableComponent.prototype, "isVertScroll", { /** * CSS class applied to root element if * vertical scrolling is enabled. */ get: function () { return this.scrollbarV; }, enumerable: true, configurable: true }); Object.defineProperty(DatatableComponent.prototype, "isHorScroll", { /** * CSS class applied to the root element * if the horziontal scrolling is enabled. */ get: function () { return this.scrollbarH; }, enumerable: true, configurable: true }); Object.defineProperty(DatatableComponent.prototype, "isSelectable", { /** * CSS class applied to root element is selectable. */ get: function () { return this.selectionType !== undefined; }, enumerable: true, configurable: true }); Object.defineProperty(DatatableComponent.prototype, "isCheckboxSelection", { /** * CSS class applied to root is checkbox selection. */ get: function () { return this.selectionType === types_1.SelectionType.checkbox; }, enumerable: true, configurable: true }); Object.defineProperty(DatatableComponent.prototype, "isCellSelection", { /** * CSS class applied to root if cell selection. */ get: function () { return this.selectionType === types_1.SelectionType.cell; }, enumerable: true, configurable: true }); Object.defineProperty(DatatableComponent.prototype, "isSingleSelection", { /** * CSS class applied to root if single select. */ get: function () { return this.selectionType === types_1.SelectionType.single; }, enumerable: true, configurable: true }); Object.defineProperty(DatatableComponent.prototype, "isMultiSelection", { /** * CSS class added to root element if mulit select */ get: function () { return this.selectionType === types_1.SelectionType.multi; }, enumerable: true, configurable: true }); Object.defineProperty(DatatableComponent.prototype, "isMultiClickSelection", { /** * CSS class added to root element if mulit click select */ get: function () { return this.selectionType === types_1.SelectionType.multiClick; }, enumerable: true, configurable: true }); Object.defineProperty(DatatableComponent.prototype, "columnTemplates", { /** * Returns the column templates. */ get: function () { return this._columnTemplates; }, /** * Column templates gathered from `ContentChildren` * if described in your markup. */ set: function (val) { this._columnTemplates = val; this.translateColumns(val); }, enumerable: true, configurable: true }); Object.defineProperty(DatatableComponent.prototype, "allRowsSelected", { /** * Returns if all rows are selected. */ get: function () { var allRowsSelected = (this.rows && this.selected && this.selected.length === this.rows.length); if (this.selectAllRowsOnPage) { var indexes = this.bodyComponent.indexes; var rowsOnPage = indexes.last - indexes.first; allRowsSelected = (this.selected.length === rowsOnPage); } return this.selected && this.rows && this.rows.length !== 0 && allRowsSelected; }, enumerable: true, configurable: true }); /** * Lifecycle hook that is called after data-bound * properties of a directive are initialized. */ DatatableComponent.prototype.ngOnInit = function () { // need to call this immediatly to size // if the table is hidden the visibility // listener will invoke this itself upon show this.recalculate(); }; /** * Lifecycle hook that is called after a component's * view has been fully initialized. */ DatatableComponent.prototype.ngAfterViewInit = function () { var _this = this; if (!this.externalSorting) { this.sortInternalRows(); } // this has to be done to prevent the change detection // tree from freaking out because we are readjusting if (typeof requestAnimationFrame === 'undefined') { return; } requestAnimationFrame(function () { _this.recalculate(); // emit page for virtual server-side kickoff if (_this.externalPaging && _this.scrollbarV) { _this.page.emit({ count: _this.count, pageSize: _this.pageSize, limit: _this.limit, offset: 0 }); } }); }; /** * Lifecycle hook that is called after a component's * content has been fully initialized. */ DatatableComponent.prototype.ngAfterContentInit = function () { var _this = this; this.columnTemplates.changes.subscribe(function (v) { return _this.translateColumns(v); }); }; /** * Translates the templates to the column objects */ DatatableComponent.prototype.translateColumns = function (val) { if (val) { var arr = val.toArray(); if (arr.length) { this._internalColumns = utils_1.translateTemplates(arr); utils_1.setColumnDefaults(this._internalColumns); this.recalculateColumns(); this.sortInternalRows(); this.cd.markForCheck(); } } }; /** * Creates a map with the data grouped by the user choice of grouping index * * @param originalArray the original array passed via parameter * @param groupByIndex the index of the column to group the data by */ DatatableComponent.prototype.groupArrayBy = function (originalArray, groupBy) { // create a map to hold groups with their corresponding results var map = new Map(); var i = 0; originalArray.forEach(function (item) { var key = item[groupBy]; if (!map.has(key)) { map.set(key, [item]); } else { map.get(key).push(item); } i++; }); var addGroup = function (key, value) { return { key: key, value: value }; }; // convert map back to a simple array of objects return Array.from(map, function (x) { return addGroup(x[0], x[1]); }); }; /* * Lifecycle hook that is called when Angular dirty checks a directive. */ DatatableComponent.prototype.ngDoCheck = function () { if (this.rowDiffer.diff(this.rows)) { if (!this.externalSorting) { this.sortInternalRows(); } else { this._internalRows = this.rows.slice(); } this.recalculatePages(); this.cd.markForCheck(); } }; /** * Recalc's the sizes of the grid. * * Updated automatically on changes to: * * - Columns * - Rows * - Paging related * * Also can be manually invoked or upon window resize. */ DatatableComponent.prototype.recalculate = function () { this.recalculateDims(); this.recalculateColumns(); }; /** * Window resize handler to update sizes. */ DatatableComponent.prototype.onWindowResize = function () { this.recalculate(); }; /** * Recalulcates the column widths based on column width * distribution mode and scrollbar offsets. */ DatatableComponent.prototype.recalculateColumns = function (columns, forceIdx, allowBleed) { if (columns === void 0) { columns = this._internalColumns; } if (forceIdx === void 0) { forceIdx = -1; } if (allowBleed === void 0) { allowBleed = this.scrollbarH; } if (!columns) return undefined; var width = this._innerWidth; if (this.scrollbarV) { width = width - this.scrollbarHelper.width; } if (this.columnMode === types_1.ColumnMode.force) { utils_1.forceFillColumnWidths(columns, width, forceIdx, allowBleed); } else if (this.columnMode === types_1.ColumnMode.flex) { utils_1.adjustColumnWidths(columns, width); } return columns; }; /** * Recalculates the dimensions of the table size. * Internally calls the page size and row count calcs too. * */ DatatableComponent.prototype.recalculateDims = function () { var dims = this.dimensionsHelper.getDimensions(this.element); this._innerWidth = Math.floor(dims.width); if (this.scrollbarV) { var height = dims.height; if (this.headerHeight) height = height - this.headerHeight; if (this.footerHeight) height = height - this.footerHeight; this.bodyHeight = height; } this.recalculatePages(); }; /** * Recalculates the pages after a update. */ DatatableComponent.prototype.recalculatePages = function () { this.pageSize = this.calcPageSize(); this.rowCount = this.calcRowCount(); }; /** * Body triggered a page event. */ DatatableComponent.prototype.onBodyPage = function (_a) { var offset = _a.offset; this.offset = offset; this.page.emit({ count: this.count, pageSize: this.pageSize, limit: this.limit, offset: this.offset }); }; /** * The body triggered a scroll event. */ DatatableComponent.prototype.onBodyScroll = function (event) { this._offsetX.next(event.offsetX); this.scroll.emit(event); this.cd.detectChanges(); }; /** * The footer triggered a page event. */ DatatableComponent.prototype.onFooterPage = function (event) { this.offset = event.page - 1; this.bodyComponent.updateOffsetY(this.offset); this.page.emit({ count: this.count, pageSize: this.pageSize, limit: this.limit, offset: this.offset }); if (this.selectAllRowsOnPage) { this.selected = []; this.select.emit({ selected: this.selected }); } }; /** * Recalculates the sizes of the page */ DatatableComponent.prototype.calcPageSize = function (val) { if (val === void 0) { val = this.rows; } // Keep the page size constant even if the row has been expanded. // This is because an expanded row is still considered to be a child of // the original row. Hence calculation would use rowHeight only. if (this.scrollbarV) { var size = Math.ceil(this.bodyHeight / this.rowHeight); return Math.max(size, 0); } // if limit is passed, we are paging if (this.limit !== undefined) { return this.limit; } // otherwise use row length if (val) { return val.length; } // other empty :( return 0; }; /** * Calculates the row count. */ DatatableComponent.prototype.calcRowCount = function (val) { if (val === void 0) { val = this.rows; } if (!this.externalPaging) { if (!val) return 0; if (this.groupedRows) { return this.groupedRows.length; } else { return val.length; } } return this.count; }; /** * The header triggered a contextmenu event. */ DatatableComponent.prototype.onColumnContextmenu = function (_a) { var event = _a.event, column = _a.column; this.tableContextmenu.emit({ event: event, type: types_1.ContextmenuType.header, content: column }); }; /** * The body triggered a contextmenu event. */ DatatableComponent.prototype.onRowContextmenu = function (_a) { var event = _a.event, row = _a.row; this.tableContextmenu.emit({ event: event, type: types_1.ContextmenuType.body, content: row }); }; /** * The header triggered a column resize event. */ DatatableComponent.prototype.onColumnResize = function (_a) { var column = _a.column, newValue = _a.newValue; /* Safari/iOS 10.2 workaround */ if (column === undefined) { return; } var idx; var cols = this._internalColumns.map(function (c, i) { c = __assign({}, c); if (c.$$id === column.$$id) { idx = i; c.width = newValue; // set this so we can force the column // width distribution to be to this value c.$$oldWidth = newValue; } return c; }); this.recalculateColumns(cols, idx); this._internalColumns = cols; this.resize.emit({ column: column, newValue: newValue }); }; /** * The header triggered a column re-order event. */ DatatableComponent.prototype.onColumnReorder = function (_a) { var column = _a.column, newValue = _a.newValue, prevValue = _a.prevValue; var cols = this._internalColumns.map(function (c) { return __assign({}, c); }); var prevCol = cols[newValue]; cols[newValue] = column; cols[prevValue] = prevCol; this._internalColumns = cols; this.reorder.emit({ column: column, newValue: newValue, prevValue: prevValue }); }; /** * The header triggered a column sort event. */ DatatableComponent.prototype.onColumnSort = function (event) { // clean selected rows if (this.selectAllRowsOnPage) { this.selected = []; this.select.emit({ selected: this.selected }); } this.sorts = event.sorts; // this could be optimized better since it will resort // the rows again on the 'push' detection... if (this.externalSorting === false) { // don't use normal setter so we don't resort this.sortInternalRows(); } // Always go to first page when sorting to see the newly sorted data this.offset = 0; this.bodyComponent.updateOffsetY(this.offset); this.sort.emit(event); }; /** * Toggle all row selection */ DatatableComponent.prototype.onHeaderSelect = function (event) { if (this.selectAllRowsOnPage) { // before we splice, chk if we currently have all selected var first = this.bodyComponent.indexes.first; var last = this.bodyComponent.indexes.last; var allSelected = this.selected.length === (last - first); // remove all existing either way this.selected = []; // do the opposite here if (!allSelected) { (_a = this.selected).push.apply(_a, this._internalRows.slice(first, last)); } } else { // before we splice, chk if we currently have all selected var allSelected = this.selected.length === this.rows.length; // remove all existing either way this.selected = []; // do the opposite here if (!allSelected) { (_b = this.selected).push.apply(_b, this.rows); } } this.select.emit({ selected: this.selected }); var _a, _b; }; /** * A row was selected from body */ DatatableComponent.prototype.onBodySelect = function (event) { this.select.emit(event); }; DatatableComponent.prototype.sortInternalRows = function () { this._internalRows = utils_1.sortRows(this._internalRows, this._internalColumns, this.sorts); }; __decorate([ core_1.Input(), __metadata("design:type", Object), __metadata("design:paramtypes", [Object]) ], DatatableComponent.prototype, "rows", null); __decorate([ core_1.Input(), __metadata("design:type", String), __metadata("design:paramtypes", [String]) ], DatatableComponent.prototype, "groupRowsBy", null); __decorate([ core_1.Input(), __metadata("design:type", Array) ], DatatableComponent.prototype, "groupedRows", void 0); __decorate([ core_1.Input(), __metadata("design:type", Array), __metadata("design:paramtypes", [Array]) ], DatatableComponent.prototype, "columns", null); __decorate([ core_1.Input(), __metadata("design:type", Array) ], DatatableComponent.prototype, "selected", void 0); __decorate([ core_1.Input(), __metadata("design:type", Boolean) ], DatatableComponent.prototype, "scrollbarV", void 0); __decorate([ core_1.Input(), __metadata("design:type", Boolean) ], DatatableComponent.prototype, "scrollbarH", void 0); __decorate([ core_1.Input(), __metadata("design:type", Number) ], DatatableComponent.prototype, "rowHeight", void 0); __decorate([ core_1.Input(), __metadata("design:type", String) ], DatatableComponent.prototype, "columnMode", void 0); __decorate([ core_1.Input(), __metadata("design:type", Object) ], DatatableComponent.prototype, "headerHeight", void 0); __decorate([ core_1.Input(), __metadata("design:type", Number) ], DatatableComponent.prototype, "footerHeight", void 0); __decorate([ core_1.Input(), __metadata("design:type", Boolean) ], DatatableComponent.prototype, "externalPaging", void 0); __decorate([ core_1.Input(), __metadata("design:type", Boolean) ], DatatableComponent.prototype, "externalSorting", void 0); __decorate([ core_1.Input(), __metadata("design:type", Number), __metadata("design:paramtypes", [Number]) ], DatatableComponent.prototype, "limit", null); __decorate([ core_1.Input(), __metadata("design:type", Number), __metadata("design:paramtypes", [Number]) ], DatatableComponent.prototype, "count", null); __decorate([ core_1.Input(), __metadata("design:type", Number), __metadata("design:paramtypes", [Number]) ], DatatableComponent.prototype, "offset", null); __decorate([ core_1.Input(), __metadata("design:type", Boolean) ], DatatableComponent.prototype, "loadingIndicator", void 0); __decorate([ core_1.Input(), __metadata("design:type", String) ], DatatableComponent.prototype, "selectionType", void 0); __decorate([ core_1.Input(), __metadata("design:type", Boolean) ], DatatableComponent.prototype, "reorderable", void 0); __decorate([ core_1.Input(), __metadata("design:type", String) ], DatatableComponent.prototype, "sortType", void 0); __decorate([ core_1.Input(), __metadata("design:type", Array) ], DatatableComponent.prototype, "sorts", void 0); __decorate([ core_1.Input(), __metadata("design:type", Object) ], DatatableComponent.prototype, "cssClasses", void 0); __decorate([ core_1.Input(), __metadata("design:type", Object) ], DatatableComponent.prototype, "messages", void 0); __decorate([ core_1.Input(), __metadata("design:type", Function) ], DatatableComponent.prototype, "rowIdentity", void 0); __decorate([ core_1.Input(), __metadata("design:type", Object) ], DatatableComponent.prototype, "rowClass", void 0); __decorate([ core_1.Input(), __metadata("design:type", Object) ], DatatableComponent.prototype, "selectCheck", void 0); __decorate([ core_1.Input(), __metadata("design:type", Function) ], DatatableComponent.prototype, "displayCheck", void 0); __decorate([ core_1.Input(), __metadata("design:type", Boolean) ], DatatableComponent.prototype, "groupExpansionDefault", void 0); __decorate([ core_1.Input(), __metadata("design:type", String) ], DatatableComponent.prototype, "trackByProp", void 0); __decorate([ core_1.Input(), __metadata("design:type", Object) ], DatatableComponent.prototype, "selectAllRowsOnPage", void 0); __decorate([ core_1.Input(), __metadata("design:type", Boolean) ], DatatableComponent.prototype, "virtualization", void 0); __decorate([ core_1.Input(), __metadata("design:type", Boolean) ], DatatableComponent.prototype, "summaryRow", void 0); __decorate([ core_1.Input(), __metadata("design:type", Number) ], DatatableComponent.prototype, "summaryHeight", void 0); __decorate([ core_1.Input(), __metadata("design:type", String) ], DatatableComponent.prototype, "summaryPosition", void 0); __decorate([ core_1.Output(), __metadata("design:type", core_1.EventEmitter) ], DatatableComponent.prototype, "scroll", void 0); __decorate([ core_1.Output(), __metadata("design:type", core_1.EventEmitter) ], DatatableComponent.prototype, "activate", void 0); __decorate([ core_1.Output(), __metadata("design:type", core_1.EventEmitter) ], DatatableComponent.prototype, "select", void 0); __decorate([ core_1.Output(), __metadata("design:type", core_1.EventEmitter) ], DatatableComponent.prototype, "sort", void 0); __decorate([ core_1.Output(), __metadata("design:type", core_1.EventEmitter) ], DatatableComponent.prototype, "page", void 0); __decorate([ core_1.Output(), __metadata("design:type", core_1.EventEmitter) ], DatatableComponent.prototype, "reorder", void 0); __decorate([ core_1.Output(), __metadata("design:type", core_1.EventEmitter) ], DatatableComponent.prototype, "resize", void 0); __decorate([ core_1.Output(), __metadata("design:type", Object) ], DatatableComponent.prototype, "tableContextmenu", void 0); __decorate([ core_1.HostBinding('class.fixed-header'), __metadata("design:type", Boolean), __metadata("design:paramtypes", []) ], DatatableComponent.prototype, "isFixedHeader", null); __decorate([ core_1.HostBinding('class.fixed-row'), __metadata("design:type", Boolean), __metadata("design:paramtypes", []) ], DatatableComponent.prototype, "isFixedRow", null); __decorate([ core_1.HostBinding('class.scroll-vertical'), __metadata("design:type", Boolean), __metadata("design:paramtypes", []) ], DatatableComponent.prototype, "isVertScroll", null); __decorate([ core_1.HostBinding('class.scroll-horz'), __metadata("design:type", Boolean), __metadata("design:paramtypes", []) ], DatatableComponent.prototype, "isHorScroll", null); __decorate([ core_1.HostBinding('class.selectable'), __metadata("design:type", Boolean), __metadata("design:paramtypes", []) ], DatatableComponent.prototype, "isSelectable", null); __decorate([ core_1.HostBinding('class.checkbox-selection'), __metadata("design:type", Boolean), __metadata("design:paramtypes", []) ], DatatableComponent.prototype, "isCheckboxSelection", null); __decorate([ core_1.HostBinding('class.cell-selection'), __metadata("design:type", Boolean), __metadata("design:paramtypes", []) ], DatatableComponent.prototype, "isCellSelection", null); __decorate([ core_1.HostBinding('class.single-selection'), __metadata("design:type", Boolean), __metadata("design:paramtypes", []) ], DatatableComponent.prototype, "isSingleSelection", null); __decorate([ core_1.HostBinding('class.multi-selection'), __metadata("design:type", Boolean), __metadata("design:paramtypes", []) ], DatatableComponent.prototype, "isMultiSelection", null); __decorate([ core_1.HostBinding('class.multi-click-selection'), __metadata("design:type", Boolean), __metadata("design:paramtypes", []) ], DatatableComponent.prototype, "isMultiClickSelection", null); __decorate([ core_1.ContentChildren(columns_1.DataTableColumnDirective), __metadata("design:type", core_1.QueryList), __metadata("design:paramtypes", [core_1.QueryList]) ], DatatableComponent.prototype, "columnTemplates", null); __decorate([ core_1.ContentChild(row_detail_1.DatatableRowDetailDirective), __metadata("design:type", row_detail_1.DatatableRowDetailDirective) ], DatatableComponent.prototype, "rowDetail", void 0); __decorate([ core_1.ContentChild(body_group_header_directive_1.DatatableGroupHeaderDirective), __metadata("design:type", body_group_header_directive_1.DatatableGroupHeaderDirective) ], DatatableComponent.prototype, "groupHeader", void 0); __decorate([ core_1.ContentChild(footer_1.DatatableFooterDirective), __metadata("design:type", footer_1.DatatableFooterDirective) ], DatatableComponent.prototype, "footer", void 0); __decorate([ core_1.ViewChild(body_1.DataTableBodyComponent), __metadata("design:type", body_1.DataTableBodyComponent) ], DatatableComponent.prototype, "bodyComponent", void 0); __decorate([ core_1.ViewChild(header_1.DataTableHeaderComponent), __metadata("design:type", header_1.DataTableHeaderComponent) ], DatatableComponent.prototype, "headerComponent", void 0); __decorate([ core_1.HostListener('window:resize'), utils_1.throttleable(5), __metadata("design:type", Function), __metadata("design:paramtypes", []), __metadata("design:returntype", void 0) ], DatatableComponent.prototype, "onWindowResize", null); DatatableComponent = __decorate([ core_1.Component({ selector: 'ngx-datatable', template: "\n <div\n visibilityObserver\n (visible)=\"recalculate()\">\n <datatable-header\n *ngIf=\"headerHeight\"\n [sorts]=\"sorts\"\n [sortType]=\"sortType\"\n [scrollbarH]=\"scrollbarH\"\n [innerWidth]=\"_innerWidth\"\n [offsetX]=\"_offsetX | async\"\n [dealsWithGroup]=\"groupedRows\"\n [columns]=\"_internalColumns\"\n [headerHeight]=\"headerHeight\"\n [reorderable]=\"reorderable\"\n [sortAscendingIcon]=\"cssClasses.sortAscending\"\n [sortDescendingIcon]=\"cssClasses.sortDescending\"\n [allRowsSelected]=\"allRowsSelected\"\n [selectionType]=\"selectionType\"\n (sort)=\"onColumnSort($event)\"\n (resize)=\"onColumnResize($event)\"\n (reorder)=\"onColumnReorder($event)\"\n (select)=\"onHeaderSelect($event)\"\n (columnContextmenu)=\"onColumnContextmenu($event)\">\n </datatable-header>\n <datatable-body\n [groupRowsBy]=\"groupRowsBy\"\n [groupedRows]=\"groupedRows\"\n [rows]=\"_internalRows\"\n [groupExpansionDefault]=\"groupExpansionDefault\"\n [scrollbarV]=\"scrollbarV\"\n [scrollbarH]=\"scrollbarH\"\n [virtualization]=\"virtualization\"\n [loadingIndicator]=\"loadingIndicator\"\n [externalPaging]=\"externalPaging\"\n [rowHeight]=\"rowHeight\"\n [rowCount]=\"rowCount\"\n [offset]=\"offset\"\n [trackByProp]=\"trackByProp\"\n [columns]=\"_internalColumns\"\n [pageSize]=\"pageSize\"\n [offsetX]=\"_offsetX | async\"\n [rowDetail]=\"rowDetail\"\n [groupHeader]=\"groupHeader\"\n [selected]=\"selected\"\n [innerWidth]=\"_innerWidth\"\n [bodyHeight]=\"bodyHeight\"\n [selectionType]=\"selectionType\"\n [emptyMessage]=\"messages.emptyMessage\"\n [rowIdentity]=\"rowIdentity\"\n [rowClass]=\"rowClass\"\n [selectCheck]=\"selectCheck\"\n [displayCheck]=\"displayCheck\"\n [summaryRow]=\"summaryRow\"\n [summaryHeight]=\"summaryHeight\"\n [summaryPosition]=\"summaryPosition\"\n (page)=\"onBodyPage($event)\"\n (activate)=\"activate.emit($event)\"\n (rowContextmenu)=\"onRowContextmenu($event)\"\n (select)=\"onBodySelect($event)\"\n (scroll)=\"onBodyScroll($event)\">\n </datatable-body>\n <datatable-footer\n *ngIf=\"footerHeight\"\n [rowCount]=\"rowCount\"\n [pageSize]=\"pageSize\"\n [offset]=\"offset\"\n [footerHeight]=\"footerHeight\"\n [footerTemplate]=\"footer\"\n [totalMessage]=\"messages.totalMessage\"\n [pagerLeftArrowIcon]=\"cssClasses.pagerLeftArrow\"\n [pagerRightArrowIcon]=\"cssClasses.pagerRightArrow\"\n [pagerPreviousIcon]=\"cssClasses.pagerPrevious\"\n [selectedCount]=\"selected.length\"\n [selectedMessage]=\"!!selectionType && messages.selectedMessage\"\n [pagerNextIcon]=\"cssClasses.pagerNext\"\n (page)=\"onFooterPage($event)\">\n </datatable-footer>\n </div>\n ", changeDetection: core_1.ChangeDetectionStrategy.OnPush, encapsulation: core_1.ViewEncapsulation.None, styles: [__webpack_require__("./src/components/datatable.component.scss")], host: { class: 'ngx-datatable' } }), __param(0, core_1.SkipSelf()), __param(1, core_1.SkipSelf()), __metadata("design:paramtypes", [services_1.ScrollbarHelper, services_1.DimensionsHelper, core_1.ChangeDetectorRef, core_1.ElementRef, core_1.KeyValueDiffers]) ], DatatableComponent); return DatatableComponent; }()); exports.DatatableComponent = DatatableComponent; /***/ }), /***/ "./src/components/footer/footer-template.directive.ts": /***/ (function(module, exports, __webpack_require__) { "use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("@angular/core"); var DataTableFooterTemplateDirective = /** @class */ (function () { function DataTableFooterTemplateDirective(template) { this.template = template; } DataTableFooterTemplateDirective = __decorate([ core_1.Directive({ selector: '[ngx-datatable-footer-template]' }), __metadata("design:paramtypes", [core_1.TemplateRef]) ], DataTableFooterTemplateDirective); return DataTableFooterTemplateDirective; }()); exports.DataTableFooterTemplateDirective = DataTableFooterTemplateDirective; /***/ }), /***/ "./src/components/footer/footer.component.ts": /***/ (function(module, exports, __webpack_require__) { "use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("@angular/core"); var DataTableFooterComponent = /** @class */ (function () { function DataTableFooterComponent() { this.selectedCount = 0; this.page = new core_1.EventEmitter(); } Object.defineProperty(DataTableFooterComponent.prototype, "isVisible", { get: function () { return (this.rowCount / this.pageSize) > 1; }, enumerable: true, configurable: true }); Object.defineProperty(DataTableFooterComponent.prototype, "curPage", { get: function () { return this.offset + 1; }, enumerable: true, configurable: true }); __decorate([ core_1.Input(), __metadata("design:type", Number) ], DataTableFooterComponent.prototype, "footerHeight", void 0); __decorate([ core_1.Input(), __metadata("design:type", Number) ], DataTableFooterComponent.prototype, "rowCount", void 0); __decorate([ core_1.Input(), __metadata("design:type", Number) ], DataTableFooterComponent.prototype, "pageSize", void 0); __decorate([ core_1.Input(), __metadata("design:type", Number) ], DataTableFooterComponent.prototype, "offset", void 0); __decorate([ core_1.Input(), __metadata("design:type", String) ], DataTableFooterComponent.prototype, "pagerLeftArrowIcon", void 0); __decorate([ core_1.Input(), __metadata("design:type", String) ], DataTableFooterComponent.prototype, "pagerRightArrowIcon", void 0); __decorate([ core_1.Input(), __metadata("design:type", String) ], DataTableFooterComponent.prototype, "pagerPreviousIcon", void 0); __decorate([ core_1.Input(), __metadata("design:type", String) ], DataTableFooterComponent.prototype, "pagerNextIcon", void 0); __decorate([ core_1.Input(), __metadata("design:type", String) ], DataTableFooterComponent.prototype, "totalMessage", void 0); __decorate([ core_1.Input(), __metadata("design:type", core_1.TemplateRef) ], DataTableFooterComponent.prototype, "footerTemplate", void 0); __decorate([ core_1.Input(), __metadata("design:type", Number) ], DataTableFooterComponent.prototype, "selectedCount", void 0); __decorate([ core_1.Input(), __metadata("design:type", Object) ], DataTableFooterComponent.prototype, "selectedMessage", void 0); __decorate([ core_1.Output(), __metadata("design:type", core_1.EventEmitter) ], DataTableFooterComponent.prototype, "page", void 0); DataTableFooterComponent = __decorate([ core_1.Component({ selector: 'datatable-footer', template: "\n <div\n class=\"datatable-footer-inner\"\n [ngClass]=\"{'selected-count': selectedMessage}\"\n [style.height.px]=\"footerHeight\">\n <ng-template\n *ngIf=\"footerTemplate\"\n [ngTemplateOutlet]=\"footerTemplate.template\"\n [ngTemplateOutletContext]=\"{ \n rowCount: rowCount, \n pageSize: pageSize, \n selectedCount: selectedCount,\n curPage: curPage,\n offset: offset\n }\">\n </ng-template>\n <div class=\"page-count\" *ngIf=\"!footerTemplate\">\n <span *ngIf=\"selectedMessage\">\n {{selectedCount.toLocaleString()}} {{selectedMessage}} / \n </span>\n {{rowCount.toLocaleString()}} {{totalMessage}}\n </div>\n <datatable-pager *ngIf=\"!footerTemplate\"\n [pagerLeftArrowIcon]=\"pagerLeftArrowIcon\"\n [pagerRightArrowIcon]=\"pagerRightArrowIcon\"\n [pagerPreviousIcon]=\"pagerPreviousIcon\"\n [pagerNextIcon]=\"pagerNextIcon\"\n [page]=\"curPage\"\n [size]=\"pageSize\"\n [count]=\"rowCount\"\n [hidden]=\"!isVisible\"\n (change)=\"page.emit($event)\">\n </datatable-pager>\n </div>\n ", host: { class: 'datatable-footer' }, changeDetection: core_1.ChangeDetectionStrategy.OnPush }) ], DataTableFooterComponent); return DataTableFooterComponent; }()); exports.DataTableFooterComponent = DataTableFooterComponent; /***/ }), /***/ "./src/components/footer/footer.directive.ts": /***/ (function(module, exports, __webpack_require__) { "use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("@angular/core"); var footer_template_directive_1 = __webpack_require__("./src/components/footer/footer-template.directive.ts"); var DatatableFooterDirective = /** @class */ (function () { function DatatableFooterDirective() { } __decorate([ core_1.Input(), __metadata("design:type", Number) ], DatatableFooterDirective.prototype, "footerHeight", void 0); __decorate([ core_1.Input(), __metadata("design:type", String) ], DatatableFooterDirective.prototype, "totalMessage", void 0); __decorate([ core_1.Input(), __metadata("design:type", Object) ], DatatableFooterDirective.prototype, "selectedMessage", void 0); __decorate([ core_1.Input(), __metadata("design:type", String) ], DatatableFooterDirective.prototype, "pagerLeftArrowIcon", void 0); __decorate([ core_1.Input(), __metadata("design:type", String) ], DatatableFooterDirective.prototype, "pagerRightArrowIcon", void 0); __decorate([ core_1.Input(), __metadata("design:type", String) ], DatatableFooterDirective.prototype, "pagerPreviousIcon", void 0); __decorate([ core_1.Input(), __metadata("design:type", String) ], DatatableFooterDirective.prototype, "pagerNextIcon", void 0); __decorate([ core_1.Input(), core_1.ContentChild(footer_template_directive_1.DataTableFooterTemplateDirective, { read: core_1.TemplateRef }), __metadata("design:type", core_1.TemplateRef) ], DatatableFooterDirective.prototype, "template", void 0); DatatableFooterDirective = __decorate([ core_1.Directive({ selector: 'ngx-datatable-footer' }) ], DatatableFooterDirective); return DatatableFooterDirective; }()); exports.DatatableFooterDirective = DatatableFooterDirective; /***/ }), /***/ "./src/components/footer/index.ts": /***/ (function(module, exports, __webpack_require__) { "use strict"; function __export(m) { for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; } Object.defineProperty(exports, "__esModule", { value: true }); __export(__webpack_require__("./src/components/footer/footer.component.ts")); __export(__webpack_require__("./src/components/footer/pager.component.ts")); __export(__webpack_require__("./src/components/footer/footer.directive.ts")); __export(__webpack_require__("./src/components/footer/footer-template.directive.ts")); /***/ }), /***/ "./src/components/footer/pager.component.ts": /***/ (function(module, exports, __webpack_require__) { "use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("@angular/core"); var DataTablePagerComponent = /** @class */ (function () { function DataTablePagerComponent() { this.change = new core_1.EventEmitter(); this._count = 0; this._page = 1; this._size = 0; } Object.defineProperty(DataTablePagerComponent.prototype, "size", { get: function () { return this._size; }, set: function (val) { this._size = val; this.pages = this.calcPages(); }, enumerable: true, configurable: true }); Object.defineProperty(DataTablePagerComponent.prototype, "count", { get: function () { return this._count; }, set: function (val) { this._count = val; this.pages = this.calcPages(); }, enumerable: true, configurable: true }); Object.defineProperty(DataTablePagerComponent.prototype, "page", { get: function () { return this._page; }, set: function (val) { this._page = val; this.pages = this.calcPages(); }, enumerable: true, configurable: true }); Object.defineProperty(DataTablePagerComponent.prototype, "totalPages", { get: function () { var count = this.size < 1 ? 1 : Math.ceil(this.count / this.size); return Math.max(count || 0, 1); }, enumerable: true, configurable: true }); DataTablePagerComponent.prototype.canPrevious = function () { return this.page > 1; }; DataTablePagerComponent.prototype.canNext = function () { return this.page < this.totalPages; }; DataTablePagerComponent.prototype.prevPage = function () { this.selectPage(this.page - 1); }; DataTablePagerComponent.prototype.nextPage = function () { this.selectPage(this.page + 1); }; DataTablePagerComponent.prototype.selectPage = function (page) { if (page > 0 && page <= this.totalPages && page !== this.page) { this.page = page; this.change.emit({ page: page }); } }; DataTablePagerComponent.prototype.calcPages = function (page) { var pages = []; var startPage = 1; var endPage = this.totalPages; var maxSize = 5; var isMaxSized = maxSize < this.totalPages; page = page || this.page; if (isMaxSized) { startPage = page - Math.floor(maxSize / 2); endPage = page + Math.floor(maxSize / 2); if (startPage < 1) { startPage = 1; endPage = Math.min(startPage + maxSize - 1, this.totalPages); } else if (endPage > this.totalPages) { startPage = Math.max(this.totalPages - maxSize + 1, 1); endPage = this.totalPages; } } for (var num = startPage; num <= endPage; num++) { pages.push({ number: num, text: num }); } return pages; }; __decorate([ core_1.Input(), __metadata("design:type", String) ], DataTablePagerComponent.prototype, "pagerLeftArrowIcon", void 0); __decorate([ core_1.Input(), __metadata("design:type", String) ], DataTablePagerComponent.prototype, "pagerRightArrowIcon", void 0); __decorate([ core_1.Input(), __metadata("design:type", String) ], DataTablePagerComponent.prototype, "pagerPreviousIcon", void 0); __decorate([ core_1.Input(), __metadata("design:type", String) ], DataTablePagerComponent.prototype, "pagerNextIcon", void 0); __decorate([ core_1.Input(), __metadata("design:type", Number), __metadata("design:paramtypes", [Number]) ], DataTablePagerComponent.prototype, "size", null); __decorate([ core_1.Input(), __metadata("design:type", Number), __metadata("design:paramtypes", [Number]) ], DataTablePagerComponent.prototype, "count", null); __decorate([ core_1.Input(), __metadata("design:type", Number), __metadata("design:paramtypes", [Number]) ], DataTablePagerComponent.prototype, "page", null); __decorate([ core_1.Output(), __metadata("design:type", core_1.EventEmitter) ], DataTablePagerComponent.prototype, "change", void 0); DataTablePagerComponent = __decorate([ core_1.Component({ selector: 'datatable-pager', template: "\n <ul class=\"pager\">\n <li [class.disabled]=\"!canPrevious()\">\n <a\n role=\"button\"\n aria-label=\"go to first page\"\n href=\"javascript:void(0)\"\n (click)=\"selectPage(1)\">\n <i class=\"{{pagerPreviousIcon}}\"></i>\n </a>\n </li>\n <li [class.disabled]=\"!canPrevious()\">\n <a\n role=\"button\"\n aria-label=\"go to previous page\"\n href=\"javascript:void(0)\"\n (click)=\"prevPage()\">\n <i class=\"{{pagerLeftArrowIcon}}\"></i>\n </a>\n </li>\n <li\n role=\"button\"\n [attr.aria-label]=\"'page ' + pg.number\"\n class=\"pages\"\n *ngFor=\"let pg of pages\"\n [class.active]=\"pg.number === page\">\n <a\n href=\"javascript:void(0)\"\n (click)=\"selectPage(pg.number)\">\n {{pg.text}}\n </a>\n </li>\n <li [class.disabled]=\"!canNext()\">\n <a\n role=\"button\"\n aria-label=\"go to next page\"\n href=\"javascript:void(0)\"\n (click)=\"nextPage()\">\n <i class=\"{{pagerRightArrowIcon}}\"></i>\n </a>\n </li>\n <li [class.disabled]=\"!canNext()\">\n <a\n role=\"button\"\n aria-label=\"go to last page\"\n href=\"javascript:void(0)\"\n (click)=\"selectPage(totalPages)\">\n <i class=\"{{pagerNextIcon}}\"></i>\n </a>\n </li>\n </ul>\n ", host: { class: 'datatable-pager' }, changeDetection: core_1.ChangeDetectionStrategy.OnPush }) ], DataTablePagerComponent); return DataTablePagerComponent; }()); exports.DataTablePagerComponent = DataTablePagerComponent; /***/ }), /***/ "./src/components/header/header-cell.component.ts": /***/ (function(module, exports, __webpack_require__) { "use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("@angular/core"); var types_1 = __webpack_require__("./src/types/index.ts"); var utils_1 = __webpack_require__("./src/utils/index.ts"); var events_1 = __webpack_require__("./src/events.ts"); var DataTableHeaderCellComponent = /** @class */ (function () { function DataTableHeaderCellComponent(cd) { this.cd = cd; this.sort = new core_1.EventEmitter(); this.select = new core_1.EventEmitter(); this.columnContextmenu = new core_1.EventEmitter(false); this.sortFn = this.onSort.bind(this); this.selectFn = this.select.emit.bind(this.select); this.cellContext = { column: this.column, sortDir: this.sortDir, sortFn: this.sortFn, allRowsSelected: this.allRowsSelected, selectFn: this.selectFn }; } Object.defineProperty(DataTableHeaderCellComponent.prototype, "allRowsSelected", { get: function () { return this._allRowsSelected; }, set: function (value) { this._allRowsSelected = value; this.cellContext.allRowsSelected = value; }, enumerable: true, configurable: true }); Object.defineProperty(DataTableHeaderCellComponent.prototype, "column", { get: function () { return this._column; }, set: function (column) { this._column = column; this.cellContext.column = column; this.cd.markForCheck(); }, enumerable: true, configurable: true }); Object.defineProperty(DataTableHeaderCellComponent.prototype, "sorts", { get: function () { return this._sorts; }, set: function (val) { this._sorts = val; this.sortDir = this.calcSortDir(val); this.cellContext.sortDir = this.sortDir; this.sortClass = this.calcSortClass(this.sortDir); this.cd.markForCheck(); }, enumerable: true, configurable: true }); Object.defineProperty(DataTableHeaderCellComponent.prototype, "columnCssClasses", { get: function () { var cls = 'datatable-header-cell'; if (this.column.sortable) cls += ' sortable'; if (this.column.resizeable) cls += ' resizeable'; if (this.column.headerClass) { if (typeof this.column.headerClass === 'string') { cls += ' ' + this.column.headerClass; } else if (typeof this.column.headerClass === 'function') { var res = this.column.headerClass({ column: this.column }); if (typeof res === 'string') { cls += res; } else if (typeof res === 'object') { var keys = Object.keys(res); for (var _i = 0, keys_1 = keys; _i < keys_1.length; _i++) { var k = keys_1[_i]; if (res[k] === true) cls += " " + k; } } } } var sortDir = this.sortDir; if (sortDir) { cls += " sort-active sort-" + sortDir; } return cls; }, enumerable: true, configurable: true }); Object.defineProperty(DataTableHeaderCellComponent.prototype, "name", { get: function () { // guaranteed to have a value by setColumnDefaults() in column-helper.ts return this.column.headerTemplate === undefined ? this.column.name : undefined; }, enumerable: true, configurable: true }); Object.defineProperty(DataTableHeaderCellComponent.prototype, "minWidth", { get: function () { return this.column.minWidth; }, enumerable: true, configurable: true }); Object.defineProperty(DataTableHeaderCellComponent.prototype, "maxWidth", { get: function () { return this.column.maxWidth; }, enumerable: true, configurable: true }); Object.defineProperty(DataTableHeaderCellComponent.prototype, "width", { get: function () { return this.column.width; }, enumerable: true, configurable: true }); Object.defineProperty(DataTableHeaderCellComponent.prototype, "isCheckboxable", { get: function () { return this.column.checkboxable && this.column.headerCheckboxable && this.selectionType === types_1.SelectionType.checkbox; }, enumerable: true, configurable: true }); DataTableHeaderCellComponent.prototype.onContextmenu = function ($event) { this.columnContextmenu.emit({ event: $event, column: this.column }); }; DataTableHeaderCellComponent.prototype.calcSortDir = function (sorts) { var _this = this; if (sorts && this.column) { var sort = sorts.find(function (s) { return s.prop === _this.column.prop; }); if (sort) return sort.dir; } }; DataTableHeaderCellComponent.prototype.onSort = function () { if (!this.column.sortable) return; var newValue = utils_1.nextSortDir(this.sortType, this.sortDir); this.sort.emit({ column: this.column, prevValue: this.sortDir, newValue: newValue }); }; DataTableHeaderCellComponent.prototype.calcSortClass = function (sortDir) { if (sortDir === types_1.SortDirection.asc) { return "sort-btn sort-asc " + this.sortAscendingIcon; } else if (sortDir === types_1.SortDirection.desc) { return "sort-btn sort-desc " + this.sortDescendingIcon; } else { return "sort-btn"; } }; __decorate([ core_1.Input(), __metadata("design:type", String) ], DataTableHeaderCellComponent.prototype, "sortType", void 0); __decorate([ core_1.Input(), __metadata("design:type", String) ], DataTableHeaderCellComponent.prototype, "sortAscendingIcon", void 0); __decorate([ core_1.Input(), __metadata("design:type", String) ], DataTableHeaderCellComponent.prototype, "sortDescendingIcon", void 0); __decorate([ core_1.Input(), __metadata("design:type", Object), __metadata("design:paramtypes", [Object]) ], DataTableHeaderCellComponent.prototype, "allRowsSelected", null); __decorate([ core_1.Input(), __metadata("design:type", String) ], DataTableHeaderCellComponent.prototype, "selectionType", void 0); __decorate([ core_1.Input(), __metadata("design:type", Object), __metadata("design:paramtypes", [Object]) ], DataTableHeaderCellComponent.prototype, "column", null); __decorate([ core_1.HostBinding('style.height.px'), core_1.Input(), __metadata("design:type", Number) ], DataTableHeaderCellComponent.prototype, "headerHeight", void 0); __decorate([ core_1.Input(), __metadata("design:type", Array), __metadata("design:paramtypes", [Array]) ], DataTableHeaderCellComponent.prototype, "sorts", null); __decorate([ core_1.Output(), __metadata("design:type", core_1.EventEmitter) ], DataTableHeaderCellComponent.prototype, "sort", void 0); __decorate([ core_1.Output(), __metadata("design:type", core_1.EventEmitter) ], DataTableHeaderCellComponent.prototype, "select", void 0); __decorate([ core_1.Output(), __metadata("design:type", Object) ], DataTableHeaderCellComponent.prototype, "columnContextmenu", void 0); __decorate([ core_1.HostBinding('class'), __metadata("design:type", Object), __metadata("design:paramtypes", []) ], DataTableHeaderCellComponent.prototype, "columnCssClasses", null); __decorate([ core_1.HostBinding('attr.title'), __metadata("design:type", String), __metadata("design:paramtypes", []) ], DataTableHeaderCellComponent.prototype, "name", null); __decorate([ core_1.HostBinding('style.minWidth.px'), __metadata("design:type", Number), __metadata("design:paramtypes", []) ], DataTableHeaderCellComponent.prototype, "minWidth", null); __decorate([ core_1.HostBinding('style.maxWidth.px'), __metadata("design:type", Number), __metadata("design:paramtypes", []) ], DataTableHeaderCellComponent.prototype, "maxWidth", null); __decorate([ core_1.HostBinding('style.width.px'), __metadata("design:type", Number), __metadata("design:paramtypes", []) ], DataTableHeaderCellComponent.prototype, "width", null); __decorate([ core_1.HostListener('contextmenu', ['$event']), __metadata("design:type", Function), __metadata("design:paramtypes", [Object]), __metadata("design:returntype", void 0) ], DataTableHeaderCellComponent.prototype, "onContextmenu", null); DataTableHeaderCellComponent = __decorate([ core_1.Component({ selector: 'datatable-header-cell', template: "\n <div class=\"datatable-header-cell-template-wrap\">\n <label\n *ngIf=\"isCheckboxable\"\n class=\"datatable-checkbox\">\n <input\n type=\"checkbox\"\n [checked]=\"allRowsSelected\"\n (change)=\"select.emit(!allRowsSelected)\"\n />\n </label>\n <span\n *ngIf=\"!column.headerTemplate\"\n class=\"datatable-header-cell-wrapper\">\n <span\n class=\"datatable-header-cell-label draggable\"\n (click)=\"onSort()\"\n [innerHTML]=\"name\">\n </span>\n </span>\n <ng-template\n *ngIf=\"column.headerTemplate\"\n [ngTemplateOutlet]=\"column.headerTemplate\"\n [ngTemplateOutletContext]=\"cellContext\">\n </ng-template>\n <span\n (click)=\"onSort()\"\n [class]=\"sortClass\">\n </span>\n </div>\n ", host: { class: 'datatable-header-cell' }, changeDetection: core_1.ChangeDetectionStrategy.OnPush }), __metadata("design:paramtypes", [core_1.ChangeDetectorRef]) ], DataTableHeaderCellComponent); return DataTableHeaderCellComponent; }()); exports.DataTableHeaderCellComponent = DataTableHeaderCellComponent; /***/ }), /***/ "./src/components/header/header.component.ts": /***/ (function(module, exports, __webpack_require__) { "use strict"; var __assign = (this && this.__assign) || Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("@angular/core"); var types_1 = __webpack_require__("./src/types/index.ts"); var utils_1 = __webpack_require__("./src/utils/index.ts"); var DataTableHeaderComponent = /** @class */ (function () { function DataTableHeaderComponent(cd) { this.cd = cd; this.sort = new core_1.EventEmitter(); this.reorder = new core_1.EventEmitter(); this.resize = new core_1.EventEmitter(); this.select = new core_1.EventEmitter(); this.columnContextmenu = new core_1.EventEmitter(false); this._styleByGroup = { left: {}, center: {}, right: {} }; } Object.defineProperty(DataTableHeaderComponent.prototype, "innerWidth", { get: function () { return this._innerWidth; }, set: function (val) { this._innerWidth = val; if (this._columns) { var colByPin = utils_1.columnsByPin(this._columns); this._columnGroupWidths = utils_1.columnGroupWidths(colByPin, this._columns); this.setStylesByGroup(); } }, enumerable: true, configurable: true }); Object.defineProperty(DataTableHeaderComponent.prototype, "headerHeight", { get: function () { return this._headerHeight; }, set: function (val) { if (val !== 'auto') { this._headerHeight = val + "px"; } else { this._headerHeight = val; } }, enumerable: true, configurable: true }); Object.defineProperty(DataTableHeaderComponent.prototype, "columns", { get: function () { return this._columns; }, set: function (val) { this._columns = val; var colsByPin = utils_1.columnsByPin(val); this._columnsByPin = utils_1.columnsByPinArr(val); this._columnGroupWidths = utils_1.columnGroupWidths(colsByPin, val); this.setStylesByGroup(); }, enumerable: true, configurable: true }); Object.defineProperty(DataTableHeaderComponent.prototype, "offsetX", { get: function () { return this._offsetX; }, set: function (val) { this._offsetX = val; this.setStylesByGroup(); }, enumerable: true, configurable: true }); DataTableHeaderComponent.prototype.onLongPressStart = function (_a) { var event = _a.event, model = _a.model; model.dragging = true; this.dragEventTarget = event; }; DataTableHeaderComponent.prototype.onLongPressEnd = function (_a) { var event = _a.event, model = _a.model; this.dragEventTarget = event; // delay resetting so sort can be // prevented if we were dragging setTimeout(function () { model.dragging = false; }, 5); }; Object.defineProperty(DataTableHeaderComponent.prototype, "headerWidth", { get: function () { if (this.scrollbarH) { return this.innerWidth + 'px'; } return '100%'; }, enumerable: true, configurable: true }); DataTableHeaderComponent.prototype.trackByGroups = function (index, colGroup) { return colGroup.type; }; DataTableHeaderComponent.prototype.columnTrackingFn = function (index, column) { return column.$$id; }; DataTableHeaderComponent.prototype.onColumnResized = function (width, column) { if (width <= column.minWidth) { width = column.minWidth; } else if (width >= column.maxWidth) { width = column.maxWidth; } this.resize.emit({ column: column, prevValue: column.width, newValue: width }); }; DataTableHeaderComponent.prototype.onColumnReordered = function (_a) { var prevIndex = _a.prevIndex, newIndex = _a.newIndex, model = _a.model; this.reorder.emit({ column: model, prevValue: prevIndex, newValue: newIndex }); }; DataTableHeaderComponent.prototype.onSort = function (_a) { var column = _a.column, prevValue = _a.prevValue, newValue = _a.newValue; // if we are dragging don't sort! if (column.dragging) return; var sorts = this.calcNewSorts(column, prevValue, newValue); this.sort.emit({ sorts: sorts, column: column, prevValue: prevValue, newValue: newValue }); }; DataTableHeaderComponent.prototype.calcNewSorts = function (column, prevValue, newValue) { var idx = 0; if (!this.sorts) { this.sorts = []; } var sorts = this.sorts.map(function (s, i) { s = __assign({}, s); if (s.prop === column.prop) idx = i; return s; }); if (newValue === undefined) { sorts.splice(idx, 1); } else if (prevValue) { sorts[idx].dir = newValue; } else { if (this.sortType === types_1.SortType.single) { sorts.splice(0, this.sorts.length); } sorts.push({ dir: newValue, prop: column.prop }); } return sorts; }; DataTableHeaderComponent.prototype.setStylesByGroup = function () { this._styleByGroup['left'] = this.calcStylesByGroup('left'); this._styleByGroup['center'] = this.calcStylesByGroup('center'); this._styleByGroup['right'] = this.calcStylesByGroup('right'); this.cd.detectChanges(); }; DataTableHeaderComponent.prototype.calcStylesByGroup = function (group) { var widths = this._columnGroupWidths; var offsetX = this.offsetX; var styles = { width: widths[group] + "px" }; if (group === 'center') { utils_1.translateXY(styles, offsetX * -1, 0); } else if (group === 'right') { var totalDiff = widths.total - this.innerWidth; var offset = totalDiff * -1; utils_1.translateXY(styles, offset, 0); } return styles; }; __decorate([ core_1.Input(), __metadata("design:type", Object) ], DataTableHeaderComponent.prototype, "sortAscendingIcon", void 0); __decorate([ core_1.Input(), __metadata("design:type", Object) ], DataTableHeaderComponent.prototype, "sortDescendingIcon", void 0); __decorate([ core_1.Input(), __metadata("design:type", Boolean) ], DataTableHeaderComponent.prototype, "scrollbarH", void 0); __decorate([ core_1.Input(), __metadata("design:type", Boolean) ], DataTableHeaderComponent.prototype, "dealsWithGroup", void 0); __decorate([ core_1.Input(), __metadata("design:type", Number), __metadata("design:paramtypes", [Number]) ], DataTableHeaderComponent.prototype, "innerWidth", null); __decorate([ core_1.Input(), __metadata("design:type", Array) ], DataTableHeaderComponent.prototype, "sorts", void 0); __decorate([ core_1.Input(), __metadata("design:type", String) ], DataTableHeaderComponent.prototype, "sortType", void 0); __decorate([ core_1.Input(), __metadata("design:type", Boolean) ], DataTableHeaderComponent.prototype, "allRowsSelected", void 0); __decorate([ core_1.Input(), __metadata("design:type", String) ], DataTableHeaderComponent.prototype, "selectionType", void 0); __decorate([ core_1.Input(), __metadata("design:type", Boolean) ], DataTableHeaderComponent.prototype, "reorderable", void 0); __decorate([ core_1.HostBinding('style.height'), core_1.Input(), __metadata("design:type", Object), __metadata("design:paramtypes", [Object]) ], DataTableHeaderComponent.prototype, "headerHeight", null); __decorate([ core_1.Input(), __metadata("design:type", Array), __metadata("design:paramtypes", [Array]) ], DataTableHeaderComponent.prototype, "columns", null); __decorate([ core_1.Input(), __metadata("design:type", Number), __metadata("design:paramtypes", [Number]) ], DataTableHeaderComponent.prototype, "offsetX", null); __decorate([ core_1.Output(), __metadata("design:type", core_1.EventEmitter) ], DataTableHeaderComponent.prototype, "sort", void 0); __decorate([ core_1.Output(), __metadata("design:type", core_1.EventEmitter) ], DataTableHeaderComponent.prototype, "reorder", void 0); __decorate([ core_1.Output(), __metadata("design:type", core_1.EventEmitter) ], DataTableHeaderComponent.prototype, "resize", void 0); __decorate([ core_1.Output(), __metadata("design:type", core_1.EventEmitter) ], DataTableHeaderComponent.prototype, "select", void 0); __decorate([ core_1.Output(), __metadata("design:type", Object) ], DataTableHeaderComponent.prototype, "columnContextmenu", void 0); __decorate([ core_1.HostBinding('style.width'), __metadata("design:type", String), __metadata("design:paramtypes", []) ], DataTableHeaderComponent.prototype, "headerWidth", null); DataTableHeaderComponent = __decorate([ core_1.Component({ selector: 'datatable-header', template: "\n <div\n orderable\n (reorder)=\"onColumnReordered($event)\"\n [style.width.px]=\"_columnGroupWidths.total\"\n class=\"datatable-header-inner\">\n <div\n *ngFor=\"let colGroup of _columnsByPin; trackBy: trackByGroups\"\n [class]=\"'datatable-row-' + colGroup.type\"\n [ngStyle]=\"_styleByGroup[colGroup.type]\">\n <datatable-header-cell\n *ngFor=\"let column of colGroup.columns; trackBy: columnTrackingFn\"\n resizeable\n [resizeEnabled]=\"column.resizeable\"\n (resize)=\"onColumnResized($event, column)\"\n long-press\n [pressModel]=\"column\"\n [pressEnabled]=\"reorderable && column.draggable\"\n (longPressStart)=\"onLongPressStart($event)\"\n (longPressEnd)=\"onLongPressEnd($event)\"\n draggable\n [dragX]=\"reorderable && column.draggable && column.dragging\"\n [dragY]=\"false\"\n [dragModel]=\"column\"\n [dragEventTarget]=\"dragEventTarget\"\n [headerHeight]=\"headerHeight\"\n [column]=\"column\"\n [sortType]=\"sortType\"\n [sorts]=\"sorts\"\n [selectionType]=\"selectionType\"\n [sortAscendingIcon]=\"sortAscendingIcon\"\n [sortDescendingIcon]=\"sortDescendingIcon\"\n [allRowsSelected]=\"allRowsSelected\"\n (sort)=\"onSort($event)\"\n (select)=\"select.emit($event)\"\n (columnContextmenu)=\"columnContextmenu.emit($event)\">\n </datatable-header-cell>\n </div>\n </div>\n ", host: { class: 'datatable-header' }, changeDetection: core_1.ChangeDetectionStrategy.OnPush }), __metadata("design:paramtypes", [core_1.ChangeDetectorRef]) ], DataTableHeaderComponent); return DataTableHeaderComponent; }()); exports.DataTableHeaderComponent = DataTableHeaderComponent; /***/ }), /***/ "./src/components/header/index.ts": /***/ (function(module, exports, __webpack_require__) { "use strict"; function __export(m) { for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; } Object.defineProperty(exports, "__esModule", { value: true }); __export(__webpack_require__("./src/components/header/header.component.ts")); __export(__webpack_require__("./src/components/header/header-cell.component.ts")); /***/ }), /***/ "./src/components/index.ts": /***/ (function(module, exports, __webpack_require__) { "use strict"; function __export(m) { for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; } Object.defineProperty(exports, "__esModule", { value: true }); __export(__webpack_require__("./src/components/datatable.component.ts")); __export(__webpack_require__("./src/components/header/index.ts")); __export(__webpack_require__("./src/components/body/index.ts")); __export(__webpack_require__("./src/components/footer/index.ts")); __export(__webpack_require__("./src/components/columns/index.ts")); __export(__webpack_require__("./src/components/row-detail/index.ts")); /***/ }), /***/ "./src/components/row-detail/index.ts": /***/ (function(module, exports, __webpack_require__) { "use strict"; function __export(m) { for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; } Object.defineProperty(exports, "__esModule", { value: true }); __export(__webpack_require__("./src/components/row-detail/row-detail.directive.ts")); __export(__webpack_require__("./src/components/row-detail/row-detail-template.directive.ts")); /***/ }), /***/ "./src/components/row-detail/row-detail-template.directive.ts": /***/ (function(module, exports, __webpack_require__) { "use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("@angular/core"); var DatatableRowDetailTemplateDirective = /** @class */ (function () { function DatatableRowDetailTemplateDirective(template) { this.template = template; } DatatableRowDetailTemplateDirective = __decorate([ core_1.Directive({ selector: '[ngx-datatable-row-detail-template]' }), __metadata("design:paramtypes", [core_1.TemplateRef]) ], DatatableRowDetailTemplateDirective); return DatatableRowDetailTemplateDirective; }()); exports.DatatableRowDetailTemplateDirective = DatatableRowDetailTemplateDirective; /***/ }), /***/ "./src/components/row-detail/row-detail.directive.ts": /***/ (function(module, exports, __webpack_require__) { "use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("@angular/core"); var row_detail_template_directive_1 = __webpack_require__("./src/components/row-detail/row-detail-template.directive.ts"); var DatatableRowDetailDirective = /** @class */ (function () { function DatatableRowDetailDirective() { /** * The detail row height is required especially * when virtual scroll is enabled. */ this.rowHeight = 0; /** * Row detail row visbility was toggled. */ this.toggle = new core_1.EventEmitter(); } /** * Toggle the expansion of the row */ DatatableRowDetailDirective.prototype.toggleExpandRow = function (row) { this.toggle.emit({ type: 'row', value: row }); }; /** * API method to expand all the rows. */ DatatableRowDetailDirective.prototype.expandAllRows = function () { this.toggle.emit({ type: 'all', value: true }); }; /** * API method to collapse all the rows. */ DatatableRowDetailDirective.prototype.collapseAllRows = function () { this.toggle.emit({ type: 'all', value: false }); }; __decorate([ core_1.Input(), __metadata("design:type", Object) ], DatatableRowDetailDirective.prototype, "rowHeight", void 0); __decorate([ core_1.Input(), core_1.ContentChild(row_detail_template_directive_1.DatatableRowDetailTemplateDirective, { read: core_1.TemplateRef }), __metadata("design:type", core_1.TemplateRef) ], DatatableRowDetailDirective.prototype, "template", void 0); __decorate([ core_1.Output(), __metadata("design:type", core_1.EventEmitter) ], DatatableRowDetailDirective.prototype, "toggle", void 0); DatatableRowDetailDirective = __decorate([ core_1.Directive({ selector: 'ngx-datatable-row-detail' }) ], DatatableRowDetailDirective); return DatatableRowDetailDirective; }()); exports.DatatableRowDetailDirective = DatatableRowDetailDirective; /***/ }), /***/ "./src/datatable.module.ts": /***/ (function(module, exports, __webpack_require__) { "use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("@angular/core"); var common_1 = __webpack_require__("@angular/common"); var components_1 = __webpack_require__("./src/components/index.ts"); var directives_1 = __webpack_require__("./src/directives/index.ts"); var services_1 = __webpack_require__("./src/services/index.ts"); var NgxDatatableModule = /** @class */ (function () { function NgxDatatableModule() { } NgxDatatableModule = __decorate([ core_1.NgModule({ imports: [ common_1.CommonModule ], providers: [ services_1.ScrollbarHelper, services_1.DimensionsHelper ], declarations: [ components_1.DataTableFooterTemplateDirective, directives_1.VisibilityDirective, directives_1.DraggableDirective, directives_1.ResizeableDirective, directives_1.OrderableDirective, directives_1.LongPressDirective, components_1.ScrollerComponent, components_1.DatatableComponent, components_1.DataTableColumnDirective, components_1.DataTableHeaderComponent, components_1.DataTableHeaderCellComponent, components_1.DataTableBodyComponent, components_1.DataTableFooterComponent, components_1.DataTablePagerComponent, components_1.ProgressBarComponent, components_1.DataTableBodyRowComponent, components_1.DataTableRowWrapperComponent, components_1.DatatableRowDetailDirective, components_1.DatatableGroupHeaderDirective, components_1.DatatableRowDetailTemplateDirective, components_1.DataTableBodyCellComponent, components_1.DataTableSelectionComponent, components_1.DataTableColumnHeaderDirective, components_1.DataTableColumnCellDirective, components_1.DatatableFooterDirective, components_1.DatatableGroupHeaderTemplateDirective, components_1.DataTableSummaryRowComponent, ], exports: [ components_1.DatatableComponent, components_1.DatatableRowDetailDirective, components_1.DatatableGroupHeaderDirective, components_1.DatatableRowDetailTemplateDirective, components_1.DataTableColumnDirective, components_1.DataTableColumnHeaderDirective, components_1.DataTableColumnCellDirective, components_1.DataTableFooterTemplateDirective, components_1.DatatableFooterDirective, components_1.DataTablePagerComponent, components_1.DatatableGroupHeaderTemplateDirective ] }) ], NgxDatatableModule); return NgxDatatableModule; }()); exports.NgxDatatableModule = NgxDatatableModule; /***/ }), /***/ "./src/directives/draggable.directive.ts": /***/ (function(module, exports, __webpack_require__) { "use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("@angular/core"); var operators_1 = __webpack_require__("rxjs/operators"); var fromEvent_1 = __webpack_require__("rxjs/observable/fromEvent"); /** * Draggable Directive for Angular2 * * Inspiration: * https://github.com/AngularClass/angular2-examples/blob/master/rx-draggable/directives/draggable.ts * http://stackoverflow.com/questions/35662530/how-to-implement-drag-and-drop-in-angular2 * */ var DraggableDirective = /** @class */ (function () { function DraggableDirective(element) { this.dragX = true; this.dragY = true; this.dragStart = new core_1.EventEmitter(); this.dragging = new core_1.EventEmitter(); this.dragEnd = new core_1.EventEmitter(); this.isDragging = false; this.element = element.nativeElement; } DraggableDirective.prototype.ngOnChanges = function (changes) { if (changes['dragEventTarget'] && changes['dragEventTarget'].currentValue && this.dragModel.dragging) { this.onMousedown(changes['dragEventTarget'].currentValue); } }; DraggableDirective.prototype.ngOnDestroy = function () { this._destroySubscription(); }; DraggableDirective.prototype.onMouseup = function (event) { if (!this.isDragging) return; this.isDragging = false; this.element.classList.remove('dragging'); if (this.subscription) { this._destroySubscription(); this.dragEnd.emit({ event: event, element: this.element, model: this.dragModel }); } }; DraggableDirective.prototype.onMousedown = function (event) { var _this = this; // we only want to drag the inner header text var isDragElm = event.target.classList.contains('draggable'); if (isDragElm && (this.dragX || this.dragY)) { event.preventDefault(); this.isDragging = true; var mouseDownPos_1 = { x: event.clientX, y: event.clientY }; var mouseup = fromEvent_1.fromEvent(document, 'mouseup'); this.subscription = mouseup .subscribe(function (ev) { return _this.onMouseup(ev); }); var mouseMoveSub = fromEvent_1.fromEvent(document, 'mousemove') .pipe(operators_1.takeUntil(mouseup)) .subscribe(function (ev) { return _this.move(ev, mouseDownPos_1); }); this.subscription.add(mouseMoveSub); this.dragStart.emit({ event: event, element: this.element, model: this.dragModel }); } }; DraggableDirective.prototype.move = function (event, mouseDownPos) { if (!this.isDragging) return; var x = event.clientX - mouseDownPos.x; var y = event.clientY - mouseDownPos.y; if (this.dragX) this.element.style.left = x + "px"; if (this.dragY) this.element.style.top = y + "px"; this.element.classList.add('dragging'); this.dragging.emit({ event: event, element: this.element, model: this.dragModel }); }; DraggableDirective.prototype._destroySubscription = function () { if (this.subscription) { this.subscription.unsubscribe(); this.subscription = undefined; } }; __decorate([ core_1.Input(), __metadata("design:type", Object) ], DraggableDirective.prototype, "dragEventTarget", void 0); __decorate([ core_1.Input(), __metadata("design:type", Object) ], DraggableDirective.prototype, "dragModel", void 0); __decorate([ core_1.Input(), __metadata("design:type", Boolean) ], DraggableDirective.prototype, "dragX", void 0); __decorate([ core_1.Input(), __metadata("design:type", Boolean) ], DraggableDirective.prototype, "dragY", void 0); __decorate([ core_1.Output(), __metadata("design:type", core_1.EventEmitter) ], DraggableDirective.prototype, "dragStart", void 0); __decorate([ core_1.Output(), __metadata("design:type", core_1.EventEmitter) ], DraggableDirective.prototype, "dragging", void 0); __decorate([ core_1.Output(), __metadata("design:type", core_1.EventEmitter) ], DraggableDirective.prototype, "dragEnd", void 0); DraggableDirective = __decorate([ core_1.Directive({ selector: '[draggable]' }), __metadata("design:paramtypes", [core_1.ElementRef]) ], DraggableDirective); return DraggableDirective; }()); exports.DraggableDirective = DraggableDirective; /***/ }), /***/ "./src/directives/index.ts": /***/ (function(module, exports, __webpack_require__) { "use strict"; function __export(m) { for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; } Object.defineProperty(exports, "__esModule", { value: true }); __export(__webpack_require__("./src/directives/draggable.directive.ts")); __export(__webpack_require__("./src/directives/long-press.directive.ts")); __export(__webpack_require__("./src/directives/orderable.directive.ts")); __export(__webpack_require__("./src/directives/resizeable.directive.ts")); __export(__webpack_require__("./src/directives/visibility.directive.ts")); /***/ }), /***/ "./src/directives/long-press.directive.ts": /***/ (function(module, exports, __webpack_require__) { "use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("@angular/core"); var operators_1 = __webpack_require__("rxjs/operators"); var fromEvent_1 = __webpack_require__("rxjs/observable/fromEvent"); var events_1 = __webpack_require__("./src/events.ts"); var LongPressDirective = /** @class */ (function () { function LongPressDirective() { this.pressEnabled = true; this.duration = 500; this.longPressStart = new core_1.EventEmitter(); this.longPressing = new core_1.EventEmitter(); this.longPressEnd = new core_1.EventEmitter(); this.mouseX = 0; this.mouseY = 0; } Object.defineProperty(LongPressDirective.prototype, "press", { get: function () { return this.pressing; }, enumerable: true, configurable: true }); Object.defineProperty(LongPressDirective.prototype, "isLongPress", { get: function () { return this.isLongPressing; }, enumerable: true, configurable: true }); LongPressDirective.prototype.onMouseDown = function (event) { var _this = this; // don't do right/middle clicks if (event.which !== 1 || !this.pressEnabled) return; // don't start drag if its on resize handle var target = event.target; if (target.classList.contains('resize-handle')) return; this.mouseX = event.clientX; this.mouseY = event.clientY; this.pressing = true; this.isLongPressing = false; var mouseup = fromEvent_1.fromEvent(document, 'mouseup'); this.subscription = mouseup.subscribe(function (ev) { return _this.onMouseup(); }); this.timeout = setTimeout(function () { _this.isLongPressing = true; _this.longPressStart.emit({ event: event, model: _this.pressModel }); _this.subscription.add(fromEvent_1.fromEvent(document, 'mousemove') .pipe(operators_1.takeUntil(mouseup)) .subscribe(function (mouseEvent) { return _this.onMouseMove(mouseEvent); })); _this.loop(event); }, this.duration); this.loop(event); }; LongPressDirective.prototype.onMouseMove = function (event) { if (this.pressing && !this.isLongPressing) { var xThres = Math.abs(event.clientX - this.mouseX) > 10; var yThres = Math.abs(event.clientY - this.mouseY) > 10; if (xThres || yThres) { this.endPress(); } } }; LongPressDirective.prototype.loop = function (event) { var _this = this; if (this.isLongPressing) { this.timeout = setTimeout(function () { _this.longPressing.emit({ event: event, model: _this.pressModel }); _this.loop(event); }, 50); } }; LongPressDirective.prototype.endPress = function () { clearTimeout(this.timeout); this.isLongPressing = false; this.pressing = false; this._destroySubscription(); this.longPressEnd.emit({ model: this.pressModel }); }; LongPressDirective.prototype.onMouseup = function () { this.endPress(); }; LongPressDirective.prototype.ngOnDestroy = function () { this._destroySubscription(); }; LongPressDirective.prototype._destroySubscription = function () { if (this.subscription) { this.subscription.unsubscribe(); this.subscription = undefined; } }; __decorate([ core_1.Input(), __metadata("design:type", Boolean) ], LongPressDirective.prototype, "pressEnabled", void 0); __decorate([ core_1.Input(), __metadata("design:type", Object) ], LongPressDirective.prototype, "pressModel", void 0); __decorate([ core_1.Input(), __metadata("design:type", Number) ], LongPressDirective.prototype, "duration", void 0); __decorate([ core_1.Output(), __metadata("design:type", core_1.EventEmitter) ], LongPressDirective.prototype, "longPressStart", void 0); __decorate([ core_1.Output(), __metadata("design:type", core_1.EventEmitter) ], LongPressDirective.prototype, "longPressing", void 0); __decorate([ core_1.Output(), __metadata("design:type", core_1.EventEmitter) ], LongPressDirective.prototype, "longPressEnd", void 0); __decorate([ core_1.HostBinding('class.press'), __metadata("design:type", Boolean), __metadata("design:paramtypes", []) ], LongPressDirective.prototype, "press", null); __decorate([ core_1.HostBinding('class.longpress'), __metadata("design:type", Boolean), __metadata("design:paramtypes", []) ], LongPressDirective.prototype, "isLongPress", null); __decorate([ core_1.HostListener('mousedown', ['$event']), __metadata("design:type", Function), __metadata("design:paramtypes", [Object]), __metadata("design:returntype", void 0) ], LongPressDirective.prototype, "onMouseDown", null); LongPressDirective = __decorate([ core_1.Directive({ selector: '[long-press]' }) ], LongPressDirective); return LongPressDirective; }()); exports.LongPressDirective = LongPressDirective; /***/ }), /***/ "./src/directives/orderable.directive.ts": /***/ (function(module, exports, __webpack_require__) { "use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var __param = (this && this.__param) || function (paramIndex, decorator) { return function (target, key) { decorator(target, key, paramIndex); } }; Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("@angular/core"); var draggable_directive_1 = __webpack_require__("./src/directives/draggable.directive.ts"); var platform_browser_1 = __webpack_require__("@angular/platform-browser"); var OrderableDirective = /** @class */ (function () { function OrderableDirective(differs, document) { this.document = document; this.reorder = new core_1.EventEmitter(); this.differ = differs.find({}).create(); } OrderableDirective.prototype.ngAfterContentInit = function () { // HACK: Investigate Better Way this.updateSubscriptions(); this.draggables.changes.subscribe(this.updateSubscriptions.bind(this)); }; OrderableDirective.prototype.ngOnDestroy = function () { this.draggables.forEach(function (d) { d.dragStart.unsubscribe(); d.dragEnd.unsubscribe(); }); }; OrderableDirective.prototype.updateSubscriptions = function () { var _this = this; var diffs = this.differ.diff(this.createMapDiffs()); if (diffs) { var subscribe = function (_a) { var currentValue = _a.currentValue, previousValue = _a.previousValue; unsubscribe_1({ previousValue: previousValue }); if (currentValue) { currentValue.dragStart.subscribe(_this.onDragStart.bind(_this)); currentValue.dragEnd.subscribe(_this.onDragEnd.bind(_this)); } }; var unsubscribe_1 = function (_a) { var previousValue = _a.previousValue; if (previousValue) { previousValue.dragStart.unsubscribe(); previousValue.dragEnd.unsubscribe(); } }; diffs.forEachAddedItem(subscribe.bind(this)); // diffs.forEachChangedItem(subscribe.bind(this)); diffs.forEachRemovedItem(unsubscribe_1.bind(this)); } }; OrderableDirective.prototype.onDragStart = function () { this.positions = {}; var i = 0; for (var _i = 0, _a = this.draggables.toArray(); _i < _a.length; _i++) { var dragger = _a[_i]; var elm = dragger.element; var left = parseInt(elm.offsetLeft.toString(), 0); this.positions[dragger.dragModel.prop] = { left: left, right: left + parseInt(elm.offsetWidth.toString(), 0), index: i++, element: elm }; } }; OrderableDirective.prototype.onDragEnd = function (_a) { var element = _a.element, model = _a.model, event = _a.event; var prevPos = this.positions[model.prop]; var target = this.isTarget(model, event); if (target) { this.reorder.emit({ prevIndex: prevPos.index, newIndex: target.i, model: model }); } element.style.left = 'auto'; }; OrderableDirective.prototype.isTarget = function (model, event) { var i = 0; var x = event.x || event.clientX; var y = event.y || event.clientY; var targets = this.document.elementsFromPoint(x, y); var _loop_1 = function (prop) { // current column position which throws event. var pos = this_1.positions[prop]; // since we drag the inner span, we need to find it in the elements at the cursor if (model.prop !== prop && targets.find(function (el) { return el === pos.element; })) { return { value: { pos: pos, i: i } }; } i++; }; var this_1 = this; for (var prop in this.positions) { var state_1 = _loop_1(prop); if (typeof state_1 === "object") return state_1.value; } }; OrderableDirective.prototype.createMapDiffs = function () { return this.draggables.toArray() .reduce(function (acc, curr) { acc[curr.dragModel.$$id] = curr; return acc; }, {}); }; __decorate([ core_1.Output(), __metadata("design:type", core_1.EventEmitter) ], OrderableDirective.prototype, "reorder", void 0); __decorate([ core_1.ContentChildren(draggable_directive_1.DraggableDirective, { descendants: true }), __metadata("design:type", core_1.QueryList) ], OrderableDirective.prototype, "draggables", void 0); OrderableDirective = __decorate([ core_1.Directive({ selector: '[orderable]' }), __param(1, core_1.Inject(platform_browser_1.DOCUMENT)), __metadata("design:paramtypes", [core_1.KeyValueDiffers, Object]) ], OrderableDirective); return OrderableDirective; }()); exports.OrderableDirective = OrderableDirective; /***/ }), /***/ "./src/directives/resizeable.directive.ts": /***/ (function(module, exports, __webpack_require__) { "use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("@angular/core"); var events_1 = __webpack_require__("./src/events.ts"); var operators_1 = __webpack_require__("rxjs/operators"); var fromEvent_1 = __webpack_require__("rxjs/observable/fromEvent"); var ResizeableDirective = /** @class */ (function () { function ResizeableDirective(element, renderer) { this.renderer = renderer; this.resizeEnabled = true; this.resize = new core_1.EventEmitter(); this.resizing = false; this.element = element.nativeElement; } ResizeableDirective.prototype.ngAfterViewInit = function () { var renderer2 = this.renderer; var node = renderer2.createElement('span'); if (this.resizeEnabled) { renderer2.addClass(node, 'resize-handle'); } else { renderer2.addClass(node, 'resize-handle--not-resizable'); } renderer2.appendChild(this.element, node); }; ResizeableDirective.prototype.ngOnDestroy = function () { this._destroySubscription(); }; ResizeableDirective.prototype.onMouseup = function () { this.resizing = false; if (this.subscription && !this.subscription.closed) { this._destroySubscription(); this.resize.emit(this.element.clientWidth); } }; ResizeableDirective.prototype.onMousedown = function (event) { var _this = this; var isHandle = (event.target).classList.contains('resize-handle'); var initialWidth = this.element.clientWidth; var mouseDownScreenX = event.screenX; if (isHandle) { event.stopPropagation(); this.resizing = true; var mouseup = fromEvent_1.fromEvent(document, 'mouseup'); this.subscription = mouseup .subscribe(function (ev) { return _this.onMouseup(); }); var mouseMoveSub = fromEvent_1.fromEvent(document, 'mousemove') .pipe(operators_1.takeUntil(mouseup)) .subscribe(function (e) { return _this.move(e, initialWidth, mouseDownScreenX); }); this.subscription.add(mouseMoveSub); } }; ResizeableDirective.prototype.move = function (event, initialWidth, mouseDownScreenX) { var movementX = event.screenX - mouseDownScreenX; var newWidth = initialWidth + movementX; var overMinWidth = !this.minWidth || newWidth >= this.minWidth; var underMaxWidth = !this.maxWidth || newWidth <= this.maxWidth; if (overMinWidth && underMaxWidth) { this.element.style.width = newWidth + "px"; } }; ResizeableDirective.prototype._destroySubscription = function () { if (this.subscription) { this.subscription.unsubscribe(); this.subscription = undefined; } }; __decorate([ core_1.Input(), __metadata("design:type", Boolean) ], ResizeableDirective.prototype, "resizeEnabled", void 0); __decorate([ core_1.Input(), __metadata("design:type", Number) ], ResizeableDirective.prototype, "minWidth", void 0); __decorate([ core_1.Input(), __metadata("design:type", Number) ], ResizeableDirective.prototype, "maxWidth", void 0); __decorate([ core_1.Output(), __metadata("design:type", core_1.EventEmitter) ], ResizeableDirective.prototype, "resize", void 0); __decorate([ core_1.HostListener('mousedown', ['$event']), __metadata("design:type", Function), __metadata("design:paramtypes", [Object]), __metadata("design:returntype", void 0) ], ResizeableDirective.prototype, "onMousedown", null); ResizeableDirective = __decorate([ core_1.Directive({ selector: '[resizeable]', host: { '[class.resizeable]': 'resizeEnabled' } }), __metadata("design:paramtypes", [core_1.ElementRef, core_1.Renderer2]) ], ResizeableDirective); return ResizeableDirective; }()); exports.ResizeableDirective = ResizeableDirective; /***/ }), /***/ "./src/directives/visibility.directive.ts": /***/ (function(module, exports, __webpack_require__) { "use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("@angular/core"); /** * Visibility Observer Directive * * Usage: * * <div * visibilityObserver * (visible)="onVisible($event)"> * </div> * */ var VisibilityDirective = /** @class */ (function () { function VisibilityDirective(element, zone) { this.element = element; this.zone = zone; this.isVisible = false; this.visible = new core_1.EventEmitter(); } VisibilityDirective.prototype.ngOnInit = function () { this.runCheck(); }; VisibilityDirective.prototype.ngOnDestroy = function () { clearTimeout(this.timeout); }; VisibilityDirective.prototype.onVisibilityChange = function () { var _this = this; // trigger zone recalc for columns this.zone.run(function () { _this.isVisible = true; _this.visible.emit(true); }); }; VisibilityDirective.prototype.runCheck = function () { var _this = this; var check = function () { // https://davidwalsh.name/offsetheight-visibility var _a = _this.element.nativeElement, offsetHeight = _a.offsetHeight, offsetWidth = _a.offsetWidth; if (offsetHeight && offsetWidth) { clearTimeout(_this.timeout); _this.onVisibilityChange(); } else { clearTimeout(_this.timeout); _this.zone.runOutsideAngular(function () { _this.timeout = setTimeout(function () { return check(); }, 50); }); } }; this.timeout = setTimeout(function () { return check(); }); }; __decorate([ core_1.HostBinding('class.visible'), __metadata("design:type", Boolean) ], VisibilityDirective.prototype, "isVisible", void 0); __decorate([ core_1.Output(), __metadata("design:type", core_1.EventEmitter) ], VisibilityDirective.prototype, "visible", void 0); VisibilityDirective = __decorate([ core_1.Directive({ selector: '[visibilityObserver]' }), __metadata("design:paramtypes", [core_1.ElementRef, core_1.NgZone]) ], VisibilityDirective); return VisibilityDirective; }()); exports.VisibilityDirective = VisibilityDirective; /***/ }), /***/ "./src/events.ts": /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(global) { Object.defineProperty(exports, "__esModule", { value: true }); /* tslint:disable:variable-name */ exports.MouseEvent = (window || global).MouseEvent; exports.KeyboardEvent = (window || global).KeyboardEvent; exports.Event = (window || global).Event; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__("./node_modules/webpack/buildin/global.js"))) /***/ }), /***/ "./src/index.ts": /***/ (function(module, exports, __webpack_require__) { "use strict"; function __export(m) { for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; } Object.defineProperty(exports, "__esModule", { value: true }); __export(__webpack_require__("./src/datatable.module.ts")); __export(__webpack_require__("./src/types/index.ts")); __export(__webpack_require__("./src/components/index.ts")); __export(__webpack_require__("./src/services/index.ts")); /***/ }), /***/ "./src/services/dimensions-helper.service.ts": /***/ (function(module, exports, __webpack_require__) { "use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("@angular/core"); /** * Gets the width of the scrollbar. Nesc for windows * http://stackoverflow.com/a/13382873/888165 */ var DimensionsHelper = /** @class */ (function () { function DimensionsHelper() { } DimensionsHelper.prototype.getDimensions = function (element) { return element.getBoundingClientRect(); }; DimensionsHelper = __decorate([ core_1.Injectable() ], DimensionsHelper); return DimensionsHelper; }()); exports.DimensionsHelper = DimensionsHelper; /***/ }), /***/ "./src/services/index.ts": /***/ (function(module, exports, __webpack_require__) { "use strict"; function __export(m) { for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; } Object.defineProperty(exports, "__esModule", { value: true }); __export(__webpack_require__("./src/services/scrollbar-helper.service.ts")); __export(__webpack_require__("./src/services/dimensions-helper.service.ts")); /***/ }), /***/ "./src/services/scrollbar-helper.service.ts": /***/ (function(module, exports, __webpack_require__) { "use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var __param = (this && this.__param) || function (paramIndex, decorator) { return function (target, key) { decorator(target, key, paramIndex); } }; Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("@angular/core"); var platform_browser_1 = __webpack_require__("@angular/platform-browser"); /** * Gets the width of the scrollbar. Nesc for windows * http://stackoverflow.com/a/13382873/888165 */ var ScrollbarHelper = /** @class */ (function () { function ScrollbarHelper(document) { this.document = document; this.width = this.getWidth(); } ScrollbarHelper.prototype.getWidth = function () { var outer = this.document.createElement('div'); outer.style.visibility = 'hidden'; outer.style.width = '100px'; outer.style.msOverflowStyle = 'scrollbar'; this.document.body.appendChild(outer); var widthNoScroll = outer.offsetWidth; outer.style.overflow = 'scroll'; var inner = this.document.createElement('div'); inner.style.width = '100%'; outer.appendChild(inner); var widthWithScroll = inner.offsetWidth; outer.parentNode.removeChild(outer); return widthNoScroll - widthWithScroll; }; ScrollbarHelper = __decorate([ core_1.Injectable(), __param(0, core_1.Inject(platform_browser_1.DOCUMENT)), __metadata("design:paramtypes", [Object]) ], ScrollbarHelper); return ScrollbarHelper; }()); exports.ScrollbarHelper = ScrollbarHelper; /***/ }), /***/ "./src/types/click.type.ts": /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var ClickType; (function (ClickType) { ClickType["single"] = "single"; ClickType["double"] = "double"; })(ClickType = exports.ClickType || (exports.ClickType = {})); /***/ }), /***/ "./src/types/column-mode.type.ts": /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var ColumnMode; (function (ColumnMode) { ColumnMode["standard"] = "standard"; ColumnMode["flex"] = "flex"; ColumnMode["force"] = "force"; })(ColumnMode = exports.ColumnMode || (exports.ColumnMode = {})); /***/ }), /***/ "./src/types/contextmenu.type.ts": /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var ContextmenuType; (function (ContextmenuType) { ContextmenuType["header"] = "header"; ContextmenuType["body"] = "body"; })(ContextmenuType = exports.ContextmenuType || (exports.ContextmenuType = {})); /***/ }), /***/ "./src/types/index.ts": /***/ (function(module, exports, __webpack_require__) { "use strict"; function __export(m) { for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; } Object.defineProperty(exports, "__esModule", { value: true }); __export(__webpack_require__("./src/types/column-mode.type.ts")); __export(__webpack_require__("./src/types/sort.type.ts")); __export(__webpack_require__("./src/types/sort-direction.type.ts")); __export(__webpack_require__("./src/types/selection.type.ts")); __export(__webpack_require__("./src/types/click.type.ts")); __export(__webpack_require__("./src/types/contextmenu.type.ts")); /***/ }), /***/ "./src/types/selection.type.ts": /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var SelectionType; (function (SelectionType) { SelectionType["single"] = "single"; SelectionType["multi"] = "multi"; SelectionType["multiClick"] = "multiClick"; SelectionType["cell"] = "cell"; SelectionType["checkbox"] = "checkbox"; })(SelectionType = exports.SelectionType || (exports.SelectionType = {})); /***/ }), /***/ "./src/types/sort-direction.type.ts": /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var SortDirection; (function (SortDirection) { SortDirection["asc"] = "asc"; SortDirection["desc"] = "desc"; })(SortDirection = exports.SortDirection || (exports.SortDirection = {})); /***/ }), /***/ "./src/types/sort.type.ts": /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var SortType; (function (SortType) { SortType["single"] = "single"; SortType["multi"] = "multi"; })(SortType = exports.SortType || (exports.SortType = {})); /***/ }), /***/ "./src/utils/camel-case.ts": /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); /** * Converts strings from something to camel case * http://stackoverflow.com/questions/10425287/convert-dash-separated-string-to-camelcase */ function camelCase(str) { // Replace special characters with a space str = str.replace(/[^a-zA-Z0-9 ]/g, ' '); // put a space before an uppercase letter str = str.replace(/([a-z](?=[A-Z]))/g, '$1 '); // Lower case first character and some other stuff str = str.replace(/([^a-zA-Z0-9 ])|^[0-9]+/g, '').trim().toLowerCase(); // uppercase characters preceded by a space or number str = str.replace(/([ 0-9]+)([a-zA-Z])/g, function (a, b, c) { return b.trim() + c.toUpperCase(); }); return str; } exports.camelCase = camelCase; /** * Converts strings from camel case to words * http://stackoverflow.com/questions/7225407/convert-camelcasetext-to-camel-case-text */ function deCamelCase(str) { return str .replace(/([A-Z])/g, function (match) { return " " + match; }) .replace(/^./, function (match) { return match.toUpperCase(); }); } exports.deCamelCase = deCamelCase; /***/ }), /***/ "./src/utils/column-helper.ts": /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var camel_case_1 = __webpack_require__("./src/utils/camel-case.ts"); var id_1 = __webpack_require__("./src/utils/id.ts"); var column_prop_getters_1 = __webpack_require__("./src/utils/column-prop-getters.ts"); /** * Sets the column defaults */ function setColumnDefaults(columns) { if (!columns) return; for (var _i = 0, columns_1 = columns; _i < columns_1.length; _i++) { var column = columns_1[_i]; if (!column.$$id) { column.$$id = id_1.id(); } // prop can be numeric; zero is valid not a missing prop // translate name => prop if (isNullOrUndefined(column.prop) && column.name) { column.prop = camel_case_1.camelCase(column.name); } if (!column.$$valueGetter) { column.$$valueGetter = column_prop_getters_1.getterForProp(column.prop); } // format props if no name passed if (!isNullOrUndefined(column.prop) && isNullOrUndefined(column.name)) { column.name = camel_case_1.deCamelCase(String(column.prop)); } if (isNullOrUndefined(column.prop) && isNullOrUndefined(column.name)) { column.name = ''; // Fixes IE and Edge displaying `null` } if (!column.hasOwnProperty('resizeable')) { column.resizeable = true; } if (!column.hasOwnProperty('sortable')) { column.sortable = true; } if (!column.hasOwnProperty('draggable')) { column.draggable = true; } if (!column.hasOwnProperty('canAutoResize')) { column.canAutoResize = true; } if (!column.hasOwnProperty('width')) { column.width = 150; } } } exports.setColumnDefaults = setColumnDefaults; function isNullOrUndefined(value) { return value === null || value === undefined; } exports.isNullOrUndefined = isNullOrUndefined; /** * Translates templates definitions to objects */ function translateTemplates(templates) { var result = []; for (var _i = 0, templates_1 = templates; _i < templates_1.length; _i++) { var temp = templates_1[_i]; var col = {}; var props = Object.getOwnPropertyNames(temp); for (var _a = 0, props_1 = props; _a < props_1.length; _a++) { var prop = props_1[_a]; col[prop] = temp[prop]; } if (temp.headerTemplate) { col.headerTemplate = temp.headerTemplate; } if (temp.cellTemplate) { col.cellTemplate = temp.cellTemplate; } if (temp.summaryFunc) { col.summaryFunc = temp.summaryFunc; } if (temp.summaryTemplate) { col.summaryTemplate = temp.summaryTemplate; } result.push(col); } return result; } exports.translateTemplates = translateTemplates; /***/ }), /***/ "./src/utils/column-prop-getters.ts": /***/ (function(module, exports, __webpack_require__) { "use strict"; // maybe rename this file to prop-getters.ts Object.defineProperty(exports, "__esModule", { value: true }); /** * Always returns the empty string '' * @returns {string} */ function emptyStringGetter() { return ''; } exports.emptyStringGetter = emptyStringGetter; /** * Returns the appropriate getter function for this kind of prop. * If prop == null, returns the emptyStringGetter. */ function getterForProp(prop) { if (prop == null) return emptyStringGetter; if (typeof prop === 'number') { return numericIndexGetter; } else { // deep or simple if (prop.indexOf('.') !== -1) { return deepValueGetter; } else { return shallowValueGetter; } } } exports.getterForProp = getterForProp; /** * Returns the value at this numeric index. * @param row array of values * @param index numeric index * @returns {any} or '' if invalid index */ function numericIndexGetter(row, index) { if (row == null) return ''; // mimic behavior of deepValueGetter if (!row || index == null) return row; var value = row[index]; if (value == null) return ''; return value; } exports.numericIndexGetter = numericIndexGetter; /** * Returns the value of a field. * (more efficient than deepValueGetter) * @param obj object containing the field * @param fieldName field name string * @returns {any} */ function shallowValueGetter(obj, fieldName) { if (obj == null) return ''; if (!obj || !fieldName) return obj; var value = obj[fieldName]; if (value == null) return ''; return value; } exports.shallowValueGetter = shallowValueGetter; /** * Returns a deep object given a string. zoo['animal.type'] * @param {object} obj * @param {string} path */ function deepValueGetter(obj, path) { if (obj == null) return ''; if (!obj || !path) return obj; // check if path matches a root-level field // { "a.b.c": 123 } var current = obj[path]; if (current !== undefined) return current; current = obj; var split = path.split('.'); if (split.length) { for (var i = 0; i < split.length; i++) { current = current[split[i]]; // if found undefined, return empty string if (current === undefined || current === null) return ''; } } return current; } exports.deepValueGetter = deepValueGetter; /***/ }), /***/ "./src/utils/column.ts": /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); /** * Returns the columns by pin. */ function columnsByPin(cols) { var ret = { left: [], center: [], right: [] }; if (cols) { for (var _i = 0, cols_1 = cols; _i < cols_1.length; _i++) { var col = cols_1[_i]; if (col.frozenLeft) { ret.left.push(col); } else if (col.frozenRight) { ret.right.push(col); } else { ret.center.push(col); } } } return ret; } exports.columnsByPin = columnsByPin; /** * Returns the widths of all group sets of a column */ function columnGroupWidths(groups, all) { return { left: columnTotalWidth(groups.left), center: columnTotalWidth(groups.center), right: columnTotalWidth(groups.right), total: Math.floor(columnTotalWidth(all)) }; } exports.columnGroupWidths = columnGroupWidths; /** * Calculates the total width of all columns and their groups */ function columnTotalWidth(columns, prop) { var totalWidth = 0; if (columns) { for (var _i = 0, columns_1 = columns; _i < columns_1.length; _i++) { var c = columns_1[_i]; var has = prop && c[prop]; var width = has ? c[prop] : c.width; totalWidth = totalWidth + parseFloat(width); } } return totalWidth; } exports.columnTotalWidth = columnTotalWidth; /** * Calculates the total width of all columns and their groups */ function columnsTotalWidth(columns, prop) { var totalWidth = 0; for (var _i = 0, columns_2 = columns; _i < columns_2.length; _i++) { var column = columns_2[_i]; var has = prop && column[prop]; totalWidth = totalWidth + (has ? column[prop] : column.width); } return totalWidth; } exports.columnsTotalWidth = columnsTotalWidth; function columnsByPinArr(val) { var colsByPinArr = []; var colsByPin = columnsByPin(val); colsByPinArr.push({ type: 'left', columns: colsByPin['left'] }); colsByPinArr.push({ type: 'center', columns: colsByPin['center'] }); colsByPinArr.push({ type: 'right', columns: colsByPin['right'] }); return colsByPinArr; } exports.columnsByPinArr = columnsByPinArr; /***/ }), /***/ "./src/utils/elm-from-point.ts": /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); if (typeof document !== 'undefined' && !document.elementsFromPoint) { document.elementsFromPoint = elementsFromPoint; } /*tslint:disable*/ /** * Polyfill for `elementsFromPoint` * * https://developer.mozilla.org/en-US/docs/Web/API/Document/elementsFromPoint * https://gist.github.com/iddan/54d5d9e58311b0495a91bf06de661380 * https://gist.github.com/oslego/7265412 */ function elementsFromPoint(x, y) { var elements = []; var previousPointerEvents = []; var current; // TODO: window.getComputedStyle should be used with inferred type (Element) var i; var d; //if (document === undefined) return elements; // get all elements via elementFromPoint, and remove them from hit-testing in order while ((current = document.elementFromPoint(x, y)) && elements.indexOf(current) === -1 && current != null) { // push the element and its current style elements.push(current); previousPointerEvents.push({ value: current.style.getPropertyValue('pointer-events'), priority: current.style.getPropertyPriority('pointer-events') }); // add "pointer-events: none", to get to the underlying element current.style.setProperty('pointer-events', 'none', 'important'); } // restore the previous pointer-events values for (i = previousPointerEvents.length; d = previousPointerEvents[--i];) { elements[i].style.setProperty('pointer-events', d.value ? d.value : '', d.priority); } // return our results return elements; } exports.elementsFromPoint = elementsFromPoint; /*tslint:enable*/ /***/ }), /***/ "./src/utils/id.ts": /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); /** * Creates a unique object id. * http://stackoverflow.com/questions/6248666/how-to-generate-short-uid-like-ax4j9z-in-js */ function id() { return ('0000' + (Math.random() * Math.pow(36, 4) << 0).toString(36)).slice(-4); } exports.id = id; /***/ }), /***/ "./src/utils/index.ts": /***/ (function(module, exports, __webpack_require__) { "use strict"; function __export(m) { for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; } Object.defineProperty(exports, "__esModule", { value: true }); __export(__webpack_require__("./src/utils/id.ts")); __export(__webpack_require__("./src/utils/column.ts")); __export(__webpack_require__("./src/utils/column-prop-getters.ts")); __export(__webpack_require__("./src/utils/camel-case.ts")); __export(__webpack_require__("./src/utils/keys.ts")); __export(__webpack_require__("./src/utils/math.ts")); __export(__webpack_require__("./src/utils/prefixes.ts")); __export(__webpack_require__("./src/utils/selection.ts")); __export(__webpack_require__("./src/utils/translate.ts")); __export(__webpack_require__("./src/utils/throttle.ts")); __export(__webpack_require__("./src/utils/sort.ts")); __export(__webpack_require__("./src/utils/row-height-cache.ts")); __export(__webpack_require__("./src/utils/column-helper.ts")); __export(__webpack_require__("./src/utils/elm-from-point.ts")); /***/ }), /***/ "./src/utils/keys.ts": /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var Keys; (function (Keys) { Keys[Keys["up"] = 38] = "up"; Keys[Keys["down"] = 40] = "down"; Keys[Keys["return"] = 13] = "return"; Keys[Keys["escape"] = 27] = "escape"; Keys[Keys["left"] = 37] = "left"; Keys[Keys["right"] = 39] = "right"; })(Keys = exports.Keys || (exports.Keys = {})); /***/ }), /***/ "./src/utils/math.ts": /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var column_1 = __webpack_require__("./src/utils/column.ts"); /** * Calculates the Total Flex Grow */ function getTotalFlexGrow(columns) { var totalFlexGrow = 0; for (var _i = 0, columns_1 = columns; _i < columns_1.length; _i++) { var c = columns_1[_i]; totalFlexGrow += c.flexGrow || 0; } return totalFlexGrow; } exports.getTotalFlexGrow = getTotalFlexGrow; /** * Adjusts the column widths. * Inspired by: https://github.com/facebook/fixed-data-table/blob/master/src/FixedDataTableWidthHelper.js */ function adjustColumnWidths(allColumns, expectedWidth) { var columnsWidth = column_1.columnsTotalWidth(allColumns); var totalFlexGrow = getTotalFlexGrow(allColumns); var colsByGroup = column_1.columnsByPin(allColumns); if (columnsWidth !== expectedWidth) { scaleColumns(colsByGroup, expectedWidth, totalFlexGrow); } } exports.adjustColumnWidths = adjustColumnWidths; /** * Resizes columns based on the flexGrow property, while respecting manually set widths */ function scaleColumns(colsByGroup, maxWidth, totalFlexGrow) { // calculate total width and flexgrow points for coulumns that can be resized for (var attr in colsByGroup) { for (var _i = 0, _a = colsByGroup[attr]; _i < _a.length; _i++) { var column = _a[_i]; if (!column.canAutoResize) { maxWidth -= column.width; totalFlexGrow -= column.flexGrow ? column.flexGrow : 0; } else { column.width = 0; } } } var hasMinWidth = {}; var remainingWidth = maxWidth; // resize columns until no width is left to be distributed do { var widthPerFlexPoint = remainingWidth / totalFlexGrow; remainingWidth = 0; for (var attr in colsByGroup) { for (var _b = 0, _c = colsByGroup[attr]; _b < _c.length; _b++) { var column = _c[_b]; // if the column can be resize and it hasn't reached its minimum width yet if (column.canAutoResize && !hasMinWidth[column.prop]) { var newWidth = column.width + column.flexGrow * widthPerFlexPoint; if (column.minWidth !== undefined && newWidth < column.minWidth) { remainingWidth += newWidth - column.minWidth; column.width = column.minWidth; hasMinWidth[column.prop] = true; } else { column.width = newWidth; } } } } } while (remainingWidth !== 0); } /** * Forces the width of the columns to * distribute equally but overflowing when necessary * * Rules: * * - If combined withs are less than the total width of the grid, * proportion the widths given the min / max / normal widths to fill the width. * * - If the combined widths, exceed the total width of the grid, * use the standard widths. * * - If a column is resized, it should always use that width * * - The proportional widths should never fall below min size if specified. * * - If the grid starts off small but then becomes greater than the size ( + / - ) * the width should use the original width; not the newly proportioned widths. */ function forceFillColumnWidths(allColumns, expectedWidth, startIdx, allowBleed, defaultColWidth) { if (defaultColWidth === void 0) { defaultColWidth = 300; } var columnsToResize = allColumns .slice(startIdx + 1, allColumns.length) .filter(function (c) { return c.canAutoResize !== false; }); for (var _i = 0, columnsToResize_1 = columnsToResize; _i < columnsToResize_1.length; _i++) { var column = columnsToResize_1[_i]; if (!column.$$oldWidth) { column.$$oldWidth = column.width; } } var additionWidthPerColumn = 0; var exceedsWindow = false; var contentWidth = getContentWidth(allColumns, defaultColWidth); var remainingWidth = expectedWidth - contentWidth; var columnsProcessed = []; // This loop takes care of the do { additionWidthPerColumn = remainingWidth / columnsToResize.length; exceedsWindow = contentWidth >= expectedWidth; for (var _a = 0, columnsToResize_2 = columnsToResize; _a < columnsToResize_2.length; _a++) { var column = columnsToResize_2[_a]; if (exceedsWindow && allowBleed) { column.width = column.$$oldWidth || column.width || defaultColWidth; } else { var newSize = (column.width || defaultColWidth) + additionWidthPerColumn; if (column.minWidth && newSize < column.minWidth) { column.width = column.minWidth; columnsProcessed.push(column); } else if (column.maxWidth && newSize > column.maxWidth) { column.width = column.maxWidth; columnsProcessed.push(column); } else { column.width = newSize; } } column.width = Math.max(0, column.width); } contentWidth = getContentWidth(allColumns); remainingWidth = expectedWidth - contentWidth; removeProcessedColumns(columnsToResize, columnsProcessed); } while (remainingWidth > 0 && columnsToResize.length !== 0); } exports.forceFillColumnWidths = forceFillColumnWidths; /** * Remove the processed columns from the current active columns. */ function removeProcessedColumns(columnsToResize, columnsProcessed) { for (var _i = 0, columnsProcessed_1 = columnsProcessed; _i < columnsProcessed_1.length; _i++) { var column = columnsProcessed_1[_i]; var index = columnsToResize.indexOf(column); columnsToResize.splice(index, 1); } } /** * Gets the width of the columns */ function getContentWidth(allColumns, defaultColWidth) { if (defaultColWidth === void 0) { defaultColWidth = 300; } var contentWidth = 0; for (var _i = 0, allColumns_1 = allColumns; _i < allColumns_1.length; _i++) { var column = allColumns_1[_i]; contentWidth += (column.width || defaultColWidth); } return contentWidth; } /***/ }), /***/ "./src/utils/prefixes.ts": /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var camel_case_1 = __webpack_require__("./src/utils/camel-case.ts"); var cache = {}; var testStyle = typeof document !== 'undefined' ? document.createElement('div').style : undefined; // Get Prefix // http://davidwalsh.name/vendor-prefix var prefix = function () { var styles = typeof window !== 'undefined' ? window.getComputedStyle(document.documentElement, '') : undefined; var match = typeof styles !== 'undefined' ? Array.prototype.slice.call(styles).join('').match(/-(moz|webkit|ms)-/) : null; var pre = match !== null ? match[1] : undefined; var dom = typeof pre !== 'undefined' ? ('WebKit|Moz|MS|O').match(new RegExp('(' + pre + ')', 'i'))[1] : undefined; return dom ? { dom: dom, lowercase: pre, css: "-" + pre + "-", js: pre[0].toUpperCase() + pre.substr(1) } : undefined; }(); function getVendorPrefixedName(property) { var name = camel_case_1.camelCase(property); if (!cache[name]) { if (prefix !== undefined && testStyle[prefix.css + property] !== undefined) { cache[name] = prefix.css + property; } else if (testStyle[property] !== undefined) { cache[name] = property; } } return cache[name]; } exports.getVendorPrefixedName = getVendorPrefixedName; /***/ }), /***/ "./src/utils/row-height-cache.ts": /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); /** * This object contains the cache of the various row heights that are present inside * the data table. Its based on Fenwick tree data structure that helps with * querying sums that have time complexity of log n. * * Fenwick Tree Credits: http://petr-mitrichev.blogspot.com/2013/05/fenwick-tree-range-updates.html * https://github.com/mikolalysenko/fenwick-tree * */ var RowHeightCache = /** @class */ (function () { function RowHeightCache() { /** * Tree Array stores the cumulative information of the row heights to perform efficient * range queries and updates. Currently the tree is initialized to the base row * height instead of the detail row height. */ this.treeArray = []; } /** * Clear the Tree array. */ RowHeightCache.prototype.clearCache = function () { this.treeArray = []; }; /** * Initialize the Fenwick tree with row Heights. * * @param rows The array of rows which contain the expanded status. * @param rowHeight The row height. * @param detailRowHeight The detail row height. */ RowHeightCache.prototype.initCache = function (details) { var rows = details.rows, rowHeight = details.rowHeight, detailRowHeight = details.detailRowHeight, externalVirtual = details.externalVirtual, rowCount = details.rowCount, rowIndexes = details.rowIndexes, rowExpansions = details.rowExpansions; var isFn = typeof rowHeight === 'function'; var isDetailFn = typeof detailRowHeight === 'function'; if (!isFn && isNaN(rowHeight)) { throw new Error("Row Height cache initialization failed. Please ensure that 'rowHeight' is a\n valid number or function value: (" + rowHeight + ") when 'scrollbarV' is enabled."); } // Add this additional guard in case detailRowHeight is set to 'auto' as it wont work. if (!isDetailFn && isNaN(detailRowHeight)) { throw new Error("Row Height cache initialization failed. Please ensure that 'detailRowHeight' is a\n valid number or function value: (" + detailRowHeight + ") when 'scrollbarV' is enabled."); } var n = externalVirtual ? rowCount : rows.length; this.treeArray = new Array(n); for (var i = 0; i < n; ++i) { this.treeArray[i] = 0; } for (var i = 0; i < n; ++i) { var row = rows[i]; var currentRowHeight = rowHeight; if (isFn) { currentRowHeight = rowHeight(row); } // Add the detail row height to the already expanded rows. // This is useful for the table that goes through a filter or sort. var expanded = rowExpansions.get(row); if (row && expanded === 1) { if (isDetailFn) { var index = rowIndexes.get(row); currentRowHeight += detailRowHeight(row, index); } else { currentRowHeight += detailRowHeight; } } this.update(i, currentRowHeight); } }; /** * Given the ScrollY position i.e. sum, provide the rowIndex * that is present in the current view port. Below handles edge cases. */ RowHeightCache.prototype.getRowIndex = function (scrollY) { if (scrollY === 0) return 0; return this.calcRowIndex(scrollY); }; /** * When a row is expanded or rowHeight is changed, update the height. This can * be utilized in future when Angular Data table supports dynamic row heights. */ RowHeightCache.prototype.update = function (atRowIndex, byRowHeight) { if (!this.treeArray.length) { throw new Error("Update at index " + atRowIndex + " with value " + byRowHeight + " failed:\n Row Height cache not initialized."); } var n = this.treeArray.length; atRowIndex |= 0; while (atRowIndex < n) { this.treeArray[atRowIndex] += byRowHeight; atRowIndex |= (atRowIndex + 1); } }; /** * Range Sum query from 1 to the rowIndex */ RowHeightCache.prototype.query = function (atIndex) { if (!this.treeArray.length) { throw new Error("query at index " + atIndex + " failed: Fenwick tree array not initialized."); } var sum = 0; atIndex |= 0; while (atIndex >= 0) { sum += this.treeArray[atIndex]; atIndex = (atIndex & (atIndex + 1)) - 1; } return sum; }; /** * Find the total height between 2 row indexes */ RowHeightCache.prototype.queryBetween = function (atIndexA, atIndexB) { return this.query(atIndexB) - this.query(atIndexA - 1); }; /** * Given the ScrollY position i.e. sum, provide the rowIndex * that is present in the current view port. */ RowHeightCache.prototype.calcRowIndex = function (sum) { if (!this.treeArray.length) return 0; var pos = -1; var dataLength = this.treeArray.length; // Get the highest bit for the block size. var highestBit = Math.pow(2, dataLength.toString(2).length - 1); for (var blockSize = highestBit; blockSize !== 0; blockSize >>= 1) { var nextPos = pos + blockSize; if (nextPos < dataLength && sum >= this.treeArray[nextPos]) { sum -= this.treeArray[nextPos]; pos = nextPos; } } return pos + 1; }; return RowHeightCache; }()); exports.RowHeightCache = RowHeightCache; /***/ }), /***/ "./src/utils/selection.ts": /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); function selectRows(selected, row, comparefn) { var selectedIndex = comparefn(row, selected); if (selectedIndex > -1) { selected.splice(selectedIndex, 1); } else { selected.push(row); } return selected; } exports.selectRows = selectRows; function selectRowsBetween(selected, rows, index, prevIndex, comparefn) { var reverse = index < prevIndex; for (var i = 0; i < rows.length; i++) { var row = rows[i]; var greater = i >= prevIndex && i <= index; var lesser = i <= prevIndex && i >= index; var range = { start: 0, end: 0 }; if (reverse) { range = { start: index, end: prevIndex }; } else { range = { start: prevIndex, end: index + 1 }; } if ((reverse && lesser) || (!reverse && greater)) { // if in the positive range to be added to `selected`, and // not already in the selected array, add it if (i >= range.start && i <= range.end) { selected.push(row); } } } return selected; } exports.selectRowsBetween = selectRowsBetween; /***/ }), /***/ "./src/utils/sort.ts": /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var types_1 = __webpack_require__("./src/types/index.ts"); var column_prop_getters_1 = __webpack_require__("./src/utils/column-prop-getters.ts"); /** * Gets the next sort direction */ function nextSortDir(sortType, current) { if (sortType === types_1.SortType.single) { if (current === types_1.SortDirection.asc) { return types_1.SortDirection.desc; } else { return types_1.SortDirection.asc; } } else { if (!current) { return types_1.SortDirection.asc; } else if (current === types_1.SortDirection.asc) { return types_1.SortDirection.desc; } else if (current === types_1.SortDirection.desc) { return undefined; } // avoid TS7030: Not all code paths return a value. return undefined; } } exports.nextSortDir = nextSortDir; /** * Adapted from fueld-ui on 6/216 * https://github.com/FuelInteractive/fuel-ui/tree/master/src/pipes/OrderBy */ function orderByComparator(a, b) { if (a === null || typeof a === 'undefined') a = 0; if (b === null || typeof b === 'undefined') b = 0; if (a instanceof Date && b instanceof Date) { if (a < b) return -1; if (a > b) return 1; } else if ((isNaN(parseFloat(a)) || !isFinite(a)) || (isNaN(parseFloat(b)) || !isFinite(b))) { // Convert to string in case of a=0 or b=0 a = String(a); b = String(b); // Isn't a number so lowercase the string to properly compare if (a.toLowerCase() < b.toLowerCase()) return -1; if (a.toLowerCase() > b.toLowerCase()) return 1; } else { // Parse strings as numbers to compare properly if (parseFloat(a) < parseFloat(b)) return -1; if (parseFloat(a) > parseFloat(b)) return 1; } // equal each other return 0; } exports.orderByComparator = orderByComparator; /** * creates a shallow copy of the `rows` input and returns the sorted copy. this function * does not sort the `rows` argument in place */ function sortRows(rows, columns, dirs) { if (!rows) return []; if (!dirs || !dirs.length || !columns) return rows.slice(); /** * record the row ordering of results from prior sort operations (if applicable) * this is necessary to guarantee stable sorting behavior */ var rowToIndexMap = new Map(); rows.forEach(function (row, index) { return rowToIndexMap.set(row, index); }); var temp = rows.slice(); var cols = columns.reduce(function (obj, col) { if (col.comparator && typeof col.comparator === 'function') { obj[col.prop] = col.comparator; } return obj; }, {}); // cache valueGetter and compareFn so that they // do not need to be looked-up in the sort function body var cachedDirs = dirs.map(function (dir) { var prop = dir.prop; return { prop: prop, dir: dir.dir, valueGetter: column_prop_getters_1.getterForProp(prop), compareFn: cols[prop] || orderByComparator }; }); return temp.sort(function (rowA, rowB) { for (var _i = 0, cachedDirs_1 = cachedDirs; _i < cachedDirs_1.length; _i++) { var cachedDir = cachedDirs_1[_i]; // Get property and valuegetters for column to be sorted var prop = cachedDir.prop, valueGetter = cachedDir.valueGetter; // Get A and B cell values from rows based on properties of the columns var propA = valueGetter(rowA, prop); var propB = valueGetter(rowB, prop); // Compare function gets five parameters: // Two cell values to be compared as propA and propB // Two rows corresponding to the cells as rowA and rowB // Direction of the sort for this column as SortDirection // Compare can be a standard JS comparison function (a,b) => -1|0|1 // as additional parameters are silently ignored. The whole row and sort // direction enable more complex sort logic. var comparison = cachedDir.dir !== types_1.SortDirection.desc ? cachedDir.compareFn(propA, propB, rowA, rowB, cachedDir.dir) : -cachedDir.compareFn(propA, propB, rowA, rowB, cachedDir.dir); // Don't return 0 yet in case of needing to sort by next property if (comparison !== 0) return comparison; } if (!(rowToIndexMap.has(rowA) && rowToIndexMap.has(rowB))) return 0; /** * all else being equal, preserve original order of the rows (stable sort) */ return rowToIndexMap.get(rowA) < rowToIndexMap.get(rowB) ? -1 : 1; }); } exports.sortRows = sortRows; /***/ }), /***/ "./src/utils/throttle.ts": /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); /** * Throttle a function */ function throttle(func, wait, options) { options = options || {}; var context; var args; var result; var timeout = null; var previous = 0; function later() { previous = options.leading === false ? 0 : +new Date(); timeout = null; result = func.apply(context, args); } return function () { var now = +new Date(); if (!previous && options.leading === false) { previous = now; } var remaining = wait - (now - previous); context = this; args = arguments; if (remaining <= 0) { clearTimeout(timeout); timeout = null; previous = now; result = func.apply(context, args); } else if (!timeout && options.trailing !== false) { timeout = setTimeout(later, remaining); } return result; }; } exports.throttle = throttle; /** * Throttle decorator * * class MyClass { * throttleable(10) * myFn() { ... } * } */ function throttleable(duration, options) { return function innerDecorator(target, key, descriptor) { return { configurable: true, enumerable: descriptor.enumerable, get: function getter() { Object.defineProperty(this, key, { configurable: true, enumerable: descriptor.enumerable, value: throttle(descriptor.value, duration, options) }); return this[key]; } }; }; } exports.throttleable = throttleable; /***/ }), /***/ "./src/utils/translate.ts": /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var prefixes_1 = __webpack_require__("./src/utils/prefixes.ts"); var camel_case_1 = __webpack_require__("./src/utils/camel-case.ts"); // browser detection and prefixing tools var transform = typeof window !== 'undefined' ? prefixes_1.getVendorPrefixedName('transform') : undefined; var backfaceVisibility = typeof window !== 'undefined' ? prefixes_1.getVendorPrefixedName('backfaceVisibility') : undefined; var hasCSSTransforms = typeof window !== 'undefined' ? !!prefixes_1.getVendorPrefixedName('transform') : undefined; var hasCSS3DTransforms = typeof window !== 'undefined' ? !!prefixes_1.getVendorPrefixedName('perspective') : undefined; var ua = typeof window !== 'undefined' ? window.navigator.userAgent : 'Chrome'; var isSafari = (/Safari\//).test(ua) && !(/Chrome\//).test(ua); function translateXY(styles, x, y) { if (typeof transform !== 'undefined' && hasCSSTransforms) { if (!isSafari && hasCSS3DTransforms) { styles[transform] = "translate3d(" + x + "px, " + y + "px, 0)"; styles[backfaceVisibility] = 'hidden'; } else { styles[camel_case_1.camelCase(transform)] = "translate(" + x + "px, " + y + "px)"; } } else { styles.top = y + "px"; styles.left = x + "px"; } } exports.translateXY = translateXY; /***/ }), /***/ "@angular/common": /***/ (function(module, exports) { module.exports = __WEBPACK_EXTERNAL_MODULE__angular_common__; /***/ }), /***/ "@angular/core": /***/ (function(module, exports) { module.exports = __WEBPACK_EXTERNAL_MODULE__angular_core__; /***/ }), /***/ "@angular/platform-browser": /***/ (function(module, exports) { module.exports = __WEBPACK_EXTERNAL_MODULE__angular_platform_browser__; /***/ }), /***/ "rxjs/BehaviorSubject": /***/ (function(module, exports) { module.exports = __WEBPACK_EXTERNAL_MODULE_rxjs_BehaviorSubject__; /***/ }), /***/ "rxjs/observable/fromEvent": /***/ (function(module, exports) { module.exports = __WEBPACK_EXTERNAL_MODULE_rxjs_observable_fromEvent__; /***/ }), /***/ "rxjs/operators": /***/ (function(module, exports) { module.exports = __WEBPACK_EXTERNAL_MODULE_rxjs_operators__; /***/ }) /******/ }); }); //# sourceMappingURL=index.map /***/ }), /***/ "./node_modules/base64-js/index.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.byteLength = byteLength exports.toByteArray = toByteArray exports.fromByteArray = fromByteArray var lookup = [] var revLookup = [] var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' for (var i = 0, len = code.length; i < len; ++i) { lookup[i] = code[i] revLookup[code.charCodeAt(i)] = i } // Support decoding URL-safe base64 strings, as Node.js does. // See: https://en.wikipedia.org/wiki/Base64#URL_applications revLookup['-'.charCodeAt(0)] = 62 revLookup['_'.charCodeAt(0)] = 63 function getLens (b64) { var len = b64.length if (len % 4 > 0) { throw new Error('Invalid string. Length must be a multiple of 4') } // Trim off extra bytes after placeholder bytes are found // See: https://github.com/beatgammit/base64-js/issues/42 var validLen = b64.indexOf('=') if (validLen === -1) validLen = len var placeHoldersLen = validLen === len ? 0 : 4 - (validLen % 4) return [validLen, placeHoldersLen] } // base64 is 4/3 + up to two characters of the original data function byteLength (b64) { var lens = getLens(b64) var validLen = lens[0] var placeHoldersLen = lens[1] return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen } function _byteLength (b64, validLen, placeHoldersLen) { return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen } function toByteArray (b64) { var tmp var lens = getLens(b64) var validLen = lens[0] var placeHoldersLen = lens[1] var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen)) var curByte = 0 // if there are placeholders, only get up to the last complete 4 chars var len = placeHoldersLen > 0 ? validLen - 4 : validLen for (var i = 0; i < len; i += 4) { tmp = (revLookup[b64.charCodeAt(i)] << 18) | (revLookup[b64.charCodeAt(i + 1)] << 12) | (revLookup[b64.charCodeAt(i + 2)] << 6) | revLookup[b64.charCodeAt(i + 3)] arr[curByte++] = (tmp >> 16) & 0xFF arr[curByte++] = (tmp >> 8) & 0xFF arr[curByte++] = tmp & 0xFF } if (placeHoldersLen === 2) { tmp = (revLookup[b64.charCodeAt(i)] << 2) | (revLookup[b64.charCodeAt(i + 1)] >> 4) arr[curByte++] = tmp & 0xFF } if (placeHoldersLen === 1) { tmp = (revLookup[b64.charCodeAt(i)] << 10) | (revLookup[b64.charCodeAt(i + 1)] << 4) | (revLookup[b64.charCodeAt(i + 2)] >> 2) arr[curByte++] = (tmp >> 8) & 0xFF arr[curByte++] = tmp & 0xFF } return arr } function tripletToBase64 (num) { return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F] } function encodeChunk (uint8, start, end) { var tmp var output = [] for (var i = start; i < end; i += 3) { tmp = ((uint8[i] << 16) & 0xFF0000) + ((uint8[i + 1] << 8) & 0xFF00) + (uint8[i + 2] & 0xFF) output.push(tripletToBase64(tmp)) } return output.join('') } function fromByteArray (uint8) { var tmp var len = uint8.length var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes var parts = [] var maxChunkLength = 16383 // must be multiple of 3 // go through the array every three bytes, we'll deal with trailing stuff later for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) { parts.push(encodeChunk( uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength) )) } // pad the end with zeros, but make sure to not forget the extra bytes if (extraBytes === 1) { tmp = uint8[len - 1] parts.push( lookup[tmp >> 2] + lookup[(tmp << 4) & 0x3F] + '==' ) } else if (extraBytes === 2) { tmp = (uint8[len - 2] << 8) + uint8[len - 1] parts.push( lookup[tmp >> 10] + lookup[(tmp >> 4) & 0x3F] + lookup[(tmp << 2) & 0x3F] + '=' ) } return parts.join('') } /***/ }), /***/ "./node_modules/buffer/index.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(global) {/*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org> * @license MIT */ /* eslint-disable no-proto */ var base64 = __webpack_require__("./node_modules/base64-js/index.js") var ieee754 = __webpack_require__("./node_modules/ieee754/index.js") var isArray = __webpack_require__("./node_modules/isarray/index.js") exports.Buffer = Buffer exports.SlowBuffer = SlowBuffer exports.INSPECT_MAX_BYTES = 50 /** * If `Buffer.TYPED_ARRAY_SUPPORT`: * === true Use Uint8Array implementation (fastest) * === false Use Object implementation (most compatible, even IE6) * * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+, * Opera 11.6+, iOS 4.2+. * * Due to various browser bugs, sometimes the Object implementation will be used even * when the browser supports typed arrays. * * Note: * * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances, * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438. * * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function. * * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of * incorrect length in some situations. * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they * get the Object implementation, which is slower but behaves correctly. */ Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined ? global.TYPED_ARRAY_SUPPORT : typedArraySupport() /* * Export kMaxLength after typed array support is determined. */ exports.kMaxLength = kMaxLength() function typedArraySupport () { try { var arr = new Uint8Array(1) arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }} return arr.foo() === 42 && // typed array instances can be augmented typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray` arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray` } catch (e) { return false } } function kMaxLength () { return Buffer.TYPED_ARRAY_SUPPORT ? 0x7fffffff : 0x3fffffff } function createBuffer (that, length) { if (kMaxLength() < length) { throw new RangeError('Invalid typed array length') } if (Buffer.TYPED_ARRAY_SUPPORT) { // Return an augmented `Uint8Array` instance, for best performance that = new Uint8Array(length) that.__proto__ = Buffer.prototype } else { // Fallback: Return an object instance of the Buffer class if (that === null) { that = new Buffer(length) } that.length = length } return that } /** * The Buffer constructor returns instances of `Uint8Array` that have their * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of * `Uint8Array`, so the returned instances will have all the node `Buffer` methods * and the `Uint8Array` methods. Square bracket notation works as expected -- it * returns a single octet. * * The `Uint8Array` prototype remains unmodified. */ function Buffer (arg, encodingOrOffset, length) { if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) { return new Buffer(arg, encodingOrOffset, length) } // Common case. if (typeof arg === 'number') { if (typeof encodingOrOffset === 'string') { throw new Error( 'If encoding is specified then the first argument must be a string' ) } return allocUnsafe(this, arg) } return from(this, arg, encodingOrOffset, length) } Buffer.poolSize = 8192 // not used by this implementation // TODO: Legacy, not needed anymore. Remove in next major version. Buffer._augment = function (arr) { arr.__proto__ = Buffer.prototype return arr } function from (that, value, encodingOrOffset, length) { if (typeof value === 'number') { throw new TypeError('"value" argument must not be a number') } if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) { return fromArrayBuffer(that, value, encodingOrOffset, length) } if (typeof value === 'string') { return fromString(that, value, encodingOrOffset) } return fromObject(that, value) } /** * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError * if value is a number. * Buffer.from(str[, encoding]) * Buffer.from(array) * Buffer.from(buffer) * Buffer.from(arrayBuffer[, byteOffset[, length]]) **/ Buffer.from = function (value, encodingOrOffset, length) { return from(null, value, encodingOrOffset, length) } if (Buffer.TYPED_ARRAY_SUPPORT) { Buffer.prototype.__proto__ = Uint8Array.prototype Buffer.__proto__ = Uint8Array if (typeof Symbol !== 'undefined' && Symbol.species && Buffer[Symbol.species] === Buffer) { // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97 Object.defineProperty(Buffer, Symbol.species, { value: null, configurable: true }) } } function assertSize (size) { if (typeof size !== 'number') { throw new TypeError('"size" argument must be a number') } else if (size < 0) { throw new RangeError('"size" argument must not be negative') } } function alloc (that, size, fill, encoding) { assertSize(size) if (size <= 0) { return createBuffer(that, size) } if (fill !== undefined) { // Only pay attention to encoding if it's a string. This // prevents accidentally sending in a number that would // be interpretted as a start offset. return typeof encoding === 'string' ? createBuffer(that, size).fill(fill, encoding) : createBuffer(that, size).fill(fill) } return createBuffer(that, size) } /** * Creates a new filled Buffer instance. * alloc(size[, fill[, encoding]]) **/ Buffer.alloc = function (size, fill, encoding) { return alloc(null, size, fill, encoding) } function allocUnsafe (that, size) { assertSize(size) that = createBuffer(that, size < 0 ? 0 : checked(size) | 0) if (!Buffer.TYPED_ARRAY_SUPPORT) { for (var i = 0; i < size; ++i) { that[i] = 0 } } return that } /** * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance. * */ Buffer.allocUnsafe = function (size) { return allocUnsafe(null, size) } /** * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. */ Buffer.allocUnsafeSlow = function (size) { return allocUnsafe(null, size) } function fromString (that, string, encoding) { if (typeof encoding !== 'string' || encoding === '') { encoding = 'utf8' } if (!Buffer.isEncoding(encoding)) { throw new TypeError('"encoding" must be a valid string encoding') } var length = byteLength(string, encoding) | 0 that = createBuffer(that, length) var actual = that.write(string, encoding) if (actual !== length) { // Writing a hex string, for example, that contains invalid characters will // cause everything after the first invalid character to be ignored. (e.g. // 'abxxcd' will be treated as 'ab') that = that.slice(0, actual) } return that } function fromArrayLike (that, array) { var length = array.length < 0 ? 0 : checked(array.length) | 0 that = createBuffer(that, length) for (var i = 0; i < length; i += 1) { that[i] = array[i] & 255 } return that } function fromArrayBuffer (that, array, byteOffset, length) { array.byteLength // this throws if `array` is not a valid ArrayBuffer if (byteOffset < 0 || array.byteLength < byteOffset) { throw new RangeError('\'offset\' is out of bounds') } if (array.byteLength < byteOffset + (length || 0)) { throw new RangeError('\'length\' is out of bounds') } if (byteOffset === undefined && length === undefined) { array = new Uint8Array(array) } else if (length === undefined) { array = new Uint8Array(array, byteOffset) } else { array = new Uint8Array(array, byteOffset, length) } if (Buffer.TYPED_ARRAY_SUPPORT) { // Return an augmented `Uint8Array` instance, for best performance that = array that.__proto__ = Buffer.prototype } else { // Fallback: Return an object instance of the Buffer class that = fromArrayLike(that, array) } return that } function fromObject (that, obj) { if (Buffer.isBuffer(obj)) { var len = checked(obj.length) | 0 that = createBuffer(that, len) if (that.length === 0) { return that } obj.copy(that, 0, 0, len) return that } if (obj) { if ((typeof ArrayBuffer !== 'undefined' && obj.buffer instanceof ArrayBuffer) || 'length' in obj) { if (typeof obj.length !== 'number' || isnan(obj.length)) { return createBuffer(that, 0) } return fromArrayLike(that, obj) } if (obj.type === 'Buffer' && isArray(obj.data)) { return fromArrayLike(that, obj.data) } } throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.') } function checked (length) { // Note: cannot use `length < kMaxLength()` here because that fails when // length is NaN (which is otherwise coerced to zero.) if (length >= kMaxLength()) { throw new RangeError('Attempt to allocate Buffer larger than maximum ' + 'size: 0x' + kMaxLength().toString(16) + ' bytes') } return length | 0 } function SlowBuffer (length) { if (+length != length) { // eslint-disable-line eqeqeq length = 0 } return Buffer.alloc(+length) } Buffer.isBuffer = function isBuffer (b) { return !!(b != null && b._isBuffer) } Buffer.compare = function compare (a, b) { if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) { throw new TypeError('Arguments must be Buffers') } if (a === b) return 0 var x = a.length var y = b.length for (var i = 0, len = Math.min(x, y); i < len; ++i) { if (a[i] !== b[i]) { x = a[i] y = b[i] break } } if (x < y) return -1 if (y < x) return 1 return 0 } Buffer.isEncoding = function isEncoding (encoding) { switch (String(encoding).toLowerCase()) { case 'hex': case 'utf8': case 'utf-8': case 'ascii': case 'latin1': case 'binary': case 'base64': case 'ucs2': case 'ucs-2': case 'utf16le': case 'utf-16le': return true default: return false } } Buffer.concat = function concat (list, length) { if (!isArray(list)) { throw new TypeError('"list" argument must be an Array of Buffers') } if (list.length === 0) { return Buffer.alloc(0) } var i if (length === undefined) { length = 0 for (i = 0; i < list.length; ++i) { length += list[i].length } } var buffer = Buffer.allocUnsafe(length) var pos = 0 for (i = 0; i < list.length; ++i) { var buf = list[i] if (!Buffer.isBuffer(buf)) { throw new TypeError('"list" argument must be an Array of Buffers') } buf.copy(buffer, pos) pos += buf.length } return buffer } function byteLength (string, encoding) { if (Buffer.isBuffer(string)) { return string.length } if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' && (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) { return string.byteLength } if (typeof string !== 'string') { string = '' + string } var len = string.length if (len === 0) return 0 // Use a for loop to avoid recursion var loweredCase = false for (;;) { switch (encoding) { case 'ascii': case 'latin1': case 'binary': return len case 'utf8': case 'utf-8': case undefined: return utf8ToBytes(string).length case 'ucs2': case 'ucs-2': case 'utf16le': case 'utf-16le': return len * 2 case 'hex': return len >>> 1 case 'base64': return base64ToBytes(string).length default: if (loweredCase) return utf8ToBytes(string).length // assume utf8 encoding = ('' + encoding).toLowerCase() loweredCase = true } } } Buffer.byteLength = byteLength function slowToString (encoding, start, end) { var loweredCase = false // No need to verify that "this.length <= MAX_UINT32" since it's a read-only // property of a typed array. // This behaves neither like String nor Uint8Array in that we set start/end // to their upper/lower bounds if the value passed is out of range. // undefined is handled specially as per ECMA-262 6th Edition, // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization. if (start === undefined || start < 0) { start = 0 } // Return early if start > this.length. Done here to prevent potential uint32 // coercion fail below. if (start > this.length) { return '' } if (end === undefined || end > this.length) { end = this.length } if (end <= 0) { return '' } // Force coersion to uint32. This will also coerce falsey/NaN values to 0. end >>>= 0 start >>>= 0 if (end <= start) { return '' } if (!encoding) encoding = 'utf8' while (true) { switch (encoding) { case 'hex': return hexSlice(this, start, end) case 'utf8': case 'utf-8': return utf8Slice(this, start, end) case 'ascii': return asciiSlice(this, start, end) case 'latin1': case 'binary': return latin1Slice(this, start, end) case 'base64': return base64Slice(this, start, end) case 'ucs2': case 'ucs-2': case 'utf16le': case 'utf-16le': return utf16leSlice(this, start, end) default: if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) encoding = (encoding + '').toLowerCase() loweredCase = true } } } // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect // Buffer instances. Buffer.prototype._isBuffer = true function swap (b, n, m) { var i = b[n] b[n] = b[m] b[m] = i } Buffer.prototype.swap16 = function swap16 () { var len = this.length if (len % 2 !== 0) { throw new RangeError('Buffer size must be a multiple of 16-bits') } for (var i = 0; i < len; i += 2) { swap(this, i, i + 1) } return this } Buffer.prototype.swap32 = function swap32 () { var len = this.length if (len % 4 !== 0) { throw new RangeError('Buffer size must be a multiple of 32-bits') } for (var i = 0; i < len; i += 4) { swap(this, i, i + 3) swap(this, i + 1, i + 2) } return this } Buffer.prototype.swap64 = function swap64 () { var len = this.length if (len % 8 !== 0) { throw new RangeError('Buffer size must be a multiple of 64-bits') } for (var i = 0; i < len; i += 8) { swap(this, i, i + 7) swap(this, i + 1, i + 6) swap(this, i + 2, i + 5) swap(this, i + 3, i + 4) } return this } Buffer.prototype.toString = function toString () { var length = this.length | 0 if (length === 0) return '' if (arguments.length === 0) return utf8Slice(this, 0, length) return slowToString.apply(this, arguments) } Buffer.prototype.equals = function equals (b) { if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer') if (this === b) return true return Buffer.compare(this, b) === 0 } Buffer.prototype.inspect = function inspect () { var str = '' var max = exports.INSPECT_MAX_BYTES if (this.length > 0) { str = this.toString('hex', 0, max).match(/.{2}/g).join(' ') if (this.length > max) str += ' ... ' } return '<Buffer ' + str + '>' } Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) { if (!Buffer.isBuffer(target)) { throw new TypeError('Argument must be a Buffer') } if (start === undefined) { start = 0 } if (end === undefined) { end = target ? target.length : 0 } if (thisStart === undefined) { thisStart = 0 } if (thisEnd === undefined) { thisEnd = this.length } if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) { throw new RangeError('out of range index') } if (thisStart >= thisEnd && start >= end) { return 0 } if (thisStart >= thisEnd) { return -1 } if (start >= end) { return 1 } start >>>= 0 end >>>= 0 thisStart >>>= 0 thisEnd >>>= 0 if (this === target) return 0 var x = thisEnd - thisStart var y = end - start var len = Math.min(x, y) var thisCopy = this.slice(thisStart, thisEnd) var targetCopy = target.slice(start, end) for (var i = 0; i < len; ++i) { if (thisCopy[i] !== targetCopy[i]) { x = thisCopy[i] y = targetCopy[i] break } } if (x < y) return -1 if (y < x) return 1 return 0 } // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`, // OR the last index of `val` in `buffer` at offset <= `byteOffset`. // // Arguments: // - buffer - a Buffer to search // - val - a string, Buffer, or number // - byteOffset - an index into `buffer`; will be clamped to an int32 // - encoding - an optional encoding, relevant is val is a string // - dir - true for indexOf, false for lastIndexOf function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) { // Empty buffer means no match if (buffer.length === 0) return -1 // Normalize byteOffset if (typeof byteOffset === 'string') { encoding = byteOffset byteOffset = 0 } else if (byteOffset > 0x7fffffff) { byteOffset = 0x7fffffff } else if (byteOffset < -0x80000000) { byteOffset = -0x80000000 } byteOffset = +byteOffset // Coerce to Number. if (isNaN(byteOffset)) { // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer byteOffset = dir ? 0 : (buffer.length - 1) } // Normalize byteOffset: negative offsets start from the end of the buffer if (byteOffset < 0) byteOffset = buffer.length + byteOffset if (byteOffset >= buffer.length) { if (dir) return -1 else byteOffset = buffer.length - 1 } else if (byteOffset < 0) { if (dir) byteOffset = 0 else return -1 } // Normalize val if (typeof val === 'string') { val = Buffer.from(val, encoding) } // Finally, search either indexOf (if dir is true) or lastIndexOf if (Buffer.isBuffer(val)) { // Special case: looking for empty string/buffer always fails if (val.length === 0) { return -1 } return arrayIndexOf(buffer, val, byteOffset, encoding, dir) } else if (typeof val === 'number') { val = val & 0xFF // Search for a byte value [0-255] if (Buffer.TYPED_ARRAY_SUPPORT && typeof Uint8Array.prototype.indexOf === 'function') { if (dir) { return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset) } else { return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset) } } return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir) } throw new TypeError('val must be string, number or Buffer') } function arrayIndexOf (arr, val, byteOffset, encoding, dir) { var indexSize = 1 var arrLength = arr.length var valLength = val.length if (encoding !== undefined) { encoding = String(encoding).toLowerCase() if (encoding === 'ucs2' || encoding === 'ucs-2' || encoding === 'utf16le' || encoding === 'utf-16le') { if (arr.length < 2 || val.length < 2) { return -1 } indexSize = 2 arrLength /= 2 valLength /= 2 byteOffset /= 2 } } function read (buf, i) { if (indexSize === 1) { return buf[i] } else { return buf.readUInt16BE(i * indexSize) } } var i if (dir) { var foundIndex = -1 for (i = byteOffset; i < arrLength; i++) { if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) { if (foundIndex === -1) foundIndex = i if (i - foundIndex + 1 === valLength) return foundIndex * indexSize } else { if (foundIndex !== -1) i -= i - foundIndex foundIndex = -1 } } } else { if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength for (i = byteOffset; i >= 0; i--) { var found = true for (var j = 0; j < valLength; j++) { if (read(arr, i + j) !== read(val, j)) { found = false break } } if (found) return i } } return -1 } Buffer.prototype.includes = function includes (val, byteOffset, encoding) { return this.indexOf(val, byteOffset, encoding) !== -1 } Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) { return bidirectionalIndexOf(this, val, byteOffset, encoding, true) } Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) { return bidirectionalIndexOf(this, val, byteOffset, encoding, false) } function hexWrite (buf, string, offset, length) { offset = Number(offset) || 0 var remaining = buf.length - offset if (!length) { length = remaining } else { length = Number(length) if (length > remaining) { length = remaining } } // must be an even number of digits var strLen = string.length if (strLen % 2 !== 0) throw new TypeError('Invalid hex string') if (length > strLen / 2) { length = strLen / 2 } for (var i = 0; i < length; ++i) { var parsed = parseInt(string.substr(i * 2, 2), 16) if (isNaN(parsed)) return i buf[offset + i] = parsed } return i } function utf8Write (buf, string, offset, length) { return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length) } function asciiWrite (buf, string, offset, length) { return blitBuffer(asciiToBytes(string), buf, offset, length) } function latin1Write (buf, string, offset, length) { return asciiWrite(buf, string, offset, length) } function base64Write (buf, string, offset, length) { return blitBuffer(base64ToBytes(string), buf, offset, length) } function ucs2Write (buf, string, offset, length) { return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length) } Buffer.prototype.write = function write (string, offset, length, encoding) { // Buffer#write(string) if (offset === undefined) { encoding = 'utf8' length = this.length offset = 0 // Buffer#write(string, encoding) } else if (length === undefined && typeof offset === 'string') { encoding = offset length = this.length offset = 0 // Buffer#write(string, offset[, length][, encoding]) } else if (isFinite(offset)) { offset = offset | 0 if (isFinite(length)) { length = length | 0 if (encoding === undefined) encoding = 'utf8' } else { encoding = length length = undefined } // legacy write(string, encoding, offset, length) - remove in v0.13 } else { throw new Error( 'Buffer.write(string, encoding, offset[, length]) is no longer supported' ) } var remaining = this.length - offset if (length === undefined || length > remaining) length = remaining if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) { throw new RangeError('Attempt to write outside buffer bounds') } if (!encoding) encoding = 'utf8' var loweredCase = false for (;;) { switch (encoding) { case 'hex': return hexWrite(this, string, offset, length) case 'utf8': case 'utf-8': return utf8Write(this, string, offset, length) case 'ascii': return asciiWrite(this, string, offset, length) case 'latin1': case 'binary': return latin1Write(this, string, offset, length) case 'base64': // Warning: maxLength not taken into account in base64Write return base64Write(this, string, offset, length) case 'ucs2': case 'ucs-2': case 'utf16le': case 'utf-16le': return ucs2Write(this, string, offset, length) default: if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) encoding = ('' + encoding).toLowerCase() loweredCase = true } } } Buffer.prototype.toJSON = function toJSON () { return { type: 'Buffer', data: Array.prototype.slice.call(this._arr || this, 0) } } function base64Slice (buf, start, end) { if (start === 0 && end === buf.length) { return base64.fromByteArray(buf) } else { return base64.fromByteArray(buf.slice(start, end)) } } function utf8Slice (buf, start, end) { end = Math.min(buf.length, end) var res = [] var i = start while (i < end) { var firstByte = buf[i] var codePoint = null var bytesPerSequence = (firstByte > 0xEF) ? 4 : (firstByte > 0xDF) ? 3 : (firstByte > 0xBF) ? 2 : 1 if (i + bytesPerSequence <= end) { var secondByte, thirdByte, fourthByte, tempCodePoint switch (bytesPerSequence) { case 1: if (firstByte < 0x80) { codePoint = firstByte } break case 2: secondByte = buf[i + 1] if ((secondByte & 0xC0) === 0x80) { tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F) if (tempCodePoint > 0x7F) { codePoint = tempCodePoint } } break case 3: secondByte = buf[i + 1] thirdByte = buf[i + 2] if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) { tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F) if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) { codePoint = tempCodePoint } } break case 4: secondByte = buf[i + 1] thirdByte = buf[i + 2] fourthByte = buf[i + 3] if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) { tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F) if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) { codePoint = tempCodePoint } } } } if (codePoint === null) { // we did not generate a valid codePoint so insert a // replacement char (U+FFFD) and advance only 1 byte codePoint = 0xFFFD bytesPerSequence = 1 } else if (codePoint > 0xFFFF) { // encode to utf16 (surrogate pair dance) codePoint -= 0x10000 res.push(codePoint >>> 10 & 0x3FF | 0xD800) codePoint = 0xDC00 | codePoint & 0x3FF } res.push(codePoint) i += bytesPerSequence } return decodeCodePointsArray(res) } // Based on http://stackoverflow.com/a/22747272/680742, the browser with // the lowest limit is Chrome, with 0x10000 args. // We go 1 magnitude less, for safety var MAX_ARGUMENTS_LENGTH = 0x1000 function decodeCodePointsArray (codePoints) { var len = codePoints.length if (len <= MAX_ARGUMENTS_LENGTH) { return String.fromCharCode.apply(String, codePoints) // avoid extra slice() } // Decode in chunks to avoid "call stack size exceeded". var res = '' var i = 0 while (i < len) { res += String.fromCharCode.apply( String, codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH) ) } return res } function asciiSlice (buf, start, end) { var ret = '' end = Math.min(buf.length, end) for (var i = start; i < end; ++i) { ret += String.fromCharCode(buf[i] & 0x7F) } return ret } function latin1Slice (buf, start, end) { var ret = '' end = Math.min(buf.length, end) for (var i = start; i < end; ++i) { ret += String.fromCharCode(buf[i]) } return ret } function hexSlice (buf, start, end) { var len = buf.length if (!start || start < 0) start = 0 if (!end || end < 0 || end > len) end = len var out = '' for (var i = start; i < end; ++i) { out += toHex(buf[i]) } return out } function utf16leSlice (buf, start, end) { var bytes = buf.slice(start, end) var res = '' for (var i = 0; i < bytes.length; i += 2) { res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256) } return res } Buffer.prototype.slice = function slice (start, end) { var len = this.length start = ~~start end = end === undefined ? len : ~~end if (start < 0) { start += len if (start < 0) start = 0 } else if (start > len) { start = len } if (end < 0) { end += len if (end < 0) end = 0 } else if (end > len) { end = len } if (end < start) end = start var newBuf if (Buffer.TYPED_ARRAY_SUPPORT) { newBuf = this.subarray(start, end) newBuf.__proto__ = Buffer.prototype } else { var sliceLen = end - start newBuf = new Buffer(sliceLen, undefined) for (var i = 0; i < sliceLen; ++i) { newBuf[i] = this[i + start] } } return newBuf } /* * Need to make sure that buffer isn't trying to write out of bounds. */ function checkOffset (offset, ext, length) { if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint') if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length') } Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) { offset = offset | 0 byteLength = byteLength | 0 if (!noAssert) checkOffset(offset, byteLength, this.length) var val = this[offset] var mul = 1 var i = 0 while (++i < byteLength && (mul *= 0x100)) { val += this[offset + i] * mul } return val } Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) { offset = offset | 0 byteLength = byteLength | 0 if (!noAssert) { checkOffset(offset, byteLength, this.length) } var val = this[offset + --byteLength] var mul = 1 while (byteLength > 0 && (mul *= 0x100)) { val += this[offset + --byteLength] * mul } return val } Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) { if (!noAssert) checkOffset(offset, 1, this.length) return this[offset] } Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) { if (!noAssert) checkOffset(offset, 2, this.length) return this[offset] | (this[offset + 1] << 8) } Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) { if (!noAssert) checkOffset(offset, 2, this.length) return (this[offset] << 8) | this[offset + 1] } Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) { if (!noAssert) checkOffset(offset, 4, this.length) return ((this[offset]) | (this[offset + 1] << 8) | (this[offset + 2] << 16)) + (this[offset + 3] * 0x1000000) } Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) { if (!noAssert) checkOffset(offset, 4, this.length) return (this[offset] * 0x1000000) + ((this[offset + 1] << 16) | (this[offset + 2] << 8) | this[offset + 3]) } Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) { offset = offset | 0 byteLength = byteLength | 0 if (!noAssert) checkOffset(offset, byteLength, this.length) var val = this[offset] var mul = 1 var i = 0 while (++i < byteLength && (mul *= 0x100)) { val += this[offset + i] * mul } mul *= 0x80 if (val >= mul) val -= Math.pow(2, 8 * byteLength) return val } Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) { offset = offset | 0 byteLength = byteLength | 0 if (!noAssert) checkOffset(offset, byteLength, this.length) var i = byteLength var mul = 1 var val = this[offset + --i] while (i > 0 && (mul *= 0x100)) { val += this[offset + --i] * mul } mul *= 0x80 if (val >= mul) val -= Math.pow(2, 8 * byteLength) return val } Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) { if (!noAssert) checkOffset(offset, 1, this.length) if (!(this[offset] & 0x80)) return (this[offset]) return ((0xff - this[offset] + 1) * -1) } Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) { if (!noAssert) checkOffset(offset, 2, this.length) var val = this[offset] | (this[offset + 1] << 8) return (val & 0x8000) ? val | 0xFFFF0000 : val } Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) { if (!noAssert) checkOffset(offset, 2, this.length) var val = this[offset + 1] | (this[offset] << 8) return (val & 0x8000) ? val | 0xFFFF0000 : val } Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) { if (!noAssert) checkOffset(offset, 4, this.length) return (this[offset]) | (this[offset + 1] << 8) | (this[offset + 2] << 16) | (this[offset + 3] << 24) } Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) { if (!noAssert) checkOffset(offset, 4, this.length) return (this[offset] << 24) | (this[offset + 1] << 16) | (this[offset + 2] << 8) | (this[offset + 3]) } Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) { if (!noAssert) checkOffset(offset, 4, this.length) return ieee754.read(this, offset, true, 23, 4) } Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) { if (!noAssert) checkOffset(offset, 4, this.length) return ieee754.read(this, offset, false, 23, 4) } Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) { if (!noAssert) checkOffset(offset, 8, this.length) return ieee754.read(this, offset, true, 52, 8) } Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) { if (!noAssert) checkOffset(offset, 8, this.length) return ieee754.read(this, offset, false, 52, 8) } function checkInt (buf, value, offset, ext, max, min) { if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance') if (value > max || value < min) throw new RangeError('"value" argument is out of bounds') if (offset + ext > buf.length) throw new RangeError('Index out of range') } Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) { value = +value offset = offset | 0 byteLength = byteLength | 0 if (!noAssert) { var maxBytes = Math.pow(2, 8 * byteLength) - 1 checkInt(this, value, offset, byteLength, maxBytes, 0) } var mul = 1 var i = 0 this[offset] = value & 0xFF while (++i < byteLength && (mul *= 0x100)) { this[offset + i] = (value / mul) & 0xFF } return offset + byteLength } Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) { value = +value offset = offset | 0 byteLength = byteLength | 0 if (!noAssert) { var maxBytes = Math.pow(2, 8 * byteLength) - 1 checkInt(this, value, offset, byteLength, maxBytes, 0) } var i = byteLength - 1 var mul = 1 this[offset + i] = value & 0xFF while (--i >= 0 && (mul *= 0x100)) { this[offset + i] = (value / mul) & 0xFF } return offset + byteLength } Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) { value = +value offset = offset | 0 if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0) if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value) this[offset] = (value & 0xff) return offset + 1 } function objectWriteUInt16 (buf, value, offset, littleEndian) { if (value < 0) value = 0xffff + value + 1 for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) { buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>> (littleEndian ? i : 1 - i) * 8 } } Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) { value = +value offset = offset | 0 if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0) if (Buffer.TYPED_ARRAY_SUPPORT) { this[offset] = (value & 0xff) this[offset + 1] = (value >>> 8) } else { objectWriteUInt16(this, value, offset, true) } return offset + 2 } Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) { value = +value offset = offset | 0 if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0) if (Buffer.TYPED_ARRAY_SUPPORT) { this[offset] = (value >>> 8) this[offset + 1] = (value & 0xff) } else { objectWriteUInt16(this, value, offset, false) } return offset + 2 } function objectWriteUInt32 (buf, value, offset, littleEndian) { if (value < 0) value = 0xffffffff + value + 1 for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) { buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff } } Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) { value = +value offset = offset | 0 if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0) if (Buffer.TYPED_ARRAY_SUPPORT) { this[offset + 3] = (value >>> 24) this[offset + 2] = (value >>> 16) this[offset + 1] = (value >>> 8) this[offset] = (value & 0xff) } else { objectWriteUInt32(this, value, offset, true) } return offset + 4 } Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) { value = +value offset = offset | 0 if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0) if (Buffer.TYPED_ARRAY_SUPPORT) { this[offset] = (value >>> 24) this[offset + 1] = (value >>> 16) this[offset + 2] = (value >>> 8) this[offset + 3] = (value & 0xff) } else { objectWriteUInt32(this, value, offset, false) } return offset + 4 } Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) { value = +value offset = offset | 0 if (!noAssert) { var limit = Math.pow(2, 8 * byteLength - 1) checkInt(this, value, offset, byteLength, limit - 1, -limit) } var i = 0 var mul = 1 var sub = 0 this[offset] = value & 0xFF while (++i < byteLength && (mul *= 0x100)) { if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) { sub = 1 } this[offset + i] = ((value / mul) >> 0) - sub & 0xFF } return offset + byteLength } Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) { value = +value offset = offset | 0 if (!noAssert) { var limit = Math.pow(2, 8 * byteLength - 1) checkInt(this, value, offset, byteLength, limit - 1, -limit) } var i = byteLength - 1 var mul = 1 var sub = 0 this[offset + i] = value & 0xFF while (--i >= 0 && (mul *= 0x100)) { if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) { sub = 1 } this[offset + i] = ((value / mul) >> 0) - sub & 0xFF } return offset + byteLength } Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) { value = +value offset = offset | 0 if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80) if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value) if (value < 0) value = 0xff + value + 1 this[offset] = (value & 0xff) return offset + 1 } Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) { value = +value offset = offset | 0 if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000) if (Buffer.TYPED_ARRAY_SUPPORT) { this[offset] = (value & 0xff) this[offset + 1] = (value >>> 8) } else { objectWriteUInt16(this, value, offset, true) } return offset + 2 } Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) { value = +value offset = offset | 0 if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000) if (Buffer.TYPED_ARRAY_SUPPORT) { this[offset] = (value >>> 8) this[offset + 1] = (value & 0xff) } else { objectWriteUInt16(this, value, offset, false) } return offset + 2 } Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) { value = +value offset = offset | 0 if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000) if (Buffer.TYPED_ARRAY_SUPPORT) { this[offset] = (value & 0xff) this[offset + 1] = (value >>> 8) this[offset + 2] = (value >>> 16) this[offset + 3] = (value >>> 24) } else { objectWriteUInt32(this, value, offset, true) } return offset + 4 } Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) { value = +value offset = offset | 0 if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000) if (value < 0) value = 0xffffffff + value + 1 if (Buffer.TYPED_ARRAY_SUPPORT) { this[offset] = (value >>> 24) this[offset + 1] = (value >>> 16) this[offset + 2] = (value >>> 8) this[offset + 3] = (value & 0xff) } else { objectWriteUInt32(this, value, offset, false) } return offset + 4 } function checkIEEE754 (buf, value, offset, ext, max, min) { if (offset + ext > buf.length) throw new RangeError('Index out of range') if (offset < 0) throw new RangeError('Index out of range') } function writeFloat (buf, value, offset, littleEndian, noAssert) { if (!noAssert) { checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38) } ieee754.write(buf, value, offset, littleEndian, 23, 4) return offset + 4 } Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) { return writeFloat(this, value, offset, true, noAssert) } Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) { return writeFloat(this, value, offset, false, noAssert) } function writeDouble (buf, value, offset, littleEndian, noAssert) { if (!noAssert) { checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308) } ieee754.write(buf, value, offset, littleEndian, 52, 8) return offset + 8 } Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) { return writeDouble(this, value, offset, true, noAssert) } Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) { return writeDouble(this, value, offset, false, noAssert) } // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length) Buffer.prototype.copy = function copy (target, targetStart, start, end) { if (!start) start = 0 if (!end && end !== 0) end = this.length if (targetStart >= target.length) targetStart = target.length if (!targetStart) targetStart = 0 if (end > 0 && end < start) end = start // Copy 0 bytes; we're done if (end === start) return 0 if (target.length === 0 || this.length === 0) return 0 // Fatal error conditions if (targetStart < 0) { throw new RangeError('targetStart out of bounds') } if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds') if (end < 0) throw new RangeError('sourceEnd out of bounds') // Are we oob? if (end > this.length) end = this.length if (target.length - targetStart < end - start) { end = target.length - targetStart + start } var len = end - start var i if (this === target && start < targetStart && targetStart < end) { // descending copy from end for (i = len - 1; i >= 0; --i) { target[i + targetStart] = this[i + start] } } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) { // ascending copy from start for (i = 0; i < len; ++i) { target[i + targetStart] = this[i + start] } } else { Uint8Array.prototype.set.call( target, this.subarray(start, start + len), targetStart ) } return len } // Usage: // buffer.fill(number[, offset[, end]]) // buffer.fill(buffer[, offset[, end]]) // buffer.fill(string[, offset[, end]][, encoding]) Buffer.prototype.fill = function fill (val, start, end, encoding) { // Handle string cases: if (typeof val === 'string') { if (typeof start === 'string') { encoding = start start = 0 end = this.length } else if (typeof end === 'string') { encoding = end end = this.length } if (val.length === 1) { var code = val.charCodeAt(0) if (code < 256) { val = code } } if (encoding !== undefined && typeof encoding !== 'string') { throw new TypeError('encoding must be a string') } if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) { throw new TypeError('Unknown encoding: ' + encoding) } } else if (typeof val === 'number') { val = val & 255 } // Invalid ranges are not set to a default, so can range check early. if (start < 0 || this.length < start || this.length < end) { throw new RangeError('Out of range index') } if (end <= start) { return this } start = start >>> 0 end = end === undefined ? this.length : end >>> 0 if (!val) val = 0 var i if (typeof val === 'number') { for (i = start; i < end; ++i) { this[i] = val } } else { var bytes = Buffer.isBuffer(val) ? val : utf8ToBytes(new Buffer(val, encoding).toString()) var len = bytes.length for (i = 0; i < end - start; ++i) { this[i + start] = bytes[i % len] } } return this } // HELPER FUNCTIONS // ================ var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g function base64clean (str) { // Node strips out invalid characters like \n and \t from the string, base64-js does not str = stringtrim(str).replace(INVALID_BASE64_RE, '') // Node converts strings with length < 2 to '' if (str.length < 2) return '' // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not while (str.length % 4 !== 0) { str = str + '=' } return str } function stringtrim (str) { if (str.trim) return str.trim() return str.replace(/^\s+|\s+$/g, '') } function toHex (n) { if (n < 16) return '0' + n.toString(16) return n.toString(16) } function utf8ToBytes (string, units) { units = units || Infinity var codePoint var length = string.length var leadSurrogate = null var bytes = [] for (var i = 0; i < length; ++i) { codePoint = string.charCodeAt(i) // is surrogate component if (codePoint > 0xD7FF && codePoint < 0xE000) { // last char was a lead if (!leadSurrogate) { // no lead yet if (codePoint > 0xDBFF) { // unexpected trail if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) continue } else if (i + 1 === length) { // unpaired lead if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) continue } // valid lead leadSurrogate = codePoint continue } // 2 leads in a row if (codePoint < 0xDC00) { if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) leadSurrogate = codePoint continue } // valid surrogate pair codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000 } else if (leadSurrogate) { // valid bmp char, but last char was a lead if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) } leadSurrogate = null // encode utf8 if (codePoint < 0x80) { if ((units -= 1) < 0) break bytes.push(codePoint) } else if (codePoint < 0x800) { if ((units -= 2) < 0) break bytes.push( codePoint >> 0x6 | 0xC0, codePoint & 0x3F | 0x80 ) } else if (codePoint < 0x10000) { if ((units -= 3) < 0) break bytes.push( codePoint >> 0xC | 0xE0, codePoint >> 0x6 & 0x3F | 0x80, codePoint & 0x3F | 0x80 ) } else if (codePoint < 0x110000) { if ((units -= 4) < 0) break bytes.push( codePoint >> 0x12 | 0xF0, codePoint >> 0xC & 0x3F | 0x80, codePoint >> 0x6 & 0x3F | 0x80, codePoint & 0x3F | 0x80 ) } else { throw new Error('Invalid code point') } } return bytes } function asciiToBytes (str) { var byteArray = [] for (var i = 0; i < str.length; ++i) { // Node's code seems to be doing this and not & 0x7F.. byteArray.push(str.charCodeAt(i) & 0xFF) } return byteArray } function utf16leToBytes (str, units) { var c, hi, lo var byteArray = [] for (var i = 0; i < str.length; ++i) { if ((units -= 2) < 0) break c = str.charCodeAt(i) hi = c >> 8 lo = c % 256 byteArray.push(lo) byteArray.push(hi) } return byteArray } function base64ToBytes (str) { return base64.toByteArray(base64clean(str)) } function blitBuffer (src, dst, offset, length) { for (var i = 0; i < length; ++i) { if ((i + offset >= dst.length) || (i >= src.length)) break dst[i + offset] = src[i] } return i } function isnan (val) { return val !== val // eslint-disable-line no-self-compare } /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__("./node_modules/webpack/buildin/global.js"))) /***/ }), /***/ "./node_modules/chart.js/src/chart.js": /***/ (function(module, exports, __webpack_require__) { /** * @namespace Chart */ var Chart = __webpack_require__("./node_modules/chart.js/src/core/core.js")(); Chart.helpers = __webpack_require__("./node_modules/chart.js/src/helpers/index.js"); // @todo dispatch these helpers into appropriated helpers/helpers.* file and write unit tests! __webpack_require__("./node_modules/chart.js/src/core/core.helpers.js")(Chart); Chart.defaults = __webpack_require__("./node_modules/chart.js/src/core/core.defaults.js"); Chart.Element = __webpack_require__("./node_modules/chart.js/src/core/core.element.js"); Chart.elements = __webpack_require__("./node_modules/chart.js/src/elements/index.js"); Chart.Interaction = __webpack_require__("./node_modules/chart.js/src/core/core.interaction.js"); Chart.layouts = __webpack_require__("./node_modules/chart.js/src/core/core.layouts.js"); Chart.platform = __webpack_require__("./node_modules/chart.js/src/platforms/platform.js"); Chart.plugins = __webpack_require__("./node_modules/chart.js/src/core/core.plugins.js"); Chart.Ticks = __webpack_require__("./node_modules/chart.js/src/core/core.ticks.js"); __webpack_require__("./node_modules/chart.js/src/core/core.animation.js")(Chart); __webpack_require__("./node_modules/chart.js/src/core/core.controller.js")(Chart); __webpack_require__("./node_modules/chart.js/src/core/core.datasetController.js")(Chart); __webpack_require__("./node_modules/chart.js/src/core/core.scaleService.js")(Chart); __webpack_require__("./node_modules/chart.js/src/core/core.scale.js")(Chart); __webpack_require__("./node_modules/chart.js/src/core/core.tooltip.js")(Chart); __webpack_require__("./node_modules/chart.js/src/scales/scale.linearbase.js")(Chart); __webpack_require__("./node_modules/chart.js/src/scales/scale.category.js")(Chart); __webpack_require__("./node_modules/chart.js/src/scales/scale.linear.js")(Chart); __webpack_require__("./node_modules/chart.js/src/scales/scale.logarithmic.js")(Chart); __webpack_require__("./node_modules/chart.js/src/scales/scale.radialLinear.js")(Chart); __webpack_require__("./node_modules/chart.js/src/scales/scale.time.js")(Chart); // Controllers must be loaded after elements // See Chart.core.datasetController.dataElementType __webpack_require__("./node_modules/chart.js/src/controllers/controller.bar.js")(Chart); __webpack_require__("./node_modules/chart.js/src/controllers/controller.bubble.js")(Chart); __webpack_require__("./node_modules/chart.js/src/controllers/controller.doughnut.js")(Chart); __webpack_require__("./node_modules/chart.js/src/controllers/controller.line.js")(Chart); __webpack_require__("./node_modules/chart.js/src/controllers/controller.polarArea.js")(Chart); __webpack_require__("./node_modules/chart.js/src/controllers/controller.radar.js")(Chart); __webpack_require__("./node_modules/chart.js/src/controllers/controller.scatter.js")(Chart); __webpack_require__("./node_modules/chart.js/src/charts/Chart.Bar.js")(Chart); __webpack_require__("./node_modules/chart.js/src/charts/Chart.Bubble.js")(Chart); __webpack_require__("./node_modules/chart.js/src/charts/Chart.Doughnut.js")(Chart); __webpack_require__("./node_modules/chart.js/src/charts/Chart.Line.js")(Chart); __webpack_require__("./node_modules/chart.js/src/charts/Chart.PolarArea.js")(Chart); __webpack_require__("./node_modules/chart.js/src/charts/Chart.Radar.js")(Chart); __webpack_require__("./node_modules/chart.js/src/charts/Chart.Scatter.js")(Chart); // Loading built-it plugins var plugins = __webpack_require__("./node_modules/chart.js/src/plugins/index.js"); for (var k in plugins) { if (plugins.hasOwnProperty(k)) { Chart.plugins.register(plugins[k]); } } Chart.platform.initialize(); module.exports = Chart; if (typeof window !== 'undefined') { window.Chart = Chart; } // DEPRECATIONS /** * Provided for backward compatibility, not available anymore * @namespace Chart.Legend * @deprecated since version 2.1.5 * @todo remove at version 3 * @private */ Chart.Legend = plugins.legend._element; /** * Provided for backward compatibility, not available anymore * @namespace Chart.Title * @deprecated since version 2.1.5 * @todo remove at version 3 * @private */ Chart.Title = plugins.title._element; /** * Provided for backward compatibility, use Chart.plugins instead * @namespace Chart.pluginService * @deprecated since version 2.1.5 * @todo remove at version 3 * @private */ Chart.pluginService = Chart.plugins; /** * Provided for backward compatibility, inheriting from Chart.PlugingBase has no * effect, instead simply create/register plugins via plain JavaScript objects. * @interface Chart.PluginBase * @deprecated since version 2.5.0 * @todo remove at version 3 * @private */ Chart.PluginBase = Chart.Element.extend({}); /** * Provided for backward compatibility, use Chart.helpers.canvas instead. * @namespace Chart.canvasHelpers * @deprecated since version 2.6.0 * @todo remove at version 3 * @private */ Chart.canvasHelpers = Chart.helpers.canvas; /** * Provided for backward compatibility, use Chart.layouts instead. * @namespace Chart.layoutService * @deprecated since version 2.8.0 * @todo remove at version 3 * @private */ Chart.layoutService = Chart.layouts; /***/ }), /***/ "./node_modules/chart.js/src/charts/Chart.Bar.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; module.exports = function(Chart) { Chart.Bar = function(context, config) { config.type = 'bar'; return new Chart(context, config); }; }; /***/ }), /***/ "./node_modules/chart.js/src/charts/Chart.Bubble.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; module.exports = function(Chart) { Chart.Bubble = function(context, config) { config.type = 'bubble'; return new Chart(context, config); }; }; /***/ }), /***/ "./node_modules/chart.js/src/charts/Chart.Doughnut.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; module.exports = function(Chart) { Chart.Doughnut = function(context, config) { config.type = 'doughnut'; return new Chart(context, config); }; }; /***/ }), /***/ "./node_modules/chart.js/src/charts/Chart.Line.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; module.exports = function(Chart) { Chart.Line = function(context, config) { config.type = 'line'; return new Chart(context, config); }; }; /***/ }), /***/ "./node_modules/chart.js/src/charts/Chart.PolarArea.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; module.exports = function(Chart) { Chart.PolarArea = function(context, config) { config.type = 'polarArea'; return new Chart(context, config); }; }; /***/ }), /***/ "./node_modules/chart.js/src/charts/Chart.Radar.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; module.exports = function(Chart) { Chart.Radar = function(context, config) { config.type = 'radar'; return new Chart(context, config); }; }; /***/ }), /***/ "./node_modules/chart.js/src/charts/Chart.Scatter.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; module.exports = function(Chart) { Chart.Scatter = function(context, config) { config.type = 'scatter'; return new Chart(context, config); }; }; /***/ }), /***/ "./node_modules/chart.js/src/controllers/controller.bar.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; var defaults = __webpack_require__("./node_modules/chart.js/src/core/core.defaults.js"); var elements = __webpack_require__("./node_modules/chart.js/src/elements/index.js"); var helpers = __webpack_require__("./node_modules/chart.js/src/helpers/index.js"); defaults._set('bar', { hover: { mode: 'label' }, scales: { xAxes: [{ type: 'category', // Specific to Bar Controller categoryPercentage: 0.8, barPercentage: 0.9, // offset settings offset: true, // grid line settings gridLines: { offsetGridLines: true } }], yAxes: [{ type: 'linear' }] } }); defaults._set('horizontalBar', { hover: { mode: 'index', axis: 'y' }, scales: { xAxes: [{ type: 'linear', position: 'bottom' }], yAxes: [{ position: 'left', type: 'category', // Specific to Horizontal Bar Controller categoryPercentage: 0.8, barPercentage: 0.9, // offset settings offset: true, // grid line settings gridLines: { offsetGridLines: true } }] }, elements: { rectangle: { borderSkipped: 'left' } }, tooltips: { callbacks: { title: function(item, data) { // Pick first xLabel for now var title = ''; if (item.length > 0) { if (item[0].yLabel) { title = item[0].yLabel; } else if (data.labels.length > 0 && item[0].index < data.labels.length) { title = data.labels[item[0].index]; } } return title; }, label: function(item, data) { var datasetLabel = data.datasets[item.datasetIndex].label || ''; return datasetLabel + ': ' + item.xLabel; } }, mode: 'index', axis: 'y' } }); /** * Computes the "optimal" sample size to maintain bars equally sized while preventing overlap. * @private */ function computeMinSampleSize(scale, pixels) { var min = scale.isHorizontal() ? scale.width : scale.height; var ticks = scale.getTicks(); var prev, curr, i, ilen; for (i = 1, ilen = pixels.length; i < ilen; ++i) { min = Math.min(min, pixels[i] - pixels[i - 1]); } for (i = 0, ilen = ticks.length; i < ilen; ++i) { curr = scale.getPixelForTick(i); min = i > 0 ? Math.min(min, curr - prev) : min; prev = curr; } return min; } /** * Computes an "ideal" category based on the absolute bar thickness or, if undefined or null, * uses the smallest interval (see computeMinSampleSize) that prevents bar overlapping. This * mode currently always generates bars equally sized (until we introduce scriptable options?). * @private */ function computeFitCategoryTraits(index, ruler, options) { var thickness = options.barThickness; var count = ruler.stackCount; var curr = ruler.pixels[index]; var size, ratio; if (helpers.isNullOrUndef(thickness)) { size = ruler.min * options.categoryPercentage; ratio = options.barPercentage; } else { // When bar thickness is enforced, category and bar percentages are ignored. // Note(SB): we could add support for relative bar thickness (e.g. barThickness: '50%') // and deprecate barPercentage since this value is ignored when thickness is absolute. size = thickness * count; ratio = 1; } return { chunk: size / count, ratio: ratio, start: curr - (size / 2) }; } /** * Computes an "optimal" category that globally arranges bars side by side (no gap when * percentage options are 1), based on the previous and following categories. This mode * generates bars with different widths when data are not evenly spaced. * @private */ function computeFlexCategoryTraits(index, ruler, options) { var pixels = ruler.pixels; var curr = pixels[index]; var prev = index > 0 ? pixels[index - 1] : null; var next = index < pixels.length - 1 ? pixels[index + 1] : null; var percent = options.categoryPercentage; var start, size; if (prev === null) { // first data: its size is double based on the next point or, // if it's also the last data, we use the scale end extremity. prev = curr - (next === null ? ruler.end - curr : next - curr); } if (next === null) { // last data: its size is also double based on the previous point. next = curr + curr - prev; } start = curr - ((curr - prev) / 2) * percent; size = ((next - prev) / 2) * percent; return { chunk: size / ruler.stackCount, ratio: options.barPercentage, start: start }; } module.exports = function(Chart) { Chart.controllers.bar = Chart.DatasetController.extend({ dataElementType: elements.Rectangle, initialize: function() { var me = this; var meta; Chart.DatasetController.prototype.initialize.apply(me, arguments); meta = me.getMeta(); meta.stack = me.getDataset().stack; meta.bar = true; }, update: function(reset) { var me = this; var rects = me.getMeta().data; var i, ilen; me._ruler = me.getRuler(); for (i = 0, ilen = rects.length; i < ilen; ++i) { me.updateElement(rects[i], i, reset); } }, updateElement: function(rectangle, index, reset) { var me = this; var chart = me.chart; var meta = me.getMeta(); var dataset = me.getDataset(); var custom = rectangle.custom || {}; var rectangleOptions = chart.options.elements.rectangle; rectangle._xScale = me.getScaleForId(meta.xAxisID); rectangle._yScale = me.getScaleForId(meta.yAxisID); rectangle._datasetIndex = me.index; rectangle._index = index; rectangle._model = { datasetLabel: dataset.label, label: chart.data.labels[index], borderSkipped: custom.borderSkipped ? custom.borderSkipped : rectangleOptions.borderSkipped, backgroundColor: custom.backgroundColor ? custom.backgroundColor : helpers.valueAtIndexOrDefault(dataset.backgroundColor, index, rectangleOptions.backgroundColor), borderColor: custom.borderColor ? custom.borderColor : helpers.valueAtIndexOrDefault(dataset.borderColor, index, rectangleOptions.borderColor), borderWidth: custom.borderWidth ? custom.borderWidth : helpers.valueAtIndexOrDefault(dataset.borderWidth, index, rectangleOptions.borderWidth) }; me.updateElementGeometry(rectangle, index, reset); rectangle.pivot(); }, /** * @private */ updateElementGeometry: function(rectangle, index, reset) { var me = this; var model = rectangle._model; var vscale = me.getValueScale(); var base = vscale.getBasePixel(); var horizontal = vscale.isHorizontal(); var ruler = me._ruler || me.getRuler(); var vpixels = me.calculateBarValuePixels(me.index, index); var ipixels = me.calculateBarIndexPixels(me.index, index, ruler); model.horizontal = horizontal; model.base = reset ? base : vpixels.base; model.x = horizontal ? reset ? base : vpixels.head : ipixels.center; model.y = horizontal ? ipixels.center : reset ? base : vpixels.head; model.height = horizontal ? ipixels.size : undefined; model.width = horizontal ? undefined : ipixels.size; }, /** * @private */ getValueScaleId: function() { return this.getMeta().yAxisID; }, /** * @private */ getIndexScaleId: function() { return this.getMeta().xAxisID; }, /** * @private */ getValueScale: function() { return this.getScaleForId(this.getValueScaleId()); }, /** * @private */ getIndexScale: function() { return this.getScaleForId(this.getIndexScaleId()); }, /** * Returns the stacks based on groups and bar visibility. * @param {Number} [last] - The dataset index * @returns {Array} The stack list * @private */ _getStacks: function(last) { var me = this; var chart = me.chart; var scale = me.getIndexScale(); var stacked = scale.options.stacked; var ilen = last === undefined ? chart.data.datasets.length : last + 1; var stacks = []; var i, meta; for (i = 0; i < ilen; ++i) { meta = chart.getDatasetMeta(i); if (meta.bar && chart.isDatasetVisible(i) && (stacked === false || (stacked === true && stacks.indexOf(meta.stack) === -1) || (stacked === undefined && (meta.stack === undefined || stacks.indexOf(meta.stack) === -1)))) { stacks.push(meta.stack); } } return stacks; }, /** * Returns the effective number of stacks based on groups and bar visibility. * @private */ getStackCount: function() { return this._getStacks().length; }, /** * Returns the stack index for the given dataset based on groups and bar visibility. * @param {Number} [datasetIndex] - The dataset index * @param {String} [name] - The stack name to find * @returns {Number} The stack index * @private */ getStackIndex: function(datasetIndex, name) { var stacks = this._getStacks(datasetIndex); var index = (name !== undefined) ? stacks.indexOf(name) : -1; // indexOf returns -1 if element is not present return (index === -1) ? stacks.length - 1 : index; }, /** * @private */ getRuler: function() { var me = this; var scale = me.getIndexScale(); var stackCount = me.getStackCount(); var datasetIndex = me.index; var isHorizontal = scale.isHorizontal(); var start = isHorizontal ? scale.left : scale.top; var end = start + (isHorizontal ? scale.width : scale.height); var pixels = []; var i, ilen, min; for (i = 0, ilen = me.getMeta().data.length; i < ilen; ++i) { pixels.push(scale.getPixelForValue(null, i, datasetIndex)); } min = helpers.isNullOrUndef(scale.options.barThickness) ? computeMinSampleSize(scale, pixels) : -1; return { min: min, pixels: pixels, start: start, end: end, stackCount: stackCount, scale: scale }; }, /** * Note: pixel values are not clamped to the scale area. * @private */ calculateBarValuePixels: function(datasetIndex, index) { var me = this; var chart = me.chart; var meta = me.getMeta(); var scale = me.getValueScale(); var datasets = chart.data.datasets; var value = scale.getRightValue(datasets[datasetIndex].data[index]); var stacked = scale.options.stacked; var stack = meta.stack; var start = 0; var i, imeta, ivalue, base, head, size; if (stacked || (stacked === undefined && stack !== undefined)) { for (i = 0; i < datasetIndex; ++i) { imeta = chart.getDatasetMeta(i); if (imeta.bar && imeta.stack === stack && imeta.controller.getValueScaleId() === scale.id && chart.isDatasetVisible(i)) { ivalue = scale.getRightValue(datasets[i].data[index]); if ((value < 0 && ivalue < 0) || (value >= 0 && ivalue > 0)) { start += ivalue; } } } } base = scale.getPixelForValue(start); head = scale.getPixelForValue(start + value); size = (head - base) / 2; return { size: size, base: base, head: head, center: head + size / 2 }; }, /** * @private */ calculateBarIndexPixels: function(datasetIndex, index, ruler) { var me = this; var options = ruler.scale.options; var range = options.barThickness === 'flex' ? computeFlexCategoryTraits(index, ruler, options) : computeFitCategoryTraits(index, ruler, options); var stackIndex = me.getStackIndex(datasetIndex, me.getMeta().stack); var center = range.start + (range.chunk * stackIndex) + (range.chunk / 2); var size = Math.min( helpers.valueOrDefault(options.maxBarThickness, Infinity), range.chunk * range.ratio); return { base: center - size / 2, head: center + size / 2, center: center, size: size }; }, draw: function() { var me = this; var chart = me.chart; var scale = me.getValueScale(); var rects = me.getMeta().data; var dataset = me.getDataset(); var ilen = rects.length; var i = 0; helpers.canvas.clipArea(chart.ctx, chart.chartArea); for (; i < ilen; ++i) { if (!isNaN(scale.getRightValue(dataset.data[i]))) { rects[i].draw(); } } helpers.canvas.unclipArea(chart.ctx); }, setHoverStyle: function(rectangle) { var dataset = this.chart.data.datasets[rectangle._datasetIndex]; var index = rectangle._index; var custom = rectangle.custom || {}; var model = rectangle._model; model.backgroundColor = custom.hoverBackgroundColor ? custom.hoverBackgroundColor : helpers.valueAtIndexOrDefault(dataset.hoverBackgroundColor, index, helpers.getHoverColor(model.backgroundColor)); model.borderColor = custom.hoverBorderColor ? custom.hoverBorderColor : helpers.valueAtIndexOrDefault(dataset.hoverBorderColor, index, helpers.getHoverColor(model.borderColor)); model.borderWidth = custom.hoverBorderWidth ? custom.hoverBorderWidth : helpers.valueAtIndexOrDefault(dataset.hoverBorderWidth, index, model.borderWidth); }, removeHoverStyle: function(rectangle) { var dataset = this.chart.data.datasets[rectangle._datasetIndex]; var index = rectangle._index; var custom = rectangle.custom || {}; var model = rectangle._model; var rectangleElementOptions = this.chart.options.elements.rectangle; model.backgroundColor = custom.backgroundColor ? custom.backgroundColor : helpers.valueAtIndexOrDefault(dataset.backgroundColor, index, rectangleElementOptions.backgroundColor); model.borderColor = custom.borderColor ? custom.borderColor : helpers.valueAtIndexOrDefault(dataset.borderColor, index, rectangleElementOptions.borderColor); model.borderWidth = custom.borderWidth ? custom.borderWidth : helpers.valueAtIndexOrDefault(dataset.borderWidth, index, rectangleElementOptions.borderWidth); } }); Chart.controllers.horizontalBar = Chart.controllers.bar.extend({ /** * @private */ getValueScaleId: function() { return this.getMeta().xAxisID; }, /** * @private */ getIndexScaleId: function() { return this.getMeta().yAxisID; } }); }; /***/ }), /***/ "./node_modules/chart.js/src/controllers/controller.bubble.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; var defaults = __webpack_require__("./node_modules/chart.js/src/core/core.defaults.js"); var elements = __webpack_require__("./node_modules/chart.js/src/elements/index.js"); var helpers = __webpack_require__("./node_modules/chart.js/src/helpers/index.js"); defaults._set('bubble', { hover: { mode: 'single' }, scales: { xAxes: [{ type: 'linear', // bubble should probably use a linear scale by default position: 'bottom', id: 'x-axis-0' // need an ID so datasets can reference the scale }], yAxes: [{ type: 'linear', position: 'left', id: 'y-axis-0' }] }, tooltips: { callbacks: { title: function() { // Title doesn't make sense for scatter since we format the data as a point return ''; }, label: function(item, data) { var datasetLabel = data.datasets[item.datasetIndex].label || ''; var dataPoint = data.datasets[item.datasetIndex].data[item.index]; return datasetLabel + ': (' + item.xLabel + ', ' + item.yLabel + ', ' + dataPoint.r + ')'; } } } }); module.exports = function(Chart) { Chart.controllers.bubble = Chart.DatasetController.extend({ /** * @protected */ dataElementType: elements.Point, /** * @protected */ update: function(reset) { var me = this; var meta = me.getMeta(); var points = meta.data; // Update Points helpers.each(points, function(point, index) { me.updateElement(point, index, reset); }); }, /** * @protected */ updateElement: function(point, index, reset) { var me = this; var meta = me.getMeta(); var custom = point.custom || {}; var xScale = me.getScaleForId(meta.xAxisID); var yScale = me.getScaleForId(meta.yAxisID); var options = me._resolveElementOptions(point, index); var data = me.getDataset().data[index]; var dsIndex = me.index; var x = reset ? xScale.getPixelForDecimal(0.5) : xScale.getPixelForValue(typeof data === 'object' ? data : NaN, index, dsIndex); var y = reset ? yScale.getBasePixel() : yScale.getPixelForValue(data, index, dsIndex); point._xScale = xScale; point._yScale = yScale; point._options = options; point._datasetIndex = dsIndex; point._index = index; point._model = { backgroundColor: options.backgroundColor, borderColor: options.borderColor, borderWidth: options.borderWidth, hitRadius: options.hitRadius, pointStyle: options.pointStyle, radius: reset ? 0 : options.radius, skip: custom.skip || isNaN(x) || isNaN(y), x: x, y: y, }; point.pivot(); }, /** * @protected */ setHoverStyle: function(point) { var model = point._model; var options = point._options; model.backgroundColor = helpers.valueOrDefault(options.hoverBackgroundColor, helpers.getHoverColor(options.backgroundColor)); model.borderColor = helpers.valueOrDefault(options.hoverBorderColor, helpers.getHoverColor(options.borderColor)); model.borderWidth = helpers.valueOrDefault(options.hoverBorderWidth, options.borderWidth); model.radius = options.radius + options.hoverRadius; }, /** * @protected */ removeHoverStyle: function(point) { var model = point._model; var options = point._options; model.backgroundColor = options.backgroundColor; model.borderColor = options.borderColor; model.borderWidth = options.borderWidth; model.radius = options.radius; }, /** * @private */ _resolveElementOptions: function(point, index) { var me = this; var chart = me.chart; var datasets = chart.data.datasets; var dataset = datasets[me.index]; var custom = point.custom || {}; var options = chart.options.elements.point; var resolve = helpers.options.resolve; var data = dataset.data[index]; var values = {}; var i, ilen, key; // Scriptable options var context = { chart: chart, dataIndex: index, dataset: dataset, datasetIndex: me.index }; var keys = [ 'backgroundColor', 'borderColor', 'borderWidth', 'hoverBackgroundColor', 'hoverBorderColor', 'hoverBorderWidth', 'hoverRadius', 'hitRadius', 'pointStyle' ]; for (i = 0, ilen = keys.length; i < ilen; ++i) { key = keys[i]; values[key] = resolve([ custom[key], dataset[key], options[key] ], context, index); } // Custom radius resolution values.radius = resolve([ custom.radius, data ? data.r : undefined, dataset.radius, options.radius ], context, index); return values; } }); }; /***/ }), /***/ "./node_modules/chart.js/src/controllers/controller.doughnut.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; var defaults = __webpack_require__("./node_modules/chart.js/src/core/core.defaults.js"); var elements = __webpack_require__("./node_modules/chart.js/src/elements/index.js"); var helpers = __webpack_require__("./node_modules/chart.js/src/helpers/index.js"); defaults._set('doughnut', { animation: { // Boolean - Whether we animate the rotation of the Doughnut animateRotate: true, // Boolean - Whether we animate scaling the Doughnut from the centre animateScale: false }, hover: { mode: 'single' }, legendCallback: function(chart) { var text = []; text.push('<ul class="' + chart.id + '-legend">'); var data = chart.data; var datasets = data.datasets; var labels = data.labels; if (datasets.length) { for (var i = 0; i < datasets[0].data.length; ++i) { text.push('<li><span style="background-color:' + datasets[0].backgroundColor[i] + '"></span>'); if (labels[i]) { text.push(labels[i]); } text.push('</li>'); } } text.push('</ul>'); return text.join(''); }, legend: { labels: { generateLabels: function(chart) { var data = chart.data; if (data.labels.length && data.datasets.length) { return data.labels.map(function(label, i) { var meta = chart.getDatasetMeta(0); var ds = data.datasets[0]; var arc = meta.data[i]; var custom = arc && arc.custom || {}; var valueAtIndexOrDefault = helpers.valueAtIndexOrDefault; var arcOpts = chart.options.elements.arc; var fill = custom.backgroundColor ? custom.backgroundColor : valueAtIndexOrDefault(ds.backgroundColor, i, arcOpts.backgroundColor); var stroke = custom.borderColor ? custom.borderColor : valueAtIndexOrDefault(ds.borderColor, i, arcOpts.borderColor); var bw = custom.borderWidth ? custom.borderWidth : valueAtIndexOrDefault(ds.borderWidth, i, arcOpts.borderWidth); return { text: label, fillStyle: fill, strokeStyle: stroke, lineWidth: bw, hidden: isNaN(ds.data[i]) || meta.data[i].hidden, // Extra data used for toggling the correct item index: i }; }); } return []; } }, onClick: function(e, legendItem) { var index = legendItem.index; var chart = this.chart; var i, ilen, meta; for (i = 0, ilen = (chart.data.datasets || []).length; i < ilen; ++i) { meta = chart.getDatasetMeta(i); // toggle visibility of index if exists if (meta.data[index]) { meta.data[index].hidden = !meta.data[index].hidden; } } chart.update(); } }, // The percentage of the chart that we cut out of the middle. cutoutPercentage: 50, // The rotation of the chart, where the first data arc begins. rotation: Math.PI * -0.5, // The total circumference of the chart. circumference: Math.PI * 2.0, // Need to override these to give a nice default tooltips: { callbacks: { title: function() { return ''; }, label: function(tooltipItem, data) { var dataLabel = data.labels[tooltipItem.index]; var value = ': ' + data.datasets[tooltipItem.datasetIndex].data[tooltipItem.index]; if (helpers.isArray(dataLabel)) { // show value on first line of multiline label // need to clone because we are changing the value dataLabel = dataLabel.slice(); dataLabel[0] += value; } else { dataLabel += value; } return dataLabel; } } } }); defaults._set('pie', helpers.clone(defaults.doughnut)); defaults._set('pie', { cutoutPercentage: 0 }); module.exports = function(Chart) { Chart.controllers.doughnut = Chart.controllers.pie = Chart.DatasetController.extend({ dataElementType: elements.Arc, linkScales: helpers.noop, // Get index of the dataset in relation to the visible datasets. This allows determining the inner and outer radius correctly getRingIndex: function(datasetIndex) { var ringIndex = 0; for (var j = 0; j < datasetIndex; ++j) { if (this.chart.isDatasetVisible(j)) { ++ringIndex; } } return ringIndex; }, update: function(reset) { var me = this; var chart = me.chart; var chartArea = chart.chartArea; var opts = chart.options; var arcOpts = opts.elements.arc; var availableWidth = chartArea.right - chartArea.left - arcOpts.borderWidth; var availableHeight = chartArea.bottom - chartArea.top - arcOpts.borderWidth; var minSize = Math.min(availableWidth, availableHeight); var offset = {x: 0, y: 0}; var meta = me.getMeta(); var cutoutPercentage = opts.cutoutPercentage; var circumference = opts.circumference; // If the chart's circumference isn't a full circle, calculate minSize as a ratio of the width/height of the arc if (circumference < Math.PI * 2.0) { var startAngle = opts.rotation % (Math.PI * 2.0); startAngle += Math.PI * 2.0 * (startAngle >= Math.PI ? -1 : startAngle < -Math.PI ? 1 : 0); var endAngle = startAngle + circumference; var start = {x: Math.cos(startAngle), y: Math.sin(startAngle)}; var end = {x: Math.cos(endAngle), y: Math.sin(endAngle)}; var contains0 = (startAngle <= 0 && endAngle >= 0) || (startAngle <= Math.PI * 2.0 && Math.PI * 2.0 <= endAngle); var contains90 = (startAngle <= Math.PI * 0.5 && Math.PI * 0.5 <= endAngle) || (startAngle <= Math.PI * 2.5 && Math.PI * 2.5 <= endAngle); var contains180 = (startAngle <= -Math.PI && -Math.PI <= endAngle) || (startAngle <= Math.PI && Math.PI <= endAngle); var contains270 = (startAngle <= -Math.PI * 0.5 && -Math.PI * 0.5 <= endAngle) || (startAngle <= Math.PI * 1.5 && Math.PI * 1.5 <= endAngle); var cutout = cutoutPercentage / 100.0; var min = {x: contains180 ? -1 : Math.min(start.x * (start.x < 0 ? 1 : cutout), end.x * (end.x < 0 ? 1 : cutout)), y: contains270 ? -1 : Math.min(start.y * (start.y < 0 ? 1 : cutout), end.y * (end.y < 0 ? 1 : cutout))}; var max = {x: contains0 ? 1 : Math.max(start.x * (start.x > 0 ? 1 : cutout), end.x * (end.x > 0 ? 1 : cutout)), y: contains90 ? 1 : Math.max(start.y * (start.y > 0 ? 1 : cutout), end.y * (end.y > 0 ? 1 : cutout))}; var size = {width: (max.x - min.x) * 0.5, height: (max.y - min.y) * 0.5}; minSize = Math.min(availableWidth / size.width, availableHeight / size.height); offset = {x: (max.x + min.x) * -0.5, y: (max.y + min.y) * -0.5}; } chart.borderWidth = me.getMaxBorderWidth(meta.data); chart.outerRadius = Math.max((minSize - chart.borderWidth) / 2, 0); chart.innerRadius = Math.max(cutoutPercentage ? (chart.outerRadius / 100) * (cutoutPercentage) : 0, 0); chart.radiusLength = (chart.outerRadius - chart.innerRadius) / chart.getVisibleDatasetCount(); chart.offsetX = offset.x * chart.outerRadius; chart.offsetY = offset.y * chart.outerRadius; meta.total = me.calculateTotal(); me.outerRadius = chart.outerRadius - (chart.radiusLength * me.getRingIndex(me.index)); me.innerRadius = Math.max(me.outerRadius - chart.radiusLength, 0); helpers.each(meta.data, function(arc, index) { me.updateElement(arc, index, reset); }); }, updateElement: function(arc, index, reset) { var me = this; var chart = me.chart; var chartArea = chart.chartArea; var opts = chart.options; var animationOpts = opts.animation; var centerX = (chartArea.left + chartArea.right) / 2; var centerY = (chartArea.top + chartArea.bottom) / 2; var startAngle = opts.rotation; // non reset case handled later var endAngle = opts.rotation; // non reset case handled later var dataset = me.getDataset(); var circumference = reset && animationOpts.animateRotate ? 0 : arc.hidden ? 0 : me.calculateCircumference(dataset.data[index]) * (opts.circumference / (2.0 * Math.PI)); var innerRadius = reset && animationOpts.animateScale ? 0 : me.innerRadius; var outerRadius = reset && animationOpts.animateScale ? 0 : me.outerRadius; var valueAtIndexOrDefault = helpers.valueAtIndexOrDefault; helpers.extend(arc, { // Utility _datasetIndex: me.index, _index: index, // Desired view properties _model: { x: centerX + chart.offsetX, y: centerY + chart.offsetY, startAngle: startAngle, endAngle: endAngle, circumference: circumference, outerRadius: outerRadius, innerRadius: innerRadius, label: valueAtIndexOrDefault(dataset.label, index, chart.data.labels[index]) } }); var model = arc._model; // Resets the visual styles this.removeHoverStyle(arc); // Set correct angles if not resetting if (!reset || !animationOpts.animateRotate) { if (index === 0) { model.startAngle = opts.rotation; } else { model.startAngle = me.getMeta().data[index - 1]._model.endAngle; } model.endAngle = model.startAngle + model.circumference; } arc.pivot(); }, removeHoverStyle: function(arc) { Chart.DatasetController.prototype.removeHoverStyle.call(this, arc, this.chart.options.elements.arc); }, calculateTotal: function() { var dataset = this.getDataset(); var meta = this.getMeta(); var total = 0; var value; helpers.each(meta.data, function(element, index) { value = dataset.data[index]; if (!isNaN(value) && !element.hidden) { total += Math.abs(value); } }); /* if (total === 0) { total = NaN; }*/ return total; }, calculateCircumference: function(value) { var total = this.getMeta().total; if (total > 0 && !isNaN(value)) { return (Math.PI * 2.0) * (Math.abs(value) / total); } return 0; }, // gets the max border or hover width to properly scale pie charts getMaxBorderWidth: function(arcs) { var max = 0; var index = this.index; var length = arcs.length; var borderWidth; var hoverWidth; for (var i = 0; i < length; i++) { borderWidth = arcs[i]._model ? arcs[i]._model.borderWidth : 0; hoverWidth = arcs[i]._chart ? arcs[i]._chart.config.data.datasets[index].hoverBorderWidth : 0; max = borderWidth > max ? borderWidth : max; max = hoverWidth > max ? hoverWidth : max; } return max; } }); }; /***/ }), /***/ "./node_modules/chart.js/src/controllers/controller.line.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; var defaults = __webpack_require__("./node_modules/chart.js/src/core/core.defaults.js"); var elements = __webpack_require__("./node_modules/chart.js/src/elements/index.js"); var helpers = __webpack_require__("./node_modules/chart.js/src/helpers/index.js"); defaults._set('line', { showLines: true, spanGaps: false, hover: { mode: 'label' }, scales: { xAxes: [{ type: 'category', id: 'x-axis-0' }], yAxes: [{ type: 'linear', id: 'y-axis-0' }] } }); module.exports = function(Chart) { function lineEnabled(dataset, options) { return helpers.valueOrDefault(dataset.showLine, options.showLines); } Chart.controllers.line = Chart.DatasetController.extend({ datasetElementType: elements.Line, dataElementType: elements.Point, update: function(reset) { var me = this; var meta = me.getMeta(); var line = meta.dataset; var points = meta.data || []; var options = me.chart.options; var lineElementOptions = options.elements.line; var scale = me.getScaleForId(meta.yAxisID); var i, ilen, custom; var dataset = me.getDataset(); var showLine = lineEnabled(dataset, options); // Update Line if (showLine) { custom = line.custom || {}; // Compatibility: If the properties are defined with only the old name, use those values if ((dataset.tension !== undefined) && (dataset.lineTension === undefined)) { dataset.lineTension = dataset.tension; } // Utility line._scale = scale; line._datasetIndex = me.index; // Data line._children = points; // Model line._model = { // Appearance // The default behavior of lines is to break at null values, according // to https://github.com/chartjs/Chart.js/issues/2435#issuecomment-216718158 // This option gives lines the ability to span gaps spanGaps: dataset.spanGaps ? dataset.spanGaps : options.spanGaps, tension: custom.tension ? custom.tension : helpers.valueOrDefault(dataset.lineTension, lineElementOptions.tension), backgroundColor: custom.backgroundColor ? custom.backgroundColor : (dataset.backgroundColor || lineElementOptions.backgroundColor), borderWidth: custom.borderWidth ? custom.borderWidth : (dataset.borderWidth || lineElementOptions.borderWidth), borderColor: custom.borderColor ? custom.borderColor : (dataset.borderColor || lineElementOptions.borderColor), borderCapStyle: custom.borderCapStyle ? custom.borderCapStyle : (dataset.borderCapStyle || lineElementOptions.borderCapStyle), borderDash: custom.borderDash ? custom.borderDash : (dataset.borderDash || lineElementOptions.borderDash), borderDashOffset: custom.borderDashOffset ? custom.borderDashOffset : (dataset.borderDashOffset || lineElementOptions.borderDashOffset), borderJoinStyle: custom.borderJoinStyle ? custom.borderJoinStyle : (dataset.borderJoinStyle || lineElementOptions.borderJoinStyle), fill: custom.fill ? custom.fill : (dataset.fill !== undefined ? dataset.fill : lineElementOptions.fill), steppedLine: custom.steppedLine ? custom.steppedLine : helpers.valueOrDefault(dataset.steppedLine, lineElementOptions.stepped), cubicInterpolationMode: custom.cubicInterpolationMode ? custom.cubicInterpolationMode : helpers.valueOrDefault(dataset.cubicInterpolationMode, lineElementOptions.cubicInterpolationMode), }; line.pivot(); } // Update Points for (i = 0, ilen = points.length; i < ilen; ++i) { me.updateElement(points[i], i, reset); } if (showLine && line._model.tension !== 0) { me.updateBezierControlPoints(); } // Now pivot the point for animation for (i = 0, ilen = points.length; i < ilen; ++i) { points[i].pivot(); } }, getPointBackgroundColor: function(point, index) { var backgroundColor = this.chart.options.elements.point.backgroundColor; var dataset = this.getDataset(); var custom = point.custom || {}; if (custom.backgroundColor) { backgroundColor = custom.backgroundColor; } else if (dataset.pointBackgroundColor) { backgroundColor = helpers.valueAtIndexOrDefault(dataset.pointBackgroundColor, index, backgroundColor); } else if (dataset.backgroundColor) { backgroundColor = dataset.backgroundColor; } return backgroundColor; }, getPointBorderColor: function(point, index) { var borderColor = this.chart.options.elements.point.borderColor; var dataset = this.getDataset(); var custom = point.custom || {}; if (custom.borderColor) { borderColor = custom.borderColor; } else if (dataset.pointBorderColor) { borderColor = helpers.valueAtIndexOrDefault(dataset.pointBorderColor, index, borderColor); } else if (dataset.borderColor) { borderColor = dataset.borderColor; } return borderColor; }, getPointBorderWidth: function(point, index) { var borderWidth = this.chart.options.elements.point.borderWidth; var dataset = this.getDataset(); var custom = point.custom || {}; if (!isNaN(custom.borderWidth)) { borderWidth = custom.borderWidth; } else if (!isNaN(dataset.pointBorderWidth) || helpers.isArray(dataset.pointBorderWidth)) { borderWidth = helpers.valueAtIndexOrDefault(dataset.pointBorderWidth, index, borderWidth); } else if (!isNaN(dataset.borderWidth)) { borderWidth = dataset.borderWidth; } return borderWidth; }, updateElement: function(point, index, reset) { var me = this; var meta = me.getMeta(); var custom = point.custom || {}; var dataset = me.getDataset(); var datasetIndex = me.index; var value = dataset.data[index]; var yScale = me.getScaleForId(meta.yAxisID); var xScale = me.getScaleForId(meta.xAxisID); var pointOptions = me.chart.options.elements.point; var x, y; // Compatibility: If the properties are defined with only the old name, use those values if ((dataset.radius !== undefined) && (dataset.pointRadius === undefined)) { dataset.pointRadius = dataset.radius; } if ((dataset.hitRadius !== undefined) && (dataset.pointHitRadius === undefined)) { dataset.pointHitRadius = dataset.hitRadius; } x = xScale.getPixelForValue(typeof value === 'object' ? value : NaN, index, datasetIndex); y = reset ? yScale.getBasePixel() : me.calculatePointY(value, index, datasetIndex); // Utility point._xScale = xScale; point._yScale = yScale; point._datasetIndex = datasetIndex; point._index = index; // Desired view properties point._model = { x: x, y: y, skip: custom.skip || isNaN(x) || isNaN(y), // Appearance radius: custom.radius || helpers.valueAtIndexOrDefault(dataset.pointRadius, index, pointOptions.radius), pointStyle: custom.pointStyle || helpers.valueAtIndexOrDefault(dataset.pointStyle, index, pointOptions.pointStyle), backgroundColor: me.getPointBackgroundColor(point, index), borderColor: me.getPointBorderColor(point, index), borderWidth: me.getPointBorderWidth(point, index), tension: meta.dataset._model ? meta.dataset._model.tension : 0, steppedLine: meta.dataset._model ? meta.dataset._model.steppedLine : false, // Tooltip hitRadius: custom.hitRadius || helpers.valueAtIndexOrDefault(dataset.pointHitRadius, index, pointOptions.hitRadius) }; }, calculatePointY: function(value, index, datasetIndex) { var me = this; var chart = me.chart; var meta = me.getMeta(); var yScale = me.getScaleForId(meta.yAxisID); var sumPos = 0; var sumNeg = 0; var i, ds, dsMeta; if (yScale.options.stacked) { for (i = 0; i < datasetIndex; i++) { ds = chart.data.datasets[i]; dsMeta = chart.getDatasetMeta(i); if (dsMeta.type === 'line' && dsMeta.yAxisID === yScale.id && chart.isDatasetVisible(i)) { var stackedRightValue = Number(yScale.getRightValue(ds.data[index])); if (stackedRightValue < 0) { sumNeg += stackedRightValue || 0; } else { sumPos += stackedRightValue || 0; } } } var rightValue = Number(yScale.getRightValue(value)); if (rightValue < 0) { return yScale.getPixelForValue(sumNeg + rightValue); } return yScale.getPixelForValue(sumPos + rightValue); } return yScale.getPixelForValue(value); }, updateBezierControlPoints: function() { var me = this; var meta = me.getMeta(); var area = me.chart.chartArea; var points = (meta.data || []); var i, ilen, point, model, controlPoints; // Only consider points that are drawn in case the spanGaps option is used if (meta.dataset._model.spanGaps) { points = points.filter(function(pt) { return !pt._model.skip; }); } function capControlPoint(pt, min, max) { return Math.max(Math.min(pt, max), min); } if (meta.dataset._model.cubicInterpolationMode === 'monotone') { helpers.splineCurveMonotone(points); } else { for (i = 0, ilen = points.length; i < ilen; ++i) { point = points[i]; model = point._model; controlPoints = helpers.splineCurve( helpers.previousItem(points, i)._model, model, helpers.nextItem(points, i)._model, meta.dataset._model.tension ); model.controlPointPreviousX = controlPoints.previous.x; model.controlPointPreviousY = controlPoints.previous.y; model.controlPointNextX = controlPoints.next.x; model.controlPointNextY = controlPoints.next.y; } } if (me.chart.options.elements.line.capBezierPoints) { for (i = 0, ilen = points.length; i < ilen; ++i) { model = points[i]._model; model.controlPointPreviousX = capControlPoint(model.controlPointPreviousX, area.left, area.right); model.controlPointPreviousY = capControlPoint(model.controlPointPreviousY, area.top, area.bottom); model.controlPointNextX = capControlPoint(model.controlPointNextX, area.left, area.right); model.controlPointNextY = capControlPoint(model.controlPointNextY, area.top, area.bottom); } } }, draw: function() { var me = this; var chart = me.chart; var meta = me.getMeta(); var points = meta.data || []; var area = chart.chartArea; var ilen = points.length; var i = 0; helpers.canvas.clipArea(chart.ctx, area); if (lineEnabled(me.getDataset(), chart.options)) { meta.dataset.draw(); } helpers.canvas.unclipArea(chart.ctx); // Draw the points for (; i < ilen; ++i) { points[i].draw(area); } }, setHoverStyle: function(point) { // Point var dataset = this.chart.data.datasets[point._datasetIndex]; var index = point._index; var custom = point.custom || {}; var model = point._model; model.radius = custom.hoverRadius || helpers.valueAtIndexOrDefault(dataset.pointHoverRadius, index, this.chart.options.elements.point.hoverRadius); model.backgroundColor = custom.hoverBackgroundColor || helpers.valueAtIndexOrDefault(dataset.pointHoverBackgroundColor, index, helpers.getHoverColor(model.backgroundColor)); model.borderColor = custom.hoverBorderColor || helpers.valueAtIndexOrDefault(dataset.pointHoverBorderColor, index, helpers.getHoverColor(model.borderColor)); model.borderWidth = custom.hoverBorderWidth || helpers.valueAtIndexOrDefault(dataset.pointHoverBorderWidth, index, model.borderWidth); }, removeHoverStyle: function(point) { var me = this; var dataset = me.chart.data.datasets[point._datasetIndex]; var index = point._index; var custom = point.custom || {}; var model = point._model; // Compatibility: If the properties are defined with only the old name, use those values if ((dataset.radius !== undefined) && (dataset.pointRadius === undefined)) { dataset.pointRadius = dataset.radius; } model.radius = custom.radius || helpers.valueAtIndexOrDefault(dataset.pointRadius, index, me.chart.options.elements.point.radius); model.backgroundColor = me.getPointBackgroundColor(point, index); model.borderColor = me.getPointBorderColor(point, index); model.borderWidth = me.getPointBorderWidth(point, index); } }); }; /***/ }), /***/ "./node_modules/chart.js/src/controllers/controller.polarArea.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; var defaults = __webpack_require__("./node_modules/chart.js/src/core/core.defaults.js"); var elements = __webpack_require__("./node_modules/chart.js/src/elements/index.js"); var helpers = __webpack_require__("./node_modules/chart.js/src/helpers/index.js"); defaults._set('polarArea', { scale: { type: 'radialLinear', angleLines: { display: false }, gridLines: { circular: true }, pointLabels: { display: false }, ticks: { beginAtZero: true } }, // Boolean - Whether to animate the rotation of the chart animation: { animateRotate: true, animateScale: true }, startAngle: -0.5 * Math.PI, legendCallback: function(chart) { var text = []; text.push('<ul class="' + chart.id + '-legend">'); var data = chart.data; var datasets = data.datasets; var labels = data.labels; if (datasets.length) { for (var i = 0; i < datasets[0].data.length; ++i) { text.push('<li><span style="background-color:' + datasets[0].backgroundColor[i] + '"></span>'); if (labels[i]) { text.push(labels[i]); } text.push('</li>'); } } text.push('</ul>'); return text.join(''); }, legend: { labels: { generateLabels: function(chart) { var data = chart.data; if (data.labels.length && data.datasets.length) { return data.labels.map(function(label, i) { var meta = chart.getDatasetMeta(0); var ds = data.datasets[0]; var arc = meta.data[i]; var custom = arc.custom || {}; var valueAtIndexOrDefault = helpers.valueAtIndexOrDefault; var arcOpts = chart.options.elements.arc; var fill = custom.backgroundColor ? custom.backgroundColor : valueAtIndexOrDefault(ds.backgroundColor, i, arcOpts.backgroundColor); var stroke = custom.borderColor ? custom.borderColor : valueAtIndexOrDefault(ds.borderColor, i, arcOpts.borderColor); var bw = custom.borderWidth ? custom.borderWidth : valueAtIndexOrDefault(ds.borderWidth, i, arcOpts.borderWidth); return { text: label, fillStyle: fill, strokeStyle: stroke, lineWidth: bw, hidden: isNaN(ds.data[i]) || meta.data[i].hidden, // Extra data used for toggling the correct item index: i }; }); } return []; } }, onClick: function(e, legendItem) { var index = legendItem.index; var chart = this.chart; var i, ilen, meta; for (i = 0, ilen = (chart.data.datasets || []).length; i < ilen; ++i) { meta = chart.getDatasetMeta(i); meta.data[index].hidden = !meta.data[index].hidden; } chart.update(); } }, // Need to override these to give a nice default tooltips: { callbacks: { title: function() { return ''; }, label: function(item, data) { return data.labels[item.index] + ': ' + item.yLabel; } } } }); module.exports = function(Chart) { Chart.controllers.polarArea = Chart.DatasetController.extend({ dataElementType: elements.Arc, linkScales: helpers.noop, update: function(reset) { var me = this; var chart = me.chart; var chartArea = chart.chartArea; var meta = me.getMeta(); var opts = chart.options; var arcOpts = opts.elements.arc; var minSize = Math.min(chartArea.right - chartArea.left, chartArea.bottom - chartArea.top); chart.outerRadius = Math.max((minSize - arcOpts.borderWidth / 2) / 2, 0); chart.innerRadius = Math.max(opts.cutoutPercentage ? (chart.outerRadius / 100) * (opts.cutoutPercentage) : 1, 0); chart.radiusLength = (chart.outerRadius - chart.innerRadius) / chart.getVisibleDatasetCount(); me.outerRadius = chart.outerRadius - (chart.radiusLength * me.index); me.innerRadius = me.outerRadius - chart.radiusLength; meta.count = me.countVisibleElements(); helpers.each(meta.data, function(arc, index) { me.updateElement(arc, index, reset); }); }, updateElement: function(arc, index, reset) { var me = this; var chart = me.chart; var dataset = me.getDataset(); var opts = chart.options; var animationOpts = opts.animation; var scale = chart.scale; var labels = chart.data.labels; var circumference = me.calculateCircumference(dataset.data[index]); var centerX = scale.xCenter; var centerY = scale.yCenter; // If there is NaN data before us, we need to calculate the starting angle correctly. // We could be way more efficient here, but its unlikely that the polar area chart will have a lot of data var visibleCount = 0; var meta = me.getMeta(); for (var i = 0; i < index; ++i) { if (!isNaN(dataset.data[i]) && !meta.data[i].hidden) { ++visibleCount; } } // var negHalfPI = -0.5 * Math.PI; var datasetStartAngle = opts.startAngle; var distance = arc.hidden ? 0 : scale.getDistanceFromCenterForValue(dataset.data[index]); var startAngle = datasetStartAngle + (circumference * visibleCount); var endAngle = startAngle + (arc.hidden ? 0 : circumference); var resetRadius = animationOpts.animateScale ? 0 : scale.getDistanceFromCenterForValue(dataset.data[index]); helpers.extend(arc, { // Utility _datasetIndex: me.index, _index: index, _scale: scale, // Desired view properties _model: { x: centerX, y: centerY, innerRadius: 0, outerRadius: reset ? resetRadius : distance, startAngle: reset && animationOpts.animateRotate ? datasetStartAngle : startAngle, endAngle: reset && animationOpts.animateRotate ? datasetStartAngle : endAngle, label: helpers.valueAtIndexOrDefault(labels, index, labels[index]) } }); // Apply border and fill style me.removeHoverStyle(arc); arc.pivot(); }, removeHoverStyle: function(arc) { Chart.DatasetController.prototype.removeHoverStyle.call(this, arc, this.chart.options.elements.arc); }, countVisibleElements: function() { var dataset = this.getDataset(); var meta = this.getMeta(); var count = 0; helpers.each(meta.data, function(element, index) { if (!isNaN(dataset.data[index]) && !element.hidden) { count++; } }); return count; }, calculateCircumference: function(value) { var count = this.getMeta().count; if (count > 0 && !isNaN(value)) { return (2 * Math.PI) / count; } return 0; } }); }; /***/ }), /***/ "./node_modules/chart.js/src/controllers/controller.radar.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; var defaults = __webpack_require__("./node_modules/chart.js/src/core/core.defaults.js"); var elements = __webpack_require__("./node_modules/chart.js/src/elements/index.js"); var helpers = __webpack_require__("./node_modules/chart.js/src/helpers/index.js"); defaults._set('radar', { scale: { type: 'radialLinear' }, elements: { line: { tension: 0 // no bezier in radar } } }); module.exports = function(Chart) { Chart.controllers.radar = Chart.DatasetController.extend({ datasetElementType: elements.Line, dataElementType: elements.Point, linkScales: helpers.noop, update: function(reset) { var me = this; var meta = me.getMeta(); var line = meta.dataset; var points = meta.data; var custom = line.custom || {}; var dataset = me.getDataset(); var lineElementOptions = me.chart.options.elements.line; var scale = me.chart.scale; // Compatibility: If the properties are defined with only the old name, use those values if ((dataset.tension !== undefined) && (dataset.lineTension === undefined)) { dataset.lineTension = dataset.tension; } helpers.extend(meta.dataset, { // Utility _datasetIndex: me.index, _scale: scale, // Data _children: points, _loop: true, // Model _model: { // Appearance tension: custom.tension ? custom.tension : helpers.valueOrDefault(dataset.lineTension, lineElementOptions.tension), backgroundColor: custom.backgroundColor ? custom.backgroundColor : (dataset.backgroundColor || lineElementOptions.backgroundColor), borderWidth: custom.borderWidth ? custom.borderWidth : (dataset.borderWidth || lineElementOptions.borderWidth), borderColor: custom.borderColor ? custom.borderColor : (dataset.borderColor || lineElementOptions.borderColor), fill: custom.fill ? custom.fill : (dataset.fill !== undefined ? dataset.fill : lineElementOptions.fill), borderCapStyle: custom.borderCapStyle ? custom.borderCapStyle : (dataset.borderCapStyle || lineElementOptions.borderCapStyle), borderDash: custom.borderDash ? custom.borderDash : (dataset.borderDash || lineElementOptions.borderDash), borderDashOffset: custom.borderDashOffset ? custom.borderDashOffset : (dataset.borderDashOffset || lineElementOptions.borderDashOffset), borderJoinStyle: custom.borderJoinStyle ? custom.borderJoinStyle : (dataset.borderJoinStyle || lineElementOptions.borderJoinStyle), } }); meta.dataset.pivot(); // Update Points helpers.each(points, function(point, index) { me.updateElement(point, index, reset); }, me); // Update bezier control points me.updateBezierControlPoints(); }, updateElement: function(point, index, reset) { var me = this; var custom = point.custom || {}; var dataset = me.getDataset(); var scale = me.chart.scale; var pointElementOptions = me.chart.options.elements.point; var pointPosition = scale.getPointPositionForValue(index, dataset.data[index]); // Compatibility: If the properties are defined with only the old name, use those values if ((dataset.radius !== undefined) && (dataset.pointRadius === undefined)) { dataset.pointRadius = dataset.radius; } if ((dataset.hitRadius !== undefined) && (dataset.pointHitRadius === undefined)) { dataset.pointHitRadius = dataset.hitRadius; } helpers.extend(point, { // Utility _datasetIndex: me.index, _index: index, _scale: scale, // Desired view properties _model: { x: reset ? scale.xCenter : pointPosition.x, // value not used in dataset scale, but we want a consistent API between scales y: reset ? scale.yCenter : pointPosition.y, // Appearance tension: custom.tension ? custom.tension : helpers.valueOrDefault(dataset.lineTension, me.chart.options.elements.line.tension), radius: custom.radius ? custom.radius : helpers.valueAtIndexOrDefault(dataset.pointRadius, index, pointElementOptions.radius), backgroundColor: custom.backgroundColor ? custom.backgroundColor : helpers.valueAtIndexOrDefault(dataset.pointBackgroundColor, index, pointElementOptions.backgroundColor), borderColor: custom.borderColor ? custom.borderColor : helpers.valueAtIndexOrDefault(dataset.pointBorderColor, index, pointElementOptions.borderColor), borderWidth: custom.borderWidth ? custom.borderWidth : helpers.valueAtIndexOrDefault(dataset.pointBorderWidth, index, pointElementOptions.borderWidth), pointStyle: custom.pointStyle ? custom.pointStyle : helpers.valueAtIndexOrDefault(dataset.pointStyle, index, pointElementOptions.pointStyle), // Tooltip hitRadius: custom.hitRadius ? custom.hitRadius : helpers.valueAtIndexOrDefault(dataset.pointHitRadius, index, pointElementOptions.hitRadius) } }); point._model.skip = custom.skip ? custom.skip : (isNaN(point._model.x) || isNaN(point._model.y)); }, updateBezierControlPoints: function() { var chartArea = this.chart.chartArea; var meta = this.getMeta(); helpers.each(meta.data, function(point, index) { var model = point._model; var controlPoints = helpers.splineCurve( helpers.previousItem(meta.data, index, true)._model, model, helpers.nextItem(meta.data, index, true)._model, model.tension ); // Prevent the bezier going outside of the bounds of the graph model.controlPointPreviousX = Math.max(Math.min(controlPoints.previous.x, chartArea.right), chartArea.left); model.controlPointPreviousY = Math.max(Math.min(controlPoints.previous.y, chartArea.bottom), chartArea.top); model.controlPointNextX = Math.max(Math.min(controlPoints.next.x, chartArea.right), chartArea.left); model.controlPointNextY = Math.max(Math.min(controlPoints.next.y, chartArea.bottom), chartArea.top); // Now pivot the point for animation point.pivot(); }); }, setHoverStyle: function(point) { // Point var dataset = this.chart.data.datasets[point._datasetIndex]; var custom = point.custom || {}; var index = point._index; var model = point._model; model.radius = custom.hoverRadius ? custom.hoverRadius : helpers.valueAtIndexOrDefault(dataset.pointHoverRadius, index, this.chart.options.elements.point.hoverRadius); model.backgroundColor = custom.hoverBackgroundColor ? custom.hoverBackgroundColor : helpers.valueAtIndexOrDefault(dataset.pointHoverBackgroundColor, index, helpers.getHoverColor(model.backgroundColor)); model.borderColor = custom.hoverBorderColor ? custom.hoverBorderColor : helpers.valueAtIndexOrDefault(dataset.pointHoverBorderColor, index, helpers.getHoverColor(model.borderColor)); model.borderWidth = custom.hoverBorderWidth ? custom.hoverBorderWidth : helpers.valueAtIndexOrDefault(dataset.pointHoverBorderWidth, index, model.borderWidth); }, removeHoverStyle: function(point) { var dataset = this.chart.data.datasets[point._datasetIndex]; var custom = point.custom || {}; var index = point._index; var model = point._model; var pointElementOptions = this.chart.options.elements.point; model.radius = custom.radius ? custom.radius : helpers.valueAtIndexOrDefault(dataset.pointRadius, index, pointElementOptions.radius); model.backgroundColor = custom.backgroundColor ? custom.backgroundColor : helpers.valueAtIndexOrDefault(dataset.pointBackgroundColor, index, pointElementOptions.backgroundColor); model.borderColor = custom.borderColor ? custom.borderColor : helpers.valueAtIndexOrDefault(dataset.pointBorderColor, index, pointElementOptions.borderColor); model.borderWidth = custom.borderWidth ? custom.borderWidth : helpers.valueAtIndexOrDefault(dataset.pointBorderWidth, index, pointElementOptions.borderWidth); } }); }; /***/ }), /***/ "./node_modules/chart.js/src/controllers/controller.scatter.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; var defaults = __webpack_require__("./node_modules/chart.js/src/core/core.defaults.js"); defaults._set('scatter', { hover: { mode: 'single' }, scales: { xAxes: [{ id: 'x-axis-1', // need an ID so datasets can reference the scale type: 'linear', // scatter should not use a category axis position: 'bottom' }], yAxes: [{ id: 'y-axis-1', type: 'linear', position: 'left' }] }, showLines: false, tooltips: { callbacks: { title: function() { return ''; // doesn't make sense for scatter since data are formatted as a point }, label: function(item) { return '(' + item.xLabel + ', ' + item.yLabel + ')'; } } } }); module.exports = function(Chart) { // Scatter charts use line controllers Chart.controllers.scatter = Chart.controllers.line; }; /***/ }), /***/ "./node_modules/chart.js/src/core/core.animation.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /* global window: false */ var defaults = __webpack_require__("./node_modules/chart.js/src/core/core.defaults.js"); var Element = __webpack_require__("./node_modules/chart.js/src/core/core.element.js"); var helpers = __webpack_require__("./node_modules/chart.js/src/helpers/index.js"); defaults._set('global', { animation: { duration: 1000, easing: 'easeOutQuart', onProgress: helpers.noop, onComplete: helpers.noop } }); module.exports = function(Chart) { Chart.Animation = Element.extend({ chart: null, // the animation associated chart instance currentStep: 0, // the current animation step numSteps: 60, // default number of steps easing: '', // the easing to use for this animation render: null, // render function used by the animation service onAnimationProgress: null, // user specified callback to fire on each step of the animation onAnimationComplete: null, // user specified callback to fire when the animation finishes }); Chart.animationService = { frameDuration: 17, animations: [], dropFrames: 0, request: null, /** * @param {Chart} chart - The chart to animate. * @param {Chart.Animation} animation - The animation that we will animate. * @param {Number} duration - The animation duration in ms. * @param {Boolean} lazy - if true, the chart is not marked as animating to enable more responsive interactions */ addAnimation: function(chart, animation, duration, lazy) { var animations = this.animations; var i, ilen; animation.chart = chart; if (!lazy) { chart.animating = true; } for (i = 0, ilen = animations.length; i < ilen; ++i) { if (animations[i].chart === chart) { animations[i] = animation; return; } } animations.push(animation); // If there are no animations queued, manually kickstart a digest, for lack of a better word if (animations.length === 1) { this.requestAnimationFrame(); } }, cancelAnimation: function(chart) { var index = helpers.findIndex(this.animations, function(animation) { return animation.chart === chart; }); if (index !== -1) { this.animations.splice(index, 1); chart.animating = false; } }, requestAnimationFrame: function() { var me = this; if (me.request === null) { // Skip animation frame requests until the active one is executed. // This can happen when processing mouse events, e.g. 'mousemove' // and 'mouseout' events will trigger multiple renders. me.request = helpers.requestAnimFrame.call(window, function() { me.request = null; me.startDigest(); }); } }, /** * @private */ startDigest: function() { var me = this; var startTime = Date.now(); var framesToDrop = 0; if (me.dropFrames > 1) { framesToDrop = Math.floor(me.dropFrames); me.dropFrames = me.dropFrames % 1; } me.advance(1 + framesToDrop); var endTime = Date.now(); me.dropFrames += (endTime - startTime) / me.frameDuration; // Do we have more stuff to animate? if (me.animations.length > 0) { me.requestAnimationFrame(); } }, /** * @private */ advance: function(count) { var animations = this.animations; var animation, chart; var i = 0; while (i < animations.length) { animation = animations[i]; chart = animation.chart; animation.currentStep = (animation.currentStep || 0) + count; animation.currentStep = Math.min(animation.currentStep, animation.numSteps); helpers.callback(animation.render, [chart, animation], chart); helpers.callback(animation.onAnimationProgress, [animation], chart); if (animation.currentStep >= animation.numSteps) { helpers.callback(animation.onAnimationComplete, [animation], chart); chart.animating = false; animations.splice(i, 1); } else { ++i; } } } }; /** * Provided for backward compatibility, use Chart.Animation instead * @prop Chart.Animation#animationObject * @deprecated since version 2.6.0 * @todo remove at version 3 */ Object.defineProperty(Chart.Animation.prototype, 'animationObject', { get: function() { return this; } }); /** * Provided for backward compatibility, use Chart.Animation#chart instead * @prop Chart.Animation#chartInstance * @deprecated since version 2.6.0 * @todo remove at version 3 */ Object.defineProperty(Chart.Animation.prototype, 'chartInstance', { get: function() { return this.chart; }, set: function(value) { this.chart = value; } }); }; /***/ }), /***/ "./node_modules/chart.js/src/core/core.controller.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; var defaults = __webpack_require__("./node_modules/chart.js/src/core/core.defaults.js"); var helpers = __webpack_require__("./node_modules/chart.js/src/helpers/index.js"); var Interaction = __webpack_require__("./node_modules/chart.js/src/core/core.interaction.js"); var layouts = __webpack_require__("./node_modules/chart.js/src/core/core.layouts.js"); var platform = __webpack_require__("./node_modules/chart.js/src/platforms/platform.js"); var plugins = __webpack_require__("./node_modules/chart.js/src/core/core.plugins.js"); module.exports = function(Chart) { // Create a dictionary of chart types, to allow for extension of existing types Chart.types = {}; // Store a reference to each instance - allowing us to globally resize chart instances on window resize. // Destroy method on the chart will remove the instance of the chart from this reference. Chart.instances = {}; // Controllers available for dataset visualization eg. bar, line, slice, etc. Chart.controllers = {}; /** * Initializes the given config with global and chart default values. */ function initConfig(config) { config = config || {}; // Do NOT use configMerge() for the data object because this method merges arrays // and so would change references to labels and datasets, preventing data updates. var data = config.data = config.data || {}; data.datasets = data.datasets || []; data.labels = data.labels || []; config.options = helpers.configMerge( defaults.global, defaults[config.type], config.options || {}); return config; } /** * Updates the config of the chart * @param chart {Chart} chart to update the options for */ function updateConfig(chart) { var newOptions = chart.options; helpers.each(chart.scales, function(scale) { layouts.removeBox(chart, scale); }); newOptions = helpers.configMerge( Chart.defaults.global, Chart.defaults[chart.config.type], newOptions); chart.options = chart.config.options = newOptions; chart.ensureScalesHaveIDs(); chart.buildOrUpdateScales(); // Tooltip chart.tooltip._options = newOptions.tooltips; chart.tooltip.initialize(); } function positionIsHorizontal(position) { return position === 'top' || position === 'bottom'; } helpers.extend(Chart.prototype, /** @lends Chart */ { /** * @private */ construct: function(item, config) { var me = this; config = initConfig(config); var context = platform.acquireContext(item, config); var canvas = context && context.canvas; var height = canvas && canvas.height; var width = canvas && canvas.width; me.id = helpers.uid(); me.ctx = context; me.canvas = canvas; me.config = config; me.width = width; me.height = height; me.aspectRatio = height ? width / height : null; me.options = config.options; me._bufferedRender = false; /** * Provided for backward compatibility, Chart and Chart.Controller have been merged, * the "instance" still need to be defined since it might be called from plugins. * @prop Chart#chart * @deprecated since version 2.6.0 * @todo remove at version 3 * @private */ me.chart = me; me.controller = me; // chart.chart.controller #inception // Add the chart instance to the global namespace Chart.instances[me.id] = me; // Define alias to the config data: `chart.data === chart.config.data` Object.defineProperty(me, 'data', { get: function() { return me.config.data; }, set: function(value) { me.config.data = value; } }); if (!context || !canvas) { // The given item is not a compatible context2d element, let's return before finalizing // the chart initialization but after setting basic chart / controller properties that // can help to figure out that the chart is not valid (e.g chart.canvas !== null); // https://github.com/chartjs/Chart.js/issues/2807 console.error("Failed to create chart: can't acquire context from the given item"); return; } me.initialize(); me.update(); }, /** * @private */ initialize: function() { var me = this; // Before init plugin notification plugins.notify(me, 'beforeInit'); helpers.retinaScale(me, me.options.devicePixelRatio); me.bindEvents(); if (me.options.responsive) { // Initial resize before chart draws (must be silent to preserve initial animations). me.resize(true); } // Make sure scales have IDs and are built before we build any controllers. me.ensureScalesHaveIDs(); me.buildOrUpdateScales(); me.initToolTip(); // After init plugin notification plugins.notify(me, 'afterInit'); return me; }, clear: function() { helpers.canvas.clear(this); return this; }, stop: function() { // Stops any current animation loop occurring Chart.animationService.cancelAnimation(this); return this; }, resize: function(silent) { var me = this; var options = me.options; var canvas = me.canvas; var aspectRatio = (options.maintainAspectRatio && me.aspectRatio) || null; // the canvas render width and height will be casted to integers so make sure that // the canvas display style uses the same integer values to avoid blurring effect. // Set to 0 instead of canvas.size because the size defaults to 300x150 if the element is collased var newWidth = Math.max(0, Math.floor(helpers.getMaximumWidth(canvas))); var newHeight = Math.max(0, Math.floor(aspectRatio ? newWidth / aspectRatio : helpers.getMaximumHeight(canvas))); if (me.width === newWidth && me.height === newHeight) { return; } canvas.width = me.width = newWidth; canvas.height = me.height = newHeight; canvas.style.width = newWidth + 'px'; canvas.style.height = newHeight + 'px'; helpers.retinaScale(me, options.devicePixelRatio); if (!silent) { // Notify any plugins about the resize var newSize = {width: newWidth, height: newHeight}; plugins.notify(me, 'resize', [newSize]); // Notify of resize if (me.options.onResize) { me.options.onResize(me, newSize); } me.stop(); me.update(me.options.responsiveAnimationDuration); } }, ensureScalesHaveIDs: function() { var options = this.options; var scalesOptions = options.scales || {}; var scaleOptions = options.scale; helpers.each(scalesOptions.xAxes, function(xAxisOptions, index) { xAxisOptions.id = xAxisOptions.id || ('x-axis-' + index); }); helpers.each(scalesOptions.yAxes, function(yAxisOptions, index) { yAxisOptions.id = yAxisOptions.id || ('y-axis-' + index); }); if (scaleOptions) { scaleOptions.id = scaleOptions.id || 'scale'; } }, /** * Builds a map of scale ID to scale object for future lookup. */ buildOrUpdateScales: function() { var me = this; var options = me.options; var scales = me.scales || {}; var items = []; var updated = Object.keys(scales).reduce(function(obj, id) { obj[id] = false; return obj; }, {}); if (options.scales) { items = items.concat( (options.scales.xAxes || []).map(function(xAxisOptions) { return {options: xAxisOptions, dtype: 'category', dposition: 'bottom'}; }), (options.scales.yAxes || []).map(function(yAxisOptions) { return {options: yAxisOptions, dtype: 'linear', dposition: 'left'}; }) ); } if (options.scale) { items.push({ options: options.scale, dtype: 'radialLinear', isDefault: true, dposition: 'chartArea' }); } helpers.each(items, function(item) { var scaleOptions = item.options; var id = scaleOptions.id; var scaleType = helpers.valueOrDefault(scaleOptions.type, item.dtype); if (positionIsHorizontal(scaleOptions.position) !== positionIsHorizontal(item.dposition)) { scaleOptions.position = item.dposition; } updated[id] = true; var scale = null; if (id in scales && scales[id].type === scaleType) { scale = scales[id]; scale.options = scaleOptions; scale.ctx = me.ctx; scale.chart = me; } else { var scaleClass = Chart.scaleService.getScaleConstructor(scaleType); if (!scaleClass) { return; } scale = new scaleClass({ id: id, type: scaleType, options: scaleOptions, ctx: me.ctx, chart: me }); scales[scale.id] = scale; } scale.mergeTicksOptions(); // TODO(SB): I think we should be able to remove this custom case (options.scale) // and consider it as a regular scale part of the "scales"" map only! This would // make the logic easier and remove some useless? custom code. if (item.isDefault) { me.scale = scale; } }); // clear up discarded scales helpers.each(updated, function(hasUpdated, id) { if (!hasUpdated) { delete scales[id]; } }); me.scales = scales; Chart.scaleService.addScalesToLayout(this); }, buildOrUpdateControllers: function() { var me = this; var types = []; var newControllers = []; helpers.each(me.data.datasets, function(dataset, datasetIndex) { var meta = me.getDatasetMeta(datasetIndex); var type = dataset.type || me.config.type; if (meta.type && meta.type !== type) { me.destroyDatasetMeta(datasetIndex); meta = me.getDatasetMeta(datasetIndex); } meta.type = type; types.push(meta.type); if (meta.controller) { meta.controller.updateIndex(datasetIndex); meta.controller.linkScales(); } else { var ControllerClass = Chart.controllers[meta.type]; if (ControllerClass === undefined) { throw new Error('"' + meta.type + '" is not a chart type.'); } meta.controller = new ControllerClass(me, datasetIndex); newControllers.push(meta.controller); } }, me); return newControllers; }, /** * Reset the elements of all datasets * @private */ resetElements: function() { var me = this; helpers.each(me.data.datasets, function(dataset, datasetIndex) { me.getDatasetMeta(datasetIndex).controller.reset(); }, me); }, /** * Resets the chart back to it's state before the initial animation */ reset: function() { this.resetElements(); this.tooltip.initialize(); }, update: function(config) { var me = this; if (!config || typeof config !== 'object') { // backwards compatibility config = { duration: config, lazy: arguments[1] }; } updateConfig(me); // plugins options references might have change, let's invalidate the cache // https://github.com/chartjs/Chart.js/issues/5111#issuecomment-355934167 plugins._invalidate(me); if (plugins.notify(me, 'beforeUpdate') === false) { return; } // In case the entire data object changed me.tooltip._data = me.data; // Make sure dataset controllers are updated and new controllers are reset var newControllers = me.buildOrUpdateControllers(); // Make sure all dataset controllers have correct meta data counts helpers.each(me.data.datasets, function(dataset, datasetIndex) { me.getDatasetMeta(datasetIndex).controller.buildOrUpdateElements(); }, me); me.updateLayout(); // Can only reset the new controllers after the scales have been updated if (me.options.animation && me.options.animation.duration) { helpers.each(newControllers, function(controller) { controller.reset(); }); } me.updateDatasets(); // Need to reset tooltip in case it is displayed with elements that are removed // after update. me.tooltip.initialize(); // Last active contains items that were previously in the tooltip. // When we reset the tooltip, we need to clear it me.lastActive = []; // Do this before render so that any plugins that need final scale updates can use it plugins.notify(me, 'afterUpdate'); if (me._bufferedRender) { me._bufferedRequest = { duration: config.duration, easing: config.easing, lazy: config.lazy }; } else { me.render(config); } }, /** * Updates the chart layout unless a plugin returns `false` to the `beforeLayout` * hook, in which case, plugins will not be called on `afterLayout`. * @private */ updateLayout: function() { var me = this; if (plugins.notify(me, 'beforeLayout') === false) { return; } layouts.update(this, this.width, this.height); /** * Provided for backward compatibility, use `afterLayout` instead. * @method IPlugin#afterScaleUpdate * @deprecated since version 2.5.0 * @todo remove at version 3 * @private */ plugins.notify(me, 'afterScaleUpdate'); plugins.notify(me, 'afterLayout'); }, /** * Updates all datasets unless a plugin returns `false` to the `beforeDatasetsUpdate` * hook, in which case, plugins will not be called on `afterDatasetsUpdate`. * @private */ updateDatasets: function() { var me = this; if (plugins.notify(me, 'beforeDatasetsUpdate') === false) { return; } for (var i = 0, ilen = me.data.datasets.length; i < ilen; ++i) { me.updateDataset(i); } plugins.notify(me, 'afterDatasetsUpdate'); }, /** * Updates dataset at index unless a plugin returns `false` to the `beforeDatasetUpdate` * hook, in which case, plugins will not be called on `afterDatasetUpdate`. * @private */ updateDataset: function(index) { var me = this; var meta = me.getDatasetMeta(index); var args = { meta: meta, index: index }; if (plugins.notify(me, 'beforeDatasetUpdate', [args]) === false) { return; } meta.controller.update(); plugins.notify(me, 'afterDatasetUpdate', [args]); }, render: function(config) { var me = this; if (!config || typeof config !== 'object') { // backwards compatibility config = { duration: config, lazy: arguments[1] }; } var duration = config.duration; var lazy = config.lazy; if (plugins.notify(me, 'beforeRender') === false) { return; } var animationOptions = me.options.animation; var onComplete = function(animation) { plugins.notify(me, 'afterRender'); helpers.callback(animationOptions && animationOptions.onComplete, [animation], me); }; if (animationOptions && ((typeof duration !== 'undefined' && duration !== 0) || (typeof duration === 'undefined' && animationOptions.duration !== 0))) { var animation = new Chart.Animation({ numSteps: (duration || animationOptions.duration) / 16.66, // 60 fps easing: config.easing || animationOptions.easing, render: function(chart, animationObject) { var easingFunction = helpers.easing.effects[animationObject.easing]; var currentStep = animationObject.currentStep; var stepDecimal = currentStep / animationObject.numSteps; chart.draw(easingFunction(stepDecimal), stepDecimal, currentStep); }, onAnimationProgress: animationOptions.onProgress, onAnimationComplete: onComplete }); Chart.animationService.addAnimation(me, animation, duration, lazy); } else { me.draw(); // See https://github.com/chartjs/Chart.js/issues/3781 onComplete(new Chart.Animation({numSteps: 0, chart: me})); } return me; }, draw: function(easingValue) { var me = this; me.clear(); if (helpers.isNullOrUndef(easingValue)) { easingValue = 1; } me.transition(easingValue); if (plugins.notify(me, 'beforeDraw', [easingValue]) === false) { return; } // Draw all the scales helpers.each(me.boxes, function(box) { box.draw(me.chartArea); }, me); if (me.scale) { me.scale.draw(); } me.drawDatasets(easingValue); me._drawTooltip(easingValue); plugins.notify(me, 'afterDraw', [easingValue]); }, /** * @private */ transition: function(easingValue) { var me = this; for (var i = 0, ilen = (me.data.datasets || []).length; i < ilen; ++i) { if (me.isDatasetVisible(i)) { me.getDatasetMeta(i).controller.transition(easingValue); } } me.tooltip.transition(easingValue); }, /** * Draws all datasets unless a plugin returns `false` to the `beforeDatasetsDraw` * hook, in which case, plugins will not be called on `afterDatasetsDraw`. * @private */ drawDatasets: function(easingValue) { var me = this; if (plugins.notify(me, 'beforeDatasetsDraw', [easingValue]) === false) { return; } // Draw datasets reversed to support proper line stacking for (var i = (me.data.datasets || []).length - 1; i >= 0; --i) { if (me.isDatasetVisible(i)) { me.drawDataset(i, easingValue); } } plugins.notify(me, 'afterDatasetsDraw', [easingValue]); }, /** * Draws dataset at index unless a plugin returns `false` to the `beforeDatasetDraw` * hook, in which case, plugins will not be called on `afterDatasetDraw`. * @private */ drawDataset: function(index, easingValue) { var me = this; var meta = me.getDatasetMeta(index); var args = { meta: meta, index: index, easingValue: easingValue }; if (plugins.notify(me, 'beforeDatasetDraw', [args]) === false) { return; } meta.controller.draw(easingValue); plugins.notify(me, 'afterDatasetDraw', [args]); }, /** * Draws tooltip unless a plugin returns `false` to the `beforeTooltipDraw` * hook, in which case, plugins will not be called on `afterTooltipDraw`. * @private */ _drawTooltip: function(easingValue) { var me = this; var tooltip = me.tooltip; var args = { tooltip: tooltip, easingValue: easingValue }; if (plugins.notify(me, 'beforeTooltipDraw', [args]) === false) { return; } tooltip.draw(); plugins.notify(me, 'afterTooltipDraw', [args]); }, // Get the single element that was clicked on // @return : An object containing the dataset index and element index of the matching element. Also contains the rectangle that was draw getElementAtEvent: function(e) { return Interaction.modes.single(this, e); }, getElementsAtEvent: function(e) { return Interaction.modes.label(this, e, {intersect: true}); }, getElementsAtXAxis: function(e) { return Interaction.modes['x-axis'](this, e, {intersect: true}); }, getElementsAtEventForMode: function(e, mode, options) { var method = Interaction.modes[mode]; if (typeof method === 'function') { return method(this, e, options); } return []; }, getDatasetAtEvent: function(e) { return Interaction.modes.dataset(this, e, {intersect: true}); }, getDatasetMeta: function(datasetIndex) { var me = this; var dataset = me.data.datasets[datasetIndex]; if (!dataset._meta) { dataset._meta = {}; } var meta = dataset._meta[me.id]; if (!meta) { meta = dataset._meta[me.id] = { type: null, data: [], dataset: null, controller: null, hidden: null, // See isDatasetVisible() comment xAxisID: null, yAxisID: null }; } return meta; }, getVisibleDatasetCount: function() { var count = 0; for (var i = 0, ilen = this.data.datasets.length; i < ilen; ++i) { if (this.isDatasetVisible(i)) { count++; } } return count; }, isDatasetVisible: function(datasetIndex) { var meta = this.getDatasetMeta(datasetIndex); // meta.hidden is a per chart dataset hidden flag override with 3 states: if true or false, // the dataset.hidden value is ignored, else if null, the dataset hidden state is returned. return typeof meta.hidden === 'boolean' ? !meta.hidden : !this.data.datasets[datasetIndex].hidden; }, generateLegend: function() { return this.options.legendCallback(this); }, /** * @private */ destroyDatasetMeta: function(datasetIndex) { var id = this.id; var dataset = this.data.datasets[datasetIndex]; var meta = dataset._meta && dataset._meta[id]; if (meta) { meta.controller.destroy(); delete dataset._meta[id]; } }, destroy: function() { var me = this; var canvas = me.canvas; var i, ilen; me.stop(); // dataset controllers need to cleanup associated data for (i = 0, ilen = me.data.datasets.length; i < ilen; ++i) { me.destroyDatasetMeta(i); } if (canvas) { me.unbindEvents(); helpers.canvas.clear(me); platform.releaseContext(me.ctx); me.canvas = null; me.ctx = null; } plugins.notify(me, 'destroy'); delete Chart.instances[me.id]; }, toBase64Image: function() { return this.canvas.toDataURL.apply(this.canvas, arguments); }, initToolTip: function() { var me = this; me.tooltip = new Chart.Tooltip({ _chart: me, _chartInstance: me, // deprecated, backward compatibility _data: me.data, _options: me.options.tooltips }, me); }, /** * @private */ bindEvents: function() { var me = this; var listeners = me._listeners = {}; var listener = function() { me.eventHandler.apply(me, arguments); }; helpers.each(me.options.events, function(type) { platform.addEventListener(me, type, listener); listeners[type] = listener; }); // Elements used to detect size change should not be injected for non responsive charts. // See https://github.com/chartjs/Chart.js/issues/2210 if (me.options.responsive) { listener = function() { me.resize(); }; platform.addEventListener(me, 'resize', listener); listeners.resize = listener; } }, /** * @private */ unbindEvents: function() { var me = this; var listeners = me._listeners; if (!listeners) { return; } delete me._listeners; helpers.each(listeners, function(listener, type) { platform.removeEventListener(me, type, listener); }); }, updateHoverStyle: function(elements, mode, enabled) { var method = enabled ? 'setHoverStyle' : 'removeHoverStyle'; var element, i, ilen; for (i = 0, ilen = elements.length; i < ilen; ++i) { element = elements[i]; if (element) { this.getDatasetMeta(element._datasetIndex).controller[method](element); } } }, /** * @private */ eventHandler: function(e) { var me = this; var tooltip = me.tooltip; if (plugins.notify(me, 'beforeEvent', [e]) === false) { return; } // Buffer any update calls so that renders do not occur me._bufferedRender = true; me._bufferedRequest = null; var changed = me.handleEvent(e); // for smooth tooltip animations issue #4989 // the tooltip should be the source of change // Animation check workaround: // tooltip._start will be null when tooltip isn't animating if (tooltip) { changed = tooltip._start ? tooltip.handleEvent(e) : changed | tooltip.handleEvent(e); } plugins.notify(me, 'afterEvent', [e]); var bufferedRequest = me._bufferedRequest; if (bufferedRequest) { // If we have an update that was triggered, we need to do a normal render me.render(bufferedRequest); } else if (changed && !me.animating) { // If entering, leaving, or changing elements, animate the change via pivot me.stop(); // We only need to render at this point. Updating will cause scales to be // recomputed generating flicker & using more memory than necessary. me.render(me.options.hover.animationDuration, true); } me._bufferedRender = false; me._bufferedRequest = null; return me; }, /** * Handle an event * @private * @param {IEvent} event the event to handle * @return {Boolean} true if the chart needs to re-render */ handleEvent: function(e) { var me = this; var options = me.options || {}; var hoverOptions = options.hover; var changed = false; me.lastActive = me.lastActive || []; // Find Active Elements for hover and tooltips if (e.type === 'mouseout') { me.active = []; } else { me.active = me.getElementsAtEventForMode(e, hoverOptions.mode, hoverOptions); } // Invoke onHover hook // Need to call with native event here to not break backwards compatibility helpers.callback(options.onHover || options.hover.onHover, [e.native, me.active], me); if (e.type === 'mouseup' || e.type === 'click') { if (options.onClick) { // Use e.native here for backwards compatibility options.onClick.call(me, e.native, me.active); } } // Remove styling for last active (even if it may still be active) if (me.lastActive.length) { me.updateHoverStyle(me.lastActive, hoverOptions.mode, false); } // Built in hover styling if (me.active.length && hoverOptions.mode) { me.updateHoverStyle(me.active, hoverOptions.mode, true); } changed = !helpers.arrayEquals(me.active, me.lastActive); // Remember Last Actives me.lastActive = me.active; return changed; } }); /** * Provided for backward compatibility, use Chart instead. * @class Chart.Controller * @deprecated since version 2.6.0 * @todo remove at version 3 * @private */ Chart.Controller = Chart; }; /***/ }), /***/ "./node_modules/chart.js/src/core/core.datasetController.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; var helpers = __webpack_require__("./node_modules/chart.js/src/helpers/index.js"); module.exports = function(Chart) { var arrayEvents = ['push', 'pop', 'shift', 'splice', 'unshift']; /** * Hooks the array methods that add or remove values ('push', pop', 'shift', 'splice', * 'unshift') and notify the listener AFTER the array has been altered. Listeners are * called on the 'onData*' callbacks (e.g. onDataPush, etc.) with same arguments. */ function listenArrayEvents(array, listener) { if (array._chartjs) { array._chartjs.listeners.push(listener); return; } Object.defineProperty(array, '_chartjs', { configurable: true, enumerable: false, value: { listeners: [listener] } }); arrayEvents.forEach(function(key) { var method = 'onData' + key.charAt(0).toUpperCase() + key.slice(1); var base = array[key]; Object.defineProperty(array, key, { configurable: true, enumerable: false, value: function() { var args = Array.prototype.slice.call(arguments); var res = base.apply(this, args); helpers.each(array._chartjs.listeners, function(object) { if (typeof object[method] === 'function') { object[method].apply(object, args); } }); return res; } }); }); } /** * Removes the given array event listener and cleanup extra attached properties (such as * the _chartjs stub and overridden methods) if array doesn't have any more listeners. */ function unlistenArrayEvents(array, listener) { var stub = array._chartjs; if (!stub) { return; } var listeners = stub.listeners; var index = listeners.indexOf(listener); if (index !== -1) { listeners.splice(index, 1); } if (listeners.length > 0) { return; } arrayEvents.forEach(function(key) { delete array[key]; }); delete array._chartjs; } // Base class for all dataset controllers (line, bar, etc) Chart.DatasetController = function(chart, datasetIndex) { this.initialize(chart, datasetIndex); }; helpers.extend(Chart.DatasetController.prototype, { /** * Element type used to generate a meta dataset (e.g. Chart.element.Line). * @type {Chart.core.element} */ datasetElementType: null, /** * Element type used to generate a meta data (e.g. Chart.element.Point). * @type {Chart.core.element} */ dataElementType: null, initialize: function(chart, datasetIndex) { var me = this; me.chart = chart; me.index = datasetIndex; me.linkScales(); me.addElements(); }, updateIndex: function(datasetIndex) { this.index = datasetIndex; }, linkScales: function() { var me = this; var meta = me.getMeta(); var dataset = me.getDataset(); if (meta.xAxisID === null || !(meta.xAxisID in me.chart.scales)) { meta.xAxisID = dataset.xAxisID || me.chart.options.scales.xAxes[0].id; } if (meta.yAxisID === null || !(meta.yAxisID in me.chart.scales)) { meta.yAxisID = dataset.yAxisID || me.chart.options.scales.yAxes[0].id; } }, getDataset: function() { return this.chart.data.datasets[this.index]; }, getMeta: function() { return this.chart.getDatasetMeta(this.index); }, getScaleForId: function(scaleID) { return this.chart.scales[scaleID]; }, reset: function() { this.update(true); }, /** * @private */ destroy: function() { if (this._data) { unlistenArrayEvents(this._data, this); } }, createMetaDataset: function() { var me = this; var type = me.datasetElementType; return type && new type({ _chart: me.chart, _datasetIndex: me.index }); }, createMetaData: function(index) { var me = this; var type = me.dataElementType; return type && new type({ _chart: me.chart, _datasetIndex: me.index, _index: index }); }, addElements: function() { var me = this; var meta = me.getMeta(); var data = me.getDataset().data || []; var metaData = meta.data; var i, ilen; for (i = 0, ilen = data.length; i < ilen; ++i) { metaData[i] = metaData[i] || me.createMetaData(i); } meta.dataset = meta.dataset || me.createMetaDataset(); }, addElementAndReset: function(index) { var element = this.createMetaData(index); this.getMeta().data.splice(index, 0, element); this.updateElement(element, index, true); }, buildOrUpdateElements: function() { var me = this; var dataset = me.getDataset(); var data = dataset.data || (dataset.data = []); // In order to correctly handle data addition/deletion animation (an thus simulate // real-time charts), we need to monitor these data modifications and synchronize // the internal meta data accordingly. if (me._data !== data) { if (me._data) { // This case happens when the user replaced the data array instance. unlistenArrayEvents(me._data, me); } listenArrayEvents(data, me); me._data = data; } // Re-sync meta data in case the user replaced the data array or if we missed // any updates and so make sure that we handle number of datapoints changing. me.resyncElements(); }, update: helpers.noop, transition: function(easingValue) { var meta = this.getMeta(); var elements = meta.data || []; var ilen = elements.length; var i = 0; for (; i < ilen; ++i) { elements[i].transition(easingValue); } if (meta.dataset) { meta.dataset.transition(easingValue); } }, draw: function() { var meta = this.getMeta(); var elements = meta.data || []; var ilen = elements.length; var i = 0; if (meta.dataset) { meta.dataset.draw(); } for (; i < ilen; ++i) { elements[i].draw(); } }, removeHoverStyle: function(element, elementOpts) { var dataset = this.chart.data.datasets[element._datasetIndex]; var index = element._index; var custom = element.custom || {}; var valueOrDefault = helpers.valueAtIndexOrDefault; var model = element._model; model.backgroundColor = custom.backgroundColor ? custom.backgroundColor : valueOrDefault(dataset.backgroundColor, index, elementOpts.backgroundColor); model.borderColor = custom.borderColor ? custom.borderColor : valueOrDefault(dataset.borderColor, index, elementOpts.borderColor); model.borderWidth = custom.borderWidth ? custom.borderWidth : valueOrDefault(dataset.borderWidth, index, elementOpts.borderWidth); }, setHoverStyle: function(element) { var dataset = this.chart.data.datasets[element._datasetIndex]; var index = element._index; var custom = element.custom || {}; var valueOrDefault = helpers.valueAtIndexOrDefault; var getHoverColor = helpers.getHoverColor; var model = element._model; model.backgroundColor = custom.hoverBackgroundColor ? custom.hoverBackgroundColor : valueOrDefault(dataset.hoverBackgroundColor, index, getHoverColor(model.backgroundColor)); model.borderColor = custom.hoverBorderColor ? custom.hoverBorderColor : valueOrDefault(dataset.hoverBorderColor, index, getHoverColor(model.borderColor)); model.borderWidth = custom.hoverBorderWidth ? custom.hoverBorderWidth : valueOrDefault(dataset.hoverBorderWidth, index, model.borderWidth); }, /** * @private */ resyncElements: function() { var me = this; var meta = me.getMeta(); var data = me.getDataset().data; var numMeta = meta.data.length; var numData = data.length; if (numData < numMeta) { meta.data.splice(numData, numMeta - numData); } else if (numData > numMeta) { me.insertElements(numMeta, numData - numMeta); } }, /** * @private */ insertElements: function(start, count) { for (var i = 0; i < count; ++i) { this.addElementAndReset(start + i); } }, /** * @private */ onDataPush: function() { this.insertElements(this.getDataset().data.length - 1, arguments.length); }, /** * @private */ onDataPop: function() { this.getMeta().data.pop(); }, /** * @private */ onDataShift: function() { this.getMeta().data.shift(); }, /** * @private */ onDataSplice: function(start, count) { this.getMeta().data.splice(start, count); this.insertElements(start, arguments.length - 2); }, /** * @private */ onDataUnshift: function() { this.insertElements(0, arguments.length); } }); Chart.DatasetController.extend = helpers.inherits; }; /***/ }), /***/ "./node_modules/chart.js/src/core/core.defaults.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; var helpers = __webpack_require__("./node_modules/chart.js/src/helpers/index.js"); module.exports = { /** * @private */ _set: function(scope, values) { return helpers.merge(this[scope] || (this[scope] = {}), values); } }; /***/ }), /***/ "./node_modules/chart.js/src/core/core.element.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; var color = __webpack_require__("./node_modules/chartjs-color/index.js"); var helpers = __webpack_require__("./node_modules/chart.js/src/helpers/index.js"); function interpolate(start, view, model, ease) { var keys = Object.keys(model); var i, ilen, key, actual, origin, target, type, c0, c1; for (i = 0, ilen = keys.length; i < ilen; ++i) { key = keys[i]; target = model[key]; // if a value is added to the model after pivot() has been called, the view // doesn't contain it, so let's initialize the view to the target value. if (!view.hasOwnProperty(key)) { view[key] = target; } actual = view[key]; if (actual === target || key[0] === '_') { continue; } if (!start.hasOwnProperty(key)) { start[key] = actual; } origin = start[key]; type = typeof target; if (type === typeof origin) { if (type === 'string') { c0 = color(origin); if (c0.valid) { c1 = color(target); if (c1.valid) { view[key] = c1.mix(c0, ease).rgbString(); continue; } } } else if (type === 'number' && isFinite(origin) && isFinite(target)) { view[key] = origin + (target - origin) * ease; continue; } } view[key] = target; } } var Element = function(configuration) { helpers.extend(this, configuration); this.initialize.apply(this, arguments); }; helpers.extend(Element.prototype, { initialize: function() { this.hidden = false; }, pivot: function() { var me = this; if (!me._view) { me._view = helpers.clone(me._model); } me._start = {}; return me; }, transition: function(ease) { var me = this; var model = me._model; var start = me._start; var view = me._view; // No animation -> No Transition if (!model || ease === 1) { me._view = model; me._start = null; return me; } if (!view) { view = me._view = {}; } if (!start) { start = me._start = {}; } interpolate(start, view, model, ease); return me; }, tooltipPosition: function() { return { x: this._model.x, y: this._model.y }; }, hasValue: function() { return helpers.isNumber(this._model.x) && helpers.isNumber(this._model.y); } }); Element.extend = helpers.inherits; module.exports = Element; /***/ }), /***/ "./node_modules/chart.js/src/core/core.helpers.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /* global window: false */ /* global document: false */ var color = __webpack_require__("./node_modules/chartjs-color/index.js"); var defaults = __webpack_require__("./node_modules/chart.js/src/core/core.defaults.js"); var helpers = __webpack_require__("./node_modules/chart.js/src/helpers/index.js"); module.exports = function(Chart) { // -- Basic js utility methods helpers.configMerge = function(/* objects ... */) { return helpers.merge(helpers.clone(arguments[0]), [].slice.call(arguments, 1), { merger: function(key, target, source, options) { var tval = target[key] || {}; var sval = source[key]; if (key === 'scales') { // scale config merging is complex. Add our own function here for that target[key] = helpers.scaleMerge(tval, sval); } else if (key === 'scale') { // used in polar area & radar charts since there is only one scale target[key] = helpers.merge(tval, [Chart.scaleService.getScaleDefaults(sval.type), sval]); } else { helpers._merger(key, target, source, options); } } }); }; helpers.scaleMerge = function(/* objects ... */) { return helpers.merge(helpers.clone(arguments[0]), [].slice.call(arguments, 1), { merger: function(key, target, source, options) { if (key === 'xAxes' || key === 'yAxes') { var slen = source[key].length; var i, type, scale; if (!target[key]) { target[key] = []; } for (i = 0; i < slen; ++i) { scale = source[key][i]; type = helpers.valueOrDefault(scale.type, key === 'xAxes' ? 'category' : 'linear'); if (i >= target[key].length) { target[key].push({}); } if (!target[key][i].type || (scale.type && scale.type !== target[key][i].type)) { // new/untyped scale or type changed: let's apply the new defaults // then merge source scale to correctly overwrite the defaults. helpers.merge(target[key][i], [Chart.scaleService.getScaleDefaults(type), scale]); } else { // scales type are the same helpers.merge(target[key][i], scale); } } } else { helpers._merger(key, target, source, options); } } }); }; helpers.where = function(collection, filterCallback) { if (helpers.isArray(collection) && Array.prototype.filter) { return collection.filter(filterCallback); } var filtered = []; helpers.each(collection, function(item) { if (filterCallback(item)) { filtered.push(item); } }); return filtered; }; helpers.findIndex = Array.prototype.findIndex ? function(array, callback, scope) { return array.findIndex(callback, scope); } : function(array, callback, scope) { scope = scope === undefined ? array : scope; for (var i = 0, ilen = array.length; i < ilen; ++i) { if (callback.call(scope, array[i], i, array)) { return i; } } return -1; }; helpers.findNextWhere = function(arrayToSearch, filterCallback, startIndex) { // Default to start of the array if (helpers.isNullOrUndef(startIndex)) { startIndex = -1; } for (var i = startIndex + 1; i < arrayToSearch.length; i++) { var currentItem = arrayToSearch[i]; if (filterCallback(currentItem)) { return currentItem; } } }; helpers.findPreviousWhere = function(arrayToSearch, filterCallback, startIndex) { // Default to end of the array if (helpers.isNullOrUndef(startIndex)) { startIndex = arrayToSearch.length; } for (var i = startIndex - 1; i >= 0; i--) { var currentItem = arrayToSearch[i]; if (filterCallback(currentItem)) { return currentItem; } } }; // -- Math methods helpers.isNumber = function(n) { return !isNaN(parseFloat(n)) && isFinite(n); }; helpers.almostEquals = function(x, y, epsilon) { return Math.abs(x - y) < epsilon; }; helpers.almostWhole = function(x, epsilon) { var rounded = Math.round(x); return (((rounded - epsilon) < x) && ((rounded + epsilon) > x)); }; helpers.max = function(array) { return array.reduce(function(max, value) { if (!isNaN(value)) { return Math.max(max, value); } return max; }, Number.NEGATIVE_INFINITY); }; helpers.min = function(array) { return array.reduce(function(min, value) { if (!isNaN(value)) { return Math.min(min, value); } return min; }, Number.POSITIVE_INFINITY); }; helpers.sign = Math.sign ? function(x) { return Math.sign(x); } : function(x) { x = +x; // convert to a number if (x === 0 || isNaN(x)) { return x; } return x > 0 ? 1 : -1; }; helpers.log10 = Math.log10 ? function(x) { return Math.log10(x); } : function(x) { var exponent = Math.log(x) * Math.LOG10E; // Math.LOG10E = 1 / Math.LN10. // Check for whole powers of 10, // which due to floating point rounding error should be corrected. var powerOf10 = Math.round(exponent); var isPowerOf10 = x === Math.pow(10, powerOf10); return isPowerOf10 ? powerOf10 : exponent; }; helpers.toRadians = function(degrees) { return degrees * (Math.PI / 180); }; helpers.toDegrees = function(radians) { return radians * (180 / Math.PI); }; // Gets the angle from vertical upright to the point about a centre. helpers.getAngleFromPoint = function(centrePoint, anglePoint) { var distanceFromXCenter = anglePoint.x - centrePoint.x; var distanceFromYCenter = anglePoint.y - centrePoint.y; var radialDistanceFromCenter = Math.sqrt(distanceFromXCenter * distanceFromXCenter + distanceFromYCenter * distanceFromYCenter); var angle = Math.atan2(distanceFromYCenter, distanceFromXCenter); if (angle < (-0.5 * Math.PI)) { angle += 2.0 * Math.PI; // make sure the returned angle is in the range of (-PI/2, 3PI/2] } return { angle: angle, distance: radialDistanceFromCenter }; }; helpers.distanceBetweenPoints = function(pt1, pt2) { return Math.sqrt(Math.pow(pt2.x - pt1.x, 2) + Math.pow(pt2.y - pt1.y, 2)); }; helpers.aliasPixel = function(pixelWidth) { return (pixelWidth % 2 === 0) ? 0 : 0.5; }; helpers.splineCurve = function(firstPoint, middlePoint, afterPoint, t) { // Props to Rob Spencer at scaled innovation for his post on splining between points // http://scaledinnovation.com/analytics/splines/aboutSplines.html // This function must also respect "skipped" points var previous = firstPoint.skip ? middlePoint : firstPoint; var current = middlePoint; var next = afterPoint.skip ? middlePoint : afterPoint; var d01 = Math.sqrt(Math.pow(current.x - previous.x, 2) + Math.pow(current.y - previous.y, 2)); var d12 = Math.sqrt(Math.pow(next.x - current.x, 2) + Math.pow(next.y - current.y, 2)); var s01 = d01 / (d01 + d12); var s12 = d12 / (d01 + d12); // If all points are the same, s01 & s02 will be inf s01 = isNaN(s01) ? 0 : s01; s12 = isNaN(s12) ? 0 : s12; var fa = t * s01; // scaling factor for triangle Ta var fb = t * s12; return { previous: { x: current.x - fa * (next.x - previous.x), y: current.y - fa * (next.y - previous.y) }, next: { x: current.x + fb * (next.x - previous.x), y: current.y + fb * (next.y - previous.y) } }; }; helpers.EPSILON = Number.EPSILON || 1e-14; helpers.splineCurveMonotone = function(points) { // This function calculates Bézier control points in a similar way than |splineCurve|, // but preserves monotonicity of the provided data and ensures no local extremums are added // between the dataset discrete points due to the interpolation. // See : https://en.wikipedia.org/wiki/Monotone_cubic_interpolation var pointsWithTangents = (points || []).map(function(point) { return { model: point._model, deltaK: 0, mK: 0 }; }); // Calculate slopes (deltaK) and initialize tangents (mK) var pointsLen = pointsWithTangents.length; var i, pointBefore, pointCurrent, pointAfter; for (i = 0; i < pointsLen; ++i) { pointCurrent = pointsWithTangents[i]; if (pointCurrent.model.skip) { continue; } pointBefore = i > 0 ? pointsWithTangents[i - 1] : null; pointAfter = i < pointsLen - 1 ? pointsWithTangents[i + 1] : null; if (pointAfter && !pointAfter.model.skip) { var slopeDeltaX = (pointAfter.model.x - pointCurrent.model.x); // In the case of two points that appear at the same x pixel, slopeDeltaX is 0 pointCurrent.deltaK = slopeDeltaX !== 0 ? (pointAfter.model.y - pointCurrent.model.y) / slopeDeltaX : 0; } if (!pointBefore || pointBefore.model.skip) { pointCurrent.mK = pointCurrent.deltaK; } else if (!pointAfter || pointAfter.model.skip) { pointCurrent.mK = pointBefore.deltaK; } else if (this.sign(pointBefore.deltaK) !== this.sign(pointCurrent.deltaK)) { pointCurrent.mK = 0; } else { pointCurrent.mK = (pointBefore.deltaK + pointCurrent.deltaK) / 2; } } // Adjust tangents to ensure monotonic properties var alphaK, betaK, tauK, squaredMagnitude; for (i = 0; i < pointsLen - 1; ++i) { pointCurrent = pointsWithTangents[i]; pointAfter = pointsWithTangents[i + 1]; if (pointCurrent.model.skip || pointAfter.model.skip) { continue; } if (helpers.almostEquals(pointCurrent.deltaK, 0, this.EPSILON)) { pointCurrent.mK = pointAfter.mK = 0; continue; } alphaK = pointCurrent.mK / pointCurrent.deltaK; betaK = pointAfter.mK / pointCurrent.deltaK; squaredMagnitude = Math.pow(alphaK, 2) + Math.pow(betaK, 2); if (squaredMagnitude <= 9) { continue; } tauK = 3 / Math.sqrt(squaredMagnitude); pointCurrent.mK = alphaK * tauK * pointCurrent.deltaK; pointAfter.mK = betaK * tauK * pointCurrent.deltaK; } // Compute control points var deltaX; for (i = 0; i < pointsLen; ++i) { pointCurrent = pointsWithTangents[i]; if (pointCurrent.model.skip) { continue; } pointBefore = i > 0 ? pointsWithTangents[i - 1] : null; pointAfter = i < pointsLen - 1 ? pointsWithTangents[i + 1] : null; if (pointBefore && !pointBefore.model.skip) { deltaX = (pointCurrent.model.x - pointBefore.model.x) / 3; pointCurrent.model.controlPointPreviousX = pointCurrent.model.x - deltaX; pointCurrent.model.controlPointPreviousY = pointCurrent.model.y - deltaX * pointCurrent.mK; } if (pointAfter && !pointAfter.model.skip) { deltaX = (pointAfter.model.x - pointCurrent.model.x) / 3; pointCurrent.model.controlPointNextX = pointCurrent.model.x + deltaX; pointCurrent.model.controlPointNextY = pointCurrent.model.y + deltaX * pointCurrent.mK; } } }; helpers.nextItem = function(collection, index, loop) { if (loop) { return index >= collection.length - 1 ? collection[0] : collection[index + 1]; } return index >= collection.length - 1 ? collection[collection.length - 1] : collection[index + 1]; }; helpers.previousItem = function(collection, index, loop) { if (loop) { return index <= 0 ? collection[collection.length - 1] : collection[index - 1]; } return index <= 0 ? collection[0] : collection[index - 1]; }; // Implementation of the nice number algorithm used in determining where axis labels will go helpers.niceNum = function(range, round) { var exponent = Math.floor(helpers.log10(range)); var fraction = range / Math.pow(10, exponent); var niceFraction; if (round) { if (fraction < 1.5) { niceFraction = 1; } else if (fraction < 3) { niceFraction = 2; } else if (fraction < 7) { niceFraction = 5; } else { niceFraction = 10; } } else if (fraction <= 1.0) { niceFraction = 1; } else if (fraction <= 2) { niceFraction = 2; } else if (fraction <= 5) { niceFraction = 5; } else { niceFraction = 10; } return niceFraction * Math.pow(10, exponent); }; // Request animation polyfill - http://www.paulirish.com/2011/requestanimationframe-for-smart-animating/ helpers.requestAnimFrame = (function() { if (typeof window === 'undefined') { return function(callback) { callback(); }; } return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || function(callback) { return window.setTimeout(callback, 1000 / 60); }; }()); // -- DOM methods helpers.getRelativePosition = function(evt, chart) { var mouseX, mouseY; var e = evt.originalEvent || evt; var canvas = evt.currentTarget || evt.srcElement; var boundingRect = canvas.getBoundingClientRect(); var touches = e.touches; if (touches && touches.length > 0) { mouseX = touches[0].clientX; mouseY = touches[0].clientY; } else { mouseX = e.clientX; mouseY = e.clientY; } // Scale mouse coordinates into canvas coordinates // by following the pattern laid out by 'jerryj' in the comments of // http://www.html5canvastutorials.com/advanced/html5-canvas-mouse-coordinates/ var paddingLeft = parseFloat(helpers.getStyle(canvas, 'padding-left')); var paddingTop = parseFloat(helpers.getStyle(canvas, 'padding-top')); var paddingRight = parseFloat(helpers.getStyle(canvas, 'padding-right')); var paddingBottom = parseFloat(helpers.getStyle(canvas, 'padding-bottom')); var width = boundingRect.right - boundingRect.left - paddingLeft - paddingRight; var height = boundingRect.bottom - boundingRect.top - paddingTop - paddingBottom; // We divide by the current device pixel ratio, because the canvas is scaled up by that amount in each direction. However // the backend model is in unscaled coordinates. Since we are going to deal with our model coordinates, we go back here mouseX = Math.round((mouseX - boundingRect.left - paddingLeft) / (width) * canvas.width / chart.currentDevicePixelRatio); mouseY = Math.round((mouseY - boundingRect.top - paddingTop) / (height) * canvas.height / chart.currentDevicePixelRatio); return { x: mouseX, y: mouseY }; }; // Private helper function to convert max-width/max-height values that may be percentages into a number function parseMaxStyle(styleValue, node, parentProperty) { var valueInPixels; if (typeof styleValue === 'string') { valueInPixels = parseInt(styleValue, 10); if (styleValue.indexOf('%') !== -1) { // percentage * size in dimension valueInPixels = valueInPixels / 100 * node.parentNode[parentProperty]; } } else { valueInPixels = styleValue; } return valueInPixels; } /** * Returns if the given value contains an effective constraint. * @private */ function isConstrainedValue(value) { return value !== undefined && value !== null && value !== 'none'; } // Private helper to get a constraint dimension // @param domNode : the node to check the constraint on // @param maxStyle : the style that defines the maximum for the direction we are using (maxWidth / maxHeight) // @param percentageProperty : property of parent to use when calculating width as a percentage // @see http://www.nathanaeljones.com/blog/2013/reading-max-width-cross-browser function getConstraintDimension(domNode, maxStyle, percentageProperty) { var view = document.defaultView; var parentNode = domNode.parentNode; var constrainedNode = view.getComputedStyle(domNode)[maxStyle]; var constrainedContainer = view.getComputedStyle(parentNode)[maxStyle]; var hasCNode = isConstrainedValue(constrainedNode); var hasCContainer = isConstrainedValue(constrainedContainer); var infinity = Number.POSITIVE_INFINITY; if (hasCNode || hasCContainer) { return Math.min( hasCNode ? parseMaxStyle(constrainedNode, domNode, percentageProperty) : infinity, hasCContainer ? parseMaxStyle(constrainedContainer, parentNode, percentageProperty) : infinity); } return 'none'; } // returns Number or undefined if no constraint helpers.getConstraintWidth = function(domNode) { return getConstraintDimension(domNode, 'max-width', 'clientWidth'); }; // returns Number or undefined if no constraint helpers.getConstraintHeight = function(domNode) { return getConstraintDimension(domNode, 'max-height', 'clientHeight'); }; helpers.getMaximumWidth = function(domNode) { var container = domNode.parentNode; if (!container) { return domNode.clientWidth; } var paddingLeft = parseInt(helpers.getStyle(container, 'padding-left'), 10); var paddingRight = parseInt(helpers.getStyle(container, 'padding-right'), 10); var w = container.clientWidth - paddingLeft - paddingRight; var cw = helpers.getConstraintWidth(domNode); return isNaN(cw) ? w : Math.min(w, cw); }; helpers.getMaximumHeight = function(domNode) { var container = domNode.parentNode; if (!container) { return domNode.clientHeight; } var paddingTop = parseInt(helpers.getStyle(container, 'padding-top'), 10); var paddingBottom = parseInt(helpers.getStyle(container, 'padding-bottom'), 10); var h = container.clientHeight - paddingTop - paddingBottom; var ch = helpers.getConstraintHeight(domNode); return isNaN(ch) ? h : Math.min(h, ch); }; helpers.getStyle = function(el, property) { return el.currentStyle ? el.currentStyle[property] : document.defaultView.getComputedStyle(el, null).getPropertyValue(property); }; helpers.retinaScale = function(chart, forceRatio) { var pixelRatio = chart.currentDevicePixelRatio = forceRatio || window.devicePixelRatio || 1; if (pixelRatio === 1) { return; } var canvas = chart.canvas; var height = chart.height; var width = chart.width; canvas.height = height * pixelRatio; canvas.width = width * pixelRatio; chart.ctx.scale(pixelRatio, pixelRatio); // If no style has been set on the canvas, the render size is used as display size, // making the chart visually bigger, so let's enforce it to the "correct" values. // See https://github.com/chartjs/Chart.js/issues/3575 if (!canvas.style.height && !canvas.style.width) { canvas.style.height = height + 'px'; canvas.style.width = width + 'px'; } }; // -- Canvas methods helpers.fontString = function(pixelSize, fontStyle, fontFamily) { return fontStyle + ' ' + pixelSize + 'px ' + fontFamily; }; helpers.longestText = function(ctx, font, arrayOfThings, cache) { cache = cache || {}; var data = cache.data = cache.data || {}; var gc = cache.garbageCollect = cache.garbageCollect || []; if (cache.font !== font) { data = cache.data = {}; gc = cache.garbageCollect = []; cache.font = font; } ctx.font = font; var longest = 0; helpers.each(arrayOfThings, function(thing) { // Undefined strings and arrays should not be measured if (thing !== undefined && thing !== null && helpers.isArray(thing) !== true) { longest = helpers.measureText(ctx, data, gc, longest, thing); } else if (helpers.isArray(thing)) { // if it is an array lets measure each element // to do maybe simplify this function a bit so we can do this more recursively? helpers.each(thing, function(nestedThing) { // Undefined strings and arrays should not be measured if (nestedThing !== undefined && nestedThing !== null && !helpers.isArray(nestedThing)) { longest = helpers.measureText(ctx, data, gc, longest, nestedThing); } }); } }); var gcLen = gc.length / 2; if (gcLen > arrayOfThings.length) { for (var i = 0; i < gcLen; i++) { delete data[gc[i]]; } gc.splice(0, gcLen); } return longest; }; helpers.measureText = function(ctx, data, gc, longest, string) { var textWidth = data[string]; if (!textWidth) { textWidth = data[string] = ctx.measureText(string).width; gc.push(string); } if (textWidth > longest) { longest = textWidth; } return longest; }; helpers.numberOfLabelLines = function(arrayOfThings) { var numberOfLines = 1; helpers.each(arrayOfThings, function(thing) { if (helpers.isArray(thing)) { if (thing.length > numberOfLines) { numberOfLines = thing.length; } } }); return numberOfLines; }; helpers.color = !color ? function(value) { console.error('Color.js not found!'); return value; } : function(value) { /* global CanvasGradient */ if (value instanceof CanvasGradient) { value = defaults.global.defaultColor; } return color(value); }; helpers.getHoverColor = function(colorValue) { /* global CanvasPattern */ return (colorValue instanceof CanvasPattern) ? colorValue : helpers.color(colorValue).saturate(0.5).darken(0.1).rgbString(); }; }; /***/ }), /***/ "./node_modules/chart.js/src/core/core.interaction.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; var helpers = __webpack_require__("./node_modules/chart.js/src/helpers/index.js"); /** * Helper function to get relative position for an event * @param {Event|IEvent} event - The event to get the position for * @param {Chart} chart - The chart * @returns {Point} the event position */ function getRelativePosition(e, chart) { if (e.native) { return { x: e.x, y: e.y }; } return helpers.getRelativePosition(e, chart); } /** * Helper function to traverse all of the visible elements in the chart * @param chart {chart} the chart * @param handler {Function} the callback to execute for each visible item */ function parseVisibleItems(chart, handler) { var datasets = chart.data.datasets; var meta, i, j, ilen, jlen; for (i = 0, ilen = datasets.length; i < ilen; ++i) { if (!chart.isDatasetVisible(i)) { continue; } meta = chart.getDatasetMeta(i); for (j = 0, jlen = meta.data.length; j < jlen; ++j) { var element = meta.data[j]; if (!element._view.skip) { handler(element); } } } } /** * Helper function to get the items that intersect the event position * @param items {ChartElement[]} elements to filter * @param position {Point} the point to be nearest to * @return {ChartElement[]} the nearest items */ function getIntersectItems(chart, position) { var elements = []; parseVisibleItems(chart, function(element) { if (element.inRange(position.x, position.y)) { elements.push(element); } }); return elements; } /** * Helper function to get the items nearest to the event position considering all visible items in teh chart * @param chart {Chart} the chart to look at elements from * @param position {Point} the point to be nearest to * @param intersect {Boolean} if true, only consider items that intersect the position * @param distanceMetric {Function} function to provide the distance between points * @return {ChartElement[]} the nearest items */ function getNearestItems(chart, position, intersect, distanceMetric) { var minDistance = Number.POSITIVE_INFINITY; var nearestItems = []; parseVisibleItems(chart, function(element) { if (intersect && !element.inRange(position.x, position.y)) { return; } var center = element.getCenterPoint(); var distance = distanceMetric(position, center); if (distance < minDistance) { nearestItems = [element]; minDistance = distance; } else if (distance === minDistance) { // Can have multiple items at the same distance in which case we sort by size nearestItems.push(element); } }); return nearestItems; } /** * Get a distance metric function for two points based on the * axis mode setting * @param {String} axis the axis mode. x|y|xy */ function getDistanceMetricForAxis(axis) { var useX = axis.indexOf('x') !== -1; var useY = axis.indexOf('y') !== -1; return function(pt1, pt2) { var deltaX = useX ? Math.abs(pt1.x - pt2.x) : 0; var deltaY = useY ? Math.abs(pt1.y - pt2.y) : 0; return Math.sqrt(Math.pow(deltaX, 2) + Math.pow(deltaY, 2)); }; } function indexMode(chart, e, options) { var position = getRelativePosition(e, chart); // Default axis for index mode is 'x' to match old behaviour options.axis = options.axis || 'x'; var distanceMetric = getDistanceMetricForAxis(options.axis); var items = options.intersect ? getIntersectItems(chart, position) : getNearestItems(chart, position, false, distanceMetric); var elements = []; if (!items.length) { return []; } chart.data.datasets.forEach(function(dataset, datasetIndex) { if (chart.isDatasetVisible(datasetIndex)) { var meta = chart.getDatasetMeta(datasetIndex); var element = meta.data[items[0]._index]; // don't count items that are skipped (null data) if (element && !element._view.skip) { elements.push(element); } } }); return elements; } /** * @interface IInteractionOptions */ /** * If true, only consider items that intersect the point * @name IInterfaceOptions#boolean * @type Boolean */ /** * Contains interaction related functions * @namespace Chart.Interaction */ module.exports = { // Helper function for different modes modes: { single: function(chart, e) { var position = getRelativePosition(e, chart); var elements = []; parseVisibleItems(chart, function(element) { if (element.inRange(position.x, position.y)) { elements.push(element); return elements; } }); return elements.slice(0, 1); }, /** * @function Chart.Interaction.modes.label * @deprecated since version 2.4.0 * @todo remove at version 3 * @private */ label: indexMode, /** * Returns items at the same index. If the options.intersect parameter is true, we only return items if we intersect something * If the options.intersect mode is false, we find the nearest item and return the items at the same index as that item * @function Chart.Interaction.modes.index * @since v2.4.0 * @param chart {chart} the chart we are returning items from * @param e {Event} the event we are find things at * @param options {IInteractionOptions} options to use during interaction * @return {Chart.Element[]} Array of elements that are under the point. If none are found, an empty array is returned */ index: indexMode, /** * Returns items in the same dataset. If the options.intersect parameter is true, we only return items if we intersect something * If the options.intersect is false, we find the nearest item and return the items in that dataset * @function Chart.Interaction.modes.dataset * @param chart {chart} the chart we are returning items from * @param e {Event} the event we are find things at * @param options {IInteractionOptions} options to use during interaction * @return {Chart.Element[]} Array of elements that are under the point. If none are found, an empty array is returned */ dataset: function(chart, e, options) { var position = getRelativePosition(e, chart); options.axis = options.axis || 'xy'; var distanceMetric = getDistanceMetricForAxis(options.axis); var items = options.intersect ? getIntersectItems(chart, position) : getNearestItems(chart, position, false, distanceMetric); if (items.length > 0) { items = chart.getDatasetMeta(items[0]._datasetIndex).data; } return items; }, /** * @function Chart.Interaction.modes.x-axis * @deprecated since version 2.4.0. Use index mode and intersect == true * @todo remove at version 3 * @private */ 'x-axis': function(chart, e) { return indexMode(chart, e, {intersect: false}); }, /** * Point mode returns all elements that hit test based on the event position * of the event * @function Chart.Interaction.modes.intersect * @param chart {chart} the chart we are returning items from * @param e {Event} the event we are find things at * @return {Chart.Element[]} Array of elements that are under the point. If none are found, an empty array is returned */ point: function(chart, e) { var position = getRelativePosition(e, chart); return getIntersectItems(chart, position); }, /** * nearest mode returns the element closest to the point * @function Chart.Interaction.modes.intersect * @param chart {chart} the chart we are returning items from * @param e {Event} the event we are find things at * @param options {IInteractionOptions} options to use * @return {Chart.Element[]} Array of elements that are under the point. If none are found, an empty array is returned */ nearest: function(chart, e, options) { var position = getRelativePosition(e, chart); options.axis = options.axis || 'xy'; var distanceMetric = getDistanceMetricForAxis(options.axis); var nearestItems = getNearestItems(chart, position, options.intersect, distanceMetric); // We have multiple items at the same distance from the event. Now sort by smallest if (nearestItems.length > 1) { nearestItems.sort(function(a, b) { var sizeA = a.getArea(); var sizeB = b.getArea(); var ret = sizeA - sizeB; if (ret === 0) { // if equal sort by dataset index ret = a._datasetIndex - b._datasetIndex; } return ret; }); } // Return only 1 item return nearestItems.slice(0, 1); }, /** * x mode returns the elements that hit-test at the current x coordinate * @function Chart.Interaction.modes.x * @param chart {chart} the chart we are returning items from * @param e {Event} the event we are find things at * @param options {IInteractionOptions} options to use * @return {Chart.Element[]} Array of elements that are under the point. If none are found, an empty array is returned */ x: function(chart, e, options) { var position = getRelativePosition(e, chart); var items = []; var intersectsItem = false; parseVisibleItems(chart, function(element) { if (element.inXRange(position.x)) { items.push(element); } if (element.inRange(position.x, position.y)) { intersectsItem = true; } }); // If we want to trigger on an intersect and we don't have any items // that intersect the position, return nothing if (options.intersect && !intersectsItem) { items = []; } return items; }, /** * y mode returns the elements that hit-test at the current y coordinate * @function Chart.Interaction.modes.y * @param chart {chart} the chart we are returning items from * @param e {Event} the event we are find things at * @param options {IInteractionOptions} options to use * @return {Chart.Element[]} Array of elements that are under the point. If none are found, an empty array is returned */ y: function(chart, e, options) { var position = getRelativePosition(e, chart); var items = []; var intersectsItem = false; parseVisibleItems(chart, function(element) { if (element.inYRange(position.y)) { items.push(element); } if (element.inRange(position.x, position.y)) { intersectsItem = true; } }); // If we want to trigger on an intersect and we don't have any items // that intersect the position, return nothing if (options.intersect && !intersectsItem) { items = []; } return items; } } }; /***/ }), /***/ "./node_modules/chart.js/src/core/core.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; var defaults = __webpack_require__("./node_modules/chart.js/src/core/core.defaults.js"); defaults._set('global', { responsive: true, responsiveAnimationDuration: 0, maintainAspectRatio: true, events: ['mousemove', 'mouseout', 'click', 'touchstart', 'touchmove'], hover: { onHover: null, mode: 'nearest', intersect: true, animationDuration: 400 }, onClick: null, defaultColor: 'rgba(0,0,0,0.1)', defaultFontColor: '#666', defaultFontFamily: "'Helvetica Neue', 'Helvetica', 'Arial', sans-serif", defaultFontSize: 12, defaultFontStyle: 'normal', showLines: true, // Element defaults defined in element extensions elements: {}, // Layout options such as padding layout: { padding: { top: 0, right: 0, bottom: 0, left: 0 } } }); module.exports = function() { // Occupy the global variable of Chart, and create a simple base class var Chart = function(item, config) { this.construct(item, config); return this; }; Chart.Chart = Chart; return Chart; }; /***/ }), /***/ "./node_modules/chart.js/src/core/core.layouts.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; var helpers = __webpack_require__("./node_modules/chart.js/src/helpers/index.js"); function filterByPosition(array, position) { return helpers.where(array, function(v) { return v.position === position; }); } function sortByWeight(array, reverse) { array.forEach(function(v, i) { v._tmpIndex_ = i; return v; }); array.sort(function(a, b) { var v0 = reverse ? b : a; var v1 = reverse ? a : b; return v0.weight === v1.weight ? v0._tmpIndex_ - v1._tmpIndex_ : v0.weight - v1.weight; }); array.forEach(function(v) { delete v._tmpIndex_; }); } /** * @interface ILayoutItem * @prop {String} position - The position of the item in the chart layout. Possible values are * 'left', 'top', 'right', 'bottom', and 'chartArea' * @prop {Number} weight - The weight used to sort the item. Higher weights are further away from the chart area * @prop {Boolean} fullWidth - if true, and the item is horizontal, then push vertical boxes down * @prop {Function} isHorizontal - returns true if the layout item is horizontal (ie. top or bottom) * @prop {Function} update - Takes two parameters: width and height. Returns size of item * @prop {Function} getPadding - Returns an object with padding on the edges * @prop {Number} width - Width of item. Must be valid after update() * @prop {Number} height - Height of item. Must be valid after update() * @prop {Number} left - Left edge of the item. Set by layout system and cannot be used in update * @prop {Number} top - Top edge of the item. Set by layout system and cannot be used in update * @prop {Number} right - Right edge of the item. Set by layout system and cannot be used in update * @prop {Number} bottom - Bottom edge of the item. Set by layout system and cannot be used in update */ // The layout service is very self explanatory. It's responsible for the layout within a chart. // Scales, Legends and Plugins all rely on the layout service and can easily register to be placed anywhere they need // It is this service's responsibility of carrying out that layout. module.exports = { defaults: {}, /** * Register a box to a chart. * A box is simply a reference to an object that requires layout. eg. Scales, Legend, Title. * @param {Chart} chart - the chart to use * @param {ILayoutItem} item - the item to add to be layed out */ addBox: function(chart, item) { if (!chart.boxes) { chart.boxes = []; } // initialize item with default values item.fullWidth = item.fullWidth || false; item.position = item.position || 'top'; item.weight = item.weight || 0; chart.boxes.push(item); }, /** * Remove a layoutItem from a chart * @param {Chart} chart - the chart to remove the box from * @param {Object} layoutItem - the item to remove from the layout */ removeBox: function(chart, layoutItem) { var index = chart.boxes ? chart.boxes.indexOf(layoutItem) : -1; if (index !== -1) { chart.boxes.splice(index, 1); } }, /** * Sets (or updates) options on the given `item`. * @param {Chart} chart - the chart in which the item lives (or will be added to) * @param {Object} item - the item to configure with the given options * @param {Object} options - the new item options. */ configure: function(chart, item, options) { var props = ['fullWidth', 'position', 'weight']; var ilen = props.length; var i = 0; var prop; for (; i < ilen; ++i) { prop = props[i]; if (options.hasOwnProperty(prop)) { item[prop] = options[prop]; } } }, /** * Fits boxes of the given chart into the given size by having each box measure itself * then running a fitting algorithm * @param {Chart} chart - the chart * @param {Number} width - the width to fit into * @param {Number} height - the height to fit into */ update: function(chart, width, height) { if (!chart) { return; } var layoutOptions = chart.options.layout || {}; var padding = helpers.options.toPadding(layoutOptions.padding); var leftPadding = padding.left; var rightPadding = padding.right; var topPadding = padding.top; var bottomPadding = padding.bottom; var leftBoxes = filterByPosition(chart.boxes, 'left'); var rightBoxes = filterByPosition(chart.boxes, 'right'); var topBoxes = filterByPosition(chart.boxes, 'top'); var bottomBoxes = filterByPosition(chart.boxes, 'bottom'); var chartAreaBoxes = filterByPosition(chart.boxes, 'chartArea'); // Sort boxes by weight. A higher weight is further away from the chart area sortByWeight(leftBoxes, true); sortByWeight(rightBoxes, false); sortByWeight(topBoxes, true); sortByWeight(bottomBoxes, false); // Essentially we now have any number of boxes on each of the 4 sides. // Our canvas looks like the following. // The areas L1 and L2 are the left axes. R1 is the right axis, T1 is the top axis and // B1 is the bottom axis // There are also 4 quadrant-like locations (left to right instead of clockwise) reserved for chart overlays // These locations are single-box locations only, when trying to register a chartArea location that is already taken, // an error will be thrown. // // |----------------------------------------------------| // | T1 (Full Width) | // |----------------------------------------------------| // | | | T2 | | // | |----|-------------------------------------|----| // | | | C1 | | C2 | | // | | |----| |----| | // | | | | | // | L1 | L2 | ChartArea (C0) | R1 | // | | | | | // | | |----| |----| | // | | | C3 | | C4 | | // | |----|-------------------------------------|----| // | | | B1 | | // |----------------------------------------------------| // | B2 (Full Width) | // |----------------------------------------------------| // // What we do to find the best sizing, we do the following // 1. Determine the minimum size of the chart area. // 2. Split the remaining width equally between each vertical axis // 3. Split the remaining height equally between each horizontal axis // 4. Give each layout the maximum size it can be. The layout will return it's minimum size // 5. Adjust the sizes of each axis based on it's minimum reported size. // 6. Refit each axis // 7. Position each axis in the final location // 8. Tell the chart the final location of the chart area // 9. Tell any axes that overlay the chart area the positions of the chart area // Step 1 var chartWidth = width - leftPadding - rightPadding; var chartHeight = height - topPadding - bottomPadding; var chartAreaWidth = chartWidth / 2; // min 50% var chartAreaHeight = chartHeight / 2; // min 50% // Step 2 var verticalBoxWidth = (width - chartAreaWidth) / (leftBoxes.length + rightBoxes.length); // Step 3 var horizontalBoxHeight = (height - chartAreaHeight) / (topBoxes.length + bottomBoxes.length); // Step 4 var maxChartAreaWidth = chartWidth; var maxChartAreaHeight = chartHeight; var minBoxSizes = []; function getMinimumBoxSize(box) { var minSize; var isHorizontal = box.isHorizontal(); if (isHorizontal) { minSize = box.update(box.fullWidth ? chartWidth : maxChartAreaWidth, horizontalBoxHeight); maxChartAreaHeight -= minSize.height; } else { minSize = box.update(verticalBoxWidth, maxChartAreaHeight); maxChartAreaWidth -= minSize.width; } minBoxSizes.push({ horizontal: isHorizontal, minSize: minSize, box: box, }); } helpers.each(leftBoxes.concat(rightBoxes, topBoxes, bottomBoxes), getMinimumBoxSize); // If a horizontal box has padding, we move the left boxes over to avoid ugly charts (see issue #2478) var maxHorizontalLeftPadding = 0; var maxHorizontalRightPadding = 0; var maxVerticalTopPadding = 0; var maxVerticalBottomPadding = 0; helpers.each(topBoxes.concat(bottomBoxes), function(horizontalBox) { if (horizontalBox.getPadding) { var boxPadding = horizontalBox.getPadding(); maxHorizontalLeftPadding = Math.max(maxHorizontalLeftPadding, boxPadding.left); maxHorizontalRightPadding = Math.max(maxHorizontalRightPadding, boxPadding.right); } }); helpers.each(leftBoxes.concat(rightBoxes), function(verticalBox) { if (verticalBox.getPadding) { var boxPadding = verticalBox.getPadding(); maxVerticalTopPadding = Math.max(maxVerticalTopPadding, boxPadding.top); maxVerticalBottomPadding = Math.max(maxVerticalBottomPadding, boxPadding.bottom); } }); // At this point, maxChartAreaHeight and maxChartAreaWidth are the size the chart area could // be if the axes are drawn at their minimum sizes. // Steps 5 & 6 var totalLeftBoxesWidth = leftPadding; var totalRightBoxesWidth = rightPadding; var totalTopBoxesHeight = topPadding; var totalBottomBoxesHeight = bottomPadding; // Function to fit a box function fitBox(box) { var minBoxSize = helpers.findNextWhere(minBoxSizes, function(minBox) { return minBox.box === box; }); if (minBoxSize) { if (box.isHorizontal()) { var scaleMargin = { left: Math.max(totalLeftBoxesWidth, maxHorizontalLeftPadding), right: Math.max(totalRightBoxesWidth, maxHorizontalRightPadding), top: 0, bottom: 0 }; // Don't use min size here because of label rotation. When the labels are rotated, their rotation highly depends // on the margin. Sometimes they need to increase in size slightly box.update(box.fullWidth ? chartWidth : maxChartAreaWidth, chartHeight / 2, scaleMargin); } else { box.update(minBoxSize.minSize.width, maxChartAreaHeight); } } } // Update, and calculate the left and right margins for the horizontal boxes helpers.each(leftBoxes.concat(rightBoxes), fitBox); helpers.each(leftBoxes, function(box) { totalLeftBoxesWidth += box.width; }); helpers.each(rightBoxes, function(box) { totalRightBoxesWidth += box.width; }); // Set the Left and Right margins for the horizontal boxes helpers.each(topBoxes.concat(bottomBoxes), fitBox); // Figure out how much margin is on the top and bottom of the vertical boxes helpers.each(topBoxes, function(box) { totalTopBoxesHeight += box.height; }); helpers.each(bottomBoxes, function(box) { totalBottomBoxesHeight += box.height; }); function finalFitVerticalBox(box) { var minBoxSize = helpers.findNextWhere(minBoxSizes, function(minSize) { return minSize.box === box; }); var scaleMargin = { left: 0, right: 0, top: totalTopBoxesHeight, bottom: totalBottomBoxesHeight }; if (minBoxSize) { box.update(minBoxSize.minSize.width, maxChartAreaHeight, scaleMargin); } } // Let the left layout know the final margin helpers.each(leftBoxes.concat(rightBoxes), finalFitVerticalBox); // Recalculate because the size of each layout might have changed slightly due to the margins (label rotation for instance) totalLeftBoxesWidth = leftPadding; totalRightBoxesWidth = rightPadding; totalTopBoxesHeight = topPadding; totalBottomBoxesHeight = bottomPadding; helpers.each(leftBoxes, function(box) { totalLeftBoxesWidth += box.width; }); helpers.each(rightBoxes, function(box) { totalRightBoxesWidth += box.width; }); helpers.each(topBoxes, function(box) { totalTopBoxesHeight += box.height; }); helpers.each(bottomBoxes, function(box) { totalBottomBoxesHeight += box.height; }); // We may be adding some padding to account for rotated x axis labels var leftPaddingAddition = Math.max(maxHorizontalLeftPadding - totalLeftBoxesWidth, 0); totalLeftBoxesWidth += leftPaddingAddition; totalRightBoxesWidth += Math.max(maxHorizontalRightPadding - totalRightBoxesWidth, 0); var topPaddingAddition = Math.max(maxVerticalTopPadding - totalTopBoxesHeight, 0); totalTopBoxesHeight += topPaddingAddition; totalBottomBoxesHeight += Math.max(maxVerticalBottomPadding - totalBottomBoxesHeight, 0); // Figure out if our chart area changed. This would occur if the dataset layout label rotation // changed due to the application of the margins in step 6. Since we can only get bigger, this is safe to do // without calling `fit` again var newMaxChartAreaHeight = height - totalTopBoxesHeight - totalBottomBoxesHeight; var newMaxChartAreaWidth = width - totalLeftBoxesWidth - totalRightBoxesWidth; if (newMaxChartAreaWidth !== maxChartAreaWidth || newMaxChartAreaHeight !== maxChartAreaHeight) { helpers.each(leftBoxes, function(box) { box.height = newMaxChartAreaHeight; }); helpers.each(rightBoxes, function(box) { box.height = newMaxChartAreaHeight; }); helpers.each(topBoxes, function(box) { if (!box.fullWidth) { box.width = newMaxChartAreaWidth; } }); helpers.each(bottomBoxes, function(box) { if (!box.fullWidth) { box.width = newMaxChartAreaWidth; } }); maxChartAreaHeight = newMaxChartAreaHeight; maxChartAreaWidth = newMaxChartAreaWidth; } // Step 7 - Position the boxes var left = leftPadding + leftPaddingAddition; var top = topPadding + topPaddingAddition; function placeBox(box) { if (box.isHorizontal()) { box.left = box.fullWidth ? leftPadding : totalLeftBoxesWidth; box.right = box.fullWidth ? width - rightPadding : totalLeftBoxesWidth + maxChartAreaWidth; box.top = top; box.bottom = top + box.height; // Move to next point top = box.bottom; } else { box.left = left; box.right = left + box.width; box.top = totalTopBoxesHeight; box.bottom = totalTopBoxesHeight + maxChartAreaHeight; // Move to next point left = box.right; } } helpers.each(leftBoxes.concat(topBoxes), placeBox); // Account for chart width and height left += maxChartAreaWidth; top += maxChartAreaHeight; helpers.each(rightBoxes, placeBox); helpers.each(bottomBoxes, placeBox); // Step 8 chart.chartArea = { left: totalLeftBoxesWidth, top: totalTopBoxesHeight, right: totalLeftBoxesWidth + maxChartAreaWidth, bottom: totalTopBoxesHeight + maxChartAreaHeight }; // Step 9 helpers.each(chartAreaBoxes, function(box) { box.left = chart.chartArea.left; box.top = chart.chartArea.top; box.right = chart.chartArea.right; box.bottom = chart.chartArea.bottom; box.update(maxChartAreaWidth, maxChartAreaHeight); }); } }; /***/ }), /***/ "./node_modules/chart.js/src/core/core.plugins.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; var defaults = __webpack_require__("./node_modules/chart.js/src/core/core.defaults.js"); var helpers = __webpack_require__("./node_modules/chart.js/src/helpers/index.js"); defaults._set('global', { plugins: {} }); /** * The plugin service singleton * @namespace Chart.plugins * @since 2.1.0 */ module.exports = { /** * Globally registered plugins. * @private */ _plugins: [], /** * This identifier is used to invalidate the descriptors cache attached to each chart * when a global plugin is registered or unregistered. In this case, the cache ID is * incremented and descriptors are regenerated during following API calls. * @private */ _cacheId: 0, /** * Registers the given plugin(s) if not already registered. * @param {Array|Object} plugins plugin instance(s). */ register: function(plugins) { var p = this._plugins; ([]).concat(plugins).forEach(function(plugin) { if (p.indexOf(plugin) === -1) { p.push(plugin); } }); this._cacheId++; }, /** * Unregisters the given plugin(s) only if registered. * @param {Array|Object} plugins plugin instance(s). */ unregister: function(plugins) { var p = this._plugins; ([]).concat(plugins).forEach(function(plugin) { var idx = p.indexOf(plugin); if (idx !== -1) { p.splice(idx, 1); } }); this._cacheId++; }, /** * Remove all registered plugins. * @since 2.1.5 */ clear: function() { this._plugins = []; this._cacheId++; }, /** * Returns the number of registered plugins? * @returns {Number} * @since 2.1.5 */ count: function() { return this._plugins.length; }, /** * Returns all registered plugin instances. * @returns {Array} array of plugin objects. * @since 2.1.5 */ getAll: function() { return this._plugins; }, /** * Calls enabled plugins for `chart` on the specified hook and with the given args. * This method immediately returns as soon as a plugin explicitly returns false. The * returned value can be used, for instance, to interrupt the current action. * @param {Object} chart - The chart instance for which plugins should be called. * @param {String} hook - The name of the plugin method to call (e.g. 'beforeUpdate'). * @param {Array} [args] - Extra arguments to apply to the hook call. * @returns {Boolean} false if any of the plugins return false, else returns true. */ notify: function(chart, hook, args) { var descriptors = this.descriptors(chart); var ilen = descriptors.length; var i, descriptor, plugin, params, method; for (i = 0; i < ilen; ++i) { descriptor = descriptors[i]; plugin = descriptor.plugin; method = plugin[hook]; if (typeof method === 'function') { params = [chart].concat(args || []); params.push(descriptor.options); if (method.apply(plugin, params) === false) { return false; } } } return true; }, /** * Returns descriptors of enabled plugins for the given chart. * @returns {Array} [{ plugin, options }] * @private */ descriptors: function(chart) { var cache = chart.$plugins || (chart.$plugins = {}); if (cache.id === this._cacheId) { return cache.descriptors; } var plugins = []; var descriptors = []; var config = (chart && chart.config) || {}; var options = (config.options && config.options.plugins) || {}; this._plugins.concat(config.plugins || []).forEach(function(plugin) { var idx = plugins.indexOf(plugin); if (idx !== -1) { return; } var id = plugin.id; var opts = options[id]; if (opts === false) { return; } if (opts === true) { opts = helpers.clone(defaults.global.plugins[id]); } plugins.push(plugin); descriptors.push({ plugin: plugin, options: opts || {} }); }); cache.descriptors = descriptors; cache.id = this._cacheId; return descriptors; }, /** * Invalidates cache for the given chart: descriptors hold a reference on plugin option, * but in some cases, this reference can be changed by the user when updating options. * https://github.com/chartjs/Chart.js/issues/5111#issuecomment-355934167 * @private */ _invalidate: function(chart) { delete chart.$plugins; } }; /** * Plugin extension hooks. * @interface IPlugin * @since 2.1.0 */ /** * @method IPlugin#beforeInit * @desc Called before initializing `chart`. * @param {Chart.Controller} chart - The chart instance. * @param {Object} options - The plugin options. */ /** * @method IPlugin#afterInit * @desc Called after `chart` has been initialized and before the first update. * @param {Chart.Controller} chart - The chart instance. * @param {Object} options - The plugin options. */ /** * @method IPlugin#beforeUpdate * @desc Called before updating `chart`. If any plugin returns `false`, the update * is cancelled (and thus subsequent render(s)) until another `update` is triggered. * @param {Chart.Controller} chart - The chart instance. * @param {Object} options - The plugin options. * @returns {Boolean} `false` to cancel the chart update. */ /** * @method IPlugin#afterUpdate * @desc Called after `chart` has been updated and before rendering. Note that this * hook will not be called if the chart update has been previously cancelled. * @param {Chart.Controller} chart - The chart instance. * @param {Object} options - The plugin options. */ /** * @method IPlugin#beforeDatasetsUpdate * @desc Called before updating the `chart` datasets. If any plugin returns `false`, * the datasets update is cancelled until another `update` is triggered. * @param {Chart.Controller} chart - The chart instance. * @param {Object} options - The plugin options. * @returns {Boolean} false to cancel the datasets update. * @since version 2.1.5 */ /** * @method IPlugin#afterDatasetsUpdate * @desc Called after the `chart` datasets have been updated. Note that this hook * will not be called if the datasets update has been previously cancelled. * @param {Chart.Controller} chart - The chart instance. * @param {Object} options - The plugin options. * @since version 2.1.5 */ /** * @method IPlugin#beforeDatasetUpdate * @desc Called before updating the `chart` dataset at the given `args.index`. If any plugin * returns `false`, the datasets update is cancelled until another `update` is triggered. * @param {Chart} chart - The chart instance. * @param {Object} args - The call arguments. * @param {Number} args.index - The dataset index. * @param {Object} args.meta - The dataset metadata. * @param {Object} options - The plugin options. * @returns {Boolean} `false` to cancel the chart datasets drawing. */ /** * @method IPlugin#afterDatasetUpdate * @desc Called after the `chart` datasets at the given `args.index` has been updated. Note * that this hook will not be called if the datasets update has been previously cancelled. * @param {Chart} chart - The chart instance. * @param {Object} args - The call arguments. * @param {Number} args.index - The dataset index. * @param {Object} args.meta - The dataset metadata. * @param {Object} options - The plugin options. */ /** * @method IPlugin#beforeLayout * @desc Called before laying out `chart`. If any plugin returns `false`, * the layout update is cancelled until another `update` is triggered. * @param {Chart.Controller} chart - The chart instance. * @param {Object} options - The plugin options. * @returns {Boolean} `false` to cancel the chart layout. */ /** * @method IPlugin#afterLayout * @desc Called after the `chart` has been layed out. Note that this hook will not * be called if the layout update has been previously cancelled. * @param {Chart.Controller} chart - The chart instance. * @param {Object} options - The plugin options. */ /** * @method IPlugin#beforeRender * @desc Called before rendering `chart`. If any plugin returns `false`, * the rendering is cancelled until another `render` is triggered. * @param {Chart.Controller} chart - The chart instance. * @param {Object} options - The plugin options. * @returns {Boolean} `false` to cancel the chart rendering. */ /** * @method IPlugin#afterRender * @desc Called after the `chart` has been fully rendered (and animation completed). Note * that this hook will not be called if the rendering has been previously cancelled. * @param {Chart.Controller} chart - The chart instance. * @param {Object} options - The plugin options. */ /** * @method IPlugin#beforeDraw * @desc Called before drawing `chart` at every animation frame specified by the given * easing value. If any plugin returns `false`, the frame drawing is cancelled until * another `render` is triggered. * @param {Chart.Controller} chart - The chart instance. * @param {Number} easingValue - The current animation value, between 0.0 and 1.0. * @param {Object} options - The plugin options. * @returns {Boolean} `false` to cancel the chart drawing. */ /** * @method IPlugin#afterDraw * @desc Called after the `chart` has been drawn for the specific easing value. Note * that this hook will not be called if the drawing has been previously cancelled. * @param {Chart.Controller} chart - The chart instance. * @param {Number} easingValue - The current animation value, between 0.0 and 1.0. * @param {Object} options - The plugin options. */ /** * @method IPlugin#beforeDatasetsDraw * @desc Called before drawing the `chart` datasets. If any plugin returns `false`, * the datasets drawing is cancelled until another `render` is triggered. * @param {Chart.Controller} chart - The chart instance. * @param {Number} easingValue - The current animation value, between 0.0 and 1.0. * @param {Object} options - The plugin options. * @returns {Boolean} `false` to cancel the chart datasets drawing. */ /** * @method IPlugin#afterDatasetsDraw * @desc Called after the `chart` datasets have been drawn. Note that this hook * will not be called if the datasets drawing has been previously cancelled. * @param {Chart.Controller} chart - The chart instance. * @param {Number} easingValue - The current animation value, between 0.0 and 1.0. * @param {Object} options - The plugin options. */ /** * @method IPlugin#beforeDatasetDraw * @desc Called before drawing the `chart` dataset at the given `args.index` (datasets * are drawn in the reverse order). If any plugin returns `false`, the datasets drawing * is cancelled until another `render` is triggered. * @param {Chart} chart - The chart instance. * @param {Object} args - The call arguments. * @param {Number} args.index - The dataset index. * @param {Object} args.meta - The dataset metadata. * @param {Number} args.easingValue - The current animation value, between 0.0 and 1.0. * @param {Object} options - The plugin options. * @returns {Boolean} `false` to cancel the chart datasets drawing. */ /** * @method IPlugin#afterDatasetDraw * @desc Called after the `chart` datasets at the given `args.index` have been drawn * (datasets are drawn in the reverse order). Note that this hook will not be called * if the datasets drawing has been previously cancelled. * @param {Chart} chart - The chart instance. * @param {Object} args - The call arguments. * @param {Number} args.index - The dataset index. * @param {Object} args.meta - The dataset metadata. * @param {Number} args.easingValue - The current animation value, between 0.0 and 1.0. * @param {Object} options - The plugin options. */ /** * @method IPlugin#beforeTooltipDraw * @desc Called before drawing the `tooltip`. If any plugin returns `false`, * the tooltip drawing is cancelled until another `render` is triggered. * @param {Chart} chart - The chart instance. * @param {Object} args - The call arguments. * @param {Object} args.tooltip - The tooltip. * @param {Number} args.easingValue - The current animation value, between 0.0 and 1.0. * @param {Object} options - The plugin options. * @returns {Boolean} `false` to cancel the chart tooltip drawing. */ /** * @method IPlugin#afterTooltipDraw * @desc Called after drawing the `tooltip`. Note that this hook will not * be called if the tooltip drawing has been previously cancelled. * @param {Chart} chart - The chart instance. * @param {Object} args - The call arguments. * @param {Object} args.tooltip - The tooltip. * @param {Number} args.easingValue - The current animation value, between 0.0 and 1.0. * @param {Object} options - The plugin options. */ /** * @method IPlugin#beforeEvent * @desc Called before processing the specified `event`. If any plugin returns `false`, * the event will be discarded. * @param {Chart.Controller} chart - The chart instance. * @param {IEvent} event - The event object. * @param {Object} options - The plugin options. */ /** * @method IPlugin#afterEvent * @desc Called after the `event` has been consumed. Note that this hook * will not be called if the `event` has been previously discarded. * @param {Chart.Controller} chart - The chart instance. * @param {IEvent} event - The event object. * @param {Object} options - The plugin options. */ /** * @method IPlugin#resize * @desc Called after the chart as been resized. * @param {Chart.Controller} chart - The chart instance. * @param {Number} size - The new canvas display size (eq. canvas.style width & height). * @param {Object} options - The plugin options. */ /** * @method IPlugin#destroy * @desc Called after the chart as been destroyed. * @param {Chart.Controller} chart - The chart instance. * @param {Object} options - The plugin options. */ /***/ }), /***/ "./node_modules/chart.js/src/core/core.scale.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; var defaults = __webpack_require__("./node_modules/chart.js/src/core/core.defaults.js"); var Element = __webpack_require__("./node_modules/chart.js/src/core/core.element.js"); var helpers = __webpack_require__("./node_modules/chart.js/src/helpers/index.js"); var Ticks = __webpack_require__("./node_modules/chart.js/src/core/core.ticks.js"); defaults._set('scale', { display: true, position: 'left', offset: false, // grid line settings gridLines: { display: true, color: 'rgba(0, 0, 0, 0.1)', lineWidth: 1, drawBorder: true, drawOnChartArea: true, drawTicks: true, tickMarkLength: 10, zeroLineWidth: 1, zeroLineColor: 'rgba(0,0,0,0.25)', zeroLineBorderDash: [], zeroLineBorderDashOffset: 0.0, offsetGridLines: false, borderDash: [], borderDashOffset: 0.0 }, // scale label scaleLabel: { // display property display: false, // actual label labelString: '', // line height lineHeight: 1.2, // top/bottom padding padding: { top: 4, bottom: 4 } }, // label settings ticks: { beginAtZero: false, minRotation: 0, maxRotation: 50, mirror: false, padding: 0, reverse: false, display: true, autoSkip: true, autoSkipPadding: 0, labelOffset: 0, // We pass through arrays to be rendered as multiline labels, we convert Others to strings here. callback: Ticks.formatters.values, minor: {}, major: {} } }); function labelsFromTicks(ticks) { var labels = []; var i, ilen; for (i = 0, ilen = ticks.length; i < ilen; ++i) { labels.push(ticks[i].label); } return labels; } function getLineValue(scale, index, offsetGridLines) { var lineValue = scale.getPixelForTick(index); if (offsetGridLines) { if (index === 0) { lineValue -= (scale.getPixelForTick(1) - lineValue) / 2; } else { lineValue -= (lineValue - scale.getPixelForTick(index - 1)) / 2; } } return lineValue; } module.exports = function(Chart) { function computeTextSize(context, tick, font) { return helpers.isArray(tick) ? helpers.longestText(context, font, tick) : context.measureText(tick).width; } function parseFontOptions(options) { var valueOrDefault = helpers.valueOrDefault; var globalDefaults = defaults.global; var size = valueOrDefault(options.fontSize, globalDefaults.defaultFontSize); var style = valueOrDefault(options.fontStyle, globalDefaults.defaultFontStyle); var family = valueOrDefault(options.fontFamily, globalDefaults.defaultFontFamily); return { size: size, style: style, family: family, font: helpers.fontString(size, style, family) }; } function parseLineHeight(options) { return helpers.options.toLineHeight( helpers.valueOrDefault(options.lineHeight, 1.2), helpers.valueOrDefault(options.fontSize, defaults.global.defaultFontSize)); } Chart.Scale = Element.extend({ /** * Get the padding needed for the scale * @method getPadding * @private * @returns {Padding} the necessary padding */ getPadding: function() { var me = this; return { left: me.paddingLeft || 0, top: me.paddingTop || 0, right: me.paddingRight || 0, bottom: me.paddingBottom || 0 }; }, /** * Returns the scale tick objects ({label, major}) * @since 2.7 */ getTicks: function() { return this._ticks; }, // These methods are ordered by lifecyle. Utilities then follow. // Any function defined here is inherited by all scale types. // Any function can be extended by the scale type mergeTicksOptions: function() { var ticks = this.options.ticks; if (ticks.minor === false) { ticks.minor = { display: false }; } if (ticks.major === false) { ticks.major = { display: false }; } for (var key in ticks) { if (key !== 'major' && key !== 'minor') { if (typeof ticks.minor[key] === 'undefined') { ticks.minor[key] = ticks[key]; } if (typeof ticks.major[key] === 'undefined') { ticks.major[key] = ticks[key]; } } } }, beforeUpdate: function() { helpers.callback(this.options.beforeUpdate, [this]); }, update: function(maxWidth, maxHeight, margins) { var me = this; var i, ilen, labels, label, ticks, tick; // Update Lifecycle - Probably don't want to ever extend or overwrite this function ;) me.beforeUpdate(); // Absorb the master measurements me.maxWidth = maxWidth; me.maxHeight = maxHeight; me.margins = helpers.extend({ left: 0, right: 0, top: 0, bottom: 0 }, margins); me.longestTextCache = me.longestTextCache || {}; // Dimensions me.beforeSetDimensions(); me.setDimensions(); me.afterSetDimensions(); // Data min/max me.beforeDataLimits(); me.determineDataLimits(); me.afterDataLimits(); // Ticks - `this.ticks` is now DEPRECATED! // Internal ticks are now stored as objects in the PRIVATE `this._ticks` member // and must not be accessed directly from outside this class. `this.ticks` being // around for long time and not marked as private, we can't change its structure // without unexpected breaking changes. If you need to access the scale ticks, // use scale.getTicks() instead. me.beforeBuildTicks(); // New implementations should return an array of objects but for BACKWARD COMPAT, // we still support no return (`this.ticks` internally set by calling this method). ticks = me.buildTicks() || []; me.afterBuildTicks(); me.beforeTickToLabelConversion(); // New implementations should return the formatted tick labels but for BACKWARD // COMPAT, we still support no return (`this.ticks` internally changed by calling // this method and supposed to contain only string values). labels = me.convertTicksToLabels(ticks) || me.ticks; me.afterTickToLabelConversion(); me.ticks = labels; // BACKWARD COMPATIBILITY // IMPORTANT: from this point, we consider that `this.ticks` will NEVER change! // BACKWARD COMPAT: synchronize `_ticks` with labels (so potentially `this.ticks`) for (i = 0, ilen = labels.length; i < ilen; ++i) { label = labels[i]; tick = ticks[i]; if (!tick) { ticks.push(tick = { label: label, major: false }); } else { tick.label = label; } } me._ticks = ticks; // Tick Rotation me.beforeCalculateTickRotation(); me.calculateTickRotation(); me.afterCalculateTickRotation(); // Fit me.beforeFit(); me.fit(); me.afterFit(); // me.afterUpdate(); return me.minSize; }, afterUpdate: function() { helpers.callback(this.options.afterUpdate, [this]); }, // beforeSetDimensions: function() { helpers.callback(this.options.beforeSetDimensions, [this]); }, setDimensions: function() { var me = this; // Set the unconstrained dimension before label rotation if (me.isHorizontal()) { // Reset position before calculating rotation me.width = me.maxWidth; me.left = 0; me.right = me.width; } else { me.height = me.maxHeight; // Reset position before calculating rotation me.top = 0; me.bottom = me.height; } // Reset padding me.paddingLeft = 0; me.paddingTop = 0; me.paddingRight = 0; me.paddingBottom = 0; }, afterSetDimensions: function() { helpers.callback(this.options.afterSetDimensions, [this]); }, // Data limits beforeDataLimits: function() { helpers.callback(this.options.beforeDataLimits, [this]); }, determineDataLimits: helpers.noop, afterDataLimits: function() { helpers.callback(this.options.afterDataLimits, [this]); }, // beforeBuildTicks: function() { helpers.callback(this.options.beforeBuildTicks, [this]); }, buildTicks: helpers.noop, afterBuildTicks: function() { helpers.callback(this.options.afterBuildTicks, [this]); }, beforeTickToLabelConversion: function() { helpers.callback(this.options.beforeTickToLabelConversion, [this]); }, convertTicksToLabels: function() { var me = this; // Convert ticks to strings var tickOpts = me.options.ticks; me.ticks = me.ticks.map(tickOpts.userCallback || tickOpts.callback, this); }, afterTickToLabelConversion: function() { helpers.callback(this.options.afterTickToLabelConversion, [this]); }, // beforeCalculateTickRotation: function() { helpers.callback(this.options.beforeCalculateTickRotation, [this]); }, calculateTickRotation: function() { var me = this; var context = me.ctx; var tickOpts = me.options.ticks; var labels = labelsFromTicks(me._ticks); // Get the width of each grid by calculating the difference // between x offsets between 0 and 1. var tickFont = parseFontOptions(tickOpts); context.font = tickFont.font; var labelRotation = tickOpts.minRotation || 0; if (labels.length && me.options.display && me.isHorizontal()) { var originalLabelWidth = helpers.longestText(context, tickFont.font, labels, me.longestTextCache); var labelWidth = originalLabelWidth; var cosRotation, sinRotation; // Allow 3 pixels x2 padding either side for label readability var tickWidth = me.getPixelForTick(1) - me.getPixelForTick(0) - 6; // Max label rotation can be set or default to 90 - also act as a loop counter while (labelWidth > tickWidth && labelRotation < tickOpts.maxRotation) { var angleRadians = helpers.toRadians(labelRotation); cosRotation = Math.cos(angleRadians); sinRotation = Math.sin(angleRadians); if (sinRotation * originalLabelWidth > me.maxHeight) { // go back one step labelRotation--; break; } labelRotation++; labelWidth = cosRotation * originalLabelWidth; } } me.labelRotation = labelRotation; }, afterCalculateTickRotation: function() { helpers.callback(this.options.afterCalculateTickRotation, [this]); }, // beforeFit: function() { helpers.callback(this.options.beforeFit, [this]); }, fit: function() { var me = this; // Reset var minSize = me.minSize = { width: 0, height: 0 }; var labels = labelsFromTicks(me._ticks); var opts = me.options; var tickOpts = opts.ticks; var scaleLabelOpts = opts.scaleLabel; var gridLineOpts = opts.gridLines; var display = opts.display; var isHorizontal = me.isHorizontal(); var tickFont = parseFontOptions(tickOpts); var tickMarkLength = opts.gridLines.tickMarkLength; // Width if (isHorizontal) { // subtract the margins to line up with the chartArea if we are a full width scale minSize.width = me.isFullWidth() ? me.maxWidth - me.margins.left - me.margins.right : me.maxWidth; } else { minSize.width = display && gridLineOpts.drawTicks ? tickMarkLength : 0; } // height if (isHorizontal) { minSize.height = display && gridLineOpts.drawTicks ? tickMarkLength : 0; } else { minSize.height = me.maxHeight; // fill all the height } // Are we showing a title for the scale? if (scaleLabelOpts.display && display) { var scaleLabelLineHeight = parseLineHeight(scaleLabelOpts); var scaleLabelPadding = helpers.options.toPadding(scaleLabelOpts.padding); var deltaHeight = scaleLabelLineHeight + scaleLabelPadding.height; if (isHorizontal) { minSize.height += deltaHeight; } else { minSize.width += deltaHeight; } } // Don't bother fitting the ticks if we are not showing them if (tickOpts.display && display) { var largestTextWidth = helpers.longestText(me.ctx, tickFont.font, labels, me.longestTextCache); var tallestLabelHeightInLines = helpers.numberOfLabelLines(labels); var lineSpace = tickFont.size * 0.5; var tickPadding = me.options.ticks.padding; if (isHorizontal) { // A horizontal axis is more constrained by the height. me.longestLabelWidth = largestTextWidth; var angleRadians = helpers.toRadians(me.labelRotation); var cosRotation = Math.cos(angleRadians); var sinRotation = Math.sin(angleRadians); // TODO - improve this calculation var labelHeight = (sinRotation * largestTextWidth) + (tickFont.size * tallestLabelHeightInLines) + (lineSpace * (tallestLabelHeightInLines - 1)) + lineSpace; // padding minSize.height = Math.min(me.maxHeight, minSize.height + labelHeight + tickPadding); me.ctx.font = tickFont.font; var firstLabelWidth = computeTextSize(me.ctx, labels[0], tickFont.font); var lastLabelWidth = computeTextSize(me.ctx, labels[labels.length - 1], tickFont.font); // Ensure that our ticks are always inside the canvas. When rotated, ticks are right aligned // which means that the right padding is dominated by the font height if (me.labelRotation !== 0) { me.paddingLeft = opts.position === 'bottom' ? (cosRotation * firstLabelWidth) + 3 : (cosRotation * lineSpace) + 3; // add 3 px to move away from canvas edges me.paddingRight = opts.position === 'bottom' ? (cosRotation * lineSpace) + 3 : (cosRotation * lastLabelWidth) + 3; } else { me.paddingLeft = firstLabelWidth / 2 + 3; // add 3 px to move away from canvas edges me.paddingRight = lastLabelWidth / 2 + 3; } } else { // A vertical axis is more constrained by the width. Labels are the // dominant factor here, so get that length first and account for padding if (tickOpts.mirror) { largestTextWidth = 0; } else { // use lineSpace for consistency with horizontal axis // tickPadding is not implemented for horizontal largestTextWidth += tickPadding + lineSpace; } minSize.width = Math.min(me.maxWidth, minSize.width + largestTextWidth); me.paddingTop = tickFont.size / 2; me.paddingBottom = tickFont.size / 2; } } me.handleMargins(); me.width = minSize.width; me.height = minSize.height; }, /** * Handle margins and padding interactions * @private */ handleMargins: function() { var me = this; if (me.margins) { me.paddingLeft = Math.max(me.paddingLeft - me.margins.left, 0); me.paddingTop = Math.max(me.paddingTop - me.margins.top, 0); me.paddingRight = Math.max(me.paddingRight - me.margins.right, 0); me.paddingBottom = Math.max(me.paddingBottom - me.margins.bottom, 0); } }, afterFit: function() { helpers.callback(this.options.afterFit, [this]); }, // Shared Methods isHorizontal: function() { return this.options.position === 'top' || this.options.position === 'bottom'; }, isFullWidth: function() { return (this.options.fullWidth); }, // Get the correct value. NaN bad inputs, If the value type is object get the x or y based on whether we are horizontal or not getRightValue: function(rawValue) { // Null and undefined values first if (helpers.isNullOrUndef(rawValue)) { return NaN; } // isNaN(object) returns true, so make sure NaN is checking for a number; Discard Infinite values if (typeof rawValue === 'number' && !isFinite(rawValue)) { return NaN; } // If it is in fact an object, dive in one more level if (rawValue) { if (this.isHorizontal()) { if (rawValue.x !== undefined) { return this.getRightValue(rawValue.x); } } else if (rawValue.y !== undefined) { return this.getRightValue(rawValue.y); } } // Value is good, return it return rawValue; }, /** * Used to get the value to display in the tooltip for the data at the given index * @param index * @param datasetIndex */ getLabelForIndex: helpers.noop, /** * Returns the location of the given data point. Value can either be an index or a numerical value * The coordinate (0, 0) is at the upper-left corner of the canvas * @param value * @param index * @param datasetIndex */ getPixelForValue: helpers.noop, /** * Used to get the data value from a given pixel. This is the inverse of getPixelForValue * The coordinate (0, 0) is at the upper-left corner of the canvas * @param pixel */ getValueForPixel: helpers.noop, /** * Returns the location of the tick at the given index * The coordinate (0, 0) is at the upper-left corner of the canvas */ getPixelForTick: function(index) { var me = this; var offset = me.options.offset; if (me.isHorizontal()) { var innerWidth = me.width - (me.paddingLeft + me.paddingRight); var tickWidth = innerWidth / Math.max((me._ticks.length - (offset ? 0 : 1)), 1); var pixel = (tickWidth * index) + me.paddingLeft; if (offset) { pixel += tickWidth / 2; } var finalVal = me.left + Math.round(pixel); finalVal += me.isFullWidth() ? me.margins.left : 0; return finalVal; } var innerHeight = me.height - (me.paddingTop + me.paddingBottom); return me.top + (index * (innerHeight / (me._ticks.length - 1))); }, /** * Utility for getting the pixel location of a percentage of scale * The coordinate (0, 0) is at the upper-left corner of the canvas */ getPixelForDecimal: function(decimal) { var me = this; if (me.isHorizontal()) { var innerWidth = me.width - (me.paddingLeft + me.paddingRight); var valueOffset = (innerWidth * decimal) + me.paddingLeft; var finalVal = me.left + Math.round(valueOffset); finalVal += me.isFullWidth() ? me.margins.left : 0; return finalVal; } return me.top + (decimal * me.height); }, /** * Returns the pixel for the minimum chart value * The coordinate (0, 0) is at the upper-left corner of the canvas */ getBasePixel: function() { return this.getPixelForValue(this.getBaseValue()); }, getBaseValue: function() { var me = this; var min = me.min; var max = me.max; return me.beginAtZero ? 0 : min < 0 && max < 0 ? max : min > 0 && max > 0 ? min : 0; }, /** * Returns a subset of ticks to be plotted to avoid overlapping labels. * @private */ _autoSkip: function(ticks) { var skipRatio; var me = this; var isHorizontal = me.isHorizontal(); var optionTicks = me.options.ticks.minor; var tickCount = ticks.length; var labelRotationRadians = helpers.toRadians(me.labelRotation); var cosRotation = Math.cos(labelRotationRadians); var longestRotatedLabel = me.longestLabelWidth * cosRotation; var result = []; var i, tick, shouldSkip; // figure out the maximum number of gridlines to show var maxTicks; if (optionTicks.maxTicksLimit) { maxTicks = optionTicks.maxTicksLimit; } if (isHorizontal) { skipRatio = false; if ((longestRotatedLabel + optionTicks.autoSkipPadding) * tickCount > (me.width - (me.paddingLeft + me.paddingRight))) { skipRatio = 1 + Math.floor(((longestRotatedLabel + optionTicks.autoSkipPadding) * tickCount) / (me.width - (me.paddingLeft + me.paddingRight))); } // if they defined a max number of optionTicks, // increase skipRatio until that number is met if (maxTicks && tickCount > maxTicks) { skipRatio = Math.max(skipRatio, Math.floor(tickCount / maxTicks)); } } for (i = 0; i < tickCount; i++) { tick = ticks[i]; // Since we always show the last tick,we need may need to hide the last shown one before shouldSkip = (skipRatio > 1 && i % skipRatio > 0) || (i % skipRatio === 0 && i + skipRatio >= tickCount); if (shouldSkip && i !== tickCount - 1) { // leave tick in place but make sure it's not displayed (#4635) delete tick.label; } result.push(tick); } return result; }, // Actually draw the scale on the canvas // @param {rectangle} chartArea : the area of the chart to draw full grid lines on draw: function(chartArea) { var me = this; var options = me.options; if (!options.display) { return; } var context = me.ctx; var globalDefaults = defaults.global; var optionTicks = options.ticks.minor; var optionMajorTicks = options.ticks.major || optionTicks; var gridLines = options.gridLines; var scaleLabel = options.scaleLabel; var isRotated = me.labelRotation !== 0; var isHorizontal = me.isHorizontal(); var ticks = optionTicks.autoSkip ? me._autoSkip(me.getTicks()) : me.getTicks(); var tickFontColor = helpers.valueOrDefault(optionTicks.fontColor, globalDefaults.defaultFontColor); var tickFont = parseFontOptions(optionTicks); var majorTickFontColor = helpers.valueOrDefault(optionMajorTicks.fontColor, globalDefaults.defaultFontColor); var majorTickFont = parseFontOptions(optionMajorTicks); var tl = gridLines.drawTicks ? gridLines.tickMarkLength : 0; var scaleLabelFontColor = helpers.valueOrDefault(scaleLabel.fontColor, globalDefaults.defaultFontColor); var scaleLabelFont = parseFontOptions(scaleLabel); var scaleLabelPadding = helpers.options.toPadding(scaleLabel.padding); var labelRotationRadians = helpers.toRadians(me.labelRotation); var itemsToDraw = []; var axisWidth = me.options.gridLines.lineWidth; var xTickStart = options.position === 'right' ? me.right : me.right - axisWidth - tl; var xTickEnd = options.position === 'right' ? me.right + tl : me.right; var yTickStart = options.position === 'bottom' ? me.top + axisWidth : me.bottom - tl - axisWidth; var yTickEnd = options.position === 'bottom' ? me.top + axisWidth + tl : me.bottom + axisWidth; helpers.each(ticks, function(tick, index) { // autoskipper skipped this tick (#4635) if (helpers.isNullOrUndef(tick.label)) { return; } var label = tick.label; var lineWidth, lineColor, borderDash, borderDashOffset; if (index === me.zeroLineIndex && options.offset === gridLines.offsetGridLines) { // Draw the first index specially lineWidth = gridLines.zeroLineWidth; lineColor = gridLines.zeroLineColor; borderDash = gridLines.zeroLineBorderDash; borderDashOffset = gridLines.zeroLineBorderDashOffset; } else { lineWidth = helpers.valueAtIndexOrDefault(gridLines.lineWidth, index); lineColor = helpers.valueAtIndexOrDefault(gridLines.color, index); borderDash = helpers.valueOrDefault(gridLines.borderDash, globalDefaults.borderDash); borderDashOffset = helpers.valueOrDefault(gridLines.borderDashOffset, globalDefaults.borderDashOffset); } // Common properties var tx1, ty1, tx2, ty2, x1, y1, x2, y2, labelX, labelY; var textAlign = 'middle'; var textBaseline = 'middle'; var tickPadding = optionTicks.padding; if (isHorizontal) { var labelYOffset = tl + tickPadding; if (options.position === 'bottom') { // bottom textBaseline = !isRotated ? 'top' : 'middle'; textAlign = !isRotated ? 'center' : 'right'; labelY = me.top + labelYOffset; } else { // top textBaseline = !isRotated ? 'bottom' : 'middle'; textAlign = !isRotated ? 'center' : 'left'; labelY = me.bottom - labelYOffset; } var xLineValue = getLineValue(me, index, gridLines.offsetGridLines && ticks.length > 1); if (xLineValue < me.left) { lineColor = 'rgba(0,0,0,0)'; } xLineValue += helpers.aliasPixel(lineWidth); labelX = me.getPixelForTick(index) + optionTicks.labelOffset; // x values for optionTicks (need to consider offsetLabel option) tx1 = tx2 = x1 = x2 = xLineValue; ty1 = yTickStart; ty2 = yTickEnd; y1 = chartArea.top; y2 = chartArea.bottom + axisWidth; } else { var isLeft = options.position === 'left'; var labelXOffset; if (optionTicks.mirror) { textAlign = isLeft ? 'left' : 'right'; labelXOffset = tickPadding; } else { textAlign = isLeft ? 'right' : 'left'; labelXOffset = tl + tickPadding; } labelX = isLeft ? me.right - labelXOffset : me.left + labelXOffset; var yLineValue = getLineValue(me, index, gridLines.offsetGridLines && ticks.length > 1); if (yLineValue < me.top) { lineColor = 'rgba(0,0,0,0)'; } yLineValue += helpers.aliasPixel(lineWidth); labelY = me.getPixelForTick(index) + optionTicks.labelOffset; tx1 = xTickStart; tx2 = xTickEnd; x1 = chartArea.left; x2 = chartArea.right + axisWidth; ty1 = ty2 = y1 = y2 = yLineValue; } itemsToDraw.push({ tx1: tx1, ty1: ty1, tx2: tx2, ty2: ty2, x1: x1, y1: y1, x2: x2, y2: y2, labelX: labelX, labelY: labelY, glWidth: lineWidth, glColor: lineColor, glBorderDash: borderDash, glBorderDashOffset: borderDashOffset, rotation: -1 * labelRotationRadians, label: label, major: tick.major, textBaseline: textBaseline, textAlign: textAlign }); }); // Draw all of the tick labels, tick marks, and grid lines at the correct places helpers.each(itemsToDraw, function(itemToDraw) { if (gridLines.display) { context.save(); context.lineWidth = itemToDraw.glWidth; context.strokeStyle = itemToDraw.glColor; if (context.setLineDash) { context.setLineDash(itemToDraw.glBorderDash); context.lineDashOffset = itemToDraw.glBorderDashOffset; } context.beginPath(); if (gridLines.drawTicks) { context.moveTo(itemToDraw.tx1, itemToDraw.ty1); context.lineTo(itemToDraw.tx2, itemToDraw.ty2); } if (gridLines.drawOnChartArea) { context.moveTo(itemToDraw.x1, itemToDraw.y1); context.lineTo(itemToDraw.x2, itemToDraw.y2); } context.stroke(); context.restore(); } if (optionTicks.display) { // Make sure we draw text in the correct color and font context.save(); context.translate(itemToDraw.labelX, itemToDraw.labelY); context.rotate(itemToDraw.rotation); context.font = itemToDraw.major ? majorTickFont.font : tickFont.font; context.fillStyle = itemToDraw.major ? majorTickFontColor : tickFontColor; context.textBaseline = itemToDraw.textBaseline; context.textAlign = itemToDraw.textAlign; var label = itemToDraw.label; if (helpers.isArray(label)) { var lineCount = label.length; var lineHeight = tickFont.size * 1.5; var y = me.isHorizontal() ? 0 : -lineHeight * (lineCount - 1) / 2; for (var i = 0; i < lineCount; ++i) { // We just make sure the multiline element is a string here.. context.fillText('' + label[i], 0, y); // apply same lineSpacing as calculated @ L#320 y += lineHeight; } } else { context.fillText(label, 0, 0); } context.restore(); } }); if (scaleLabel.display) { // Draw the scale label var scaleLabelX; var scaleLabelY; var rotation = 0; var halfLineHeight = parseLineHeight(scaleLabel) / 2; if (isHorizontal) { scaleLabelX = me.left + ((me.right - me.left) / 2); // midpoint of the width scaleLabelY = options.position === 'bottom' ? me.bottom - halfLineHeight - scaleLabelPadding.bottom : me.top + halfLineHeight + scaleLabelPadding.top; } else { var isLeft = options.position === 'left'; scaleLabelX = isLeft ? me.left + halfLineHeight + scaleLabelPadding.top : me.right - halfLineHeight - scaleLabelPadding.top; scaleLabelY = me.top + ((me.bottom - me.top) / 2); rotation = isLeft ? -0.5 * Math.PI : 0.5 * Math.PI; } context.save(); context.translate(scaleLabelX, scaleLabelY); context.rotate(rotation); context.textAlign = 'center'; context.textBaseline = 'middle'; context.fillStyle = scaleLabelFontColor; // render in correct colour context.font = scaleLabelFont.font; context.fillText(scaleLabel.labelString, 0, 0); context.restore(); } if (gridLines.drawBorder) { // Draw the line at the edge of the axis context.lineWidth = helpers.valueAtIndexOrDefault(gridLines.lineWidth, 0); context.strokeStyle = helpers.valueAtIndexOrDefault(gridLines.color, 0); var x1 = me.left; var x2 = me.right + axisWidth; var y1 = me.top; var y2 = me.bottom + axisWidth; var aliasPixel = helpers.aliasPixel(context.lineWidth); if (isHorizontal) { y1 = y2 = options.position === 'top' ? me.bottom : me.top; y1 += aliasPixel; y2 += aliasPixel; } else { x1 = x2 = options.position === 'left' ? me.right : me.left; x1 += aliasPixel; x2 += aliasPixel; } context.beginPath(); context.moveTo(x1, y1); context.lineTo(x2, y2); context.stroke(); } } }); }; /***/ }), /***/ "./node_modules/chart.js/src/core/core.scaleService.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; var defaults = __webpack_require__("./node_modules/chart.js/src/core/core.defaults.js"); var helpers = __webpack_require__("./node_modules/chart.js/src/helpers/index.js"); var layouts = __webpack_require__("./node_modules/chart.js/src/core/core.layouts.js"); module.exports = function(Chart) { Chart.scaleService = { // Scale registration object. Extensions can register new scale types (such as log or DB scales) and then // use the new chart options to grab the correct scale constructors: {}, // Use a registration function so that we can move to an ES6 map when we no longer need to support // old browsers // Scale config defaults defaults: {}, registerScaleType: function(type, scaleConstructor, scaleDefaults) { this.constructors[type] = scaleConstructor; this.defaults[type] = helpers.clone(scaleDefaults); }, getScaleConstructor: function(type) { return this.constructors.hasOwnProperty(type) ? this.constructors[type] : undefined; }, getScaleDefaults: function(type) { // Return the scale defaults merged with the global settings so that we always use the latest ones return this.defaults.hasOwnProperty(type) ? helpers.merge({}, [defaults.scale, this.defaults[type]]) : {}; }, updateScaleDefaults: function(type, additions) { var me = this; if (me.defaults.hasOwnProperty(type)) { me.defaults[type] = helpers.extend(me.defaults[type], additions); } }, addScalesToLayout: function(chart) { // Adds each scale to the chart.boxes array to be sized accordingly helpers.each(chart.scales, function(scale) { // Set ILayoutItem parameters for backwards compatibility scale.fullWidth = scale.options.fullWidth; scale.position = scale.options.position; scale.weight = scale.options.weight; layouts.addBox(chart, scale); }); } }; }; /***/ }), /***/ "./node_modules/chart.js/src/core/core.ticks.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; var helpers = __webpack_require__("./node_modules/chart.js/src/helpers/index.js"); /** * Namespace to hold static tick generation functions * @namespace Chart.Ticks */ module.exports = { /** * Namespace to hold formatters for different types of ticks * @namespace Chart.Ticks.formatters */ formatters: { /** * Formatter for value labels * @method Chart.Ticks.formatters.values * @param value the value to display * @return {String|Array} the label to display */ values: function(value) { return helpers.isArray(value) ? value : '' + value; }, /** * Formatter for linear numeric ticks * @method Chart.Ticks.formatters.linear * @param tickValue {Number} the value to be formatted * @param index {Number} the position of the tickValue parameter in the ticks array * @param ticks {Array<Number>} the list of ticks being converted * @return {String} string representation of the tickValue parameter */ linear: function(tickValue, index, ticks) { // If we have lots of ticks, don't use the ones var delta = ticks.length > 3 ? ticks[2] - ticks[1] : ticks[1] - ticks[0]; // If we have a number like 2.5 as the delta, figure out how many decimal places we need if (Math.abs(delta) > 1) { if (tickValue !== Math.floor(tickValue)) { // not an integer delta = tickValue - Math.floor(tickValue); } } var logDelta = helpers.log10(Math.abs(delta)); var tickString = ''; if (tickValue !== 0) { var numDecimal = -1 * Math.floor(logDelta); numDecimal = Math.max(Math.min(numDecimal, 20), 0); // toFixed has a max of 20 decimal places tickString = tickValue.toFixed(numDecimal); } else { tickString = '0'; // never show decimal places for 0 } return tickString; }, logarithmic: function(tickValue, index, ticks) { var remain = tickValue / (Math.pow(10, Math.floor(helpers.log10(tickValue)))); if (tickValue === 0) { return '0'; } else if (remain === 1 || remain === 2 || remain === 5 || index === 0 || index === ticks.length - 1) { return tickValue.toExponential(); } return ''; } } }; /***/ }), /***/ "./node_modules/chart.js/src/core/core.tooltip.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; var defaults = __webpack_require__("./node_modules/chart.js/src/core/core.defaults.js"); var Element = __webpack_require__("./node_modules/chart.js/src/core/core.element.js"); var helpers = __webpack_require__("./node_modules/chart.js/src/helpers/index.js"); defaults._set('global', { tooltips: { enabled: true, custom: null, mode: 'nearest', position: 'average', intersect: true, backgroundColor: 'rgba(0,0,0,0.8)', titleFontStyle: 'bold', titleSpacing: 2, titleMarginBottom: 6, titleFontColor: '#fff', titleAlign: 'left', bodySpacing: 2, bodyFontColor: '#fff', bodyAlign: 'left', footerFontStyle: 'bold', footerSpacing: 2, footerMarginTop: 6, footerFontColor: '#fff', footerAlign: 'left', yPadding: 6, xPadding: 6, caretPadding: 2, caretSize: 5, cornerRadius: 6, multiKeyBackground: '#fff', displayColors: true, borderColor: 'rgba(0,0,0,0)', borderWidth: 0, callbacks: { // Args are: (tooltipItems, data) beforeTitle: helpers.noop, title: function(tooltipItems, data) { // Pick first xLabel for now var title = ''; var labels = data.labels; var labelCount = labels ? labels.length : 0; if (tooltipItems.length > 0) { var item = tooltipItems[0]; if (item.xLabel) { title = item.xLabel; } else if (labelCount > 0 && item.index < labelCount) { title = labels[item.index]; } } return title; }, afterTitle: helpers.noop, // Args are: (tooltipItems, data) beforeBody: helpers.noop, // Args are: (tooltipItem, data) beforeLabel: helpers.noop, label: function(tooltipItem, data) { var label = data.datasets[tooltipItem.datasetIndex].label || ''; if (label) { label += ': '; } label += tooltipItem.yLabel; return label; }, labelColor: function(tooltipItem, chart) { var meta = chart.getDatasetMeta(tooltipItem.datasetIndex); var activeElement = meta.data[tooltipItem.index]; var view = activeElement._view; return { borderColor: view.borderColor, backgroundColor: view.backgroundColor }; }, labelTextColor: function() { return this._options.bodyFontColor; }, afterLabel: helpers.noop, // Args are: (tooltipItems, data) afterBody: helpers.noop, // Args are: (tooltipItems, data) beforeFooter: helpers.noop, footer: helpers.noop, afterFooter: helpers.noop } } }); module.exports = function(Chart) { /** * Helper method to merge the opacity into a color */ function mergeOpacity(colorString, opacity) { var color = helpers.color(colorString); return color.alpha(opacity * color.alpha()).rgbaString(); } // Helper to push or concat based on if the 2nd parameter is an array or not function pushOrConcat(base, toPush) { if (toPush) { if (helpers.isArray(toPush)) { // base = base.concat(toPush); Array.prototype.push.apply(base, toPush); } else { base.push(toPush); } } return base; } // Private helper to create a tooltip item model // @param element : the chart element (point, arc, bar) to create the tooltip item for // @return : new tooltip item function createTooltipItem(element) { var xScale = element._xScale; var yScale = element._yScale || element._scale; // handle radar || polarArea charts var index = element._index; var datasetIndex = element._datasetIndex; return { xLabel: xScale ? xScale.getLabelForIndex(index, datasetIndex) : '', yLabel: yScale ? yScale.getLabelForIndex(index, datasetIndex) : '', index: index, datasetIndex: datasetIndex, x: element._model.x, y: element._model.y }; } /** * Helper to get the reset model for the tooltip * @param tooltipOpts {Object} the tooltip options */ function getBaseModel(tooltipOpts) { var globalDefaults = defaults.global; var valueOrDefault = helpers.valueOrDefault; return { // Positioning xPadding: tooltipOpts.xPadding, yPadding: tooltipOpts.yPadding, xAlign: tooltipOpts.xAlign, yAlign: tooltipOpts.yAlign, // Body bodyFontColor: tooltipOpts.bodyFontColor, _bodyFontFamily: valueOrDefault(tooltipOpts.bodyFontFamily, globalDefaults.defaultFontFamily), _bodyFontStyle: valueOrDefault(tooltipOpts.bodyFontStyle, globalDefaults.defaultFontStyle), _bodyAlign: tooltipOpts.bodyAlign, bodyFontSize: valueOrDefault(tooltipOpts.bodyFontSize, globalDefaults.defaultFontSize), bodySpacing: tooltipOpts.bodySpacing, // Title titleFontColor: tooltipOpts.titleFontColor, _titleFontFamily: valueOrDefault(tooltipOpts.titleFontFamily, globalDefaults.defaultFontFamily), _titleFontStyle: valueOrDefault(tooltipOpts.titleFontStyle, globalDefaults.defaultFontStyle), titleFontSize: valueOrDefault(tooltipOpts.titleFontSize, globalDefaults.defaultFontSize), _titleAlign: tooltipOpts.titleAlign, titleSpacing: tooltipOpts.titleSpacing, titleMarginBottom: tooltipOpts.titleMarginBottom, // Footer footerFontColor: tooltipOpts.footerFontColor, _footerFontFamily: valueOrDefault(tooltipOpts.footerFontFamily, globalDefaults.defaultFontFamily), _footerFontStyle: valueOrDefault(tooltipOpts.footerFontStyle, globalDefaults.defaultFontStyle), footerFontSize: valueOrDefault(tooltipOpts.footerFontSize, globalDefaults.defaultFontSize), _footerAlign: tooltipOpts.footerAlign, footerSpacing: tooltipOpts.footerSpacing, footerMarginTop: tooltipOpts.footerMarginTop, // Appearance caretSize: tooltipOpts.caretSize, cornerRadius: tooltipOpts.cornerRadius, backgroundColor: tooltipOpts.backgroundColor, opacity: 0, legendColorBackground: tooltipOpts.multiKeyBackground, displayColors: tooltipOpts.displayColors, borderColor: tooltipOpts.borderColor, borderWidth: tooltipOpts.borderWidth }; } /** * Get the size of the tooltip */ function getTooltipSize(tooltip, model) { var ctx = tooltip._chart.ctx; var height = model.yPadding * 2; // Tooltip Padding var width = 0; // Count of all lines in the body var body = model.body; var combinedBodyLength = body.reduce(function(count, bodyItem) { return count + bodyItem.before.length + bodyItem.lines.length + bodyItem.after.length; }, 0); combinedBodyLength += model.beforeBody.length + model.afterBody.length; var titleLineCount = model.title.length; var footerLineCount = model.footer.length; var titleFontSize = model.titleFontSize; var bodyFontSize = model.bodyFontSize; var footerFontSize = model.footerFontSize; height += titleLineCount * titleFontSize; // Title Lines height += titleLineCount ? (titleLineCount - 1) * model.titleSpacing : 0; // Title Line Spacing height += titleLineCount ? model.titleMarginBottom : 0; // Title's bottom Margin height += combinedBodyLength * bodyFontSize; // Body Lines height += combinedBodyLength ? (combinedBodyLength - 1) * model.bodySpacing : 0; // Body Line Spacing height += footerLineCount ? model.footerMarginTop : 0; // Footer Margin height += footerLineCount * (footerFontSize); // Footer Lines height += footerLineCount ? (footerLineCount - 1) * model.footerSpacing : 0; // Footer Line Spacing // Title width var widthPadding = 0; var maxLineWidth = function(line) { width = Math.max(width, ctx.measureText(line).width + widthPadding); }; ctx.font = helpers.fontString(titleFontSize, model._titleFontStyle, model._titleFontFamily); helpers.each(model.title, maxLineWidth); // Body width ctx.font = helpers.fontString(bodyFontSize, model._bodyFontStyle, model._bodyFontFamily); helpers.each(model.beforeBody.concat(model.afterBody), maxLineWidth); // Body lines may include some extra width due to the color box widthPadding = model.displayColors ? (bodyFontSize + 2) : 0; helpers.each(body, function(bodyItem) { helpers.each(bodyItem.before, maxLineWidth); helpers.each(bodyItem.lines, maxLineWidth); helpers.each(bodyItem.after, maxLineWidth); }); // Reset back to 0 widthPadding = 0; // Footer width ctx.font = helpers.fontString(footerFontSize, model._footerFontStyle, model._footerFontFamily); helpers.each(model.footer, maxLineWidth); // Add padding width += 2 * model.xPadding; return { width: width, height: height }; } /** * Helper to get the alignment of a tooltip given the size */ function determineAlignment(tooltip, size) { var model = tooltip._model; var chart = tooltip._chart; var chartArea = tooltip._chart.chartArea; var xAlign = 'center'; var yAlign = 'center'; if (model.y < size.height) { yAlign = 'top'; } else if (model.y > (chart.height - size.height)) { yAlign = 'bottom'; } var lf, rf; // functions to determine left, right alignment var olf, orf; // functions to determine if left/right alignment causes tooltip to go outside chart var yf; // function to get the y alignment if the tooltip goes outside of the left or right edges var midX = (chartArea.left + chartArea.right) / 2; var midY = (chartArea.top + chartArea.bottom) / 2; if (yAlign === 'center') { lf = function(x) { return x <= midX; }; rf = function(x) { return x > midX; }; } else { lf = function(x) { return x <= (size.width / 2); }; rf = function(x) { return x >= (chart.width - (size.width / 2)); }; } olf = function(x) { return x + size.width + model.caretSize + model.caretPadding > chart.width; }; orf = function(x) { return x - size.width - model.caretSize - model.caretPadding < 0; }; yf = function(y) { return y <= midY ? 'top' : 'bottom'; }; if (lf(model.x)) { xAlign = 'left'; // Is tooltip too wide and goes over the right side of the chart.? if (olf(model.x)) { xAlign = 'center'; yAlign = yf(model.y); } } else if (rf(model.x)) { xAlign = 'right'; // Is tooltip too wide and goes outside left edge of canvas? if (orf(model.x)) { xAlign = 'center'; yAlign = yf(model.y); } } var opts = tooltip._options; return { xAlign: opts.xAlign ? opts.xAlign : xAlign, yAlign: opts.yAlign ? opts.yAlign : yAlign }; } /** * @Helper to get the location a tooltip needs to be placed at given the initial position (via the vm) and the size and alignment */ function getBackgroundPoint(vm, size, alignment, chart) { // Background Position var x = vm.x; var y = vm.y; var caretSize = vm.caretSize; var caretPadding = vm.caretPadding; var cornerRadius = vm.cornerRadius; var xAlign = alignment.xAlign; var yAlign = alignment.yAlign; var paddingAndSize = caretSize + caretPadding; var radiusAndPadding = cornerRadius + caretPadding; if (xAlign === 'right') { x -= size.width; } else if (xAlign === 'center') { x -= (size.width / 2); if (x + size.width > chart.width) { x = chart.width - size.width; } if (x < 0) { x = 0; } } if (yAlign === 'top') { y += paddingAndSize; } else if (yAlign === 'bottom') { y -= size.height + paddingAndSize; } else { y -= (size.height / 2); } if (yAlign === 'center') { if (xAlign === 'left') { x += paddingAndSize; } else if (xAlign === 'right') { x -= paddingAndSize; } } else if (xAlign === 'left') { x -= radiusAndPadding; } else if (xAlign === 'right') { x += radiusAndPadding; } return { x: x, y: y }; } Chart.Tooltip = Element.extend({ initialize: function() { this._model = getBaseModel(this._options); this._lastActive = []; }, // Get the title // Args are: (tooltipItem, data) getTitle: function() { var me = this; var opts = me._options; var callbacks = opts.callbacks; var beforeTitle = callbacks.beforeTitle.apply(me, arguments); var title = callbacks.title.apply(me, arguments); var afterTitle = callbacks.afterTitle.apply(me, arguments); var lines = []; lines = pushOrConcat(lines, beforeTitle); lines = pushOrConcat(lines, title); lines = pushOrConcat(lines, afterTitle); return lines; }, // Args are: (tooltipItem, data) getBeforeBody: function() { var lines = this._options.callbacks.beforeBody.apply(this, arguments); return helpers.isArray(lines) ? lines : lines !== undefined ? [lines] : []; }, // Args are: (tooltipItem, data) getBody: function(tooltipItems, data) { var me = this; var callbacks = me._options.callbacks; var bodyItems = []; helpers.each(tooltipItems, function(tooltipItem) { var bodyItem = { before: [], lines: [], after: [] }; pushOrConcat(bodyItem.before, callbacks.beforeLabel.call(me, tooltipItem, data)); pushOrConcat(bodyItem.lines, callbacks.label.call(me, tooltipItem, data)); pushOrConcat(bodyItem.after, callbacks.afterLabel.call(me, tooltipItem, data)); bodyItems.push(bodyItem); }); return bodyItems; }, // Args are: (tooltipItem, data) getAfterBody: function() { var lines = this._options.callbacks.afterBody.apply(this, arguments); return helpers.isArray(lines) ? lines : lines !== undefined ? [lines] : []; }, // Get the footer and beforeFooter and afterFooter lines // Args are: (tooltipItem, data) getFooter: function() { var me = this; var callbacks = me._options.callbacks; var beforeFooter = callbacks.beforeFooter.apply(me, arguments); var footer = callbacks.footer.apply(me, arguments); var afterFooter = callbacks.afterFooter.apply(me, arguments); var lines = []; lines = pushOrConcat(lines, beforeFooter); lines = pushOrConcat(lines, footer); lines = pushOrConcat(lines, afterFooter); return lines; }, update: function(changed) { var me = this; var opts = me._options; // Need to regenerate the model because its faster than using extend and it is necessary due to the optimization in Chart.Element.transition // that does _view = _model if ease === 1. This causes the 2nd tooltip update to set properties in both the view and model at the same time // which breaks any animations. var existingModel = me._model; var model = me._model = getBaseModel(opts); var active = me._active; var data = me._data; // In the case where active.length === 0 we need to keep these at existing values for good animations var alignment = { xAlign: existingModel.xAlign, yAlign: existingModel.yAlign }; var backgroundPoint = { x: existingModel.x, y: existingModel.y }; var tooltipSize = { width: existingModel.width, height: existingModel.height }; var tooltipPosition = { x: existingModel.caretX, y: existingModel.caretY }; var i, len; if (active.length) { model.opacity = 1; var labelColors = []; var labelTextColors = []; tooltipPosition = Chart.Tooltip.positioners[opts.position].call(me, active, me._eventPosition); var tooltipItems = []; for (i = 0, len = active.length; i < len; ++i) { tooltipItems.push(createTooltipItem(active[i])); } // If the user provided a filter function, use it to modify the tooltip items if (opts.filter) { tooltipItems = tooltipItems.filter(function(a) { return opts.filter(a, data); }); } // If the user provided a sorting function, use it to modify the tooltip items if (opts.itemSort) { tooltipItems = tooltipItems.sort(function(a, b) { return opts.itemSort(a, b, data); }); } // Determine colors for boxes helpers.each(tooltipItems, function(tooltipItem) { labelColors.push(opts.callbacks.labelColor.call(me, tooltipItem, me._chart)); labelTextColors.push(opts.callbacks.labelTextColor.call(me, tooltipItem, me._chart)); }); // Build the Text Lines model.title = me.getTitle(tooltipItems, data); model.beforeBody = me.getBeforeBody(tooltipItems, data); model.body = me.getBody(tooltipItems, data); model.afterBody = me.getAfterBody(tooltipItems, data); model.footer = me.getFooter(tooltipItems, data); // Initial positioning and colors model.x = Math.round(tooltipPosition.x); model.y = Math.round(tooltipPosition.y); model.caretPadding = opts.caretPadding; model.labelColors = labelColors; model.labelTextColors = labelTextColors; // data points model.dataPoints = tooltipItems; // We need to determine alignment of the tooltip tooltipSize = getTooltipSize(this, model); alignment = determineAlignment(this, tooltipSize); // Final Size and Position backgroundPoint = getBackgroundPoint(model, tooltipSize, alignment, me._chart); } else { model.opacity = 0; } model.xAlign = alignment.xAlign; model.yAlign = alignment.yAlign; model.x = backgroundPoint.x; model.y = backgroundPoint.y; model.width = tooltipSize.width; model.height = tooltipSize.height; // Point where the caret on the tooltip points to model.caretX = tooltipPosition.x; model.caretY = tooltipPosition.y; me._model = model; if (changed && opts.custom) { opts.custom.call(me, model); } return me; }, drawCaret: function(tooltipPoint, size) { var ctx = this._chart.ctx; var vm = this._view; var caretPosition = this.getCaretPosition(tooltipPoint, size, vm); ctx.lineTo(caretPosition.x1, caretPosition.y1); ctx.lineTo(caretPosition.x2, caretPosition.y2); ctx.lineTo(caretPosition.x3, caretPosition.y3); }, getCaretPosition: function(tooltipPoint, size, vm) { var x1, x2, x3, y1, y2, y3; var caretSize = vm.caretSize; var cornerRadius = vm.cornerRadius; var xAlign = vm.xAlign; var yAlign = vm.yAlign; var ptX = tooltipPoint.x; var ptY = tooltipPoint.y; var width = size.width; var height = size.height; if (yAlign === 'center') { y2 = ptY + (height / 2); if (xAlign === 'left') { x1 = ptX; x2 = x1 - caretSize; x3 = x1; y1 = y2 + caretSize; y3 = y2 - caretSize; } else { x1 = ptX + width; x2 = x1 + caretSize; x3 = x1; y1 = y2 - caretSize; y3 = y2 + caretSize; } } else { if (xAlign === 'left') { x2 = ptX + cornerRadius + (caretSize); x1 = x2 - caretSize; x3 = x2 + caretSize; } else if (xAlign === 'right') { x2 = ptX + width - cornerRadius - caretSize; x1 = x2 - caretSize; x3 = x2 + caretSize; } else { x2 = vm.caretX; x1 = x2 - caretSize; x3 = x2 + caretSize; } if (yAlign === 'top') { y1 = ptY; y2 = y1 - caretSize; y3 = y1; } else { y1 = ptY + height; y2 = y1 + caretSize; y3 = y1; // invert drawing order var tmp = x3; x3 = x1; x1 = tmp; } } return {x1: x1, x2: x2, x3: x3, y1: y1, y2: y2, y3: y3}; }, drawTitle: function(pt, vm, ctx, opacity) { var title = vm.title; if (title.length) { ctx.textAlign = vm._titleAlign; ctx.textBaseline = 'top'; var titleFontSize = vm.titleFontSize; var titleSpacing = vm.titleSpacing; ctx.fillStyle = mergeOpacity(vm.titleFontColor, opacity); ctx.font = helpers.fontString(titleFontSize, vm._titleFontStyle, vm._titleFontFamily); var i, len; for (i = 0, len = title.length; i < len; ++i) { ctx.fillText(title[i], pt.x, pt.y); pt.y += titleFontSize + titleSpacing; // Line Height and spacing if (i + 1 === title.length) { pt.y += vm.titleMarginBottom - titleSpacing; // If Last, add margin, remove spacing } } } }, drawBody: function(pt, vm, ctx, opacity) { var bodyFontSize = vm.bodyFontSize; var bodySpacing = vm.bodySpacing; var body = vm.body; ctx.textAlign = vm._bodyAlign; ctx.textBaseline = 'top'; ctx.font = helpers.fontString(bodyFontSize, vm._bodyFontStyle, vm._bodyFontFamily); // Before Body var xLinePadding = 0; var fillLineOfText = function(line) { ctx.fillText(line, pt.x + xLinePadding, pt.y); pt.y += bodyFontSize + bodySpacing; }; // Before body lines ctx.fillStyle = mergeOpacity(vm.bodyFontColor, opacity); helpers.each(vm.beforeBody, fillLineOfText); var drawColorBoxes = vm.displayColors; xLinePadding = drawColorBoxes ? (bodyFontSize + 2) : 0; // Draw body lines now helpers.each(body, function(bodyItem, i) { var textColor = mergeOpacity(vm.labelTextColors[i], opacity); ctx.fillStyle = textColor; helpers.each(bodyItem.before, fillLineOfText); helpers.each(bodyItem.lines, function(line) { // Draw Legend-like boxes if needed if (drawColorBoxes) { // Fill a white rect so that colours merge nicely if the opacity is < 1 ctx.fillStyle = mergeOpacity(vm.legendColorBackground, opacity); ctx.fillRect(pt.x, pt.y, bodyFontSize, bodyFontSize); // Border ctx.lineWidth = 1; ctx.strokeStyle = mergeOpacity(vm.labelColors[i].borderColor, opacity); ctx.strokeRect(pt.x, pt.y, bodyFontSize, bodyFontSize); // Inner square ctx.fillStyle = mergeOpacity(vm.labelColors[i].backgroundColor, opacity); ctx.fillRect(pt.x + 1, pt.y + 1, bodyFontSize - 2, bodyFontSize - 2); ctx.fillStyle = textColor; } fillLineOfText(line); }); helpers.each(bodyItem.after, fillLineOfText); }); // Reset back to 0 for after body xLinePadding = 0; // After body lines helpers.each(vm.afterBody, fillLineOfText); pt.y -= bodySpacing; // Remove last body spacing }, drawFooter: function(pt, vm, ctx, opacity) { var footer = vm.footer; if (footer.length) { pt.y += vm.footerMarginTop; ctx.textAlign = vm._footerAlign; ctx.textBaseline = 'top'; ctx.fillStyle = mergeOpacity(vm.footerFontColor, opacity); ctx.font = helpers.fontString(vm.footerFontSize, vm._footerFontStyle, vm._footerFontFamily); helpers.each(footer, function(line) { ctx.fillText(line, pt.x, pt.y); pt.y += vm.footerFontSize + vm.footerSpacing; }); } }, drawBackground: function(pt, vm, ctx, tooltipSize, opacity) { ctx.fillStyle = mergeOpacity(vm.backgroundColor, opacity); ctx.strokeStyle = mergeOpacity(vm.borderColor, opacity); ctx.lineWidth = vm.borderWidth; var xAlign = vm.xAlign; var yAlign = vm.yAlign; var x = pt.x; var y = pt.y; var width = tooltipSize.width; var height = tooltipSize.height; var radius = vm.cornerRadius; ctx.beginPath(); ctx.moveTo(x + radius, y); if (yAlign === 'top') { this.drawCaret(pt, tooltipSize); } ctx.lineTo(x + width - radius, y); ctx.quadraticCurveTo(x + width, y, x + width, y + radius); if (yAlign === 'center' && xAlign === 'right') { this.drawCaret(pt, tooltipSize); } ctx.lineTo(x + width, y + height - radius); ctx.quadraticCurveTo(x + width, y + height, x + width - radius, y + height); if (yAlign === 'bottom') { this.drawCaret(pt, tooltipSize); } ctx.lineTo(x + radius, y + height); ctx.quadraticCurveTo(x, y + height, x, y + height - radius); if (yAlign === 'center' && xAlign === 'left') { this.drawCaret(pt, tooltipSize); } ctx.lineTo(x, y + radius); ctx.quadraticCurveTo(x, y, x + radius, y); ctx.closePath(); ctx.fill(); if (vm.borderWidth > 0) { ctx.stroke(); } }, draw: function() { var ctx = this._chart.ctx; var vm = this._view; if (vm.opacity === 0) { return; } var tooltipSize = { width: vm.width, height: vm.height }; var pt = { x: vm.x, y: vm.y }; // IE11/Edge does not like very small opacities, so snap to 0 var opacity = Math.abs(vm.opacity < 1e-3) ? 0 : vm.opacity; // Truthy/falsey value for empty tooltip var hasTooltipContent = vm.title.length || vm.beforeBody.length || vm.body.length || vm.afterBody.length || vm.footer.length; if (this._options.enabled && hasTooltipContent) { // Draw Background this.drawBackground(pt, vm, ctx, tooltipSize, opacity); // Draw Title, Body, and Footer pt.x += vm.xPadding; pt.y += vm.yPadding; // Titles this.drawTitle(pt, vm, ctx, opacity); // Body this.drawBody(pt, vm, ctx, opacity); // Footer this.drawFooter(pt, vm, ctx, opacity); } }, /** * Handle an event * @private * @param {IEvent} event - The event to handle * @returns {Boolean} true if the tooltip changed */ handleEvent: function(e) { var me = this; var options = me._options; var changed = false; me._lastActive = me._lastActive || []; // Find Active Elements for tooltips if (e.type === 'mouseout') { me._active = []; } else { me._active = me._chart.getElementsAtEventForMode(e, options.mode, options); } // Remember Last Actives changed = !helpers.arrayEquals(me._active, me._lastActive); // Only handle target event on tooltip change if (changed) { me._lastActive = me._active; if (options.enabled || options.custom) { me._eventPosition = { x: e.x, y: e.y }; me.update(true); me.pivot(); } } return changed; } }); /** * @namespace Chart.Tooltip.positioners */ Chart.Tooltip.positioners = { /** * Average mode places the tooltip at the average position of the elements shown * @function Chart.Tooltip.positioners.average * @param elements {ChartElement[]} the elements being displayed in the tooltip * @returns {Point} tooltip position */ average: function(elements) { if (!elements.length) { return false; } var i, len; var x = 0; var y = 0; var count = 0; for (i = 0, len = elements.length; i < len; ++i) { var el = elements[i]; if (el && el.hasValue()) { var pos = el.tooltipPosition(); x += pos.x; y += pos.y; ++count; } } return { x: Math.round(x / count), y: Math.round(y / count) }; }, /** * Gets the tooltip position nearest of the item nearest to the event position * @function Chart.Tooltip.positioners.nearest * @param elements {Chart.Element[]} the tooltip elements * @param eventPosition {Point} the position of the event in canvas coordinates * @returns {Point} the tooltip position */ nearest: function(elements, eventPosition) { var x = eventPosition.x; var y = eventPosition.y; var minDistance = Number.POSITIVE_INFINITY; var i, len, nearestElement; for (i = 0, len = elements.length; i < len; ++i) { var el = elements[i]; if (el && el.hasValue()) { var center = el.getCenterPoint(); var d = helpers.distanceBetweenPoints(eventPosition, center); if (d < minDistance) { minDistance = d; nearestElement = el; } } } if (nearestElement) { var tp = nearestElement.tooltipPosition(); x = tp.x; y = tp.y; } return { x: x, y: y }; } }; }; /***/ }), /***/ "./node_modules/chart.js/src/elements/element.arc.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; var defaults = __webpack_require__("./node_modules/chart.js/src/core/core.defaults.js"); var Element = __webpack_require__("./node_modules/chart.js/src/core/core.element.js"); var helpers = __webpack_require__("./node_modules/chart.js/src/helpers/index.js"); defaults._set('global', { elements: { arc: { backgroundColor: defaults.global.defaultColor, borderColor: '#fff', borderWidth: 2 } } }); module.exports = Element.extend({ inLabelRange: function(mouseX) { var vm = this._view; if (vm) { return (Math.pow(mouseX - vm.x, 2) < Math.pow(vm.radius + vm.hoverRadius, 2)); } return false; }, inRange: function(chartX, chartY) { var vm = this._view; if (vm) { var pointRelativePosition = helpers.getAngleFromPoint(vm, {x: chartX, y: chartY}); var angle = pointRelativePosition.angle; var distance = pointRelativePosition.distance; // Sanitise angle range var startAngle = vm.startAngle; var endAngle = vm.endAngle; while (endAngle < startAngle) { endAngle += 2.0 * Math.PI; } while (angle > endAngle) { angle -= 2.0 * Math.PI; } while (angle < startAngle) { angle += 2.0 * Math.PI; } // Check if within the range of the open/close angle var betweenAngles = (angle >= startAngle && angle <= endAngle); var withinRadius = (distance >= vm.innerRadius && distance <= vm.outerRadius); return (betweenAngles && withinRadius); } return false; }, getCenterPoint: function() { var vm = this._view; var halfAngle = (vm.startAngle + vm.endAngle) / 2; var halfRadius = (vm.innerRadius + vm.outerRadius) / 2; return { x: vm.x + Math.cos(halfAngle) * halfRadius, y: vm.y + Math.sin(halfAngle) * halfRadius }; }, getArea: function() { var vm = this._view; return Math.PI * ((vm.endAngle - vm.startAngle) / (2 * Math.PI)) * (Math.pow(vm.outerRadius, 2) - Math.pow(vm.innerRadius, 2)); }, tooltipPosition: function() { var vm = this._view; var centreAngle = vm.startAngle + ((vm.endAngle - vm.startAngle) / 2); var rangeFromCentre = (vm.outerRadius - vm.innerRadius) / 2 + vm.innerRadius; return { x: vm.x + (Math.cos(centreAngle) * rangeFromCentre), y: vm.y + (Math.sin(centreAngle) * rangeFromCentre) }; }, draw: function() { var ctx = this._chart.ctx; var vm = this._view; var sA = vm.startAngle; var eA = vm.endAngle; ctx.beginPath(); ctx.arc(vm.x, vm.y, vm.outerRadius, sA, eA); ctx.arc(vm.x, vm.y, vm.innerRadius, eA, sA, true); ctx.closePath(); ctx.strokeStyle = vm.borderColor; ctx.lineWidth = vm.borderWidth; ctx.fillStyle = vm.backgroundColor; ctx.fill(); ctx.lineJoin = 'bevel'; if (vm.borderWidth) { ctx.stroke(); } } }); /***/ }), /***/ "./node_modules/chart.js/src/elements/element.line.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; var defaults = __webpack_require__("./node_modules/chart.js/src/core/core.defaults.js"); var Element = __webpack_require__("./node_modules/chart.js/src/core/core.element.js"); var helpers = __webpack_require__("./node_modules/chart.js/src/helpers/index.js"); var globalDefaults = defaults.global; defaults._set('global', { elements: { line: { tension: 0.4, backgroundColor: globalDefaults.defaultColor, borderWidth: 3, borderColor: globalDefaults.defaultColor, borderCapStyle: 'butt', borderDash: [], borderDashOffset: 0.0, borderJoinStyle: 'miter', capBezierPoints: true, fill: true, // do we fill in the area between the line and its base axis } } }); module.exports = Element.extend({ draw: function() { var me = this; var vm = me._view; var ctx = me._chart.ctx; var spanGaps = vm.spanGaps; var points = me._children.slice(); // clone array var globalOptionLineElements = globalDefaults.elements.line; var lastDrawnIndex = -1; var index, current, previous, currentVM; // If we are looping, adding the first point again if (me._loop && points.length) { points.push(points[0]); } ctx.save(); // Stroke Line Options ctx.lineCap = vm.borderCapStyle || globalOptionLineElements.borderCapStyle; // IE 9 and 10 do not support line dash if (ctx.setLineDash) { ctx.setLineDash(vm.borderDash || globalOptionLineElements.borderDash); } ctx.lineDashOffset = vm.borderDashOffset || globalOptionLineElements.borderDashOffset; ctx.lineJoin = vm.borderJoinStyle || globalOptionLineElements.borderJoinStyle; ctx.lineWidth = vm.borderWidth || globalOptionLineElements.borderWidth; ctx.strokeStyle = vm.borderColor || globalDefaults.defaultColor; // Stroke Line ctx.beginPath(); lastDrawnIndex = -1; for (index = 0; index < points.length; ++index) { current = points[index]; previous = helpers.previousItem(points, index); currentVM = current._view; // First point moves to it's starting position no matter what if (index === 0) { if (!currentVM.skip) { ctx.moveTo(currentVM.x, currentVM.y); lastDrawnIndex = index; } } else { previous = lastDrawnIndex === -1 ? previous : points[lastDrawnIndex]; if (!currentVM.skip) { if ((lastDrawnIndex !== (index - 1) && !spanGaps) || lastDrawnIndex === -1) { // There was a gap and this is the first point after the gap ctx.moveTo(currentVM.x, currentVM.y); } else { // Line to next point helpers.canvas.lineTo(ctx, previous._view, current._view); } lastDrawnIndex = index; } } } ctx.stroke(); ctx.restore(); } }); /***/ }), /***/ "./node_modules/chart.js/src/elements/element.point.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; var defaults = __webpack_require__("./node_modules/chart.js/src/core/core.defaults.js"); var Element = __webpack_require__("./node_modules/chart.js/src/core/core.element.js"); var helpers = __webpack_require__("./node_modules/chart.js/src/helpers/index.js"); var defaultColor = defaults.global.defaultColor; defaults._set('global', { elements: { point: { radius: 3, pointStyle: 'circle', backgroundColor: defaultColor, borderColor: defaultColor, borderWidth: 1, // Hover hitRadius: 1, hoverRadius: 4, hoverBorderWidth: 1 } } }); function xRange(mouseX) { var vm = this._view; return vm ? (Math.abs(mouseX - vm.x) < vm.radius + vm.hitRadius) : false; } function yRange(mouseY) { var vm = this._view; return vm ? (Math.abs(mouseY - vm.y) < vm.radius + vm.hitRadius) : false; } module.exports = Element.extend({ inRange: function(mouseX, mouseY) { var vm = this._view; return vm ? ((Math.pow(mouseX - vm.x, 2) + Math.pow(mouseY - vm.y, 2)) < Math.pow(vm.hitRadius + vm.radius, 2)) : false; }, inLabelRange: xRange, inXRange: xRange, inYRange: yRange, getCenterPoint: function() { var vm = this._view; return { x: vm.x, y: vm.y }; }, getArea: function() { return Math.PI * Math.pow(this._view.radius, 2); }, tooltipPosition: function() { var vm = this._view; return { x: vm.x, y: vm.y, padding: vm.radius + vm.borderWidth }; }, draw: function(chartArea) { var vm = this._view; var model = this._model; var ctx = this._chart.ctx; var pointStyle = vm.pointStyle; var radius = vm.radius; var x = vm.x; var y = vm.y; var color = helpers.color; var errMargin = 1.01; // 1.01 is margin for Accumulated error. (Especially Edge, IE.) var ratio = 0; if (vm.skip) { return; } ctx.strokeStyle = vm.borderColor || defaultColor; ctx.lineWidth = helpers.valueOrDefault(vm.borderWidth, defaults.global.elements.point.borderWidth); ctx.fillStyle = vm.backgroundColor || defaultColor; // Cliping for Points. // going out from inner charArea? if ((chartArea !== undefined) && ((model.x < chartArea.left) || (chartArea.right * errMargin < model.x) || (model.y < chartArea.top) || (chartArea.bottom * errMargin < model.y))) { // Point fade out if (model.x < chartArea.left) { ratio = (x - model.x) / (chartArea.left - model.x); } else if (chartArea.right * errMargin < model.x) { ratio = (model.x - x) / (model.x - chartArea.right); } else if (model.y < chartArea.top) { ratio = (y - model.y) / (chartArea.top - model.y); } else if (chartArea.bottom * errMargin < model.y) { ratio = (model.y - y) / (model.y - chartArea.bottom); } ratio = Math.round(ratio * 100) / 100; ctx.strokeStyle = color(ctx.strokeStyle).alpha(ratio).rgbString(); ctx.fillStyle = color(ctx.fillStyle).alpha(ratio).rgbString(); } helpers.canvas.drawPoint(ctx, pointStyle, radius, x, y); } }); /***/ }), /***/ "./node_modules/chart.js/src/elements/element.rectangle.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; var defaults = __webpack_require__("./node_modules/chart.js/src/core/core.defaults.js"); var Element = __webpack_require__("./node_modules/chart.js/src/core/core.element.js"); defaults._set('global', { elements: { rectangle: { backgroundColor: defaults.global.defaultColor, borderColor: defaults.global.defaultColor, borderSkipped: 'bottom', borderWidth: 0 } } }); function isVertical(bar) { return bar._view.width !== undefined; } /** * Helper function to get the bounds of the bar regardless of the orientation * @param bar {Chart.Element.Rectangle} the bar * @return {Bounds} bounds of the bar * @private */ function getBarBounds(bar) { var vm = bar._view; var x1, x2, y1, y2; if (isVertical(bar)) { // vertical var halfWidth = vm.width / 2; x1 = vm.x - halfWidth; x2 = vm.x + halfWidth; y1 = Math.min(vm.y, vm.base); y2 = Math.max(vm.y, vm.base); } else { // horizontal bar var halfHeight = vm.height / 2; x1 = Math.min(vm.x, vm.base); x2 = Math.max(vm.x, vm.base); y1 = vm.y - halfHeight; y2 = vm.y + halfHeight; } return { left: x1, top: y1, right: x2, bottom: y2 }; } module.exports = Element.extend({ draw: function() { var ctx = this._chart.ctx; var vm = this._view; var left, right, top, bottom, signX, signY, borderSkipped; var borderWidth = vm.borderWidth; if (!vm.horizontal) { // bar left = vm.x - vm.width / 2; right = vm.x + vm.width / 2; top = vm.y; bottom = vm.base; signX = 1; signY = bottom > top ? 1 : -1; borderSkipped = vm.borderSkipped || 'bottom'; } else { // horizontal bar left = vm.base; right = vm.x; top = vm.y - vm.height / 2; bottom = vm.y + vm.height / 2; signX = right > left ? 1 : -1; signY = 1; borderSkipped = vm.borderSkipped || 'left'; } // Canvas doesn't allow us to stroke inside the width so we can // adjust the sizes to fit if we're setting a stroke on the line if (borderWidth) { // borderWidth shold be less than bar width and bar height. var barSize = Math.min(Math.abs(left - right), Math.abs(top - bottom)); borderWidth = borderWidth > barSize ? barSize : borderWidth; var halfStroke = borderWidth / 2; // Adjust borderWidth when bar top position is near vm.base(zero). var borderLeft = left + (borderSkipped !== 'left' ? halfStroke * signX : 0); var borderRight = right + (borderSkipped !== 'right' ? -halfStroke * signX : 0); var borderTop = top + (borderSkipped !== 'top' ? halfStroke * signY : 0); var borderBottom = bottom + (borderSkipped !== 'bottom' ? -halfStroke * signY : 0); // not become a vertical line? if (borderLeft !== borderRight) { top = borderTop; bottom = borderBottom; } // not become a horizontal line? if (borderTop !== borderBottom) { left = borderLeft; right = borderRight; } } ctx.beginPath(); ctx.fillStyle = vm.backgroundColor; ctx.strokeStyle = vm.borderColor; ctx.lineWidth = borderWidth; // Corner points, from bottom-left to bottom-right clockwise // | 1 2 | // | 0 3 | var corners = [ [left, bottom], [left, top], [right, top], [right, bottom] ]; // Find first (starting) corner with fallback to 'bottom' var borders = ['bottom', 'left', 'top', 'right']; var startCorner = borders.indexOf(borderSkipped, 0); if (startCorner === -1) { startCorner = 0; } function cornerAt(index) { return corners[(startCorner + index) % 4]; } // Draw rectangle from 'startCorner' var corner = cornerAt(0); ctx.moveTo(corner[0], corner[1]); for (var i = 1; i < 4; i++) { corner = cornerAt(i); ctx.lineTo(corner[0], corner[1]); } ctx.fill(); if (borderWidth) { ctx.stroke(); } }, height: function() { var vm = this._view; return vm.base - vm.y; }, inRange: function(mouseX, mouseY) { var inRange = false; if (this._view) { var bounds = getBarBounds(this); inRange = mouseX >= bounds.left && mouseX <= bounds.right && mouseY >= bounds.top && mouseY <= bounds.bottom; } return inRange; }, inLabelRange: function(mouseX, mouseY) { var me = this; if (!me._view) { return false; } var inRange = false; var bounds = getBarBounds(me); if (isVertical(me)) { inRange = mouseX >= bounds.left && mouseX <= bounds.right; } else { inRange = mouseY >= bounds.top && mouseY <= bounds.bottom; } return inRange; }, inXRange: function(mouseX) { var bounds = getBarBounds(this); return mouseX >= bounds.left && mouseX <= bounds.right; }, inYRange: function(mouseY) { var bounds = getBarBounds(this); return mouseY >= bounds.top && mouseY <= bounds.bottom; }, getCenterPoint: function() { var vm = this._view; var x, y; if (isVertical(this)) { x = vm.x; y = (vm.y + vm.base) / 2; } else { x = (vm.x + vm.base) / 2; y = vm.y; } return {x: x, y: y}; }, getArea: function() { var vm = this._view; return vm.width * Math.abs(vm.y - vm.base); }, tooltipPosition: function() { var vm = this._view; return { x: vm.x, y: vm.y }; } }); /***/ }), /***/ "./node_modules/chart.js/src/elements/index.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; module.exports = {}; module.exports.Arc = __webpack_require__("./node_modules/chart.js/src/elements/element.arc.js"); module.exports.Line = __webpack_require__("./node_modules/chart.js/src/elements/element.line.js"); module.exports.Point = __webpack_require__("./node_modules/chart.js/src/elements/element.point.js"); module.exports.Rectangle = __webpack_require__("./node_modules/chart.js/src/elements/element.rectangle.js"); /***/ }), /***/ "./node_modules/chart.js/src/helpers/helpers.canvas.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; var helpers = __webpack_require__("./node_modules/chart.js/src/helpers/helpers.core.js"); /** * @namespace Chart.helpers.canvas */ var exports = module.exports = { /** * Clears the entire canvas associated to the given `chart`. * @param {Chart} chart - The chart for which to clear the canvas. */ clear: function(chart) { chart.ctx.clearRect(0, 0, chart.width, chart.height); }, /** * Creates a "path" for a rectangle with rounded corners at position (x, y) with a * given size (width, height) and the same `radius` for all corners. * @param {CanvasRenderingContext2D} ctx - The canvas 2D Context. * @param {Number} x - The x axis of the coordinate for the rectangle starting point. * @param {Number} y - The y axis of the coordinate for the rectangle starting point. * @param {Number} width - The rectangle's width. * @param {Number} height - The rectangle's height. * @param {Number} radius - The rounded amount (in pixels) for the four corners. * @todo handle `radius` as top-left, top-right, bottom-right, bottom-left array/object? */ roundedRect: function(ctx, x, y, width, height, radius) { if (radius) { var rx = Math.min(radius, width / 2); var ry = Math.min(radius, height / 2); ctx.moveTo(x + rx, y); ctx.lineTo(x + width - rx, y); ctx.quadraticCurveTo(x + width, y, x + width, y + ry); ctx.lineTo(x + width, y + height - ry); ctx.quadraticCurveTo(x + width, y + height, x + width - rx, y + height); ctx.lineTo(x + rx, y + height); ctx.quadraticCurveTo(x, y + height, x, y + height - ry); ctx.lineTo(x, y + ry); ctx.quadraticCurveTo(x, y, x + rx, y); } else { ctx.rect(x, y, width, height); } }, drawPoint: function(ctx, style, radius, x, y) { var type, edgeLength, xOffset, yOffset, height, size; if (style && typeof style === 'object') { type = style.toString(); if (type === '[object HTMLImageElement]' || type === '[object HTMLCanvasElement]') { ctx.drawImage(style, x - style.width / 2, y - style.height / 2, style.width, style.height); return; } } if (isNaN(radius) || radius <= 0) { return; } switch (style) { // Default includes circle default: ctx.beginPath(); ctx.arc(x, y, radius, 0, Math.PI * 2); ctx.closePath(); ctx.fill(); break; case 'triangle': ctx.beginPath(); edgeLength = 3 * radius / Math.sqrt(3); height = edgeLength * Math.sqrt(3) / 2; ctx.moveTo(x - edgeLength / 2, y + height / 3); ctx.lineTo(x + edgeLength / 2, y + height / 3); ctx.lineTo(x, y - 2 * height / 3); ctx.closePath(); ctx.fill(); break; case 'rect': size = 1 / Math.SQRT2 * radius; ctx.beginPath(); ctx.fillRect(x - size, y - size, 2 * size, 2 * size); ctx.strokeRect(x - size, y - size, 2 * size, 2 * size); break; case 'rectRounded': var offset = radius / Math.SQRT2; var leftX = x - offset; var topY = y - offset; var sideSize = Math.SQRT2 * radius; ctx.beginPath(); this.roundedRect(ctx, leftX, topY, sideSize, sideSize, radius / 2); ctx.closePath(); ctx.fill(); break; case 'rectRot': size = 1 / Math.SQRT2 * radius; ctx.beginPath(); ctx.moveTo(x - size, y); ctx.lineTo(x, y + size); ctx.lineTo(x + size, y); ctx.lineTo(x, y - size); ctx.closePath(); ctx.fill(); break; case 'cross': ctx.beginPath(); ctx.moveTo(x, y + radius); ctx.lineTo(x, y - radius); ctx.moveTo(x - radius, y); ctx.lineTo(x + radius, y); ctx.closePath(); break; case 'crossRot': ctx.beginPath(); xOffset = Math.cos(Math.PI / 4) * radius; yOffset = Math.sin(Math.PI / 4) * radius; ctx.moveTo(x - xOffset, y - yOffset); ctx.lineTo(x + xOffset, y + yOffset); ctx.moveTo(x - xOffset, y + yOffset); ctx.lineTo(x + xOffset, y - yOffset); ctx.closePath(); break; case 'star': ctx.beginPath(); ctx.moveTo(x, y + radius); ctx.lineTo(x, y - radius); ctx.moveTo(x - radius, y); ctx.lineTo(x + radius, y); xOffset = Math.cos(Math.PI / 4) * radius; yOffset = Math.sin(Math.PI / 4) * radius; ctx.moveTo(x - xOffset, y - yOffset); ctx.lineTo(x + xOffset, y + yOffset); ctx.moveTo(x - xOffset, y + yOffset); ctx.lineTo(x + xOffset, y - yOffset); ctx.closePath(); break; case 'line': ctx.beginPath(); ctx.moveTo(x - radius, y); ctx.lineTo(x + radius, y); ctx.closePath(); break; case 'dash': ctx.beginPath(); ctx.moveTo(x, y); ctx.lineTo(x + radius, y); ctx.closePath(); break; } ctx.stroke(); }, clipArea: function(ctx, area) { ctx.save(); ctx.beginPath(); ctx.rect(area.left, area.top, area.right - area.left, area.bottom - area.top); ctx.clip(); }, unclipArea: function(ctx) { ctx.restore(); }, lineTo: function(ctx, previous, target, flip) { if (target.steppedLine) { if ((target.steppedLine === 'after' && !flip) || (target.steppedLine !== 'after' && flip)) { ctx.lineTo(previous.x, target.y); } else { ctx.lineTo(target.x, previous.y); } ctx.lineTo(target.x, target.y); return; } if (!target.tension) { ctx.lineTo(target.x, target.y); return; } ctx.bezierCurveTo( flip ? previous.controlPointPreviousX : previous.controlPointNextX, flip ? previous.controlPointPreviousY : previous.controlPointNextY, flip ? target.controlPointNextX : target.controlPointPreviousX, flip ? target.controlPointNextY : target.controlPointPreviousY, target.x, target.y); } }; // DEPRECATIONS /** * Provided for backward compatibility, use Chart.helpers.canvas.clear instead. * @namespace Chart.helpers.clear * @deprecated since version 2.7.0 * @todo remove at version 3 * @private */ helpers.clear = exports.clear; /** * Provided for backward compatibility, use Chart.helpers.canvas.roundedRect instead. * @namespace Chart.helpers.drawRoundedRectangle * @deprecated since version 2.7.0 * @todo remove at version 3 * @private */ helpers.drawRoundedRectangle = function(ctx) { ctx.beginPath(); exports.roundedRect.apply(exports, arguments); ctx.closePath(); }; /***/ }), /***/ "./node_modules/chart.js/src/helpers/helpers.core.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * @namespace Chart.helpers */ var helpers = { /** * An empty function that can be used, for example, for optional callback. */ noop: function() {}, /** * Returns a unique id, sequentially generated from a global variable. * @returns {Number} * @function */ uid: (function() { var id = 0; return function() { return id++; }; }()), /** * Returns true if `value` is neither null nor undefined, else returns false. * @param {*} value - The value to test. * @returns {Boolean} * @since 2.7.0 */ isNullOrUndef: function(value) { return value === null || typeof value === 'undefined'; }, /** * Returns true if `value` is an array, else returns false. * @param {*} value - The value to test. * @returns {Boolean} * @function */ isArray: Array.isArray ? Array.isArray : function(value) { return Object.prototype.toString.call(value) === '[object Array]'; }, /** * Returns true if `value` is an object (excluding null), else returns false. * @param {*} value - The value to test. * @returns {Boolean} * @since 2.7.0 */ isObject: function(value) { return value !== null && Object.prototype.toString.call(value) === '[object Object]'; }, /** * Returns `value` if defined, else returns `defaultValue`. * @param {*} value - The value to return if defined. * @param {*} defaultValue - The value to return if `value` is undefined. * @returns {*} */ valueOrDefault: function(value, defaultValue) { return typeof value === 'undefined' ? defaultValue : value; }, /** * Returns value at the given `index` in array if defined, else returns `defaultValue`. * @param {Array} value - The array to lookup for value at `index`. * @param {Number} index - The index in `value` to lookup for value. * @param {*} defaultValue - The value to return if `value[index]` is undefined. * @returns {*} */ valueAtIndexOrDefault: function(value, index, defaultValue) { return helpers.valueOrDefault(helpers.isArray(value) ? value[index] : value, defaultValue); }, /** * Calls `fn` with the given `args` in the scope defined by `thisArg` and returns the * value returned by `fn`. If `fn` is not a function, this method returns undefined. * @param {Function} fn - The function to call. * @param {Array|undefined|null} args - The arguments with which `fn` should be called. * @param {Object} [thisArg] - The value of `this` provided for the call to `fn`. * @returns {*} */ callback: function(fn, args, thisArg) { if (fn && typeof fn.call === 'function') { return fn.apply(thisArg, args); } }, /** * Note(SB) for performance sake, this method should only be used when loopable type * is unknown or in none intensive code (not called often and small loopable). Else * it's preferable to use a regular for() loop and save extra function calls. * @param {Object|Array} loopable - The object or array to be iterated. * @param {Function} fn - The function to call for each item. * @param {Object} [thisArg] - The value of `this` provided for the call to `fn`. * @param {Boolean} [reverse] - If true, iterates backward on the loopable. */ each: function(loopable, fn, thisArg, reverse) { var i, len, keys; if (helpers.isArray(loopable)) { len = loopable.length; if (reverse) { for (i = len - 1; i >= 0; i--) { fn.call(thisArg, loopable[i], i); } } else { for (i = 0; i < len; i++) { fn.call(thisArg, loopable[i], i); } } } else if (helpers.isObject(loopable)) { keys = Object.keys(loopable); len = keys.length; for (i = 0; i < len; i++) { fn.call(thisArg, loopable[keys[i]], keys[i]); } } }, /** * Returns true if the `a0` and `a1` arrays have the same content, else returns false. * @see http://stackoverflow.com/a/14853974 * @param {Array} a0 - The array to compare * @param {Array} a1 - The array to compare * @returns {Boolean} */ arrayEquals: function(a0, a1) { var i, ilen, v0, v1; if (!a0 || !a1 || a0.length !== a1.length) { return false; } for (i = 0, ilen = a0.length; i < ilen; ++i) { v0 = a0[i]; v1 = a1[i]; if (v0 instanceof Array && v1 instanceof Array) { if (!helpers.arrayEquals(v0, v1)) { return false; } } else if (v0 !== v1) { // NOTE: two different object instances will never be equal: {x:20} != {x:20} return false; } } return true; }, /** * Returns a deep copy of `source` without keeping references on objects and arrays. * @param {*} source - The value to clone. * @returns {*} */ clone: function(source) { if (helpers.isArray(source)) { return source.map(helpers.clone); } if (helpers.isObject(source)) { var target = {}; var keys = Object.keys(source); var klen = keys.length; var k = 0; for (; k < klen; ++k) { target[keys[k]] = helpers.clone(source[keys[k]]); } return target; } return source; }, /** * The default merger when Chart.helpers.merge is called without merger option. * Note(SB): this method is also used by configMerge and scaleMerge as fallback. * @private */ _merger: function(key, target, source, options) { var tval = target[key]; var sval = source[key]; if (helpers.isObject(tval) && helpers.isObject(sval)) { helpers.merge(tval, sval, options); } else { target[key] = helpers.clone(sval); } }, /** * Merges source[key] in target[key] only if target[key] is undefined. * @private */ _mergerIf: function(key, target, source) { var tval = target[key]; var sval = source[key]; if (helpers.isObject(tval) && helpers.isObject(sval)) { helpers.mergeIf(tval, sval); } else if (!target.hasOwnProperty(key)) { target[key] = helpers.clone(sval); } }, /** * Recursively deep copies `source` properties into `target` with the given `options`. * IMPORTANT: `target` is not cloned and will be updated with `source` properties. * @param {Object} target - The target object in which all sources are merged into. * @param {Object|Array(Object)} source - Object(s) to merge into `target`. * @param {Object} [options] - Merging options: * @param {Function} [options.merger] - The merge method (key, target, source, options) * @returns {Object} The `target` object. */ merge: function(target, source, options) { var sources = helpers.isArray(source) ? source : [source]; var ilen = sources.length; var merge, i, keys, klen, k; if (!helpers.isObject(target)) { return target; } options = options || {}; merge = options.merger || helpers._merger; for (i = 0; i < ilen; ++i) { source = sources[i]; if (!helpers.isObject(source)) { continue; } keys = Object.keys(source); for (k = 0, klen = keys.length; k < klen; ++k) { merge(keys[k], target, source, options); } } return target; }, /** * Recursively deep copies `source` properties into `target` *only* if not defined in target. * IMPORTANT: `target` is not cloned and will be updated with `source` properties. * @param {Object} target - The target object in which all sources are merged into. * @param {Object|Array(Object)} source - Object(s) to merge into `target`. * @returns {Object} The `target` object. */ mergeIf: function(target, source) { return helpers.merge(target, source, {merger: helpers._mergerIf}); }, /** * Applies the contents of two or more objects together into the first object. * @param {Object} target - The target object in which all objects are merged into. * @param {Object} arg1 - Object containing additional properties to merge in target. * @param {Object} argN - Additional objects containing properties to merge in target. * @returns {Object} The `target` object. */ extend: function(target) { var setFn = function(value, key) { target[key] = value; }; for (var i = 1, ilen = arguments.length; i < ilen; ++i) { helpers.each(arguments[i], setFn); } return target; }, /** * Basic javascript inheritance based on the model created in Backbone.js */ inherits: function(extensions) { var me = this; var ChartElement = (extensions && extensions.hasOwnProperty('constructor')) ? extensions.constructor : function() { return me.apply(this, arguments); }; var Surrogate = function() { this.constructor = ChartElement; }; Surrogate.prototype = me.prototype; ChartElement.prototype = new Surrogate(); ChartElement.extend = helpers.inherits; if (extensions) { helpers.extend(ChartElement.prototype, extensions); } ChartElement.__super__ = me.prototype; return ChartElement; } }; module.exports = helpers; // DEPRECATIONS /** * Provided for backward compatibility, use Chart.helpers.callback instead. * @function Chart.helpers.callCallback * @deprecated since version 2.6.0 * @todo remove at version 3 * @private */ helpers.callCallback = helpers.callback; /** * Provided for backward compatibility, use Array.prototype.indexOf instead. * Array.prototype.indexOf compatibility: Chrome, Opera, Safari, FF1.5+, IE9+ * @function Chart.helpers.indexOf * @deprecated since version 2.7.0 * @todo remove at version 3 * @private */ helpers.indexOf = function(array, item, fromIndex) { return Array.prototype.indexOf.call(array, item, fromIndex); }; /** * Provided for backward compatibility, use Chart.helpers.valueOrDefault instead. * @function Chart.helpers.getValueOrDefault * @deprecated since version 2.7.0 * @todo remove at version 3 * @private */ helpers.getValueOrDefault = helpers.valueOrDefault; /** * Provided for backward compatibility, use Chart.helpers.valueAtIndexOrDefault instead. * @function Chart.helpers.getValueAtIndexOrDefault * @deprecated since version 2.7.0 * @todo remove at version 3 * @private */ helpers.getValueAtIndexOrDefault = helpers.valueAtIndexOrDefault; /***/ }), /***/ "./node_modules/chart.js/src/helpers/helpers.easing.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; var helpers = __webpack_require__("./node_modules/chart.js/src/helpers/helpers.core.js"); /** * Easing functions adapted from Robert Penner's easing equations. * @namespace Chart.helpers.easingEffects * @see http://www.robertpenner.com/easing/ */ var effects = { linear: function(t) { return t; }, easeInQuad: function(t) { return t * t; }, easeOutQuad: function(t) { return -t * (t - 2); }, easeInOutQuad: function(t) { if ((t /= 0.5) < 1) { return 0.5 * t * t; } return -0.5 * ((--t) * (t - 2) - 1); }, easeInCubic: function(t) { return t * t * t; }, easeOutCubic: function(t) { return (t = t - 1) * t * t + 1; }, easeInOutCubic: function(t) { if ((t /= 0.5) < 1) { return 0.5 * t * t * t; } return 0.5 * ((t -= 2) * t * t + 2); }, easeInQuart: function(t) { return t * t * t * t; }, easeOutQuart: function(t) { return -((t = t - 1) * t * t * t - 1); }, easeInOutQuart: function(t) { if ((t /= 0.5) < 1) { return 0.5 * t * t * t * t; } return -0.5 * ((t -= 2) * t * t * t - 2); }, easeInQuint: function(t) { return t * t * t * t * t; }, easeOutQuint: function(t) { return (t = t - 1) * t * t * t * t + 1; }, easeInOutQuint: function(t) { if ((t /= 0.5) < 1) { return 0.5 * t * t * t * t * t; } return 0.5 * ((t -= 2) * t * t * t * t + 2); }, easeInSine: function(t) { return -Math.cos(t * (Math.PI / 2)) + 1; }, easeOutSine: function(t) { return Math.sin(t * (Math.PI / 2)); }, easeInOutSine: function(t) { return -0.5 * (Math.cos(Math.PI * t) - 1); }, easeInExpo: function(t) { return (t === 0) ? 0 : Math.pow(2, 10 * (t - 1)); }, easeOutExpo: function(t) { return (t === 1) ? 1 : -Math.pow(2, -10 * t) + 1; }, easeInOutExpo: function(t) { if (t === 0) { return 0; } if (t === 1) { return 1; } if ((t /= 0.5) < 1) { return 0.5 * Math.pow(2, 10 * (t - 1)); } return 0.5 * (-Math.pow(2, -10 * --t) + 2); }, easeInCirc: function(t) { if (t >= 1) { return t; } return -(Math.sqrt(1 - t * t) - 1); }, easeOutCirc: function(t) { return Math.sqrt(1 - (t = t - 1) * t); }, easeInOutCirc: function(t) { if ((t /= 0.5) < 1) { return -0.5 * (Math.sqrt(1 - t * t) - 1); } return 0.5 * (Math.sqrt(1 - (t -= 2) * t) + 1); }, easeInElastic: function(t) { var s = 1.70158; var p = 0; var a = 1; if (t === 0) { return 0; } if (t === 1) { return 1; } if (!p) { p = 0.3; } if (a < 1) { a = 1; s = p / 4; } else { s = p / (2 * Math.PI) * Math.asin(1 / a); } return -(a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t - s) * (2 * Math.PI) / p)); }, easeOutElastic: function(t) { var s = 1.70158; var p = 0; var a = 1; if (t === 0) { return 0; } if (t === 1) { return 1; } if (!p) { p = 0.3; } if (a < 1) { a = 1; s = p / 4; } else { s = p / (2 * Math.PI) * Math.asin(1 / a); } return a * Math.pow(2, -10 * t) * Math.sin((t - s) * (2 * Math.PI) / p) + 1; }, easeInOutElastic: function(t) { var s = 1.70158; var p = 0; var a = 1; if (t === 0) { return 0; } if ((t /= 0.5) === 2) { return 1; } if (!p) { p = 0.45; } if (a < 1) { a = 1; s = p / 4; } else { s = p / (2 * Math.PI) * Math.asin(1 / a); } if (t < 1) { return -0.5 * (a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t - s) * (2 * Math.PI) / p)); } return a * Math.pow(2, -10 * (t -= 1)) * Math.sin((t - s) * (2 * Math.PI) / p) * 0.5 + 1; }, easeInBack: function(t) { var s = 1.70158; return t * t * ((s + 1) * t - s); }, easeOutBack: function(t) { var s = 1.70158; return (t = t - 1) * t * ((s + 1) * t + s) + 1; }, easeInOutBack: function(t) { var s = 1.70158; if ((t /= 0.5) < 1) { return 0.5 * (t * t * (((s *= (1.525)) + 1) * t - s)); } return 0.5 * ((t -= 2) * t * (((s *= (1.525)) + 1) * t + s) + 2); }, easeInBounce: function(t) { return 1 - effects.easeOutBounce(1 - t); }, easeOutBounce: function(t) { if (t < (1 / 2.75)) { return 7.5625 * t * t; } if (t < (2 / 2.75)) { return 7.5625 * (t -= (1.5 / 2.75)) * t + 0.75; } if (t < (2.5 / 2.75)) { return 7.5625 * (t -= (2.25 / 2.75)) * t + 0.9375; } return 7.5625 * (t -= (2.625 / 2.75)) * t + 0.984375; }, easeInOutBounce: function(t) { if (t < 0.5) { return effects.easeInBounce(t * 2) * 0.5; } return effects.easeOutBounce(t * 2 - 1) * 0.5 + 0.5; } }; module.exports = { effects: effects }; // DEPRECATIONS /** * Provided for backward compatibility, use Chart.helpers.easing.effects instead. * @function Chart.helpers.easingEffects * @deprecated since version 2.7.0 * @todo remove at version 3 * @private */ helpers.easingEffects = effects; /***/ }), /***/ "./node_modules/chart.js/src/helpers/helpers.options.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; var helpers = __webpack_require__("./node_modules/chart.js/src/helpers/helpers.core.js"); /** * @alias Chart.helpers.options * @namespace */ module.exports = { /** * Converts the given line height `value` in pixels for a specific font `size`. * @param {Number|String} value - The lineHeight to parse (eg. 1.6, '14px', '75%', '1.6em'). * @param {Number} size - The font size (in pixels) used to resolve relative `value`. * @returns {Number} The effective line height in pixels (size * 1.2 if value is invalid). * @see https://developer.mozilla.org/en-US/docs/Web/CSS/line-height * @since 2.7.0 */ toLineHeight: function(value, size) { var matches = ('' + value).match(/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/); if (!matches || matches[1] === 'normal') { return size * 1.2; } value = +matches[2]; switch (matches[3]) { case 'px': return value; case '%': value /= 100; break; default: break; } return size * value; }, /** * Converts the given value into a padding object with pre-computed width/height. * @param {Number|Object} value - If a number, set the value to all TRBL component, * else, if and object, use defined properties and sets undefined ones to 0. * @returns {Object} The padding values (top, right, bottom, left, width, height) * @since 2.7.0 */ toPadding: function(value) { var t, r, b, l; if (helpers.isObject(value)) { t = +value.top || 0; r = +value.right || 0; b = +value.bottom || 0; l = +value.left || 0; } else { t = r = b = l = +value || 0; } return { top: t, right: r, bottom: b, left: l, height: t + b, width: l + r }; }, /** * Evaluates the given `inputs` sequentially and returns the first defined value. * @param {Array[]} inputs - An array of values, falling back to the last value. * @param {Object} [context] - If defined and the current value is a function, the value * is called with `context` as first argument and the result becomes the new input. * @param {Number} [index] - If defined and the current value is an array, the value * at `index` become the new input. * @since 2.7.0 */ resolve: function(inputs, context, index) { var i, ilen, value; for (i = 0, ilen = inputs.length; i < ilen; ++i) { value = inputs[i]; if (value === undefined) { continue; } if (context !== undefined && typeof value === 'function') { value = value(context); } if (index !== undefined && helpers.isArray(value)) { value = value[index]; } if (value !== undefined) { return value; } } } }; /***/ }), /***/ "./node_modules/chart.js/src/helpers/index.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; module.exports = __webpack_require__("./node_modules/chart.js/src/helpers/helpers.core.js"); module.exports.easing = __webpack_require__("./node_modules/chart.js/src/helpers/helpers.easing.js"); module.exports.canvas = __webpack_require__("./node_modules/chart.js/src/helpers/helpers.canvas.js"); module.exports.options = __webpack_require__("./node_modules/chart.js/src/helpers/helpers.options.js"); /***/ }), /***/ "./node_modules/chart.js/src/platforms/platform.basic.js": /***/ (function(module, exports) { /** * Platform fallback implementation (minimal). * @see https://github.com/chartjs/Chart.js/pull/4591#issuecomment-319575939 */ module.exports = { acquireContext: function(item) { if (item && item.canvas) { // Support for any object associated to a canvas (including a context2d) item = item.canvas; } return item && item.getContext('2d') || null; } }; /***/ }), /***/ "./node_modules/chart.js/src/platforms/platform.dom.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * Chart.Platform implementation for targeting a web browser */ var helpers = __webpack_require__("./node_modules/chart.js/src/helpers/index.js"); var EXPANDO_KEY = '$chartjs'; var CSS_PREFIX = 'chartjs-'; var CSS_RENDER_MONITOR = CSS_PREFIX + 'render-monitor'; var CSS_RENDER_ANIMATION = CSS_PREFIX + 'render-animation'; var ANIMATION_START_EVENTS = ['animationstart', 'webkitAnimationStart']; /** * DOM event types -> Chart.js event types. * Note: only events with different types are mapped. * @see https://developer.mozilla.org/en-US/docs/Web/Events */ var EVENT_TYPES = { touchstart: 'mousedown', touchmove: 'mousemove', touchend: 'mouseup', pointerenter: 'mouseenter', pointerdown: 'mousedown', pointermove: 'mousemove', pointerup: 'mouseup', pointerleave: 'mouseout', pointerout: 'mouseout' }; /** * The "used" size is the final value of a dimension property after all calculations have * been performed. This method uses the computed style of `element` but returns undefined * if the computed style is not expressed in pixels. That can happen in some cases where * `element` has a size relative to its parent and this last one is not yet displayed, * for example because of `display: none` on a parent node. * @see https://developer.mozilla.org/en-US/docs/Web/CSS/used_value * @returns {Number} Size in pixels or undefined if unknown. */ function readUsedSize(element, property) { var value = helpers.getStyle(element, property); var matches = value && value.match(/^(\d+)(\.\d+)?px$/); return matches ? Number(matches[1]) : undefined; } /** * Initializes the canvas style and render size without modifying the canvas display size, * since responsiveness is handled by the controller.resize() method. The config is used * to determine the aspect ratio to apply in case no explicit height has been specified. */ function initCanvas(canvas, config) { var style = canvas.style; // NOTE(SB) canvas.getAttribute('width') !== canvas.width: in the first case it // returns null or '' if no explicit value has been set to the canvas attribute. var renderHeight = canvas.getAttribute('height'); var renderWidth = canvas.getAttribute('width'); // Chart.js modifies some canvas values that we want to restore on destroy canvas[EXPANDO_KEY] = { initial: { height: renderHeight, width: renderWidth, style: { display: style.display, height: style.height, width: style.width } } }; // Force canvas to display as block to avoid extra space caused by inline // elements, which would interfere with the responsive resize process. // https://github.com/chartjs/Chart.js/issues/2538 style.display = style.display || 'block'; if (renderWidth === null || renderWidth === '') { var displayWidth = readUsedSize(canvas, 'width'); if (displayWidth !== undefined) { canvas.width = displayWidth; } } if (renderHeight === null || renderHeight === '') { if (canvas.style.height === '') { // If no explicit render height and style height, let's apply the aspect ratio, // which one can be specified by the user but also by charts as default option // (i.e. options.aspectRatio). If not specified, use canvas aspect ratio of 2. canvas.height = canvas.width / (config.options.aspectRatio || 2); } else { var displayHeight = readUsedSize(canvas, 'height'); if (displayWidth !== undefined) { canvas.height = displayHeight; } } } return canvas; } /** * Detects support for options object argument in addEventListener. * https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#Safely_detecting_option_support * @private */ var supportsEventListenerOptions = (function() { var supports = false; try { var options = Object.defineProperty({}, 'passive', { get: function() { supports = true; } }); window.addEventListener('e', null, options); } catch (e) { // continue regardless of error } return supports; }()); // Default passive to true as expected by Chrome for 'touchstart' and 'touchend' events. // https://github.com/chartjs/Chart.js/issues/4287 var eventListenerOptions = supportsEventListenerOptions ? {passive: true} : false; function addEventListener(node, type, listener) { node.addEventListener(type, listener, eventListenerOptions); } function removeEventListener(node, type, listener) { node.removeEventListener(type, listener, eventListenerOptions); } function createEvent(type, chart, x, y, nativeEvent) { return { type: type, chart: chart, native: nativeEvent || null, x: x !== undefined ? x : null, y: y !== undefined ? y : null, }; } function fromNativeEvent(event, chart) { var type = EVENT_TYPES[event.type] || event.type; var pos = helpers.getRelativePosition(event, chart); return createEvent(type, chart, pos.x, pos.y, event); } function throttled(fn, thisArg) { var ticking = false; var args = []; return function() { args = Array.prototype.slice.call(arguments); thisArg = thisArg || this; if (!ticking) { ticking = true; helpers.requestAnimFrame.call(window, function() { ticking = false; fn.apply(thisArg, args); }); } }; } // Implementation based on https://github.com/marcj/css-element-queries function createResizer(handler) { var resizer = document.createElement('div'); var cls = CSS_PREFIX + 'size-monitor'; var maxSize = 1000000; var style = 'position:absolute;' + 'left:0;' + 'top:0;' + 'right:0;' + 'bottom:0;' + 'overflow:hidden;' + 'pointer-events:none;' + 'visibility:hidden;' + 'z-index:-1;'; resizer.style.cssText = style; resizer.className = cls; resizer.innerHTML = '<div class="' + cls + '-expand" style="' + style + '">' + '<div style="' + 'position:absolute;' + 'width:' + maxSize + 'px;' + 'height:' + maxSize + 'px;' + 'left:0;' + 'top:0">' + '</div>' + '</div>' + '<div class="' + cls + '-shrink" style="' + style + '">' + '<div style="' + 'position:absolute;' + 'width:200%;' + 'height:200%;' + 'left:0; ' + 'top:0">' + '</div>' + '</div>'; var expand = resizer.childNodes[0]; var shrink = resizer.childNodes[1]; resizer._reset = function() { expand.scrollLeft = maxSize; expand.scrollTop = maxSize; shrink.scrollLeft = maxSize; shrink.scrollTop = maxSize; }; var onScroll = function() { resizer._reset(); handler(); }; addEventListener(expand, 'scroll', onScroll.bind(expand, 'expand')); addEventListener(shrink, 'scroll', onScroll.bind(shrink, 'shrink')); return resizer; } // https://davidwalsh.name/detect-node-insertion function watchForRender(node, handler) { var expando = node[EXPANDO_KEY] || (node[EXPANDO_KEY] = {}); var proxy = expando.renderProxy = function(e) { if (e.animationName === CSS_RENDER_ANIMATION) { handler(); } }; helpers.each(ANIMATION_START_EVENTS, function(type) { addEventListener(node, type, proxy); }); // #4737: Chrome might skip the CSS animation when the CSS_RENDER_MONITOR class // is removed then added back immediately (same animation frame?). Accessing the // `offsetParent` property will force a reflow and re-evaluate the CSS animation. // https://gist.github.com/paulirish/5d52fb081b3570c81e3a#box-metrics // https://github.com/chartjs/Chart.js/issues/4737 expando.reflow = !!node.offsetParent; node.classList.add(CSS_RENDER_MONITOR); } function unwatchForRender(node) { var expando = node[EXPANDO_KEY] || {}; var proxy = expando.renderProxy; if (proxy) { helpers.each(ANIMATION_START_EVENTS, function(type) { removeEventListener(node, type, proxy); }); delete expando.renderProxy; } node.classList.remove(CSS_RENDER_MONITOR); } function addResizeListener(node, listener, chart) { var expando = node[EXPANDO_KEY] || (node[EXPANDO_KEY] = {}); // Let's keep track of this added resizer and thus avoid DOM query when removing it. var resizer = expando.resizer = createResizer(throttled(function() { if (expando.resizer) { return listener(createEvent('resize', chart)); } })); // The resizer needs to be attached to the node parent, so we first need to be // sure that `node` is attached to the DOM before injecting the resizer element. watchForRender(node, function() { if (expando.resizer) { var container = node.parentNode; if (container && container !== resizer.parentNode) { container.insertBefore(resizer, container.firstChild); } // The container size might have changed, let's reset the resizer state. resizer._reset(); } }); } function removeResizeListener(node) { var expando = node[EXPANDO_KEY] || {}; var resizer = expando.resizer; delete expando.resizer; unwatchForRender(node); if (resizer && resizer.parentNode) { resizer.parentNode.removeChild(resizer); } } function injectCSS(platform, css) { // http://stackoverflow.com/q/3922139 var style = platform._style || document.createElement('style'); if (!platform._style) { platform._style = style; css = '/* Chart.js */\n' + css; style.setAttribute('type', 'text/css'); document.getElementsByTagName('head')[0].appendChild(style); } style.appendChild(document.createTextNode(css)); } module.exports = { /** * This property holds whether this platform is enabled for the current environment. * Currently used by platform.js to select the proper implementation. * @private */ _enabled: typeof window !== 'undefined' && typeof document !== 'undefined', initialize: function() { var keyframes = 'from{opacity:0.99}to{opacity:1}'; injectCSS(this, // DOM rendering detection // https://davidwalsh.name/detect-node-insertion '@-webkit-keyframes ' + CSS_RENDER_ANIMATION + '{' + keyframes + '}' + '@keyframes ' + CSS_RENDER_ANIMATION + '{' + keyframes + '}' + '.' + CSS_RENDER_MONITOR + '{' + '-webkit-animation:' + CSS_RENDER_ANIMATION + ' 0.001s;' + 'animation:' + CSS_RENDER_ANIMATION + ' 0.001s;' + '}' ); }, acquireContext: function(item, config) { if (typeof item === 'string') { item = document.getElementById(item); } else if (item.length) { // Support for array based queries (such as jQuery) item = item[0]; } if (item && item.canvas) { // Support for any object associated to a canvas (including a context2d) item = item.canvas; } // To prevent canvas fingerprinting, some add-ons undefine the getContext // method, for example: https://github.com/kkapsner/CanvasBlocker // https://github.com/chartjs/Chart.js/issues/2807 var context = item && item.getContext && item.getContext('2d'); // `instanceof HTMLCanvasElement/CanvasRenderingContext2D` fails when the item is // inside an iframe or when running in a protected environment. We could guess the // types from their toString() value but let's keep things flexible and assume it's // a sufficient condition if the item has a context2D which has item as `canvas`. // https://github.com/chartjs/Chart.js/issues/3887 // https://github.com/chartjs/Chart.js/issues/4102 // https://github.com/chartjs/Chart.js/issues/4152 if (context && context.canvas === item) { initCanvas(item, config); return context; } return null; }, releaseContext: function(context) { var canvas = context.canvas; if (!canvas[EXPANDO_KEY]) { return; } var initial = canvas[EXPANDO_KEY].initial; ['height', 'width'].forEach(function(prop) { var value = initial[prop]; if (helpers.isNullOrUndef(value)) { canvas.removeAttribute(prop); } else { canvas.setAttribute(prop, value); } }); helpers.each(initial.style || {}, function(value, key) { canvas.style[key] = value; }); // The canvas render size might have been changed (and thus the state stack discarded), // we can't use save() and restore() to restore the initial state. So make sure that at // least the canvas context is reset to the default state by setting the canvas width. // https://www.w3.org/TR/2011/WD-html5-20110525/the-canvas-element.html canvas.width = canvas.width; delete canvas[EXPANDO_KEY]; }, addEventListener: function(chart, type, listener) { var canvas = chart.canvas; if (type === 'resize') { // Note: the resize event is not supported on all browsers. addResizeListener(canvas, listener, chart); return; } var expando = listener[EXPANDO_KEY] || (listener[EXPANDO_KEY] = {}); var proxies = expando.proxies || (expando.proxies = {}); var proxy = proxies[chart.id + '_' + type] = function(event) { listener(fromNativeEvent(event, chart)); }; addEventListener(canvas, type, proxy); }, removeEventListener: function(chart, type, listener) { var canvas = chart.canvas; if (type === 'resize') { // Note: the resize event is not supported on all browsers. removeResizeListener(canvas, listener); return; } var expando = listener[EXPANDO_KEY] || {}; var proxies = expando.proxies || {}; var proxy = proxies[chart.id + '_' + type]; if (!proxy) { return; } removeEventListener(canvas, type, proxy); } }; // DEPRECATIONS /** * Provided for backward compatibility, use EventTarget.addEventListener instead. * EventTarget.addEventListener compatibility: Chrome, Opera 7, Safari, FF1.5+, IE9+ * @see https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener * @function Chart.helpers.addEvent * @deprecated since version 2.7.0 * @todo remove at version 3 * @private */ helpers.addEvent = addEventListener; /** * Provided for backward compatibility, use EventTarget.removeEventListener instead. * EventTarget.removeEventListener compatibility: Chrome, Opera 7, Safari, FF1.5+, IE9+ * @see https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/removeEventListener * @function Chart.helpers.removeEvent * @deprecated since version 2.7.0 * @todo remove at version 3 * @private */ helpers.removeEvent = removeEventListener; /***/ }), /***/ "./node_modules/chart.js/src/platforms/platform.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; var helpers = __webpack_require__("./node_modules/chart.js/src/helpers/index.js"); var basic = __webpack_require__("./node_modules/chart.js/src/platforms/platform.basic.js"); var dom = __webpack_require__("./node_modules/chart.js/src/platforms/platform.dom.js"); // @TODO Make possible to select another platform at build time. var implementation = dom._enabled ? dom : basic; /** * @namespace Chart.platform * @see https://chartjs.gitbooks.io/proposals/content/Platform.html * @since 2.4.0 */ module.exports = helpers.extend({ /** * @since 2.7.0 */ initialize: function() {}, /** * Called at chart construction time, returns a context2d instance implementing * the [W3C Canvas 2D Context API standard]{@link https://www.w3.org/TR/2dcontext/}. * @param {*} item - The native item from which to acquire context (platform specific) * @param {Object} options - The chart options * @returns {CanvasRenderingContext2D} context2d instance */ acquireContext: function() {}, /** * Called at chart destruction time, releases any resources associated to the context * previously returned by the acquireContext() method. * @param {CanvasRenderingContext2D} context - The context2d instance * @returns {Boolean} true if the method succeeded, else false */ releaseContext: function() {}, /** * Registers the specified listener on the given chart. * @param {Chart} chart - Chart from which to listen for event * @param {String} type - The ({@link IEvent}) type to listen for * @param {Function} listener - Receives a notification (an object that implements * the {@link IEvent} interface) when an event of the specified type occurs. */ addEventListener: function() {}, /** * Removes the specified listener previously registered with addEventListener. * @param {Chart} chart -Chart from which to remove the listener * @param {String} type - The ({@link IEvent}) type to remove * @param {Function} listener - The listener function to remove from the event target. */ removeEventListener: function() {} }, implementation); /** * @interface IPlatform * Allows abstracting platform dependencies away from the chart * @borrows Chart.platform.acquireContext as acquireContext * @borrows Chart.platform.releaseContext as releaseContext * @borrows Chart.platform.addEventListener as addEventListener * @borrows Chart.platform.removeEventListener as removeEventListener */ /** * @interface IEvent * @prop {String} type - The event type name, possible values are: * 'contextmenu', 'mouseenter', 'mousedown', 'mousemove', 'mouseup', 'mouseout', * 'click', 'dblclick', 'keydown', 'keypress', 'keyup' and 'resize' * @prop {*} native - The original native event (null for emulated events, e.g. 'resize') * @prop {Number} x - The mouse x position, relative to the canvas (null for incompatible events) * @prop {Number} y - The mouse y position, relative to the canvas (null for incompatible events) */ /***/ }), /***/ "./node_modules/chart.js/src/plugins/index.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; module.exports = {}; module.exports.filler = __webpack_require__("./node_modules/chart.js/src/plugins/plugin.filler.js"); module.exports.legend = __webpack_require__("./node_modules/chart.js/src/plugins/plugin.legend.js"); module.exports.title = __webpack_require__("./node_modules/chart.js/src/plugins/plugin.title.js"); /***/ }), /***/ "./node_modules/chart.js/src/plugins/plugin.filler.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * Plugin based on discussion from the following Chart.js issues: * @see https://github.com/chartjs/Chart.js/issues/2380#issuecomment-279961569 * @see https://github.com/chartjs/Chart.js/issues/2440#issuecomment-256461897 */ var defaults = __webpack_require__("./node_modules/chart.js/src/core/core.defaults.js"); var elements = __webpack_require__("./node_modules/chart.js/src/elements/index.js"); var helpers = __webpack_require__("./node_modules/chart.js/src/helpers/index.js"); defaults._set('global', { plugins: { filler: { propagate: true } } }); var mappers = { dataset: function(source) { var index = source.fill; var chart = source.chart; var meta = chart.getDatasetMeta(index); var visible = meta && chart.isDatasetVisible(index); var points = (visible && meta.dataset._children) || []; var length = points.length || 0; return !length ? null : function(point, i) { return (i < length && points[i]._view) || null; }; }, boundary: function(source) { var boundary = source.boundary; var x = boundary ? boundary.x : null; var y = boundary ? boundary.y : null; return function(point) { return { x: x === null ? point.x : x, y: y === null ? point.y : y, }; }; } }; // @todo if (fill[0] === '#') function decodeFill(el, index, count) { var model = el._model || {}; var fill = model.fill; var target; if (fill === undefined) { fill = !!model.backgroundColor; } if (fill === false || fill === null) { return false; } if (fill === true) { return 'origin'; } target = parseFloat(fill, 10); if (isFinite(target) && Math.floor(target) === target) { if (fill[0] === '-' || fill[0] === '+') { target = index + target; } if (target === index || target < 0 || target >= count) { return false; } return target; } switch (fill) { // compatibility case 'bottom': return 'start'; case 'top': return 'end'; case 'zero': return 'origin'; // supported boundaries case 'origin': case 'start': case 'end': return fill; // invalid fill values default: return false; } } function computeBoundary(source) { var model = source.el._model || {}; var scale = source.el._scale || {}; var fill = source.fill; var target = null; var horizontal; if (isFinite(fill)) { return null; } // Backward compatibility: until v3, we still need to support boundary values set on // the model (scaleTop, scaleBottom and scaleZero) because some external plugins and // controllers might still use it (e.g. the Smith chart). if (fill === 'start') { target = model.scaleBottom === undefined ? scale.bottom : model.scaleBottom; } else if (fill === 'end') { target = model.scaleTop === undefined ? scale.top : model.scaleTop; } else if (model.scaleZero !== undefined) { target = model.scaleZero; } else if (scale.getBasePosition) { target = scale.getBasePosition(); } else if (scale.getBasePixel) { target = scale.getBasePixel(); } if (target !== undefined && target !== null) { if (target.x !== undefined && target.y !== undefined) { return target; } if (typeof target === 'number' && isFinite(target)) { horizontal = scale.isHorizontal(); return { x: horizontal ? target : null, y: horizontal ? null : target }; } } return null; } function resolveTarget(sources, index, propagate) { var source = sources[index]; var fill = source.fill; var visited = [index]; var target; if (!propagate) { return fill; } while (fill !== false && visited.indexOf(fill) === -1) { if (!isFinite(fill)) { return fill; } target = sources[fill]; if (!target) { return false; } if (target.visible) { return fill; } visited.push(fill); fill = target.fill; } return false; } function createMapper(source) { var fill = source.fill; var type = 'dataset'; if (fill === false) { return null; } if (!isFinite(fill)) { type = 'boundary'; } return mappers[type](source); } function isDrawable(point) { return point && !point.skip; } function drawArea(ctx, curve0, curve1, len0, len1) { var i; if (!len0 || !len1) { return; } // building first area curve (normal) ctx.moveTo(curve0[0].x, curve0[0].y); for (i = 1; i < len0; ++i) { helpers.canvas.lineTo(ctx, curve0[i - 1], curve0[i]); } // joining the two area curves ctx.lineTo(curve1[len1 - 1].x, curve1[len1 - 1].y); // building opposite area curve (reverse) for (i = len1 - 1; i > 0; --i) { helpers.canvas.lineTo(ctx, curve1[i], curve1[i - 1], true); } } function doFill(ctx, points, mapper, view, color, loop) { var count = points.length; var span = view.spanGaps; var curve0 = []; var curve1 = []; var len0 = 0; var len1 = 0; var i, ilen, index, p0, p1, d0, d1; ctx.beginPath(); for (i = 0, ilen = (count + !!loop); i < ilen; ++i) { index = i % count; p0 = points[index]._view; p1 = mapper(p0, index, view); d0 = isDrawable(p0); d1 = isDrawable(p1); if (d0 && d1) { len0 = curve0.push(p0); len1 = curve1.push(p1); } else if (len0 && len1) { if (!span) { drawArea(ctx, curve0, curve1, len0, len1); len0 = len1 = 0; curve0 = []; curve1 = []; } else { if (d0) { curve0.push(p0); } if (d1) { curve1.push(p1); } } } } drawArea(ctx, curve0, curve1, len0, len1); ctx.closePath(); ctx.fillStyle = color; ctx.fill(); } module.exports = { id: 'filler', afterDatasetsUpdate: function(chart, options) { var count = (chart.data.datasets || []).length; var propagate = options.propagate; var sources = []; var meta, i, el, source; for (i = 0; i < count; ++i) { meta = chart.getDatasetMeta(i); el = meta.dataset; source = null; if (el && el._model && el instanceof elements.Line) { source = { visible: chart.isDatasetVisible(i), fill: decodeFill(el, i, count), chart: chart, el: el }; } meta.$filler = source; sources.push(source); } for (i = 0; i < count; ++i) { source = sources[i]; if (!source) { continue; } source.fill = resolveTarget(sources, i, propagate); source.boundary = computeBoundary(source); source.mapper = createMapper(source); } }, beforeDatasetDraw: function(chart, args) { var meta = args.meta.$filler; if (!meta) { return; } var ctx = chart.ctx; var el = meta.el; var view = el._view; var points = el._children || []; var mapper = meta.mapper; var color = view.backgroundColor || defaults.global.defaultColor; if (mapper && color && points.length) { helpers.canvas.clipArea(ctx, chart.chartArea); doFill(ctx, points, mapper, view, color, el._loop); helpers.canvas.unclipArea(ctx); } } }; /***/ }), /***/ "./node_modules/chart.js/src/plugins/plugin.legend.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; var defaults = __webpack_require__("./node_modules/chart.js/src/core/core.defaults.js"); var Element = __webpack_require__("./node_modules/chart.js/src/core/core.element.js"); var helpers = __webpack_require__("./node_modules/chart.js/src/helpers/index.js"); var layouts = __webpack_require__("./node_modules/chart.js/src/core/core.layouts.js"); var noop = helpers.noop; defaults._set('global', { legend: { display: true, position: 'top', fullWidth: true, reverse: false, weight: 1000, // a callback that will handle onClick: function(e, legendItem) { var index = legendItem.datasetIndex; var ci = this.chart; var meta = ci.getDatasetMeta(index); // See controller.isDatasetVisible comment meta.hidden = meta.hidden === null ? !ci.data.datasets[index].hidden : null; // We hid a dataset ... rerender the chart ci.update(); }, onHover: null, labels: { boxWidth: 40, padding: 10, // Generates labels shown in the legend // Valid properties to return: // text : text to display // fillStyle : fill of coloured box // strokeStyle: stroke of coloured box // hidden : if this legend item refers to a hidden item // lineCap : cap style for line // lineDash // lineDashOffset : // lineJoin : // lineWidth : generateLabels: function(chart) { var data = chart.data; return helpers.isArray(data.datasets) ? data.datasets.map(function(dataset, i) { return { text: dataset.label, fillStyle: (!helpers.isArray(dataset.backgroundColor) ? dataset.backgroundColor : dataset.backgroundColor[0]), hidden: !chart.isDatasetVisible(i), lineCap: dataset.borderCapStyle, lineDash: dataset.borderDash, lineDashOffset: dataset.borderDashOffset, lineJoin: dataset.borderJoinStyle, lineWidth: dataset.borderWidth, strokeStyle: dataset.borderColor, pointStyle: dataset.pointStyle, // Below is extra data used for toggling the datasets datasetIndex: i }; }, this) : []; } } }, legendCallback: function(chart) { var text = []; text.push('<ul class="' + chart.id + '-legend">'); for (var i = 0; i < chart.data.datasets.length; i++) { text.push('<li><span style="background-color:' + chart.data.datasets[i].backgroundColor + '"></span>'); if (chart.data.datasets[i].label) { text.push(chart.data.datasets[i].label); } text.push('</li>'); } text.push('</ul>'); return text.join(''); } }); /** * Helper function to get the box width based on the usePointStyle option * @param labelopts {Object} the label options on the legend * @param fontSize {Number} the label font size * @return {Number} width of the color box area */ function getBoxWidth(labelOpts, fontSize) { return labelOpts.usePointStyle ? fontSize * Math.SQRT2 : labelOpts.boxWidth; } /** * IMPORTANT: this class is exposed publicly as Chart.Legend, backward compatibility required! */ var Legend = Element.extend({ initialize: function(config) { helpers.extend(this, config); // Contains hit boxes for each dataset (in dataset order) this.legendHitBoxes = []; // Are we in doughnut mode which has a different data type this.doughnutMode = false; }, // These methods are ordered by lifecycle. Utilities then follow. // Any function defined here is inherited by all legend types. // Any function can be extended by the legend type beforeUpdate: noop, update: function(maxWidth, maxHeight, margins) { var me = this; // Update Lifecycle - Probably don't want to ever extend or overwrite this function ;) me.beforeUpdate(); // Absorb the master measurements me.maxWidth = maxWidth; me.maxHeight = maxHeight; me.margins = margins; // Dimensions me.beforeSetDimensions(); me.setDimensions(); me.afterSetDimensions(); // Labels me.beforeBuildLabels(); me.buildLabels(); me.afterBuildLabels(); // Fit me.beforeFit(); me.fit(); me.afterFit(); // me.afterUpdate(); return me.minSize; }, afterUpdate: noop, // beforeSetDimensions: noop, setDimensions: function() { var me = this; // Set the unconstrained dimension before label rotation if (me.isHorizontal()) { // Reset position before calculating rotation me.width = me.maxWidth; me.left = 0; me.right = me.width; } else { me.height = me.maxHeight; // Reset position before calculating rotation me.top = 0; me.bottom = me.height; } // Reset padding me.paddingLeft = 0; me.paddingTop = 0; me.paddingRight = 0; me.paddingBottom = 0; // Reset minSize me.minSize = { width: 0, height: 0 }; }, afterSetDimensions: noop, // beforeBuildLabels: noop, buildLabels: function() { var me = this; var labelOpts = me.options.labels || {}; var legendItems = helpers.callback(labelOpts.generateLabels, [me.chart], me) || []; if (labelOpts.filter) { legendItems = legendItems.filter(function(item) { return labelOpts.filter(item, me.chart.data); }); } if (me.options.reverse) { legendItems.reverse(); } me.legendItems = legendItems; }, afterBuildLabels: noop, // beforeFit: noop, fit: function() { var me = this; var opts = me.options; var labelOpts = opts.labels; var display = opts.display; var ctx = me.ctx; var globalDefault = defaults.global; var valueOrDefault = helpers.valueOrDefault; var fontSize = valueOrDefault(labelOpts.fontSize, globalDefault.defaultFontSize); var fontStyle = valueOrDefault(labelOpts.fontStyle, globalDefault.defaultFontStyle); var fontFamily = valueOrDefault(labelOpts.fontFamily, globalDefault.defaultFontFamily); var labelFont = helpers.fontString(fontSize, fontStyle, fontFamily); // Reset hit boxes var hitboxes = me.legendHitBoxes = []; var minSize = me.minSize; var isHorizontal = me.isHorizontal(); if (isHorizontal) { minSize.width = me.maxWidth; // fill all the width minSize.height = display ? 10 : 0; } else { minSize.width = display ? 10 : 0; minSize.height = me.maxHeight; // fill all the height } // Increase sizes here if (display) { ctx.font = labelFont; if (isHorizontal) { // Labels // Width of each line of legend boxes. Labels wrap onto multiple lines when there are too many to fit on one var lineWidths = me.lineWidths = [0]; var totalHeight = me.legendItems.length ? fontSize + (labelOpts.padding) : 0; ctx.textAlign = 'left'; ctx.textBaseline = 'top'; helpers.each(me.legendItems, function(legendItem, i) { var boxWidth = getBoxWidth(labelOpts, fontSize); var width = boxWidth + (fontSize / 2) + ctx.measureText(legendItem.text).width; if (lineWidths[lineWidths.length - 1] + width + labelOpts.padding >= me.width) { totalHeight += fontSize + (labelOpts.padding); lineWidths[lineWidths.length] = me.left; } // Store the hitbox width and height here. Final position will be updated in `draw` hitboxes[i] = { left: 0, top: 0, width: width, height: fontSize }; lineWidths[lineWidths.length - 1] += width + labelOpts.padding; }); minSize.height += totalHeight; } else { var vPadding = labelOpts.padding; var columnWidths = me.columnWidths = []; var totalWidth = labelOpts.padding; var currentColWidth = 0; var currentColHeight = 0; var itemHeight = fontSize + vPadding; helpers.each(me.legendItems, function(legendItem, i) { var boxWidth = getBoxWidth(labelOpts, fontSize); var itemWidth = boxWidth + (fontSize / 2) + ctx.measureText(legendItem.text).width; // If too tall, go to new column if (currentColHeight + itemHeight > minSize.height) { totalWidth += currentColWidth + labelOpts.padding; columnWidths.push(currentColWidth); // previous column width currentColWidth = 0; currentColHeight = 0; } // Get max width currentColWidth = Math.max(currentColWidth, itemWidth); currentColHeight += itemHeight; // Store the hitbox width and height here. Final position will be updated in `draw` hitboxes[i] = { left: 0, top: 0, width: itemWidth, height: fontSize }; }); totalWidth += currentColWidth; columnWidths.push(currentColWidth); minSize.width += totalWidth; } } me.width = minSize.width; me.height = minSize.height; }, afterFit: noop, // Shared Methods isHorizontal: function() { return this.options.position === 'top' || this.options.position === 'bottom'; }, // Actually draw the legend on the canvas draw: function() { var me = this; var opts = me.options; var labelOpts = opts.labels; var globalDefault = defaults.global; var lineDefault = globalDefault.elements.line; var legendWidth = me.width; var lineWidths = me.lineWidths; if (opts.display) { var ctx = me.ctx; var valueOrDefault = helpers.valueOrDefault; var fontColor = valueOrDefault(labelOpts.fontColor, globalDefault.defaultFontColor); var fontSize = valueOrDefault(labelOpts.fontSize, globalDefault.defaultFontSize); var fontStyle = valueOrDefault(labelOpts.fontStyle, globalDefault.defaultFontStyle); var fontFamily = valueOrDefault(labelOpts.fontFamily, globalDefault.defaultFontFamily); var labelFont = helpers.fontString(fontSize, fontStyle, fontFamily); var cursor; // Canvas setup ctx.textAlign = 'left'; ctx.textBaseline = 'middle'; ctx.lineWidth = 0.5; ctx.strokeStyle = fontColor; // for strikethrough effect ctx.fillStyle = fontColor; // render in correct colour ctx.font = labelFont; var boxWidth = getBoxWidth(labelOpts, fontSize); var hitboxes = me.legendHitBoxes; // current position var drawLegendBox = function(x, y, legendItem) { if (isNaN(boxWidth) || boxWidth <= 0) { return; } // Set the ctx for the box ctx.save(); ctx.fillStyle = valueOrDefault(legendItem.fillStyle, globalDefault.defaultColor); ctx.lineCap = valueOrDefault(legendItem.lineCap, lineDefault.borderCapStyle); ctx.lineDashOffset = valueOrDefault(legendItem.lineDashOffset, lineDefault.borderDashOffset); ctx.lineJoin = valueOrDefault(legendItem.lineJoin, lineDefault.borderJoinStyle); ctx.lineWidth = valueOrDefault(legendItem.lineWidth, lineDefault.borderWidth); ctx.strokeStyle = valueOrDefault(legendItem.strokeStyle, globalDefault.defaultColor); var isLineWidthZero = (valueOrDefault(legendItem.lineWidth, lineDefault.borderWidth) === 0); if (ctx.setLineDash) { // IE 9 and 10 do not support line dash ctx.setLineDash(valueOrDefault(legendItem.lineDash, lineDefault.borderDash)); } if (opts.labels && opts.labels.usePointStyle) { // Recalculate x and y for drawPoint() because its expecting // x and y to be center of figure (instead of top left) var radius = fontSize * Math.SQRT2 / 2; var offSet = radius / Math.SQRT2; var centerX = x + offSet; var centerY = y + offSet; // Draw pointStyle as legend symbol helpers.canvas.drawPoint(ctx, legendItem.pointStyle, radius, centerX, centerY); } else { // Draw box as legend symbol if (!isLineWidthZero) { ctx.strokeRect(x, y, boxWidth, fontSize); } ctx.fillRect(x, y, boxWidth, fontSize); } ctx.restore(); }; var fillText = function(x, y, legendItem, textWidth) { var halfFontSize = fontSize / 2; var xLeft = boxWidth + halfFontSize + x; var yMiddle = y + halfFontSize; ctx.fillText(legendItem.text, xLeft, yMiddle); if (legendItem.hidden) { // Strikethrough the text if hidden ctx.beginPath(); ctx.lineWidth = 2; ctx.moveTo(xLeft, yMiddle); ctx.lineTo(xLeft + textWidth, yMiddle); ctx.stroke(); } }; // Horizontal var isHorizontal = me.isHorizontal(); if (isHorizontal) { cursor = { x: me.left + ((legendWidth - lineWidths[0]) / 2), y: me.top + labelOpts.padding, line: 0 }; } else { cursor = { x: me.left + labelOpts.padding, y: me.top + labelOpts.padding, line: 0 }; } var itemHeight = fontSize + labelOpts.padding; helpers.each(me.legendItems, function(legendItem, i) { var textWidth = ctx.measureText(legendItem.text).width; var width = boxWidth + (fontSize / 2) + textWidth; var x = cursor.x; var y = cursor.y; if (isHorizontal) { if (x + width >= legendWidth) { y = cursor.y += itemHeight; cursor.line++; x = cursor.x = me.left + ((legendWidth - lineWidths[cursor.line]) / 2); } } else if (y + itemHeight > me.bottom) { x = cursor.x = x + me.columnWidths[cursor.line] + labelOpts.padding; y = cursor.y = me.top + labelOpts.padding; cursor.line++; } drawLegendBox(x, y, legendItem); hitboxes[i].left = x; hitboxes[i].top = y; // Fill the actual label fillText(x, y, legendItem, textWidth); if (isHorizontal) { cursor.x += width + (labelOpts.padding); } else { cursor.y += itemHeight; } }); } }, /** * Handle an event * @private * @param {IEvent} event - The event to handle * @return {Boolean} true if a change occured */ handleEvent: function(e) { var me = this; var opts = me.options; var type = e.type === 'mouseup' ? 'click' : e.type; var changed = false; if (type === 'mousemove') { if (!opts.onHover) { return; } } else if (type === 'click') { if (!opts.onClick) { return; } } else { return; } // Chart event already has relative position in it var x = e.x; var y = e.y; if (x >= me.left && x <= me.right && y >= me.top && y <= me.bottom) { // See if we are touching one of the dataset boxes var lh = me.legendHitBoxes; for (var i = 0; i < lh.length; ++i) { var hitBox = lh[i]; if (x >= hitBox.left && x <= hitBox.left + hitBox.width && y >= hitBox.top && y <= hitBox.top + hitBox.height) { // Touching an element if (type === 'click') { // use e.native for backwards compatibility opts.onClick.call(me, e.native, me.legendItems[i]); changed = true; break; } else if (type === 'mousemove') { // use e.native for backwards compatibility opts.onHover.call(me, e.native, me.legendItems[i]); changed = true; break; } } } } return changed; } }); function createNewLegendAndAttach(chart, legendOpts) { var legend = new Legend({ ctx: chart.ctx, options: legendOpts, chart: chart }); layouts.configure(chart, legend, legendOpts); layouts.addBox(chart, legend); chart.legend = legend; } module.exports = { id: 'legend', /** * Backward compatibility: since 2.1.5, the legend is registered as a plugin, making * Chart.Legend obsolete. To avoid a breaking change, we export the Legend as part of * the plugin, which one will be re-exposed in the chart.js file. * https://github.com/chartjs/Chart.js/pull/2640 * @private */ _element: Legend, beforeInit: function(chart) { var legendOpts = chart.options.legend; if (legendOpts) { createNewLegendAndAttach(chart, legendOpts); } }, beforeUpdate: function(chart) { var legendOpts = chart.options.legend; var legend = chart.legend; if (legendOpts) { helpers.mergeIf(legendOpts, defaults.global.legend); if (legend) { layouts.configure(chart, legend, legendOpts); legend.options = legendOpts; } else { createNewLegendAndAttach(chart, legendOpts); } } else if (legend) { layouts.removeBox(chart, legend); delete chart.legend; } }, afterEvent: function(chart, e) { var legend = chart.legend; if (legend) { legend.handleEvent(e); } } }; /***/ }), /***/ "./node_modules/chart.js/src/plugins/plugin.title.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; var defaults = __webpack_require__("./node_modules/chart.js/src/core/core.defaults.js"); var Element = __webpack_require__("./node_modules/chart.js/src/core/core.element.js"); var helpers = __webpack_require__("./node_modules/chart.js/src/helpers/index.js"); var layouts = __webpack_require__("./node_modules/chart.js/src/core/core.layouts.js"); var noop = helpers.noop; defaults._set('global', { title: { display: false, fontStyle: 'bold', fullWidth: true, lineHeight: 1.2, padding: 10, position: 'top', text: '', weight: 2000 // by default greater than legend (1000) to be above } }); /** * IMPORTANT: this class is exposed publicly as Chart.Legend, backward compatibility required! */ var Title = Element.extend({ initialize: function(config) { var me = this; helpers.extend(me, config); // Contains hit boxes for each dataset (in dataset order) me.legendHitBoxes = []; }, // These methods are ordered by lifecycle. Utilities then follow. beforeUpdate: noop, update: function(maxWidth, maxHeight, margins) { var me = this; // Update Lifecycle - Probably don't want to ever extend or overwrite this function ;) me.beforeUpdate(); // Absorb the master measurements me.maxWidth = maxWidth; me.maxHeight = maxHeight; me.margins = margins; // Dimensions me.beforeSetDimensions(); me.setDimensions(); me.afterSetDimensions(); // Labels me.beforeBuildLabels(); me.buildLabels(); me.afterBuildLabels(); // Fit me.beforeFit(); me.fit(); me.afterFit(); // me.afterUpdate(); return me.minSize; }, afterUpdate: noop, // beforeSetDimensions: noop, setDimensions: function() { var me = this; // Set the unconstrained dimension before label rotation if (me.isHorizontal()) { // Reset position before calculating rotation me.width = me.maxWidth; me.left = 0; me.right = me.width; } else { me.height = me.maxHeight; // Reset position before calculating rotation me.top = 0; me.bottom = me.height; } // Reset padding me.paddingLeft = 0; me.paddingTop = 0; me.paddingRight = 0; me.paddingBottom = 0; // Reset minSize me.minSize = { width: 0, height: 0 }; }, afterSetDimensions: noop, // beforeBuildLabels: noop, buildLabels: noop, afterBuildLabels: noop, // beforeFit: noop, fit: function() { var me = this; var valueOrDefault = helpers.valueOrDefault; var opts = me.options; var display = opts.display; var fontSize = valueOrDefault(opts.fontSize, defaults.global.defaultFontSize); var minSize = me.minSize; var lineCount = helpers.isArray(opts.text) ? opts.text.length : 1; var lineHeight = helpers.options.toLineHeight(opts.lineHeight, fontSize); var textSize = display ? (lineCount * lineHeight) + (opts.padding * 2) : 0; if (me.isHorizontal()) { minSize.width = me.maxWidth; // fill all the width minSize.height = textSize; } else { minSize.width = textSize; minSize.height = me.maxHeight; // fill all the height } me.width = minSize.width; me.height = minSize.height; }, afterFit: noop, // Shared Methods isHorizontal: function() { var pos = this.options.position; return pos === 'top' || pos === 'bottom'; }, // Actually draw the title block on the canvas draw: function() { var me = this; var ctx = me.ctx; var valueOrDefault = helpers.valueOrDefault; var opts = me.options; var globalDefaults = defaults.global; if (opts.display) { var fontSize = valueOrDefault(opts.fontSize, globalDefaults.defaultFontSize); var fontStyle = valueOrDefault(opts.fontStyle, globalDefaults.defaultFontStyle); var fontFamily = valueOrDefault(opts.fontFamily, globalDefaults.defaultFontFamily); var titleFont = helpers.fontString(fontSize, fontStyle, fontFamily); var lineHeight = helpers.options.toLineHeight(opts.lineHeight, fontSize); var offset = lineHeight / 2 + opts.padding; var rotation = 0; var top = me.top; var left = me.left; var bottom = me.bottom; var right = me.right; var maxWidth, titleX, titleY; ctx.fillStyle = valueOrDefault(opts.fontColor, globalDefaults.defaultFontColor); // render in correct colour ctx.font = titleFont; // Horizontal if (me.isHorizontal()) { titleX = left + ((right - left) / 2); // midpoint of the width titleY = top + offset; maxWidth = right - left; } else { titleX = opts.position === 'left' ? left + offset : right - offset; titleY = top + ((bottom - top) / 2); maxWidth = bottom - top; rotation = Math.PI * (opts.position === 'left' ? -0.5 : 0.5); } ctx.save(); ctx.translate(titleX, titleY); ctx.rotate(rotation); ctx.textAlign = 'center'; ctx.textBaseline = 'middle'; var text = opts.text; if (helpers.isArray(text)) { var y = 0; for (var i = 0; i < text.length; ++i) { ctx.fillText(text[i], 0, y, maxWidth); y += lineHeight; } } else { ctx.fillText(text, 0, 0, maxWidth); } ctx.restore(); } } }); function createNewTitleBlockAndAttach(chart, titleOpts) { var title = new Title({ ctx: chart.ctx, options: titleOpts, chart: chart }); layouts.configure(chart, title, titleOpts); layouts.addBox(chart, title); chart.titleBlock = title; } module.exports = { id: 'title', /** * Backward compatibility: since 2.1.5, the title is registered as a plugin, making * Chart.Title obsolete. To avoid a breaking change, we export the Title as part of * the plugin, which one will be re-exposed in the chart.js file. * https://github.com/chartjs/Chart.js/pull/2640 * @private */ _element: Title, beforeInit: function(chart) { var titleOpts = chart.options.title; if (titleOpts) { createNewTitleBlockAndAttach(chart, titleOpts); } }, beforeUpdate: function(chart) { var titleOpts = chart.options.title; var titleBlock = chart.titleBlock; if (titleOpts) { helpers.mergeIf(titleOpts, defaults.global.title); if (titleBlock) { layouts.configure(chart, titleBlock, titleOpts); titleBlock.options = titleOpts; } else { createNewTitleBlockAndAttach(chart, titleOpts); } } else if (titleBlock) { layouts.removeBox(chart, titleBlock); delete chart.titleBlock; } } }; /***/ }), /***/ "./node_modules/chart.js/src/scales/scale.category.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; module.exports = function(Chart) { // Default config for a category scale var defaultConfig = { position: 'bottom' }; var DatasetScale = Chart.Scale.extend({ /** * Internal function to get the correct labels. If data.xLabels or data.yLabels are defined, use those * else fall back to data.labels * @private */ getLabels: function() { var data = this.chart.data; return this.options.labels || (this.isHorizontal() ? data.xLabels : data.yLabels) || data.labels; }, determineDataLimits: function() { var me = this; var labels = me.getLabels(); me.minIndex = 0; me.maxIndex = labels.length - 1; var findIndex; if (me.options.ticks.min !== undefined) { // user specified min value findIndex = labels.indexOf(me.options.ticks.min); me.minIndex = findIndex !== -1 ? findIndex : me.minIndex; } if (me.options.ticks.max !== undefined) { // user specified max value findIndex = labels.indexOf(me.options.ticks.max); me.maxIndex = findIndex !== -1 ? findIndex : me.maxIndex; } me.min = labels[me.minIndex]; me.max = labels[me.maxIndex]; }, buildTicks: function() { var me = this; var labels = me.getLabels(); // If we are viewing some subset of labels, slice the original array me.ticks = (me.minIndex === 0 && me.maxIndex === labels.length - 1) ? labels : labels.slice(me.minIndex, me.maxIndex + 1); }, getLabelForIndex: function(index, datasetIndex) { var me = this; var data = me.chart.data; var isHorizontal = me.isHorizontal(); if (data.yLabels && !isHorizontal) { return me.getRightValue(data.datasets[datasetIndex].data[index]); } return me.ticks[index - me.minIndex]; }, // Used to get data value locations. Value can either be an index or a numerical value getPixelForValue: function(value, index) { var me = this; var offset = me.options.offset; // 1 is added because we need the length but we have the indexes var offsetAmt = Math.max((me.maxIndex + 1 - me.minIndex - (offset ? 0 : 1)), 1); // If value is a data object, then index is the index in the data array, // not the index of the scale. We need to change that. var valueCategory; if (value !== undefined && value !== null) { valueCategory = me.isHorizontal() ? value.x : value.y; } if (valueCategory !== undefined || (value !== undefined && isNaN(index))) { var labels = me.getLabels(); value = valueCategory || value; var idx = labels.indexOf(value); index = idx !== -1 ? idx : index; } if (me.isHorizontal()) { var valueWidth = me.width / offsetAmt; var widthOffset = (valueWidth * (index - me.minIndex)); if (offset) { widthOffset += (valueWidth / 2); } return me.left + Math.round(widthOffset); } var valueHeight = me.height / offsetAmt; var heightOffset = (valueHeight * (index - me.minIndex)); if (offset) { heightOffset += (valueHeight / 2); } return me.top + Math.round(heightOffset); }, getPixelForTick: function(index) { return this.getPixelForValue(this.ticks[index], index + this.minIndex, null); }, getValueForPixel: function(pixel) { var me = this; var offset = me.options.offset; var value; var offsetAmt = Math.max((me._ticks.length - (offset ? 0 : 1)), 1); var horz = me.isHorizontal(); var valueDimension = (horz ? me.width : me.height) / offsetAmt; pixel -= horz ? me.left : me.top; if (offset) { pixel -= (valueDimension / 2); } if (pixel <= 0) { value = 0; } else { value = Math.round(pixel / valueDimension); } return value + me.minIndex; }, getBasePixel: function() { return this.bottom; } }); Chart.scaleService.registerScaleType('category', DatasetScale, defaultConfig); }; /***/ }), /***/ "./node_modules/chart.js/src/scales/scale.linear.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; var defaults = __webpack_require__("./node_modules/chart.js/src/core/core.defaults.js"); var helpers = __webpack_require__("./node_modules/chart.js/src/helpers/index.js"); var Ticks = __webpack_require__("./node_modules/chart.js/src/core/core.ticks.js"); module.exports = function(Chart) { var defaultConfig = { position: 'left', ticks: { callback: Ticks.formatters.linear } }; var LinearScale = Chart.LinearScaleBase.extend({ determineDataLimits: function() { var me = this; var opts = me.options; var chart = me.chart; var data = chart.data; var datasets = data.datasets; var isHorizontal = me.isHorizontal(); var DEFAULT_MIN = 0; var DEFAULT_MAX = 1; function IDMatches(meta) { return isHorizontal ? meta.xAxisID === me.id : meta.yAxisID === me.id; } // First Calculate the range me.min = null; me.max = null; var hasStacks = opts.stacked; if (hasStacks === undefined) { helpers.each(datasets, function(dataset, datasetIndex) { if (hasStacks) { return; } var meta = chart.getDatasetMeta(datasetIndex); if (chart.isDatasetVisible(datasetIndex) && IDMatches(meta) && meta.stack !== undefined) { hasStacks = true; } }); } if (opts.stacked || hasStacks) { var valuesPerStack = {}; helpers.each(datasets, function(dataset, datasetIndex) { var meta = chart.getDatasetMeta(datasetIndex); var key = [ meta.type, // we have a separate stack for stack=undefined datasets when the opts.stacked is undefined ((opts.stacked === undefined && meta.stack === undefined) ? datasetIndex : ''), meta.stack ].join('.'); if (valuesPerStack[key] === undefined) { valuesPerStack[key] = { positiveValues: [], negativeValues: [] }; } // Store these per type var positiveValues = valuesPerStack[key].positiveValues; var negativeValues = valuesPerStack[key].negativeValues; if (chart.isDatasetVisible(datasetIndex) && IDMatches(meta)) { helpers.each(dataset.data, function(rawValue, index) { var value = +me.getRightValue(rawValue); if (isNaN(value) || meta.data[index].hidden) { return; } positiveValues[index] = positiveValues[index] || 0; negativeValues[index] = negativeValues[index] || 0; if (opts.relativePoints) { positiveValues[index] = 100; } else if (value < 0) { negativeValues[index] += value; } else { positiveValues[index] += value; } }); } }); helpers.each(valuesPerStack, function(valuesForType) { var values = valuesForType.positiveValues.concat(valuesForType.negativeValues); var minVal = helpers.min(values); var maxVal = helpers.max(values); me.min = me.min === null ? minVal : Math.min(me.min, minVal); me.max = me.max === null ? maxVal : Math.max(me.max, maxVal); }); } else { helpers.each(datasets, function(dataset, datasetIndex) { var meta = chart.getDatasetMeta(datasetIndex); if (chart.isDatasetVisible(datasetIndex) && IDMatches(meta)) { helpers.each(dataset.data, function(rawValue, index) { var value = +me.getRightValue(rawValue); if (isNaN(value) || meta.data[index].hidden) { return; } if (me.min === null) { me.min = value; } else if (value < me.min) { me.min = value; } if (me.max === null) { me.max = value; } else if (value > me.max) { me.max = value; } }); } }); } me.min = isFinite(me.min) && !isNaN(me.min) ? me.min : DEFAULT_MIN; me.max = isFinite(me.max) && !isNaN(me.max) ? me.max : DEFAULT_MAX; // Common base implementation to handle ticks.min, ticks.max, ticks.beginAtZero this.handleTickRangeOptions(); }, getTickLimit: function() { var maxTicks; var me = this; var tickOpts = me.options.ticks; if (me.isHorizontal()) { maxTicks = Math.min(tickOpts.maxTicksLimit ? tickOpts.maxTicksLimit : 11, Math.ceil(me.width / 50)); } else { // The factor of 2 used to scale the font size has been experimentally determined. var tickFontSize = helpers.valueOrDefault(tickOpts.fontSize, defaults.global.defaultFontSize); maxTicks = Math.min(tickOpts.maxTicksLimit ? tickOpts.maxTicksLimit : 11, Math.ceil(me.height / (2 * tickFontSize))); } return maxTicks; }, // Called after the ticks are built. We need handleDirectionalChanges: function() { if (!this.isHorizontal()) { // We are in a vertical orientation. The top value is the highest. So reverse the array this.ticks.reverse(); } }, getLabelForIndex: function(index, datasetIndex) { return +this.getRightValue(this.chart.data.datasets[datasetIndex].data[index]); }, // Utils getPixelForValue: function(value) { // This must be called after fit has been run so that // this.left, this.top, this.right, and this.bottom have been defined var me = this; var start = me.start; var rightValue = +me.getRightValue(value); var pixel; var range = me.end - start; if (me.isHorizontal()) { pixel = me.left + (me.width / range * (rightValue - start)); } else { pixel = me.bottom - (me.height / range * (rightValue - start)); } return pixel; }, getValueForPixel: function(pixel) { var me = this; var isHorizontal = me.isHorizontal(); var innerDimension = isHorizontal ? me.width : me.height; var offset = (isHorizontal ? pixel - me.left : me.bottom - pixel) / innerDimension; return me.start + ((me.end - me.start) * offset); }, getPixelForTick: function(index) { return this.getPixelForValue(this.ticksAsNumbers[index]); } }); Chart.scaleService.registerScaleType('linear', LinearScale, defaultConfig); }; /***/ }), /***/ "./node_modules/chart.js/src/scales/scale.linearbase.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; var helpers = __webpack_require__("./node_modules/chart.js/src/helpers/index.js"); /** * Generate a set of linear ticks * @param generationOptions the options used to generate the ticks * @param dataRange the range of the data * @returns {Array<Number>} array of tick values */ function generateTicks(generationOptions, dataRange) { var ticks = []; // To get a "nice" value for the tick spacing, we will use the appropriately named // "nice number" algorithm. See http://stackoverflow.com/questions/8506881/nice-label-algorithm-for-charts-with-minimum-ticks // for details. var spacing; if (generationOptions.stepSize && generationOptions.stepSize > 0) { spacing = generationOptions.stepSize; } else { var niceRange = helpers.niceNum(dataRange.max - dataRange.min, false); spacing = helpers.niceNum(niceRange / (generationOptions.maxTicks - 1), true); } var niceMin = Math.floor(dataRange.min / spacing) * spacing; var niceMax = Math.ceil(dataRange.max / spacing) * spacing; // If min, max and stepSize is set and they make an evenly spaced scale use it. if (generationOptions.min && generationOptions.max && generationOptions.stepSize) { // If very close to our whole number, use it. if (helpers.almostWhole((generationOptions.max - generationOptions.min) / generationOptions.stepSize, spacing / 1000)) { niceMin = generationOptions.min; niceMax = generationOptions.max; } } var numSpaces = (niceMax - niceMin) / spacing; // If very close to our rounded value, use it. if (helpers.almostEquals(numSpaces, Math.round(numSpaces), spacing / 1000)) { numSpaces = Math.round(numSpaces); } else { numSpaces = Math.ceil(numSpaces); } var precision = 1; if (spacing < 1) { precision = Math.pow(10, spacing.toString().length - 2); niceMin = Math.round(niceMin * precision) / precision; niceMax = Math.round(niceMax * precision) / precision; } ticks.push(generationOptions.min !== undefined ? generationOptions.min : niceMin); for (var j = 1; j < numSpaces; ++j) { ticks.push(Math.round((niceMin + j * spacing) * precision) / precision); } ticks.push(generationOptions.max !== undefined ? generationOptions.max : niceMax); return ticks; } module.exports = function(Chart) { var noop = helpers.noop; Chart.LinearScaleBase = Chart.Scale.extend({ getRightValue: function(value) { if (typeof value === 'string') { return +value; } return Chart.Scale.prototype.getRightValue.call(this, value); }, handleTickRangeOptions: function() { var me = this; var opts = me.options; var tickOpts = opts.ticks; // If we are forcing it to begin at 0, but 0 will already be rendered on the chart, // do nothing since that would make the chart weird. If the user really wants a weird chart // axis, they can manually override it if (tickOpts.beginAtZero) { var minSign = helpers.sign(me.min); var maxSign = helpers.sign(me.max); if (minSign < 0 && maxSign < 0) { // move the top up to 0 me.max = 0; } else if (minSign > 0 && maxSign > 0) { // move the bottom down to 0 me.min = 0; } } var setMin = tickOpts.min !== undefined || tickOpts.suggestedMin !== undefined; var setMax = tickOpts.max !== undefined || tickOpts.suggestedMax !== undefined; if (tickOpts.min !== undefined) { me.min = tickOpts.min; } else if (tickOpts.suggestedMin !== undefined) { if (me.min === null) { me.min = tickOpts.suggestedMin; } else { me.min = Math.min(me.min, tickOpts.suggestedMin); } } if (tickOpts.max !== undefined) { me.max = tickOpts.max; } else if (tickOpts.suggestedMax !== undefined) { if (me.max === null) { me.max = tickOpts.suggestedMax; } else { me.max = Math.max(me.max, tickOpts.suggestedMax); } } if (setMin !== setMax) { // We set the min or the max but not both. // So ensure that our range is good // Inverted or 0 length range can happen when // ticks.min is set, and no datasets are visible if (me.min >= me.max) { if (setMin) { me.max = me.min + 1; } else { me.min = me.max - 1; } } } if (me.min === me.max) { me.max++; if (!tickOpts.beginAtZero) { me.min--; } } }, getTickLimit: noop, handleDirectionalChanges: noop, buildTicks: function() { var me = this; var opts = me.options; var tickOpts = opts.ticks; // Figure out what the max number of ticks we can support it is based on the size of // the axis area. For now, we say that the minimum tick spacing in pixels must be 50 // We also limit the maximum number of ticks to 11 which gives a nice 10 squares on // the graph. Make sure we always have at least 2 ticks var maxTicks = me.getTickLimit(); maxTicks = Math.max(2, maxTicks); var numericGeneratorOptions = { maxTicks: maxTicks, min: tickOpts.min, max: tickOpts.max, stepSize: helpers.valueOrDefault(tickOpts.fixedStepSize, tickOpts.stepSize) }; var ticks = me.ticks = generateTicks(numericGeneratorOptions, me); me.handleDirectionalChanges(); // At this point, we need to update our max and min given the tick values since we have expanded the // range of the scale me.max = helpers.max(ticks); me.min = helpers.min(ticks); if (tickOpts.reverse) { ticks.reverse(); me.start = me.max; me.end = me.min; } else { me.start = me.min; me.end = me.max; } }, convertTicksToLabels: function() { var me = this; me.ticksAsNumbers = me.ticks.slice(); me.zeroLineIndex = me.ticks.indexOf(0); Chart.Scale.prototype.convertTicksToLabels.call(me); } }); }; /***/ }), /***/ "./node_modules/chart.js/src/scales/scale.logarithmic.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; var helpers = __webpack_require__("./node_modules/chart.js/src/helpers/index.js"); var Ticks = __webpack_require__("./node_modules/chart.js/src/core/core.ticks.js"); /** * Generate a set of logarithmic ticks * @param generationOptions the options used to generate the ticks * @param dataRange the range of the data * @returns {Array<Number>} array of tick values */ function generateTicks(generationOptions, dataRange) { var ticks = []; var valueOrDefault = helpers.valueOrDefault; // Figure out what the max number of ticks we can support it is based on the size of // the axis area. For now, we say that the minimum tick spacing in pixels must be 50 // We also limit the maximum number of ticks to 11 which gives a nice 10 squares on // the graph var tickVal = valueOrDefault(generationOptions.min, Math.pow(10, Math.floor(helpers.log10(dataRange.min)))); var endExp = Math.floor(helpers.log10(dataRange.max)); var endSignificand = Math.ceil(dataRange.max / Math.pow(10, endExp)); var exp, significand; if (tickVal === 0) { exp = Math.floor(helpers.log10(dataRange.minNotZero)); significand = Math.floor(dataRange.minNotZero / Math.pow(10, exp)); ticks.push(tickVal); tickVal = significand * Math.pow(10, exp); } else { exp = Math.floor(helpers.log10(tickVal)); significand = Math.floor(tickVal / Math.pow(10, exp)); } var precision = exp < 0 ? Math.pow(10, Math.abs(exp)) : 1; do { ticks.push(tickVal); ++significand; if (significand === 10) { significand = 1; ++exp; precision = exp >= 0 ? 1 : precision; } tickVal = Math.round(significand * Math.pow(10, exp) * precision) / precision; } while (exp < endExp || (exp === endExp && significand < endSignificand)); var lastTick = valueOrDefault(generationOptions.max, tickVal); ticks.push(lastTick); return ticks; } module.exports = function(Chart) { var defaultConfig = { position: 'left', // label settings ticks: { callback: Ticks.formatters.logarithmic } }; var LogarithmicScale = Chart.Scale.extend({ determineDataLimits: function() { var me = this; var opts = me.options; var chart = me.chart; var data = chart.data; var datasets = data.datasets; var isHorizontal = me.isHorizontal(); function IDMatches(meta) { return isHorizontal ? meta.xAxisID === me.id : meta.yAxisID === me.id; } // Calculate Range me.min = null; me.max = null; me.minNotZero = null; var hasStacks = opts.stacked; if (hasStacks === undefined) { helpers.each(datasets, function(dataset, datasetIndex) { if (hasStacks) { return; } var meta = chart.getDatasetMeta(datasetIndex); if (chart.isDatasetVisible(datasetIndex) && IDMatches(meta) && meta.stack !== undefined) { hasStacks = true; } }); } if (opts.stacked || hasStacks) { var valuesPerStack = {}; helpers.each(datasets, function(dataset, datasetIndex) { var meta = chart.getDatasetMeta(datasetIndex); var key = [ meta.type, // we have a separate stack for stack=undefined datasets when the opts.stacked is undefined ((opts.stacked === undefined && meta.stack === undefined) ? datasetIndex : ''), meta.stack ].join('.'); if (chart.isDatasetVisible(datasetIndex) && IDMatches(meta)) { if (valuesPerStack[key] === undefined) { valuesPerStack[key] = []; } helpers.each(dataset.data, function(rawValue, index) { var values = valuesPerStack[key]; var value = +me.getRightValue(rawValue); // invalid, hidden and negative values are ignored if (isNaN(value) || meta.data[index].hidden || value < 0) { return; } values[index] = values[index] || 0; values[index] += value; }); } }); helpers.each(valuesPerStack, function(valuesForType) { if (valuesForType.length > 0) { var minVal = helpers.min(valuesForType); var maxVal = helpers.max(valuesForType); me.min = me.min === null ? minVal : Math.min(me.min, minVal); me.max = me.max === null ? maxVal : Math.max(me.max, maxVal); } }); } else { helpers.each(datasets, function(dataset, datasetIndex) { var meta = chart.getDatasetMeta(datasetIndex); if (chart.isDatasetVisible(datasetIndex) && IDMatches(meta)) { helpers.each(dataset.data, function(rawValue, index) { var value = +me.getRightValue(rawValue); // invalid, hidden and negative values are ignored if (isNaN(value) || meta.data[index].hidden || value < 0) { return; } if (me.min === null) { me.min = value; } else if (value < me.min) { me.min = value; } if (me.max === null) { me.max = value; } else if (value > me.max) { me.max = value; } if (value !== 0 && (me.minNotZero === null || value < me.minNotZero)) { me.minNotZero = value; } }); } }); } // Common base implementation to handle ticks.min, ticks.max this.handleTickRangeOptions(); }, handleTickRangeOptions: function() { var me = this; var opts = me.options; var tickOpts = opts.ticks; var valueOrDefault = helpers.valueOrDefault; var DEFAULT_MIN = 1; var DEFAULT_MAX = 10; me.min = valueOrDefault(tickOpts.min, me.min); me.max = valueOrDefault(tickOpts.max, me.max); if (me.min === me.max) { if (me.min !== 0 && me.min !== null) { me.min = Math.pow(10, Math.floor(helpers.log10(me.min)) - 1); me.max = Math.pow(10, Math.floor(helpers.log10(me.max)) + 1); } else { me.min = DEFAULT_MIN; me.max = DEFAULT_MAX; } } if (me.min === null) { me.min = Math.pow(10, Math.floor(helpers.log10(me.max)) - 1); } if (me.max === null) { me.max = me.min !== 0 ? Math.pow(10, Math.floor(helpers.log10(me.min)) + 1) : DEFAULT_MAX; } if (me.minNotZero === null) { if (me.min > 0) { me.minNotZero = me.min; } else if (me.max < 1) { me.minNotZero = Math.pow(10, Math.floor(helpers.log10(me.max))); } else { me.minNotZero = DEFAULT_MIN; } } }, buildTicks: function() { var me = this; var opts = me.options; var tickOpts = opts.ticks; var reverse = !me.isHorizontal(); var generationOptions = { min: tickOpts.min, max: tickOpts.max }; var ticks = me.ticks = generateTicks(generationOptions, me); // At this point, we need to update our max and min given the tick values since we have expanded the // range of the scale me.max = helpers.max(ticks); me.min = helpers.min(ticks); if (tickOpts.reverse) { reverse = !reverse; me.start = me.max; me.end = me.min; } else { me.start = me.min; me.end = me.max; } if (reverse) { ticks.reverse(); } }, convertTicksToLabels: function() { this.tickValues = this.ticks.slice(); Chart.Scale.prototype.convertTicksToLabels.call(this); }, // Get the correct tooltip label getLabelForIndex: function(index, datasetIndex) { return +this.getRightValue(this.chart.data.datasets[datasetIndex].data[index]); }, getPixelForTick: function(index) { return this.getPixelForValue(this.tickValues[index]); }, /** * Returns the value of the first tick. * @param {Number} value - The minimum not zero value. * @return {Number} The first tick value. * @private */ _getFirstTickValue: function(value) { var exp = Math.floor(helpers.log10(value)); var significand = Math.floor(value / Math.pow(10, exp)); return significand * Math.pow(10, exp); }, getPixelForValue: function(value) { var me = this; var reverse = me.options.ticks.reverse; var log10 = helpers.log10; var firstTickValue = me._getFirstTickValue(me.minNotZero); var offset = 0; var innerDimension, pixel, start, end, sign; value = +me.getRightValue(value); if (reverse) { start = me.end; end = me.start; sign = -1; } else { start = me.start; end = me.end; sign = 1; } if (me.isHorizontal()) { innerDimension = me.width; pixel = reverse ? me.right : me.left; } else { innerDimension = me.height; sign *= -1; // invert, since the upper-left corner of the canvas is at pixel (0, 0) pixel = reverse ? me.top : me.bottom; } if (value !== start) { if (start === 0) { // include zero tick offset = helpers.getValueOrDefault( me.options.ticks.fontSize, Chart.defaults.global.defaultFontSize ); innerDimension -= offset; start = firstTickValue; } if (value !== 0) { offset += innerDimension / (log10(end) - log10(start)) * (log10(value) - log10(start)); } pixel += sign * offset; } return pixel; }, getValueForPixel: function(pixel) { var me = this; var reverse = me.options.ticks.reverse; var log10 = helpers.log10; var firstTickValue = me._getFirstTickValue(me.minNotZero); var innerDimension, start, end, value; if (reverse) { start = me.end; end = me.start; } else { start = me.start; end = me.end; } if (me.isHorizontal()) { innerDimension = me.width; value = reverse ? me.right - pixel : pixel - me.left; } else { innerDimension = me.height; value = reverse ? pixel - me.top : me.bottom - pixel; } if (value !== start) { if (start === 0) { // include zero tick var offset = helpers.getValueOrDefault( me.options.ticks.fontSize, Chart.defaults.global.defaultFontSize ); value -= offset; innerDimension -= offset; start = firstTickValue; } value *= log10(end) - log10(start); value /= innerDimension; value = Math.pow(10, log10(start) + value); } return value; } }); Chart.scaleService.registerScaleType('logarithmic', LogarithmicScale, defaultConfig); }; /***/ }), /***/ "./node_modules/chart.js/src/scales/scale.radialLinear.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; var defaults = __webpack_require__("./node_modules/chart.js/src/core/core.defaults.js"); var helpers = __webpack_require__("./node_modules/chart.js/src/helpers/index.js"); var Ticks = __webpack_require__("./node_modules/chart.js/src/core/core.ticks.js"); module.exports = function(Chart) { var globalDefaults = defaults.global; var defaultConfig = { display: true, // Boolean - Whether to animate scaling the chart from the centre animate: true, position: 'chartArea', angleLines: { display: true, color: 'rgba(0, 0, 0, 0.1)', lineWidth: 1 }, gridLines: { circular: false }, // label settings ticks: { // Boolean - Show a backdrop to the scale label showLabelBackdrop: true, // String - The colour of the label backdrop backdropColor: 'rgba(255,255,255,0.75)', // Number - The backdrop padding above & below the label in pixels backdropPaddingY: 2, // Number - The backdrop padding to the side of the label in pixels backdropPaddingX: 2, callback: Ticks.formatters.linear }, pointLabels: { // Boolean - if true, show point labels display: true, // Number - Point label font size in pixels fontSize: 10, // Function - Used to convert point labels callback: function(label) { return label; } } }; function getValueCount(scale) { var opts = scale.options; return opts.angleLines.display || opts.pointLabels.display ? scale.chart.data.labels.length : 0; } function getPointLabelFontOptions(scale) { var pointLabelOptions = scale.options.pointLabels; var fontSize = helpers.valueOrDefault(pointLabelOptions.fontSize, globalDefaults.defaultFontSize); var fontStyle = helpers.valueOrDefault(pointLabelOptions.fontStyle, globalDefaults.defaultFontStyle); var fontFamily = helpers.valueOrDefault(pointLabelOptions.fontFamily, globalDefaults.defaultFontFamily); var font = helpers.fontString(fontSize, fontStyle, fontFamily); return { size: fontSize, style: fontStyle, family: fontFamily, font: font }; } function measureLabelSize(ctx, fontSize, label) { if (helpers.isArray(label)) { return { w: helpers.longestText(ctx, ctx.font, label), h: (label.length * fontSize) + ((label.length - 1) * 1.5 * fontSize) }; } return { w: ctx.measureText(label).width, h: fontSize }; } function determineLimits(angle, pos, size, min, max) { if (angle === min || angle === max) { return { start: pos - (size / 2), end: pos + (size / 2) }; } else if (angle < min || angle > max) { return { start: pos - size - 5, end: pos }; } return { start: pos, end: pos + size + 5 }; } /** * Helper function to fit a radial linear scale with point labels */ function fitWithPointLabels(scale) { /* * Right, this is really confusing and there is a lot of maths going on here * The gist of the problem is here: https://gist.github.com/nnnick/696cc9c55f4b0beb8fe9 * * Reaction: https://dl.dropboxusercontent.com/u/34601363/toomuchscience.gif * * Solution: * * We assume the radius of the polygon is half the size of the canvas at first * at each index we check if the text overlaps. * * Where it does, we store that angle and that index. * * After finding the largest index and angle we calculate how much we need to remove * from the shape radius to move the point inwards by that x. * * We average the left and right distances to get the maximum shape radius that can fit in the box * along with labels. * * Once we have that, we can find the centre point for the chart, by taking the x text protrusion * on each side, removing that from the size, halving it and adding the left x protrusion width. * * This will mean we have a shape fitted to the canvas, as large as it can be with the labels * and position it in the most space efficient manner * * https://dl.dropboxusercontent.com/u/34601363/yeahscience.gif */ var plFont = getPointLabelFontOptions(scale); // Get maximum radius of the polygon. Either half the height (minus the text width) or half the width. // Use this to calculate the offset + change. - Make sure L/R protrusion is at least 0 to stop issues with centre points var largestPossibleRadius = Math.min(scale.height / 2, scale.width / 2); var furthestLimits = { r: scale.width, l: 0, t: scale.height, b: 0 }; var furthestAngles = {}; var i, textSize, pointPosition; scale.ctx.font = plFont.font; scale._pointLabelSizes = []; var valueCount = getValueCount(scale); for (i = 0; i < valueCount; i++) { pointPosition = scale.getPointPosition(i, largestPossibleRadius); textSize = measureLabelSize(scale.ctx, plFont.size, scale.pointLabels[i] || ''); scale._pointLabelSizes[i] = textSize; // Add quarter circle to make degree 0 mean top of circle var angleRadians = scale.getIndexAngle(i); var angle = helpers.toDegrees(angleRadians) % 360; var hLimits = determineLimits(angle, pointPosition.x, textSize.w, 0, 180); var vLimits = determineLimits(angle, pointPosition.y, textSize.h, 90, 270); if (hLimits.start < furthestLimits.l) { furthestLimits.l = hLimits.start; furthestAngles.l = angleRadians; } if (hLimits.end > furthestLimits.r) { furthestLimits.r = hLimits.end; furthestAngles.r = angleRadians; } if (vLimits.start < furthestLimits.t) { furthestLimits.t = vLimits.start; furthestAngles.t = angleRadians; } if (vLimits.end > furthestLimits.b) { furthestLimits.b = vLimits.end; furthestAngles.b = angleRadians; } } scale.setReductions(largestPossibleRadius, furthestLimits, furthestAngles); } /** * Helper function to fit a radial linear scale with no point labels */ function fit(scale) { var largestPossibleRadius = Math.min(scale.height / 2, scale.width / 2); scale.drawingArea = Math.round(largestPossibleRadius); scale.setCenterPoint(0, 0, 0, 0); } function getTextAlignForAngle(angle) { if (angle === 0 || angle === 180) { return 'center'; } else if (angle < 180) { return 'left'; } return 'right'; } function fillText(ctx, text, position, fontSize) { if (helpers.isArray(text)) { var y = position.y; var spacing = 1.5 * fontSize; for (var i = 0; i < text.length; ++i) { ctx.fillText(text[i], position.x, y); y += spacing; } } else { ctx.fillText(text, position.x, position.y); } } function adjustPointPositionForLabelHeight(angle, textSize, position) { if (angle === 90 || angle === 270) { position.y -= (textSize.h / 2); } else if (angle > 270 || angle < 90) { position.y -= textSize.h; } } function drawPointLabels(scale) { var ctx = scale.ctx; var opts = scale.options; var angleLineOpts = opts.angleLines; var pointLabelOpts = opts.pointLabels; ctx.lineWidth = angleLineOpts.lineWidth; ctx.strokeStyle = angleLineOpts.color; var outerDistance = scale.getDistanceFromCenterForValue(opts.ticks.reverse ? scale.min : scale.max); // Point Label Font var plFont = getPointLabelFontOptions(scale); ctx.textBaseline = 'top'; for (var i = getValueCount(scale) - 1; i >= 0; i--) { if (angleLineOpts.display) { var outerPosition = scale.getPointPosition(i, outerDistance); ctx.beginPath(); ctx.moveTo(scale.xCenter, scale.yCenter); ctx.lineTo(outerPosition.x, outerPosition.y); ctx.stroke(); ctx.closePath(); } if (pointLabelOpts.display) { // Extra 3px out for some label spacing var pointLabelPosition = scale.getPointPosition(i, outerDistance + 5); // Keep this in loop since we may support array properties here var pointLabelFontColor = helpers.valueAtIndexOrDefault(pointLabelOpts.fontColor, i, globalDefaults.defaultFontColor); ctx.font = plFont.font; ctx.fillStyle = pointLabelFontColor; var angleRadians = scale.getIndexAngle(i); var angle = helpers.toDegrees(angleRadians); ctx.textAlign = getTextAlignForAngle(angle); adjustPointPositionForLabelHeight(angle, scale._pointLabelSizes[i], pointLabelPosition); fillText(ctx, scale.pointLabels[i] || '', pointLabelPosition, plFont.size); } } } function drawRadiusLine(scale, gridLineOpts, radius, index) { var ctx = scale.ctx; ctx.strokeStyle = helpers.valueAtIndexOrDefault(gridLineOpts.color, index - 1); ctx.lineWidth = helpers.valueAtIndexOrDefault(gridLineOpts.lineWidth, index - 1); if (scale.options.gridLines.circular) { // Draw circular arcs between the points ctx.beginPath(); ctx.arc(scale.xCenter, scale.yCenter, radius, 0, Math.PI * 2); ctx.closePath(); ctx.stroke(); } else { // Draw straight lines connecting each index var valueCount = getValueCount(scale); if (valueCount === 0) { return; } ctx.beginPath(); var pointPosition = scale.getPointPosition(0, radius); ctx.moveTo(pointPosition.x, pointPosition.y); for (var i = 1; i < valueCount; i++) { pointPosition = scale.getPointPosition(i, radius); ctx.lineTo(pointPosition.x, pointPosition.y); } ctx.closePath(); ctx.stroke(); } } function numberOrZero(param) { return helpers.isNumber(param) ? param : 0; } var LinearRadialScale = Chart.LinearScaleBase.extend({ setDimensions: function() { var me = this; var opts = me.options; var tickOpts = opts.ticks; // Set the unconstrained dimension before label rotation me.width = me.maxWidth; me.height = me.maxHeight; me.xCenter = Math.round(me.width / 2); me.yCenter = Math.round(me.height / 2); var minSize = helpers.min([me.height, me.width]); var tickFontSize = helpers.valueOrDefault(tickOpts.fontSize, globalDefaults.defaultFontSize); me.drawingArea = opts.display ? (minSize / 2) - (tickFontSize / 2 + tickOpts.backdropPaddingY) : (minSize / 2); }, determineDataLimits: function() { var me = this; var chart = me.chart; var min = Number.POSITIVE_INFINITY; var max = Number.NEGATIVE_INFINITY; helpers.each(chart.data.datasets, function(dataset, datasetIndex) { if (chart.isDatasetVisible(datasetIndex)) { var meta = chart.getDatasetMeta(datasetIndex); helpers.each(dataset.data, function(rawValue, index) { var value = +me.getRightValue(rawValue); if (isNaN(value) || meta.data[index].hidden) { return; } min = Math.min(value, min); max = Math.max(value, max); }); } }); me.min = (min === Number.POSITIVE_INFINITY ? 0 : min); me.max = (max === Number.NEGATIVE_INFINITY ? 0 : max); // Common base implementation to handle ticks.min, ticks.max, ticks.beginAtZero me.handleTickRangeOptions(); }, getTickLimit: function() { var tickOpts = this.options.ticks; var tickFontSize = helpers.valueOrDefault(tickOpts.fontSize, globalDefaults.defaultFontSize); return Math.min(tickOpts.maxTicksLimit ? tickOpts.maxTicksLimit : 11, Math.ceil(this.drawingArea / (1.5 * tickFontSize))); }, convertTicksToLabels: function() { var me = this; Chart.LinearScaleBase.prototype.convertTicksToLabels.call(me); // Point labels me.pointLabels = me.chart.data.labels.map(me.options.pointLabels.callback, me); }, getLabelForIndex: function(index, datasetIndex) { return +this.getRightValue(this.chart.data.datasets[datasetIndex].data[index]); }, fit: function() { if (this.options.pointLabels.display) { fitWithPointLabels(this); } else { fit(this); } }, /** * Set radius reductions and determine new radius and center point * @private */ setReductions: function(largestPossibleRadius, furthestLimits, furthestAngles) { var me = this; var radiusReductionLeft = furthestLimits.l / Math.sin(furthestAngles.l); var radiusReductionRight = Math.max(furthestLimits.r - me.width, 0) / Math.sin(furthestAngles.r); var radiusReductionTop = -furthestLimits.t / Math.cos(furthestAngles.t); var radiusReductionBottom = -Math.max(furthestLimits.b - me.height, 0) / Math.cos(furthestAngles.b); radiusReductionLeft = numberOrZero(radiusReductionLeft); radiusReductionRight = numberOrZero(radiusReductionRight); radiusReductionTop = numberOrZero(radiusReductionTop); radiusReductionBottom = numberOrZero(radiusReductionBottom); me.drawingArea = Math.min( Math.round(largestPossibleRadius - (radiusReductionLeft + radiusReductionRight) / 2), Math.round(largestPossibleRadius - (radiusReductionTop + radiusReductionBottom) / 2)); me.setCenterPoint(radiusReductionLeft, radiusReductionRight, radiusReductionTop, radiusReductionBottom); }, setCenterPoint: function(leftMovement, rightMovement, topMovement, bottomMovement) { var me = this; var maxRight = me.width - rightMovement - me.drawingArea; var maxLeft = leftMovement + me.drawingArea; var maxTop = topMovement + me.drawingArea; var maxBottom = me.height - bottomMovement - me.drawingArea; me.xCenter = Math.round(((maxLeft + maxRight) / 2) + me.left); me.yCenter = Math.round(((maxTop + maxBottom) / 2) + me.top); }, getIndexAngle: function(index) { var angleMultiplier = (Math.PI * 2) / getValueCount(this); var startAngle = this.chart.options && this.chart.options.startAngle ? this.chart.options.startAngle : 0; var startAngleRadians = startAngle * Math.PI * 2 / 360; // Start from the top instead of right, so remove a quarter of the circle return index * angleMultiplier + startAngleRadians; }, getDistanceFromCenterForValue: function(value) { var me = this; if (value === null) { return 0; // null always in center } // Take into account half font size + the yPadding of the top value var scalingFactor = me.drawingArea / (me.max - me.min); if (me.options.ticks.reverse) { return (me.max - value) * scalingFactor; } return (value - me.min) * scalingFactor; }, getPointPosition: function(index, distanceFromCenter) { var me = this; var thisAngle = me.getIndexAngle(index) - (Math.PI / 2); return { x: Math.round(Math.cos(thisAngle) * distanceFromCenter) + me.xCenter, y: Math.round(Math.sin(thisAngle) * distanceFromCenter) + me.yCenter }; }, getPointPositionForValue: function(index, value) { return this.getPointPosition(index, this.getDistanceFromCenterForValue(value)); }, getBasePosition: function() { var me = this; var min = me.min; var max = me.max; return me.getPointPositionForValue(0, me.beginAtZero ? 0 : min < 0 && max < 0 ? max : min > 0 && max > 0 ? min : 0); }, draw: function() { var me = this; var opts = me.options; var gridLineOpts = opts.gridLines; var tickOpts = opts.ticks; var valueOrDefault = helpers.valueOrDefault; if (opts.display) { var ctx = me.ctx; var startAngle = this.getIndexAngle(0); // Tick Font var tickFontSize = valueOrDefault(tickOpts.fontSize, globalDefaults.defaultFontSize); var tickFontStyle = valueOrDefault(tickOpts.fontStyle, globalDefaults.defaultFontStyle); var tickFontFamily = valueOrDefault(tickOpts.fontFamily, globalDefaults.defaultFontFamily); var tickLabelFont = helpers.fontString(tickFontSize, tickFontStyle, tickFontFamily); helpers.each(me.ticks, function(label, index) { // Don't draw a centre value (if it is minimum) if (index > 0 || tickOpts.reverse) { var yCenterOffset = me.getDistanceFromCenterForValue(me.ticksAsNumbers[index]); // Draw circular lines around the scale if (gridLineOpts.display && index !== 0) { drawRadiusLine(me, gridLineOpts, yCenterOffset, index); } if (tickOpts.display) { var tickFontColor = valueOrDefault(tickOpts.fontColor, globalDefaults.defaultFontColor); ctx.font = tickLabelFont; ctx.save(); ctx.translate(me.xCenter, me.yCenter); ctx.rotate(startAngle); if (tickOpts.showLabelBackdrop) { var labelWidth = ctx.measureText(label).width; ctx.fillStyle = tickOpts.backdropColor; ctx.fillRect( -labelWidth / 2 - tickOpts.backdropPaddingX, -yCenterOffset - tickFontSize / 2 - tickOpts.backdropPaddingY, labelWidth + tickOpts.backdropPaddingX * 2, tickFontSize + tickOpts.backdropPaddingY * 2 ); } ctx.textAlign = 'center'; ctx.textBaseline = 'middle'; ctx.fillStyle = tickFontColor; ctx.fillText(label, 0, -yCenterOffset); ctx.restore(); } } }); if (opts.angleLines.display || opts.pointLabels.display) { drawPointLabels(me); } } } }); Chart.scaleService.registerScaleType('radialLinear', LinearRadialScale, defaultConfig); }; /***/ }), /***/ "./node_modules/chart.js/src/scales/scale.time.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /* global window: false */ var moment = __webpack_require__("./node_modules/moment/moment.js"); moment = typeof moment === 'function' ? moment : window.moment; var defaults = __webpack_require__("./node_modules/chart.js/src/core/core.defaults.js"); var helpers = __webpack_require__("./node_modules/chart.js/src/helpers/index.js"); // Integer constants are from the ES6 spec. var MIN_INTEGER = Number.MIN_SAFE_INTEGER || -9007199254740991; var MAX_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991; var INTERVALS = { millisecond: { common: true, size: 1, steps: [1, 2, 5, 10, 20, 50, 100, 250, 500] }, second: { common: true, size: 1000, steps: [1, 2, 5, 10, 30] }, minute: { common: true, size: 60000, steps: [1, 2, 5, 10, 30] }, hour: { common: true, size: 3600000, steps: [1, 2, 3, 6, 12] }, day: { common: true, size: 86400000, steps: [1, 2, 5] }, week: { common: false, size: 604800000, steps: [1, 2, 3, 4] }, month: { common: true, size: 2.628e9, steps: [1, 2, 3] }, quarter: { common: false, size: 7.884e9, steps: [1, 2, 3, 4] }, year: { common: true, size: 3.154e10 } }; var UNITS = Object.keys(INTERVALS); function sorter(a, b) { return a - b; } function arrayUnique(items) { var hash = {}; var out = []; var i, ilen, item; for (i = 0, ilen = items.length; i < ilen; ++i) { item = items[i]; if (!hash[item]) { hash[item] = true; out.push(item); } } return out; } /** * Returns an array of {time, pos} objects used to interpolate a specific `time` or position * (`pos`) on the scale, by searching entries before and after the requested value. `pos` is * a decimal between 0 and 1: 0 being the start of the scale (left or top) and 1 the other * extremity (left + width or top + height). Note that it would be more optimized to directly * store pre-computed pixels, but the scale dimensions are not guaranteed at the time we need * to create the lookup table. The table ALWAYS contains at least two items: min and max. * * @param {Number[]} timestamps - timestamps sorted from lowest to highest. * @param {String} distribution - If 'linear', timestamps will be spread linearly along the min * and max range, so basically, the table will contains only two items: {min, 0} and {max, 1}. * If 'series', timestamps will be positioned at the same distance from each other. In this * case, only timestamps that break the time linearity are registered, meaning that in the * best case, all timestamps are linear, the table contains only min and max. */ function buildLookupTable(timestamps, min, max, distribution) { if (distribution === 'linear' || !timestamps.length) { return [ {time: min, pos: 0}, {time: max, pos: 1} ]; } var table = []; var items = [min]; var i, ilen, prev, curr, next; for (i = 0, ilen = timestamps.length; i < ilen; ++i) { curr = timestamps[i]; if (curr > min && curr < max) { items.push(curr); } } items.push(max); for (i = 0, ilen = items.length; i < ilen; ++i) { next = items[i + 1]; prev = items[i - 1]; curr = items[i]; // only add points that breaks the scale linearity if (prev === undefined || next === undefined || Math.round((next + prev) / 2) !== curr) { table.push({time: curr, pos: i / (ilen - 1)}); } } return table; } // @see adapted from http://www.anujgakhar.com/2014/03/01/binary-search-in-javascript/ function lookup(table, key, value) { var lo = 0; var hi = table.length - 1; var mid, i0, i1; while (lo >= 0 && lo <= hi) { mid = (lo + hi) >> 1; i0 = table[mid - 1] || null; i1 = table[mid]; if (!i0) { // given value is outside table (before first item) return {lo: null, hi: i1}; } else if (i1[key] < value) { lo = mid + 1; } else if (i0[key] > value) { hi = mid - 1; } else { return {lo: i0, hi: i1}; } } // given value is outside table (after last item) return {lo: i1, hi: null}; } /** * Linearly interpolates the given source `value` using the table items `skey` values and * returns the associated `tkey` value. For example, interpolate(table, 'time', 42, 'pos') * returns the position for a timestamp equal to 42. If value is out of bounds, values at * index [0, 1] or [n - 1, n] are used for the interpolation. */ function interpolate(table, skey, sval, tkey) { var range = lookup(table, skey, sval); // Note: the lookup table ALWAYS contains at least 2 items (min and max) var prev = !range.lo ? table[0] : !range.hi ? table[table.length - 2] : range.lo; var next = !range.lo ? table[1] : !range.hi ? table[table.length - 1] : range.hi; var span = next[skey] - prev[skey]; var ratio = span ? (sval - prev[skey]) / span : 0; var offset = (next[tkey] - prev[tkey]) * ratio; return prev[tkey] + offset; } /** * Convert the given value to a moment object using the given time options. * @see http://momentjs.com/docs/#/parsing/ */ function momentify(value, options) { var parser = options.parser; var format = options.parser || options.format; if (typeof parser === 'function') { return parser(value); } if (typeof value === 'string' && typeof format === 'string') { return moment(value, format); } if (!(value instanceof moment)) { value = moment(value); } if (value.isValid()) { return value; } // Labels are in an incompatible moment format and no `parser` has been provided. // The user might still use the deprecated `format` option to convert his inputs. if (typeof format === 'function') { return format(value); } return value; } function parse(input, scale) { if (helpers.isNullOrUndef(input)) { return null; } var options = scale.options.time; var value = momentify(scale.getRightValue(input), options); if (!value.isValid()) { return null; } if (options.round) { value.startOf(options.round); } return value.valueOf(); } /** * Returns the number of unit to skip to be able to display up to `capacity` number of ticks * in `unit` for the given `min` / `max` range and respecting the interval steps constraints. */ function determineStepSize(min, max, unit, capacity) { var range = max - min; var interval = INTERVALS[unit]; var milliseconds = interval.size; var steps = interval.steps; var i, ilen, factor; if (!steps) { return Math.ceil(range / (capacity * milliseconds)); } for (i = 0, ilen = steps.length; i < ilen; ++i) { factor = steps[i]; if (Math.ceil(range / (milliseconds * factor)) <= capacity) { break; } } return factor; } /** * Figures out what unit results in an appropriate number of auto-generated ticks */ function determineUnitForAutoTicks(minUnit, min, max, capacity) { var ilen = UNITS.length; var i, interval, factor; for (i = UNITS.indexOf(minUnit); i < ilen - 1; ++i) { interval = INTERVALS[UNITS[i]]; factor = interval.steps ? interval.steps[interval.steps.length - 1] : MAX_INTEGER; if (interval.common && Math.ceil((max - min) / (factor * interval.size)) <= capacity) { return UNITS[i]; } } return UNITS[ilen - 1]; } /** * Figures out what unit to format a set of ticks with */ function determineUnitForFormatting(ticks, minUnit, min, max) { var duration = moment.duration(moment(max).diff(moment(min))); var ilen = UNITS.length; var i, unit; for (i = ilen - 1; i >= UNITS.indexOf(minUnit); i--) { unit = UNITS[i]; if (INTERVALS[unit].common && duration.as(unit) >= ticks.length) { return unit; } } return UNITS[minUnit ? UNITS.indexOf(minUnit) : 0]; } function determineMajorUnit(unit) { for (var i = UNITS.indexOf(unit) + 1, ilen = UNITS.length; i < ilen; ++i) { if (INTERVALS[UNITS[i]].common) { return UNITS[i]; } } } /** * Generates a maximum of `capacity` timestamps between min and max, rounded to the * `minor` unit, aligned on the `major` unit and using the given scale time `options`. * Important: this method can return ticks outside the min and max range, it's the * responsibility of the calling code to clamp values if needed. */ function generate(min, max, capacity, options) { var timeOpts = options.time; var minor = timeOpts.unit || determineUnitForAutoTicks(timeOpts.minUnit, min, max, capacity); var major = determineMajorUnit(minor); var stepSize = helpers.valueOrDefault(timeOpts.stepSize, timeOpts.unitStepSize); var weekday = minor === 'week' ? timeOpts.isoWeekday : false; var majorTicksEnabled = options.ticks.major.enabled; var interval = INTERVALS[minor]; var first = moment(min); var last = moment(max); var ticks = []; var time; if (!stepSize) { stepSize = determineStepSize(min, max, minor, capacity); } // For 'week' unit, handle the first day of week option if (weekday) { first = first.isoWeekday(weekday); last = last.isoWeekday(weekday); } // Align first/last ticks on unit first = first.startOf(weekday ? 'day' : minor); last = last.startOf(weekday ? 'day' : minor); // Make sure that the last tick include max if (last < max) { last.add(1, minor); } time = moment(first); if (majorTicksEnabled && major && !weekday && !timeOpts.round) { // Align the first tick on the previous `minor` unit aligned on the `major` unit: // we first aligned time on the previous `major` unit then add the number of full // stepSize there is between first and the previous major time. time.startOf(major); time.add(~~((first - time) / (interval.size * stepSize)) * stepSize, minor); } for (; time < last; time.add(stepSize, minor)) { ticks.push(+time); } ticks.push(+time); return ticks; } /** * Returns the right and left offsets from edges in the form of {left, right}. * Offsets are added when the `offset` option is true. */ function computeOffsets(table, ticks, min, max, options) { var left = 0; var right = 0; var upper, lower; if (options.offset && ticks.length) { if (!options.time.min) { upper = ticks.length > 1 ? ticks[1] : max; lower = ticks[0]; left = ( interpolate(table, 'time', upper, 'pos') - interpolate(table, 'time', lower, 'pos') ) / 2; } if (!options.time.max) { upper = ticks[ticks.length - 1]; lower = ticks.length > 1 ? ticks[ticks.length - 2] : min; right = ( interpolate(table, 'time', upper, 'pos') - interpolate(table, 'time', lower, 'pos') ) / 2; } } return {left: left, right: right}; } function ticksFromTimestamps(values, majorUnit) { var ticks = []; var i, ilen, value, major; for (i = 0, ilen = values.length; i < ilen; ++i) { value = values[i]; major = majorUnit ? value === +moment(value).startOf(majorUnit) : false; ticks.push({ value: value, major: major }); } return ticks; } function determineLabelFormat(data, timeOpts) { var i, momentDate, hasTime; var ilen = data.length; // find the label with the most parts (milliseconds, minutes, etc.) // format all labels with the same level of detail as the most specific label for (i = 0; i < ilen; i++) { momentDate = momentify(data[i], timeOpts); if (momentDate.millisecond() !== 0) { return 'MMM D, YYYY h:mm:ss.SSS a'; } if (momentDate.second() !== 0 || momentDate.minute() !== 0 || momentDate.hour() !== 0) { hasTime = true; } } if (hasTime) { return 'MMM D, YYYY h:mm:ss a'; } return 'MMM D, YYYY'; } module.exports = function(Chart) { var defaultConfig = { position: 'bottom', /** * Data distribution along the scale: * - 'linear': data are spread according to their time (distances can vary), * - 'series': data are spread at the same distance from each other. * @see https://github.com/chartjs/Chart.js/pull/4507 * @since 2.7.0 */ distribution: 'linear', /** * Scale boundary strategy (bypassed by min/max time options) * - `data`: make sure data are fully visible, ticks outside are removed * - `ticks`: make sure ticks are fully visible, data outside are truncated * @see https://github.com/chartjs/Chart.js/pull/4556 * @since 2.7.0 */ bounds: 'data', time: { parser: false, // false == a pattern string from http://momentjs.com/docs/#/parsing/string-format/ or a custom callback that converts its argument to a moment format: false, // DEPRECATED false == date objects, moment object, callback or a pattern string from http://momentjs.com/docs/#/parsing/string-format/ unit: false, // false == automatic or override with week, month, year, etc. round: false, // none, or override with week, month, year, etc. displayFormat: false, // DEPRECATED isoWeekday: false, // override week start day - see http://momentjs.com/docs/#/get-set/iso-weekday/ minUnit: 'millisecond', // defaults to unit's corresponding unitFormat below or override using pattern string from http://momentjs.com/docs/#/displaying/format/ displayFormats: { millisecond: 'h:mm:ss.SSS a', // 11:20:01.123 AM, second: 'h:mm:ss a', // 11:20:01 AM minute: 'h:mm a', // 11:20 AM hour: 'hA', // 5PM day: 'MMM D', // Sep 4 week: 'll', // Week 46, or maybe "[W]WW - YYYY" ? month: 'MMM YYYY', // Sept 2015 quarter: '[Q]Q - YYYY', // Q3 year: 'YYYY' // 2015 }, }, ticks: { autoSkip: false, /** * Ticks generation input values: * - 'auto': generates "optimal" ticks based on scale size and time options. * - 'data': generates ticks from data (including labels from data {t|x|y} objects). * - 'labels': generates ticks from user given `data.labels` values ONLY. * @see https://github.com/chartjs/Chart.js/pull/4507 * @since 2.7.0 */ source: 'auto', major: { enabled: false } } }; var TimeScale = Chart.Scale.extend({ initialize: function() { if (!moment) { throw new Error('Chart.js - Moment.js could not be found! You must include it before Chart.js to use the time scale. Download at https://momentjs.com'); } this.mergeTicksOptions(); Chart.Scale.prototype.initialize.call(this); }, update: function() { var me = this; var options = me.options; // DEPRECATIONS: output a message only one time per update if (options.time && options.time.format) { console.warn('options.time.format is deprecated and replaced by options.time.parser.'); } return Chart.Scale.prototype.update.apply(me, arguments); }, /** * Allows data to be referenced via 't' attribute */ getRightValue: function(rawValue) { if (rawValue && rawValue.t !== undefined) { rawValue = rawValue.t; } return Chart.Scale.prototype.getRightValue.call(this, rawValue); }, determineDataLimits: function() { var me = this; var chart = me.chart; var timeOpts = me.options.time; var unit = timeOpts.unit || 'day'; var min = MAX_INTEGER; var max = MIN_INTEGER; var timestamps = []; var datasets = []; var labels = []; var i, j, ilen, jlen, data, timestamp; // Convert labels to timestamps for (i = 0, ilen = chart.data.labels.length; i < ilen; ++i) { labels.push(parse(chart.data.labels[i], me)); } // Convert data to timestamps for (i = 0, ilen = (chart.data.datasets || []).length; i < ilen; ++i) { if (chart.isDatasetVisible(i)) { data = chart.data.datasets[i].data; // Let's consider that all data have the same format. if (helpers.isObject(data[0])) { datasets[i] = []; for (j = 0, jlen = data.length; j < jlen; ++j) { timestamp = parse(data[j], me); timestamps.push(timestamp); datasets[i][j] = timestamp; } } else { timestamps.push.apply(timestamps, labels); datasets[i] = labels.slice(0); } } else { datasets[i] = []; } } if (labels.length) { // Sort labels **after** data have been converted labels = arrayUnique(labels).sort(sorter); min = Math.min(min, labels[0]); max = Math.max(max, labels[labels.length - 1]); } if (timestamps.length) { timestamps = arrayUnique(timestamps).sort(sorter); min = Math.min(min, timestamps[0]); max = Math.max(max, timestamps[timestamps.length - 1]); } min = parse(timeOpts.min, me) || min; max = parse(timeOpts.max, me) || max; // In case there is no valid min/max, set limits based on unit time option min = min === MAX_INTEGER ? +moment().startOf(unit) : min; max = max === MIN_INTEGER ? +moment().endOf(unit) + 1 : max; // Make sure that max is strictly higher than min (required by the lookup table) me.min = Math.min(min, max); me.max = Math.max(min + 1, max); // PRIVATE me._horizontal = me.isHorizontal(); me._table = []; me._timestamps = { data: timestamps, datasets: datasets, labels: labels }; }, buildTicks: function() { var me = this; var min = me.min; var max = me.max; var options = me.options; var timeOpts = options.time; var timestamps = []; var ticks = []; var i, ilen, timestamp; switch (options.ticks.source) { case 'data': timestamps = me._timestamps.data; break; case 'labels': timestamps = me._timestamps.labels; break; case 'auto': default: timestamps = generate(min, max, me.getLabelCapacity(min), options); } if (options.bounds === 'ticks' && timestamps.length) { min = timestamps[0]; max = timestamps[timestamps.length - 1]; } // Enforce limits with user min/max options min = parse(timeOpts.min, me) || min; max = parse(timeOpts.max, me) || max; // Remove ticks outside the min/max range for (i = 0, ilen = timestamps.length; i < ilen; ++i) { timestamp = timestamps[i]; if (timestamp >= min && timestamp <= max) { ticks.push(timestamp); } } me.min = min; me.max = max; // PRIVATE me._unit = timeOpts.unit || determineUnitForFormatting(ticks, timeOpts.minUnit, me.min, me.max); me._majorUnit = determineMajorUnit(me._unit); me._table = buildLookupTable(me._timestamps.data, min, max, options.distribution); me._offsets = computeOffsets(me._table, ticks, min, max, options); me._labelFormat = determineLabelFormat(me._timestamps.data, timeOpts); return ticksFromTimestamps(ticks, me._majorUnit); }, getLabelForIndex: function(index, datasetIndex) { var me = this; var data = me.chart.data; var timeOpts = me.options.time; var label = data.labels && index < data.labels.length ? data.labels[index] : ''; var value = data.datasets[datasetIndex].data[index]; if (helpers.isObject(value)) { label = me.getRightValue(value); } if (timeOpts.tooltipFormat) { return momentify(label, timeOpts).format(timeOpts.tooltipFormat); } if (typeof label === 'string') { return label; } return momentify(label, timeOpts).format(me._labelFormat); }, /** * Function to format an individual tick mark * @private */ tickFormatFunction: function(tick, index, ticks, formatOverride) { var me = this; var options = me.options; var time = tick.valueOf(); var formats = options.time.displayFormats; var minorFormat = formats[me._unit]; var majorUnit = me._majorUnit; var majorFormat = formats[majorUnit]; var majorTime = tick.clone().startOf(majorUnit).valueOf(); var majorTickOpts = options.ticks.major; var major = majorTickOpts.enabled && majorUnit && majorFormat && time === majorTime; var label = tick.format(formatOverride ? formatOverride : major ? majorFormat : minorFormat); var tickOpts = major ? majorTickOpts : options.ticks.minor; var formatter = helpers.valueOrDefault(tickOpts.callback, tickOpts.userCallback); return formatter ? formatter(label, index, ticks) : label; }, convertTicksToLabels: function(ticks) { var labels = []; var i, ilen; for (i = 0, ilen = ticks.length; i < ilen; ++i) { labels.push(this.tickFormatFunction(moment(ticks[i].value), i, ticks)); } return labels; }, /** * @private */ getPixelForOffset: function(time) { var me = this; var size = me._horizontal ? me.width : me.height; var start = me._horizontal ? me.left : me.top; var pos = interpolate(me._table, 'time', time, 'pos'); return start + size * (me._offsets.left + pos) / (me._offsets.left + 1 + me._offsets.right); }, getPixelForValue: function(value, index, datasetIndex) { var me = this; var time = null; if (index !== undefined && datasetIndex !== undefined) { time = me._timestamps.datasets[datasetIndex][index]; } if (time === null) { time = parse(value, me); } if (time !== null) { return me.getPixelForOffset(time); } }, getPixelForTick: function(index) { var ticks = this.getTicks(); return index >= 0 && index < ticks.length ? this.getPixelForOffset(ticks[index].value) : null; }, getValueForPixel: function(pixel) { var me = this; var size = me._horizontal ? me.width : me.height; var start = me._horizontal ? me.left : me.top; var pos = (size ? (pixel - start) / size : 0) * (me._offsets.left + 1 + me._offsets.left) - me._offsets.right; var time = interpolate(me._table, 'pos', pos, 'time'); return moment(time); }, /** * Crude approximation of what the label width might be * @private */ getLabelWidth: function(label) { var me = this; var ticksOpts = me.options.ticks; var tickLabelWidth = me.ctx.measureText(label).width; var angle = helpers.toRadians(ticksOpts.maxRotation); var cosRotation = Math.cos(angle); var sinRotation = Math.sin(angle); var tickFontSize = helpers.valueOrDefault(ticksOpts.fontSize, defaults.global.defaultFontSize); return (tickLabelWidth * cosRotation) + (tickFontSize * sinRotation); }, /** * @private */ getLabelCapacity: function(exampleTime) { var me = this; var formatOverride = me.options.time.displayFormats.millisecond; // Pick the longest format for guestimation var exampleLabel = me.tickFormatFunction(moment(exampleTime), 0, [], formatOverride); var tickLabelWidth = me.getLabelWidth(exampleLabel); var innerWidth = me.isHorizontal() ? me.width : me.height; var capacity = Math.floor(innerWidth / tickLabelWidth); return capacity > 0 ? capacity : 1; } }); Chart.scaleService.registerScaleType('time', TimeScale, defaultConfig); }; /***/ }), /***/ "./node_modules/chartjs-color-string/color-string.js": /***/ (function(module, exports, __webpack_require__) { /* MIT license */ var colorNames = __webpack_require__("./node_modules/color-name/index.js"); module.exports = { getRgba: getRgba, getHsla: getHsla, getRgb: getRgb, getHsl: getHsl, getHwb: getHwb, getAlpha: getAlpha, hexString: hexString, rgbString: rgbString, rgbaString: rgbaString, percentString: percentString, percentaString: percentaString, hslString: hslString, hslaString: hslaString, hwbString: hwbString, keyword: keyword } function getRgba(string) { if (!string) { return; } var abbr = /^#([a-fA-F0-9]{3})$/i, hex = /^#([a-fA-F0-9]{6})$/i, rgba = /^rgba?\(\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/i, per = /^rgba?\(\s*([+-]?[\d\.]+)\%\s*,\s*([+-]?[\d\.]+)\%\s*,\s*([+-]?[\d\.]+)\%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/i, keyword = /(\w+)/; var rgb = [0, 0, 0], a = 1, match = string.match(abbr); if (match) { match = match[1]; for (var i = 0; i < rgb.length; i++) { rgb[i] = parseInt(match[i] + match[i], 16); } } else if (match = string.match(hex)) { match = match[1]; for (var i = 0; i < rgb.length; i++) { rgb[i] = parseInt(match.slice(i * 2, i * 2 + 2), 16); } } else if (match = string.match(rgba)) { for (var i = 0; i < rgb.length; i++) { rgb[i] = parseInt(match[i + 1]); } a = parseFloat(match[4]); } else if (match = string.match(per)) { for (var i = 0; i < rgb.length; i++) { rgb[i] = Math.round(parseFloat(match[i + 1]) * 2.55); } a = parseFloat(match[4]); } else if (match = string.match(keyword)) { if (match[1] == "transparent") { return [0, 0, 0, 0]; } rgb = colorNames[match[1]]; if (!rgb) { return; } } for (var i = 0; i < rgb.length; i++) { rgb[i] = scale(rgb[i], 0, 255); } if (!a && a != 0) { a = 1; } else { a = scale(a, 0, 1); } rgb[3] = a; return rgb; } function getHsla(string) { if (!string) { return; } var hsl = /^hsla?\(\s*([+-]?\d+)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)/; var match = string.match(hsl); if (match) { var alpha = parseFloat(match[4]); var h = scale(parseInt(match[1]), 0, 360), s = scale(parseFloat(match[2]), 0, 100), l = scale(parseFloat(match[3]), 0, 100), a = scale(isNaN(alpha) ? 1 : alpha, 0, 1); return [h, s, l, a]; } } function getHwb(string) { if (!string) { return; } var hwb = /^hwb\(\s*([+-]?\d+)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)/; var match = string.match(hwb); if (match) { var alpha = parseFloat(match[4]); var h = scale(parseInt(match[1]), 0, 360), w = scale(parseFloat(match[2]), 0, 100), b = scale(parseFloat(match[3]), 0, 100), a = scale(isNaN(alpha) ? 1 : alpha, 0, 1); return [h, w, b, a]; } } function getRgb(string) { var rgba = getRgba(string); return rgba && rgba.slice(0, 3); } function getHsl(string) { var hsla = getHsla(string); return hsla && hsla.slice(0, 3); } function getAlpha(string) { var vals = getRgba(string); if (vals) { return vals[3]; } else if (vals = getHsla(string)) { return vals[3]; } else if (vals = getHwb(string)) { return vals[3]; } } // generators function hexString(rgb) { return "#" + hexDouble(rgb[0]) + hexDouble(rgb[1]) + hexDouble(rgb[2]); } function rgbString(rgba, alpha) { if (alpha < 1 || (rgba[3] && rgba[3] < 1)) { return rgbaString(rgba, alpha); } return "rgb(" + rgba[0] + ", " + rgba[1] + ", " + rgba[2] + ")"; } function rgbaString(rgba, alpha) { if (alpha === undefined) { alpha = (rgba[3] !== undefined ? rgba[3] : 1); } return "rgba(" + rgba[0] + ", " + rgba[1] + ", " + rgba[2] + ", " + alpha + ")"; } function percentString(rgba, alpha) { if (alpha < 1 || (rgba[3] && rgba[3] < 1)) { return percentaString(rgba, alpha); } var r = Math.round(rgba[0]/255 * 100), g = Math.round(rgba[1]/255 * 100), b = Math.round(rgba[2]/255 * 100); return "rgb(" + r + "%, " + g + "%, " + b + "%)"; } function percentaString(rgba, alpha) { var r = Math.round(rgba[0]/255 * 100), g = Math.round(rgba[1]/255 * 100), b = Math.round(rgba[2]/255 * 100); return "rgba(" + r + "%, " + g + "%, " + b + "%, " + (alpha || rgba[3] || 1) + ")"; } function hslString(hsla, alpha) { if (alpha < 1 || (hsla[3] && hsla[3] < 1)) { return hslaString(hsla, alpha); } return "hsl(" + hsla[0] + ", " + hsla[1] + "%, " + hsla[2] + "%)"; } function hslaString(hsla, alpha) { if (alpha === undefined) { alpha = (hsla[3] !== undefined ? hsla[3] : 1); } return "hsla(" + hsla[0] + ", " + hsla[1] + "%, " + hsla[2] + "%, " + alpha + ")"; } // hwb is a bit different than rgb(a) & hsl(a) since there is no alpha specific syntax // (hwb have alpha optional & 1 is default value) function hwbString(hwb, alpha) { if (alpha === undefined) { alpha = (hwb[3] !== undefined ? hwb[3] : 1); } return "hwb(" + hwb[0] + ", " + hwb[1] + "%, " + hwb[2] + "%" + (alpha !== undefined && alpha !== 1 ? ", " + alpha : "") + ")"; } function keyword(rgb) { return reverseNames[rgb.slice(0, 3)]; } // helpers function scale(num, min, max) { return Math.min(Math.max(min, num), max); } function hexDouble(num) { var str = num.toString(16).toUpperCase(); return (str.length < 2) ? "0" + str : str; } //create a list of reverse color names var reverseNames = {}; for (var name in colorNames) { reverseNames[colorNames[name]] = name; } /***/ }), /***/ "./node_modules/chartjs-color/index.js": /***/ (function(module, exports, __webpack_require__) { /* MIT license */ var convert = __webpack_require__("./node_modules/color-convert/index.js"); var string = __webpack_require__("./node_modules/chartjs-color-string/color-string.js"); var Color = function (obj) { if (obj instanceof Color) { return obj; } if (!(this instanceof Color)) { return new Color(obj); } this.valid = false; this.values = { rgb: [0, 0, 0], hsl: [0, 0, 0], hsv: [0, 0, 0], hwb: [0, 0, 0], cmyk: [0, 0, 0, 0], alpha: 1 }; // parse Color() argument var vals; if (typeof obj === 'string') { vals = string.getRgba(obj); if (vals) { this.setValues('rgb', vals); } else if (vals = string.getHsla(obj)) { this.setValues('hsl', vals); } else if (vals = string.getHwb(obj)) { this.setValues('hwb', vals); } } else if (typeof obj === 'object') { vals = obj; if (vals.r !== undefined || vals.red !== undefined) { this.setValues('rgb', vals); } else if (vals.l !== undefined || vals.lightness !== undefined) { this.setValues('hsl', vals); } else if (vals.v !== undefined || vals.value !== undefined) { this.setValues('hsv', vals); } else if (vals.w !== undefined || vals.whiteness !== undefined) { this.setValues('hwb', vals); } else if (vals.c !== undefined || vals.cyan !== undefined) { this.setValues('cmyk', vals); } } }; Color.prototype = { isValid: function () { return this.valid; }, rgb: function () { return this.setSpace('rgb', arguments); }, hsl: function () { return this.setSpace('hsl', arguments); }, hsv: function () { return this.setSpace('hsv', arguments); }, hwb: function () { return this.setSpace('hwb', arguments); }, cmyk: function () { return this.setSpace('cmyk', arguments); }, rgbArray: function () { return this.values.rgb; }, hslArray: function () { return this.values.hsl; }, hsvArray: function () { return this.values.hsv; }, hwbArray: function () { var values = this.values; if (values.alpha !== 1) { return values.hwb.concat([values.alpha]); } return values.hwb; }, cmykArray: function () { return this.values.cmyk; }, rgbaArray: function () { var values = this.values; return values.rgb.concat([values.alpha]); }, hslaArray: function () { var values = this.values; return values.hsl.concat([values.alpha]); }, alpha: function (val) { if (val === undefined) { return this.values.alpha; } this.setValues('alpha', val); return this; }, red: function (val) { return this.setChannel('rgb', 0, val); }, green: function (val) { return this.setChannel('rgb', 1, val); }, blue: function (val) { return this.setChannel('rgb', 2, val); }, hue: function (val) { if (val) { val %= 360; val = val < 0 ? 360 + val : val; } return this.setChannel('hsl', 0, val); }, saturation: function (val) { return this.setChannel('hsl', 1, val); }, lightness: function (val) { return this.setChannel('hsl', 2, val); }, saturationv: function (val) { return this.setChannel('hsv', 1, val); }, whiteness: function (val) { return this.setChannel('hwb', 1, val); }, blackness: function (val) { return this.setChannel('hwb', 2, val); }, value: function (val) { return this.setChannel('hsv', 2, val); }, cyan: function (val) { return this.setChannel('cmyk', 0, val); }, magenta: function (val) { return this.setChannel('cmyk', 1, val); }, yellow: function (val) { return this.setChannel('cmyk', 2, val); }, black: function (val) { return this.setChannel('cmyk', 3, val); }, hexString: function () { return string.hexString(this.values.rgb); }, rgbString: function () { return string.rgbString(this.values.rgb, this.values.alpha); }, rgbaString: function () { return string.rgbaString(this.values.rgb, this.values.alpha); }, percentString: function () { return string.percentString(this.values.rgb, this.values.alpha); }, hslString: function () { return string.hslString(this.values.hsl, this.values.alpha); }, hslaString: function () { return string.hslaString(this.values.hsl, this.values.alpha); }, hwbString: function () { return string.hwbString(this.values.hwb, this.values.alpha); }, keyword: function () { return string.keyword(this.values.rgb, this.values.alpha); }, rgbNumber: function () { var rgb = this.values.rgb; return (rgb[0] << 16) | (rgb[1] << 8) | rgb[2]; }, luminosity: function () { // http://www.w3.org/TR/WCAG20/#relativeluminancedef var rgb = this.values.rgb; var lum = []; for (var i = 0; i < rgb.length; i++) { var chan = rgb[i] / 255; lum[i] = (chan <= 0.03928) ? chan / 12.92 : Math.pow(((chan + 0.055) / 1.055), 2.4); } return 0.2126 * lum[0] + 0.7152 * lum[1] + 0.0722 * lum[2]; }, contrast: function (color2) { // http://www.w3.org/TR/WCAG20/#contrast-ratiodef var lum1 = this.luminosity(); var lum2 = color2.luminosity(); if (lum1 > lum2) { return (lum1 + 0.05) / (lum2 + 0.05); } return (lum2 + 0.05) / (lum1 + 0.05); }, level: function (color2) { var contrastRatio = this.contrast(color2); if (contrastRatio >= 7.1) { return 'AAA'; } return (contrastRatio >= 4.5) ? 'AA' : ''; }, dark: function () { // YIQ equation from http://24ways.org/2010/calculating-color-contrast var rgb = this.values.rgb; var yiq = (rgb[0] * 299 + rgb[1] * 587 + rgb[2] * 114) / 1000; return yiq < 128; }, light: function () { return !this.dark(); }, negate: function () { var rgb = []; for (var i = 0; i < 3; i++) { rgb[i] = 255 - this.values.rgb[i]; } this.setValues('rgb', rgb); return this; }, lighten: function (ratio) { var hsl = this.values.hsl; hsl[2] += hsl[2] * ratio; this.setValues('hsl', hsl); return this; }, darken: function (ratio) { var hsl = this.values.hsl; hsl[2] -= hsl[2] * ratio; this.setValues('hsl', hsl); return this; }, saturate: function (ratio) { var hsl = this.values.hsl; hsl[1] += hsl[1] * ratio; this.setValues('hsl', hsl); return this; }, desaturate: function (ratio) { var hsl = this.values.hsl; hsl[1] -= hsl[1] * ratio; this.setValues('hsl', hsl); return this; }, whiten: function (ratio) { var hwb = this.values.hwb; hwb[1] += hwb[1] * ratio; this.setValues('hwb', hwb); return this; }, blacken: function (ratio) { var hwb = this.values.hwb; hwb[2] += hwb[2] * ratio; this.setValues('hwb', hwb); return this; }, greyscale: function () { var rgb = this.values.rgb; // http://en.wikipedia.org/wiki/Grayscale#Converting_color_to_grayscale var val = rgb[0] * 0.3 + rgb[1] * 0.59 + rgb[2] * 0.11; this.setValues('rgb', [val, val, val]); return this; }, clearer: function (ratio) { var alpha = this.values.alpha; this.setValues('alpha', alpha - (alpha * ratio)); return this; }, opaquer: function (ratio) { var alpha = this.values.alpha; this.setValues('alpha', alpha + (alpha * ratio)); return this; }, rotate: function (degrees) { var hsl = this.values.hsl; var hue = (hsl[0] + degrees) % 360; hsl[0] = hue < 0 ? 360 + hue : hue; this.setValues('hsl', hsl); return this; }, /** * Ported from sass implementation in C * https://github.com/sass/libsass/blob/0e6b4a2850092356aa3ece07c6b249f0221caced/functions.cpp#L209 */ mix: function (mixinColor, weight) { var color1 = this; var color2 = mixinColor; var p = weight === undefined ? 0.5 : weight; var w = 2 * p - 1; var a = color1.alpha() - color2.alpha(); var w1 = (((w * a === -1) ? w : (w + a) / (1 + w * a)) + 1) / 2.0; var w2 = 1 - w1; return this .rgb( w1 * color1.red() + w2 * color2.red(), w1 * color1.green() + w2 * color2.green(), w1 * color1.blue() + w2 * color2.blue() ) .alpha(color1.alpha() * p + color2.alpha() * (1 - p)); }, toJSON: function () { return this.rgb(); }, clone: function () { // NOTE(SB): using node-clone creates a dependency to Buffer when using browserify, // making the final build way to big to embed in Chart.js. So let's do it manually, // assuming that values to clone are 1 dimension arrays containing only numbers, // except 'alpha' which is a number. var result = new Color(); var source = this.values; var target = result.values; var value, type; for (var prop in source) { if (source.hasOwnProperty(prop)) { value = source[prop]; type = ({}).toString.call(value); if (type === '[object Array]') { target[prop] = value.slice(0); } else if (type === '[object Number]') { target[prop] = value; } else { console.error('unexpected color value:', value); } } } return result; } }; Color.prototype.spaces = { rgb: ['red', 'green', 'blue'], hsl: ['hue', 'saturation', 'lightness'], hsv: ['hue', 'saturation', 'value'], hwb: ['hue', 'whiteness', 'blackness'], cmyk: ['cyan', 'magenta', 'yellow', 'black'] }; Color.prototype.maxes = { rgb: [255, 255, 255], hsl: [360, 100, 100], hsv: [360, 100, 100], hwb: [360, 100, 100], cmyk: [100, 100, 100, 100] }; Color.prototype.getValues = function (space) { var values = this.values; var vals = {}; for (var i = 0; i < space.length; i++) { vals[space.charAt(i)] = values[space][i]; } if (values.alpha !== 1) { vals.a = values.alpha; } // {r: 255, g: 255, b: 255, a: 0.4} return vals; }; Color.prototype.setValues = function (space, vals) { var values = this.values; var spaces = this.spaces; var maxes = this.maxes; var alpha = 1; var i; this.valid = true; if (space === 'alpha') { alpha = vals; } else if (vals.length) { // [10, 10, 10] values[space] = vals.slice(0, space.length); alpha = vals[space.length]; } else if (vals[space.charAt(0)] !== undefined) { // {r: 10, g: 10, b: 10} for (i = 0; i < space.length; i++) { values[space][i] = vals[space.charAt(i)]; } alpha = vals.a; } else if (vals[spaces[space][0]] !== undefined) { // {red: 10, green: 10, blue: 10} var chans = spaces[space]; for (i = 0; i < space.length; i++) { values[space][i] = vals[chans[i]]; } alpha = vals.alpha; } values.alpha = Math.max(0, Math.min(1, (alpha === undefined ? values.alpha : alpha))); if (space === 'alpha') { return false; } var capped; // cap values of the space prior converting all values for (i = 0; i < space.length; i++) { capped = Math.max(0, Math.min(maxes[space][i], values[space][i])); values[space][i] = Math.round(capped); } // convert to all the other color spaces for (var sname in spaces) { if (sname !== space) { values[sname] = convert[space][sname](values[space]); } } return true; }; Color.prototype.setSpace = function (space, args) { var vals = args[0]; if (vals === undefined) { // color.rgb() return this.getValues(space); } // color.rgb(10, 10, 10) if (typeof vals === 'number') { vals = Array.prototype.slice.call(args); } this.setValues(space, vals); return this; }; Color.prototype.setChannel = function (space, index, val) { var svalues = this.values[space]; if (val === undefined) { // color.red() return svalues[index]; } else if (val === svalues[index]) { // color.red(color.red()) return this; } // color.red(100) svalues[index] = val; this.setValues(space, svalues); return this; }; if (typeof window !== 'undefined') { window.Color = Color; } module.exports = Color; /***/ }), /***/ "./node_modules/color-convert/conversions.js": /***/ (function(module, exports) { /* MIT license */ module.exports = { rgb2hsl: rgb2hsl, rgb2hsv: rgb2hsv, rgb2hwb: rgb2hwb, rgb2cmyk: rgb2cmyk, rgb2keyword: rgb2keyword, rgb2xyz: rgb2xyz, rgb2lab: rgb2lab, rgb2lch: rgb2lch, hsl2rgb: hsl2rgb, hsl2hsv: hsl2hsv, hsl2hwb: hsl2hwb, hsl2cmyk: hsl2cmyk, hsl2keyword: hsl2keyword, hsv2rgb: hsv2rgb, hsv2hsl: hsv2hsl, hsv2hwb: hsv2hwb, hsv2cmyk: hsv2cmyk, hsv2keyword: hsv2keyword, hwb2rgb: hwb2rgb, hwb2hsl: hwb2hsl, hwb2hsv: hwb2hsv, hwb2cmyk: hwb2cmyk, hwb2keyword: hwb2keyword, cmyk2rgb: cmyk2rgb, cmyk2hsl: cmyk2hsl, cmyk2hsv: cmyk2hsv, cmyk2hwb: cmyk2hwb, cmyk2keyword: cmyk2keyword, keyword2rgb: keyword2rgb, keyword2hsl: keyword2hsl, keyword2hsv: keyword2hsv, keyword2hwb: keyword2hwb, keyword2cmyk: keyword2cmyk, keyword2lab: keyword2lab, keyword2xyz: keyword2xyz, xyz2rgb: xyz2rgb, xyz2lab: xyz2lab, xyz2lch: xyz2lch, lab2xyz: lab2xyz, lab2rgb: lab2rgb, lab2lch: lab2lch, lch2lab: lch2lab, lch2xyz: lch2xyz, lch2rgb: lch2rgb } function rgb2hsl(rgb) { var r = rgb[0]/255, g = rgb[1]/255, b = rgb[2]/255, min = Math.min(r, g, b), max = Math.max(r, g, b), delta = max - min, h, s, l; if (max == min) h = 0; else if (r == max) h = (g - b) / delta; else if (g == max) h = 2 + (b - r) / delta; else if (b == max) h = 4 + (r - g)/ delta; h = Math.min(h * 60, 360); if (h < 0) h += 360; l = (min + max) / 2; if (max == min) s = 0; else if (l <= 0.5) s = delta / (max + min); else s = delta / (2 - max - min); return [h, s * 100, l * 100]; } function rgb2hsv(rgb) { var r = rgb[0], g = rgb[1], b = rgb[2], min = Math.min(r, g, b), max = Math.max(r, g, b), delta = max - min, h, s, v; if (max == 0) s = 0; else s = (delta/max * 1000)/10; if (max == min) h = 0; else if (r == max) h = (g - b) / delta; else if (g == max) h = 2 + (b - r) / delta; else if (b == max) h = 4 + (r - g) / delta; h = Math.min(h * 60, 360); if (h < 0) h += 360; v = ((max / 255) * 1000) / 10; return [h, s, v]; } function rgb2hwb(rgb) { var r = rgb[0], g = rgb[1], b = rgb[2], h = rgb2hsl(rgb)[0], w = 1/255 * Math.min(r, Math.min(g, b)), b = 1 - 1/255 * Math.max(r, Math.max(g, b)); return [h, w * 100, b * 100]; } function rgb2cmyk(rgb) { var r = rgb[0] / 255, g = rgb[1] / 255, b = rgb[2] / 255, c, m, y, k; k = Math.min(1 - r, 1 - g, 1 - b); c = (1 - r - k) / (1 - k) || 0; m = (1 - g - k) / (1 - k) || 0; y = (1 - b - k) / (1 - k) || 0; return [c * 100, m * 100, y * 100, k * 100]; } function rgb2keyword(rgb) { return reverseKeywords[JSON.stringify(rgb)]; } function rgb2xyz(rgb) { var r = rgb[0] / 255, g = rgb[1] / 255, b = rgb[2] / 255; // assume sRGB r = r > 0.04045 ? Math.pow(((r + 0.055) / 1.055), 2.4) : (r / 12.92); g = g > 0.04045 ? Math.pow(((g + 0.055) / 1.055), 2.4) : (g / 12.92); b = b > 0.04045 ? Math.pow(((b + 0.055) / 1.055), 2.4) : (b / 12.92); var x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805); var y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722); var z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505); return [x * 100, y *100, z * 100]; } function rgb2lab(rgb) { var xyz = rgb2xyz(rgb), x = xyz[0], y = xyz[1], z = xyz[2], l, a, b; x /= 95.047; y /= 100; z /= 108.883; x = x > 0.008856 ? Math.pow(x, 1/3) : (7.787 * x) + (16 / 116); y = y > 0.008856 ? Math.pow(y, 1/3) : (7.787 * y) + (16 / 116); z = z > 0.008856 ? Math.pow(z, 1/3) : (7.787 * z) + (16 / 116); l = (116 * y) - 16; a = 500 * (x - y); b = 200 * (y - z); return [l, a, b]; } function rgb2lch(args) { return lab2lch(rgb2lab(args)); } function hsl2rgb(hsl) { var h = hsl[0] / 360, s = hsl[1] / 100, l = hsl[2] / 100, t1, t2, t3, rgb, val; if (s == 0) { val = l * 255; return [val, val, val]; } if (l < 0.5) t2 = l * (1 + s); else t2 = l + s - l * s; t1 = 2 * l - t2; rgb = [0, 0, 0]; for (var i = 0; i < 3; i++) { t3 = h + 1 / 3 * - (i - 1); t3 < 0 && t3++; t3 > 1 && t3--; if (6 * t3 < 1) val = t1 + (t2 - t1) * 6 * t3; else if (2 * t3 < 1) val = t2; else if (3 * t3 < 2) val = t1 + (t2 - t1) * (2 / 3 - t3) * 6; else val = t1; rgb[i] = val * 255; } return rgb; } function hsl2hsv(hsl) { var h = hsl[0], s = hsl[1] / 100, l = hsl[2] / 100, sv, v; if(l === 0) { // no need to do calc on black // also avoids divide by 0 error return [0, 0, 0]; } l *= 2; s *= (l <= 1) ? l : 2 - l; v = (l + s) / 2; sv = (2 * s) / (l + s); return [h, sv * 100, v * 100]; } function hsl2hwb(args) { return rgb2hwb(hsl2rgb(args)); } function hsl2cmyk(args) { return rgb2cmyk(hsl2rgb(args)); } function hsl2keyword(args) { return rgb2keyword(hsl2rgb(args)); } function hsv2rgb(hsv) { var h = hsv[0] / 60, s = hsv[1] / 100, v = hsv[2] / 100, hi = Math.floor(h) % 6; var f = h - Math.floor(h), p = 255 * v * (1 - s), q = 255 * v * (1 - (s * f)), t = 255 * v * (1 - (s * (1 - f))), v = 255 * v; switch(hi) { case 0: return [v, t, p]; case 1: return [q, v, p]; case 2: return [p, v, t]; case 3: return [p, q, v]; case 4: return [t, p, v]; case 5: return [v, p, q]; } } function hsv2hsl(hsv) { var h = hsv[0], s = hsv[1] / 100, v = hsv[2] / 100, sl, l; l = (2 - s) * v; sl = s * v; sl /= (l <= 1) ? l : 2 - l; sl = sl || 0; l /= 2; return [h, sl * 100, l * 100]; } function hsv2hwb(args) { return rgb2hwb(hsv2rgb(args)) } function hsv2cmyk(args) { return rgb2cmyk(hsv2rgb(args)); } function hsv2keyword(args) { return rgb2keyword(hsv2rgb(args)); } // http://dev.w3.org/csswg/css-color/#hwb-to-rgb function hwb2rgb(hwb) { var h = hwb[0] / 360, wh = hwb[1] / 100, bl = hwb[2] / 100, ratio = wh + bl, i, v, f, n; // wh + bl cant be > 1 if (ratio > 1) { wh /= ratio; bl /= ratio; } i = Math.floor(6 * h); v = 1 - bl; f = 6 * h - i; if ((i & 0x01) != 0) { f = 1 - f; } n = wh + f * (v - wh); // linear interpolation switch (i) { default: case 6: case 0: r = v; g = n; b = wh; break; case 1: r = n; g = v; b = wh; break; case 2: r = wh; g = v; b = n; break; case 3: r = wh; g = n; b = v; break; case 4: r = n; g = wh; b = v; break; case 5: r = v; g = wh; b = n; break; } return [r * 255, g * 255, b * 255]; } function hwb2hsl(args) { return rgb2hsl(hwb2rgb(args)); } function hwb2hsv(args) { return rgb2hsv(hwb2rgb(args)); } function hwb2cmyk(args) { return rgb2cmyk(hwb2rgb(args)); } function hwb2keyword(args) { return rgb2keyword(hwb2rgb(args)); } function cmyk2rgb(cmyk) { var c = cmyk[0] / 100, m = cmyk[1] / 100, y = cmyk[2] / 100, k = cmyk[3] / 100, r, g, b; r = 1 - Math.min(1, c * (1 - k) + k); g = 1 - Math.min(1, m * (1 - k) + k); b = 1 - Math.min(1, y * (1 - k) + k); return [r * 255, g * 255, b * 255]; } function cmyk2hsl(args) { return rgb2hsl(cmyk2rgb(args)); } function cmyk2hsv(args) { return rgb2hsv(cmyk2rgb(args)); } function cmyk2hwb(args) { return rgb2hwb(cmyk2rgb(args)); } function cmyk2keyword(args) { return rgb2keyword(cmyk2rgb(args)); } function xyz2rgb(xyz) { var x = xyz[0] / 100, y = xyz[1] / 100, z = xyz[2] / 100, r, g, b; r = (x * 3.2406) + (y * -1.5372) + (z * -0.4986); g = (x * -0.9689) + (y * 1.8758) + (z * 0.0415); b = (x * 0.0557) + (y * -0.2040) + (z * 1.0570); // assume sRGB r = r > 0.0031308 ? ((1.055 * Math.pow(r, 1.0 / 2.4)) - 0.055) : r = (r * 12.92); g = g > 0.0031308 ? ((1.055 * Math.pow(g, 1.0 / 2.4)) - 0.055) : g = (g * 12.92); b = b > 0.0031308 ? ((1.055 * Math.pow(b, 1.0 / 2.4)) - 0.055) : b = (b * 12.92); r = Math.min(Math.max(0, r), 1); g = Math.min(Math.max(0, g), 1); b = Math.min(Math.max(0, b), 1); return [r * 255, g * 255, b * 255]; } function xyz2lab(xyz) { var x = xyz[0], y = xyz[1], z = xyz[2], l, a, b; x /= 95.047; y /= 100; z /= 108.883; x = x > 0.008856 ? Math.pow(x, 1/3) : (7.787 * x) + (16 / 116); y = y > 0.008856 ? Math.pow(y, 1/3) : (7.787 * y) + (16 / 116); z = z > 0.008856 ? Math.pow(z, 1/3) : (7.787 * z) + (16 / 116); l = (116 * y) - 16; a = 500 * (x - y); b = 200 * (y - z); return [l, a, b]; } function xyz2lch(args) { return lab2lch(xyz2lab(args)); } function lab2xyz(lab) { var l = lab[0], a = lab[1], b = lab[2], x, y, z, y2; if (l <= 8) { y = (l * 100) / 903.3; y2 = (7.787 * (y / 100)) + (16 / 116); } else { y = 100 * Math.pow((l + 16) / 116, 3); y2 = Math.pow(y / 100, 1/3); } x = x / 95.047 <= 0.008856 ? x = (95.047 * ((a / 500) + y2 - (16 / 116))) / 7.787 : 95.047 * Math.pow((a / 500) + y2, 3); z = z / 108.883 <= 0.008859 ? z = (108.883 * (y2 - (b / 200) - (16 / 116))) / 7.787 : 108.883 * Math.pow(y2 - (b / 200), 3); return [x, y, z]; } function lab2lch(lab) { var l = lab[0], a = lab[1], b = lab[2], hr, h, c; hr = Math.atan2(b, a); h = hr * 360 / 2 / Math.PI; if (h < 0) { h += 360; } c = Math.sqrt(a * a + b * b); return [l, c, h]; } function lab2rgb(args) { return xyz2rgb(lab2xyz(args)); } function lch2lab(lch) { var l = lch[0], c = lch[1], h = lch[2], a, b, hr; hr = h / 360 * 2 * Math.PI; a = c * Math.cos(hr); b = c * Math.sin(hr); return [l, a, b]; } function lch2xyz(args) { return lab2xyz(lch2lab(args)); } function lch2rgb(args) { return lab2rgb(lch2lab(args)); } function keyword2rgb(keyword) { return cssKeywords[keyword]; } function keyword2hsl(args) { return rgb2hsl(keyword2rgb(args)); } function keyword2hsv(args) { return rgb2hsv(keyword2rgb(args)); } function keyword2hwb(args) { return rgb2hwb(keyword2rgb(args)); } function keyword2cmyk(args) { return rgb2cmyk(keyword2rgb(args)); } function keyword2lab(args) { return rgb2lab(keyword2rgb(args)); } function keyword2xyz(args) { return rgb2xyz(keyword2rgb(args)); } var cssKeywords = { aliceblue: [240,248,255], antiquewhite: [250,235,215], aqua: [0,255,255], aquamarine: [127,255,212], azure: [240,255,255], beige: [245,245,220], bisque: [255,228,196], black: [0,0,0], blanchedalmond: [255,235,205], blue: [0,0,255], blueviolet: [138,43,226], brown: [165,42,42], burlywood: [222,184,135], cadetblue: [95,158,160], chartreuse: [127,255,0], chocolate: [210,105,30], coral: [255,127,80], cornflowerblue: [100,149,237], cornsilk: [255,248,220], crimson: [220,20,60], cyan: [0,255,255], darkblue: [0,0,139], darkcyan: [0,139,139], darkgoldenrod: [184,134,11], darkgray: [169,169,169], darkgreen: [0,100,0], darkgrey: [169,169,169], darkkhaki: [189,183,107], darkmagenta: [139,0,139], darkolivegreen: [85,107,47], darkorange: [255,140,0], darkorchid: [153,50,204], darkred: [139,0,0], darksalmon: [233,150,122], darkseagreen: [143,188,143], darkslateblue: [72,61,139], darkslategray: [47,79,79], darkslategrey: [47,79,79], darkturquoise: [0,206,209], darkviolet: [148,0,211], deeppink: [255,20,147], deepskyblue: [0,191,255], dimgray: [105,105,105], dimgrey: [105,105,105], dodgerblue: [30,144,255], firebrick: [178,34,34], floralwhite: [255,250,240], forestgreen: [34,139,34], fuchsia: [255,0,255], gainsboro: [220,220,220], ghostwhite: [248,248,255], gold: [255,215,0], goldenrod: [218,165,32], gray: [128,128,128], green: [0,128,0], greenyellow: [173,255,47], grey: [128,128,128], honeydew: [240,255,240], hotpink: [255,105,180], indianred: [205,92,92], indigo: [75,0,130], ivory: [255,255,240], khaki: [240,230,140], lavender: [230,230,250], lavenderblush: [255,240,245], lawngreen: [124,252,0], lemonchiffon: [255,250,205], lightblue: [173,216,230], lightcoral: [240,128,128], lightcyan: [224,255,255], lightgoldenrodyellow: [250,250,210], lightgray: [211,211,211], lightgreen: [144,238,144], lightgrey: [211,211,211], lightpink: [255,182,193], lightsalmon: [255,160,122], lightseagreen: [32,178,170], lightskyblue: [135,206,250], lightslategray: [119,136,153], lightslategrey: [119,136,153], lightsteelblue: [176,196,222], lightyellow: [255,255,224], lime: [0,255,0], limegreen: [50,205,50], linen: [250,240,230], magenta: [255,0,255], maroon: [128,0,0], mediumaquamarine: [102,205,170], mediumblue: [0,0,205], mediumorchid: [186,85,211], mediumpurple: [147,112,219], mediumseagreen: [60,179,113], mediumslateblue: [123,104,238], mediumspringgreen: [0,250,154], mediumturquoise: [72,209,204], mediumvioletred: [199,21,133], midnightblue: [25,25,112], mintcream: [245,255,250], mistyrose: [255,228,225], moccasin: [255,228,181], navajowhite: [255,222,173], navy: [0,0,128], oldlace: [253,245,230], olive: [128,128,0], olivedrab: [107,142,35], orange: [255,165,0], orangered: [255,69,0], orchid: [218,112,214], palegoldenrod: [238,232,170], palegreen: [152,251,152], paleturquoise: [175,238,238], palevioletred: [219,112,147], papayawhip: [255,239,213], peachpuff: [255,218,185], peru: [205,133,63], pink: [255,192,203], plum: [221,160,221], powderblue: [176,224,230], purple: [128,0,128], rebeccapurple: [102, 51, 153], red: [255,0,0], rosybrown: [188,143,143], royalblue: [65,105,225], saddlebrown: [139,69,19], salmon: [250,128,114], sandybrown: [244,164,96], seagreen: [46,139,87], seashell: [255,245,238], sienna: [160,82,45], silver: [192,192,192], skyblue: [135,206,235], slateblue: [106,90,205], slategray: [112,128,144], slategrey: [112,128,144], snow: [255,250,250], springgreen: [0,255,127], steelblue: [70,130,180], tan: [210,180,140], teal: [0,128,128], thistle: [216,191,216], tomato: [255,99,71], turquoise: [64,224,208], violet: [238,130,238], wheat: [245,222,179], white: [255,255,255], whitesmoke: [245,245,245], yellow: [255,255,0], yellowgreen: [154,205,50] }; var reverseKeywords = {}; for (var key in cssKeywords) { reverseKeywords[JSON.stringify(cssKeywords[key])] = key; } /***/ }), /***/ "./node_modules/color-convert/index.js": /***/ (function(module, exports, __webpack_require__) { var conversions = __webpack_require__("./node_modules/color-convert/conversions.js"); var convert = function() { return new Converter(); } for (var func in conversions) { // export Raw versions convert[func + "Raw"] = (function(func) { // accept array or plain args return function(arg) { if (typeof arg == "number") arg = Array.prototype.slice.call(arguments); return conversions[func](arg); } })(func); var pair = /(\w+)2(\w+)/.exec(func), from = pair[1], to = pair[2]; // export rgb2hsl and ["rgb"]["hsl"] convert[from] = convert[from] || {}; convert[from][to] = convert[func] = (function(func) { return function(arg) { if (typeof arg == "number") arg = Array.prototype.slice.call(arguments); var val = conversions[func](arg); if (typeof val == "string" || val === undefined) return val; // keyword for (var i = 0; i < val.length; i++) val[i] = Math.round(val[i]); return val; } })(func); } /* Converter does lazy conversion and caching */ var Converter = function() { this.convs = {}; }; /* Either get the values for a space or set the values for a space, depending on args */ Converter.prototype.routeSpace = function(space, args) { var values = args[0]; if (values === undefined) { // color.rgb() return this.getValues(space); } // color.rgb(10, 10, 10) if (typeof values == "number") { values = Array.prototype.slice.call(args); } return this.setValues(space, values); }; /* Set the values for a space, invalidating cache */ Converter.prototype.setValues = function(space, values) { this.space = space; this.convs = {}; this.convs[space] = values; return this; }; /* Get the values for a space. If there's already a conversion for the space, fetch it, otherwise compute it */ Converter.prototype.getValues = function(space) { var vals = this.convs[space]; if (!vals) { var fspace = this.space, from = this.convs[fspace]; vals = convert[fspace][space](from); this.convs[space] = vals; } return vals; }; ["rgb", "hsl", "hsv", "cmyk", "keyword"].forEach(function(space) { Converter.prototype[space] = function(vals) { return this.routeSpace(space, arguments); } }); module.exports = convert; /***/ }), /***/ "./node_modules/color-name/index.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; module.exports = { "aliceblue": [240, 248, 255], "antiquewhite": [250, 235, 215], "aqua": [0, 255, 255], "aquamarine": [127, 255, 212], "azure": [240, 255, 255], "beige": [245, 245, 220], "bisque": [255, 228, 196], "black": [0, 0, 0], "blanchedalmond": [255, 235, 205], "blue": [0, 0, 255], "blueviolet": [138, 43, 226], "brown": [165, 42, 42], "burlywood": [222, 184, 135], "cadetblue": [95, 158, 160], "chartreuse": [127, 255, 0], "chocolate": [210, 105, 30], "coral": [255, 127, 80], "cornflowerblue": [100, 149, 237], "cornsilk": [255, 248, 220], "crimson": [220, 20, 60], "cyan": [0, 255, 255], "darkblue": [0, 0, 139], "darkcyan": [0, 139, 139], "darkgoldenrod": [184, 134, 11], "darkgray": [169, 169, 169], "darkgreen": [0, 100, 0], "darkgrey": [169, 169, 169], "darkkhaki": [189, 183, 107], "darkmagenta": [139, 0, 139], "darkolivegreen": [85, 107, 47], "darkorange": [255, 140, 0], "darkorchid": [153, 50, 204], "darkred": [139, 0, 0], "darksalmon": [233, 150, 122], "darkseagreen": [143, 188, 143], "darkslateblue": [72, 61, 139], "darkslategray": [47, 79, 79], "darkslategrey": [47, 79, 79], "darkturquoise": [0, 206, 209], "darkviolet": [148, 0, 211], "deeppink": [255, 20, 147], "deepskyblue": [0, 191, 255], "dimgray": [105, 105, 105], "dimgrey": [105, 105, 105], "dodgerblue": [30, 144, 255], "firebrick": [178, 34, 34], "floralwhite": [255, 250, 240], "forestgreen": [34, 139, 34], "fuchsia": [255, 0, 255], "gainsboro": [220, 220, 220], "ghostwhite": [248, 248, 255], "gold": [255, 215, 0], "goldenrod": [218, 165, 32], "gray": [128, 128, 128], "green": [0, 128, 0], "greenyellow": [173, 255, 47], "grey": [128, 128, 128], "honeydew": [240, 255, 240], "hotpink": [255, 105, 180], "indianred": [205, 92, 92], "indigo": [75, 0, 130], "ivory": [255, 255, 240], "khaki": [240, 230, 140], "lavender": [230, 230, 250], "lavenderblush": [255, 240, 245], "lawngreen": [124, 252, 0], "lemonchiffon": [255, 250, 205], "lightblue": [173, 216, 230], "lightcoral": [240, 128, 128], "lightcyan": [224, 255, 255], "lightgoldenrodyellow": [250, 250, 210], "lightgray": [211, 211, 211], "lightgreen": [144, 238, 144], "lightgrey": [211, 211, 211], "lightpink": [255, 182, 193], "lightsalmon": [255, 160, 122], "lightseagreen": [32, 178, 170], "lightskyblue": [135, 206, 250], "lightslategray": [119, 136, 153], "lightslategrey": [119, 136, 153], "lightsteelblue": [176, 196, 222], "lightyellow": [255, 255, 224], "lime": [0, 255, 0], "limegreen": [50, 205, 50], "linen": [250, 240, 230], "magenta": [255, 0, 255], "maroon": [128, 0, 0], "mediumaquamarine": [102, 205, 170], "mediumblue": [0, 0, 205], "mediumorchid": [186, 85, 211], "mediumpurple": [147, 112, 219], "mediumseagreen": [60, 179, 113], "mediumslateblue": [123, 104, 238], "mediumspringgreen": [0, 250, 154], "mediumturquoise": [72, 209, 204], "mediumvioletred": [199, 21, 133], "midnightblue": [25, 25, 112], "mintcream": [245, 255, 250], "mistyrose": [255, 228, 225], "moccasin": [255, 228, 181], "navajowhite": [255, 222, 173], "navy": [0, 0, 128], "oldlace": [253, 245, 230], "olive": [128, 128, 0], "olivedrab": [107, 142, 35], "orange": [255, 165, 0], "orangered": [255, 69, 0], "orchid": [218, 112, 214], "palegoldenrod": [238, 232, 170], "palegreen": [152, 251, 152], "paleturquoise": [175, 238, 238], "palevioletred": [219, 112, 147], "papayawhip": [255, 239, 213], "peachpuff": [255, 218, 185], "peru": [205, 133, 63], "pink": [255, 192, 203], "plum": [221, 160, 221], "powderblue": [176, 224, 230], "purple": [128, 0, 128], "rebeccapurple": [102, 51, 153], "red": [255, 0, 0], "rosybrown": [188, 143, 143], "royalblue": [65, 105, 225], "saddlebrown": [139, 69, 19], "salmon": [250, 128, 114], "sandybrown": [244, 164, 96], "seagreen": [46, 139, 87], "seashell": [255, 245, 238], "sienna": [160, 82, 45], "silver": [192, 192, 192], "skyblue": [135, 206, 235], "slateblue": [106, 90, 205], "slategray": [112, 128, 144], "slategrey": [112, 128, 144], "snow": [255, 250, 250], "springgreen": [0, 255, 127], "steelblue": [70, 130, 180], "tan": [210, 180, 140], "teal": [0, 128, 128], "thistle": [216, 191, 216], "tomato": [255, 99, 71], "turquoise": [64, 224, 208], "violet": [238, 130, 238], "wheat": [245, 222, 179], "white": [255, 255, 255], "whitesmoke": [245, 245, 245], "yellow": [255, 255, 0], "yellowgreen": [154, 205, 50] }; /***/ }), /***/ "./node_modules/core-util-is/lib/util.js": /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(Buffer) {// Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to permit // persons to whom the Software is furnished to do so, subject to the // following conditions: // // The above copyright notice and this permission notice shall be included // in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. // NOTE: These type checking functions intentionally don't use `instanceof` // because it is fragile and can be easily faked with `Object.create()`. function isArray(arg) { if (Array.isArray) { return Array.isArray(arg); } return objectToString(arg) === '[object Array]'; } exports.isArray = isArray; function isBoolean(arg) { return typeof arg === 'boolean'; } exports.isBoolean = isBoolean; function isNull(arg) { return arg === null; } exports.isNull = isNull; function isNullOrUndefined(arg) { return arg == null; } exports.isNullOrUndefined = isNullOrUndefined; function isNumber(arg) { return typeof arg === 'number'; } exports.isNumber = isNumber; function isString(arg) { return typeof arg === 'string'; } exports.isString = isString; function isSymbol(arg) { return typeof arg === 'symbol'; } exports.isSymbol = isSymbol; function isUndefined(arg) { return arg === void 0; } exports.isUndefined = isUndefined; function isRegExp(re) { return objectToString(re) === '[object RegExp]'; } exports.isRegExp = isRegExp; function isObject(arg) { return typeof arg === 'object' && arg !== null; } exports.isObject = isObject; function isDate(d) { return objectToString(d) === '[object Date]'; } exports.isDate = isDate; function isError(e) { return (objectToString(e) === '[object Error]' || e instanceof Error); } exports.isError = isError; function isFunction(arg) { return typeof arg === 'function'; } exports.isFunction = isFunction; function isPrimitive(arg) { return arg === null || typeof arg === 'boolean' || typeof arg === 'number' || typeof arg === 'string' || typeof arg === 'symbol' || // ES6 symbol typeof arg === 'undefined'; } exports.isPrimitive = isPrimitive; exports.isBuffer = Buffer.isBuffer; function objectToString(o) { return Object.prototype.toString.call(o); } /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__("./node_modules/buffer/index.js").Buffer)) /***/ }), /***/ "./node_modules/d3-array/index.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__src_bisect__ = __webpack_require__("./node_modules/d3-array/src/bisect.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "bisect", function() { return __WEBPACK_IMPORTED_MODULE_0__src_bisect__["c"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "bisectRight", function() { return __WEBPACK_IMPORTED_MODULE_0__src_bisect__["b"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "bisectLeft", function() { return __WEBPACK_IMPORTED_MODULE_0__src_bisect__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__src_ascending__ = __webpack_require__("./node_modules/d3-array/src/ascending.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "ascending", function() { return __WEBPACK_IMPORTED_MODULE_1__src_ascending__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__src_bisector__ = __webpack_require__("./node_modules/d3-array/src/bisector.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "bisector", function() { return __WEBPACK_IMPORTED_MODULE_2__src_bisector__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__src_cross__ = __webpack_require__("./node_modules/d3-array/src/cross.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "cross", function() { return __WEBPACK_IMPORTED_MODULE_3__src_cross__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__src_descending__ = __webpack_require__("./node_modules/d3-array/src/descending.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "descending", function() { return __WEBPACK_IMPORTED_MODULE_4__src_descending__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__src_deviation__ = __webpack_require__("./node_modules/d3-array/src/deviation.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "deviation", function() { return __WEBPACK_IMPORTED_MODULE_5__src_deviation__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__src_extent__ = __webpack_require__("./node_modules/d3-array/src/extent.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "extent", function() { return __WEBPACK_IMPORTED_MODULE_6__src_extent__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__src_histogram__ = __webpack_require__("./node_modules/d3-array/src/histogram.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "histogram", function() { return __WEBPACK_IMPORTED_MODULE_7__src_histogram__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__src_threshold_freedmanDiaconis__ = __webpack_require__("./node_modules/d3-array/src/threshold/freedmanDiaconis.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "thresholdFreedmanDiaconis", function() { return __WEBPACK_IMPORTED_MODULE_8__src_threshold_freedmanDiaconis__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__src_threshold_scott__ = __webpack_require__("./node_modules/d3-array/src/threshold/scott.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "thresholdScott", function() { return __WEBPACK_IMPORTED_MODULE_9__src_threshold_scott__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__src_threshold_sturges__ = __webpack_require__("./node_modules/d3-array/src/threshold/sturges.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "thresholdSturges", function() { return __WEBPACK_IMPORTED_MODULE_10__src_threshold_sturges__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__src_max__ = __webpack_require__("./node_modules/d3-array/src/max.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "max", function() { return __WEBPACK_IMPORTED_MODULE_11__src_max__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__src_mean__ = __webpack_require__("./node_modules/d3-array/src/mean.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "mean", function() { return __WEBPACK_IMPORTED_MODULE_12__src_mean__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__src_median__ = __webpack_require__("./node_modules/d3-array/src/median.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "median", function() { return __WEBPACK_IMPORTED_MODULE_13__src_median__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__src_merge__ = __webpack_require__("./node_modules/d3-array/src/merge.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "merge", function() { return __WEBPACK_IMPORTED_MODULE_14__src_merge__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__src_min__ = __webpack_require__("./node_modules/d3-array/src/min.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "min", function() { return __WEBPACK_IMPORTED_MODULE_15__src_min__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__src_pairs__ = __webpack_require__("./node_modules/d3-array/src/pairs.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "pairs", function() { return __WEBPACK_IMPORTED_MODULE_16__src_pairs__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_17__src_permute__ = __webpack_require__("./node_modules/d3-array/src/permute.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "permute", function() { return __WEBPACK_IMPORTED_MODULE_17__src_permute__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_18__src_quantile__ = __webpack_require__("./node_modules/d3-array/src/quantile.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "quantile", function() { return __WEBPACK_IMPORTED_MODULE_18__src_quantile__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_19__src_range__ = __webpack_require__("./node_modules/d3-array/src/range.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "range", function() { return __WEBPACK_IMPORTED_MODULE_19__src_range__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_20__src_scan__ = __webpack_require__("./node_modules/d3-array/src/scan.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "scan", function() { return __WEBPACK_IMPORTED_MODULE_20__src_scan__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_21__src_shuffle__ = __webpack_require__("./node_modules/d3-array/src/shuffle.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "shuffle", function() { return __WEBPACK_IMPORTED_MODULE_21__src_shuffle__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_22__src_sum__ = __webpack_require__("./node_modules/d3-array/src/sum.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "sum", function() { return __WEBPACK_IMPORTED_MODULE_22__src_sum__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_23__src_ticks__ = __webpack_require__("./node_modules/d3-array/src/ticks.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "ticks", function() { return __WEBPACK_IMPORTED_MODULE_23__src_ticks__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "tickIncrement", function() { return __WEBPACK_IMPORTED_MODULE_23__src_ticks__["b"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "tickStep", function() { return __WEBPACK_IMPORTED_MODULE_23__src_ticks__["c"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_24__src_transpose__ = __webpack_require__("./node_modules/d3-array/src/transpose.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "transpose", function() { return __WEBPACK_IMPORTED_MODULE_24__src_transpose__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_25__src_variance__ = __webpack_require__("./node_modules/d3-array/src/variance.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "variance", function() { return __WEBPACK_IMPORTED_MODULE_25__src_variance__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_26__src_zip__ = __webpack_require__("./node_modules/d3-array/src/zip.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "zip", function() { return __WEBPACK_IMPORTED_MODULE_26__src_zip__["a"]; }); /***/ }), /***/ "./node_modules/d3-array/src/array.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return slice; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return map; }); var array = Array.prototype; var slice = array.slice; var map = array.map; /***/ }), /***/ "./node_modules/d3-array/src/ascending.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony default export */ __webpack_exports__["a"] = (function(a, b) { return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN; }); /***/ }), /***/ "./node_modules/d3-array/src/bisect.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return bisectRight; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return bisectLeft; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__ascending__ = __webpack_require__("./node_modules/d3-array/src/ascending.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__bisector__ = __webpack_require__("./node_modules/d3-array/src/bisector.js"); var ascendingBisect = Object(__WEBPACK_IMPORTED_MODULE_1__bisector__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_0__ascending__["a" /* default */]); var bisectRight = ascendingBisect.right; var bisectLeft = ascendingBisect.left; /* harmony default export */ __webpack_exports__["c"] = (bisectRight); /***/ }), /***/ "./node_modules/d3-array/src/bisector.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__ascending__ = __webpack_require__("./node_modules/d3-array/src/ascending.js"); /* harmony default export */ __webpack_exports__["a"] = (function(compare) { if (compare.length === 1) compare = ascendingComparator(compare); return { left: function(a, x, lo, hi) { if (lo == null) lo = 0; if (hi == null) hi = a.length; while (lo < hi) { var mid = lo + hi >>> 1; if (compare(a[mid], x) < 0) lo = mid + 1; else hi = mid; } return lo; }, right: function(a, x, lo, hi) { if (lo == null) lo = 0; if (hi == null) hi = a.length; while (lo < hi) { var mid = lo + hi >>> 1; if (compare(a[mid], x) > 0) hi = mid; else lo = mid + 1; } return lo; } }; }); function ascendingComparator(f) { return function(d, x) { return Object(__WEBPACK_IMPORTED_MODULE_0__ascending__["a" /* default */])(f(d), x); }; } /***/ }), /***/ "./node_modules/d3-array/src/constant.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony default export */ __webpack_exports__["a"] = (function(x) { return function() { return x; }; }); /***/ }), /***/ "./node_modules/d3-array/src/cross.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__pairs__ = __webpack_require__("./node_modules/d3-array/src/pairs.js"); /* harmony default export */ __webpack_exports__["a"] = (function(values0, values1, reduce) { var n0 = values0.length, n1 = values1.length, values = new Array(n0 * n1), i0, i1, i, value0; if (reduce == null) reduce = __WEBPACK_IMPORTED_MODULE_0__pairs__["b" /* pair */]; for (i0 = i = 0; i0 < n0; ++i0) { for (value0 = values0[i0], i1 = 0; i1 < n1; ++i1, ++i) { values[i] = reduce(value0, values1[i1]); } } return values; }); /***/ }), /***/ "./node_modules/d3-array/src/descending.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony default export */ __webpack_exports__["a"] = (function(a, b) { return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN; }); /***/ }), /***/ "./node_modules/d3-array/src/deviation.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__variance__ = __webpack_require__("./node_modules/d3-array/src/variance.js"); /* harmony default export */ __webpack_exports__["a"] = (function(array, f) { var v = Object(__WEBPACK_IMPORTED_MODULE_0__variance__["a" /* default */])(array, f); return v ? Math.sqrt(v) : v; }); /***/ }), /***/ "./node_modules/d3-array/src/extent.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony default export */ __webpack_exports__["a"] = (function(values, valueof) { var n = values.length, i = -1, value, min, max; if (valueof == null) { while (++i < n) { // Find the first comparable value. if ((value = values[i]) != null && value >= value) { min = max = value; while (++i < n) { // Compare the remaining values. if ((value = values[i]) != null) { if (min > value) min = value; if (max < value) max = value; } } } } } else { while (++i < n) { // Find the first comparable value. if ((value = valueof(values[i], i, values)) != null && value >= value) { min = max = value; while (++i < n) { // Compare the remaining values. if ((value = valueof(values[i], i, values)) != null) { if (min > value) min = value; if (max < value) max = value; } } } } } return [min, max]; }); /***/ }), /***/ "./node_modules/d3-array/src/histogram.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__array__ = __webpack_require__("./node_modules/d3-array/src/array.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__bisect__ = __webpack_require__("./node_modules/d3-array/src/bisect.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__constant__ = __webpack_require__("./node_modules/d3-array/src/constant.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__extent__ = __webpack_require__("./node_modules/d3-array/src/extent.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__identity__ = __webpack_require__("./node_modules/d3-array/src/identity.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__range__ = __webpack_require__("./node_modules/d3-array/src/range.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__ticks__ = __webpack_require__("./node_modules/d3-array/src/ticks.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__threshold_sturges__ = __webpack_require__("./node_modules/d3-array/src/threshold/sturges.js"); /* harmony default export */ __webpack_exports__["a"] = (function() { var value = __WEBPACK_IMPORTED_MODULE_4__identity__["a" /* default */], domain = __WEBPACK_IMPORTED_MODULE_3__extent__["a" /* default */], threshold = __WEBPACK_IMPORTED_MODULE_7__threshold_sturges__["a" /* default */]; function histogram(data) { var i, n = data.length, x, values = new Array(n); for (i = 0; i < n; ++i) { values[i] = value(data[i], i, data); } var xz = domain(values), x0 = xz[0], x1 = xz[1], tz = threshold(values, x0, x1); // Convert number of thresholds into uniform thresholds. if (!Array.isArray(tz)) { tz = Object(__WEBPACK_IMPORTED_MODULE_6__ticks__["c" /* tickStep */])(x0, x1, tz); tz = Object(__WEBPACK_IMPORTED_MODULE_5__range__["a" /* default */])(Math.ceil(x0 / tz) * tz, Math.floor(x1 / tz) * tz, tz); // exclusive } // Remove any thresholds outside the domain. var m = tz.length; while (tz[0] <= x0) tz.shift(), --m; while (tz[m - 1] > x1) tz.pop(), --m; var bins = new Array(m + 1), bin; // Initialize bins. for (i = 0; i <= m; ++i) { bin = bins[i] = []; bin.x0 = i > 0 ? tz[i - 1] : x0; bin.x1 = i < m ? tz[i] : x1; } // Assign data to bins by value, ignoring any outside the domain. for (i = 0; i < n; ++i) { x = values[i]; if (x0 <= x && x <= x1) { bins[Object(__WEBPACK_IMPORTED_MODULE_1__bisect__["c" /* default */])(tz, x, 0, m)].push(data[i]); } } return bins; } histogram.value = function(_) { return arguments.length ? (value = typeof _ === "function" ? _ : Object(__WEBPACK_IMPORTED_MODULE_2__constant__["a" /* default */])(_), histogram) : value; }; histogram.domain = function(_) { return arguments.length ? (domain = typeof _ === "function" ? _ : Object(__WEBPACK_IMPORTED_MODULE_2__constant__["a" /* default */])([_[0], _[1]]), histogram) : domain; }; histogram.thresholds = function(_) { return arguments.length ? (threshold = typeof _ === "function" ? _ : Array.isArray(_) ? Object(__WEBPACK_IMPORTED_MODULE_2__constant__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_0__array__["b" /* slice */].call(_)) : Object(__WEBPACK_IMPORTED_MODULE_2__constant__["a" /* default */])(_), histogram) : threshold; }; return histogram; }); /***/ }), /***/ "./node_modules/d3-array/src/identity.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony default export */ __webpack_exports__["a"] = (function(x) { return x; }); /***/ }), /***/ "./node_modules/d3-array/src/max.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony default export */ __webpack_exports__["a"] = (function(values, valueof) { var n = values.length, i = -1, value, max; if (valueof == null) { while (++i < n) { // Find the first comparable value. if ((value = values[i]) != null && value >= value) { max = value; while (++i < n) { // Compare the remaining values. if ((value = values[i]) != null && value > max) { max = value; } } } } } else { while (++i < n) { // Find the first comparable value. if ((value = valueof(values[i], i, values)) != null && value >= value) { max = value; while (++i < n) { // Compare the remaining values. if ((value = valueof(values[i], i, values)) != null && value > max) { max = value; } } } } } return max; }); /***/ }), /***/ "./node_modules/d3-array/src/mean.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__number__ = __webpack_require__("./node_modules/d3-array/src/number.js"); /* harmony default export */ __webpack_exports__["a"] = (function(values, valueof) { var n = values.length, m = n, i = -1, value, sum = 0; if (valueof == null) { while (++i < n) { if (!isNaN(value = Object(__WEBPACK_IMPORTED_MODULE_0__number__["a" /* default */])(values[i]))) sum += value; else --m; } } else { while (++i < n) { if (!isNaN(value = Object(__WEBPACK_IMPORTED_MODULE_0__number__["a" /* default */])(valueof(values[i], i, values)))) sum += value; else --m; } } if (m) return sum / m; }); /***/ }), /***/ "./node_modules/d3-array/src/median.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__ascending__ = __webpack_require__("./node_modules/d3-array/src/ascending.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__number__ = __webpack_require__("./node_modules/d3-array/src/number.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__quantile__ = __webpack_require__("./node_modules/d3-array/src/quantile.js"); /* harmony default export */ __webpack_exports__["a"] = (function(values, valueof) { var n = values.length, i = -1, value, numbers = []; if (valueof == null) { while (++i < n) { if (!isNaN(value = Object(__WEBPACK_IMPORTED_MODULE_1__number__["a" /* default */])(values[i]))) { numbers.push(value); } } } else { while (++i < n) { if (!isNaN(value = Object(__WEBPACK_IMPORTED_MODULE_1__number__["a" /* default */])(valueof(values[i], i, values)))) { numbers.push(value); } } } return Object(__WEBPACK_IMPORTED_MODULE_2__quantile__["a" /* default */])(numbers.sort(__WEBPACK_IMPORTED_MODULE_0__ascending__["a" /* default */]), 0.5); }); /***/ }), /***/ "./node_modules/d3-array/src/merge.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony default export */ __webpack_exports__["a"] = (function(arrays) { var n = arrays.length, m, i = -1, j = 0, merged, array; while (++i < n) j += arrays[i].length; merged = new Array(j); while (--n >= 0) { array = arrays[n]; m = array.length; while (--m >= 0) { merged[--j] = array[m]; } } return merged; }); /***/ }), /***/ "./node_modules/d3-array/src/min.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony default export */ __webpack_exports__["a"] = (function(values, valueof) { var n = values.length, i = -1, value, min; if (valueof == null) { while (++i < n) { // Find the first comparable value. if ((value = values[i]) != null && value >= value) { min = value; while (++i < n) { // Compare the remaining values. if ((value = values[i]) != null && min > value) { min = value; } } } } } else { while (++i < n) { // Find the first comparable value. if ((value = valueof(values[i], i, values)) != null && value >= value) { min = value; while (++i < n) { // Compare the remaining values. if ((value = valueof(values[i], i, values)) != null && min > value) { min = value; } } } } } return min; }); /***/ }), /***/ "./node_modules/d3-array/src/number.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony default export */ __webpack_exports__["a"] = (function(x) { return x === null ? NaN : +x; }); /***/ }), /***/ "./node_modules/d3-array/src/pairs.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["b"] = pair; /* harmony default export */ __webpack_exports__["a"] = (function(array, f) { if (f == null) f = pair; var i = 0, n = array.length - 1, p = array[0], pairs = new Array(n < 0 ? 0 : n); while (i < n) pairs[i] = f(p, p = array[++i]); return pairs; }); function pair(a, b) { return [a, b]; } /***/ }), /***/ "./node_modules/d3-array/src/permute.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony default export */ __webpack_exports__["a"] = (function(array, indexes) { var i = indexes.length, permutes = new Array(i); while (i--) permutes[i] = array[indexes[i]]; return permutes; }); /***/ }), /***/ "./node_modules/d3-array/src/quantile.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__number__ = __webpack_require__("./node_modules/d3-array/src/number.js"); /* harmony default export */ __webpack_exports__["a"] = (function(values, p, valueof) { if (valueof == null) valueof = __WEBPACK_IMPORTED_MODULE_0__number__["a" /* default */]; if (!(n = values.length)) return; if ((p = +p) <= 0 || n < 2) return +valueof(values[0], 0, values); if (p >= 1) return +valueof(values[n - 1], n - 1, values); var n, i = (n - 1) * p, i0 = Math.floor(i), value0 = +valueof(values[i0], i0, values), value1 = +valueof(values[i0 + 1], i0 + 1, values); return value0 + (value1 - value0) * (i - i0); }); /***/ }), /***/ "./node_modules/d3-array/src/range.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony default export */ __webpack_exports__["a"] = (function(start, stop, step) { start = +start, stop = +stop, step = (n = arguments.length) < 2 ? (stop = start, start = 0, 1) : n < 3 ? 1 : +step; var i = -1, n = Math.max(0, Math.ceil((stop - start) / step)) | 0, range = new Array(n); while (++i < n) { range[i] = start + i * step; } return range; }); /***/ }), /***/ "./node_modules/d3-array/src/scan.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__ascending__ = __webpack_require__("./node_modules/d3-array/src/ascending.js"); /* harmony default export */ __webpack_exports__["a"] = (function(values, compare) { if (!(n = values.length)) return; var n, i = 0, j = 0, xi, xj = values[j]; if (compare == null) compare = __WEBPACK_IMPORTED_MODULE_0__ascending__["a" /* default */]; while (++i < n) { if (compare(xi = values[i], xj) < 0 || compare(xj, xj) !== 0) { xj = xi, j = i; } } if (compare(xj, xj) === 0) return j; }); /***/ }), /***/ "./node_modules/d3-array/src/shuffle.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony default export */ __webpack_exports__["a"] = (function(array, i0, i1) { var m = (i1 == null ? array.length : i1) - (i0 = i0 == null ? 0 : +i0), t, i; while (m) { i = Math.random() * m-- | 0; t = array[m + i0]; array[m + i0] = array[i + i0]; array[i + i0] = t; } return array; }); /***/ }), /***/ "./node_modules/d3-array/src/sum.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony default export */ __webpack_exports__["a"] = (function(values, valueof) { var n = values.length, i = -1, value, sum = 0; if (valueof == null) { while (++i < n) { if (value = +values[i]) sum += value; // Note: zero and null are equivalent. } } else { while (++i < n) { if (value = +valueof(values[i], i, values)) sum += value; } } return sum; }); /***/ }), /***/ "./node_modules/d3-array/src/threshold/freedmanDiaconis.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__array__ = __webpack_require__("./node_modules/d3-array/src/array.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__ascending__ = __webpack_require__("./node_modules/d3-array/src/ascending.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__number__ = __webpack_require__("./node_modules/d3-array/src/number.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__quantile__ = __webpack_require__("./node_modules/d3-array/src/quantile.js"); /* harmony default export */ __webpack_exports__["a"] = (function(values, min, max) { values = __WEBPACK_IMPORTED_MODULE_0__array__["a" /* map */].call(values, __WEBPACK_IMPORTED_MODULE_2__number__["a" /* default */]).sort(__WEBPACK_IMPORTED_MODULE_1__ascending__["a" /* default */]); return Math.ceil((max - min) / (2 * (Object(__WEBPACK_IMPORTED_MODULE_3__quantile__["a" /* default */])(values, 0.75) - Object(__WEBPACK_IMPORTED_MODULE_3__quantile__["a" /* default */])(values, 0.25)) * Math.pow(values.length, -1 / 3))); }); /***/ }), /***/ "./node_modules/d3-array/src/threshold/scott.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__deviation__ = __webpack_require__("./node_modules/d3-array/src/deviation.js"); /* harmony default export */ __webpack_exports__["a"] = (function(values, min, max) { return Math.ceil((max - min) / (3.5 * Object(__WEBPACK_IMPORTED_MODULE_0__deviation__["a" /* default */])(values) * Math.pow(values.length, -1 / 3))); }); /***/ }), /***/ "./node_modules/d3-array/src/threshold/sturges.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony default export */ __webpack_exports__["a"] = (function(values) { return Math.ceil(Math.log(values.length) / Math.LN2) + 1; }); /***/ }), /***/ "./node_modules/d3-array/src/ticks.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["b"] = tickIncrement; /* harmony export (immutable) */ __webpack_exports__["c"] = tickStep; var e10 = Math.sqrt(50), e5 = Math.sqrt(10), e2 = Math.sqrt(2); /* harmony default export */ __webpack_exports__["a"] = (function(start, stop, count) { var reverse, i = -1, n, ticks, step; stop = +stop, start = +start, count = +count; if (start === stop && count > 0) return [start]; if (reverse = stop < start) n = start, start = stop, stop = n; if ((step = tickIncrement(start, stop, count)) === 0 || !isFinite(step)) return []; if (step > 0) { start = Math.ceil(start / step); stop = Math.floor(stop / step); ticks = new Array(n = Math.ceil(stop - start + 1)); while (++i < n) ticks[i] = (start + i) * step; } else { start = Math.floor(start * step); stop = Math.ceil(stop * step); ticks = new Array(n = Math.ceil(start - stop + 1)); while (++i < n) ticks[i] = (start - i) / step; } if (reverse) ticks.reverse(); return ticks; }); function tickIncrement(start, stop, count) { var step = (stop - start) / Math.max(0, count), power = Math.floor(Math.log(step) / Math.LN10), error = step / Math.pow(10, power); return power >= 0 ? (error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1) * Math.pow(10, power) : -Math.pow(10, -power) / (error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1); } function tickStep(start, stop, count) { var step0 = Math.abs(stop - start) / Math.max(0, count), step1 = Math.pow(10, Math.floor(Math.log(step0) / Math.LN10)), error = step0 / step1; if (error >= e10) step1 *= 10; else if (error >= e5) step1 *= 5; else if (error >= e2) step1 *= 2; return stop < start ? -step1 : step1; } /***/ }), /***/ "./node_modules/d3-array/src/transpose.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__min__ = __webpack_require__("./node_modules/d3-array/src/min.js"); /* harmony default export */ __webpack_exports__["a"] = (function(matrix) { if (!(n = matrix.length)) return []; for (var i = -1, m = Object(__WEBPACK_IMPORTED_MODULE_0__min__["a" /* default */])(matrix, length), transpose = new Array(m); ++i < m;) { for (var j = -1, n, row = transpose[i] = new Array(n); ++j < n;) { row[j] = matrix[j][i]; } } return transpose; }); function length(d) { return d.length; } /***/ }), /***/ "./node_modules/d3-array/src/variance.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__number__ = __webpack_require__("./node_modules/d3-array/src/number.js"); /* harmony default export */ __webpack_exports__["a"] = (function(values, valueof) { var n = values.length, m = 0, i = -1, mean = 0, value, delta, sum = 0; if (valueof == null) { while (++i < n) { if (!isNaN(value = Object(__WEBPACK_IMPORTED_MODULE_0__number__["a" /* default */])(values[i]))) { delta = value - mean; mean += delta / ++m; sum += delta * (value - mean); } } } else { while (++i < n) { if (!isNaN(value = Object(__WEBPACK_IMPORTED_MODULE_0__number__["a" /* default */])(valueof(values[i], i, values)))) { delta = value - mean; mean += delta / ++m; sum += delta * (value - mean); } } } if (m > 1) return sum / (m - 1); }); /***/ }), /***/ "./node_modules/d3-array/src/zip.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__transpose__ = __webpack_require__("./node_modules/d3-array/src/transpose.js"); /* harmony default export */ __webpack_exports__["a"] = (function() { return Object(__WEBPACK_IMPORTED_MODULE_0__transpose__["a" /* default */])(arguments); }); /***/ }), /***/ "./node_modules/d3-brush/index.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__src_brush__ = __webpack_require__("./node_modules/d3-brush/src/brush.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "brush", function() { return __WEBPACK_IMPORTED_MODULE_0__src_brush__["d"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "brushX", function() { return __WEBPACK_IMPORTED_MODULE_0__src_brush__["b"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "brushY", function() { return __WEBPACK_IMPORTED_MODULE_0__src_brush__["c"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "brushSelection", function() { return __WEBPACK_IMPORTED_MODULE_0__src_brush__["a"]; }); /***/ }), /***/ "./node_modules/d3-brush/src/brush.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = brushSelection; /* harmony export (immutable) */ __webpack_exports__["b"] = brushX; /* harmony export (immutable) */ __webpack_exports__["c"] = brushY; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_d3_dispatch__ = __webpack_require__("./node_modules/d3-dispatch/index.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_d3_drag__ = __webpack_require__("./node_modules/d3-drag/index.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_d3_interpolate__ = __webpack_require__("./node_modules/d3-interpolate/index.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_d3_selection__ = __webpack_require__("./node_modules/d3-selection/index.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_d3_transition__ = __webpack_require__("./node_modules/d3-transition/index.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__constant__ = __webpack_require__("./node_modules/d3-brush/src/constant.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__event__ = __webpack_require__("./node_modules/d3-brush/src/event.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__noevent__ = __webpack_require__("./node_modules/d3-brush/src/noevent.js"); var MODE_DRAG = {name: "drag"}, MODE_SPACE = {name: "space"}, MODE_HANDLE = {name: "handle"}, MODE_CENTER = {name: "center"}; var X = { name: "x", handles: ["e", "w"].map(type), input: function(x, e) { return x && [[x[0], e[0][1]], [x[1], e[1][1]]]; }, output: function(xy) { return xy && [xy[0][0], xy[1][0]]; } }; var Y = { name: "y", handles: ["n", "s"].map(type), input: function(y, e) { return y && [[e[0][0], y[0]], [e[1][0], y[1]]]; }, output: function(xy) { return xy && [xy[0][1], xy[1][1]]; } }; var XY = { name: "xy", handles: ["n", "e", "s", "w", "nw", "ne", "se", "sw"].map(type), input: function(xy) { return xy; }, output: function(xy) { return xy; } }; var cursors = { overlay: "crosshair", selection: "move", n: "ns-resize", e: "ew-resize", s: "ns-resize", w: "ew-resize", nw: "nwse-resize", ne: "nesw-resize", se: "nwse-resize", sw: "nesw-resize" }; var flipX = { e: "w", w: "e", nw: "ne", ne: "nw", se: "sw", sw: "se" }; var flipY = { n: "s", s: "n", nw: "sw", ne: "se", se: "ne", sw: "nw" }; var signsX = { overlay: +1, selection: +1, n: null, e: +1, s: null, w: -1, nw: -1, ne: +1, se: +1, sw: -1 }; var signsY = { overlay: +1, selection: +1, n: -1, e: null, s: +1, w: null, nw: -1, ne: -1, se: +1, sw: +1 }; function type(t) { return {type: t}; } // Ignore right-click, since that should open the context menu. function defaultFilter() { return !__WEBPACK_IMPORTED_MODULE_3_d3_selection__["event"].button; } function defaultExtent() { var svg = this.ownerSVGElement || this; return [[0, 0], [svg.width.baseVal.value, svg.height.baseVal.value]]; } // Like d3.local, but with the name “__brush” rather than auto-generated. function local(node) { while (!node.__brush) if (!(node = node.parentNode)) return; return node.__brush; } function empty(extent) { return extent[0][0] === extent[1][0] || extent[0][1] === extent[1][1]; } function brushSelection(node) { var state = node.__brush; return state ? state.dim.output(state.selection) : null; } function brushX() { return brush(X); } function brushY() { return brush(Y); } /* harmony default export */ __webpack_exports__["d"] = (function() { return brush(XY); }); function brush(dim) { var extent = defaultExtent, filter = defaultFilter, listeners = Object(__WEBPACK_IMPORTED_MODULE_0_d3_dispatch__["a" /* dispatch */])(brush, "start", "brush", "end"), handleSize = 6, touchending; function brush(group) { var overlay = group .property("__brush", initialize) .selectAll(".overlay") .data([type("overlay")]); overlay.enter().append("rect") .attr("class", "overlay") .attr("pointer-events", "all") .attr("cursor", cursors.overlay) .merge(overlay) .each(function() { var extent = local(this).extent; Object(__WEBPACK_IMPORTED_MODULE_3_d3_selection__["select"])(this) .attr("x", extent[0][0]) .attr("y", extent[0][1]) .attr("width", extent[1][0] - extent[0][0]) .attr("height", extent[1][1] - extent[0][1]); }); group.selectAll(".selection") .data([type("selection")]) .enter().append("rect") .attr("class", "selection") .attr("cursor", cursors.selection) .attr("fill", "#777") .attr("fill-opacity", 0.3) .attr("stroke", "#fff") .attr("shape-rendering", "crispEdges"); var handle = group.selectAll(".handle") .data(dim.handles, function(d) { return d.type; }); handle.exit().remove(); handle.enter().append("rect") .attr("class", function(d) { return "handle handle--" + d.type; }) .attr("cursor", function(d) { return cursors[d.type]; }); group .each(redraw) .attr("fill", "none") .attr("pointer-events", "all") .style("-webkit-tap-highlight-color", "rgba(0,0,0,0)") .on("mousedown.brush touchstart.brush", started); } brush.move = function(group, selection) { if (group.selection) { group .on("start.brush", function() { emitter(this, arguments).beforestart().start(); }) .on("interrupt.brush end.brush", function() { emitter(this, arguments).end(); }) .tween("brush", function() { var that = this, state = that.__brush, emit = emitter(that, arguments), selection0 = state.selection, selection1 = dim.input(typeof selection === "function" ? selection.apply(this, arguments) : selection, state.extent), i = Object(__WEBPACK_IMPORTED_MODULE_2_d3_interpolate__["interpolate"])(selection0, selection1); function tween(t) { state.selection = t === 1 && empty(selection1) ? null : i(t); redraw.call(that); emit.brush(); } return selection0 && selection1 ? tween : tween(1); }); } else { group .each(function() { var that = this, args = arguments, state = that.__brush, selection1 = dim.input(typeof selection === "function" ? selection.apply(that, args) : selection, state.extent), emit = emitter(that, args).beforestart(); Object(__WEBPACK_IMPORTED_MODULE_4_d3_transition__["a" /* interrupt */])(that); state.selection = selection1 == null || empty(selection1) ? null : selection1; redraw.call(that); emit.start().brush().end(); }); } }; function redraw() { var group = Object(__WEBPACK_IMPORTED_MODULE_3_d3_selection__["select"])(this), selection = local(this).selection; if (selection) { group.selectAll(".selection") .style("display", null) .attr("x", selection[0][0]) .attr("y", selection[0][1]) .attr("width", selection[1][0] - selection[0][0]) .attr("height", selection[1][1] - selection[0][1]); group.selectAll(".handle") .style("display", null) .attr("x", function(d) { return d.type[d.type.length - 1] === "e" ? selection[1][0] - handleSize / 2 : selection[0][0] - handleSize / 2; }) .attr("y", function(d) { return d.type[0] === "s" ? selection[1][1] - handleSize / 2 : selection[0][1] - handleSize / 2; }) .attr("width", function(d) { return d.type === "n" || d.type === "s" ? selection[1][0] - selection[0][0] + handleSize : handleSize; }) .attr("height", function(d) { return d.type === "e" || d.type === "w" ? selection[1][1] - selection[0][1] + handleSize : handleSize; }); } else { group.selectAll(".selection,.handle") .style("display", "none") .attr("x", null) .attr("y", null) .attr("width", null) .attr("height", null); } } function emitter(that, args) { return that.__brush.emitter || new Emitter(that, args); } function Emitter(that, args) { this.that = that; this.args = args; this.state = that.__brush; this.active = 0; } Emitter.prototype = { beforestart: function() { if (++this.active === 1) this.state.emitter = this, this.starting = true; return this; }, start: function() { if (this.starting) this.starting = false, this.emit("start"); return this; }, brush: function() { this.emit("brush"); return this; }, end: function() { if (--this.active === 0) delete this.state.emitter, this.emit("end"); return this; }, emit: function(type) { Object(__WEBPACK_IMPORTED_MODULE_3_d3_selection__["customEvent"])(new __WEBPACK_IMPORTED_MODULE_6__event__["a" /* default */](brush, type, dim.output(this.state.selection)), listeners.apply, listeners, [type, this.that, this.args]); } }; function started() { if (__WEBPACK_IMPORTED_MODULE_3_d3_selection__["event"].touches) { if (__WEBPACK_IMPORTED_MODULE_3_d3_selection__["event"].changedTouches.length < __WEBPACK_IMPORTED_MODULE_3_d3_selection__["event"].touches.length) return Object(__WEBPACK_IMPORTED_MODULE_7__noevent__["a" /* default */])(); } else if (touchending) return; if (!filter.apply(this, arguments)) return; var that = this, type = __WEBPACK_IMPORTED_MODULE_3_d3_selection__["event"].target.__data__.type, mode = (__WEBPACK_IMPORTED_MODULE_3_d3_selection__["event"].metaKey ? type = "overlay" : type) === "selection" ? MODE_DRAG : (__WEBPACK_IMPORTED_MODULE_3_d3_selection__["event"].altKey ? MODE_CENTER : MODE_HANDLE), signX = dim === Y ? null : signsX[type], signY = dim === X ? null : signsY[type], state = local(that), extent = state.extent, selection = state.selection, W = extent[0][0], w0, w1, N = extent[0][1], n0, n1, E = extent[1][0], e0, e1, S = extent[1][1], s0, s1, dx, dy, moving, shifting = signX && signY && __WEBPACK_IMPORTED_MODULE_3_d3_selection__["event"].shiftKey, lockX, lockY, point0 = Object(__WEBPACK_IMPORTED_MODULE_3_d3_selection__["mouse"])(that), point = point0, emit = emitter(that, arguments).beforestart(); if (type === "overlay") { state.selection = selection = [ [w0 = dim === Y ? W : point0[0], n0 = dim === X ? N : point0[1]], [e0 = dim === Y ? E : w0, s0 = dim === X ? S : n0] ]; } else { w0 = selection[0][0]; n0 = selection[0][1]; e0 = selection[1][0]; s0 = selection[1][1]; } w1 = w0; n1 = n0; e1 = e0; s1 = s0; var group = Object(__WEBPACK_IMPORTED_MODULE_3_d3_selection__["select"])(that) .attr("pointer-events", "none"); var overlay = group.selectAll(".overlay") .attr("cursor", cursors[type]); if (__WEBPACK_IMPORTED_MODULE_3_d3_selection__["event"].touches) { group .on("touchmove.brush", moved, true) .on("touchend.brush touchcancel.brush", ended, true); } else { var view = Object(__WEBPACK_IMPORTED_MODULE_3_d3_selection__["select"])(__WEBPACK_IMPORTED_MODULE_3_d3_selection__["event"].view) .on("keydown.brush", keydowned, true) .on("keyup.brush", keyupped, true) .on("mousemove.brush", moved, true) .on("mouseup.brush", ended, true); Object(__WEBPACK_IMPORTED_MODULE_1_d3_drag__["a" /* dragDisable */])(__WEBPACK_IMPORTED_MODULE_3_d3_selection__["event"].view); } Object(__WEBPACK_IMPORTED_MODULE_7__noevent__["b" /* nopropagation */])(); Object(__WEBPACK_IMPORTED_MODULE_4_d3_transition__["a" /* interrupt */])(that); redraw.call(that); emit.start(); function moved() { var point1 = Object(__WEBPACK_IMPORTED_MODULE_3_d3_selection__["mouse"])(that); if (shifting && !lockX && !lockY) { if (Math.abs(point1[0] - point[0]) > Math.abs(point1[1] - point[1])) lockY = true; else lockX = true; } point = point1; moving = true; Object(__WEBPACK_IMPORTED_MODULE_7__noevent__["a" /* default */])(); move(); } function move() { var t; dx = point[0] - point0[0]; dy = point[1] - point0[1]; switch (mode) { case MODE_SPACE: case MODE_DRAG: { if (signX) dx = Math.max(W - w0, Math.min(E - e0, dx)), w1 = w0 + dx, e1 = e0 + dx; if (signY) dy = Math.max(N - n0, Math.min(S - s0, dy)), n1 = n0 + dy, s1 = s0 + dy; break; } case MODE_HANDLE: { if (signX < 0) dx = Math.max(W - w0, Math.min(E - w0, dx)), w1 = w0 + dx, e1 = e0; else if (signX > 0) dx = Math.max(W - e0, Math.min(E - e0, dx)), w1 = w0, e1 = e0 + dx; if (signY < 0) dy = Math.max(N - n0, Math.min(S - n0, dy)), n1 = n0 + dy, s1 = s0; else if (signY > 0) dy = Math.max(N - s0, Math.min(S - s0, dy)), n1 = n0, s1 = s0 + dy; break; } case MODE_CENTER: { if (signX) w1 = Math.max(W, Math.min(E, w0 - dx * signX)), e1 = Math.max(W, Math.min(E, e0 + dx * signX)); if (signY) n1 = Math.max(N, Math.min(S, n0 - dy * signY)), s1 = Math.max(N, Math.min(S, s0 + dy * signY)); break; } } if (e1 < w1) { signX *= -1; t = w0, w0 = e0, e0 = t; t = w1, w1 = e1, e1 = t; if (type in flipX) overlay.attr("cursor", cursors[type = flipX[type]]); } if (s1 < n1) { signY *= -1; t = n0, n0 = s0, s0 = t; t = n1, n1 = s1, s1 = t; if (type in flipY) overlay.attr("cursor", cursors[type = flipY[type]]); } if (state.selection) selection = state.selection; // May be set by brush.move! if (lockX) w1 = selection[0][0], e1 = selection[1][0]; if (lockY) n1 = selection[0][1], s1 = selection[1][1]; if (selection[0][0] !== w1 || selection[0][1] !== n1 || selection[1][0] !== e1 || selection[1][1] !== s1) { state.selection = [[w1, n1], [e1, s1]]; redraw.call(that); emit.brush(); } } function ended() { Object(__WEBPACK_IMPORTED_MODULE_7__noevent__["b" /* nopropagation */])(); if (__WEBPACK_IMPORTED_MODULE_3_d3_selection__["event"].touches) { if (__WEBPACK_IMPORTED_MODULE_3_d3_selection__["event"].touches.length) return; if (touchending) clearTimeout(touchending); touchending = setTimeout(function() { touchending = null; }, 500); // Ghost clicks are delayed! group.on("touchmove.brush touchend.brush touchcancel.brush", null); } else { Object(__WEBPACK_IMPORTED_MODULE_1_d3_drag__["b" /* dragEnable */])(__WEBPACK_IMPORTED_MODULE_3_d3_selection__["event"].view, moving); view.on("keydown.brush keyup.brush mousemove.brush mouseup.brush", null); } group.attr("pointer-events", "all"); overlay.attr("cursor", cursors.overlay); if (state.selection) selection = state.selection; // May be set by brush.move (on start)! if (empty(selection)) state.selection = null, redraw.call(that); emit.end(); } function keydowned() { switch (__WEBPACK_IMPORTED_MODULE_3_d3_selection__["event"].keyCode) { case 16: { // SHIFT shifting = signX && signY; break; } case 18: { // ALT if (mode === MODE_HANDLE) { if (signX) e0 = e1 - dx * signX, w0 = w1 + dx * signX; if (signY) s0 = s1 - dy * signY, n0 = n1 + dy * signY; mode = MODE_CENTER; move(); } break; } case 32: { // SPACE; takes priority over ALT if (mode === MODE_HANDLE || mode === MODE_CENTER) { if (signX < 0) e0 = e1 - dx; else if (signX > 0) w0 = w1 - dx; if (signY < 0) s0 = s1 - dy; else if (signY > 0) n0 = n1 - dy; mode = MODE_SPACE; overlay.attr("cursor", cursors.selection); move(); } break; } default: return; } Object(__WEBPACK_IMPORTED_MODULE_7__noevent__["a" /* default */])(); } function keyupped() { switch (__WEBPACK_IMPORTED_MODULE_3_d3_selection__["event"].keyCode) { case 16: { // SHIFT if (shifting) { lockX = lockY = shifting = false; move(); } break; } case 18: { // ALT if (mode === MODE_CENTER) { if (signX < 0) e0 = e1; else if (signX > 0) w0 = w1; if (signY < 0) s0 = s1; else if (signY > 0) n0 = n1; mode = MODE_HANDLE; move(); } break; } case 32: { // SPACE if (mode === MODE_SPACE) { if (__WEBPACK_IMPORTED_MODULE_3_d3_selection__["event"].altKey) { if (signX) e0 = e1 - dx * signX, w0 = w1 + dx * signX; if (signY) s0 = s1 - dy * signY, n0 = n1 + dy * signY; mode = MODE_CENTER; } else { if (signX < 0) e0 = e1; else if (signX > 0) w0 = w1; if (signY < 0) s0 = s1; else if (signY > 0) n0 = n1; mode = MODE_HANDLE; } overlay.attr("cursor", cursors[type]); move(); } break; } default: return; } Object(__WEBPACK_IMPORTED_MODULE_7__noevent__["a" /* default */])(); } } function initialize() { var state = this.__brush || {selection: null}; state.extent = extent.apply(this, arguments); state.dim = dim; return state; } brush.extent = function(_) { return arguments.length ? (extent = typeof _ === "function" ? _ : Object(__WEBPACK_IMPORTED_MODULE_5__constant__["a" /* default */])([[+_[0][0], +_[0][1]], [+_[1][0], +_[1][1]]]), brush) : extent; }; brush.filter = function(_) { return arguments.length ? (filter = typeof _ === "function" ? _ : Object(__WEBPACK_IMPORTED_MODULE_5__constant__["a" /* default */])(!!_), brush) : filter; }; brush.handleSize = function(_) { return arguments.length ? (handleSize = +_, brush) : handleSize; }; brush.on = function() { var value = listeners.on.apply(listeners, arguments); return value === listeners ? brush : value; }; return brush; } /***/ }), /***/ "./node_modules/d3-brush/src/constant.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony default export */ __webpack_exports__["a"] = (function(x) { return function() { return x; }; }); /***/ }), /***/ "./node_modules/d3-brush/src/event.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony default export */ __webpack_exports__["a"] = (function(target, type, selection) { this.target = target; this.type = type; this.selection = selection; }); /***/ }), /***/ "./node_modules/d3-brush/src/noevent.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["b"] = nopropagation; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_d3_selection__ = __webpack_require__("./node_modules/d3-selection/index.js"); function nopropagation() { __WEBPACK_IMPORTED_MODULE_0_d3_selection__["event"].stopImmediatePropagation(); } /* harmony default export */ __webpack_exports__["a"] = (function() { __WEBPACK_IMPORTED_MODULE_0_d3_selection__["event"].preventDefault(); __WEBPACK_IMPORTED_MODULE_0_d3_selection__["event"].stopImmediatePropagation(); }); /***/ }), /***/ "./node_modules/d3-collection/index.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__src_nest__ = __webpack_require__("./node_modules/d3-collection/src/nest.js"); /* unused harmony reexport nest */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__src_set__ = __webpack_require__("./node_modules/d3-collection/src/set.js"); /* unused harmony reexport set */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__src_map__ = __webpack_require__("./node_modules/d3-collection/src/map.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return __WEBPACK_IMPORTED_MODULE_2__src_map__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__src_keys__ = __webpack_require__("./node_modules/d3-collection/src/keys.js"); /* unused harmony reexport keys */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__src_values__ = __webpack_require__("./node_modules/d3-collection/src/values.js"); /* unused harmony reexport values */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__src_entries__ = __webpack_require__("./node_modules/d3-collection/src/entries.js"); /* unused harmony reexport entries */ /***/ }), /***/ "./node_modules/d3-collection/src/entries.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony default export */ var _unused_webpack_default_export = (function(map) { var entries = []; for (var key in map) entries.push({key: key, value: map[key]}); return entries; }); /***/ }), /***/ "./node_modules/d3-collection/src/keys.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony default export */ var _unused_webpack_default_export = (function(map) { var keys = []; for (var key in map) keys.push(key); return keys; }); /***/ }), /***/ "./node_modules/d3-collection/src/map.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return prefix; }); var prefix = "$"; function Map() {} Map.prototype = map.prototype = { constructor: Map, has: function(key) { return (prefix + key) in this; }, get: function(key) { return this[prefix + key]; }, set: function(key, value) { this[prefix + key] = value; return this; }, remove: function(key) { var property = prefix + key; return property in this && delete this[property]; }, clear: function() { for (var property in this) if (property[0] === prefix) delete this[property]; }, keys: function() { var keys = []; for (var property in this) if (property[0] === prefix) keys.push(property.slice(1)); return keys; }, values: function() { var values = []; for (var property in this) if (property[0] === prefix) values.push(this[property]); return values; }, entries: function() { var entries = []; for (var property in this) if (property[0] === prefix) entries.push({key: property.slice(1), value: this[property]}); return entries; }, size: function() { var size = 0; for (var property in this) if (property[0] === prefix) ++size; return size; }, empty: function() { for (var property in this) if (property[0] === prefix) return false; return true; }, each: function(f) { for (var property in this) if (property[0] === prefix) f(this[property], property.slice(1), this); } }; function map(object, f) { var map = new Map; // Copy constructor. if (object instanceof Map) object.each(function(value, key) { map.set(key, value); }); // Index array by numeric index or specified key function. else if (Array.isArray(object)) { var i = -1, n = object.length, o; if (f == null) while (++i < n) map.set(i, object[i]); else while (++i < n) map.set(f(o = object[i], i, object), o); } // Convert object to map. else if (object) for (var key in object) map.set(key, object[key]); return map; } /* harmony default export */ __webpack_exports__["a"] = (map); /***/ }), /***/ "./node_modules/d3-collection/src/nest.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__map__ = __webpack_require__("./node_modules/d3-collection/src/map.js"); /* unused harmony default export */ var _unused_webpack_default_export = (function() { var keys = [], sortKeys = [], sortValues, rollup, nest; function apply(array, depth, createResult, setResult) { if (depth >= keys.length) { if (sortValues != null) array.sort(sortValues); return rollup != null ? rollup(array) : array; } var i = -1, n = array.length, key = keys[depth++], keyValue, value, valuesByKey = Object(__WEBPACK_IMPORTED_MODULE_0__map__["a" /* default */])(), values, result = createResult(); while (++i < n) { if (values = valuesByKey.get(keyValue = key(value = array[i]) + "")) { values.push(value); } else { valuesByKey.set(keyValue, [value]); } } valuesByKey.each(function(values, key) { setResult(result, key, apply(values, depth, createResult, setResult)); }); return result; } function entries(map, depth) { if (++depth > keys.length) return map; var array, sortKey = sortKeys[depth - 1]; if (rollup != null && depth >= keys.length) array = map.entries(); else array = [], map.each(function(v, k) { array.push({key: k, values: entries(v, depth)}); }); return sortKey != null ? array.sort(function(a, b) { return sortKey(a.key, b.key); }) : array; } return nest = { object: function(array) { return apply(array, 0, createObject, setObject); }, map: function(array) { return apply(array, 0, createMap, setMap); }, entries: function(array) { return entries(apply(array, 0, createMap, setMap), 0); }, key: function(d) { keys.push(d); return nest; }, sortKeys: function(order) { sortKeys[keys.length - 1] = order; return nest; }, sortValues: function(order) { sortValues = order; return nest; }, rollup: function(f) { rollup = f; return nest; } }; }); function createObject() { return {}; } function setObject(object, key, value) { object[key] = value; } function createMap() { return Object(__WEBPACK_IMPORTED_MODULE_0__map__["a" /* default */])(); } function setMap(map, key, value) { map.set(key, value); } /***/ }), /***/ "./node_modules/d3-collection/src/set.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__map__ = __webpack_require__("./node_modules/d3-collection/src/map.js"); function Set() {} var proto = __WEBPACK_IMPORTED_MODULE_0__map__["a" /* default */].prototype; Set.prototype = set.prototype = { constructor: Set, has: proto.has, add: function(value) { value += ""; this[__WEBPACK_IMPORTED_MODULE_0__map__["b" /* prefix */] + value] = value; return this; }, remove: proto.remove, clear: proto.clear, values: proto.keys, size: proto.size, empty: proto.empty, each: proto.each }; function set(object, f) { var set = new Set; // Copy constructor. if (object instanceof Set) object.each(function(value) { set.add(value); }); // Otherwise, assume it’s an array. else if (object) { var i = -1, n = object.length; if (f == null) while (++i < n) set.add(object[i]); else while (++i < n) set.add(f(object[i], i, object)); } return set; } /* unused harmony default export */ var _unused_webpack_default_export = (set); /***/ }), /***/ "./node_modules/d3-collection/src/values.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony default export */ var _unused_webpack_default_export = (function(map) { var values = []; for (var key in map) values.push(map[key]); return values; }); /***/ }), /***/ "./node_modules/d3-color/index.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__src_color__ = __webpack_require__("./node_modules/d3-color/src/color.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "color", function() { return __WEBPACK_IMPORTED_MODULE_0__src_color__["e"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "rgb", function() { return __WEBPACK_IMPORTED_MODULE_0__src_color__["g"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "hsl", function() { return __WEBPACK_IMPORTED_MODULE_0__src_color__["f"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__src_lab__ = __webpack_require__("./node_modules/d3-color/src/lab.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "lab", function() { return __WEBPACK_IMPORTED_MODULE_1__src_lab__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "hcl", function() { return __WEBPACK_IMPORTED_MODULE_1__src_lab__["c"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "lch", function() { return __WEBPACK_IMPORTED_MODULE_1__src_lab__["d"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "gray", function() { return __WEBPACK_IMPORTED_MODULE_1__src_lab__["b"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__src_cubehelix__ = __webpack_require__("./node_modules/d3-color/src/cubehelix.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "cubehelix", function() { return __WEBPACK_IMPORTED_MODULE_2__src_cubehelix__["a"]; }); /***/ }), /***/ "./node_modules/d3-color/src/color.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = Color; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return darker; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return brighter; }); /* harmony export (immutable) */ __webpack_exports__["e"] = color; /* harmony export (immutable) */ __webpack_exports__["h"] = rgbConvert; /* harmony export (immutable) */ __webpack_exports__["g"] = rgb; /* harmony export (immutable) */ __webpack_exports__["b"] = Rgb; /* unused harmony export hslConvert */ /* harmony export (immutable) */ __webpack_exports__["f"] = hsl; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__define__ = __webpack_require__("./node_modules/d3-color/src/define.js"); function Color() {} var darker = 0.7; var brighter = 1 / darker; var reI = "\\s*([+-]?\\d+)\\s*", reN = "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*", reP = "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*", reHex3 = /^#([0-9a-f]{3})$/, reHex6 = /^#([0-9a-f]{6})$/, reRgbInteger = new RegExp("^rgb\\(" + [reI, reI, reI] + "\\)$"), reRgbPercent = new RegExp("^rgb\\(" + [reP, reP, reP] + "\\)$"), reRgbaInteger = new RegExp("^rgba\\(" + [reI, reI, reI, reN] + "\\)$"), reRgbaPercent = new RegExp("^rgba\\(" + [reP, reP, reP, reN] + "\\)$"), reHslPercent = new RegExp("^hsl\\(" + [reN, reP, reP] + "\\)$"), reHslaPercent = new RegExp("^hsla\\(" + [reN, reP, reP, reN] + "\\)$"); var named = { aliceblue: 0xf0f8ff, antiquewhite: 0xfaebd7, aqua: 0x00ffff, aquamarine: 0x7fffd4, azure: 0xf0ffff, beige: 0xf5f5dc, bisque: 0xffe4c4, black: 0x000000, blanchedalmond: 0xffebcd, blue: 0x0000ff, blueviolet: 0x8a2be2, brown: 0xa52a2a, burlywood: 0xdeb887, cadetblue: 0x5f9ea0, chartreuse: 0x7fff00, chocolate: 0xd2691e, coral: 0xff7f50, cornflowerblue: 0x6495ed, cornsilk: 0xfff8dc, crimson: 0xdc143c, cyan: 0x00ffff, darkblue: 0x00008b, darkcyan: 0x008b8b, darkgoldenrod: 0xb8860b, darkgray: 0xa9a9a9, darkgreen: 0x006400, darkgrey: 0xa9a9a9, darkkhaki: 0xbdb76b, darkmagenta: 0x8b008b, darkolivegreen: 0x556b2f, darkorange: 0xff8c00, darkorchid: 0x9932cc, darkred: 0x8b0000, darksalmon: 0xe9967a, darkseagreen: 0x8fbc8f, darkslateblue: 0x483d8b, darkslategray: 0x2f4f4f, darkslategrey: 0x2f4f4f, darkturquoise: 0x00ced1, darkviolet: 0x9400d3, deeppink: 0xff1493, deepskyblue: 0x00bfff, dimgray: 0x696969, dimgrey: 0x696969, dodgerblue: 0x1e90ff, firebrick: 0xb22222, floralwhite: 0xfffaf0, forestgreen: 0x228b22, fuchsia: 0xff00ff, gainsboro: 0xdcdcdc, ghostwhite: 0xf8f8ff, gold: 0xffd700, goldenrod: 0xdaa520, gray: 0x808080, green: 0x008000, greenyellow: 0xadff2f, grey: 0x808080, honeydew: 0xf0fff0, hotpink: 0xff69b4, indianred: 0xcd5c5c, indigo: 0x4b0082, ivory: 0xfffff0, khaki: 0xf0e68c, lavender: 0xe6e6fa, lavenderblush: 0xfff0f5, lawngreen: 0x7cfc00, lemonchiffon: 0xfffacd, lightblue: 0xadd8e6, lightcoral: 0xf08080, lightcyan: 0xe0ffff, lightgoldenrodyellow: 0xfafad2, lightgray: 0xd3d3d3, lightgreen: 0x90ee90, lightgrey: 0xd3d3d3, lightpink: 0xffb6c1, lightsalmon: 0xffa07a, lightseagreen: 0x20b2aa, lightskyblue: 0x87cefa, lightslategray: 0x778899, lightslategrey: 0x778899, lightsteelblue: 0xb0c4de, lightyellow: 0xffffe0, lime: 0x00ff00, limegreen: 0x32cd32, linen: 0xfaf0e6, magenta: 0xff00ff, maroon: 0x800000, mediumaquamarine: 0x66cdaa, mediumblue: 0x0000cd, mediumorchid: 0xba55d3, mediumpurple: 0x9370db, mediumseagreen: 0x3cb371, mediumslateblue: 0x7b68ee, mediumspringgreen: 0x00fa9a, mediumturquoise: 0x48d1cc, mediumvioletred: 0xc71585, midnightblue: 0x191970, mintcream: 0xf5fffa, mistyrose: 0xffe4e1, moccasin: 0xffe4b5, navajowhite: 0xffdead, navy: 0x000080, oldlace: 0xfdf5e6, olive: 0x808000, olivedrab: 0x6b8e23, orange: 0xffa500, orangered: 0xff4500, orchid: 0xda70d6, palegoldenrod: 0xeee8aa, palegreen: 0x98fb98, paleturquoise: 0xafeeee, palevioletred: 0xdb7093, papayawhip: 0xffefd5, peachpuff: 0xffdab9, peru: 0xcd853f, pink: 0xffc0cb, plum: 0xdda0dd, powderblue: 0xb0e0e6, purple: 0x800080, rebeccapurple: 0x663399, red: 0xff0000, rosybrown: 0xbc8f8f, royalblue: 0x4169e1, saddlebrown: 0x8b4513, salmon: 0xfa8072, sandybrown: 0xf4a460, seagreen: 0x2e8b57, seashell: 0xfff5ee, sienna: 0xa0522d, silver: 0xc0c0c0, skyblue: 0x87ceeb, slateblue: 0x6a5acd, slategray: 0x708090, slategrey: 0x708090, snow: 0xfffafa, springgreen: 0x00ff7f, steelblue: 0x4682b4, tan: 0xd2b48c, teal: 0x008080, thistle: 0xd8bfd8, tomato: 0xff6347, turquoise: 0x40e0d0, violet: 0xee82ee, wheat: 0xf5deb3, white: 0xffffff, whitesmoke: 0xf5f5f5, yellow: 0xffff00, yellowgreen: 0x9acd32 }; Object(__WEBPACK_IMPORTED_MODULE_0__define__["a" /* default */])(Color, color, { displayable: function() { return this.rgb().displayable(); }, hex: function() { return this.rgb().hex(); }, toString: function() { return this.rgb() + ""; } }); function color(format) { var m; format = (format + "").trim().toLowerCase(); return (m = reHex3.exec(format)) ? (m = parseInt(m[1], 16), new Rgb((m >> 8 & 0xf) | (m >> 4 & 0x0f0), (m >> 4 & 0xf) | (m & 0xf0), ((m & 0xf) << 4) | (m & 0xf), 1)) // #f00 : (m = reHex6.exec(format)) ? rgbn(parseInt(m[1], 16)) // #ff0000 : (m = reRgbInteger.exec(format)) ? new Rgb(m[1], m[2], m[3], 1) // rgb(255, 0, 0) : (m = reRgbPercent.exec(format)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) // rgb(100%, 0%, 0%) : (m = reRgbaInteger.exec(format)) ? rgba(m[1], m[2], m[3], m[4]) // rgba(255, 0, 0, 1) : (m = reRgbaPercent.exec(format)) ? rgba(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4]) // rgb(100%, 0%, 0%, 1) : (m = reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) // hsl(120, 50%, 50%) : (m = reHslaPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4]) // hsla(120, 50%, 50%, 1) : named.hasOwnProperty(format) ? rgbn(named[format]) : format === "transparent" ? new Rgb(NaN, NaN, NaN, 0) : null; } function rgbn(n) { return new Rgb(n >> 16 & 0xff, n >> 8 & 0xff, n & 0xff, 1); } function rgba(r, g, b, a) { if (a <= 0) r = g = b = NaN; return new Rgb(r, g, b, a); } function rgbConvert(o) { if (!(o instanceof Color)) o = color(o); if (!o) return new Rgb; o = o.rgb(); return new Rgb(o.r, o.g, o.b, o.opacity); } function rgb(r, g, b, opacity) { return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity); } function Rgb(r, g, b, opacity) { this.r = +r; this.g = +g; this.b = +b; this.opacity = +opacity; } Object(__WEBPACK_IMPORTED_MODULE_0__define__["a" /* default */])(Rgb, rgb, Object(__WEBPACK_IMPORTED_MODULE_0__define__["b" /* extend */])(Color, { brighter: function(k) { k = k == null ? brighter : Math.pow(brighter, k); return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity); }, darker: function(k) { k = k == null ? darker : Math.pow(darker, k); return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity); }, rgb: function() { return this; }, displayable: function() { return (0 <= this.r && this.r <= 255) && (0 <= this.g && this.g <= 255) && (0 <= this.b && this.b <= 255) && (0 <= this.opacity && this.opacity <= 1); }, hex: function() { return "#" + hex(this.r) + hex(this.g) + hex(this.b); }, toString: function() { var a = this.opacity; a = isNaN(a) ? 1 : Math.max(0, Math.min(1, a)); return (a === 1 ? "rgb(" : "rgba(") + Math.max(0, Math.min(255, Math.round(this.r) || 0)) + ", " + Math.max(0, Math.min(255, Math.round(this.g) || 0)) + ", " + Math.max(0, Math.min(255, Math.round(this.b) || 0)) + (a === 1 ? ")" : ", " + a + ")"); } })); function hex(value) { value = Math.max(0, Math.min(255, Math.round(value) || 0)); return (value < 16 ? "0" : "") + value.toString(16); } function hsla(h, s, l, a) { if (a <= 0) h = s = l = NaN; else if (l <= 0 || l >= 1) h = s = NaN; else if (s <= 0) h = NaN; return new Hsl(h, s, l, a); } function hslConvert(o) { if (o instanceof Hsl) return new Hsl(o.h, o.s, o.l, o.opacity); if (!(o instanceof Color)) o = color(o); if (!o) return new Hsl; if (o instanceof Hsl) return o; o = o.rgb(); var r = o.r / 255, g = o.g / 255, b = o.b / 255, min = Math.min(r, g, b), max = Math.max(r, g, b), h = NaN, s = max - min, l = (max + min) / 2; if (s) { if (r === max) h = (g - b) / s + (g < b) * 6; else if (g === max) h = (b - r) / s + 2; else h = (r - g) / s + 4; s /= l < 0.5 ? max + min : 2 - max - min; h *= 60; } else { s = l > 0 && l < 1 ? 0 : h; } return new Hsl(h, s, l, o.opacity); } function hsl(h, s, l, opacity) { return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity); } function Hsl(h, s, l, opacity) { this.h = +h; this.s = +s; this.l = +l; this.opacity = +opacity; } Object(__WEBPACK_IMPORTED_MODULE_0__define__["a" /* default */])(Hsl, hsl, Object(__WEBPACK_IMPORTED_MODULE_0__define__["b" /* extend */])(Color, { brighter: function(k) { k = k == null ? brighter : Math.pow(brighter, k); return new Hsl(this.h, this.s, this.l * k, this.opacity); }, darker: function(k) { k = k == null ? darker : Math.pow(darker, k); return new Hsl(this.h, this.s, this.l * k, this.opacity); }, rgb: function() { var h = this.h % 360 + (this.h < 0) * 360, s = isNaN(h) || isNaN(this.s) ? 0 : this.s, l = this.l, m2 = l + (l < 0.5 ? l : 1 - l) * s, m1 = 2 * l - m2; return new Rgb( hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2), hsl2rgb(h, m1, m2), hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2), this.opacity ); }, displayable: function() { return (0 <= this.s && this.s <= 1 || isNaN(this.s)) && (0 <= this.l && this.l <= 1) && (0 <= this.opacity && this.opacity <= 1); } })); /* From FvD 13.37, CSS Color Module Level 3 */ function hsl2rgb(h, m1, m2) { return (h < 60 ? m1 + (m2 - m1) * h / 60 : h < 180 ? m2 : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60 : m1) * 255; } /***/ }), /***/ "./node_modules/d3-color/src/cubehelix.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = cubehelix; /* unused harmony export Cubehelix */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__define__ = __webpack_require__("./node_modules/d3-color/src/define.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__color__ = __webpack_require__("./node_modules/d3-color/src/color.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__math__ = __webpack_require__("./node_modules/d3-color/src/math.js"); var A = -0.14861, B = +1.78277, C = -0.29227, D = -0.90649, E = +1.97294, ED = E * D, EB = E * B, BC_DA = B * C - D * A; function cubehelixConvert(o) { if (o instanceof Cubehelix) return new Cubehelix(o.h, o.s, o.l, o.opacity); if (!(o instanceof __WEBPACK_IMPORTED_MODULE_1__color__["b" /* Rgb */])) o = Object(__WEBPACK_IMPORTED_MODULE_1__color__["h" /* rgbConvert */])(o); var r = o.r / 255, g = o.g / 255, b = o.b / 255, l = (BC_DA * b + ED * r - EB * g) / (BC_DA + ED - EB), bl = b - l, k = (E * (g - l) - C * bl) / D, s = Math.sqrt(k * k + bl * bl) / (E * l * (1 - l)), // NaN if l=0 or l=1 h = s ? Math.atan2(k, bl) * __WEBPACK_IMPORTED_MODULE_2__math__["b" /* rad2deg */] - 120 : NaN; return new Cubehelix(h < 0 ? h + 360 : h, s, l, o.opacity); } function cubehelix(h, s, l, opacity) { return arguments.length === 1 ? cubehelixConvert(h) : new Cubehelix(h, s, l, opacity == null ? 1 : opacity); } function Cubehelix(h, s, l, opacity) { this.h = +h; this.s = +s; this.l = +l; this.opacity = +opacity; } Object(__WEBPACK_IMPORTED_MODULE_0__define__["a" /* default */])(Cubehelix, cubehelix, Object(__WEBPACK_IMPORTED_MODULE_0__define__["b" /* extend */])(__WEBPACK_IMPORTED_MODULE_1__color__["a" /* Color */], { brighter: function(k) { k = k == null ? __WEBPACK_IMPORTED_MODULE_1__color__["c" /* brighter */] : Math.pow(__WEBPACK_IMPORTED_MODULE_1__color__["c" /* brighter */], k); return new Cubehelix(this.h, this.s, this.l * k, this.opacity); }, darker: function(k) { k = k == null ? __WEBPACK_IMPORTED_MODULE_1__color__["d" /* darker */] : Math.pow(__WEBPACK_IMPORTED_MODULE_1__color__["d" /* darker */], k); return new Cubehelix(this.h, this.s, this.l * k, this.opacity); }, rgb: function() { var h = isNaN(this.h) ? 0 : (this.h + 120) * __WEBPACK_IMPORTED_MODULE_2__math__["a" /* deg2rad */], l = +this.l, a = isNaN(this.s) ? 0 : this.s * l * (1 - l), cosh = Math.cos(h), sinh = Math.sin(h); return new __WEBPACK_IMPORTED_MODULE_1__color__["b" /* Rgb */]( 255 * (l + a * (A * cosh + B * sinh)), 255 * (l + a * (C * cosh + D * sinh)), 255 * (l + a * (E * cosh)), this.opacity ); } })); /***/ }), /***/ "./node_modules/d3-color/src/define.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["b"] = extend; /* harmony default export */ __webpack_exports__["a"] = (function(constructor, factory, prototype) { constructor.prototype = factory.prototype = prototype; prototype.constructor = constructor; }); function extend(parent, definition) { var prototype = Object.create(parent.prototype); for (var key in definition) prototype[key] = definition[key]; return prototype; } /***/ }), /***/ "./node_modules/d3-color/src/lab.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["b"] = gray; /* harmony export (immutable) */ __webpack_exports__["a"] = lab; /* unused harmony export Lab */ /* harmony export (immutable) */ __webpack_exports__["d"] = lch; /* harmony export (immutable) */ __webpack_exports__["c"] = hcl; /* unused harmony export Hcl */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__define__ = __webpack_require__("./node_modules/d3-color/src/define.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__color__ = __webpack_require__("./node_modules/d3-color/src/color.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__math__ = __webpack_require__("./node_modules/d3-color/src/math.js"); // https://beta.observablehq.com/@mbostock/lab-and-rgb var K = 18, Xn = 0.96422, Yn = 1, Zn = 0.82521, t0 = 4 / 29, t1 = 6 / 29, t2 = 3 * t1 * t1, t3 = t1 * t1 * t1; function labConvert(o) { if (o instanceof Lab) return new Lab(o.l, o.a, o.b, o.opacity); if (o instanceof Hcl) { if (isNaN(o.h)) return new Lab(o.l, 0, 0, o.opacity); var h = o.h * __WEBPACK_IMPORTED_MODULE_2__math__["a" /* deg2rad */]; return new Lab(o.l, Math.cos(h) * o.c, Math.sin(h) * o.c, o.opacity); } if (!(o instanceof __WEBPACK_IMPORTED_MODULE_1__color__["b" /* Rgb */])) o = Object(__WEBPACK_IMPORTED_MODULE_1__color__["h" /* rgbConvert */])(o); var r = rgb2lrgb(o.r), g = rgb2lrgb(o.g), b = rgb2lrgb(o.b), y = xyz2lab((0.2225045 * r + 0.7168786 * g + 0.0606169 * b) / Yn), x, z; if (r === g && g === b) x = z = y; else { x = xyz2lab((0.4360747 * r + 0.3850649 * g + 0.1430804 * b) / Xn); z = xyz2lab((0.0139322 * r + 0.0971045 * g + 0.7141733 * b) / Zn); } return new Lab(116 * y - 16, 500 * (x - y), 200 * (y - z), o.opacity); } function gray(l, opacity) { return new Lab(l, 0, 0, opacity == null ? 1 : opacity); } function lab(l, a, b, opacity) { return arguments.length === 1 ? labConvert(l) : new Lab(l, a, b, opacity == null ? 1 : opacity); } function Lab(l, a, b, opacity) { this.l = +l; this.a = +a; this.b = +b; this.opacity = +opacity; } Object(__WEBPACK_IMPORTED_MODULE_0__define__["a" /* default */])(Lab, lab, Object(__WEBPACK_IMPORTED_MODULE_0__define__["b" /* extend */])(__WEBPACK_IMPORTED_MODULE_1__color__["a" /* Color */], { brighter: function(k) { return new Lab(this.l + K * (k == null ? 1 : k), this.a, this.b, this.opacity); }, darker: function(k) { return new Lab(this.l - K * (k == null ? 1 : k), this.a, this.b, this.opacity); }, rgb: function() { var y = (this.l + 16) / 116, x = isNaN(this.a) ? y : y + this.a / 500, z = isNaN(this.b) ? y : y - this.b / 200; x = Xn * lab2xyz(x); y = Yn * lab2xyz(y); z = Zn * lab2xyz(z); return new __WEBPACK_IMPORTED_MODULE_1__color__["b" /* Rgb */]( lrgb2rgb( 3.1338561 * x - 1.6168667 * y - 0.4906146 * z), lrgb2rgb(-0.9787684 * x + 1.9161415 * y + 0.0334540 * z), lrgb2rgb( 0.0719453 * x - 0.2289914 * y + 1.4052427 * z), this.opacity ); } })); function xyz2lab(t) { return t > t3 ? Math.pow(t, 1 / 3) : t / t2 + t0; } function lab2xyz(t) { return t > t1 ? t * t * t : t2 * (t - t0); } function lrgb2rgb(x) { return 255 * (x <= 0.0031308 ? 12.92 * x : 1.055 * Math.pow(x, 1 / 2.4) - 0.055); } function rgb2lrgb(x) { return (x /= 255) <= 0.04045 ? x / 12.92 : Math.pow((x + 0.055) / 1.055, 2.4); } function hclConvert(o) { if (o instanceof Hcl) return new Hcl(o.h, o.c, o.l, o.opacity); if (!(o instanceof Lab)) o = labConvert(o); if (o.a === 0 && o.b === 0) return new Hcl(NaN, 0, o.l, o.opacity); var h = Math.atan2(o.b, o.a) * __WEBPACK_IMPORTED_MODULE_2__math__["b" /* rad2deg */]; return new Hcl(h < 0 ? h + 360 : h, Math.sqrt(o.a * o.a + o.b * o.b), o.l, o.opacity); } function lch(l, c, h, opacity) { return arguments.length === 1 ? hclConvert(l) : new Hcl(h, c, l, opacity == null ? 1 : opacity); } function hcl(h, c, l, opacity) { return arguments.length === 1 ? hclConvert(h) : new Hcl(h, c, l, opacity == null ? 1 : opacity); } function Hcl(h, c, l, opacity) { this.h = +h; this.c = +c; this.l = +l; this.opacity = +opacity; } Object(__WEBPACK_IMPORTED_MODULE_0__define__["a" /* default */])(Hcl, hcl, Object(__WEBPACK_IMPORTED_MODULE_0__define__["b" /* extend */])(__WEBPACK_IMPORTED_MODULE_1__color__["a" /* Color */], { brighter: function(k) { return new Hcl(this.h, this.c, this.l + K * (k == null ? 1 : k), this.opacity); }, darker: function(k) { return new Hcl(this.h, this.c, this.l - K * (k == null ? 1 : k), this.opacity); }, rgb: function() { return labConvert(this).rgb(); } })); /***/ }), /***/ "./node_modules/d3-color/src/math.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return deg2rad; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return rad2deg; }); var deg2rad = Math.PI / 180; var rad2deg = 180 / Math.PI; /***/ }), /***/ "./node_modules/d3-dispatch/index.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__src_dispatch__ = __webpack_require__("./node_modules/d3-dispatch/src/dispatch.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return __WEBPACK_IMPORTED_MODULE_0__src_dispatch__["a"]; }); /***/ }), /***/ "./node_modules/d3-dispatch/src/dispatch.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; var noop = {value: function() {}}; function dispatch() { for (var i = 0, n = arguments.length, _ = {}, t; i < n; ++i) { if (!(t = arguments[i] + "") || (t in _)) throw new Error("illegal type: " + t); _[t] = []; } return new Dispatch(_); } function Dispatch(_) { this._ = _; } function parseTypenames(typenames, types) { return typenames.trim().split(/^|\s+/).map(function(t) { var name = "", i = t.indexOf("."); if (i >= 0) name = t.slice(i + 1), t = t.slice(0, i); if (t && !types.hasOwnProperty(t)) throw new Error("unknown type: " + t); return {type: t, name: name}; }); } Dispatch.prototype = dispatch.prototype = { constructor: Dispatch, on: function(typename, callback) { var _ = this._, T = parseTypenames(typename + "", _), t, i = -1, n = T.length; // If no callback was specified, return the callback of the given type and name. if (arguments.length < 2) { while (++i < n) if ((t = (typename = T[i]).type) && (t = get(_[t], typename.name))) return t; return; } // If a type was specified, set the callback for the given type and name. // Otherwise, if a null callback was specified, remove callbacks of the given name. if (callback != null && typeof callback !== "function") throw new Error("invalid callback: " + callback); while (++i < n) { if (t = (typename = T[i]).type) _[t] = set(_[t], typename.name, callback); else if (callback == null) for (t in _) _[t] = set(_[t], typename.name, null); } return this; }, copy: function() { var copy = {}, _ = this._; for (var t in _) copy[t] = _[t].slice(); return new Dispatch(copy); }, call: function(type, that) { if ((n = arguments.length - 2) > 0) for (var args = new Array(n), i = 0, n, t; i < n; ++i) args[i] = arguments[i + 2]; if (!this._.hasOwnProperty(type)) throw new Error("unknown type: " + type); for (t = this._[type], i = 0, n = t.length; i < n; ++i) t[i].value.apply(that, args); }, apply: function(type, that, args) { if (!this._.hasOwnProperty(type)) throw new Error("unknown type: " + type); for (var t = this._[type], i = 0, n = t.length; i < n; ++i) t[i].value.apply(that, args); } }; function get(type, name) { for (var i = 0, n = type.length, c; i < n; ++i) { if ((c = type[i]).name === name) { return c.value; } } } function set(type, name, callback) { for (var i = 0, n = type.length; i < n; ++i) { if (type[i].name === name) { type[i] = noop, type = type.slice(0, i).concat(type.slice(i + 1)); break; } } if (callback != null) type.push({name: name, value: callback}); return type; } /* harmony default export */ __webpack_exports__["a"] = (dispatch); /***/ }), /***/ "./node_modules/d3-drag/index.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__src_drag__ = __webpack_require__("./node_modules/d3-drag/src/drag.js"); /* unused harmony reexport drag */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__src_nodrag__ = __webpack_require__("./node_modules/d3-drag/src/nodrag.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return __WEBPACK_IMPORTED_MODULE_1__src_nodrag__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return __WEBPACK_IMPORTED_MODULE_1__src_nodrag__["b"]; }); /***/ }), /***/ "./node_modules/d3-drag/src/constant.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony default export */ __webpack_exports__["a"] = (function(x) { return function() { return x; }; }); /***/ }), /***/ "./node_modules/d3-drag/src/drag.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_d3_dispatch__ = __webpack_require__("./node_modules/d3-dispatch/index.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_d3_selection__ = __webpack_require__("./node_modules/d3-selection/index.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__nodrag__ = __webpack_require__("./node_modules/d3-drag/src/nodrag.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__noevent__ = __webpack_require__("./node_modules/d3-drag/src/noevent.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__constant__ = __webpack_require__("./node_modules/d3-drag/src/constant.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__event__ = __webpack_require__("./node_modules/d3-drag/src/event.js"); // Ignore right-click, since that should open the context menu. function defaultFilter() { return !__WEBPACK_IMPORTED_MODULE_1_d3_selection__["event"].button; } function defaultContainer() { return this.parentNode; } function defaultSubject(d) { return d == null ? {x: __WEBPACK_IMPORTED_MODULE_1_d3_selection__["event"].x, y: __WEBPACK_IMPORTED_MODULE_1_d3_selection__["event"].y} : d; } function defaultTouchable() { return "ontouchstart" in this; } /* unused harmony default export */ var _unused_webpack_default_export = (function() { var filter = defaultFilter, container = defaultContainer, subject = defaultSubject, touchable = defaultTouchable, gestures = {}, listeners = Object(__WEBPACK_IMPORTED_MODULE_0_d3_dispatch__["a" /* dispatch */])("start", "drag", "end"), active = 0, mousedownx, mousedowny, mousemoving, touchending, clickDistance2 = 0; function drag(selection) { selection .on("mousedown.drag", mousedowned) .filter(touchable) .on("touchstart.drag", touchstarted) .on("touchmove.drag", touchmoved) .on("touchend.drag touchcancel.drag", touchended) .style("touch-action", "none") .style("-webkit-tap-highlight-color", "rgba(0,0,0,0)"); } function mousedowned() { if (touchending || !filter.apply(this, arguments)) return; var gesture = beforestart("mouse", container.apply(this, arguments), __WEBPACK_IMPORTED_MODULE_1_d3_selection__["mouse"], this, arguments); if (!gesture) return; Object(__WEBPACK_IMPORTED_MODULE_1_d3_selection__["select"])(__WEBPACK_IMPORTED_MODULE_1_d3_selection__["event"].view).on("mousemove.drag", mousemoved, true).on("mouseup.drag", mouseupped, true); Object(__WEBPACK_IMPORTED_MODULE_2__nodrag__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1_d3_selection__["event"].view); Object(__WEBPACK_IMPORTED_MODULE_3__noevent__["b" /* nopropagation */])(); mousemoving = false; mousedownx = __WEBPACK_IMPORTED_MODULE_1_d3_selection__["event"].clientX; mousedowny = __WEBPACK_IMPORTED_MODULE_1_d3_selection__["event"].clientY; gesture("start"); } function mousemoved() { Object(__WEBPACK_IMPORTED_MODULE_3__noevent__["a" /* default */])(); if (!mousemoving) { var dx = __WEBPACK_IMPORTED_MODULE_1_d3_selection__["event"].clientX - mousedownx, dy = __WEBPACK_IMPORTED_MODULE_1_d3_selection__["event"].clientY - mousedowny; mousemoving = dx * dx + dy * dy > clickDistance2; } gestures.mouse("drag"); } function mouseupped() { Object(__WEBPACK_IMPORTED_MODULE_1_d3_selection__["select"])(__WEBPACK_IMPORTED_MODULE_1_d3_selection__["event"].view).on("mousemove.drag mouseup.drag", null); Object(__WEBPACK_IMPORTED_MODULE_2__nodrag__["b" /* yesdrag */])(__WEBPACK_IMPORTED_MODULE_1_d3_selection__["event"].view, mousemoving); Object(__WEBPACK_IMPORTED_MODULE_3__noevent__["a" /* default */])(); gestures.mouse("end"); } function touchstarted() { if (!filter.apply(this, arguments)) return; var touches = __WEBPACK_IMPORTED_MODULE_1_d3_selection__["event"].changedTouches, c = container.apply(this, arguments), n = touches.length, i, gesture; for (i = 0; i < n; ++i) { if (gesture = beforestart(touches[i].identifier, c, __WEBPACK_IMPORTED_MODULE_1_d3_selection__["touch"], this, arguments)) { Object(__WEBPACK_IMPORTED_MODULE_3__noevent__["b" /* nopropagation */])(); gesture("start"); } } } function touchmoved() { var touches = __WEBPACK_IMPORTED_MODULE_1_d3_selection__["event"].changedTouches, n = touches.length, i, gesture; for (i = 0; i < n; ++i) { if (gesture = gestures[touches[i].identifier]) { Object(__WEBPACK_IMPORTED_MODULE_3__noevent__["a" /* default */])(); gesture("drag"); } } } function touchended() { var touches = __WEBPACK_IMPORTED_MODULE_1_d3_selection__["event"].changedTouches, n = touches.length, i, gesture; if (touchending) clearTimeout(touchending); touchending = setTimeout(function() { touchending = null; }, 500); // Ghost clicks are delayed! for (i = 0; i < n; ++i) { if (gesture = gestures[touches[i].identifier]) { Object(__WEBPACK_IMPORTED_MODULE_3__noevent__["b" /* nopropagation */])(); gesture("end"); } } } function beforestart(id, container, point, that, args) { var p = point(container, id), s, dx, dy, sublisteners = listeners.copy(); if (!Object(__WEBPACK_IMPORTED_MODULE_1_d3_selection__["customEvent"])(new __WEBPACK_IMPORTED_MODULE_5__event__["a" /* default */](drag, "beforestart", s, id, active, p[0], p[1], 0, 0, sublisteners), function() { if ((__WEBPACK_IMPORTED_MODULE_1_d3_selection__["event"].subject = s = subject.apply(that, args)) == null) return false; dx = s.x - p[0] || 0; dy = s.y - p[1] || 0; return true; })) return; return function gesture(type) { var p0 = p, n; switch (type) { case "start": gestures[id] = gesture, n = active++; break; case "end": delete gestures[id], --active; // nobreak case "drag": p = point(container, id), n = active; break; } Object(__WEBPACK_IMPORTED_MODULE_1_d3_selection__["customEvent"])(new __WEBPACK_IMPORTED_MODULE_5__event__["a" /* default */](drag, type, s, id, n, p[0] + dx, p[1] + dy, p[0] - p0[0], p[1] - p0[1], sublisteners), sublisteners.apply, sublisteners, [type, that, args]); }; } drag.filter = function(_) { return arguments.length ? (filter = typeof _ === "function" ? _ : Object(__WEBPACK_IMPORTED_MODULE_4__constant__["a" /* default */])(!!_), drag) : filter; }; drag.container = function(_) { return arguments.length ? (container = typeof _ === "function" ? _ : Object(__WEBPACK_IMPORTED_MODULE_4__constant__["a" /* default */])(_), drag) : container; }; drag.subject = function(_) { return arguments.length ? (subject = typeof _ === "function" ? _ : Object(__WEBPACK_IMPORTED_MODULE_4__constant__["a" /* default */])(_), drag) : subject; }; drag.touchable = function(_) { return arguments.length ? (touchable = typeof _ === "function" ? _ : Object(__WEBPACK_IMPORTED_MODULE_4__constant__["a" /* default */])(!!_), drag) : touchable; }; drag.on = function() { var value = listeners.on.apply(listeners, arguments); return value === listeners ? drag : value; }; drag.clickDistance = function(_) { return arguments.length ? (clickDistance2 = (_ = +_) * _, drag) : Math.sqrt(clickDistance2); }; return drag; }); /***/ }), /***/ "./node_modules/d3-drag/src/event.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = DragEvent; function DragEvent(target, type, subject, id, active, x, y, dx, dy, dispatch) { this.target = target; this.type = type; this.subject = subject; this.identifier = id; this.active = active; this.x = x; this.y = y; this.dx = dx; this.dy = dy; this._ = dispatch; } DragEvent.prototype.on = function() { var value = this._.on.apply(this._, arguments); return value === this._ ? this : value; }; /***/ }), /***/ "./node_modules/d3-drag/src/nodrag.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["b"] = yesdrag; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_d3_selection__ = __webpack_require__("./node_modules/d3-selection/index.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__noevent__ = __webpack_require__("./node_modules/d3-drag/src/noevent.js"); /* harmony default export */ __webpack_exports__["a"] = (function(view) { var root = view.document.documentElement, selection = Object(__WEBPACK_IMPORTED_MODULE_0_d3_selection__["select"])(view).on("dragstart.drag", __WEBPACK_IMPORTED_MODULE_1__noevent__["a" /* default */], true); if ("onselectstart" in root) { selection.on("selectstart.drag", __WEBPACK_IMPORTED_MODULE_1__noevent__["a" /* default */], true); } else { root.__noselect = root.style.MozUserSelect; root.style.MozUserSelect = "none"; } }); function yesdrag(view, noclick) { var root = view.document.documentElement, selection = Object(__WEBPACK_IMPORTED_MODULE_0_d3_selection__["select"])(view).on("dragstart.drag", null); if (noclick) { selection.on("click.drag", __WEBPACK_IMPORTED_MODULE_1__noevent__["a" /* default */], true); setTimeout(function() { selection.on("click.drag", null); }, 0); } if ("onselectstart" in root) { selection.on("selectstart.drag", null); } else { root.style.MozUserSelect = root.__noselect; delete root.__noselect; } } /***/ }), /***/ "./node_modules/d3-drag/src/noevent.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["b"] = nopropagation; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_d3_selection__ = __webpack_require__("./node_modules/d3-selection/index.js"); function nopropagation() { __WEBPACK_IMPORTED_MODULE_0_d3_selection__["event"].stopImmediatePropagation(); } /* harmony default export */ __webpack_exports__["a"] = (function() { __WEBPACK_IMPORTED_MODULE_0_d3_selection__["event"].preventDefault(); __WEBPACK_IMPORTED_MODULE_0_d3_selection__["event"].stopImmediatePropagation(); }); /***/ }), /***/ "./node_modules/d3-ease/index.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__src_linear__ = __webpack_require__("./node_modules/d3-ease/src/linear.js"); /* unused harmony reexport easeLinear */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__src_quad__ = __webpack_require__("./node_modules/d3-ease/src/quad.js"); /* unused harmony reexport easeQuad */ /* unused harmony reexport easeQuadIn */ /* unused harmony reexport easeQuadOut */ /* unused harmony reexport easeQuadInOut */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__src_cubic__ = __webpack_require__("./node_modules/d3-ease/src/cubic.js"); /* unused harmony reexport easeCubic */ /* unused harmony reexport easeCubicIn */ /* unused harmony reexport easeCubicOut */ /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return __WEBPACK_IMPORTED_MODULE_2__src_cubic__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__src_poly__ = __webpack_require__("./node_modules/d3-ease/src/poly.js"); /* unused harmony reexport easePoly */ /* unused harmony reexport easePolyIn */ /* unused harmony reexport easePolyOut */ /* unused harmony reexport easePolyInOut */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__src_sin__ = __webpack_require__("./node_modules/d3-ease/src/sin.js"); /* unused harmony reexport easeSin */ /* unused harmony reexport easeSinIn */ /* unused harmony reexport easeSinOut */ /* unused harmony reexport easeSinInOut */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__src_exp__ = __webpack_require__("./node_modules/d3-ease/src/exp.js"); /* unused harmony reexport easeExp */ /* unused harmony reexport easeExpIn */ /* unused harmony reexport easeExpOut */ /* unused harmony reexport easeExpInOut */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__src_circle__ = __webpack_require__("./node_modules/d3-ease/src/circle.js"); /* unused harmony reexport easeCircle */ /* unused harmony reexport easeCircleIn */ /* unused harmony reexport easeCircleOut */ /* unused harmony reexport easeCircleInOut */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__src_bounce__ = __webpack_require__("./node_modules/d3-ease/src/bounce.js"); /* unused harmony reexport easeBounce */ /* unused harmony reexport easeBounceIn */ /* unused harmony reexport easeBounceOut */ /* unused harmony reexport easeBounceInOut */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__src_back__ = __webpack_require__("./node_modules/d3-ease/src/back.js"); /* unused harmony reexport easeBack */ /* unused harmony reexport easeBackIn */ /* unused harmony reexport easeBackOut */ /* unused harmony reexport easeBackInOut */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__src_elastic__ = __webpack_require__("./node_modules/d3-ease/src/elastic.js"); /* unused harmony reexport easeElastic */ /* unused harmony reexport easeElasticIn */ /* unused harmony reexport easeElasticOut */ /* unused harmony reexport easeElasticInOut */ /***/ }), /***/ "./node_modules/d3-ease/src/back.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export backIn */ /* unused harmony export backOut */ /* unused harmony export backInOut */ var overshoot = 1.70158; var backIn = (function custom(s) { s = +s; function backIn(t) { return t * t * ((s + 1) * t - s); } backIn.overshoot = custom; return backIn; })(overshoot); var backOut = (function custom(s) { s = +s; function backOut(t) { return --t * t * ((s + 1) * t + s) + 1; } backOut.overshoot = custom; return backOut; })(overshoot); var backInOut = (function custom(s) { s = +s; function backInOut(t) { return ((t *= 2) < 1 ? t * t * ((s + 1) * t - s) : (t -= 2) * t * ((s + 1) * t + s) + 2) / 2; } backInOut.overshoot = custom; return backInOut; })(overshoot); /***/ }), /***/ "./node_modules/d3-ease/src/bounce.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export bounceIn */ /* unused harmony export bounceOut */ /* unused harmony export bounceInOut */ var b1 = 4 / 11, b2 = 6 / 11, b3 = 8 / 11, b4 = 3 / 4, b5 = 9 / 11, b6 = 10 / 11, b7 = 15 / 16, b8 = 21 / 22, b9 = 63 / 64, b0 = 1 / b1 / b1; function bounceIn(t) { return 1 - bounceOut(1 - t); } function bounceOut(t) { return (t = +t) < b1 ? b0 * t * t : t < b3 ? b0 * (t -= b2) * t + b4 : t < b6 ? b0 * (t -= b5) * t + b7 : b0 * (t -= b8) * t + b9; } function bounceInOut(t) { return ((t *= 2) <= 1 ? 1 - bounceOut(1 - t) : bounceOut(t - 1) + 1) / 2; } /***/ }), /***/ "./node_modules/d3-ease/src/circle.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export circleIn */ /* unused harmony export circleOut */ /* unused harmony export circleInOut */ function circleIn(t) { return 1 - Math.sqrt(1 - t * t); } function circleOut(t) { return Math.sqrt(1 - --t * t); } function circleInOut(t) { return ((t *= 2) <= 1 ? 1 - Math.sqrt(1 - t * t) : Math.sqrt(1 - (t -= 2) * t) + 1) / 2; } /***/ }), /***/ "./node_modules/d3-ease/src/cubic.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export cubicIn */ /* unused harmony export cubicOut */ /* harmony export (immutable) */ __webpack_exports__["a"] = cubicInOut; function cubicIn(t) { return t * t * t; } function cubicOut(t) { return --t * t * t + 1; } function cubicInOut(t) { return ((t *= 2) <= 1 ? t * t * t : (t -= 2) * t * t + 2) / 2; } /***/ }), /***/ "./node_modules/d3-ease/src/elastic.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export elasticIn */ /* unused harmony export elasticOut */ /* unused harmony export elasticInOut */ var tau = 2 * Math.PI, amplitude = 1, period = 0.3; var elasticIn = (function custom(a, p) { var s = Math.asin(1 / (a = Math.max(1, a))) * (p /= tau); function elasticIn(t) { return a * Math.pow(2, 10 * --t) * Math.sin((s - t) / p); } elasticIn.amplitude = function(a) { return custom(a, p * tau); }; elasticIn.period = function(p) { return custom(a, p); }; return elasticIn; })(amplitude, period); var elasticOut = (function custom(a, p) { var s = Math.asin(1 / (a = Math.max(1, a))) * (p /= tau); function elasticOut(t) { return 1 - a * Math.pow(2, -10 * (t = +t)) * Math.sin((t + s) / p); } elasticOut.amplitude = function(a) { return custom(a, p * tau); }; elasticOut.period = function(p) { return custom(a, p); }; return elasticOut; })(amplitude, period); var elasticInOut = (function custom(a, p) { var s = Math.asin(1 / (a = Math.max(1, a))) * (p /= tau); function elasticInOut(t) { return ((t = t * 2 - 1) < 0 ? a * Math.pow(2, 10 * t) * Math.sin((s - t) / p) : 2 - a * Math.pow(2, -10 * t) * Math.sin((s + t) / p)) / 2; } elasticInOut.amplitude = function(a) { return custom(a, p * tau); }; elasticInOut.period = function(p) { return custom(a, p); }; return elasticInOut; })(amplitude, period); /***/ }), /***/ "./node_modules/d3-ease/src/exp.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export expIn */ /* unused harmony export expOut */ /* unused harmony export expInOut */ function expIn(t) { return Math.pow(2, 10 * t - 10); } function expOut(t) { return 1 - Math.pow(2, -10 * t); } function expInOut(t) { return ((t *= 2) <= 1 ? Math.pow(2, 10 * t - 10) : 2 - Math.pow(2, 10 - 10 * t)) / 2; } /***/ }), /***/ "./node_modules/d3-ease/src/linear.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export linear */ function linear(t) { return +t; } /***/ }), /***/ "./node_modules/d3-ease/src/poly.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export polyIn */ /* unused harmony export polyOut */ /* unused harmony export polyInOut */ var exponent = 3; var polyIn = (function custom(e) { e = +e; function polyIn(t) { return Math.pow(t, e); } polyIn.exponent = custom; return polyIn; })(exponent); var polyOut = (function custom(e) { e = +e; function polyOut(t) { return 1 - Math.pow(1 - t, e); } polyOut.exponent = custom; return polyOut; })(exponent); var polyInOut = (function custom(e) { e = +e; function polyInOut(t) { return ((t *= 2) <= 1 ? Math.pow(t, e) : 2 - Math.pow(2 - t, e)) / 2; } polyInOut.exponent = custom; return polyInOut; })(exponent); /***/ }), /***/ "./node_modules/d3-ease/src/quad.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export quadIn */ /* unused harmony export quadOut */ /* unused harmony export quadInOut */ function quadIn(t) { return t * t; } function quadOut(t) { return t * (2 - t); } function quadInOut(t) { return ((t *= 2) <= 1 ? t * t : --t * (2 - t) + 1) / 2; } /***/ }), /***/ "./node_modules/d3-ease/src/sin.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export sinIn */ /* unused harmony export sinOut */ /* unused harmony export sinInOut */ var pi = Math.PI, halfPi = pi / 2; function sinIn(t) { return 1 - Math.cos(t * halfPi); } function sinOut(t) { return Math.sin(t * halfPi); } function sinInOut(t) { return (1 - Math.cos(pi * t)) / 2; } /***/ }), /***/ "./node_modules/d3-force/index.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__src_center__ = __webpack_require__("./node_modules/d3-force/src/center.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "forceCenter", function() { return __WEBPACK_IMPORTED_MODULE_0__src_center__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__src_collide__ = __webpack_require__("./node_modules/d3-force/src/collide.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "forceCollide", function() { return __WEBPACK_IMPORTED_MODULE_1__src_collide__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__src_link__ = __webpack_require__("./node_modules/d3-force/src/link.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "forceLink", function() { return __WEBPACK_IMPORTED_MODULE_2__src_link__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__src_manyBody__ = __webpack_require__("./node_modules/d3-force/src/manyBody.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "forceManyBody", function() { return __WEBPACK_IMPORTED_MODULE_3__src_manyBody__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__src_radial__ = __webpack_require__("./node_modules/d3-force/src/radial.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "forceRadial", function() { return __WEBPACK_IMPORTED_MODULE_4__src_radial__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__src_simulation__ = __webpack_require__("./node_modules/d3-force/src/simulation.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "forceSimulation", function() { return __WEBPACK_IMPORTED_MODULE_5__src_simulation__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__src_x__ = __webpack_require__("./node_modules/d3-force/src/x.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "forceX", function() { return __WEBPACK_IMPORTED_MODULE_6__src_x__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__src_y__ = __webpack_require__("./node_modules/d3-force/src/y.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "forceY", function() { return __WEBPACK_IMPORTED_MODULE_7__src_y__["a"]; }); /***/ }), /***/ "./node_modules/d3-force/src/center.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony default export */ __webpack_exports__["a"] = (function(x, y) { var nodes; if (x == null) x = 0; if (y == null) y = 0; function force() { var i, n = nodes.length, node, sx = 0, sy = 0; for (i = 0; i < n; ++i) { node = nodes[i], sx += node.x, sy += node.y; } for (sx = sx / n - x, sy = sy / n - y, i = 0; i < n; ++i) { node = nodes[i], node.x -= sx, node.y -= sy; } } force.initialize = function(_) { nodes = _; }; force.x = function(_) { return arguments.length ? (x = +_, force) : x; }; force.y = function(_) { return arguments.length ? (y = +_, force) : y; }; return force; }); /***/ }), /***/ "./node_modules/d3-force/src/collide.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__constant__ = __webpack_require__("./node_modules/d3-force/src/constant.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__jiggle__ = __webpack_require__("./node_modules/d3-force/src/jiggle.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_d3_quadtree__ = __webpack_require__("./node_modules/d3-quadtree/index.js"); function x(d) { return d.x + d.vx; } function y(d) { return d.y + d.vy; } /* harmony default export */ __webpack_exports__["a"] = (function(radius) { var nodes, radii, strength = 1, iterations = 1; if (typeof radius !== "function") radius = Object(__WEBPACK_IMPORTED_MODULE_0__constant__["a" /* default */])(radius == null ? 1 : +radius); function force() { var i, n = nodes.length, tree, node, xi, yi, ri, ri2; for (var k = 0; k < iterations; ++k) { tree = Object(__WEBPACK_IMPORTED_MODULE_2_d3_quadtree__["a" /* quadtree */])(nodes, x, y).visitAfter(prepare); for (i = 0; i < n; ++i) { node = nodes[i]; ri = radii[node.index], ri2 = ri * ri; xi = node.x + node.vx; yi = node.y + node.vy; tree.visit(apply); } } function apply(quad, x0, y0, x1, y1) { var data = quad.data, rj = quad.r, r = ri + rj; if (data) { if (data.index > node.index) { var x = xi - data.x - data.vx, y = yi - data.y - data.vy, l = x * x + y * y; if (l < r * r) { if (x === 0) x = Object(__WEBPACK_IMPORTED_MODULE_1__jiggle__["a" /* default */])(), l += x * x; if (y === 0) y = Object(__WEBPACK_IMPORTED_MODULE_1__jiggle__["a" /* default */])(), l += y * y; l = (r - (l = Math.sqrt(l))) / l * strength; node.vx += (x *= l) * (r = (rj *= rj) / (ri2 + rj)); node.vy += (y *= l) * r; data.vx -= x * (r = 1 - r); data.vy -= y * r; } } return; } return x0 > xi + r || x1 < xi - r || y0 > yi + r || y1 < yi - r; } } function prepare(quad) { if (quad.data) return quad.r = radii[quad.data.index]; for (var i = quad.r = 0; i < 4; ++i) { if (quad[i] && quad[i].r > quad.r) { quad.r = quad[i].r; } } } function initialize() { if (!nodes) return; var i, n = nodes.length, node; radii = new Array(n); for (i = 0; i < n; ++i) node = nodes[i], radii[node.index] = +radius(node, i, nodes); } force.initialize = function(_) { nodes = _; initialize(); }; force.iterations = function(_) { return arguments.length ? (iterations = +_, force) : iterations; }; force.strength = function(_) { return arguments.length ? (strength = +_, force) : strength; }; force.radius = function(_) { return arguments.length ? (radius = typeof _ === "function" ? _ : Object(__WEBPACK_IMPORTED_MODULE_0__constant__["a" /* default */])(+_), initialize(), force) : radius; }; return force; }); /***/ }), /***/ "./node_modules/d3-force/src/constant.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony default export */ __webpack_exports__["a"] = (function(x) { return function() { return x; }; }); /***/ }), /***/ "./node_modules/d3-force/src/jiggle.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony default export */ __webpack_exports__["a"] = (function() { return (Math.random() - 0.5) * 1e-6; }); /***/ }), /***/ "./node_modules/d3-force/src/link.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__constant__ = __webpack_require__("./node_modules/d3-force/src/constant.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__jiggle__ = __webpack_require__("./node_modules/d3-force/src/jiggle.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_d3_collection__ = __webpack_require__("./node_modules/d3-collection/index.js"); function index(d) { return d.index; } function find(nodeById, nodeId) { var node = nodeById.get(nodeId); if (!node) throw new Error("missing: " + nodeId); return node; } /* harmony default export */ __webpack_exports__["a"] = (function(links) { var id = index, strength = defaultStrength, strengths, distance = Object(__WEBPACK_IMPORTED_MODULE_0__constant__["a" /* default */])(30), distances, nodes, count, bias, iterations = 1; if (links == null) links = []; function defaultStrength(link) { return 1 / Math.min(count[link.source.index], count[link.target.index]); } function force(alpha) { for (var k = 0, n = links.length; k < iterations; ++k) { for (var i = 0, link, source, target, x, y, l, b; i < n; ++i) { link = links[i], source = link.source, target = link.target; x = target.x + target.vx - source.x - source.vx || Object(__WEBPACK_IMPORTED_MODULE_1__jiggle__["a" /* default */])(); y = target.y + target.vy - source.y - source.vy || Object(__WEBPACK_IMPORTED_MODULE_1__jiggle__["a" /* default */])(); l = Math.sqrt(x * x + y * y); l = (l - distances[i]) / l * alpha * strengths[i]; x *= l, y *= l; target.vx -= x * (b = bias[i]); target.vy -= y * b; source.vx += x * (b = 1 - b); source.vy += y * b; } } } function initialize() { if (!nodes) return; var i, n = nodes.length, m = links.length, nodeById = Object(__WEBPACK_IMPORTED_MODULE_2_d3_collection__["a" /* map */])(nodes, id), link; for (i = 0, count = new Array(n); i < m; ++i) { link = links[i], link.index = i; if (typeof link.source !== "object") link.source = find(nodeById, link.source); if (typeof link.target !== "object") link.target = find(nodeById, link.target); count[link.source.index] = (count[link.source.index] || 0) + 1; count[link.target.index] = (count[link.target.index] || 0) + 1; } for (i = 0, bias = new Array(m); i < m; ++i) { link = links[i], bias[i] = count[link.source.index] / (count[link.source.index] + count[link.target.index]); } strengths = new Array(m), initializeStrength(); distances = new Array(m), initializeDistance(); } function initializeStrength() { if (!nodes) return; for (var i = 0, n = links.length; i < n; ++i) { strengths[i] = +strength(links[i], i, links); } } function initializeDistance() { if (!nodes) return; for (var i = 0, n = links.length; i < n; ++i) { distances[i] = +distance(links[i], i, links); } } force.initialize = function(_) { nodes = _; initialize(); }; force.links = function(_) { return arguments.length ? (links = _, initialize(), force) : links; }; force.id = function(_) { return arguments.length ? (id = _, force) : id; }; force.iterations = function(_) { return arguments.length ? (iterations = +_, force) : iterations; }; force.strength = function(_) { return arguments.length ? (strength = typeof _ === "function" ? _ : Object(__WEBPACK_IMPORTED_MODULE_0__constant__["a" /* default */])(+_), initializeStrength(), force) : strength; }; force.distance = function(_) { return arguments.length ? (distance = typeof _ === "function" ? _ : Object(__WEBPACK_IMPORTED_MODULE_0__constant__["a" /* default */])(+_), initializeDistance(), force) : distance; }; return force; }); /***/ }), /***/ "./node_modules/d3-force/src/manyBody.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__constant__ = __webpack_require__("./node_modules/d3-force/src/constant.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__jiggle__ = __webpack_require__("./node_modules/d3-force/src/jiggle.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_d3_quadtree__ = __webpack_require__("./node_modules/d3-quadtree/index.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__simulation__ = __webpack_require__("./node_modules/d3-force/src/simulation.js"); /* harmony default export */ __webpack_exports__["a"] = (function() { var nodes, node, alpha, strength = Object(__WEBPACK_IMPORTED_MODULE_0__constant__["a" /* default */])(-30), strengths, distanceMin2 = 1, distanceMax2 = Infinity, theta2 = 0.81; function force(_) { var i, n = nodes.length, tree = Object(__WEBPACK_IMPORTED_MODULE_2_d3_quadtree__["a" /* quadtree */])(nodes, __WEBPACK_IMPORTED_MODULE_3__simulation__["b" /* x */], __WEBPACK_IMPORTED_MODULE_3__simulation__["c" /* y */]).visitAfter(accumulate); for (alpha = _, i = 0; i < n; ++i) node = nodes[i], tree.visit(apply); } function initialize() { if (!nodes) return; var i, n = nodes.length, node; strengths = new Array(n); for (i = 0; i < n; ++i) node = nodes[i], strengths[node.index] = +strength(node, i, nodes); } function accumulate(quad) { var strength = 0, q, c, weight = 0, x, y, i; // For internal nodes, accumulate forces from child quadrants. if (quad.length) { for (x = y = i = 0; i < 4; ++i) { if ((q = quad[i]) && (c = Math.abs(q.value))) { strength += q.value, weight += c, x += c * q.x, y += c * q.y; } } quad.x = x / weight; quad.y = y / weight; } // For leaf nodes, accumulate forces from coincident quadrants. else { q = quad; q.x = q.data.x; q.y = q.data.y; do strength += strengths[q.data.index]; while (q = q.next); } quad.value = strength; } function apply(quad, x1, _, x2) { if (!quad.value) return true; var x = quad.x - node.x, y = quad.y - node.y, w = x2 - x1, l = x * x + y * y; // Apply the Barnes-Hut approximation if possible. // Limit forces for very close nodes; randomize direction if coincident. if (w * w / theta2 < l) { if (l < distanceMax2) { if (x === 0) x = Object(__WEBPACK_IMPORTED_MODULE_1__jiggle__["a" /* default */])(), l += x * x; if (y === 0) y = Object(__WEBPACK_IMPORTED_MODULE_1__jiggle__["a" /* default */])(), l += y * y; if (l < distanceMin2) l = Math.sqrt(distanceMin2 * l); node.vx += x * quad.value * alpha / l; node.vy += y * quad.value * alpha / l; } return true; } // Otherwise, process points directly. else if (quad.length || l >= distanceMax2) return; // Limit forces for very close nodes; randomize direction if coincident. if (quad.data !== node || quad.next) { if (x === 0) x = Object(__WEBPACK_IMPORTED_MODULE_1__jiggle__["a" /* default */])(), l += x * x; if (y === 0) y = Object(__WEBPACK_IMPORTED_MODULE_1__jiggle__["a" /* default */])(), l += y * y; if (l < distanceMin2) l = Math.sqrt(distanceMin2 * l); } do if (quad.data !== node) { w = strengths[quad.data.index] * alpha / l; node.vx += x * w; node.vy += y * w; } while (quad = quad.next); } force.initialize = function(_) { nodes = _; initialize(); }; force.strength = function(_) { return arguments.length ? (strength = typeof _ === "function" ? _ : Object(__WEBPACK_IMPORTED_MODULE_0__constant__["a" /* default */])(+_), initialize(), force) : strength; }; force.distanceMin = function(_) { return arguments.length ? (distanceMin2 = _ * _, force) : Math.sqrt(distanceMin2); }; force.distanceMax = function(_) { return arguments.length ? (distanceMax2 = _ * _, force) : Math.sqrt(distanceMax2); }; force.theta = function(_) { return arguments.length ? (theta2 = _ * _, force) : Math.sqrt(theta2); }; return force; }); /***/ }), /***/ "./node_modules/d3-force/src/radial.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__constant__ = __webpack_require__("./node_modules/d3-force/src/constant.js"); /* harmony default export */ __webpack_exports__["a"] = (function(radius, x, y) { var nodes, strength = Object(__WEBPACK_IMPORTED_MODULE_0__constant__["a" /* default */])(0.1), strengths, radiuses; if (typeof radius !== "function") radius = Object(__WEBPACK_IMPORTED_MODULE_0__constant__["a" /* default */])(+radius); if (x == null) x = 0; if (y == null) y = 0; function force(alpha) { for (var i = 0, n = nodes.length; i < n; ++i) { var node = nodes[i], dx = node.x - x || 1e-6, dy = node.y - y || 1e-6, r = Math.sqrt(dx * dx + dy * dy), k = (radiuses[i] - r) * strengths[i] * alpha / r; node.vx += dx * k; node.vy += dy * k; } } function initialize() { if (!nodes) return; var i, n = nodes.length; strengths = new Array(n); radiuses = new Array(n); for (i = 0; i < n; ++i) { radiuses[i] = +radius(nodes[i], i, nodes); strengths[i] = isNaN(radiuses[i]) ? 0 : +strength(nodes[i], i, nodes); } } force.initialize = function(_) { nodes = _, initialize(); }; force.strength = function(_) { return arguments.length ? (strength = typeof _ === "function" ? _ : Object(__WEBPACK_IMPORTED_MODULE_0__constant__["a" /* default */])(+_), initialize(), force) : strength; }; force.radius = function(_) { return arguments.length ? (radius = typeof _ === "function" ? _ : Object(__WEBPACK_IMPORTED_MODULE_0__constant__["a" /* default */])(+_), initialize(), force) : radius; }; force.x = function(_) { return arguments.length ? (x = +_, force) : x; }; force.y = function(_) { return arguments.length ? (y = +_, force) : y; }; return force; }); /***/ }), /***/ "./node_modules/d3-force/src/simulation.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["b"] = x; /* harmony export (immutable) */ __webpack_exports__["c"] = y; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_d3_dispatch__ = __webpack_require__("./node_modules/d3-dispatch/index.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_d3_collection__ = __webpack_require__("./node_modules/d3-collection/index.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_d3_timer__ = __webpack_require__("./node_modules/d3-timer/index.js"); function x(d) { return d.x; } function y(d) { return d.y; } var initialRadius = 10, initialAngle = Math.PI * (3 - Math.sqrt(5)); /* harmony default export */ __webpack_exports__["a"] = (function(nodes) { var simulation, alpha = 1, alphaMin = 0.001, alphaDecay = 1 - Math.pow(alphaMin, 1 / 300), alphaTarget = 0, velocityDecay = 0.6, forces = Object(__WEBPACK_IMPORTED_MODULE_1_d3_collection__["a" /* map */])(), stepper = Object(__WEBPACK_IMPORTED_MODULE_2_d3_timer__["c" /* timer */])(step), event = Object(__WEBPACK_IMPORTED_MODULE_0_d3_dispatch__["a" /* dispatch */])("tick", "end"); if (nodes == null) nodes = []; function step() { tick(); event.call("tick", simulation); if (alpha < alphaMin) { stepper.stop(); event.call("end", simulation); } } function tick() { var i, n = nodes.length, node; alpha += (alphaTarget - alpha) * alphaDecay; forces.each(function(force) { force(alpha); }); for (i = 0; i < n; ++i) { node = nodes[i]; if (node.fx == null) node.x += node.vx *= velocityDecay; else node.x = node.fx, node.vx = 0; if (node.fy == null) node.y += node.vy *= velocityDecay; else node.y = node.fy, node.vy = 0; } } function initializeNodes() { for (var i = 0, n = nodes.length, node; i < n; ++i) { node = nodes[i], node.index = i; if (isNaN(node.x) || isNaN(node.y)) { var radius = initialRadius * Math.sqrt(i), angle = i * initialAngle; node.x = radius * Math.cos(angle); node.y = radius * Math.sin(angle); } if (isNaN(node.vx) || isNaN(node.vy)) { node.vx = node.vy = 0; } } } function initializeForce(force) { if (force.initialize) force.initialize(nodes); return force; } initializeNodes(); return simulation = { tick: tick, restart: function() { return stepper.restart(step), simulation; }, stop: function() { return stepper.stop(), simulation; }, nodes: function(_) { return arguments.length ? (nodes = _, initializeNodes(), forces.each(initializeForce), simulation) : nodes; }, alpha: function(_) { return arguments.length ? (alpha = +_, simulation) : alpha; }, alphaMin: function(_) { return arguments.length ? (alphaMin = +_, simulation) : alphaMin; }, alphaDecay: function(_) { return arguments.length ? (alphaDecay = +_, simulation) : +alphaDecay; }, alphaTarget: function(_) { return arguments.length ? (alphaTarget = +_, simulation) : alphaTarget; }, velocityDecay: function(_) { return arguments.length ? (velocityDecay = 1 - _, simulation) : 1 - velocityDecay; }, force: function(name, _) { return arguments.length > 1 ? ((_ == null ? forces.remove(name) : forces.set(name, initializeForce(_))), simulation) : forces.get(name); }, find: function(x, y, radius) { var i = 0, n = nodes.length, dx, dy, d2, node, closest; if (radius == null) radius = Infinity; else radius *= radius; for (i = 0; i < n; ++i) { node = nodes[i]; dx = x - node.x; dy = y - node.y; d2 = dx * dx + dy * dy; if (d2 < radius) closest = node, radius = d2; } return closest; }, on: function(name, _) { return arguments.length > 1 ? (event.on(name, _), simulation) : event.on(name); } }; }); /***/ }), /***/ "./node_modules/d3-force/src/x.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__constant__ = __webpack_require__("./node_modules/d3-force/src/constant.js"); /* harmony default export */ __webpack_exports__["a"] = (function(x) { var strength = Object(__WEBPACK_IMPORTED_MODULE_0__constant__["a" /* default */])(0.1), nodes, strengths, xz; if (typeof x !== "function") x = Object(__WEBPACK_IMPORTED_MODULE_0__constant__["a" /* default */])(x == null ? 0 : +x); function force(alpha) { for (var i = 0, n = nodes.length, node; i < n; ++i) { node = nodes[i], node.vx += (xz[i] - node.x) * strengths[i] * alpha; } } function initialize() { if (!nodes) return; var i, n = nodes.length; strengths = new Array(n); xz = new Array(n); for (i = 0; i < n; ++i) { strengths[i] = isNaN(xz[i] = +x(nodes[i], i, nodes)) ? 0 : +strength(nodes[i], i, nodes); } } force.initialize = function(_) { nodes = _; initialize(); }; force.strength = function(_) { return arguments.length ? (strength = typeof _ === "function" ? _ : Object(__WEBPACK_IMPORTED_MODULE_0__constant__["a" /* default */])(+_), initialize(), force) : strength; }; force.x = function(_) { return arguments.length ? (x = typeof _ === "function" ? _ : Object(__WEBPACK_IMPORTED_MODULE_0__constant__["a" /* default */])(+_), initialize(), force) : x; }; return force; }); /***/ }), /***/ "./node_modules/d3-force/src/y.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__constant__ = __webpack_require__("./node_modules/d3-force/src/constant.js"); /* harmony default export */ __webpack_exports__["a"] = (function(y) { var strength = Object(__WEBPACK_IMPORTED_MODULE_0__constant__["a" /* default */])(0.1), nodes, strengths, yz; if (typeof y !== "function") y = Object(__WEBPACK_IMPORTED_MODULE_0__constant__["a" /* default */])(y == null ? 0 : +y); function force(alpha) { for (var i = 0, n = nodes.length, node; i < n; ++i) { node = nodes[i], node.vy += (yz[i] - node.y) * strengths[i] * alpha; } } function initialize() { if (!nodes) return; var i, n = nodes.length; strengths = new Array(n); yz = new Array(n); for (i = 0; i < n; ++i) { strengths[i] = isNaN(yz[i] = +y(nodes[i], i, nodes)) ? 0 : +strength(nodes[i], i, nodes); } } force.initialize = function(_) { nodes = _; initialize(); }; force.strength = function(_) { return arguments.length ? (strength = typeof _ === "function" ? _ : Object(__WEBPACK_IMPORTED_MODULE_0__constant__["a" /* default */])(+_), initialize(), force) : strength; }; force.y = function(_) { return arguments.length ? (y = typeof _ === "function" ? _ : Object(__WEBPACK_IMPORTED_MODULE_0__constant__["a" /* default */])(+_), initialize(), force) : y; }; return force; }); /***/ }), /***/ "./node_modules/d3-format/index.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__src_defaultLocale__ = __webpack_require__("./node_modules/d3-format/src/defaultLocale.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "formatDefaultLocale", function() { return __WEBPACK_IMPORTED_MODULE_0__src_defaultLocale__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "format", function() { return __WEBPACK_IMPORTED_MODULE_0__src_defaultLocale__["b"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "formatPrefix", function() { return __WEBPACK_IMPORTED_MODULE_0__src_defaultLocale__["c"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__src_locale__ = __webpack_require__("./node_modules/d3-format/src/locale.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "formatLocale", function() { return __WEBPACK_IMPORTED_MODULE_1__src_locale__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__src_formatSpecifier__ = __webpack_require__("./node_modules/d3-format/src/formatSpecifier.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "formatSpecifier", function() { return __WEBPACK_IMPORTED_MODULE_2__src_formatSpecifier__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__src_precisionFixed__ = __webpack_require__("./node_modules/d3-format/src/precisionFixed.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "precisionFixed", function() { return __WEBPACK_IMPORTED_MODULE_3__src_precisionFixed__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__src_precisionPrefix__ = __webpack_require__("./node_modules/d3-format/src/precisionPrefix.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "precisionPrefix", function() { return __WEBPACK_IMPORTED_MODULE_4__src_precisionPrefix__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__src_precisionRound__ = __webpack_require__("./node_modules/d3-format/src/precisionRound.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "precisionRound", function() { return __WEBPACK_IMPORTED_MODULE_5__src_precisionRound__["a"]; }); /***/ }), /***/ "./node_modules/d3-format/src/defaultLocale.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return format; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return formatPrefix; }); /* harmony export (immutable) */ __webpack_exports__["a"] = defaultLocale; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__locale__ = __webpack_require__("./node_modules/d3-format/src/locale.js"); var locale; var format; var formatPrefix; defaultLocale({ decimal: ".", thousands: ",", grouping: [3], currency: ["$", ""] }); function defaultLocale(definition) { locale = Object(__WEBPACK_IMPORTED_MODULE_0__locale__["a" /* default */])(definition); format = locale.format; formatPrefix = locale.formatPrefix; return locale; } /***/ }), /***/ "./node_modules/d3-format/src/exponent.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__formatDecimal__ = __webpack_require__("./node_modules/d3-format/src/formatDecimal.js"); /* harmony default export */ __webpack_exports__["a"] = (function(x) { return x = Object(__WEBPACK_IMPORTED_MODULE_0__formatDecimal__["a" /* default */])(Math.abs(x)), x ? x[1] : NaN; }); /***/ }), /***/ "./node_modules/d3-format/src/formatDecimal.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; // Computes the decimal coefficient and exponent of the specified number x with // significant digits p, where x is positive and p is in [1, 21] or undefined. // For example, formatDecimal(1.23) returns ["123", 0]. /* harmony default export */ __webpack_exports__["a"] = (function(x, p) { if ((i = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf("e")) < 0) return null; // NaN, ±Infinity var i, coefficient = x.slice(0, i); // The string returned by toExponential either has the form \d\.\d+e[-+]\d+ // (e.g., 1.2e+3) or the form \de[-+]\d+ (e.g., 1e+3). return [ coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient, +x.slice(i + 1) ]; }); /***/ }), /***/ "./node_modules/d3-format/src/formatGroup.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony default export */ __webpack_exports__["a"] = (function(grouping, thousands) { return function(value, width) { var i = value.length, t = [], j = 0, g = grouping[0], length = 0; while (i > 0 && g > 0) { if (length + g + 1 > width) g = Math.max(1, width - length); t.push(value.substring(i -= g, i + g)); if ((length += g + 1) > width) break; g = grouping[j = (j + 1) % grouping.length]; } return t.reverse().join(thousands); }; }); /***/ }), /***/ "./node_modules/d3-format/src/formatNumerals.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony default export */ __webpack_exports__["a"] = (function(numerals) { return function(value) { return value.replace(/[0-9]/g, function(i) { return numerals[+i]; }); }; }); /***/ }), /***/ "./node_modules/d3-format/src/formatPrefixAuto.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return prefixExponent; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__formatDecimal__ = __webpack_require__("./node_modules/d3-format/src/formatDecimal.js"); var prefixExponent; /* harmony default export */ __webpack_exports__["a"] = (function(x, p) { var d = Object(__WEBPACK_IMPORTED_MODULE_0__formatDecimal__["a" /* default */])(x, p); if (!d) return x + ""; var coefficient = d[0], exponent = d[1], i = exponent - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent / 3))) * 3) + 1, n = coefficient.length; return i === n ? coefficient : i > n ? coefficient + new Array(i - n + 1).join("0") : i > 0 ? coefficient.slice(0, i) + "." + coefficient.slice(i) : "0." + new Array(1 - i).join("0") + Object(__WEBPACK_IMPORTED_MODULE_0__formatDecimal__["a" /* default */])(x, Math.max(0, p + i - 1))[0]; // less than 1y! }); /***/ }), /***/ "./node_modules/d3-format/src/formatRounded.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__formatDecimal__ = __webpack_require__("./node_modules/d3-format/src/formatDecimal.js"); /* harmony default export */ __webpack_exports__["a"] = (function(x, p) { var d = Object(__WEBPACK_IMPORTED_MODULE_0__formatDecimal__["a" /* default */])(x, p); if (!d) return x + ""; var coefficient = d[0], exponent = d[1]; return exponent < 0 ? "0." + new Array(-exponent).join("0") + coefficient : coefficient.length > exponent + 1 ? coefficient.slice(0, exponent + 1) + "." + coefficient.slice(exponent + 1) : coefficient + new Array(exponent - coefficient.length + 2).join("0"); }); /***/ }), /***/ "./node_modules/d3-format/src/formatSpecifier.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = formatSpecifier; // [[fill]align][sign][symbol][0][width][,][.precision][~][type] var re = /^(?:(.)?([<>=^]))?([+\-\( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i; function formatSpecifier(specifier) { return new FormatSpecifier(specifier); } formatSpecifier.prototype = FormatSpecifier.prototype; // instanceof function FormatSpecifier(specifier) { if (!(match = re.exec(specifier))) throw new Error("invalid format: " + specifier); var match; this.fill = match[1] || " "; this.align = match[2] || ">"; this.sign = match[3] || "-"; this.symbol = match[4] || ""; this.zero = !!match[5]; this.width = match[6] && +match[6]; this.comma = !!match[7]; this.precision = match[8] && +match[8].slice(1); this.trim = !!match[9]; this.type = match[10] || ""; } FormatSpecifier.prototype.toString = function() { return this.fill + this.align + this.sign + this.symbol + (this.zero ? "0" : "") + (this.width == null ? "" : Math.max(1, this.width | 0)) + (this.comma ? "," : "") + (this.precision == null ? "" : "." + Math.max(0, this.precision | 0)) + (this.trim ? "~" : "") + this.type; }; /***/ }), /***/ "./node_modules/d3-format/src/formatTrim.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; // Trims insignificant zeros, e.g., replaces 1.2000k with 1.2k. /* harmony default export */ __webpack_exports__["a"] = (function(s) { out: for (var n = s.length, i = 1, i0 = -1, i1; i < n; ++i) { switch (s[i]) { case ".": i0 = i1 = i; break; case "0": if (i0 === 0) i0 = i; i1 = i; break; default: if (i0 > 0) { if (!+s[i]) break out; i0 = 0; } break; } } return i0 > 0 ? s.slice(0, i0) + s.slice(i1 + 1) : s; }); /***/ }), /***/ "./node_modules/d3-format/src/formatTypes.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__formatPrefixAuto__ = __webpack_require__("./node_modules/d3-format/src/formatPrefixAuto.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__formatRounded__ = __webpack_require__("./node_modules/d3-format/src/formatRounded.js"); /* harmony default export */ __webpack_exports__["a"] = ({ "%": function(x, p) { return (x * 100).toFixed(p); }, "b": function(x) { return Math.round(x).toString(2); }, "c": function(x) { return x + ""; }, "d": function(x) { return Math.round(x).toString(10); }, "e": function(x, p) { return x.toExponential(p); }, "f": function(x, p) { return x.toFixed(p); }, "g": function(x, p) { return x.toPrecision(p); }, "o": function(x) { return Math.round(x).toString(8); }, "p": function(x, p) { return Object(__WEBPACK_IMPORTED_MODULE_1__formatRounded__["a" /* default */])(x * 100, p); }, "r": __WEBPACK_IMPORTED_MODULE_1__formatRounded__["a" /* default */], "s": __WEBPACK_IMPORTED_MODULE_0__formatPrefixAuto__["a" /* default */], "X": function(x) { return Math.round(x).toString(16).toUpperCase(); }, "x": function(x) { return Math.round(x).toString(16); } }); /***/ }), /***/ "./node_modules/d3-format/src/identity.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony default export */ __webpack_exports__["a"] = (function(x) { return x; }); /***/ }), /***/ "./node_modules/d3-format/src/locale.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__exponent__ = __webpack_require__("./node_modules/d3-format/src/exponent.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__formatGroup__ = __webpack_require__("./node_modules/d3-format/src/formatGroup.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__formatNumerals__ = __webpack_require__("./node_modules/d3-format/src/formatNumerals.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__formatSpecifier__ = __webpack_require__("./node_modules/d3-format/src/formatSpecifier.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__formatTrim__ = __webpack_require__("./node_modules/d3-format/src/formatTrim.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__formatTypes__ = __webpack_require__("./node_modules/d3-format/src/formatTypes.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__formatPrefixAuto__ = __webpack_require__("./node_modules/d3-format/src/formatPrefixAuto.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__identity__ = __webpack_require__("./node_modules/d3-format/src/identity.js"); var prefixes = ["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"]; /* harmony default export */ __webpack_exports__["a"] = (function(locale) { var group = locale.grouping && locale.thousands ? Object(__WEBPACK_IMPORTED_MODULE_1__formatGroup__["a" /* default */])(locale.grouping, locale.thousands) : __WEBPACK_IMPORTED_MODULE_7__identity__["a" /* default */], currency = locale.currency, decimal = locale.decimal, numerals = locale.numerals ? Object(__WEBPACK_IMPORTED_MODULE_2__formatNumerals__["a" /* default */])(locale.numerals) : __WEBPACK_IMPORTED_MODULE_7__identity__["a" /* default */], percent = locale.percent || "%"; function newFormat(specifier) { specifier = Object(__WEBPACK_IMPORTED_MODULE_3__formatSpecifier__["a" /* default */])(specifier); var fill = specifier.fill, align = specifier.align, sign = specifier.sign, symbol = specifier.symbol, zero = specifier.zero, width = specifier.width, comma = specifier.comma, precision = specifier.precision, trim = specifier.trim, type = specifier.type; // The "n" type is an alias for ",g". if (type === "n") comma = true, type = "g"; // The "" type, and any invalid type, is an alias for ".12~g". else if (!__WEBPACK_IMPORTED_MODULE_5__formatTypes__["a" /* default */][type]) precision == null && (precision = 12), trim = true, type = "g"; // If zero fill is specified, padding goes after sign and before digits. if (zero || (fill === "0" && align === "=")) zero = true, fill = "0", align = "="; // Compute the prefix and suffix. // For SI-prefix, the suffix is lazily computed. var prefix = symbol === "$" ? currency[0] : symbol === "#" && /[boxX]/.test(type) ? "0" + type.toLowerCase() : "", suffix = symbol === "$" ? currency[1] : /[%p]/.test(type) ? percent : ""; // What format function should we use? // Is this an integer type? // Can this type generate exponential notation? var formatType = __WEBPACK_IMPORTED_MODULE_5__formatTypes__["a" /* default */][type], maybeSuffix = /[defgprs%]/.test(type); // Set the default precision if not specified, // or clamp the specified precision to the supported range. // For significant precision, it must be in [1, 21]. // For fixed precision, it must be in [0, 20]. precision = precision == null ? 6 : /[gprs]/.test(type) ? Math.max(1, Math.min(21, precision)) : Math.max(0, Math.min(20, precision)); function format(value) { var valuePrefix = prefix, valueSuffix = suffix, i, n, c; if (type === "c") { valueSuffix = formatType(value) + valueSuffix; value = ""; } else { value = +value; // Perform the initial formatting. var valueNegative = value < 0; value = formatType(Math.abs(value), precision); // Trim insignificant zeros. if (trim) value = Object(__WEBPACK_IMPORTED_MODULE_4__formatTrim__["a" /* default */])(value); // If a negative value rounds to zero during formatting, treat as positive. if (valueNegative && +value === 0) valueNegative = false; // Compute the prefix and suffix. valuePrefix = (valueNegative ? (sign === "(" ? sign : "-") : sign === "-" || sign === "(" ? "" : sign) + valuePrefix; valueSuffix = (type === "s" ? prefixes[8 + __WEBPACK_IMPORTED_MODULE_6__formatPrefixAuto__["b" /* prefixExponent */] / 3] : "") + valueSuffix + (valueNegative && sign === "(" ? ")" : ""); // Break the formatted value into the integer “value” part that can be // grouped, and fractional or exponential “suffix” part that is not. if (maybeSuffix) { i = -1, n = value.length; while (++i < n) { if (c = value.charCodeAt(i), 48 > c || c > 57) { valueSuffix = (c === 46 ? decimal + value.slice(i + 1) : value.slice(i)) + valueSuffix; value = value.slice(0, i); break; } } } } // If the fill character is not "0", grouping is applied before padding. if (comma && !zero) value = group(value, Infinity); // Compute the padding. var length = valuePrefix.length + value.length + valueSuffix.length, padding = length < width ? new Array(width - length + 1).join(fill) : ""; // If the fill character is "0", grouping is applied after padding. if (comma && zero) value = group(padding + value, padding.length ? width - valueSuffix.length : Infinity), padding = ""; // Reconstruct the final output based on the desired alignment. switch (align) { case "<": value = valuePrefix + value + valueSuffix + padding; break; case "=": value = valuePrefix + padding + value + valueSuffix; break; case "^": value = padding.slice(0, length = padding.length >> 1) + valuePrefix + value + valueSuffix + padding.slice(length); break; default: value = padding + valuePrefix + value + valueSuffix; break; } return numerals(value); } format.toString = function() { return specifier + ""; }; return format; } function formatPrefix(specifier, value) { var f = newFormat((specifier = Object(__WEBPACK_IMPORTED_MODULE_3__formatSpecifier__["a" /* default */])(specifier), specifier.type = "f", specifier)), e = Math.max(-8, Math.min(8, Math.floor(Object(__WEBPACK_IMPORTED_MODULE_0__exponent__["a" /* default */])(value) / 3))) * 3, k = Math.pow(10, -e), prefix = prefixes[8 + e / 3]; return function(value) { return f(k * value) + prefix; }; } return { format: newFormat, formatPrefix: formatPrefix }; }); /***/ }), /***/ "./node_modules/d3-format/src/precisionFixed.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__exponent__ = __webpack_require__("./node_modules/d3-format/src/exponent.js"); /* harmony default export */ __webpack_exports__["a"] = (function(step) { return Math.max(0, -Object(__WEBPACK_IMPORTED_MODULE_0__exponent__["a" /* default */])(Math.abs(step))); }); /***/ }), /***/ "./node_modules/d3-format/src/precisionPrefix.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__exponent__ = __webpack_require__("./node_modules/d3-format/src/exponent.js"); /* harmony default export */ __webpack_exports__["a"] = (function(step, value) { return Math.max(0, Math.max(-8, Math.min(8, Math.floor(Object(__WEBPACK_IMPORTED_MODULE_0__exponent__["a" /* default */])(value) / 3))) * 3 - Object(__WEBPACK_IMPORTED_MODULE_0__exponent__["a" /* default */])(Math.abs(step))); }); /***/ }), /***/ "./node_modules/d3-format/src/precisionRound.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__exponent__ = __webpack_require__("./node_modules/d3-format/src/exponent.js"); /* harmony default export */ __webpack_exports__["a"] = (function(step, max) { step = Math.abs(step), max = Math.abs(max) - step; return Math.max(0, Object(__WEBPACK_IMPORTED_MODULE_0__exponent__["a" /* default */])(max) - Object(__WEBPACK_IMPORTED_MODULE_0__exponent__["a" /* default */])(step)) + 1; }); /***/ }), /***/ "./node_modules/d3-hierarchy/index.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__src_cluster__ = __webpack_require__("./node_modules/d3-hierarchy/src/cluster.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "cluster", function() { return __WEBPACK_IMPORTED_MODULE_0__src_cluster__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__src_hierarchy_index__ = __webpack_require__("./node_modules/d3-hierarchy/src/hierarchy/index.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "hierarchy", function() { return __WEBPACK_IMPORTED_MODULE_1__src_hierarchy_index__["c"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__src_pack_index__ = __webpack_require__("./node_modules/d3-hierarchy/src/pack/index.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "pack", function() { return __WEBPACK_IMPORTED_MODULE_2__src_pack_index__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__src_pack_siblings__ = __webpack_require__("./node_modules/d3-hierarchy/src/pack/siblings.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "packSiblings", function() { return __WEBPACK_IMPORTED_MODULE_3__src_pack_siblings__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__src_pack_enclose__ = __webpack_require__("./node_modules/d3-hierarchy/src/pack/enclose.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "packEnclose", function() { return __WEBPACK_IMPORTED_MODULE_4__src_pack_enclose__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__src_partition__ = __webpack_require__("./node_modules/d3-hierarchy/src/partition.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "partition", function() { return __WEBPACK_IMPORTED_MODULE_5__src_partition__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__src_stratify__ = __webpack_require__("./node_modules/d3-hierarchy/src/stratify.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "stratify", function() { return __WEBPACK_IMPORTED_MODULE_6__src_stratify__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__src_tree__ = __webpack_require__("./node_modules/d3-hierarchy/src/tree.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "tree", function() { return __WEBPACK_IMPORTED_MODULE_7__src_tree__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__src_treemap_index__ = __webpack_require__("./node_modules/d3-hierarchy/src/treemap/index.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "treemap", function() { return __WEBPACK_IMPORTED_MODULE_8__src_treemap_index__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__src_treemap_binary__ = __webpack_require__("./node_modules/d3-hierarchy/src/treemap/binary.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "treemapBinary", function() { return __WEBPACK_IMPORTED_MODULE_9__src_treemap_binary__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__src_treemap_dice__ = __webpack_require__("./node_modules/d3-hierarchy/src/treemap/dice.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "treemapDice", function() { return __WEBPACK_IMPORTED_MODULE_10__src_treemap_dice__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__src_treemap_slice__ = __webpack_require__("./node_modules/d3-hierarchy/src/treemap/slice.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "treemapSlice", function() { return __WEBPACK_IMPORTED_MODULE_11__src_treemap_slice__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__src_treemap_sliceDice__ = __webpack_require__("./node_modules/d3-hierarchy/src/treemap/sliceDice.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "treemapSliceDice", function() { return __WEBPACK_IMPORTED_MODULE_12__src_treemap_sliceDice__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__src_treemap_squarify__ = __webpack_require__("./node_modules/d3-hierarchy/src/treemap/squarify.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "treemapSquarify", function() { return __WEBPACK_IMPORTED_MODULE_13__src_treemap_squarify__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__src_treemap_resquarify__ = __webpack_require__("./node_modules/d3-hierarchy/src/treemap/resquarify.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "treemapResquarify", function() { return __WEBPACK_IMPORTED_MODULE_14__src_treemap_resquarify__["a"]; }); /***/ }), /***/ "./node_modules/d3-hierarchy/src/accessors.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = optional; /* harmony export (immutable) */ __webpack_exports__["b"] = required; function optional(f) { return f == null ? null : required(f); } function required(f) { if (typeof f !== "function") throw new Error; return f; } /***/ }), /***/ "./node_modules/d3-hierarchy/src/array.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return slice; }); /* harmony export (immutable) */ __webpack_exports__["a"] = shuffle; var slice = Array.prototype.slice; function shuffle(array) { var m = array.length, t, i; while (m) { i = Math.random() * m-- | 0; t = array[m]; array[m] = array[i]; array[i] = t; } return array; } /***/ }), /***/ "./node_modules/d3-hierarchy/src/cluster.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; function defaultSeparation(a, b) { return a.parent === b.parent ? 1 : 2; } function meanX(children) { return children.reduce(meanXReduce, 0) / children.length; } function meanXReduce(x, c) { return x + c.x; } function maxY(children) { return 1 + children.reduce(maxYReduce, 0); } function maxYReduce(y, c) { return Math.max(y, c.y); } function leafLeft(node) { var children; while (children = node.children) node = children[0]; return node; } function leafRight(node) { var children; while (children = node.children) node = children[children.length - 1]; return node; } /* harmony default export */ __webpack_exports__["a"] = (function() { var separation = defaultSeparation, dx = 1, dy = 1, nodeSize = false; function cluster(root) { var previousNode, x = 0; // First walk, computing the initial x & y values. root.eachAfter(function(node) { var children = node.children; if (children) { node.x = meanX(children); node.y = maxY(children); } else { node.x = previousNode ? x += separation(node, previousNode) : 0; node.y = 0; previousNode = node; } }); var left = leafLeft(root), right = leafRight(root), x0 = left.x - separation(left, right) / 2, x1 = right.x + separation(right, left) / 2; // Second walk, normalizing x & y to the desired size. return root.eachAfter(nodeSize ? function(node) { node.x = (node.x - root.x) * dx; node.y = (root.y - node.y) * dy; } : function(node) { node.x = (node.x - x0) / (x1 - x0) * dx; node.y = (1 - (root.y ? node.y / root.y : 1)) * dy; }); } cluster.separation = function(x) { return arguments.length ? (separation = x, cluster) : separation; }; cluster.size = function(x) { return arguments.length ? (nodeSize = false, dx = +x[0], dy = +x[1], cluster) : (nodeSize ? null : [dx, dy]); }; cluster.nodeSize = function(x) { return arguments.length ? (nodeSize = true, dx = +x[0], dy = +x[1], cluster) : (nodeSize ? [dx, dy] : null); }; return cluster; }); /***/ }), /***/ "./node_modules/d3-hierarchy/src/constant.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = constantZero; function constantZero() { return 0; } /* harmony default export */ __webpack_exports__["b"] = (function(x) { return function() { return x; }; }); /***/ }), /***/ "./node_modules/d3-hierarchy/src/hierarchy/ancestors.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony default export */ __webpack_exports__["a"] = (function() { var node = this, nodes = [node]; while (node = node.parent) { nodes.push(node); } return nodes; }); /***/ }), /***/ "./node_modules/d3-hierarchy/src/hierarchy/count.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; function count(node) { var sum = 0, children = node.children, i = children && children.length; if (!i) sum = 1; else while (--i >= 0) sum += children[i].value; node.value = sum; } /* harmony default export */ __webpack_exports__["a"] = (function() { return this.eachAfter(count); }); /***/ }), /***/ "./node_modules/d3-hierarchy/src/hierarchy/descendants.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony default export */ __webpack_exports__["a"] = (function() { var nodes = []; this.each(function(node) { nodes.push(node); }); return nodes; }); /***/ }), /***/ "./node_modules/d3-hierarchy/src/hierarchy/each.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony default export */ __webpack_exports__["a"] = (function(callback) { var node = this, current, next = [node], children, i, n; do { current = next.reverse(), next = []; while (node = current.pop()) { callback(node), children = node.children; if (children) for (i = 0, n = children.length; i < n; ++i) { next.push(children[i]); } } } while (next.length); return this; }); /***/ }), /***/ "./node_modules/d3-hierarchy/src/hierarchy/eachAfter.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony default export */ __webpack_exports__["a"] = (function(callback) { var node = this, nodes = [node], next = [], children, i, n; while (node = nodes.pop()) { next.push(node), children = node.children; if (children) for (i = 0, n = children.length; i < n; ++i) { nodes.push(children[i]); } } while (node = next.pop()) { callback(node); } return this; }); /***/ }), /***/ "./node_modules/d3-hierarchy/src/hierarchy/eachBefore.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony default export */ __webpack_exports__["a"] = (function(callback) { var node = this, nodes = [node], children, i; while (node = nodes.pop()) { callback(node), children = node.children; if (children) for (i = children.length - 1; i >= 0; --i) { nodes.push(children[i]); } } return this; }); /***/ }), /***/ "./node_modules/d3-hierarchy/src/hierarchy/index.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["c"] = hierarchy; /* harmony export (immutable) */ __webpack_exports__["b"] = computeHeight; /* harmony export (immutable) */ __webpack_exports__["a"] = Node; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__count__ = __webpack_require__("./node_modules/d3-hierarchy/src/hierarchy/count.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__each__ = __webpack_require__("./node_modules/d3-hierarchy/src/hierarchy/each.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__eachBefore__ = __webpack_require__("./node_modules/d3-hierarchy/src/hierarchy/eachBefore.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__eachAfter__ = __webpack_require__("./node_modules/d3-hierarchy/src/hierarchy/eachAfter.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__sum__ = __webpack_require__("./node_modules/d3-hierarchy/src/hierarchy/sum.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__sort__ = __webpack_require__("./node_modules/d3-hierarchy/src/hierarchy/sort.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__path__ = __webpack_require__("./node_modules/d3-hierarchy/src/hierarchy/path.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__ancestors__ = __webpack_require__("./node_modules/d3-hierarchy/src/hierarchy/ancestors.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__descendants__ = __webpack_require__("./node_modules/d3-hierarchy/src/hierarchy/descendants.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__leaves__ = __webpack_require__("./node_modules/d3-hierarchy/src/hierarchy/leaves.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__links__ = __webpack_require__("./node_modules/d3-hierarchy/src/hierarchy/links.js"); function hierarchy(data, children) { var root = new Node(data), valued = +data.value && (root.value = data.value), node, nodes = [root], child, childs, i, n; if (children == null) children = defaultChildren; while (node = nodes.pop()) { if (valued) node.value = +node.data.value; if ((childs = children(node.data)) && (n = childs.length)) { node.children = new Array(n); for (i = n - 1; i >= 0; --i) { nodes.push(child = node.children[i] = new Node(childs[i])); child.parent = node; child.depth = node.depth + 1; } } } return root.eachBefore(computeHeight); } function node_copy() { return hierarchy(this).eachBefore(copyData); } function defaultChildren(d) { return d.children; } function copyData(node) { node.data = node.data.data; } function computeHeight(node) { var height = 0; do node.height = height; while ((node = node.parent) && (node.height < ++height)); } function Node(data) { this.data = data; this.depth = this.height = 0; this.parent = null; } Node.prototype = hierarchy.prototype = { constructor: Node, count: __WEBPACK_IMPORTED_MODULE_0__count__["a" /* default */], each: __WEBPACK_IMPORTED_MODULE_1__each__["a" /* default */], eachAfter: __WEBPACK_IMPORTED_MODULE_3__eachAfter__["a" /* default */], eachBefore: __WEBPACK_IMPORTED_MODULE_2__eachBefore__["a" /* default */], sum: __WEBPACK_IMPORTED_MODULE_4__sum__["a" /* default */], sort: __WEBPACK_IMPORTED_MODULE_5__sort__["a" /* default */], path: __WEBPACK_IMPORTED_MODULE_6__path__["a" /* default */], ancestors: __WEBPACK_IMPORTED_MODULE_7__ancestors__["a" /* default */], descendants: __WEBPACK_IMPORTED_MODULE_8__descendants__["a" /* default */], leaves: __WEBPACK_IMPORTED_MODULE_9__leaves__["a" /* default */], links: __WEBPACK_IMPORTED_MODULE_10__links__["a" /* default */], copy: node_copy }; /***/ }), /***/ "./node_modules/d3-hierarchy/src/hierarchy/leaves.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony default export */ __webpack_exports__["a"] = (function() { var leaves = []; this.eachBefore(function(node) { if (!node.children) { leaves.push(node); } }); return leaves; }); /***/ }), /***/ "./node_modules/d3-hierarchy/src/hierarchy/links.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony default export */ __webpack_exports__["a"] = (function() { var root = this, links = []; root.each(function(node) { if (node !== root) { // Don’t include the root’s parent, if any. links.push({source: node.parent, target: node}); } }); return links; }); /***/ }), /***/ "./node_modules/d3-hierarchy/src/hierarchy/path.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony default export */ __webpack_exports__["a"] = (function(end) { var start = this, ancestor = leastCommonAncestor(start, end), nodes = [start]; while (start !== ancestor) { start = start.parent; nodes.push(start); } var k = nodes.length; while (end !== ancestor) { nodes.splice(k, 0, end); end = end.parent; } return nodes; }); function leastCommonAncestor(a, b) { if (a === b) return a; var aNodes = a.ancestors(), bNodes = b.ancestors(), c = null; a = aNodes.pop(); b = bNodes.pop(); while (a === b) { c = a; a = aNodes.pop(); b = bNodes.pop(); } return c; } /***/ }), /***/ "./node_modules/d3-hierarchy/src/hierarchy/sort.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony default export */ __webpack_exports__["a"] = (function(compare) { return this.eachBefore(function(node) { if (node.children) { node.children.sort(compare); } }); }); /***/ }), /***/ "./node_modules/d3-hierarchy/src/hierarchy/sum.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony default export */ __webpack_exports__["a"] = (function(value) { return this.eachAfter(function(node) { var sum = +value(node.data) || 0, children = node.children, i = children && children.length; while (--i >= 0) sum += children[i].value; node.value = sum; }); }); /***/ }), /***/ "./node_modules/d3-hierarchy/src/pack/enclose.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__array__ = __webpack_require__("./node_modules/d3-hierarchy/src/array.js"); /* harmony default export */ __webpack_exports__["a"] = (function(circles) { var i = 0, n = (circles = Object(__WEBPACK_IMPORTED_MODULE_0__array__["a" /* shuffle */])(__WEBPACK_IMPORTED_MODULE_0__array__["b" /* slice */].call(circles))).length, B = [], p, e; while (i < n) { p = circles[i]; if (e && enclosesWeak(e, p)) ++i; else e = encloseBasis(B = extendBasis(B, p)), i = 0; } return e; }); function extendBasis(B, p) { var i, j; if (enclosesWeakAll(p, B)) return [p]; // If we get here then B must have at least one element. for (i = 0; i < B.length; ++i) { if (enclosesNot(p, B[i]) && enclosesWeakAll(encloseBasis2(B[i], p), B)) { return [B[i], p]; } } // If we get here then B must have at least two elements. for (i = 0; i < B.length - 1; ++i) { for (j = i + 1; j < B.length; ++j) { if (enclosesNot(encloseBasis2(B[i], B[j]), p) && enclosesNot(encloseBasis2(B[i], p), B[j]) && enclosesNot(encloseBasis2(B[j], p), B[i]) && enclosesWeakAll(encloseBasis3(B[i], B[j], p), B)) { return [B[i], B[j], p]; } } } // If we get here then something is very wrong. throw new Error; } function enclosesNot(a, b) { var dr = a.r - b.r, dx = b.x - a.x, dy = b.y - a.y; return dr < 0 || dr * dr < dx * dx + dy * dy; } function enclosesWeak(a, b) { var dr = a.r - b.r + 1e-6, dx = b.x - a.x, dy = b.y - a.y; return dr > 0 && dr * dr > dx * dx + dy * dy; } function enclosesWeakAll(a, B) { for (var i = 0; i < B.length; ++i) { if (!enclosesWeak(a, B[i])) { return false; } } return true; } function encloseBasis(B) { switch (B.length) { case 1: return encloseBasis1(B[0]); case 2: return encloseBasis2(B[0], B[1]); case 3: return encloseBasis3(B[0], B[1], B[2]); } } function encloseBasis1(a) { return { x: a.x, y: a.y, r: a.r }; } function encloseBasis2(a, b) { var x1 = a.x, y1 = a.y, r1 = a.r, x2 = b.x, y2 = b.y, r2 = b.r, x21 = x2 - x1, y21 = y2 - y1, r21 = r2 - r1, l = Math.sqrt(x21 * x21 + y21 * y21); return { x: (x1 + x2 + x21 / l * r21) / 2, y: (y1 + y2 + y21 / l * r21) / 2, r: (l + r1 + r2) / 2 }; } function encloseBasis3(a, b, c) { var x1 = a.x, y1 = a.y, r1 = a.r, x2 = b.x, y2 = b.y, r2 = b.r, x3 = c.x, y3 = c.y, r3 = c.r, a2 = x1 - x2, a3 = x1 - x3, b2 = y1 - y2, b3 = y1 - y3, c2 = r2 - r1, c3 = r3 - r1, d1 = x1 * x1 + y1 * y1 - r1 * r1, d2 = d1 - x2 * x2 - y2 * y2 + r2 * r2, d3 = d1 - x3 * x3 - y3 * y3 + r3 * r3, ab = a3 * b2 - a2 * b3, xa = (b2 * d3 - b3 * d2) / (ab * 2) - x1, xb = (b3 * c2 - b2 * c3) / ab, ya = (a3 * d2 - a2 * d3) / (ab * 2) - y1, yb = (a2 * c3 - a3 * c2) / ab, A = xb * xb + yb * yb - 1, B = 2 * (r1 + xa * xb + ya * yb), C = xa * xa + ya * ya - r1 * r1, r = -(A ? (B + Math.sqrt(B * B - 4 * A * C)) / (2 * A) : C / B); return { x: x1 + xa + xb * r, y: y1 + ya + yb * r, r: r }; } /***/ }), /***/ "./node_modules/d3-hierarchy/src/pack/index.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__siblings__ = __webpack_require__("./node_modules/d3-hierarchy/src/pack/siblings.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__accessors__ = __webpack_require__("./node_modules/d3-hierarchy/src/accessors.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__constant__ = __webpack_require__("./node_modules/d3-hierarchy/src/constant.js"); function defaultRadius(d) { return Math.sqrt(d.value); } /* harmony default export */ __webpack_exports__["a"] = (function() { var radius = null, dx = 1, dy = 1, padding = __WEBPACK_IMPORTED_MODULE_2__constant__["a" /* constantZero */]; function pack(root) { root.x = dx / 2, root.y = dy / 2; if (radius) { root.eachBefore(radiusLeaf(radius)) .eachAfter(packChildren(padding, 0.5)) .eachBefore(translateChild(1)); } else { root.eachBefore(radiusLeaf(defaultRadius)) .eachAfter(packChildren(__WEBPACK_IMPORTED_MODULE_2__constant__["a" /* constantZero */], 1)) .eachAfter(packChildren(padding, root.r / Math.min(dx, dy))) .eachBefore(translateChild(Math.min(dx, dy) / (2 * root.r))); } return root; } pack.radius = function(x) { return arguments.length ? (radius = Object(__WEBPACK_IMPORTED_MODULE_1__accessors__["a" /* optional */])(x), pack) : radius; }; pack.size = function(x) { return arguments.length ? (dx = +x[0], dy = +x[1], pack) : [dx, dy]; }; pack.padding = function(x) { return arguments.length ? (padding = typeof x === "function" ? x : Object(__WEBPACK_IMPORTED_MODULE_2__constant__["b" /* default */])(+x), pack) : padding; }; return pack; }); function radiusLeaf(radius) { return function(node) { if (!node.children) { node.r = Math.max(0, +radius(node) || 0); } }; } function packChildren(padding, k) { return function(node) { if (children = node.children) { var children, i, n = children.length, r = padding(node) * k || 0, e; if (r) for (i = 0; i < n; ++i) children[i].r += r; e = Object(__WEBPACK_IMPORTED_MODULE_0__siblings__["b" /* packEnclose */])(children); if (r) for (i = 0; i < n; ++i) children[i].r -= r; node.r = e + r; } }; } function translateChild(k) { return function(node) { var parent = node.parent; node.r *= k; if (parent) { node.x = parent.x + k * node.x; node.y = parent.y + k * node.y; } }; } /***/ }), /***/ "./node_modules/d3-hierarchy/src/pack/siblings.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["b"] = packEnclose; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__enclose__ = __webpack_require__("./node_modules/d3-hierarchy/src/pack/enclose.js"); function place(b, a, c) { var dx = b.x - a.x, x, a2, dy = b.y - a.y, y, b2, d2 = dx * dx + dy * dy; if (d2) { a2 = a.r + c.r, a2 *= a2; b2 = b.r + c.r, b2 *= b2; if (a2 > b2) { x = (d2 + b2 - a2) / (2 * d2); y = Math.sqrt(Math.max(0, b2 / d2 - x * x)); c.x = b.x - x * dx - y * dy; c.y = b.y - x * dy + y * dx; } else { x = (d2 + a2 - b2) / (2 * d2); y = Math.sqrt(Math.max(0, a2 / d2 - x * x)); c.x = a.x + x * dx - y * dy; c.y = a.y + x * dy + y * dx; } } else { c.x = a.x + c.r; c.y = a.y; } } function intersects(a, b) { var dr = a.r + b.r - 1e-6, dx = b.x - a.x, dy = b.y - a.y; return dr > 0 && dr * dr > dx * dx + dy * dy; } function score(node) { var a = node._, b = node.next._, ab = a.r + b.r, dx = (a.x * b.r + b.x * a.r) / ab, dy = (a.y * b.r + b.y * a.r) / ab; return dx * dx + dy * dy; } function Node(circle) { this._ = circle; this.next = null; this.previous = null; } function packEnclose(circles) { if (!(n = circles.length)) return 0; var a, b, c, n, aa, ca, i, j, k, sj, sk; // Place the first circle. a = circles[0], a.x = 0, a.y = 0; if (!(n > 1)) return a.r; // Place the second circle. b = circles[1], a.x = -b.r, b.x = a.r, b.y = 0; if (!(n > 2)) return a.r + b.r; // Place the third circle. place(b, a, c = circles[2]); // Initialize the front-chain using the first three circles a, b and c. a = new Node(a), b = new Node(b), c = new Node(c); a.next = c.previous = b; b.next = a.previous = c; c.next = b.previous = a; // Attempt to place each remaining circle… pack: for (i = 3; i < n; ++i) { place(a._, b._, c = circles[i]), c = new Node(c); // Find the closest intersecting circle on the front-chain, if any. // “Closeness” is determined by linear distance along the front-chain. // “Ahead” or “behind” is likewise determined by linear distance. j = b.next, k = a.previous, sj = b._.r, sk = a._.r; do { if (sj <= sk) { if (intersects(j._, c._)) { b = j, a.next = b, b.previous = a, --i; continue pack; } sj += j._.r, j = j.next; } else { if (intersects(k._, c._)) { a = k, a.next = b, b.previous = a, --i; continue pack; } sk += k._.r, k = k.previous; } } while (j !== k.next); // Success! Insert the new circle c between a and b. c.previous = a, c.next = b, a.next = b.previous = b = c; // Compute the new closest circle pair to the centroid. aa = score(a); while ((c = c.next) !== b) { if ((ca = score(c)) < aa) { a = c, aa = ca; } } b = a.next; } // Compute the enclosing circle of the front chain. a = [b._], c = b; while ((c = c.next) !== b) a.push(c._); c = Object(__WEBPACK_IMPORTED_MODULE_0__enclose__["a" /* default */])(a); // Translate the circles to put the enclosing circle around the origin. for (i = 0; i < n; ++i) a = circles[i], a.x -= c.x, a.y -= c.y; return c.r; } /* harmony default export */ __webpack_exports__["a"] = (function(circles) { packEnclose(circles); return circles; }); /***/ }), /***/ "./node_modules/d3-hierarchy/src/partition.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__treemap_round__ = __webpack_require__("./node_modules/d3-hierarchy/src/treemap/round.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__treemap_dice__ = __webpack_require__("./node_modules/d3-hierarchy/src/treemap/dice.js"); /* harmony default export */ __webpack_exports__["a"] = (function() { var dx = 1, dy = 1, padding = 0, round = false; function partition(root) { var n = root.height + 1; root.x0 = root.y0 = padding; root.x1 = dx; root.y1 = dy / n; root.eachBefore(positionNode(dy, n)); if (round) root.eachBefore(__WEBPACK_IMPORTED_MODULE_0__treemap_round__["a" /* default */]); return root; } function positionNode(dy, n) { return function(node) { if (node.children) { Object(__WEBPACK_IMPORTED_MODULE_1__treemap_dice__["a" /* default */])(node, node.x0, dy * (node.depth + 1) / n, node.x1, dy * (node.depth + 2) / n); } var x0 = node.x0, y0 = node.y0, x1 = node.x1 - padding, y1 = node.y1 - padding; if (x1 < x0) x0 = x1 = (x0 + x1) / 2; if (y1 < y0) y0 = y1 = (y0 + y1) / 2; node.x0 = x0; node.y0 = y0; node.x1 = x1; node.y1 = y1; }; } partition.round = function(x) { return arguments.length ? (round = !!x, partition) : round; }; partition.size = function(x) { return arguments.length ? (dx = +x[0], dy = +x[1], partition) : [dx, dy]; }; partition.padding = function(x) { return arguments.length ? (padding = +x, partition) : padding; }; return partition; }); /***/ }), /***/ "./node_modules/d3-hierarchy/src/stratify.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__accessors__ = __webpack_require__("./node_modules/d3-hierarchy/src/accessors.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__hierarchy_index__ = __webpack_require__("./node_modules/d3-hierarchy/src/hierarchy/index.js"); var keyPrefix = "$", // Protect against keys like “__proto__”. preroot = {depth: -1}, ambiguous = {}; function defaultId(d) { return d.id; } function defaultParentId(d) { return d.parentId; } /* harmony default export */ __webpack_exports__["a"] = (function() { var id = defaultId, parentId = defaultParentId; function stratify(data) { var d, i, n = data.length, root, parent, node, nodes = new Array(n), nodeId, nodeKey, nodeByKey = {}; for (i = 0; i < n; ++i) { d = data[i], node = nodes[i] = new __WEBPACK_IMPORTED_MODULE_1__hierarchy_index__["a" /* Node */](d); if ((nodeId = id(d, i, data)) != null && (nodeId += "")) { nodeKey = keyPrefix + (node.id = nodeId); nodeByKey[nodeKey] = nodeKey in nodeByKey ? ambiguous : node; } } for (i = 0; i < n; ++i) { node = nodes[i], nodeId = parentId(data[i], i, data); if (nodeId == null || !(nodeId += "")) { if (root) throw new Error("multiple roots"); root = node; } else { parent = nodeByKey[keyPrefix + nodeId]; if (!parent) throw new Error("missing: " + nodeId); if (parent === ambiguous) throw new Error("ambiguous: " + nodeId); if (parent.children) parent.children.push(node); else parent.children = [node]; node.parent = parent; } } if (!root) throw new Error("no root"); root.parent = preroot; root.eachBefore(function(node) { node.depth = node.parent.depth + 1; --n; }).eachBefore(__WEBPACK_IMPORTED_MODULE_1__hierarchy_index__["b" /* computeHeight */]); root.parent = null; if (n > 0) throw new Error("cycle"); return root; } stratify.id = function(x) { return arguments.length ? (id = Object(__WEBPACK_IMPORTED_MODULE_0__accessors__["b" /* required */])(x), stratify) : id; }; stratify.parentId = function(x) { return arguments.length ? (parentId = Object(__WEBPACK_IMPORTED_MODULE_0__accessors__["b" /* required */])(x), stratify) : parentId; }; return stratify; }); /***/ }), /***/ "./node_modules/d3-hierarchy/src/tree.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__hierarchy_index__ = __webpack_require__("./node_modules/d3-hierarchy/src/hierarchy/index.js"); function defaultSeparation(a, b) { return a.parent === b.parent ? 1 : 2; } // function radialSeparation(a, b) { // return (a.parent === b.parent ? 1 : 2) / a.depth; // } // This function is used to traverse the left contour of a subtree (or // subforest). It returns the successor of v on this contour. This successor is // either given by the leftmost child of v or by the thread of v. The function // returns null if and only if v is on the highest level of its subtree. function nextLeft(v) { var children = v.children; return children ? children[0] : v.t; } // This function works analogously to nextLeft. function nextRight(v) { var children = v.children; return children ? children[children.length - 1] : v.t; } // Shifts the current subtree rooted at w+. This is done by increasing // prelim(w+) and mod(w+) by shift. function moveSubtree(wm, wp, shift) { var change = shift / (wp.i - wm.i); wp.c -= change; wp.s += shift; wm.c += change; wp.z += shift; wp.m += shift; } // All other shifts, applied to the smaller subtrees between w- and w+, are // performed by this function. To prepare the shifts, we have to adjust // change(w+), shift(w+), and change(w-). function executeShifts(v) { var shift = 0, change = 0, children = v.children, i = children.length, w; while (--i >= 0) { w = children[i]; w.z += shift; w.m += shift; shift += w.s + (change += w.c); } } // If vi-’s ancestor is a sibling of v, returns vi-’s ancestor. Otherwise, // returns the specified (default) ancestor. function nextAncestor(vim, v, ancestor) { return vim.a.parent === v.parent ? vim.a : ancestor; } function TreeNode(node, i) { this._ = node; this.parent = null; this.children = null; this.A = null; // default ancestor this.a = this; // ancestor this.z = 0; // prelim this.m = 0; // mod this.c = 0; // change this.s = 0; // shift this.t = null; // thread this.i = i; // number } TreeNode.prototype = Object.create(__WEBPACK_IMPORTED_MODULE_0__hierarchy_index__["a" /* Node */].prototype); function treeRoot(root) { var tree = new TreeNode(root, 0), node, nodes = [tree], child, children, i, n; while (node = nodes.pop()) { if (children = node._.children) { node.children = new Array(n = children.length); for (i = n - 1; i >= 0; --i) { nodes.push(child = node.children[i] = new TreeNode(children[i], i)); child.parent = node; } } } (tree.parent = new TreeNode(null, 0)).children = [tree]; return tree; } // Node-link tree diagram using the Reingold-Tilford "tidy" algorithm /* harmony default export */ __webpack_exports__["a"] = (function() { var separation = defaultSeparation, dx = 1, dy = 1, nodeSize = null; function tree(root) { var t = treeRoot(root); // Compute the layout using Buchheim et al.’s algorithm. t.eachAfter(firstWalk), t.parent.m = -t.z; t.eachBefore(secondWalk); // If a fixed node size is specified, scale x and y. if (nodeSize) root.eachBefore(sizeNode); // If a fixed tree size is specified, scale x and y based on the extent. // Compute the left-most, right-most, and depth-most nodes for extents. else { var left = root, right = root, bottom = root; root.eachBefore(function(node) { if (node.x < left.x) left = node; if (node.x > right.x) right = node; if (node.depth > bottom.depth) bottom = node; }); var s = left === right ? 1 : separation(left, right) / 2, tx = s - left.x, kx = dx / (right.x + s + tx), ky = dy / (bottom.depth || 1); root.eachBefore(function(node) { node.x = (node.x + tx) * kx; node.y = node.depth * ky; }); } return root; } // Computes a preliminary x-coordinate for v. Before that, FIRST WALK is // applied recursively to the children of v, as well as the function // APPORTION. After spacing out the children by calling EXECUTE SHIFTS, the // node v is placed to the midpoint of its outermost children. function firstWalk(v) { var children = v.children, siblings = v.parent.children, w = v.i ? siblings[v.i - 1] : null; if (children) { executeShifts(v); var midpoint = (children[0].z + children[children.length - 1].z) / 2; if (w) { v.z = w.z + separation(v._, w._); v.m = v.z - midpoint; } else { v.z = midpoint; } } else if (w) { v.z = w.z + separation(v._, w._); } v.parent.A = apportion(v, w, v.parent.A || siblings[0]); } // Computes all real x-coordinates by summing up the modifiers recursively. function secondWalk(v) { v._.x = v.z + v.parent.m; v.m += v.parent.m; } // The core of the algorithm. Here, a new subtree is combined with the // previous subtrees. Threads are used to traverse the inside and outside // contours of the left and right subtree up to the highest common level. The // vertices used for the traversals are vi+, vi-, vo-, and vo+, where the // superscript o means outside and i means inside, the subscript - means left // subtree and + means right subtree. For summing up the modifiers along the // contour, we use respective variables si+, si-, so-, and so+. Whenever two // nodes of the inside contours conflict, we compute the left one of the // greatest uncommon ancestors using the function ANCESTOR and call MOVE // SUBTREE to shift the subtree and prepare the shifts of smaller subtrees. // Finally, we add a new thread (if necessary). function apportion(v, w, ancestor) { if (w) { var vip = v, vop = v, vim = w, vom = vip.parent.children[0], sip = vip.m, sop = vop.m, sim = vim.m, som = vom.m, shift; while (vim = nextRight(vim), vip = nextLeft(vip), vim && vip) { vom = nextLeft(vom); vop = nextRight(vop); vop.a = v; shift = vim.z + sim - vip.z - sip + separation(vim._, vip._); if (shift > 0) { moveSubtree(nextAncestor(vim, v, ancestor), v, shift); sip += shift; sop += shift; } sim += vim.m; sip += vip.m; som += vom.m; sop += vop.m; } if (vim && !nextRight(vop)) { vop.t = vim; vop.m += sim - sop; } if (vip && !nextLeft(vom)) { vom.t = vip; vom.m += sip - som; ancestor = v; } } return ancestor; } function sizeNode(node) { node.x *= dx; node.y = node.depth * dy; } tree.separation = function(x) { return arguments.length ? (separation = x, tree) : separation; }; tree.size = function(x) { return arguments.length ? (nodeSize = false, dx = +x[0], dy = +x[1], tree) : (nodeSize ? null : [dx, dy]); }; tree.nodeSize = function(x) { return arguments.length ? (nodeSize = true, dx = +x[0], dy = +x[1], tree) : (nodeSize ? [dx, dy] : null); }; return tree; }); /***/ }), /***/ "./node_modules/d3-hierarchy/src/treemap/binary.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony default export */ __webpack_exports__["a"] = (function(parent, x0, y0, x1, y1) { var nodes = parent.children, i, n = nodes.length, sum, sums = new Array(n + 1); for (sums[0] = sum = i = 0; i < n; ++i) { sums[i + 1] = sum += nodes[i].value; } partition(0, n, parent.value, x0, y0, x1, y1); function partition(i, j, value, x0, y0, x1, y1) { if (i >= j - 1) { var node = nodes[i]; node.x0 = x0, node.y0 = y0; node.x1 = x1, node.y1 = y1; return; } var valueOffset = sums[i], valueTarget = (value / 2) + valueOffset, k = i + 1, hi = j - 1; while (k < hi) { var mid = k + hi >>> 1; if (sums[mid] < valueTarget) k = mid + 1; else hi = mid; } if ((valueTarget - sums[k - 1]) < (sums[k] - valueTarget) && i + 1 < k) --k; var valueLeft = sums[k] - valueOffset, valueRight = value - valueLeft; if ((x1 - x0) > (y1 - y0)) { var xk = (x0 * valueRight + x1 * valueLeft) / value; partition(i, k, valueLeft, x0, y0, xk, y1); partition(k, j, valueRight, xk, y0, x1, y1); } else { var yk = (y0 * valueRight + y1 * valueLeft) / value; partition(i, k, valueLeft, x0, y0, x1, yk); partition(k, j, valueRight, x0, yk, x1, y1); } } }); /***/ }), /***/ "./node_modules/d3-hierarchy/src/treemap/dice.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony default export */ __webpack_exports__["a"] = (function(parent, x0, y0, x1, y1) { var nodes = parent.children, node, i = -1, n = nodes.length, k = parent.value && (x1 - x0) / parent.value; while (++i < n) { node = nodes[i], node.y0 = y0, node.y1 = y1; node.x0 = x0, node.x1 = x0 += node.value * k; } }); /***/ }), /***/ "./node_modules/d3-hierarchy/src/treemap/index.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__round__ = __webpack_require__("./node_modules/d3-hierarchy/src/treemap/round.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__squarify__ = __webpack_require__("./node_modules/d3-hierarchy/src/treemap/squarify.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__accessors__ = __webpack_require__("./node_modules/d3-hierarchy/src/accessors.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__constant__ = __webpack_require__("./node_modules/d3-hierarchy/src/constant.js"); /* harmony default export */ __webpack_exports__["a"] = (function() { var tile = __WEBPACK_IMPORTED_MODULE_1__squarify__["a" /* default */], round = false, dx = 1, dy = 1, paddingStack = [0], paddingInner = __WEBPACK_IMPORTED_MODULE_3__constant__["a" /* constantZero */], paddingTop = __WEBPACK_IMPORTED_MODULE_3__constant__["a" /* constantZero */], paddingRight = __WEBPACK_IMPORTED_MODULE_3__constant__["a" /* constantZero */], paddingBottom = __WEBPACK_IMPORTED_MODULE_3__constant__["a" /* constantZero */], paddingLeft = __WEBPACK_IMPORTED_MODULE_3__constant__["a" /* constantZero */]; function treemap(root) { root.x0 = root.y0 = 0; root.x1 = dx; root.y1 = dy; root.eachBefore(positionNode); paddingStack = [0]; if (round) root.eachBefore(__WEBPACK_IMPORTED_MODULE_0__round__["a" /* default */]); return root; } function positionNode(node) { var p = paddingStack[node.depth], x0 = node.x0 + p, y0 = node.y0 + p, x1 = node.x1 - p, y1 = node.y1 - p; if (x1 < x0) x0 = x1 = (x0 + x1) / 2; if (y1 < y0) y0 = y1 = (y0 + y1) / 2; node.x0 = x0; node.y0 = y0; node.x1 = x1; node.y1 = y1; if (node.children) { p = paddingStack[node.depth + 1] = paddingInner(node) / 2; x0 += paddingLeft(node) - p; y0 += paddingTop(node) - p; x1 -= paddingRight(node) - p; y1 -= paddingBottom(node) - p; if (x1 < x0) x0 = x1 = (x0 + x1) / 2; if (y1 < y0) y0 = y1 = (y0 + y1) / 2; tile(node, x0, y0, x1, y1); } } treemap.round = function(x) { return arguments.length ? (round = !!x, treemap) : round; }; treemap.size = function(x) { return arguments.length ? (dx = +x[0], dy = +x[1], treemap) : [dx, dy]; }; treemap.tile = function(x) { return arguments.length ? (tile = Object(__WEBPACK_IMPORTED_MODULE_2__accessors__["b" /* required */])(x), treemap) : tile; }; treemap.padding = function(x) { return arguments.length ? treemap.paddingInner(x).paddingOuter(x) : treemap.paddingInner(); }; treemap.paddingInner = function(x) { return arguments.length ? (paddingInner = typeof x === "function" ? x : Object(__WEBPACK_IMPORTED_MODULE_3__constant__["b" /* default */])(+x), treemap) : paddingInner; }; treemap.paddingOuter = function(x) { return arguments.length ? treemap.paddingTop(x).paddingRight(x).paddingBottom(x).paddingLeft(x) : treemap.paddingTop(); }; treemap.paddingTop = function(x) { return arguments.length ? (paddingTop = typeof x === "function" ? x : Object(__WEBPACK_IMPORTED_MODULE_3__constant__["b" /* default */])(+x), treemap) : paddingTop; }; treemap.paddingRight = function(x) { return arguments.length ? (paddingRight = typeof x === "function" ? x : Object(__WEBPACK_IMPORTED_MODULE_3__constant__["b" /* default */])(+x), treemap) : paddingRight; }; treemap.paddingBottom = function(x) { return arguments.length ? (paddingBottom = typeof x === "function" ? x : Object(__WEBPACK_IMPORTED_MODULE_3__constant__["b" /* default */])(+x), treemap) : paddingBottom; }; treemap.paddingLeft = function(x) { return arguments.length ? (paddingLeft = typeof x === "function" ? x : Object(__WEBPACK_IMPORTED_MODULE_3__constant__["b" /* default */])(+x), treemap) : paddingLeft; }; return treemap; }); /***/ }), /***/ "./node_modules/d3-hierarchy/src/treemap/resquarify.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__dice__ = __webpack_require__("./node_modules/d3-hierarchy/src/treemap/dice.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__slice__ = __webpack_require__("./node_modules/d3-hierarchy/src/treemap/slice.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__squarify__ = __webpack_require__("./node_modules/d3-hierarchy/src/treemap/squarify.js"); /* harmony default export */ __webpack_exports__["a"] = ((function custom(ratio) { function resquarify(parent, x0, y0, x1, y1) { if ((rows = parent._squarify) && (rows.ratio === ratio)) { var rows, row, nodes, i, j = -1, n, m = rows.length, value = parent.value; while (++j < m) { row = rows[j], nodes = row.children; for (i = row.value = 0, n = nodes.length; i < n; ++i) row.value += nodes[i].value; if (row.dice) Object(__WEBPACK_IMPORTED_MODULE_0__dice__["a" /* default */])(row, x0, y0, x1, y0 += (y1 - y0) * row.value / value); else Object(__WEBPACK_IMPORTED_MODULE_1__slice__["a" /* default */])(row, x0, y0, x0 += (x1 - x0) * row.value / value, y1); value -= row.value; } } else { parent._squarify = rows = Object(__WEBPACK_IMPORTED_MODULE_2__squarify__["c" /* squarifyRatio */])(ratio, parent, x0, y0, x1, y1); rows.ratio = ratio; } } resquarify.ratio = function(x) { return custom((x = +x) > 1 ? x : 1); }; return resquarify; })(__WEBPACK_IMPORTED_MODULE_2__squarify__["b" /* phi */])); /***/ }), /***/ "./node_modules/d3-hierarchy/src/treemap/round.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony default export */ __webpack_exports__["a"] = (function(node) { node.x0 = Math.round(node.x0); node.y0 = Math.round(node.y0); node.x1 = Math.round(node.x1); node.y1 = Math.round(node.y1); }); /***/ }), /***/ "./node_modules/d3-hierarchy/src/treemap/slice.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony default export */ __webpack_exports__["a"] = (function(parent, x0, y0, x1, y1) { var nodes = parent.children, node, i = -1, n = nodes.length, k = parent.value && (y1 - y0) / parent.value; while (++i < n) { node = nodes[i], node.x0 = x0, node.x1 = x1; node.y0 = y0, node.y1 = y0 += node.value * k; } }); /***/ }), /***/ "./node_modules/d3-hierarchy/src/treemap/sliceDice.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__dice__ = __webpack_require__("./node_modules/d3-hierarchy/src/treemap/dice.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__slice__ = __webpack_require__("./node_modules/d3-hierarchy/src/treemap/slice.js"); /* harmony default export */ __webpack_exports__["a"] = (function(parent, x0, y0, x1, y1) { (parent.depth & 1 ? __WEBPACK_IMPORTED_MODULE_1__slice__["a" /* default */] : __WEBPACK_IMPORTED_MODULE_0__dice__["a" /* default */])(parent, x0, y0, x1, y1); }); /***/ }), /***/ "./node_modules/d3-hierarchy/src/treemap/squarify.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return phi; }); /* harmony export (immutable) */ __webpack_exports__["c"] = squarifyRatio; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__dice__ = __webpack_require__("./node_modules/d3-hierarchy/src/treemap/dice.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__slice__ = __webpack_require__("./node_modules/d3-hierarchy/src/treemap/slice.js"); var phi = (1 + Math.sqrt(5)) / 2; function squarifyRatio(ratio, parent, x0, y0, x1, y1) { var rows = [], nodes = parent.children, row, nodeValue, i0 = 0, i1 = 0, n = nodes.length, dx, dy, value = parent.value, sumValue, minValue, maxValue, newRatio, minRatio, alpha, beta; while (i0 < n) { dx = x1 - x0, dy = y1 - y0; // Find the next non-empty node. do sumValue = nodes[i1++].value; while (!sumValue && i1 < n); minValue = maxValue = sumValue; alpha = Math.max(dy / dx, dx / dy) / (value * ratio); beta = sumValue * sumValue * alpha; minRatio = Math.max(maxValue / beta, beta / minValue); // Keep adding nodes while the aspect ratio maintains or improves. for (; i1 < n; ++i1) { sumValue += nodeValue = nodes[i1].value; if (nodeValue < minValue) minValue = nodeValue; if (nodeValue > maxValue) maxValue = nodeValue; beta = sumValue * sumValue * alpha; newRatio = Math.max(maxValue / beta, beta / minValue); if (newRatio > minRatio) { sumValue -= nodeValue; break; } minRatio = newRatio; } // Position and record the row orientation. rows.push(row = {value: sumValue, dice: dx < dy, children: nodes.slice(i0, i1)}); if (row.dice) Object(__WEBPACK_IMPORTED_MODULE_0__dice__["a" /* default */])(row, x0, y0, x1, value ? y0 += dy * sumValue / value : y1); else Object(__WEBPACK_IMPORTED_MODULE_1__slice__["a" /* default */])(row, x0, y0, value ? x0 += dx * sumValue / value : x1, y1); value -= sumValue, i0 = i1; } return rows; } /* harmony default export */ __webpack_exports__["a"] = ((function custom(ratio) { function squarify(parent, x0, y0, x1, y1) { squarifyRatio(ratio, parent, x0, y0, x1, y1); } squarify.ratio = function(x) { return custom((x = +x) > 1 ? x : 1); }; return squarify; })(phi)); /***/ }), /***/ "./node_modules/d3-interpolate/index.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__src_value__ = __webpack_require__("./node_modules/d3-interpolate/src/value.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "interpolate", function() { return __WEBPACK_IMPORTED_MODULE_0__src_value__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__src_array__ = __webpack_require__("./node_modules/d3-interpolate/src/array.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "interpolateArray", function() { return __WEBPACK_IMPORTED_MODULE_1__src_array__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__src_basis__ = __webpack_require__("./node_modules/d3-interpolate/src/basis.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "interpolateBasis", function() { return __WEBPACK_IMPORTED_MODULE_2__src_basis__["b"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__src_basisClosed__ = __webpack_require__("./node_modules/d3-interpolate/src/basisClosed.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "interpolateBasisClosed", function() { return __WEBPACK_IMPORTED_MODULE_3__src_basisClosed__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__src_date__ = __webpack_require__("./node_modules/d3-interpolate/src/date.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "interpolateDate", function() { return __WEBPACK_IMPORTED_MODULE_4__src_date__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__src_number__ = __webpack_require__("./node_modules/d3-interpolate/src/number.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "interpolateNumber", function() { return __WEBPACK_IMPORTED_MODULE_5__src_number__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__src_object__ = __webpack_require__("./node_modules/d3-interpolate/src/object.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "interpolateObject", function() { return __WEBPACK_IMPORTED_MODULE_6__src_object__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__src_round__ = __webpack_require__("./node_modules/d3-interpolate/src/round.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "interpolateRound", function() { return __WEBPACK_IMPORTED_MODULE_7__src_round__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__src_string__ = __webpack_require__("./node_modules/d3-interpolate/src/string.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "interpolateString", function() { return __WEBPACK_IMPORTED_MODULE_8__src_string__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__src_transform_index__ = __webpack_require__("./node_modules/d3-interpolate/src/transform/index.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "interpolateTransformCss", function() { return __WEBPACK_IMPORTED_MODULE_9__src_transform_index__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "interpolateTransformSvg", function() { return __WEBPACK_IMPORTED_MODULE_9__src_transform_index__["b"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__src_zoom__ = __webpack_require__("./node_modules/d3-interpolate/src/zoom.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "interpolateZoom", function() { return __WEBPACK_IMPORTED_MODULE_10__src_zoom__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__src_rgb__ = __webpack_require__("./node_modules/d3-interpolate/src/rgb.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "interpolateRgb", function() { return __WEBPACK_IMPORTED_MODULE_11__src_rgb__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "interpolateRgbBasis", function() { return __WEBPACK_IMPORTED_MODULE_11__src_rgb__["b"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "interpolateRgbBasisClosed", function() { return __WEBPACK_IMPORTED_MODULE_11__src_rgb__["c"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__src_hsl__ = __webpack_require__("./node_modules/d3-interpolate/src/hsl.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "interpolateHsl", function() { return __WEBPACK_IMPORTED_MODULE_12__src_hsl__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "interpolateHslLong", function() { return __WEBPACK_IMPORTED_MODULE_12__src_hsl__["b"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__src_lab__ = __webpack_require__("./node_modules/d3-interpolate/src/lab.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "interpolateLab", function() { return __WEBPACK_IMPORTED_MODULE_13__src_lab__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__src_hcl__ = __webpack_require__("./node_modules/d3-interpolate/src/hcl.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "interpolateHcl", function() { return __WEBPACK_IMPORTED_MODULE_14__src_hcl__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "interpolateHclLong", function() { return __WEBPACK_IMPORTED_MODULE_14__src_hcl__["b"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__src_cubehelix__ = __webpack_require__("./node_modules/d3-interpolate/src/cubehelix.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "interpolateCubehelix", function() { return __WEBPACK_IMPORTED_MODULE_15__src_cubehelix__["b"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "interpolateCubehelixLong", function() { return __WEBPACK_IMPORTED_MODULE_15__src_cubehelix__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__src_piecewise__ = __webpack_require__("./node_modules/d3-interpolate/src/piecewise.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "piecewise", function() { return __WEBPACK_IMPORTED_MODULE_16__src_piecewise__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_17__src_quantize__ = __webpack_require__("./node_modules/d3-interpolate/src/quantize.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "quantize", function() { return __WEBPACK_IMPORTED_MODULE_17__src_quantize__["a"]; }); /***/ }), /***/ "./node_modules/d3-interpolate/src/array.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__value__ = __webpack_require__("./node_modules/d3-interpolate/src/value.js"); /* harmony default export */ __webpack_exports__["a"] = (function(a, b) { var nb = b ? b.length : 0, na = a ? Math.min(nb, a.length) : 0, x = new Array(na), c = new Array(nb), i; for (i = 0; i < na; ++i) x[i] = Object(__WEBPACK_IMPORTED_MODULE_0__value__["a" /* default */])(a[i], b[i]); for (; i < nb; ++i) c[i] = b[i]; return function(t) { for (i = 0; i < na; ++i) c[i] = x[i](t); return c; }; }); /***/ }), /***/ "./node_modules/d3-interpolate/src/basis.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = basis; function basis(t1, v0, v1, v2, v3) { var t2 = t1 * t1, t3 = t2 * t1; return ((1 - 3 * t1 + 3 * t2 - t3) * v0 + (4 - 6 * t2 + 3 * t3) * v1 + (1 + 3 * t1 + 3 * t2 - 3 * t3) * v2 + t3 * v3) / 6; } /* harmony default export */ __webpack_exports__["b"] = (function(values) { var n = values.length - 1; return function(t) { var i = t <= 0 ? (t = 0) : t >= 1 ? (t = 1, n - 1) : Math.floor(t * n), v1 = values[i], v2 = values[i + 1], v0 = i > 0 ? values[i - 1] : 2 * v1 - v2, v3 = i < n - 1 ? values[i + 2] : 2 * v2 - v1; return basis((t - i / n) * n, v0, v1, v2, v3); }; }); /***/ }), /***/ "./node_modules/d3-interpolate/src/basisClosed.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__basis__ = __webpack_require__("./node_modules/d3-interpolate/src/basis.js"); /* harmony default export */ __webpack_exports__["a"] = (function(values) { var n = values.length; return function(t) { var i = Math.floor(((t %= 1) < 0 ? ++t : t) * n), v0 = values[(i + n - 1) % n], v1 = values[i % n], v2 = values[(i + 1) % n], v3 = values[(i + 2) % n]; return Object(__WEBPACK_IMPORTED_MODULE_0__basis__["a" /* basis */])((t - i / n) * n, v0, v1, v2, v3); }; }); /***/ }), /***/ "./node_modules/d3-interpolate/src/color.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["c"] = hue; /* harmony export (immutable) */ __webpack_exports__["b"] = gamma; /* harmony export (immutable) */ __webpack_exports__["a"] = nogamma; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__constant__ = __webpack_require__("./node_modules/d3-interpolate/src/constant.js"); function linear(a, d) { return function(t) { return a + t * d; }; } function exponential(a, b, y) { return a = Math.pow(a, y), b = Math.pow(b, y) - a, y = 1 / y, function(t) { return Math.pow(a + t * b, y); }; } function hue(a, b) { var d = b - a; return d ? linear(a, d > 180 || d < -180 ? d - 360 * Math.round(d / 360) : d) : Object(__WEBPACK_IMPORTED_MODULE_0__constant__["a" /* default */])(isNaN(a) ? b : a); } function gamma(y) { return (y = +y) === 1 ? nogamma : function(a, b) { return b - a ? exponential(a, b, y) : Object(__WEBPACK_IMPORTED_MODULE_0__constant__["a" /* default */])(isNaN(a) ? b : a); }; } function nogamma(a, b) { var d = b - a; return d ? linear(a, d) : Object(__WEBPACK_IMPORTED_MODULE_0__constant__["a" /* default */])(isNaN(a) ? b : a); } /***/ }), /***/ "./node_modules/d3-interpolate/src/constant.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony default export */ __webpack_exports__["a"] = (function(x) { return function() { return x; }; }); /***/ }), /***/ "./node_modules/d3-interpolate/src/cubehelix.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return cubehelixLong; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_d3_color__ = __webpack_require__("./node_modules/d3-color/index.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__color__ = __webpack_require__("./node_modules/d3-interpolate/src/color.js"); function cubehelix(hue) { return (function cubehelixGamma(y) { y = +y; function cubehelix(start, end) { var h = hue((start = Object(__WEBPACK_IMPORTED_MODULE_0_d3_color__["cubehelix"])(start)).h, (end = Object(__WEBPACK_IMPORTED_MODULE_0_d3_color__["cubehelix"])(end)).h), s = Object(__WEBPACK_IMPORTED_MODULE_1__color__["a" /* default */])(start.s, end.s), l = Object(__WEBPACK_IMPORTED_MODULE_1__color__["a" /* default */])(start.l, end.l), opacity = Object(__WEBPACK_IMPORTED_MODULE_1__color__["a" /* default */])(start.opacity, end.opacity); return function(t) { start.h = h(t); start.s = s(t); start.l = l(Math.pow(t, y)); start.opacity = opacity(t); return start + ""; }; } cubehelix.gamma = cubehelixGamma; return cubehelix; })(1); } /* harmony default export */ __webpack_exports__["b"] = (cubehelix(__WEBPACK_IMPORTED_MODULE_1__color__["c" /* hue */])); var cubehelixLong = cubehelix(__WEBPACK_IMPORTED_MODULE_1__color__["a" /* default */]); /***/ }), /***/ "./node_modules/d3-interpolate/src/date.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony default export */ __webpack_exports__["a"] = (function(a, b) { var d = new Date; return a = +a, b -= a, function(t) { return d.setTime(a + b * t), d; }; }); /***/ }), /***/ "./node_modules/d3-interpolate/src/hcl.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return hclLong; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_d3_color__ = __webpack_require__("./node_modules/d3-color/index.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__color__ = __webpack_require__("./node_modules/d3-interpolate/src/color.js"); function hcl(hue) { return function(start, end) { var h = hue((start = Object(__WEBPACK_IMPORTED_MODULE_0_d3_color__["hcl"])(start)).h, (end = Object(__WEBPACK_IMPORTED_MODULE_0_d3_color__["hcl"])(end)).h), c = Object(__WEBPACK_IMPORTED_MODULE_1__color__["a" /* default */])(start.c, end.c), l = Object(__WEBPACK_IMPORTED_MODULE_1__color__["a" /* default */])(start.l, end.l), opacity = Object(__WEBPACK_IMPORTED_MODULE_1__color__["a" /* default */])(start.opacity, end.opacity); return function(t) { start.h = h(t); start.c = c(t); start.l = l(t); start.opacity = opacity(t); return start + ""; }; } } /* harmony default export */ __webpack_exports__["a"] = (hcl(__WEBPACK_IMPORTED_MODULE_1__color__["c" /* hue */])); var hclLong = hcl(__WEBPACK_IMPORTED_MODULE_1__color__["a" /* default */]); /***/ }), /***/ "./node_modules/d3-interpolate/src/hsl.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return hslLong; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_d3_color__ = __webpack_require__("./node_modules/d3-color/index.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__color__ = __webpack_require__("./node_modules/d3-interpolate/src/color.js"); function hsl(hue) { return function(start, end) { var h = hue((start = Object(__WEBPACK_IMPORTED_MODULE_0_d3_color__["hsl"])(start)).h, (end = Object(__WEBPACK_IMPORTED_MODULE_0_d3_color__["hsl"])(end)).h), s = Object(__WEBPACK_IMPORTED_MODULE_1__color__["a" /* default */])(start.s, end.s), l = Object(__WEBPACK_IMPORTED_MODULE_1__color__["a" /* default */])(start.l, end.l), opacity = Object(__WEBPACK_IMPORTED_MODULE_1__color__["a" /* default */])(start.opacity, end.opacity); return function(t) { start.h = h(t); start.s = s(t); start.l = l(t); start.opacity = opacity(t); return start + ""; }; } } /* harmony default export */ __webpack_exports__["a"] = (hsl(__WEBPACK_IMPORTED_MODULE_1__color__["c" /* hue */])); var hslLong = hsl(__WEBPACK_IMPORTED_MODULE_1__color__["a" /* default */]); /***/ }), /***/ "./node_modules/d3-interpolate/src/lab.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = lab; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_d3_color__ = __webpack_require__("./node_modules/d3-color/index.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__color__ = __webpack_require__("./node_modules/d3-interpolate/src/color.js"); function lab(start, end) { var l = Object(__WEBPACK_IMPORTED_MODULE_1__color__["a" /* default */])((start = Object(__WEBPACK_IMPORTED_MODULE_0_d3_color__["lab"])(start)).l, (end = Object(__WEBPACK_IMPORTED_MODULE_0_d3_color__["lab"])(end)).l), a = Object(__WEBPACK_IMPORTED_MODULE_1__color__["a" /* default */])(start.a, end.a), b = Object(__WEBPACK_IMPORTED_MODULE_1__color__["a" /* default */])(start.b, end.b), opacity = Object(__WEBPACK_IMPORTED_MODULE_1__color__["a" /* default */])(start.opacity, end.opacity); return function(t) { start.l = l(t); start.a = a(t); start.b = b(t); start.opacity = opacity(t); return start + ""; }; } /***/ }), /***/ "./node_modules/d3-interpolate/src/number.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony default export */ __webpack_exports__["a"] = (function(a, b) { return a = +a, b -= a, function(t) { return a + b * t; }; }); /***/ }), /***/ "./node_modules/d3-interpolate/src/object.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__value__ = __webpack_require__("./node_modules/d3-interpolate/src/value.js"); /* harmony default export */ __webpack_exports__["a"] = (function(a, b) { var i = {}, c = {}, k; if (a === null || typeof a !== "object") a = {}; if (b === null || typeof b !== "object") b = {}; for (k in b) { if (k in a) { i[k] = Object(__WEBPACK_IMPORTED_MODULE_0__value__["a" /* default */])(a[k], b[k]); } else { c[k] = b[k]; } } return function(t) { for (k in i) c[k] = i[k](t); return c; }; }); /***/ }), /***/ "./node_modules/d3-interpolate/src/piecewise.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = piecewise; function piecewise(interpolate, values) { var i = 0, n = values.length - 1, v = values[0], I = new Array(n < 0 ? 0 : n); while (i < n) I[i] = interpolate(v, v = values[++i]); return function(t) { var i = Math.max(0, Math.min(n - 1, Math.floor(t *= n))); return I[i](t - i); }; } /***/ }), /***/ "./node_modules/d3-interpolate/src/quantize.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony default export */ __webpack_exports__["a"] = (function(interpolator, n) { var samples = new Array(n); for (var i = 0; i < n; ++i) samples[i] = interpolator(i / (n - 1)); return samples; }); /***/ }), /***/ "./node_modules/d3-interpolate/src/rgb.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return rgbBasis; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return rgbBasisClosed; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_d3_color__ = __webpack_require__("./node_modules/d3-color/index.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__basis__ = __webpack_require__("./node_modules/d3-interpolate/src/basis.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__basisClosed__ = __webpack_require__("./node_modules/d3-interpolate/src/basisClosed.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__color__ = __webpack_require__("./node_modules/d3-interpolate/src/color.js"); /* harmony default export */ __webpack_exports__["a"] = ((function rgbGamma(y) { var color = Object(__WEBPACK_IMPORTED_MODULE_3__color__["b" /* gamma */])(y); function rgb(start, end) { var r = color((start = Object(__WEBPACK_IMPORTED_MODULE_0_d3_color__["rgb"])(start)).r, (end = Object(__WEBPACK_IMPORTED_MODULE_0_d3_color__["rgb"])(end)).r), g = color(start.g, end.g), b = color(start.b, end.b), opacity = Object(__WEBPACK_IMPORTED_MODULE_3__color__["a" /* default */])(start.opacity, end.opacity); return function(t) { start.r = r(t); start.g = g(t); start.b = b(t); start.opacity = opacity(t); return start + ""; }; } rgb.gamma = rgbGamma; return rgb; })(1)); function rgbSpline(spline) { return function(colors) { var n = colors.length, r = new Array(n), g = new Array(n), b = new Array(n), i, color; for (i = 0; i < n; ++i) { color = Object(__WEBPACK_IMPORTED_MODULE_0_d3_color__["rgb"])(colors[i]); r[i] = color.r || 0; g[i] = color.g || 0; b[i] = color.b || 0; } r = spline(r); g = spline(g); b = spline(b); color.opacity = 1; return function(t) { color.r = r(t); color.g = g(t); color.b = b(t); return color + ""; }; }; } var rgbBasis = rgbSpline(__WEBPACK_IMPORTED_MODULE_1__basis__["b" /* default */]); var rgbBasisClosed = rgbSpline(__WEBPACK_IMPORTED_MODULE_2__basisClosed__["a" /* default */]); /***/ }), /***/ "./node_modules/d3-interpolate/src/round.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony default export */ __webpack_exports__["a"] = (function(a, b) { return a = +a, b -= a, function(t) { return Math.round(a + b * t); }; }); /***/ }), /***/ "./node_modules/d3-interpolate/src/string.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__number__ = __webpack_require__("./node_modules/d3-interpolate/src/number.js"); var reA = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g, reB = new RegExp(reA.source, "g"); function zero(b) { return function() { return b; }; } function one(b) { return function(t) { return b(t) + ""; }; } /* harmony default export */ __webpack_exports__["a"] = (function(a, b) { var bi = reA.lastIndex = reB.lastIndex = 0, // scan index for next number in b am, // current match in a bm, // current match in b bs, // string preceding current number in b, if any i = -1, // index in s s = [], // string constants and placeholders q = []; // number interpolators // Coerce inputs to strings. a = a + "", b = b + ""; // Interpolate pairs of numbers in a & b. while ((am = reA.exec(a)) && (bm = reB.exec(b))) { if ((bs = bm.index) > bi) { // a string precedes the next number in b bs = b.slice(bi, bs); if (s[i]) s[i] += bs; // coalesce with previous string else s[++i] = bs; } if ((am = am[0]) === (bm = bm[0])) { // numbers in a & b match if (s[i]) s[i] += bm; // coalesce with previous string else s[++i] = bm; } else { // interpolate non-matching numbers s[++i] = null; q.push({i: i, x: Object(__WEBPACK_IMPORTED_MODULE_0__number__["a" /* default */])(am, bm)}); } bi = reB.lastIndex; } // Add remains of b. if (bi < b.length) { bs = b.slice(bi); if (s[i]) s[i] += bs; // coalesce with previous string else s[++i] = bs; } // Special optimization for only a single match. // Otherwise, interpolate each of the numbers and rejoin the string. return s.length < 2 ? (q[0] ? one(q[0].x) : zero(b)) : (b = q.length, function(t) { for (var i = 0, o; i < b; ++i) s[(o = q[i]).i] = o.x(t); return s.join(""); }); }); /***/ }), /***/ "./node_modules/d3-interpolate/src/transform/decompose.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return identity; }); var degrees = 180 / Math.PI; var identity = { translateX: 0, translateY: 0, rotate: 0, skewX: 0, scaleX: 1, scaleY: 1 }; /* harmony default export */ __webpack_exports__["a"] = (function(a, b, c, d, e, f) { var scaleX, scaleY, skewX; if (scaleX = Math.sqrt(a * a + b * b)) a /= scaleX, b /= scaleX; if (skewX = a * c + b * d) c -= a * skewX, d -= b * skewX; if (scaleY = Math.sqrt(c * c + d * d)) c /= scaleY, d /= scaleY, skewX /= scaleY; if (a * d < b * c) a = -a, b = -b, skewX = -skewX, scaleX = -scaleX; return { translateX: e, translateY: f, rotate: Math.atan2(b, a) * degrees, skewX: Math.atan(skewX) * degrees, scaleX: scaleX, scaleY: scaleY }; }); /***/ }), /***/ "./node_modules/d3-interpolate/src/transform/index.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return interpolateTransformCss; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return interpolateTransformSvg; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__number__ = __webpack_require__("./node_modules/d3-interpolate/src/number.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__parse__ = __webpack_require__("./node_modules/d3-interpolate/src/transform/parse.js"); function interpolateTransform(parse, pxComma, pxParen, degParen) { function pop(s) { return s.length ? s.pop() + " " : ""; } function translate(xa, ya, xb, yb, s, q) { if (xa !== xb || ya !== yb) { var i = s.push("translate(", null, pxComma, null, pxParen); q.push({i: i - 4, x: Object(__WEBPACK_IMPORTED_MODULE_0__number__["a" /* default */])(xa, xb)}, {i: i - 2, x: Object(__WEBPACK_IMPORTED_MODULE_0__number__["a" /* default */])(ya, yb)}); } else if (xb || yb) { s.push("translate(" + xb + pxComma + yb + pxParen); } } function rotate(a, b, s, q) { if (a !== b) { if (a - b > 180) b += 360; else if (b - a > 180) a += 360; // shortest path q.push({i: s.push(pop(s) + "rotate(", null, degParen) - 2, x: Object(__WEBPACK_IMPORTED_MODULE_0__number__["a" /* default */])(a, b)}); } else if (b) { s.push(pop(s) + "rotate(" + b + degParen); } } function skewX(a, b, s, q) { if (a !== b) { q.push({i: s.push(pop(s) + "skewX(", null, degParen) - 2, x: Object(__WEBPACK_IMPORTED_MODULE_0__number__["a" /* default */])(a, b)}); } else if (b) { s.push(pop(s) + "skewX(" + b + degParen); } } function scale(xa, ya, xb, yb, s, q) { if (xa !== xb || ya !== yb) { var i = s.push(pop(s) + "scale(", null, ",", null, ")"); q.push({i: i - 4, x: Object(__WEBPACK_IMPORTED_MODULE_0__number__["a" /* default */])(xa, xb)}, {i: i - 2, x: Object(__WEBPACK_IMPORTED_MODULE_0__number__["a" /* default */])(ya, yb)}); } else if (xb !== 1 || yb !== 1) { s.push(pop(s) + "scale(" + xb + "," + yb + ")"); } } return function(a, b) { var s = [], // string constants and placeholders q = []; // number interpolators a = parse(a), b = parse(b); translate(a.translateX, a.translateY, b.translateX, b.translateY, s, q); rotate(a.rotate, b.rotate, s, q); skewX(a.skewX, b.skewX, s, q); scale(a.scaleX, a.scaleY, b.scaleX, b.scaleY, s, q); a = b = null; // gc return function(t) { var i = -1, n = q.length, o; while (++i < n) s[(o = q[i]).i] = o.x(t); return s.join(""); }; }; } var interpolateTransformCss = interpolateTransform(__WEBPACK_IMPORTED_MODULE_1__parse__["a" /* parseCss */], "px, ", "px)", "deg)"); var interpolateTransformSvg = interpolateTransform(__WEBPACK_IMPORTED_MODULE_1__parse__["b" /* parseSvg */], ", ", ")", ")"); /***/ }), /***/ "./node_modules/d3-interpolate/src/transform/parse.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = parseCss; /* harmony export (immutable) */ __webpack_exports__["b"] = parseSvg; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__decompose__ = __webpack_require__("./node_modules/d3-interpolate/src/transform/decompose.js"); var cssNode, cssRoot, cssView, svgNode; function parseCss(value) { if (value === "none") return __WEBPACK_IMPORTED_MODULE_0__decompose__["b" /* identity */]; if (!cssNode) cssNode = document.createElement("DIV"), cssRoot = document.documentElement, cssView = document.defaultView; cssNode.style.transform = value; value = cssView.getComputedStyle(cssRoot.appendChild(cssNode), null).getPropertyValue("transform"); cssRoot.removeChild(cssNode); value = value.slice(7, -1).split(","); return Object(__WEBPACK_IMPORTED_MODULE_0__decompose__["a" /* default */])(+value[0], +value[1], +value[2], +value[3], +value[4], +value[5]); } function parseSvg(value) { if (value == null) return __WEBPACK_IMPORTED_MODULE_0__decompose__["b" /* identity */]; if (!svgNode) svgNode = document.createElementNS("http://www.w3.org/2000/svg", "g"); svgNode.setAttribute("transform", value); if (!(value = svgNode.transform.baseVal.consolidate())) return __WEBPACK_IMPORTED_MODULE_0__decompose__["b" /* identity */]; value = value.matrix; return Object(__WEBPACK_IMPORTED_MODULE_0__decompose__["a" /* default */])(value.a, value.b, value.c, value.d, value.e, value.f); } /***/ }), /***/ "./node_modules/d3-interpolate/src/value.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_d3_color__ = __webpack_require__("./node_modules/d3-color/index.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__rgb__ = __webpack_require__("./node_modules/d3-interpolate/src/rgb.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__array__ = __webpack_require__("./node_modules/d3-interpolate/src/array.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__date__ = __webpack_require__("./node_modules/d3-interpolate/src/date.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__number__ = __webpack_require__("./node_modules/d3-interpolate/src/number.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__object__ = __webpack_require__("./node_modules/d3-interpolate/src/object.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__string__ = __webpack_require__("./node_modules/d3-interpolate/src/string.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__constant__ = __webpack_require__("./node_modules/d3-interpolate/src/constant.js"); /* harmony default export */ __webpack_exports__["a"] = (function(a, b) { var t = typeof b, c; return b == null || t === "boolean" ? Object(__WEBPACK_IMPORTED_MODULE_7__constant__["a" /* default */])(b) : (t === "number" ? __WEBPACK_IMPORTED_MODULE_4__number__["a" /* default */] : t === "string" ? ((c = Object(__WEBPACK_IMPORTED_MODULE_0_d3_color__["color"])(b)) ? (b = c, __WEBPACK_IMPORTED_MODULE_1__rgb__["a" /* default */]) : __WEBPACK_IMPORTED_MODULE_6__string__["a" /* default */]) : b instanceof __WEBPACK_IMPORTED_MODULE_0_d3_color__["color"] ? __WEBPACK_IMPORTED_MODULE_1__rgb__["a" /* default */] : b instanceof Date ? __WEBPACK_IMPORTED_MODULE_3__date__["a" /* default */] : Array.isArray(b) ? __WEBPACK_IMPORTED_MODULE_2__array__["a" /* default */] : typeof b.valueOf !== "function" && typeof b.toString !== "function" || isNaN(b) ? __WEBPACK_IMPORTED_MODULE_5__object__["a" /* default */] : __WEBPACK_IMPORTED_MODULE_4__number__["a" /* default */])(a, b); }); /***/ }), /***/ "./node_modules/d3-interpolate/src/zoom.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; var rho = Math.SQRT2, rho2 = 2, rho4 = 4, epsilon2 = 1e-12; function cosh(x) { return ((x = Math.exp(x)) + 1 / x) / 2; } function sinh(x) { return ((x = Math.exp(x)) - 1 / x) / 2; } function tanh(x) { return ((x = Math.exp(2 * x)) - 1) / (x + 1); } // p0 = [ux0, uy0, w0] // p1 = [ux1, uy1, w1] /* harmony default export */ __webpack_exports__["a"] = (function(p0, p1) { var ux0 = p0[0], uy0 = p0[1], w0 = p0[2], ux1 = p1[0], uy1 = p1[1], w1 = p1[2], dx = ux1 - ux0, dy = uy1 - uy0, d2 = dx * dx + dy * dy, i, S; // Special case for u0 ≅ u1. if (d2 < epsilon2) { S = Math.log(w1 / w0) / rho; i = function(t) { return [ ux0 + t * dx, uy0 + t * dy, w0 * Math.exp(rho * t * S) ]; } } // General case. else { var d1 = Math.sqrt(d2), b0 = (w1 * w1 - w0 * w0 + rho4 * d2) / (2 * w0 * rho2 * d1), b1 = (w1 * w1 - w0 * w0 - rho4 * d2) / (2 * w1 * rho2 * d1), r0 = Math.log(Math.sqrt(b0 * b0 + 1) - b0), r1 = Math.log(Math.sqrt(b1 * b1 + 1) - b1); S = (r1 - r0) / rho; i = function(t) { var s = t * S, coshr0 = cosh(r0), u = w0 / (rho2 * d1) * (coshr0 * tanh(rho * s + r0) - sinh(r0)); return [ ux0 + u * dx, uy0 + u * dy, w0 * coshr0 / cosh(rho * s + r0) ]; } } i.duration = S * 1000; return i; }); /***/ }), /***/ "./node_modules/d3-path/index.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__src_path__ = __webpack_require__("./node_modules/d3-path/src/path.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return __WEBPACK_IMPORTED_MODULE_0__src_path__["a"]; }); /***/ }), /***/ "./node_modules/d3-path/src/path.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; var pi = Math.PI, tau = 2 * pi, epsilon = 1e-6, tauEpsilon = tau - epsilon; function Path() { this._x0 = this._y0 = // start of current subpath this._x1 = this._y1 = null; // end of current subpath this._ = ""; } function path() { return new Path; } Path.prototype = path.prototype = { constructor: Path, moveTo: function(x, y) { this._ += "M" + (this._x0 = this._x1 = +x) + "," + (this._y0 = this._y1 = +y); }, closePath: function() { if (this._x1 !== null) { this._x1 = this._x0, this._y1 = this._y0; this._ += "Z"; } }, lineTo: function(x, y) { this._ += "L" + (this._x1 = +x) + "," + (this._y1 = +y); }, quadraticCurveTo: function(x1, y1, x, y) { this._ += "Q" + (+x1) + "," + (+y1) + "," + (this._x1 = +x) + "," + (this._y1 = +y); }, bezierCurveTo: function(x1, y1, x2, y2, x, y) { this._ += "C" + (+x1) + "," + (+y1) + "," + (+x2) + "," + (+y2) + "," + (this._x1 = +x) + "," + (this._y1 = +y); }, arcTo: function(x1, y1, x2, y2, r) { x1 = +x1, y1 = +y1, x2 = +x2, y2 = +y2, r = +r; var x0 = this._x1, y0 = this._y1, x21 = x2 - x1, y21 = y2 - y1, x01 = x0 - x1, y01 = y0 - y1, l01_2 = x01 * x01 + y01 * y01; // Is the radius negative? Error. if (r < 0) throw new Error("negative radius: " + r); // Is this path empty? Move to (x1,y1). if (this._x1 === null) { this._ += "M" + (this._x1 = x1) + "," + (this._y1 = y1); } // Or, is (x1,y1) coincident with (x0,y0)? Do nothing. else if (!(l01_2 > epsilon)) {} // Or, are (x0,y0), (x1,y1) and (x2,y2) collinear? // Equivalently, is (x1,y1) coincident with (x2,y2)? // Or, is the radius zero? Line to (x1,y1). else if (!(Math.abs(y01 * x21 - y21 * x01) > epsilon) || !r) { this._ += "L" + (this._x1 = x1) + "," + (this._y1 = y1); } // Otherwise, draw an arc! else { var x20 = x2 - x0, y20 = y2 - y0, l21_2 = x21 * x21 + y21 * y21, l20_2 = x20 * x20 + y20 * y20, l21 = Math.sqrt(l21_2), l01 = Math.sqrt(l01_2), l = r * Math.tan((pi - Math.acos((l21_2 + l01_2 - l20_2) / (2 * l21 * l01))) / 2), t01 = l / l01, t21 = l / l21; // If the start tangent is not coincident with (x0,y0), line to. if (Math.abs(t01 - 1) > epsilon) { this._ += "L" + (x1 + t01 * x01) + "," + (y1 + t01 * y01); } this._ += "A" + r + "," + r + ",0,0," + (+(y01 * x20 > x01 * y20)) + "," + (this._x1 = x1 + t21 * x21) + "," + (this._y1 = y1 + t21 * y21); } }, arc: function(x, y, r, a0, a1, ccw) { x = +x, y = +y, r = +r; var dx = r * Math.cos(a0), dy = r * Math.sin(a0), x0 = x + dx, y0 = y + dy, cw = 1 ^ ccw, da = ccw ? a0 - a1 : a1 - a0; // Is the radius negative? Error. if (r < 0) throw new Error("negative radius: " + r); // Is this path empty? Move to (x0,y0). if (this._x1 === null) { this._ += "M" + x0 + "," + y0; } // Or, is (x0,y0) not coincident with the previous point? Line to (x0,y0). else if (Math.abs(this._x1 - x0) > epsilon || Math.abs(this._y1 - y0) > epsilon) { this._ += "L" + x0 + "," + y0; } // Is this arc empty? We’re done. if (!r) return; // Does the angle go the wrong way? Flip the direction. if (da < 0) da = da % tau + tau; // Is this a complete circle? Draw two arcs to complete the circle. if (da > tauEpsilon) { this._ += "A" + r + "," + r + ",0,1," + cw + "," + (x - dx) + "," + (y - dy) + "A" + r + "," + r + ",0,1," + cw + "," + (this._x1 = x0) + "," + (this._y1 = y0); } // Is this arc non-empty? Draw an arc! else if (da > epsilon) { this._ += "A" + r + "," + r + ",0," + (+(da >= pi)) + "," + cw + "," + (this._x1 = x + r * Math.cos(a1)) + "," + (this._y1 = y + r * Math.sin(a1)); } }, rect: function(x, y, w, h) { this._ += "M" + (this._x0 = this._x1 = +x) + "," + (this._y0 = this._y1 = +y) + "h" + (+w) + "v" + (+h) + "h" + (-w) + "Z"; }, toString: function() { return this._; } }; /* harmony default export */ __webpack_exports__["a"] = (path); /***/ }), /***/ "./node_modules/d3-quadtree/index.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__src_quadtree__ = __webpack_require__("./node_modules/d3-quadtree/src/quadtree.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return __WEBPACK_IMPORTED_MODULE_0__src_quadtree__["a"]; }); /***/ }), /***/ "./node_modules/d3-quadtree/src/add.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = addAll; /* harmony default export */ __webpack_exports__["b"] = (function(d) { var x = +this._x.call(null, d), y = +this._y.call(null, d); return add(this.cover(x, y), x, y, d); }); function add(tree, x, y, d) { if (isNaN(x) || isNaN(y)) return tree; // ignore invalid points var parent, node = tree._root, leaf = {data: d}, x0 = tree._x0, y0 = tree._y0, x1 = tree._x1, y1 = tree._y1, xm, ym, xp, yp, right, bottom, i, j; // If the tree is empty, initialize the root as a leaf. if (!node) return tree._root = leaf, tree; // Find the existing leaf for the new point, or add it. while (node.length) { if (right = x >= (xm = (x0 + x1) / 2)) x0 = xm; else x1 = xm; if (bottom = y >= (ym = (y0 + y1) / 2)) y0 = ym; else y1 = ym; if (parent = node, !(node = node[i = bottom << 1 | right])) return parent[i] = leaf, tree; } // Is the new point is exactly coincident with the existing point? xp = +tree._x.call(null, node.data); yp = +tree._y.call(null, node.data); if (x === xp && y === yp) return leaf.next = node, parent ? parent[i] = leaf : tree._root = leaf, tree; // Otherwise, split the leaf node until the old and new point are separated. do { parent = parent ? parent[i] = new Array(4) : tree._root = new Array(4); if (right = x >= (xm = (x0 + x1) / 2)) x0 = xm; else x1 = xm; if (bottom = y >= (ym = (y0 + y1) / 2)) y0 = ym; else y1 = ym; } while ((i = bottom << 1 | right) === (j = (yp >= ym) << 1 | (xp >= xm))); return parent[j] = node, parent[i] = leaf, tree; } function addAll(data) { var d, i, n = data.length, x, y, xz = new Array(n), yz = new Array(n), x0 = Infinity, y0 = Infinity, x1 = -Infinity, y1 = -Infinity; // Compute the points and their extent. for (i = 0; i < n; ++i) { if (isNaN(x = +this._x.call(null, d = data[i])) || isNaN(y = +this._y.call(null, d))) continue; xz[i] = x; yz[i] = y; if (x < x0) x0 = x; if (x > x1) x1 = x; if (y < y0) y0 = y; if (y > y1) y1 = y; } // If there were no (valid) points, inherit the existing extent. if (x1 < x0) x0 = this._x0, x1 = this._x1; if (y1 < y0) y0 = this._y0, y1 = this._y1; // Expand the tree to cover the new points. this.cover(x0, y0).cover(x1, y1); // Add the new points. for (i = 0; i < n; ++i) { add(this, xz[i], yz[i], data[i]); } return this; } /***/ }), /***/ "./node_modules/d3-quadtree/src/cover.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony default export */ __webpack_exports__["a"] = (function(x, y) { if (isNaN(x = +x) || isNaN(y = +y)) return this; // ignore invalid points var x0 = this._x0, y0 = this._y0, x1 = this._x1, y1 = this._y1; // If the quadtree has no extent, initialize them. // Integer extent are necessary so that if we later double the extent, // the existing quadrant boundaries don’t change due to floating point error! if (isNaN(x0)) { x1 = (x0 = Math.floor(x)) + 1; y1 = (y0 = Math.floor(y)) + 1; } // Otherwise, double repeatedly to cover. else if (x0 > x || x > x1 || y0 > y || y > y1) { var z = x1 - x0, node = this._root, parent, i; switch (i = (y < (y0 + y1) / 2) << 1 | (x < (x0 + x1) / 2)) { case 0: { do parent = new Array(4), parent[i] = node, node = parent; while (z *= 2, x1 = x0 + z, y1 = y0 + z, x > x1 || y > y1); break; } case 1: { do parent = new Array(4), parent[i] = node, node = parent; while (z *= 2, x0 = x1 - z, y1 = y0 + z, x0 > x || y > y1); break; } case 2: { do parent = new Array(4), parent[i] = node, node = parent; while (z *= 2, x1 = x0 + z, y0 = y1 - z, x > x1 || y0 > y); break; } case 3: { do parent = new Array(4), parent[i] = node, node = parent; while (z *= 2, x0 = x1 - z, y0 = y1 - z, x0 > x || y0 > y); break; } } if (this._root && this._root.length) this._root = node; } // If the quadtree covers the point already, just return. else return this; this._x0 = x0; this._y0 = y0; this._x1 = x1; this._y1 = y1; return this; }); /***/ }), /***/ "./node_modules/d3-quadtree/src/data.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony default export */ __webpack_exports__["a"] = (function() { var data = []; this.visit(function(node) { if (!node.length) do data.push(node.data); while (node = node.next) }); return data; }); /***/ }), /***/ "./node_modules/d3-quadtree/src/extent.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony default export */ __webpack_exports__["a"] = (function(_) { return arguments.length ? this.cover(+_[0][0], +_[0][1]).cover(+_[1][0], +_[1][1]) : isNaN(this._x0) ? undefined : [[this._x0, this._y0], [this._x1, this._y1]]; }); /***/ }), /***/ "./node_modules/d3-quadtree/src/find.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__quad__ = __webpack_require__("./node_modules/d3-quadtree/src/quad.js"); /* harmony default export */ __webpack_exports__["a"] = (function(x, y, radius) { var data, x0 = this._x0, y0 = this._y0, x1, y1, x2, y2, x3 = this._x1, y3 = this._y1, quads = [], node = this._root, q, i; if (node) quads.push(new __WEBPACK_IMPORTED_MODULE_0__quad__["a" /* default */](node, x0, y0, x3, y3)); if (radius == null) radius = Infinity; else { x0 = x - radius, y0 = y - radius; x3 = x + radius, y3 = y + radius; radius *= radius; } while (q = quads.pop()) { // Stop searching if this quadrant can’t contain a closer node. if (!(node = q.node) || (x1 = q.x0) > x3 || (y1 = q.y0) > y3 || (x2 = q.x1) < x0 || (y2 = q.y1) < y0) continue; // Bisect the current quadrant. if (node.length) { var xm = (x1 + x2) / 2, ym = (y1 + y2) / 2; quads.push( new __WEBPACK_IMPORTED_MODULE_0__quad__["a" /* default */](node[3], xm, ym, x2, y2), new __WEBPACK_IMPORTED_MODULE_0__quad__["a" /* default */](node[2], x1, ym, xm, y2), new __WEBPACK_IMPORTED_MODULE_0__quad__["a" /* default */](node[1], xm, y1, x2, ym), new __WEBPACK_IMPORTED_MODULE_0__quad__["a" /* default */](node[0], x1, y1, xm, ym) ); // Visit the closest quadrant first. if (i = (y >= ym) << 1 | (x >= xm)) { q = quads[quads.length - 1]; quads[quads.length - 1] = quads[quads.length - 1 - i]; quads[quads.length - 1 - i] = q; } } // Visit this point. (Visiting coincident points isn’t necessary!) else { var dx = x - +this._x.call(null, node.data), dy = y - +this._y.call(null, node.data), d2 = dx * dx + dy * dy; if (d2 < radius) { var d = Math.sqrt(radius = d2); x0 = x - d, y0 = y - d; x3 = x + d, y3 = y + d; data = node.data; } } } return data; }); /***/ }), /***/ "./node_modules/d3-quadtree/src/quad.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony default export */ __webpack_exports__["a"] = (function(node, x0, y0, x1, y1) { this.node = node; this.x0 = x0; this.y0 = y0; this.x1 = x1; this.y1 = y1; }); /***/ }), /***/ "./node_modules/d3-quadtree/src/quadtree.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = quadtree; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__add__ = __webpack_require__("./node_modules/d3-quadtree/src/add.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__cover__ = __webpack_require__("./node_modules/d3-quadtree/src/cover.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__data__ = __webpack_require__("./node_modules/d3-quadtree/src/data.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__extent__ = __webpack_require__("./node_modules/d3-quadtree/src/extent.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__find__ = __webpack_require__("./node_modules/d3-quadtree/src/find.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__remove__ = __webpack_require__("./node_modules/d3-quadtree/src/remove.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__root__ = __webpack_require__("./node_modules/d3-quadtree/src/root.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__size__ = __webpack_require__("./node_modules/d3-quadtree/src/size.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__visit__ = __webpack_require__("./node_modules/d3-quadtree/src/visit.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__visitAfter__ = __webpack_require__("./node_modules/d3-quadtree/src/visitAfter.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__x__ = __webpack_require__("./node_modules/d3-quadtree/src/x.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__y__ = __webpack_require__("./node_modules/d3-quadtree/src/y.js"); function quadtree(nodes, x, y) { var tree = new Quadtree(x == null ? __WEBPACK_IMPORTED_MODULE_10__x__["b" /* defaultX */] : x, y == null ? __WEBPACK_IMPORTED_MODULE_11__y__["b" /* defaultY */] : y, NaN, NaN, NaN, NaN); return nodes == null ? tree : tree.addAll(nodes); } function Quadtree(x, y, x0, y0, x1, y1) { this._x = x; this._y = y; this._x0 = x0; this._y0 = y0; this._x1 = x1; this._y1 = y1; this._root = undefined; } function leaf_copy(leaf) { var copy = {data: leaf.data}, next = copy; while (leaf = leaf.next) next = next.next = {data: leaf.data}; return copy; } var treeProto = quadtree.prototype = Quadtree.prototype; treeProto.copy = function() { var copy = new Quadtree(this._x, this._y, this._x0, this._y0, this._x1, this._y1), node = this._root, nodes, child; if (!node) return copy; if (!node.length) return copy._root = leaf_copy(node), copy; nodes = [{source: node, target: copy._root = new Array(4)}]; while (node = nodes.pop()) { for (var i = 0; i < 4; ++i) { if (child = node.source[i]) { if (child.length) nodes.push({source: child, target: node.target[i] = new Array(4)}); else node.target[i] = leaf_copy(child); } } } return copy; }; treeProto.add = __WEBPACK_IMPORTED_MODULE_0__add__["b" /* default */]; treeProto.addAll = __WEBPACK_IMPORTED_MODULE_0__add__["a" /* addAll */]; treeProto.cover = __WEBPACK_IMPORTED_MODULE_1__cover__["a" /* default */]; treeProto.data = __WEBPACK_IMPORTED_MODULE_2__data__["a" /* default */]; treeProto.extent = __WEBPACK_IMPORTED_MODULE_3__extent__["a" /* default */]; treeProto.find = __WEBPACK_IMPORTED_MODULE_4__find__["a" /* default */]; treeProto.remove = __WEBPACK_IMPORTED_MODULE_5__remove__["a" /* default */]; treeProto.removeAll = __WEBPACK_IMPORTED_MODULE_5__remove__["b" /* removeAll */]; treeProto.root = __WEBPACK_IMPORTED_MODULE_6__root__["a" /* default */]; treeProto.size = __WEBPACK_IMPORTED_MODULE_7__size__["a" /* default */]; treeProto.visit = __WEBPACK_IMPORTED_MODULE_8__visit__["a" /* default */]; treeProto.visitAfter = __WEBPACK_IMPORTED_MODULE_9__visitAfter__["a" /* default */]; treeProto.x = __WEBPACK_IMPORTED_MODULE_10__x__["a" /* default */]; treeProto.y = __WEBPACK_IMPORTED_MODULE_11__y__["a" /* default */]; /***/ }), /***/ "./node_modules/d3-quadtree/src/remove.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["b"] = removeAll; /* harmony default export */ __webpack_exports__["a"] = (function(d) { if (isNaN(x = +this._x.call(null, d)) || isNaN(y = +this._y.call(null, d))) return this; // ignore invalid points var parent, node = this._root, retainer, previous, next, x0 = this._x0, y0 = this._y0, x1 = this._x1, y1 = this._y1, x, y, xm, ym, right, bottom, i, j; // If the tree is empty, initialize the root as a leaf. if (!node) return this; // Find the leaf node for the point. // While descending, also retain the deepest parent with a non-removed sibling. if (node.length) while (true) { if (right = x >= (xm = (x0 + x1) / 2)) x0 = xm; else x1 = xm; if (bottom = y >= (ym = (y0 + y1) / 2)) y0 = ym; else y1 = ym; if (!(parent = node, node = node[i = bottom << 1 | right])) return this; if (!node.length) break; if (parent[(i + 1) & 3] || parent[(i + 2) & 3] || parent[(i + 3) & 3]) retainer = parent, j = i; } // Find the point to remove. while (node.data !== d) if (!(previous = node, node = node.next)) return this; if (next = node.next) delete node.next; // If there are multiple coincident points, remove just the point. if (previous) return (next ? previous.next = next : delete previous.next), this; // If this is the root point, remove it. if (!parent) return this._root = next, this; // Remove this leaf. next ? parent[i] = next : delete parent[i]; // If the parent now contains exactly one leaf, collapse superfluous parents. if ((node = parent[0] || parent[1] || parent[2] || parent[3]) && node === (parent[3] || parent[2] || parent[1] || parent[0]) && !node.length) { if (retainer) retainer[j] = node; else this._root = node; } return this; }); function removeAll(data) { for (var i = 0, n = data.length; i < n; ++i) this.remove(data[i]); return this; } /***/ }), /***/ "./node_modules/d3-quadtree/src/root.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony default export */ __webpack_exports__["a"] = (function() { return this._root; }); /***/ }), /***/ "./node_modules/d3-quadtree/src/size.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony default export */ __webpack_exports__["a"] = (function() { var size = 0; this.visit(function(node) { if (!node.length) do ++size; while (node = node.next) }); return size; }); /***/ }), /***/ "./node_modules/d3-quadtree/src/visit.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__quad__ = __webpack_require__("./node_modules/d3-quadtree/src/quad.js"); /* harmony default export */ __webpack_exports__["a"] = (function(callback) { var quads = [], q, node = this._root, child, x0, y0, x1, y1; if (node) quads.push(new __WEBPACK_IMPORTED_MODULE_0__quad__["a" /* default */](node, this._x0, this._y0, this._x1, this._y1)); while (q = quads.pop()) { if (!callback(node = q.node, x0 = q.x0, y0 = q.y0, x1 = q.x1, y1 = q.y1) && node.length) { var xm = (x0 + x1) / 2, ym = (y0 + y1) / 2; if (child = node[3]) quads.push(new __WEBPACK_IMPORTED_MODULE_0__quad__["a" /* default */](child, xm, ym, x1, y1)); if (child = node[2]) quads.push(new __WEBPACK_IMPORTED_MODULE_0__quad__["a" /* default */](child, x0, ym, xm, y1)); if (child = node[1]) quads.push(new __WEBPACK_IMPORTED_MODULE_0__quad__["a" /* default */](child, xm, y0, x1, ym)); if (child = node[0]) quads.push(new __WEBPACK_IMPORTED_MODULE_0__quad__["a" /* default */](child, x0, y0, xm, ym)); } } return this; }); /***/ }), /***/ "./node_modules/d3-quadtree/src/visitAfter.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__quad__ = __webpack_require__("./node_modules/d3-quadtree/src/quad.js"); /* harmony default export */ __webpack_exports__["a"] = (function(callback) { var quads = [], next = [], q; if (this._root) quads.push(new __WEBPACK_IMPORTED_MODULE_0__quad__["a" /* default */](this._root, this._x0, this._y0, this._x1, this._y1)); while (q = quads.pop()) { var node = q.node; if (node.length) { var child, x0 = q.x0, y0 = q.y0, x1 = q.x1, y1 = q.y1, xm = (x0 + x1) / 2, ym = (y0 + y1) / 2; if (child = node[0]) quads.push(new __WEBPACK_IMPORTED_MODULE_0__quad__["a" /* default */](child, x0, y0, xm, ym)); if (child = node[1]) quads.push(new __WEBPACK_IMPORTED_MODULE_0__quad__["a" /* default */](child, xm, y0, x1, ym)); if (child = node[2]) quads.push(new __WEBPACK_IMPORTED_MODULE_0__quad__["a" /* default */](child, x0, ym, xm, y1)); if (child = node[3]) quads.push(new __WEBPACK_IMPORTED_MODULE_0__quad__["a" /* default */](child, xm, ym, x1, y1)); } next.push(q); } while (q = next.pop()) { callback(q.node, q.x0, q.y0, q.x1, q.y1); } return this; }); /***/ }), /***/ "./node_modules/d3-quadtree/src/x.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["b"] = defaultX; function defaultX(d) { return d[0]; } /* harmony default export */ __webpack_exports__["a"] = (function(_) { return arguments.length ? (this._x = _, this) : this._x; }); /***/ }), /***/ "./node_modules/d3-quadtree/src/y.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["b"] = defaultY; function defaultY(d) { return d[1]; } /* harmony default export */ __webpack_exports__["a"] = (function(_) { return arguments.length ? (this._y = _, this) : this._y; }); /***/ }), /***/ "./node_modules/d3-selection/index.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__src_create__ = __webpack_require__("./node_modules/d3-selection/src/create.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "create", function() { return __WEBPACK_IMPORTED_MODULE_0__src_create__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__src_creator__ = __webpack_require__("./node_modules/d3-selection/src/creator.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "creator", function() { return __WEBPACK_IMPORTED_MODULE_1__src_creator__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__src_local__ = __webpack_require__("./node_modules/d3-selection/src/local.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "local", function() { return __WEBPACK_IMPORTED_MODULE_2__src_local__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__src_matcher__ = __webpack_require__("./node_modules/d3-selection/src/matcher.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "matcher", function() { return __WEBPACK_IMPORTED_MODULE_3__src_matcher__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__src_mouse__ = __webpack_require__("./node_modules/d3-selection/src/mouse.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "mouse", function() { return __WEBPACK_IMPORTED_MODULE_4__src_mouse__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__src_namespace__ = __webpack_require__("./node_modules/d3-selection/src/namespace.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "namespace", function() { return __WEBPACK_IMPORTED_MODULE_5__src_namespace__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__src_namespaces__ = __webpack_require__("./node_modules/d3-selection/src/namespaces.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "namespaces", function() { return __WEBPACK_IMPORTED_MODULE_6__src_namespaces__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__src_point__ = __webpack_require__("./node_modules/d3-selection/src/point.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "clientPoint", function() { return __WEBPACK_IMPORTED_MODULE_7__src_point__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__src_select__ = __webpack_require__("./node_modules/d3-selection/src/select.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "select", function() { return __WEBPACK_IMPORTED_MODULE_8__src_select__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__src_selectAll__ = __webpack_require__("./node_modules/d3-selection/src/selectAll.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "selectAll", function() { return __WEBPACK_IMPORTED_MODULE_9__src_selectAll__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__src_selection_index__ = __webpack_require__("./node_modules/d3-selection/src/selection/index.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "selection", function() { return __WEBPACK_IMPORTED_MODULE_10__src_selection_index__["b"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__src_selector__ = __webpack_require__("./node_modules/d3-selection/src/selector.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "selector", function() { return __WEBPACK_IMPORTED_MODULE_11__src_selector__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__src_selectorAll__ = __webpack_require__("./node_modules/d3-selection/src/selectorAll.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "selectorAll", function() { return __WEBPACK_IMPORTED_MODULE_12__src_selectorAll__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__src_selection_style__ = __webpack_require__("./node_modules/d3-selection/src/selection/style.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "style", function() { return __WEBPACK_IMPORTED_MODULE_13__src_selection_style__["b"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__src_touch__ = __webpack_require__("./node_modules/d3-selection/src/touch.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "touch", function() { return __WEBPACK_IMPORTED_MODULE_14__src_touch__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__src_touches__ = __webpack_require__("./node_modules/d3-selection/src/touches.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "touches", function() { return __WEBPACK_IMPORTED_MODULE_15__src_touches__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__src_window__ = __webpack_require__("./node_modules/d3-selection/src/window.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "window", function() { return __WEBPACK_IMPORTED_MODULE_16__src_window__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_17__src_selection_on__ = __webpack_require__("./node_modules/d3-selection/src/selection/on.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "event", function() { return __WEBPACK_IMPORTED_MODULE_17__src_selection_on__["c"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "customEvent", function() { return __WEBPACK_IMPORTED_MODULE_17__src_selection_on__["a"]; }); /***/ }), /***/ "./node_modules/d3-selection/src/constant.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony default export */ __webpack_exports__["a"] = (function(x) { return function() { return x; }; }); /***/ }), /***/ "./node_modules/d3-selection/src/create.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__creator__ = __webpack_require__("./node_modules/d3-selection/src/creator.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__select__ = __webpack_require__("./node_modules/d3-selection/src/select.js"); /* harmony default export */ __webpack_exports__["a"] = (function(name) { return Object(__WEBPACK_IMPORTED_MODULE_1__select__["a" /* default */])(Object(__WEBPACK_IMPORTED_MODULE_0__creator__["a" /* default */])(name).call(document.documentElement)); }); /***/ }), /***/ "./node_modules/d3-selection/src/creator.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__namespace__ = __webpack_require__("./node_modules/d3-selection/src/namespace.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__namespaces__ = __webpack_require__("./node_modules/d3-selection/src/namespaces.js"); function creatorInherit(name) { return function() { var document = this.ownerDocument, uri = this.namespaceURI; return uri === __WEBPACK_IMPORTED_MODULE_1__namespaces__["b" /* xhtml */] && document.documentElement.namespaceURI === __WEBPACK_IMPORTED_MODULE_1__namespaces__["b" /* xhtml */] ? document.createElement(name) : document.createElementNS(uri, name); }; } function creatorFixed(fullname) { return function() { return this.ownerDocument.createElementNS(fullname.space, fullname.local); }; } /* harmony default export */ __webpack_exports__["a"] = (function(name) { var fullname = Object(__WEBPACK_IMPORTED_MODULE_0__namespace__["a" /* default */])(name); return (fullname.local ? creatorFixed : creatorInherit)(fullname); }); /***/ }), /***/ "./node_modules/d3-selection/src/local.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = local; var nextId = 0; function local() { return new Local; } function Local() { this._ = "@" + (++nextId).toString(36); } Local.prototype = local.prototype = { constructor: Local, get: function(node) { var id = this._; while (!(id in node)) if (!(node = node.parentNode)) return; return node[id]; }, set: function(node, value) { return node[this._] = value; }, remove: function(node) { return this._ in node && delete node[this._]; }, toString: function() { return this._; } }; /***/ }), /***/ "./node_modules/d3-selection/src/matcher.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; var matcher = function(selector) { return function() { return this.matches(selector); }; }; if (typeof document !== "undefined") { var element = document.documentElement; if (!element.matches) { var vendorMatches = element.webkitMatchesSelector || element.msMatchesSelector || element.mozMatchesSelector || element.oMatchesSelector; matcher = function(selector) { return function() { return vendorMatches.call(this, selector); }; }; } } /* harmony default export */ __webpack_exports__["a"] = (matcher); /***/ }), /***/ "./node_modules/d3-selection/src/mouse.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__sourceEvent__ = __webpack_require__("./node_modules/d3-selection/src/sourceEvent.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__point__ = __webpack_require__("./node_modules/d3-selection/src/point.js"); /* harmony default export */ __webpack_exports__["a"] = (function(node) { var event = Object(__WEBPACK_IMPORTED_MODULE_0__sourceEvent__["a" /* default */])(); if (event.changedTouches) event = event.changedTouches[0]; return Object(__WEBPACK_IMPORTED_MODULE_1__point__["a" /* default */])(node, event); }); /***/ }), /***/ "./node_modules/d3-selection/src/namespace.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__namespaces__ = __webpack_require__("./node_modules/d3-selection/src/namespaces.js"); /* harmony default export */ __webpack_exports__["a"] = (function(name) { var prefix = name += "", i = prefix.indexOf(":"); if (i >= 0 && (prefix = name.slice(0, i)) !== "xmlns") name = name.slice(i + 1); return __WEBPACK_IMPORTED_MODULE_0__namespaces__["a" /* default */].hasOwnProperty(prefix) ? {space: __WEBPACK_IMPORTED_MODULE_0__namespaces__["a" /* default */][prefix], local: name} : name; }); /***/ }), /***/ "./node_modules/d3-selection/src/namespaces.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return xhtml; }); var xhtml = "http://www.w3.org/1999/xhtml"; /* harmony default export */ __webpack_exports__["a"] = ({ svg: "http://www.w3.org/2000/svg", xhtml: xhtml, xlink: "http://www.w3.org/1999/xlink", xml: "http://www.w3.org/XML/1998/namespace", xmlns: "http://www.w3.org/2000/xmlns/" }); /***/ }), /***/ "./node_modules/d3-selection/src/point.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony default export */ __webpack_exports__["a"] = (function(node, event) { var svg = node.ownerSVGElement || node; if (svg.createSVGPoint) { var point = svg.createSVGPoint(); point.x = event.clientX, point.y = event.clientY; point = point.matrixTransform(node.getScreenCTM().inverse()); return [point.x, point.y]; } var rect = node.getBoundingClientRect(); return [event.clientX - rect.left - node.clientLeft, event.clientY - rect.top - node.clientTop]; }); /***/ }), /***/ "./node_modules/d3-selection/src/select.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__selection_index__ = __webpack_require__("./node_modules/d3-selection/src/selection/index.js"); /* harmony default export */ __webpack_exports__["a"] = (function(selector) { return typeof selector === "string" ? new __WEBPACK_IMPORTED_MODULE_0__selection_index__["a" /* Selection */]([[document.querySelector(selector)]], [document.documentElement]) : new __WEBPACK_IMPORTED_MODULE_0__selection_index__["a" /* Selection */]([[selector]], __WEBPACK_IMPORTED_MODULE_0__selection_index__["c" /* root */]); }); /***/ }), /***/ "./node_modules/d3-selection/src/selectAll.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__selection_index__ = __webpack_require__("./node_modules/d3-selection/src/selection/index.js"); /* harmony default export */ __webpack_exports__["a"] = (function(selector) { return typeof selector === "string" ? new __WEBPACK_IMPORTED_MODULE_0__selection_index__["a" /* Selection */]([document.querySelectorAll(selector)], [document.documentElement]) : new __WEBPACK_IMPORTED_MODULE_0__selection_index__["a" /* Selection */]([selector == null ? [] : selector], __WEBPACK_IMPORTED_MODULE_0__selection_index__["c" /* root */]); }); /***/ }), /***/ "./node_modules/d3-selection/src/selection/append.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__creator__ = __webpack_require__("./node_modules/d3-selection/src/creator.js"); /* harmony default export */ __webpack_exports__["a"] = (function(name) { var create = typeof name === "function" ? name : Object(__WEBPACK_IMPORTED_MODULE_0__creator__["a" /* default */])(name); return this.select(function() { return this.appendChild(create.apply(this, arguments)); }); }); /***/ }), /***/ "./node_modules/d3-selection/src/selection/attr.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__namespace__ = __webpack_require__("./node_modules/d3-selection/src/namespace.js"); function attrRemove(name) { return function() { this.removeAttribute(name); }; } function attrRemoveNS(fullname) { return function() { this.removeAttributeNS(fullname.space, fullname.local); }; } function attrConstant(name, value) { return function() { this.setAttribute(name, value); }; } function attrConstantNS(fullname, value) { return function() { this.setAttributeNS(fullname.space, fullname.local, value); }; } function attrFunction(name, value) { return function() { var v = value.apply(this, arguments); if (v == null) this.removeAttribute(name); else this.setAttribute(name, v); }; } function attrFunctionNS(fullname, value) { return function() { var v = value.apply(this, arguments); if (v == null) this.removeAttributeNS(fullname.space, fullname.local); else this.setAttributeNS(fullname.space, fullname.local, v); }; } /* harmony default export */ __webpack_exports__["a"] = (function(name, value) { var fullname = Object(__WEBPACK_IMPORTED_MODULE_0__namespace__["a" /* default */])(name); if (arguments.length < 2) { var node = this.node(); return fullname.local ? node.getAttributeNS(fullname.space, fullname.local) : node.getAttribute(fullname); } return this.each((value == null ? (fullname.local ? attrRemoveNS : attrRemove) : (typeof value === "function" ? (fullname.local ? attrFunctionNS : attrFunction) : (fullname.local ? attrConstantNS : attrConstant)))(fullname, value)); }); /***/ }), /***/ "./node_modules/d3-selection/src/selection/call.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony default export */ __webpack_exports__["a"] = (function() { var callback = arguments[0]; arguments[0] = this; callback.apply(null, arguments); return this; }); /***/ }), /***/ "./node_modules/d3-selection/src/selection/classed.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; function classArray(string) { return string.trim().split(/^|\s+/); } function classList(node) { return node.classList || new ClassList(node); } function ClassList(node) { this._node = node; this._names = classArray(node.getAttribute("class") || ""); } ClassList.prototype = { add: function(name) { var i = this._names.indexOf(name); if (i < 0) { this._names.push(name); this._node.setAttribute("class", this._names.join(" ")); } }, remove: function(name) { var i = this._names.indexOf(name); if (i >= 0) { this._names.splice(i, 1); this._node.setAttribute("class", this._names.join(" ")); } }, contains: function(name) { return this._names.indexOf(name) >= 0; } }; function classedAdd(node, names) { var list = classList(node), i = -1, n = names.length; while (++i < n) list.add(names[i]); } function classedRemove(node, names) { var list = classList(node), i = -1, n = names.length; while (++i < n) list.remove(names[i]); } function classedTrue(names) { return function() { classedAdd(this, names); }; } function classedFalse(names) { return function() { classedRemove(this, names); }; } function classedFunction(names, value) { return function() { (value.apply(this, arguments) ? classedAdd : classedRemove)(this, names); }; } /* harmony default export */ __webpack_exports__["a"] = (function(name, value) { var names = classArray(name + ""); if (arguments.length < 2) { var list = classList(this.node()), i = -1, n = names.length; while (++i < n) if (!list.contains(names[i])) return false; return true; } return this.each((typeof value === "function" ? classedFunction : value ? classedTrue : classedFalse)(names, value)); }); /***/ }), /***/ "./node_modules/d3-selection/src/selection/clone.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; function selection_cloneShallow() { return this.parentNode.insertBefore(this.cloneNode(false), this.nextSibling); } function selection_cloneDeep() { return this.parentNode.insertBefore(this.cloneNode(true), this.nextSibling); } /* harmony default export */ __webpack_exports__["a"] = (function(deep) { return this.select(deep ? selection_cloneDeep : selection_cloneShallow); }); /***/ }), /***/ "./node_modules/d3-selection/src/selection/data.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__index__ = __webpack_require__("./node_modules/d3-selection/src/selection/index.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__enter__ = __webpack_require__("./node_modules/d3-selection/src/selection/enter.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__constant__ = __webpack_require__("./node_modules/d3-selection/src/constant.js"); var keyPrefix = "$"; // Protect against keys like “__proto__”. function bindIndex(parent, group, enter, update, exit, data) { var i = 0, node, groupLength = group.length, dataLength = data.length; // Put any non-null nodes that fit into update. // Put any null nodes into enter. // Put any remaining data into enter. for (; i < dataLength; ++i) { if (node = group[i]) { node.__data__ = data[i]; update[i] = node; } else { enter[i] = new __WEBPACK_IMPORTED_MODULE_1__enter__["a" /* EnterNode */](parent, data[i]); } } // Put any non-null nodes that don’t fit into exit. for (; i < groupLength; ++i) { if (node = group[i]) { exit[i] = node; } } } function bindKey(parent, group, enter, update, exit, data, key) { var i, node, nodeByKeyValue = {}, groupLength = group.length, dataLength = data.length, keyValues = new Array(groupLength), keyValue; // Compute the key for each node. // If multiple nodes have the same key, the duplicates are added to exit. for (i = 0; i < groupLength; ++i) { if (node = group[i]) { keyValues[i] = keyValue = keyPrefix + key.call(node, node.__data__, i, group); if (keyValue in nodeByKeyValue) { exit[i] = node; } else { nodeByKeyValue[keyValue] = node; } } } // Compute the key for each datum. // If there a node associated with this key, join and add it to update. // If there is not (or the key is a duplicate), add it to enter. for (i = 0; i < dataLength; ++i) { keyValue = keyPrefix + key.call(parent, data[i], i, data); if (node = nodeByKeyValue[keyValue]) { update[i] = node; node.__data__ = data[i]; nodeByKeyValue[keyValue] = null; } else { enter[i] = new __WEBPACK_IMPORTED_MODULE_1__enter__["a" /* EnterNode */](parent, data[i]); } } // Add any remaining nodes that were not bound to data to exit. for (i = 0; i < groupLength; ++i) { if ((node = group[i]) && (nodeByKeyValue[keyValues[i]] === node)) { exit[i] = node; } } } /* harmony default export */ __webpack_exports__["a"] = (function(value, key) { if (!value) { data = new Array(this.size()), j = -1; this.each(function(d) { data[++j] = d; }); return data; } var bind = key ? bindKey : bindIndex, parents = this._parents, groups = this._groups; if (typeof value !== "function") value = Object(__WEBPACK_IMPORTED_MODULE_2__constant__["a" /* default */])(value); for (var m = groups.length, update = new Array(m), enter = new Array(m), exit = new Array(m), j = 0; j < m; ++j) { var parent = parents[j], group = groups[j], groupLength = group.length, data = value.call(parent, parent && parent.__data__, j, parents), dataLength = data.length, enterGroup = enter[j] = new Array(dataLength), updateGroup = update[j] = new Array(dataLength), exitGroup = exit[j] = new Array(groupLength); bind(parent, group, enterGroup, updateGroup, exitGroup, data, key); // Now connect the enter nodes to their following update node, such that // appendChild can insert the materialized enter node before this node, // rather than at the end of the parent node. for (var i0 = 0, i1 = 0, previous, next; i0 < dataLength; ++i0) { if (previous = enterGroup[i0]) { if (i0 >= i1) i1 = i0 + 1; while (!(next = updateGroup[i1]) && ++i1 < dataLength); previous._next = next || null; } } } update = new __WEBPACK_IMPORTED_MODULE_0__index__["a" /* Selection */](update, parents); update._enter = enter; update._exit = exit; return update; }); /***/ }), /***/ "./node_modules/d3-selection/src/selection/datum.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony default export */ __webpack_exports__["a"] = (function(value) { return arguments.length ? this.property("__data__", value) : this.node().__data__; }); /***/ }), /***/ "./node_modules/d3-selection/src/selection/dispatch.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__window__ = __webpack_require__("./node_modules/d3-selection/src/window.js"); function dispatchEvent(node, type, params) { var window = Object(__WEBPACK_IMPORTED_MODULE_0__window__["a" /* default */])(node), event = window.CustomEvent; if (typeof event === "function") { event = new event(type, params); } else { event = window.document.createEvent("Event"); if (params) event.initEvent(type, params.bubbles, params.cancelable), event.detail = params.detail; else event.initEvent(type, false, false); } node.dispatchEvent(event); } function dispatchConstant(type, params) { return function() { return dispatchEvent(this, type, params); }; } function dispatchFunction(type, params) { return function() { return dispatchEvent(this, type, params.apply(this, arguments)); }; } /* harmony default export */ __webpack_exports__["a"] = (function(type, params) { return this.each((typeof params === "function" ? dispatchFunction : dispatchConstant)(type, params)); }); /***/ }), /***/ "./node_modules/d3-selection/src/selection/each.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony default export */ __webpack_exports__["a"] = (function(callback) { for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) { for (var group = groups[j], i = 0, n = group.length, node; i < n; ++i) { if (node = group[i]) callback.call(node, node.__data__, i, group); } } return this; }); /***/ }), /***/ "./node_modules/d3-selection/src/selection/empty.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony default export */ __webpack_exports__["a"] = (function() { return !this.node(); }); /***/ }), /***/ "./node_modules/d3-selection/src/selection/enter.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = EnterNode; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__sparse__ = __webpack_require__("./node_modules/d3-selection/src/selection/sparse.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__index__ = __webpack_require__("./node_modules/d3-selection/src/selection/index.js"); /* harmony default export */ __webpack_exports__["b"] = (function() { return new __WEBPACK_IMPORTED_MODULE_1__index__["a" /* Selection */](this._enter || this._groups.map(__WEBPACK_IMPORTED_MODULE_0__sparse__["a" /* default */]), this._parents); }); function EnterNode(parent, datum) { this.ownerDocument = parent.ownerDocument; this.namespaceURI = parent.namespaceURI; this._next = null; this._parent = parent; this.__data__ = datum; } EnterNode.prototype = { constructor: EnterNode, appendChild: function(child) { return this._parent.insertBefore(child, this._next); }, insertBefore: function(child, next) { return this._parent.insertBefore(child, next); }, querySelector: function(selector) { return this._parent.querySelector(selector); }, querySelectorAll: function(selector) { return this._parent.querySelectorAll(selector); } }; /***/ }), /***/ "./node_modules/d3-selection/src/selection/exit.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__sparse__ = __webpack_require__("./node_modules/d3-selection/src/selection/sparse.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__index__ = __webpack_require__("./node_modules/d3-selection/src/selection/index.js"); /* harmony default export */ __webpack_exports__["a"] = (function() { return new __WEBPACK_IMPORTED_MODULE_1__index__["a" /* Selection */](this._exit || this._groups.map(__WEBPACK_IMPORTED_MODULE_0__sparse__["a" /* default */]), this._parents); }); /***/ }), /***/ "./node_modules/d3-selection/src/selection/filter.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__index__ = __webpack_require__("./node_modules/d3-selection/src/selection/index.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__matcher__ = __webpack_require__("./node_modules/d3-selection/src/matcher.js"); /* harmony default export */ __webpack_exports__["a"] = (function(match) { if (typeof match !== "function") match = Object(__WEBPACK_IMPORTED_MODULE_1__matcher__["a" /* default */])(match); for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) { for (var group = groups[j], n = group.length, subgroup = subgroups[j] = [], node, i = 0; i < n; ++i) { if ((node = group[i]) && match.call(node, node.__data__, i, group)) { subgroup.push(node); } } } return new __WEBPACK_IMPORTED_MODULE_0__index__["a" /* Selection */](subgroups, this._parents); }); /***/ }), /***/ "./node_modules/d3-selection/src/selection/html.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; function htmlRemove() { this.innerHTML = ""; } function htmlConstant(value) { return function() { this.innerHTML = value; }; } function htmlFunction(value) { return function() { var v = value.apply(this, arguments); this.innerHTML = v == null ? "" : v; }; } /* harmony default export */ __webpack_exports__["a"] = (function(value) { return arguments.length ? this.each(value == null ? htmlRemove : (typeof value === "function" ? htmlFunction : htmlConstant)(value)) : this.node().innerHTML; }); /***/ }), /***/ "./node_modules/d3-selection/src/selection/index.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return root; }); /* harmony export (immutable) */ __webpack_exports__["a"] = Selection; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__select__ = __webpack_require__("./node_modules/d3-selection/src/selection/select.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__selectAll__ = __webpack_require__("./node_modules/d3-selection/src/selection/selectAll.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__filter__ = __webpack_require__("./node_modules/d3-selection/src/selection/filter.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__data__ = __webpack_require__("./node_modules/d3-selection/src/selection/data.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__enter__ = __webpack_require__("./node_modules/d3-selection/src/selection/enter.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__exit__ = __webpack_require__("./node_modules/d3-selection/src/selection/exit.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__merge__ = __webpack_require__("./node_modules/d3-selection/src/selection/merge.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__order__ = __webpack_require__("./node_modules/d3-selection/src/selection/order.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__sort__ = __webpack_require__("./node_modules/d3-selection/src/selection/sort.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__call__ = __webpack_require__("./node_modules/d3-selection/src/selection/call.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__nodes__ = __webpack_require__("./node_modules/d3-selection/src/selection/nodes.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__node__ = __webpack_require__("./node_modules/d3-selection/src/selection/node.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__size__ = __webpack_require__("./node_modules/d3-selection/src/selection/size.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__empty__ = __webpack_require__("./node_modules/d3-selection/src/selection/empty.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__each__ = __webpack_require__("./node_modules/d3-selection/src/selection/each.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__attr__ = __webpack_require__("./node_modules/d3-selection/src/selection/attr.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__style__ = __webpack_require__("./node_modules/d3-selection/src/selection/style.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_17__property__ = __webpack_require__("./node_modules/d3-selection/src/selection/property.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_18__classed__ = __webpack_require__("./node_modules/d3-selection/src/selection/classed.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_19__text__ = __webpack_require__("./node_modules/d3-selection/src/selection/text.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_20__html__ = __webpack_require__("./node_modules/d3-selection/src/selection/html.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_21__raise__ = __webpack_require__("./node_modules/d3-selection/src/selection/raise.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_22__lower__ = __webpack_require__("./node_modules/d3-selection/src/selection/lower.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_23__append__ = __webpack_require__("./node_modules/d3-selection/src/selection/append.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_24__insert__ = __webpack_require__("./node_modules/d3-selection/src/selection/insert.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_25__remove__ = __webpack_require__("./node_modules/d3-selection/src/selection/remove.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_26__clone__ = __webpack_require__("./node_modules/d3-selection/src/selection/clone.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_27__datum__ = __webpack_require__("./node_modules/d3-selection/src/selection/datum.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_28__on__ = __webpack_require__("./node_modules/d3-selection/src/selection/on.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_29__dispatch__ = __webpack_require__("./node_modules/d3-selection/src/selection/dispatch.js"); var root = [null]; function Selection(groups, parents) { this._groups = groups; this._parents = parents; } function selection() { return new Selection([[document.documentElement]], root); } Selection.prototype = selection.prototype = { constructor: Selection, select: __WEBPACK_IMPORTED_MODULE_0__select__["a" /* default */], selectAll: __WEBPACK_IMPORTED_MODULE_1__selectAll__["a" /* default */], filter: __WEBPACK_IMPORTED_MODULE_2__filter__["a" /* default */], data: __WEBPACK_IMPORTED_MODULE_3__data__["a" /* default */], enter: __WEBPACK_IMPORTED_MODULE_4__enter__["b" /* default */], exit: __WEBPACK_IMPORTED_MODULE_5__exit__["a" /* default */], merge: __WEBPACK_IMPORTED_MODULE_6__merge__["a" /* default */], order: __WEBPACK_IMPORTED_MODULE_7__order__["a" /* default */], sort: __WEBPACK_IMPORTED_MODULE_8__sort__["a" /* default */], call: __WEBPACK_IMPORTED_MODULE_9__call__["a" /* default */], nodes: __WEBPACK_IMPORTED_MODULE_10__nodes__["a" /* default */], node: __WEBPACK_IMPORTED_MODULE_11__node__["a" /* default */], size: __WEBPACK_IMPORTED_MODULE_12__size__["a" /* default */], empty: __WEBPACK_IMPORTED_MODULE_13__empty__["a" /* default */], each: __WEBPACK_IMPORTED_MODULE_14__each__["a" /* default */], attr: __WEBPACK_IMPORTED_MODULE_15__attr__["a" /* default */], style: __WEBPACK_IMPORTED_MODULE_16__style__["a" /* default */], property: __WEBPACK_IMPORTED_MODULE_17__property__["a" /* default */], classed: __WEBPACK_IMPORTED_MODULE_18__classed__["a" /* default */], text: __WEBPACK_IMPORTED_MODULE_19__text__["a" /* default */], html: __WEBPACK_IMPORTED_MODULE_20__html__["a" /* default */], raise: __WEBPACK_IMPORTED_MODULE_21__raise__["a" /* default */], lower: __WEBPACK_IMPORTED_MODULE_22__lower__["a" /* default */], append: __WEBPACK_IMPORTED_MODULE_23__append__["a" /* default */], insert: __WEBPACK_IMPORTED_MODULE_24__insert__["a" /* default */], remove: __WEBPACK_IMPORTED_MODULE_25__remove__["a" /* default */], clone: __WEBPACK_IMPORTED_MODULE_26__clone__["a" /* default */], datum: __WEBPACK_IMPORTED_MODULE_27__datum__["a" /* default */], on: __WEBPACK_IMPORTED_MODULE_28__on__["b" /* default */], dispatch: __WEBPACK_IMPORTED_MODULE_29__dispatch__["a" /* default */] }; /* harmony default export */ __webpack_exports__["b"] = (selection); /***/ }), /***/ "./node_modules/d3-selection/src/selection/insert.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__creator__ = __webpack_require__("./node_modules/d3-selection/src/creator.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__selector__ = __webpack_require__("./node_modules/d3-selection/src/selector.js"); function constantNull() { return null; } /* harmony default export */ __webpack_exports__["a"] = (function(name, before) { var create = typeof name === "function" ? name : Object(__WEBPACK_IMPORTED_MODULE_0__creator__["a" /* default */])(name), select = before == null ? constantNull : typeof before === "function" ? before : Object(__WEBPACK_IMPORTED_MODULE_1__selector__["a" /* default */])(before); return this.select(function() { return this.insertBefore(create.apply(this, arguments), select.apply(this, arguments) || null); }); }); /***/ }), /***/ "./node_modules/d3-selection/src/selection/lower.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; function lower() { if (this.previousSibling) this.parentNode.insertBefore(this, this.parentNode.firstChild); } /* harmony default export */ __webpack_exports__["a"] = (function() { return this.each(lower); }); /***/ }), /***/ "./node_modules/d3-selection/src/selection/merge.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__index__ = __webpack_require__("./node_modules/d3-selection/src/selection/index.js"); /* harmony default export */ __webpack_exports__["a"] = (function(selection) { for (var groups0 = this._groups, groups1 = selection._groups, m0 = groups0.length, m1 = groups1.length, m = Math.min(m0, m1), merges = new Array(m0), j = 0; j < m; ++j) { for (var group0 = groups0[j], group1 = groups1[j], n = group0.length, merge = merges[j] = new Array(n), node, i = 0; i < n; ++i) { if (node = group0[i] || group1[i]) { merge[i] = node; } } } for (; j < m0; ++j) { merges[j] = groups0[j]; } return new __WEBPACK_IMPORTED_MODULE_0__index__["a" /* Selection */](merges, this._parents); }); /***/ }), /***/ "./node_modules/d3-selection/src/selection/node.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony default export */ __webpack_exports__["a"] = (function() { for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) { for (var group = groups[j], i = 0, n = group.length; i < n; ++i) { var node = group[i]; if (node) return node; } } return null; }); /***/ }), /***/ "./node_modules/d3-selection/src/selection/nodes.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony default export */ __webpack_exports__["a"] = (function() { var nodes = new Array(this.size()), i = -1; this.each(function() { nodes[++i] = this; }); return nodes; }); /***/ }), /***/ "./node_modules/d3-selection/src/selection/on.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return event; }); /* harmony export (immutable) */ __webpack_exports__["a"] = customEvent; var filterEvents = {}; var event = null; if (typeof document !== "undefined") { var element = document.documentElement; if (!("onmouseenter" in element)) { filterEvents = {mouseenter: "mouseover", mouseleave: "mouseout"}; } } function filterContextListener(listener, index, group) { listener = contextListener(listener, index, group); return function(event) { var related = event.relatedTarget; if (!related || (related !== this && !(related.compareDocumentPosition(this) & 8))) { listener.call(this, event); } }; } function contextListener(listener, index, group) { return function(event1) { var event0 = event; // Events can be reentrant (e.g., focus). event = event1; try { listener.call(this, this.__data__, index, group); } finally { event = event0; } }; } function parseTypenames(typenames) { return typenames.trim().split(/^|\s+/).map(function(t) { var name = "", i = t.indexOf("."); if (i >= 0) name = t.slice(i + 1), t = t.slice(0, i); return {type: t, name: name}; }); } function onRemove(typename) { return function() { var on = this.__on; if (!on) return; for (var j = 0, i = -1, m = on.length, o; j < m; ++j) { if (o = on[j], (!typename.type || o.type === typename.type) && o.name === typename.name) { this.removeEventListener(o.type, o.listener, o.capture); } else { on[++i] = o; } } if (++i) on.length = i; else delete this.__on; }; } function onAdd(typename, value, capture) { var wrap = filterEvents.hasOwnProperty(typename.type) ? filterContextListener : contextListener; return function(d, i, group) { var on = this.__on, o, listener = wrap(value, i, group); if (on) for (var j = 0, m = on.length; j < m; ++j) { if ((o = on[j]).type === typename.type && o.name === typename.name) { this.removeEventListener(o.type, o.listener, o.capture); this.addEventListener(o.type, o.listener = listener, o.capture = capture); o.value = value; return; } } this.addEventListener(typename.type, listener, capture); o = {type: typename.type, name: typename.name, value: value, listener: listener, capture: capture}; if (!on) this.__on = [o]; else on.push(o); }; } /* harmony default export */ __webpack_exports__["b"] = (function(typename, value, capture) { var typenames = parseTypenames(typename + ""), i, n = typenames.length, t; if (arguments.length < 2) { var on = this.node().__on; if (on) for (var j = 0, m = on.length, o; j < m; ++j) { for (i = 0, o = on[j]; i < n; ++i) { if ((t = typenames[i]).type === o.type && t.name === o.name) { return o.value; } } } return; } on = value ? onAdd : onRemove; if (capture == null) capture = false; for (i = 0; i < n; ++i) this.each(on(typenames[i], value, capture)); return this; }); function customEvent(event1, listener, that, args) { var event0 = event; event1.sourceEvent = event; event = event1; try { return listener.apply(that, args); } finally { event = event0; } } /***/ }), /***/ "./node_modules/d3-selection/src/selection/order.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony default export */ __webpack_exports__["a"] = (function() { for (var groups = this._groups, j = -1, m = groups.length; ++j < m;) { for (var group = groups[j], i = group.length - 1, next = group[i], node; --i >= 0;) { if (node = group[i]) { if (next && next !== node.nextSibling) next.parentNode.insertBefore(node, next); next = node; } } } return this; }); /***/ }), /***/ "./node_modules/d3-selection/src/selection/property.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; function propertyRemove(name) { return function() { delete this[name]; }; } function propertyConstant(name, value) { return function() { this[name] = value; }; } function propertyFunction(name, value) { return function() { var v = value.apply(this, arguments); if (v == null) delete this[name]; else this[name] = v; }; } /* harmony default export */ __webpack_exports__["a"] = (function(name, value) { return arguments.length > 1 ? this.each((value == null ? propertyRemove : typeof value === "function" ? propertyFunction : propertyConstant)(name, value)) : this.node()[name]; }); /***/ }), /***/ "./node_modules/d3-selection/src/selection/raise.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; function raise() { if (this.nextSibling) this.parentNode.appendChild(this); } /* harmony default export */ __webpack_exports__["a"] = (function() { return this.each(raise); }); /***/ }), /***/ "./node_modules/d3-selection/src/selection/remove.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; function remove() { var parent = this.parentNode; if (parent) parent.removeChild(this); } /* harmony default export */ __webpack_exports__["a"] = (function() { return this.each(remove); }); /***/ }), /***/ "./node_modules/d3-selection/src/selection/select.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__index__ = __webpack_require__("./node_modules/d3-selection/src/selection/index.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__selector__ = __webpack_require__("./node_modules/d3-selection/src/selector.js"); /* harmony default export */ __webpack_exports__["a"] = (function(select) { if (typeof select !== "function") select = Object(__WEBPACK_IMPORTED_MODULE_1__selector__["a" /* default */])(select); for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) { for (var group = groups[j], n = group.length, subgroup = subgroups[j] = new Array(n), node, subnode, i = 0; i < n; ++i) { if ((node = group[i]) && (subnode = select.call(node, node.__data__, i, group))) { if ("__data__" in node) subnode.__data__ = node.__data__; subgroup[i] = subnode; } } } return new __WEBPACK_IMPORTED_MODULE_0__index__["a" /* Selection */](subgroups, this._parents); }); /***/ }), /***/ "./node_modules/d3-selection/src/selection/selectAll.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__index__ = __webpack_require__("./node_modules/d3-selection/src/selection/index.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__selectorAll__ = __webpack_require__("./node_modules/d3-selection/src/selectorAll.js"); /* harmony default export */ __webpack_exports__["a"] = (function(select) { if (typeof select !== "function") select = Object(__WEBPACK_IMPORTED_MODULE_1__selectorAll__["a" /* default */])(select); for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j = 0; j < m; ++j) { for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) { if (node = group[i]) { subgroups.push(select.call(node, node.__data__, i, group)); parents.push(node); } } } return new __WEBPACK_IMPORTED_MODULE_0__index__["a" /* Selection */](subgroups, parents); }); /***/ }), /***/ "./node_modules/d3-selection/src/selection/size.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony default export */ __webpack_exports__["a"] = (function() { var size = 0; this.each(function() { ++size; }); return size; }); /***/ }), /***/ "./node_modules/d3-selection/src/selection/sort.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__index__ = __webpack_require__("./node_modules/d3-selection/src/selection/index.js"); /* harmony default export */ __webpack_exports__["a"] = (function(compare) { if (!compare) compare = ascending; function compareNode(a, b) { return a && b ? compare(a.__data__, b.__data__) : !a - !b; } for (var groups = this._groups, m = groups.length, sortgroups = new Array(m), j = 0; j < m; ++j) { for (var group = groups[j], n = group.length, sortgroup = sortgroups[j] = new Array(n), node, i = 0; i < n; ++i) { if (node = group[i]) { sortgroup[i] = node; } } sortgroup.sort(compareNode); } return new __WEBPACK_IMPORTED_MODULE_0__index__["a" /* Selection */](sortgroups, this._parents).order(); }); function ascending(a, b) { return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN; } /***/ }), /***/ "./node_modules/d3-selection/src/selection/sparse.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony default export */ __webpack_exports__["a"] = (function(update) { return new Array(update.length); }); /***/ }), /***/ "./node_modules/d3-selection/src/selection/style.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["b"] = styleValue; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__window__ = __webpack_require__("./node_modules/d3-selection/src/window.js"); function styleRemove(name) { return function() { this.style.removeProperty(name); }; } function styleConstant(name, value, priority) { return function() { this.style.setProperty(name, value, priority); }; } function styleFunction(name, value, priority) { return function() { var v = value.apply(this, arguments); if (v == null) this.style.removeProperty(name); else this.style.setProperty(name, v, priority); }; } /* harmony default export */ __webpack_exports__["a"] = (function(name, value, priority) { return arguments.length > 1 ? this.each((value == null ? styleRemove : typeof value === "function" ? styleFunction : styleConstant)(name, value, priority == null ? "" : priority)) : styleValue(this.node(), name); }); function styleValue(node, name) { return node.style.getPropertyValue(name) || Object(__WEBPACK_IMPORTED_MODULE_0__window__["a" /* default */])(node).getComputedStyle(node, null).getPropertyValue(name); } /***/ }), /***/ "./node_modules/d3-selection/src/selection/text.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; function textRemove() { this.textContent = ""; } function textConstant(value) { return function() { this.textContent = value; }; } function textFunction(value) { return function() { var v = value.apply(this, arguments); this.textContent = v == null ? "" : v; }; } /* harmony default export */ __webpack_exports__["a"] = (function(value) { return arguments.length ? this.each(value == null ? textRemove : (typeof value === "function" ? textFunction : textConstant)(value)) : this.node().textContent; }); /***/ }), /***/ "./node_modules/d3-selection/src/selector.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; function none() {} /* harmony default export */ __webpack_exports__["a"] = (function(selector) { return selector == null ? none : function() { return this.querySelector(selector); }; }); /***/ }), /***/ "./node_modules/d3-selection/src/selectorAll.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; function empty() { return []; } /* harmony default export */ __webpack_exports__["a"] = (function(selector) { return selector == null ? empty : function() { return this.querySelectorAll(selector); }; }); /***/ }), /***/ "./node_modules/d3-selection/src/sourceEvent.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__selection_on__ = __webpack_require__("./node_modules/d3-selection/src/selection/on.js"); /* harmony default export */ __webpack_exports__["a"] = (function() { var current = __WEBPACK_IMPORTED_MODULE_0__selection_on__["c" /* event */], source; while (source = current.sourceEvent) current = source; return current; }); /***/ }), /***/ "./node_modules/d3-selection/src/touch.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__sourceEvent__ = __webpack_require__("./node_modules/d3-selection/src/sourceEvent.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__point__ = __webpack_require__("./node_modules/d3-selection/src/point.js"); /* harmony default export */ __webpack_exports__["a"] = (function(node, touches, identifier) { if (arguments.length < 3) identifier = touches, touches = Object(__WEBPACK_IMPORTED_MODULE_0__sourceEvent__["a" /* default */])().changedTouches; for (var i = 0, n = touches ? touches.length : 0, touch; i < n; ++i) { if ((touch = touches[i]).identifier === identifier) { return Object(__WEBPACK_IMPORTED_MODULE_1__point__["a" /* default */])(node, touch); } } return null; }); /***/ }), /***/ "./node_modules/d3-selection/src/touches.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__sourceEvent__ = __webpack_require__("./node_modules/d3-selection/src/sourceEvent.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__point__ = __webpack_require__("./node_modules/d3-selection/src/point.js"); /* harmony default export */ __webpack_exports__["a"] = (function(node, touches) { if (touches == null) touches = Object(__WEBPACK_IMPORTED_MODULE_0__sourceEvent__["a" /* default */])().touches; for (var i = 0, n = touches ? touches.length : 0, points = new Array(n); i < n; ++i) { points[i] = Object(__WEBPACK_IMPORTED_MODULE_1__point__["a" /* default */])(node, touches[i]); } return points; }); /***/ }), /***/ "./node_modules/d3-selection/src/window.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony default export */ __webpack_exports__["a"] = (function(node) { return (node.ownerDocument && node.ownerDocument.defaultView) // node is a Node || (node.document && node) // node is a Window || node.defaultView; // node is a Document }); /***/ }), /***/ "./node_modules/d3-shape/index.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__src_arc__ = __webpack_require__("./node_modules/d3-shape/src/arc.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "arc", function() { return __WEBPACK_IMPORTED_MODULE_0__src_arc__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__src_area__ = __webpack_require__("./node_modules/d3-shape/src/area.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "area", function() { return __WEBPACK_IMPORTED_MODULE_1__src_area__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__src_line__ = __webpack_require__("./node_modules/d3-shape/src/line.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "line", function() { return __WEBPACK_IMPORTED_MODULE_2__src_line__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__src_pie__ = __webpack_require__("./node_modules/d3-shape/src/pie.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "pie", function() { return __WEBPACK_IMPORTED_MODULE_3__src_pie__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__src_areaRadial__ = __webpack_require__("./node_modules/d3-shape/src/areaRadial.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "areaRadial", function() { return __WEBPACK_IMPORTED_MODULE_4__src_areaRadial__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "radialArea", function() { return __WEBPACK_IMPORTED_MODULE_4__src_areaRadial__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__src_lineRadial__ = __webpack_require__("./node_modules/d3-shape/src/lineRadial.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "lineRadial", function() { return __WEBPACK_IMPORTED_MODULE_5__src_lineRadial__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "radialLine", function() { return __WEBPACK_IMPORTED_MODULE_5__src_lineRadial__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__src_pointRadial__ = __webpack_require__("./node_modules/d3-shape/src/pointRadial.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "pointRadial", function() { return __WEBPACK_IMPORTED_MODULE_6__src_pointRadial__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__src_link_index__ = __webpack_require__("./node_modules/d3-shape/src/link/index.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "linkHorizontal", function() { return __WEBPACK_IMPORTED_MODULE_7__src_link_index__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "linkVertical", function() { return __WEBPACK_IMPORTED_MODULE_7__src_link_index__["c"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "linkRadial", function() { return __WEBPACK_IMPORTED_MODULE_7__src_link_index__["b"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__src_symbol__ = __webpack_require__("./node_modules/d3-shape/src/symbol.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "symbol", function() { return __WEBPACK_IMPORTED_MODULE_8__src_symbol__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "symbols", function() { return __WEBPACK_IMPORTED_MODULE_8__src_symbol__["b"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__src_symbol_circle__ = __webpack_require__("./node_modules/d3-shape/src/symbol/circle.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "symbolCircle", function() { return __WEBPACK_IMPORTED_MODULE_9__src_symbol_circle__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__src_symbol_cross__ = __webpack_require__("./node_modules/d3-shape/src/symbol/cross.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "symbolCross", function() { return __WEBPACK_IMPORTED_MODULE_10__src_symbol_cross__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__src_symbol_diamond__ = __webpack_require__("./node_modules/d3-shape/src/symbol/diamond.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "symbolDiamond", function() { return __WEBPACK_IMPORTED_MODULE_11__src_symbol_diamond__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__src_symbol_square__ = __webpack_require__("./node_modules/d3-shape/src/symbol/square.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "symbolSquare", function() { return __WEBPACK_IMPORTED_MODULE_12__src_symbol_square__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__src_symbol_star__ = __webpack_require__("./node_modules/d3-shape/src/symbol/star.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "symbolStar", function() { return __WEBPACK_IMPORTED_MODULE_13__src_symbol_star__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__src_symbol_triangle__ = __webpack_require__("./node_modules/d3-shape/src/symbol/triangle.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "symbolTriangle", function() { return __WEBPACK_IMPORTED_MODULE_14__src_symbol_triangle__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__src_symbol_wye__ = __webpack_require__("./node_modules/d3-shape/src/symbol/wye.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "symbolWye", function() { return __WEBPACK_IMPORTED_MODULE_15__src_symbol_wye__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__src_curve_basisClosed__ = __webpack_require__("./node_modules/d3-shape/src/curve/basisClosed.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "curveBasisClosed", function() { return __WEBPACK_IMPORTED_MODULE_16__src_curve_basisClosed__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_17__src_curve_basisOpen__ = __webpack_require__("./node_modules/d3-shape/src/curve/basisOpen.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "curveBasisOpen", function() { return __WEBPACK_IMPORTED_MODULE_17__src_curve_basisOpen__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_18__src_curve_basis__ = __webpack_require__("./node_modules/d3-shape/src/curve/basis.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "curveBasis", function() { return __WEBPACK_IMPORTED_MODULE_18__src_curve_basis__["b"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_19__src_curve_bundle__ = __webpack_require__("./node_modules/d3-shape/src/curve/bundle.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "curveBundle", function() { return __WEBPACK_IMPORTED_MODULE_19__src_curve_bundle__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_20__src_curve_cardinalClosed__ = __webpack_require__("./node_modules/d3-shape/src/curve/cardinalClosed.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "curveCardinalClosed", function() { return __WEBPACK_IMPORTED_MODULE_20__src_curve_cardinalClosed__["b"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_21__src_curve_cardinalOpen__ = __webpack_require__("./node_modules/d3-shape/src/curve/cardinalOpen.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "curveCardinalOpen", function() { return __WEBPACK_IMPORTED_MODULE_21__src_curve_cardinalOpen__["b"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_22__src_curve_cardinal__ = __webpack_require__("./node_modules/d3-shape/src/curve/cardinal.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "curveCardinal", function() { return __WEBPACK_IMPORTED_MODULE_22__src_curve_cardinal__["b"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_23__src_curve_catmullRomClosed__ = __webpack_require__("./node_modules/d3-shape/src/curve/catmullRomClosed.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "curveCatmullRomClosed", function() { return __WEBPACK_IMPORTED_MODULE_23__src_curve_catmullRomClosed__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_24__src_curve_catmullRomOpen__ = __webpack_require__("./node_modules/d3-shape/src/curve/catmullRomOpen.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "curveCatmullRomOpen", function() { return __WEBPACK_IMPORTED_MODULE_24__src_curve_catmullRomOpen__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_25__src_curve_catmullRom__ = __webpack_require__("./node_modules/d3-shape/src/curve/catmullRom.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "curveCatmullRom", function() { return __WEBPACK_IMPORTED_MODULE_25__src_curve_catmullRom__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_26__src_curve_linearClosed__ = __webpack_require__("./node_modules/d3-shape/src/curve/linearClosed.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "curveLinearClosed", function() { return __WEBPACK_IMPORTED_MODULE_26__src_curve_linearClosed__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_27__src_curve_linear__ = __webpack_require__("./node_modules/d3-shape/src/curve/linear.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "curveLinear", function() { return __WEBPACK_IMPORTED_MODULE_27__src_curve_linear__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_28__src_curve_monotone__ = __webpack_require__("./node_modules/d3-shape/src/curve/monotone.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "curveMonotoneX", function() { return __WEBPACK_IMPORTED_MODULE_28__src_curve_monotone__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "curveMonotoneY", function() { return __WEBPACK_IMPORTED_MODULE_28__src_curve_monotone__["b"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_29__src_curve_natural__ = __webpack_require__("./node_modules/d3-shape/src/curve/natural.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "curveNatural", function() { return __WEBPACK_IMPORTED_MODULE_29__src_curve_natural__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_30__src_curve_step__ = __webpack_require__("./node_modules/d3-shape/src/curve/step.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "curveStep", function() { return __WEBPACK_IMPORTED_MODULE_30__src_curve_step__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "curveStepAfter", function() { return __WEBPACK_IMPORTED_MODULE_30__src_curve_step__["b"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "curveStepBefore", function() { return __WEBPACK_IMPORTED_MODULE_30__src_curve_step__["c"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_31__src_stack__ = __webpack_require__("./node_modules/d3-shape/src/stack.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "stack", function() { return __WEBPACK_IMPORTED_MODULE_31__src_stack__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_32__src_offset_expand__ = __webpack_require__("./node_modules/d3-shape/src/offset/expand.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "stackOffsetExpand", function() { return __WEBPACK_IMPORTED_MODULE_32__src_offset_expand__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_33__src_offset_diverging__ = __webpack_require__("./node_modules/d3-shape/src/offset/diverging.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "stackOffsetDiverging", function() { return __WEBPACK_IMPORTED_MODULE_33__src_offset_diverging__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_34__src_offset_none__ = __webpack_require__("./node_modules/d3-shape/src/offset/none.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "stackOffsetNone", function() { return __WEBPACK_IMPORTED_MODULE_34__src_offset_none__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_35__src_offset_silhouette__ = __webpack_require__("./node_modules/d3-shape/src/offset/silhouette.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "stackOffsetSilhouette", function() { return __WEBPACK_IMPORTED_MODULE_35__src_offset_silhouette__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_36__src_offset_wiggle__ = __webpack_require__("./node_modules/d3-shape/src/offset/wiggle.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "stackOffsetWiggle", function() { return __WEBPACK_IMPORTED_MODULE_36__src_offset_wiggle__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_37__src_order_ascending__ = __webpack_require__("./node_modules/d3-shape/src/order/ascending.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "stackOrderAscending", function() { return __WEBPACK_IMPORTED_MODULE_37__src_order_ascending__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_38__src_order_descending__ = __webpack_require__("./node_modules/d3-shape/src/order/descending.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "stackOrderDescending", function() { return __WEBPACK_IMPORTED_MODULE_38__src_order_descending__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_39__src_order_insideOut__ = __webpack_require__("./node_modules/d3-shape/src/order/insideOut.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "stackOrderInsideOut", function() { return __WEBPACK_IMPORTED_MODULE_39__src_order_insideOut__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_40__src_order_none__ = __webpack_require__("./node_modules/d3-shape/src/order/none.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "stackOrderNone", function() { return __WEBPACK_IMPORTED_MODULE_40__src_order_none__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_41__src_order_reverse__ = __webpack_require__("./node_modules/d3-shape/src/order/reverse.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "stackOrderReverse", function() { return __WEBPACK_IMPORTED_MODULE_41__src_order_reverse__["a"]; }); // Note: radialArea is deprecated! // Note: radialLine is deprecated! /***/ }), /***/ "./node_modules/d3-shape/src/arc.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_d3_path__ = __webpack_require__("./node_modules/d3-path/index.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__constant__ = __webpack_require__("./node_modules/d3-shape/src/constant.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__math__ = __webpack_require__("./node_modules/d3-shape/src/math.js"); function arcInnerRadius(d) { return d.innerRadius; } function arcOuterRadius(d) { return d.outerRadius; } function arcStartAngle(d) { return d.startAngle; } function arcEndAngle(d) { return d.endAngle; } function arcPadAngle(d) { return d && d.padAngle; // Note: optional! } function intersect(x0, y0, x1, y1, x2, y2, x3, y3) { var x10 = x1 - x0, y10 = y1 - y0, x32 = x3 - x2, y32 = y3 - y2, t = (x32 * (y0 - y2) - y32 * (x0 - x2)) / (y32 * x10 - x32 * y10); return [x0 + t * x10, y0 + t * y10]; } // Compute perpendicular offset line of length rc. // http://mathworld.wolfram.com/Circle-LineIntersection.html function cornerTangents(x0, y0, x1, y1, r1, rc, cw) { var x01 = x0 - x1, y01 = y0 - y1, lo = (cw ? rc : -rc) / Object(__WEBPACK_IMPORTED_MODULE_2__math__["l" /* sqrt */])(x01 * x01 + y01 * y01), ox = lo * y01, oy = -lo * x01, x11 = x0 + ox, y11 = y0 + oy, x10 = x1 + ox, y10 = y1 + oy, x00 = (x11 + x10) / 2, y00 = (y11 + y10) / 2, dx = x10 - x11, dy = y10 - y11, d2 = dx * dx + dy * dy, r = r1 - rc, D = x11 * y10 - x10 * y11, d = (dy < 0 ? -1 : 1) * Object(__WEBPACK_IMPORTED_MODULE_2__math__["l" /* sqrt */])(Object(__WEBPACK_IMPORTED_MODULE_2__math__["h" /* max */])(0, r * r * d2 - D * D)), cx0 = (D * dy - dx * d) / d2, cy0 = (-D * dx - dy * d) / d2, cx1 = (D * dy + dx * d) / d2, cy1 = (-D * dx + dy * d) / d2, dx0 = cx0 - x00, dy0 = cy0 - y00, dx1 = cx1 - x00, dy1 = cy1 - y00; // Pick the closer of the two intersection points. // TODO Is there a faster way to determine which intersection to use? if (dx0 * dx0 + dy0 * dy0 > dx1 * dx1 + dy1 * dy1) cx0 = cx1, cy0 = cy1; return { cx: cx0, cy: cy0, x01: -ox, y01: -oy, x11: cx0 * (r1 / r - 1), y11: cy0 * (r1 / r - 1) }; } /* harmony default export */ __webpack_exports__["a"] = (function() { var innerRadius = arcInnerRadius, outerRadius = arcOuterRadius, cornerRadius = Object(__WEBPACK_IMPORTED_MODULE_1__constant__["a" /* default */])(0), padRadius = null, startAngle = arcStartAngle, endAngle = arcEndAngle, padAngle = arcPadAngle, context = null; function arc() { var buffer, r, r0 = +innerRadius.apply(this, arguments), r1 = +outerRadius.apply(this, arguments), a0 = startAngle.apply(this, arguments) - __WEBPACK_IMPORTED_MODULE_2__math__["g" /* halfPi */], a1 = endAngle.apply(this, arguments) - __WEBPACK_IMPORTED_MODULE_2__math__["g" /* halfPi */], da = Object(__WEBPACK_IMPORTED_MODULE_2__math__["a" /* abs */])(a1 - a0), cw = a1 > a0; if (!context) context = buffer = Object(__WEBPACK_IMPORTED_MODULE_0_d3_path__["a" /* path */])(); // Ensure that the outer radius is always larger than the inner radius. if (r1 < r0) r = r1, r1 = r0, r0 = r; // Is it a point? if (!(r1 > __WEBPACK_IMPORTED_MODULE_2__math__["f" /* epsilon */])) context.moveTo(0, 0); // Or is it a circle or annulus? else if (da > __WEBPACK_IMPORTED_MODULE_2__math__["m" /* tau */] - __WEBPACK_IMPORTED_MODULE_2__math__["f" /* epsilon */]) { context.moveTo(r1 * Object(__WEBPACK_IMPORTED_MODULE_2__math__["e" /* cos */])(a0), r1 * Object(__WEBPACK_IMPORTED_MODULE_2__math__["k" /* sin */])(a0)); context.arc(0, 0, r1, a0, a1, !cw); if (r0 > __WEBPACK_IMPORTED_MODULE_2__math__["f" /* epsilon */]) { context.moveTo(r0 * Object(__WEBPACK_IMPORTED_MODULE_2__math__["e" /* cos */])(a1), r0 * Object(__WEBPACK_IMPORTED_MODULE_2__math__["k" /* sin */])(a1)); context.arc(0, 0, r0, a1, a0, cw); } } // Or is it a circular or annular sector? else { var a01 = a0, a11 = a1, a00 = a0, a10 = a1, da0 = da, da1 = da, ap = padAngle.apply(this, arguments) / 2, rp = (ap > __WEBPACK_IMPORTED_MODULE_2__math__["f" /* epsilon */]) && (padRadius ? +padRadius.apply(this, arguments) : Object(__WEBPACK_IMPORTED_MODULE_2__math__["l" /* sqrt */])(r0 * r0 + r1 * r1)), rc = Object(__WEBPACK_IMPORTED_MODULE_2__math__["i" /* min */])(Object(__WEBPACK_IMPORTED_MODULE_2__math__["a" /* abs */])(r1 - r0) / 2, +cornerRadius.apply(this, arguments)), rc0 = rc, rc1 = rc, t0, t1; // Apply padding? Note that since r1 ≥ r0, da1 ≥ da0. if (rp > __WEBPACK_IMPORTED_MODULE_2__math__["f" /* epsilon */]) { var p0 = Object(__WEBPACK_IMPORTED_MODULE_2__math__["c" /* asin */])(rp / r0 * Object(__WEBPACK_IMPORTED_MODULE_2__math__["k" /* sin */])(ap)), p1 = Object(__WEBPACK_IMPORTED_MODULE_2__math__["c" /* asin */])(rp / r1 * Object(__WEBPACK_IMPORTED_MODULE_2__math__["k" /* sin */])(ap)); if ((da0 -= p0 * 2) > __WEBPACK_IMPORTED_MODULE_2__math__["f" /* epsilon */]) p0 *= (cw ? 1 : -1), a00 += p0, a10 -= p0; else da0 = 0, a00 = a10 = (a0 + a1) / 2; if ((da1 -= p1 * 2) > __WEBPACK_IMPORTED_MODULE_2__math__["f" /* epsilon */]) p1 *= (cw ? 1 : -1), a01 += p1, a11 -= p1; else da1 = 0, a01 = a11 = (a0 + a1) / 2; } var x01 = r1 * Object(__WEBPACK_IMPORTED_MODULE_2__math__["e" /* cos */])(a01), y01 = r1 * Object(__WEBPACK_IMPORTED_MODULE_2__math__["k" /* sin */])(a01), x10 = r0 * Object(__WEBPACK_IMPORTED_MODULE_2__math__["e" /* cos */])(a10), y10 = r0 * Object(__WEBPACK_IMPORTED_MODULE_2__math__["k" /* sin */])(a10); // Apply rounded corners? if (rc > __WEBPACK_IMPORTED_MODULE_2__math__["f" /* epsilon */]) { var x11 = r1 * Object(__WEBPACK_IMPORTED_MODULE_2__math__["e" /* cos */])(a11), y11 = r1 * Object(__WEBPACK_IMPORTED_MODULE_2__math__["k" /* sin */])(a11), x00 = r0 * Object(__WEBPACK_IMPORTED_MODULE_2__math__["e" /* cos */])(a00), y00 = r0 * Object(__WEBPACK_IMPORTED_MODULE_2__math__["k" /* sin */])(a00); // Restrict the corner radius according to the sector angle. if (da < __WEBPACK_IMPORTED_MODULE_2__math__["j" /* pi */]) { var oc = da0 > __WEBPACK_IMPORTED_MODULE_2__math__["f" /* epsilon */] ? intersect(x01, y01, x00, y00, x11, y11, x10, y10) : [x10, y10], ax = x01 - oc[0], ay = y01 - oc[1], bx = x11 - oc[0], by = y11 - oc[1], kc = 1 / Object(__WEBPACK_IMPORTED_MODULE_2__math__["k" /* sin */])(Object(__WEBPACK_IMPORTED_MODULE_2__math__["b" /* acos */])((ax * bx + ay * by) / (Object(__WEBPACK_IMPORTED_MODULE_2__math__["l" /* sqrt */])(ax * ax + ay * ay) * Object(__WEBPACK_IMPORTED_MODULE_2__math__["l" /* sqrt */])(bx * bx + by * by))) / 2), lc = Object(__WEBPACK_IMPORTED_MODULE_2__math__["l" /* sqrt */])(oc[0] * oc[0] + oc[1] * oc[1]); rc0 = Object(__WEBPACK_IMPORTED_MODULE_2__math__["i" /* min */])(rc, (r0 - lc) / (kc - 1)); rc1 = Object(__WEBPACK_IMPORTED_MODULE_2__math__["i" /* min */])(rc, (r1 - lc) / (kc + 1)); } } // Is the sector collapsed to a line? if (!(da1 > __WEBPACK_IMPORTED_MODULE_2__math__["f" /* epsilon */])) context.moveTo(x01, y01); // Does the sector’s outer ring have rounded corners? else if (rc1 > __WEBPACK_IMPORTED_MODULE_2__math__["f" /* epsilon */]) { t0 = cornerTangents(x00, y00, x01, y01, r1, rc1, cw); t1 = cornerTangents(x11, y11, x10, y10, r1, rc1, cw); context.moveTo(t0.cx + t0.x01, t0.cy + t0.y01); // Have the corners merged? if (rc1 < rc) context.arc(t0.cx, t0.cy, rc1, Object(__WEBPACK_IMPORTED_MODULE_2__math__["d" /* atan2 */])(t0.y01, t0.x01), Object(__WEBPACK_IMPORTED_MODULE_2__math__["d" /* atan2 */])(t1.y01, t1.x01), !cw); // Otherwise, draw the two corners and the ring. else { context.arc(t0.cx, t0.cy, rc1, Object(__WEBPACK_IMPORTED_MODULE_2__math__["d" /* atan2 */])(t0.y01, t0.x01), Object(__WEBPACK_IMPORTED_MODULE_2__math__["d" /* atan2 */])(t0.y11, t0.x11), !cw); context.arc(0, 0, r1, Object(__WEBPACK_IMPORTED_MODULE_2__math__["d" /* atan2 */])(t0.cy + t0.y11, t0.cx + t0.x11), Object(__WEBPACK_IMPORTED_MODULE_2__math__["d" /* atan2 */])(t1.cy + t1.y11, t1.cx + t1.x11), !cw); context.arc(t1.cx, t1.cy, rc1, Object(__WEBPACK_IMPORTED_MODULE_2__math__["d" /* atan2 */])(t1.y11, t1.x11), Object(__WEBPACK_IMPORTED_MODULE_2__math__["d" /* atan2 */])(t1.y01, t1.x01), !cw); } } // Or is the outer ring just a circular arc? else context.moveTo(x01, y01), context.arc(0, 0, r1, a01, a11, !cw); // Is there no inner ring, and it’s a circular sector? // Or perhaps it’s an annular sector collapsed due to padding? if (!(r0 > __WEBPACK_IMPORTED_MODULE_2__math__["f" /* epsilon */]) || !(da0 > __WEBPACK_IMPORTED_MODULE_2__math__["f" /* epsilon */])) context.lineTo(x10, y10); // Does the sector’s inner ring (or point) have rounded corners? else if (rc0 > __WEBPACK_IMPORTED_MODULE_2__math__["f" /* epsilon */]) { t0 = cornerTangents(x10, y10, x11, y11, r0, -rc0, cw); t1 = cornerTangents(x01, y01, x00, y00, r0, -rc0, cw); context.lineTo(t0.cx + t0.x01, t0.cy + t0.y01); // Have the corners merged? if (rc0 < rc) context.arc(t0.cx, t0.cy, rc0, Object(__WEBPACK_IMPORTED_MODULE_2__math__["d" /* atan2 */])(t0.y01, t0.x01), Object(__WEBPACK_IMPORTED_MODULE_2__math__["d" /* atan2 */])(t1.y01, t1.x01), !cw); // Otherwise, draw the two corners and the ring. else { context.arc(t0.cx, t0.cy, rc0, Object(__WEBPACK_IMPORTED_MODULE_2__math__["d" /* atan2 */])(t0.y01, t0.x01), Object(__WEBPACK_IMPORTED_MODULE_2__math__["d" /* atan2 */])(t0.y11, t0.x11), !cw); context.arc(0, 0, r0, Object(__WEBPACK_IMPORTED_MODULE_2__math__["d" /* atan2 */])(t0.cy + t0.y11, t0.cx + t0.x11), Object(__WEBPACK_IMPORTED_MODULE_2__math__["d" /* atan2 */])(t1.cy + t1.y11, t1.cx + t1.x11), cw); context.arc(t1.cx, t1.cy, rc0, Object(__WEBPACK_IMPORTED_MODULE_2__math__["d" /* atan2 */])(t1.y11, t1.x11), Object(__WEBPACK_IMPORTED_MODULE_2__math__["d" /* atan2 */])(t1.y01, t1.x01), !cw); } } // Or is the inner ring just a circular arc? else context.arc(0, 0, r0, a10, a00, cw); } context.closePath(); if (buffer) return context = null, buffer + "" || null; } arc.centroid = function() { var r = (+innerRadius.apply(this, arguments) + +outerRadius.apply(this, arguments)) / 2, a = (+startAngle.apply(this, arguments) + +endAngle.apply(this, arguments)) / 2 - __WEBPACK_IMPORTED_MODULE_2__math__["j" /* pi */] / 2; return [Object(__WEBPACK_IMPORTED_MODULE_2__math__["e" /* cos */])(a) * r, Object(__WEBPACK_IMPORTED_MODULE_2__math__["k" /* sin */])(a) * r]; }; arc.innerRadius = function(_) { return arguments.length ? (innerRadius = typeof _ === "function" ? _ : Object(__WEBPACK_IMPORTED_MODULE_1__constant__["a" /* default */])(+_), arc) : innerRadius; }; arc.outerRadius = function(_) { return arguments.length ? (outerRadius = typeof _ === "function" ? _ : Object(__WEBPACK_IMPORTED_MODULE_1__constant__["a" /* default */])(+_), arc) : outerRadius; }; arc.cornerRadius = function(_) { return arguments.length ? (cornerRadius = typeof _ === "function" ? _ : Object(__WEBPACK_IMPORTED_MODULE_1__constant__["a" /* default */])(+_), arc) : cornerRadius; }; arc.padRadius = function(_) { return arguments.length ? (padRadius = _ == null ? null : typeof _ === "function" ? _ : Object(__WEBPACK_IMPORTED_MODULE_1__constant__["a" /* default */])(+_), arc) : padRadius; }; arc.startAngle = function(_) { return arguments.length ? (startAngle = typeof _ === "function" ? _ : Object(__WEBPACK_IMPORTED_MODULE_1__constant__["a" /* default */])(+_), arc) : startAngle; }; arc.endAngle = function(_) { return arguments.length ? (endAngle = typeof _ === "function" ? _ : Object(__WEBPACK_IMPORTED_MODULE_1__constant__["a" /* default */])(+_), arc) : endAngle; }; arc.padAngle = function(_) { return arguments.length ? (padAngle = typeof _ === "function" ? _ : Object(__WEBPACK_IMPORTED_MODULE_1__constant__["a" /* default */])(+_), arc) : padAngle; }; arc.context = function(_) { return arguments.length ? ((context = _ == null ? null : _), arc) : context; }; return arc; }); /***/ }), /***/ "./node_modules/d3-shape/src/area.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_d3_path__ = __webpack_require__("./node_modules/d3-path/index.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__constant__ = __webpack_require__("./node_modules/d3-shape/src/constant.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__curve_linear__ = __webpack_require__("./node_modules/d3-shape/src/curve/linear.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__line__ = __webpack_require__("./node_modules/d3-shape/src/line.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__point__ = __webpack_require__("./node_modules/d3-shape/src/point.js"); /* harmony default export */ __webpack_exports__["a"] = (function() { var x0 = __WEBPACK_IMPORTED_MODULE_4__point__["a" /* x */], x1 = null, y0 = Object(__WEBPACK_IMPORTED_MODULE_1__constant__["a" /* default */])(0), y1 = __WEBPACK_IMPORTED_MODULE_4__point__["b" /* y */], defined = Object(__WEBPACK_IMPORTED_MODULE_1__constant__["a" /* default */])(true), context = null, curve = __WEBPACK_IMPORTED_MODULE_2__curve_linear__["a" /* default */], output = null; function area(data) { var i, j, k, n = data.length, d, defined0 = false, buffer, x0z = new Array(n), y0z = new Array(n); if (context == null) output = curve(buffer = Object(__WEBPACK_IMPORTED_MODULE_0_d3_path__["a" /* path */])()); for (i = 0; i <= n; ++i) { if (!(i < n && defined(d = data[i], i, data)) === defined0) { if (defined0 = !defined0) { j = i; output.areaStart(); output.lineStart(); } else { output.lineEnd(); output.lineStart(); for (k = i - 1; k >= j; --k) { output.point(x0z[k], y0z[k]); } output.lineEnd(); output.areaEnd(); } } if (defined0) { x0z[i] = +x0(d, i, data), y0z[i] = +y0(d, i, data); output.point(x1 ? +x1(d, i, data) : x0z[i], y1 ? +y1(d, i, data) : y0z[i]); } } if (buffer) return output = null, buffer + "" || null; } function arealine() { return Object(__WEBPACK_IMPORTED_MODULE_3__line__["a" /* default */])().defined(defined).curve(curve).context(context); } area.x = function(_) { return arguments.length ? (x0 = typeof _ === "function" ? _ : Object(__WEBPACK_IMPORTED_MODULE_1__constant__["a" /* default */])(+_), x1 = null, area) : x0; }; area.x0 = function(_) { return arguments.length ? (x0 = typeof _ === "function" ? _ : Object(__WEBPACK_IMPORTED_MODULE_1__constant__["a" /* default */])(+_), area) : x0; }; area.x1 = function(_) { return arguments.length ? (x1 = _ == null ? null : typeof _ === "function" ? _ : Object(__WEBPACK_IMPORTED_MODULE_1__constant__["a" /* default */])(+_), area) : x1; }; area.y = function(_) { return arguments.length ? (y0 = typeof _ === "function" ? _ : Object(__WEBPACK_IMPORTED_MODULE_1__constant__["a" /* default */])(+_), y1 = null, area) : y0; }; area.y0 = function(_) { return arguments.length ? (y0 = typeof _ === "function" ? _ : Object(__WEBPACK_IMPORTED_MODULE_1__constant__["a" /* default */])(+_), area) : y0; }; area.y1 = function(_) { return arguments.length ? (y1 = _ == null ? null : typeof _ === "function" ? _ : Object(__WEBPACK_IMPORTED_MODULE_1__constant__["a" /* default */])(+_), area) : y1; }; area.lineX0 = area.lineY0 = function() { return arealine().x(x0).y(y0); }; area.lineY1 = function() { return arealine().x(x0).y(y1); }; area.lineX1 = function() { return arealine().x(x1).y(y0); }; area.defined = function(_) { return arguments.length ? (defined = typeof _ === "function" ? _ : Object(__WEBPACK_IMPORTED_MODULE_1__constant__["a" /* default */])(!!_), area) : defined; }; area.curve = function(_) { return arguments.length ? (curve = _, context != null && (output = curve(context)), area) : curve; }; area.context = function(_) { return arguments.length ? (_ == null ? context = output = null : output = curve(context = _), area) : context; }; return area; }); /***/ }), /***/ "./node_modules/d3-shape/src/areaRadial.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__curve_radial__ = __webpack_require__("./node_modules/d3-shape/src/curve/radial.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__area__ = __webpack_require__("./node_modules/d3-shape/src/area.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__lineRadial__ = __webpack_require__("./node_modules/d3-shape/src/lineRadial.js"); /* harmony default export */ __webpack_exports__["a"] = (function() { var a = Object(__WEBPACK_IMPORTED_MODULE_1__area__["a" /* default */])().curve(__WEBPACK_IMPORTED_MODULE_0__curve_radial__["a" /* curveRadialLinear */]), c = a.curve, x0 = a.lineX0, x1 = a.lineX1, y0 = a.lineY0, y1 = a.lineY1; a.angle = a.x, delete a.x; a.startAngle = a.x0, delete a.x0; a.endAngle = a.x1, delete a.x1; a.radius = a.y, delete a.y; a.innerRadius = a.y0, delete a.y0; a.outerRadius = a.y1, delete a.y1; a.lineStartAngle = function() { return Object(__WEBPACK_IMPORTED_MODULE_2__lineRadial__["b" /* lineRadial */])(x0()); }, delete a.lineX0; a.lineEndAngle = function() { return Object(__WEBPACK_IMPORTED_MODULE_2__lineRadial__["b" /* lineRadial */])(x1()); }, delete a.lineX1; a.lineInnerRadius = function() { return Object(__WEBPACK_IMPORTED_MODULE_2__lineRadial__["b" /* lineRadial */])(y0()); }, delete a.lineY0; a.lineOuterRadius = function() { return Object(__WEBPACK_IMPORTED_MODULE_2__lineRadial__["b" /* lineRadial */])(y1()); }, delete a.lineY1; a.curve = function(_) { return arguments.length ? c(Object(__WEBPACK_IMPORTED_MODULE_0__curve_radial__["b" /* default */])(_)) : c()._curve; }; return a; }); /***/ }), /***/ "./node_modules/d3-shape/src/array.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return slice; }); var slice = Array.prototype.slice; /***/ }), /***/ "./node_modules/d3-shape/src/constant.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony default export */ __webpack_exports__["a"] = (function(x) { return function constant() { return x; }; }); /***/ }), /***/ "./node_modules/d3-shape/src/curve/basis.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["c"] = point; /* harmony export (immutable) */ __webpack_exports__["a"] = Basis; function point(that, x, y) { that._context.bezierCurveTo( (2 * that._x0 + that._x1) / 3, (2 * that._y0 + that._y1) / 3, (that._x0 + 2 * that._x1) / 3, (that._y0 + 2 * that._y1) / 3, (that._x0 + 4 * that._x1 + x) / 6, (that._y0 + 4 * that._y1 + y) / 6 ); } function Basis(context) { this._context = context; } Basis.prototype = { areaStart: function() { this._line = 0; }, areaEnd: function() { this._line = NaN; }, lineStart: function() { this._x0 = this._x1 = this._y0 = this._y1 = NaN; this._point = 0; }, lineEnd: function() { switch (this._point) { case 3: point(this, this._x1, this._y1); // proceed case 2: this._context.lineTo(this._x1, this._y1); break; } if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath(); this._line = 1 - this._line; }, point: function(x, y) { x = +x, y = +y; switch (this._point) { case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break; case 1: this._point = 2; break; case 2: this._point = 3; this._context.lineTo((5 * this._x0 + this._x1) / 6, (5 * this._y0 + this._y1) / 6); // proceed default: point(this, x, y); break; } this._x0 = this._x1, this._x1 = x; this._y0 = this._y1, this._y1 = y; } }; /* harmony default export */ __webpack_exports__["b"] = (function(context) { return new Basis(context); }); /***/ }), /***/ "./node_modules/d3-shape/src/curve/basisClosed.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__noop__ = __webpack_require__("./node_modules/d3-shape/src/noop.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__basis__ = __webpack_require__("./node_modules/d3-shape/src/curve/basis.js"); function BasisClosed(context) { this._context = context; } BasisClosed.prototype = { areaStart: __WEBPACK_IMPORTED_MODULE_0__noop__["a" /* default */], areaEnd: __WEBPACK_IMPORTED_MODULE_0__noop__["a" /* default */], lineStart: function() { this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = NaN; this._point = 0; }, lineEnd: function() { switch (this._point) { case 1: { this._context.moveTo(this._x2, this._y2); this._context.closePath(); break; } case 2: { this._context.moveTo((this._x2 + 2 * this._x3) / 3, (this._y2 + 2 * this._y3) / 3); this._context.lineTo((this._x3 + 2 * this._x2) / 3, (this._y3 + 2 * this._y2) / 3); this._context.closePath(); break; } case 3: { this.point(this._x2, this._y2); this.point(this._x3, this._y3); this.point(this._x4, this._y4); break; } } }, point: function(x, y) { x = +x, y = +y; switch (this._point) { case 0: this._point = 1; this._x2 = x, this._y2 = y; break; case 1: this._point = 2; this._x3 = x, this._y3 = y; break; case 2: this._point = 3; this._x4 = x, this._y4 = y; this._context.moveTo((this._x0 + 4 * this._x1 + x) / 6, (this._y0 + 4 * this._y1 + y) / 6); break; default: Object(__WEBPACK_IMPORTED_MODULE_1__basis__["c" /* point */])(this, x, y); break; } this._x0 = this._x1, this._x1 = x; this._y0 = this._y1, this._y1 = y; } }; /* harmony default export */ __webpack_exports__["a"] = (function(context) { return new BasisClosed(context); }); /***/ }), /***/ "./node_modules/d3-shape/src/curve/basisOpen.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__basis__ = __webpack_require__("./node_modules/d3-shape/src/curve/basis.js"); function BasisOpen(context) { this._context = context; } BasisOpen.prototype = { areaStart: function() { this._line = 0; }, areaEnd: function() { this._line = NaN; }, lineStart: function() { this._x0 = this._x1 = this._y0 = this._y1 = NaN; this._point = 0; }, lineEnd: function() { if (this._line || (this._line !== 0 && this._point === 3)) this._context.closePath(); this._line = 1 - this._line; }, point: function(x, y) { x = +x, y = +y; switch (this._point) { case 0: this._point = 1; break; case 1: this._point = 2; break; case 2: this._point = 3; var x0 = (this._x0 + 4 * this._x1 + x) / 6, y0 = (this._y0 + 4 * this._y1 + y) / 6; this._line ? this._context.lineTo(x0, y0) : this._context.moveTo(x0, y0); break; case 3: this._point = 4; // proceed default: Object(__WEBPACK_IMPORTED_MODULE_0__basis__["c" /* point */])(this, x, y); break; } this._x0 = this._x1, this._x1 = x; this._y0 = this._y1, this._y1 = y; } }; /* harmony default export */ __webpack_exports__["a"] = (function(context) { return new BasisOpen(context); }); /***/ }), /***/ "./node_modules/d3-shape/src/curve/bundle.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__basis__ = __webpack_require__("./node_modules/d3-shape/src/curve/basis.js"); function Bundle(context, beta) { this._basis = new __WEBPACK_IMPORTED_MODULE_0__basis__["a" /* Basis */](context); this._beta = beta; } Bundle.prototype = { lineStart: function() { this._x = []; this._y = []; this._basis.lineStart(); }, lineEnd: function() { var x = this._x, y = this._y, j = x.length - 1; if (j > 0) { var x0 = x[0], y0 = y[0], dx = x[j] - x0, dy = y[j] - y0, i = -1, t; while (++i <= j) { t = i / j; this._basis.point( this._beta * x[i] + (1 - this._beta) * (x0 + t * dx), this._beta * y[i] + (1 - this._beta) * (y0 + t * dy) ); } } this._x = this._y = null; this._basis.lineEnd(); }, point: function(x, y) { this._x.push(+x); this._y.push(+y); } }; /* harmony default export */ __webpack_exports__["a"] = ((function custom(beta) { function bundle(context) { return beta === 1 ? new __WEBPACK_IMPORTED_MODULE_0__basis__["a" /* Basis */](context) : new Bundle(context, beta); } bundle.beta = function(beta) { return custom(+beta); }; return bundle; })(0.85)); /***/ }), /***/ "./node_modules/d3-shape/src/curve/cardinal.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["c"] = point; /* harmony export (immutable) */ __webpack_exports__["a"] = Cardinal; function point(that, x, y) { that._context.bezierCurveTo( that._x1 + that._k * (that._x2 - that._x0), that._y1 + that._k * (that._y2 - that._y0), that._x2 + that._k * (that._x1 - x), that._y2 + that._k * (that._y1 - y), that._x2, that._y2 ); } function Cardinal(context, tension) { this._context = context; this._k = (1 - tension) / 6; } Cardinal.prototype = { areaStart: function() { this._line = 0; }, areaEnd: function() { this._line = NaN; }, lineStart: function() { this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN; this._point = 0; }, lineEnd: function() { switch (this._point) { case 2: this._context.lineTo(this._x2, this._y2); break; case 3: point(this, this._x1, this._y1); break; } if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath(); this._line = 1 - this._line; }, point: function(x, y) { x = +x, y = +y; switch (this._point) { case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break; case 1: this._point = 2; this._x1 = x, this._y1 = y; break; case 2: this._point = 3; // proceed default: point(this, x, y); break; } this._x0 = this._x1, this._x1 = this._x2, this._x2 = x; this._y0 = this._y1, this._y1 = this._y2, this._y2 = y; } }; /* harmony default export */ __webpack_exports__["b"] = ((function custom(tension) { function cardinal(context) { return new Cardinal(context, tension); } cardinal.tension = function(tension) { return custom(+tension); }; return cardinal; })(0)); /***/ }), /***/ "./node_modules/d3-shape/src/curve/cardinalClosed.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = CardinalClosed; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__noop__ = __webpack_require__("./node_modules/d3-shape/src/noop.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__cardinal__ = __webpack_require__("./node_modules/d3-shape/src/curve/cardinal.js"); function CardinalClosed(context, tension) { this._context = context; this._k = (1 - tension) / 6; } CardinalClosed.prototype = { areaStart: __WEBPACK_IMPORTED_MODULE_0__noop__["a" /* default */], areaEnd: __WEBPACK_IMPORTED_MODULE_0__noop__["a" /* default */], lineStart: function() { this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 = this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN; this._point = 0; }, lineEnd: function() { switch (this._point) { case 1: { this._context.moveTo(this._x3, this._y3); this._context.closePath(); break; } case 2: { this._context.lineTo(this._x3, this._y3); this._context.closePath(); break; } case 3: { this.point(this._x3, this._y3); this.point(this._x4, this._y4); this.point(this._x5, this._y5); break; } } }, point: function(x, y) { x = +x, y = +y; switch (this._point) { case 0: this._point = 1; this._x3 = x, this._y3 = y; break; case 1: this._point = 2; this._context.moveTo(this._x4 = x, this._y4 = y); break; case 2: this._point = 3; this._x5 = x, this._y5 = y; break; default: Object(__WEBPACK_IMPORTED_MODULE_1__cardinal__["c" /* point */])(this, x, y); break; } this._x0 = this._x1, this._x1 = this._x2, this._x2 = x; this._y0 = this._y1, this._y1 = this._y2, this._y2 = y; } }; /* harmony default export */ __webpack_exports__["b"] = ((function custom(tension) { function cardinal(context) { return new CardinalClosed(context, tension); } cardinal.tension = function(tension) { return custom(+tension); }; return cardinal; })(0)); /***/ }), /***/ "./node_modules/d3-shape/src/curve/cardinalOpen.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = CardinalOpen; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cardinal__ = __webpack_require__("./node_modules/d3-shape/src/curve/cardinal.js"); function CardinalOpen(context, tension) { this._context = context; this._k = (1 - tension) / 6; } CardinalOpen.prototype = { areaStart: function() { this._line = 0; }, areaEnd: function() { this._line = NaN; }, lineStart: function() { this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN; this._point = 0; }, lineEnd: function() { if (this._line || (this._line !== 0 && this._point === 3)) this._context.closePath(); this._line = 1 - this._line; }, point: function(x, y) { x = +x, y = +y; switch (this._point) { case 0: this._point = 1; break; case 1: this._point = 2; break; case 2: this._point = 3; this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2); break; case 3: this._point = 4; // proceed default: Object(__WEBPACK_IMPORTED_MODULE_0__cardinal__["c" /* point */])(this, x, y); break; } this._x0 = this._x1, this._x1 = this._x2, this._x2 = x; this._y0 = this._y1, this._y1 = this._y2, this._y2 = y; } }; /* harmony default export */ __webpack_exports__["b"] = ((function custom(tension) { function cardinal(context) { return new CardinalOpen(context, tension); } cardinal.tension = function(tension) { return custom(+tension); }; return cardinal; })(0)); /***/ }), /***/ "./node_modules/d3-shape/src/curve/catmullRom.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["b"] = point; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__math__ = __webpack_require__("./node_modules/d3-shape/src/math.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__cardinal__ = __webpack_require__("./node_modules/d3-shape/src/curve/cardinal.js"); function point(that, x, y) { var x1 = that._x1, y1 = that._y1, x2 = that._x2, y2 = that._y2; if (that._l01_a > __WEBPACK_IMPORTED_MODULE_0__math__["f" /* epsilon */]) { var a = 2 * that._l01_2a + 3 * that._l01_a * that._l12_a + that._l12_2a, n = 3 * that._l01_a * (that._l01_a + that._l12_a); x1 = (x1 * a - that._x0 * that._l12_2a + that._x2 * that._l01_2a) / n; y1 = (y1 * a - that._y0 * that._l12_2a + that._y2 * that._l01_2a) / n; } if (that._l23_a > __WEBPACK_IMPORTED_MODULE_0__math__["f" /* epsilon */]) { var b = 2 * that._l23_2a + 3 * that._l23_a * that._l12_a + that._l12_2a, m = 3 * that._l23_a * (that._l23_a + that._l12_a); x2 = (x2 * b + that._x1 * that._l23_2a - x * that._l12_2a) / m; y2 = (y2 * b + that._y1 * that._l23_2a - y * that._l12_2a) / m; } that._context.bezierCurveTo(x1, y1, x2, y2, that._x2, that._y2); } function CatmullRom(context, alpha) { this._context = context; this._alpha = alpha; } CatmullRom.prototype = { areaStart: function() { this._line = 0; }, areaEnd: function() { this._line = NaN; }, lineStart: function() { this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN; this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0; }, lineEnd: function() { switch (this._point) { case 2: this._context.lineTo(this._x2, this._y2); break; case 3: this.point(this._x2, this._y2); break; } if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath(); this._line = 1 - this._line; }, point: function(x, y) { x = +x, y = +y; if (this._point) { var x23 = this._x2 - x, y23 = this._y2 - y; this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha)); } switch (this._point) { case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break; case 1: this._point = 2; break; case 2: this._point = 3; // proceed default: point(this, x, y); break; } this._l01_a = this._l12_a, this._l12_a = this._l23_a; this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a; this._x0 = this._x1, this._x1 = this._x2, this._x2 = x; this._y0 = this._y1, this._y1 = this._y2, this._y2 = y; } }; /* harmony default export */ __webpack_exports__["a"] = ((function custom(alpha) { function catmullRom(context) { return alpha ? new CatmullRom(context, alpha) : new __WEBPACK_IMPORTED_MODULE_1__cardinal__["a" /* Cardinal */](context, 0); } catmullRom.alpha = function(alpha) { return custom(+alpha); }; return catmullRom; })(0.5)); /***/ }), /***/ "./node_modules/d3-shape/src/curve/catmullRomClosed.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cardinalClosed__ = __webpack_require__("./node_modules/d3-shape/src/curve/cardinalClosed.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__noop__ = __webpack_require__("./node_modules/d3-shape/src/noop.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__catmullRom__ = __webpack_require__("./node_modules/d3-shape/src/curve/catmullRom.js"); function CatmullRomClosed(context, alpha) { this._context = context; this._alpha = alpha; } CatmullRomClosed.prototype = { areaStart: __WEBPACK_IMPORTED_MODULE_1__noop__["a" /* default */], areaEnd: __WEBPACK_IMPORTED_MODULE_1__noop__["a" /* default */], lineStart: function() { this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 = this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN; this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0; }, lineEnd: function() { switch (this._point) { case 1: { this._context.moveTo(this._x3, this._y3); this._context.closePath(); break; } case 2: { this._context.lineTo(this._x3, this._y3); this._context.closePath(); break; } case 3: { this.point(this._x3, this._y3); this.point(this._x4, this._y4); this.point(this._x5, this._y5); break; } } }, point: function(x, y) { x = +x, y = +y; if (this._point) { var x23 = this._x2 - x, y23 = this._y2 - y; this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha)); } switch (this._point) { case 0: this._point = 1; this._x3 = x, this._y3 = y; break; case 1: this._point = 2; this._context.moveTo(this._x4 = x, this._y4 = y); break; case 2: this._point = 3; this._x5 = x, this._y5 = y; break; default: Object(__WEBPACK_IMPORTED_MODULE_2__catmullRom__["b" /* point */])(this, x, y); break; } this._l01_a = this._l12_a, this._l12_a = this._l23_a; this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a; this._x0 = this._x1, this._x1 = this._x2, this._x2 = x; this._y0 = this._y1, this._y1 = this._y2, this._y2 = y; } }; /* harmony default export */ __webpack_exports__["a"] = ((function custom(alpha) { function catmullRom(context) { return alpha ? new CatmullRomClosed(context, alpha) : new __WEBPACK_IMPORTED_MODULE_0__cardinalClosed__["a" /* CardinalClosed */](context, 0); } catmullRom.alpha = function(alpha) { return custom(+alpha); }; return catmullRom; })(0.5)); /***/ }), /***/ "./node_modules/d3-shape/src/curve/catmullRomOpen.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cardinalOpen__ = __webpack_require__("./node_modules/d3-shape/src/curve/cardinalOpen.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__catmullRom__ = __webpack_require__("./node_modules/d3-shape/src/curve/catmullRom.js"); function CatmullRomOpen(context, alpha) { this._context = context; this._alpha = alpha; } CatmullRomOpen.prototype = { areaStart: function() { this._line = 0; }, areaEnd: function() { this._line = NaN; }, lineStart: function() { this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN; this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0; }, lineEnd: function() { if (this._line || (this._line !== 0 && this._point === 3)) this._context.closePath(); this._line = 1 - this._line; }, point: function(x, y) { x = +x, y = +y; if (this._point) { var x23 = this._x2 - x, y23 = this._y2 - y; this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha)); } switch (this._point) { case 0: this._point = 1; break; case 1: this._point = 2; break; case 2: this._point = 3; this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2); break; case 3: this._point = 4; // proceed default: Object(__WEBPACK_IMPORTED_MODULE_1__catmullRom__["b" /* point */])(this, x, y); break; } this._l01_a = this._l12_a, this._l12_a = this._l23_a; this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a; this._x0 = this._x1, this._x1 = this._x2, this._x2 = x; this._y0 = this._y1, this._y1 = this._y2, this._y2 = y; } }; /* harmony default export */ __webpack_exports__["a"] = ((function custom(alpha) { function catmullRom(context) { return alpha ? new CatmullRomOpen(context, alpha) : new __WEBPACK_IMPORTED_MODULE_0__cardinalOpen__["a" /* CardinalOpen */](context, 0); } catmullRom.alpha = function(alpha) { return custom(+alpha); }; return catmullRom; })(0.5)); /***/ }), /***/ "./node_modules/d3-shape/src/curve/linear.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; function Linear(context) { this._context = context; } Linear.prototype = { areaStart: function() { this._line = 0; }, areaEnd: function() { this._line = NaN; }, lineStart: function() { this._point = 0; }, lineEnd: function() { if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath(); this._line = 1 - this._line; }, point: function(x, y) { x = +x, y = +y; switch (this._point) { case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break; case 1: this._point = 2; // proceed default: this._context.lineTo(x, y); break; } } }; /* harmony default export */ __webpack_exports__["a"] = (function(context) { return new Linear(context); }); /***/ }), /***/ "./node_modules/d3-shape/src/curve/linearClosed.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__noop__ = __webpack_require__("./node_modules/d3-shape/src/noop.js"); function LinearClosed(context) { this._context = context; } LinearClosed.prototype = { areaStart: __WEBPACK_IMPORTED_MODULE_0__noop__["a" /* default */], areaEnd: __WEBPACK_IMPORTED_MODULE_0__noop__["a" /* default */], lineStart: function() { this._point = 0; }, lineEnd: function() { if (this._point) this._context.closePath(); }, point: function(x, y) { x = +x, y = +y; if (this._point) this._context.lineTo(x, y); else this._point = 1, this._context.moveTo(x, y); } }; /* harmony default export */ __webpack_exports__["a"] = (function(context) { return new LinearClosed(context); }); /***/ }), /***/ "./node_modules/d3-shape/src/curve/monotone.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = monotoneX; /* harmony export (immutable) */ __webpack_exports__["b"] = monotoneY; function sign(x) { return x < 0 ? -1 : 1; } // Calculate the slopes of the tangents (Hermite-type interpolation) based on // the following paper: Steffen, M. 1990. A Simple Method for Monotonic // Interpolation in One Dimension. Astronomy and Astrophysics, Vol. 239, NO. // NOV(II), P. 443, 1990. function slope3(that, x2, y2) { var h0 = that._x1 - that._x0, h1 = x2 - that._x1, s0 = (that._y1 - that._y0) / (h0 || h1 < 0 && -0), s1 = (y2 - that._y1) / (h1 || h0 < 0 && -0), p = (s0 * h1 + s1 * h0) / (h0 + h1); return (sign(s0) + sign(s1)) * Math.min(Math.abs(s0), Math.abs(s1), 0.5 * Math.abs(p)) || 0; } // Calculate a one-sided slope. function slope2(that, t) { var h = that._x1 - that._x0; return h ? (3 * (that._y1 - that._y0) / h - t) / 2 : t; } // According to https://en.wikipedia.org/wiki/Cubic_Hermite_spline#Representations // "you can express cubic Hermite interpolation in terms of cubic Bézier curves // with respect to the four values p0, p0 + m0 / 3, p1 - m1 / 3, p1". function point(that, t0, t1) { var x0 = that._x0, y0 = that._y0, x1 = that._x1, y1 = that._y1, dx = (x1 - x0) / 3; that._context.bezierCurveTo(x0 + dx, y0 + dx * t0, x1 - dx, y1 - dx * t1, x1, y1); } function MonotoneX(context) { this._context = context; } MonotoneX.prototype = { areaStart: function() { this._line = 0; }, areaEnd: function() { this._line = NaN; }, lineStart: function() { this._x0 = this._x1 = this._y0 = this._y1 = this._t0 = NaN; this._point = 0; }, lineEnd: function() { switch (this._point) { case 2: this._context.lineTo(this._x1, this._y1); break; case 3: point(this, this._t0, slope2(this, this._t0)); break; } if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath(); this._line = 1 - this._line; }, point: function(x, y) { var t1 = NaN; x = +x, y = +y; if (x === this._x1 && y === this._y1) return; // Ignore coincident points. switch (this._point) { case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break; case 1: this._point = 2; break; case 2: this._point = 3; point(this, slope2(this, t1 = slope3(this, x, y)), t1); break; default: point(this, this._t0, t1 = slope3(this, x, y)); break; } this._x0 = this._x1, this._x1 = x; this._y0 = this._y1, this._y1 = y; this._t0 = t1; } } function MonotoneY(context) { this._context = new ReflectContext(context); } (MonotoneY.prototype = Object.create(MonotoneX.prototype)).point = function(x, y) { MonotoneX.prototype.point.call(this, y, x); }; function ReflectContext(context) { this._context = context; } ReflectContext.prototype = { moveTo: function(x, y) { this._context.moveTo(y, x); }, closePath: function() { this._context.closePath(); }, lineTo: function(x, y) { this._context.lineTo(y, x); }, bezierCurveTo: function(x1, y1, x2, y2, x, y) { this._context.bezierCurveTo(y1, x1, y2, x2, y, x); } }; function monotoneX(context) { return new MonotoneX(context); } function monotoneY(context) { return new MonotoneY(context); } /***/ }), /***/ "./node_modules/d3-shape/src/curve/natural.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; function Natural(context) { this._context = context; } Natural.prototype = { areaStart: function() { this._line = 0; }, areaEnd: function() { this._line = NaN; }, lineStart: function() { this._x = []; this._y = []; }, lineEnd: function() { var x = this._x, y = this._y, n = x.length; if (n) { this._line ? this._context.lineTo(x[0], y[0]) : this._context.moveTo(x[0], y[0]); if (n === 2) { this._context.lineTo(x[1], y[1]); } else { var px = controlPoints(x), py = controlPoints(y); for (var i0 = 0, i1 = 1; i1 < n; ++i0, ++i1) { this._context.bezierCurveTo(px[0][i0], py[0][i0], px[1][i0], py[1][i0], x[i1], y[i1]); } } } if (this._line || (this._line !== 0 && n === 1)) this._context.closePath(); this._line = 1 - this._line; this._x = this._y = null; }, point: function(x, y) { this._x.push(+x); this._y.push(+y); } }; // See https://www.particleincell.com/2012/bezier-splines/ for derivation. function controlPoints(x) { var i, n = x.length - 1, m, a = new Array(n), b = new Array(n), r = new Array(n); a[0] = 0, b[0] = 2, r[0] = x[0] + 2 * x[1]; for (i = 1; i < n - 1; ++i) a[i] = 1, b[i] = 4, r[i] = 4 * x[i] + 2 * x[i + 1]; a[n - 1] = 2, b[n - 1] = 7, r[n - 1] = 8 * x[n - 1] + x[n]; for (i = 1; i < n; ++i) m = a[i] / b[i - 1], b[i] -= m, r[i] -= m * r[i - 1]; a[n - 1] = r[n - 1] / b[n - 1]; for (i = n - 2; i >= 0; --i) a[i] = (r[i] - a[i + 1]) / b[i]; b[n - 1] = (x[n] + a[n - 1]) / 2; for (i = 0; i < n - 1; ++i) b[i] = 2 * x[i + 1] - a[i + 1]; return [a, b]; } /* harmony default export */ __webpack_exports__["a"] = (function(context) { return new Natural(context); }); /***/ }), /***/ "./node_modules/d3-shape/src/curve/radial.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return curveRadialLinear; }); /* harmony export (immutable) */ __webpack_exports__["b"] = curveRadial; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__linear__ = __webpack_require__("./node_modules/d3-shape/src/curve/linear.js"); var curveRadialLinear = curveRadial(__WEBPACK_IMPORTED_MODULE_0__linear__["a" /* default */]); function Radial(curve) { this._curve = curve; } Radial.prototype = { areaStart: function() { this._curve.areaStart(); }, areaEnd: function() { this._curve.areaEnd(); }, lineStart: function() { this._curve.lineStart(); }, lineEnd: function() { this._curve.lineEnd(); }, point: function(a, r) { this._curve.point(r * Math.sin(a), r * -Math.cos(a)); } }; function curveRadial(curve) { function radial(context) { return new Radial(curve(context)); } radial._curve = curve; return radial; } /***/ }), /***/ "./node_modules/d3-shape/src/curve/step.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["c"] = stepBefore; /* harmony export (immutable) */ __webpack_exports__["b"] = stepAfter; function Step(context, t) { this._context = context; this._t = t; } Step.prototype = { areaStart: function() { this._line = 0; }, areaEnd: function() { this._line = NaN; }, lineStart: function() { this._x = this._y = NaN; this._point = 0; }, lineEnd: function() { if (0 < this._t && this._t < 1 && this._point === 2) this._context.lineTo(this._x, this._y); if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath(); if (this._line >= 0) this._t = 1 - this._t, this._line = 1 - this._line; }, point: function(x, y) { x = +x, y = +y; switch (this._point) { case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break; case 1: this._point = 2; // proceed default: { if (this._t <= 0) { this._context.lineTo(this._x, y); this._context.lineTo(x, y); } else { var x1 = this._x * (1 - this._t) + x * this._t; this._context.lineTo(x1, this._y); this._context.lineTo(x1, y); } break; } } this._x = x, this._y = y; } }; /* harmony default export */ __webpack_exports__["a"] = (function(context) { return new Step(context, 0.5); }); function stepBefore(context) { return new Step(context, 0); } function stepAfter(context) { return new Step(context, 1); } /***/ }), /***/ "./node_modules/d3-shape/src/descending.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony default export */ __webpack_exports__["a"] = (function(a, b) { return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN; }); /***/ }), /***/ "./node_modules/d3-shape/src/identity.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony default export */ __webpack_exports__["a"] = (function(d) { return d; }); /***/ }), /***/ "./node_modules/d3-shape/src/line.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_d3_path__ = __webpack_require__("./node_modules/d3-path/index.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__constant__ = __webpack_require__("./node_modules/d3-shape/src/constant.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__curve_linear__ = __webpack_require__("./node_modules/d3-shape/src/curve/linear.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__point__ = __webpack_require__("./node_modules/d3-shape/src/point.js"); /* harmony default export */ __webpack_exports__["a"] = (function() { var x = __WEBPACK_IMPORTED_MODULE_3__point__["a" /* x */], y = __WEBPACK_IMPORTED_MODULE_3__point__["b" /* y */], defined = Object(__WEBPACK_IMPORTED_MODULE_1__constant__["a" /* default */])(true), context = null, curve = __WEBPACK_IMPORTED_MODULE_2__curve_linear__["a" /* default */], output = null; function line(data) { var i, n = data.length, d, defined0 = false, buffer; if (context == null) output = curve(buffer = Object(__WEBPACK_IMPORTED_MODULE_0_d3_path__["a" /* path */])()); for (i = 0; i <= n; ++i) { if (!(i < n && defined(d = data[i], i, data)) === defined0) { if (defined0 = !defined0) output.lineStart(); else output.lineEnd(); } if (defined0) output.point(+x(d, i, data), +y(d, i, data)); } if (buffer) return output = null, buffer + "" || null; } line.x = function(_) { return arguments.length ? (x = typeof _ === "function" ? _ : Object(__WEBPACK_IMPORTED_MODULE_1__constant__["a" /* default */])(+_), line) : x; }; line.y = function(_) { return arguments.length ? (y = typeof _ === "function" ? _ : Object(__WEBPACK_IMPORTED_MODULE_1__constant__["a" /* default */])(+_), line) : y; }; line.defined = function(_) { return arguments.length ? (defined = typeof _ === "function" ? _ : Object(__WEBPACK_IMPORTED_MODULE_1__constant__["a" /* default */])(!!_), line) : defined; }; line.curve = function(_) { return arguments.length ? (curve = _, context != null && (output = curve(context)), line) : curve; }; line.context = function(_) { return arguments.length ? (_ == null ? context = output = null : output = curve(context = _), line) : context; }; return line; }); /***/ }), /***/ "./node_modules/d3-shape/src/lineRadial.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["b"] = lineRadial; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__curve_radial__ = __webpack_require__("./node_modules/d3-shape/src/curve/radial.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__line__ = __webpack_require__("./node_modules/d3-shape/src/line.js"); function lineRadial(l) { var c = l.curve; l.angle = l.x, delete l.x; l.radius = l.y, delete l.y; l.curve = function(_) { return arguments.length ? c(Object(__WEBPACK_IMPORTED_MODULE_0__curve_radial__["b" /* default */])(_)) : c()._curve; }; return l; } /* harmony default export */ __webpack_exports__["a"] = (function() { return lineRadial(Object(__WEBPACK_IMPORTED_MODULE_1__line__["a" /* default */])().curve(__WEBPACK_IMPORTED_MODULE_0__curve_radial__["a" /* curveRadialLinear */])); }); /***/ }), /***/ "./node_modules/d3-shape/src/link/index.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = linkHorizontal; /* harmony export (immutable) */ __webpack_exports__["c"] = linkVertical; /* harmony export (immutable) */ __webpack_exports__["b"] = linkRadial; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_d3_path__ = __webpack_require__("./node_modules/d3-path/index.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__array__ = __webpack_require__("./node_modules/d3-shape/src/array.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__constant__ = __webpack_require__("./node_modules/d3-shape/src/constant.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__point__ = __webpack_require__("./node_modules/d3-shape/src/point.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__pointRadial__ = __webpack_require__("./node_modules/d3-shape/src/pointRadial.js"); function linkSource(d) { return d.source; } function linkTarget(d) { return d.target; } function link(curve) { var source = linkSource, target = linkTarget, x = __WEBPACK_IMPORTED_MODULE_3__point__["a" /* x */], y = __WEBPACK_IMPORTED_MODULE_3__point__["b" /* y */], context = null; function link() { var buffer, argv = __WEBPACK_IMPORTED_MODULE_1__array__["a" /* slice */].call(arguments), s = source.apply(this, argv), t = target.apply(this, argv); if (!context) context = buffer = Object(__WEBPACK_IMPORTED_MODULE_0_d3_path__["a" /* path */])(); curve(context, +x.apply(this, (argv[0] = s, argv)), +y.apply(this, argv), +x.apply(this, (argv[0] = t, argv)), +y.apply(this, argv)); if (buffer) return context = null, buffer + "" || null; } link.source = function(_) { return arguments.length ? (source = _, link) : source; }; link.target = function(_) { return arguments.length ? (target = _, link) : target; }; link.x = function(_) { return arguments.length ? (x = typeof _ === "function" ? _ : Object(__WEBPACK_IMPORTED_MODULE_2__constant__["a" /* default */])(+_), link) : x; }; link.y = function(_) { return arguments.length ? (y = typeof _ === "function" ? _ : Object(__WEBPACK_IMPORTED_MODULE_2__constant__["a" /* default */])(+_), link) : y; }; link.context = function(_) { return arguments.length ? ((context = _ == null ? null : _), link) : context; }; return link; } function curveHorizontal(context, x0, y0, x1, y1) { context.moveTo(x0, y0); context.bezierCurveTo(x0 = (x0 + x1) / 2, y0, x0, y1, x1, y1); } function curveVertical(context, x0, y0, x1, y1) { context.moveTo(x0, y0); context.bezierCurveTo(x0, y0 = (y0 + y1) / 2, x1, y0, x1, y1); } function curveRadial(context, x0, y0, x1, y1) { var p0 = Object(__WEBPACK_IMPORTED_MODULE_4__pointRadial__["a" /* default */])(x0, y0), p1 = Object(__WEBPACK_IMPORTED_MODULE_4__pointRadial__["a" /* default */])(x0, y0 = (y0 + y1) / 2), p2 = Object(__WEBPACK_IMPORTED_MODULE_4__pointRadial__["a" /* default */])(x1, y0), p3 = Object(__WEBPACK_IMPORTED_MODULE_4__pointRadial__["a" /* default */])(x1, y1); context.moveTo(p0[0], p0[1]); context.bezierCurveTo(p1[0], p1[1], p2[0], p2[1], p3[0], p3[1]); } function linkHorizontal() { return link(curveHorizontal); } function linkVertical() { return link(curveVertical); } function linkRadial() { var l = link(curveRadial); l.angle = l.x, delete l.x; l.radius = l.y, delete l.y; return l; } /***/ }), /***/ "./node_modules/d3-shape/src/math.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return abs; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return atan2; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return cos; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return max; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return min; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return sin; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "l", function() { return sqrt; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return epsilon; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return pi; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return halfPi; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "m", function() { return tau; }); /* harmony export (immutable) */ __webpack_exports__["b"] = acos; /* harmony export (immutable) */ __webpack_exports__["c"] = asin; var abs = Math.abs; var atan2 = Math.atan2; var cos = Math.cos; var max = Math.max; var min = Math.min; var sin = Math.sin; var sqrt = Math.sqrt; var epsilon = 1e-12; var pi = Math.PI; var halfPi = pi / 2; var tau = 2 * pi; function acos(x) { return x > 1 ? 0 : x < -1 ? pi : Math.acos(x); } function asin(x) { return x >= 1 ? halfPi : x <= -1 ? -halfPi : Math.asin(x); } /***/ }), /***/ "./node_modules/d3-shape/src/noop.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony default export */ __webpack_exports__["a"] = (function() {}); /***/ }), /***/ "./node_modules/d3-shape/src/offset/diverging.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony default export */ __webpack_exports__["a"] = (function(series, order) { if (!((n = series.length) > 1)) return; for (var i, j = 0, d, dy, yp, yn, n, m = series[order[0]].length; j < m; ++j) { for (yp = yn = 0, i = 0; i < n; ++i) { if ((dy = (d = series[order[i]][j])[1] - d[0]) >= 0) { d[0] = yp, d[1] = yp += dy; } else if (dy < 0) { d[1] = yn, d[0] = yn += dy; } else { d[0] = yp; } } } }); /***/ }), /***/ "./node_modules/d3-shape/src/offset/expand.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__none__ = __webpack_require__("./node_modules/d3-shape/src/offset/none.js"); /* harmony default export */ __webpack_exports__["a"] = (function(series, order) { if (!((n = series.length) > 0)) return; for (var i, n, j = 0, m = series[0].length, y; j < m; ++j) { for (y = i = 0; i < n; ++i) y += series[i][j][1] || 0; if (y) for (i = 0; i < n; ++i) series[i][j][1] /= y; } Object(__WEBPACK_IMPORTED_MODULE_0__none__["a" /* default */])(series, order); }); /***/ }), /***/ "./node_modules/d3-shape/src/offset/none.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony default export */ __webpack_exports__["a"] = (function(series, order) { if (!((n = series.length) > 1)) return; for (var i = 1, j, s0, s1 = series[order[0]], n, m = s1.length; i < n; ++i) { s0 = s1, s1 = series[order[i]]; for (j = 0; j < m; ++j) { s1[j][1] += s1[j][0] = isNaN(s0[j][1]) ? s0[j][0] : s0[j][1]; } } }); /***/ }), /***/ "./node_modules/d3-shape/src/offset/silhouette.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__none__ = __webpack_require__("./node_modules/d3-shape/src/offset/none.js"); /* harmony default export */ __webpack_exports__["a"] = (function(series, order) { if (!((n = series.length) > 0)) return; for (var j = 0, s0 = series[order[0]], n, m = s0.length; j < m; ++j) { for (var i = 0, y = 0; i < n; ++i) y += series[i][j][1] || 0; s0[j][1] += s0[j][0] = -y / 2; } Object(__WEBPACK_IMPORTED_MODULE_0__none__["a" /* default */])(series, order); }); /***/ }), /***/ "./node_modules/d3-shape/src/offset/wiggle.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__none__ = __webpack_require__("./node_modules/d3-shape/src/offset/none.js"); /* harmony default export */ __webpack_exports__["a"] = (function(series, order) { if (!((n = series.length) > 0) || !((m = (s0 = series[order[0]]).length) > 0)) return; for (var y = 0, j = 1, s0, m, n; j < m; ++j) { for (var i = 0, s1 = 0, s2 = 0; i < n; ++i) { var si = series[order[i]], sij0 = si[j][1] || 0, sij1 = si[j - 1][1] || 0, s3 = (sij0 - sij1) / 2; for (var k = 0; k < i; ++k) { var sk = series[order[k]], skj0 = sk[j][1] || 0, skj1 = sk[j - 1][1] || 0; s3 += skj0 - skj1; } s1 += sij0, s2 += s3 * sij0; } s0[j - 1][1] += s0[j - 1][0] = y; if (s1) y -= s2 / s1; } s0[j - 1][1] += s0[j - 1][0] = y; Object(__WEBPACK_IMPORTED_MODULE_0__none__["a" /* default */])(series, order); }); /***/ }), /***/ "./node_modules/d3-shape/src/order/ascending.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["b"] = sum; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__none__ = __webpack_require__("./node_modules/d3-shape/src/order/none.js"); /* harmony default export */ __webpack_exports__["a"] = (function(series) { var sums = series.map(sum); return Object(__WEBPACK_IMPORTED_MODULE_0__none__["a" /* default */])(series).sort(function(a, b) { return sums[a] - sums[b]; }); }); function sum(series) { var s = 0, i = -1, n = series.length, v; while (++i < n) if (v = +series[i][1]) s += v; return s; } /***/ }), /***/ "./node_modules/d3-shape/src/order/descending.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__ascending__ = __webpack_require__("./node_modules/d3-shape/src/order/ascending.js"); /* harmony default export */ __webpack_exports__["a"] = (function(series) { return Object(__WEBPACK_IMPORTED_MODULE_0__ascending__["a" /* default */])(series).reverse(); }); /***/ }), /***/ "./node_modules/d3-shape/src/order/insideOut.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__none__ = __webpack_require__("./node_modules/d3-shape/src/order/none.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__ascending__ = __webpack_require__("./node_modules/d3-shape/src/order/ascending.js"); /* harmony default export */ __webpack_exports__["a"] = (function(series) { var n = series.length, i, j, sums = series.map(__WEBPACK_IMPORTED_MODULE_1__ascending__["b" /* sum */]), order = Object(__WEBPACK_IMPORTED_MODULE_0__none__["a" /* default */])(series).sort(function(a, b) { return sums[b] - sums[a]; }), top = 0, bottom = 0, tops = [], bottoms = []; for (i = 0; i < n; ++i) { j = order[i]; if (top < bottom) { top += sums[j]; tops.push(j); } else { bottom += sums[j]; bottoms.push(j); } } return bottoms.reverse().concat(tops); }); /***/ }), /***/ "./node_modules/d3-shape/src/order/none.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony default export */ __webpack_exports__["a"] = (function(series) { var n = series.length, o = new Array(n); while (--n >= 0) o[n] = n; return o; }); /***/ }), /***/ "./node_modules/d3-shape/src/order/reverse.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__none__ = __webpack_require__("./node_modules/d3-shape/src/order/none.js"); /* harmony default export */ __webpack_exports__["a"] = (function(series) { return Object(__WEBPACK_IMPORTED_MODULE_0__none__["a" /* default */])(series).reverse(); }); /***/ }), /***/ "./node_modules/d3-shape/src/pie.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__constant__ = __webpack_require__("./node_modules/d3-shape/src/constant.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__descending__ = __webpack_require__("./node_modules/d3-shape/src/descending.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__identity__ = __webpack_require__("./node_modules/d3-shape/src/identity.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__math__ = __webpack_require__("./node_modules/d3-shape/src/math.js"); /* harmony default export */ __webpack_exports__["a"] = (function() { var value = __WEBPACK_IMPORTED_MODULE_2__identity__["a" /* default */], sortValues = __WEBPACK_IMPORTED_MODULE_1__descending__["a" /* default */], sort = null, startAngle = Object(__WEBPACK_IMPORTED_MODULE_0__constant__["a" /* default */])(0), endAngle = Object(__WEBPACK_IMPORTED_MODULE_0__constant__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_3__math__["m" /* tau */]), padAngle = Object(__WEBPACK_IMPORTED_MODULE_0__constant__["a" /* default */])(0); function pie(data) { var i, n = data.length, j, k, sum = 0, index = new Array(n), arcs = new Array(n), a0 = +startAngle.apply(this, arguments), da = Math.min(__WEBPACK_IMPORTED_MODULE_3__math__["m" /* tau */], Math.max(-__WEBPACK_IMPORTED_MODULE_3__math__["m" /* tau */], endAngle.apply(this, arguments) - a0)), a1, p = Math.min(Math.abs(da) / n, padAngle.apply(this, arguments)), pa = p * (da < 0 ? -1 : 1), v; for (i = 0; i < n; ++i) { if ((v = arcs[index[i] = i] = +value(data[i], i, data)) > 0) { sum += v; } } // Optionally sort the arcs by previously-computed values or by data. if (sortValues != null) index.sort(function(i, j) { return sortValues(arcs[i], arcs[j]); }); else if (sort != null) index.sort(function(i, j) { return sort(data[i], data[j]); }); // Compute the arcs! They are stored in the original data's order. for (i = 0, k = sum ? (da - n * pa) / sum : 0; i < n; ++i, a0 = a1) { j = index[i], v = arcs[j], a1 = a0 + (v > 0 ? v * k : 0) + pa, arcs[j] = { data: data[j], index: i, value: v, startAngle: a0, endAngle: a1, padAngle: p }; } return arcs; } pie.value = function(_) { return arguments.length ? (value = typeof _ === "function" ? _ : Object(__WEBPACK_IMPORTED_MODULE_0__constant__["a" /* default */])(+_), pie) : value; }; pie.sortValues = function(_) { return arguments.length ? (sortValues = _, sort = null, pie) : sortValues; }; pie.sort = function(_) { return arguments.length ? (sort = _, sortValues = null, pie) : sort; }; pie.startAngle = function(_) { return arguments.length ? (startAngle = typeof _ === "function" ? _ : Object(__WEBPACK_IMPORTED_MODULE_0__constant__["a" /* default */])(+_), pie) : startAngle; }; pie.endAngle = function(_) { return arguments.length ? (endAngle = typeof _ === "function" ? _ : Object(__WEBPACK_IMPORTED_MODULE_0__constant__["a" /* default */])(+_), pie) : endAngle; }; pie.padAngle = function(_) { return arguments.length ? (padAngle = typeof _ === "function" ? _ : Object(__WEBPACK_IMPORTED_MODULE_0__constant__["a" /* default */])(+_), pie) : padAngle; }; return pie; }); /***/ }), /***/ "./node_modules/d3-shape/src/point.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = x; /* harmony export (immutable) */ __webpack_exports__["b"] = y; function x(p) { return p[0]; } function y(p) { return p[1]; } /***/ }), /***/ "./node_modules/d3-shape/src/pointRadial.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony default export */ __webpack_exports__["a"] = (function(x, y) { return [(y = +y) * Math.cos(x -= Math.PI / 2), y * Math.sin(x)]; }); /***/ }), /***/ "./node_modules/d3-shape/src/stack.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__array__ = __webpack_require__("./node_modules/d3-shape/src/array.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__constant__ = __webpack_require__("./node_modules/d3-shape/src/constant.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__offset_none__ = __webpack_require__("./node_modules/d3-shape/src/offset/none.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__order_none__ = __webpack_require__("./node_modules/d3-shape/src/order/none.js"); function stackValue(d, key) { return d[key]; } /* harmony default export */ __webpack_exports__["a"] = (function() { var keys = Object(__WEBPACK_IMPORTED_MODULE_1__constant__["a" /* default */])([]), order = __WEBPACK_IMPORTED_MODULE_3__order_none__["a" /* default */], offset = __WEBPACK_IMPORTED_MODULE_2__offset_none__["a" /* default */], value = stackValue; function stack(data) { var kz = keys.apply(this, arguments), i, m = data.length, n = kz.length, sz = new Array(n), oz; for (i = 0; i < n; ++i) { for (var ki = kz[i], si = sz[i] = new Array(m), j = 0, sij; j < m; ++j) { si[j] = sij = [0, +value(data[j], ki, j, data)]; sij.data = data[j]; } si.key = ki; } for (i = 0, oz = order(sz); i < n; ++i) { sz[oz[i]].index = i; } offset(sz, oz); return sz; } stack.keys = function(_) { return arguments.length ? (keys = typeof _ === "function" ? _ : Object(__WEBPACK_IMPORTED_MODULE_1__constant__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_0__array__["a" /* slice */].call(_)), stack) : keys; }; stack.value = function(_) { return arguments.length ? (value = typeof _ === "function" ? _ : Object(__WEBPACK_IMPORTED_MODULE_1__constant__["a" /* default */])(+_), stack) : value; }; stack.order = function(_) { return arguments.length ? (order = _ == null ? __WEBPACK_IMPORTED_MODULE_3__order_none__["a" /* default */] : typeof _ === "function" ? _ : Object(__WEBPACK_IMPORTED_MODULE_1__constant__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_0__array__["a" /* slice */].call(_)), stack) : order; }; stack.offset = function(_) { return arguments.length ? (offset = _ == null ? __WEBPACK_IMPORTED_MODULE_2__offset_none__["a" /* default */] : _, stack) : offset; }; return stack; }); /***/ }), /***/ "./node_modules/d3-shape/src/symbol.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return symbols; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_d3_path__ = __webpack_require__("./node_modules/d3-path/index.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__symbol_circle__ = __webpack_require__("./node_modules/d3-shape/src/symbol/circle.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__symbol_cross__ = __webpack_require__("./node_modules/d3-shape/src/symbol/cross.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__symbol_diamond__ = __webpack_require__("./node_modules/d3-shape/src/symbol/diamond.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__symbol_star__ = __webpack_require__("./node_modules/d3-shape/src/symbol/star.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__symbol_square__ = __webpack_require__("./node_modules/d3-shape/src/symbol/square.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__symbol_triangle__ = __webpack_require__("./node_modules/d3-shape/src/symbol/triangle.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__symbol_wye__ = __webpack_require__("./node_modules/d3-shape/src/symbol/wye.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__constant__ = __webpack_require__("./node_modules/d3-shape/src/constant.js"); var symbols = [ __WEBPACK_IMPORTED_MODULE_1__symbol_circle__["a" /* default */], __WEBPACK_IMPORTED_MODULE_2__symbol_cross__["a" /* default */], __WEBPACK_IMPORTED_MODULE_3__symbol_diamond__["a" /* default */], __WEBPACK_IMPORTED_MODULE_5__symbol_square__["a" /* default */], __WEBPACK_IMPORTED_MODULE_4__symbol_star__["a" /* default */], __WEBPACK_IMPORTED_MODULE_6__symbol_triangle__["a" /* default */], __WEBPACK_IMPORTED_MODULE_7__symbol_wye__["a" /* default */] ]; /* harmony default export */ __webpack_exports__["a"] = (function() { var type = Object(__WEBPACK_IMPORTED_MODULE_8__constant__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__symbol_circle__["a" /* default */]), size = Object(__WEBPACK_IMPORTED_MODULE_8__constant__["a" /* default */])(64), context = null; function symbol() { var buffer; if (!context) context = buffer = Object(__WEBPACK_IMPORTED_MODULE_0_d3_path__["a" /* path */])(); type.apply(this, arguments).draw(context, +size.apply(this, arguments)); if (buffer) return context = null, buffer + "" || null; } symbol.type = function(_) { return arguments.length ? (type = typeof _ === "function" ? _ : Object(__WEBPACK_IMPORTED_MODULE_8__constant__["a" /* default */])(_), symbol) : type; }; symbol.size = function(_) { return arguments.length ? (size = typeof _ === "function" ? _ : Object(__WEBPACK_IMPORTED_MODULE_8__constant__["a" /* default */])(+_), symbol) : size; }; symbol.context = function(_) { return arguments.length ? (context = _ == null ? null : _, symbol) : context; }; return symbol; }); /***/ }), /***/ "./node_modules/d3-shape/src/symbol/circle.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__math__ = __webpack_require__("./node_modules/d3-shape/src/math.js"); /* harmony default export */ __webpack_exports__["a"] = ({ draw: function(context, size) { var r = Math.sqrt(size / __WEBPACK_IMPORTED_MODULE_0__math__["j" /* pi */]); context.moveTo(r, 0); context.arc(0, 0, r, 0, __WEBPACK_IMPORTED_MODULE_0__math__["m" /* tau */]); } }); /***/ }), /***/ "./node_modules/d3-shape/src/symbol/cross.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony default export */ __webpack_exports__["a"] = ({ draw: function(context, size) { var r = Math.sqrt(size / 5) / 2; context.moveTo(-3 * r, -r); context.lineTo(-r, -r); context.lineTo(-r, -3 * r); context.lineTo(r, -3 * r); context.lineTo(r, -r); context.lineTo(3 * r, -r); context.lineTo(3 * r, r); context.lineTo(r, r); context.lineTo(r, 3 * r); context.lineTo(-r, 3 * r); context.lineTo(-r, r); context.lineTo(-3 * r, r); context.closePath(); } }); /***/ }), /***/ "./node_modules/d3-shape/src/symbol/diamond.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; var tan30 = Math.sqrt(1 / 3), tan30_2 = tan30 * 2; /* harmony default export */ __webpack_exports__["a"] = ({ draw: function(context, size) { var y = Math.sqrt(size / tan30_2), x = y * tan30; context.moveTo(0, -y); context.lineTo(x, 0); context.lineTo(0, y); context.lineTo(-x, 0); context.closePath(); } }); /***/ }), /***/ "./node_modules/d3-shape/src/symbol/square.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony default export */ __webpack_exports__["a"] = ({ draw: function(context, size) { var w = Math.sqrt(size), x = -w / 2; context.rect(x, x, w, w); } }); /***/ }), /***/ "./node_modules/d3-shape/src/symbol/star.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__math__ = __webpack_require__("./node_modules/d3-shape/src/math.js"); var ka = 0.89081309152928522810, kr = Math.sin(__WEBPACK_IMPORTED_MODULE_0__math__["j" /* pi */] / 10) / Math.sin(7 * __WEBPACK_IMPORTED_MODULE_0__math__["j" /* pi */] / 10), kx = Math.sin(__WEBPACK_IMPORTED_MODULE_0__math__["m" /* tau */] / 10) * kr, ky = -Math.cos(__WEBPACK_IMPORTED_MODULE_0__math__["m" /* tau */] / 10) * kr; /* harmony default export */ __webpack_exports__["a"] = ({ draw: function(context, size) { var r = Math.sqrt(size * ka), x = kx * r, y = ky * r; context.moveTo(0, -r); context.lineTo(x, y); for (var i = 1; i < 5; ++i) { var a = __WEBPACK_IMPORTED_MODULE_0__math__["m" /* tau */] * i / 5, c = Math.cos(a), s = Math.sin(a); context.lineTo(s * r, -c * r); context.lineTo(c * x - s * y, s * x + c * y); } context.closePath(); } }); /***/ }), /***/ "./node_modules/d3-shape/src/symbol/triangle.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; var sqrt3 = Math.sqrt(3); /* harmony default export */ __webpack_exports__["a"] = ({ draw: function(context, size) { var y = -Math.sqrt(size / (sqrt3 * 3)); context.moveTo(0, y * 2); context.lineTo(-sqrt3 * y, -y); context.lineTo(sqrt3 * y, -y); context.closePath(); } }); /***/ }), /***/ "./node_modules/d3-shape/src/symbol/wye.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; var c = -0.5, s = Math.sqrt(3) / 2, k = 1 / Math.sqrt(12), a = (k / 2 + 1) * 3; /* harmony default export */ __webpack_exports__["a"] = ({ draw: function(context, size) { var r = Math.sqrt(size / a), x0 = r / 2, y0 = r * k, x1 = x0, y1 = r * k + r, x2 = -x1, y2 = y1; context.moveTo(x0, y0); context.lineTo(x1, y1); context.lineTo(x2, y2); context.lineTo(c * x0 - s * y0, s * x0 + c * y0); context.lineTo(c * x1 - s * y1, s * x1 + c * y1); context.lineTo(c * x2 - s * y2, s * x2 + c * y2); context.lineTo(c * x0 + s * y0, c * y0 - s * x0); context.lineTo(c * x1 + s * y1, c * y1 - s * x1); context.lineTo(c * x2 + s * y2, c * y2 - s * x2); context.closePath(); } }); /***/ }), /***/ "./node_modules/d3-time-format/index.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__src_defaultLocale__ = __webpack_require__("./node_modules/d3-time-format/src/defaultLocale.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "timeFormatDefaultLocale", function() { return __WEBPACK_IMPORTED_MODULE_0__src_defaultLocale__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "timeFormat", function() { return __WEBPACK_IMPORTED_MODULE_0__src_defaultLocale__["b"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "timeParse", function() { return __WEBPACK_IMPORTED_MODULE_0__src_defaultLocale__["c"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "utcFormat", function() { return __WEBPACK_IMPORTED_MODULE_0__src_defaultLocale__["d"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "utcParse", function() { return __WEBPACK_IMPORTED_MODULE_0__src_defaultLocale__["e"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__src_locale__ = __webpack_require__("./node_modules/d3-time-format/src/locale.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "timeFormatLocale", function() { return __WEBPACK_IMPORTED_MODULE_1__src_locale__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__src_isoFormat__ = __webpack_require__("./node_modules/d3-time-format/src/isoFormat.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isoFormat", function() { return __WEBPACK_IMPORTED_MODULE_2__src_isoFormat__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__src_isoParse__ = __webpack_require__("./node_modules/d3-time-format/src/isoParse.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isoParse", function() { return __WEBPACK_IMPORTED_MODULE_3__src_isoParse__["a"]; }); /***/ }), /***/ "./node_modules/d3-time-format/src/defaultLocale.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return timeFormat; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return timeParse; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return utcFormat; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return utcParse; }); /* harmony export (immutable) */ __webpack_exports__["a"] = defaultLocale; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__locale__ = __webpack_require__("./node_modules/d3-time-format/src/locale.js"); var locale; var timeFormat; var timeParse; var utcFormat; var utcParse; defaultLocale({ dateTime: "%x, %X", date: "%-m/%-d/%Y", time: "%-I:%M:%S %p", periods: ["AM", "PM"], days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], shortDays: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], shortMonths: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"] }); function defaultLocale(definition) { locale = Object(__WEBPACK_IMPORTED_MODULE_0__locale__["a" /* default */])(definition); timeFormat = locale.format; timeParse = locale.parse; utcFormat = locale.utcFormat; utcParse = locale.utcParse; return locale; } /***/ }), /***/ "./node_modules/d3-time-format/src/isoFormat.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return isoSpecifier; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__defaultLocale__ = __webpack_require__("./node_modules/d3-time-format/src/defaultLocale.js"); var isoSpecifier = "%Y-%m-%dT%H:%M:%S.%LZ"; function formatIsoNative(date) { return date.toISOString(); } var formatIso = Date.prototype.toISOString ? formatIsoNative : Object(__WEBPACK_IMPORTED_MODULE_0__defaultLocale__["d" /* utcFormat */])(isoSpecifier); /* harmony default export */ __webpack_exports__["a"] = (formatIso); /***/ }), /***/ "./node_modules/d3-time-format/src/isoParse.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isoFormat__ = __webpack_require__("./node_modules/d3-time-format/src/isoFormat.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__defaultLocale__ = __webpack_require__("./node_modules/d3-time-format/src/defaultLocale.js"); function parseIsoNative(string) { var date = new Date(string); return isNaN(date) ? null : date; } var parseIso = +new Date("2000-01-01T00:00:00.000Z") ? parseIsoNative : Object(__WEBPACK_IMPORTED_MODULE_1__defaultLocale__["e" /* utcParse */])(__WEBPACK_IMPORTED_MODULE_0__isoFormat__["b" /* isoSpecifier */]); /* harmony default export */ __webpack_exports__["a"] = (parseIso); /***/ }), /***/ "./node_modules/d3-time-format/src/locale.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = formatLocale; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_d3_time__ = __webpack_require__("./node_modules/d3-time/index.js"); function localDate(d) { if (0 <= d.y && d.y < 100) { var date = new Date(-1, d.m, d.d, d.H, d.M, d.S, d.L); date.setFullYear(d.y); return date; } return new Date(d.y, d.m, d.d, d.H, d.M, d.S, d.L); } function utcDate(d) { if (0 <= d.y && d.y < 100) { var date = new Date(Date.UTC(-1, d.m, d.d, d.H, d.M, d.S, d.L)); date.setUTCFullYear(d.y); return date; } return new Date(Date.UTC(d.y, d.m, d.d, d.H, d.M, d.S, d.L)); } function newYear(y) { return {y: y, m: 0, d: 1, H: 0, M: 0, S: 0, L: 0}; } function formatLocale(locale) { var locale_dateTime = locale.dateTime, locale_date = locale.date, locale_time = locale.time, locale_periods = locale.periods, locale_weekdays = locale.days, locale_shortWeekdays = locale.shortDays, locale_months = locale.months, locale_shortMonths = locale.shortMonths; var periodRe = formatRe(locale_periods), periodLookup = formatLookup(locale_periods), weekdayRe = formatRe(locale_weekdays), weekdayLookup = formatLookup(locale_weekdays), shortWeekdayRe = formatRe(locale_shortWeekdays), shortWeekdayLookup = formatLookup(locale_shortWeekdays), monthRe = formatRe(locale_months), monthLookup = formatLookup(locale_months), shortMonthRe = formatRe(locale_shortMonths), shortMonthLookup = formatLookup(locale_shortMonths); var formats = { "a": formatShortWeekday, "A": formatWeekday, "b": formatShortMonth, "B": formatMonth, "c": null, "d": formatDayOfMonth, "e": formatDayOfMonth, "f": formatMicroseconds, "H": formatHour24, "I": formatHour12, "j": formatDayOfYear, "L": formatMilliseconds, "m": formatMonthNumber, "M": formatMinutes, "p": formatPeriod, "Q": formatUnixTimestamp, "s": formatUnixTimestampSeconds, "S": formatSeconds, "u": formatWeekdayNumberMonday, "U": formatWeekNumberSunday, "V": formatWeekNumberISO, "w": formatWeekdayNumberSunday, "W": formatWeekNumberMonday, "x": null, "X": null, "y": formatYear, "Y": formatFullYear, "Z": formatZone, "%": formatLiteralPercent }; var utcFormats = { "a": formatUTCShortWeekday, "A": formatUTCWeekday, "b": formatUTCShortMonth, "B": formatUTCMonth, "c": null, "d": formatUTCDayOfMonth, "e": formatUTCDayOfMonth, "f": formatUTCMicroseconds, "H": formatUTCHour24, "I": formatUTCHour12, "j": formatUTCDayOfYear, "L": formatUTCMilliseconds, "m": formatUTCMonthNumber, "M": formatUTCMinutes, "p": formatUTCPeriod, "Q": formatUnixTimestamp, "s": formatUnixTimestampSeconds, "S": formatUTCSeconds, "u": formatUTCWeekdayNumberMonday, "U": formatUTCWeekNumberSunday, "V": formatUTCWeekNumberISO, "w": formatUTCWeekdayNumberSunday, "W": formatUTCWeekNumberMonday, "x": null, "X": null, "y": formatUTCYear, "Y": formatUTCFullYear, "Z": formatUTCZone, "%": formatLiteralPercent }; var parses = { "a": parseShortWeekday, "A": parseWeekday, "b": parseShortMonth, "B": parseMonth, "c": parseLocaleDateTime, "d": parseDayOfMonth, "e": parseDayOfMonth, "f": parseMicroseconds, "H": parseHour24, "I": parseHour24, "j": parseDayOfYear, "L": parseMilliseconds, "m": parseMonthNumber, "M": parseMinutes, "p": parsePeriod, "Q": parseUnixTimestamp, "s": parseUnixTimestampSeconds, "S": parseSeconds, "u": parseWeekdayNumberMonday, "U": parseWeekNumberSunday, "V": parseWeekNumberISO, "w": parseWeekdayNumberSunday, "W": parseWeekNumberMonday, "x": parseLocaleDate, "X": parseLocaleTime, "y": parseYear, "Y": parseFullYear, "Z": parseZone, "%": parseLiteralPercent }; // These recursive directive definitions must be deferred. formats.x = newFormat(locale_date, formats); formats.X = newFormat(locale_time, formats); formats.c = newFormat(locale_dateTime, formats); utcFormats.x = newFormat(locale_date, utcFormats); utcFormats.X = newFormat(locale_time, utcFormats); utcFormats.c = newFormat(locale_dateTime, utcFormats); function newFormat(specifier, formats) { return function(date) { var string = [], i = -1, j = 0, n = specifier.length, c, pad, format; if (!(date instanceof Date)) date = new Date(+date); while (++i < n) { if (specifier.charCodeAt(i) === 37) { string.push(specifier.slice(j, i)); if ((pad = pads[c = specifier.charAt(++i)]) != null) c = specifier.charAt(++i); else pad = c === "e" ? " " : "0"; if (format = formats[c]) c = format(date, pad); string.push(c); j = i + 1; } } string.push(specifier.slice(j, i)); return string.join(""); }; } function newParse(specifier, newDate) { return function(string) { var d = newYear(1900), i = parseSpecifier(d, specifier, string += "", 0), week, day; if (i != string.length) return null; // If a UNIX timestamp is specified, return it. if ("Q" in d) return new Date(d.Q); // The am-pm flag is 0 for AM, and 1 for PM. if ("p" in d) d.H = d.H % 12 + d.p * 12; // Convert day-of-week and week-of-year to day-of-year. if ("V" in d) { if (d.V < 1 || d.V > 53) return null; if (!("w" in d)) d.w = 1; if ("Z" in d) { week = utcDate(newYear(d.y)), day = week.getUTCDay(); week = day > 4 || day === 0 ? __WEBPACK_IMPORTED_MODULE_0_d3_time__["p" /* utcMonday */].ceil(week) : Object(__WEBPACK_IMPORTED_MODULE_0_d3_time__["p" /* utcMonday */])(week); week = __WEBPACK_IMPORTED_MODULE_0_d3_time__["l" /* utcDay */].offset(week, (d.V - 1) * 7); d.y = week.getUTCFullYear(); d.m = week.getUTCMonth(); d.d = week.getUTCDate() + (d.w + 6) % 7; } else { week = newDate(newYear(d.y)), day = week.getDay(); week = day > 4 || day === 0 ? __WEBPACK_IMPORTED_MODULE_0_d3_time__["e" /* timeMonday */].ceil(week) : Object(__WEBPACK_IMPORTED_MODULE_0_d3_time__["e" /* timeMonday */])(week); week = __WEBPACK_IMPORTED_MODULE_0_d3_time__["a" /* timeDay */].offset(week, (d.V - 1) * 7); d.y = week.getFullYear(); d.m = week.getMonth(); d.d = week.getDate() + (d.w + 6) % 7; } } else if ("W" in d || "U" in d) { if (!("w" in d)) d.w = "u" in d ? d.u % 7 : "W" in d ? 1 : 0; day = "Z" in d ? utcDate(newYear(d.y)).getUTCDay() : newDate(newYear(d.y)).getDay(); d.m = 0; d.d = "W" in d ? (d.w + 6) % 7 + d.W * 7 - (day + 5) % 7 : d.w + d.U * 7 - (day + 6) % 7; } // If a time zone is specified, all fields are interpreted as UTC and then // offset according to the specified time zone. if ("Z" in d) { d.H += d.Z / 100 | 0; d.M += d.Z % 100; return utcDate(d); } // Otherwise, all fields are in local time. return newDate(d); }; } function parseSpecifier(d, specifier, string, j) { var i = 0, n = specifier.length, m = string.length, c, parse; while (i < n) { if (j >= m) return -1; c = specifier.charCodeAt(i++); if (c === 37) { c = specifier.charAt(i++); parse = parses[c in pads ? specifier.charAt(i++) : c]; if (!parse || ((j = parse(d, string, j)) < 0)) return -1; } else if (c != string.charCodeAt(j++)) { return -1; } } return j; } function parsePeriod(d, string, i) { var n = periodRe.exec(string.slice(i)); return n ? (d.p = periodLookup[n[0].toLowerCase()], i + n[0].length) : -1; } function parseShortWeekday(d, string, i) { var n = shortWeekdayRe.exec(string.slice(i)); return n ? (d.w = shortWeekdayLookup[n[0].toLowerCase()], i + n[0].length) : -1; } function parseWeekday(d, string, i) { var n = weekdayRe.exec(string.slice(i)); return n ? (d.w = weekdayLookup[n[0].toLowerCase()], i + n[0].length) : -1; } function parseShortMonth(d, string, i) { var n = shortMonthRe.exec(string.slice(i)); return n ? (d.m = shortMonthLookup[n[0].toLowerCase()], i + n[0].length) : -1; } function parseMonth(d, string, i) { var n = monthRe.exec(string.slice(i)); return n ? (d.m = monthLookup[n[0].toLowerCase()], i + n[0].length) : -1; } function parseLocaleDateTime(d, string, i) { return parseSpecifier(d, locale_dateTime, string, i); } function parseLocaleDate(d, string, i) { return parseSpecifier(d, locale_date, string, i); } function parseLocaleTime(d, string, i) { return parseSpecifier(d, locale_time, string, i); } function formatShortWeekday(d) { return locale_shortWeekdays[d.getDay()]; } function formatWeekday(d) { return locale_weekdays[d.getDay()]; } function formatShortMonth(d) { return locale_shortMonths[d.getMonth()]; } function formatMonth(d) { return locale_months[d.getMonth()]; } function formatPeriod(d) { return locale_periods[+(d.getHours() >= 12)]; } function formatUTCShortWeekday(d) { return locale_shortWeekdays[d.getUTCDay()]; } function formatUTCWeekday(d) { return locale_weekdays[d.getUTCDay()]; } function formatUTCShortMonth(d) { return locale_shortMonths[d.getUTCMonth()]; } function formatUTCMonth(d) { return locale_months[d.getUTCMonth()]; } function formatUTCPeriod(d) { return locale_periods[+(d.getUTCHours() >= 12)]; } return { format: function(specifier) { var f = newFormat(specifier += "", formats); f.toString = function() { return specifier; }; return f; }, parse: function(specifier) { var p = newParse(specifier += "", localDate); p.toString = function() { return specifier; }; return p; }, utcFormat: function(specifier) { var f = newFormat(specifier += "", utcFormats); f.toString = function() { return specifier; }; return f; }, utcParse: function(specifier) { var p = newParse(specifier, utcDate); p.toString = function() { return specifier; }; return p; } }; } var pads = {"-": "", "_": " ", "0": "0"}, numberRe = /^\s*\d+/, // note: ignores next directive percentRe = /^%/, requoteRe = /[\\^$*+?|[\]().{}]/g; function pad(value, fill, width) { var sign = value < 0 ? "-" : "", string = (sign ? -value : value) + "", length = string.length; return sign + (length < width ? new Array(width - length + 1).join(fill) + string : string); } function requote(s) { return s.replace(requoteRe, "\\$&"); } function formatRe(names) { return new RegExp("^(?:" + names.map(requote).join("|") + ")", "i"); } function formatLookup(names) { var map = {}, i = -1, n = names.length; while (++i < n) map[names[i].toLowerCase()] = i; return map; } function parseWeekdayNumberSunday(d, string, i) { var n = numberRe.exec(string.slice(i, i + 1)); return n ? (d.w = +n[0], i + n[0].length) : -1; } function parseWeekdayNumberMonday(d, string, i) { var n = numberRe.exec(string.slice(i, i + 1)); return n ? (d.u = +n[0], i + n[0].length) : -1; } function parseWeekNumberSunday(d, string, i) { var n = numberRe.exec(string.slice(i, i + 2)); return n ? (d.U = +n[0], i + n[0].length) : -1; } function parseWeekNumberISO(d, string, i) { var n = numberRe.exec(string.slice(i, i + 2)); return n ? (d.V = +n[0], i + n[0].length) : -1; } function parseWeekNumberMonday(d, string, i) { var n = numberRe.exec(string.slice(i, i + 2)); return n ? (d.W = +n[0], i + n[0].length) : -1; } function parseFullYear(d, string, i) { var n = numberRe.exec(string.slice(i, i + 4)); return n ? (d.y = +n[0], i + n[0].length) : -1; } function parseYear(d, string, i) { var n = numberRe.exec(string.slice(i, i + 2)); return n ? (d.y = +n[0] + (+n[0] > 68 ? 1900 : 2000), i + n[0].length) : -1; } function parseZone(d, string, i) { var n = /^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(string.slice(i, i + 6)); return n ? (d.Z = n[1] ? 0 : -(n[2] + (n[3] || "00")), i + n[0].length) : -1; } function parseMonthNumber(d, string, i) { var n = numberRe.exec(string.slice(i, i + 2)); return n ? (d.m = n[0] - 1, i + n[0].length) : -1; } function parseDayOfMonth(d, string, i) { var n = numberRe.exec(string.slice(i, i + 2)); return n ? (d.d = +n[0], i + n[0].length) : -1; } function parseDayOfYear(d, string, i) { var n = numberRe.exec(string.slice(i, i + 3)); return n ? (d.m = 0, d.d = +n[0], i + n[0].length) : -1; } function parseHour24(d, string, i) { var n = numberRe.exec(string.slice(i, i + 2)); return n ? (d.H = +n[0], i + n[0].length) : -1; } function parseMinutes(d, string, i) { var n = numberRe.exec(string.slice(i, i + 2)); return n ? (d.M = +n[0], i + n[0].length) : -1; } function parseSeconds(d, string, i) { var n = numberRe.exec(string.slice(i, i + 2)); return n ? (d.S = +n[0], i + n[0].length) : -1; } function parseMilliseconds(d, string, i) { var n = numberRe.exec(string.slice(i, i + 3)); return n ? (d.L = +n[0], i + n[0].length) : -1; } function parseMicroseconds(d, string, i) { var n = numberRe.exec(string.slice(i, i + 6)); return n ? (d.L = Math.floor(n[0] / 1000), i + n[0].length) : -1; } function parseLiteralPercent(d, string, i) { var n = percentRe.exec(string.slice(i, i + 1)); return n ? i + n[0].length : -1; } function parseUnixTimestamp(d, string, i) { var n = numberRe.exec(string.slice(i)); return n ? (d.Q = +n[0], i + n[0].length) : -1; } function parseUnixTimestampSeconds(d, string, i) { var n = numberRe.exec(string.slice(i)); return n ? (d.Q = (+n[0]) * 1000, i + n[0].length) : -1; } function formatDayOfMonth(d, p) { return pad(d.getDate(), p, 2); } function formatHour24(d, p) { return pad(d.getHours(), p, 2); } function formatHour12(d, p) { return pad(d.getHours() % 12 || 12, p, 2); } function formatDayOfYear(d, p) { return pad(1 + __WEBPACK_IMPORTED_MODULE_0_d3_time__["a" /* timeDay */].count(Object(__WEBPACK_IMPORTED_MODULE_0_d3_time__["k" /* timeYear */])(d), d), p, 3); } function formatMilliseconds(d, p) { return pad(d.getMilliseconds(), p, 3); } function formatMicroseconds(d, p) { return formatMilliseconds(d, p) + "000"; } function formatMonthNumber(d, p) { return pad(d.getMonth() + 1, p, 2); } function formatMinutes(d, p) { return pad(d.getMinutes(), p, 2); } function formatSeconds(d, p) { return pad(d.getSeconds(), p, 2); } function formatWeekdayNumberMonday(d) { var day = d.getDay(); return day === 0 ? 7 : day; } function formatWeekNumberSunday(d, p) { return pad(__WEBPACK_IMPORTED_MODULE_0_d3_time__["h" /* timeSunday */].count(Object(__WEBPACK_IMPORTED_MODULE_0_d3_time__["k" /* timeYear */])(d), d), p, 2); } function formatWeekNumberISO(d, p) { var day = d.getDay(); d = (day >= 4 || day === 0) ? Object(__WEBPACK_IMPORTED_MODULE_0_d3_time__["i" /* timeThursday */])(d) : __WEBPACK_IMPORTED_MODULE_0_d3_time__["i" /* timeThursday */].ceil(d); return pad(__WEBPACK_IMPORTED_MODULE_0_d3_time__["i" /* timeThursday */].count(Object(__WEBPACK_IMPORTED_MODULE_0_d3_time__["k" /* timeYear */])(d), d) + (Object(__WEBPACK_IMPORTED_MODULE_0_d3_time__["k" /* timeYear */])(d).getDay() === 4), p, 2); } function formatWeekdayNumberSunday(d) { return d.getDay(); } function formatWeekNumberMonday(d, p) { return pad(__WEBPACK_IMPORTED_MODULE_0_d3_time__["e" /* timeMonday */].count(Object(__WEBPACK_IMPORTED_MODULE_0_d3_time__["k" /* timeYear */])(d), d), p, 2); } function formatYear(d, p) { return pad(d.getFullYear() % 100, p, 2); } function formatFullYear(d, p) { return pad(d.getFullYear() % 10000, p, 4); } function formatZone(d) { var z = d.getTimezoneOffset(); return (z > 0 ? "-" : (z *= -1, "+")) + pad(z / 60 | 0, "0", 2) + pad(z % 60, "0", 2); } function formatUTCDayOfMonth(d, p) { return pad(d.getUTCDate(), p, 2); } function formatUTCHour24(d, p) { return pad(d.getUTCHours(), p, 2); } function formatUTCHour12(d, p) { return pad(d.getUTCHours() % 12 || 12, p, 2); } function formatUTCDayOfYear(d, p) { return pad(1 + __WEBPACK_IMPORTED_MODULE_0_d3_time__["l" /* utcDay */].count(Object(__WEBPACK_IMPORTED_MODULE_0_d3_time__["v" /* utcYear */])(d), d), p, 3); } function formatUTCMilliseconds(d, p) { return pad(d.getUTCMilliseconds(), p, 3); } function formatUTCMicroseconds(d, p) { return formatUTCMilliseconds(d, p) + "000"; } function formatUTCMonthNumber(d, p) { return pad(d.getUTCMonth() + 1, p, 2); } function formatUTCMinutes(d, p) { return pad(d.getUTCMinutes(), p, 2); } function formatUTCSeconds(d, p) { return pad(d.getUTCSeconds(), p, 2); } function formatUTCWeekdayNumberMonday(d) { var dow = d.getUTCDay(); return dow === 0 ? 7 : dow; } function formatUTCWeekNumberSunday(d, p) { return pad(__WEBPACK_IMPORTED_MODULE_0_d3_time__["s" /* utcSunday */].count(Object(__WEBPACK_IMPORTED_MODULE_0_d3_time__["v" /* utcYear */])(d), d), p, 2); } function formatUTCWeekNumberISO(d, p) { var day = d.getUTCDay(); d = (day >= 4 || day === 0) ? Object(__WEBPACK_IMPORTED_MODULE_0_d3_time__["t" /* utcThursday */])(d) : __WEBPACK_IMPORTED_MODULE_0_d3_time__["t" /* utcThursday */].ceil(d); return pad(__WEBPACK_IMPORTED_MODULE_0_d3_time__["t" /* utcThursday */].count(Object(__WEBPACK_IMPORTED_MODULE_0_d3_time__["v" /* utcYear */])(d), d) + (Object(__WEBPACK_IMPORTED_MODULE_0_d3_time__["v" /* utcYear */])(d).getUTCDay() === 4), p, 2); } function formatUTCWeekdayNumberSunday(d) { return d.getUTCDay(); } function formatUTCWeekNumberMonday(d, p) { return pad(__WEBPACK_IMPORTED_MODULE_0_d3_time__["p" /* utcMonday */].count(Object(__WEBPACK_IMPORTED_MODULE_0_d3_time__["v" /* utcYear */])(d), d), p, 2); } function formatUTCYear(d, p) { return pad(d.getUTCFullYear() % 100, p, 2); } function formatUTCFullYear(d, p) { return pad(d.getUTCFullYear() % 10000, p, 4); } function formatUTCZone() { return "+0000"; } function formatLiteralPercent() { return "%"; } function formatUnixTimestamp(d) { return +d; } function formatUnixTimestampSeconds(d) { return Math.floor(+d / 1000); } /***/ }), /***/ "./node_modules/d3-time/index.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__src_interval__ = __webpack_require__("./node_modules/d3-time/src/interval.js"); /* unused harmony reexport timeInterval */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__src_millisecond__ = __webpack_require__("./node_modules/d3-time/src/millisecond.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return __WEBPACK_IMPORTED_MODULE_1__src_millisecond__["a"]; }); /* unused harmony reexport timeMilliseconds */ /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "n", function() { return __WEBPACK_IMPORTED_MODULE_1__src_millisecond__["a"]; }); /* unused harmony reexport utcMilliseconds */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__src_second__ = __webpack_require__("./node_modules/d3-time/src/second.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return __WEBPACK_IMPORTED_MODULE_2__src_second__["a"]; }); /* unused harmony reexport timeSeconds */ /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "r", function() { return __WEBPACK_IMPORTED_MODULE_2__src_second__["a"]; }); /* unused harmony reexport utcSeconds */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__src_minute__ = __webpack_require__("./node_modules/d3-time/src/minute.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return __WEBPACK_IMPORTED_MODULE_3__src_minute__["a"]; }); /* unused harmony reexport timeMinutes */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__src_hour__ = __webpack_require__("./node_modules/d3-time/src/hour.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return __WEBPACK_IMPORTED_MODULE_4__src_hour__["a"]; }); /* unused harmony reexport timeHours */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__src_day__ = __webpack_require__("./node_modules/d3-time/src/day.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return __WEBPACK_IMPORTED_MODULE_5__src_day__["a"]; }); /* unused harmony reexport timeDays */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__src_week__ = __webpack_require__("./node_modules/d3-time/src/week.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return __WEBPACK_IMPORTED_MODULE_6__src_week__["b"]; }); /* unused harmony reexport timeWeeks */ /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return __WEBPACK_IMPORTED_MODULE_6__src_week__["b"]; }); /* unused harmony reexport timeSundays */ /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return __WEBPACK_IMPORTED_MODULE_6__src_week__["a"]; }); /* unused harmony reexport timeMondays */ /* unused harmony reexport timeTuesday */ /* unused harmony reexport timeTuesdays */ /* unused harmony reexport timeWednesday */ /* unused harmony reexport timeWednesdays */ /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return __WEBPACK_IMPORTED_MODULE_6__src_week__["c"]; }); /* unused harmony reexport timeThursdays */ /* unused harmony reexport timeFriday */ /* unused harmony reexport timeFridays */ /* unused harmony reexport timeSaturday */ /* unused harmony reexport timeSaturdays */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__src_month__ = __webpack_require__("./node_modules/d3-time/src/month.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return __WEBPACK_IMPORTED_MODULE_7__src_month__["a"]; }); /* unused harmony reexport timeMonths */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__src_year__ = __webpack_require__("./node_modules/d3-time/src/year.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return __WEBPACK_IMPORTED_MODULE_8__src_year__["a"]; }); /* unused harmony reexport timeYears */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__src_utcMinute__ = __webpack_require__("./node_modules/d3-time/src/utcMinute.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "o", function() { return __WEBPACK_IMPORTED_MODULE_9__src_utcMinute__["a"]; }); /* unused harmony reexport utcMinutes */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__src_utcHour__ = __webpack_require__("./node_modules/d3-time/src/utcHour.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "m", function() { return __WEBPACK_IMPORTED_MODULE_10__src_utcHour__["a"]; }); /* unused harmony reexport utcHours */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__src_utcDay__ = __webpack_require__("./node_modules/d3-time/src/utcDay.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "l", function() { return __WEBPACK_IMPORTED_MODULE_11__src_utcDay__["a"]; }); /* unused harmony reexport utcDays */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__src_utcWeek__ = __webpack_require__("./node_modules/d3-time/src/utcWeek.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "u", function() { return __WEBPACK_IMPORTED_MODULE_12__src_utcWeek__["b"]; }); /* unused harmony reexport utcWeeks */ /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "s", function() { return __WEBPACK_IMPORTED_MODULE_12__src_utcWeek__["b"]; }); /* unused harmony reexport utcSundays */ /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "p", function() { return __WEBPACK_IMPORTED_MODULE_12__src_utcWeek__["a"]; }); /* unused harmony reexport utcMondays */ /* unused harmony reexport utcTuesday */ /* unused harmony reexport utcTuesdays */ /* unused harmony reexport utcWednesday */ /* unused harmony reexport utcWednesdays */ /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "t", function() { return __WEBPACK_IMPORTED_MODULE_12__src_utcWeek__["c"]; }); /* unused harmony reexport utcThursdays */ /* unused harmony reexport utcFriday */ /* unused harmony reexport utcFridays */ /* unused harmony reexport utcSaturday */ /* unused harmony reexport utcSaturdays */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__src_utcMonth__ = __webpack_require__("./node_modules/d3-time/src/utcMonth.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "q", function() { return __WEBPACK_IMPORTED_MODULE_13__src_utcMonth__["a"]; }); /* unused harmony reexport utcMonths */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__src_utcYear__ = __webpack_require__("./node_modules/d3-time/src/utcYear.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "v", function() { return __WEBPACK_IMPORTED_MODULE_14__src_utcYear__["a"]; }); /* unused harmony reexport utcYears */ /***/ }), /***/ "./node_modules/d3-time/src/day.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export days */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__interval__ = __webpack_require__("./node_modules/d3-time/src/interval.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__duration__ = __webpack_require__("./node_modules/d3-time/src/duration.js"); var day = Object(__WEBPACK_IMPORTED_MODULE_0__interval__["a" /* default */])(function(date) { date.setHours(0, 0, 0, 0); }, function(date, step) { date.setDate(date.getDate() + step); }, function(start, end) { return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * __WEBPACK_IMPORTED_MODULE_1__duration__["c" /* durationMinute */]) / __WEBPACK_IMPORTED_MODULE_1__duration__["a" /* durationDay */]; }, function(date) { return date.getDate() - 1; }); /* harmony default export */ __webpack_exports__["a"] = (day); var days = day.range; /***/ }), /***/ "./node_modules/d3-time/src/duration.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return durationSecond; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return durationMinute; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return durationHour; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return durationDay; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return durationWeek; }); var durationSecond = 1e3; var durationMinute = 6e4; var durationHour = 36e5; var durationDay = 864e5; var durationWeek = 6048e5; /***/ }), /***/ "./node_modules/d3-time/src/hour.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export hours */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__interval__ = __webpack_require__("./node_modules/d3-time/src/interval.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__duration__ = __webpack_require__("./node_modules/d3-time/src/duration.js"); var hour = Object(__WEBPACK_IMPORTED_MODULE_0__interval__["a" /* default */])(function(date) { var offset = date.getTimezoneOffset() * __WEBPACK_IMPORTED_MODULE_1__duration__["c" /* durationMinute */] % __WEBPACK_IMPORTED_MODULE_1__duration__["b" /* durationHour */]; if (offset < 0) offset += __WEBPACK_IMPORTED_MODULE_1__duration__["b" /* durationHour */]; date.setTime(Math.floor((+date - offset) / __WEBPACK_IMPORTED_MODULE_1__duration__["b" /* durationHour */]) * __WEBPACK_IMPORTED_MODULE_1__duration__["b" /* durationHour */] + offset); }, function(date, step) { date.setTime(+date + step * __WEBPACK_IMPORTED_MODULE_1__duration__["b" /* durationHour */]); }, function(start, end) { return (end - start) / __WEBPACK_IMPORTED_MODULE_1__duration__["b" /* durationHour */]; }, function(date) { return date.getHours(); }); /* harmony default export */ __webpack_exports__["a"] = (hour); var hours = hour.range; /***/ }), /***/ "./node_modules/d3-time/src/interval.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = newInterval; var t0 = new Date, t1 = new Date; function newInterval(floori, offseti, count, field) { function interval(date) { return floori(date = new Date(+date)), date; } interval.floor = interval; interval.ceil = function(date) { return floori(date = new Date(date - 1)), offseti(date, 1), floori(date), date; }; interval.round = function(date) { var d0 = interval(date), d1 = interval.ceil(date); return date - d0 < d1 - date ? d0 : d1; }; interval.offset = function(date, step) { return offseti(date = new Date(+date), step == null ? 1 : Math.floor(step)), date; }; interval.range = function(start, stop, step) { var range = [], previous; start = interval.ceil(start); step = step == null ? 1 : Math.floor(step); if (!(start < stop) || !(step > 0)) return range; // also handles Invalid Date do range.push(previous = new Date(+start)), offseti(start, step), floori(start); while (previous < start && start < stop); return range; }; interval.filter = function(test) { return newInterval(function(date) { if (date >= date) while (floori(date), !test(date)) date.setTime(date - 1); }, function(date, step) { if (date >= date) { if (step < 0) while (++step <= 0) { while (offseti(date, -1), !test(date)) {} // eslint-disable-line no-empty } else while (--step >= 0) { while (offseti(date, +1), !test(date)) {} // eslint-disable-line no-empty } } }); }; if (count) { interval.count = function(start, end) { t0.setTime(+start), t1.setTime(+end); floori(t0), floori(t1); return Math.floor(count(t0, t1)); }; interval.every = function(step) { step = Math.floor(step); return !isFinite(step) || !(step > 0) ? null : !(step > 1) ? interval : interval.filter(field ? function(d) { return field(d) % step === 0; } : function(d) { return interval.count(0, d) % step === 0; }); }; } return interval; } /***/ }), /***/ "./node_modules/d3-time/src/millisecond.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export milliseconds */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__interval__ = __webpack_require__("./node_modules/d3-time/src/interval.js"); var millisecond = Object(__WEBPACK_IMPORTED_MODULE_0__interval__["a" /* default */])(function() { // noop }, function(date, step) { date.setTime(+date + step); }, function(start, end) { return end - start; }); // An optimized implementation for this simple case. millisecond.every = function(k) { k = Math.floor(k); if (!isFinite(k) || !(k > 0)) return null; if (!(k > 1)) return millisecond; return Object(__WEBPACK_IMPORTED_MODULE_0__interval__["a" /* default */])(function(date) { date.setTime(Math.floor(date / k) * k); }, function(date, step) { date.setTime(+date + step * k); }, function(start, end) { return (end - start) / k; }); }; /* harmony default export */ __webpack_exports__["a"] = (millisecond); var milliseconds = millisecond.range; /***/ }), /***/ "./node_modules/d3-time/src/minute.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export minutes */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__interval__ = __webpack_require__("./node_modules/d3-time/src/interval.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__duration__ = __webpack_require__("./node_modules/d3-time/src/duration.js"); var minute = Object(__WEBPACK_IMPORTED_MODULE_0__interval__["a" /* default */])(function(date) { date.setTime(Math.floor(date / __WEBPACK_IMPORTED_MODULE_1__duration__["c" /* durationMinute */]) * __WEBPACK_IMPORTED_MODULE_1__duration__["c" /* durationMinute */]); }, function(date, step) { date.setTime(+date + step * __WEBPACK_IMPORTED_MODULE_1__duration__["c" /* durationMinute */]); }, function(start, end) { return (end - start) / __WEBPACK_IMPORTED_MODULE_1__duration__["c" /* durationMinute */]; }, function(date) { return date.getMinutes(); }); /* harmony default export */ __webpack_exports__["a"] = (minute); var minutes = minute.range; /***/ }), /***/ "./node_modules/d3-time/src/month.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export months */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__interval__ = __webpack_require__("./node_modules/d3-time/src/interval.js"); var month = Object(__WEBPACK_IMPORTED_MODULE_0__interval__["a" /* default */])(function(date) { date.setDate(1); date.setHours(0, 0, 0, 0); }, function(date, step) { date.setMonth(date.getMonth() + step); }, function(start, end) { return end.getMonth() - start.getMonth() + (end.getFullYear() - start.getFullYear()) * 12; }, function(date) { return date.getMonth(); }); /* harmony default export */ __webpack_exports__["a"] = (month); var months = month.range; /***/ }), /***/ "./node_modules/d3-time/src/second.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export seconds */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__interval__ = __webpack_require__("./node_modules/d3-time/src/interval.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__duration__ = __webpack_require__("./node_modules/d3-time/src/duration.js"); var second = Object(__WEBPACK_IMPORTED_MODULE_0__interval__["a" /* default */])(function(date) { date.setTime(Math.floor(date / __WEBPACK_IMPORTED_MODULE_1__duration__["d" /* durationSecond */]) * __WEBPACK_IMPORTED_MODULE_1__duration__["d" /* durationSecond */]); }, function(date, step) { date.setTime(+date + step * __WEBPACK_IMPORTED_MODULE_1__duration__["d" /* durationSecond */]); }, function(start, end) { return (end - start) / __WEBPACK_IMPORTED_MODULE_1__duration__["d" /* durationSecond */]; }, function(date) { return date.getUTCSeconds(); }); /* harmony default export */ __webpack_exports__["a"] = (second); var seconds = second.range; /***/ }), /***/ "./node_modules/d3-time/src/utcDay.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export utcDays */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__interval__ = __webpack_require__("./node_modules/d3-time/src/interval.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__duration__ = __webpack_require__("./node_modules/d3-time/src/duration.js"); var utcDay = Object(__WEBPACK_IMPORTED_MODULE_0__interval__["a" /* default */])(function(date) { date.setUTCHours(0, 0, 0, 0); }, function(date, step) { date.setUTCDate(date.getUTCDate() + step); }, function(start, end) { return (end - start) / __WEBPACK_IMPORTED_MODULE_1__duration__["a" /* durationDay */]; }, function(date) { return date.getUTCDate() - 1; }); /* harmony default export */ __webpack_exports__["a"] = (utcDay); var utcDays = utcDay.range; /***/ }), /***/ "./node_modules/d3-time/src/utcHour.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export utcHours */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__interval__ = __webpack_require__("./node_modules/d3-time/src/interval.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__duration__ = __webpack_require__("./node_modules/d3-time/src/duration.js"); var utcHour = Object(__WEBPACK_IMPORTED_MODULE_0__interval__["a" /* default */])(function(date) { date.setUTCMinutes(0, 0, 0); }, function(date, step) { date.setTime(+date + step * __WEBPACK_IMPORTED_MODULE_1__duration__["b" /* durationHour */]); }, function(start, end) { return (end - start) / __WEBPACK_IMPORTED_MODULE_1__duration__["b" /* durationHour */]; }, function(date) { return date.getUTCHours(); }); /* harmony default export */ __webpack_exports__["a"] = (utcHour); var utcHours = utcHour.range; /***/ }), /***/ "./node_modules/d3-time/src/utcMinute.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export utcMinutes */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__interval__ = __webpack_require__("./node_modules/d3-time/src/interval.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__duration__ = __webpack_require__("./node_modules/d3-time/src/duration.js"); var utcMinute = Object(__WEBPACK_IMPORTED_MODULE_0__interval__["a" /* default */])(function(date) { date.setUTCSeconds(0, 0); }, function(date, step) { date.setTime(+date + step * __WEBPACK_IMPORTED_MODULE_1__duration__["c" /* durationMinute */]); }, function(start, end) { return (end - start) / __WEBPACK_IMPORTED_MODULE_1__duration__["c" /* durationMinute */]; }, function(date) { return date.getUTCMinutes(); }); /* harmony default export */ __webpack_exports__["a"] = (utcMinute); var utcMinutes = utcMinute.range; /***/ }), /***/ "./node_modules/d3-time/src/utcMonth.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export utcMonths */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__interval__ = __webpack_require__("./node_modules/d3-time/src/interval.js"); var utcMonth = Object(__WEBPACK_IMPORTED_MODULE_0__interval__["a" /* default */])(function(date) { date.setUTCDate(1); date.setUTCHours(0, 0, 0, 0); }, function(date, step) { date.setUTCMonth(date.getUTCMonth() + step); }, function(start, end) { return end.getUTCMonth() - start.getUTCMonth() + (end.getUTCFullYear() - start.getUTCFullYear()) * 12; }, function(date) { return date.getUTCMonth(); }); /* harmony default export */ __webpack_exports__["a"] = (utcMonth); var utcMonths = utcMonth.range; /***/ }), /***/ "./node_modules/d3-time/src/utcWeek.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return utcSunday; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return utcMonday; }); /* unused harmony export utcTuesday */ /* unused harmony export utcWednesday */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return utcThursday; }); /* unused harmony export utcFriday */ /* unused harmony export utcSaturday */ /* unused harmony export utcSundays */ /* unused harmony export utcMondays */ /* unused harmony export utcTuesdays */ /* unused harmony export utcWednesdays */ /* unused harmony export utcThursdays */ /* unused harmony export utcFridays */ /* unused harmony export utcSaturdays */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__interval__ = __webpack_require__("./node_modules/d3-time/src/interval.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__duration__ = __webpack_require__("./node_modules/d3-time/src/duration.js"); function utcWeekday(i) { return Object(__WEBPACK_IMPORTED_MODULE_0__interval__["a" /* default */])(function(date) { date.setUTCDate(date.getUTCDate() - (date.getUTCDay() + 7 - i) % 7); date.setUTCHours(0, 0, 0, 0); }, function(date, step) { date.setUTCDate(date.getUTCDate() + step * 7); }, function(start, end) { return (end - start) / __WEBPACK_IMPORTED_MODULE_1__duration__["e" /* durationWeek */]; }); } var utcSunday = utcWeekday(0); var utcMonday = utcWeekday(1); var utcTuesday = utcWeekday(2); var utcWednesday = utcWeekday(3); var utcThursday = utcWeekday(4); var utcFriday = utcWeekday(5); var utcSaturday = utcWeekday(6); var utcSundays = utcSunday.range; var utcMondays = utcMonday.range; var utcTuesdays = utcTuesday.range; var utcWednesdays = utcWednesday.range; var utcThursdays = utcThursday.range; var utcFridays = utcFriday.range; var utcSaturdays = utcSaturday.range; /***/ }), /***/ "./node_modules/d3-time/src/utcYear.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export utcYears */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__interval__ = __webpack_require__("./node_modules/d3-time/src/interval.js"); var utcYear = Object(__WEBPACK_IMPORTED_MODULE_0__interval__["a" /* default */])(function(date) { date.setUTCMonth(0, 1); date.setUTCHours(0, 0, 0, 0); }, function(date, step) { date.setUTCFullYear(date.getUTCFullYear() + step); }, function(start, end) { return end.getUTCFullYear() - start.getUTCFullYear(); }, function(date) { return date.getUTCFullYear(); }); // An optimized implementation for this simple case. utcYear.every = function(k) { return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : Object(__WEBPACK_IMPORTED_MODULE_0__interval__["a" /* default */])(function(date) { date.setUTCFullYear(Math.floor(date.getUTCFullYear() / k) * k); date.setUTCMonth(0, 1); date.setUTCHours(0, 0, 0, 0); }, function(date, step) { date.setUTCFullYear(date.getUTCFullYear() + step * k); }); }; /* harmony default export */ __webpack_exports__["a"] = (utcYear); var utcYears = utcYear.range; /***/ }), /***/ "./node_modules/d3-time/src/week.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return sunday; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return monday; }); /* unused harmony export tuesday */ /* unused harmony export wednesday */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return thursday; }); /* unused harmony export friday */ /* unused harmony export saturday */ /* unused harmony export sundays */ /* unused harmony export mondays */ /* unused harmony export tuesdays */ /* unused harmony export wednesdays */ /* unused harmony export thursdays */ /* unused harmony export fridays */ /* unused harmony export saturdays */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__interval__ = __webpack_require__("./node_modules/d3-time/src/interval.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__duration__ = __webpack_require__("./node_modules/d3-time/src/duration.js"); function weekday(i) { return Object(__WEBPACK_IMPORTED_MODULE_0__interval__["a" /* default */])(function(date) { date.setDate(date.getDate() - (date.getDay() + 7 - i) % 7); date.setHours(0, 0, 0, 0); }, function(date, step) { date.setDate(date.getDate() + step * 7); }, function(start, end) { return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * __WEBPACK_IMPORTED_MODULE_1__duration__["c" /* durationMinute */]) / __WEBPACK_IMPORTED_MODULE_1__duration__["e" /* durationWeek */]; }); } var sunday = weekday(0); var monday = weekday(1); var tuesday = weekday(2); var wednesday = weekday(3); var thursday = weekday(4); var friday = weekday(5); var saturday = weekday(6); var sundays = sunday.range; var mondays = monday.range; var tuesdays = tuesday.range; var wednesdays = wednesday.range; var thursdays = thursday.range; var fridays = friday.range; var saturdays = saturday.range; /***/ }), /***/ "./node_modules/d3-time/src/year.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export years */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__interval__ = __webpack_require__("./node_modules/d3-time/src/interval.js"); var year = Object(__WEBPACK_IMPORTED_MODULE_0__interval__["a" /* default */])(function(date) { date.setMonth(0, 1); date.setHours(0, 0, 0, 0); }, function(date, step) { date.setFullYear(date.getFullYear() + step); }, function(start, end) { return end.getFullYear() - start.getFullYear(); }, function(date) { return date.getFullYear(); }); // An optimized implementation for this simple case. year.every = function(k) { return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : Object(__WEBPACK_IMPORTED_MODULE_0__interval__["a" /* default */])(function(date) { date.setFullYear(Math.floor(date.getFullYear() / k) * k); date.setMonth(0, 1); date.setHours(0, 0, 0, 0); }, function(date, step) { date.setFullYear(date.getFullYear() + step * k); }); }; /* harmony default export */ __webpack_exports__["a"] = (year); var years = year.range; /***/ }), /***/ "./node_modules/d3-timer/index.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__src_timer__ = __webpack_require__("./node_modules/d3-timer/src/timer.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return __WEBPACK_IMPORTED_MODULE_0__src_timer__["b"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return __WEBPACK_IMPORTED_MODULE_0__src_timer__["c"]; }); /* unused harmony reexport timerFlush */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__src_timeout__ = __webpack_require__("./node_modules/d3-timer/src/timeout.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return __WEBPACK_IMPORTED_MODULE_1__src_timeout__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__src_interval__ = __webpack_require__("./node_modules/d3-timer/src/interval.js"); /* unused harmony reexport interval */ /***/ }), /***/ "./node_modules/d3-timer/src/interval.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__timer__ = __webpack_require__("./node_modules/d3-timer/src/timer.js"); /* unused harmony default export */ var _unused_webpack_default_export = (function(callback, delay, time) { var t = new __WEBPACK_IMPORTED_MODULE_0__timer__["a" /* Timer */], total = delay; if (delay == null) return t.restart(callback, delay, time), t; delay = +delay, time = time == null ? Object(__WEBPACK_IMPORTED_MODULE_0__timer__["b" /* now */])() : +time; t.restart(function tick(elapsed) { elapsed += total; t.restart(tick, total += delay, time); callback(elapsed); }, delay, time); return t; }); /***/ }), /***/ "./node_modules/d3-timer/src/timeout.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__timer__ = __webpack_require__("./node_modules/d3-timer/src/timer.js"); /* harmony default export */ __webpack_exports__["a"] = (function(callback, delay, time) { var t = new __WEBPACK_IMPORTED_MODULE_0__timer__["a" /* Timer */]; delay = delay == null ? 0 : +delay; t.restart(function(elapsed) { t.stop(); callback(elapsed + delay); }, delay, time); return t; }); /***/ }), /***/ "./node_modules/d3-timer/src/timer.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["b"] = now; /* harmony export (immutable) */ __webpack_exports__["a"] = Timer; /* harmony export (immutable) */ __webpack_exports__["c"] = timer; /* unused harmony export timerFlush */ var frame = 0, // is an animation frame pending? timeout = 0, // is a timeout pending? interval = 0, // are any timers active? pokeDelay = 1000, // how frequently we check for clock skew taskHead, taskTail, clockLast = 0, clockNow = 0, clockSkew = 0, clock = typeof performance === "object" && performance.now ? performance : Date, setFrame = typeof window === "object" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function(f) { setTimeout(f, 17); }; function now() { return clockNow || (setFrame(clearNow), clockNow = clock.now() + clockSkew); } function clearNow() { clockNow = 0; } function Timer() { this._call = this._time = this._next = null; } Timer.prototype = timer.prototype = { constructor: Timer, restart: function(callback, delay, time) { if (typeof callback !== "function") throw new TypeError("callback is not a function"); time = (time == null ? now() : +time) + (delay == null ? 0 : +delay); if (!this._next && taskTail !== this) { if (taskTail) taskTail._next = this; else taskHead = this; taskTail = this; } this._call = callback; this._time = time; sleep(); }, stop: function() { if (this._call) { this._call = null; this._time = Infinity; sleep(); } } }; function timer(callback, delay, time) { var t = new Timer; t.restart(callback, delay, time); return t; } function timerFlush() { now(); // Get the current time, if not already set. ++frame; // Pretend we’ve set an alarm, if we haven’t already. var t = taskHead, e; while (t) { if ((e = clockNow - t._time) >= 0) t._call.call(null, e); t = t._next; } --frame; } function wake() { clockNow = (clockLast = clock.now()) + clockSkew; frame = timeout = 0; try { timerFlush(); } finally { frame = 0; nap(); clockNow = 0; } } function poke() { var now = clock.now(), delay = now - clockLast; if (delay > pokeDelay) clockSkew -= delay, clockLast = now; } function nap() { var t0, t1 = taskHead, t2, time = Infinity; while (t1) { if (t1._call) { if (time > t1._time) time = t1._time; t0 = t1, t1 = t1._next; } else { t2 = t1._next, t1._next = null; t1 = t0 ? t0._next = t2 : taskHead = t2; } } taskTail = t0; sleep(time); } function sleep(time) { if (frame) return; // Soonest alarm already set, or will be. if (timeout) timeout = clearTimeout(timeout); var delay = time - clockNow; // Strictly less than if we recomputed clockNow. if (delay > 24) { if (time < Infinity) timeout = setTimeout(wake, time - clock.now() - clockSkew); if (interval) interval = clearInterval(interval); } else { if (!interval) clockLast = clock.now(), interval = setInterval(poke, pokeDelay); frame = 1, setFrame(wake); } } /***/ }), /***/ "./node_modules/d3-transition/index.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__src_selection_index__ = __webpack_require__("./node_modules/d3-transition/src/selection/index.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__src_transition_index__ = __webpack_require__("./node_modules/d3-transition/src/transition/index.js"); /* unused harmony reexport transition */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__src_active__ = __webpack_require__("./node_modules/d3-transition/src/active.js"); /* unused harmony reexport active */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__src_interrupt__ = __webpack_require__("./node_modules/d3-transition/src/interrupt.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return __WEBPACK_IMPORTED_MODULE_3__src_interrupt__["a"]; }); /***/ }), /***/ "./node_modules/d3-transition/src/active.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__transition_index__ = __webpack_require__("./node_modules/d3-transition/src/transition/index.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__transition_schedule__ = __webpack_require__("./node_modules/d3-transition/src/transition/schedule.js"); var root = [null]; /* unused harmony default export */ var _unused_webpack_default_export = (function(node, name) { var schedules = node.__transition, schedule, i; if (schedules) { name = name == null ? null : name + ""; for (i in schedules) { if ((schedule = schedules[i]).state > __WEBPACK_IMPORTED_MODULE_1__transition_schedule__["c" /* SCHEDULED */] && schedule.name === name) { return new __WEBPACK_IMPORTED_MODULE_0__transition_index__["a" /* Transition */]([[node]], root, name, +i); } } } return null; }); /***/ }), /***/ "./node_modules/d3-transition/src/interrupt.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__transition_schedule__ = __webpack_require__("./node_modules/d3-transition/src/transition/schedule.js"); /* harmony default export */ __webpack_exports__["a"] = (function(node, name) { var schedules = node.__transition, schedule, active, empty = true, i; if (!schedules) return; name = name == null ? null : name + ""; for (i in schedules) { if ((schedule = schedules[i]).name !== name) { empty = false; continue; } active = schedule.state > __WEBPACK_IMPORTED_MODULE_0__transition_schedule__["d" /* STARTING */] && schedule.state < __WEBPACK_IMPORTED_MODULE_0__transition_schedule__["b" /* ENDING */]; schedule.state = __WEBPACK_IMPORTED_MODULE_0__transition_schedule__["a" /* ENDED */]; schedule.timer.stop(); if (active) schedule.on.call("interrupt", node, node.__data__, schedule.index, schedule.group); delete schedules[i]; } if (empty) delete node.__transition; }); /***/ }), /***/ "./node_modules/d3-transition/src/selection/index.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_d3_selection__ = __webpack_require__("./node_modules/d3-selection/index.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__interrupt__ = __webpack_require__("./node_modules/d3-transition/src/selection/interrupt.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__transition__ = __webpack_require__("./node_modules/d3-transition/src/selection/transition.js"); __WEBPACK_IMPORTED_MODULE_0_d3_selection__["selection"].prototype.interrupt = __WEBPACK_IMPORTED_MODULE_1__interrupt__["a" /* default */]; __WEBPACK_IMPORTED_MODULE_0_d3_selection__["selection"].prototype.transition = __WEBPACK_IMPORTED_MODULE_2__transition__["a" /* default */]; /***/ }), /***/ "./node_modules/d3-transition/src/selection/interrupt.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__interrupt__ = __webpack_require__("./node_modules/d3-transition/src/interrupt.js"); /* harmony default export */ __webpack_exports__["a"] = (function(name) { return this.each(function() { Object(__WEBPACK_IMPORTED_MODULE_0__interrupt__["a" /* default */])(this, name); }); }); /***/ }), /***/ "./node_modules/d3-transition/src/selection/transition.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__transition_index__ = __webpack_require__("./node_modules/d3-transition/src/transition/index.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__transition_schedule__ = __webpack_require__("./node_modules/d3-transition/src/transition/schedule.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_d3_ease__ = __webpack_require__("./node_modules/d3-ease/index.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_d3_timer__ = __webpack_require__("./node_modules/d3-timer/index.js"); var defaultTiming = { time: null, // Set on use. delay: 0, duration: 250, ease: __WEBPACK_IMPORTED_MODULE_2_d3_ease__["a" /* easeCubicInOut */] }; function inherit(node, id) { var timing; while (!(timing = node.__transition) || !(timing = timing[id])) { if (!(node = node.parentNode)) { return defaultTiming.time = Object(__WEBPACK_IMPORTED_MODULE_3_d3_timer__["a" /* now */])(), defaultTiming; } } return timing; } /* harmony default export */ __webpack_exports__["a"] = (function(name) { var id, timing; if (name instanceof __WEBPACK_IMPORTED_MODULE_0__transition_index__["a" /* Transition */]) { id = name._id, name = name._name; } else { id = Object(__WEBPACK_IMPORTED_MODULE_0__transition_index__["b" /* newId */])(), (timing = defaultTiming).time = Object(__WEBPACK_IMPORTED_MODULE_3_d3_timer__["a" /* now */])(), name = name == null ? null : name + ""; } for (var groups = this._groups, m = groups.length, j = 0; j < m; ++j) { for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) { if (node = group[i]) { Object(__WEBPACK_IMPORTED_MODULE_1__transition_schedule__["e" /* default */])(node, name, id, i, group, timing || inherit(node, id)); } } } return new __WEBPACK_IMPORTED_MODULE_0__transition_index__["a" /* Transition */](groups, this._parents, name, id); }); /***/ }), /***/ "./node_modules/d3-transition/src/transition/attr.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_d3_interpolate__ = __webpack_require__("./node_modules/d3-interpolate/index.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_d3_selection__ = __webpack_require__("./node_modules/d3-selection/index.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__tween__ = __webpack_require__("./node_modules/d3-transition/src/transition/tween.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__interpolate__ = __webpack_require__("./node_modules/d3-transition/src/transition/interpolate.js"); function attrRemove(name) { return function() { this.removeAttribute(name); }; } function attrRemoveNS(fullname) { return function() { this.removeAttributeNS(fullname.space, fullname.local); }; } function attrConstant(name, interpolate, value1) { var value00, interpolate0; return function() { var value0 = this.getAttribute(name); return value0 === value1 ? null : value0 === value00 ? interpolate0 : interpolate0 = interpolate(value00 = value0, value1); }; } function attrConstantNS(fullname, interpolate, value1) { var value00, interpolate0; return function() { var value0 = this.getAttributeNS(fullname.space, fullname.local); return value0 === value1 ? null : value0 === value00 ? interpolate0 : interpolate0 = interpolate(value00 = value0, value1); }; } function attrFunction(name, interpolate, value) { var value00, value10, interpolate0; return function() { var value0, value1 = value(this); if (value1 == null) return void this.removeAttribute(name); value0 = this.getAttribute(name); return value0 === value1 ? null : value0 === value00 && value1 === value10 ? interpolate0 : interpolate0 = interpolate(value00 = value0, value10 = value1); }; } function attrFunctionNS(fullname, interpolate, value) { var value00, value10, interpolate0; return function() { var value0, value1 = value(this); if (value1 == null) return void this.removeAttributeNS(fullname.space, fullname.local); value0 = this.getAttributeNS(fullname.space, fullname.local); return value0 === value1 ? null : value0 === value00 && value1 === value10 ? interpolate0 : interpolate0 = interpolate(value00 = value0, value10 = value1); }; } /* harmony default export */ __webpack_exports__["a"] = (function(name, value) { var fullname = Object(__WEBPACK_IMPORTED_MODULE_1_d3_selection__["namespace"])(name), i = fullname === "transform" ? __WEBPACK_IMPORTED_MODULE_0_d3_interpolate__["interpolateTransformSvg"] : __WEBPACK_IMPORTED_MODULE_3__interpolate__["a" /* default */]; return this.attrTween(name, typeof value === "function" ? (fullname.local ? attrFunctionNS : attrFunction)(fullname, i, Object(__WEBPACK_IMPORTED_MODULE_2__tween__["b" /* tweenValue */])(this, "attr." + name, value)) : value == null ? (fullname.local ? attrRemoveNS : attrRemove)(fullname) : (fullname.local ? attrConstantNS : attrConstant)(fullname, i, value + "")); }); /***/ }), /***/ "./node_modules/d3-transition/src/transition/attrTween.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_d3_selection__ = __webpack_require__("./node_modules/d3-selection/index.js"); function attrTweenNS(fullname, value) { function tween() { var node = this, i = value.apply(node, arguments); return i && function(t) { node.setAttributeNS(fullname.space, fullname.local, i(t)); }; } tween._value = value; return tween; } function attrTween(name, value) { function tween() { var node = this, i = value.apply(node, arguments); return i && function(t) { node.setAttribute(name, i(t)); }; } tween._value = value; return tween; } /* harmony default export */ __webpack_exports__["a"] = (function(name, value) { var key = "attr." + name; if (arguments.length < 2) return (key = this.tween(key)) && key._value; if (value == null) return this.tween(key, null); if (typeof value !== "function") throw new Error; var fullname = Object(__WEBPACK_IMPORTED_MODULE_0_d3_selection__["namespace"])(name); return this.tween(key, (fullname.local ? attrTweenNS : attrTween)(fullname, value)); }); /***/ }), /***/ "./node_modules/d3-transition/src/transition/delay.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__schedule__ = __webpack_require__("./node_modules/d3-transition/src/transition/schedule.js"); function delayFunction(id, value) { return function() { Object(__WEBPACK_IMPORTED_MODULE_0__schedule__["g" /* init */])(this, id).delay = +value.apply(this, arguments); }; } function delayConstant(id, value) { return value = +value, function() { Object(__WEBPACK_IMPORTED_MODULE_0__schedule__["g" /* init */])(this, id).delay = value; }; } /* harmony default export */ __webpack_exports__["a"] = (function(value) { var id = this._id; return arguments.length ? this.each((typeof value === "function" ? delayFunction : delayConstant)(id, value)) : Object(__WEBPACK_IMPORTED_MODULE_0__schedule__["f" /* get */])(this.node(), id).delay; }); /***/ }), /***/ "./node_modules/d3-transition/src/transition/duration.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__schedule__ = __webpack_require__("./node_modules/d3-transition/src/transition/schedule.js"); function durationFunction(id, value) { return function() { Object(__WEBPACK_IMPORTED_MODULE_0__schedule__["h" /* set */])(this, id).duration = +value.apply(this, arguments); }; } function durationConstant(id, value) { return value = +value, function() { Object(__WEBPACK_IMPORTED_MODULE_0__schedule__["h" /* set */])(this, id).duration = value; }; } /* harmony default export */ __webpack_exports__["a"] = (function(value) { var id = this._id; return arguments.length ? this.each((typeof value === "function" ? durationFunction : durationConstant)(id, value)) : Object(__WEBPACK_IMPORTED_MODULE_0__schedule__["f" /* get */])(this.node(), id).duration; }); /***/ }), /***/ "./node_modules/d3-transition/src/transition/ease.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__schedule__ = __webpack_require__("./node_modules/d3-transition/src/transition/schedule.js"); function easeConstant(id, value) { if (typeof value !== "function") throw new Error; return function() { Object(__WEBPACK_IMPORTED_MODULE_0__schedule__["h" /* set */])(this, id).ease = value; }; } /* harmony default export */ __webpack_exports__["a"] = (function(value) { var id = this._id; return arguments.length ? this.each(easeConstant(id, value)) : Object(__WEBPACK_IMPORTED_MODULE_0__schedule__["f" /* get */])(this.node(), id).ease; }); /***/ }), /***/ "./node_modules/d3-transition/src/transition/filter.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_d3_selection__ = __webpack_require__("./node_modules/d3-selection/index.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__index__ = __webpack_require__("./node_modules/d3-transition/src/transition/index.js"); /* harmony default export */ __webpack_exports__["a"] = (function(match) { if (typeof match !== "function") match = Object(__WEBPACK_IMPORTED_MODULE_0_d3_selection__["matcher"])(match); for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) { for (var group = groups[j], n = group.length, subgroup = subgroups[j] = [], node, i = 0; i < n; ++i) { if ((node = group[i]) && match.call(node, node.__data__, i, group)) { subgroup.push(node); } } } return new __WEBPACK_IMPORTED_MODULE_1__index__["a" /* Transition */](subgroups, this._parents, this._name, this._id); }); /***/ }), /***/ "./node_modules/d3-transition/src/transition/index.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = Transition; /* unused harmony export default */ /* harmony export (immutable) */ __webpack_exports__["b"] = newId; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_d3_selection__ = __webpack_require__("./node_modules/d3-selection/index.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__attr__ = __webpack_require__("./node_modules/d3-transition/src/transition/attr.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__attrTween__ = __webpack_require__("./node_modules/d3-transition/src/transition/attrTween.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__delay__ = __webpack_require__("./node_modules/d3-transition/src/transition/delay.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__duration__ = __webpack_require__("./node_modules/d3-transition/src/transition/duration.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__ease__ = __webpack_require__("./node_modules/d3-transition/src/transition/ease.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__filter__ = __webpack_require__("./node_modules/d3-transition/src/transition/filter.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__merge__ = __webpack_require__("./node_modules/d3-transition/src/transition/merge.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__on__ = __webpack_require__("./node_modules/d3-transition/src/transition/on.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__remove__ = __webpack_require__("./node_modules/d3-transition/src/transition/remove.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__select__ = __webpack_require__("./node_modules/d3-transition/src/transition/select.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__selectAll__ = __webpack_require__("./node_modules/d3-transition/src/transition/selectAll.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__selection__ = __webpack_require__("./node_modules/d3-transition/src/transition/selection.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__style__ = __webpack_require__("./node_modules/d3-transition/src/transition/style.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__styleTween__ = __webpack_require__("./node_modules/d3-transition/src/transition/styleTween.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__text__ = __webpack_require__("./node_modules/d3-transition/src/transition/text.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__transition__ = __webpack_require__("./node_modules/d3-transition/src/transition/transition.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_17__tween__ = __webpack_require__("./node_modules/d3-transition/src/transition/tween.js"); var id = 0; function Transition(groups, parents, name, id) { this._groups = groups; this._parents = parents; this._name = name; this._id = id; } function transition(name) { return Object(__WEBPACK_IMPORTED_MODULE_0_d3_selection__["selection"])().transition(name); } function newId() { return ++id; } var selection_prototype = __WEBPACK_IMPORTED_MODULE_0_d3_selection__["selection"].prototype; Transition.prototype = transition.prototype = { constructor: Transition, select: __WEBPACK_IMPORTED_MODULE_10__select__["a" /* default */], selectAll: __WEBPACK_IMPORTED_MODULE_11__selectAll__["a" /* default */], filter: __WEBPACK_IMPORTED_MODULE_6__filter__["a" /* default */], merge: __WEBPACK_IMPORTED_MODULE_7__merge__["a" /* default */], selection: __WEBPACK_IMPORTED_MODULE_12__selection__["a" /* default */], transition: __WEBPACK_IMPORTED_MODULE_16__transition__["a" /* default */], call: selection_prototype.call, nodes: selection_prototype.nodes, node: selection_prototype.node, size: selection_prototype.size, empty: selection_prototype.empty, each: selection_prototype.each, on: __WEBPACK_IMPORTED_MODULE_8__on__["a" /* default */], attr: __WEBPACK_IMPORTED_MODULE_1__attr__["a" /* default */], attrTween: __WEBPACK_IMPORTED_MODULE_2__attrTween__["a" /* default */], style: __WEBPACK_IMPORTED_MODULE_13__style__["a" /* default */], styleTween: __WEBPACK_IMPORTED_MODULE_14__styleTween__["a" /* default */], text: __WEBPACK_IMPORTED_MODULE_15__text__["a" /* default */], remove: __WEBPACK_IMPORTED_MODULE_9__remove__["a" /* default */], tween: __WEBPACK_IMPORTED_MODULE_17__tween__["a" /* default */], delay: __WEBPACK_IMPORTED_MODULE_3__delay__["a" /* default */], duration: __WEBPACK_IMPORTED_MODULE_4__duration__["a" /* default */], ease: __WEBPACK_IMPORTED_MODULE_5__ease__["a" /* default */] }; /***/ }), /***/ "./node_modules/d3-transition/src/transition/interpolate.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_d3_color__ = __webpack_require__("./node_modules/d3-color/index.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_d3_interpolate__ = __webpack_require__("./node_modules/d3-interpolate/index.js"); /* harmony default export */ __webpack_exports__["a"] = (function(a, b) { var c; return (typeof b === "number" ? __WEBPACK_IMPORTED_MODULE_1_d3_interpolate__["interpolateNumber"] : b instanceof __WEBPACK_IMPORTED_MODULE_0_d3_color__["color"] ? __WEBPACK_IMPORTED_MODULE_1_d3_interpolate__["interpolateRgb"] : (c = Object(__WEBPACK_IMPORTED_MODULE_0_d3_color__["color"])(b)) ? (b = c, __WEBPACK_IMPORTED_MODULE_1_d3_interpolate__["interpolateRgb"]) : __WEBPACK_IMPORTED_MODULE_1_d3_interpolate__["interpolateString"])(a, b); }); /***/ }), /***/ "./node_modules/d3-transition/src/transition/merge.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__index__ = __webpack_require__("./node_modules/d3-transition/src/transition/index.js"); /* harmony default export */ __webpack_exports__["a"] = (function(transition) { if (transition._id !== this._id) throw new Error; for (var groups0 = this._groups, groups1 = transition._groups, m0 = groups0.length, m1 = groups1.length, m = Math.min(m0, m1), merges = new Array(m0), j = 0; j < m; ++j) { for (var group0 = groups0[j], group1 = groups1[j], n = group0.length, merge = merges[j] = new Array(n), node, i = 0; i < n; ++i) { if (node = group0[i] || group1[i]) { merge[i] = node; } } } for (; j < m0; ++j) { merges[j] = groups0[j]; } return new __WEBPACK_IMPORTED_MODULE_0__index__["a" /* Transition */](merges, this._parents, this._name, this._id); }); /***/ }), /***/ "./node_modules/d3-transition/src/transition/on.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__schedule__ = __webpack_require__("./node_modules/d3-transition/src/transition/schedule.js"); function start(name) { return (name + "").trim().split(/^|\s+/).every(function(t) { var i = t.indexOf("."); if (i >= 0) t = t.slice(0, i); return !t || t === "start"; }); } function onFunction(id, name, listener) { var on0, on1, sit = start(name) ? __WEBPACK_IMPORTED_MODULE_0__schedule__["g" /* init */] : __WEBPACK_IMPORTED_MODULE_0__schedule__["h" /* set */]; return function() { var schedule = sit(this, id), on = schedule.on; // If this node shared a dispatch with the previous node, // just assign the updated shared dispatch and we’re done! // Otherwise, copy-on-write. if (on !== on0) (on1 = (on0 = on).copy()).on(name, listener); schedule.on = on1; }; } /* harmony default export */ __webpack_exports__["a"] = (function(name, listener) { var id = this._id; return arguments.length < 2 ? Object(__WEBPACK_IMPORTED_MODULE_0__schedule__["f" /* get */])(this.node(), id).on.on(name) : this.each(onFunction(id, name, listener)); }); /***/ }), /***/ "./node_modules/d3-transition/src/transition/remove.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; function removeFunction(id) { return function() { var parent = this.parentNode; for (var i in this.__transition) if (+i !== id) return; if (parent) parent.removeChild(this); }; } /* harmony default export */ __webpack_exports__["a"] = (function() { return this.on("end.remove", removeFunction(this._id)); }); /***/ }), /***/ "./node_modules/d3-transition/src/transition/schedule.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export CREATED */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return SCHEDULED; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return STARTING; }); /* unused harmony export STARTED */ /* unused harmony export RUNNING */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return ENDING; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ENDED; }); /* harmony export (immutable) */ __webpack_exports__["g"] = init; /* harmony export (immutable) */ __webpack_exports__["h"] = set; /* harmony export (immutable) */ __webpack_exports__["f"] = get; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_d3_dispatch__ = __webpack_require__("./node_modules/d3-dispatch/index.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_d3_timer__ = __webpack_require__("./node_modules/d3-timer/index.js"); var emptyOn = Object(__WEBPACK_IMPORTED_MODULE_0_d3_dispatch__["a" /* dispatch */])("start", "end", "interrupt"); var emptyTween = []; var CREATED = 0; var SCHEDULED = 1; var STARTING = 2; var STARTED = 3; var RUNNING = 4; var ENDING = 5; var ENDED = 6; /* harmony default export */ __webpack_exports__["e"] = (function(node, name, id, index, group, timing) { var schedules = node.__transition; if (!schedules) node.__transition = {}; else if (id in schedules) return; create(node, id, { name: name, index: index, // For context during callback. group: group, // For context during callback. on: emptyOn, tween: emptyTween, time: timing.time, delay: timing.delay, duration: timing.duration, ease: timing.ease, timer: null, state: CREATED }); }); function init(node, id) { var schedule = get(node, id); if (schedule.state > CREATED) throw new Error("too late; already scheduled"); return schedule; } function set(node, id) { var schedule = get(node, id); if (schedule.state > STARTING) throw new Error("too late; already started"); return schedule; } function get(node, id) { var schedule = node.__transition; if (!schedule || !(schedule = schedule[id])) throw new Error("transition not found"); return schedule; } function create(node, id, self) { var schedules = node.__transition, tween; // Initialize the self timer when the transition is created. // Note the actual delay is not known until the first callback! schedules[id] = self; self.timer = Object(__WEBPACK_IMPORTED_MODULE_1_d3_timer__["c" /* timer */])(schedule, 0, self.time); function schedule(elapsed) { self.state = SCHEDULED; self.timer.restart(start, self.delay, self.time); // If the elapsed delay is less than our first sleep, start immediately. if (self.delay <= elapsed) start(elapsed - self.delay); } function start(elapsed) { var i, j, n, o; // If the state is not SCHEDULED, then we previously errored on start. if (self.state !== SCHEDULED) return stop(); for (i in schedules) { o = schedules[i]; if (o.name !== self.name) continue; // While this element already has a starting transition during this frame, // defer starting an interrupting transition until that transition has a // chance to tick (and possibly end); see d3/d3-transition#54! if (o.state === STARTED) return Object(__WEBPACK_IMPORTED_MODULE_1_d3_timer__["b" /* timeout */])(start); // Interrupt the active transition, if any. // Dispatch the interrupt event. if (o.state === RUNNING) { o.state = ENDED; o.timer.stop(); o.on.call("interrupt", node, node.__data__, o.index, o.group); delete schedules[i]; } // Cancel any pre-empted transitions. No interrupt event is dispatched // because the cancelled transitions never started. Note that this also // removes this transition from the pending list! else if (+i < id) { o.state = ENDED; o.timer.stop(); delete schedules[i]; } } // Defer the first tick to end of the current frame; see d3/d3#1576. // Note the transition may be canceled after start and before the first tick! // Note this must be scheduled before the start event; see d3/d3-transition#16! // Assuming this is successful, subsequent callbacks go straight to tick. Object(__WEBPACK_IMPORTED_MODULE_1_d3_timer__["b" /* timeout */])(function() { if (self.state === STARTED) { self.state = RUNNING; self.timer.restart(tick, self.delay, self.time); tick(elapsed); } }); // Dispatch the start event. // Note this must be done before the tween are initialized. self.state = STARTING; self.on.call("start", node, node.__data__, self.index, self.group); if (self.state !== STARTING) return; // interrupted self.state = STARTED; // Initialize the tween, deleting null tween. tween = new Array(n = self.tween.length); for (i = 0, j = -1; i < n; ++i) { if (o = self.tween[i].value.call(node, node.__data__, self.index, self.group)) { tween[++j] = o; } } tween.length = j + 1; } function tick(elapsed) { var t = elapsed < self.duration ? self.ease.call(null, elapsed / self.duration) : (self.timer.restart(stop), self.state = ENDING, 1), i = -1, n = tween.length; while (++i < n) { tween[i].call(null, t); } // Dispatch the end event. if (self.state === ENDING) { self.on.call("end", node, node.__data__, self.index, self.group); stop(); } } function stop() { self.state = ENDED; self.timer.stop(); delete schedules[id]; for (var i in schedules) return; // eslint-disable-line no-unused-vars delete node.__transition; } } /***/ }), /***/ "./node_modules/d3-transition/src/transition/select.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_d3_selection__ = __webpack_require__("./node_modules/d3-selection/index.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__index__ = __webpack_require__("./node_modules/d3-transition/src/transition/index.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__schedule__ = __webpack_require__("./node_modules/d3-transition/src/transition/schedule.js"); /* harmony default export */ __webpack_exports__["a"] = (function(select) { var name = this._name, id = this._id; if (typeof select !== "function") select = Object(__WEBPACK_IMPORTED_MODULE_0_d3_selection__["selector"])(select); for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) { for (var group = groups[j], n = group.length, subgroup = subgroups[j] = new Array(n), node, subnode, i = 0; i < n; ++i) { if ((node = group[i]) && (subnode = select.call(node, node.__data__, i, group))) { if ("__data__" in node) subnode.__data__ = node.__data__; subgroup[i] = subnode; Object(__WEBPACK_IMPORTED_MODULE_2__schedule__["e" /* default */])(subgroup[i], name, id, i, subgroup, Object(__WEBPACK_IMPORTED_MODULE_2__schedule__["f" /* get */])(node, id)); } } } return new __WEBPACK_IMPORTED_MODULE_1__index__["a" /* Transition */](subgroups, this._parents, name, id); }); /***/ }), /***/ "./node_modules/d3-transition/src/transition/selectAll.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_d3_selection__ = __webpack_require__("./node_modules/d3-selection/index.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__index__ = __webpack_require__("./node_modules/d3-transition/src/transition/index.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__schedule__ = __webpack_require__("./node_modules/d3-transition/src/transition/schedule.js"); /* harmony default export */ __webpack_exports__["a"] = (function(select) { var name = this._name, id = this._id; if (typeof select !== "function") select = Object(__WEBPACK_IMPORTED_MODULE_0_d3_selection__["selectorAll"])(select); for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j = 0; j < m; ++j) { for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) { if (node = group[i]) { for (var children = select.call(node, node.__data__, i, group), child, inherit = Object(__WEBPACK_IMPORTED_MODULE_2__schedule__["f" /* get */])(node, id), k = 0, l = children.length; k < l; ++k) { if (child = children[k]) { Object(__WEBPACK_IMPORTED_MODULE_2__schedule__["e" /* default */])(child, name, id, k, children, inherit); } } subgroups.push(children); parents.push(node); } } } return new __WEBPACK_IMPORTED_MODULE_1__index__["a" /* Transition */](subgroups, parents, name, id); }); /***/ }), /***/ "./node_modules/d3-transition/src/transition/selection.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_d3_selection__ = __webpack_require__("./node_modules/d3-selection/index.js"); var Selection = __WEBPACK_IMPORTED_MODULE_0_d3_selection__["selection"].prototype.constructor; /* harmony default export */ __webpack_exports__["a"] = (function() { return new Selection(this._groups, this._parents); }); /***/ }), /***/ "./node_modules/d3-transition/src/transition/style.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_d3_interpolate__ = __webpack_require__("./node_modules/d3-interpolate/index.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_d3_selection__ = __webpack_require__("./node_modules/d3-selection/index.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__tween__ = __webpack_require__("./node_modules/d3-transition/src/transition/tween.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__interpolate__ = __webpack_require__("./node_modules/d3-transition/src/transition/interpolate.js"); function styleRemove(name, interpolate) { var value00, value10, interpolate0; return function() { var value0 = Object(__WEBPACK_IMPORTED_MODULE_1_d3_selection__["style"])(this, name), value1 = (this.style.removeProperty(name), Object(__WEBPACK_IMPORTED_MODULE_1_d3_selection__["style"])(this, name)); return value0 === value1 ? null : value0 === value00 && value1 === value10 ? interpolate0 : interpolate0 = interpolate(value00 = value0, value10 = value1); }; } function styleRemoveEnd(name) { return function() { this.style.removeProperty(name); }; } function styleConstant(name, interpolate, value1) { var value00, interpolate0; return function() { var value0 = Object(__WEBPACK_IMPORTED_MODULE_1_d3_selection__["style"])(this, name); return value0 === value1 ? null : value0 === value00 ? interpolate0 : interpolate0 = interpolate(value00 = value0, value1); }; } function styleFunction(name, interpolate, value) { var value00, value10, interpolate0; return function() { var value0 = Object(__WEBPACK_IMPORTED_MODULE_1_d3_selection__["style"])(this, name), value1 = value(this); if (value1 == null) value1 = (this.style.removeProperty(name), Object(__WEBPACK_IMPORTED_MODULE_1_d3_selection__["style"])(this, name)); return value0 === value1 ? null : value0 === value00 && value1 === value10 ? interpolate0 : interpolate0 = interpolate(value00 = value0, value10 = value1); }; } /* harmony default export */ __webpack_exports__["a"] = (function(name, value, priority) { var i = (name += "") === "transform" ? __WEBPACK_IMPORTED_MODULE_0_d3_interpolate__["interpolateTransformCss"] : __WEBPACK_IMPORTED_MODULE_3__interpolate__["a" /* default */]; return value == null ? this .styleTween(name, styleRemove(name, i)) .on("end.style." + name, styleRemoveEnd(name)) : this.styleTween(name, typeof value === "function" ? styleFunction(name, i, Object(__WEBPACK_IMPORTED_MODULE_2__tween__["b" /* tweenValue */])(this, "style." + name, value)) : styleConstant(name, i, value + ""), priority); }); /***/ }), /***/ "./node_modules/d3-transition/src/transition/styleTween.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; function styleTween(name, value, priority) { function tween() { var node = this, i = value.apply(node, arguments); return i && function(t) { node.style.setProperty(name, i(t), priority); }; } tween._value = value; return tween; } /* harmony default export */ __webpack_exports__["a"] = (function(name, value, priority) { var key = "style." + (name += ""); if (arguments.length < 2) return (key = this.tween(key)) && key._value; if (value == null) return this.tween(key, null); if (typeof value !== "function") throw new Error; return this.tween(key, styleTween(name, value, priority == null ? "" : priority)); }); /***/ }), /***/ "./node_modules/d3-transition/src/transition/text.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tween__ = __webpack_require__("./node_modules/d3-transition/src/transition/tween.js"); function textConstant(value) { return function() { this.textContent = value; }; } function textFunction(value) { return function() { var value1 = value(this); this.textContent = value1 == null ? "" : value1; }; } /* harmony default export */ __webpack_exports__["a"] = (function(value) { return this.tween("text", typeof value === "function" ? textFunction(Object(__WEBPACK_IMPORTED_MODULE_0__tween__["b" /* tweenValue */])(this, "text", value)) : textConstant(value == null ? "" : value + "")); }); /***/ }), /***/ "./node_modules/d3-transition/src/transition/transition.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__index__ = __webpack_require__("./node_modules/d3-transition/src/transition/index.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__schedule__ = __webpack_require__("./node_modules/d3-transition/src/transition/schedule.js"); /* harmony default export */ __webpack_exports__["a"] = (function() { var name = this._name, id0 = this._id, id1 = Object(__WEBPACK_IMPORTED_MODULE_0__index__["b" /* newId */])(); for (var groups = this._groups, m = groups.length, j = 0; j < m; ++j) { for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) { if (node = group[i]) { var inherit = Object(__WEBPACK_IMPORTED_MODULE_1__schedule__["f" /* get */])(node, id0); Object(__WEBPACK_IMPORTED_MODULE_1__schedule__["e" /* default */])(node, name, id1, i, group, { time: inherit.time + inherit.delay + inherit.duration, delay: 0, duration: inherit.duration, ease: inherit.ease }); } } } return new __WEBPACK_IMPORTED_MODULE_0__index__["a" /* Transition */](groups, this._parents, name, id1); }); /***/ }), /***/ "./node_modules/d3-transition/src/transition/tween.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["b"] = tweenValue; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__schedule__ = __webpack_require__("./node_modules/d3-transition/src/transition/schedule.js"); function tweenRemove(id, name) { var tween0, tween1; return function() { var schedule = Object(__WEBPACK_IMPORTED_MODULE_0__schedule__["h" /* set */])(this, id), tween = schedule.tween; // If this node shared tween with the previous node, // just assign the updated shared tween and we’re done! // Otherwise, copy-on-write. if (tween !== tween0) { tween1 = tween0 = tween; for (var i = 0, n = tween1.length; i < n; ++i) { if (tween1[i].name === name) { tween1 = tween1.slice(); tween1.splice(i, 1); break; } } } schedule.tween = tween1; }; } function tweenFunction(id, name, value) { var tween0, tween1; if (typeof value !== "function") throw new Error; return function() { var schedule = Object(__WEBPACK_IMPORTED_MODULE_0__schedule__["h" /* set */])(this, id), tween = schedule.tween; // If this node shared tween with the previous node, // just assign the updated shared tween and we’re done! // Otherwise, copy-on-write. if (tween !== tween0) { tween1 = (tween0 = tween).slice(); for (var t = {name: name, value: value}, i = 0, n = tween1.length; i < n; ++i) { if (tween1[i].name === name) { tween1[i] = t; break; } } if (i === n) tween1.push(t); } schedule.tween = tween1; }; } /* harmony default export */ __webpack_exports__["a"] = (function(name, value) { var id = this._id; name += ""; if (arguments.length < 2) { var tween = Object(__WEBPACK_IMPORTED_MODULE_0__schedule__["f" /* get */])(this.node(), id).tween; for (var i = 0, n = tween.length, t; i < n; ++i) { if ((t = tween[i]).name === name) { return t.value; } } return null; } return this.each((value == null ? tweenRemove : tweenFunction)(id, name, value)); }); function tweenValue(transition, name, value) { var id = transition._id; transition.each(function() { var schedule = Object(__WEBPACK_IMPORTED_MODULE_0__schedule__["h" /* set */])(this, id); (schedule.value || (schedule.value = {}))[name] = value.apply(this, arguments); }); return function(node) { return Object(__WEBPACK_IMPORTED_MODULE_0__schedule__["f" /* get */])(node, id).value[name]; }; } /***/ }), /***/ "./node_modules/devextreme-angular/core/component.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var events_strategy_1 = __webpack_require__("./node_modules/devextreme-angular/core/events-strategy.js"); var events = __webpack_require__("./node_modules/devextreme/events.js"); var utils_1 = __webpack_require__("./node_modules/devextreme-angular/core/utils.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var DxComponent = (function () { function DxComponent(element, ngZone, templateHost, watcherHelper) { this.element = element; this.ngZone = ngZone; this.watcherHelper = watcherHelper; this._initialOptions = {}; this._optionsToUpdate = {}; this.isLinked = true; this.changedOptions = {}; this.renderOnViewInit = true; this.widgetUpdateLocked = false; this.templates = []; templateHost.setHost(this); this._collectionContainerImpl = new nested_option_1.CollectionNestedOptionContainerImpl(this._setOption.bind(this)); this.eventHelper = new events_strategy_1.EmitterHelper(this.ngZone, this); } DxComponent.prototype._initTemplates = function () { if (this.templates.length) { var initialTemplates_1 = {}; this.templates.forEach(function (template) { initialTemplates_1[template.name] = template; }); this._initialOptions.integrationOptions.templates = initialTemplates_1; } }; DxComponent.prototype._initOptions = function () { this._initialOptions.eventsStrategy = this.eventHelper.strategy; this._initialOptions.integrationOptions.watchMethod = this.watcherHelper.getWatchMethod(); }; DxComponent.prototype._createEventEmitters = function (events) { var _this = this; events.forEach(function (event) { _this.eventHelper.createEmitter(event.emit, event.subscribe); }); }; DxComponent.prototype._shouldOptionChange = function (name, value) { if (this.changedOptions.hasOwnProperty(name)) { var prevValue = this.changedOptions[name]; delete this.changedOptions[name]; return value !== prevValue; } return true; }; DxComponent.prototype.clearChangedOptions = function () { this.changedOptions = {}; }; DxComponent.prototype._getOption = function (name) { return this.instance ? this.instance.option(name) : this._initialOptions[name]; }; DxComponent.prototype.lockWidgetUpdate = function () { if (!this.widgetUpdateLocked && this.instance) { this.instance.beginUpdate(); this.widgetUpdateLocked = true; } }; DxComponent.prototype._setOption = function (name, value) { this.lockWidgetUpdate(); if (!this._shouldOptionChange(name, value)) { return; } if (this.instance) { this.instance.option(name, value); } else { this._initialOptions[name] = value; } }; DxComponent.prototype._createWidget = function (element) { var _this = this; this._initialOptions.integrationOptions = {}; this._initTemplates(); this._initOptions(); var optionChangeHandler = function (e) { _this.eventHelper.rememberEvent(e.name); }; this._initialOptions.onInitializing = function () { this.on('optionChanged', optionChangeHandler); }; this.instance = this._createInstance(element, this._initialOptions); this._initialOptions = {}; this.instance.off('optionChanged', optionChangeHandler); this.instance.on('optionChanged', function (e) { _this.changedOptions[e.name] = e.value; _this.eventHelper.fireNgEvent(e.name + 'Change', [e.value]); }); }; DxComponent.prototype._destroyWidget = function () { if (this.instance) { var element = this.instance.element(); events.triggerHandler(element, { type: 'dxremove', _angularIntegration: true }); this.instance.dispose(); utils_1.removeElement(element); } }; DxComponent.prototype.ngAfterViewInit = function () { if (this.renderOnViewInit) { this._createWidget(this.element.nativeElement); } }; DxComponent.prototype.ngAfterContentChecked = function () { this.applyOptions(); if (this.widgetUpdateLocked) { this.widgetUpdateLocked = false; this.instance.endUpdate(); } }; DxComponent.prototype.ngOnChanges = function (changes) { for (var key in changes) { var change = changes[key]; if (change.currentValue !== this[key]) { this._optionsToUpdate[key] = changes[key].currentValue; } } }; DxComponent.prototype.ngDoCheck = function () { this.applyOptions(); }; DxComponent.prototype.applyOptions = function () { if (Object.keys(this._optionsToUpdate).length) { if (this.instance) { this.instance.option(this._optionsToUpdate); } this._optionsToUpdate = {}; } }; DxComponent.prototype.setTemplate = function (template) { this.templates.push(template); }; DxComponent.prototype.setChildren = function (propertyName, items) { return this._collectionContainerImpl.setChildren(propertyName, items); }; return DxComponent; }()); exports.DxComponent = DxComponent; var DxComponentExtension = (function (_super) { __extends(DxComponentExtension, _super); function DxComponentExtension() { return _super !== null && _super.apply(this, arguments) || this; } DxComponentExtension.prototype.createInstance = function (element) { this._createWidget(element); }; return DxComponentExtension; }(DxComponent)); exports.DxComponentExtension = DxComponentExtension; //# sourceMappingURL=component.js.map /***/ }), /***/ "./node_modules/devextreme-angular/core/events-strategy.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var dxToNgEventNames = {}; var NgEventsStrategy = (function () { function NgEventsStrategy(component, ngZone) { this.component = component; this.ngZone = ngZone; this.subscriptions = {}; } NgEventsStrategy.prototype.hasEvent = function (name) { return this.getEmitter(name).observers.length; }; NgEventsStrategy.prototype.fireEvent = function (name, args) { var _this = this; this.ngZone.run(function () { _this.getEmitter(name).next(args && args[0]); }); }; NgEventsStrategy.prototype.on = function (name, handler) { var eventSubscriptions = this.subscriptions[name] || [], subcription = this.getEmitter(name).subscribe(handler.bind(this.component.instance)), unsubscribe = subcription.unsubscribe.bind(subcription); eventSubscriptions.push({ handler: handler, unsubscribe: unsubscribe }); this.subscriptions[name] = eventSubscriptions; }; NgEventsStrategy.prototype.off = function (name, handler) { var eventSubscriptions = this.subscriptions[name] || []; if (handler) { eventSubscriptions.some(function (subscription, i) { if (subscription.handler === handler) { subscription.unsubscribe(); eventSubscriptions.splice(i, 1); return true; } }); } else { eventSubscriptions.forEach(function (subscription) { subscription.unsubscribe(); }); eventSubscriptions.splice(0, eventSubscriptions.length); } }; NgEventsStrategy.prototype.dispose = function () { }; NgEventsStrategy.prototype.getEmitter = function (eventName) { var ngEventName = dxToNgEventNames[eventName]; if (!this.component[ngEventName]) { this.component[ngEventName] = new core_1.EventEmitter(); } return this.component[ngEventName]; }; return NgEventsStrategy; }()); exports.NgEventsStrategy = NgEventsStrategy; var events = []; var onStableSubscription = null; var createOnStableSubscription = function (ngZone, fireNgEvent) { if (onStableSubscription) { return; } onStableSubscription = ngZone.onStable.subscribe(function () { onStableSubscription.unsubscribe(); onStableSubscription = null; ngZone.run(function () { events.forEach(function (event) { var value = event.context.component[event.name]; fireNgEvent.call(event.context, event.name + 'Change', [value]); }); }); events = []; }); }; var EmitterHelper = (function () { function EmitterHelper(ngZone, component) { this.component = component; this.lockedValueChangeEvent = false; this.strategy = new NgEventsStrategy(component, ngZone); createOnStableSubscription(ngZone, this.fireNgEvent); } EmitterHelper.prototype.fireNgEvent = function (eventName, eventArgs) { if (this.lockedValueChangeEvent && eventName === 'valueChange') { return; } var emitter = this.component[eventName]; if (emitter) { emitter.next(eventArgs && eventArgs[0]); } }; EmitterHelper.prototype.createEmitter = function (ngEventName, dxEventName) { this.component[ngEventName] = new core_1.EventEmitter(); if (dxEventName) { dxToNgEventNames[dxEventName] = ngEventName; } }; EmitterHelper.prototype.rememberEvent = function (name) { events.push({ name: name, context: this }); }; return EmitterHelper; }()); exports.EmitterHelper = EmitterHelper; //# sourceMappingURL=events-strategy.js.map /***/ }), /***/ "./node_modules/devextreme-angular/core/iterable-differ-helper.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var IterableDifferHelper = (function () { function IterableDifferHelper(_differs) { this._differs = _differs; this._propertyDiffers = {}; } IterableDifferHelper.prototype.setHost = function (host) { this._host = host; }; IterableDifferHelper.prototype.setup = function (prop, changes) { if (prop in changes) { var value = changes[prop].currentValue; this.setupSingle(prop, value); } }; IterableDifferHelper.prototype.setupSingle = function (prop, value) { if (value && Array.isArray(value)) { if (!this._propertyDiffers[prop]) { try { this._propertyDiffers[prop] = this._differs.find(value).create(null); return true; } catch (e) { } } } else { delete this._propertyDiffers[prop]; } return false; }; IterableDifferHelper.prototype.getChanges = function (prop, value) { if (this._propertyDiffers[prop]) { return this._propertyDiffers[prop].diff(value); } }; IterableDifferHelper.prototype.checkChangedOptions = function (propName, hostValue) { return this._host.changedOptions[propName] === hostValue; }; ; IterableDifferHelper.prototype.doCheck = function (prop) { if (this._propertyDiffers[prop]) { var hostValue = this._host[prop], isChangedOption = this.checkChangedOptions(prop, hostValue); var changes = this.getChanges(prop, hostValue); if (changes && this._host.instance && !isChangedOption) { this._host.lockWidgetUpdate(); this._host.instance.option(prop, hostValue); } } }; IterableDifferHelper.decorators = [ { type: core_1.Injectable }, ]; /** @nocollapse */ IterableDifferHelper.ctorParameters = function () { return [ { type: core_1.IterableDiffers, }, ]; }; return IterableDifferHelper; }()); exports.IterableDifferHelper = IterableDifferHelper; //# sourceMappingURL=iterable-differ-helper.js.map /***/ }), /***/ "./node_modules/devextreme-angular/core/nested-option.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var template_1 = __webpack_require__("./node_modules/devextreme-angular/core/template.js"); var utils_1 = __webpack_require__("./node_modules/devextreme-angular/core/utils.js"); var events = __webpack_require__("./node_modules/devextreme/events.js"); var VISIBILITY_CHANGE_SELECTOR = 'dx-visibility-change-handler'; var BaseNestedOption = (function () { function BaseNestedOption() { this._initialOptions = {}; this._collectionContainerImpl = new CollectionNestedOptionContainerImpl(this._setOption.bind(this), this._filterItems.bind(this)); } BaseNestedOption.prototype._getOption = function (name) { if (this.isLinked) { return this.instance.option(this._fullOptionPath() + name); } else { return this._initialOptions[name]; } }; BaseNestedOption.prototype._setOption = function (name, value) { if (this.isLinked) { this.instance.option(this._fullOptionPath() + name, value); } else { this._initialOptions[name] = value; } }; BaseNestedOption.prototype.setHost = function (host, optionPath) { this._host = host; this._hostOptionPath = optionPath; }; BaseNestedOption.prototype.setChildren = function (propertyName, items) { return this._collectionContainerImpl.setChildren(propertyName, items); }; BaseNestedOption.prototype._filterItems = function (items) { var _this = this; return items.filter(function (item) { return item !== _this; }); }; Object.defineProperty(BaseNestedOption.prototype, "instance", { get: function () { return this._host && this._host.instance; }, enumerable: true, configurable: true }); Object.defineProperty(BaseNestedOption.prototype, "isLinked", { get: function () { return !!this.instance && this._host.isLinked; }, enumerable: true, configurable: true }); return BaseNestedOption; }()); exports.BaseNestedOption = BaseNestedOption; var CollectionNestedOptionContainerImpl = (function () { function CollectionNestedOptionContainerImpl(_setOption, _filterItems) { this._setOption = _setOption; this._filterItems = _filterItems; this._activatedQueries = {}; } CollectionNestedOptionContainerImpl.prototype.setChildren = function (propertyName, items) { if (this._filterItems) { items = this._filterItems(items); } if (items.length) { this._activatedQueries[propertyName] = true; } if (this._activatedQueries[propertyName]) { var widgetItems = items.map(function (item, index) { item._index = index; return item._value; }); this._setOption(propertyName, widgetItems); } }; return CollectionNestedOptionContainerImpl; }()); exports.CollectionNestedOptionContainerImpl = CollectionNestedOptionContainerImpl; var NestedOption = (function (_super) { __extends(NestedOption, _super); function NestedOption() { return _super !== null && _super.apply(this, arguments) || this; } NestedOption.prototype.setHost = function (host, optionPath) { _super.prototype.setHost.call(this, host, optionPath); this._host[this._optionPath] = this._initialOptions; }; NestedOption.prototype._fullOptionPath = function () { return this._hostOptionPath() + this._optionPath + '.'; }; return NestedOption; }(BaseNestedOption)); exports.NestedOption = NestedOption; var CollectionNestedOption = (function (_super) { __extends(CollectionNestedOption, _super); function CollectionNestedOption() { return _super !== null && _super.apply(this, arguments) || this; } CollectionNestedOption.prototype._fullOptionPath = function () { return this._hostOptionPath() + this._optionPath + '[' + this._index + ']' + '.'; }; Object.defineProperty(CollectionNestedOption.prototype, "_value", { get: function () { return this._initialOptions; }, enumerable: true, configurable: true }); Object.defineProperty(CollectionNestedOption.prototype, "isLinked", { get: function () { return this._index !== undefined && !!this.instance; }, enumerable: true, configurable: true }); return CollectionNestedOption; }(BaseNestedOption)); exports.CollectionNestedOption = CollectionNestedOption; var triggerShownEvent = function (element) { var changeHandlers = []; if (utils_1.hasClass(element, VISIBILITY_CHANGE_SELECTOR)) { changeHandlers.push(element); } changeHandlers.push.apply(changeHandlers, element.querySelectorAll('.' + VISIBILITY_CHANGE_SELECTOR)); for (var i = 0; i < changeHandlers.length; i++) { events.triggerHandler(changeHandlers[i], 'dxshown'); } }; function extractTemplate(option, element) { if (!option.template === undefined || !element.nativeElement.hasChildNodes()) { return; } var childNodes = [].slice.call(element.nativeElement.childNodes); var userContent = childNodes.filter(function (n) { if (n.tagName) { var tagNamePrefix = n.tagName.toLowerCase().substr(0, 3); return !(tagNamePrefix === 'dxi' || tagNamePrefix === 'dxo'); } else { return n.nodeName !== '#comment' && n.textContent.replace(/\s/g, '').length; } }); if (!userContent.length) { return; } option.template = { render: function (renderData) { var result = element.nativeElement; utils_1.addClass(result, template_1.DX_TEMPLATE_WRAPPER_CLASS); if (renderData.container) { var container = utils_1.getElement(renderData.container); var resultInContainer = container.contains(element.nativeElement); container.appendChild(element.nativeElement); if (!resultInContainer) { var resultInBody = document.body.contains(container); if (resultInBody) { triggerShownEvent(result); } } } return result; } }; } exports.extractTemplate = extractTemplate; var NestedOptionHost = (function () { function NestedOptionHost() { } NestedOptionHost.prototype.setHost = function (host, optionPath) { this._host = host; this._optionPath = optionPath || (function () { return ''; }); }; NestedOptionHost.prototype.setNestedOption = function (nestedOption) { nestedOption.setHost(this._host, this._optionPath); }; return NestedOptionHost; }()); exports.NestedOptionHost = NestedOptionHost; //# sourceMappingURL=nested-option.js.map /***/ }), /***/ "./node_modules/devextreme-angular/core/template-host.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ Object.defineProperty(exports, "__esModule", { value: true }); ; var DxTemplateHost = (function () { function DxTemplateHost() { } DxTemplateHost.prototype.setHost = function (host) { this.host = host; }; DxTemplateHost.prototype.setTemplate = function (template) { this.host.setTemplate(template); }; return DxTemplateHost; }()); exports.DxTemplateHost = DxTemplateHost; //# sourceMappingURL=template-host.js.map /***/ }), /***/ "./node_modules/devextreme-angular/core/template.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ Object.defineProperty(exports, "__esModule", { value: true }); /* tslint:disable:use-input-property-decorator */ var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var template_host_1 = __webpack_require__("./node_modules/devextreme-angular/core/template-host.js"); var utils_1 = __webpack_require__("./node_modules/devextreme-angular/core/utils.js"); var events = __webpack_require__("./node_modules/devextreme/events.js"); exports.DX_TEMPLATE_WRAPPER_CLASS = 'dx-template-wrapper'; var RenderData = (function () { function RenderData() { } return RenderData; }()); exports.RenderData = RenderData; var DxTemplateDirective = (function () { function DxTemplateDirective(templateRef, viewContainerRef, templateHost, ngZone) { this.templateRef = templateRef; this.viewContainerRef = viewContainerRef; this.ngZone = ngZone; templateHost.setTemplate(this); } Object.defineProperty(DxTemplateDirective.prototype, "dxTemplateOf", { set: function (value) { this.name = value; }, enumerable: true, configurable: true }); ; DxTemplateDirective.prototype.render = function (renderData) { var childView = this.viewContainerRef.createEmbeddedView(this.templateRef, { '$implicit': renderData.model, index: renderData.index }); var container = utils_1.getElement(renderData.container); if (renderData.container) { childView.rootNodes.forEach(function (element) { container.appendChild(element); }); } // =========== WORKAROUND ============= // https://github.com/angular/angular/issues/12243 this.ngZone.run(function () { childView['detectChanges'](); }); // =========== /WORKAROUND ============= childView.rootNodes.forEach(function (element) { utils_1.addClass(element, exports.DX_TEMPLATE_WRAPPER_CLASS); events.one(element, 'dxremove', function (e) { if (!e._angularIntegration) { childView.destroy(); } }); }); return childView.rootNodes; }; DxTemplateDirective.decorators = [ { type: core_1.Directive, args: [{ selector: '[dxTemplate]' },] }, ]; /** @nocollapse */ DxTemplateDirective.ctorParameters = function () { return [ { type: core_1.TemplateRef, }, { type: core_1.ViewContainerRef, }, { type: template_host_1.DxTemplateHost, }, { type: core_1.NgZone, }, ]; }; DxTemplateDirective.propDecorators = { 'dxTemplateOf': [{ type: core_1.Input },], }; return DxTemplateDirective; }()); exports.DxTemplateDirective = DxTemplateDirective; var DxTemplateModule = (function () { function DxTemplateModule() { } DxTemplateModule.decorators = [ { type: core_1.NgModule, args: [{ declarations: [DxTemplateDirective], exports: [DxTemplateDirective] },] }, ]; /** @nocollapse */ DxTemplateModule.ctorParameters = function () { return []; }; return DxTemplateModule; }()); exports.DxTemplateModule = DxTemplateModule; //# sourceMappingURL=template.js.map /***/ }), /***/ "./node_modules/devextreme-angular/core/utils.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ Object.defineProperty(exports, "__esModule", { value: true }); function addClass(element, name) { if (element.nodeType === 1) { if (element.classList) { element.classList.add(name); } else { element.className = element.className ? element.className + ' ' + name : name; } } } exports.addClass = addClass; ; function hasClass(element, name) { var result; if (element.classList) { result = element.classList.contains(name); } else { result = element.className.split(' ').indexOf(name) >= 0; } return result; } exports.hasClass = hasClass; ; function getElement(element) { return element.get ? element.get(0) : element; } exports.getElement = getElement; ; function removeElement(element) { var node = getElement(element), parentNode = node && node.parentNode; if (parentNode) { parentNode.removeChild(node); } } exports.removeElement = removeElement; ; //# sourceMappingURL=utils.js.map /***/ }), /***/ "./node_modules/devextreme-angular/core/watcher-helper.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var WatcherHelper = (function () { function WatcherHelper() { this._watchers = []; } WatcherHelper.prototype.getWatchMethod = function () { var _this = this; var watchMethod = function (valueGetter, valueChangeCallback, options) { var oldValue = valueGetter(); options = options || {}; if (!options.skipImmediate) { valueChangeCallback(oldValue); } var watcher = function () { var newValue = valueGetter(); if (_this._isDifferentValues(oldValue, newValue, options.deep)) { valueChangeCallback(newValue); oldValue = newValue; } }; _this._watchers.push(watcher); return function () { var index = _this._watchers.indexOf(watcher); if (index !== -1) { _this._watchers.splice(index, 1); } }; }; return watchMethod; }; WatcherHelper.prototype._isDifferentValues = function (oldValue, newValue, deepCheck) { var comparableNewValue = this._toComparable(newValue); var comparableOldValue = this._toComparable(oldValue); var isObjectValues = comparableNewValue instanceof Object && comparableOldValue instanceof Object; if (deepCheck && isObjectValues) { return this._checkObjectsFields(newValue, oldValue); } return comparableNewValue !== comparableOldValue; }; WatcherHelper.prototype._toComparable = function (value) { if (value instanceof Date) { return value.getTime(); } return value; }; WatcherHelper.prototype._checkObjectsFields = function (checkingFromObject, checkingToObject) { for (var field in checkingFromObject) { var oldValue = this._toComparable(checkingFromObject[field]); var newValue = this._toComparable(checkingToObject[field]); if (newValue !== oldValue) { return true; } } }; WatcherHelper.prototype.checkWatchers = function () { for (var _i = 0, _a = this._watchers; _i < _a.length; _i++) { var watcher = _a[_i]; watcher(); } }; WatcherHelper.decorators = [ { type: core_1.Injectable }, ]; /** @nocollapse */ WatcherHelper.ctorParameters = function () { return []; }; return WatcherHelper; }()); exports.WatcherHelper = WatcherHelper; //# sourceMappingURL=watcher-helper.js.map /***/ }), /***/ "./node_modules/devextreme-angular/index.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ function __export(m) { for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; } Object.defineProperty(exports, "__esModule", { value: true }); __export(__webpack_require__("./node_modules/devextreme-angular/core/component.js")); __export(__webpack_require__("./node_modules/devextreme-angular/core/events-strategy.js")); __export(__webpack_require__("./node_modules/devextreme-angular/core/iterable-differ-helper.js")); __export(__webpack_require__("./node_modules/devextreme-angular/core/nested-option.js")); __export(__webpack_require__("./node_modules/devextreme-angular/core/template-host.js")); __export(__webpack_require__("./node_modules/devextreme-angular/core/template.js")); __export(__webpack_require__("./node_modules/devextreme-angular/core/utils.js")); __export(__webpack_require__("./node_modules/devextreme-angular/core/watcher-helper.js")); __export(__webpack_require__("./node_modules/devextreme-angular/ui/accordion.js")); __export(__webpack_require__("./node_modules/devextreme-angular/ui/action-sheet.js")); __export(__webpack_require__("./node_modules/devextreme-angular/ui/all.js")); __export(__webpack_require__("./node_modules/devextreme-angular/ui/autocomplete.js")); __export(__webpack_require__("./node_modules/devextreme-angular/ui/bar-gauge.js")); __export(__webpack_require__("./node_modules/devextreme-angular/ui/box.js")); __export(__webpack_require__("./node_modules/devextreme-angular/ui/bullet.js")); __export(__webpack_require__("./node_modules/devextreme-angular/ui/button.js")); __export(__webpack_require__("./node_modules/devextreme-angular/ui/calendar.js")); __export(__webpack_require__("./node_modules/devextreme-angular/ui/chart.js")); __export(__webpack_require__("./node_modules/devextreme-angular/ui/check-box.js")); __export(__webpack_require__("./node_modules/devextreme-angular/ui/circular-gauge.js")); __export(__webpack_require__("./node_modules/devextreme-angular/ui/color-box.js")); __export(__webpack_require__("./node_modules/devextreme-angular/ui/context-menu.js")); __export(__webpack_require__("./node_modules/devextreme-angular/ui/data-grid.js")); __export(__webpack_require__("./node_modules/devextreme-angular/ui/date-box.js")); __export(__webpack_require__("./node_modules/devextreme-angular/ui/defer-rendering.js")); __export(__webpack_require__("./node_modules/devextreme-angular/ui/drop-down-box.js")); __export(__webpack_require__("./node_modules/devextreme-angular/ui/file-uploader.js")); __export(__webpack_require__("./node_modules/devextreme-angular/ui/filter-builder.js")); __export(__webpack_require__("./node_modules/devextreme-angular/ui/form.js")); __export(__webpack_require__("./node_modules/devextreme-angular/ui/funnel.js")); __export(__webpack_require__("./node_modules/devextreme-angular/ui/gallery.js")); __export(__webpack_require__("./node_modules/devextreme-angular/ui/linear-gauge.js")); __export(__webpack_require__("./node_modules/devextreme-angular/ui/list.js")); __export(__webpack_require__("./node_modules/devextreme-angular/ui/load-indicator.js")); __export(__webpack_require__("./node_modules/devextreme-angular/ui/load-panel.js")); __export(__webpack_require__("./node_modules/devextreme-angular/ui/lookup.js")); __export(__webpack_require__("./node_modules/devextreme-angular/ui/map.js")); __export(__webpack_require__("./node_modules/devextreme-angular/ui/menu.js")); __export(__webpack_require__("./node_modules/devextreme-angular/ui/multi-view.js")); __export(__webpack_require__("./node_modules/devextreme-angular/ui/nav-bar.js")); __export(__webpack_require__("./node_modules/devextreme-angular/ui/number-box.js")); __export(__webpack_require__("./node_modules/devextreme-angular/ui/panorama.js")); __export(__webpack_require__("./node_modules/devextreme-angular/ui/pie-chart.js")); __export(__webpack_require__("./node_modules/devextreme-angular/ui/pivot-grid-field-chooser.js")); __export(__webpack_require__("./node_modules/devextreme-angular/ui/pivot-grid.js")); __export(__webpack_require__("./node_modules/devextreme-angular/ui/pivot.js")); __export(__webpack_require__("./node_modules/devextreme-angular/ui/polar-chart.js")); __export(__webpack_require__("./node_modules/devextreme-angular/ui/popover.js")); __export(__webpack_require__("./node_modules/devextreme-angular/ui/popup.js")); __export(__webpack_require__("./node_modules/devextreme-angular/ui/progress-bar.js")); __export(__webpack_require__("./node_modules/devextreme-angular/ui/radio-group.js")); __export(__webpack_require__("./node_modules/devextreme-angular/ui/range-selector.js")); __export(__webpack_require__("./node_modules/devextreme-angular/ui/range-slider.js")); __export(__webpack_require__("./node_modules/devextreme-angular/ui/resizable.js")); __export(__webpack_require__("./node_modules/devextreme-angular/ui/responsive-box.js")); __export(__webpack_require__("./node_modules/devextreme-angular/ui/scheduler.js")); __export(__webpack_require__("./node_modules/devextreme-angular/ui/scroll-view.js")); __export(__webpack_require__("./node_modules/devextreme-angular/ui/select-box.js")); __export(__webpack_require__("./node_modules/devextreme-angular/ui/slide-out-view.js")); __export(__webpack_require__("./node_modules/devextreme-angular/ui/slide-out.js")); __export(__webpack_require__("./node_modules/devextreme-angular/ui/slider.js")); __export(__webpack_require__("./node_modules/devextreme-angular/ui/sparkline.js")); __export(__webpack_require__("./node_modules/devextreme-angular/ui/switch.js")); __export(__webpack_require__("./node_modules/devextreme-angular/ui/tab-panel.js")); __export(__webpack_require__("./node_modules/devextreme-angular/ui/tabs.js")); __export(__webpack_require__("./node_modules/devextreme-angular/ui/tag-box.js")); __export(__webpack_require__("./node_modules/devextreme-angular/ui/text-area.js")); __export(__webpack_require__("./node_modules/devextreme-angular/ui/text-box.js")); __export(__webpack_require__("./node_modules/devextreme-angular/ui/tile-view.js")); __export(__webpack_require__("./node_modules/devextreme-angular/ui/toast.js")); __export(__webpack_require__("./node_modules/devextreme-angular/ui/toolbar.js")); __export(__webpack_require__("./node_modules/devextreme-angular/ui/tooltip.js")); __export(__webpack_require__("./node_modules/devextreme-angular/ui/tree-list.js")); __export(__webpack_require__("./node_modules/devextreme-angular/ui/tree-map.js")); __export(__webpack_require__("./node_modules/devextreme-angular/ui/tree-view.js")); __export(__webpack_require__("./node_modules/devextreme-angular/ui/validation-group.js")); __export(__webpack_require__("./node_modules/devextreme-angular/ui/validation-summary.js")); __export(__webpack_require__("./node_modules/devextreme-angular/ui/validator.js")); __export(__webpack_require__("./node_modules/devextreme-angular/ui/vector-map.js")); //# sourceMappingURL=index.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/accordion.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var accordion_1 = __webpack_require__("./node_modules/devextreme/ui/accordion.js"); var component_1 = __webpack_require__("./node_modules/devextreme-angular/core/component.js"); var template_host_1 = __webpack_require__("./node_modules/devextreme-angular/core/template-host.js"); var template_1 = __webpack_require__("./node_modules/devextreme-angular/core/template.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var watcher_helper_1 = __webpack_require__("./node_modules/devextreme-angular/core/watcher-helper.js"); var iterable_differ_helper_1 = __webpack_require__("./node_modules/devextreme-angular/core/iterable-differ-helper.js"); var item_dxi_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/item-dxi.js"); var item_dxi_2 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/item-dxi.js"); /** * The Accordion widget contains several panels displayed one under another. These panels can be collapsed or expanded by an end user, which makes this widget very useful for presenting information in a limited amount of space. */ var DxAccordionComponent = (function (_super) { __extends(DxAccordionComponent, _super); function DxAccordionComponent(elementRef, ngZone, templateHost, _watcherHelper, _idh, optionHost) { var _this = _super.call(this, elementRef, ngZone, templateHost, _watcherHelper) || this; _this._watcherHelper = _watcherHelper; _this._idh = _idh; _this._createEventEmitters([ { subscribe: 'contentReady', emit: 'onContentReady' }, { subscribe: 'disposing', emit: 'onDisposing' }, { subscribe: 'initialized', emit: 'onInitialized' }, { subscribe: 'itemClick', emit: 'onItemClick' }, { subscribe: 'itemContextMenu', emit: 'onItemContextMenu' }, { subscribe: 'itemHold', emit: 'onItemHold' }, { subscribe: 'itemRendered', emit: 'onItemRendered' }, { subscribe: 'itemTitleClick', emit: 'onItemTitleClick' }, { subscribe: 'optionChanged', emit: 'onOptionChanged' }, { subscribe: 'selectionChanged', emit: 'onSelectionChanged' }, { emit: 'accessKeyChange' }, { emit: 'activeStateEnabledChange' }, { emit: 'animationDurationChange' }, { emit: 'collapsibleChange' }, { emit: 'dataSourceChange' }, { emit: 'deferRenderingChange' }, { emit: 'disabledChange' }, { emit: 'elementAttrChange' }, { emit: 'focusStateEnabledChange' }, { emit: 'heightChange' }, { emit: 'hintChange' }, { emit: 'hoverStateEnabledChange' }, { emit: 'itemHoldTimeoutChange' }, { emit: 'itemsChange' }, { emit: 'itemTemplateChange' }, { emit: 'itemTitleTemplateChange' }, { emit: 'keyExprChange' }, { emit: 'multipleChange' }, { emit: 'noDataTextChange' }, { emit: 'rtlEnabledChange' }, { emit: 'selectedIndexChange' }, { emit: 'selectedItemChange' }, { emit: 'selectedItemKeysChange' }, { emit: 'selectedItemsChange' }, { emit: 'tabIndexChange' }, { emit: 'visibleChange' }, { emit: 'widthChange' } ]); _this._idh.setHost(_this); optionHost.setHost(_this); return _this; } Object.defineProperty(DxAccordionComponent.prototype, "accessKey", { /** * Specifies the shortcut key that sets focus on the widget. */ get: function () { return this._getOption('accessKey'); }, set: function (value) { this._setOption('accessKey', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxAccordionComponent.prototype, "activeStateEnabled", { /** * Specifies whether or not the widget changes its state when interacting with a user. */ get: function () { return this._getOption('activeStateEnabled'); }, set: function (value) { this._setOption('activeStateEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxAccordionComponent.prototype, "animationDuration", { /** * A number specifying the time in milliseconds spent on the animation of the expanding or collapsing of a panel. */ get: function () { return this._getOption('animationDuration'); }, set: function (value) { this._setOption('animationDuration', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxAccordionComponent.prototype, "collapsible", { /** * Specifies whether all items can be collapsed or whether at least one item must always be expanded. */ get: function () { return this._getOption('collapsible'); }, set: function (value) { this._setOption('collapsible', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxAccordionComponent.prototype, "dataSource", { /** * A data source used to fetch data to be displayed by the widget. */ get: function () { return this._getOption('dataSource'); }, set: function (value) { this._setOption('dataSource', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxAccordionComponent.prototype, "deferRendering", { /** * Specifies whether widget content is rendered when the widget is shown or when rendering the widget. */ get: function () { return this._getOption('deferRendering'); }, set: function (value) { this._setOption('deferRendering', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxAccordionComponent.prototype, "disabled", { /** * Specifies whether the widget responds to user interaction. */ get: function () { return this._getOption('disabled'); }, set: function (value) { this._setOption('disabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxAccordionComponent.prototype, "elementAttr", { /** * Specifies the attributes to be attached to the widget's root element. */ get: function () { return this._getOption('elementAttr'); }, set: function (value) { this._setOption('elementAttr', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxAccordionComponent.prototype, "focusStateEnabled", { /** * Specifies whether the widget can be focused using keyboard navigation. */ get: function () { return this._getOption('focusStateEnabled'); }, set: function (value) { this._setOption('focusStateEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxAccordionComponent.prototype, "height", { /** * Specifies the widget's height. */ get: function () { return this._getOption('height'); }, set: function (value) { this._setOption('height', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxAccordionComponent.prototype, "hint", { /** * Specifies text for a hint that appears when a user pauses on the widget. */ get: function () { return this._getOption('hint'); }, set: function (value) { this._setOption('hint', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxAccordionComponent.prototype, "hoverStateEnabled", { /** * Specifies whether the widget changes its state when a user pauses on it. */ get: function () { return this._getOption('hoverStateEnabled'); }, set: function (value) { this._setOption('hoverStateEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxAccordionComponent.prototype, "itemHoldTimeout", { /** * The time period in milliseconds before the onItemHold event is raised. */ get: function () { return this._getOption('itemHoldTimeout'); }, set: function (value) { this._setOption('itemHoldTimeout', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxAccordionComponent.prototype, "items", { /** * An array of items displayed by the widget. */ get: function () { return this._getOption('items'); }, set: function (value) { this._setOption('items', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxAccordionComponent.prototype, "itemTemplate", { /** * Specifies a custom template for items. */ get: function () { return this._getOption('itemTemplate'); }, set: function (value) { this._setOption('itemTemplate', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxAccordionComponent.prototype, "itemTitleTemplate", { /** * Specifies a custom template for item titles. */ get: function () { return this._getOption('itemTitleTemplate'); }, set: function (value) { this._setOption('itemTitleTemplate', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxAccordionComponent.prototype, "keyExpr", { /** * Specifies which data field provides keys for widget items. */ get: function () { return this._getOption('keyExpr'); }, set: function (value) { this._setOption('keyExpr', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxAccordionComponent.prototype, "multiple", { /** * Specifies whether the widget can expand several items or only a single item at once. */ get: function () { return this._getOption('multiple'); }, set: function (value) { this._setOption('multiple', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxAccordionComponent.prototype, "noDataText", { /** * The text or HTML markup displayed by the widget if the item collection is empty. */ get: function () { return this._getOption('noDataText'); }, set: function (value) { this._setOption('noDataText', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxAccordionComponent.prototype, "rtlEnabled", { /** * Switches the widget to a right-to-left representation. */ get: function () { return this._getOption('rtlEnabled'); }, set: function (value) { this._setOption('rtlEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxAccordionComponent.prototype, "selectedIndex", { /** * The index number of the currently selected item. */ get: function () { return this._getOption('selectedIndex'); }, set: function (value) { this._setOption('selectedIndex', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxAccordionComponent.prototype, "selectedItem", { /** * The selected item object. */ get: function () { return this._getOption('selectedItem'); }, set: function (value) { this._setOption('selectedItem', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxAccordionComponent.prototype, "selectedItemKeys", { /** * Specifies an array of currently selected item keys. */ get: function () { return this._getOption('selectedItemKeys'); }, set: function (value) { this._setOption('selectedItemKeys', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxAccordionComponent.prototype, "selectedItems", { /** * An array of currently selected item objects. */ get: function () { return this._getOption('selectedItems'); }, set: function (value) { this._setOption('selectedItems', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxAccordionComponent.prototype, "tabIndex", { /** * Specifies the number of the element when the Tab key is used for navigating. */ get: function () { return this._getOption('tabIndex'); }, set: function (value) { this._setOption('tabIndex', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxAccordionComponent.prototype, "visible", { /** * Specifies whether the widget is visible. */ get: function () { return this._getOption('visible'); }, set: function (value) { this._setOption('visible', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxAccordionComponent.prototype, "width", { /** * Specifies the widget's width. */ get: function () { return this._getOption('width'); }, set: function (value) { this._setOption('width', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxAccordionComponent.prototype, "itemsChildren", { get: function () { return this._getOption('items'); }, set: function (value) { this.setChildren('items', value); }, enumerable: true, configurable: true }); DxAccordionComponent.prototype._createInstance = function (element, options) { return new accordion_1.default(element, options); }; DxAccordionComponent.prototype.ngOnDestroy = function () { this._destroyWidget(); }; DxAccordionComponent.prototype.ngOnChanges = function (changes) { _super.prototype.ngOnChanges.call(this, changes); this.setupChanges('dataSource', changes); this.setupChanges('items', changes); this.setupChanges('selectedItemKeys', changes); this.setupChanges('selectedItems', changes); }; DxAccordionComponent.prototype.setupChanges = function (prop, changes) { if (!(prop in this._optionsToUpdate)) { this._idh.setup(prop, changes); } }; DxAccordionComponent.prototype.ngDoCheck = function () { this._idh.doCheck('dataSource'); this._idh.doCheck('items'); this._idh.doCheck('selectedItemKeys'); this._idh.doCheck('selectedItems'); this._watcherHelper.checkWatchers(); _super.prototype.ngDoCheck.call(this); _super.prototype.clearChangedOptions.call(this); }; DxAccordionComponent.prototype._setOption = function (name, value) { var isSetup = this._idh.setupSingle(name, value); var isChanged = this._idh.getChanges(name, value) !== null; if (isSetup || isChanged) { _super.prototype._setOption.call(this, name, value); } }; DxAccordionComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dx-accordion', template: '', providers: [ template_host_1.DxTemplateHost, watcher_helper_1.WatcherHelper, nested_option_1.NestedOptionHost, iterable_differ_helper_1.IterableDifferHelper ] },] }, ]; /** @nocollapse */ DxAccordionComponent.ctorParameters = function () { return [ { type: core_1.ElementRef, }, { type: core_1.NgZone, }, { type: template_host_1.DxTemplateHost, }, { type: watcher_helper_1.WatcherHelper, }, { type: iterable_differ_helper_1.IterableDifferHelper, }, { type: nested_option_1.NestedOptionHost, }, ]; }; DxAccordionComponent.propDecorators = { 'accessKey': [{ type: core_1.Input },], 'activeStateEnabled': [{ type: core_1.Input },], 'animationDuration': [{ type: core_1.Input },], 'collapsible': [{ type: core_1.Input },], 'dataSource': [{ type: core_1.Input },], 'deferRendering': [{ type: core_1.Input },], 'disabled': [{ type: core_1.Input },], 'elementAttr': [{ type: core_1.Input },], 'focusStateEnabled': [{ type: core_1.Input },], 'height': [{ type: core_1.Input },], 'hint': [{ type: core_1.Input },], 'hoverStateEnabled': [{ type: core_1.Input },], 'itemHoldTimeout': [{ type: core_1.Input },], 'items': [{ type: core_1.Input },], 'itemTemplate': [{ type: core_1.Input },], 'itemTitleTemplate': [{ type: core_1.Input },], 'keyExpr': [{ type: core_1.Input },], 'multiple': [{ type: core_1.Input },], 'noDataText': [{ type: core_1.Input },], 'rtlEnabled': [{ type: core_1.Input },], 'selectedIndex': [{ type: core_1.Input },], 'selectedItem': [{ type: core_1.Input },], 'selectedItemKeys': [{ type: core_1.Input },], 'selectedItems': [{ type: core_1.Input },], 'tabIndex': [{ type: core_1.Input },], 'visible': [{ type: core_1.Input },], 'width': [{ type: core_1.Input },], 'onContentReady': [{ type: core_1.Output },], 'onDisposing': [{ type: core_1.Output },], 'onInitialized': [{ type: core_1.Output },], 'onItemClick': [{ type: core_1.Output },], 'onItemContextMenu': [{ type: core_1.Output },], 'onItemHold': [{ type: core_1.Output },], 'onItemRendered': [{ type: core_1.Output },], 'onItemTitleClick': [{ type: core_1.Output },], 'onOptionChanged': [{ type: core_1.Output },], 'onSelectionChanged': [{ type: core_1.Output },], 'accessKeyChange': [{ type: core_1.Output },], 'activeStateEnabledChange': [{ type: core_1.Output },], 'animationDurationChange': [{ type: core_1.Output },], 'collapsibleChange': [{ type: core_1.Output },], 'dataSourceChange': [{ type: core_1.Output },], 'deferRenderingChange': [{ type: core_1.Output },], 'disabledChange': [{ type: core_1.Output },], 'elementAttrChange': [{ type: core_1.Output },], 'focusStateEnabledChange': [{ type: core_1.Output },], 'heightChange': [{ type: core_1.Output },], 'hintChange': [{ type: core_1.Output },], 'hoverStateEnabledChange': [{ type: core_1.Output },], 'itemHoldTimeoutChange': [{ type: core_1.Output },], 'itemsChange': [{ type: core_1.Output },], 'itemTemplateChange': [{ type: core_1.Output },], 'itemTitleTemplateChange': [{ type: core_1.Output },], 'keyExprChange': [{ type: core_1.Output },], 'multipleChange': [{ type: core_1.Output },], 'noDataTextChange': [{ type: core_1.Output },], 'rtlEnabledChange': [{ type: core_1.Output },], 'selectedIndexChange': [{ type: core_1.Output },], 'selectedItemChange': [{ type: core_1.Output },], 'selectedItemKeysChange': [{ type: core_1.Output },], 'selectedItemsChange': [{ type: core_1.Output },], 'tabIndexChange': [{ type: core_1.Output },], 'visibleChange': [{ type: core_1.Output },], 'widthChange': [{ type: core_1.Output },], 'itemsChildren': [{ type: core_1.ContentChildren, args: [item_dxi_2.DxiItemComponent,] },], }; return DxAccordionComponent; }(component_1.DxComponent)); exports.DxAccordionComponent = DxAccordionComponent; var DxAccordionModule = (function () { function DxAccordionModule() { } DxAccordionModule.decorators = [ { type: core_1.NgModule, args: [{ imports: [ item_dxi_1.DxiItemModule, template_1.DxTemplateModule ], declarations: [ DxAccordionComponent ], exports: [ DxAccordionComponent, item_dxi_1.DxiItemModule, template_1.DxTemplateModule ], },] }, ]; /** @nocollapse */ DxAccordionModule.ctorParameters = function () { return []; }; return DxAccordionModule; }()); exports.DxAccordionModule = DxAccordionModule; //# sourceMappingURL=accordion.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/action-sheet.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var action_sheet_1 = __webpack_require__("./node_modules/devextreme/ui/action_sheet.js"); var component_1 = __webpack_require__("./node_modules/devextreme-angular/core/component.js"); var template_host_1 = __webpack_require__("./node_modules/devextreme-angular/core/template-host.js"); var template_1 = __webpack_require__("./node_modules/devextreme-angular/core/template.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var watcher_helper_1 = __webpack_require__("./node_modules/devextreme-angular/core/watcher-helper.js"); var iterable_differ_helper_1 = __webpack_require__("./node_modules/devextreme-angular/core/iterable-differ-helper.js"); var item_dxi_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/item-dxi.js"); var item_dxi_2 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/item-dxi.js"); /** * The ActionSheet widget is a sheet containing a set of buttons located one under the other. These buttons usually represent several choices relating to a single task. */ var DxActionSheetComponent = (function (_super) { __extends(DxActionSheetComponent, _super); function DxActionSheetComponent(elementRef, ngZone, templateHost, _watcherHelper, _idh, optionHost) { var _this = _super.call(this, elementRef, ngZone, templateHost, _watcherHelper) || this; _this._watcherHelper = _watcherHelper; _this._idh = _idh; _this._createEventEmitters([ { subscribe: 'cancelClick', emit: 'onCancelClick' }, { subscribe: 'contentReady', emit: 'onContentReady' }, { subscribe: 'disposing', emit: 'onDisposing' }, { subscribe: 'initialized', emit: 'onInitialized' }, { subscribe: 'itemClick', emit: 'onItemClick' }, { subscribe: 'itemContextMenu', emit: 'onItemContextMenu' }, { subscribe: 'itemHold', emit: 'onItemHold' }, { subscribe: 'itemRendered', emit: 'onItemRendered' }, { subscribe: 'optionChanged', emit: 'onOptionChanged' }, { emit: 'cancelTextChange' }, { emit: 'dataSourceChange' }, { emit: 'disabledChange' }, { emit: 'elementAttrChange' }, { emit: 'heightChange' }, { emit: 'hintChange' }, { emit: 'hoverStateEnabledChange' }, { emit: 'itemHoldTimeoutChange' }, { emit: 'itemsChange' }, { emit: 'itemTemplateChange' }, { emit: 'rtlEnabledChange' }, { emit: 'showCancelButtonChange' }, { emit: 'showTitleChange' }, { emit: 'targetChange' }, { emit: 'titleChange' }, { emit: 'usePopoverChange' }, { emit: 'visibleChange' }, { emit: 'widthChange' } ]); _this._idh.setHost(_this); optionHost.setHost(_this); return _this; } Object.defineProperty(DxActionSheetComponent.prototype, "cancelText", { /** * The text displayed in the button that closes the action sheet. */ get: function () { return this._getOption('cancelText'); }, set: function (value) { this._setOption('cancelText', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxActionSheetComponent.prototype, "dataSource", { /** * A data source used to fetch data to be displayed by the widget. */ get: function () { return this._getOption('dataSource'); }, set: function (value) { this._setOption('dataSource', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxActionSheetComponent.prototype, "disabled", { /** * Specifies whether the widget responds to user interaction. */ get: function () { return this._getOption('disabled'); }, set: function (value) { this._setOption('disabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxActionSheetComponent.prototype, "elementAttr", { /** * Specifies the attributes to be attached to the widget's root element. */ get: function () { return this._getOption('elementAttr'); }, set: function (value) { this._setOption('elementAttr', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxActionSheetComponent.prototype, "height", { /** * Specifies the widget's height. */ get: function () { return this._getOption('height'); }, set: function (value) { this._setOption('height', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxActionSheetComponent.prototype, "hint", { /** * Specifies text for a hint that appears when a user pauses on the widget. */ get: function () { return this._getOption('hint'); }, set: function (value) { this._setOption('hint', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxActionSheetComponent.prototype, "hoverStateEnabled", { /** * Specifies whether the widget changes its state when a user pauses on it. */ get: function () { return this._getOption('hoverStateEnabled'); }, set: function (value) { this._setOption('hoverStateEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxActionSheetComponent.prototype, "itemHoldTimeout", { /** * The time period in milliseconds before the onItemHold event is raised. */ get: function () { return this._getOption('itemHoldTimeout'); }, set: function (value) { this._setOption('itemHoldTimeout', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxActionSheetComponent.prototype, "items", { /** * An array of items displayed by the widget. */ get: function () { return this._getOption('items'); }, set: function (value) { this._setOption('items', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxActionSheetComponent.prototype, "itemTemplate", { /** * Specifies a custom template for items. */ get: function () { return this._getOption('itemTemplate'); }, set: function (value) { this._setOption('itemTemplate', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxActionSheetComponent.prototype, "rtlEnabled", { /** * Switches the widget to a right-to-left representation. */ get: function () { return this._getOption('rtlEnabled'); }, set: function (value) { this._setOption('rtlEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxActionSheetComponent.prototype, "showCancelButton", { /** * Specifies whether or not to display the Cancel button in action sheet. */ get: function () { return this._getOption('showCancelButton'); }, set: function (value) { this._setOption('showCancelButton', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxActionSheetComponent.prototype, "showTitle", { /** * A Boolean value specifying whether or not the title of the action sheet is visible. */ get: function () { return this._getOption('showTitle'); }, set: function (value) { this._setOption('showTitle', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxActionSheetComponent.prototype, "target", { /** * Specifies the element the action sheet popover points at. Applies only if usePopover is true. */ get: function () { return this._getOption('target'); }, set: function (value) { this._setOption('target', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxActionSheetComponent.prototype, "title", { /** * The title of the action sheet. */ get: function () { return this._getOption('title'); }, set: function (value) { this._setOption('title', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxActionSheetComponent.prototype, "usePopover", { /** * Specifies whether or not to show the action sheet within a Popover widget. */ get: function () { return this._getOption('usePopover'); }, set: function (value) { this._setOption('usePopover', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxActionSheetComponent.prototype, "visible", { /** * A Boolean value specifying whether or not the ActionSheet widget is visible. */ get: function () { return this._getOption('visible'); }, set: function (value) { this._setOption('visible', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxActionSheetComponent.prototype, "width", { /** * Specifies the widget's width. */ get: function () { return this._getOption('width'); }, set: function (value) { this._setOption('width', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxActionSheetComponent.prototype, "itemsChildren", { get: function () { return this._getOption('items'); }, set: function (value) { this.setChildren('items', value); }, enumerable: true, configurable: true }); DxActionSheetComponent.prototype._createInstance = function (element, options) { return new action_sheet_1.default(element, options); }; DxActionSheetComponent.prototype.ngOnDestroy = function () { this._destroyWidget(); }; DxActionSheetComponent.prototype.ngOnChanges = function (changes) { _super.prototype.ngOnChanges.call(this, changes); this.setupChanges('dataSource', changes); this.setupChanges('items', changes); }; DxActionSheetComponent.prototype.setupChanges = function (prop, changes) { if (!(prop in this._optionsToUpdate)) { this._idh.setup(prop, changes); } }; DxActionSheetComponent.prototype.ngDoCheck = function () { this._idh.doCheck('dataSource'); this._idh.doCheck('items'); this._watcherHelper.checkWatchers(); _super.prototype.ngDoCheck.call(this); _super.prototype.clearChangedOptions.call(this); }; DxActionSheetComponent.prototype._setOption = function (name, value) { var isSetup = this._idh.setupSingle(name, value); var isChanged = this._idh.getChanges(name, value) !== null; if (isSetup || isChanged) { _super.prototype._setOption.call(this, name, value); } }; DxActionSheetComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dx-action-sheet', template: '', providers: [ template_host_1.DxTemplateHost, watcher_helper_1.WatcherHelper, nested_option_1.NestedOptionHost, iterable_differ_helper_1.IterableDifferHelper ] },] }, ]; /** @nocollapse */ DxActionSheetComponent.ctorParameters = function () { return [ { type: core_1.ElementRef, }, { type: core_1.NgZone, }, { type: template_host_1.DxTemplateHost, }, { type: watcher_helper_1.WatcherHelper, }, { type: iterable_differ_helper_1.IterableDifferHelper, }, { type: nested_option_1.NestedOptionHost, }, ]; }; DxActionSheetComponent.propDecorators = { 'cancelText': [{ type: core_1.Input },], 'dataSource': [{ type: core_1.Input },], 'disabled': [{ type: core_1.Input },], 'elementAttr': [{ type: core_1.Input },], 'height': [{ type: core_1.Input },], 'hint': [{ type: core_1.Input },], 'hoverStateEnabled': [{ type: core_1.Input },], 'itemHoldTimeout': [{ type: core_1.Input },], 'items': [{ type: core_1.Input },], 'itemTemplate': [{ type: core_1.Input },], 'rtlEnabled': [{ type: core_1.Input },], 'showCancelButton': [{ type: core_1.Input },], 'showTitle': [{ type: core_1.Input },], 'target': [{ type: core_1.Input },], 'title': [{ type: core_1.Input },], 'usePopover': [{ type: core_1.Input },], 'visible': [{ type: core_1.Input },], 'width': [{ type: core_1.Input },], 'onCancelClick': [{ type: core_1.Output },], 'onContentReady': [{ type: core_1.Output },], 'onDisposing': [{ type: core_1.Output },], 'onInitialized': [{ type: core_1.Output },], 'onItemClick': [{ type: core_1.Output },], 'onItemContextMenu': [{ type: core_1.Output },], 'onItemHold': [{ type: core_1.Output },], 'onItemRendered': [{ type: core_1.Output },], 'onOptionChanged': [{ type: core_1.Output },], 'cancelTextChange': [{ type: core_1.Output },], 'dataSourceChange': [{ type: core_1.Output },], 'disabledChange': [{ type: core_1.Output },], 'elementAttrChange': [{ type: core_1.Output },], 'heightChange': [{ type: core_1.Output },], 'hintChange': [{ type: core_1.Output },], 'hoverStateEnabledChange': [{ type: core_1.Output },], 'itemHoldTimeoutChange': [{ type: core_1.Output },], 'itemsChange': [{ type: core_1.Output },], 'itemTemplateChange': [{ type: core_1.Output },], 'rtlEnabledChange': [{ type: core_1.Output },], 'showCancelButtonChange': [{ type: core_1.Output },], 'showTitleChange': [{ type: core_1.Output },], 'targetChange': [{ type: core_1.Output },], 'titleChange': [{ type: core_1.Output },], 'usePopoverChange': [{ type: core_1.Output },], 'visibleChange': [{ type: core_1.Output },], 'widthChange': [{ type: core_1.Output },], 'itemsChildren': [{ type: core_1.ContentChildren, args: [item_dxi_2.DxiItemComponent,] },], }; return DxActionSheetComponent; }(component_1.DxComponent)); exports.DxActionSheetComponent = DxActionSheetComponent; var DxActionSheetModule = (function () { function DxActionSheetModule() { } DxActionSheetModule.decorators = [ { type: core_1.NgModule, args: [{ imports: [ item_dxi_1.DxiItemModule, template_1.DxTemplateModule ], declarations: [ DxActionSheetComponent ], exports: [ DxActionSheetComponent, item_dxi_1.DxiItemModule, template_1.DxTemplateModule ], },] }, ]; /** @nocollapse */ DxActionSheetModule.ctorParameters = function () { return []; }; return DxActionSheetModule; }()); exports.DxActionSheetModule = DxActionSheetModule; //# sourceMappingURL=action-sheet.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/all.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var accordion_1 = __webpack_require__("./node_modules/devextreme-angular/ui/accordion.js"); var action_sheet_1 = __webpack_require__("./node_modules/devextreme-angular/ui/action-sheet.js"); var autocomplete_1 = __webpack_require__("./node_modules/devextreme-angular/ui/autocomplete.js"); var bar_gauge_1 = __webpack_require__("./node_modules/devextreme-angular/ui/bar-gauge.js"); var box_1 = __webpack_require__("./node_modules/devextreme-angular/ui/box.js"); var bullet_1 = __webpack_require__("./node_modules/devextreme-angular/ui/bullet.js"); var button_1 = __webpack_require__("./node_modules/devextreme-angular/ui/button.js"); var calendar_1 = __webpack_require__("./node_modules/devextreme-angular/ui/calendar.js"); var chart_1 = __webpack_require__("./node_modules/devextreme-angular/ui/chart.js"); var check_box_1 = __webpack_require__("./node_modules/devextreme-angular/ui/check-box.js"); var circular_gauge_1 = __webpack_require__("./node_modules/devextreme-angular/ui/circular-gauge.js"); var color_box_1 = __webpack_require__("./node_modules/devextreme-angular/ui/color-box.js"); var context_menu_1 = __webpack_require__("./node_modules/devextreme-angular/ui/context-menu.js"); var data_grid_1 = __webpack_require__("./node_modules/devextreme-angular/ui/data-grid.js"); var date_box_1 = __webpack_require__("./node_modules/devextreme-angular/ui/date-box.js"); var defer_rendering_1 = __webpack_require__("./node_modules/devextreme-angular/ui/defer-rendering.js"); var drop_down_box_1 = __webpack_require__("./node_modules/devextreme-angular/ui/drop-down-box.js"); var file_uploader_1 = __webpack_require__("./node_modules/devextreme-angular/ui/file-uploader.js"); var filter_builder_1 = __webpack_require__("./node_modules/devextreme-angular/ui/filter-builder.js"); var form_1 = __webpack_require__("./node_modules/devextreme-angular/ui/form.js"); var funnel_1 = __webpack_require__("./node_modules/devextreme-angular/ui/funnel.js"); var gallery_1 = __webpack_require__("./node_modules/devextreme-angular/ui/gallery.js"); var linear_gauge_1 = __webpack_require__("./node_modules/devextreme-angular/ui/linear-gauge.js"); var list_1 = __webpack_require__("./node_modules/devextreme-angular/ui/list.js"); var load_indicator_1 = __webpack_require__("./node_modules/devextreme-angular/ui/load-indicator.js"); var load_panel_1 = __webpack_require__("./node_modules/devextreme-angular/ui/load-panel.js"); var lookup_1 = __webpack_require__("./node_modules/devextreme-angular/ui/lookup.js"); var map_1 = __webpack_require__("./node_modules/devextreme-angular/ui/map.js"); var menu_1 = __webpack_require__("./node_modules/devextreme-angular/ui/menu.js"); var multi_view_1 = __webpack_require__("./node_modules/devextreme-angular/ui/multi-view.js"); var nav_bar_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nav-bar.js"); var number_box_1 = __webpack_require__("./node_modules/devextreme-angular/ui/number-box.js"); var panorama_1 = __webpack_require__("./node_modules/devextreme-angular/ui/panorama.js"); var pie_chart_1 = __webpack_require__("./node_modules/devextreme-angular/ui/pie-chart.js"); var pivot_grid_field_chooser_1 = __webpack_require__("./node_modules/devextreme-angular/ui/pivot-grid-field-chooser.js"); var pivot_grid_1 = __webpack_require__("./node_modules/devextreme-angular/ui/pivot-grid.js"); var pivot_1 = __webpack_require__("./node_modules/devextreme-angular/ui/pivot.js"); var polar_chart_1 = __webpack_require__("./node_modules/devextreme-angular/ui/polar-chart.js"); var popover_1 = __webpack_require__("./node_modules/devextreme-angular/ui/popover.js"); var popup_1 = __webpack_require__("./node_modules/devextreme-angular/ui/popup.js"); var progress_bar_1 = __webpack_require__("./node_modules/devextreme-angular/ui/progress-bar.js"); var radio_group_1 = __webpack_require__("./node_modules/devextreme-angular/ui/radio-group.js"); var range_selector_1 = __webpack_require__("./node_modules/devextreme-angular/ui/range-selector.js"); var range_slider_1 = __webpack_require__("./node_modules/devextreme-angular/ui/range-slider.js"); var resizable_1 = __webpack_require__("./node_modules/devextreme-angular/ui/resizable.js"); var responsive_box_1 = __webpack_require__("./node_modules/devextreme-angular/ui/responsive-box.js"); var scheduler_1 = __webpack_require__("./node_modules/devextreme-angular/ui/scheduler.js"); var scroll_view_1 = __webpack_require__("./node_modules/devextreme-angular/ui/scroll-view.js"); var select_box_1 = __webpack_require__("./node_modules/devextreme-angular/ui/select-box.js"); var slide_out_view_1 = __webpack_require__("./node_modules/devextreme-angular/ui/slide-out-view.js"); var slide_out_1 = __webpack_require__("./node_modules/devextreme-angular/ui/slide-out.js"); var slider_1 = __webpack_require__("./node_modules/devextreme-angular/ui/slider.js"); var sparkline_1 = __webpack_require__("./node_modules/devextreme-angular/ui/sparkline.js"); var switch_1 = __webpack_require__("./node_modules/devextreme-angular/ui/switch.js"); var tab_panel_1 = __webpack_require__("./node_modules/devextreme-angular/ui/tab-panel.js"); var tabs_1 = __webpack_require__("./node_modules/devextreme-angular/ui/tabs.js"); var tag_box_1 = __webpack_require__("./node_modules/devextreme-angular/ui/tag-box.js"); var text_area_1 = __webpack_require__("./node_modules/devextreme-angular/ui/text-area.js"); var text_box_1 = __webpack_require__("./node_modules/devextreme-angular/ui/text-box.js"); var tile_view_1 = __webpack_require__("./node_modules/devextreme-angular/ui/tile-view.js"); var toast_1 = __webpack_require__("./node_modules/devextreme-angular/ui/toast.js"); var toolbar_1 = __webpack_require__("./node_modules/devextreme-angular/ui/toolbar.js"); var tooltip_1 = __webpack_require__("./node_modules/devextreme-angular/ui/tooltip.js"); var tree_list_1 = __webpack_require__("./node_modules/devextreme-angular/ui/tree-list.js"); var tree_map_1 = __webpack_require__("./node_modules/devextreme-angular/ui/tree-map.js"); var tree_view_1 = __webpack_require__("./node_modules/devextreme-angular/ui/tree-view.js"); var validation_group_1 = __webpack_require__("./node_modules/devextreme-angular/ui/validation-group.js"); var validation_summary_1 = __webpack_require__("./node_modules/devextreme-angular/ui/validation-summary.js"); var validator_1 = __webpack_require__("./node_modules/devextreme-angular/ui/validator.js"); var vector_map_1 = __webpack_require__("./node_modules/devextreme-angular/ui/vector-map.js"); var template_1 = __webpack_require__("./node_modules/devextreme-angular/core/template.js"); var DevExtremeModule = (function () { function DevExtremeModule() { } DevExtremeModule.decorators = [ { type: core_1.NgModule, args: [{ imports: [ accordion_1.DxAccordionModule, action_sheet_1.DxActionSheetModule, autocomplete_1.DxAutocompleteModule, bar_gauge_1.DxBarGaugeModule, box_1.DxBoxModule, bullet_1.DxBulletModule, button_1.DxButtonModule, calendar_1.DxCalendarModule, chart_1.DxChartModule, check_box_1.DxCheckBoxModule, circular_gauge_1.DxCircularGaugeModule, color_box_1.DxColorBoxModule, context_menu_1.DxContextMenuModule, data_grid_1.DxDataGridModule, date_box_1.DxDateBoxModule, defer_rendering_1.DxDeferRenderingModule, drop_down_box_1.DxDropDownBoxModule, file_uploader_1.DxFileUploaderModule, filter_builder_1.DxFilterBuilderModule, form_1.DxFormModule, funnel_1.DxFunnelModule, gallery_1.DxGalleryModule, linear_gauge_1.DxLinearGaugeModule, list_1.DxListModule, load_indicator_1.DxLoadIndicatorModule, load_panel_1.DxLoadPanelModule, lookup_1.DxLookupModule, map_1.DxMapModule, menu_1.DxMenuModule, multi_view_1.DxMultiViewModule, nav_bar_1.DxNavBarModule, number_box_1.DxNumberBoxModule, panorama_1.DxPanoramaModule, pie_chart_1.DxPieChartModule, pivot_grid_field_chooser_1.DxPivotGridFieldChooserModule, pivot_grid_1.DxPivotGridModule, pivot_1.DxPivotModule, polar_chart_1.DxPolarChartModule, popover_1.DxPopoverModule, popup_1.DxPopupModule, progress_bar_1.DxProgressBarModule, radio_group_1.DxRadioGroupModule, range_selector_1.DxRangeSelectorModule, range_slider_1.DxRangeSliderModule, resizable_1.DxResizableModule, responsive_box_1.DxResponsiveBoxModule, scheduler_1.DxSchedulerModule, scroll_view_1.DxScrollViewModule, select_box_1.DxSelectBoxModule, slide_out_view_1.DxSlideOutViewModule, slide_out_1.DxSlideOutModule, slider_1.DxSliderModule, sparkline_1.DxSparklineModule, switch_1.DxSwitchModule, tab_panel_1.DxTabPanelModule, tabs_1.DxTabsModule, tag_box_1.DxTagBoxModule, text_area_1.DxTextAreaModule, text_box_1.DxTextBoxModule, tile_view_1.DxTileViewModule, toast_1.DxToastModule, toolbar_1.DxToolbarModule, tooltip_1.DxTooltipModule, tree_list_1.DxTreeListModule, tree_map_1.DxTreeMapModule, tree_view_1.DxTreeViewModule, validation_group_1.DxValidationGroupModule, validation_summary_1.DxValidationSummaryModule, validator_1.DxValidatorModule, vector_map_1.DxVectorMapModule, template_1.DxTemplateModule ], exports: [ accordion_1.DxAccordionModule, action_sheet_1.DxActionSheetModule, autocomplete_1.DxAutocompleteModule, bar_gauge_1.DxBarGaugeModule, box_1.DxBoxModule, bullet_1.DxBulletModule, button_1.DxButtonModule, calendar_1.DxCalendarModule, chart_1.DxChartModule, check_box_1.DxCheckBoxModule, circular_gauge_1.DxCircularGaugeModule, color_box_1.DxColorBoxModule, context_menu_1.DxContextMenuModule, data_grid_1.DxDataGridModule, date_box_1.DxDateBoxModule, defer_rendering_1.DxDeferRenderingModule, drop_down_box_1.DxDropDownBoxModule, file_uploader_1.DxFileUploaderModule, filter_builder_1.DxFilterBuilderModule, form_1.DxFormModule, funnel_1.DxFunnelModule, gallery_1.DxGalleryModule, linear_gauge_1.DxLinearGaugeModule, list_1.DxListModule, load_indicator_1.DxLoadIndicatorModule, load_panel_1.DxLoadPanelModule, lookup_1.DxLookupModule, map_1.DxMapModule, menu_1.DxMenuModule, multi_view_1.DxMultiViewModule, nav_bar_1.DxNavBarModule, number_box_1.DxNumberBoxModule, panorama_1.DxPanoramaModule, pie_chart_1.DxPieChartModule, pivot_grid_field_chooser_1.DxPivotGridFieldChooserModule, pivot_grid_1.DxPivotGridModule, pivot_1.DxPivotModule, polar_chart_1.DxPolarChartModule, popover_1.DxPopoverModule, popup_1.DxPopupModule, progress_bar_1.DxProgressBarModule, radio_group_1.DxRadioGroupModule, range_selector_1.DxRangeSelectorModule, range_slider_1.DxRangeSliderModule, resizable_1.DxResizableModule, responsive_box_1.DxResponsiveBoxModule, scheduler_1.DxSchedulerModule, scroll_view_1.DxScrollViewModule, select_box_1.DxSelectBoxModule, slide_out_view_1.DxSlideOutViewModule, slide_out_1.DxSlideOutModule, slider_1.DxSliderModule, sparkline_1.DxSparklineModule, switch_1.DxSwitchModule, tab_panel_1.DxTabPanelModule, tabs_1.DxTabsModule, tag_box_1.DxTagBoxModule, text_area_1.DxTextAreaModule, text_box_1.DxTextBoxModule, tile_view_1.DxTileViewModule, toast_1.DxToastModule, toolbar_1.DxToolbarModule, tooltip_1.DxTooltipModule, tree_list_1.DxTreeListModule, tree_map_1.DxTreeMapModule, tree_view_1.DxTreeViewModule, validation_group_1.DxValidationGroupModule, validation_summary_1.DxValidationSummaryModule, validator_1.DxValidatorModule, vector_map_1.DxVectorMapModule, template_1.DxTemplateModule ] },] }, ]; /** @nocollapse */ DevExtremeModule.ctorParameters = function () { return []; }; return DevExtremeModule; }()); exports.DevExtremeModule = DevExtremeModule; //# sourceMappingURL=all.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/autocomplete.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var autocomplete_1 = __webpack_require__("./node_modules/devextreme/ui/autocomplete.js"); var validator_1 = __webpack_require__("./node_modules/devextreme-angular/ui/validator.js"); var forms_1 = __webpack_require__("./node_modules/@angular/forms/esm2015/forms.js"); var component_1 = __webpack_require__("./node_modules/devextreme-angular/core/component.js"); var template_host_1 = __webpack_require__("./node_modules/devextreme-angular/core/template-host.js"); var template_1 = __webpack_require__("./node_modules/devextreme-angular/core/template.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var watcher_helper_1 = __webpack_require__("./node_modules/devextreme-angular/core/watcher-helper.js"); var iterable_differ_helper_1 = __webpack_require__("./node_modules/devextreme-angular/core/iterable-differ-helper.js"); var item_dxi_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/item-dxi.js"); var item_dxi_2 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/item-dxi.js"); var CUSTOM_VALUE_ACCESSOR_PROVIDER = { provide: forms_1.NG_VALUE_ACCESSOR, useExisting: core_1.forwardRef(function () { return DxAutocompleteComponent; }), multi: true }; /** * The Autocomplete widget is a textbox that provides suggestions while a user types into it. */ var DxAutocompleteComponent = (function (_super) { __extends(DxAutocompleteComponent, _super); function DxAutocompleteComponent(elementRef, ngZone, templateHost, _watcherHelper, _idh, optionHost) { var _this = _super.call(this, elementRef, ngZone, templateHost, _watcherHelper) || this; _this._watcherHelper = _watcherHelper; _this._idh = _idh; _this.touched = function (_) { }; _this._createEventEmitters([ { subscribe: 'change', emit: 'onChange' }, { subscribe: 'closed', emit: 'onClosed' }, { subscribe: 'contentReady', emit: 'onContentReady' }, { subscribe: 'copy', emit: 'onCopy' }, { subscribe: 'cut', emit: 'onCut' }, { subscribe: 'disposing', emit: 'onDisposing' }, { subscribe: 'enterKey', emit: 'onEnterKey' }, { subscribe: 'focusIn', emit: 'onFocusIn' }, { subscribe: 'focusOut', emit: 'onFocusOut' }, { subscribe: 'initialized', emit: 'onInitialized' }, { subscribe: 'input', emit: 'onInput' }, { subscribe: 'itemClick', emit: 'onItemClick' }, { subscribe: 'keyDown', emit: 'onKeyDown' }, { subscribe: 'keyPress', emit: 'onKeyPress' }, { subscribe: 'keyUp', emit: 'onKeyUp' }, { subscribe: 'opened', emit: 'onOpened' }, { subscribe: 'optionChanged', emit: 'onOptionChanged' }, { subscribe: 'paste', emit: 'onPaste' }, { subscribe: 'selectionChanged', emit: 'onSelectionChanged' }, { subscribe: 'valueChanged', emit: 'onValueChanged' }, { emit: 'accessKeyChange' }, { emit: 'activeStateEnabledChange' }, { emit: 'attrChange' }, { emit: 'dataSourceChange' }, { emit: 'deferRenderingChange' }, { emit: 'disabledChange' }, { emit: 'displayExprChange' }, { emit: 'displayValueChange' }, { emit: 'dropDownButtonTemplateChange' }, { emit: 'elementAttrChange' }, { emit: 'focusStateEnabledChange' }, { emit: 'groupedChange' }, { emit: 'groupTemplateChange' }, { emit: 'heightChange' }, { emit: 'hintChange' }, { emit: 'hoverStateEnabledChange' }, { emit: 'inputAttrChange' }, { emit: 'isValidChange' }, { emit: 'itemsChange' }, { emit: 'itemTemplateChange' }, { emit: 'maxItemCountChange' }, { emit: 'maxLengthChange' }, { emit: 'minSearchLengthChange' }, { emit: 'nameChange' }, { emit: 'openedChange' }, { emit: 'placeholderChange' }, { emit: 'readOnlyChange' }, { emit: 'rtlEnabledChange' }, { emit: 'searchExprChange' }, { emit: 'searchModeChange' }, { emit: 'searchTimeoutChange' }, { emit: 'selectedItemChange' }, { emit: 'showClearButtonChange' }, { emit: 'spellcheckChange' }, { emit: 'tabIndexChange' }, { emit: 'textChange' }, { emit: 'validationErrorChange' }, { emit: 'validationMessageModeChange' }, { emit: 'valueChange' }, { emit: 'valueChangeEventChange' }, { emit: 'valueExprChange' }, { emit: 'visibleChange' }, { emit: 'widthChange' }, { emit: 'onBlur' } ]); _this._idh.setHost(_this); optionHost.setHost(_this); return _this; } Object.defineProperty(DxAutocompleteComponent.prototype, "accessKey", { /** * Specifies the shortcut key that sets focus on the widget. */ get: function () { return this._getOption('accessKey'); }, set: function (value) { this._setOption('accessKey', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxAutocompleteComponent.prototype, "activeStateEnabled", { /** * Specifies whether or not the widget changes its state when interacting with a user. */ get: function () { return this._getOption('activeStateEnabled'); }, set: function (value) { this._setOption('activeStateEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxAutocompleteComponent.prototype, "attr", { /** * Use the inputAttr option instead. */ get: function () { return this._getOption('attr'); }, set: function (value) { this._setOption('attr', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxAutocompleteComponent.prototype, "dataSource", { /** * A data source used to fetch data to be displayed by the widget. */ get: function () { return this._getOption('dataSource'); }, set: function (value) { this._setOption('dataSource', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxAutocompleteComponent.prototype, "deferRendering", { /** * Specifies whether widget content is rendered when the widget is shown or when rendering the widget. */ get: function () { return this._getOption('deferRendering'); }, set: function (value) { this._setOption('deferRendering', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxAutocompleteComponent.prototype, "disabled", { /** * Specifies whether the widget responds to user interaction. */ get: function () { return this._getOption('disabled'); }, set: function (value) { this._setOption('disabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxAutocompleteComponent.prototype, "displayExpr", { /** * Use the valueExpr option instead. */ get: function () { return this._getOption('displayExpr'); }, set: function (value) { this._setOption('displayExpr', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxAutocompleteComponent.prototype, "displayValue", { /** * Returns the value currently displayed by the widget. */ get: function () { return this._getOption('displayValue'); }, set: function (value) { this._setOption('displayValue', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxAutocompleteComponent.prototype, "dropDownButtonTemplate", { /** * Specifies a custom template for the drop-down button. */ get: function () { return this._getOption('dropDownButtonTemplate'); }, set: function (value) { this._setOption('dropDownButtonTemplate', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxAutocompleteComponent.prototype, "elementAttr", { /** * Specifies the attributes to be attached to the widget's root element. */ get: function () { return this._getOption('elementAttr'); }, set: function (value) { this._setOption('elementAttr', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxAutocompleteComponent.prototype, "focusStateEnabled", { /** * Specifies whether the widget can be focused using keyboard navigation. */ get: function () { return this._getOption('focusStateEnabled'); }, set: function (value) { this._setOption('focusStateEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxAutocompleteComponent.prototype, "grouped", { /** * Specifies whether data items should be grouped. */ get: function () { return this._getOption('grouped'); }, set: function (value) { this._setOption('grouped', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxAutocompleteComponent.prototype, "groupTemplate", { /** * Specifies a custom template for group captions. */ get: function () { return this._getOption('groupTemplate'); }, set: function (value) { this._setOption('groupTemplate', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxAutocompleteComponent.prototype, "height", { /** * Specifies the widget's height. */ get: function () { return this._getOption('height'); }, set: function (value) { this._setOption('height', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxAutocompleteComponent.prototype, "hint", { /** * Specifies text for a hint that appears when a user pauses on the widget. */ get: function () { return this._getOption('hint'); }, set: function (value) { this._setOption('hint', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxAutocompleteComponent.prototype, "hoverStateEnabled", { /** * Specifies whether the widget changes its state when a user pauses on it. */ get: function () { return this._getOption('hoverStateEnabled'); }, set: function (value) { this._setOption('hoverStateEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxAutocompleteComponent.prototype, "inputAttr", { /** * Specifies the attributes to be passed on to the underlying HTML element. */ get: function () { return this._getOption('inputAttr'); }, set: function (value) { this._setOption('inputAttr', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxAutocompleteComponent.prototype, "isValid", { /** * Specifies whether the editor's value is valid. */ get: function () { return this._getOption('isValid'); }, set: function (value) { this._setOption('isValid', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxAutocompleteComponent.prototype, "items", { /** * An array of items displayed by the widget. */ get: function () { return this._getOption('items'); }, set: function (value) { this._setOption('items', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxAutocompleteComponent.prototype, "itemTemplate", { /** * Specifies a custom template for items. */ get: function () { return this._getOption('itemTemplate'); }, set: function (value) { this._setOption('itemTemplate', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxAutocompleteComponent.prototype, "maxItemCount", { /** * Specifies the maximum count of items displayed by the widget. */ get: function () { return this._getOption('maxItemCount'); }, set: function (value) { this._setOption('maxItemCount', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxAutocompleteComponent.prototype, "maxLength", { /** * Specifies the maximum number of characters you can enter into the textbox. */ get: function () { return this._getOption('maxLength'); }, set: function (value) { this._setOption('maxLength', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxAutocompleteComponent.prototype, "minSearchLength", { /** * The minimum number of characters that must be entered into the text box to begin a search. */ get: function () { return this._getOption('minSearchLength'); }, set: function (value) { this._setOption('minSearchLength', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxAutocompleteComponent.prototype, "name", { /** * The value to be assigned to the `name` attribute of the underlying HTML element. */ get: function () { return this._getOption('name'); }, set: function (value) { this._setOption('name', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxAutocompleteComponent.prototype, "opened", { /** * Specifies whether or not the drop-down editor is displayed. */ get: function () { return this._getOption('opened'); }, set: function (value) { this._setOption('opened', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxAutocompleteComponent.prototype, "placeholder", { /** * The text displayed by the widget when the widget value is empty. */ get: function () { return this._getOption('placeholder'); }, set: function (value) { this._setOption('placeholder', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxAutocompleteComponent.prototype, "readOnly", { /** * A Boolean value specifying whether or not the widget is read-only. */ get: function () { return this._getOption('readOnly'); }, set: function (value) { this._setOption('readOnly', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxAutocompleteComponent.prototype, "rtlEnabled", { /** * Switches the widget to a right-to-left representation. */ get: function () { return this._getOption('rtlEnabled'); }, set: function (value) { this._setOption('rtlEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxAutocompleteComponent.prototype, "searchExpr", { /** * Specifies the name of a data source item field or an expression whose value is compared to the search criterion. */ get: function () { return this._getOption('searchExpr'); }, set: function (value) { this._setOption('searchExpr', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxAutocompleteComponent.prototype, "searchMode", { /** * Specifies the binary operation used to filter data. */ get: function () { return this._getOption('searchMode'); }, set: function (value) { this._setOption('searchMode', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxAutocompleteComponent.prototype, "searchTimeout", { /** * Specifies the time delay, in milliseconds, after the last character has been typed in, before a search is executed. */ get: function () { return this._getOption('searchTimeout'); }, set: function (value) { this._setOption('searchTimeout', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxAutocompleteComponent.prototype, "selectedItem", { /** * Gets the currently selected item. */ get: function () { return this._getOption('selectedItem'); }, set: function (value) { this._setOption('selectedItem', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxAutocompleteComponent.prototype, "showClearButton", { /** * Specifies whether to display the Clear button in the widget. */ get: function () { return this._getOption('showClearButton'); }, set: function (value) { this._setOption('showClearButton', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxAutocompleteComponent.prototype, "spellcheck", { /** * Specifies whether or not the widget checks the inner text for spelling mistakes. */ get: function () { return this._getOption('spellcheck'); }, set: function (value) { this._setOption('spellcheck', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxAutocompleteComponent.prototype, "tabIndex", { /** * Specifies the number of the element when the Tab key is used for navigating. */ get: function () { return this._getOption('tabIndex'); }, set: function (value) { this._setOption('tabIndex', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxAutocompleteComponent.prototype, "text", { /** * The read-only option that holds the text displayed by the widget input element. */ get: function () { return this._getOption('text'); }, set: function (value) { this._setOption('text', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxAutocompleteComponent.prototype, "validationError", { /** * Specifies information on the validation error when using a custom validation engine. Should be changed at runtime along with the isValid option. */ get: function () { return this._getOption('validationError'); }, set: function (value) { this._setOption('validationError', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxAutocompleteComponent.prototype, "validationMessageMode", { /** * Specifies how the message about the validation rules that are not satisfied by this editor's value is displayed. */ get: function () { return this._getOption('validationMessageMode'); }, set: function (value) { this._setOption('validationMessageMode', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxAutocompleteComponent.prototype, "value", { /** * Specifies the current value displayed by the widget. */ get: function () { return this._getOption('value'); }, set: function (value) { this._setOption('value', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxAutocompleteComponent.prototype, "valueChangeEvent", { /** * Specifies DOM event names that update a widget's value. */ get: function () { return this._getOption('valueChangeEvent'); }, set: function (value) { this._setOption('valueChangeEvent', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxAutocompleteComponent.prototype, "valueExpr", { /** * Specifies which data field provides the widget's value. When this option is not set, the value is the entire data object. */ get: function () { return this._getOption('valueExpr'); }, set: function (value) { this._setOption('valueExpr', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxAutocompleteComponent.prototype, "visible", { /** * Specifies whether the widget is visible. */ get: function () { return this._getOption('visible'); }, set: function (value) { this._setOption('visible', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxAutocompleteComponent.prototype, "width", { /** * Specifies the widget's width. */ get: function () { return this._getOption('width'); }, set: function (value) { this._setOption('width', value); }, enumerable: true, configurable: true }); DxAutocompleteComponent.prototype.change = function (_) { }; Object.defineProperty(DxAutocompleteComponent.prototype, "itemsChildren", { get: function () { return this._getOption('items'); }, set: function (value) { this.setChildren('items', value); }, enumerable: true, configurable: true }); DxAutocompleteComponent.prototype._createInstance = function (element, options) { var widget = new autocomplete_1.default(element, options); if (this.validator) { this.validator.createInstance(element); } return widget; }; DxAutocompleteComponent.prototype.writeValue = function (value) { this.eventHelper.lockedValueChangeEvent = true; this.value = value; this.eventHelper.lockedValueChangeEvent = false; }; DxAutocompleteComponent.prototype.setDisabledState = function (isDisabled) { this.disabled = isDisabled; }; DxAutocompleteComponent.prototype.registerOnChange = function (fn) { this.change = fn; }; DxAutocompleteComponent.prototype.registerOnTouched = function (fn) { this.touched = fn; }; DxAutocompleteComponent.prototype._createWidget = function (element) { var _this = this; _super.prototype._createWidget.call(this, element); this.instance.on('focusOut', function (e) { _this.eventHelper.fireNgEvent('onBlur', [e]); }); }; DxAutocompleteComponent.prototype.ngOnDestroy = function () { this._destroyWidget(); }; DxAutocompleteComponent.prototype.ngOnChanges = function (changes) { _super.prototype.ngOnChanges.call(this, changes); this.setupChanges('dataSource', changes); this.setupChanges('items', changes); this.setupChanges('searchExpr', changes); }; DxAutocompleteComponent.prototype.setupChanges = function (prop, changes) { if (!(prop in this._optionsToUpdate)) { this._idh.setup(prop, changes); } }; DxAutocompleteComponent.prototype.ngDoCheck = function () { this._idh.doCheck('dataSource'); this._idh.doCheck('items'); this._idh.doCheck('searchExpr'); this._watcherHelper.checkWatchers(); _super.prototype.ngDoCheck.call(this); _super.prototype.clearChangedOptions.call(this); }; DxAutocompleteComponent.prototype._setOption = function (name, value) { var isSetup = this._idh.setupSingle(name, value); var isChanged = this._idh.getChanges(name, value) !== null; if (isSetup || isChanged) { _super.prototype._setOption.call(this, name, value); } }; DxAutocompleteComponent.prototype.ngAfterContentInit = function () { if (this.validator) { this.validator.renderOnViewInit = false; } }; DxAutocompleteComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dx-autocomplete', template: '', providers: [ template_host_1.DxTemplateHost, watcher_helper_1.WatcherHelper, CUSTOM_VALUE_ACCESSOR_PROVIDER, nested_option_1.NestedOptionHost, iterable_differ_helper_1.IterableDifferHelper ] },] }, ]; /** @nocollapse */ DxAutocompleteComponent.ctorParameters = function () { return [ { type: core_1.ElementRef, }, { type: core_1.NgZone, }, { type: template_host_1.DxTemplateHost, }, { type: watcher_helper_1.WatcherHelper, }, { type: iterable_differ_helper_1.IterableDifferHelper, }, { type: nested_option_1.NestedOptionHost, }, ]; }; DxAutocompleteComponent.propDecorators = { 'validator': [{ type: core_1.ContentChild, args: [validator_1.DxValidatorComponent,] },], 'accessKey': [{ type: core_1.Input },], 'activeStateEnabled': [{ type: core_1.Input },], 'attr': [{ type: core_1.Input },], 'dataSource': [{ type: core_1.Input },], 'deferRendering': [{ type: core_1.Input },], 'disabled': [{ type: core_1.Input },], 'displayExpr': [{ type: core_1.Input },], 'displayValue': [{ type: core_1.Input },], 'dropDownButtonTemplate': [{ type: core_1.Input },], 'elementAttr': [{ type: core_1.Input },], 'focusStateEnabled': [{ type: core_1.Input },], 'grouped': [{ type: core_1.Input },], 'groupTemplate': [{ type: core_1.Input },], 'height': [{ type: core_1.Input },], 'hint': [{ type: core_1.Input },], 'hoverStateEnabled': [{ type: core_1.Input },], 'inputAttr': [{ type: core_1.Input },], 'isValid': [{ type: core_1.Input },], 'items': [{ type: core_1.Input },], 'itemTemplate': [{ type: core_1.Input },], 'maxItemCount': [{ type: core_1.Input },], 'maxLength': [{ type: core_1.Input },], 'minSearchLength': [{ type: core_1.Input },], 'name': [{ type: core_1.Input },], 'opened': [{ type: core_1.Input },], 'placeholder': [{ type: core_1.Input },], 'readOnly': [{ type: core_1.Input },], 'rtlEnabled': [{ type: core_1.Input },], 'searchExpr': [{ type: core_1.Input },], 'searchMode': [{ type: core_1.Input },], 'searchTimeout': [{ type: core_1.Input },], 'selectedItem': [{ type: core_1.Input },], 'showClearButton': [{ type: core_1.Input },], 'spellcheck': [{ type: core_1.Input },], 'tabIndex': [{ type: core_1.Input },], 'text': [{ type: core_1.Input },], 'validationError': [{ type: core_1.Input },], 'validationMessageMode': [{ type: core_1.Input },], 'value': [{ type: core_1.Input },], 'valueChangeEvent': [{ type: core_1.Input },], 'valueExpr': [{ type: core_1.Input },], 'visible': [{ type: core_1.Input },], 'width': [{ type: core_1.Input },], 'onChange': [{ type: core_1.Output },], 'onClosed': [{ type: core_1.Output },], 'onContentReady': [{ type: core_1.Output },], 'onCopy': [{ type: core_1.Output },], 'onCut': [{ type: core_1.Output },], 'onDisposing': [{ type: core_1.Output },], 'onEnterKey': [{ type: core_1.Output },], 'onFocusIn': [{ type: core_1.Output },], 'onFocusOut': [{ type: core_1.Output },], 'onInitialized': [{ type: core_1.Output },], 'onInput': [{ type: core_1.Output },], 'onItemClick': [{ type: core_1.Output },], 'onKeyDown': [{ type: core_1.Output },], 'onKeyPress': [{ type: core_1.Output },], 'onKeyUp': [{ type: core_1.Output },], 'onOpened': [{ type: core_1.Output },], 'onOptionChanged': [{ type: core_1.Output },], 'onPaste': [{ type: core_1.Output },], 'onSelectionChanged': [{ type: core_1.Output },], 'onValueChanged': [{ type: core_1.Output },], 'accessKeyChange': [{ type: core_1.Output },], 'activeStateEnabledChange': [{ type: core_1.Output },], 'attrChange': [{ type: core_1.Output },], 'dataSourceChange': [{ type: core_1.Output },], 'deferRenderingChange': [{ type: core_1.Output },], 'disabledChange': [{ type: core_1.Output },], 'displayExprChange': [{ type: core_1.Output },], 'displayValueChange': [{ type: core_1.Output },], 'dropDownButtonTemplateChange': [{ type: core_1.Output },], 'elementAttrChange': [{ type: core_1.Output },], 'focusStateEnabledChange': [{ type: core_1.Output },], 'groupedChange': [{ type: core_1.Output },], 'groupTemplateChange': [{ type: core_1.Output },], 'heightChange': [{ type: core_1.Output },], 'hintChange': [{ type: core_1.Output },], 'hoverStateEnabledChange': [{ type: core_1.Output },], 'inputAttrChange': [{ type: core_1.Output },], 'isValidChange': [{ type: core_1.Output },], 'itemsChange': [{ type: core_1.Output },], 'itemTemplateChange': [{ type: core_1.Output },], 'maxItemCountChange': [{ type: core_1.Output },], 'maxLengthChange': [{ type: core_1.Output },], 'minSearchLengthChange': [{ type: core_1.Output },], 'nameChange': [{ type: core_1.Output },], 'openedChange': [{ type: core_1.Output },], 'placeholderChange': [{ type: core_1.Output },], 'readOnlyChange': [{ type: core_1.Output },], 'rtlEnabledChange': [{ type: core_1.Output },], 'searchExprChange': [{ type: core_1.Output },], 'searchModeChange': [{ type: core_1.Output },], 'searchTimeoutChange': [{ type: core_1.Output },], 'selectedItemChange': [{ type: core_1.Output },], 'showClearButtonChange': [{ type: core_1.Output },], 'spellcheckChange': [{ type: core_1.Output },], 'tabIndexChange': [{ type: core_1.Output },], 'textChange': [{ type: core_1.Output },], 'validationErrorChange': [{ type: core_1.Output },], 'validationMessageModeChange': [{ type: core_1.Output },], 'valueChange': [{ type: core_1.Output },], 'valueChangeEventChange': [{ type: core_1.Output },], 'valueExprChange': [{ type: core_1.Output },], 'visibleChange': [{ type: core_1.Output },], 'widthChange': [{ type: core_1.Output },], 'onBlur': [{ type: core_1.Output },], 'change': [{ type: core_1.HostListener, args: ['valueChange', ['$event'],] },], 'touched': [{ type: core_1.HostListener, args: ['onBlur', ['$event'],] },], 'itemsChildren': [{ type: core_1.ContentChildren, args: [item_dxi_2.DxiItemComponent,] },], }; return DxAutocompleteComponent; }(component_1.DxComponent)); exports.DxAutocompleteComponent = DxAutocompleteComponent; var DxAutocompleteModule = (function () { function DxAutocompleteModule() { } DxAutocompleteModule.decorators = [ { type: core_1.NgModule, args: [{ imports: [ item_dxi_1.DxiItemModule, template_1.DxTemplateModule ], declarations: [ DxAutocompleteComponent ], exports: [ DxAutocompleteComponent, item_dxi_1.DxiItemModule, template_1.DxTemplateModule ], },] }, ]; /** @nocollapse */ DxAutocompleteModule.ctorParameters = function () { return []; }; return DxAutocompleteModule; }()); exports.DxAutocompleteModule = DxAutocompleteModule; //# sourceMappingURL=autocomplete.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/bar-gauge.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var bar_gauge_1 = __webpack_require__("./node_modules/devextreme/viz/bar_gauge.js"); var component_1 = __webpack_require__("./node_modules/devextreme-angular/core/component.js"); var template_host_1 = __webpack_require__("./node_modules/devextreme-angular/core/template-host.js"); var template_1 = __webpack_require__("./node_modules/devextreme-angular/core/template.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var watcher_helper_1 = __webpack_require__("./node_modules/devextreme-angular/core/watcher-helper.js"); var iterable_differ_helper_1 = __webpack_require__("./node_modules/devextreme-angular/core/iterable-differ-helper.js"); var animation_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/animation.js"); var export_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/export.js"); var geometry_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/geometry.js"); var label_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/label.js"); var font_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/font.js"); var format_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/format.js"); var loading_indicator_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/loading-indicator.js"); var margin_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/margin.js"); var size_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/size.js"); var subtitle_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/subtitle.js"); var title_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/title.js"); var tooltip_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/tooltip.js"); var border_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/border.js"); var shadow_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/shadow.js"); /** * The BarGauge widget contains several circular bars that each indicates a single value. */ var DxBarGaugeComponent = (function (_super) { __extends(DxBarGaugeComponent, _super); function DxBarGaugeComponent(elementRef, ngZone, templateHost, _watcherHelper, _idh, optionHost) { var _this = _super.call(this, elementRef, ngZone, templateHost, _watcherHelper) || this; _this._watcherHelper = _watcherHelper; _this._idh = _idh; _this._createEventEmitters([ { subscribe: 'disposing', emit: 'onDisposing' }, { subscribe: 'drawn', emit: 'onDrawn' }, { subscribe: 'exported', emit: 'onExported' }, { subscribe: 'exporting', emit: 'onExporting' }, { subscribe: 'fileSaving', emit: 'onFileSaving' }, { subscribe: 'incidentOccurred', emit: 'onIncidentOccurred' }, { subscribe: 'initialized', emit: 'onInitialized' }, { subscribe: 'optionChanged', emit: 'onOptionChanged' }, { subscribe: 'tooltipHidden', emit: 'onTooltipHidden' }, { subscribe: 'tooltipShown', emit: 'onTooltipShown' }, { emit: 'animationChange' }, { emit: 'backgroundColorChange' }, { emit: 'barSpacingChange' }, { emit: 'baseValueChange' }, { emit: 'elementAttrChange' }, { emit: 'endValueChange' }, { emit: 'exportChange' }, { emit: 'geometryChange' }, { emit: 'labelChange' }, { emit: 'loadingIndicatorChange' }, { emit: 'marginChange' }, { emit: 'paletteChange' }, { emit: 'pathModifiedChange' }, { emit: 'redrawOnResizeChange' }, { emit: 'relativeInnerRadiusChange' }, { emit: 'rtlEnabledChange' }, { emit: 'sizeChange' }, { emit: 'startValueChange' }, { emit: 'subtitleChange' }, { emit: 'themeChange' }, { emit: 'titleChange' }, { emit: 'tooltipChange' }, { emit: 'valuesChange' } ]); _this._idh.setHost(_this); optionHost.setHost(_this); return _this; } Object.defineProperty(DxBarGaugeComponent.prototype, "animation", { /** * Specifies animation options. */ get: function () { return this._getOption('animation'); }, set: function (value) { this._setOption('animation', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxBarGaugeComponent.prototype, "backgroundColor", { /** * Specifies a color for the remaining segment of the bar's track. */ get: function () { return this._getOption('backgroundColor'); }, set: function (value) { this._setOption('backgroundColor', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxBarGaugeComponent.prototype, "barSpacing", { /** * Specifies a distance between bars in pixels. */ get: function () { return this._getOption('barSpacing'); }, set: function (value) { this._setOption('barSpacing', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxBarGaugeComponent.prototype, "baseValue", { /** * Specifies a base value for bars. */ get: function () { return this._getOption('baseValue'); }, set: function (value) { this._setOption('baseValue', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxBarGaugeComponent.prototype, "elementAttr", { /** * Specifies the attributes to be attached to the widget's root element. */ get: function () { return this._getOption('elementAttr'); }, set: function (value) { this._setOption('elementAttr', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxBarGaugeComponent.prototype, "endValue", { /** * Specifies an end value for the gauge's invisible scale. */ get: function () { return this._getOption('endValue'); }, set: function (value) { this._setOption('endValue', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxBarGaugeComponent.prototype, "export", { /** * Configures the exporting and printing features. */ get: function () { return this._getOption('export'); }, set: function (value) { this._setOption('export', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxBarGaugeComponent.prototype, "geometry", { /** * Defines the shape of the gauge's arc. */ get: function () { return this._getOption('geometry'); }, set: function (value) { this._setOption('geometry', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxBarGaugeComponent.prototype, "label", { /** * Specifies the options of the labels that accompany gauge bars. */ get: function () { return this._getOption('label'); }, set: function (value) { this._setOption('label', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxBarGaugeComponent.prototype, "loadingIndicator", { /** * Configures the loading indicator. */ get: function () { return this._getOption('loadingIndicator'); }, set: function (value) { this._setOption('loadingIndicator', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxBarGaugeComponent.prototype, "margin", { /** * Generates space around the widget. */ get: function () { return this._getOption('margin'); }, set: function (value) { this._setOption('margin', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxBarGaugeComponent.prototype, "palette", { /** * Sets the name of the palette or an array of colors to be used for coloring the gauge range container. */ get: function () { return this._getOption('palette'); }, set: function (value) { this._setOption('palette', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxBarGaugeComponent.prototype, "pathModified", { /** * Notifies the widget that it is embedded into an HTML page that uses a tag modifying the path. */ get: function () { return this._getOption('pathModified'); }, set: function (value) { this._setOption('pathModified', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxBarGaugeComponent.prototype, "redrawOnResize", { /** * Specifies whether to redraw the widget when the size of the parent browser window changes or a mobile device rotates. */ get: function () { return this._getOption('redrawOnResize'); }, set: function (value) { this._setOption('redrawOnResize', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxBarGaugeComponent.prototype, "relativeInnerRadius", { /** * Defines the radius of the bar that is closest to the center relatively to the radius of the topmost bar. */ get: function () { return this._getOption('relativeInnerRadius'); }, set: function (value) { this._setOption('relativeInnerRadius', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxBarGaugeComponent.prototype, "rtlEnabled", { /** * Switches the widget to a right-to-left representation. */ get: function () { return this._getOption('rtlEnabled'); }, set: function (value) { this._setOption('rtlEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxBarGaugeComponent.prototype, "size", { /** * Specifies the widget's size in pixels. */ get: function () { return this._getOption('size'); }, set: function (value) { this._setOption('size', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxBarGaugeComponent.prototype, "startValue", { /** * Specifies a start value for the gauge's invisible scale. */ get: function () { return this._getOption('startValue'); }, set: function (value) { this._setOption('startValue', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxBarGaugeComponent.prototype, "subtitle", { /** * Use the title.subtitle option instead. */ get: function () { return this._getOption('subtitle'); }, set: function (value) { this._setOption('subtitle', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxBarGaugeComponent.prototype, "theme", { /** * Sets the name of the theme the widget uses. */ get: function () { return this._getOption('theme'); }, set: function (value) { this._setOption('theme', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxBarGaugeComponent.prototype, "title", { /** * Configures the widget's title. */ get: function () { return this._getOption('title'); }, set: function (value) { this._setOption('title', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxBarGaugeComponent.prototype, "tooltip", { /** * Configures tooltips. */ get: function () { return this._getOption('tooltip'); }, set: function (value) { this._setOption('tooltip', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxBarGaugeComponent.prototype, "values", { /** * Specifies the array of values to be indicated on a bar gauge. */ get: function () { return this._getOption('values'); }, set: function (value) { this._setOption('values', value); }, enumerable: true, configurable: true }); DxBarGaugeComponent.prototype._createInstance = function (element, options) { return new bar_gauge_1.default(element, options); }; DxBarGaugeComponent.prototype.ngOnDestroy = function () { this._destroyWidget(); }; DxBarGaugeComponent.prototype.ngOnChanges = function (changes) { _super.prototype.ngOnChanges.call(this, changes); this.setupChanges('palette', changes); this.setupChanges('values', changes); }; DxBarGaugeComponent.prototype.setupChanges = function (prop, changes) { if (!(prop in this._optionsToUpdate)) { this._idh.setup(prop, changes); } }; DxBarGaugeComponent.prototype.ngDoCheck = function () { this._idh.doCheck('palette'); this._idh.doCheck('values'); this._watcherHelper.checkWatchers(); _super.prototype.ngDoCheck.call(this); _super.prototype.clearChangedOptions.call(this); }; DxBarGaugeComponent.prototype._setOption = function (name, value) { var isSetup = this._idh.setupSingle(name, value); var isChanged = this._idh.getChanges(name, value) !== null; if (isSetup || isChanged) { _super.prototype._setOption.call(this, name, value); } }; DxBarGaugeComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dx-bar-gauge', template: '', styles: [' :host { display: block; }'], providers: [ template_host_1.DxTemplateHost, watcher_helper_1.WatcherHelper, nested_option_1.NestedOptionHost, iterable_differ_helper_1.IterableDifferHelper ] },] }, ]; /** @nocollapse */ DxBarGaugeComponent.ctorParameters = function () { return [ { type: core_1.ElementRef, }, { type: core_1.NgZone, }, { type: template_host_1.DxTemplateHost, }, { type: watcher_helper_1.WatcherHelper, }, { type: iterable_differ_helper_1.IterableDifferHelper, }, { type: nested_option_1.NestedOptionHost, }, ]; }; DxBarGaugeComponent.propDecorators = { 'animation': [{ type: core_1.Input },], 'backgroundColor': [{ type: core_1.Input },], 'barSpacing': [{ type: core_1.Input },], 'baseValue': [{ type: core_1.Input },], 'elementAttr': [{ type: core_1.Input },], 'endValue': [{ type: core_1.Input },], 'export': [{ type: core_1.Input },], 'geometry': [{ type: core_1.Input },], 'label': [{ type: core_1.Input },], 'loadingIndicator': [{ type: core_1.Input },], 'margin': [{ type: core_1.Input },], 'palette': [{ type: core_1.Input },], 'pathModified': [{ type: core_1.Input },], 'redrawOnResize': [{ type: core_1.Input },], 'relativeInnerRadius': [{ type: core_1.Input },], 'rtlEnabled': [{ type: core_1.Input },], 'size': [{ type: core_1.Input },], 'startValue': [{ type: core_1.Input },], 'subtitle': [{ type: core_1.Input },], 'theme': [{ type: core_1.Input },], 'title': [{ type: core_1.Input },], 'tooltip': [{ type: core_1.Input },], 'values': [{ type: core_1.Input },], 'onDisposing': [{ type: core_1.Output },], 'onDrawn': [{ type: core_1.Output },], 'onExported': [{ type: core_1.Output },], 'onExporting': [{ type: core_1.Output },], 'onFileSaving': [{ type: core_1.Output },], 'onIncidentOccurred': [{ type: core_1.Output },], 'onInitialized': [{ type: core_1.Output },], 'onOptionChanged': [{ type: core_1.Output },], 'onTooltipHidden': [{ type: core_1.Output },], 'onTooltipShown': [{ type: core_1.Output },], 'animationChange': [{ type: core_1.Output },], 'backgroundColorChange': [{ type: core_1.Output },], 'barSpacingChange': [{ type: core_1.Output },], 'baseValueChange': [{ type: core_1.Output },], 'elementAttrChange': [{ type: core_1.Output },], 'endValueChange': [{ type: core_1.Output },], 'exportChange': [{ type: core_1.Output },], 'geometryChange': [{ type: core_1.Output },], 'labelChange': [{ type: core_1.Output },], 'loadingIndicatorChange': [{ type: core_1.Output },], 'marginChange': [{ type: core_1.Output },], 'paletteChange': [{ type: core_1.Output },], 'pathModifiedChange': [{ type: core_1.Output },], 'redrawOnResizeChange': [{ type: core_1.Output },], 'relativeInnerRadiusChange': [{ type: core_1.Output },], 'rtlEnabledChange': [{ type: core_1.Output },], 'sizeChange': [{ type: core_1.Output },], 'startValueChange': [{ type: core_1.Output },], 'subtitleChange': [{ type: core_1.Output },], 'themeChange': [{ type: core_1.Output },], 'titleChange': [{ type: core_1.Output },], 'tooltipChange': [{ type: core_1.Output },], 'valuesChange': [{ type: core_1.Output },], }; return DxBarGaugeComponent; }(component_1.DxComponent)); exports.DxBarGaugeComponent = DxBarGaugeComponent; var DxBarGaugeModule = (function () { function DxBarGaugeModule() { } DxBarGaugeModule.decorators = [ { type: core_1.NgModule, args: [{ imports: [ animation_1.DxoAnimationModule, export_1.DxoExportModule, geometry_1.DxoGeometryModule, label_1.DxoLabelModule, font_1.DxoFontModule, format_1.DxoFormatModule, loading_indicator_1.DxoLoadingIndicatorModule, margin_1.DxoMarginModule, size_1.DxoSizeModule, subtitle_1.DxoSubtitleModule, title_1.DxoTitleModule, tooltip_1.DxoTooltipModule, border_1.DxoBorderModule, shadow_1.DxoShadowModule, template_1.DxTemplateModule ], declarations: [ DxBarGaugeComponent ], exports: [ DxBarGaugeComponent, animation_1.DxoAnimationModule, export_1.DxoExportModule, geometry_1.DxoGeometryModule, label_1.DxoLabelModule, font_1.DxoFontModule, format_1.DxoFormatModule, loading_indicator_1.DxoLoadingIndicatorModule, margin_1.DxoMarginModule, size_1.DxoSizeModule, subtitle_1.DxoSubtitleModule, title_1.DxoTitleModule, tooltip_1.DxoTooltipModule, border_1.DxoBorderModule, shadow_1.DxoShadowModule, template_1.DxTemplateModule ], },] }, ]; /** @nocollapse */ DxBarGaugeModule.ctorParameters = function () { return []; }; return DxBarGaugeModule; }()); exports.DxBarGaugeModule = DxBarGaugeModule; //# sourceMappingURL=bar-gauge.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/box.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var box_1 = __webpack_require__("./node_modules/devextreme/ui/box.js"); var component_1 = __webpack_require__("./node_modules/devextreme-angular/core/component.js"); var template_host_1 = __webpack_require__("./node_modules/devextreme-angular/core/template-host.js"); var template_1 = __webpack_require__("./node_modules/devextreme-angular/core/template.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var watcher_helper_1 = __webpack_require__("./node_modules/devextreme-angular/core/watcher-helper.js"); var iterable_differ_helper_1 = __webpack_require__("./node_modules/devextreme-angular/core/iterable-differ-helper.js"); var item_dxi_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/item-dxi.js"); var box_2 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/box.js"); var item_dxi_2 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/item-dxi.js"); /** * The Box widget allows you to arrange various elements within it. Separate and adaptive, the Box widget acts as a building block for the layout. */ var DxBoxComponent = (function (_super) { __extends(DxBoxComponent, _super); function DxBoxComponent(elementRef, ngZone, templateHost, _watcherHelper, _idh, optionHost) { var _this = _super.call(this, elementRef, ngZone, templateHost, _watcherHelper) || this; _this._watcherHelper = _watcherHelper; _this._idh = _idh; _this._createEventEmitters([ { subscribe: 'contentReady', emit: 'onContentReady' }, { subscribe: 'disposing', emit: 'onDisposing' }, { subscribe: 'initialized', emit: 'onInitialized' }, { subscribe: 'itemClick', emit: 'onItemClick' }, { subscribe: 'itemContextMenu', emit: 'onItemContextMenu' }, { subscribe: 'itemHold', emit: 'onItemHold' }, { subscribe: 'itemRendered', emit: 'onItemRendered' }, { subscribe: 'optionChanged', emit: 'onOptionChanged' }, { emit: 'alignChange' }, { emit: 'crossAlignChange' }, { emit: 'dataSourceChange' }, { emit: 'directionChange' }, { emit: 'disabledChange' }, { emit: 'elementAttrChange' }, { emit: 'heightChange' }, { emit: 'hoverStateEnabledChange' }, { emit: 'itemHoldTimeoutChange' }, { emit: 'itemsChange' }, { emit: 'itemTemplateChange' }, { emit: 'rtlEnabledChange' }, { emit: 'visibleChange' }, { emit: 'widthChange' } ]); _this._idh.setHost(_this); optionHost.setHost(_this); return _this; } Object.defineProperty(DxBoxComponent.prototype, "align", { /** * Specifies how widget items are aligned along the main direction. */ get: function () { return this._getOption('align'); }, set: function (value) { this._setOption('align', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxBoxComponent.prototype, "crossAlign", { /** * Specifies how widget items are aligned cross-wise. */ get: function () { return this._getOption('crossAlign'); }, set: function (value) { this._setOption('crossAlign', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxBoxComponent.prototype, "dataSource", { /** * A data source used to fetch data to be displayed by the widget. */ get: function () { return this._getOption('dataSource'); }, set: function (value) { this._setOption('dataSource', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxBoxComponent.prototype, "direction", { /** * Specifies the direction of item positioning in the widget. */ get: function () { return this._getOption('direction'); }, set: function (value) { this._setOption('direction', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxBoxComponent.prototype, "disabled", { /** * Specifies whether the widget responds to user interaction. */ get: function () { return this._getOption('disabled'); }, set: function (value) { this._setOption('disabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxBoxComponent.prototype, "elementAttr", { /** * Specifies the attributes to be attached to the widget's root element. */ get: function () { return this._getOption('elementAttr'); }, set: function (value) { this._setOption('elementAttr', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxBoxComponent.prototype, "height", { /** * Specifies the widget's height. */ get: function () { return this._getOption('height'); }, set: function (value) { this._setOption('height', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxBoxComponent.prototype, "hoverStateEnabled", { /** * Specifies whether the widget changes its state when a user pauses on it. */ get: function () { return this._getOption('hoverStateEnabled'); }, set: function (value) { this._setOption('hoverStateEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxBoxComponent.prototype, "itemHoldTimeout", { /** * The time period in milliseconds before the onItemHold event is raised. */ get: function () { return this._getOption('itemHoldTimeout'); }, set: function (value) { this._setOption('itemHoldTimeout', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxBoxComponent.prototype, "items", { /** * An array of items displayed by the widget. */ get: function () { return this._getOption('items'); }, set: function (value) { this._setOption('items', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxBoxComponent.prototype, "itemTemplate", { /** * Specifies a custom template for items. */ get: function () { return this._getOption('itemTemplate'); }, set: function (value) { this._setOption('itemTemplate', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxBoxComponent.prototype, "rtlEnabled", { /** * Switches the widget to a right-to-left representation. */ get: function () { return this._getOption('rtlEnabled'); }, set: function (value) { this._setOption('rtlEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxBoxComponent.prototype, "visible", { /** * Specifies whether the widget is visible. */ get: function () { return this._getOption('visible'); }, set: function (value) { this._setOption('visible', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxBoxComponent.prototype, "width", { /** * Specifies the widget's width. */ get: function () { return this._getOption('width'); }, set: function (value) { this._setOption('width', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxBoxComponent.prototype, "itemsChildren", { get: function () { return this._getOption('items'); }, set: function (value) { this.setChildren('items', value); }, enumerable: true, configurable: true }); DxBoxComponent.prototype._createInstance = function (element, options) { return new box_1.default(element, options); }; DxBoxComponent.prototype.ngOnDestroy = function () { this._destroyWidget(); }; DxBoxComponent.prototype.ngOnChanges = function (changes) { _super.prototype.ngOnChanges.call(this, changes); this.setupChanges('dataSource', changes); this.setupChanges('items', changes); }; DxBoxComponent.prototype.setupChanges = function (prop, changes) { if (!(prop in this._optionsToUpdate)) { this._idh.setup(prop, changes); } }; DxBoxComponent.prototype.ngDoCheck = function () { this._idh.doCheck('dataSource'); this._idh.doCheck('items'); this._watcherHelper.checkWatchers(); _super.prototype.ngDoCheck.call(this); _super.prototype.clearChangedOptions.call(this); }; DxBoxComponent.prototype._setOption = function (name, value) { var isSetup = this._idh.setupSingle(name, value); var isChanged = this._idh.getChanges(name, value) !== null; if (isSetup || isChanged) { _super.prototype._setOption.call(this, name, value); } }; DxBoxComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dx-box', template: '', providers: [ template_host_1.DxTemplateHost, watcher_helper_1.WatcherHelper, nested_option_1.NestedOptionHost, iterable_differ_helper_1.IterableDifferHelper ] },] }, ]; /** @nocollapse */ DxBoxComponent.ctorParameters = function () { return [ { type: core_1.ElementRef, }, { type: core_1.NgZone, }, { type: template_host_1.DxTemplateHost, }, { type: watcher_helper_1.WatcherHelper, }, { type: iterable_differ_helper_1.IterableDifferHelper, }, { type: nested_option_1.NestedOptionHost, }, ]; }; DxBoxComponent.propDecorators = { 'align': [{ type: core_1.Input },], 'crossAlign': [{ type: core_1.Input },], 'dataSource': [{ type: core_1.Input },], 'direction': [{ type: core_1.Input },], 'disabled': [{ type: core_1.Input },], 'elementAttr': [{ type: core_1.Input },], 'height': [{ type: core_1.Input },], 'hoverStateEnabled': [{ type: core_1.Input },], 'itemHoldTimeout': [{ type: core_1.Input },], 'items': [{ type: core_1.Input },], 'itemTemplate': [{ type: core_1.Input },], 'rtlEnabled': [{ type: core_1.Input },], 'visible': [{ type: core_1.Input },], 'width': [{ type: core_1.Input },], 'onContentReady': [{ type: core_1.Output },], 'onDisposing': [{ type: core_1.Output },], 'onInitialized': [{ type: core_1.Output },], 'onItemClick': [{ type: core_1.Output },], 'onItemContextMenu': [{ type: core_1.Output },], 'onItemHold': [{ type: core_1.Output },], 'onItemRendered': [{ type: core_1.Output },], 'onOptionChanged': [{ type: core_1.Output },], 'alignChange': [{ type: core_1.Output },], 'crossAlignChange': [{ type: core_1.Output },], 'dataSourceChange': [{ type: core_1.Output },], 'directionChange': [{ type: core_1.Output },], 'disabledChange': [{ type: core_1.Output },], 'elementAttrChange': [{ type: core_1.Output },], 'heightChange': [{ type: core_1.Output },], 'hoverStateEnabledChange': [{ type: core_1.Output },], 'itemHoldTimeoutChange': [{ type: core_1.Output },], 'itemsChange': [{ type: core_1.Output },], 'itemTemplateChange': [{ type: core_1.Output },], 'rtlEnabledChange': [{ type: core_1.Output },], 'visibleChange': [{ type: core_1.Output },], 'widthChange': [{ type: core_1.Output },], 'itemsChildren': [{ type: core_1.ContentChildren, args: [item_dxi_2.DxiItemComponent,] },], }; return DxBoxComponent; }(component_1.DxComponent)); exports.DxBoxComponent = DxBoxComponent; var DxBoxModule = (function () { function DxBoxModule() { } DxBoxModule.decorators = [ { type: core_1.NgModule, args: [{ imports: [ item_dxi_1.DxiItemModule, box_2.DxoBoxModule, template_1.DxTemplateModule ], declarations: [ DxBoxComponent ], exports: [ DxBoxComponent, item_dxi_1.DxiItemModule, box_2.DxoBoxModule, template_1.DxTemplateModule ], },] }, ]; /** @nocollapse */ DxBoxModule.ctorParameters = function () { return []; }; return DxBoxModule; }()); exports.DxBoxModule = DxBoxModule; //# sourceMappingURL=box.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/bullet.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var bullet_1 = __webpack_require__("./node_modules/devextreme/viz/bullet.js"); var component_1 = __webpack_require__("./node_modules/devextreme-angular/core/component.js"); var template_host_1 = __webpack_require__("./node_modules/devextreme-angular/core/template-host.js"); var template_1 = __webpack_require__("./node_modules/devextreme-angular/core/template.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var watcher_helper_1 = __webpack_require__("./node_modules/devextreme-angular/core/watcher-helper.js"); var margin_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/margin.js"); var size_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/size.js"); var tooltip_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/tooltip.js"); var border_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/border.js"); var font_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/font.js"); var format_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/format.js"); var shadow_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/shadow.js"); /** * The Bullet widget is useful when you need to compare a single measure to a target value. The widget comprises a horizontal bar indicating the measure and a vertical line indicating the target value. */ var DxBulletComponent = (function (_super) { __extends(DxBulletComponent, _super); function DxBulletComponent(elementRef, ngZone, templateHost, _watcherHelper, optionHost) { var _this = _super.call(this, elementRef, ngZone, templateHost, _watcherHelper) || this; _this._createEventEmitters([ { subscribe: 'disposing', emit: 'onDisposing' }, { subscribe: 'drawn', emit: 'onDrawn' }, { subscribe: 'exported', emit: 'onExported' }, { subscribe: 'exporting', emit: 'onExporting' }, { subscribe: 'fileSaving', emit: 'onFileSaving' }, { subscribe: 'incidentOccurred', emit: 'onIncidentOccurred' }, { subscribe: 'initialized', emit: 'onInitialized' }, { subscribe: 'optionChanged', emit: 'onOptionChanged' }, { subscribe: 'tooltipHidden', emit: 'onTooltipHidden' }, { subscribe: 'tooltipShown', emit: 'onTooltipShown' }, { emit: 'colorChange' }, { emit: 'elementAttrChange' }, { emit: 'endScaleValueChange' }, { emit: 'marginChange' }, { emit: 'pathModifiedChange' }, { emit: 'rtlEnabledChange' }, { emit: 'showTargetChange' }, { emit: 'showZeroLevelChange' }, { emit: 'sizeChange' }, { emit: 'startScaleValueChange' }, { emit: 'targetChange' }, { emit: 'targetColorChange' }, { emit: 'targetWidthChange' }, { emit: 'themeChange' }, { emit: 'tooltipChange' }, { emit: 'valueChange' } ]); optionHost.setHost(_this); return _this; } Object.defineProperty(DxBulletComponent.prototype, "color", { /** * Specifies a color for the bullet bar. */ get: function () { return this._getOption('color'); }, set: function (value) { this._setOption('color', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxBulletComponent.prototype, "elementAttr", { /** * Specifies the attributes to be attached to the widget's root element. */ get: function () { return this._getOption('elementAttr'); }, set: function (value) { this._setOption('elementAttr', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxBulletComponent.prototype, "endScaleValue", { /** * Specifies an end value for the invisible scale. */ get: function () { return this._getOption('endScaleValue'); }, set: function (value) { this._setOption('endScaleValue', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxBulletComponent.prototype, "margin", { /** * Generates space around the widget. */ get: function () { return this._getOption('margin'); }, set: function (value) { this._setOption('margin', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxBulletComponent.prototype, "pathModified", { /** * Notifies the widget that it is embedded into an HTML page that uses a tag modifying the path. */ get: function () { return this._getOption('pathModified'); }, set: function (value) { this._setOption('pathModified', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxBulletComponent.prototype, "rtlEnabled", { /** * Switches the widget to a right-to-left representation. */ get: function () { return this._getOption('rtlEnabled'); }, set: function (value) { this._setOption('rtlEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxBulletComponent.prototype, "showTarget", { /** * Specifies whether or not to show the target line. */ get: function () { return this._getOption('showTarget'); }, set: function (value) { this._setOption('showTarget', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxBulletComponent.prototype, "showZeroLevel", { /** * Specifies whether or not to show the line indicating zero on the invisible scale. */ get: function () { return this._getOption('showZeroLevel'); }, set: function (value) { this._setOption('showZeroLevel', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxBulletComponent.prototype, "size", { /** * Specifies the widget's size in pixels. */ get: function () { return this._getOption('size'); }, set: function (value) { this._setOption('size', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxBulletComponent.prototype, "startScaleValue", { /** * Specifies a start value for the invisible scale. */ get: function () { return this._getOption('startScaleValue'); }, set: function (value) { this._setOption('startScaleValue', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxBulletComponent.prototype, "target", { /** * Specifies the value indicated by the target line. */ get: function () { return this._getOption('target'); }, set: function (value) { this._setOption('target', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxBulletComponent.prototype, "targetColor", { /** * Specifies a color for both the target and zero level lines. */ get: function () { return this._getOption('targetColor'); }, set: function (value) { this._setOption('targetColor', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxBulletComponent.prototype, "targetWidth", { /** * Specifies the width of the target line. */ get: function () { return this._getOption('targetWidth'); }, set: function (value) { this._setOption('targetWidth', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxBulletComponent.prototype, "theme", { /** * Sets the name of the theme the widget uses. */ get: function () { return this._getOption('theme'); }, set: function (value) { this._setOption('theme', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxBulletComponent.prototype, "tooltip", { /** * Configures the tooltip. */ get: function () { return this._getOption('tooltip'); }, set: function (value) { this._setOption('tooltip', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxBulletComponent.prototype, "value", { /** * Specifies the primary value indicated by the bullet bar. */ get: function () { return this._getOption('value'); }, set: function (value) { this._setOption('value', value); }, enumerable: true, configurable: true }); DxBulletComponent.prototype._createInstance = function (element, options) { return new bullet_1.default(element, options); }; DxBulletComponent.prototype.ngOnDestroy = function () { this._destroyWidget(); }; DxBulletComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dx-bullet', template: '', styles: [' :host { display: block; }'], providers: [ template_host_1.DxTemplateHost, watcher_helper_1.WatcherHelper, nested_option_1.NestedOptionHost ] },] }, ]; /** @nocollapse */ DxBulletComponent.ctorParameters = function () { return [ { type: core_1.ElementRef, }, { type: core_1.NgZone, }, { type: template_host_1.DxTemplateHost, }, { type: watcher_helper_1.WatcherHelper, }, { type: nested_option_1.NestedOptionHost, }, ]; }; DxBulletComponent.propDecorators = { 'color': [{ type: core_1.Input },], 'elementAttr': [{ type: core_1.Input },], 'endScaleValue': [{ type: core_1.Input },], 'margin': [{ type: core_1.Input },], 'pathModified': [{ type: core_1.Input },], 'rtlEnabled': [{ type: core_1.Input },], 'showTarget': [{ type: core_1.Input },], 'showZeroLevel': [{ type: core_1.Input },], 'size': [{ type: core_1.Input },], 'startScaleValue': [{ type: core_1.Input },], 'target': [{ type: core_1.Input },], 'targetColor': [{ type: core_1.Input },], 'targetWidth': [{ type: core_1.Input },], 'theme': [{ type: core_1.Input },], 'tooltip': [{ type: core_1.Input },], 'value': [{ type: core_1.Input },], 'onDisposing': [{ type: core_1.Output },], 'onDrawn': [{ type: core_1.Output },], 'onExported': [{ type: core_1.Output },], 'onExporting': [{ type: core_1.Output },], 'onFileSaving': [{ type: core_1.Output },], 'onIncidentOccurred': [{ type: core_1.Output },], 'onInitialized': [{ type: core_1.Output },], 'onOptionChanged': [{ type: core_1.Output },], 'onTooltipHidden': [{ type: core_1.Output },], 'onTooltipShown': [{ type: core_1.Output },], 'colorChange': [{ type: core_1.Output },], 'elementAttrChange': [{ type: core_1.Output },], 'endScaleValueChange': [{ type: core_1.Output },], 'marginChange': [{ type: core_1.Output },], 'pathModifiedChange': [{ type: core_1.Output },], 'rtlEnabledChange': [{ type: core_1.Output },], 'showTargetChange': [{ type: core_1.Output },], 'showZeroLevelChange': [{ type: core_1.Output },], 'sizeChange': [{ type: core_1.Output },], 'startScaleValueChange': [{ type: core_1.Output },], 'targetChange': [{ type: core_1.Output },], 'targetColorChange': [{ type: core_1.Output },], 'targetWidthChange': [{ type: core_1.Output },], 'themeChange': [{ type: core_1.Output },], 'tooltipChange': [{ type: core_1.Output },], 'valueChange': [{ type: core_1.Output },], }; return DxBulletComponent; }(component_1.DxComponent)); exports.DxBulletComponent = DxBulletComponent; var DxBulletModule = (function () { function DxBulletModule() { } DxBulletModule.decorators = [ { type: core_1.NgModule, args: [{ imports: [ margin_1.DxoMarginModule, size_1.DxoSizeModule, tooltip_1.DxoTooltipModule, border_1.DxoBorderModule, font_1.DxoFontModule, format_1.DxoFormatModule, shadow_1.DxoShadowModule, template_1.DxTemplateModule ], declarations: [ DxBulletComponent ], exports: [ DxBulletComponent, margin_1.DxoMarginModule, size_1.DxoSizeModule, tooltip_1.DxoTooltipModule, border_1.DxoBorderModule, font_1.DxoFontModule, format_1.DxoFormatModule, shadow_1.DxoShadowModule, template_1.DxTemplateModule ], },] }, ]; /** @nocollapse */ DxBulletModule.ctorParameters = function () { return []; }; return DxBulletModule; }()); exports.DxBulletModule = DxBulletModule; //# sourceMappingURL=bullet.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/button.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var button_1 = __webpack_require__("./node_modules/devextreme/ui/button.js"); var component_1 = __webpack_require__("./node_modules/devextreme-angular/core/component.js"); var template_host_1 = __webpack_require__("./node_modules/devextreme-angular/core/template-host.js"); var template_1 = __webpack_require__("./node_modules/devextreme-angular/core/template.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var watcher_helper_1 = __webpack_require__("./node_modules/devextreme-angular/core/watcher-helper.js"); /** * The Button widget is a simple button that performs specified commands when a user clicks it. */ var DxButtonComponent = (function (_super) { __extends(DxButtonComponent, _super); function DxButtonComponent(elementRef, ngZone, templateHost, _watcherHelper, optionHost) { var _this = _super.call(this, elementRef, ngZone, templateHost, _watcherHelper) || this; _this._createEventEmitters([ { subscribe: 'click', emit: 'onClick' }, { subscribe: 'contentReady', emit: 'onContentReady' }, { subscribe: 'disposing', emit: 'onDisposing' }, { subscribe: 'initialized', emit: 'onInitialized' }, { subscribe: 'optionChanged', emit: 'onOptionChanged' }, { emit: 'accessKeyChange' }, { emit: 'activeStateEnabledChange' }, { emit: 'disabledChange' }, { emit: 'elementAttrChange' }, { emit: 'focusStateEnabledChange' }, { emit: 'heightChange' }, { emit: 'hintChange' }, { emit: 'hoverStateEnabledChange' }, { emit: 'iconChange' }, { emit: 'iconSrcChange' }, { emit: 'rtlEnabledChange' }, { emit: 'tabIndexChange' }, { emit: 'templateChange' }, { emit: 'textChange' }, { emit: 'typeChange' }, { emit: 'useSubmitBehaviorChange' }, { emit: 'validationGroupChange' }, { emit: 'visibleChange' }, { emit: 'widthChange' } ]); optionHost.setHost(_this); return _this; } Object.defineProperty(DxButtonComponent.prototype, "accessKey", { /** * Specifies the shortcut key that sets focus on the widget. */ get: function () { return this._getOption('accessKey'); }, set: function (value) { this._setOption('accessKey', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxButtonComponent.prototype, "activeStateEnabled", { /** * A Boolean value specifying whether or not the widget changes its state when interacting with a user. */ get: function () { return this._getOption('activeStateEnabled'); }, set: function (value) { this._setOption('activeStateEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxButtonComponent.prototype, "disabled", { /** * Specifies whether the widget responds to user interaction. */ get: function () { return this._getOption('disabled'); }, set: function (value) { this._setOption('disabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxButtonComponent.prototype, "elementAttr", { /** * Specifies the attributes to be attached to the widget's root element. */ get: function () { return this._getOption('elementAttr'); }, set: function (value) { this._setOption('elementAttr', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxButtonComponent.prototype, "focusStateEnabled", { /** * Specifies whether the widget can be focused using keyboard navigation. */ get: function () { return this._getOption('focusStateEnabled'); }, set: function (value) { this._setOption('focusStateEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxButtonComponent.prototype, "height", { /** * Specifies the widget's height. */ get: function () { return this._getOption('height'); }, set: function (value) { this._setOption('height', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxButtonComponent.prototype, "hint", { /** * Specifies text for a hint that appears when a user pauses on the widget. */ get: function () { return this._getOption('hint'); }, set: function (value) { this._setOption('hint', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxButtonComponent.prototype, "hoverStateEnabled", { /** * Specifies whether the widget changes its state when a user pauses on it. */ get: function () { return this._getOption('hoverStateEnabled'); }, set: function (value) { this._setOption('hoverStateEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxButtonComponent.prototype, "icon", { /** * Specifies the icon to be displayed on the button. */ get: function () { return this._getOption('icon'); }, set: function (value) { this._setOption('icon', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxButtonComponent.prototype, "iconSrc", { /** * Use the icon option instead. */ get: function () { return this._getOption('iconSrc'); }, set: function (value) { this._setOption('iconSrc', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxButtonComponent.prototype, "rtlEnabled", { /** * Switches the widget to a right-to-left representation. */ get: function () { return this._getOption('rtlEnabled'); }, set: function (value) { this._setOption('rtlEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxButtonComponent.prototype, "tabIndex", { /** * Specifies the number of the element when the Tab key is used for navigating. */ get: function () { return this._getOption('tabIndex'); }, set: function (value) { this._setOption('tabIndex', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxButtonComponent.prototype, "template", { /** * Specifies a custom template for the Button widget. */ get: function () { return this._getOption('template'); }, set: function (value) { this._setOption('template', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxButtonComponent.prototype, "text", { /** * The text displayed on the button. */ get: function () { return this._getOption('text'); }, set: function (value) { this._setOption('text', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxButtonComponent.prototype, "type", { /** * Specifies the button type. */ get: function () { return this._getOption('type'); }, set: function (value) { this._setOption('type', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxButtonComponent.prototype, "useSubmitBehavior", { /** * Specifies whether or not the button must submit an HTML form. */ get: function () { return this._getOption('useSubmitBehavior'); }, set: function (value) { this._setOption('useSubmitBehavior', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxButtonComponent.prototype, "validationGroup", { /** * Specifies the name of the validation group to be accessed in the click event handler. */ get: function () { return this._getOption('validationGroup'); }, set: function (value) { this._setOption('validationGroup', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxButtonComponent.prototype, "visible", { /** * Specifies whether the widget is visible. */ get: function () { return this._getOption('visible'); }, set: function (value) { this._setOption('visible', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxButtonComponent.prototype, "width", { /** * Specifies the widget's width. */ get: function () { return this._getOption('width'); }, set: function (value) { this._setOption('width', value); }, enumerable: true, configurable: true }); DxButtonComponent.prototype._createInstance = function (element, options) { return new button_1.default(element, options); }; DxButtonComponent.prototype.ngOnDestroy = function () { this._destroyWidget(); }; DxButtonComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dx-button', template: '', providers: [ template_host_1.DxTemplateHost, watcher_helper_1.WatcherHelper, nested_option_1.NestedOptionHost ] },] }, ]; /** @nocollapse */ DxButtonComponent.ctorParameters = function () { return [ { type: core_1.ElementRef, }, { type: core_1.NgZone, }, { type: template_host_1.DxTemplateHost, }, { type: watcher_helper_1.WatcherHelper, }, { type: nested_option_1.NestedOptionHost, }, ]; }; DxButtonComponent.propDecorators = { 'accessKey': [{ type: core_1.Input },], 'activeStateEnabled': [{ type: core_1.Input },], 'disabled': [{ type: core_1.Input },], 'elementAttr': [{ type: core_1.Input },], 'focusStateEnabled': [{ type: core_1.Input },], 'height': [{ type: core_1.Input },], 'hint': [{ type: core_1.Input },], 'hoverStateEnabled': [{ type: core_1.Input },], 'icon': [{ type: core_1.Input },], 'iconSrc': [{ type: core_1.Input },], 'rtlEnabled': [{ type: core_1.Input },], 'tabIndex': [{ type: core_1.Input },], 'template': [{ type: core_1.Input },], 'text': [{ type: core_1.Input },], 'type': [{ type: core_1.Input },], 'useSubmitBehavior': [{ type: core_1.Input },], 'validationGroup': [{ type: core_1.Input },], 'visible': [{ type: core_1.Input },], 'width': [{ type: core_1.Input },], 'onClick': [{ type: core_1.Output },], 'onContentReady': [{ type: core_1.Output },], 'onDisposing': [{ type: core_1.Output },], 'onInitialized': [{ type: core_1.Output },], 'onOptionChanged': [{ type: core_1.Output },], 'accessKeyChange': [{ type: core_1.Output },], 'activeStateEnabledChange': [{ type: core_1.Output },], 'disabledChange': [{ type: core_1.Output },], 'elementAttrChange': [{ type: core_1.Output },], 'focusStateEnabledChange': [{ type: core_1.Output },], 'heightChange': [{ type: core_1.Output },], 'hintChange': [{ type: core_1.Output },], 'hoverStateEnabledChange': [{ type: core_1.Output },], 'iconChange': [{ type: core_1.Output },], 'iconSrcChange': [{ type: core_1.Output },], 'rtlEnabledChange': [{ type: core_1.Output },], 'tabIndexChange': [{ type: core_1.Output },], 'templateChange': [{ type: core_1.Output },], 'textChange': [{ type: core_1.Output },], 'typeChange': [{ type: core_1.Output },], 'useSubmitBehaviorChange': [{ type: core_1.Output },], 'validationGroupChange': [{ type: core_1.Output },], 'visibleChange': [{ type: core_1.Output },], 'widthChange': [{ type: core_1.Output },], }; return DxButtonComponent; }(component_1.DxComponent)); exports.DxButtonComponent = DxButtonComponent; var DxButtonModule = (function () { function DxButtonModule() { } DxButtonModule.decorators = [ { type: core_1.NgModule, args: [{ imports: [ template_1.DxTemplateModule ], declarations: [ DxButtonComponent ], exports: [ DxButtonComponent, template_1.DxTemplateModule ], },] }, ]; /** @nocollapse */ DxButtonModule.ctorParameters = function () { return []; }; return DxButtonModule; }()); exports.DxButtonModule = DxButtonModule; //# sourceMappingURL=button.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/calendar.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var calendar_1 = __webpack_require__("./node_modules/devextreme/ui/calendar.js"); var validator_1 = __webpack_require__("./node_modules/devextreme-angular/ui/validator.js"); var forms_1 = __webpack_require__("./node_modules/@angular/forms/esm2015/forms.js"); var component_1 = __webpack_require__("./node_modules/devextreme-angular/core/component.js"); var template_host_1 = __webpack_require__("./node_modules/devextreme-angular/core/template-host.js"); var template_1 = __webpack_require__("./node_modules/devextreme-angular/core/template.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var watcher_helper_1 = __webpack_require__("./node_modules/devextreme-angular/core/watcher-helper.js"); var iterable_differ_helper_1 = __webpack_require__("./node_modules/devextreme-angular/core/iterable-differ-helper.js"); var CUSTOM_VALUE_ACCESSOR_PROVIDER = { provide: forms_1.NG_VALUE_ACCESSOR, useExisting: core_1.forwardRef(function () { return DxCalendarComponent; }), multi: true }; /** * The Calendar is a widget that displays a calendar and allows an end user to select the required date within a specified date range. */ var DxCalendarComponent = (function (_super) { __extends(DxCalendarComponent, _super); function DxCalendarComponent(elementRef, ngZone, templateHost, _watcherHelper, _idh, optionHost) { var _this = _super.call(this, elementRef, ngZone, templateHost, _watcherHelper) || this; _this._watcherHelper = _watcherHelper; _this._idh = _idh; _this.touched = function (_) { }; _this._createEventEmitters([ { subscribe: 'disposing', emit: 'onDisposing' }, { subscribe: 'initialized', emit: 'onInitialized' }, { subscribe: 'optionChanged', emit: 'onOptionChanged' }, { subscribe: 'valueChanged', emit: 'onValueChanged' }, { emit: 'accessKeyChange' }, { emit: 'activeStateEnabledChange' }, { emit: 'cellTemplateChange' }, { emit: 'dateSerializationFormatChange' }, { emit: 'disabledChange' }, { emit: 'disabledDatesChange' }, { emit: 'elementAttrChange' }, { emit: 'firstDayOfWeekChange' }, { emit: 'focusStateEnabledChange' }, { emit: 'heightChange' }, { emit: 'hintChange' }, { emit: 'hoverStateEnabledChange' }, { emit: 'isValidChange' }, { emit: 'maxChange' }, { emit: 'maxZoomLevelChange' }, { emit: 'minChange' }, { emit: 'minZoomLevelChange' }, { emit: 'nameChange' }, { emit: 'readOnlyChange' }, { emit: 'rtlEnabledChange' }, { emit: 'showTodayButtonChange' }, { emit: 'tabIndexChange' }, { emit: 'validationErrorChange' }, { emit: 'validationMessageModeChange' }, { emit: 'valueChange' }, { emit: 'visibleChange' }, { emit: 'widthChange' }, { emit: 'zoomLevelChange' }, { emit: 'onBlur' } ]); _this._idh.setHost(_this); optionHost.setHost(_this); return _this; } Object.defineProperty(DxCalendarComponent.prototype, "accessKey", { /** * Specifies the shortcut key that sets focus on the widget. */ get: function () { return this._getOption('accessKey'); }, set: function (value) { this._setOption('accessKey', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxCalendarComponent.prototype, "activeStateEnabled", { /** * Specifies whether or not the widget changes its state when interacting with a user. */ get: function () { return this._getOption('activeStateEnabled'); }, set: function (value) { this._setOption('activeStateEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxCalendarComponent.prototype, "cellTemplate", { /** * Specifies a custom template for calendar cells. */ get: function () { return this._getOption('cellTemplate'); }, set: function (value) { this._setOption('cellTemplate', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxCalendarComponent.prototype, "dateSerializationFormat", { /** * Specifies the date-time value serialization format. Use it only if you do not specify the value at design time. */ get: function () { return this._getOption('dateSerializationFormat'); }, set: function (value) { this._setOption('dateSerializationFormat', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxCalendarComponent.prototype, "disabled", { /** * Specifies whether the widget responds to user interaction. */ get: function () { return this._getOption('disabled'); }, set: function (value) { this._setOption('disabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxCalendarComponent.prototype, "disabledDates", { /** * Specifies dates to be disabled. */ get: function () { return this._getOption('disabledDates'); }, set: function (value) { this._setOption('disabledDates', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxCalendarComponent.prototype, "elementAttr", { /** * Specifies the attributes to be attached to the widget's root element. */ get: function () { return this._getOption('elementAttr'); }, set: function (value) { this._setOption('elementAttr', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxCalendarComponent.prototype, "firstDayOfWeek", { /** * Specifies the first day of a week. */ get: function () { return this._getOption('firstDayOfWeek'); }, set: function (value) { this._setOption('firstDayOfWeek', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxCalendarComponent.prototype, "focusStateEnabled", { /** * Specifies whether the widget can be focused using keyboard navigation. */ get: function () { return this._getOption('focusStateEnabled'); }, set: function (value) { this._setOption('focusStateEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxCalendarComponent.prototype, "height", { /** * Specifies the widget's height. */ get: function () { return this._getOption('height'); }, set: function (value) { this._setOption('height', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxCalendarComponent.prototype, "hint", { /** * Specifies text for a hint that appears when a user pauses on the widget. */ get: function () { return this._getOption('hint'); }, set: function (value) { this._setOption('hint', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxCalendarComponent.prototype, "hoverStateEnabled", { /** * Specifies whether the widget changes its state when a user pauses on it. */ get: function () { return this._getOption('hoverStateEnabled'); }, set: function (value) { this._setOption('hoverStateEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxCalendarComponent.prototype, "isValid", { /** * Specifies whether the editor's value is valid. */ get: function () { return this._getOption('isValid'); }, set: function (value) { this._setOption('isValid', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxCalendarComponent.prototype, "max", { /** * The latest date the widget allows to select. */ get: function () { return this._getOption('max'); }, set: function (value) { this._setOption('max', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxCalendarComponent.prototype, "maxZoomLevel", { /** * Specifies the maximum zoom level of the calendar. */ get: function () { return this._getOption('maxZoomLevel'); }, set: function (value) { this._setOption('maxZoomLevel', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxCalendarComponent.prototype, "min", { /** * The earliest date the widget allows to select. */ get: function () { return this._getOption('min'); }, set: function (value) { this._setOption('min', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxCalendarComponent.prototype, "minZoomLevel", { /** * Specifies the minimum zoom level of the calendar. */ get: function () { return this._getOption('minZoomLevel'); }, set: function (value) { this._setOption('minZoomLevel', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxCalendarComponent.prototype, "name", { /** * The value to be assigned to the `name` attribute of the underlying HTML element. */ get: function () { return this._getOption('name'); }, set: function (value) { this._setOption('name', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxCalendarComponent.prototype, "readOnly", { /** * A Boolean value specifying whether or not the widget is read-only. */ get: function () { return this._getOption('readOnly'); }, set: function (value) { this._setOption('readOnly', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxCalendarComponent.prototype, "rtlEnabled", { /** * Switches the widget to a right-to-left representation. */ get: function () { return this._getOption('rtlEnabled'); }, set: function (value) { this._setOption('rtlEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxCalendarComponent.prototype, "showTodayButton", { /** * Specifies whether or not the widget displays a button that selects the current date. */ get: function () { return this._getOption('showTodayButton'); }, set: function (value) { this._setOption('showTodayButton', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxCalendarComponent.prototype, "tabIndex", { /** * Specifies the number of the element when the Tab key is used for navigating. */ get: function () { return this._getOption('tabIndex'); }, set: function (value) { this._setOption('tabIndex', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxCalendarComponent.prototype, "validationError", { /** * Specifies information on the validation error when using a custom validation engine. Should be changed at runtime along with the isValid option. */ get: function () { return this._getOption('validationError'); }, set: function (value) { this._setOption('validationError', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxCalendarComponent.prototype, "validationMessageMode", { /** * Specifies how the message about the validation rules that are not satisfied by this editor's value is displayed. */ get: function () { return this._getOption('validationMessageMode'); }, set: function (value) { this._setOption('validationMessageMode', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxCalendarComponent.prototype, "value", { /** * An object or a value specifying the date and time currently selected in the calendar. */ get: function () { return this._getOption('value'); }, set: function (value) { this._setOption('value', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxCalendarComponent.prototype, "visible", { /** * Specifies whether the widget is visible. */ get: function () { return this._getOption('visible'); }, set: function (value) { this._setOption('visible', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxCalendarComponent.prototype, "width", { /** * Specifies the widget's width. */ get: function () { return this._getOption('width'); }, set: function (value) { this._setOption('width', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxCalendarComponent.prototype, "zoomLevel", { /** * Specifies the current calendar zoom level. */ get: function () { return this._getOption('zoomLevel'); }, set: function (value) { this._setOption('zoomLevel', value); }, enumerable: true, configurable: true }); DxCalendarComponent.prototype.change = function (_) { }; DxCalendarComponent.prototype._createInstance = function (element, options) { var widget = new calendar_1.default(element, options); if (this.validator) { this.validator.createInstance(element); } return widget; }; DxCalendarComponent.prototype.writeValue = function (value) { this.eventHelper.lockedValueChangeEvent = true; this.value = value; this.eventHelper.lockedValueChangeEvent = false; }; DxCalendarComponent.prototype.setDisabledState = function (isDisabled) { this.disabled = isDisabled; }; DxCalendarComponent.prototype.registerOnChange = function (fn) { this.change = fn; }; DxCalendarComponent.prototype.registerOnTouched = function (fn) { this.touched = fn; }; DxCalendarComponent.prototype._createWidget = function (element) { var _this = this; _super.prototype._createWidget.call(this, element); this.instance.on('focusOut', function (e) { _this.eventHelper.fireNgEvent('onBlur', [e]); }); }; DxCalendarComponent.prototype.ngOnDestroy = function () { this._destroyWidget(); }; DxCalendarComponent.prototype.ngOnChanges = function (changes) { _super.prototype.ngOnChanges.call(this, changes); this.setupChanges('disabledDates', changes); }; DxCalendarComponent.prototype.setupChanges = function (prop, changes) { if (!(prop in this._optionsToUpdate)) { this._idh.setup(prop, changes); } }; DxCalendarComponent.prototype.ngDoCheck = function () { this._idh.doCheck('disabledDates'); this._watcherHelper.checkWatchers(); _super.prototype.ngDoCheck.call(this); _super.prototype.clearChangedOptions.call(this); }; DxCalendarComponent.prototype._setOption = function (name, value) { var isSetup = this._idh.setupSingle(name, value); var isChanged = this._idh.getChanges(name, value) !== null; if (isSetup || isChanged) { _super.prototype._setOption.call(this, name, value); } }; DxCalendarComponent.prototype.ngAfterContentInit = function () { if (this.validator) { this.validator.renderOnViewInit = false; } }; DxCalendarComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dx-calendar', template: '', providers: [ template_host_1.DxTemplateHost, watcher_helper_1.WatcherHelper, CUSTOM_VALUE_ACCESSOR_PROVIDER, nested_option_1.NestedOptionHost, iterable_differ_helper_1.IterableDifferHelper ] },] }, ]; /** @nocollapse */ DxCalendarComponent.ctorParameters = function () { return [ { type: core_1.ElementRef, }, { type: core_1.NgZone, }, { type: template_host_1.DxTemplateHost, }, { type: watcher_helper_1.WatcherHelper, }, { type: iterable_differ_helper_1.IterableDifferHelper, }, { type: nested_option_1.NestedOptionHost, }, ]; }; DxCalendarComponent.propDecorators = { 'validator': [{ type: core_1.ContentChild, args: [validator_1.DxValidatorComponent,] },], 'accessKey': [{ type: core_1.Input },], 'activeStateEnabled': [{ type: core_1.Input },], 'cellTemplate': [{ type: core_1.Input },], 'dateSerializationFormat': [{ type: core_1.Input },], 'disabled': [{ type: core_1.Input },], 'disabledDates': [{ type: core_1.Input },], 'elementAttr': [{ type: core_1.Input },], 'firstDayOfWeek': [{ type: core_1.Input },], 'focusStateEnabled': [{ type: core_1.Input },], 'height': [{ type: core_1.Input },], 'hint': [{ type: core_1.Input },], 'hoverStateEnabled': [{ type: core_1.Input },], 'isValid': [{ type: core_1.Input },], 'max': [{ type: core_1.Input },], 'maxZoomLevel': [{ type: core_1.Input },], 'min': [{ type: core_1.Input },], 'minZoomLevel': [{ type: core_1.Input },], 'name': [{ type: core_1.Input },], 'readOnly': [{ type: core_1.Input },], 'rtlEnabled': [{ type: core_1.Input },], 'showTodayButton': [{ type: core_1.Input },], 'tabIndex': [{ type: core_1.Input },], 'validationError': [{ type: core_1.Input },], 'validationMessageMode': [{ type: core_1.Input },], 'value': [{ type: core_1.Input },], 'visible': [{ type: core_1.Input },], 'width': [{ type: core_1.Input },], 'zoomLevel': [{ type: core_1.Input },], 'onDisposing': [{ type: core_1.Output },], 'onInitialized': [{ type: core_1.Output },], 'onOptionChanged': [{ type: core_1.Output },], 'onValueChanged': [{ type: core_1.Output },], 'accessKeyChange': [{ type: core_1.Output },], 'activeStateEnabledChange': [{ type: core_1.Output },], 'cellTemplateChange': [{ type: core_1.Output },], 'dateSerializationFormatChange': [{ type: core_1.Output },], 'disabledChange': [{ type: core_1.Output },], 'disabledDatesChange': [{ type: core_1.Output },], 'elementAttrChange': [{ type: core_1.Output },], 'firstDayOfWeekChange': [{ type: core_1.Output },], 'focusStateEnabledChange': [{ type: core_1.Output },], 'heightChange': [{ type: core_1.Output },], 'hintChange': [{ type: core_1.Output },], 'hoverStateEnabledChange': [{ type: core_1.Output },], 'isValidChange': [{ type: core_1.Output },], 'maxChange': [{ type: core_1.Output },], 'maxZoomLevelChange': [{ type: core_1.Output },], 'minChange': [{ type: core_1.Output },], 'minZoomLevelChange': [{ type: core_1.Output },], 'nameChange': [{ type: core_1.Output },], 'readOnlyChange': [{ type: core_1.Output },], 'rtlEnabledChange': [{ type: core_1.Output },], 'showTodayButtonChange': [{ type: core_1.Output },], 'tabIndexChange': [{ type: core_1.Output },], 'validationErrorChange': [{ type: core_1.Output },], 'validationMessageModeChange': [{ type: core_1.Output },], 'valueChange': [{ type: core_1.Output },], 'visibleChange': [{ type: core_1.Output },], 'widthChange': [{ type: core_1.Output },], 'zoomLevelChange': [{ type: core_1.Output },], 'onBlur': [{ type: core_1.Output },], 'change': [{ type: core_1.HostListener, args: ['valueChange', ['$event'],] },], 'touched': [{ type: core_1.HostListener, args: ['onBlur', ['$event'],] },], }; return DxCalendarComponent; }(component_1.DxComponent)); exports.DxCalendarComponent = DxCalendarComponent; var DxCalendarModule = (function () { function DxCalendarModule() { } DxCalendarModule.decorators = [ { type: core_1.NgModule, args: [{ imports: [ template_1.DxTemplateModule ], declarations: [ DxCalendarComponent ], exports: [ DxCalendarComponent, template_1.DxTemplateModule ], },] }, ]; /** @nocollapse */ DxCalendarModule.ctorParameters = function () { return []; }; return DxCalendarModule; }()); exports.DxCalendarModule = DxCalendarModule; //# sourceMappingURL=calendar.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/chart.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var chart_1 = __webpack_require__("./node_modules/devextreme/viz/chart.js"); var component_1 = __webpack_require__("./node_modules/devextreme-angular/core/component.js"); var template_host_1 = __webpack_require__("./node_modules/devextreme-angular/core/template-host.js"); var template_1 = __webpack_require__("./node_modules/devextreme-angular/core/template.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var watcher_helper_1 = __webpack_require__("./node_modules/devextreme-angular/core/watcher-helper.js"); var iterable_differ_helper_1 = __webpack_require__("./node_modules/devextreme-angular/core/iterable-differ-helper.js"); var adaptive_layout_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/adaptive-layout.js"); var animation_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/animation.js"); var argument_axis_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/argument-axis.js"); var break_dxi_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/break-dxi.js"); var break_style_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/break-style.js"); var constant_line_dxi_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/constant-line-dxi.js"); var label_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/label.js"); var font_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/font.js"); var constant_line_style_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/constant-line-style.js"); var grid_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/grid.js"); var format_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/format.js"); var overlapping_behavior_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/overlapping-behavior.js"); var minor_grid_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/minor-grid.js"); var minor_tick_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/minor-tick.js"); var minor_tick_interval_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/minor-tick-interval.js"); var strip_dxi_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/strip-dxi.js"); var strip_style_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/strip-style.js"); var tick_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/tick.js"); var tick_interval_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/tick-interval.js"); var title_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/title.js"); var common_axis_settings_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/common-axis-settings.js"); var common_pane_settings_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/common-pane-settings.js"); var border_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/border.js"); var common_series_settings_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/common-series-settings.js"); var area_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/area.js"); var hover_style_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/hover-style.js"); var hatching_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/hatching.js"); var connector_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/connector.js"); var point_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/point.js"); var image_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/image.js"); var height_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/height.js"); var url_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/url.js"); var width_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/width.js"); var selection_style_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/selection-style.js"); var reduction_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/reduction.js"); var value_error_bar_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/value-error-bar.js"); var bar_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/bar.js"); var bubble_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/bubble.js"); var candlestick_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/candlestick.js"); var fullstackedarea_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/fullstackedarea.js"); var fullstackedbar_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/fullstackedbar.js"); var fullstackedline_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/fullstackedline.js"); var fullstackedspline_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/fullstackedspline.js"); var fullstackedsplinearea_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/fullstackedsplinearea.js"); var argument_format_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/argument-format.js"); var line_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/line.js"); var rangearea_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/rangearea.js"); var rangebar_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/rangebar.js"); var scatter_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/scatter.js"); var spline_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/spline.js"); var splinearea_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/splinearea.js"); var stackedarea_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/stackedarea.js"); var stackedbar_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/stackedbar.js"); var stackedline_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/stackedline.js"); var stackedspline_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/stackedspline.js"); var stackedsplinearea_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/stackedsplinearea.js"); var steparea_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/steparea.js"); var stepline_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/stepline.js"); var stock_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/stock.js"); var crosshair_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/crosshair.js"); var horizontal_line_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/horizontal-line.js"); var vertical_line_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/vertical-line.js"); var data_prepare_settings_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/data-prepare-settings.js"); var export_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/export.js"); var legend_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/legend.js"); var margin_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/margin.js"); var loading_indicator_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/loading-indicator.js"); var pane_dxi_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/pane-dxi.js"); var scroll_bar_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/scroll-bar.js"); var series_dxi_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/series-dxi.js"); var series_template_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/series-template.js"); var size_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/size.js"); var subtitle_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/subtitle.js"); var tooltip_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/tooltip.js"); var shadow_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/shadow.js"); var value_axis_dxi_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/value-axis-dxi.js"); var pane_dxi_2 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/pane-dxi.js"); var series_dxi_2 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/series-dxi.js"); var value_axis_dxi_2 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/value-axis-dxi.js"); /** * The Chart is a widget that visualizes data from a local or remote storage using a great variety of series types along with different interactive elements, such as tooltips, crosshair pointer, legend, etc. */ var DxChartComponent = (function (_super) { __extends(DxChartComponent, _super); function DxChartComponent(elementRef, ngZone, templateHost, _watcherHelper, _idh, optionHost) { var _this = _super.call(this, elementRef, ngZone, templateHost, _watcherHelper) || this; _this._watcherHelper = _watcherHelper; _this._idh = _idh; _this._createEventEmitters([ { subscribe: 'argumentAxisClick', emit: 'onArgumentAxisClick' }, { subscribe: 'disposing', emit: 'onDisposing' }, { subscribe: 'done', emit: 'onDone' }, { subscribe: 'drawn', emit: 'onDrawn' }, { subscribe: 'exported', emit: 'onExported' }, { subscribe: 'exporting', emit: 'onExporting' }, { subscribe: 'fileSaving', emit: 'onFileSaving' }, { subscribe: 'incidentOccurred', emit: 'onIncidentOccurred' }, { subscribe: 'initialized', emit: 'onInitialized' }, { subscribe: 'legendClick', emit: 'onLegendClick' }, { subscribe: 'optionChanged', emit: 'onOptionChanged' }, { subscribe: 'pointClick', emit: 'onPointClick' }, { subscribe: 'pointHoverChanged', emit: 'onPointHoverChanged' }, { subscribe: 'pointSelectionChanged', emit: 'onPointSelectionChanged' }, { subscribe: 'seriesClick', emit: 'onSeriesClick' }, { subscribe: 'seriesHoverChanged', emit: 'onSeriesHoverChanged' }, { subscribe: 'seriesSelectionChanged', emit: 'onSeriesSelectionChanged' }, { subscribe: 'tooltipHidden', emit: 'onTooltipHidden' }, { subscribe: 'tooltipShown', emit: 'onTooltipShown' }, { subscribe: 'zoomEnd', emit: 'onZoomEnd' }, { subscribe: 'zoomStart', emit: 'onZoomStart' }, { emit: 'adaptiveLayoutChange' }, { emit: 'adjustOnZoomChange' }, { emit: 'animationChange' }, { emit: 'argumentAxisChange' }, { emit: 'barWidthChange' }, { emit: 'commonAxisSettingsChange' }, { emit: 'commonPaneSettingsChange' }, { emit: 'commonSeriesSettingsChange' }, { emit: 'containerBackgroundColorChange' }, { emit: 'crosshairChange' }, { emit: 'customizeLabelChange' }, { emit: 'customizePointChange' }, { emit: 'dataPrepareSettingsChange' }, { emit: 'dataSourceChange' }, { emit: 'defaultPaneChange' }, { emit: 'elementAttrChange' }, { emit: 'equalBarWidthChange' }, { emit: 'exportChange' }, { emit: 'legendChange' }, { emit: 'loadingIndicatorChange' }, { emit: 'marginChange' }, { emit: 'maxBubbleSizeChange' }, { emit: 'minBubbleSizeChange' }, { emit: 'negativesAsZeroesChange' }, { emit: 'paletteChange' }, { emit: 'panesChange' }, { emit: 'pathModifiedChange' }, { emit: 'pointSelectionModeChange' }, { emit: 'redrawOnResizeChange' }, { emit: 'resolveLabelOverlappingChange' }, { emit: 'rotatedChange' }, { emit: 'rtlEnabledChange' }, { emit: 'scrollBarChange' }, { emit: 'scrollingModeChange' }, { emit: 'seriesChange' }, { emit: 'seriesSelectionModeChange' }, { emit: 'seriesTemplateChange' }, { emit: 'sizeChange' }, { emit: 'synchronizeMultiAxesChange' }, { emit: 'themeChange' }, { emit: 'titleChange' }, { emit: 'tooltipChange' }, { emit: 'useAggregationChange' }, { emit: 'valueAxisChange' }, { emit: 'zoomingModeChange' } ]); _this._idh.setHost(_this); optionHost.setHost(_this); return _this; } Object.defineProperty(DxChartComponent.prototype, "adaptiveLayout", { /** * Specifies adaptive layout options. */ get: function () { return this._getOption('adaptiveLayout'); }, set: function (value) { this._setOption('adaptiveLayout', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxChartComponent.prototype, "adjustOnZoom", { /** * Specifies whether or not to adjust the value axis when zooming the widget. */ get: function () { return this._getOption('adjustOnZoom'); }, set: function (value) { this._setOption('adjustOnZoom', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxChartComponent.prototype, "animation", { /** * Specifies animation options. */ get: function () { return this._getOption('animation'); }, set: function (value) { this._setOption('animation', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxChartComponent.prototype, "argumentAxis", { /** * Configures the argument axis. */ get: function () { return this._getOption('argumentAxis'); }, set: function (value) { this._setOption('argumentAxis', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxChartComponent.prototype, "barWidth", { /** * Controls the width of bars in the widget. Applies only to bar-like series and when the equalBarWidth option is true. */ get: function () { return this._getOption('barWidth'); }, set: function (value) { this._setOption('barWidth', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxChartComponent.prototype, "commonAxisSettings", { /** * Defines common settings for both the argument and value axis in a chart. */ get: function () { return this._getOption('commonAxisSettings'); }, set: function (value) { this._setOption('commonAxisSettings', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxChartComponent.prototype, "commonPaneSettings", { /** * Defines common settings for all panes in a chart. */ get: function () { return this._getOption('commonPaneSettings'); }, set: function (value) { this._setOption('commonPaneSettings', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxChartComponent.prototype, "commonSeriesSettings", { /** * Specifies settings common for all series in the chart. */ get: function () { return this._getOption('commonSeriesSettings'); }, set: function (value) { this._setOption('commonSeriesSettings', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxChartComponent.prototype, "containerBackgroundColor", { /** * Colors the background of the chart container. */ get: function () { return this._getOption('containerBackgroundColor'); }, set: function (value) { this._setOption('containerBackgroundColor', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxChartComponent.prototype, "crosshair", { /** * Configures the crosshair feature. */ get: function () { return this._getOption('crosshair'); }, set: function (value) { this._setOption('crosshair', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxChartComponent.prototype, "customizeLabel", { /** * Customizes the appearance of an individual point label. */ get: function () { return this._getOption('customizeLabel'); }, set: function (value) { this._setOption('customizeLabel', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxChartComponent.prototype, "customizePoint", { /** * Customizes the appearance of an individual series point. */ get: function () { return this._getOption('customizePoint'); }, set: function (value) { this._setOption('customizePoint', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxChartComponent.prototype, "dataPrepareSettings", { /** * Processes data before visualizing it. */ get: function () { return this._getOption('dataPrepareSettings'); }, set: function (value) { this._setOption('dataPrepareSettings', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxChartComponent.prototype, "dataSource", { /** * Specifies the widget's data origin. */ get: function () { return this._getOption('dataSource'); }, set: function (value) { this._setOption('dataSource', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxChartComponent.prototype, "defaultPane", { /** * Specifies which pane should be used by default. */ get: function () { return this._getOption('defaultPane'); }, set: function (value) { this._setOption('defaultPane', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxChartComponent.prototype, "elementAttr", { /** * Specifies the attributes to be attached to the widget's root element. */ get: function () { return this._getOption('elementAttr'); }, set: function (value) { this._setOption('elementAttr', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxChartComponent.prototype, "equalBarWidth", { /** * Specifies whether all bars should have equal width, even if some values are missing from a series. Applies only to bar-like series. */ get: function () { return this._getOption('equalBarWidth'); }, set: function (value) { this._setOption('equalBarWidth', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxChartComponent.prototype, "export", { /** * Configures the exporting and printing features. */ get: function () { return this._getOption('export'); }, set: function (value) { this._setOption('export', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxChartComponent.prototype, "legend", { /** * Specifies the options of a chart's legend. */ get: function () { return this._getOption('legend'); }, set: function (value) { this._setOption('legend', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxChartComponent.prototype, "loadingIndicator", { /** * Configures the loading indicator. */ get: function () { return this._getOption('loadingIndicator'); }, set: function (value) { this._setOption('loadingIndicator', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxChartComponent.prototype, "margin", { /** * Generates space around the widget. */ get: function () { return this._getOption('margin'); }, set: function (value) { this._setOption('margin', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxChartComponent.prototype, "maxBubbleSize", { /** * Specifies a coefficient determining the diameter of the largest bubble. */ get: function () { return this._getOption('maxBubbleSize'); }, set: function (value) { this._setOption('maxBubbleSize', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxChartComponent.prototype, "minBubbleSize", { /** * Specifies the diameter of the smallest bubble measured in pixels. */ get: function () { return this._getOption('minBubbleSize'); }, set: function (value) { this._setOption('minBubbleSize', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxChartComponent.prototype, "negativesAsZeroes", { /** * Forces the widget to treat negative values as zeroes. Applies to stacked-like series only. */ get: function () { return this._getOption('negativesAsZeroes'); }, set: function (value) { this._setOption('negativesAsZeroes', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxChartComponent.prototype, "palette", { /** * Sets the name of the palette to be used in the chart. Alternatively, an array of colors can be set as a custom palette to be used within this chart. */ get: function () { return this._getOption('palette'); }, set: function (value) { this._setOption('palette', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxChartComponent.prototype, "panes", { /** * Declares a collection of panes. */ get: function () { return this._getOption('panes'); }, set: function (value) { this._setOption('panes', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxChartComponent.prototype, "pathModified", { /** * Notifies the widget that it is embedded into an HTML page that uses a tag modifying the path. */ get: function () { return this._getOption('pathModified'); }, set: function (value) { this._setOption('pathModified', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxChartComponent.prototype, "pointSelectionMode", { /** * Specifies whether a single point or multiple points can be selected in the chart. */ get: function () { return this._getOption('pointSelectionMode'); }, set: function (value) { this._setOption('pointSelectionMode', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxChartComponent.prototype, "redrawOnResize", { /** * Specifies whether to redraw the widget when the size of the parent browser window changes or a mobile device rotates. */ get: function () { return this._getOption('redrawOnResize'); }, set: function (value) { this._setOption('redrawOnResize', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxChartComponent.prototype, "resolveLabelOverlapping", { /** * Specifies how the chart must behave when series point labels overlap. */ get: function () { return this._getOption('resolveLabelOverlapping'); }, set: function (value) { this._setOption('resolveLabelOverlapping', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxChartComponent.prototype, "rotated", { /** * Swaps the axes around making the value axis horizontal and the argument axis vertical. */ get: function () { return this._getOption('rotated'); }, set: function (value) { this._setOption('rotated', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxChartComponent.prototype, "rtlEnabled", { /** * Switches the widget to a right-to-left representation. */ get: function () { return this._getOption('rtlEnabled'); }, set: function (value) { this._setOption('rtlEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxChartComponent.prototype, "scrollBar", { /** * Specifies the settings of the scroll bar. */ get: function () { return this._getOption('scrollBar'); }, set: function (value) { this._setOption('scrollBar', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxChartComponent.prototype, "scrollingMode", { /** * Enables scrolling in your chart. */ get: function () { return this._getOption('scrollingMode'); }, set: function (value) { this._setOption('scrollingMode', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxChartComponent.prototype, "series", { /** * Specifies options for Chart widget series. */ get: function () { return this._getOption('series'); }, set: function (value) { this._setOption('series', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxChartComponent.prototype, "seriesSelectionMode", { /** * Specifies whether a single series or multiple series can be selected in the chart. */ get: function () { return this._getOption('seriesSelectionMode'); }, set: function (value) { this._setOption('seriesSelectionMode', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxChartComponent.prototype, "seriesTemplate", { /** * Defines options for the series template. */ get: function () { return this._getOption('seriesTemplate'); }, set: function (value) { this._setOption('seriesTemplate', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxChartComponent.prototype, "size", { /** * Specifies the widget's size in pixels. */ get: function () { return this._getOption('size'); }, set: function (value) { this._setOption('size', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxChartComponent.prototype, "synchronizeMultiAxes", { /** * Indicates whether or not to synchronize value axes when they are displayed on a single pane. */ get: function () { return this._getOption('synchronizeMultiAxes'); }, set: function (value) { this._setOption('synchronizeMultiAxes', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxChartComponent.prototype, "theme", { /** * Sets the name of the theme the widget uses. */ get: function () { return this._getOption('theme'); }, set: function (value) { this._setOption('theme', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxChartComponent.prototype, "title", { /** * Configures the widget's title. */ get: function () { return this._getOption('title'); }, set: function (value) { this._setOption('title', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxChartComponent.prototype, "tooltip", { /** * Configures tooltips. */ get: function () { return this._getOption('tooltip'); }, set: function (value) { this._setOption('tooltip', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxChartComponent.prototype, "useAggregation", { /** * Specifies whether or not to filter the series points depending on their quantity. */ get: function () { return this._getOption('useAggregation'); }, set: function (value) { this._setOption('useAggregation', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxChartComponent.prototype, "valueAxis", { /** * Configures the value axis. */ get: function () { return this._getOption('valueAxis'); }, set: function (value) { this._setOption('valueAxis', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxChartComponent.prototype, "zoomingMode", { /** * Enables zooming in your chart. */ get: function () { return this._getOption('zoomingMode'); }, set: function (value) { this._setOption('zoomingMode', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxChartComponent.prototype, "panesChildren", { get: function () { return this._getOption('panes'); }, set: function (value) { this.setChildren('panes', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxChartComponent.prototype, "seriesChildren", { get: function () { return this._getOption('series'); }, set: function (value) { this.setChildren('series', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxChartComponent.prototype, "valueAxisChildren", { get: function () { return this._getOption('valueAxis'); }, set: function (value) { this.setChildren('valueAxis', value); }, enumerable: true, configurable: true }); DxChartComponent.prototype._createInstance = function (element, options) { return new chart_1.default(element, options); }; DxChartComponent.prototype.ngOnDestroy = function () { this._destroyWidget(); }; DxChartComponent.prototype.ngOnChanges = function (changes) { _super.prototype.ngOnChanges.call(this, changes); this.setupChanges('dataSource', changes); this.setupChanges('palette', changes); this.setupChanges('panes', changes); this.setupChanges('series', changes); this.setupChanges('valueAxis', changes); }; DxChartComponent.prototype.setupChanges = function (prop, changes) { if (!(prop in this._optionsToUpdate)) { this._idh.setup(prop, changes); } }; DxChartComponent.prototype.ngDoCheck = function () { this._idh.doCheck('dataSource'); this._idh.doCheck('palette'); this._idh.doCheck('panes'); this._idh.doCheck('series'); this._idh.doCheck('valueAxis'); this._watcherHelper.checkWatchers(); _super.prototype.ngDoCheck.call(this); _super.prototype.clearChangedOptions.call(this); }; DxChartComponent.prototype._setOption = function (name, value) { var isSetup = this._idh.setupSingle(name, value); var isChanged = this._idh.getChanges(name, value) !== null; if (isSetup || isChanged) { _super.prototype._setOption.call(this, name, value); } }; DxChartComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dx-chart', template: '', styles: [' :host { display: block; }'], providers: [ template_host_1.DxTemplateHost, watcher_helper_1.WatcherHelper, nested_option_1.NestedOptionHost, iterable_differ_helper_1.IterableDifferHelper ] },] }, ]; /** @nocollapse */ DxChartComponent.ctorParameters = function () { return [ { type: core_1.ElementRef, }, { type: core_1.NgZone, }, { type: template_host_1.DxTemplateHost, }, { type: watcher_helper_1.WatcherHelper, }, { type: iterable_differ_helper_1.IterableDifferHelper, }, { type: nested_option_1.NestedOptionHost, }, ]; }; DxChartComponent.propDecorators = { 'adaptiveLayout': [{ type: core_1.Input },], 'adjustOnZoom': [{ type: core_1.Input },], 'animation': [{ type: core_1.Input },], 'argumentAxis': [{ type: core_1.Input },], 'barWidth': [{ type: core_1.Input },], 'commonAxisSettings': [{ type: core_1.Input },], 'commonPaneSettings': [{ type: core_1.Input },], 'commonSeriesSettings': [{ type: core_1.Input },], 'containerBackgroundColor': [{ type: core_1.Input },], 'crosshair': [{ type: core_1.Input },], 'customizeLabel': [{ type: core_1.Input },], 'customizePoint': [{ type: core_1.Input },], 'dataPrepareSettings': [{ type: core_1.Input },], 'dataSource': [{ type: core_1.Input },], 'defaultPane': [{ type: core_1.Input },], 'elementAttr': [{ type: core_1.Input },], 'equalBarWidth': [{ type: core_1.Input },], 'export': [{ type: core_1.Input },], 'legend': [{ type: core_1.Input },], 'loadingIndicator': [{ type: core_1.Input },], 'margin': [{ type: core_1.Input },], 'maxBubbleSize': [{ type: core_1.Input },], 'minBubbleSize': [{ type: core_1.Input },], 'negativesAsZeroes': [{ type: core_1.Input },], 'palette': [{ type: core_1.Input },], 'panes': [{ type: core_1.Input },], 'pathModified': [{ type: core_1.Input },], 'pointSelectionMode': [{ type: core_1.Input },], 'redrawOnResize': [{ type: core_1.Input },], 'resolveLabelOverlapping': [{ type: core_1.Input },], 'rotated': [{ type: core_1.Input },], 'rtlEnabled': [{ type: core_1.Input },], 'scrollBar': [{ type: core_1.Input },], 'scrollingMode': [{ type: core_1.Input },], 'series': [{ type: core_1.Input },], 'seriesSelectionMode': [{ type: core_1.Input },], 'seriesTemplate': [{ type: core_1.Input },], 'size': [{ type: core_1.Input },], 'synchronizeMultiAxes': [{ type: core_1.Input },], 'theme': [{ type: core_1.Input },], 'title': [{ type: core_1.Input },], 'tooltip': [{ type: core_1.Input },], 'useAggregation': [{ type: core_1.Input },], 'valueAxis': [{ type: core_1.Input },], 'zoomingMode': [{ type: core_1.Input },], 'onArgumentAxisClick': [{ type: core_1.Output },], 'onDisposing': [{ type: core_1.Output },], 'onDone': [{ type: core_1.Output },], 'onDrawn': [{ type: core_1.Output },], 'onExported': [{ type: core_1.Output },], 'onExporting': [{ type: core_1.Output },], 'onFileSaving': [{ type: core_1.Output },], 'onIncidentOccurred': [{ type: core_1.Output },], 'onInitialized': [{ type: core_1.Output },], 'onLegendClick': [{ type: core_1.Output },], 'onOptionChanged': [{ type: core_1.Output },], 'onPointClick': [{ type: core_1.Output },], 'onPointHoverChanged': [{ type: core_1.Output },], 'onPointSelectionChanged': [{ type: core_1.Output },], 'onSeriesClick': [{ type: core_1.Output },], 'onSeriesHoverChanged': [{ type: core_1.Output },], 'onSeriesSelectionChanged': [{ type: core_1.Output },], 'onTooltipHidden': [{ type: core_1.Output },], 'onTooltipShown': [{ type: core_1.Output },], 'onZoomEnd': [{ type: core_1.Output },], 'onZoomStart': [{ type: core_1.Output },], 'adaptiveLayoutChange': [{ type: core_1.Output },], 'adjustOnZoomChange': [{ type: core_1.Output },], 'animationChange': [{ type: core_1.Output },], 'argumentAxisChange': [{ type: core_1.Output },], 'barWidthChange': [{ type: core_1.Output },], 'commonAxisSettingsChange': [{ type: core_1.Output },], 'commonPaneSettingsChange': [{ type: core_1.Output },], 'commonSeriesSettingsChange': [{ type: core_1.Output },], 'containerBackgroundColorChange': [{ type: core_1.Output },], 'crosshairChange': [{ type: core_1.Output },], 'customizeLabelChange': [{ type: core_1.Output },], 'customizePointChange': [{ type: core_1.Output },], 'dataPrepareSettingsChange': [{ type: core_1.Output },], 'dataSourceChange': [{ type: core_1.Output },], 'defaultPaneChange': [{ type: core_1.Output },], 'elementAttrChange': [{ type: core_1.Output },], 'equalBarWidthChange': [{ type: core_1.Output },], 'exportChange': [{ type: core_1.Output },], 'legendChange': [{ type: core_1.Output },], 'loadingIndicatorChange': [{ type: core_1.Output },], 'marginChange': [{ type: core_1.Output },], 'maxBubbleSizeChange': [{ type: core_1.Output },], 'minBubbleSizeChange': [{ type: core_1.Output },], 'negativesAsZeroesChange': [{ type: core_1.Output },], 'paletteChange': [{ type: core_1.Output },], 'panesChange': [{ type: core_1.Output },], 'pathModifiedChange': [{ type: core_1.Output },], 'pointSelectionModeChange': [{ type: core_1.Output },], 'redrawOnResizeChange': [{ type: core_1.Output },], 'resolveLabelOverlappingChange': [{ type: core_1.Output },], 'rotatedChange': [{ type: core_1.Output },], 'rtlEnabledChange': [{ type: core_1.Output },], 'scrollBarChange': [{ type: core_1.Output },], 'scrollingModeChange': [{ type: core_1.Output },], 'seriesChange': [{ type: core_1.Output },], 'seriesSelectionModeChange': [{ type: core_1.Output },], 'seriesTemplateChange': [{ type: core_1.Output },], 'sizeChange': [{ type: core_1.Output },], 'synchronizeMultiAxesChange': [{ type: core_1.Output },], 'themeChange': [{ type: core_1.Output },], 'titleChange': [{ type: core_1.Output },], 'tooltipChange': [{ type: core_1.Output },], 'useAggregationChange': [{ type: core_1.Output },], 'valueAxisChange': [{ type: core_1.Output },], 'zoomingModeChange': [{ type: core_1.Output },], 'panesChildren': [{ type: core_1.ContentChildren, args: [pane_dxi_2.DxiPaneComponent,] },], 'seriesChildren': [{ type: core_1.ContentChildren, args: [series_dxi_2.DxiSeriesComponent,] },], 'valueAxisChildren': [{ type: core_1.ContentChildren, args: [value_axis_dxi_2.DxiValueAxisComponent,] },], }; return DxChartComponent; }(component_1.DxComponent)); exports.DxChartComponent = DxChartComponent; var DxChartModule = (function () { function DxChartModule() { } DxChartModule.decorators = [ { type: core_1.NgModule, args: [{ imports: [ adaptive_layout_1.DxoAdaptiveLayoutModule, animation_1.DxoAnimationModule, argument_axis_1.DxoArgumentAxisModule, break_dxi_1.DxiBreakModule, break_style_1.DxoBreakStyleModule, constant_line_dxi_1.DxiConstantLineModule, label_1.DxoLabelModule, font_1.DxoFontModule, constant_line_style_1.DxoConstantLineStyleModule, grid_1.DxoGridModule, format_1.DxoFormatModule, overlapping_behavior_1.DxoOverlappingBehaviorModule, minor_grid_1.DxoMinorGridModule, minor_tick_1.DxoMinorTickModule, minor_tick_interval_1.DxoMinorTickIntervalModule, strip_dxi_1.DxiStripModule, strip_style_1.DxoStripStyleModule, tick_1.DxoTickModule, tick_interval_1.DxoTickIntervalModule, title_1.DxoTitleModule, common_axis_settings_1.DxoCommonAxisSettingsModule, common_pane_settings_1.DxoCommonPaneSettingsModule, border_1.DxoBorderModule, common_series_settings_1.DxoCommonSeriesSettingsModule, area_1.DxoAreaModule, hover_style_1.DxoHoverStyleModule, hatching_1.DxoHatchingModule, connector_1.DxoConnectorModule, point_1.DxoPointModule, image_1.DxoImageModule, height_1.DxoHeightModule, url_1.DxoUrlModule, width_1.DxoWidthModule, selection_style_1.DxoSelectionStyleModule, reduction_1.DxoReductionModule, value_error_bar_1.DxoValueErrorBarModule, bar_1.DxoBarModule, bubble_1.DxoBubbleModule, candlestick_1.DxoCandlestickModule, fullstackedarea_1.DxoFullstackedareaModule, fullstackedbar_1.DxoFullstackedbarModule, fullstackedline_1.DxoFullstackedlineModule, fullstackedspline_1.DxoFullstackedsplineModule, fullstackedsplinearea_1.DxoFullstackedsplineareaModule, argument_format_1.DxoArgumentFormatModule, line_1.DxoLineModule, rangearea_1.DxoRangeareaModule, rangebar_1.DxoRangebarModule, scatter_1.DxoScatterModule, spline_1.DxoSplineModule, splinearea_1.DxoSplineareaModule, stackedarea_1.DxoStackedareaModule, stackedbar_1.DxoStackedbarModule, stackedline_1.DxoStackedlineModule, stackedspline_1.DxoStackedsplineModule, stackedsplinearea_1.DxoStackedsplineareaModule, steparea_1.DxoStepareaModule, stepline_1.DxoSteplineModule, stock_1.DxoStockModule, crosshair_1.DxoCrosshairModule, horizontal_line_1.DxoHorizontalLineModule, vertical_line_1.DxoVerticalLineModule, data_prepare_settings_1.DxoDataPrepareSettingsModule, export_1.DxoExportModule, legend_1.DxoLegendModule, margin_1.DxoMarginModule, loading_indicator_1.DxoLoadingIndicatorModule, pane_dxi_1.DxiPaneModule, scroll_bar_1.DxoScrollBarModule, series_dxi_1.DxiSeriesModule, series_template_1.DxoSeriesTemplateModule, size_1.DxoSizeModule, subtitle_1.DxoSubtitleModule, tooltip_1.DxoTooltipModule, shadow_1.DxoShadowModule, value_axis_dxi_1.DxiValueAxisModule, template_1.DxTemplateModule ], declarations: [ DxChartComponent ], exports: [ DxChartComponent, adaptive_layout_1.DxoAdaptiveLayoutModule, animation_1.DxoAnimationModule, argument_axis_1.DxoArgumentAxisModule, break_dxi_1.DxiBreakModule, break_style_1.DxoBreakStyleModule, constant_line_dxi_1.DxiConstantLineModule, label_1.DxoLabelModule, font_1.DxoFontModule, constant_line_style_1.DxoConstantLineStyleModule, grid_1.DxoGridModule, format_1.DxoFormatModule, overlapping_behavior_1.DxoOverlappingBehaviorModule, minor_grid_1.DxoMinorGridModule, minor_tick_1.DxoMinorTickModule, minor_tick_interval_1.DxoMinorTickIntervalModule, strip_dxi_1.DxiStripModule, strip_style_1.DxoStripStyleModule, tick_1.DxoTickModule, tick_interval_1.DxoTickIntervalModule, title_1.DxoTitleModule, common_axis_settings_1.DxoCommonAxisSettingsModule, common_pane_settings_1.DxoCommonPaneSettingsModule, border_1.DxoBorderModule, common_series_settings_1.DxoCommonSeriesSettingsModule, area_1.DxoAreaModule, hover_style_1.DxoHoverStyleModule, hatching_1.DxoHatchingModule, connector_1.DxoConnectorModule, point_1.DxoPointModule, image_1.DxoImageModule, height_1.DxoHeightModule, url_1.DxoUrlModule, width_1.DxoWidthModule, selection_style_1.DxoSelectionStyleModule, reduction_1.DxoReductionModule, value_error_bar_1.DxoValueErrorBarModule, bar_1.DxoBarModule, bubble_1.DxoBubbleModule, candlestick_1.DxoCandlestickModule, fullstackedarea_1.DxoFullstackedareaModule, fullstackedbar_1.DxoFullstackedbarModule, fullstackedline_1.DxoFullstackedlineModule, fullstackedspline_1.DxoFullstackedsplineModule, fullstackedsplinearea_1.DxoFullstackedsplineareaModule, argument_format_1.DxoArgumentFormatModule, line_1.DxoLineModule, rangearea_1.DxoRangeareaModule, rangebar_1.DxoRangebarModule, scatter_1.DxoScatterModule, spline_1.DxoSplineModule, splinearea_1.DxoSplineareaModule, stackedarea_1.DxoStackedareaModule, stackedbar_1.DxoStackedbarModule, stackedline_1.DxoStackedlineModule, stackedspline_1.DxoStackedsplineModule, stackedsplinearea_1.DxoStackedsplineareaModule, steparea_1.DxoStepareaModule, stepline_1.DxoSteplineModule, stock_1.DxoStockModule, crosshair_1.DxoCrosshairModule, horizontal_line_1.DxoHorizontalLineModule, vertical_line_1.DxoVerticalLineModule, data_prepare_settings_1.DxoDataPrepareSettingsModule, export_1.DxoExportModule, legend_1.DxoLegendModule, margin_1.DxoMarginModule, loading_indicator_1.DxoLoadingIndicatorModule, pane_dxi_1.DxiPaneModule, scroll_bar_1.DxoScrollBarModule, series_dxi_1.DxiSeriesModule, series_template_1.DxoSeriesTemplateModule, size_1.DxoSizeModule, subtitle_1.DxoSubtitleModule, tooltip_1.DxoTooltipModule, shadow_1.DxoShadowModule, value_axis_dxi_1.DxiValueAxisModule, template_1.DxTemplateModule ], },] }, ]; /** @nocollapse */ DxChartModule.ctorParameters = function () { return []; }; return DxChartModule; }()); exports.DxChartModule = DxChartModule; //# sourceMappingURL=chart.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/check-box.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var check_box_1 = __webpack_require__("./node_modules/devextreme/ui/check_box.js"); var validator_1 = __webpack_require__("./node_modules/devextreme-angular/ui/validator.js"); var forms_1 = __webpack_require__("./node_modules/@angular/forms/esm2015/forms.js"); var component_1 = __webpack_require__("./node_modules/devextreme-angular/core/component.js"); var template_host_1 = __webpack_require__("./node_modules/devextreme-angular/core/template-host.js"); var template_1 = __webpack_require__("./node_modules/devextreme-angular/core/template.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var watcher_helper_1 = __webpack_require__("./node_modules/devextreme-angular/core/watcher-helper.js"); var CUSTOM_VALUE_ACCESSOR_PROVIDER = { provide: forms_1.NG_VALUE_ACCESSOR, useExisting: core_1.forwardRef(function () { return DxCheckBoxComponent; }), multi: true }; /** * The CheckBox is a small box, which when selected by the end user, shows that a particular feature has been enabled or a specific option has been chosen. */ var DxCheckBoxComponent = (function (_super) { __extends(DxCheckBoxComponent, _super); function DxCheckBoxComponent(elementRef, ngZone, templateHost, _watcherHelper, optionHost) { var _this = _super.call(this, elementRef, ngZone, templateHost, _watcherHelper) || this; _this.touched = function (_) { }; _this._createEventEmitters([ { subscribe: 'contentReady', emit: 'onContentReady' }, { subscribe: 'disposing', emit: 'onDisposing' }, { subscribe: 'initialized', emit: 'onInitialized' }, { subscribe: 'optionChanged', emit: 'onOptionChanged' }, { subscribe: 'valueChanged', emit: 'onValueChanged' }, { emit: 'accessKeyChange' }, { emit: 'activeStateEnabledChange' }, { emit: 'disabledChange' }, { emit: 'elementAttrChange' }, { emit: 'focusStateEnabledChange' }, { emit: 'heightChange' }, { emit: 'hintChange' }, { emit: 'hoverStateEnabledChange' }, { emit: 'isValidChange' }, { emit: 'nameChange' }, { emit: 'readOnlyChange' }, { emit: 'rtlEnabledChange' }, { emit: 'tabIndexChange' }, { emit: 'textChange' }, { emit: 'validationErrorChange' }, { emit: 'validationMessageModeChange' }, { emit: 'valueChange' }, { emit: 'visibleChange' }, { emit: 'widthChange' }, { emit: 'onBlur' } ]); optionHost.setHost(_this); return _this; } Object.defineProperty(DxCheckBoxComponent.prototype, "accessKey", { /** * Specifies the shortcut key that sets focus on the widget. */ get: function () { return this._getOption('accessKey'); }, set: function (value) { this._setOption('accessKey', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxCheckBoxComponent.prototype, "activeStateEnabled", { /** * Specifies whether or not the widget changes its state when interacting with a user. */ get: function () { return this._getOption('activeStateEnabled'); }, set: function (value) { this._setOption('activeStateEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxCheckBoxComponent.prototype, "disabled", { /** * Specifies whether the widget responds to user interaction. */ get: function () { return this._getOption('disabled'); }, set: function (value) { this._setOption('disabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxCheckBoxComponent.prototype, "elementAttr", { /** * Specifies the attributes to be attached to the widget's root element. */ get: function () { return this._getOption('elementAttr'); }, set: function (value) { this._setOption('elementAttr', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxCheckBoxComponent.prototype, "focusStateEnabled", { /** * Specifies whether the widget can be focused using keyboard navigation. */ get: function () { return this._getOption('focusStateEnabled'); }, set: function (value) { this._setOption('focusStateEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxCheckBoxComponent.prototype, "height", { /** * Specifies the widget's height. */ get: function () { return this._getOption('height'); }, set: function (value) { this._setOption('height', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxCheckBoxComponent.prototype, "hint", { /** * Specifies text for a hint that appears when a user pauses on the widget. */ get: function () { return this._getOption('hint'); }, set: function (value) { this._setOption('hint', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxCheckBoxComponent.prototype, "hoverStateEnabled", { /** * Specifies whether the widget changes its state when a user pauses on it. */ get: function () { return this._getOption('hoverStateEnabled'); }, set: function (value) { this._setOption('hoverStateEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxCheckBoxComponent.prototype, "isValid", { /** * Specifies whether the editor's value is valid. */ get: function () { return this._getOption('isValid'); }, set: function (value) { this._setOption('isValid', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxCheckBoxComponent.prototype, "name", { /** * The value to be assigned to the `name` attribute of the underlying HTML element. */ get: function () { return this._getOption('name'); }, set: function (value) { this._setOption('name', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxCheckBoxComponent.prototype, "readOnly", { /** * A Boolean value specifying whether or not the widget is read-only. */ get: function () { return this._getOption('readOnly'); }, set: function (value) { this._setOption('readOnly', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxCheckBoxComponent.prototype, "rtlEnabled", { /** * Switches the widget to a right-to-left representation. */ get: function () { return this._getOption('rtlEnabled'); }, set: function (value) { this._setOption('rtlEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxCheckBoxComponent.prototype, "tabIndex", { /** * Specifies the number of the element when the Tab key is used for navigating. */ get: function () { return this._getOption('tabIndex'); }, set: function (value) { this._setOption('tabIndex', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxCheckBoxComponent.prototype, "text", { /** * Specifies the text displayed by the check box. */ get: function () { return this._getOption('text'); }, set: function (value) { this._setOption('text', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxCheckBoxComponent.prototype, "validationError", { /** * Specifies information on the validation error when using a custom validation engine. Should be changed at runtime along with the isValid option. */ get: function () { return this._getOption('validationError'); }, set: function (value) { this._setOption('validationError', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxCheckBoxComponent.prototype, "validationMessageMode", { /** * Specifies how the message about the validation rules that are not satisfied by this editor's value is displayed. */ get: function () { return this._getOption('validationMessageMode'); }, set: function (value) { this._setOption('validationMessageMode', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxCheckBoxComponent.prototype, "value", { /** * Specifies the widget state. */ get: function () { return this._getOption('value'); }, set: function (value) { this._setOption('value', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxCheckBoxComponent.prototype, "visible", { /** * Specifies whether the widget is visible. */ get: function () { return this._getOption('visible'); }, set: function (value) { this._setOption('visible', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxCheckBoxComponent.prototype, "width", { /** * Specifies the widget's width. */ get: function () { return this._getOption('width'); }, set: function (value) { this._setOption('width', value); }, enumerable: true, configurable: true }); DxCheckBoxComponent.prototype.change = function (_) { }; DxCheckBoxComponent.prototype._createInstance = function (element, options) { var widget = new check_box_1.default(element, options); if (this.validator) { this.validator.createInstance(element); } return widget; }; DxCheckBoxComponent.prototype.writeValue = function (value) { this.eventHelper.lockedValueChangeEvent = true; this.value = value; this.eventHelper.lockedValueChangeEvent = false; }; DxCheckBoxComponent.prototype.setDisabledState = function (isDisabled) { this.disabled = isDisabled; }; DxCheckBoxComponent.prototype.registerOnChange = function (fn) { this.change = fn; }; DxCheckBoxComponent.prototype.registerOnTouched = function (fn) { this.touched = fn; }; DxCheckBoxComponent.prototype._createWidget = function (element) { var _this = this; _super.prototype._createWidget.call(this, element); this.instance.on('focusOut', function (e) { _this.eventHelper.fireNgEvent('onBlur', [e]); }); }; DxCheckBoxComponent.prototype.ngOnDestroy = function () { this._destroyWidget(); }; DxCheckBoxComponent.prototype.ngAfterContentInit = function () { if (this.validator) { this.validator.renderOnViewInit = false; } }; DxCheckBoxComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dx-check-box', template: '', providers: [ template_host_1.DxTemplateHost, watcher_helper_1.WatcherHelper, CUSTOM_VALUE_ACCESSOR_PROVIDER, nested_option_1.NestedOptionHost ] },] }, ]; /** @nocollapse */ DxCheckBoxComponent.ctorParameters = function () { return [ { type: core_1.ElementRef, }, { type: core_1.NgZone, }, { type: template_host_1.DxTemplateHost, }, { type: watcher_helper_1.WatcherHelper, }, { type: nested_option_1.NestedOptionHost, }, ]; }; DxCheckBoxComponent.propDecorators = { 'validator': [{ type: core_1.ContentChild, args: [validator_1.DxValidatorComponent,] },], 'accessKey': [{ type: core_1.Input },], 'activeStateEnabled': [{ type: core_1.Input },], 'disabled': [{ type: core_1.Input },], 'elementAttr': [{ type: core_1.Input },], 'focusStateEnabled': [{ type: core_1.Input },], 'height': [{ type: core_1.Input },], 'hint': [{ type: core_1.Input },], 'hoverStateEnabled': [{ type: core_1.Input },], 'isValid': [{ type: core_1.Input },], 'name': [{ type: core_1.Input },], 'readOnly': [{ type: core_1.Input },], 'rtlEnabled': [{ type: core_1.Input },], 'tabIndex': [{ type: core_1.Input },], 'text': [{ type: core_1.Input },], 'validationError': [{ type: core_1.Input },], 'validationMessageMode': [{ type: core_1.Input },], 'value': [{ type: core_1.Input },], 'visible': [{ type: core_1.Input },], 'width': [{ type: core_1.Input },], 'onContentReady': [{ type: core_1.Output },], 'onDisposing': [{ type: core_1.Output },], 'onInitialized': [{ type: core_1.Output },], 'onOptionChanged': [{ type: core_1.Output },], 'onValueChanged': [{ type: core_1.Output },], 'accessKeyChange': [{ type: core_1.Output },], 'activeStateEnabledChange': [{ type: core_1.Output },], 'disabledChange': [{ type: core_1.Output },], 'elementAttrChange': [{ type: core_1.Output },], 'focusStateEnabledChange': [{ type: core_1.Output },], 'heightChange': [{ type: core_1.Output },], 'hintChange': [{ type: core_1.Output },], 'hoverStateEnabledChange': [{ type: core_1.Output },], 'isValidChange': [{ type: core_1.Output },], 'nameChange': [{ type: core_1.Output },], 'readOnlyChange': [{ type: core_1.Output },], 'rtlEnabledChange': [{ type: core_1.Output },], 'tabIndexChange': [{ type: core_1.Output },], 'textChange': [{ type: core_1.Output },], 'validationErrorChange': [{ type: core_1.Output },], 'validationMessageModeChange': [{ type: core_1.Output },], 'valueChange': [{ type: core_1.Output },], 'visibleChange': [{ type: core_1.Output },], 'widthChange': [{ type: core_1.Output },], 'onBlur': [{ type: core_1.Output },], 'change': [{ type: core_1.HostListener, args: ['valueChange', ['$event'],] },], 'touched': [{ type: core_1.HostListener, args: ['onBlur', ['$event'],] },], }; return DxCheckBoxComponent; }(component_1.DxComponent)); exports.DxCheckBoxComponent = DxCheckBoxComponent; var DxCheckBoxModule = (function () { function DxCheckBoxModule() { } DxCheckBoxModule.decorators = [ { type: core_1.NgModule, args: [{ imports: [ template_1.DxTemplateModule ], declarations: [ DxCheckBoxComponent ], exports: [ DxCheckBoxComponent, template_1.DxTemplateModule ], },] }, ]; /** @nocollapse */ DxCheckBoxModule.ctorParameters = function () { return []; }; return DxCheckBoxModule; }()); exports.DxCheckBoxModule = DxCheckBoxModule; //# sourceMappingURL=check-box.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/circular-gauge.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var circular_gauge_1 = __webpack_require__("./node_modules/devextreme/viz/circular_gauge.js"); var component_1 = __webpack_require__("./node_modules/devextreme-angular/core/component.js"); var template_host_1 = __webpack_require__("./node_modules/devextreme-angular/core/template-host.js"); var template_1 = __webpack_require__("./node_modules/devextreme-angular/core/template.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var watcher_helper_1 = __webpack_require__("./node_modules/devextreme-angular/core/watcher-helper.js"); var iterable_differ_helper_1 = __webpack_require__("./node_modules/devextreme-angular/core/iterable-differ-helper.js"); var animation_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/animation.js"); var export_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/export.js"); var geometry_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/geometry.js"); var loading_indicator_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/loading-indicator.js"); var font_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/font.js"); var margin_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/margin.js"); var range_container_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/range-container.js"); var range_dxi_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/range-dxi.js"); var scale_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/scale.js"); var label_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/label.js"); var format_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/format.js"); var overlapping_behavior_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/overlapping-behavior.js"); var major_tick_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/major-tick.js"); var minor_tick_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/minor-tick.js"); var tick_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/tick.js"); var size_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/size.js"); var subtitle_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/subtitle.js"); var subvalue_indicator_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/subvalue-indicator.js"); var text_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/text.js"); var title_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/title.js"); var tooltip_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/tooltip.js"); var border_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/border.js"); var shadow_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/shadow.js"); var value_indicator_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/value-indicator.js"); /** * The CircularGauge is a widget that indicates values on a circular numeric scale. */ var DxCircularGaugeComponent = (function (_super) { __extends(DxCircularGaugeComponent, _super); function DxCircularGaugeComponent(elementRef, ngZone, templateHost, _watcherHelper, _idh, optionHost) { var _this = _super.call(this, elementRef, ngZone, templateHost, _watcherHelper) || this; _this._watcherHelper = _watcherHelper; _this._idh = _idh; _this._createEventEmitters([ { subscribe: 'disposing', emit: 'onDisposing' }, { subscribe: 'drawn', emit: 'onDrawn' }, { subscribe: 'exported', emit: 'onExported' }, { subscribe: 'exporting', emit: 'onExporting' }, { subscribe: 'fileSaving', emit: 'onFileSaving' }, { subscribe: 'incidentOccurred', emit: 'onIncidentOccurred' }, { subscribe: 'initialized', emit: 'onInitialized' }, { subscribe: 'optionChanged', emit: 'onOptionChanged' }, { subscribe: 'tooltipHidden', emit: 'onTooltipHidden' }, { subscribe: 'tooltipShown', emit: 'onTooltipShown' }, { emit: 'animationChange' }, { emit: 'containerBackgroundColorChange' }, { emit: 'elementAttrChange' }, { emit: 'exportChange' }, { emit: 'geometryChange' }, { emit: 'loadingIndicatorChange' }, { emit: 'marginChange' }, { emit: 'pathModifiedChange' }, { emit: 'rangeContainerChange' }, { emit: 'redrawOnResizeChange' }, { emit: 'rtlEnabledChange' }, { emit: 'scaleChange' }, { emit: 'sizeChange' }, { emit: 'subtitleChange' }, { emit: 'subvalueIndicatorChange' }, { emit: 'subvaluesChange' }, { emit: 'themeChange' }, { emit: 'titleChange' }, { emit: 'tooltipChange' }, { emit: 'valueChange' }, { emit: 'valueIndicatorChange' } ]); _this._idh.setHost(_this); optionHost.setHost(_this); return _this; } Object.defineProperty(DxCircularGaugeComponent.prototype, "animation", { /** * Specifies animation options. */ get: function () { return this._getOption('animation'); }, set: function (value) { this._setOption('animation', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxCircularGaugeComponent.prototype, "containerBackgroundColor", { /** * Specifies the color of the parent page element. */ get: function () { return this._getOption('containerBackgroundColor'); }, set: function (value) { this._setOption('containerBackgroundColor', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxCircularGaugeComponent.prototype, "elementAttr", { /** * Specifies the attributes to be attached to the widget's root element. */ get: function () { return this._getOption('elementAttr'); }, set: function (value) { this._setOption('elementAttr', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxCircularGaugeComponent.prototype, "export", { /** * Configures the exporting and printing features. */ get: function () { return this._getOption('export'); }, set: function (value) { this._setOption('export', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxCircularGaugeComponent.prototype, "geometry", { /** * Specifies the options required to set the geometry of the CircularGauge widget. */ get: function () { return this._getOption('geometry'); }, set: function (value) { this._setOption('geometry', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxCircularGaugeComponent.prototype, "loadingIndicator", { /** * Configures the loading indicator. */ get: function () { return this._getOption('loadingIndicator'); }, set: function (value) { this._setOption('loadingIndicator', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxCircularGaugeComponent.prototype, "margin", { /** * Generates space around the widget. */ get: function () { return this._getOption('margin'); }, set: function (value) { this._setOption('margin', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxCircularGaugeComponent.prototype, "pathModified", { /** * Notifies the widget that it is embedded into an HTML page that uses a tag modifying the path. */ get: function () { return this._getOption('pathModified'); }, set: function (value) { this._setOption('pathModified', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxCircularGaugeComponent.prototype, "rangeContainer", { /** * Specifies gauge range container options. */ get: function () { return this._getOption('rangeContainer'); }, set: function (value) { this._setOption('rangeContainer', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxCircularGaugeComponent.prototype, "redrawOnResize", { /** * Specifies whether to redraw the widget when the size of the parent browser window changes or a mobile device rotates. */ get: function () { return this._getOption('redrawOnResize'); }, set: function (value) { this._setOption('redrawOnResize', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxCircularGaugeComponent.prototype, "rtlEnabled", { /** * Switches the widget to a right-to-left representation. */ get: function () { return this._getOption('rtlEnabled'); }, set: function (value) { this._setOption('rtlEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxCircularGaugeComponent.prototype, "scale", { /** * Specifies a gauge's scale options. */ get: function () { return this._getOption('scale'); }, set: function (value) { this._setOption('scale', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxCircularGaugeComponent.prototype, "size", { /** * Specifies the widget's size in pixels. */ get: function () { return this._getOption('size'); }, set: function (value) { this._setOption('size', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxCircularGaugeComponent.prototype, "subtitle", { /** * Use the title.subtitle option instead. */ get: function () { return this._getOption('subtitle'); }, set: function (value) { this._setOption('subtitle', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxCircularGaugeComponent.prototype, "subvalueIndicator", { /** * Specifies the appearance options of subvalue indicators. */ get: function () { return this._getOption('subvalueIndicator'); }, set: function (value) { this._setOption('subvalueIndicator', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxCircularGaugeComponent.prototype, "subvalues", { /** * Specifies a set of subvalues to be designated by the subvalue indicators. */ get: function () { return this._getOption('subvalues'); }, set: function (value) { this._setOption('subvalues', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxCircularGaugeComponent.prototype, "theme", { /** * Sets the name of the theme the widget uses. */ get: function () { return this._getOption('theme'); }, set: function (value) { this._setOption('theme', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxCircularGaugeComponent.prototype, "title", { /** * Configures the widget's title. */ get: function () { return this._getOption('title'); }, set: function (value) { this._setOption('title', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxCircularGaugeComponent.prototype, "tooltip", { /** * Configures tooltips. */ get: function () { return this._getOption('tooltip'); }, set: function (value) { this._setOption('tooltip', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxCircularGaugeComponent.prototype, "value", { /** * Specifies the main value on a gauge. */ get: function () { return this._getOption('value'); }, set: function (value) { this._setOption('value', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxCircularGaugeComponent.prototype, "valueIndicator", { /** * Specifies the appearance options of the value indicator. */ get: function () { return this._getOption('valueIndicator'); }, set: function (value) { this._setOption('valueIndicator', value); }, enumerable: true, configurable: true }); DxCircularGaugeComponent.prototype._createInstance = function (element, options) { return new circular_gauge_1.default(element, options); }; DxCircularGaugeComponent.prototype.ngOnDestroy = function () { this._destroyWidget(); }; DxCircularGaugeComponent.prototype.ngOnChanges = function (changes) { _super.prototype.ngOnChanges.call(this, changes); this.setupChanges('subvalues', changes); }; DxCircularGaugeComponent.prototype.setupChanges = function (prop, changes) { if (!(prop in this._optionsToUpdate)) { this._idh.setup(prop, changes); } }; DxCircularGaugeComponent.prototype.ngDoCheck = function () { this._idh.doCheck('subvalues'); this._watcherHelper.checkWatchers(); _super.prototype.ngDoCheck.call(this); _super.prototype.clearChangedOptions.call(this); }; DxCircularGaugeComponent.prototype._setOption = function (name, value) { var isSetup = this._idh.setupSingle(name, value); var isChanged = this._idh.getChanges(name, value) !== null; if (isSetup || isChanged) { _super.prototype._setOption.call(this, name, value); } }; DxCircularGaugeComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dx-circular-gauge', template: '', styles: [' :host { display: block; }'], providers: [ template_host_1.DxTemplateHost, watcher_helper_1.WatcherHelper, nested_option_1.NestedOptionHost, iterable_differ_helper_1.IterableDifferHelper ] },] }, ]; /** @nocollapse */ DxCircularGaugeComponent.ctorParameters = function () { return [ { type: core_1.ElementRef, }, { type: core_1.NgZone, }, { type: template_host_1.DxTemplateHost, }, { type: watcher_helper_1.WatcherHelper, }, { type: iterable_differ_helper_1.IterableDifferHelper, }, { type: nested_option_1.NestedOptionHost, }, ]; }; DxCircularGaugeComponent.propDecorators = { 'animation': [{ type: core_1.Input },], 'containerBackgroundColor': [{ type: core_1.Input },], 'elementAttr': [{ type: core_1.Input },], 'export': [{ type: core_1.Input },], 'geometry': [{ type: core_1.Input },], 'loadingIndicator': [{ type: core_1.Input },], 'margin': [{ type: core_1.Input },], 'pathModified': [{ type: core_1.Input },], 'rangeContainer': [{ type: core_1.Input },], 'redrawOnResize': [{ type: core_1.Input },], 'rtlEnabled': [{ type: core_1.Input },], 'scale': [{ type: core_1.Input },], 'size': [{ type: core_1.Input },], 'subtitle': [{ type: core_1.Input },], 'subvalueIndicator': [{ type: core_1.Input },], 'subvalues': [{ type: core_1.Input },], 'theme': [{ type: core_1.Input },], 'title': [{ type: core_1.Input },], 'tooltip': [{ type: core_1.Input },], 'value': [{ type: core_1.Input },], 'valueIndicator': [{ type: core_1.Input },], 'onDisposing': [{ type: core_1.Output },], 'onDrawn': [{ type: core_1.Output },], 'onExported': [{ type: core_1.Output },], 'onExporting': [{ type: core_1.Output },], 'onFileSaving': [{ type: core_1.Output },], 'onIncidentOccurred': [{ type: core_1.Output },], 'onInitialized': [{ type: core_1.Output },], 'onOptionChanged': [{ type: core_1.Output },], 'onTooltipHidden': [{ type: core_1.Output },], 'onTooltipShown': [{ type: core_1.Output },], 'animationChange': [{ type: core_1.Output },], 'containerBackgroundColorChange': [{ type: core_1.Output },], 'elementAttrChange': [{ type: core_1.Output },], 'exportChange': [{ type: core_1.Output },], 'geometryChange': [{ type: core_1.Output },], 'loadingIndicatorChange': [{ type: core_1.Output },], 'marginChange': [{ type: core_1.Output },], 'pathModifiedChange': [{ type: core_1.Output },], 'rangeContainerChange': [{ type: core_1.Output },], 'redrawOnResizeChange': [{ type: core_1.Output },], 'rtlEnabledChange': [{ type: core_1.Output },], 'scaleChange': [{ type: core_1.Output },], 'sizeChange': [{ type: core_1.Output },], 'subtitleChange': [{ type: core_1.Output },], 'subvalueIndicatorChange': [{ type: core_1.Output },], 'subvaluesChange': [{ type: core_1.Output },], 'themeChange': [{ type: core_1.Output },], 'titleChange': [{ type: core_1.Output },], 'tooltipChange': [{ type: core_1.Output },], 'valueChange': [{ type: core_1.Output },], 'valueIndicatorChange': [{ type: core_1.Output },], }; return DxCircularGaugeComponent; }(component_1.DxComponent)); exports.DxCircularGaugeComponent = DxCircularGaugeComponent; var DxCircularGaugeModule = (function () { function DxCircularGaugeModule() { } DxCircularGaugeModule.decorators = [ { type: core_1.NgModule, args: [{ imports: [ animation_1.DxoAnimationModule, export_1.DxoExportModule, geometry_1.DxoGeometryModule, loading_indicator_1.DxoLoadingIndicatorModule, font_1.DxoFontModule, margin_1.DxoMarginModule, range_container_1.DxoRangeContainerModule, range_dxi_1.DxiRangeModule, scale_1.DxoScaleModule, label_1.DxoLabelModule, format_1.DxoFormatModule, overlapping_behavior_1.DxoOverlappingBehaviorModule, major_tick_1.DxoMajorTickModule, minor_tick_1.DxoMinorTickModule, tick_1.DxoTickModule, size_1.DxoSizeModule, subtitle_1.DxoSubtitleModule, subvalue_indicator_1.DxoSubvalueIndicatorModule, text_1.DxoTextModule, title_1.DxoTitleModule, tooltip_1.DxoTooltipModule, border_1.DxoBorderModule, shadow_1.DxoShadowModule, value_indicator_1.DxoValueIndicatorModule, template_1.DxTemplateModule ], declarations: [ DxCircularGaugeComponent ], exports: [ DxCircularGaugeComponent, animation_1.DxoAnimationModule, export_1.DxoExportModule, geometry_1.DxoGeometryModule, loading_indicator_1.DxoLoadingIndicatorModule, font_1.DxoFontModule, margin_1.DxoMarginModule, range_container_1.DxoRangeContainerModule, range_dxi_1.DxiRangeModule, scale_1.DxoScaleModule, label_1.DxoLabelModule, format_1.DxoFormatModule, overlapping_behavior_1.DxoOverlappingBehaviorModule, major_tick_1.DxoMajorTickModule, minor_tick_1.DxoMinorTickModule, tick_1.DxoTickModule, size_1.DxoSizeModule, subtitle_1.DxoSubtitleModule, subvalue_indicator_1.DxoSubvalueIndicatorModule, text_1.DxoTextModule, title_1.DxoTitleModule, tooltip_1.DxoTooltipModule, border_1.DxoBorderModule, shadow_1.DxoShadowModule, value_indicator_1.DxoValueIndicatorModule, template_1.DxTemplateModule ], },] }, ]; /** @nocollapse */ DxCircularGaugeModule.ctorParameters = function () { return []; }; return DxCircularGaugeModule; }()); exports.DxCircularGaugeModule = DxCircularGaugeModule; //# sourceMappingURL=circular-gauge.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/color-box.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var color_box_1 = __webpack_require__("./node_modules/devextreme/ui/color_box.js"); var validator_1 = __webpack_require__("./node_modules/devextreme-angular/ui/validator.js"); var forms_1 = __webpack_require__("./node_modules/@angular/forms/esm2015/forms.js"); var component_1 = __webpack_require__("./node_modules/devextreme-angular/core/component.js"); var template_host_1 = __webpack_require__("./node_modules/devextreme-angular/core/template-host.js"); var template_1 = __webpack_require__("./node_modules/devextreme-angular/core/template.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var watcher_helper_1 = __webpack_require__("./node_modules/devextreme-angular/core/watcher-helper.js"); var CUSTOM_VALUE_ACCESSOR_PROVIDER = { provide: forms_1.NG_VALUE_ACCESSOR, useExisting: core_1.forwardRef(function () { return DxColorBoxComponent; }), multi: true }; /** * The ColorBox is a widget that allows an end user to enter a color or pick it out from the drop-down editor. */ var DxColorBoxComponent = (function (_super) { __extends(DxColorBoxComponent, _super); function DxColorBoxComponent(elementRef, ngZone, templateHost, _watcherHelper, optionHost) { var _this = _super.call(this, elementRef, ngZone, templateHost, _watcherHelper) || this; _this.touched = function (_) { }; _this._createEventEmitters([ { subscribe: 'change', emit: 'onChange' }, { subscribe: 'closed', emit: 'onClosed' }, { subscribe: 'copy', emit: 'onCopy' }, { subscribe: 'cut', emit: 'onCut' }, { subscribe: 'disposing', emit: 'onDisposing' }, { subscribe: 'enterKey', emit: 'onEnterKey' }, { subscribe: 'focusIn', emit: 'onFocusIn' }, { subscribe: 'focusOut', emit: 'onFocusOut' }, { subscribe: 'initialized', emit: 'onInitialized' }, { subscribe: 'input', emit: 'onInput' }, { subscribe: 'keyDown', emit: 'onKeyDown' }, { subscribe: 'keyPress', emit: 'onKeyPress' }, { subscribe: 'keyUp', emit: 'onKeyUp' }, { subscribe: 'opened', emit: 'onOpened' }, { subscribe: 'optionChanged', emit: 'onOptionChanged' }, { subscribe: 'paste', emit: 'onPaste' }, { subscribe: 'valueChanged', emit: 'onValueChanged' }, { emit: 'acceptCustomValueChange' }, { emit: 'accessKeyChange' }, { emit: 'activeStateEnabledChange' }, { emit: 'applyButtonTextChange' }, { emit: 'applyValueModeChange' }, { emit: 'attrChange' }, { emit: 'cancelButtonTextChange' }, { emit: 'deferRenderingChange' }, { emit: 'disabledChange' }, { emit: 'dropDownButtonTemplateChange' }, { emit: 'editAlphaChannelChange' }, { emit: 'elementAttrChange' }, { emit: 'fieldTemplateChange' }, { emit: 'focusStateEnabledChange' }, { emit: 'heightChange' }, { emit: 'hintChange' }, { emit: 'hoverStateEnabledChange' }, { emit: 'inputAttrChange' }, { emit: 'isValidChange' }, { emit: 'keyStepChange' }, { emit: 'nameChange' }, { emit: 'openedChange' }, { emit: 'placeholderChange' }, { emit: 'readOnlyChange' }, { emit: 'rtlEnabledChange' }, { emit: 'tabIndexChange' }, { emit: 'textChange' }, { emit: 'validationErrorChange' }, { emit: 'validationMessageModeChange' }, { emit: 'valueChange' }, { emit: 'visibleChange' }, { emit: 'widthChange' }, { emit: 'onBlur' } ]); optionHost.setHost(_this); return _this; } Object.defineProperty(DxColorBoxComponent.prototype, "acceptCustomValue", { /** * Specifies whether or not the widget allows an end-user to enter a custom value. */ get: function () { return this._getOption('acceptCustomValue'); }, set: function (value) { this._setOption('acceptCustomValue', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxColorBoxComponent.prototype, "accessKey", { /** * Specifies the shortcut key that sets focus on the widget. */ get: function () { return this._getOption('accessKey'); }, set: function (value) { this._setOption('accessKey', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxColorBoxComponent.prototype, "activeStateEnabled", { /** * Specifies whether or not the widget changes its state when interacting with a user. */ get: function () { return this._getOption('activeStateEnabled'); }, set: function (value) { this._setOption('activeStateEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxColorBoxComponent.prototype, "applyButtonText", { /** * Specifies the text displayed on the button that applies changes and closes the drop-down editor. */ get: function () { return this._getOption('applyButtonText'); }, set: function (value) { this._setOption('applyButtonText', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxColorBoxComponent.prototype, "applyValueMode", { /** * Specifies the way an end-user applies the selected value. */ get: function () { return this._getOption('applyValueMode'); }, set: function (value) { this._setOption('applyValueMode', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxColorBoxComponent.prototype, "attr", { /** * Use the inputAttr option instead. */ get: function () { return this._getOption('attr'); }, set: function (value) { this._setOption('attr', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxColorBoxComponent.prototype, "cancelButtonText", { /** * Specifies the text displayed on the button that cancels changes and closes the drop-down editor. */ get: function () { return this._getOption('cancelButtonText'); }, set: function (value) { this._setOption('cancelButtonText', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxColorBoxComponent.prototype, "deferRendering", { /** * Specifies whether widget content is rendered when the widget is shown or when rendering the widget. */ get: function () { return this._getOption('deferRendering'); }, set: function (value) { this._setOption('deferRendering', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxColorBoxComponent.prototype, "disabled", { /** * Specifies whether the widget responds to user interaction. */ get: function () { return this._getOption('disabled'); }, set: function (value) { this._setOption('disabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxColorBoxComponent.prototype, "dropDownButtonTemplate", { /** * Specifies a custom template for the drop-down button. */ get: function () { return this._getOption('dropDownButtonTemplate'); }, set: function (value) { this._setOption('dropDownButtonTemplate', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxColorBoxComponent.prototype, "editAlphaChannel", { /** * Specifies whether or not the widget value includes the alpha channel component. */ get: function () { return this._getOption('editAlphaChannel'); }, set: function (value) { this._setOption('editAlphaChannel', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxColorBoxComponent.prototype, "elementAttr", { /** * Specifies the attributes to be attached to the widget's root element. */ get: function () { return this._getOption('elementAttr'); }, set: function (value) { this._setOption('elementAttr', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxColorBoxComponent.prototype, "fieldTemplate", { /** * Specifies a custom template for the input field. Must contain the TextBox widget. */ get: function () { return this._getOption('fieldTemplate'); }, set: function (value) { this._setOption('fieldTemplate', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxColorBoxComponent.prototype, "focusStateEnabled", { /** * Specifies whether the widget can be focused using keyboard navigation. */ get: function () { return this._getOption('focusStateEnabled'); }, set: function (value) { this._setOption('focusStateEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxColorBoxComponent.prototype, "height", { /** * Specifies the widget's height. */ get: function () { return this._getOption('height'); }, set: function (value) { this._setOption('height', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxColorBoxComponent.prototype, "hint", { /** * Specifies text for a hint that appears when a user pauses on the widget. */ get: function () { return this._getOption('hint'); }, set: function (value) { this._setOption('hint', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxColorBoxComponent.prototype, "hoverStateEnabled", { /** * Specifies whether the widget changes its state when a user pauses on it. */ get: function () { return this._getOption('hoverStateEnabled'); }, set: function (value) { this._setOption('hoverStateEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxColorBoxComponent.prototype, "inputAttr", { /** * Specifies the attributes to be passed on to the underlying HTML element. */ get: function () { return this._getOption('inputAttr'); }, set: function (value) { this._setOption('inputAttr', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxColorBoxComponent.prototype, "isValid", { /** * Specifies whether the editor's value is valid. */ get: function () { return this._getOption('isValid'); }, set: function (value) { this._setOption('isValid', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxColorBoxComponent.prototype, "keyStep", { /** * Specifies the size of a step by which a handle is moved using a keyboard shortcut. */ get: function () { return this._getOption('keyStep'); }, set: function (value) { this._setOption('keyStep', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxColorBoxComponent.prototype, "name", { /** * The value to be assigned to the `name` attribute of the underlying HTML element. */ get: function () { return this._getOption('name'); }, set: function (value) { this._setOption('name', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxColorBoxComponent.prototype, "opened", { /** * Specifies whether or not the drop-down editor is displayed. */ get: function () { return this._getOption('opened'); }, set: function (value) { this._setOption('opened', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxColorBoxComponent.prototype, "placeholder", { /** * The text displayed by the widget when the widget value is empty. */ get: function () { return this._getOption('placeholder'); }, set: function (value) { this._setOption('placeholder', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxColorBoxComponent.prototype, "readOnly", { /** * A Boolean value specifying whether or not the widget is read-only. */ get: function () { return this._getOption('readOnly'); }, set: function (value) { this._setOption('readOnly', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxColorBoxComponent.prototype, "rtlEnabled", { /** * Switches the widget to a right-to-left representation. */ get: function () { return this._getOption('rtlEnabled'); }, set: function (value) { this._setOption('rtlEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxColorBoxComponent.prototype, "tabIndex", { /** * Specifies the number of the element when the Tab key is used for navigating. */ get: function () { return this._getOption('tabIndex'); }, set: function (value) { this._setOption('tabIndex', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxColorBoxComponent.prototype, "text", { /** * The read-only option that holds the text displayed by the widget input element. */ get: function () { return this._getOption('text'); }, set: function (value) { this._setOption('text', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxColorBoxComponent.prototype, "validationError", { /** * Specifies information on the validation error when using a custom validation engine. Should be changed at runtime along with the isValid option. */ get: function () { return this._getOption('validationError'); }, set: function (value) { this._setOption('validationError', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxColorBoxComponent.prototype, "validationMessageMode", { /** * Specifies how the message about the validation rules that are not satisfied by this editor's value is displayed. */ get: function () { return this._getOption('validationMessageMode'); }, set: function (value) { this._setOption('validationMessageMode', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxColorBoxComponent.prototype, "value", { /** * Specifies the currently selected value. */ get: function () { return this._getOption('value'); }, set: function (value) { this._setOption('value', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxColorBoxComponent.prototype, "visible", { /** * Specifies whether the widget is visible. */ get: function () { return this._getOption('visible'); }, set: function (value) { this._setOption('visible', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxColorBoxComponent.prototype, "width", { /** * Specifies the widget's width. */ get: function () { return this._getOption('width'); }, set: function (value) { this._setOption('width', value); }, enumerable: true, configurable: true }); DxColorBoxComponent.prototype.change = function (_) { }; DxColorBoxComponent.prototype._createInstance = function (element, options) { var widget = new color_box_1.default(element, options); if (this.validator) { this.validator.createInstance(element); } return widget; }; DxColorBoxComponent.prototype.writeValue = function (value) { this.eventHelper.lockedValueChangeEvent = true; this.value = value; this.eventHelper.lockedValueChangeEvent = false; }; DxColorBoxComponent.prototype.setDisabledState = function (isDisabled) { this.disabled = isDisabled; }; DxColorBoxComponent.prototype.registerOnChange = function (fn) { this.change = fn; }; DxColorBoxComponent.prototype.registerOnTouched = function (fn) { this.touched = fn; }; DxColorBoxComponent.prototype._createWidget = function (element) { var _this = this; _super.prototype._createWidget.call(this, element); this.instance.on('focusOut', function (e) { _this.eventHelper.fireNgEvent('onBlur', [e]); }); }; DxColorBoxComponent.prototype.ngOnDestroy = function () { this._destroyWidget(); }; DxColorBoxComponent.prototype.ngAfterContentInit = function () { if (this.validator) { this.validator.renderOnViewInit = false; } }; DxColorBoxComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dx-color-box', template: '', providers: [ template_host_1.DxTemplateHost, watcher_helper_1.WatcherHelper, CUSTOM_VALUE_ACCESSOR_PROVIDER, nested_option_1.NestedOptionHost ] },] }, ]; /** @nocollapse */ DxColorBoxComponent.ctorParameters = function () { return [ { type: core_1.ElementRef, }, { type: core_1.NgZone, }, { type: template_host_1.DxTemplateHost, }, { type: watcher_helper_1.WatcherHelper, }, { type: nested_option_1.NestedOptionHost, }, ]; }; DxColorBoxComponent.propDecorators = { 'validator': [{ type: core_1.ContentChild, args: [validator_1.DxValidatorComponent,] },], 'acceptCustomValue': [{ type: core_1.Input },], 'accessKey': [{ type: core_1.Input },], 'activeStateEnabled': [{ type: core_1.Input },], 'applyButtonText': [{ type: core_1.Input },], 'applyValueMode': [{ type: core_1.Input },], 'attr': [{ type: core_1.Input },], 'cancelButtonText': [{ type: core_1.Input },], 'deferRendering': [{ type: core_1.Input },], 'disabled': [{ type: core_1.Input },], 'dropDownButtonTemplate': [{ type: core_1.Input },], 'editAlphaChannel': [{ type: core_1.Input },], 'elementAttr': [{ type: core_1.Input },], 'fieldTemplate': [{ type: core_1.Input },], 'focusStateEnabled': [{ type: core_1.Input },], 'height': [{ type: core_1.Input },], 'hint': [{ type: core_1.Input },], 'hoverStateEnabled': [{ type: core_1.Input },], 'inputAttr': [{ type: core_1.Input },], 'isValid': [{ type: core_1.Input },], 'keyStep': [{ type: core_1.Input },], 'name': [{ type: core_1.Input },], 'opened': [{ type: core_1.Input },], 'placeholder': [{ type: core_1.Input },], 'readOnly': [{ type: core_1.Input },], 'rtlEnabled': [{ type: core_1.Input },], 'tabIndex': [{ type: core_1.Input },], 'text': [{ type: core_1.Input },], 'validationError': [{ type: core_1.Input },], 'validationMessageMode': [{ type: core_1.Input },], 'value': [{ type: core_1.Input },], 'visible': [{ type: core_1.Input },], 'width': [{ type: core_1.Input },], 'onChange': [{ type: core_1.Output },], 'onClosed': [{ type: core_1.Output },], 'onCopy': [{ type: core_1.Output },], 'onCut': [{ type: core_1.Output },], 'onDisposing': [{ type: core_1.Output },], 'onEnterKey': [{ type: core_1.Output },], 'onFocusIn': [{ type: core_1.Output },], 'onFocusOut': [{ type: core_1.Output },], 'onInitialized': [{ type: core_1.Output },], 'onInput': [{ type: core_1.Output },], 'onKeyDown': [{ type: core_1.Output },], 'onKeyPress': [{ type: core_1.Output },], 'onKeyUp': [{ type: core_1.Output },], 'onOpened': [{ type: core_1.Output },], 'onOptionChanged': [{ type: core_1.Output },], 'onPaste': [{ type: core_1.Output },], 'onValueChanged': [{ type: core_1.Output },], 'acceptCustomValueChange': [{ type: core_1.Output },], 'accessKeyChange': [{ type: core_1.Output },], 'activeStateEnabledChange': [{ type: core_1.Output },], 'applyButtonTextChange': [{ type: core_1.Output },], 'applyValueModeChange': [{ type: core_1.Output },], 'attrChange': [{ type: core_1.Output },], 'cancelButtonTextChange': [{ type: core_1.Output },], 'deferRenderingChange': [{ type: core_1.Output },], 'disabledChange': [{ type: core_1.Output },], 'dropDownButtonTemplateChange': [{ type: core_1.Output },], 'editAlphaChannelChange': [{ type: core_1.Output },], 'elementAttrChange': [{ type: core_1.Output },], 'fieldTemplateChange': [{ type: core_1.Output },], 'focusStateEnabledChange': [{ type: core_1.Output },], 'heightChange': [{ type: core_1.Output },], 'hintChange': [{ type: core_1.Output },], 'hoverStateEnabledChange': [{ type: core_1.Output },], 'inputAttrChange': [{ type: core_1.Output },], 'isValidChange': [{ type: core_1.Output },], 'keyStepChange': [{ type: core_1.Output },], 'nameChange': [{ type: core_1.Output },], 'openedChange': [{ type: core_1.Output },], 'placeholderChange': [{ type: core_1.Output },], 'readOnlyChange': [{ type: core_1.Output },], 'rtlEnabledChange': [{ type: core_1.Output },], 'tabIndexChange': [{ type: core_1.Output },], 'textChange': [{ type: core_1.Output },], 'validationErrorChange': [{ type: core_1.Output },], 'validationMessageModeChange': [{ type: core_1.Output },], 'valueChange': [{ type: core_1.Output },], 'visibleChange': [{ type: core_1.Output },], 'widthChange': [{ type: core_1.Output },], 'onBlur': [{ type: core_1.Output },], 'change': [{ type: core_1.HostListener, args: ['valueChange', ['$event'],] },], 'touched': [{ type: core_1.HostListener, args: ['onBlur', ['$event'],] },], }; return DxColorBoxComponent; }(component_1.DxComponent)); exports.DxColorBoxComponent = DxColorBoxComponent; var DxColorBoxModule = (function () { function DxColorBoxModule() { } DxColorBoxModule.decorators = [ { type: core_1.NgModule, args: [{ imports: [ template_1.DxTemplateModule ], declarations: [ DxColorBoxComponent ], exports: [ DxColorBoxComponent, template_1.DxTemplateModule ], },] }, ]; /** @nocollapse */ DxColorBoxModule.ctorParameters = function () { return []; }; return DxColorBoxModule; }()); exports.DxColorBoxModule = DxColorBoxModule; //# sourceMappingURL=color-box.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/context-menu.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var context_menu_1 = __webpack_require__("./node_modules/devextreme/ui/context_menu.js"); var component_1 = __webpack_require__("./node_modules/devextreme-angular/core/component.js"); var template_host_1 = __webpack_require__("./node_modules/devextreme-angular/core/template-host.js"); var template_1 = __webpack_require__("./node_modules/devextreme-angular/core/template.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var watcher_helper_1 = __webpack_require__("./node_modules/devextreme-angular/core/watcher-helper.js"); var iterable_differ_helper_1 = __webpack_require__("./node_modules/devextreme-angular/core/iterable-differ-helper.js"); var animation_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/animation.js"); var hide_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/hide.js"); var show_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/show.js"); var item_dxi_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/item-dxi.js"); var position_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/position.js"); var at_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/at.js"); var boundary_offset_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/boundary-offset.js"); var collision_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/collision.js"); var my_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/my.js"); var offset_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/offset.js"); var show_event_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/show-event.js"); var show_submenu_mode_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/show-submenu-mode.js"); var delay_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/delay.js"); var item_dxi_2 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/item-dxi.js"); /** * The ContextMenu widget displays a single- or multi-level context menu. An end user invokes this menu by a right click or a long press. */ var DxContextMenuComponent = (function (_super) { __extends(DxContextMenuComponent, _super); function DxContextMenuComponent(elementRef, ngZone, templateHost, _watcherHelper, _idh, optionHost) { var _this = _super.call(this, elementRef, ngZone, templateHost, _watcherHelper) || this; _this._watcherHelper = _watcherHelper; _this._idh = _idh; _this._createEventEmitters([ { subscribe: 'contentReady', emit: 'onContentReady' }, { subscribe: 'disposing', emit: 'onDisposing' }, { subscribe: 'hidden', emit: 'onHidden' }, { subscribe: 'hiding', emit: 'onHiding' }, { subscribe: 'initialized', emit: 'onInitialized' }, { subscribe: 'itemClick', emit: 'onItemClick' }, { subscribe: 'itemContextMenu', emit: 'onItemContextMenu' }, { subscribe: 'itemRendered', emit: 'onItemRendered' }, { subscribe: 'optionChanged', emit: 'onOptionChanged' }, { subscribe: 'positioning', emit: 'onPositioning' }, { subscribe: 'selectionChanged', emit: 'onSelectionChanged' }, { subscribe: 'showing', emit: 'onShowing' }, { subscribe: 'shown', emit: 'onShown' }, { emit: 'accessKeyChange' }, { emit: 'activeStateEnabledChange' }, { emit: 'animationChange' }, { emit: 'closeOnOutsideClickChange' }, { emit: 'cssClassChange' }, { emit: 'dataSourceChange' }, { emit: 'disabledChange' }, { emit: 'disabledExprChange' }, { emit: 'displayExprChange' }, { emit: 'elementAttrChange' }, { emit: 'focusStateEnabledChange' }, { emit: 'heightChange' }, { emit: 'hintChange' }, { emit: 'hoverStateEnabledChange' }, { emit: 'itemsChange' }, { emit: 'itemsExprChange' }, { emit: 'itemTemplateChange' }, { emit: 'positionChange' }, { emit: 'rtlEnabledChange' }, { emit: 'selectByClickChange' }, { emit: 'selectedExprChange' }, { emit: 'selectedItemChange' }, { emit: 'selectionByClickChange' }, { emit: 'selectionModeChange' }, { emit: 'showEventChange' }, { emit: 'showSubmenuModeChange' }, { emit: 'submenuDirectionChange' }, { emit: 'tabIndexChange' }, { emit: 'targetChange' }, { emit: 'visibleChange' }, { emit: 'widthChange' } ]); _this._idh.setHost(_this); optionHost.setHost(_this); return _this; } Object.defineProperty(DxContextMenuComponent.prototype, "accessKey", { /** * Specifies the shortcut key that sets focus on the widget. */ get: function () { return this._getOption('accessKey'); }, set: function (value) { this._setOption('accessKey', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxContextMenuComponent.prototype, "activeStateEnabled", { /** * A Boolean value specifying whether or not the widget changes its state when interacting with a user. */ get: function () { return this._getOption('activeStateEnabled'); }, set: function (value) { this._setOption('activeStateEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxContextMenuComponent.prototype, "animation", { /** * Configures widget visibility animations. This object contains two fields: show and hide. */ get: function () { return this._getOption('animation'); }, set: function (value) { this._setOption('animation', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxContextMenuComponent.prototype, "closeOnOutsideClick", { /** * Specifies whether to close the ContextMenu if a user clicks outside it. */ get: function () { return this._getOption('closeOnOutsideClick'); }, set: function (value) { this._setOption('closeOnOutsideClick', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxContextMenuComponent.prototype, "cssClass", { /** * Specifies the name of the CSS class to be applied to the root menu level and all submenus. */ get: function () { return this._getOption('cssClass'); }, set: function (value) { this._setOption('cssClass', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxContextMenuComponent.prototype, "dataSource", { /** * A data source used to fetch data to be displayed by the widget. */ get: function () { return this._getOption('dataSource'); }, set: function (value) { this._setOption('dataSource', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxContextMenuComponent.prototype, "disabled", { /** * Specifies whether the widget responds to user interaction. */ get: function () { return this._getOption('disabled'); }, set: function (value) { this._setOption('disabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxContextMenuComponent.prototype, "disabledExpr", { /** * Specifies the name of the data source item field whose value defines whether or not the corresponding widget item is disabled. */ get: function () { return this._getOption('disabledExpr'); }, set: function (value) { this._setOption('disabledExpr', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxContextMenuComponent.prototype, "displayExpr", { /** * Specifies the name of the data source item field whose value is displayed by the widget. */ get: function () { return this._getOption('displayExpr'); }, set: function (value) { this._setOption('displayExpr', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxContextMenuComponent.prototype, "elementAttr", { /** * Specifies the attributes to be attached to the widget's root element. */ get: function () { return this._getOption('elementAttr'); }, set: function (value) { this._setOption('elementAttr', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxContextMenuComponent.prototype, "focusStateEnabled", { /** * Specifies whether the widget can be focused using keyboard navigation. */ get: function () { return this._getOption('focusStateEnabled'); }, set: function (value) { this._setOption('focusStateEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxContextMenuComponent.prototype, "height", { /** * Specifies the widget's height. */ get: function () { return this._getOption('height'); }, set: function (value) { this._setOption('height', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxContextMenuComponent.prototype, "hint", { /** * Specifies text for a hint that appears when a user pauses on the widget. */ get: function () { return this._getOption('hint'); }, set: function (value) { this._setOption('hint', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxContextMenuComponent.prototype, "hoverStateEnabled", { /** * Specifies whether the widget changes its state when a user pauses on it. */ get: function () { return this._getOption('hoverStateEnabled'); }, set: function (value) { this._setOption('hoverStateEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxContextMenuComponent.prototype, "items", { /** * Holds an array of menu items. */ get: function () { return this._getOption('items'); }, set: function (value) { this._setOption('items', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxContextMenuComponent.prototype, "itemsExpr", { /** * Specifies which data field contains nested items. */ get: function () { return this._getOption('itemsExpr'); }, set: function (value) { this._setOption('itemsExpr', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxContextMenuComponent.prototype, "itemTemplate", { /** * Specifies a custom template for items. */ get: function () { return this._getOption('itemTemplate'); }, set: function (value) { this._setOption('itemTemplate', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxContextMenuComponent.prototype, "position", { /** * An object defining widget positioning options. */ get: function () { return this._getOption('position'); }, set: function (value) { this._setOption('position', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxContextMenuComponent.prototype, "rtlEnabled", { /** * Switches the widget to a right-to-left representation. */ get: function () { return this._getOption('rtlEnabled'); }, set: function (value) { this._setOption('rtlEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxContextMenuComponent.prototype, "selectByClick", { /** * Specifies whether or not an item becomes selected if a user clicks it. */ get: function () { return this._getOption('selectByClick'); }, set: function (value) { this._setOption('selectByClick', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxContextMenuComponent.prototype, "selectedExpr", { /** * Specifies the name of the data source item field whose value defines whether or not the corresponding widget items is selected. */ get: function () { return this._getOption('selectedExpr'); }, set: function (value) { this._setOption('selectedExpr', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxContextMenuComponent.prototype, "selectedItem", { /** * The selected item object. */ get: function () { return this._getOption('selectedItem'); }, set: function (value) { this._setOption('selectedItem', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxContextMenuComponent.prototype, "selectionByClick", { /** * Use the selectByClick option instead. */ get: function () { return this._getOption('selectionByClick'); }, set: function (value) { this._setOption('selectionByClick', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxContextMenuComponent.prototype, "selectionMode", { /** * Specifies the selection mode supported by the menu. */ get: function () { return this._getOption('selectionMode'); }, set: function (value) { this._setOption('selectionMode', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxContextMenuComponent.prototype, "showEvent", { /** * Specifies options for displaying the widget. */ get: function () { return this._getOption('showEvent'); }, set: function (value) { this._setOption('showEvent', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxContextMenuComponent.prototype, "showSubmenuMode", { /** * Specifies options of submenu showing and hiding. */ get: function () { return this._getOption('showSubmenuMode'); }, set: function (value) { this._setOption('showSubmenuMode', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxContextMenuComponent.prototype, "submenuDirection", { /** * Specifies the direction at which submenus are displayed. */ get: function () { return this._getOption('submenuDirection'); }, set: function (value) { this._setOption('submenuDirection', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxContextMenuComponent.prototype, "tabIndex", { /** * Specifies the number of the element when the Tab key is used for navigating. */ get: function () { return this._getOption('tabIndex'); }, set: function (value) { this._setOption('tabIndex', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxContextMenuComponent.prototype, "target", { /** * The target element associated with the context menu. */ get: function () { return this._getOption('target'); }, set: function (value) { this._setOption('target', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxContextMenuComponent.prototype, "visible", { /** * A Boolean value specifying whether or not the widget is visible. */ get: function () { return this._getOption('visible'); }, set: function (value) { this._setOption('visible', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxContextMenuComponent.prototype, "width", { /** * Specifies the widget's width. */ get: function () { return this._getOption('width'); }, set: function (value) { this._setOption('width', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxContextMenuComponent.prototype, "itemsChildren", { get: function () { return this._getOption('items'); }, set: function (value) { this.setChildren('items', value); }, enumerable: true, configurable: true }); DxContextMenuComponent.prototype._createInstance = function (element, options) { return new context_menu_1.default(element, options); }; DxContextMenuComponent.prototype.ngOnDestroy = function () { this._destroyWidget(); }; DxContextMenuComponent.prototype.ngOnChanges = function (changes) { _super.prototype.ngOnChanges.call(this, changes); this.setupChanges('dataSource', changes); this.setupChanges('items', changes); }; DxContextMenuComponent.prototype.setupChanges = function (prop, changes) { if (!(prop in this._optionsToUpdate)) { this._idh.setup(prop, changes); } }; DxContextMenuComponent.prototype.ngDoCheck = function () { this._idh.doCheck('dataSource'); this._idh.doCheck('items'); this._watcherHelper.checkWatchers(); _super.prototype.ngDoCheck.call(this); _super.prototype.clearChangedOptions.call(this); }; DxContextMenuComponent.prototype._setOption = function (name, value) { var isSetup = this._idh.setupSingle(name, value); var isChanged = this._idh.getChanges(name, value) !== null; if (isSetup || isChanged) { _super.prototype._setOption.call(this, name, value); } }; DxContextMenuComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dx-context-menu', template: '', providers: [ template_host_1.DxTemplateHost, watcher_helper_1.WatcherHelper, nested_option_1.NestedOptionHost, iterable_differ_helper_1.IterableDifferHelper ] },] }, ]; /** @nocollapse */ DxContextMenuComponent.ctorParameters = function () { return [ { type: core_1.ElementRef, }, { type: core_1.NgZone, }, { type: template_host_1.DxTemplateHost, }, { type: watcher_helper_1.WatcherHelper, }, { type: iterable_differ_helper_1.IterableDifferHelper, }, { type: nested_option_1.NestedOptionHost, }, ]; }; DxContextMenuComponent.propDecorators = { 'accessKey': [{ type: core_1.Input },], 'activeStateEnabled': [{ type: core_1.Input },], 'animation': [{ type: core_1.Input },], 'closeOnOutsideClick': [{ type: core_1.Input },], 'cssClass': [{ type: core_1.Input },], 'dataSource': [{ type: core_1.Input },], 'disabled': [{ type: core_1.Input },], 'disabledExpr': [{ type: core_1.Input },], 'displayExpr': [{ type: core_1.Input },], 'elementAttr': [{ type: core_1.Input },], 'focusStateEnabled': [{ type: core_1.Input },], 'height': [{ type: core_1.Input },], 'hint': [{ type: core_1.Input },], 'hoverStateEnabled': [{ type: core_1.Input },], 'items': [{ type: core_1.Input },], 'itemsExpr': [{ type: core_1.Input },], 'itemTemplate': [{ type: core_1.Input },], 'position': [{ type: core_1.Input },], 'rtlEnabled': [{ type: core_1.Input },], 'selectByClick': [{ type: core_1.Input },], 'selectedExpr': [{ type: core_1.Input },], 'selectedItem': [{ type: core_1.Input },], 'selectionByClick': [{ type: core_1.Input },], 'selectionMode': [{ type: core_1.Input },], 'showEvent': [{ type: core_1.Input },], 'showSubmenuMode': [{ type: core_1.Input },], 'submenuDirection': [{ type: core_1.Input },], 'tabIndex': [{ type: core_1.Input },], 'target': [{ type: core_1.Input },], 'visible': [{ type: core_1.Input },], 'width': [{ type: core_1.Input },], 'onContentReady': [{ type: core_1.Output },], 'onDisposing': [{ type: core_1.Output },], 'onHidden': [{ type: core_1.Output },], 'onHiding': [{ type: core_1.Output },], 'onInitialized': [{ type: core_1.Output },], 'onItemClick': [{ type: core_1.Output },], 'onItemContextMenu': [{ type: core_1.Output },], 'onItemRendered': [{ type: core_1.Output },], 'onOptionChanged': [{ type: core_1.Output },], 'onPositioning': [{ type: core_1.Output },], 'onSelectionChanged': [{ type: core_1.Output },], 'onShowing': [{ type: core_1.Output },], 'onShown': [{ type: core_1.Output },], 'accessKeyChange': [{ type: core_1.Output },], 'activeStateEnabledChange': [{ type: core_1.Output },], 'animationChange': [{ type: core_1.Output },], 'closeOnOutsideClickChange': [{ type: core_1.Output },], 'cssClassChange': [{ type: core_1.Output },], 'dataSourceChange': [{ type: core_1.Output },], 'disabledChange': [{ type: core_1.Output },], 'disabledExprChange': [{ type: core_1.Output },], 'displayExprChange': [{ type: core_1.Output },], 'elementAttrChange': [{ type: core_1.Output },], 'focusStateEnabledChange': [{ type: core_1.Output },], 'heightChange': [{ type: core_1.Output },], 'hintChange': [{ type: core_1.Output },], 'hoverStateEnabledChange': [{ type: core_1.Output },], 'itemsChange': [{ type: core_1.Output },], 'itemsExprChange': [{ type: core_1.Output },], 'itemTemplateChange': [{ type: core_1.Output },], 'positionChange': [{ type: core_1.Output },], 'rtlEnabledChange': [{ type: core_1.Output },], 'selectByClickChange': [{ type: core_1.Output },], 'selectedExprChange': [{ type: core_1.Output },], 'selectedItemChange': [{ type: core_1.Output },], 'selectionByClickChange': [{ type: core_1.Output },], 'selectionModeChange': [{ type: core_1.Output },], 'showEventChange': [{ type: core_1.Output },], 'showSubmenuModeChange': [{ type: core_1.Output },], 'submenuDirectionChange': [{ type: core_1.Output },], 'tabIndexChange': [{ type: core_1.Output },], 'targetChange': [{ type: core_1.Output },], 'visibleChange': [{ type: core_1.Output },], 'widthChange': [{ type: core_1.Output },], 'itemsChildren': [{ type: core_1.ContentChildren, args: [item_dxi_2.DxiItemComponent,] },], }; return DxContextMenuComponent; }(component_1.DxComponent)); exports.DxContextMenuComponent = DxContextMenuComponent; var DxContextMenuModule = (function () { function DxContextMenuModule() { } DxContextMenuModule.decorators = [ { type: core_1.NgModule, args: [{ imports: [ animation_1.DxoAnimationModule, hide_1.DxoHideModule, show_1.DxoShowModule, item_dxi_1.DxiItemModule, position_1.DxoPositionModule, at_1.DxoAtModule, boundary_offset_1.DxoBoundaryOffsetModule, collision_1.DxoCollisionModule, my_1.DxoMyModule, offset_1.DxoOffsetModule, show_event_1.DxoShowEventModule, show_submenu_mode_1.DxoShowSubmenuModeModule, delay_1.DxoDelayModule, template_1.DxTemplateModule ], declarations: [ DxContextMenuComponent ], exports: [ DxContextMenuComponent, animation_1.DxoAnimationModule, hide_1.DxoHideModule, show_1.DxoShowModule, item_dxi_1.DxiItemModule, position_1.DxoPositionModule, at_1.DxoAtModule, boundary_offset_1.DxoBoundaryOffsetModule, collision_1.DxoCollisionModule, my_1.DxoMyModule, offset_1.DxoOffsetModule, show_event_1.DxoShowEventModule, show_submenu_mode_1.DxoShowSubmenuModeModule, delay_1.DxoDelayModule, template_1.DxTemplateModule ], },] }, ]; /** @nocollapse */ DxContextMenuModule.ctorParameters = function () { return []; }; return DxContextMenuModule; }()); exports.DxContextMenuModule = DxContextMenuModule; //# sourceMappingURL=context-menu.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/data-grid.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var data_grid_1 = __webpack_require__("./node_modules/devextreme/ui/data_grid.js"); var component_1 = __webpack_require__("./node_modules/devextreme-angular/core/component.js"); var template_host_1 = __webpack_require__("./node_modules/devextreme-angular/core/template-host.js"); var template_1 = __webpack_require__("./node_modules/devextreme-angular/core/template.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var watcher_helper_1 = __webpack_require__("./node_modules/devextreme-angular/core/watcher-helper.js"); var iterable_differ_helper_1 = __webpack_require__("./node_modules/devextreme-angular/core/iterable-differ-helper.js"); var column_chooser_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/column-chooser.js"); var column_fixing_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/column-fixing.js"); var texts_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/texts.js"); var column_dxi_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/column-dxi.js"); var header_filter_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/header-filter.js"); var lookup_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/lookup.js"); var format_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/format.js"); var form_item_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/form-item.js"); var label_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/label.js"); var validation_rule_dxi_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/validation-rule-dxi.js"); var editing_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/editing.js"); var form_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/form.js"); var col_count_by_screen_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/col-count-by-screen.js"); var item_dxi_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/item-dxi.js"); var tab_panel_options_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/tab-panel-options.js"); var tab_dxi_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/tab-dxi.js"); var popup_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/popup.js"); var animation_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/animation.js"); var hide_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/hide.js"); var show_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/show.js"); var position_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/position.js"); var at_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/at.js"); var boundary_offset_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/boundary-offset.js"); var collision_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/collision.js"); var my_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/my.js"); var offset_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/offset.js"); var toolbar_item_dxi_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/toolbar-item-dxi.js"); var export_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/export.js"); var filter_row_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/filter-row.js"); var operation_descriptions_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/operation-descriptions.js"); var grouping_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/grouping.js"); var group_panel_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/group-panel.js"); var load_panel_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/load-panel.js"); var master_detail_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/master-detail.js"); var pager_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/pager.js"); var paging_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/paging.js"); var remote_operations_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/remote-operations.js"); var scrolling_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/scrolling.js"); var search_panel_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/search-panel.js"); var selection_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/selection.js"); var sort_by_group_summary_info_dxi_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/sort-by-group-summary-info-dxi.js"); var sorting_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/sorting.js"); var state_storing_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/state-storing.js"); var summary_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/summary.js"); var group_item_dxi_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/group-item-dxi.js"); var value_format_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/value-format.js"); var total_item_dxi_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/total-item-dxi.js"); var column_dxi_2 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/column-dxi.js"); var sort_by_group_summary_info_dxi_2 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/sort-by-group-summary-info-dxi.js"); /** * The DataGrid is a widget that represents data from a local or remote source in the form of a grid. This widget offers such basic features as sorting, grouping, filtering, as well as more advanced capabilities, like state storing, export to Excel, master-detail interface, and many others. */ var DxDataGridComponent = (function (_super) { __extends(DxDataGridComponent, _super); function DxDataGridComponent(elementRef, ngZone, templateHost, _watcherHelper, _idh, optionHost) { var _this = _super.call(this, elementRef, ngZone, templateHost, _watcherHelper) || this; _this._watcherHelper = _watcherHelper; _this._idh = _idh; _this._createEventEmitters([ { subscribe: 'adaptiveDetailRowPreparing', emit: 'onAdaptiveDetailRowPreparing' }, { subscribe: 'cellClick', emit: 'onCellClick' }, { subscribe: 'cellHoverChanged', emit: 'onCellHoverChanged' }, { subscribe: 'cellPrepared', emit: 'onCellPrepared' }, { subscribe: 'contentReady', emit: 'onContentReady' }, { subscribe: 'contextMenuPreparing', emit: 'onContextMenuPreparing' }, { subscribe: 'dataErrorOccurred', emit: 'onDataErrorOccurred' }, { subscribe: 'disposing', emit: 'onDisposing' }, { subscribe: 'editingStart', emit: 'onEditingStart' }, { subscribe: 'editorPrepared', emit: 'onEditorPrepared' }, { subscribe: 'editorPreparing', emit: 'onEditorPreparing' }, { subscribe: 'exported', emit: 'onExported' }, { subscribe: 'exporting', emit: 'onExporting' }, { subscribe: 'fileSaving', emit: 'onFileSaving' }, { subscribe: 'initialized', emit: 'onInitialized' }, { subscribe: 'initNewRow', emit: 'onInitNewRow' }, { subscribe: 'keyDown', emit: 'onKeyDown' }, { subscribe: 'optionChanged', emit: 'onOptionChanged' }, { subscribe: 'rowClick', emit: 'onRowClick' }, { subscribe: 'rowCollapsed', emit: 'onRowCollapsed' }, { subscribe: 'rowCollapsing', emit: 'onRowCollapsing' }, { subscribe: 'rowExpanded', emit: 'onRowExpanded' }, { subscribe: 'rowExpanding', emit: 'onRowExpanding' }, { subscribe: 'rowInserted', emit: 'onRowInserted' }, { subscribe: 'rowInserting', emit: 'onRowInserting' }, { subscribe: 'rowPrepared', emit: 'onRowPrepared' }, { subscribe: 'rowRemoved', emit: 'onRowRemoved' }, { subscribe: 'rowRemoving', emit: 'onRowRemoving' }, { subscribe: 'rowUpdated', emit: 'onRowUpdated' }, { subscribe: 'rowUpdating', emit: 'onRowUpdating' }, { subscribe: 'rowValidating', emit: 'onRowValidating' }, { subscribe: 'selectionChanged', emit: 'onSelectionChanged' }, { subscribe: 'toolbarPreparing', emit: 'onToolbarPreparing' }, { emit: 'accessKeyChange' }, { emit: 'activeStateEnabledChange' }, { emit: 'allowColumnReorderingChange' }, { emit: 'allowColumnResizingChange' }, { emit: 'cacheEnabledChange' }, { emit: 'cellHintEnabledChange' }, { emit: 'columnAutoWidthChange' }, { emit: 'columnChooserChange' }, { emit: 'columnFixingChange' }, { emit: 'columnHidingEnabledChange' }, { emit: 'columnMinWidthChange' }, { emit: 'columnResizingModeChange' }, { emit: 'columnsChange' }, { emit: 'customizeColumnsChange' }, { emit: 'customizeExportDataChange' }, { emit: 'dataSourceChange' }, { emit: 'dateSerializationFormatChange' }, { emit: 'disabledChange' }, { emit: 'editingChange' }, { emit: 'elementAttrChange' }, { emit: 'errorRowEnabledChange' }, { emit: 'exportChange' }, { emit: 'filterRowChange' }, { emit: 'focusStateEnabledChange' }, { emit: 'groupingChange' }, { emit: 'groupPanelChange' }, { emit: 'headerFilterChange' }, { emit: 'heightChange' }, { emit: 'hintChange' }, { emit: 'hoverStateEnabledChange' }, { emit: 'keyExprChange' }, { emit: 'loadPanelChange' }, { emit: 'masterDetailChange' }, { emit: 'noDataTextChange' }, { emit: 'pagerChange' }, { emit: 'pagingChange' }, { emit: 'remoteOperationsChange' }, { emit: 'rowAlternationEnabledChange' }, { emit: 'rowTemplateChange' }, { emit: 'rtlEnabledChange' }, { emit: 'scrollingChange' }, { emit: 'searchPanelChange' }, { emit: 'selectedRowKeysChange' }, { emit: 'selectionChange' }, { emit: 'selectionFilterChange' }, { emit: 'showBordersChange' }, { emit: 'showColumnHeadersChange' }, { emit: 'showColumnLinesChange' }, { emit: 'showRowLinesChange' }, { emit: 'sortByGroupSummaryInfoChange' }, { emit: 'sortingChange' }, { emit: 'stateStoringChange' }, { emit: 'summaryChange' }, { emit: 'tabIndexChange' }, { emit: 'twoWayBindingEnabledChange' }, { emit: 'visibleChange' }, { emit: 'widthChange' }, { emit: 'wordWrapEnabledChange' } ]); _this._idh.setHost(_this); optionHost.setHost(_this); return _this; } Object.defineProperty(DxDataGridComponent.prototype, "accessKey", { /** * Specifies the shortcut key that sets focus on the widget. */ get: function () { return this._getOption('accessKey'); }, set: function (value) { this._setOption('accessKey', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDataGridComponent.prototype, "activeStateEnabled", { /** * Specifies whether or not the widget changes its state when interacting with a user. */ get: function () { return this._getOption('activeStateEnabled'); }, set: function (value) { this._setOption('activeStateEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDataGridComponent.prototype, "allowColumnReordering", { /** * Specifies whether a user can reorder columns. */ get: function () { return this._getOption('allowColumnReordering'); }, set: function (value) { this._setOption('allowColumnReordering', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDataGridComponent.prototype, "allowColumnResizing", { /** * Specifies whether a user can resize columns. */ get: function () { return this._getOption('allowColumnResizing'); }, set: function (value) { this._setOption('allowColumnResizing', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDataGridComponent.prototype, "cacheEnabled", { /** * Specifies whether data should be cached. */ get: function () { return this._getOption('cacheEnabled'); }, set: function (value) { this._setOption('cacheEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDataGridComponent.prototype, "cellHintEnabled", { /** * Enables a hint that appears when a user hovers the mouse pointer over a cell with truncated content. */ get: function () { return this._getOption('cellHintEnabled'); }, set: function (value) { this._setOption('cellHintEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDataGridComponent.prototype, "columnAutoWidth", { /** * Specifies whether columns should adjust their widths to the content. */ get: function () { return this._getOption('columnAutoWidth'); }, set: function (value) { this._setOption('columnAutoWidth', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDataGridComponent.prototype, "columnChooser", { /** * Configures the column chooser. */ get: function () { return this._getOption('columnChooser'); }, set: function (value) { this._setOption('columnChooser', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDataGridComponent.prototype, "columnFixing", { /** * Configures column fixing. */ get: function () { return this._getOption('columnFixing'); }, set: function (value) { this._setOption('columnFixing', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDataGridComponent.prototype, "columnHidingEnabled", { /** * Specifies whether the widget should hide columns to adapt to the screen or container size. Ignored if allowColumnResizing is true and columnResizingMode is "widget". */ get: function () { return this._getOption('columnHidingEnabled'); }, set: function (value) { this._setOption('columnHidingEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDataGridComponent.prototype, "columnMinWidth", { /** * Specifies the minimum width of columns. */ get: function () { return this._getOption('columnMinWidth'); }, set: function (value) { this._setOption('columnMinWidth', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDataGridComponent.prototype, "columnResizingMode", { /** * Specifies how the widget resizes columns. Applies only if allowColumnResizing is true. */ get: function () { return this._getOption('columnResizingMode'); }, set: function (value) { this._setOption('columnResizingMode', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDataGridComponent.prototype, "columns", { /** * An array of grid columns. */ get: function () { return this._getOption('columns'); }, set: function (value) { this._setOption('columns', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDataGridComponent.prototype, "customizeColumns", { /** * Specifies a function that customizes grid columns after they are created. */ get: function () { return this._getOption('customizeColumns'); }, set: function (value) { this._setOption('customizeColumns', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDataGridComponent.prototype, "customizeExportData", { /** * Customizes grid columns and data before exporting. */ get: function () { return this._getOption('customizeExportData'); }, set: function (value) { this._setOption('customizeExportData', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDataGridComponent.prototype, "dataSource", { /** * Specifies the origin of data for the widget. */ get: function () { return this._getOption('dataSource'); }, set: function (value) { this._setOption('dataSource', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDataGridComponent.prototype, "dateSerializationFormat", { /** * Specifies date-time values' serialization format. Use it only if you do not specify the dataSource at design time. */ get: function () { return this._getOption('dateSerializationFormat'); }, set: function (value) { this._setOption('dateSerializationFormat', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDataGridComponent.prototype, "disabled", { /** * Specifies whether the widget responds to user interaction. */ get: function () { return this._getOption('disabled'); }, set: function (value) { this._setOption('disabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDataGridComponent.prototype, "editing", { /** * Configures editing. */ get: function () { return this._getOption('editing'); }, set: function (value) { this._setOption('editing', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDataGridComponent.prototype, "elementAttr", { /** * Specifies the attributes to be attached to the widget's root element. */ get: function () { return this._getOption('elementAttr'); }, set: function (value) { this._setOption('elementAttr', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDataGridComponent.prototype, "errorRowEnabled", { /** * Indicates whether to show the error row. */ get: function () { return this._getOption('errorRowEnabled'); }, set: function (value) { this._setOption('errorRowEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDataGridComponent.prototype, "export", { /** * Configures client-side exporting. */ get: function () { return this._getOption('export'); }, set: function (value) { this._setOption('export', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDataGridComponent.prototype, "filterRow", { /** * Configures the filter row. */ get: function () { return this._getOption('filterRow'); }, set: function (value) { this._setOption('filterRow', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDataGridComponent.prototype, "focusStateEnabled", { /** * Specifies whether the widget can be focused using keyboard navigation. */ get: function () { return this._getOption('focusStateEnabled'); }, set: function (value) { this._setOption('focusStateEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDataGridComponent.prototype, "grouping", { /** * Configures grouping. */ get: function () { return this._getOption('grouping'); }, set: function (value) { this._setOption('grouping', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDataGridComponent.prototype, "groupPanel", { /** * Configures the group panel. */ get: function () { return this._getOption('groupPanel'); }, set: function (value) { this._setOption('groupPanel', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDataGridComponent.prototype, "headerFilter", { /** * Configures the header filter feature. */ get: function () { return this._getOption('headerFilter'); }, set: function (value) { this._setOption('headerFilter', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDataGridComponent.prototype, "height", { /** * Specifies the widget's height. */ get: function () { return this._getOption('height'); }, set: function (value) { this._setOption('height', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDataGridComponent.prototype, "hint", { /** * Specifies text for a hint that appears when a user pauses on the widget. */ get: function () { return this._getOption('hint'); }, set: function (value) { this._setOption('hint', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDataGridComponent.prototype, "hoverStateEnabled", { /** * Specifies whether the widget changes its state when a user pauses on it. */ get: function () { return this._getOption('hoverStateEnabled'); }, set: function (value) { this._setOption('hoverStateEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDataGridComponent.prototype, "keyExpr", { /** * Specifies which data field provides data items' keys. Applies only if data is a JavaScript array. */ get: function () { return this._getOption('keyExpr'); }, set: function (value) { this._setOption('keyExpr', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDataGridComponent.prototype, "loadPanel", { /** * Configures the load panel. */ get: function () { return this._getOption('loadPanel'); }, set: function (value) { this._setOption('loadPanel', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDataGridComponent.prototype, "masterDetail", { /** * Allows you to build a master-detail interface in the grid. */ get: function () { return this._getOption('masterDetail'); }, set: function (value) { this._setOption('masterDetail', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDataGridComponent.prototype, "noDataText", { /** * Specifies text shown when the widget does not display any data. */ get: function () { return this._getOption('noDataText'); }, set: function (value) { this._setOption('noDataText', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDataGridComponent.prototype, "pager", { /** * Specifies the options of a grid pager. */ get: function () { return this._getOption('pager'); }, set: function (value) { this._setOption('pager', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDataGridComponent.prototype, "paging", { /** * Specifies paging options. */ get: function () { return this._getOption('paging'); }, set: function (value) { this._setOption('paging', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDataGridComponent.prototype, "remoteOperations", { /** * Specifies the operations that must be performed on the server side. */ get: function () { return this._getOption('remoteOperations'); }, set: function (value) { this._setOption('remoteOperations', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDataGridComponent.prototype, "rowAlternationEnabled", { /** * Specifies whether rows should be shaded differently. */ get: function () { return this._getOption('rowAlternationEnabled'); }, set: function (value) { this._setOption('rowAlternationEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDataGridComponent.prototype, "rowTemplate", { /** * Specifies a custom template for rows. */ get: function () { return this._getOption('rowTemplate'); }, set: function (value) { this._setOption('rowTemplate', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDataGridComponent.prototype, "rtlEnabled", { /** * Switches the widget to a right-to-left representation. */ get: function () { return this._getOption('rtlEnabled'); }, set: function (value) { this._setOption('rtlEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDataGridComponent.prototype, "scrolling", { /** * Configures scrolling. */ get: function () { return this._getOption('scrolling'); }, set: function (value) { this._setOption('scrolling', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDataGridComponent.prototype, "searchPanel", { /** * Configures the search panel. */ get: function () { return this._getOption('searchPanel'); }, set: function (value) { this._setOption('searchPanel', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDataGridComponent.prototype, "selectedRowKeys", { /** * Allows you to select rows or learn which rows are selected. */ get: function () { return this._getOption('selectedRowKeys'); }, set: function (value) { this._setOption('selectedRowKeys', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDataGridComponent.prototype, "selection", { /** * Configures runtime selection. */ get: function () { return this._getOption('selection'); }, set: function (value) { this._setOption('selection', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDataGridComponent.prototype, "selectionFilter", { /** * Specifies filters for the rows that must be selected initially. Applies only if selection.deferred is true. */ get: function () { return this._getOption('selectionFilter'); }, set: function (value) { this._setOption('selectionFilter', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDataGridComponent.prototype, "showBorders", { /** * Specifies whether the outer borders of the widget are visible. */ get: function () { return this._getOption('showBorders'); }, set: function (value) { this._setOption('showBorders', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDataGridComponent.prototype, "showColumnHeaders", { /** * Specifies whether column headers are visible. */ get: function () { return this._getOption('showColumnHeaders'); }, set: function (value) { this._setOption('showColumnHeaders', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDataGridComponent.prototype, "showColumnLines", { /** * Specifies whether vertical lines that separate one column from another are visible. */ get: function () { return this._getOption('showColumnLines'); }, set: function (value) { this._setOption('showColumnLines', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDataGridComponent.prototype, "showRowLines", { /** * Specifies whether horizontal lines that separate one row from another are visible. */ get: function () { return this._getOption('showRowLines'); }, set: function (value) { this._setOption('showRowLines', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDataGridComponent.prototype, "sortByGroupSummaryInfo", { /** * Allows you to sort groups according to the values of group summary items. */ get: function () { return this._getOption('sortByGroupSummaryInfo'); }, set: function (value) { this._setOption('sortByGroupSummaryInfo', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDataGridComponent.prototype, "sorting", { /** * Configures runtime sorting. */ get: function () { return this._getOption('sorting'); }, set: function (value) { this._setOption('sorting', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDataGridComponent.prototype, "stateStoring", { /** * Configures state storing. */ get: function () { return this._getOption('stateStoring'); }, set: function (value) { this._setOption('stateStoring', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDataGridComponent.prototype, "summary", { /** * Specifies the options of the grid summary. */ get: function () { return this._getOption('summary'); }, set: function (value) { this._setOption('summary', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDataGridComponent.prototype, "tabIndex", { /** * Specifies the number of the element when the Tab key is used for navigating. */ get: function () { return this._getOption('tabIndex'); }, set: function (value) { this._setOption('tabIndex', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDataGridComponent.prototype, "twoWayBindingEnabled", { /** * Specifies whether to enable two-way data binding. */ get: function () { return this._getOption('twoWayBindingEnabled'); }, set: function (value) { this._setOption('twoWayBindingEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDataGridComponent.prototype, "visible", { /** * Specifies whether the widget is visible. */ get: function () { return this._getOption('visible'); }, set: function (value) { this._setOption('visible', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDataGridComponent.prototype, "width", { /** * Specifies the widget's width. */ get: function () { return this._getOption('width'); }, set: function (value) { this._setOption('width', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDataGridComponent.prototype, "wordWrapEnabled", { /** * Specifies whether text that does not fit into a column should be wrapped. */ get: function () { return this._getOption('wordWrapEnabled'); }, set: function (value) { this._setOption('wordWrapEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDataGridComponent.prototype, "columnsChildren", { get: function () { return this._getOption('columns'); }, set: function (value) { this.setChildren('columns', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDataGridComponent.prototype, "sortByGroupSummaryInfoChildren", { get: function () { return this._getOption('sortByGroupSummaryInfo'); }, set: function (value) { this.setChildren('sortByGroupSummaryInfo', value); }, enumerable: true, configurable: true }); DxDataGridComponent.prototype._createInstance = function (element, options) { return new data_grid_1.default(element, options); }; DxDataGridComponent.prototype.ngOnDestroy = function () { this._destroyWidget(); }; DxDataGridComponent.prototype.ngOnChanges = function (changes) { _super.prototype.ngOnChanges.call(this, changes); this.setupChanges('columns', changes); this.setupChanges('dataSource', changes); this.setupChanges('keyExpr', changes); this.setupChanges('selectedRowKeys', changes); this.setupChanges('sortByGroupSummaryInfo', changes); }; DxDataGridComponent.prototype.setupChanges = function (prop, changes) { if (!(prop in this._optionsToUpdate)) { this._idh.setup(prop, changes); } }; DxDataGridComponent.prototype.ngDoCheck = function () { this._idh.doCheck('columns'); this._idh.doCheck('dataSource'); this._idh.doCheck('keyExpr'); this._idh.doCheck('selectedRowKeys'); this._idh.doCheck('sortByGroupSummaryInfo'); this._watcherHelper.checkWatchers(); _super.prototype.ngDoCheck.call(this); _super.prototype.clearChangedOptions.call(this); }; DxDataGridComponent.prototype._setOption = function (name, value) { var isSetup = this._idh.setupSingle(name, value); var isChanged = this._idh.getChanges(name, value) !== null; if (isSetup || isChanged) { _super.prototype._setOption.call(this, name, value); } }; DxDataGridComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dx-data-grid', template: '', providers: [ template_host_1.DxTemplateHost, watcher_helper_1.WatcherHelper, nested_option_1.NestedOptionHost, iterable_differ_helper_1.IterableDifferHelper ] },] }, ]; /** @nocollapse */ DxDataGridComponent.ctorParameters = function () { return [ { type: core_1.ElementRef, }, { type: core_1.NgZone, }, { type: template_host_1.DxTemplateHost, }, { type: watcher_helper_1.WatcherHelper, }, { type: iterable_differ_helper_1.IterableDifferHelper, }, { type: nested_option_1.NestedOptionHost, }, ]; }; DxDataGridComponent.propDecorators = { 'accessKey': [{ type: core_1.Input },], 'activeStateEnabled': [{ type: core_1.Input },], 'allowColumnReordering': [{ type: core_1.Input },], 'allowColumnResizing': [{ type: core_1.Input },], 'cacheEnabled': [{ type: core_1.Input },], 'cellHintEnabled': [{ type: core_1.Input },], 'columnAutoWidth': [{ type: core_1.Input },], 'columnChooser': [{ type: core_1.Input },], 'columnFixing': [{ type: core_1.Input },], 'columnHidingEnabled': [{ type: core_1.Input },], 'columnMinWidth': [{ type: core_1.Input },], 'columnResizingMode': [{ type: core_1.Input },], 'columns': [{ type: core_1.Input },], 'customizeColumns': [{ type: core_1.Input },], 'customizeExportData': [{ type: core_1.Input },], 'dataSource': [{ type: core_1.Input },], 'dateSerializationFormat': [{ type: core_1.Input },], 'disabled': [{ type: core_1.Input },], 'editing': [{ type: core_1.Input },], 'elementAttr': [{ type: core_1.Input },], 'errorRowEnabled': [{ type: core_1.Input },], 'export': [{ type: core_1.Input },], 'filterRow': [{ type: core_1.Input },], 'focusStateEnabled': [{ type: core_1.Input },], 'grouping': [{ type: core_1.Input },], 'groupPanel': [{ type: core_1.Input },], 'headerFilter': [{ type: core_1.Input },], 'height': [{ type: core_1.Input },], 'hint': [{ type: core_1.Input },], 'hoverStateEnabled': [{ type: core_1.Input },], 'keyExpr': [{ type: core_1.Input },], 'loadPanel': [{ type: core_1.Input },], 'masterDetail': [{ type: core_1.Input },], 'noDataText': [{ type: core_1.Input },], 'pager': [{ type: core_1.Input },], 'paging': [{ type: core_1.Input },], 'remoteOperations': [{ type: core_1.Input },], 'rowAlternationEnabled': [{ type: core_1.Input },], 'rowTemplate': [{ type: core_1.Input },], 'rtlEnabled': [{ type: core_1.Input },], 'scrolling': [{ type: core_1.Input },], 'searchPanel': [{ type: core_1.Input },], 'selectedRowKeys': [{ type: core_1.Input },], 'selection': [{ type: core_1.Input },], 'selectionFilter': [{ type: core_1.Input },], 'showBorders': [{ type: core_1.Input },], 'showColumnHeaders': [{ type: core_1.Input },], 'showColumnLines': [{ type: core_1.Input },], 'showRowLines': [{ type: core_1.Input },], 'sortByGroupSummaryInfo': [{ type: core_1.Input },], 'sorting': [{ type: core_1.Input },], 'stateStoring': [{ type: core_1.Input },], 'summary': [{ type: core_1.Input },], 'tabIndex': [{ type: core_1.Input },], 'twoWayBindingEnabled': [{ type: core_1.Input },], 'visible': [{ type: core_1.Input },], 'width': [{ type: core_1.Input },], 'wordWrapEnabled': [{ type: core_1.Input },], 'onAdaptiveDetailRowPreparing': [{ type: core_1.Output },], 'onCellClick': [{ type: core_1.Output },], 'onCellHoverChanged': [{ type: core_1.Output },], 'onCellPrepared': [{ type: core_1.Output },], 'onContentReady': [{ type: core_1.Output },], 'onContextMenuPreparing': [{ type: core_1.Output },], 'onDataErrorOccurred': [{ type: core_1.Output },], 'onDisposing': [{ type: core_1.Output },], 'onEditingStart': [{ type: core_1.Output },], 'onEditorPrepared': [{ type: core_1.Output },], 'onEditorPreparing': [{ type: core_1.Output },], 'onExported': [{ type: core_1.Output },], 'onExporting': [{ type: core_1.Output },], 'onFileSaving': [{ type: core_1.Output },], 'onInitialized': [{ type: core_1.Output },], 'onInitNewRow': [{ type: core_1.Output },], 'onKeyDown': [{ type: core_1.Output },], 'onOptionChanged': [{ type: core_1.Output },], 'onRowClick': [{ type: core_1.Output },], 'onRowCollapsed': [{ type: core_1.Output },], 'onRowCollapsing': [{ type: core_1.Output },], 'onRowExpanded': [{ type: core_1.Output },], 'onRowExpanding': [{ type: core_1.Output },], 'onRowInserted': [{ type: core_1.Output },], 'onRowInserting': [{ type: core_1.Output },], 'onRowPrepared': [{ type: core_1.Output },], 'onRowRemoved': [{ type: core_1.Output },], 'onRowRemoving': [{ type: core_1.Output },], 'onRowUpdated': [{ type: core_1.Output },], 'onRowUpdating': [{ type: core_1.Output },], 'onRowValidating': [{ type: core_1.Output },], 'onSelectionChanged': [{ type: core_1.Output },], 'onToolbarPreparing': [{ type: core_1.Output },], 'accessKeyChange': [{ type: core_1.Output },], 'activeStateEnabledChange': [{ type: core_1.Output },], 'allowColumnReorderingChange': [{ type: core_1.Output },], 'allowColumnResizingChange': [{ type: core_1.Output },], 'cacheEnabledChange': [{ type: core_1.Output },], 'cellHintEnabledChange': [{ type: core_1.Output },], 'columnAutoWidthChange': [{ type: core_1.Output },], 'columnChooserChange': [{ type: core_1.Output },], 'columnFixingChange': [{ type: core_1.Output },], 'columnHidingEnabledChange': [{ type: core_1.Output },], 'columnMinWidthChange': [{ type: core_1.Output },], 'columnResizingModeChange': [{ type: core_1.Output },], 'columnsChange': [{ type: core_1.Output },], 'customizeColumnsChange': [{ type: core_1.Output },], 'customizeExportDataChange': [{ type: core_1.Output },], 'dataSourceChange': [{ type: core_1.Output },], 'dateSerializationFormatChange': [{ type: core_1.Output },], 'disabledChange': [{ type: core_1.Output },], 'editingChange': [{ type: core_1.Output },], 'elementAttrChange': [{ type: core_1.Output },], 'errorRowEnabledChange': [{ type: core_1.Output },], 'exportChange': [{ type: core_1.Output },], 'filterRowChange': [{ type: core_1.Output },], 'focusStateEnabledChange': [{ type: core_1.Output },], 'groupingChange': [{ type: core_1.Output },], 'groupPanelChange': [{ type: core_1.Output },], 'headerFilterChange': [{ type: core_1.Output },], 'heightChange': [{ type: core_1.Output },], 'hintChange': [{ type: core_1.Output },], 'hoverStateEnabledChange': [{ type: core_1.Output },], 'keyExprChange': [{ type: core_1.Output },], 'loadPanelChange': [{ type: core_1.Output },], 'masterDetailChange': [{ type: core_1.Output },], 'noDataTextChange': [{ type: core_1.Output },], 'pagerChange': [{ type: core_1.Output },], 'pagingChange': [{ type: core_1.Output },], 'remoteOperationsChange': [{ type: core_1.Output },], 'rowAlternationEnabledChange': [{ type: core_1.Output },], 'rowTemplateChange': [{ type: core_1.Output },], 'rtlEnabledChange': [{ type: core_1.Output },], 'scrollingChange': [{ type: core_1.Output },], 'searchPanelChange': [{ type: core_1.Output },], 'selectedRowKeysChange': [{ type: core_1.Output },], 'selectionChange': [{ type: core_1.Output },], 'selectionFilterChange': [{ type: core_1.Output },], 'showBordersChange': [{ type: core_1.Output },], 'showColumnHeadersChange': [{ type: core_1.Output },], 'showColumnLinesChange': [{ type: core_1.Output },], 'showRowLinesChange': [{ type: core_1.Output },], 'sortByGroupSummaryInfoChange': [{ type: core_1.Output },], 'sortingChange': [{ type: core_1.Output },], 'stateStoringChange': [{ type: core_1.Output },], 'summaryChange': [{ type: core_1.Output },], 'tabIndexChange': [{ type: core_1.Output },], 'twoWayBindingEnabledChange': [{ type: core_1.Output },], 'visibleChange': [{ type: core_1.Output },], 'widthChange': [{ type: core_1.Output },], 'wordWrapEnabledChange': [{ type: core_1.Output },], 'columnsChildren': [{ type: core_1.ContentChildren, args: [column_dxi_2.DxiColumnComponent,] },], 'sortByGroupSummaryInfoChildren': [{ type: core_1.ContentChildren, args: [sort_by_group_summary_info_dxi_2.DxiSortByGroupSummaryInfoComponent,] },], }; return DxDataGridComponent; }(component_1.DxComponent)); exports.DxDataGridComponent = DxDataGridComponent; var DxDataGridModule = (function () { function DxDataGridModule() { } DxDataGridModule.decorators = [ { type: core_1.NgModule, args: [{ imports: [ column_chooser_1.DxoColumnChooserModule, column_fixing_1.DxoColumnFixingModule, texts_1.DxoTextsModule, column_dxi_1.DxiColumnModule, header_filter_1.DxoHeaderFilterModule, lookup_1.DxoLookupModule, format_1.DxoFormatModule, form_item_1.DxoFormItemModule, label_1.DxoLabelModule, validation_rule_dxi_1.DxiValidationRuleModule, editing_1.DxoEditingModule, form_1.DxoFormModule, col_count_by_screen_1.DxoColCountByScreenModule, item_dxi_1.DxiItemModule, tab_panel_options_1.DxoTabPanelOptionsModule, tab_dxi_1.DxiTabModule, popup_1.DxoPopupModule, animation_1.DxoAnimationModule, hide_1.DxoHideModule, show_1.DxoShowModule, position_1.DxoPositionModule, at_1.DxoAtModule, boundary_offset_1.DxoBoundaryOffsetModule, collision_1.DxoCollisionModule, my_1.DxoMyModule, offset_1.DxoOffsetModule, toolbar_item_dxi_1.DxiToolbarItemModule, export_1.DxoExportModule, filter_row_1.DxoFilterRowModule, operation_descriptions_1.DxoOperationDescriptionsModule, grouping_1.DxoGroupingModule, group_panel_1.DxoGroupPanelModule, load_panel_1.DxoLoadPanelModule, master_detail_1.DxoMasterDetailModule, pager_1.DxoPagerModule, paging_1.DxoPagingModule, remote_operations_1.DxoRemoteOperationsModule, scrolling_1.DxoScrollingModule, search_panel_1.DxoSearchPanelModule, selection_1.DxoSelectionModule, sort_by_group_summary_info_dxi_1.DxiSortByGroupSummaryInfoModule, sorting_1.DxoSortingModule, state_storing_1.DxoStateStoringModule, summary_1.DxoSummaryModule, group_item_dxi_1.DxiGroupItemModule, value_format_1.DxoValueFormatModule, total_item_dxi_1.DxiTotalItemModule, template_1.DxTemplateModule ], declarations: [ DxDataGridComponent ], exports: [ DxDataGridComponent, column_chooser_1.DxoColumnChooserModule, column_fixing_1.DxoColumnFixingModule, texts_1.DxoTextsModule, column_dxi_1.DxiColumnModule, header_filter_1.DxoHeaderFilterModule, lookup_1.DxoLookupModule, format_1.DxoFormatModule, form_item_1.DxoFormItemModule, label_1.DxoLabelModule, validation_rule_dxi_1.DxiValidationRuleModule, editing_1.DxoEditingModule, form_1.DxoFormModule, col_count_by_screen_1.DxoColCountByScreenModule, item_dxi_1.DxiItemModule, tab_panel_options_1.DxoTabPanelOptionsModule, tab_dxi_1.DxiTabModule, popup_1.DxoPopupModule, animation_1.DxoAnimationModule, hide_1.DxoHideModule, show_1.DxoShowModule, position_1.DxoPositionModule, at_1.DxoAtModule, boundary_offset_1.DxoBoundaryOffsetModule, collision_1.DxoCollisionModule, my_1.DxoMyModule, offset_1.DxoOffsetModule, toolbar_item_dxi_1.DxiToolbarItemModule, export_1.DxoExportModule, filter_row_1.DxoFilterRowModule, operation_descriptions_1.DxoOperationDescriptionsModule, grouping_1.DxoGroupingModule, group_panel_1.DxoGroupPanelModule, load_panel_1.DxoLoadPanelModule, master_detail_1.DxoMasterDetailModule, pager_1.DxoPagerModule, paging_1.DxoPagingModule, remote_operations_1.DxoRemoteOperationsModule, scrolling_1.DxoScrollingModule, search_panel_1.DxoSearchPanelModule, selection_1.DxoSelectionModule, sort_by_group_summary_info_dxi_1.DxiSortByGroupSummaryInfoModule, sorting_1.DxoSortingModule, state_storing_1.DxoStateStoringModule, summary_1.DxoSummaryModule, group_item_dxi_1.DxiGroupItemModule, value_format_1.DxoValueFormatModule, total_item_dxi_1.DxiTotalItemModule, template_1.DxTemplateModule ], },] }, ]; /** @nocollapse */ DxDataGridModule.ctorParameters = function () { return []; }; return DxDataGridModule; }()); exports.DxDataGridModule = DxDataGridModule; //# sourceMappingURL=data-grid.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/date-box.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var date_box_1 = __webpack_require__("./node_modules/devextreme/ui/date_box.js"); var validator_1 = __webpack_require__("./node_modules/devextreme-angular/ui/validator.js"); var forms_1 = __webpack_require__("./node_modules/@angular/forms/esm2015/forms.js"); var component_1 = __webpack_require__("./node_modules/devextreme-angular/core/component.js"); var template_host_1 = __webpack_require__("./node_modules/devextreme-angular/core/template-host.js"); var template_1 = __webpack_require__("./node_modules/devextreme-angular/core/template.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var watcher_helper_1 = __webpack_require__("./node_modules/devextreme-angular/core/watcher-helper.js"); var iterable_differ_helper_1 = __webpack_require__("./node_modules/devextreme-angular/core/iterable-differ-helper.js"); var display_format_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/display-format.js"); var CUSTOM_VALUE_ACCESSOR_PROVIDER = { provide: forms_1.NG_VALUE_ACCESSOR, useExisting: core_1.forwardRef(function () { return DxDateBoxComponent; }), multi: true }; /** * The DateBox is a widget that displays date and time in a specified format, and enables a user to pick or type in the required date/time value. */ var DxDateBoxComponent = (function (_super) { __extends(DxDateBoxComponent, _super); function DxDateBoxComponent(elementRef, ngZone, templateHost, _watcherHelper, _idh, optionHost) { var _this = _super.call(this, elementRef, ngZone, templateHost, _watcherHelper) || this; _this._watcherHelper = _watcherHelper; _this._idh = _idh; _this.touched = function (_) { }; _this._createEventEmitters([ { subscribe: 'change', emit: 'onChange' }, { subscribe: 'closed', emit: 'onClosed' }, { subscribe: 'contentReady', emit: 'onContentReady' }, { subscribe: 'copy', emit: 'onCopy' }, { subscribe: 'cut', emit: 'onCut' }, { subscribe: 'disposing', emit: 'onDisposing' }, { subscribe: 'enterKey', emit: 'onEnterKey' }, { subscribe: 'focusIn', emit: 'onFocusIn' }, { subscribe: 'focusOut', emit: 'onFocusOut' }, { subscribe: 'initialized', emit: 'onInitialized' }, { subscribe: 'input', emit: 'onInput' }, { subscribe: 'keyDown', emit: 'onKeyDown' }, { subscribe: 'keyPress', emit: 'onKeyPress' }, { subscribe: 'keyUp', emit: 'onKeyUp' }, { subscribe: 'opened', emit: 'onOpened' }, { subscribe: 'optionChanged', emit: 'onOptionChanged' }, { subscribe: 'paste', emit: 'onPaste' }, { subscribe: 'valueChanged', emit: 'onValueChanged' }, { emit: 'acceptCustomValueChange' }, { emit: 'accessKeyChange' }, { emit: 'activeStateEnabledChange' }, { emit: 'adaptivityEnabledChange' }, { emit: 'applyButtonTextChange' }, { emit: 'applyValueModeChange' }, { emit: 'attrChange' }, { emit: 'cancelButtonTextChange' }, { emit: 'dateOutOfRangeMessageChange' }, { emit: 'dateSerializationFormatChange' }, { emit: 'deferRenderingChange' }, { emit: 'disabledChange' }, { emit: 'disabledDatesChange' }, { emit: 'displayFormatChange' }, { emit: 'dropDownButtonTemplateChange' }, { emit: 'elementAttrChange' }, { emit: 'fieldEditEnabledChange' }, { emit: 'focusStateEnabledChange' }, { emit: 'formatChange' }, { emit: 'formatStringChange' }, { emit: 'heightChange' }, { emit: 'hintChange' }, { emit: 'hoverStateEnabledChange' }, { emit: 'inputAttrChange' }, { emit: 'intervalChange' }, { emit: 'invalidDateMessageChange' }, { emit: 'isValidChange' }, { emit: 'maxChange' }, { emit: 'maxLengthChange' }, { emit: 'maxZoomLevelChange' }, { emit: 'minChange' }, { emit: 'minZoomLevelChange' }, { emit: 'nameChange' }, { emit: 'openedChange' }, { emit: 'pickerTypeChange' }, { emit: 'placeholderChange' }, { emit: 'readOnlyChange' }, { emit: 'rtlEnabledChange' }, { emit: 'showClearButtonChange' }, { emit: 'spellcheckChange' }, { emit: 'tabIndexChange' }, { emit: 'textChange' }, { emit: 'typeChange' }, { emit: 'useCalendarChange' }, { emit: 'useNativeChange' }, { emit: 'validationErrorChange' }, { emit: 'validationMessageModeChange' }, { emit: 'valueChange' }, { emit: 'valueChangeEventChange' }, { emit: 'visibleChange' }, { emit: 'widthChange' }, { emit: 'onBlur' } ]); _this._idh.setHost(_this); optionHost.setHost(_this); return _this; } Object.defineProperty(DxDateBoxComponent.prototype, "acceptCustomValue", { /** * Specifies whether or not the widget allows an end-user to enter a custom value. */ get: function () { return this._getOption('acceptCustomValue'); }, set: function (value) { this._setOption('acceptCustomValue', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDateBoxComponent.prototype, "accessKey", { /** * Specifies the shortcut key that sets focus on the widget. */ get: function () { return this._getOption('accessKey'); }, set: function (value) { this._setOption('accessKey', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDateBoxComponent.prototype, "activeStateEnabled", { /** * Specifies whether or not the widget changes its state when interacting with a user. */ get: function () { return this._getOption('activeStateEnabled'); }, set: function (value) { this._setOption('activeStateEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDateBoxComponent.prototype, "adaptivityEnabled", { /** * Specifies whether or not adaptive widget rendering is enabled on a small screen. */ get: function () { return this._getOption('adaptivityEnabled'); }, set: function (value) { this._setOption('adaptivityEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDateBoxComponent.prototype, "applyButtonText", { /** * The text displayed on the Apply button. */ get: function () { return this._getOption('applyButtonText'); }, set: function (value) { this._setOption('applyButtonText', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDateBoxComponent.prototype, "applyValueMode", { /** * Specifies the way an end-user applies the selected value. */ get: function () { return this._getOption('applyValueMode'); }, set: function (value) { this._setOption('applyValueMode', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDateBoxComponent.prototype, "attr", { /** * Use the inputAttr option instead. */ get: function () { return this._getOption('attr'); }, set: function (value) { this._setOption('attr', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDateBoxComponent.prototype, "cancelButtonText", { /** * The text displayed on the Cancel button. */ get: function () { return this._getOption('cancelButtonText'); }, set: function (value) { this._setOption('cancelButtonText', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDateBoxComponent.prototype, "dateOutOfRangeMessage", { /** * Specifies the message displayed if the specified date is later than the max value or earlier than the min value. */ get: function () { return this._getOption('dateOutOfRangeMessage'); }, set: function (value) { this._setOption('dateOutOfRangeMessage', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDateBoxComponent.prototype, "dateSerializationFormat", { /** * Specifies the date-time value serialization format. Use it only if you do not specify the value at design time. */ get: function () { return this._getOption('dateSerializationFormat'); }, set: function (value) { this._setOption('dateSerializationFormat', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDateBoxComponent.prototype, "deferRendering", { /** * Specifies whether widget content is rendered when the widget is shown or when rendering the widget. */ get: function () { return this._getOption('deferRendering'); }, set: function (value) { this._setOption('deferRendering', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDateBoxComponent.prototype, "disabled", { /** * Specifies whether the widget responds to user interaction. */ get: function () { return this._getOption('disabled'); }, set: function (value) { this._setOption('disabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDateBoxComponent.prototype, "disabledDates", { /** * Specifies dates to be disabled. Applies only if pickerType is "calendar". */ get: function () { return this._getOption('disabledDates'); }, set: function (value) { this._setOption('disabledDates', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDateBoxComponent.prototype, "displayFormat", { /** * Specifies the date display format. Ignored if the pickerType option is 'native' */ get: function () { return this._getOption('displayFormat'); }, set: function (value) { this._setOption('displayFormat', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDateBoxComponent.prototype, "dropDownButtonTemplate", { /** * Specifies a custom template for the drop-down button. */ get: function () { return this._getOption('dropDownButtonTemplate'); }, set: function (value) { this._setOption('dropDownButtonTemplate', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDateBoxComponent.prototype, "elementAttr", { /** * Specifies the attributes to be attached to the widget's root element. */ get: function () { return this._getOption('elementAttr'); }, set: function (value) { this._setOption('elementAttr', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDateBoxComponent.prototype, "fieldEditEnabled", { /** * Use the acceptCustomValue option instead. */ get: function () { return this._getOption('fieldEditEnabled'); }, set: function (value) { this._setOption('fieldEditEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDateBoxComponent.prototype, "focusStateEnabled", { /** * Specifies whether the widget can be focused using keyboard navigation. */ get: function () { return this._getOption('focusStateEnabled'); }, set: function (value) { this._setOption('focusStateEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDateBoxComponent.prototype, "format", { /** * Use the type option instead. */ get: function () { return this._getOption('format'); }, set: function (value) { this._setOption('format', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDateBoxComponent.prototype, "formatString", { /** * Use the displayFormat option instead. */ get: function () { return this._getOption('formatString'); }, set: function (value) { this._setOption('formatString', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDateBoxComponent.prototype, "height", { /** * Specifies the widget's height. */ get: function () { return this._getOption('height'); }, set: function (value) { this._setOption('height', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDateBoxComponent.prototype, "hint", { /** * Specifies text for a hint that appears when a user pauses on the widget. */ get: function () { return this._getOption('hint'); }, set: function (value) { this._setOption('hint', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDateBoxComponent.prototype, "hoverStateEnabled", { /** * Specifies whether the widget changes its state when a user pauses on it. */ get: function () { return this._getOption('hoverStateEnabled'); }, set: function (value) { this._setOption('hoverStateEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDateBoxComponent.prototype, "inputAttr", { /** * Specifies the attributes to be passed on to the underlying HTML element. */ get: function () { return this._getOption('inputAttr'); }, set: function (value) { this._setOption('inputAttr', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDateBoxComponent.prototype, "interval", { /** * Specifies the interval between neighboring values in the popup list in minutes. */ get: function () { return this._getOption('interval'); }, set: function (value) { this._setOption('interval', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDateBoxComponent.prototype, "invalidDateMessage", { /** * Specifies the message displayed if the typed value is not a valid date or time. */ get: function () { return this._getOption('invalidDateMessage'); }, set: function (value) { this._setOption('invalidDateMessage', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDateBoxComponent.prototype, "isValid", { /** * Specifies whether the editor's value is valid. */ get: function () { return this._getOption('isValid'); }, set: function (value) { this._setOption('isValid', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDateBoxComponent.prototype, "max", { /** * The last date that can be selected within the widget. */ get: function () { return this._getOption('max'); }, set: function (value) { this._setOption('max', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDateBoxComponent.prototype, "maxLength", { /** * Specifies the maximum number of characters you can enter into the textbox. */ get: function () { return this._getOption('maxLength'); }, set: function (value) { this._setOption('maxLength', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDateBoxComponent.prototype, "maxZoomLevel", { /** * Specifies the maximum zoom level of a calendar, which is used to pick the date. */ get: function () { return this._getOption('maxZoomLevel'); }, set: function (value) { this._setOption('maxZoomLevel', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDateBoxComponent.prototype, "min", { /** * The minimum date that can be selected within the widget. */ get: function () { return this._getOption('min'); }, set: function (value) { this._setOption('min', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDateBoxComponent.prototype, "minZoomLevel", { /** * Specifies the minimal zoom level of a calendar, which is used to pick the date. */ get: function () { return this._getOption('minZoomLevel'); }, set: function (value) { this._setOption('minZoomLevel', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDateBoxComponent.prototype, "name", { /** * The value to be assigned to the `name` attribute of the underlying HTML element. */ get: function () { return this._getOption('name'); }, set: function (value) { this._setOption('name', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDateBoxComponent.prototype, "opened", { /** * Specifies whether or not the drop-down editor is displayed. */ get: function () { return this._getOption('opened'); }, set: function (value) { this._setOption('opened', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDateBoxComponent.prototype, "pickerType", { /** * Specifies the type of the date/time picker. */ get: function () { return this._getOption('pickerType'); }, set: function (value) { this._setOption('pickerType', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDateBoxComponent.prototype, "placeholder", { /** * Specifies a placeholder for the input field. */ get: function () { return this._getOption('placeholder'); }, set: function (value) { this._setOption('placeholder', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDateBoxComponent.prototype, "readOnly", { /** * A Boolean value specifying whether or not the widget is read-only. */ get: function () { return this._getOption('readOnly'); }, set: function (value) { this._setOption('readOnly', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDateBoxComponent.prototype, "rtlEnabled", { /** * Switches the widget to a right-to-left representation. */ get: function () { return this._getOption('rtlEnabled'); }, set: function (value) { this._setOption('rtlEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDateBoxComponent.prototype, "showClearButton", { /** * Specifies whether to display the Clear button in the widget. */ get: function () { return this._getOption('showClearButton'); }, set: function (value) { this._setOption('showClearButton', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDateBoxComponent.prototype, "spellcheck", { /** * Specifies whether or not the widget checks the inner text for spelling mistakes. */ get: function () { return this._getOption('spellcheck'); }, set: function (value) { this._setOption('spellcheck', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDateBoxComponent.prototype, "tabIndex", { /** * Specifies the number of the element when the Tab key is used for navigating. */ get: function () { return this._getOption('tabIndex'); }, set: function (value) { this._setOption('tabIndex', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDateBoxComponent.prototype, "text", { /** * The read-only option that holds the text displayed by the widget input element. */ get: function () { return this._getOption('text'); }, set: function (value) { this._setOption('text', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDateBoxComponent.prototype, "type", { /** * A format used to display date/time information. */ get: function () { return this._getOption('type'); }, set: function (value) { this._setOption('type', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDateBoxComponent.prototype, "useCalendar", { /** * Use the pickerType option instead. */ get: function () { return this._getOption('useCalendar'); }, set: function (value) { this._setOption('useCalendar', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDateBoxComponent.prototype, "useNative", { /** * Use the pickerType option instead. */ get: function () { return this._getOption('useNative'); }, set: function (value) { this._setOption('useNative', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDateBoxComponent.prototype, "validationError", { /** * Specifies information on the validation error when using a custom validation engine. Should be changed at runtime along with the isValid option. */ get: function () { return this._getOption('validationError'); }, set: function (value) { this._setOption('validationError', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDateBoxComponent.prototype, "validationMessageMode", { /** * Specifies how the message about the validation rules that are not satisfied by this editor's value is displayed. */ get: function () { return this._getOption('validationMessageMode'); }, set: function (value) { this._setOption('validationMessageMode', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDateBoxComponent.prototype, "value", { /** * An object or a value specifying the date and time currently selected using the date box. */ get: function () { return this._getOption('value'); }, set: function (value) { this._setOption('value', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDateBoxComponent.prototype, "valueChangeEvent", { /** * Specifies DOM event names that update a widget's value. */ get: function () { return this._getOption('valueChangeEvent'); }, set: function (value) { this._setOption('valueChangeEvent', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDateBoxComponent.prototype, "visible", { /** * Specifies whether the widget is visible. */ get: function () { return this._getOption('visible'); }, set: function (value) { this._setOption('visible', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDateBoxComponent.prototype, "width", { /** * Specifies the widget's width. */ get: function () { return this._getOption('width'); }, set: function (value) { this._setOption('width', value); }, enumerable: true, configurable: true }); DxDateBoxComponent.prototype.change = function (_) { }; DxDateBoxComponent.prototype._createInstance = function (element, options) { var widget = new date_box_1.default(element, options); if (this.validator) { this.validator.createInstance(element); } return widget; }; DxDateBoxComponent.prototype.writeValue = function (value) { this.eventHelper.lockedValueChangeEvent = true; this.value = value; this.eventHelper.lockedValueChangeEvent = false; }; DxDateBoxComponent.prototype.setDisabledState = function (isDisabled) { this.disabled = isDisabled; }; DxDateBoxComponent.prototype.registerOnChange = function (fn) { this.change = fn; }; DxDateBoxComponent.prototype.registerOnTouched = function (fn) { this.touched = fn; }; DxDateBoxComponent.prototype._createWidget = function (element) { var _this = this; _super.prototype._createWidget.call(this, element); this.instance.on('focusOut', function (e) { _this.eventHelper.fireNgEvent('onBlur', [e]); }); }; DxDateBoxComponent.prototype.ngOnDestroy = function () { this._destroyWidget(); }; DxDateBoxComponent.prototype.ngOnChanges = function (changes) { _super.prototype.ngOnChanges.call(this, changes); this.setupChanges('disabledDates', changes); }; DxDateBoxComponent.prototype.setupChanges = function (prop, changes) { if (!(prop in this._optionsToUpdate)) { this._idh.setup(prop, changes); } }; DxDateBoxComponent.prototype.ngDoCheck = function () { this._idh.doCheck('disabledDates'); this._watcherHelper.checkWatchers(); _super.prototype.ngDoCheck.call(this); _super.prototype.clearChangedOptions.call(this); }; DxDateBoxComponent.prototype._setOption = function (name, value) { var isSetup = this._idh.setupSingle(name, value); var isChanged = this._idh.getChanges(name, value) !== null; if (isSetup || isChanged) { _super.prototype._setOption.call(this, name, value); } }; DxDateBoxComponent.prototype.ngAfterContentInit = function () { if (this.validator) { this.validator.renderOnViewInit = false; } }; DxDateBoxComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dx-date-box', template: '', providers: [ template_host_1.DxTemplateHost, watcher_helper_1.WatcherHelper, CUSTOM_VALUE_ACCESSOR_PROVIDER, nested_option_1.NestedOptionHost, iterable_differ_helper_1.IterableDifferHelper ] },] }, ]; /** @nocollapse */ DxDateBoxComponent.ctorParameters = function () { return [ { type: core_1.ElementRef, }, { type: core_1.NgZone, }, { type: template_host_1.DxTemplateHost, }, { type: watcher_helper_1.WatcherHelper, }, { type: iterable_differ_helper_1.IterableDifferHelper, }, { type: nested_option_1.NestedOptionHost, }, ]; }; DxDateBoxComponent.propDecorators = { 'validator': [{ type: core_1.ContentChild, args: [validator_1.DxValidatorComponent,] },], 'acceptCustomValue': [{ type: core_1.Input },], 'accessKey': [{ type: core_1.Input },], 'activeStateEnabled': [{ type: core_1.Input },], 'adaptivityEnabled': [{ type: core_1.Input },], 'applyButtonText': [{ type: core_1.Input },], 'applyValueMode': [{ type: core_1.Input },], 'attr': [{ type: core_1.Input },], 'cancelButtonText': [{ type: core_1.Input },], 'dateOutOfRangeMessage': [{ type: core_1.Input },], 'dateSerializationFormat': [{ type: core_1.Input },], 'deferRendering': [{ type: core_1.Input },], 'disabled': [{ type: core_1.Input },], 'disabledDates': [{ type: core_1.Input },], 'displayFormat': [{ type: core_1.Input },], 'dropDownButtonTemplate': [{ type: core_1.Input },], 'elementAttr': [{ type: core_1.Input },], 'fieldEditEnabled': [{ type: core_1.Input },], 'focusStateEnabled': [{ type: core_1.Input },], 'format': [{ type: core_1.Input },], 'formatString': [{ type: core_1.Input },], 'height': [{ type: core_1.Input },], 'hint': [{ type: core_1.Input },], 'hoverStateEnabled': [{ type: core_1.Input },], 'inputAttr': [{ type: core_1.Input },], 'interval': [{ type: core_1.Input },], 'invalidDateMessage': [{ type: core_1.Input },], 'isValid': [{ type: core_1.Input },], 'max': [{ type: core_1.Input },], 'maxLength': [{ type: core_1.Input },], 'maxZoomLevel': [{ type: core_1.Input },], 'min': [{ type: core_1.Input },], 'minZoomLevel': [{ type: core_1.Input },], 'name': [{ type: core_1.Input },], 'opened': [{ type: core_1.Input },], 'pickerType': [{ type: core_1.Input },], 'placeholder': [{ type: core_1.Input },], 'readOnly': [{ type: core_1.Input },], 'rtlEnabled': [{ type: core_1.Input },], 'showClearButton': [{ type: core_1.Input },], 'spellcheck': [{ type: core_1.Input },], 'tabIndex': [{ type: core_1.Input },], 'text': [{ type: core_1.Input },], 'type': [{ type: core_1.Input },], 'useCalendar': [{ type: core_1.Input },], 'useNative': [{ type: core_1.Input },], 'validationError': [{ type: core_1.Input },], 'validationMessageMode': [{ type: core_1.Input },], 'value': [{ type: core_1.Input },], 'valueChangeEvent': [{ type: core_1.Input },], 'visible': [{ type: core_1.Input },], 'width': [{ type: core_1.Input },], 'onChange': [{ type: core_1.Output },], 'onClosed': [{ type: core_1.Output },], 'onContentReady': [{ type: core_1.Output },], 'onCopy': [{ type: core_1.Output },], 'onCut': [{ type: core_1.Output },], 'onDisposing': [{ type: core_1.Output },], 'onEnterKey': [{ type: core_1.Output },], 'onFocusIn': [{ type: core_1.Output },], 'onFocusOut': [{ type: core_1.Output },], 'onInitialized': [{ type: core_1.Output },], 'onInput': [{ type: core_1.Output },], 'onKeyDown': [{ type: core_1.Output },], 'onKeyPress': [{ type: core_1.Output },], 'onKeyUp': [{ type: core_1.Output },], 'onOpened': [{ type: core_1.Output },], 'onOptionChanged': [{ type: core_1.Output },], 'onPaste': [{ type: core_1.Output },], 'onValueChanged': [{ type: core_1.Output },], 'acceptCustomValueChange': [{ type: core_1.Output },], 'accessKeyChange': [{ type: core_1.Output },], 'activeStateEnabledChange': [{ type: core_1.Output },], 'adaptivityEnabledChange': [{ type: core_1.Output },], 'applyButtonTextChange': [{ type: core_1.Output },], 'applyValueModeChange': [{ type: core_1.Output },], 'attrChange': [{ type: core_1.Output },], 'cancelButtonTextChange': [{ type: core_1.Output },], 'dateOutOfRangeMessageChange': [{ type: core_1.Output },], 'dateSerializationFormatChange': [{ type: core_1.Output },], 'deferRenderingChange': [{ type: core_1.Output },], 'disabledChange': [{ type: core_1.Output },], 'disabledDatesChange': [{ type: core_1.Output },], 'displayFormatChange': [{ type: core_1.Output },], 'dropDownButtonTemplateChange': [{ type: core_1.Output },], 'elementAttrChange': [{ type: core_1.Output },], 'fieldEditEnabledChange': [{ type: core_1.Output },], 'focusStateEnabledChange': [{ type: core_1.Output },], 'formatChange': [{ type: core_1.Output },], 'formatStringChange': [{ type: core_1.Output },], 'heightChange': [{ type: core_1.Output },], 'hintChange': [{ type: core_1.Output },], 'hoverStateEnabledChange': [{ type: core_1.Output },], 'inputAttrChange': [{ type: core_1.Output },], 'intervalChange': [{ type: core_1.Output },], 'invalidDateMessageChange': [{ type: core_1.Output },], 'isValidChange': [{ type: core_1.Output },], 'maxChange': [{ type: core_1.Output },], 'maxLengthChange': [{ type: core_1.Output },], 'maxZoomLevelChange': [{ type: core_1.Output },], 'minChange': [{ type: core_1.Output },], 'minZoomLevelChange': [{ type: core_1.Output },], 'nameChange': [{ type: core_1.Output },], 'openedChange': [{ type: core_1.Output },], 'pickerTypeChange': [{ type: core_1.Output },], 'placeholderChange': [{ type: core_1.Output },], 'readOnlyChange': [{ type: core_1.Output },], 'rtlEnabledChange': [{ type: core_1.Output },], 'showClearButtonChange': [{ type: core_1.Output },], 'spellcheckChange': [{ type: core_1.Output },], 'tabIndexChange': [{ type: core_1.Output },], 'textChange': [{ type: core_1.Output },], 'typeChange': [{ type: core_1.Output },], 'useCalendarChange': [{ type: core_1.Output },], 'useNativeChange': [{ type: core_1.Output },], 'validationErrorChange': [{ type: core_1.Output },], 'validationMessageModeChange': [{ type: core_1.Output },], 'valueChange': [{ type: core_1.Output },], 'valueChangeEventChange': [{ type: core_1.Output },], 'visibleChange': [{ type: core_1.Output },], 'widthChange': [{ type: core_1.Output },], 'onBlur': [{ type: core_1.Output },], 'change': [{ type: core_1.HostListener, args: ['valueChange', ['$event'],] },], 'touched': [{ type: core_1.HostListener, args: ['onBlur', ['$event'],] },], }; return DxDateBoxComponent; }(component_1.DxComponent)); exports.DxDateBoxComponent = DxDateBoxComponent; var DxDateBoxModule = (function () { function DxDateBoxModule() { } DxDateBoxModule.decorators = [ { type: core_1.NgModule, args: [{ imports: [ display_format_1.DxoDisplayFormatModule, template_1.DxTemplateModule ], declarations: [ DxDateBoxComponent ], exports: [ DxDateBoxComponent, display_format_1.DxoDisplayFormatModule, template_1.DxTemplateModule ], },] }, ]; /** @nocollapse */ DxDateBoxModule.ctorParameters = function () { return []; }; return DxDateBoxModule; }()); exports.DxDateBoxModule = DxDateBoxModule; //# sourceMappingURL=date-box.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/defer-rendering.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var defer_rendering_1 = __webpack_require__("./node_modules/devextreme/ui/defer_rendering.js"); var component_1 = __webpack_require__("./node_modules/devextreme-angular/core/component.js"); var template_host_1 = __webpack_require__("./node_modules/devextreme-angular/core/template-host.js"); var template_1 = __webpack_require__("./node_modules/devextreme-angular/core/template.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var watcher_helper_1 = __webpack_require__("./node_modules/devextreme-angular/core/watcher-helper.js"); var animation_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/animation.js"); /** * The DeferRendering is a widget that waits for its content to be ready before rendering it. While the content is getting ready, the DeferRendering displays a loading indicator. */ var DxDeferRenderingComponent = (function (_super) { __extends(DxDeferRenderingComponent, _super); function DxDeferRenderingComponent(elementRef, ngZone, templateHost, _watcherHelper, optionHost) { var _this = _super.call(this, elementRef, ngZone, templateHost, _watcherHelper) || this; _this._createEventEmitters([ { subscribe: 'contentReady', emit: 'onContentReady' }, { subscribe: 'disposing', emit: 'onDisposing' }, { subscribe: 'initialized', emit: 'onInitialized' }, { subscribe: 'optionChanged', emit: 'onOptionChanged' }, { subscribe: 'rendered', emit: 'onRendered' }, { subscribe: 'shown', emit: 'onShown' }, { emit: 'accessKeyChange' }, { emit: 'activeStateEnabledChange' }, { emit: 'animationChange' }, { emit: 'disabledChange' }, { emit: 'elementAttrChange' }, { emit: 'focusStateEnabledChange' }, { emit: 'heightChange' }, { emit: 'hintChange' }, { emit: 'hoverStateEnabledChange' }, { emit: 'renderWhenChange' }, { emit: 'rtlEnabledChange' }, { emit: 'showLoadIndicatorChange' }, { emit: 'staggerItemSelectorChange' }, { emit: 'tabIndexChange' }, { emit: 'visibleChange' }, { emit: 'widthChange' } ]); optionHost.setHost(_this); return _this; } Object.defineProperty(DxDeferRenderingComponent.prototype, "accessKey", { /** * Specifies the shortcut key that sets focus on the widget. */ get: function () { return this._getOption('accessKey'); }, set: function (value) { this._setOption('accessKey', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDeferRenderingComponent.prototype, "activeStateEnabled", { /** * Specifies whether or not the widget changes its state when interacting with a user. */ get: function () { return this._getOption('activeStateEnabled'); }, set: function (value) { this._setOption('activeStateEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDeferRenderingComponent.prototype, "animation", { /** * Specifies the animation to be used to show the rendered content. */ get: function () { return this._getOption('animation'); }, set: function (value) { this._setOption('animation', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDeferRenderingComponent.prototype, "disabled", { /** * Specifies whether the widget responds to user interaction. */ get: function () { return this._getOption('disabled'); }, set: function (value) { this._setOption('disabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDeferRenderingComponent.prototype, "elementAttr", { /** * Specifies the attributes to be attached to the widget's root element. */ get: function () { return this._getOption('elementAttr'); }, set: function (value) { this._setOption('elementAttr', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDeferRenderingComponent.prototype, "focusStateEnabled", { /** * Specifies whether the widget can be focused using keyboard navigation. */ get: function () { return this._getOption('focusStateEnabled'); }, set: function (value) { this._setOption('focusStateEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDeferRenderingComponent.prototype, "height", { /** * Specifies the widget's height. */ get: function () { return this._getOption('height'); }, set: function (value) { this._setOption('height', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDeferRenderingComponent.prototype, "hint", { /** * Specifies text for a hint that appears when a user pauses on the widget. */ get: function () { return this._getOption('hint'); }, set: function (value) { this._setOption('hint', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDeferRenderingComponent.prototype, "hoverStateEnabled", { /** * Specifies whether the widget changes its state when a user pauses on it. */ get: function () { return this._getOption('hoverStateEnabled'); }, set: function (value) { this._setOption('hoverStateEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDeferRenderingComponent.prototype, "renderWhen", { /** * Specifies when the widget content is rendered. */ get: function () { return this._getOption('renderWhen'); }, set: function (value) { this._setOption('renderWhen', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDeferRenderingComponent.prototype, "rtlEnabled", { /** * Switches the widget to a right-to-left representation. */ get: function () { return this._getOption('rtlEnabled'); }, set: function (value) { this._setOption('rtlEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDeferRenderingComponent.prototype, "showLoadIndicator", { /** * Indicates if a load indicator should be shown until the widget's content is rendered. */ get: function () { return this._getOption('showLoadIndicator'); }, set: function (value) { this._setOption('showLoadIndicator', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDeferRenderingComponent.prototype, "staggerItemSelector", { /** * Specifies a jQuery selector of items that should be rendered using a staggered animation. */ get: function () { return this._getOption('staggerItemSelector'); }, set: function (value) { this._setOption('staggerItemSelector', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDeferRenderingComponent.prototype, "tabIndex", { /** * Specifies the number of the element when the Tab key is used for navigating. */ get: function () { return this._getOption('tabIndex'); }, set: function (value) { this._setOption('tabIndex', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDeferRenderingComponent.prototype, "visible", { /** * Specifies whether the widget is visible. */ get: function () { return this._getOption('visible'); }, set: function (value) { this._setOption('visible', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDeferRenderingComponent.prototype, "width", { /** * Specifies the widget's width. */ get: function () { return this._getOption('width'); }, set: function (value) { this._setOption('width', value); }, enumerable: true, configurable: true }); DxDeferRenderingComponent.prototype._createInstance = function (element, options) { return new defer_rendering_1.default(element, options); }; DxDeferRenderingComponent.prototype.ngOnDestroy = function () { this._destroyWidget(); }; DxDeferRenderingComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dx-defer-rendering', template: '', providers: [ template_host_1.DxTemplateHost, watcher_helper_1.WatcherHelper, nested_option_1.NestedOptionHost ] },] }, ]; /** @nocollapse */ DxDeferRenderingComponent.ctorParameters = function () { return [ { type: core_1.ElementRef, }, { type: core_1.NgZone, }, { type: template_host_1.DxTemplateHost, }, { type: watcher_helper_1.WatcherHelper, }, { type: nested_option_1.NestedOptionHost, }, ]; }; DxDeferRenderingComponent.propDecorators = { 'accessKey': [{ type: core_1.Input },], 'activeStateEnabled': [{ type: core_1.Input },], 'animation': [{ type: core_1.Input },], 'disabled': [{ type: core_1.Input },], 'elementAttr': [{ type: core_1.Input },], 'focusStateEnabled': [{ type: core_1.Input },], 'height': [{ type: core_1.Input },], 'hint': [{ type: core_1.Input },], 'hoverStateEnabled': [{ type: core_1.Input },], 'renderWhen': [{ type: core_1.Input },], 'rtlEnabled': [{ type: core_1.Input },], 'showLoadIndicator': [{ type: core_1.Input },], 'staggerItemSelector': [{ type: core_1.Input },], 'tabIndex': [{ type: core_1.Input },], 'visible': [{ type: core_1.Input },], 'width': [{ type: core_1.Input },], 'onContentReady': [{ type: core_1.Output },], 'onDisposing': [{ type: core_1.Output },], 'onInitialized': [{ type: core_1.Output },], 'onOptionChanged': [{ type: core_1.Output },], 'onRendered': [{ type: core_1.Output },], 'onShown': [{ type: core_1.Output },], 'accessKeyChange': [{ type: core_1.Output },], 'activeStateEnabledChange': [{ type: core_1.Output },], 'animationChange': [{ type: core_1.Output },], 'disabledChange': [{ type: core_1.Output },], 'elementAttrChange': [{ type: core_1.Output },], 'focusStateEnabledChange': [{ type: core_1.Output },], 'heightChange': [{ type: core_1.Output },], 'hintChange': [{ type: core_1.Output },], 'hoverStateEnabledChange': [{ type: core_1.Output },], 'renderWhenChange': [{ type: core_1.Output },], 'rtlEnabledChange': [{ type: core_1.Output },], 'showLoadIndicatorChange': [{ type: core_1.Output },], 'staggerItemSelectorChange': [{ type: core_1.Output },], 'tabIndexChange': [{ type: core_1.Output },], 'visibleChange': [{ type: core_1.Output },], 'widthChange': [{ type: core_1.Output },], }; return DxDeferRenderingComponent; }(component_1.DxComponent)); exports.DxDeferRenderingComponent = DxDeferRenderingComponent; var DxDeferRenderingModule = (function () { function DxDeferRenderingModule() { } DxDeferRenderingModule.decorators = [ { type: core_1.NgModule, args: [{ imports: [ animation_1.DxoAnimationModule, template_1.DxTemplateModule ], declarations: [ DxDeferRenderingComponent ], exports: [ DxDeferRenderingComponent, animation_1.DxoAnimationModule, template_1.DxTemplateModule ], },] }, ]; /** @nocollapse */ DxDeferRenderingModule.ctorParameters = function () { return []; }; return DxDeferRenderingModule; }()); exports.DxDeferRenderingModule = DxDeferRenderingModule; //# sourceMappingURL=defer-rendering.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/drop-down-box.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var drop_down_box_1 = __webpack_require__("./node_modules/devextreme/ui/drop_down_box.js"); var validator_1 = __webpack_require__("./node_modules/devextreme-angular/ui/validator.js"); var forms_1 = __webpack_require__("./node_modules/@angular/forms/esm2015/forms.js"); var component_1 = __webpack_require__("./node_modules/devextreme-angular/core/component.js"); var template_host_1 = __webpack_require__("./node_modules/devextreme-angular/core/template-host.js"); var template_1 = __webpack_require__("./node_modules/devextreme-angular/core/template.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var watcher_helper_1 = __webpack_require__("./node_modules/devextreme-angular/core/watcher-helper.js"); var iterable_differ_helper_1 = __webpack_require__("./node_modules/devextreme-angular/core/iterable-differ-helper.js"); var drop_down_options_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/drop-down-options.js"); var animation_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/animation.js"); var hide_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/hide.js"); var show_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/show.js"); var position_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/position.js"); var at_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/at.js"); var boundary_offset_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/boundary-offset.js"); var collision_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/collision.js"); var my_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/my.js"); var offset_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/offset.js"); var toolbar_item_dxi_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/toolbar-item-dxi.js"); var item_dxi_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/item-dxi.js"); var item_dxi_2 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/item-dxi.js"); var CUSTOM_VALUE_ACCESSOR_PROVIDER = { provide: forms_1.NG_VALUE_ACCESSOR, useExisting: core_1.forwardRef(function () { return DxDropDownBoxComponent; }), multi: true }; /** * The DropDownBox widget consists of a text field, which displays the current value, and a drop-down field, which can contain any UI element. */ var DxDropDownBoxComponent = (function (_super) { __extends(DxDropDownBoxComponent, _super); function DxDropDownBoxComponent(elementRef, ngZone, templateHost, _watcherHelper, _idh, optionHost) { var _this = _super.call(this, elementRef, ngZone, templateHost, _watcherHelper) || this; _this._watcherHelper = _watcherHelper; _this._idh = _idh; _this.touched = function (_) { }; _this._createEventEmitters([ { subscribe: 'change', emit: 'onChange' }, { subscribe: 'closed', emit: 'onClosed' }, { subscribe: 'copy', emit: 'onCopy' }, { subscribe: 'cut', emit: 'onCut' }, { subscribe: 'disposing', emit: 'onDisposing' }, { subscribe: 'enterKey', emit: 'onEnterKey' }, { subscribe: 'focusIn', emit: 'onFocusIn' }, { subscribe: 'focusOut', emit: 'onFocusOut' }, { subscribe: 'initialized', emit: 'onInitialized' }, { subscribe: 'input', emit: 'onInput' }, { subscribe: 'keyDown', emit: 'onKeyDown' }, { subscribe: 'keyPress', emit: 'onKeyPress' }, { subscribe: 'keyUp', emit: 'onKeyUp' }, { subscribe: 'opened', emit: 'onOpened' }, { subscribe: 'optionChanged', emit: 'onOptionChanged' }, { subscribe: 'paste', emit: 'onPaste' }, { subscribe: 'valueChanged', emit: 'onValueChanged' }, { emit: 'acceptCustomValueChange' }, { emit: 'accessKeyChange' }, { emit: 'activeStateEnabledChange' }, { emit: 'contentTemplateChange' }, { emit: 'dataSourceChange' }, { emit: 'deferRenderingChange' }, { emit: 'disabledChange' }, { emit: 'displayExprChange' }, { emit: 'dropDownButtonTemplateChange' }, { emit: 'dropDownOptionsChange' }, { emit: 'elementAttrChange' }, { emit: 'fieldTemplateChange' }, { emit: 'focusStateEnabledChange' }, { emit: 'heightChange' }, { emit: 'hintChange' }, { emit: 'hoverStateEnabledChange' }, { emit: 'inputAttrChange' }, { emit: 'isValidChange' }, { emit: 'itemsChange' }, { emit: 'nameChange' }, { emit: 'openedChange' }, { emit: 'placeholderChange' }, { emit: 'readOnlyChange' }, { emit: 'rtlEnabledChange' }, { emit: 'showClearButtonChange' }, { emit: 'tabIndexChange' }, { emit: 'textChange' }, { emit: 'validationErrorChange' }, { emit: 'validationMessageModeChange' }, { emit: 'valueChange' }, { emit: 'valueChangeEventChange' }, { emit: 'valueExprChange' }, { emit: 'visibleChange' }, { emit: 'widthChange' }, { emit: 'onBlur' } ]); _this._idh.setHost(_this); optionHost.setHost(_this); return _this; } Object.defineProperty(DxDropDownBoxComponent.prototype, "acceptCustomValue", { /** * Specifies whether the widget allows a user to enter a custom value. */ get: function () { return this._getOption('acceptCustomValue'); }, set: function (value) { this._setOption('acceptCustomValue', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDropDownBoxComponent.prototype, "accessKey", { /** * Specifies the shortcut key that sets focus on the widget. */ get: function () { return this._getOption('accessKey'); }, set: function (value) { this._setOption('accessKey', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDropDownBoxComponent.prototype, "activeStateEnabled", { /** * Specifies whether or not the widget changes its state when interacting with a user. */ get: function () { return this._getOption('activeStateEnabled'); }, set: function (value) { this._setOption('activeStateEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDropDownBoxComponent.prototype, "contentTemplate", { /** * Specifies a custom template for the drop-down content. */ get: function () { return this._getOption('contentTemplate'); }, set: function (value) { this._setOption('contentTemplate', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDropDownBoxComponent.prototype, "dataSource", { /** * A data source used to fetch data to be displayed by the widget. */ get: function () { return this._getOption('dataSource'); }, set: function (value) { this._setOption('dataSource', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDropDownBoxComponent.prototype, "deferRendering", { /** * Specifies whether widget content is rendered when the widget is shown or when rendering the widget. */ get: function () { return this._getOption('deferRendering'); }, set: function (value) { this._setOption('deferRendering', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDropDownBoxComponent.prototype, "disabled", { /** * Specifies whether the widget responds to user interaction. */ get: function () { return this._getOption('disabled'); }, set: function (value) { this._setOption('disabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDropDownBoxComponent.prototype, "displayExpr", { /** * Specifies the name of the data source item field whose value is displayed by the widget. */ get: function () { return this._getOption('displayExpr'); }, set: function (value) { this._setOption('displayExpr', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDropDownBoxComponent.prototype, "dropDownButtonTemplate", { /** * Specifies a custom template for the drop-down button. */ get: function () { return this._getOption('dropDownButtonTemplate'); }, set: function (value) { this._setOption('dropDownButtonTemplate', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDropDownBoxComponent.prototype, "dropDownOptions", { /** * Configures the drop-down field which holds the content. */ get: function () { return this._getOption('dropDownOptions'); }, set: function (value) { this._setOption('dropDownOptions', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDropDownBoxComponent.prototype, "elementAttr", { /** * Specifies the attributes to be attached to the widget's root element. */ get: function () { return this._getOption('elementAttr'); }, set: function (value) { this._setOption('elementAttr', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDropDownBoxComponent.prototype, "fieldTemplate", { /** * Specifies a custom template for the text field. Must contain the TextBox widget. */ get: function () { return this._getOption('fieldTemplate'); }, set: function (value) { this._setOption('fieldTemplate', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDropDownBoxComponent.prototype, "focusStateEnabled", { /** * Specifies whether the widget can be focused using keyboard navigation. */ get: function () { return this._getOption('focusStateEnabled'); }, set: function (value) { this._setOption('focusStateEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDropDownBoxComponent.prototype, "height", { /** * Specifies the widget's height. */ get: function () { return this._getOption('height'); }, set: function (value) { this._setOption('height', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDropDownBoxComponent.prototype, "hint", { /** * Specifies text for a hint that appears when a user pauses on the widget. */ get: function () { return this._getOption('hint'); }, set: function (value) { this._setOption('hint', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDropDownBoxComponent.prototype, "hoverStateEnabled", { /** * Specifies whether the widget changes its state when a user pauses on it. */ get: function () { return this._getOption('hoverStateEnabled'); }, set: function (value) { this._setOption('hoverStateEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDropDownBoxComponent.prototype, "inputAttr", { /** * Specifies the attributes to be passed on to the underlying HTML element. */ get: function () { return this._getOption('inputAttr'); }, set: function (value) { this._setOption('inputAttr', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDropDownBoxComponent.prototype, "isValid", { /** * Specifies whether the editor's value is valid. */ get: function () { return this._getOption('isValid'); }, set: function (value) { this._setOption('isValid', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDropDownBoxComponent.prototype, "items", { /** * An array of items displayed by the widget. */ get: function () { return this._getOption('items'); }, set: function (value) { this._setOption('items', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDropDownBoxComponent.prototype, "name", { /** * The value to be assigned to the `name` attribute of the underlying HTML element. */ get: function () { return this._getOption('name'); }, set: function (value) { this._setOption('name', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDropDownBoxComponent.prototype, "opened", { /** * Specifies whether or not the drop-down editor is displayed. */ get: function () { return this._getOption('opened'); }, set: function (value) { this._setOption('opened', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDropDownBoxComponent.prototype, "placeholder", { /** * The text displayed by the widget when the widget value is empty. */ get: function () { return this._getOption('placeholder'); }, set: function (value) { this._setOption('placeholder', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDropDownBoxComponent.prototype, "readOnly", { /** * A Boolean value specifying whether or not the widget is read-only. */ get: function () { return this._getOption('readOnly'); }, set: function (value) { this._setOption('readOnly', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDropDownBoxComponent.prototype, "rtlEnabled", { /** * Switches the widget to a right-to-left representation. */ get: function () { return this._getOption('rtlEnabled'); }, set: function (value) { this._setOption('rtlEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDropDownBoxComponent.prototype, "showClearButton", { /** * Specifies whether to display the Clear button in the widget. */ get: function () { return this._getOption('showClearButton'); }, set: function (value) { this._setOption('showClearButton', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDropDownBoxComponent.prototype, "tabIndex", { /** * Specifies the number of the element when the Tab key is used for navigating. */ get: function () { return this._getOption('tabIndex'); }, set: function (value) { this._setOption('tabIndex', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDropDownBoxComponent.prototype, "text", { /** * The read-only option that holds the text displayed by the widget input element. */ get: function () { return this._getOption('text'); }, set: function (value) { this._setOption('text', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDropDownBoxComponent.prototype, "validationError", { /** * Specifies information on the validation error when using a custom validation engine. Should be changed at runtime along with the isValid option. */ get: function () { return this._getOption('validationError'); }, set: function (value) { this._setOption('validationError', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDropDownBoxComponent.prototype, "validationMessageMode", { /** * Specifies how the message about the validation rules that are not satisfied by this editor's value is displayed. */ get: function () { return this._getOption('validationMessageMode'); }, set: function (value) { this._setOption('validationMessageMode', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDropDownBoxComponent.prototype, "value", { /** * Specifies the currently selected value. May be an object if dataSource contains objects and valueExpr is not set. */ get: function () { return this._getOption('value'); }, set: function (value) { this._setOption('value', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDropDownBoxComponent.prototype, "valueChangeEvent", { /** * Specifies after which DOM events the widget updates the value. */ get: function () { return this._getOption('valueChangeEvent'); }, set: function (value) { this._setOption('valueChangeEvent', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDropDownBoxComponent.prototype, "valueExpr", { /** * Specifies which data field provides the widget's value. When this option is not set, the value is the entire data object. */ get: function () { return this._getOption('valueExpr'); }, set: function (value) { this._setOption('valueExpr', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDropDownBoxComponent.prototype, "visible", { /** * Specifies whether the widget is visible. */ get: function () { return this._getOption('visible'); }, set: function (value) { this._setOption('visible', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxDropDownBoxComponent.prototype, "width", { /** * Specifies the widget's width. */ get: function () { return this._getOption('width'); }, set: function (value) { this._setOption('width', value); }, enumerable: true, configurable: true }); DxDropDownBoxComponent.prototype.change = function (_) { }; Object.defineProperty(DxDropDownBoxComponent.prototype, "itemsChildren", { get: function () { return this._getOption('items'); }, set: function (value) { this.setChildren('items', value); }, enumerable: true, configurable: true }); DxDropDownBoxComponent.prototype._createInstance = function (element, options) { var widget = new drop_down_box_1.default(element, options); if (this.validator) { this.validator.createInstance(element); } return widget; }; DxDropDownBoxComponent.prototype.writeValue = function (value) { this.eventHelper.lockedValueChangeEvent = true; this.value = value; this.eventHelper.lockedValueChangeEvent = false; }; DxDropDownBoxComponent.prototype.setDisabledState = function (isDisabled) { this.disabled = isDisabled; }; DxDropDownBoxComponent.prototype.registerOnChange = function (fn) { this.change = fn; }; DxDropDownBoxComponent.prototype.registerOnTouched = function (fn) { this.touched = fn; }; DxDropDownBoxComponent.prototype._createWidget = function (element) { var _this = this; _super.prototype._createWidget.call(this, element); this.instance.on('focusOut', function (e) { _this.eventHelper.fireNgEvent('onBlur', [e]); }); }; DxDropDownBoxComponent.prototype.ngOnDestroy = function () { this._destroyWidget(); }; DxDropDownBoxComponent.prototype.ngOnChanges = function (changes) { _super.prototype.ngOnChanges.call(this, changes); this.setupChanges('dataSource', changes); this.setupChanges('items', changes); }; DxDropDownBoxComponent.prototype.setupChanges = function (prop, changes) { if (!(prop in this._optionsToUpdate)) { this._idh.setup(prop, changes); } }; DxDropDownBoxComponent.prototype.ngDoCheck = function () { this._idh.doCheck('dataSource'); this._idh.doCheck('items'); this._watcherHelper.checkWatchers(); _super.prototype.ngDoCheck.call(this); _super.prototype.clearChangedOptions.call(this); }; DxDropDownBoxComponent.prototype._setOption = function (name, value) { var isSetup = this._idh.setupSingle(name, value); var isChanged = this._idh.getChanges(name, value) !== null; if (isSetup || isChanged) { _super.prototype._setOption.call(this, name, value); } }; DxDropDownBoxComponent.prototype.ngAfterContentInit = function () { if (this.validator) { this.validator.renderOnViewInit = false; } }; DxDropDownBoxComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dx-drop-down-box', template: '', providers: [ template_host_1.DxTemplateHost, watcher_helper_1.WatcherHelper, CUSTOM_VALUE_ACCESSOR_PROVIDER, nested_option_1.NestedOptionHost, iterable_differ_helper_1.IterableDifferHelper ] },] }, ]; /** @nocollapse */ DxDropDownBoxComponent.ctorParameters = function () { return [ { type: core_1.ElementRef, }, { type: core_1.NgZone, }, { type: template_host_1.DxTemplateHost, }, { type: watcher_helper_1.WatcherHelper, }, { type: iterable_differ_helper_1.IterableDifferHelper, }, { type: nested_option_1.NestedOptionHost, }, ]; }; DxDropDownBoxComponent.propDecorators = { 'validator': [{ type: core_1.ContentChild, args: [validator_1.DxValidatorComponent,] },], 'acceptCustomValue': [{ type: core_1.Input },], 'accessKey': [{ type: core_1.Input },], 'activeStateEnabled': [{ type: core_1.Input },], 'contentTemplate': [{ type: core_1.Input },], 'dataSource': [{ type: core_1.Input },], 'deferRendering': [{ type: core_1.Input },], 'disabled': [{ type: core_1.Input },], 'displayExpr': [{ type: core_1.Input },], 'dropDownButtonTemplate': [{ type: core_1.Input },], 'dropDownOptions': [{ type: core_1.Input },], 'elementAttr': [{ type: core_1.Input },], 'fieldTemplate': [{ type: core_1.Input },], 'focusStateEnabled': [{ type: core_1.Input },], 'height': [{ type: core_1.Input },], 'hint': [{ type: core_1.Input },], 'hoverStateEnabled': [{ type: core_1.Input },], 'inputAttr': [{ type: core_1.Input },], 'isValid': [{ type: core_1.Input },], 'items': [{ type: core_1.Input },], 'name': [{ type: core_1.Input },], 'opened': [{ type: core_1.Input },], 'placeholder': [{ type: core_1.Input },], 'readOnly': [{ type: core_1.Input },], 'rtlEnabled': [{ type: core_1.Input },], 'showClearButton': [{ type: core_1.Input },], 'tabIndex': [{ type: core_1.Input },], 'text': [{ type: core_1.Input },], 'validationError': [{ type: core_1.Input },], 'validationMessageMode': [{ type: core_1.Input },], 'value': [{ type: core_1.Input },], 'valueChangeEvent': [{ type: core_1.Input },], 'valueExpr': [{ type: core_1.Input },], 'visible': [{ type: core_1.Input },], 'width': [{ type: core_1.Input },], 'onChange': [{ type: core_1.Output },], 'onClosed': [{ type: core_1.Output },], 'onCopy': [{ type: core_1.Output },], 'onCut': [{ type: core_1.Output },], 'onDisposing': [{ type: core_1.Output },], 'onEnterKey': [{ type: core_1.Output },], 'onFocusIn': [{ type: core_1.Output },], 'onFocusOut': [{ type: core_1.Output },], 'onInitialized': [{ type: core_1.Output },], 'onInput': [{ type: core_1.Output },], 'onKeyDown': [{ type: core_1.Output },], 'onKeyPress': [{ type: core_1.Output },], 'onKeyUp': [{ type: core_1.Output },], 'onOpened': [{ type: core_1.Output },], 'onOptionChanged': [{ type: core_1.Output },], 'onPaste': [{ type: core_1.Output },], 'onValueChanged': [{ type: core_1.Output },], 'acceptCustomValueChange': [{ type: core_1.Output },], 'accessKeyChange': [{ type: core_1.Output },], 'activeStateEnabledChange': [{ type: core_1.Output },], 'contentTemplateChange': [{ type: core_1.Output },], 'dataSourceChange': [{ type: core_1.Output },], 'deferRenderingChange': [{ type: core_1.Output },], 'disabledChange': [{ type: core_1.Output },], 'displayExprChange': [{ type: core_1.Output },], 'dropDownButtonTemplateChange': [{ type: core_1.Output },], 'dropDownOptionsChange': [{ type: core_1.Output },], 'elementAttrChange': [{ type: core_1.Output },], 'fieldTemplateChange': [{ type: core_1.Output },], 'focusStateEnabledChange': [{ type: core_1.Output },], 'heightChange': [{ type: core_1.Output },], 'hintChange': [{ type: core_1.Output },], 'hoverStateEnabledChange': [{ type: core_1.Output },], 'inputAttrChange': [{ type: core_1.Output },], 'isValidChange': [{ type: core_1.Output },], 'itemsChange': [{ type: core_1.Output },], 'nameChange': [{ type: core_1.Output },], 'openedChange': [{ type: core_1.Output },], 'placeholderChange': [{ type: core_1.Output },], 'readOnlyChange': [{ type: core_1.Output },], 'rtlEnabledChange': [{ type: core_1.Output },], 'showClearButtonChange': [{ type: core_1.Output },], 'tabIndexChange': [{ type: core_1.Output },], 'textChange': [{ type: core_1.Output },], 'validationErrorChange': [{ type: core_1.Output },], 'validationMessageModeChange': [{ type: core_1.Output },], 'valueChange': [{ type: core_1.Output },], 'valueChangeEventChange': [{ type: core_1.Output },], 'valueExprChange': [{ type: core_1.Output },], 'visibleChange': [{ type: core_1.Output },], 'widthChange': [{ type: core_1.Output },], 'onBlur': [{ type: core_1.Output },], 'change': [{ type: core_1.HostListener, args: ['valueChange', ['$event'],] },], 'touched': [{ type: core_1.HostListener, args: ['onBlur', ['$event'],] },], 'itemsChildren': [{ type: core_1.ContentChildren, args: [item_dxi_2.DxiItemComponent,] },], }; return DxDropDownBoxComponent; }(component_1.DxComponent)); exports.DxDropDownBoxComponent = DxDropDownBoxComponent; var DxDropDownBoxModule = (function () { function DxDropDownBoxModule() { } DxDropDownBoxModule.decorators = [ { type: core_1.NgModule, args: [{ imports: [ drop_down_options_1.DxoDropDownOptionsModule, animation_1.DxoAnimationModule, hide_1.DxoHideModule, show_1.DxoShowModule, position_1.DxoPositionModule, at_1.DxoAtModule, boundary_offset_1.DxoBoundaryOffsetModule, collision_1.DxoCollisionModule, my_1.DxoMyModule, offset_1.DxoOffsetModule, toolbar_item_dxi_1.DxiToolbarItemModule, item_dxi_1.DxiItemModule, template_1.DxTemplateModule ], declarations: [ DxDropDownBoxComponent ], exports: [ DxDropDownBoxComponent, drop_down_options_1.DxoDropDownOptionsModule, animation_1.DxoAnimationModule, hide_1.DxoHideModule, show_1.DxoShowModule, position_1.DxoPositionModule, at_1.DxoAtModule, boundary_offset_1.DxoBoundaryOffsetModule, collision_1.DxoCollisionModule, my_1.DxoMyModule, offset_1.DxoOffsetModule, toolbar_item_dxi_1.DxiToolbarItemModule, item_dxi_1.DxiItemModule, template_1.DxTemplateModule ], },] }, ]; /** @nocollapse */ DxDropDownBoxModule.ctorParameters = function () { return []; }; return DxDropDownBoxModule; }()); exports.DxDropDownBoxModule = DxDropDownBoxModule; //# sourceMappingURL=drop-down-box.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/file-uploader.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var file_uploader_1 = __webpack_require__("./node_modules/devextreme/ui/file_uploader.js"); var validator_1 = __webpack_require__("./node_modules/devextreme-angular/ui/validator.js"); var forms_1 = __webpack_require__("./node_modules/@angular/forms/esm2015/forms.js"); var component_1 = __webpack_require__("./node_modules/devextreme-angular/core/component.js"); var template_host_1 = __webpack_require__("./node_modules/devextreme-angular/core/template-host.js"); var template_1 = __webpack_require__("./node_modules/devextreme-angular/core/template.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var watcher_helper_1 = __webpack_require__("./node_modules/devextreme-angular/core/watcher-helper.js"); var iterable_differ_helper_1 = __webpack_require__("./node_modules/devextreme-angular/core/iterable-differ-helper.js"); var CUSTOM_VALUE_ACCESSOR_PROVIDER = { provide: forms_1.NG_VALUE_ACCESSOR, useExisting: core_1.forwardRef(function () { return DxFileUploaderComponent; }), multi: true }; /** * The FileUploader widget enables an end user to upload files to the server. An end user can select files in the file explorer or drag and drop files to the FileUploader area on the page. */ var DxFileUploaderComponent = (function (_super) { __extends(DxFileUploaderComponent, _super); function DxFileUploaderComponent(elementRef, ngZone, templateHost, _watcherHelper, _idh, optionHost) { var _this = _super.call(this, elementRef, ngZone, templateHost, _watcherHelper) || this; _this._watcherHelper = _watcherHelper; _this._idh = _idh; _this.touched = function (_) { }; _this._createEventEmitters([ { subscribe: 'contentReady', emit: 'onContentReady' }, { subscribe: 'disposing', emit: 'onDisposing' }, { subscribe: 'initialized', emit: 'onInitialized' }, { subscribe: 'optionChanged', emit: 'onOptionChanged' }, { subscribe: 'progress', emit: 'onProgress' }, { subscribe: 'uploadAborted', emit: 'onUploadAborted' }, { subscribe: 'uploaded', emit: 'onUploaded' }, { subscribe: 'uploadError', emit: 'onUploadError' }, { subscribe: 'uploadStarted', emit: 'onUploadStarted' }, { subscribe: 'valueChanged', emit: 'onValueChanged' }, { emit: 'acceptChange' }, { emit: 'accessKeyChange' }, { emit: 'activeStateEnabledChange' }, { emit: 'allowCancelingChange' }, { emit: 'buttonTextChange' }, { emit: 'disabledChange' }, { emit: 'elementAttrChange' }, { emit: 'focusStateEnabledChange' }, { emit: 'heightChange' }, { emit: 'hintChange' }, { emit: 'hoverStateEnabledChange' }, { emit: 'isValidChange' }, { emit: 'labelTextChange' }, { emit: 'multipleChange' }, { emit: 'nameChange' }, { emit: 'progressChange' }, { emit: 'readOnlyChange' }, { emit: 'readyToUploadMessageChange' }, { emit: 'rtlEnabledChange' }, { emit: 'selectButtonTextChange' }, { emit: 'showFileListChange' }, { emit: 'tabIndexChange' }, { emit: 'uploadButtonTextChange' }, { emit: 'uploadedMessageChange' }, { emit: 'uploadFailedMessageChange' }, { emit: 'uploadHeadersChange' }, { emit: 'uploadMethodChange' }, { emit: 'uploadModeChange' }, { emit: 'uploadUrlChange' }, { emit: 'validationErrorChange' }, { emit: 'valueChange' }, { emit: 'valuesChange' }, { emit: 'visibleChange' }, { emit: 'widthChange' }, { emit: 'onBlur' } ]); _this._idh.setHost(_this); optionHost.setHost(_this); return _this; } Object.defineProperty(DxFileUploaderComponent.prototype, "accept", { /** * Specifies a file type or several types accepted by the widget. */ get: function () { return this._getOption('accept'); }, set: function (value) { this._setOption('accept', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFileUploaderComponent.prototype, "accessKey", { /** * Specifies the shortcut key that sets focus on the widget. */ get: function () { return this._getOption('accessKey'); }, set: function (value) { this._setOption('accessKey', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFileUploaderComponent.prototype, "activeStateEnabled", { /** * Specifies whether or not the widget changes its state when interacting with a user. */ get: function () { return this._getOption('activeStateEnabled'); }, set: function (value) { this._setOption('activeStateEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFileUploaderComponent.prototype, "allowCanceling", { /** * Specifies if an end user can remove a file from the selection and interrupt uploading. */ get: function () { return this._getOption('allowCanceling'); }, set: function (value) { this._setOption('allowCanceling', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFileUploaderComponent.prototype, "buttonText", { /** * Use the selectButtonText option instead. */ get: function () { return this._getOption('buttonText'); }, set: function (value) { this._setOption('buttonText', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFileUploaderComponent.prototype, "disabled", { /** * Specifies whether the widget responds to user interaction. */ get: function () { return this._getOption('disabled'); }, set: function (value) { this._setOption('disabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFileUploaderComponent.prototype, "elementAttr", { /** * Specifies the attributes to be attached to the widget's root element. */ get: function () { return this._getOption('elementAttr'); }, set: function (value) { this._setOption('elementAttr', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFileUploaderComponent.prototype, "focusStateEnabled", { /** * Specifies whether the widget can be focused using keyboard navigation. */ get: function () { return this._getOption('focusStateEnabled'); }, set: function (value) { this._setOption('focusStateEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFileUploaderComponent.prototype, "height", { /** * Specifies the widget's height. */ get: function () { return this._getOption('height'); }, set: function (value) { this._setOption('height', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFileUploaderComponent.prototype, "hint", { /** * Specifies text for a hint that appears when a user pauses on the widget. */ get: function () { return this._getOption('hint'); }, set: function (value) { this._setOption('hint', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFileUploaderComponent.prototype, "hoverStateEnabled", { /** * Specifies whether the widget changes its state when a user pauses on it. */ get: function () { return this._getOption('hoverStateEnabled'); }, set: function (value) { this._setOption('hoverStateEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFileUploaderComponent.prototype, "isValid", { /** * Specifies whether the editor's value is valid. */ get: function () { return this._getOption('isValid'); }, set: function (value) { this._setOption('isValid', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFileUploaderComponent.prototype, "labelText", { /** * Specifies the text displayed on the area to which an end-user can drop a file. */ get: function () { return this._getOption('labelText'); }, set: function (value) { this._setOption('labelText', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFileUploaderComponent.prototype, "multiple", { /** * Specifies whether the widget enables an end-user to select a single file or multiple files. */ get: function () { return this._getOption('multiple'); }, set: function (value) { this._setOption('multiple', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFileUploaderComponent.prototype, "name", { /** * Specifies the value passed to the name attribute of the underlying input element. */ get: function () { return this._getOption('name'); }, set: function (value) { this._setOption('name', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFileUploaderComponent.prototype, "progress", { /** * Gets the current progress in percentages. */ get: function () { return this._getOption('progress'); }, set: function (value) { this._setOption('progress', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFileUploaderComponent.prototype, "readOnly", { /** * A Boolean value specifying whether or not the widget is read-only. */ get: function () { return this._getOption('readOnly'); }, set: function (value) { this._setOption('readOnly', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFileUploaderComponent.prototype, "readyToUploadMessage", { /** * The message displayed by the widget when it is ready to upload the specified files. */ get: function () { return this._getOption('readyToUploadMessage'); }, set: function (value) { this._setOption('readyToUploadMessage', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFileUploaderComponent.prototype, "rtlEnabled", { /** * Switches the widget to a right-to-left representation. */ get: function () { return this._getOption('rtlEnabled'); }, set: function (value) { this._setOption('rtlEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFileUploaderComponent.prototype, "selectButtonText", { /** * The text displayed on the button that opens the file browser. */ get: function () { return this._getOption('selectButtonText'); }, set: function (value) { this._setOption('selectButtonText', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFileUploaderComponent.prototype, "showFileList", { /** * Specifies whether or not the widget displays the list of selected files. */ get: function () { return this._getOption('showFileList'); }, set: function (value) { this._setOption('showFileList', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFileUploaderComponent.prototype, "tabIndex", { /** * Specifies the number of the element when the Tab key is used for navigating. */ get: function () { return this._getOption('tabIndex'); }, set: function (value) { this._setOption('tabIndex', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFileUploaderComponent.prototype, "uploadButtonText", { /** * The text displayed on the button that starts uploading. */ get: function () { return this._getOption('uploadButtonText'); }, set: function (value) { this._setOption('uploadButtonText', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFileUploaderComponent.prototype, "uploadedMessage", { /** * The message displayed by the widget when uploading is finished. */ get: function () { return this._getOption('uploadedMessage'); }, set: function (value) { this._setOption('uploadedMessage', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFileUploaderComponent.prototype, "uploadFailedMessage", { /** * The message displayed by the widget on uploading failure. */ get: function () { return this._getOption('uploadFailedMessage'); }, set: function (value) { this._setOption('uploadFailedMessage', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFileUploaderComponent.prototype, "uploadHeaders", { /** * Specifies headers for the upload request. */ get: function () { return this._getOption('uploadHeaders'); }, set: function (value) { this._setOption('uploadHeaders', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFileUploaderComponent.prototype, "uploadMethod", { /** * Specifies the method for the upload request. */ get: function () { return this._getOption('uploadMethod'); }, set: function (value) { this._setOption('uploadMethod', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFileUploaderComponent.prototype, "uploadMode", { /** * Specifies how the widget uploads files. */ get: function () { return this._getOption('uploadMode'); }, set: function (value) { this._setOption('uploadMode', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFileUploaderComponent.prototype, "uploadUrl", { /** * Specifies a target Url for the upload request. */ get: function () { return this._getOption('uploadUrl'); }, set: function (value) { this._setOption('uploadUrl', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFileUploaderComponent.prototype, "validationError", { /** * Specifies information on the validation error when using a custom validation engine. Should be changed at runtime along with the isValid option. */ get: function () { return this._getOption('validationError'); }, set: function (value) { this._setOption('validationError', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFileUploaderComponent.prototype, "value", { /** * Specifies a File instance representing the selected file. Read-only when uploadMode is "useForm". */ get: function () { return this._getOption('value'); }, set: function (value) { this._setOption('value', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFileUploaderComponent.prototype, "values", { /** * Use the value option instead. */ get: function () { return this._getOption('values'); }, set: function (value) { this._setOption('values', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFileUploaderComponent.prototype, "visible", { /** * Specifies whether the widget is visible. */ get: function () { return this._getOption('visible'); }, set: function (value) { this._setOption('visible', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFileUploaderComponent.prototype, "width", { /** * Specifies the widget's width. */ get: function () { return this._getOption('width'); }, set: function (value) { this._setOption('width', value); }, enumerable: true, configurable: true }); DxFileUploaderComponent.prototype.change = function (_) { }; DxFileUploaderComponent.prototype._createInstance = function (element, options) { var widget = new file_uploader_1.default(element, options); if (this.validator) { this.validator.createInstance(element); } return widget; }; DxFileUploaderComponent.prototype.writeValue = function (value) { this.eventHelper.lockedValueChangeEvent = true; this.value = value; this.eventHelper.lockedValueChangeEvent = false; }; DxFileUploaderComponent.prototype.setDisabledState = function (isDisabled) { this.disabled = isDisabled; }; DxFileUploaderComponent.prototype.registerOnChange = function (fn) { this.change = fn; }; DxFileUploaderComponent.prototype.registerOnTouched = function (fn) { this.touched = fn; }; DxFileUploaderComponent.prototype._createWidget = function (element) { var _this = this; _super.prototype._createWidget.call(this, element); this.instance.on('focusOut', function (e) { _this.eventHelper.fireNgEvent('onBlur', [e]); }); }; DxFileUploaderComponent.prototype.ngOnDestroy = function () { this._destroyWidget(); }; DxFileUploaderComponent.prototype.ngOnChanges = function (changes) { _super.prototype.ngOnChanges.call(this, changes); this.setupChanges('value', changes); }; DxFileUploaderComponent.prototype.setupChanges = function (prop, changes) { if (!(prop in this._optionsToUpdate)) { this._idh.setup(prop, changes); } }; DxFileUploaderComponent.prototype.ngDoCheck = function () { this._idh.doCheck('value'); this._watcherHelper.checkWatchers(); _super.prototype.ngDoCheck.call(this); _super.prototype.clearChangedOptions.call(this); }; DxFileUploaderComponent.prototype._setOption = function (name, value) { var isSetup = this._idh.setupSingle(name, value); var isChanged = this._idh.getChanges(name, value) !== null; if (isSetup || isChanged) { _super.prototype._setOption.call(this, name, value); } }; DxFileUploaderComponent.prototype.ngAfterContentInit = function () { if (this.validator) { this.validator.renderOnViewInit = false; } }; DxFileUploaderComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dx-file-uploader', template: '', providers: [ template_host_1.DxTemplateHost, watcher_helper_1.WatcherHelper, CUSTOM_VALUE_ACCESSOR_PROVIDER, nested_option_1.NestedOptionHost, iterable_differ_helper_1.IterableDifferHelper ] },] }, ]; /** @nocollapse */ DxFileUploaderComponent.ctorParameters = function () { return [ { type: core_1.ElementRef, }, { type: core_1.NgZone, }, { type: template_host_1.DxTemplateHost, }, { type: watcher_helper_1.WatcherHelper, }, { type: iterable_differ_helper_1.IterableDifferHelper, }, { type: nested_option_1.NestedOptionHost, }, ]; }; DxFileUploaderComponent.propDecorators = { 'validator': [{ type: core_1.ContentChild, args: [validator_1.DxValidatorComponent,] },], 'accept': [{ type: core_1.Input },], 'accessKey': [{ type: core_1.Input },], 'activeStateEnabled': [{ type: core_1.Input },], 'allowCanceling': [{ type: core_1.Input },], 'buttonText': [{ type: core_1.Input },], 'disabled': [{ type: core_1.Input },], 'elementAttr': [{ type: core_1.Input },], 'focusStateEnabled': [{ type: core_1.Input },], 'height': [{ type: core_1.Input },], 'hint': [{ type: core_1.Input },], 'hoverStateEnabled': [{ type: core_1.Input },], 'isValid': [{ type: core_1.Input },], 'labelText': [{ type: core_1.Input },], 'multiple': [{ type: core_1.Input },], 'name': [{ type: core_1.Input },], 'progress': [{ type: core_1.Input },], 'readOnly': [{ type: core_1.Input },], 'readyToUploadMessage': [{ type: core_1.Input },], 'rtlEnabled': [{ type: core_1.Input },], 'selectButtonText': [{ type: core_1.Input },], 'showFileList': [{ type: core_1.Input },], 'tabIndex': [{ type: core_1.Input },], 'uploadButtonText': [{ type: core_1.Input },], 'uploadedMessage': [{ type: core_1.Input },], 'uploadFailedMessage': [{ type: core_1.Input },], 'uploadHeaders': [{ type: core_1.Input },], 'uploadMethod': [{ type: core_1.Input },], 'uploadMode': [{ type: core_1.Input },], 'uploadUrl': [{ type: core_1.Input },], 'validationError': [{ type: core_1.Input },], 'value': [{ type: core_1.Input },], 'values': [{ type: core_1.Input },], 'visible': [{ type: core_1.Input },], 'width': [{ type: core_1.Input },], 'onContentReady': [{ type: core_1.Output },], 'onDisposing': [{ type: core_1.Output },], 'onInitialized': [{ type: core_1.Output },], 'onOptionChanged': [{ type: core_1.Output },], 'onProgress': [{ type: core_1.Output },], 'onUploadAborted': [{ type: core_1.Output },], 'onUploaded': [{ type: core_1.Output },], 'onUploadError': [{ type: core_1.Output },], 'onUploadStarted': [{ type: core_1.Output },], 'onValueChanged': [{ type: core_1.Output },], 'acceptChange': [{ type: core_1.Output },], 'accessKeyChange': [{ type: core_1.Output },], 'activeStateEnabledChange': [{ type: core_1.Output },], 'allowCancelingChange': [{ type: core_1.Output },], 'buttonTextChange': [{ type: core_1.Output },], 'disabledChange': [{ type: core_1.Output },], 'elementAttrChange': [{ type: core_1.Output },], 'focusStateEnabledChange': [{ type: core_1.Output },], 'heightChange': [{ type: core_1.Output },], 'hintChange': [{ type: core_1.Output },], 'hoverStateEnabledChange': [{ type: core_1.Output },], 'isValidChange': [{ type: core_1.Output },], 'labelTextChange': [{ type: core_1.Output },], 'multipleChange': [{ type: core_1.Output },], 'nameChange': [{ type: core_1.Output },], 'progressChange': [{ type: core_1.Output },], 'readOnlyChange': [{ type: core_1.Output },], 'readyToUploadMessageChange': [{ type: core_1.Output },], 'rtlEnabledChange': [{ type: core_1.Output },], 'selectButtonTextChange': [{ type: core_1.Output },], 'showFileListChange': [{ type: core_1.Output },], 'tabIndexChange': [{ type: core_1.Output },], 'uploadButtonTextChange': [{ type: core_1.Output },], 'uploadedMessageChange': [{ type: core_1.Output },], 'uploadFailedMessageChange': [{ type: core_1.Output },], 'uploadHeadersChange': [{ type: core_1.Output },], 'uploadMethodChange': [{ type: core_1.Output },], 'uploadModeChange': [{ type: core_1.Output },], 'uploadUrlChange': [{ type: core_1.Output },], 'validationErrorChange': [{ type: core_1.Output },], 'valueChange': [{ type: core_1.Output },], 'valuesChange': [{ type: core_1.Output },], 'visibleChange': [{ type: core_1.Output },], 'widthChange': [{ type: core_1.Output },], 'onBlur': [{ type: core_1.Output },], 'change': [{ type: core_1.HostListener, args: ['valueChange', ['$event'],] },], 'touched': [{ type: core_1.HostListener, args: ['onBlur', ['$event'],] },], }; return DxFileUploaderComponent; }(component_1.DxComponent)); exports.DxFileUploaderComponent = DxFileUploaderComponent; var DxFileUploaderModule = (function () { function DxFileUploaderModule() { } DxFileUploaderModule.decorators = [ { type: core_1.NgModule, args: [{ imports: [ template_1.DxTemplateModule ], declarations: [ DxFileUploaderComponent ], exports: [ DxFileUploaderComponent, template_1.DxTemplateModule ], },] }, ]; /** @nocollapse */ DxFileUploaderModule.ctorParameters = function () { return []; }; return DxFileUploaderModule; }()); exports.DxFileUploaderModule = DxFileUploaderModule; //# sourceMappingURL=file-uploader.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/filter-builder.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var filter_builder_1 = __webpack_require__("./node_modules/devextreme/ui/filter_builder.js"); var validator_1 = __webpack_require__("./node_modules/devextreme-angular/ui/validator.js"); var forms_1 = __webpack_require__("./node_modules/@angular/forms/esm2015/forms.js"); var component_1 = __webpack_require__("./node_modules/devextreme-angular/core/component.js"); var template_host_1 = __webpack_require__("./node_modules/devextreme-angular/core/template-host.js"); var template_1 = __webpack_require__("./node_modules/devextreme-angular/core/template.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var watcher_helper_1 = __webpack_require__("./node_modules/devextreme-angular/core/watcher-helper.js"); var iterable_differ_helper_1 = __webpack_require__("./node_modules/devextreme-angular/core/iterable-differ-helper.js"); var field_dxi_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/field-dxi.js"); var format_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/format.js"); var lookup_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/lookup.js"); var filter_operation_descriptions_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/filter-operation-descriptions.js"); var group_operation_descriptions_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/group-operation-descriptions.js"); var field_dxi_2 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/field-dxi.js"); var CUSTOM_VALUE_ACCESSOR_PROVIDER = { provide: forms_1.NG_VALUE_ACCESSOR, useExisting: core_1.forwardRef(function () { return DxFilterBuilderComponent; }), multi: true }; /** * The FilterBuilder widget allows a user to build complex filter expressions with an unlimited number of filter conditions, combined by logical operations using the UI. */ var DxFilterBuilderComponent = (function (_super) { __extends(DxFilterBuilderComponent, _super); function DxFilterBuilderComponent(elementRef, ngZone, templateHost, _watcherHelper, _idh, optionHost) { var _this = _super.call(this, elementRef, ngZone, templateHost, _watcherHelper) || this; _this._watcherHelper = _watcherHelper; _this._idh = _idh; _this.touched = function (_) { }; _this._createEventEmitters([ { subscribe: 'disposing', emit: 'onDisposing' }, { subscribe: 'editorPrepared', emit: 'onEditorPrepared' }, { subscribe: 'editorPreparing', emit: 'onEditorPreparing' }, { subscribe: 'initialized', emit: 'onInitialized' }, { subscribe: 'optionChanged', emit: 'onOptionChanged' }, { subscribe: 'valueChanged', emit: 'onValueChanged' }, { emit: 'accessKeyChange' }, { emit: 'activeStateEnabledChange' }, { emit: 'allowHierarchicalFieldsChange' }, { emit: 'disabledChange' }, { emit: 'elementAttrChange' }, { emit: 'fieldsChange' }, { emit: 'filterOperationDescriptionsChange' }, { emit: 'focusStateEnabledChange' }, { emit: 'groupOperationDescriptionsChange' }, { emit: 'heightChange' }, { emit: 'hintChange' }, { emit: 'hoverStateEnabledChange' }, { emit: 'rtlEnabledChange' }, { emit: 'tabIndexChange' }, { emit: 'valueChange' }, { emit: 'visibleChange' }, { emit: 'widthChange' }, { emit: 'onBlur' } ]); _this._idh.setHost(_this); optionHost.setHost(_this); return _this; } Object.defineProperty(DxFilterBuilderComponent.prototype, "accessKey", { /** * Specifies the shortcut key that sets focus on the widget. */ get: function () { return this._getOption('accessKey'); }, set: function (value) { this._setOption('accessKey', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFilterBuilderComponent.prototype, "activeStateEnabled", { /** * Specifies whether or not the widget changes its state when interacting with a user. */ get: function () { return this._getOption('activeStateEnabled'); }, set: function (value) { this._setOption('activeStateEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFilterBuilderComponent.prototype, "allowHierarchicalFields", { /** * Specifies whether the widget can display hierarchical data fields. */ get: function () { return this._getOption('allowHierarchicalFields'); }, set: function (value) { this._setOption('allowHierarchicalFields', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFilterBuilderComponent.prototype, "disabled", { /** * Specifies whether the widget responds to user interaction. */ get: function () { return this._getOption('disabled'); }, set: function (value) { this._setOption('disabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFilterBuilderComponent.prototype, "elementAttr", { /** * Specifies the attributes to be attached to the widget's root element. */ get: function () { return this._getOption('elementAttr'); }, set: function (value) { this._setOption('elementAttr', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFilterBuilderComponent.prototype, "fields", { /** * Configures fields. */ get: function () { return this._getOption('fields'); }, set: function (value) { this._setOption('fields', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFilterBuilderComponent.prototype, "filterOperationDescriptions", { /** * Specifies filter operation descriptions. */ get: function () { return this._getOption('filterOperationDescriptions'); }, set: function (value) { this._setOption('filterOperationDescriptions', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFilterBuilderComponent.prototype, "focusStateEnabled", { /** * Specifies whether the widget can be focused using keyboard navigation. */ get: function () { return this._getOption('focusStateEnabled'); }, set: function (value) { this._setOption('focusStateEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFilterBuilderComponent.prototype, "groupOperationDescriptions", { /** * Specifies group operation descriptions. */ get: function () { return this._getOption('groupOperationDescriptions'); }, set: function (value) { this._setOption('groupOperationDescriptions', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFilterBuilderComponent.prototype, "height", { /** * Specifies the widget's height. */ get: function () { return this._getOption('height'); }, set: function (value) { this._setOption('height', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFilterBuilderComponent.prototype, "hint", { /** * Specifies text for a hint that appears when a user pauses on the widget. */ get: function () { return this._getOption('hint'); }, set: function (value) { this._setOption('hint', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFilterBuilderComponent.prototype, "hoverStateEnabled", { /** * Specifies whether the widget changes its state when a user pauses on it. */ get: function () { return this._getOption('hoverStateEnabled'); }, set: function (value) { this._setOption('hoverStateEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFilterBuilderComponent.prototype, "rtlEnabled", { /** * Switches the widget to a right-to-left representation. */ get: function () { return this._getOption('rtlEnabled'); }, set: function (value) { this._setOption('rtlEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFilterBuilderComponent.prototype, "tabIndex", { /** * Specifies the number of the element when the Tab key is used for navigating. */ get: function () { return this._getOption('tabIndex'); }, set: function (value) { this._setOption('tabIndex', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFilterBuilderComponent.prototype, "value", { /** * Specifies the current filter expression. */ get: function () { return this._getOption('value'); }, set: function (value) { this._setOption('value', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFilterBuilderComponent.prototype, "visible", { /** * Specifies whether the widget is visible. */ get: function () { return this._getOption('visible'); }, set: function (value) { this._setOption('visible', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFilterBuilderComponent.prototype, "width", { /** * Specifies the widget's width. */ get: function () { return this._getOption('width'); }, set: function (value) { this._setOption('width', value); }, enumerable: true, configurable: true }); DxFilterBuilderComponent.prototype.change = function (_) { }; Object.defineProperty(DxFilterBuilderComponent.prototype, "fieldsChildren", { get: function () { return this._getOption('fields'); }, set: function (value) { this.setChildren('fields', value); }, enumerable: true, configurable: true }); DxFilterBuilderComponent.prototype._createInstance = function (element, options) { var widget = new filter_builder_1.default(element, options); if (this.validator) { this.validator.createInstance(element); } return widget; }; DxFilterBuilderComponent.prototype.writeValue = function (value) { this.eventHelper.lockedValueChangeEvent = true; this.value = value; this.eventHelper.lockedValueChangeEvent = false; }; DxFilterBuilderComponent.prototype.setDisabledState = function (isDisabled) { this.disabled = isDisabled; }; DxFilterBuilderComponent.prototype.registerOnChange = function (fn) { this.change = fn; }; DxFilterBuilderComponent.prototype.registerOnTouched = function (fn) { this.touched = fn; }; DxFilterBuilderComponent.prototype._createWidget = function (element) { var _this = this; _super.prototype._createWidget.call(this, element); this.instance.on('focusOut', function (e) { _this.eventHelper.fireNgEvent('onBlur', [e]); }); }; DxFilterBuilderComponent.prototype.ngOnDestroy = function () { this._destroyWidget(); }; DxFilterBuilderComponent.prototype.ngOnChanges = function (changes) { _super.prototype.ngOnChanges.call(this, changes); this.setupChanges('fields', changes); }; DxFilterBuilderComponent.prototype.setupChanges = function (prop, changes) { if (!(prop in this._optionsToUpdate)) { this._idh.setup(prop, changes); } }; DxFilterBuilderComponent.prototype.ngDoCheck = function () { this._idh.doCheck('fields'); this._watcherHelper.checkWatchers(); _super.prototype.ngDoCheck.call(this); _super.prototype.clearChangedOptions.call(this); }; DxFilterBuilderComponent.prototype._setOption = function (name, value) { var isSetup = this._idh.setupSingle(name, value); var isChanged = this._idh.getChanges(name, value) !== null; if (isSetup || isChanged) { _super.prototype._setOption.call(this, name, value); } }; DxFilterBuilderComponent.prototype.ngAfterContentInit = function () { if (this.validator) { this.validator.renderOnViewInit = false; } }; DxFilterBuilderComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dx-filter-builder', template: '', providers: [ template_host_1.DxTemplateHost, watcher_helper_1.WatcherHelper, CUSTOM_VALUE_ACCESSOR_PROVIDER, nested_option_1.NestedOptionHost, iterable_differ_helper_1.IterableDifferHelper ] },] }, ]; /** @nocollapse */ DxFilterBuilderComponent.ctorParameters = function () { return [ { type: core_1.ElementRef, }, { type: core_1.NgZone, }, { type: template_host_1.DxTemplateHost, }, { type: watcher_helper_1.WatcherHelper, }, { type: iterable_differ_helper_1.IterableDifferHelper, }, { type: nested_option_1.NestedOptionHost, }, ]; }; DxFilterBuilderComponent.propDecorators = { 'validator': [{ type: core_1.ContentChild, args: [validator_1.DxValidatorComponent,] },], 'accessKey': [{ type: core_1.Input },], 'activeStateEnabled': [{ type: core_1.Input },], 'allowHierarchicalFields': [{ type: core_1.Input },], 'disabled': [{ type: core_1.Input },], 'elementAttr': [{ type: core_1.Input },], 'fields': [{ type: core_1.Input },], 'filterOperationDescriptions': [{ type: core_1.Input },], 'focusStateEnabled': [{ type: core_1.Input },], 'groupOperationDescriptions': [{ type: core_1.Input },], 'height': [{ type: core_1.Input },], 'hint': [{ type: core_1.Input },], 'hoverStateEnabled': [{ type: core_1.Input },], 'rtlEnabled': [{ type: core_1.Input },], 'tabIndex': [{ type: core_1.Input },], 'value': [{ type: core_1.Input },], 'visible': [{ type: core_1.Input },], 'width': [{ type: core_1.Input },], 'onDisposing': [{ type: core_1.Output },], 'onEditorPrepared': [{ type: core_1.Output },], 'onEditorPreparing': [{ type: core_1.Output },], 'onInitialized': [{ type: core_1.Output },], 'onOptionChanged': [{ type: core_1.Output },], 'onValueChanged': [{ type: core_1.Output },], 'accessKeyChange': [{ type: core_1.Output },], 'activeStateEnabledChange': [{ type: core_1.Output },], 'allowHierarchicalFieldsChange': [{ type: core_1.Output },], 'disabledChange': [{ type: core_1.Output },], 'elementAttrChange': [{ type: core_1.Output },], 'fieldsChange': [{ type: core_1.Output },], 'filterOperationDescriptionsChange': [{ type: core_1.Output },], 'focusStateEnabledChange': [{ type: core_1.Output },], 'groupOperationDescriptionsChange': [{ type: core_1.Output },], 'heightChange': [{ type: core_1.Output },], 'hintChange': [{ type: core_1.Output },], 'hoverStateEnabledChange': [{ type: core_1.Output },], 'rtlEnabledChange': [{ type: core_1.Output },], 'tabIndexChange': [{ type: core_1.Output },], 'valueChange': [{ type: core_1.Output },], 'visibleChange': [{ type: core_1.Output },], 'widthChange': [{ type: core_1.Output },], 'onBlur': [{ type: core_1.Output },], 'change': [{ type: core_1.HostListener, args: ['valueChange', ['$event'],] },], 'touched': [{ type: core_1.HostListener, args: ['onBlur', ['$event'],] },], 'fieldsChildren': [{ type: core_1.ContentChildren, args: [field_dxi_2.DxiFieldComponent,] },], }; return DxFilterBuilderComponent; }(component_1.DxComponent)); exports.DxFilterBuilderComponent = DxFilterBuilderComponent; var DxFilterBuilderModule = (function () { function DxFilterBuilderModule() { } DxFilterBuilderModule.decorators = [ { type: core_1.NgModule, args: [{ imports: [ field_dxi_1.DxiFieldModule, format_1.DxoFormatModule, lookup_1.DxoLookupModule, filter_operation_descriptions_1.DxoFilterOperationDescriptionsModule, group_operation_descriptions_1.DxoGroupOperationDescriptionsModule, template_1.DxTemplateModule ], declarations: [ DxFilterBuilderComponent ], exports: [ DxFilterBuilderComponent, field_dxi_1.DxiFieldModule, format_1.DxoFormatModule, lookup_1.DxoLookupModule, filter_operation_descriptions_1.DxoFilterOperationDescriptionsModule, group_operation_descriptions_1.DxoGroupOperationDescriptionsModule, template_1.DxTemplateModule ], },] }, ]; /** @nocollapse */ DxFilterBuilderModule.ctorParameters = function () { return []; }; return DxFilterBuilderModule; }()); exports.DxFilterBuilderModule = DxFilterBuilderModule; //# sourceMappingURL=filter-builder.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/form.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var form_1 = __webpack_require__("./node_modules/devextreme/ui/form.js"); var component_1 = __webpack_require__("./node_modules/devextreme-angular/core/component.js"); var template_host_1 = __webpack_require__("./node_modules/devextreme-angular/core/template-host.js"); var template_1 = __webpack_require__("./node_modules/devextreme-angular/core/template.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var watcher_helper_1 = __webpack_require__("./node_modules/devextreme-angular/core/watcher-helper.js"); var iterable_differ_helper_1 = __webpack_require__("./node_modules/devextreme-angular/core/iterable-differ-helper.js"); var col_count_by_screen_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/col-count-by-screen.js"); var item_dxi_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/item-dxi.js"); var label_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/label.js"); var validation_rule_dxi_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/validation-rule-dxi.js"); var tab_panel_options_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/tab-panel-options.js"); var tab_dxi_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/tab-dxi.js"); var item_dxi_2 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/item-dxi.js"); /** * The Form widget represents fields of a data object as a collection of label-editor pairs. These pairs can be arranged in several groups, tabs and columns. */ var DxFormComponent = (function (_super) { __extends(DxFormComponent, _super); function DxFormComponent(elementRef, ngZone, templateHost, _watcherHelper, _idh, optionHost) { var _this = _super.call(this, elementRef, ngZone, templateHost, _watcherHelper) || this; _this._watcherHelper = _watcherHelper; _this._idh = _idh; _this._createEventEmitters([ { subscribe: 'contentReady', emit: 'onContentReady' }, { subscribe: 'disposing', emit: 'onDisposing' }, { subscribe: 'editorEnterKey', emit: 'onEditorEnterKey' }, { subscribe: 'fieldDataChanged', emit: 'onFieldDataChanged' }, { subscribe: 'initialized', emit: 'onInitialized' }, { subscribe: 'optionChanged', emit: 'onOptionChanged' }, { emit: 'accessKeyChange' }, { emit: 'activeStateEnabledChange' }, { emit: 'alignItemLabelsChange' }, { emit: 'alignItemLabelsInAllGroupsChange' }, { emit: 'colCountChange' }, { emit: 'colCountByScreenChange' }, { emit: 'customizeItemChange' }, { emit: 'disabledChange' }, { emit: 'elementAttrChange' }, { emit: 'focusStateEnabledChange' }, { emit: 'formDataChange' }, { emit: 'heightChange' }, { emit: 'hintChange' }, { emit: 'hoverStateEnabledChange' }, { emit: 'itemsChange' }, { emit: 'labelLocationChange' }, { emit: 'minColWidthChange' }, { emit: 'optionalMarkChange' }, { emit: 'readOnlyChange' }, { emit: 'requiredMarkChange' }, { emit: 'requiredMessageChange' }, { emit: 'rtlEnabledChange' }, { emit: 'screenByWidthChange' }, { emit: 'scrollingEnabledChange' }, { emit: 'showColonAfterLabelChange' }, { emit: 'showOptionalMarkChange' }, { emit: 'showRequiredMarkChange' }, { emit: 'showValidationSummaryChange' }, { emit: 'tabIndexChange' }, { emit: 'validationGroupChange' }, { emit: 'visibleChange' }, { emit: 'widthChange' } ]); _this._idh.setHost(_this); optionHost.setHost(_this); return _this; } Object.defineProperty(DxFormComponent.prototype, "accessKey", { /** * Specifies the shortcut key that sets focus on the widget. */ get: function () { return this._getOption('accessKey'); }, set: function (value) { this._setOption('accessKey', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFormComponent.prototype, "activeStateEnabled", { /** * Specifies whether or not the widget changes its state when interacting with a user. */ get: function () { return this._getOption('activeStateEnabled'); }, set: function (value) { this._setOption('activeStateEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFormComponent.prototype, "alignItemLabels", { /** * Specifies whether or not all root item labels are aligned. */ get: function () { return this._getOption('alignItemLabels'); }, set: function (value) { this._setOption('alignItemLabels', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFormComponent.prototype, "alignItemLabelsInAllGroups", { /** * Specifies whether or not item labels in all groups are aligned. */ get: function () { return this._getOption('alignItemLabelsInAllGroups'); }, set: function (value) { this._setOption('alignItemLabelsInAllGroups', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFormComponent.prototype, "colCount", { /** * The count of columns in the form layout. */ get: function () { return this._getOption('colCount'); }, set: function (value) { this._setOption('colCount', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFormComponent.prototype, "colCountByScreen", { /** * Specifies dependency between the screen factor and the count of columns in the form layout. */ get: function () { return this._getOption('colCountByScreen'); }, set: function (value) { this._setOption('colCountByScreen', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFormComponent.prototype, "customizeItem", { /** * Specifies a function that customizes a form item after it has been created. */ get: function () { return this._getOption('customizeItem'); }, set: function (value) { this._setOption('customizeItem', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFormComponent.prototype, "disabled", { /** * Specifies whether the widget responds to user interaction. */ get: function () { return this._getOption('disabled'); }, set: function (value) { this._setOption('disabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFormComponent.prototype, "elementAttr", { /** * Specifies the attributes to be attached to the widget's root element. */ get: function () { return this._getOption('elementAttr'); }, set: function (value) { this._setOption('elementAttr', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFormComponent.prototype, "focusStateEnabled", { /** * Specifies whether the widget can be focused using keyboard navigation. */ get: function () { return this._getOption('focusStateEnabled'); }, set: function (value) { this._setOption('focusStateEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFormComponent.prototype, "formData", { /** * An object providing data for the form. */ get: function () { return this._getOption('formData'); }, set: function (value) { this._setOption('formData', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFormComponent.prototype, "height", { /** * Specifies the widget's height. */ get: function () { return this._getOption('height'); }, set: function (value) { this._setOption('height', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFormComponent.prototype, "hint", { /** * Specifies text for a hint that appears when a user pauses on the widget. */ get: function () { return this._getOption('hint'); }, set: function (value) { this._setOption('hint', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFormComponent.prototype, "hoverStateEnabled", { /** * Specifies whether the widget changes its state when a user pauses on it. */ get: function () { return this._getOption('hoverStateEnabled'); }, set: function (value) { this._setOption('hoverStateEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFormComponent.prototype, "items", { /** * Holds an array of form items. */ get: function () { return this._getOption('items'); }, set: function (value) { this._setOption('items', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFormComponent.prototype, "labelLocation", { /** * Specifies the location of a label against the editor. */ get: function () { return this._getOption('labelLocation'); }, set: function (value) { this._setOption('labelLocation', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFormComponent.prototype, "minColWidth", { /** * The minimum column width used for calculating column count in the form layout. */ get: function () { return this._getOption('minColWidth'); }, set: function (value) { this._setOption('minColWidth', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFormComponent.prototype, "optionalMark", { /** * The text displayed for optional fields. */ get: function () { return this._getOption('optionalMark'); }, set: function (value) { this._setOption('optionalMark', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFormComponent.prototype, "readOnly", { /** * Specifies whether all editors on the form are read-only. Applies only to non-templated items. */ get: function () { return this._getOption('readOnly'); }, set: function (value) { this._setOption('readOnly', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFormComponent.prototype, "requiredMark", { /** * The text displayed for required fields. */ get: function () { return this._getOption('requiredMark'); }, set: function (value) { this._setOption('requiredMark', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFormComponent.prototype, "requiredMessage", { /** * Specifies the message that is shown for end-users if a required field value is not specified. */ get: function () { return this._getOption('requiredMessage'); }, set: function (value) { this._setOption('requiredMessage', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFormComponent.prototype, "rtlEnabled", { /** * Switches the widget to a right-to-left representation. */ get: function () { return this._getOption('rtlEnabled'); }, set: function (value) { this._setOption('rtlEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFormComponent.prototype, "screenByWidth", { /** * Specifies the function returning the screen factor depending on the screen width. */ get: function () { return this._getOption('screenByWidth'); }, set: function (value) { this._setOption('screenByWidth', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFormComponent.prototype, "scrollingEnabled", { /** * A Boolean value specifying whether to enable or disable form scrolling. */ get: function () { return this._getOption('scrollingEnabled'); }, set: function (value) { this._setOption('scrollingEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFormComponent.prototype, "showColonAfterLabel", { /** * Specifies whether or not a colon is displayed at the end of form labels. */ get: function () { return this._getOption('showColonAfterLabel'); }, set: function (value) { this._setOption('showColonAfterLabel', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFormComponent.prototype, "showOptionalMark", { /** * Specifies whether or not the optional mark is displayed for optional fields. */ get: function () { return this._getOption('showOptionalMark'); }, set: function (value) { this._setOption('showOptionalMark', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFormComponent.prototype, "showRequiredMark", { /** * Specifies whether or not the required mark is displayed for required fields. */ get: function () { return this._getOption('showRequiredMark'); }, set: function (value) { this._setOption('showRequiredMark', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFormComponent.prototype, "showValidationSummary", { /** * Specifies whether or not the total validation summary is displayed on the form. */ get: function () { return this._getOption('showValidationSummary'); }, set: function (value) { this._setOption('showValidationSummary', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFormComponent.prototype, "tabIndex", { /** * Specifies the number of the element when the Tab key is used for navigating. */ get: function () { return this._getOption('tabIndex'); }, set: function (value) { this._setOption('tabIndex', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFormComponent.prototype, "validationGroup", { /** * Gives a name to the internal validation group. */ get: function () { return this._getOption('validationGroup'); }, set: function (value) { this._setOption('validationGroup', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFormComponent.prototype, "visible", { /** * Specifies whether the widget is visible. */ get: function () { return this._getOption('visible'); }, set: function (value) { this._setOption('visible', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFormComponent.prototype, "width", { /** * Specifies the widget's width. */ get: function () { return this._getOption('width'); }, set: function (value) { this._setOption('width', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFormComponent.prototype, "itemsChildren", { get: function () { return this._getOption('items'); }, set: function (value) { this.setChildren('items', value); }, enumerable: true, configurable: true }); DxFormComponent.prototype._createInstance = function (element, options) { return new form_1.default(element, options); }; DxFormComponent.prototype.ngOnDestroy = function () { this._destroyWidget(); }; DxFormComponent.prototype.ngOnChanges = function (changes) { _super.prototype.ngOnChanges.call(this, changes); this.setupChanges('items', changes); }; DxFormComponent.prototype.setupChanges = function (prop, changes) { if (!(prop in this._optionsToUpdate)) { this._idh.setup(prop, changes); } }; DxFormComponent.prototype.ngDoCheck = function () { this._idh.doCheck('items'); this._watcherHelper.checkWatchers(); _super.prototype.ngDoCheck.call(this); _super.prototype.clearChangedOptions.call(this); }; DxFormComponent.prototype._setOption = function (name, value) { var isSetup = this._idh.setupSingle(name, value); var isChanged = this._idh.getChanges(name, value) !== null; if (isSetup || isChanged) { _super.prototype._setOption.call(this, name, value); } }; DxFormComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dx-form', template: '', providers: [ template_host_1.DxTemplateHost, watcher_helper_1.WatcherHelper, nested_option_1.NestedOptionHost, iterable_differ_helper_1.IterableDifferHelper ] },] }, ]; /** @nocollapse */ DxFormComponent.ctorParameters = function () { return [ { type: core_1.ElementRef, }, { type: core_1.NgZone, }, { type: template_host_1.DxTemplateHost, }, { type: watcher_helper_1.WatcherHelper, }, { type: iterable_differ_helper_1.IterableDifferHelper, }, { type: nested_option_1.NestedOptionHost, }, ]; }; DxFormComponent.propDecorators = { 'accessKey': [{ type: core_1.Input },], 'activeStateEnabled': [{ type: core_1.Input },], 'alignItemLabels': [{ type: core_1.Input },], 'alignItemLabelsInAllGroups': [{ type: core_1.Input },], 'colCount': [{ type: core_1.Input },], 'colCountByScreen': [{ type: core_1.Input },], 'customizeItem': [{ type: core_1.Input },], 'disabled': [{ type: core_1.Input },], 'elementAttr': [{ type: core_1.Input },], 'focusStateEnabled': [{ type: core_1.Input },], 'formData': [{ type: core_1.Input },], 'height': [{ type: core_1.Input },], 'hint': [{ type: core_1.Input },], 'hoverStateEnabled': [{ type: core_1.Input },], 'items': [{ type: core_1.Input },], 'labelLocation': [{ type: core_1.Input },], 'minColWidth': [{ type: core_1.Input },], 'optionalMark': [{ type: core_1.Input },], 'readOnly': [{ type: core_1.Input },], 'requiredMark': [{ type: core_1.Input },], 'requiredMessage': [{ type: core_1.Input },], 'rtlEnabled': [{ type: core_1.Input },], 'screenByWidth': [{ type: core_1.Input },], 'scrollingEnabled': [{ type: core_1.Input },], 'showColonAfterLabel': [{ type: core_1.Input },], 'showOptionalMark': [{ type: core_1.Input },], 'showRequiredMark': [{ type: core_1.Input },], 'showValidationSummary': [{ type: core_1.Input },], 'tabIndex': [{ type: core_1.Input },], 'validationGroup': [{ type: core_1.Input },], 'visible': [{ type: core_1.Input },], 'width': [{ type: core_1.Input },], 'onContentReady': [{ type: core_1.Output },], 'onDisposing': [{ type: core_1.Output },], 'onEditorEnterKey': [{ type: core_1.Output },], 'onFieldDataChanged': [{ type: core_1.Output },], 'onInitialized': [{ type: core_1.Output },], 'onOptionChanged': [{ type: core_1.Output },], 'accessKeyChange': [{ type: core_1.Output },], 'activeStateEnabledChange': [{ type: core_1.Output },], 'alignItemLabelsChange': [{ type: core_1.Output },], 'alignItemLabelsInAllGroupsChange': [{ type: core_1.Output },], 'colCountChange': [{ type: core_1.Output },], 'colCountByScreenChange': [{ type: core_1.Output },], 'customizeItemChange': [{ type: core_1.Output },], 'disabledChange': [{ type: core_1.Output },], 'elementAttrChange': [{ type: core_1.Output },], 'focusStateEnabledChange': [{ type: core_1.Output },], 'formDataChange': [{ type: core_1.Output },], 'heightChange': [{ type: core_1.Output },], 'hintChange': [{ type: core_1.Output },], 'hoverStateEnabledChange': [{ type: core_1.Output },], 'itemsChange': [{ type: core_1.Output },], 'labelLocationChange': [{ type: core_1.Output },], 'minColWidthChange': [{ type: core_1.Output },], 'optionalMarkChange': [{ type: core_1.Output },], 'readOnlyChange': [{ type: core_1.Output },], 'requiredMarkChange': [{ type: core_1.Output },], 'requiredMessageChange': [{ type: core_1.Output },], 'rtlEnabledChange': [{ type: core_1.Output },], 'screenByWidthChange': [{ type: core_1.Output },], 'scrollingEnabledChange': [{ type: core_1.Output },], 'showColonAfterLabelChange': [{ type: core_1.Output },], 'showOptionalMarkChange': [{ type: core_1.Output },], 'showRequiredMarkChange': [{ type: core_1.Output },], 'showValidationSummaryChange': [{ type: core_1.Output },], 'tabIndexChange': [{ type: core_1.Output },], 'validationGroupChange': [{ type: core_1.Output },], 'visibleChange': [{ type: core_1.Output },], 'widthChange': [{ type: core_1.Output },], 'itemsChildren': [{ type: core_1.ContentChildren, args: [item_dxi_2.DxiItemComponent,] },], }; return DxFormComponent; }(component_1.DxComponent)); exports.DxFormComponent = DxFormComponent; var DxFormModule = (function () { function DxFormModule() { } DxFormModule.decorators = [ { type: core_1.NgModule, args: [{ imports: [ col_count_by_screen_1.DxoColCountByScreenModule, item_dxi_1.DxiItemModule, label_1.DxoLabelModule, validation_rule_dxi_1.DxiValidationRuleModule, tab_panel_options_1.DxoTabPanelOptionsModule, tab_dxi_1.DxiTabModule, template_1.DxTemplateModule ], declarations: [ DxFormComponent ], exports: [ DxFormComponent, col_count_by_screen_1.DxoColCountByScreenModule, item_dxi_1.DxiItemModule, label_1.DxoLabelModule, validation_rule_dxi_1.DxiValidationRuleModule, tab_panel_options_1.DxoTabPanelOptionsModule, tab_dxi_1.DxiTabModule, template_1.DxTemplateModule ], },] }, ]; /** @nocollapse */ DxFormModule.ctorParameters = function () { return []; }; return DxFormModule; }()); exports.DxFormModule = DxFormModule; //# sourceMappingURL=form.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/funnel.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var funnel_1 = __webpack_require__("./node_modules/devextreme/viz/funnel.js"); var component_1 = __webpack_require__("./node_modules/devextreme-angular/core/component.js"); var template_host_1 = __webpack_require__("./node_modules/devextreme-angular/core/template-host.js"); var template_1 = __webpack_require__("./node_modules/devextreme-angular/core/template.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var watcher_helper_1 = __webpack_require__("./node_modules/devextreme-angular/core/watcher-helper.js"); var iterable_differ_helper_1 = __webpack_require__("./node_modules/devextreme-angular/core/iterable-differ-helper.js"); var adaptive_layout_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/adaptive-layout.js"); var export_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/export.js"); var item_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/item.js"); var border_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/border.js"); var hover_style_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/hover-style.js"); var hatching_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/hatching.js"); var selection_style_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/selection-style.js"); var label_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/label.js"); var connector_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/connector.js"); var font_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/font.js"); var format_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/format.js"); var legend_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/legend.js"); var margin_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/margin.js"); var loading_indicator_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/loading-indicator.js"); var size_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/size.js"); var title_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/title.js"); var subtitle_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/subtitle.js"); var tooltip_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/tooltip.js"); var shadow_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/shadow.js"); /** * The Funnel is a widget that visualizes a value at different stages. It helps assess value changes throughout these stages and identify potential issues. The Funnel widget conveys information using different interactive elements (tooltips, labels, legend) and enables you to create not only a funnel, but also a pyramid chart. */ var DxFunnelComponent = (function (_super) { __extends(DxFunnelComponent, _super); function DxFunnelComponent(elementRef, ngZone, templateHost, _watcherHelper, _idh, optionHost) { var _this = _super.call(this, elementRef, ngZone, templateHost, _watcherHelper) || this; _this._watcherHelper = _watcherHelper; _this._idh = _idh; _this._createEventEmitters([ { subscribe: 'disposing', emit: 'onDisposing' }, { subscribe: 'drawn', emit: 'onDrawn' }, { subscribe: 'exported', emit: 'onExported' }, { subscribe: 'exporting', emit: 'onExporting' }, { subscribe: 'fileSaving', emit: 'onFileSaving' }, { subscribe: 'hoverChanged', emit: 'onHoverChanged' }, { subscribe: 'incidentOccurred', emit: 'onIncidentOccurred' }, { subscribe: 'initialized', emit: 'onInitialized' }, { subscribe: 'itemClick', emit: 'onItemClick' }, { subscribe: 'legendClick', emit: 'onLegendClick' }, { subscribe: 'optionChanged', emit: 'onOptionChanged' }, { subscribe: 'selectionChanged', emit: 'onSelectionChanged' }, { emit: 'adaptiveLayoutChange' }, { emit: 'algorithmChange' }, { emit: 'argumentFieldChange' }, { emit: 'colorFieldChange' }, { emit: 'dataSourceChange' }, { emit: 'elementAttrChange' }, { emit: 'exportChange' }, { emit: 'hoverEnabledChange' }, { emit: 'invertedChange' }, { emit: 'itemChange' }, { emit: 'labelChange' }, { emit: 'legendChange' }, { emit: 'loadingIndicatorChange' }, { emit: 'marginChange' }, { emit: 'neckHeightChange' }, { emit: 'neckWidthChange' }, { emit: 'paletteChange' }, { emit: 'pathModifiedChange' }, { emit: 'redrawOnResizeChange' }, { emit: 'rtlEnabledChange' }, { emit: 'selectionModeChange' }, { emit: 'sizeChange' }, { emit: 'sortDataChange' }, { emit: 'themeChange' }, { emit: 'titleChange' }, { emit: 'tooltipChange' }, { emit: 'valueFieldChange' } ]); _this._idh.setHost(_this); optionHost.setHost(_this); return _this; } Object.defineProperty(DxFunnelComponent.prototype, "adaptiveLayout", { /** * Specifies adaptive layout options. */ get: function () { return this._getOption('adaptiveLayout'); }, set: function (value) { this._setOption('adaptiveLayout', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFunnelComponent.prototype, "algorithm", { /** * Specifies the algorithm for building the funnel. */ get: function () { return this._getOption('algorithm'); }, set: function (value) { this._setOption('algorithm', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFunnelComponent.prototype, "argumentField", { /** * Specifies which data source field provides arguments for funnel items. The argument identifies a funnel item and represents it on the legend. */ get: function () { return this._getOption('argumentField'); }, set: function (value) { this._setOption('argumentField', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFunnelComponent.prototype, "colorField", { /** * Specifies which data source field provides colors for funnel items. If this field is absent, the palette provides the colors. */ get: function () { return this._getOption('colorField'); }, set: function (value) { this._setOption('colorField', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFunnelComponent.prototype, "dataSource", { /** * Specifies the widget's data origin. */ get: function () { return this._getOption('dataSource'); }, set: function (value) { this._setOption('dataSource', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFunnelComponent.prototype, "elementAttr", { /** * Specifies the attributes to be attached to the widget's root element. */ get: function () { return this._getOption('elementAttr'); }, set: function (value) { this._setOption('elementAttr', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFunnelComponent.prototype, "export", { /** * Configures the exporting and printing features. */ get: function () { return this._getOption('export'); }, set: function (value) { this._setOption('export', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFunnelComponent.prototype, "hoverEnabled", { /** * Specifies whether funnel items change their style when a user pauses on them. */ get: function () { return this._getOption('hoverEnabled'); }, set: function (value) { this._setOption('hoverEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFunnelComponent.prototype, "inverted", { /** * Turns the funnel upside down. */ get: function () { return this._getOption('inverted'); }, set: function (value) { this._setOption('inverted', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFunnelComponent.prototype, "item", { /** * Configures funnel items' appearance. */ get: function () { return this._getOption('item'); }, set: function (value) { this._setOption('item', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFunnelComponent.prototype, "label", { /** * Configures funnel item labels. */ get: function () { return this._getOption('label'); }, set: function (value) { this._setOption('label', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFunnelComponent.prototype, "legend", { /** * Configures the legend. */ get: function () { return this._getOption('legend'); }, set: function (value) { this._setOption('legend', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFunnelComponent.prototype, "loadingIndicator", { /** * Configures the loading indicator. */ get: function () { return this._getOption('loadingIndicator'); }, set: function (value) { this._setOption('loadingIndicator', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFunnelComponent.prototype, "margin", { /** * Generates space around the widget. */ get: function () { return this._getOption('margin'); }, set: function (value) { this._setOption('margin', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFunnelComponent.prototype, "neckHeight", { /** * Specifies the ratio between the height of the neck and that of the whole funnel. Accepts values from 0 to 1. Applies only if the algorithm is "dynamicHeight". */ get: function () { return this._getOption('neckHeight'); }, set: function (value) { this._setOption('neckHeight', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFunnelComponent.prototype, "neckWidth", { /** * Specifies the ratio between the width of the neck and that of the whole funnel. Accepts values from 0 to 1. Applies only if the algorithm is "dynamicHeight". */ get: function () { return this._getOption('neckWidth'); }, set: function (value) { this._setOption('neckWidth', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFunnelComponent.prototype, "palette", { /** * Sets the palette to be used for colorizing funnel items. */ get: function () { return this._getOption('palette'); }, set: function (value) { this._setOption('palette', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFunnelComponent.prototype, "pathModified", { /** * Notifies the widget that it is embedded into an HTML page that uses a tag modifying the path. */ get: function () { return this._getOption('pathModified'); }, set: function (value) { this._setOption('pathModified', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFunnelComponent.prototype, "redrawOnResize", { /** * Specifies whether to redraw the widget when the size of the parent browser window changes or a mobile device rotates. */ get: function () { return this._getOption('redrawOnResize'); }, set: function (value) { this._setOption('redrawOnResize', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFunnelComponent.prototype, "rtlEnabled", { /** * Switches the widget to a right-to-left representation. */ get: function () { return this._getOption('rtlEnabled'); }, set: function (value) { this._setOption('rtlEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFunnelComponent.prototype, "selectionMode", { /** * Specifies whether a single or multiple funnel items can be in the selected state at a time. Assigning "none" disables the selection feature. */ get: function () { return this._getOption('selectionMode'); }, set: function (value) { this._setOption('selectionMode', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFunnelComponent.prototype, "size", { /** * Specifies the widget's size in pixels. */ get: function () { return this._getOption('size'); }, set: function (value) { this._setOption('size', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFunnelComponent.prototype, "sortData", { /** * Specifies whether to sort funnel items. */ get: function () { return this._getOption('sortData'); }, set: function (value) { this._setOption('sortData', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFunnelComponent.prototype, "theme", { /** * Sets the name of the theme the widget uses. */ get: function () { return this._getOption('theme'); }, set: function (value) { this._setOption('theme', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFunnelComponent.prototype, "title", { /** * Configures the widget's title. */ get: function () { return this._getOption('title'); }, set: function (value) { this._setOption('title', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFunnelComponent.prototype, "tooltip", { /** * Configures tooltips - small pop-up rectangles that display information about a data-visualizing widget element being pressed or hovered over with the mouse pointer. */ get: function () { return this._getOption('tooltip'); }, set: function (value) { this._setOption('tooltip', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFunnelComponent.prototype, "valueField", { /** * Specifies which data source field provides values for funnel items. The value defines a funnel item's area. */ get: function () { return this._getOption('valueField'); }, set: function (value) { this._setOption('valueField', value); }, enumerable: true, configurable: true }); DxFunnelComponent.prototype._createInstance = function (element, options) { return new funnel_1.default(element, options); }; DxFunnelComponent.prototype.ngOnDestroy = function () { this._destroyWidget(); }; DxFunnelComponent.prototype.ngOnChanges = function (changes) { _super.prototype.ngOnChanges.call(this, changes); this.setupChanges('dataSource', changes); this.setupChanges('palette', changes); }; DxFunnelComponent.prototype.setupChanges = function (prop, changes) { if (!(prop in this._optionsToUpdate)) { this._idh.setup(prop, changes); } }; DxFunnelComponent.prototype.ngDoCheck = function () { this._idh.doCheck('dataSource'); this._idh.doCheck('palette'); this._watcherHelper.checkWatchers(); _super.prototype.ngDoCheck.call(this); _super.prototype.clearChangedOptions.call(this); }; DxFunnelComponent.prototype._setOption = function (name, value) { var isSetup = this._idh.setupSingle(name, value); var isChanged = this._idh.getChanges(name, value) !== null; if (isSetup || isChanged) { _super.prototype._setOption.call(this, name, value); } }; DxFunnelComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dx-funnel', template: '', styles: [' :host { display: block; }'], providers: [ template_host_1.DxTemplateHost, watcher_helper_1.WatcherHelper, nested_option_1.NestedOptionHost, iterable_differ_helper_1.IterableDifferHelper ] },] }, ]; /** @nocollapse */ DxFunnelComponent.ctorParameters = function () { return [ { type: core_1.ElementRef, }, { type: core_1.NgZone, }, { type: template_host_1.DxTemplateHost, }, { type: watcher_helper_1.WatcherHelper, }, { type: iterable_differ_helper_1.IterableDifferHelper, }, { type: nested_option_1.NestedOptionHost, }, ]; }; DxFunnelComponent.propDecorators = { 'adaptiveLayout': [{ type: core_1.Input },], 'algorithm': [{ type: core_1.Input },], 'argumentField': [{ type: core_1.Input },], 'colorField': [{ type: core_1.Input },], 'dataSource': [{ type: core_1.Input },], 'elementAttr': [{ type: core_1.Input },], 'export': [{ type: core_1.Input },], 'hoverEnabled': [{ type: core_1.Input },], 'inverted': [{ type: core_1.Input },], 'item': [{ type: core_1.Input },], 'label': [{ type: core_1.Input },], 'legend': [{ type: core_1.Input },], 'loadingIndicator': [{ type: core_1.Input },], 'margin': [{ type: core_1.Input },], 'neckHeight': [{ type: core_1.Input },], 'neckWidth': [{ type: core_1.Input },], 'palette': [{ type: core_1.Input },], 'pathModified': [{ type: core_1.Input },], 'redrawOnResize': [{ type: core_1.Input },], 'rtlEnabled': [{ type: core_1.Input },], 'selectionMode': [{ type: core_1.Input },], 'size': [{ type: core_1.Input },], 'sortData': [{ type: core_1.Input },], 'theme': [{ type: core_1.Input },], 'title': [{ type: core_1.Input },], 'tooltip': [{ type: core_1.Input },], 'valueField': [{ type: core_1.Input },], 'onDisposing': [{ type: core_1.Output },], 'onDrawn': [{ type: core_1.Output },], 'onExported': [{ type: core_1.Output },], 'onExporting': [{ type: core_1.Output },], 'onFileSaving': [{ type: core_1.Output },], 'onHoverChanged': [{ type: core_1.Output },], 'onIncidentOccurred': [{ type: core_1.Output },], 'onInitialized': [{ type: core_1.Output },], 'onItemClick': [{ type: core_1.Output },], 'onLegendClick': [{ type: core_1.Output },], 'onOptionChanged': [{ type: core_1.Output },], 'onSelectionChanged': [{ type: core_1.Output },], 'adaptiveLayoutChange': [{ type: core_1.Output },], 'algorithmChange': [{ type: core_1.Output },], 'argumentFieldChange': [{ type: core_1.Output },], 'colorFieldChange': [{ type: core_1.Output },], 'dataSourceChange': [{ type: core_1.Output },], 'elementAttrChange': [{ type: core_1.Output },], 'exportChange': [{ type: core_1.Output },], 'hoverEnabledChange': [{ type: core_1.Output },], 'invertedChange': [{ type: core_1.Output },], 'itemChange': [{ type: core_1.Output },], 'labelChange': [{ type: core_1.Output },], 'legendChange': [{ type: core_1.Output },], 'loadingIndicatorChange': [{ type: core_1.Output },], 'marginChange': [{ type: core_1.Output },], 'neckHeightChange': [{ type: core_1.Output },], 'neckWidthChange': [{ type: core_1.Output },], 'paletteChange': [{ type: core_1.Output },], 'pathModifiedChange': [{ type: core_1.Output },], 'redrawOnResizeChange': [{ type: core_1.Output },], 'rtlEnabledChange': [{ type: core_1.Output },], 'selectionModeChange': [{ type: core_1.Output },], 'sizeChange': [{ type: core_1.Output },], 'sortDataChange': [{ type: core_1.Output },], 'themeChange': [{ type: core_1.Output },], 'titleChange': [{ type: core_1.Output },], 'tooltipChange': [{ type: core_1.Output },], 'valueFieldChange': [{ type: core_1.Output },], }; return DxFunnelComponent; }(component_1.DxComponent)); exports.DxFunnelComponent = DxFunnelComponent; var DxFunnelModule = (function () { function DxFunnelModule() { } DxFunnelModule.decorators = [ { type: core_1.NgModule, args: [{ imports: [ adaptive_layout_1.DxoAdaptiveLayoutModule, export_1.DxoExportModule, item_1.DxoItemModule, border_1.DxoBorderModule, hover_style_1.DxoHoverStyleModule, hatching_1.DxoHatchingModule, selection_style_1.DxoSelectionStyleModule, label_1.DxoLabelModule, connector_1.DxoConnectorModule, font_1.DxoFontModule, format_1.DxoFormatModule, legend_1.DxoLegendModule, margin_1.DxoMarginModule, loading_indicator_1.DxoLoadingIndicatorModule, size_1.DxoSizeModule, title_1.DxoTitleModule, subtitle_1.DxoSubtitleModule, tooltip_1.DxoTooltipModule, shadow_1.DxoShadowModule, template_1.DxTemplateModule ], declarations: [ DxFunnelComponent ], exports: [ DxFunnelComponent, adaptive_layout_1.DxoAdaptiveLayoutModule, export_1.DxoExportModule, item_1.DxoItemModule, border_1.DxoBorderModule, hover_style_1.DxoHoverStyleModule, hatching_1.DxoHatchingModule, selection_style_1.DxoSelectionStyleModule, label_1.DxoLabelModule, connector_1.DxoConnectorModule, font_1.DxoFontModule, format_1.DxoFormatModule, legend_1.DxoLegendModule, margin_1.DxoMarginModule, loading_indicator_1.DxoLoadingIndicatorModule, size_1.DxoSizeModule, title_1.DxoTitleModule, subtitle_1.DxoSubtitleModule, tooltip_1.DxoTooltipModule, shadow_1.DxoShadowModule, template_1.DxTemplateModule ], },] }, ]; /** @nocollapse */ DxFunnelModule.ctorParameters = function () { return []; }; return DxFunnelModule; }()); exports.DxFunnelModule = DxFunnelModule; //# sourceMappingURL=funnel.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/gallery.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var gallery_1 = __webpack_require__("./node_modules/devextreme/ui/gallery.js"); var component_1 = __webpack_require__("./node_modules/devextreme-angular/core/component.js"); var template_host_1 = __webpack_require__("./node_modules/devextreme-angular/core/template-host.js"); var template_1 = __webpack_require__("./node_modules/devextreme-angular/core/template.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var watcher_helper_1 = __webpack_require__("./node_modules/devextreme-angular/core/watcher-helper.js"); var iterable_differ_helper_1 = __webpack_require__("./node_modules/devextreme-angular/core/iterable-differ-helper.js"); var item_dxi_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/item-dxi.js"); var item_dxi_2 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/item-dxi.js"); /** * The Gallery is a widget that displays a collection of images in a carousel. The widget is supplied with various navigation controls that allow a user to switch between images. */ var DxGalleryComponent = (function (_super) { __extends(DxGalleryComponent, _super); function DxGalleryComponent(elementRef, ngZone, templateHost, _watcherHelper, _idh, optionHost) { var _this = _super.call(this, elementRef, ngZone, templateHost, _watcherHelper) || this; _this._watcherHelper = _watcherHelper; _this._idh = _idh; _this._createEventEmitters([ { subscribe: 'contentReady', emit: 'onContentReady' }, { subscribe: 'disposing', emit: 'onDisposing' }, { subscribe: 'initialized', emit: 'onInitialized' }, { subscribe: 'itemClick', emit: 'onItemClick' }, { subscribe: 'itemContextMenu', emit: 'onItemContextMenu' }, { subscribe: 'itemHold', emit: 'onItemHold' }, { subscribe: 'itemRendered', emit: 'onItemRendered' }, { subscribe: 'optionChanged', emit: 'onOptionChanged' }, { subscribe: 'selectionChanged', emit: 'onSelectionChanged' }, { emit: 'accessKeyChange' }, { emit: 'animationDurationChange' }, { emit: 'animationEnabledChange' }, { emit: 'dataSourceChange' }, { emit: 'disabledChange' }, { emit: 'elementAttrChange' }, { emit: 'focusStateEnabledChange' }, { emit: 'heightChange' }, { emit: 'hintChange' }, { emit: 'hoverStateEnabledChange' }, { emit: 'indicatorEnabledChange' }, { emit: 'initialItemWidthChange' }, { emit: 'itemHoldTimeoutChange' }, { emit: 'itemsChange' }, { emit: 'itemTemplateChange' }, { emit: 'loopChange' }, { emit: 'rtlEnabledChange' }, { emit: 'selectedIndexChange' }, { emit: 'selectedItemChange' }, { emit: 'showIndicatorChange' }, { emit: 'showNavButtonsChange' }, { emit: 'slideshowDelayChange' }, { emit: 'stretchImagesChange' }, { emit: 'swipeEnabledChange' }, { emit: 'tabIndexChange' }, { emit: 'visibleChange' }, { emit: 'widthChange' }, { emit: 'wrapAroundChange' } ]); _this._idh.setHost(_this); optionHost.setHost(_this); return _this; } Object.defineProperty(DxGalleryComponent.prototype, "accessKey", { /** * Specifies the shortcut key that sets focus on the widget. */ get: function () { return this._getOption('accessKey'); }, set: function (value) { this._setOption('accessKey', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxGalleryComponent.prototype, "animationDuration", { /** * The time, in milliseconds, spent on slide animation. */ get: function () { return this._getOption('animationDuration'); }, set: function (value) { this._setOption('animationDuration', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxGalleryComponent.prototype, "animationEnabled", { /** * Specifies whether or not to animate the displayed item change. */ get: function () { return this._getOption('animationEnabled'); }, set: function (value) { this._setOption('animationEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxGalleryComponent.prototype, "dataSource", { /** * A data source used to fetch data to be displayed by the widget. */ get: function () { return this._getOption('dataSource'); }, set: function (value) { this._setOption('dataSource', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxGalleryComponent.prototype, "disabled", { /** * Specifies whether the widget responds to user interaction. */ get: function () { return this._getOption('disabled'); }, set: function (value) { this._setOption('disabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxGalleryComponent.prototype, "elementAttr", { /** * Specifies the attributes to be attached to the widget's root element. */ get: function () { return this._getOption('elementAttr'); }, set: function (value) { this._setOption('elementAttr', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxGalleryComponent.prototype, "focusStateEnabled", { /** * Specifies whether the widget can be focused using keyboard navigation. */ get: function () { return this._getOption('focusStateEnabled'); }, set: function (value) { this._setOption('focusStateEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxGalleryComponent.prototype, "height", { /** * Specifies the widget's height. */ get: function () { return this._getOption('height'); }, set: function (value) { this._setOption('height', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxGalleryComponent.prototype, "hint", { /** * Specifies text for a hint that appears when a user pauses on the widget. */ get: function () { return this._getOption('hint'); }, set: function (value) { this._setOption('hint', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxGalleryComponent.prototype, "hoverStateEnabled", { /** * Specifies whether the widget changes its state when a user pauses on it. */ get: function () { return this._getOption('hoverStateEnabled'); }, set: function (value) { this._setOption('hoverStateEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxGalleryComponent.prototype, "indicatorEnabled", { /** * A Boolean value specifying whether or not to allow users to switch between items by clicking an indicator. */ get: function () { return this._getOption('indicatorEnabled'); }, set: function (value) { this._setOption('indicatorEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxGalleryComponent.prototype, "initialItemWidth", { /** * Specifies the width of an area used to display a single image. */ get: function () { return this._getOption('initialItemWidth'); }, set: function (value) { this._setOption('initialItemWidth', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxGalleryComponent.prototype, "itemHoldTimeout", { /** * The time period in milliseconds before the onItemHold event is raised. */ get: function () { return this._getOption('itemHoldTimeout'); }, set: function (value) { this._setOption('itemHoldTimeout', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxGalleryComponent.prototype, "items", { /** * An array of items displayed by the widget. */ get: function () { return this._getOption('items'); }, set: function (value) { this._setOption('items', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxGalleryComponent.prototype, "itemTemplate", { /** * Specifies a custom template for items. */ get: function () { return this._getOption('itemTemplate'); }, set: function (value) { this._setOption('itemTemplate', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxGalleryComponent.prototype, "loop", { /** * A Boolean value specifying whether or not to scroll back to the first item after the last item is swiped. */ get: function () { return this._getOption('loop'); }, set: function (value) { this._setOption('loop', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxGalleryComponent.prototype, "rtlEnabled", { /** * Switches the widget to a right-to-left representation. */ get: function () { return this._getOption('rtlEnabled'); }, set: function (value) { this._setOption('rtlEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxGalleryComponent.prototype, "selectedIndex", { /** * The index of the currently active gallery item. */ get: function () { return this._getOption('selectedIndex'); }, set: function (value) { this._setOption('selectedIndex', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxGalleryComponent.prototype, "selectedItem", { /** * The selected item object. */ get: function () { return this._getOption('selectedItem'); }, set: function (value) { this._setOption('selectedItem', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxGalleryComponent.prototype, "showIndicator", { /** * A Boolean value specifying whether or not to display an indicator that points to the selected gallery item. */ get: function () { return this._getOption('showIndicator'); }, set: function (value) { this._setOption('showIndicator', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxGalleryComponent.prototype, "showNavButtons", { /** * A Boolean value that specifies the availability of the "Forward" and "Back" navigation buttons. */ get: function () { return this._getOption('showNavButtons'); }, set: function (value) { this._setOption('showNavButtons', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxGalleryComponent.prototype, "slideshowDelay", { /** * The time interval in milliseconds, after which the gallery switches to the next item. */ get: function () { return this._getOption('slideshowDelay'); }, set: function (value) { this._setOption('slideshowDelay', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxGalleryComponent.prototype, "stretchImages", { /** * Specifies if the widget stretches images to fit the total gallery width. */ get: function () { return this._getOption('stretchImages'); }, set: function (value) { this._setOption('stretchImages', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxGalleryComponent.prototype, "swipeEnabled", { /** * A Boolean value specifying whether or not to allow users to switch between items by swiping. */ get: function () { return this._getOption('swipeEnabled'); }, set: function (value) { this._setOption('swipeEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxGalleryComponent.prototype, "tabIndex", { /** * Specifies the number of the element when the Tab key is used for navigating. */ get: function () { return this._getOption('tabIndex'); }, set: function (value) { this._setOption('tabIndex', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxGalleryComponent.prototype, "visible", { /** * Specifies whether the widget is visible. */ get: function () { return this._getOption('visible'); }, set: function (value) { this._setOption('visible', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxGalleryComponent.prototype, "width", { /** * Specifies the widget's width. */ get: function () { return this._getOption('width'); }, set: function (value) { this._setOption('width', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxGalleryComponent.prototype, "wrapAround", { /** * Specifies whether or not to display parts of previous and next images along the sides of the current image. */ get: function () { return this._getOption('wrapAround'); }, set: function (value) { this._setOption('wrapAround', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxGalleryComponent.prototype, "itemsChildren", { get: function () { return this._getOption('items'); }, set: function (value) { this.setChildren('items', value); }, enumerable: true, configurable: true }); DxGalleryComponent.prototype._createInstance = function (element, options) { return new gallery_1.default(element, options); }; DxGalleryComponent.prototype.ngOnDestroy = function () { this._destroyWidget(); }; DxGalleryComponent.prototype.ngOnChanges = function (changes) { _super.prototype.ngOnChanges.call(this, changes); this.setupChanges('dataSource', changes); this.setupChanges('items', changes); }; DxGalleryComponent.prototype.setupChanges = function (prop, changes) { if (!(prop in this._optionsToUpdate)) { this._idh.setup(prop, changes); } }; DxGalleryComponent.prototype.ngDoCheck = function () { this._idh.doCheck('dataSource'); this._idh.doCheck('items'); this._watcherHelper.checkWatchers(); _super.prototype.ngDoCheck.call(this); _super.prototype.clearChangedOptions.call(this); }; DxGalleryComponent.prototype._setOption = function (name, value) { var isSetup = this._idh.setupSingle(name, value); var isChanged = this._idh.getChanges(name, value) !== null; if (isSetup || isChanged) { _super.prototype._setOption.call(this, name, value); } }; DxGalleryComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dx-gallery', template: '', providers: [ template_host_1.DxTemplateHost, watcher_helper_1.WatcherHelper, nested_option_1.NestedOptionHost, iterable_differ_helper_1.IterableDifferHelper ] },] }, ]; /** @nocollapse */ DxGalleryComponent.ctorParameters = function () { return [ { type: core_1.ElementRef, }, { type: core_1.NgZone, }, { type: template_host_1.DxTemplateHost, }, { type: watcher_helper_1.WatcherHelper, }, { type: iterable_differ_helper_1.IterableDifferHelper, }, { type: nested_option_1.NestedOptionHost, }, ]; }; DxGalleryComponent.propDecorators = { 'accessKey': [{ type: core_1.Input },], 'animationDuration': [{ type: core_1.Input },], 'animationEnabled': [{ type: core_1.Input },], 'dataSource': [{ type: core_1.Input },], 'disabled': [{ type: core_1.Input },], 'elementAttr': [{ type: core_1.Input },], 'focusStateEnabled': [{ type: core_1.Input },], 'height': [{ type: core_1.Input },], 'hint': [{ type: core_1.Input },], 'hoverStateEnabled': [{ type: core_1.Input },], 'indicatorEnabled': [{ type: core_1.Input },], 'initialItemWidth': [{ type: core_1.Input },], 'itemHoldTimeout': [{ type: core_1.Input },], 'items': [{ type: core_1.Input },], 'itemTemplate': [{ type: core_1.Input },], 'loop': [{ type: core_1.Input },], 'rtlEnabled': [{ type: core_1.Input },], 'selectedIndex': [{ type: core_1.Input },], 'selectedItem': [{ type: core_1.Input },], 'showIndicator': [{ type: core_1.Input },], 'showNavButtons': [{ type: core_1.Input },], 'slideshowDelay': [{ type: core_1.Input },], 'stretchImages': [{ type: core_1.Input },], 'swipeEnabled': [{ type: core_1.Input },], 'tabIndex': [{ type: core_1.Input },], 'visible': [{ type: core_1.Input },], 'width': [{ type: core_1.Input },], 'wrapAround': [{ type: core_1.Input },], 'onContentReady': [{ type: core_1.Output },], 'onDisposing': [{ type: core_1.Output },], 'onInitialized': [{ type: core_1.Output },], 'onItemClick': [{ type: core_1.Output },], 'onItemContextMenu': [{ type: core_1.Output },], 'onItemHold': [{ type: core_1.Output },], 'onItemRendered': [{ type: core_1.Output },], 'onOptionChanged': [{ type: core_1.Output },], 'onSelectionChanged': [{ type: core_1.Output },], 'accessKeyChange': [{ type: core_1.Output },], 'animationDurationChange': [{ type: core_1.Output },], 'animationEnabledChange': [{ type: core_1.Output },], 'dataSourceChange': [{ type: core_1.Output },], 'disabledChange': [{ type: core_1.Output },], 'elementAttrChange': [{ type: core_1.Output },], 'focusStateEnabledChange': [{ type: core_1.Output },], 'heightChange': [{ type: core_1.Output },], 'hintChange': [{ type: core_1.Output },], 'hoverStateEnabledChange': [{ type: core_1.Output },], 'indicatorEnabledChange': [{ type: core_1.Output },], 'initialItemWidthChange': [{ type: core_1.Output },], 'itemHoldTimeoutChange': [{ type: core_1.Output },], 'itemsChange': [{ type: core_1.Output },], 'itemTemplateChange': [{ type: core_1.Output },], 'loopChange': [{ type: core_1.Output },], 'rtlEnabledChange': [{ type: core_1.Output },], 'selectedIndexChange': [{ type: core_1.Output },], 'selectedItemChange': [{ type: core_1.Output },], 'showIndicatorChange': [{ type: core_1.Output },], 'showNavButtonsChange': [{ type: core_1.Output },], 'slideshowDelayChange': [{ type: core_1.Output },], 'stretchImagesChange': [{ type: core_1.Output },], 'swipeEnabledChange': [{ type: core_1.Output },], 'tabIndexChange': [{ type: core_1.Output },], 'visibleChange': [{ type: core_1.Output },], 'widthChange': [{ type: core_1.Output },], 'wrapAroundChange': [{ type: core_1.Output },], 'itemsChildren': [{ type: core_1.ContentChildren, args: [item_dxi_2.DxiItemComponent,] },], }; return DxGalleryComponent; }(component_1.DxComponent)); exports.DxGalleryComponent = DxGalleryComponent; var DxGalleryModule = (function () { function DxGalleryModule() { } DxGalleryModule.decorators = [ { type: core_1.NgModule, args: [{ imports: [ item_dxi_1.DxiItemModule, template_1.DxTemplateModule ], declarations: [ DxGalleryComponent ], exports: [ DxGalleryComponent, item_dxi_1.DxiItemModule, template_1.DxTemplateModule ], },] }, ]; /** @nocollapse */ DxGalleryModule.ctorParameters = function () { return []; }; return DxGalleryModule; }()); exports.DxGalleryModule = DxGalleryModule; //# sourceMappingURL=gallery.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/linear-gauge.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var linear_gauge_1 = __webpack_require__("./node_modules/devextreme/viz/linear_gauge.js"); var component_1 = __webpack_require__("./node_modules/devextreme-angular/core/component.js"); var template_host_1 = __webpack_require__("./node_modules/devextreme-angular/core/template-host.js"); var template_1 = __webpack_require__("./node_modules/devextreme-angular/core/template.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var watcher_helper_1 = __webpack_require__("./node_modules/devextreme-angular/core/watcher-helper.js"); var iterable_differ_helper_1 = __webpack_require__("./node_modules/devextreme-angular/core/iterable-differ-helper.js"); var animation_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/animation.js"); var export_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/export.js"); var geometry_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/geometry.js"); var loading_indicator_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/loading-indicator.js"); var font_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/font.js"); var margin_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/margin.js"); var range_container_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/range-container.js"); var range_dxi_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/range-dxi.js"); var width_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/width.js"); var scale_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/scale.js"); var label_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/label.js"); var format_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/format.js"); var overlapping_behavior_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/overlapping-behavior.js"); var major_tick_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/major-tick.js"); var minor_tick_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/minor-tick.js"); var tick_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/tick.js"); var size_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/size.js"); var subtitle_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/subtitle.js"); var subvalue_indicator_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/subvalue-indicator.js"); var text_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/text.js"); var title_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/title.js"); var tooltip_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/tooltip.js"); var border_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/border.js"); var shadow_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/shadow.js"); var value_indicator_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/value-indicator.js"); /** * The LinearGauge is a widget that indicates values on a linear numeric scale. */ var DxLinearGaugeComponent = (function (_super) { __extends(DxLinearGaugeComponent, _super); function DxLinearGaugeComponent(elementRef, ngZone, templateHost, _watcherHelper, _idh, optionHost) { var _this = _super.call(this, elementRef, ngZone, templateHost, _watcherHelper) || this; _this._watcherHelper = _watcherHelper; _this._idh = _idh; _this._createEventEmitters([ { subscribe: 'disposing', emit: 'onDisposing' }, { subscribe: 'drawn', emit: 'onDrawn' }, { subscribe: 'exported', emit: 'onExported' }, { subscribe: 'exporting', emit: 'onExporting' }, { subscribe: 'fileSaving', emit: 'onFileSaving' }, { subscribe: 'incidentOccurred', emit: 'onIncidentOccurred' }, { subscribe: 'initialized', emit: 'onInitialized' }, { subscribe: 'optionChanged', emit: 'onOptionChanged' }, { subscribe: 'tooltipHidden', emit: 'onTooltipHidden' }, { subscribe: 'tooltipShown', emit: 'onTooltipShown' }, { emit: 'animationChange' }, { emit: 'containerBackgroundColorChange' }, { emit: 'elementAttrChange' }, { emit: 'exportChange' }, { emit: 'geometryChange' }, { emit: 'loadingIndicatorChange' }, { emit: 'marginChange' }, { emit: 'pathModifiedChange' }, { emit: 'rangeContainerChange' }, { emit: 'redrawOnResizeChange' }, { emit: 'rtlEnabledChange' }, { emit: 'scaleChange' }, { emit: 'sizeChange' }, { emit: 'subtitleChange' }, { emit: 'subvalueIndicatorChange' }, { emit: 'subvaluesChange' }, { emit: 'themeChange' }, { emit: 'titleChange' }, { emit: 'tooltipChange' }, { emit: 'valueChange' }, { emit: 'valueIndicatorChange' } ]); _this._idh.setHost(_this); optionHost.setHost(_this); return _this; } Object.defineProperty(DxLinearGaugeComponent.prototype, "animation", { /** * Specifies animation options. */ get: function () { return this._getOption('animation'); }, set: function (value) { this._setOption('animation', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLinearGaugeComponent.prototype, "containerBackgroundColor", { /** * Specifies the color of the parent page element. */ get: function () { return this._getOption('containerBackgroundColor'); }, set: function (value) { this._setOption('containerBackgroundColor', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLinearGaugeComponent.prototype, "elementAttr", { /** * Specifies the attributes to be attached to the widget's root element. */ get: function () { return this._getOption('elementAttr'); }, set: function (value) { this._setOption('elementAttr', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLinearGaugeComponent.prototype, "export", { /** * Configures the exporting and printing features. */ get: function () { return this._getOption('export'); }, set: function (value) { this._setOption('export', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLinearGaugeComponent.prototype, "geometry", { /** * Specifies the options required to set the geometry of the LinearGauge widget. */ get: function () { return this._getOption('geometry'); }, set: function (value) { this._setOption('geometry', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLinearGaugeComponent.prototype, "loadingIndicator", { /** * Configures the loading indicator. */ get: function () { return this._getOption('loadingIndicator'); }, set: function (value) { this._setOption('loadingIndicator', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLinearGaugeComponent.prototype, "margin", { /** * Generates space around the widget. */ get: function () { return this._getOption('margin'); }, set: function (value) { this._setOption('margin', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLinearGaugeComponent.prototype, "pathModified", { /** * Notifies the widget that it is embedded into an HTML page that uses a tag modifying the path. */ get: function () { return this._getOption('pathModified'); }, set: function (value) { this._setOption('pathModified', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLinearGaugeComponent.prototype, "rangeContainer", { /** * Specifies gauge range container options. */ get: function () { return this._getOption('rangeContainer'); }, set: function (value) { this._setOption('rangeContainer', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLinearGaugeComponent.prototype, "redrawOnResize", { /** * Specifies whether to redraw the widget when the size of the parent browser window changes or a mobile device rotates. */ get: function () { return this._getOption('redrawOnResize'); }, set: function (value) { this._setOption('redrawOnResize', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLinearGaugeComponent.prototype, "rtlEnabled", { /** * Switches the widget to a right-to-left representation. */ get: function () { return this._getOption('rtlEnabled'); }, set: function (value) { this._setOption('rtlEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLinearGaugeComponent.prototype, "scale", { /** * Specifies the gauge's scale options. */ get: function () { return this._getOption('scale'); }, set: function (value) { this._setOption('scale', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLinearGaugeComponent.prototype, "size", { /** * Specifies the widget's size in pixels. */ get: function () { return this._getOption('size'); }, set: function (value) { this._setOption('size', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLinearGaugeComponent.prototype, "subtitle", { /** * Use the title.subtitle option instead. */ get: function () { return this._getOption('subtitle'); }, set: function (value) { this._setOption('subtitle', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLinearGaugeComponent.prototype, "subvalueIndicator", { /** * Specifies the appearance options of subvalue indicators. */ get: function () { return this._getOption('subvalueIndicator'); }, set: function (value) { this._setOption('subvalueIndicator', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLinearGaugeComponent.prototype, "subvalues", { /** * Specifies a set of subvalues to be designated by the subvalue indicators. */ get: function () { return this._getOption('subvalues'); }, set: function (value) { this._setOption('subvalues', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLinearGaugeComponent.prototype, "theme", { /** * Sets the name of the theme the widget uses. */ get: function () { return this._getOption('theme'); }, set: function (value) { this._setOption('theme', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLinearGaugeComponent.prototype, "title", { /** * Configures the widget's title. */ get: function () { return this._getOption('title'); }, set: function (value) { this._setOption('title', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLinearGaugeComponent.prototype, "tooltip", { /** * Configures tooltips. */ get: function () { return this._getOption('tooltip'); }, set: function (value) { this._setOption('tooltip', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLinearGaugeComponent.prototype, "value", { /** * Specifies the main value on a gauge. */ get: function () { return this._getOption('value'); }, set: function (value) { this._setOption('value', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLinearGaugeComponent.prototype, "valueIndicator", { /** * Specifies the appearance options of the value indicator. */ get: function () { return this._getOption('valueIndicator'); }, set: function (value) { this._setOption('valueIndicator', value); }, enumerable: true, configurable: true }); DxLinearGaugeComponent.prototype._createInstance = function (element, options) { return new linear_gauge_1.default(element, options); }; DxLinearGaugeComponent.prototype.ngOnDestroy = function () { this._destroyWidget(); }; DxLinearGaugeComponent.prototype.ngOnChanges = function (changes) { _super.prototype.ngOnChanges.call(this, changes); this.setupChanges('subvalues', changes); }; DxLinearGaugeComponent.prototype.setupChanges = function (prop, changes) { if (!(prop in this._optionsToUpdate)) { this._idh.setup(prop, changes); } }; DxLinearGaugeComponent.prototype.ngDoCheck = function () { this._idh.doCheck('subvalues'); this._watcherHelper.checkWatchers(); _super.prototype.ngDoCheck.call(this); _super.prototype.clearChangedOptions.call(this); }; DxLinearGaugeComponent.prototype._setOption = function (name, value) { var isSetup = this._idh.setupSingle(name, value); var isChanged = this._idh.getChanges(name, value) !== null; if (isSetup || isChanged) { _super.prototype._setOption.call(this, name, value); } }; DxLinearGaugeComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dx-linear-gauge', template: '', styles: [' :host { display: block; }'], providers: [ template_host_1.DxTemplateHost, watcher_helper_1.WatcherHelper, nested_option_1.NestedOptionHost, iterable_differ_helper_1.IterableDifferHelper ] },] }, ]; /** @nocollapse */ DxLinearGaugeComponent.ctorParameters = function () { return [ { type: core_1.ElementRef, }, { type: core_1.NgZone, }, { type: template_host_1.DxTemplateHost, }, { type: watcher_helper_1.WatcherHelper, }, { type: iterable_differ_helper_1.IterableDifferHelper, }, { type: nested_option_1.NestedOptionHost, }, ]; }; DxLinearGaugeComponent.propDecorators = { 'animation': [{ type: core_1.Input },], 'containerBackgroundColor': [{ type: core_1.Input },], 'elementAttr': [{ type: core_1.Input },], 'export': [{ type: core_1.Input },], 'geometry': [{ type: core_1.Input },], 'loadingIndicator': [{ type: core_1.Input },], 'margin': [{ type: core_1.Input },], 'pathModified': [{ type: core_1.Input },], 'rangeContainer': [{ type: core_1.Input },], 'redrawOnResize': [{ type: core_1.Input },], 'rtlEnabled': [{ type: core_1.Input },], 'scale': [{ type: core_1.Input },], 'size': [{ type: core_1.Input },], 'subtitle': [{ type: core_1.Input },], 'subvalueIndicator': [{ type: core_1.Input },], 'subvalues': [{ type: core_1.Input },], 'theme': [{ type: core_1.Input },], 'title': [{ type: core_1.Input },], 'tooltip': [{ type: core_1.Input },], 'value': [{ type: core_1.Input },], 'valueIndicator': [{ type: core_1.Input },], 'onDisposing': [{ type: core_1.Output },], 'onDrawn': [{ type: core_1.Output },], 'onExported': [{ type: core_1.Output },], 'onExporting': [{ type: core_1.Output },], 'onFileSaving': [{ type: core_1.Output },], 'onIncidentOccurred': [{ type: core_1.Output },], 'onInitialized': [{ type: core_1.Output },], 'onOptionChanged': [{ type: core_1.Output },], 'onTooltipHidden': [{ type: core_1.Output },], 'onTooltipShown': [{ type: core_1.Output },], 'animationChange': [{ type: core_1.Output },], 'containerBackgroundColorChange': [{ type: core_1.Output },], 'elementAttrChange': [{ type: core_1.Output },], 'exportChange': [{ type: core_1.Output },], 'geometryChange': [{ type: core_1.Output },], 'loadingIndicatorChange': [{ type: core_1.Output },], 'marginChange': [{ type: core_1.Output },], 'pathModifiedChange': [{ type: core_1.Output },], 'rangeContainerChange': [{ type: core_1.Output },], 'redrawOnResizeChange': [{ type: core_1.Output },], 'rtlEnabledChange': [{ type: core_1.Output },], 'scaleChange': [{ type: core_1.Output },], 'sizeChange': [{ type: core_1.Output },], 'subtitleChange': [{ type: core_1.Output },], 'subvalueIndicatorChange': [{ type: core_1.Output },], 'subvaluesChange': [{ type: core_1.Output },], 'themeChange': [{ type: core_1.Output },], 'titleChange': [{ type: core_1.Output },], 'tooltipChange': [{ type: core_1.Output },], 'valueChange': [{ type: core_1.Output },], 'valueIndicatorChange': [{ type: core_1.Output },], }; return DxLinearGaugeComponent; }(component_1.DxComponent)); exports.DxLinearGaugeComponent = DxLinearGaugeComponent; var DxLinearGaugeModule = (function () { function DxLinearGaugeModule() { } DxLinearGaugeModule.decorators = [ { type: core_1.NgModule, args: [{ imports: [ animation_1.DxoAnimationModule, export_1.DxoExportModule, geometry_1.DxoGeometryModule, loading_indicator_1.DxoLoadingIndicatorModule, font_1.DxoFontModule, margin_1.DxoMarginModule, range_container_1.DxoRangeContainerModule, range_dxi_1.DxiRangeModule, width_1.DxoWidthModule, scale_1.DxoScaleModule, label_1.DxoLabelModule, format_1.DxoFormatModule, overlapping_behavior_1.DxoOverlappingBehaviorModule, major_tick_1.DxoMajorTickModule, minor_tick_1.DxoMinorTickModule, tick_1.DxoTickModule, size_1.DxoSizeModule, subtitle_1.DxoSubtitleModule, subvalue_indicator_1.DxoSubvalueIndicatorModule, text_1.DxoTextModule, title_1.DxoTitleModule, tooltip_1.DxoTooltipModule, border_1.DxoBorderModule, shadow_1.DxoShadowModule, value_indicator_1.DxoValueIndicatorModule, template_1.DxTemplateModule ], declarations: [ DxLinearGaugeComponent ], exports: [ DxLinearGaugeComponent, animation_1.DxoAnimationModule, export_1.DxoExportModule, geometry_1.DxoGeometryModule, loading_indicator_1.DxoLoadingIndicatorModule, font_1.DxoFontModule, margin_1.DxoMarginModule, range_container_1.DxoRangeContainerModule, range_dxi_1.DxiRangeModule, width_1.DxoWidthModule, scale_1.DxoScaleModule, label_1.DxoLabelModule, format_1.DxoFormatModule, overlapping_behavior_1.DxoOverlappingBehaviorModule, major_tick_1.DxoMajorTickModule, minor_tick_1.DxoMinorTickModule, tick_1.DxoTickModule, size_1.DxoSizeModule, subtitle_1.DxoSubtitleModule, subvalue_indicator_1.DxoSubvalueIndicatorModule, text_1.DxoTextModule, title_1.DxoTitleModule, tooltip_1.DxoTooltipModule, border_1.DxoBorderModule, shadow_1.DxoShadowModule, value_indicator_1.DxoValueIndicatorModule, template_1.DxTemplateModule ], },] }, ]; /** @nocollapse */ DxLinearGaugeModule.ctorParameters = function () { return []; }; return DxLinearGaugeModule; }()); exports.DxLinearGaugeModule = DxLinearGaugeModule; //# sourceMappingURL=linear-gauge.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/list.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var list_1 = __webpack_require__("./node_modules/devextreme/ui/list.js"); var component_1 = __webpack_require__("./node_modules/devextreme-angular/core/component.js"); var template_host_1 = __webpack_require__("./node_modules/devextreme-angular/core/template-host.js"); var template_1 = __webpack_require__("./node_modules/devextreme-angular/core/template.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var watcher_helper_1 = __webpack_require__("./node_modules/devextreme-angular/core/watcher-helper.js"); var iterable_differ_helper_1 = __webpack_require__("./node_modules/devextreme-angular/core/iterable-differ-helper.js"); var item_dxi_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/item-dxi.js"); var menu_item_dxi_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/menu-item-dxi.js"); var search_editor_options_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/search-editor-options.js"); var item_dxi_2 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/item-dxi.js"); var menu_item_dxi_2 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/menu-item-dxi.js"); /** * The List is a widget that represents a collection of items in a scrollable list. */ var DxListComponent = (function (_super) { __extends(DxListComponent, _super); function DxListComponent(elementRef, ngZone, templateHost, _watcherHelper, _idh, optionHost) { var _this = _super.call(this, elementRef, ngZone, templateHost, _watcherHelper) || this; _this._watcherHelper = _watcherHelper; _this._idh = _idh; _this._createEventEmitters([ { subscribe: 'contentReady', emit: 'onContentReady' }, { subscribe: 'disposing', emit: 'onDisposing' }, { subscribe: 'groupRendered', emit: 'onGroupRendered' }, { subscribe: 'initialized', emit: 'onInitialized' }, { subscribe: 'itemClick', emit: 'onItemClick' }, { subscribe: 'itemContextMenu', emit: 'onItemContextMenu' }, { subscribe: 'itemDeleted', emit: 'onItemDeleted' }, { subscribe: 'itemDeleting', emit: 'onItemDeleting' }, { subscribe: 'itemHold', emit: 'onItemHold' }, { subscribe: 'itemRendered', emit: 'onItemRendered' }, { subscribe: 'itemReordered', emit: 'onItemReordered' }, { subscribe: 'itemSwipe', emit: 'onItemSwipe' }, { subscribe: 'optionChanged', emit: 'onOptionChanged' }, { subscribe: 'pageLoading', emit: 'onPageLoading' }, { subscribe: 'pullRefresh', emit: 'onPullRefresh' }, { subscribe: 'scroll', emit: 'onScroll' }, { subscribe: 'selectAllValueChanged', emit: 'onSelectAllValueChanged' }, { subscribe: 'selectionChanged', emit: 'onSelectionChanged' }, { emit: 'accessKeyChange' }, { emit: 'activeStateEnabledChange' }, { emit: 'allowItemDeletingChange' }, { emit: 'allowItemReorderingChange' }, { emit: 'autoPagingEnabledChange' }, { emit: 'bounceEnabledChange' }, { emit: 'collapsibleGroupsChange' }, { emit: 'dataSourceChange' }, { emit: 'disabledChange' }, { emit: 'elementAttrChange' }, { emit: 'focusStateEnabledChange' }, { emit: 'groupedChange' }, { emit: 'groupTemplateChange' }, { emit: 'heightChange' }, { emit: 'hintChange' }, { emit: 'hoverStateEnabledChange' }, { emit: 'indicateLoadingChange' }, { emit: 'itemDeleteModeChange' }, { emit: 'itemHoldTimeoutChange' }, { emit: 'itemsChange' }, { emit: 'itemTemplateChange' }, { emit: 'keyExprChange' }, { emit: 'menuItemsChange' }, { emit: 'menuModeChange' }, { emit: 'nextButtonTextChange' }, { emit: 'noDataTextChange' }, { emit: 'pageLoadingTextChange' }, { emit: 'pageLoadModeChange' }, { emit: 'pulledDownTextChange' }, { emit: 'pullingDownTextChange' }, { emit: 'pullRefreshEnabledChange' }, { emit: 'refreshingTextChange' }, { emit: 'rtlEnabledChange' }, { emit: 'scrollByContentChange' }, { emit: 'scrollByThumbChange' }, { emit: 'scrollingEnabledChange' }, { emit: 'searchEditorOptionsChange' }, { emit: 'searchEnabledChange' }, { emit: 'searchExprChange' }, { emit: 'searchModeChange' }, { emit: 'searchTimeoutChange' }, { emit: 'searchValueChange' }, { emit: 'selectAllModeChange' }, { emit: 'selectedItemKeysChange' }, { emit: 'selectedItemsChange' }, { emit: 'selectionModeChange' }, { emit: 'showNextButtonChange' }, { emit: 'showScrollbarChange' }, { emit: 'showSelectionControlsChange' }, { emit: 'tabIndexChange' }, { emit: 'useNativeScrollingChange' }, { emit: 'visibleChange' }, { emit: 'widthChange' } ]); _this._idh.setHost(_this); optionHost.setHost(_this); return _this; } Object.defineProperty(DxListComponent.prototype, "accessKey", { /** * Specifies the shortcut key that sets focus on the widget. */ get: function () { return this._getOption('accessKey'); }, set: function (value) { this._setOption('accessKey', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxListComponent.prototype, "activeStateEnabled", { /** * Specifies whether or not the widget changes its state when interacting with a user. */ get: function () { return this._getOption('activeStateEnabled'); }, set: function (value) { this._setOption('activeStateEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxListComponent.prototype, "allowItemDeleting", { /** * Specifies whether or not an end user can delete list items. */ get: function () { return this._getOption('allowItemDeleting'); }, set: function (value) { this._setOption('allowItemDeleting', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxListComponent.prototype, "allowItemReordering", { /** * Specifies whether or not an end user can reorder list items. */ get: function () { return this._getOption('allowItemReordering'); }, set: function (value) { this._setOption('allowItemReordering', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxListComponent.prototype, "autoPagingEnabled", { /** * Use the pageLoadMode option instead. */ get: function () { return this._getOption('autoPagingEnabled'); }, set: function (value) { this._setOption('autoPagingEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxListComponent.prototype, "bounceEnabled", { /** * A Boolean value specifying whether to enable or disable the bounce-back effect. */ get: function () { return this._getOption('bounceEnabled'); }, set: function (value) { this._setOption('bounceEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxListComponent.prototype, "collapsibleGroups", { /** * Specifies whether or not an end-user can collapse groups. */ get: function () { return this._getOption('collapsibleGroups'); }, set: function (value) { this._setOption('collapsibleGroups', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxListComponent.prototype, "dataSource", { /** * A data source used to fetch data to be displayed by the widget. */ get: function () { return this._getOption('dataSource'); }, set: function (value) { this._setOption('dataSource', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxListComponent.prototype, "disabled", { /** * Specifies whether the widget responds to user interaction. */ get: function () { return this._getOption('disabled'); }, set: function (value) { this._setOption('disabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxListComponent.prototype, "elementAttr", { /** * Specifies the attributes to be attached to the widget's root element. */ get: function () { return this._getOption('elementAttr'); }, set: function (value) { this._setOption('elementAttr', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxListComponent.prototype, "focusStateEnabled", { /** * Specifies whether the widget can be focused using keyboard navigation. */ get: function () { return this._getOption('focusStateEnabled'); }, set: function (value) { this._setOption('focusStateEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxListComponent.prototype, "grouped", { /** * Specifies whether data items should be grouped. */ get: function () { return this._getOption('grouped'); }, set: function (value) { this._setOption('grouped', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxListComponent.prototype, "groupTemplate", { /** * Specifies a custom template for group captions. */ get: function () { return this._getOption('groupTemplate'); }, set: function (value) { this._setOption('groupTemplate', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxListComponent.prototype, "height", { /** * Specifies the widget's height. */ get: function () { return this._getOption('height'); }, set: function (value) { this._setOption('height', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxListComponent.prototype, "hint", { /** * Specifies text for a hint that appears when a user pauses on the widget. */ get: function () { return this._getOption('hint'); }, set: function (value) { this._setOption('hint', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxListComponent.prototype, "hoverStateEnabled", { /** * Specifies whether the widget changes its state when a user pauses on it. */ get: function () { return this._getOption('hoverStateEnabled'); }, set: function (value) { this._setOption('hoverStateEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxListComponent.prototype, "indicateLoading", { /** * Specifies whether or not to show the loading panel when the DataSource bound to the widget is loading data. */ get: function () { return this._getOption('indicateLoading'); }, set: function (value) { this._setOption('indicateLoading', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxListComponent.prototype, "itemDeleteMode", { /** * Specifies the way a user can delete items from the list. */ get: function () { return this._getOption('itemDeleteMode'); }, set: function (value) { this._setOption('itemDeleteMode', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxListComponent.prototype, "itemHoldTimeout", { /** * The time period in milliseconds before the onItemHold event is raised. */ get: function () { return this._getOption('itemHoldTimeout'); }, set: function (value) { this._setOption('itemHoldTimeout', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxListComponent.prototype, "items", { /** * An array of items displayed by the widget. */ get: function () { return this._getOption('items'); }, set: function (value) { this._setOption('items', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxListComponent.prototype, "itemTemplate", { /** * Specifies a custom template for items. */ get: function () { return this._getOption('itemTemplate'); }, set: function (value) { this._setOption('itemTemplate', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxListComponent.prototype, "keyExpr", { /** * Specifies which data field provides keys for widget items. */ get: function () { return this._getOption('keyExpr'); }, set: function (value) { this._setOption('keyExpr', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxListComponent.prototype, "menuItems", { /** * Specifies the array of items for a context menu called for a list item. */ get: function () { return this._getOption('menuItems'); }, set: function (value) { this._setOption('menuItems', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxListComponent.prototype, "menuMode", { /** * Specifies whether an item context menu is shown when a user holds or swipes an item. */ get: function () { return this._getOption('menuMode'); }, set: function (value) { this._setOption('menuMode', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxListComponent.prototype, "nextButtonText", { /** * The text displayed on the button used to load the next page from the data source. */ get: function () { return this._getOption('nextButtonText'); }, set: function (value) { this._setOption('nextButtonText', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxListComponent.prototype, "noDataText", { /** * The text or HTML markup displayed by the widget if the item collection is empty. */ get: function () { return this._getOption('noDataText'); }, set: function (value) { this._setOption('noDataText', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxListComponent.prototype, "pageLoadingText", { /** * Specifies the text shown in the pullDown panel, which is displayed when the list is scrolled to the bottom. */ get: function () { return this._getOption('pageLoadingText'); }, set: function (value) { this._setOption('pageLoadingText', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxListComponent.prototype, "pageLoadMode", { /** * Specifies whether the next page is loaded when a user scrolls the widget to the bottom or when the "next" button is clicked. */ get: function () { return this._getOption('pageLoadMode'); }, set: function (value) { this._setOption('pageLoadMode', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxListComponent.prototype, "pulledDownText", { /** * Specifies the text displayed in the pullDown panel when the list is pulled below the refresh threshold. */ get: function () { return this._getOption('pulledDownText'); }, set: function (value) { this._setOption('pulledDownText', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxListComponent.prototype, "pullingDownText", { /** * Specifies the text shown in the pullDown panel while the list is being pulled down to the refresh threshold. */ get: function () { return this._getOption('pullingDownText'); }, set: function (value) { this._setOption('pullingDownText', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxListComponent.prototype, "pullRefreshEnabled", { /** * A Boolean value specifying whether or not the widget supports the "pull down to refresh" gesture. */ get: function () { return this._getOption('pullRefreshEnabled'); }, set: function (value) { this._setOption('pullRefreshEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxListComponent.prototype, "refreshingText", { /** * Specifies the text displayed in the pullDown panel while the list is being refreshed. */ get: function () { return this._getOption('refreshingText'); }, set: function (value) { this._setOption('refreshingText', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxListComponent.prototype, "rtlEnabled", { /** * Switches the widget to a right-to-left representation. */ get: function () { return this._getOption('rtlEnabled'); }, set: function (value) { this._setOption('rtlEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxListComponent.prototype, "scrollByContent", { /** * A Boolean value specifying if the list is scrolled by content. */ get: function () { return this._getOption('scrollByContent'); }, set: function (value) { this._setOption('scrollByContent', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxListComponent.prototype, "scrollByThumb", { /** * A Boolean value specifying if the list is scrolled using the scrollbar. */ get: function () { return this._getOption('scrollByThumb'); }, set: function (value) { this._setOption('scrollByThumb', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxListComponent.prototype, "scrollingEnabled", { /** * A Boolean value specifying whether to enable or disable list scrolling. */ get: function () { return this._getOption('scrollingEnabled'); }, set: function (value) { this._setOption('scrollingEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxListComponent.prototype, "searchEditorOptions", { /** * Configures the search panel. */ get: function () { return this._getOption('searchEditorOptions'); }, set: function (value) { this._setOption('searchEditorOptions', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxListComponent.prototype, "searchEnabled", { /** * Specifies whether the search panel is visible. */ get: function () { return this._getOption('searchEnabled'); }, set: function (value) { this._setOption('searchEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxListComponent.prototype, "searchExpr", { /** * Specifies a data object's field name or an expression whose value is compared to the search string. */ get: function () { return this._getOption('searchExpr'); }, set: function (value) { this._setOption('searchExpr', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxListComponent.prototype, "searchMode", { /** * Specifies whether the widget finds entries that contain your search string or entries that only start with it. */ get: function () { return this._getOption('searchMode'); }, set: function (value) { this._setOption('searchMode', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxListComponent.prototype, "searchTimeout", { /** * Specifies a delay in milliseconds between when a user finishes typing, and the search is executed. */ get: function () { return this._getOption('searchTimeout'); }, set: function (value) { this._setOption('searchTimeout', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxListComponent.prototype, "searchValue", { /** * Specifies the current search string. */ get: function () { return this._getOption('searchValue'); }, set: function (value) { this._setOption('searchValue', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxListComponent.prototype, "selectAllMode", { /** * Specifies the mode in which all items are selected. */ get: function () { return this._getOption('selectAllMode'); }, set: function (value) { this._setOption('selectAllMode', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxListComponent.prototype, "selectedItemKeys", { /** * Specifies an array of currently selected item keys. */ get: function () { return this._getOption('selectedItemKeys'); }, set: function (value) { this._setOption('selectedItemKeys', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxListComponent.prototype, "selectedItems", { /** * An array of currently selected item objects. */ get: function () { return this._getOption('selectedItems'); }, set: function (value) { this._setOption('selectedItems', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxListComponent.prototype, "selectionMode", { /** * Specifies item selection mode. */ get: function () { return this._getOption('selectionMode'); }, set: function (value) { this._setOption('selectionMode', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxListComponent.prototype, "showNextButton", { /** * Use the pageLoadMode option instead. */ get: function () { return this._getOption('showNextButton'); }, set: function (value) { this._setOption('showNextButton', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxListComponent.prototype, "showScrollbar", { /** * Specifies when the widget shows the scrollbar. */ get: function () { return this._getOption('showScrollbar'); }, set: function (value) { this._setOption('showScrollbar', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxListComponent.prototype, "showSelectionControls", { /** * Specifies whether or not to display controls used to select list items. */ get: function () { return this._getOption('showSelectionControls'); }, set: function (value) { this._setOption('showSelectionControls', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxListComponent.prototype, "tabIndex", { /** * Specifies the number of the element when the Tab key is used for navigating. */ get: function () { return this._getOption('tabIndex'); }, set: function (value) { this._setOption('tabIndex', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxListComponent.prototype, "useNativeScrolling", { /** * Specifies whether or not the widget uses native scrolling. */ get: function () { return this._getOption('useNativeScrolling'); }, set: function (value) { this._setOption('useNativeScrolling', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxListComponent.prototype, "visible", { /** * Specifies whether the widget is visible. */ get: function () { return this._getOption('visible'); }, set: function (value) { this._setOption('visible', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxListComponent.prototype, "width", { /** * Specifies the widget's width. */ get: function () { return this._getOption('width'); }, set: function (value) { this._setOption('width', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxListComponent.prototype, "itemsChildren", { get: function () { return this._getOption('items'); }, set: function (value) { this.setChildren('items', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxListComponent.prototype, "menuItemsChildren", { get: function () { return this._getOption('menuItems'); }, set: function (value) { this.setChildren('menuItems', value); }, enumerable: true, configurable: true }); DxListComponent.prototype._createInstance = function (element, options) { return new list_1.default(element, options); }; DxListComponent.prototype.ngOnDestroy = function () { this._destroyWidget(); }; DxListComponent.prototype.ngOnChanges = function (changes) { _super.prototype.ngOnChanges.call(this, changes); this.setupChanges('dataSource', changes); this.setupChanges('items', changes); this.setupChanges('menuItems', changes); this.setupChanges('searchExpr', changes); this.setupChanges('selectedItemKeys', changes); this.setupChanges('selectedItems', changes); }; DxListComponent.prototype.setupChanges = function (prop, changes) { if (!(prop in this._optionsToUpdate)) { this._idh.setup(prop, changes); } }; DxListComponent.prototype.ngDoCheck = function () { this._idh.doCheck('dataSource'); this._idh.doCheck('items'); this._idh.doCheck('menuItems'); this._idh.doCheck('searchExpr'); this._idh.doCheck('selectedItemKeys'); this._idh.doCheck('selectedItems'); this._watcherHelper.checkWatchers(); _super.prototype.ngDoCheck.call(this); _super.prototype.clearChangedOptions.call(this); }; DxListComponent.prototype._setOption = function (name, value) { var isSetup = this._idh.setupSingle(name, value); var isChanged = this._idh.getChanges(name, value) !== null; if (isSetup || isChanged) { _super.prototype._setOption.call(this, name, value); } }; DxListComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dx-list', template: '', providers: [ template_host_1.DxTemplateHost, watcher_helper_1.WatcherHelper, nested_option_1.NestedOptionHost, iterable_differ_helper_1.IterableDifferHelper ] },] }, ]; /** @nocollapse */ DxListComponent.ctorParameters = function () { return [ { type: core_1.ElementRef, }, { type: core_1.NgZone, }, { type: template_host_1.DxTemplateHost, }, { type: watcher_helper_1.WatcherHelper, }, { type: iterable_differ_helper_1.IterableDifferHelper, }, { type: nested_option_1.NestedOptionHost, }, ]; }; DxListComponent.propDecorators = { 'accessKey': [{ type: core_1.Input },], 'activeStateEnabled': [{ type: core_1.Input },], 'allowItemDeleting': [{ type: core_1.Input },], 'allowItemReordering': [{ type: core_1.Input },], 'autoPagingEnabled': [{ type: core_1.Input },], 'bounceEnabled': [{ type: core_1.Input },], 'collapsibleGroups': [{ type: core_1.Input },], 'dataSource': [{ type: core_1.Input },], 'disabled': [{ type: core_1.Input },], 'elementAttr': [{ type: core_1.Input },], 'focusStateEnabled': [{ type: core_1.Input },], 'grouped': [{ type: core_1.Input },], 'groupTemplate': [{ type: core_1.Input },], 'height': [{ type: core_1.Input },], 'hint': [{ type: core_1.Input },], 'hoverStateEnabled': [{ type: core_1.Input },], 'indicateLoading': [{ type: core_1.Input },], 'itemDeleteMode': [{ type: core_1.Input },], 'itemHoldTimeout': [{ type: core_1.Input },], 'items': [{ type: core_1.Input },], 'itemTemplate': [{ type: core_1.Input },], 'keyExpr': [{ type: core_1.Input },], 'menuItems': [{ type: core_1.Input },], 'menuMode': [{ type: core_1.Input },], 'nextButtonText': [{ type: core_1.Input },], 'noDataText': [{ type: core_1.Input },], 'pageLoadingText': [{ type: core_1.Input },], 'pageLoadMode': [{ type: core_1.Input },], 'pulledDownText': [{ type: core_1.Input },], 'pullingDownText': [{ type: core_1.Input },], 'pullRefreshEnabled': [{ type: core_1.Input },], 'refreshingText': [{ type: core_1.Input },], 'rtlEnabled': [{ type: core_1.Input },], 'scrollByContent': [{ type: core_1.Input },], 'scrollByThumb': [{ type: core_1.Input },], 'scrollingEnabled': [{ type: core_1.Input },], 'searchEditorOptions': [{ type: core_1.Input },], 'searchEnabled': [{ type: core_1.Input },], 'searchExpr': [{ type: core_1.Input },], 'searchMode': [{ type: core_1.Input },], 'searchTimeout': [{ type: core_1.Input },], 'searchValue': [{ type: core_1.Input },], 'selectAllMode': [{ type: core_1.Input },], 'selectedItemKeys': [{ type: core_1.Input },], 'selectedItems': [{ type: core_1.Input },], 'selectionMode': [{ type: core_1.Input },], 'showNextButton': [{ type: core_1.Input },], 'showScrollbar': [{ type: core_1.Input },], 'showSelectionControls': [{ type: core_1.Input },], 'tabIndex': [{ type: core_1.Input },], 'useNativeScrolling': [{ type: core_1.Input },], 'visible': [{ type: core_1.Input },], 'width': [{ type: core_1.Input },], 'onContentReady': [{ type: core_1.Output },], 'onDisposing': [{ type: core_1.Output },], 'onGroupRendered': [{ type: core_1.Output },], 'onInitialized': [{ type: core_1.Output },], 'onItemClick': [{ type: core_1.Output },], 'onItemContextMenu': [{ type: core_1.Output },], 'onItemDeleted': [{ type: core_1.Output },], 'onItemDeleting': [{ type: core_1.Output },], 'onItemHold': [{ type: core_1.Output },], 'onItemRendered': [{ type: core_1.Output },], 'onItemReordered': [{ type: core_1.Output },], 'onItemSwipe': [{ type: core_1.Output },], 'onOptionChanged': [{ type: core_1.Output },], 'onPageLoading': [{ type: core_1.Output },], 'onPullRefresh': [{ type: core_1.Output },], 'onScroll': [{ type: core_1.Output },], 'onSelectAllValueChanged': [{ type: core_1.Output },], 'onSelectionChanged': [{ type: core_1.Output },], 'accessKeyChange': [{ type: core_1.Output },], 'activeStateEnabledChange': [{ type: core_1.Output },], 'allowItemDeletingChange': [{ type: core_1.Output },], 'allowItemReorderingChange': [{ type: core_1.Output },], 'autoPagingEnabledChange': [{ type: core_1.Output },], 'bounceEnabledChange': [{ type: core_1.Output },], 'collapsibleGroupsChange': [{ type: core_1.Output },], 'dataSourceChange': [{ type: core_1.Output },], 'disabledChange': [{ type: core_1.Output },], 'elementAttrChange': [{ type: core_1.Output },], 'focusStateEnabledChange': [{ type: core_1.Output },], 'groupedChange': [{ type: core_1.Output },], 'groupTemplateChange': [{ type: core_1.Output },], 'heightChange': [{ type: core_1.Output },], 'hintChange': [{ type: core_1.Output },], 'hoverStateEnabledChange': [{ type: core_1.Output },], 'indicateLoadingChange': [{ type: core_1.Output },], 'itemDeleteModeChange': [{ type: core_1.Output },], 'itemHoldTimeoutChange': [{ type: core_1.Output },], 'itemsChange': [{ type: core_1.Output },], 'itemTemplateChange': [{ type: core_1.Output },], 'keyExprChange': [{ type: core_1.Output },], 'menuItemsChange': [{ type: core_1.Output },], 'menuModeChange': [{ type: core_1.Output },], 'nextButtonTextChange': [{ type: core_1.Output },], 'noDataTextChange': [{ type: core_1.Output },], 'pageLoadingTextChange': [{ type: core_1.Output },], 'pageLoadModeChange': [{ type: core_1.Output },], 'pulledDownTextChange': [{ type: core_1.Output },], 'pullingDownTextChange': [{ type: core_1.Output },], 'pullRefreshEnabledChange': [{ type: core_1.Output },], 'refreshingTextChange': [{ type: core_1.Output },], 'rtlEnabledChange': [{ type: core_1.Output },], 'scrollByContentChange': [{ type: core_1.Output },], 'scrollByThumbChange': [{ type: core_1.Output },], 'scrollingEnabledChange': [{ type: core_1.Output },], 'searchEditorOptionsChange': [{ type: core_1.Output },], 'searchEnabledChange': [{ type: core_1.Output },], 'searchExprChange': [{ type: core_1.Output },], 'searchModeChange': [{ type: core_1.Output },], 'searchTimeoutChange': [{ type: core_1.Output },], 'searchValueChange': [{ type: core_1.Output },], 'selectAllModeChange': [{ type: core_1.Output },], 'selectedItemKeysChange': [{ type: core_1.Output },], 'selectedItemsChange': [{ type: core_1.Output },], 'selectionModeChange': [{ type: core_1.Output },], 'showNextButtonChange': [{ type: core_1.Output },], 'showScrollbarChange': [{ type: core_1.Output },], 'showSelectionControlsChange': [{ type: core_1.Output },], 'tabIndexChange': [{ type: core_1.Output },], 'useNativeScrollingChange': [{ type: core_1.Output },], 'visibleChange': [{ type: core_1.Output },], 'widthChange': [{ type: core_1.Output },], 'itemsChildren': [{ type: core_1.ContentChildren, args: [item_dxi_2.DxiItemComponent,] },], 'menuItemsChildren': [{ type: core_1.ContentChildren, args: [menu_item_dxi_2.DxiMenuItemComponent,] },], }; return DxListComponent; }(component_1.DxComponent)); exports.DxListComponent = DxListComponent; var DxListModule = (function () { function DxListModule() { } DxListModule.decorators = [ { type: core_1.NgModule, args: [{ imports: [ item_dxi_1.DxiItemModule, menu_item_dxi_1.DxiMenuItemModule, search_editor_options_1.DxoSearchEditorOptionsModule, template_1.DxTemplateModule ], declarations: [ DxListComponent ], exports: [ DxListComponent, item_dxi_1.DxiItemModule, menu_item_dxi_1.DxiMenuItemModule, search_editor_options_1.DxoSearchEditorOptionsModule, template_1.DxTemplateModule ], },] }, ]; /** @nocollapse */ DxListModule.ctorParameters = function () { return []; }; return DxListModule; }()); exports.DxListModule = DxListModule; //# sourceMappingURL=list.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/load-indicator.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var load_indicator_1 = __webpack_require__("./node_modules/devextreme/ui/load_indicator.js"); var component_1 = __webpack_require__("./node_modules/devextreme-angular/core/component.js"); var template_host_1 = __webpack_require__("./node_modules/devextreme-angular/core/template-host.js"); var template_1 = __webpack_require__("./node_modules/devextreme-angular/core/template.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var watcher_helper_1 = __webpack_require__("./node_modules/devextreme-angular/core/watcher-helper.js"); /** * The LoadIndicator is a UI element notifying the viewer that a process is in progress. */ var DxLoadIndicatorComponent = (function (_super) { __extends(DxLoadIndicatorComponent, _super); function DxLoadIndicatorComponent(elementRef, ngZone, templateHost, _watcherHelper, optionHost) { var _this = _super.call(this, elementRef, ngZone, templateHost, _watcherHelper) || this; _this._createEventEmitters([ { subscribe: 'contentReady', emit: 'onContentReady' }, { subscribe: 'disposing', emit: 'onDisposing' }, { subscribe: 'initialized', emit: 'onInitialized' }, { subscribe: 'optionChanged', emit: 'onOptionChanged' }, { emit: 'elementAttrChange' }, { emit: 'heightChange' }, { emit: 'hintChange' }, { emit: 'indicatorSrcChange' }, { emit: 'rtlEnabledChange' }, { emit: 'visibleChange' }, { emit: 'widthChange' } ]); optionHost.setHost(_this); return _this; } Object.defineProperty(DxLoadIndicatorComponent.prototype, "elementAttr", { /** * Specifies the attributes to be attached to the widget's root element. */ get: function () { return this._getOption('elementAttr'); }, set: function (value) { this._setOption('elementAttr', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLoadIndicatorComponent.prototype, "height", { /** * Specifies the widget's height. */ get: function () { return this._getOption('height'); }, set: function (value) { this._setOption('height', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLoadIndicatorComponent.prototype, "hint", { /** * Specifies text for a hint that appears when a user pauses on the widget. */ get: function () { return this._getOption('hint'); }, set: function (value) { this._setOption('hint', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLoadIndicatorComponent.prototype, "indicatorSrc", { /** * Specifies the path to an image used as the indicator. */ get: function () { return this._getOption('indicatorSrc'); }, set: function (value) { this._setOption('indicatorSrc', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLoadIndicatorComponent.prototype, "rtlEnabled", { /** * Switches the widget to a right-to-left representation. */ get: function () { return this._getOption('rtlEnabled'); }, set: function (value) { this._setOption('rtlEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLoadIndicatorComponent.prototype, "visible", { /** * Specifies whether the widget is visible. */ get: function () { return this._getOption('visible'); }, set: function (value) { this._setOption('visible', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLoadIndicatorComponent.prototype, "width", { /** * Specifies the widget's width. */ get: function () { return this._getOption('width'); }, set: function (value) { this._setOption('width', value); }, enumerable: true, configurable: true }); DxLoadIndicatorComponent.prototype._createInstance = function (element, options) { return new load_indicator_1.default(element, options); }; DxLoadIndicatorComponent.prototype.ngOnDestroy = function () { this._destroyWidget(); }; DxLoadIndicatorComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dx-load-indicator', template: '', providers: [ template_host_1.DxTemplateHost, watcher_helper_1.WatcherHelper, nested_option_1.NestedOptionHost ] },] }, ]; /** @nocollapse */ DxLoadIndicatorComponent.ctorParameters = function () { return [ { type: core_1.ElementRef, }, { type: core_1.NgZone, }, { type: template_host_1.DxTemplateHost, }, { type: watcher_helper_1.WatcherHelper, }, { type: nested_option_1.NestedOptionHost, }, ]; }; DxLoadIndicatorComponent.propDecorators = { 'elementAttr': [{ type: core_1.Input },], 'height': [{ type: core_1.Input },], 'hint': [{ type: core_1.Input },], 'indicatorSrc': [{ type: core_1.Input },], 'rtlEnabled': [{ type: core_1.Input },], 'visible': [{ type: core_1.Input },], 'width': [{ type: core_1.Input },], 'onContentReady': [{ type: core_1.Output },], 'onDisposing': [{ type: core_1.Output },], 'onInitialized': [{ type: core_1.Output },], 'onOptionChanged': [{ type: core_1.Output },], 'elementAttrChange': [{ type: core_1.Output },], 'heightChange': [{ type: core_1.Output },], 'hintChange': [{ type: core_1.Output },], 'indicatorSrcChange': [{ type: core_1.Output },], 'rtlEnabledChange': [{ type: core_1.Output },], 'visibleChange': [{ type: core_1.Output },], 'widthChange': [{ type: core_1.Output },], }; return DxLoadIndicatorComponent; }(component_1.DxComponent)); exports.DxLoadIndicatorComponent = DxLoadIndicatorComponent; var DxLoadIndicatorModule = (function () { function DxLoadIndicatorModule() { } DxLoadIndicatorModule.decorators = [ { type: core_1.NgModule, args: [{ imports: [ template_1.DxTemplateModule ], declarations: [ DxLoadIndicatorComponent ], exports: [ DxLoadIndicatorComponent, template_1.DxTemplateModule ], },] }, ]; /** @nocollapse */ DxLoadIndicatorModule.ctorParameters = function () { return []; }; return DxLoadIndicatorModule; }()); exports.DxLoadIndicatorModule = DxLoadIndicatorModule; //# sourceMappingURL=load-indicator.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/load-panel.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var load_panel_1 = __webpack_require__("./node_modules/devextreme/ui/load_panel.js"); var component_1 = __webpack_require__("./node_modules/devextreme-angular/core/component.js"); var template_host_1 = __webpack_require__("./node_modules/devextreme-angular/core/template-host.js"); var template_1 = __webpack_require__("./node_modules/devextreme-angular/core/template.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var watcher_helper_1 = __webpack_require__("./node_modules/devextreme-angular/core/watcher-helper.js"); var animation_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/animation.js"); var hide_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/hide.js"); var show_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/show.js"); var position_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/position.js"); var at_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/at.js"); var boundary_offset_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/boundary-offset.js"); var collision_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/collision.js"); var my_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/my.js"); var offset_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/offset.js"); /** * The LoadPanel is an overlay widget notifying the viewer that loading is in progress. */ var DxLoadPanelComponent = (function (_super) { __extends(DxLoadPanelComponent, _super); function DxLoadPanelComponent(elementRef, ngZone, templateHost, _watcherHelper, optionHost) { var _this = _super.call(this, elementRef, ngZone, templateHost, _watcherHelper) || this; _this._createEventEmitters([ { subscribe: 'contentReady', emit: 'onContentReady' }, { subscribe: 'disposing', emit: 'onDisposing' }, { subscribe: 'hidden', emit: 'onHidden' }, { subscribe: 'hiding', emit: 'onHiding' }, { subscribe: 'initialized', emit: 'onInitialized' }, { subscribe: 'optionChanged', emit: 'onOptionChanged' }, { subscribe: 'showing', emit: 'onShowing' }, { subscribe: 'shown', emit: 'onShown' }, { emit: 'animationChange' }, { emit: 'closeOnOutsideClickChange' }, { emit: 'deferRenderingChange' }, { emit: 'delayChange' }, { emit: 'elementAttrChange' }, { emit: 'focusStateEnabledChange' }, { emit: 'heightChange' }, { emit: 'hintChange' }, { emit: 'hoverStateEnabledChange' }, { emit: 'indicatorSrcChange' }, { emit: 'maxHeightChange' }, { emit: 'maxWidthChange' }, { emit: 'messageChange' }, { emit: 'minHeightChange' }, { emit: 'minWidthChange' }, { emit: 'positionChange' }, { emit: 'rtlEnabledChange' }, { emit: 'shadingChange' }, { emit: 'shadingColorChange' }, { emit: 'showIndicatorChange' }, { emit: 'showPaneChange' }, { emit: 'visibleChange' }, { emit: 'widthChange' } ]); optionHost.setHost(_this); return _this; } Object.defineProperty(DxLoadPanelComponent.prototype, "animation", { /** * Configures widget visibility animations. This object contains two fields: show and hide. */ get: function () { return this._getOption('animation'); }, set: function (value) { this._setOption('animation', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLoadPanelComponent.prototype, "closeOnOutsideClick", { /** * Specifies whether to close the widget if a user clicks outside it. */ get: function () { return this._getOption('closeOnOutsideClick'); }, set: function (value) { this._setOption('closeOnOutsideClick', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLoadPanelComponent.prototype, "deferRendering", { /** * Specifies whether widget content is rendered when the widget is shown or when rendering the widget. */ get: function () { return this._getOption('deferRendering'); }, set: function (value) { this._setOption('deferRendering', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLoadPanelComponent.prototype, "delay", { /** * The delay in milliseconds after which the load panel is displayed. */ get: function () { return this._getOption('delay'); }, set: function (value) { this._setOption('delay', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLoadPanelComponent.prototype, "elementAttr", { /** * Specifies the attributes to be attached to the widget's root element. */ get: function () { return this._getOption('elementAttr'); }, set: function (value) { this._setOption('elementAttr', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLoadPanelComponent.prototype, "focusStateEnabled", { /** * Specifies whether or not the widget can be focused. */ get: function () { return this._getOption('focusStateEnabled'); }, set: function (value) { this._setOption('focusStateEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLoadPanelComponent.prototype, "height", { /** * Specified the widget's height. */ get: function () { return this._getOption('height'); }, set: function (value) { this._setOption('height', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLoadPanelComponent.prototype, "hint", { /** * Specifies text for a hint that appears when a user pauses on the widget. */ get: function () { return this._getOption('hint'); }, set: function (value) { this._setOption('hint', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLoadPanelComponent.prototype, "hoverStateEnabled", { /** * Specifies whether the widget changes its state when a user pauses on it. */ get: function () { return this._getOption('hoverStateEnabled'); }, set: function (value) { this._setOption('hoverStateEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLoadPanelComponent.prototype, "indicatorSrc", { /** * A URL pointing to an image to be used as a load indicator. */ get: function () { return this._getOption('indicatorSrc'); }, set: function (value) { this._setOption('indicatorSrc', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLoadPanelComponent.prototype, "maxHeight", { /** * Specifies the maximum height the widget can reach while resizing. */ get: function () { return this._getOption('maxHeight'); }, set: function (value) { this._setOption('maxHeight', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLoadPanelComponent.prototype, "maxWidth", { /** * Specifies the maximum width the widget can reach while resizing. */ get: function () { return this._getOption('maxWidth'); }, set: function (value) { this._setOption('maxWidth', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLoadPanelComponent.prototype, "message", { /** * The text displayed in the load panel. */ get: function () { return this._getOption('message'); }, set: function (value) { this._setOption('message', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLoadPanelComponent.prototype, "minHeight", { /** * Specifies the minimum height the widget can reach while resizing. */ get: function () { return this._getOption('minHeight'); }, set: function (value) { this._setOption('minHeight', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLoadPanelComponent.prototype, "minWidth", { /** * Specifies the minimum width the widget can reach while resizing. */ get: function () { return this._getOption('minWidth'); }, set: function (value) { this._setOption('minWidth', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLoadPanelComponent.prototype, "position", { /** * Positions the widget. */ get: function () { return this._getOption('position'); }, set: function (value) { this._setOption('position', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLoadPanelComponent.prototype, "rtlEnabled", { /** * Switches the widget to a right-to-left representation. */ get: function () { return this._getOption('rtlEnabled'); }, set: function (value) { this._setOption('rtlEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLoadPanelComponent.prototype, "shading", { /** * A Boolean value specifying whether or not the main screen is inactive while the widget is active. */ get: function () { return this._getOption('shading'); }, set: function (value) { this._setOption('shading', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLoadPanelComponent.prototype, "shadingColor", { /** * Specifies the shading color. */ get: function () { return this._getOption('shadingColor'); }, set: function (value) { this._setOption('shadingColor', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLoadPanelComponent.prototype, "showIndicator", { /** * A Boolean value specifying whether or not to show a load indicator. */ get: function () { return this._getOption('showIndicator'); }, set: function (value) { this._setOption('showIndicator', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLoadPanelComponent.prototype, "showPane", { /** * A Boolean value specifying whether or not to show the pane behind the load indicator. */ get: function () { return this._getOption('showPane'); }, set: function (value) { this._setOption('showPane', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLoadPanelComponent.prototype, "visible", { /** * A Boolean value specifying whether or not the widget is visible. */ get: function () { return this._getOption('visible'); }, set: function (value) { this._setOption('visible', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLoadPanelComponent.prototype, "width", { /** * Specifies the widget's width. */ get: function () { return this._getOption('width'); }, set: function (value) { this._setOption('width', value); }, enumerable: true, configurable: true }); DxLoadPanelComponent.prototype._createInstance = function (element, options) { return new load_panel_1.default(element, options); }; DxLoadPanelComponent.prototype.ngOnDestroy = function () { this._destroyWidget(); }; DxLoadPanelComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dx-load-panel', template: '', providers: [ template_host_1.DxTemplateHost, watcher_helper_1.WatcherHelper, nested_option_1.NestedOptionHost ] },] }, ]; /** @nocollapse */ DxLoadPanelComponent.ctorParameters = function () { return [ { type: core_1.ElementRef, }, { type: core_1.NgZone, }, { type: template_host_1.DxTemplateHost, }, { type: watcher_helper_1.WatcherHelper, }, { type: nested_option_1.NestedOptionHost, }, ]; }; DxLoadPanelComponent.propDecorators = { 'animation': [{ type: core_1.Input },], 'closeOnOutsideClick': [{ type: core_1.Input },], 'deferRendering': [{ type: core_1.Input },], 'delay': [{ type: core_1.Input },], 'elementAttr': [{ type: core_1.Input },], 'focusStateEnabled': [{ type: core_1.Input },], 'height': [{ type: core_1.Input },], 'hint': [{ type: core_1.Input },], 'hoverStateEnabled': [{ type: core_1.Input },], 'indicatorSrc': [{ type: core_1.Input },], 'maxHeight': [{ type: core_1.Input },], 'maxWidth': [{ type: core_1.Input },], 'message': [{ type: core_1.Input },], 'minHeight': [{ type: core_1.Input },], 'minWidth': [{ type: core_1.Input },], 'position': [{ type: core_1.Input },], 'rtlEnabled': [{ type: core_1.Input },], 'shading': [{ type: core_1.Input },], 'shadingColor': [{ type: core_1.Input },], 'showIndicator': [{ type: core_1.Input },], 'showPane': [{ type: core_1.Input },], 'visible': [{ type: core_1.Input },], 'width': [{ type: core_1.Input },], 'onContentReady': [{ type: core_1.Output },], 'onDisposing': [{ type: core_1.Output },], 'onHidden': [{ type: core_1.Output },], 'onHiding': [{ type: core_1.Output },], 'onInitialized': [{ type: core_1.Output },], 'onOptionChanged': [{ type: core_1.Output },], 'onShowing': [{ type: core_1.Output },], 'onShown': [{ type: core_1.Output },], 'animationChange': [{ type: core_1.Output },], 'closeOnOutsideClickChange': [{ type: core_1.Output },], 'deferRenderingChange': [{ type: core_1.Output },], 'delayChange': [{ type: core_1.Output },], 'elementAttrChange': [{ type: core_1.Output },], 'focusStateEnabledChange': [{ type: core_1.Output },], 'heightChange': [{ type: core_1.Output },], 'hintChange': [{ type: core_1.Output },], 'hoverStateEnabledChange': [{ type: core_1.Output },], 'indicatorSrcChange': [{ type: core_1.Output },], 'maxHeightChange': [{ type: core_1.Output },], 'maxWidthChange': [{ type: core_1.Output },], 'messageChange': [{ type: core_1.Output },], 'minHeightChange': [{ type: core_1.Output },], 'minWidthChange': [{ type: core_1.Output },], 'positionChange': [{ type: core_1.Output },], 'rtlEnabledChange': [{ type: core_1.Output },], 'shadingChange': [{ type: core_1.Output },], 'shadingColorChange': [{ type: core_1.Output },], 'showIndicatorChange': [{ type: core_1.Output },], 'showPaneChange': [{ type: core_1.Output },], 'visibleChange': [{ type: core_1.Output },], 'widthChange': [{ type: core_1.Output },], }; return DxLoadPanelComponent; }(component_1.DxComponent)); exports.DxLoadPanelComponent = DxLoadPanelComponent; var DxLoadPanelModule = (function () { function DxLoadPanelModule() { } DxLoadPanelModule.decorators = [ { type: core_1.NgModule, args: [{ imports: [ animation_1.DxoAnimationModule, hide_1.DxoHideModule, show_1.DxoShowModule, position_1.DxoPositionModule, at_1.DxoAtModule, boundary_offset_1.DxoBoundaryOffsetModule, collision_1.DxoCollisionModule, my_1.DxoMyModule, offset_1.DxoOffsetModule, template_1.DxTemplateModule ], declarations: [ DxLoadPanelComponent ], exports: [ DxLoadPanelComponent, animation_1.DxoAnimationModule, hide_1.DxoHideModule, show_1.DxoShowModule, position_1.DxoPositionModule, at_1.DxoAtModule, boundary_offset_1.DxoBoundaryOffsetModule, collision_1.DxoCollisionModule, my_1.DxoMyModule, offset_1.DxoOffsetModule, template_1.DxTemplateModule ], },] }, ]; /** @nocollapse */ DxLoadPanelModule.ctorParameters = function () { return []; }; return DxLoadPanelModule; }()); exports.DxLoadPanelModule = DxLoadPanelModule; //# sourceMappingURL=load-panel.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/lookup.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var lookup_1 = __webpack_require__("./node_modules/devextreme/ui/lookup.js"); var validator_1 = __webpack_require__("./node_modules/devextreme-angular/ui/validator.js"); var forms_1 = __webpack_require__("./node_modules/@angular/forms/esm2015/forms.js"); var component_1 = __webpack_require__("./node_modules/devextreme-angular/core/component.js"); var template_host_1 = __webpack_require__("./node_modules/devextreme-angular/core/template-host.js"); var template_1 = __webpack_require__("./node_modules/devextreme-angular/core/template.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var watcher_helper_1 = __webpack_require__("./node_modules/devextreme-angular/core/watcher-helper.js"); var iterable_differ_helper_1 = __webpack_require__("./node_modules/devextreme-angular/core/iterable-differ-helper.js"); var animation_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/animation.js"); var hide_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/hide.js"); var show_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/show.js"); var item_dxi_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/item-dxi.js"); var position_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/position.js"); var at_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/at.js"); var boundary_offset_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/boundary-offset.js"); var collision_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/collision.js"); var my_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/my.js"); var offset_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/offset.js"); var item_dxi_2 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/item-dxi.js"); var CUSTOM_VALUE_ACCESSOR_PROVIDER = { provide: forms_1.NG_VALUE_ACCESSOR, useExisting: core_1.forwardRef(function () { return DxLookupComponent; }), multi: true }; /** * The Lookup is a widget that allows an end user to search for an item in a collection shown in a drop-down menu. */ var DxLookupComponent = (function (_super) { __extends(DxLookupComponent, _super); function DxLookupComponent(elementRef, ngZone, templateHost, _watcherHelper, _idh, optionHost) { var _this = _super.call(this, elementRef, ngZone, templateHost, _watcherHelper) || this; _this._watcherHelper = _watcherHelper; _this._idh = _idh; _this.touched = function (_) { }; _this._createEventEmitters([ { subscribe: 'closed', emit: 'onClosed' }, { subscribe: 'contentReady', emit: 'onContentReady' }, { subscribe: 'disposing', emit: 'onDisposing' }, { subscribe: 'initialized', emit: 'onInitialized' }, { subscribe: 'itemClick', emit: 'onItemClick' }, { subscribe: 'opened', emit: 'onOpened' }, { subscribe: 'optionChanged', emit: 'onOptionChanged' }, { subscribe: 'pageLoading', emit: 'onPageLoading' }, { subscribe: 'pullRefresh', emit: 'onPullRefresh' }, { subscribe: 'scroll', emit: 'onScroll' }, { subscribe: 'selectionChanged', emit: 'onSelectionChanged' }, { subscribe: 'titleRendered', emit: 'onTitleRendered' }, { subscribe: 'valueChanged', emit: 'onValueChanged' }, { emit: 'accessKeyChange' }, { emit: 'activeStateEnabledChange' }, { emit: 'animationChange' }, { emit: 'applyButtonTextChange' }, { emit: 'applyValueModeChange' }, { emit: 'attrChange' }, { emit: 'cancelButtonTextChange' }, { emit: 'cleanSearchOnOpeningChange' }, { emit: 'clearButtonTextChange' }, { emit: 'closeOnOutsideClickChange' }, { emit: 'dataSourceChange' }, { emit: 'deferRenderingChange' }, { emit: 'disabledChange' }, { emit: 'displayExprChange' }, { emit: 'displayValueChange' }, { emit: 'dropDownButtonTemplateChange' }, { emit: 'elementAttrChange' }, { emit: 'fieldEditEnabledChange' }, { emit: 'fieldTemplateChange' }, { emit: 'focusStateEnabledChange' }, { emit: 'fullScreenChange' }, { emit: 'groupedChange' }, { emit: 'groupTemplateChange' }, { emit: 'heightChange' }, { emit: 'hintChange' }, { emit: 'hoverStateEnabledChange' }, { emit: 'inputAttrChange' }, { emit: 'isValidChange' }, { emit: 'itemsChange' }, { emit: 'itemTemplateChange' }, { emit: 'minSearchLengthChange' }, { emit: 'nameChange' }, { emit: 'nextButtonTextChange' }, { emit: 'noDataTextChange' }, { emit: 'openedChange' }, { emit: 'pageLoadingTextChange' }, { emit: 'pageLoadModeChange' }, { emit: 'pagingEnabledChange' }, { emit: 'placeholderChange' }, { emit: 'popupHeightChange' }, { emit: 'popupWidthChange' }, { emit: 'positionChange' }, { emit: 'pulledDownTextChange' }, { emit: 'pullingDownTextChange' }, { emit: 'pullRefreshEnabledChange' }, { emit: 'refreshingTextChange' }, { emit: 'rtlEnabledChange' }, { emit: 'searchEnabledChange' }, { emit: 'searchExprChange' }, { emit: 'searchModeChange' }, { emit: 'searchPlaceholderChange' }, { emit: 'searchTimeoutChange' }, { emit: 'selectedItemChange' }, { emit: 'shadingChange' }, { emit: 'showCancelButtonChange' }, { emit: 'showClearButtonChange' }, { emit: 'showDataBeforeSearchChange' }, { emit: 'showNextButtonChange' }, { emit: 'showPopupTitleChange' }, { emit: 'tabIndexChange' }, { emit: 'textChange' }, { emit: 'titleChange' }, { emit: 'titleTemplateChange' }, { emit: 'useNativeScrollingChange' }, { emit: 'usePopoverChange' }, { emit: 'validationErrorChange' }, { emit: 'validationMessageModeChange' }, { emit: 'valueChange' }, { emit: 'valueChangeEventChange' }, { emit: 'valueExprChange' }, { emit: 'visibleChange' }, { emit: 'widthChange' }, { emit: 'onBlur' } ]); _this._idh.setHost(_this); optionHost.setHost(_this); return _this; } Object.defineProperty(DxLookupComponent.prototype, "accessKey", { /** * Specifies the shortcut key that sets focus on the widget. */ get: function () { return this._getOption('accessKey'); }, set: function (value) { this._setOption('accessKey', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLookupComponent.prototype, "activeStateEnabled", { /** * Specifies whether or not the widget changes its state when interacting with a user. */ get: function () { return this._getOption('activeStateEnabled'); }, set: function (value) { this._setOption('activeStateEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLookupComponent.prototype, "animation", { /** * Configures widget visibility animations. This object contains two fields: show and hide. */ get: function () { return this._getOption('animation'); }, set: function (value) { this._setOption('animation', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLookupComponent.prototype, "applyButtonText", { /** * The text displayed on the Apply button. */ get: function () { return this._getOption('applyButtonText'); }, set: function (value) { this._setOption('applyButtonText', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLookupComponent.prototype, "applyValueMode", { /** * Specifies the way an end-user applies the selected value. */ get: function () { return this._getOption('applyValueMode'); }, set: function (value) { this._setOption('applyValueMode', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLookupComponent.prototype, "attr", { /** * Use the inputAttr option instead. */ get: function () { return this._getOption('attr'); }, set: function (value) { this._setOption('attr', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLookupComponent.prototype, "cancelButtonText", { /** * The text displayed on the Cancel button. */ get: function () { return this._getOption('cancelButtonText'); }, set: function (value) { this._setOption('cancelButtonText', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLookupComponent.prototype, "cleanSearchOnOpening", { /** * Specifies whether or not the widget cleans the search box when the popup window is displayed. */ get: function () { return this._getOption('cleanSearchOnOpening'); }, set: function (value) { this._setOption('cleanSearchOnOpening', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLookupComponent.prototype, "clearButtonText", { /** * The text displayed on the Clear button. */ get: function () { return this._getOption('clearButtonText'); }, set: function (value) { this._setOption('clearButtonText', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLookupComponent.prototype, "closeOnOutsideClick", { /** * Specifies whether to close the drop-down menu if a user clicks outside it. */ get: function () { return this._getOption('closeOnOutsideClick'); }, set: function (value) { this._setOption('closeOnOutsideClick', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLookupComponent.prototype, "dataSource", { /** * A data source used to fetch data to be displayed by the widget. */ get: function () { return this._getOption('dataSource'); }, set: function (value) { this._setOption('dataSource', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLookupComponent.prototype, "deferRendering", { /** * Specifies whether widget content is rendered when the widget is shown or when rendering the widget. */ get: function () { return this._getOption('deferRendering'); }, set: function (value) { this._setOption('deferRendering', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLookupComponent.prototype, "disabled", { /** * Specifies whether the widget responds to user interaction. */ get: function () { return this._getOption('disabled'); }, set: function (value) { this._setOption('disabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLookupComponent.prototype, "displayExpr", { /** * Specifies the name of the data source item field whose value is displayed by the widget. */ get: function () { return this._getOption('displayExpr'); }, set: function (value) { this._setOption('displayExpr', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLookupComponent.prototype, "displayValue", { /** * Returns the value currently displayed by the widget. */ get: function () { return this._getOption('displayValue'); }, set: function (value) { this._setOption('displayValue', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLookupComponent.prototype, "dropDownButtonTemplate", { /** * Specifies a custom template for the drop-down button. */ get: function () { return this._getOption('dropDownButtonTemplate'); }, set: function (value) { this._setOption('dropDownButtonTemplate', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLookupComponent.prototype, "elementAttr", { /** * Specifies the attributes to be attached to the widget's root element. */ get: function () { return this._getOption('elementAttr'); }, set: function (value) { this._setOption('elementAttr', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLookupComponent.prototype, "fieldEditEnabled", { /** * This option is deprecated, because the functionality controlled by it was not supposed to belong to the Lookup widget. Instead, we suggest that you use the SelectBox widget with the acceptCustomValue option set to true. */ get: function () { return this._getOption('fieldEditEnabled'); }, set: function (value) { this._setOption('fieldEditEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLookupComponent.prototype, "fieldTemplate", { /** * Specifies a custom template for the input field. Must contain the TextBox widget. */ get: function () { return this._getOption('fieldTemplate'); }, set: function (value) { this._setOption('fieldTemplate', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLookupComponent.prototype, "focusStateEnabled", { /** * Specifies whether the widget can be focused using keyboard navigation. */ get: function () { return this._getOption('focusStateEnabled'); }, set: function (value) { this._setOption('focusStateEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLookupComponent.prototype, "fullScreen", { /** * A Boolean value specifying whether or not to display the lookup in full-screen mode. */ get: function () { return this._getOption('fullScreen'); }, set: function (value) { this._setOption('fullScreen', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLookupComponent.prototype, "grouped", { /** * A Boolean value specifying whether or not to group widget items. */ get: function () { return this._getOption('grouped'); }, set: function (value) { this._setOption('grouped', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLookupComponent.prototype, "groupTemplate", { /** * Specifies a custom template for group captions. */ get: function () { return this._getOption('groupTemplate'); }, set: function (value) { this._setOption('groupTemplate', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLookupComponent.prototype, "height", { /** * Specifies the widget's height. */ get: function () { return this._getOption('height'); }, set: function (value) { this._setOption('height', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLookupComponent.prototype, "hint", { /** * Specifies text for a hint that appears when a user pauses on the widget. */ get: function () { return this._getOption('hint'); }, set: function (value) { this._setOption('hint', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLookupComponent.prototype, "hoverStateEnabled", { /** * Specifies whether the widget changes its state when a user pauses on it. */ get: function () { return this._getOption('hoverStateEnabled'); }, set: function (value) { this._setOption('hoverStateEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLookupComponent.prototype, "inputAttr", { /** * Specifies the attributes to be passed on to the underlying HTML element. */ get: function () { return this._getOption('inputAttr'); }, set: function (value) { this._setOption('inputAttr', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLookupComponent.prototype, "isValid", { /** * Specifies whether the editor's value is valid. */ get: function () { return this._getOption('isValid'); }, set: function (value) { this._setOption('isValid', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLookupComponent.prototype, "items", { /** * An array of items displayed by the widget. */ get: function () { return this._getOption('items'); }, set: function (value) { this._setOption('items', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLookupComponent.prototype, "itemTemplate", { /** * Specifies a custom template for items. */ get: function () { return this._getOption('itemTemplate'); }, set: function (value) { this._setOption('itemTemplate', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLookupComponent.prototype, "minSearchLength", { /** * The minimum number of characters that must be entered into the text box to begin a search. Applies only if searchEnabled is true. */ get: function () { return this._getOption('minSearchLength'); }, set: function (value) { this._setOption('minSearchLength', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLookupComponent.prototype, "name", { /** * The value to be assigned to the `name` attribute of the underlying HTML element. */ get: function () { return this._getOption('name'); }, set: function (value) { this._setOption('name', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLookupComponent.prototype, "nextButtonText", { /** * The text displayed on the button used to load the next page from the data source. */ get: function () { return this._getOption('nextButtonText'); }, set: function (value) { this._setOption('nextButtonText', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLookupComponent.prototype, "noDataText", { /** * The text or HTML markup displayed by the widget if the item collection is empty. */ get: function () { return this._getOption('noDataText'); }, set: function (value) { this._setOption('noDataText', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLookupComponent.prototype, "opened", { /** * Specifies whether or not the drop-down editor is displayed. */ get: function () { return this._getOption('opened'); }, set: function (value) { this._setOption('opened', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLookupComponent.prototype, "pageLoadingText", { /** * Specifies the text shown in the pullDown panel, which is displayed when the widget is scrolled to the bottom. */ get: function () { return this._getOption('pageLoadingText'); }, set: function (value) { this._setOption('pageLoadingText', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLookupComponent.prototype, "pageLoadMode", { /** * Specifies whether the next page is loaded when a user scrolls the widget to the bottom or when the "next" button is clicked. */ get: function () { return this._getOption('pageLoadMode'); }, set: function (value) { this._setOption('pageLoadMode', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLookupComponent.prototype, "pagingEnabled", { /** * Use the DataSource.paginate option instead. */ get: function () { return this._getOption('pagingEnabled'); }, set: function (value) { this._setOption('pagingEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLookupComponent.prototype, "placeholder", { /** * The text displayed by the widget when nothing is selected. */ get: function () { return this._getOption('placeholder'); }, set: function (value) { this._setOption('placeholder', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLookupComponent.prototype, "popupHeight", { /** * Specifies the popup element's height. Applies only if fullScreen is false. */ get: function () { return this._getOption('popupHeight'); }, set: function (value) { this._setOption('popupHeight', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLookupComponent.prototype, "popupWidth", { /** * Specifies the popup element's width. Applies only if fullScreen is false. */ get: function () { return this._getOption('popupWidth'); }, set: function (value) { this._setOption('popupWidth', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLookupComponent.prototype, "position", { /** * An object defining widget positioning options. */ get: function () { return this._getOption('position'); }, set: function (value) { this._setOption('position', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLookupComponent.prototype, "pulledDownText", { /** * Specifies the text displayed in the pullDown panel when the widget is pulled below the refresh threshold. */ get: function () { return this._getOption('pulledDownText'); }, set: function (value) { this._setOption('pulledDownText', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLookupComponent.prototype, "pullingDownText", { /** * Specifies the text shown in the pullDown panel while the list is being pulled down to the refresh threshold. */ get: function () { return this._getOption('pullingDownText'); }, set: function (value) { this._setOption('pullingDownText', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLookupComponent.prototype, "pullRefreshEnabled", { /** * A Boolean value specifying whether or not the widget supports the "pull down to refresh" gesture. */ get: function () { return this._getOption('pullRefreshEnabled'); }, set: function (value) { this._setOption('pullRefreshEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLookupComponent.prototype, "refreshingText", { /** * Specifies the text displayed in the pullDown panel while the widget is being refreshed. */ get: function () { return this._getOption('refreshingText'); }, set: function (value) { this._setOption('refreshingText', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLookupComponent.prototype, "rtlEnabled", { /** * Switches the widget to a right-to-left representation. */ get: function () { return this._getOption('rtlEnabled'); }, set: function (value) { this._setOption('rtlEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLookupComponent.prototype, "searchEnabled", { /** * Specifies whether the search box is visible. */ get: function () { return this._getOption('searchEnabled'); }, set: function (value) { this._setOption('searchEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLookupComponent.prototype, "searchExpr", { /** * Specifies the name of a data source item field or an expression whose value is compared to the search criterion. */ get: function () { return this._getOption('searchExpr'); }, set: function (value) { this._setOption('searchExpr', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLookupComponent.prototype, "searchMode", { /** * Specifies the binary operation used to filter data. */ get: function () { return this._getOption('searchMode'); }, set: function (value) { this._setOption('searchMode', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLookupComponent.prototype, "searchPlaceholder", { /** * The text that is provided as a hint in the lookup's search bar. */ get: function () { return this._getOption('searchPlaceholder'); }, set: function (value) { this._setOption('searchPlaceholder', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLookupComponent.prototype, "searchTimeout", { /** * Specifies the time delay, in milliseconds, after the last character has been typed in, before a search is executed. */ get: function () { return this._getOption('searchTimeout'); }, set: function (value) { this._setOption('searchTimeout', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLookupComponent.prototype, "selectedItem", { /** * Gets the currently selected item. */ get: function () { return this._getOption('selectedItem'); }, set: function (value) { this._setOption('selectedItem', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLookupComponent.prototype, "shading", { /** * A Boolean value specifying whether or not the main screen is inactive while the lookup is active. */ get: function () { return this._getOption('shading'); }, set: function (value) { this._setOption('shading', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLookupComponent.prototype, "showCancelButton", { /** * Specifies whether to display the Cancel button in the lookup window. */ get: function () { return this._getOption('showCancelButton'); }, set: function (value) { this._setOption('showCancelButton', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLookupComponent.prototype, "showClearButton", { /** * Specifies whether or not to display the Clear button in the lookup window. */ get: function () { return this._getOption('showClearButton'); }, set: function (value) { this._setOption('showClearButton', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLookupComponent.prototype, "showDataBeforeSearch", { /** * Specifies whether or not the widget displays unfiltered values until a user types a number of characters exceeding the minSearchLength option value. */ get: function () { return this._getOption('showDataBeforeSearch'); }, set: function (value) { this._setOption('showDataBeforeSearch', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLookupComponent.prototype, "showNextButton", { /** * Use the pageLoadMode option instead. */ get: function () { return this._getOption('showNextButton'); }, set: function (value) { this._setOption('showNextButton', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLookupComponent.prototype, "showPopupTitle", { /** * A Boolean value specifying whether or not to display the title in the popup window. */ get: function () { return this._getOption('showPopupTitle'); }, set: function (value) { this._setOption('showPopupTitle', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLookupComponent.prototype, "tabIndex", { /** * Specifies the number of the element when the Tab key is used for navigating. */ get: function () { return this._getOption('tabIndex'); }, set: function (value) { this._setOption('tabIndex', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLookupComponent.prototype, "text", { /** * The read-only option that holds the text displayed by the widget input element. */ get: function () { return this._getOption('text'); }, set: function (value) { this._setOption('text', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLookupComponent.prototype, "title", { /** * The title of the lookup window. */ get: function () { return this._getOption('title'); }, set: function (value) { this._setOption('title', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLookupComponent.prototype, "titleTemplate", { /** * Specifies a custom template for the title. */ get: function () { return this._getOption('titleTemplate'); }, set: function (value) { this._setOption('titleTemplate', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLookupComponent.prototype, "useNativeScrolling", { /** * Specifies whether or not the widget uses native scrolling. */ get: function () { return this._getOption('useNativeScrolling'); }, set: function (value) { this._setOption('useNativeScrolling', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLookupComponent.prototype, "usePopover", { /** * Specifies whether or not to show lookup contents in a Popover widget. */ get: function () { return this._getOption('usePopover'); }, set: function (value) { this._setOption('usePopover', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLookupComponent.prototype, "validationError", { /** * Specifies information on the validation error when using a custom validation engine. Should be changed at runtime along with the isValid option. */ get: function () { return this._getOption('validationError'); }, set: function (value) { this._setOption('validationError', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLookupComponent.prototype, "validationMessageMode", { /** * Specifies how the message about the validation rules that are not satisfied by this editor's value is displayed. */ get: function () { return this._getOption('validationMessageMode'); }, set: function (value) { this._setOption('validationMessageMode', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLookupComponent.prototype, "value", { /** * Specifies the currently selected value. May be an object if dataSource contains objects and valueExpr is not set. */ get: function () { return this._getOption('value'); }, set: function (value) { this._setOption('value', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLookupComponent.prototype, "valueChangeEvent", { /** * Specifies DOM event names that update a widget's value. */ get: function () { return this._getOption('valueChangeEvent'); }, set: function (value) { this._setOption('valueChangeEvent', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLookupComponent.prototype, "valueExpr", { /** * Specifies which data field provides the widget's value. When this option is not set, the value is the entire data object. */ get: function () { return this._getOption('valueExpr'); }, set: function (value) { this._setOption('valueExpr', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLookupComponent.prototype, "visible", { /** * Specifies whether the widget is visible. */ get: function () { return this._getOption('visible'); }, set: function (value) { this._setOption('visible', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxLookupComponent.prototype, "width", { /** * Specifies the widget's width. */ get: function () { return this._getOption('width'); }, set: function (value) { this._setOption('width', value); }, enumerable: true, configurable: true }); DxLookupComponent.prototype.change = function (_) { }; Object.defineProperty(DxLookupComponent.prototype, "itemsChildren", { get: function () { return this._getOption('items'); }, set: function (value) { this.setChildren('items', value); }, enumerable: true, configurable: true }); DxLookupComponent.prototype._createInstance = function (element, options) { var widget = new lookup_1.default(element, options); if (this.validator) { this.validator.createInstance(element); } return widget; }; DxLookupComponent.prototype.writeValue = function (value) { this.eventHelper.lockedValueChangeEvent = true; this.value = value; this.eventHelper.lockedValueChangeEvent = false; }; DxLookupComponent.prototype.setDisabledState = function (isDisabled) { this.disabled = isDisabled; }; DxLookupComponent.prototype.registerOnChange = function (fn) { this.change = fn; }; DxLookupComponent.prototype.registerOnTouched = function (fn) { this.touched = fn; }; DxLookupComponent.prototype._createWidget = function (element) { var _this = this; _super.prototype._createWidget.call(this, element); this.instance.on('focusOut', function (e) { _this.eventHelper.fireNgEvent('onBlur', [e]); }); }; DxLookupComponent.prototype.ngOnDestroy = function () { this._destroyWidget(); }; DxLookupComponent.prototype.ngOnChanges = function (changes) { _super.prototype.ngOnChanges.call(this, changes); this.setupChanges('dataSource', changes); this.setupChanges('items', changes); this.setupChanges('searchExpr', changes); }; DxLookupComponent.prototype.setupChanges = function (prop, changes) { if (!(prop in this._optionsToUpdate)) { this._idh.setup(prop, changes); } }; DxLookupComponent.prototype.ngDoCheck = function () { this._idh.doCheck('dataSource'); this._idh.doCheck('items'); this._idh.doCheck('searchExpr'); this._watcherHelper.checkWatchers(); _super.prototype.ngDoCheck.call(this); _super.prototype.clearChangedOptions.call(this); }; DxLookupComponent.prototype._setOption = function (name, value) { var isSetup = this._idh.setupSingle(name, value); var isChanged = this._idh.getChanges(name, value) !== null; if (isSetup || isChanged) { _super.prototype._setOption.call(this, name, value); } }; DxLookupComponent.prototype.ngAfterContentInit = function () { if (this.validator) { this.validator.renderOnViewInit = false; } }; DxLookupComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dx-lookup', template: '', providers: [ template_host_1.DxTemplateHost, watcher_helper_1.WatcherHelper, CUSTOM_VALUE_ACCESSOR_PROVIDER, nested_option_1.NestedOptionHost, iterable_differ_helper_1.IterableDifferHelper ] },] }, ]; /** @nocollapse */ DxLookupComponent.ctorParameters = function () { return [ { type: core_1.ElementRef, }, { type: core_1.NgZone, }, { type: template_host_1.DxTemplateHost, }, { type: watcher_helper_1.WatcherHelper, }, { type: iterable_differ_helper_1.IterableDifferHelper, }, { type: nested_option_1.NestedOptionHost, }, ]; }; DxLookupComponent.propDecorators = { 'validator': [{ type: core_1.ContentChild, args: [validator_1.DxValidatorComponent,] },], 'accessKey': [{ type: core_1.Input },], 'activeStateEnabled': [{ type: core_1.Input },], 'animation': [{ type: core_1.Input },], 'applyButtonText': [{ type: core_1.Input },], 'applyValueMode': [{ type: core_1.Input },], 'attr': [{ type: core_1.Input },], 'cancelButtonText': [{ type: core_1.Input },], 'cleanSearchOnOpening': [{ type: core_1.Input },], 'clearButtonText': [{ type: core_1.Input },], 'closeOnOutsideClick': [{ type: core_1.Input },], 'dataSource': [{ type: core_1.Input },], 'deferRendering': [{ type: core_1.Input },], 'disabled': [{ type: core_1.Input },], 'displayExpr': [{ type: core_1.Input },], 'displayValue': [{ type: core_1.Input },], 'dropDownButtonTemplate': [{ type: core_1.Input },], 'elementAttr': [{ type: core_1.Input },], 'fieldEditEnabled': [{ type: core_1.Input },], 'fieldTemplate': [{ type: core_1.Input },], 'focusStateEnabled': [{ type: core_1.Input },], 'fullScreen': [{ type: core_1.Input },], 'grouped': [{ type: core_1.Input },], 'groupTemplate': [{ type: core_1.Input },], 'height': [{ type: core_1.Input },], 'hint': [{ type: core_1.Input },], 'hoverStateEnabled': [{ type: core_1.Input },], 'inputAttr': [{ type: core_1.Input },], 'isValid': [{ type: core_1.Input },], 'items': [{ type: core_1.Input },], 'itemTemplate': [{ type: core_1.Input },], 'minSearchLength': [{ type: core_1.Input },], 'name': [{ type: core_1.Input },], 'nextButtonText': [{ type: core_1.Input },], 'noDataText': [{ type: core_1.Input },], 'opened': [{ type: core_1.Input },], 'pageLoadingText': [{ type: core_1.Input },], 'pageLoadMode': [{ type: core_1.Input },], 'pagingEnabled': [{ type: core_1.Input },], 'placeholder': [{ type: core_1.Input },], 'popupHeight': [{ type: core_1.Input },], 'popupWidth': [{ type: core_1.Input },], 'position': [{ type: core_1.Input },], 'pulledDownText': [{ type: core_1.Input },], 'pullingDownText': [{ type: core_1.Input },], 'pullRefreshEnabled': [{ type: core_1.Input },], 'refreshingText': [{ type: core_1.Input },], 'rtlEnabled': [{ type: core_1.Input },], 'searchEnabled': [{ type: core_1.Input },], 'searchExpr': [{ type: core_1.Input },], 'searchMode': [{ type: core_1.Input },], 'searchPlaceholder': [{ type: core_1.Input },], 'searchTimeout': [{ type: core_1.Input },], 'selectedItem': [{ type: core_1.Input },], 'shading': [{ type: core_1.Input },], 'showCancelButton': [{ type: core_1.Input },], 'showClearButton': [{ type: core_1.Input },], 'showDataBeforeSearch': [{ type: core_1.Input },], 'showNextButton': [{ type: core_1.Input },], 'showPopupTitle': [{ type: core_1.Input },], 'tabIndex': [{ type: core_1.Input },], 'text': [{ type: core_1.Input },], 'title': [{ type: core_1.Input },], 'titleTemplate': [{ type: core_1.Input },], 'useNativeScrolling': [{ type: core_1.Input },], 'usePopover': [{ type: core_1.Input },], 'validationError': [{ type: core_1.Input },], 'validationMessageMode': [{ type: core_1.Input },], 'value': [{ type: core_1.Input },], 'valueChangeEvent': [{ type: core_1.Input },], 'valueExpr': [{ type: core_1.Input },], 'visible': [{ type: core_1.Input },], 'width': [{ type: core_1.Input },], 'onClosed': [{ type: core_1.Output },], 'onContentReady': [{ type: core_1.Output },], 'onDisposing': [{ type: core_1.Output },], 'onInitialized': [{ type: core_1.Output },], 'onItemClick': [{ type: core_1.Output },], 'onOpened': [{ type: core_1.Output },], 'onOptionChanged': [{ type: core_1.Output },], 'onPageLoading': [{ type: core_1.Output },], 'onPullRefresh': [{ type: core_1.Output },], 'onScroll': [{ type: core_1.Output },], 'onSelectionChanged': [{ type: core_1.Output },], 'onTitleRendered': [{ type: core_1.Output },], 'onValueChanged': [{ type: core_1.Output },], 'accessKeyChange': [{ type: core_1.Output },], 'activeStateEnabledChange': [{ type: core_1.Output },], 'animationChange': [{ type: core_1.Output },], 'applyButtonTextChange': [{ type: core_1.Output },], 'applyValueModeChange': [{ type: core_1.Output },], 'attrChange': [{ type: core_1.Output },], 'cancelButtonTextChange': [{ type: core_1.Output },], 'cleanSearchOnOpeningChange': [{ type: core_1.Output },], 'clearButtonTextChange': [{ type: core_1.Output },], 'closeOnOutsideClickChange': [{ type: core_1.Output },], 'dataSourceChange': [{ type: core_1.Output },], 'deferRenderingChange': [{ type: core_1.Output },], 'disabledChange': [{ type: core_1.Output },], 'displayExprChange': [{ type: core_1.Output },], 'displayValueChange': [{ type: core_1.Output },], 'dropDownButtonTemplateChange': [{ type: core_1.Output },], 'elementAttrChange': [{ type: core_1.Output },], 'fieldEditEnabledChange': [{ type: core_1.Output },], 'fieldTemplateChange': [{ type: core_1.Output },], 'focusStateEnabledChange': [{ type: core_1.Output },], 'fullScreenChange': [{ type: core_1.Output },], 'groupedChange': [{ type: core_1.Output },], 'groupTemplateChange': [{ type: core_1.Output },], 'heightChange': [{ type: core_1.Output },], 'hintChange': [{ type: core_1.Output },], 'hoverStateEnabledChange': [{ type: core_1.Output },], 'inputAttrChange': [{ type: core_1.Output },], 'isValidChange': [{ type: core_1.Output },], 'itemsChange': [{ type: core_1.Output },], 'itemTemplateChange': [{ type: core_1.Output },], 'minSearchLengthChange': [{ type: core_1.Output },], 'nameChange': [{ type: core_1.Output },], 'nextButtonTextChange': [{ type: core_1.Output },], 'noDataTextChange': [{ type: core_1.Output },], 'openedChange': [{ type: core_1.Output },], 'pageLoadingTextChange': [{ type: core_1.Output },], 'pageLoadModeChange': [{ type: core_1.Output },], 'pagingEnabledChange': [{ type: core_1.Output },], 'placeholderChange': [{ type: core_1.Output },], 'popupHeightChange': [{ type: core_1.Output },], 'popupWidthChange': [{ type: core_1.Output },], 'positionChange': [{ type: core_1.Output },], 'pulledDownTextChange': [{ type: core_1.Output },], 'pullingDownTextChange': [{ type: core_1.Output },], 'pullRefreshEnabledChange': [{ type: core_1.Output },], 'refreshingTextChange': [{ type: core_1.Output },], 'rtlEnabledChange': [{ type: core_1.Output },], 'searchEnabledChange': [{ type: core_1.Output },], 'searchExprChange': [{ type: core_1.Output },], 'searchModeChange': [{ type: core_1.Output },], 'searchPlaceholderChange': [{ type: core_1.Output },], 'searchTimeoutChange': [{ type: core_1.Output },], 'selectedItemChange': [{ type: core_1.Output },], 'shadingChange': [{ type: core_1.Output },], 'showCancelButtonChange': [{ type: core_1.Output },], 'showClearButtonChange': [{ type: core_1.Output },], 'showDataBeforeSearchChange': [{ type: core_1.Output },], 'showNextButtonChange': [{ type: core_1.Output },], 'showPopupTitleChange': [{ type: core_1.Output },], 'tabIndexChange': [{ type: core_1.Output },], 'textChange': [{ type: core_1.Output },], 'titleChange': [{ type: core_1.Output },], 'titleTemplateChange': [{ type: core_1.Output },], 'useNativeScrollingChange': [{ type: core_1.Output },], 'usePopoverChange': [{ type: core_1.Output },], 'validationErrorChange': [{ type: core_1.Output },], 'validationMessageModeChange': [{ type: core_1.Output },], 'valueChange': [{ type: core_1.Output },], 'valueChangeEventChange': [{ type: core_1.Output },], 'valueExprChange': [{ type: core_1.Output },], 'visibleChange': [{ type: core_1.Output },], 'widthChange': [{ type: core_1.Output },], 'onBlur': [{ type: core_1.Output },], 'change': [{ type: core_1.HostListener, args: ['valueChange', ['$event'],] },], 'touched': [{ type: core_1.HostListener, args: ['onBlur', ['$event'],] },], 'itemsChildren': [{ type: core_1.ContentChildren, args: [item_dxi_2.DxiItemComponent,] },], }; return DxLookupComponent; }(component_1.DxComponent)); exports.DxLookupComponent = DxLookupComponent; var DxLookupModule = (function () { function DxLookupModule() { } DxLookupModule.decorators = [ { type: core_1.NgModule, args: [{ imports: [ animation_1.DxoAnimationModule, hide_1.DxoHideModule, show_1.DxoShowModule, item_dxi_1.DxiItemModule, position_1.DxoPositionModule, at_1.DxoAtModule, boundary_offset_1.DxoBoundaryOffsetModule, collision_1.DxoCollisionModule, my_1.DxoMyModule, offset_1.DxoOffsetModule, template_1.DxTemplateModule ], declarations: [ DxLookupComponent ], exports: [ DxLookupComponent, animation_1.DxoAnimationModule, hide_1.DxoHideModule, show_1.DxoShowModule, item_dxi_1.DxiItemModule, position_1.DxoPositionModule, at_1.DxoAtModule, boundary_offset_1.DxoBoundaryOffsetModule, collision_1.DxoCollisionModule, my_1.DxoMyModule, offset_1.DxoOffsetModule, template_1.DxTemplateModule ], },] }, ]; /** @nocollapse */ DxLookupModule.ctorParameters = function () { return []; }; return DxLookupModule; }()); exports.DxLookupModule = DxLookupModule; //# sourceMappingURL=lookup.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/map.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var map_1 = __webpack_require__("./node_modules/devextreme/ui/map.js"); var component_1 = __webpack_require__("./node_modules/devextreme-angular/core/component.js"); var template_host_1 = __webpack_require__("./node_modules/devextreme-angular/core/template-host.js"); var template_1 = __webpack_require__("./node_modules/devextreme-angular/core/template.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var watcher_helper_1 = __webpack_require__("./node_modules/devextreme-angular/core/watcher-helper.js"); var iterable_differ_helper_1 = __webpack_require__("./node_modules/devextreme-angular/core/iterable-differ-helper.js"); var center_dxi_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/center-dxi.js"); var key_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/key.js"); var marker_dxi_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/marker-dxi.js"); var location_dxi_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/location-dxi.js"); var tooltip_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/tooltip.js"); var route_dxi_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/route-dxi.js"); var center_dxi_2 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/center-dxi.js"); var marker_dxi_2 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/marker-dxi.js"); var route_dxi_2 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/route-dxi.js"); /** * The Map is an interactive widget that displays a geographic map with markers and routes. */ var DxMapComponent = (function (_super) { __extends(DxMapComponent, _super); function DxMapComponent(elementRef, ngZone, templateHost, _watcherHelper, _idh, optionHost) { var _this = _super.call(this, elementRef, ngZone, templateHost, _watcherHelper) || this; _this._watcherHelper = _watcherHelper; _this._idh = _idh; _this._createEventEmitters([ { subscribe: 'click', emit: 'onClick' }, { subscribe: 'disposing', emit: 'onDisposing' }, { subscribe: 'initialized', emit: 'onInitialized' }, { subscribe: 'markerAdded', emit: 'onMarkerAdded' }, { subscribe: 'markerRemoved', emit: 'onMarkerRemoved' }, { subscribe: 'optionChanged', emit: 'onOptionChanged' }, { subscribe: 'ready', emit: 'onReady' }, { subscribe: 'routeAdded', emit: 'onRouteAdded' }, { subscribe: 'routeRemoved', emit: 'onRouteRemoved' }, { emit: 'accessKeyChange' }, { emit: 'activeStateEnabledChange' }, { emit: 'autoAdjustChange' }, { emit: 'centerChange' }, { emit: 'controlsChange' }, { emit: 'disabledChange' }, { emit: 'elementAttrChange' }, { emit: 'focusStateEnabledChange' }, { emit: 'heightChange' }, { emit: 'hintChange' }, { emit: 'hoverStateEnabledChange' }, { emit: 'keyChange' }, { emit: 'markerIconSrcChange' }, { emit: 'markersChange' }, { emit: 'providerChange' }, { emit: 'routesChange' }, { emit: 'rtlEnabledChange' }, { emit: 'tabIndexChange' }, { emit: 'typeChange' }, { emit: 'visibleChange' }, { emit: 'widthChange' }, { emit: 'zoomChange' } ]); _this._idh.setHost(_this); optionHost.setHost(_this); return _this; } Object.defineProperty(DxMapComponent.prototype, "accessKey", { /** * Specifies the shortcut key that sets focus on the widget. */ get: function () { return this._getOption('accessKey'); }, set: function (value) { this._setOption('accessKey', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxMapComponent.prototype, "activeStateEnabled", { /** * Specifies whether or not the widget changes its state when interacting with a user. */ get: function () { return this._getOption('activeStateEnabled'); }, set: function (value) { this._setOption('activeStateEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxMapComponent.prototype, "autoAdjust", { /** * Specifies whether or not the widget automatically adjusts center and zoom option values when adding a new marker or route, or when creating a widget if it initially contains markers or routes. */ get: function () { return this._getOption('autoAdjust'); }, set: function (value) { this._setOption('autoAdjust', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxMapComponent.prototype, "center", { /** * An object, a string, or an array specifying the location displayed at the center of the widget. */ get: function () { return this._getOption('center'); }, set: function (value) { this._setOption('center', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxMapComponent.prototype, "controls", { /** * Specifies whether or not map widget controls are available. */ get: function () { return this._getOption('controls'); }, set: function (value) { this._setOption('controls', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxMapComponent.prototype, "disabled", { /** * Specifies whether the widget responds to user interaction. */ get: function () { return this._getOption('disabled'); }, set: function (value) { this._setOption('disabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxMapComponent.prototype, "elementAttr", { /** * Specifies the attributes to be attached to the widget's root element. */ get: function () { return this._getOption('elementAttr'); }, set: function (value) { this._setOption('elementAttr', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxMapComponent.prototype, "focusStateEnabled", { /** * Specifies whether the widget can be focused using keyboard navigation. */ get: function () { return this._getOption('focusStateEnabled'); }, set: function (value) { this._setOption('focusStateEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxMapComponent.prototype, "height", { /** * Specifies the widget's height. */ get: function () { return this._getOption('height'); }, set: function (value) { this._setOption('height', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxMapComponent.prototype, "hint", { /** * Specifies text for a hint that appears when a user pauses on the widget. */ get: function () { return this._getOption('hint'); }, set: function (value) { this._setOption('hint', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxMapComponent.prototype, "hoverStateEnabled", { /** * Specifies whether the widget changes its state when a user pauses on it. */ get: function () { return this._getOption('hoverStateEnabled'); }, set: function (value) { this._setOption('hoverStateEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxMapComponent.prototype, "key", { /** * A key used to authenticate the application within the required map provider. */ get: function () { return this._getOption('key'); }, set: function (value) { this._setOption('key', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxMapComponent.prototype, "markerIconSrc", { /** * A URL pointing to the custom icon to be used for map markers. */ get: function () { return this._getOption('markerIconSrc'); }, set: function (value) { this._setOption('markerIconSrc', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxMapComponent.prototype, "markers", { /** * An array of markers displayed on a map. */ get: function () { return this._getOption('markers'); }, set: function (value) { this._setOption('markers', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxMapComponent.prototype, "provider", { /** * The name of the current map data provider. */ get: function () { return this._getOption('provider'); }, set: function (value) { this._setOption('provider', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxMapComponent.prototype, "routes", { /** * An array of routes shown on the map. */ get: function () { return this._getOption('routes'); }, set: function (value) { this._setOption('routes', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxMapComponent.prototype, "rtlEnabled", { /** * Switches the widget to a right-to-left representation. */ get: function () { return this._getOption('rtlEnabled'); }, set: function (value) { this._setOption('rtlEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxMapComponent.prototype, "tabIndex", { /** * Specifies the number of the element when the Tab key is used for navigating. */ get: function () { return this._getOption('tabIndex'); }, set: function (value) { this._setOption('tabIndex', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxMapComponent.prototype, "type", { /** * The type of a map to display. */ get: function () { return this._getOption('type'); }, set: function (value) { this._setOption('type', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxMapComponent.prototype, "visible", { /** * Specifies whether the widget is visible. */ get: function () { return this._getOption('visible'); }, set: function (value) { this._setOption('visible', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxMapComponent.prototype, "width", { /** * Specifies the widget's width. */ get: function () { return this._getOption('width'); }, set: function (value) { this._setOption('width', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxMapComponent.prototype, "zoom", { /** * The zoom level of the map. */ get: function () { return this._getOption('zoom'); }, set: function (value) { this._setOption('zoom', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxMapComponent.prototype, "centerChildren", { get: function () { return this._getOption('center'); }, set: function (value) { this.setChildren('center', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxMapComponent.prototype, "markersChildren", { get: function () { return this._getOption('markers'); }, set: function (value) { this.setChildren('markers', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxMapComponent.prototype, "routesChildren", { get: function () { return this._getOption('routes'); }, set: function (value) { this.setChildren('routes', value); }, enumerable: true, configurable: true }); DxMapComponent.prototype._createInstance = function (element, options) { return new map_1.default(element, options); }; DxMapComponent.prototype.ngOnDestroy = function () { this._destroyWidget(); }; DxMapComponent.prototype.ngOnChanges = function (changes) { _super.prototype.ngOnChanges.call(this, changes); this.setupChanges('center', changes); this.setupChanges('markers', changes); this.setupChanges('routes', changes); }; DxMapComponent.prototype.setupChanges = function (prop, changes) { if (!(prop in this._optionsToUpdate)) { this._idh.setup(prop, changes); } }; DxMapComponent.prototype.ngDoCheck = function () { this._idh.doCheck('center'); this._idh.doCheck('markers'); this._idh.doCheck('routes'); this._watcherHelper.checkWatchers(); _super.prototype.ngDoCheck.call(this); _super.prototype.clearChangedOptions.call(this); }; DxMapComponent.prototype._setOption = function (name, value) { var isSetup = this._idh.setupSingle(name, value); var isChanged = this._idh.getChanges(name, value) !== null; if (isSetup || isChanged) { _super.prototype._setOption.call(this, name, value); } }; DxMapComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dx-map', template: '', providers: [ template_host_1.DxTemplateHost, watcher_helper_1.WatcherHelper, nested_option_1.NestedOptionHost, iterable_differ_helper_1.IterableDifferHelper ] },] }, ]; /** @nocollapse */ DxMapComponent.ctorParameters = function () { return [ { type: core_1.ElementRef, }, { type: core_1.NgZone, }, { type: template_host_1.DxTemplateHost, }, { type: watcher_helper_1.WatcherHelper, }, { type: iterable_differ_helper_1.IterableDifferHelper, }, { type: nested_option_1.NestedOptionHost, }, ]; }; DxMapComponent.propDecorators = { 'accessKey': [{ type: core_1.Input },], 'activeStateEnabled': [{ type: core_1.Input },], 'autoAdjust': [{ type: core_1.Input },], 'center': [{ type: core_1.Input },], 'controls': [{ type: core_1.Input },], 'disabled': [{ type: core_1.Input },], 'elementAttr': [{ type: core_1.Input },], 'focusStateEnabled': [{ type: core_1.Input },], 'height': [{ type: core_1.Input },], 'hint': [{ type: core_1.Input },], 'hoverStateEnabled': [{ type: core_1.Input },], 'key': [{ type: core_1.Input },], 'markerIconSrc': [{ type: core_1.Input },], 'markers': [{ type: core_1.Input },], 'provider': [{ type: core_1.Input },], 'routes': [{ type: core_1.Input },], 'rtlEnabled': [{ type: core_1.Input },], 'tabIndex': [{ type: core_1.Input },], 'type': [{ type: core_1.Input },], 'visible': [{ type: core_1.Input },], 'width': [{ type: core_1.Input },], 'zoom': [{ type: core_1.Input },], 'onClick': [{ type: core_1.Output },], 'onDisposing': [{ type: core_1.Output },], 'onInitialized': [{ type: core_1.Output },], 'onMarkerAdded': [{ type: core_1.Output },], 'onMarkerRemoved': [{ type: core_1.Output },], 'onOptionChanged': [{ type: core_1.Output },], 'onReady': [{ type: core_1.Output },], 'onRouteAdded': [{ type: core_1.Output },], 'onRouteRemoved': [{ type: core_1.Output },], 'accessKeyChange': [{ type: core_1.Output },], 'activeStateEnabledChange': [{ type: core_1.Output },], 'autoAdjustChange': [{ type: core_1.Output },], 'centerChange': [{ type: core_1.Output },], 'controlsChange': [{ type: core_1.Output },], 'disabledChange': [{ type: core_1.Output },], 'elementAttrChange': [{ type: core_1.Output },], 'focusStateEnabledChange': [{ type: core_1.Output },], 'heightChange': [{ type: core_1.Output },], 'hintChange': [{ type: core_1.Output },], 'hoverStateEnabledChange': [{ type: core_1.Output },], 'keyChange': [{ type: core_1.Output },], 'markerIconSrcChange': [{ type: core_1.Output },], 'markersChange': [{ type: core_1.Output },], 'providerChange': [{ type: core_1.Output },], 'routesChange': [{ type: core_1.Output },], 'rtlEnabledChange': [{ type: core_1.Output },], 'tabIndexChange': [{ type: core_1.Output },], 'typeChange': [{ type: core_1.Output },], 'visibleChange': [{ type: core_1.Output },], 'widthChange': [{ type: core_1.Output },], 'zoomChange': [{ type: core_1.Output },], 'centerChildren': [{ type: core_1.ContentChildren, args: [center_dxi_2.DxiCenterComponent,] },], 'markersChildren': [{ type: core_1.ContentChildren, args: [marker_dxi_2.DxiMarkerComponent,] },], 'routesChildren': [{ type: core_1.ContentChildren, args: [route_dxi_2.DxiRouteComponent,] },], }; return DxMapComponent; }(component_1.DxComponent)); exports.DxMapComponent = DxMapComponent; var DxMapModule = (function () { function DxMapModule() { } DxMapModule.decorators = [ { type: core_1.NgModule, args: [{ imports: [ center_dxi_1.DxiCenterModule, key_1.DxoKeyModule, marker_dxi_1.DxiMarkerModule, location_dxi_1.DxiLocationModule, tooltip_1.DxoTooltipModule, route_dxi_1.DxiRouteModule, template_1.DxTemplateModule ], declarations: [ DxMapComponent ], exports: [ DxMapComponent, center_dxi_1.DxiCenterModule, key_1.DxoKeyModule, marker_dxi_1.DxiMarkerModule, location_dxi_1.DxiLocationModule, tooltip_1.DxoTooltipModule, route_dxi_1.DxiRouteModule, template_1.DxTemplateModule ], },] }, ]; /** @nocollapse */ DxMapModule.ctorParameters = function () { return []; }; return DxMapModule; }()); exports.DxMapModule = DxMapModule; //# sourceMappingURL=map.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/menu.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var menu_1 = __webpack_require__("./node_modules/devextreme/ui/menu.js"); var component_1 = __webpack_require__("./node_modules/devextreme-angular/core/component.js"); var template_host_1 = __webpack_require__("./node_modules/devextreme-angular/core/template-host.js"); var template_1 = __webpack_require__("./node_modules/devextreme-angular/core/template.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var watcher_helper_1 = __webpack_require__("./node_modules/devextreme-angular/core/watcher-helper.js"); var iterable_differ_helper_1 = __webpack_require__("./node_modules/devextreme-angular/core/iterable-differ-helper.js"); var animation_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/animation.js"); var hide_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/hide.js"); var show_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/show.js"); var item_dxi_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/item-dxi.js"); var show_first_submenu_mode_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/show-first-submenu-mode.js"); var delay_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/delay.js"); var show_submenu_mode_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/show-submenu-mode.js"); var item_dxi_2 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/item-dxi.js"); /** * The Menu widget is a panel with clickable items. A click on an item opens a drop-down menu, which can contain several submenus. */ var DxMenuComponent = (function (_super) { __extends(DxMenuComponent, _super); function DxMenuComponent(elementRef, ngZone, templateHost, _watcherHelper, _idh, optionHost) { var _this = _super.call(this, elementRef, ngZone, templateHost, _watcherHelper) || this; _this._watcherHelper = _watcherHelper; _this._idh = _idh; _this._createEventEmitters([ { subscribe: 'contentReady', emit: 'onContentReady' }, { subscribe: 'disposing', emit: 'onDisposing' }, { subscribe: 'initialized', emit: 'onInitialized' }, { subscribe: 'itemClick', emit: 'onItemClick' }, { subscribe: 'itemContextMenu', emit: 'onItemContextMenu' }, { subscribe: 'itemRendered', emit: 'onItemRendered' }, { subscribe: 'optionChanged', emit: 'onOptionChanged' }, { subscribe: 'selectionChanged', emit: 'onSelectionChanged' }, { subscribe: 'submenuHidden', emit: 'onSubmenuHidden' }, { subscribe: 'submenuHiding', emit: 'onSubmenuHiding' }, { subscribe: 'submenuShowing', emit: 'onSubmenuShowing' }, { subscribe: 'submenuShown', emit: 'onSubmenuShown' }, { emit: 'accessKeyChange' }, { emit: 'activeStateEnabledChange' }, { emit: 'adaptivityEnabledChange' }, { emit: 'animationChange' }, { emit: 'cssClassChange' }, { emit: 'dataSourceChange' }, { emit: 'disabledChange' }, { emit: 'disabledExprChange' }, { emit: 'displayExprChange' }, { emit: 'elementAttrChange' }, { emit: 'focusStateEnabledChange' }, { emit: 'heightChange' }, { emit: 'hideSubmenuOnMouseLeaveChange' }, { emit: 'hintChange' }, { emit: 'hoverStateEnabledChange' }, { emit: 'itemsChange' }, { emit: 'itemsExprChange' }, { emit: 'itemTemplateChange' }, { emit: 'orientationChange' }, { emit: 'rtlEnabledChange' }, { emit: 'selectByClickChange' }, { emit: 'selectedExprChange' }, { emit: 'selectedItemChange' }, { emit: 'selectionByClickChange' }, { emit: 'selectionModeChange' }, { emit: 'showFirstSubmenuModeChange' }, { emit: 'showSubmenuModeChange' }, { emit: 'submenuDirectionChange' }, { emit: 'tabIndexChange' }, { emit: 'visibleChange' }, { emit: 'widthChange' } ]); _this._idh.setHost(_this); optionHost.setHost(_this); return _this; } Object.defineProperty(DxMenuComponent.prototype, "accessKey", { /** * Specifies the shortcut key that sets focus on the widget. */ get: function () { return this._getOption('accessKey'); }, set: function (value) { this._setOption('accessKey', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxMenuComponent.prototype, "activeStateEnabled", { /** * A Boolean value specifying whether or not the widget changes its state when interacting with a user. */ get: function () { return this._getOption('activeStateEnabled'); }, set: function (value) { this._setOption('activeStateEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxMenuComponent.prototype, "adaptivityEnabled", { /** * Specifies whether adaptive widget rendering is enabled on small screens. Applies only if the orientation is "horizontal". */ get: function () { return this._getOption('adaptivityEnabled'); }, set: function (value) { this._setOption('adaptivityEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxMenuComponent.prototype, "animation", { /** * Configures widget visibility animations. This object contains two fields: show and hide. */ get: function () { return this._getOption('animation'); }, set: function (value) { this._setOption('animation', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxMenuComponent.prototype, "cssClass", { /** * Specifies the name of the CSS class to be applied to the root menu level and all submenus. */ get: function () { return this._getOption('cssClass'); }, set: function (value) { this._setOption('cssClass', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxMenuComponent.prototype, "dataSource", { /** * A data source used to fetch data to be displayed by the widget. */ get: function () { return this._getOption('dataSource'); }, set: function (value) { this._setOption('dataSource', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxMenuComponent.prototype, "disabled", { /** * Specifies whether the widget responds to user interaction. */ get: function () { return this._getOption('disabled'); }, set: function (value) { this._setOption('disabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxMenuComponent.prototype, "disabledExpr", { /** * Specifies the name of the data source item field whose value defines whether or not the corresponding widget item is disabled. */ get: function () { return this._getOption('disabledExpr'); }, set: function (value) { this._setOption('disabledExpr', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxMenuComponent.prototype, "displayExpr", { /** * Specifies the name of the data source item field whose value is displayed by the widget. */ get: function () { return this._getOption('displayExpr'); }, set: function (value) { this._setOption('displayExpr', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxMenuComponent.prototype, "elementAttr", { /** * Specifies the attributes to be attached to the widget's root element. */ get: function () { return this._getOption('elementAttr'); }, set: function (value) { this._setOption('elementAttr', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxMenuComponent.prototype, "focusStateEnabled", { /** * Specifies whether the widget can be focused using keyboard navigation. */ get: function () { return this._getOption('focusStateEnabled'); }, set: function (value) { this._setOption('focusStateEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxMenuComponent.prototype, "height", { /** * Specifies the widget's height. */ get: function () { return this._getOption('height'); }, set: function (value) { this._setOption('height', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxMenuComponent.prototype, "hideSubmenuOnMouseLeave", { /** * Specifies whether or not the submenu is hidden when the mouse pointer leaves it. */ get: function () { return this._getOption('hideSubmenuOnMouseLeave'); }, set: function (value) { this._setOption('hideSubmenuOnMouseLeave', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxMenuComponent.prototype, "hint", { /** * Specifies text for a hint that appears when a user pauses on the widget. */ get: function () { return this._getOption('hint'); }, set: function (value) { this._setOption('hint', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxMenuComponent.prototype, "hoverStateEnabled", { /** * Specifies whether the widget changes its state when a user pauses on it. */ get: function () { return this._getOption('hoverStateEnabled'); }, set: function (value) { this._setOption('hoverStateEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxMenuComponent.prototype, "items", { /** * Holds an array of menu items. */ get: function () { return this._getOption('items'); }, set: function (value) { this._setOption('items', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxMenuComponent.prototype, "itemsExpr", { /** * Specifies which data field contains nested items. */ get: function () { return this._getOption('itemsExpr'); }, set: function (value) { this._setOption('itemsExpr', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxMenuComponent.prototype, "itemTemplate", { /** * Specifies a custom template for items. */ get: function () { return this._getOption('itemTemplate'); }, set: function (value) { this._setOption('itemTemplate', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxMenuComponent.prototype, "orientation", { /** * Specifies whether the menu has horizontal or vertical orientation. */ get: function () { return this._getOption('orientation'); }, set: function (value) { this._setOption('orientation', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxMenuComponent.prototype, "rtlEnabled", { /** * Switches the widget to a right-to-left representation. */ get: function () { return this._getOption('rtlEnabled'); }, set: function (value) { this._setOption('rtlEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxMenuComponent.prototype, "selectByClick", { /** * Specifies whether or not an item becomes selected if a user clicks it. */ get: function () { return this._getOption('selectByClick'); }, set: function (value) { this._setOption('selectByClick', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxMenuComponent.prototype, "selectedExpr", { /** * Specifies the name of the data source item field whose value defines whether or not the corresponding widget items is selected. */ get: function () { return this._getOption('selectedExpr'); }, set: function (value) { this._setOption('selectedExpr', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxMenuComponent.prototype, "selectedItem", { /** * The selected item object. */ get: function () { return this._getOption('selectedItem'); }, set: function (value) { this._setOption('selectedItem', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxMenuComponent.prototype, "selectionByClick", { /** * Use the selectByClick option instead. */ get: function () { return this._getOption('selectionByClick'); }, set: function (value) { this._setOption('selectionByClick', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxMenuComponent.prototype, "selectionMode", { /** * Specifies the selection mode supported by the menu. */ get: function () { return this._getOption('selectionMode'); }, set: function (value) { this._setOption('selectionMode', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxMenuComponent.prototype, "showFirstSubmenuMode", { /** * Specifies options for showing and hiding the first level submenu. */ get: function () { return this._getOption('showFirstSubmenuMode'); }, set: function (value) { this._setOption('showFirstSubmenuMode', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxMenuComponent.prototype, "showSubmenuMode", { /** * Specifies options of submenu showing and hiding. */ get: function () { return this._getOption('showSubmenuMode'); }, set: function (value) { this._setOption('showSubmenuMode', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxMenuComponent.prototype, "submenuDirection", { /** * Specifies the direction at which the submenus are displayed. */ get: function () { return this._getOption('submenuDirection'); }, set: function (value) { this._setOption('submenuDirection', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxMenuComponent.prototype, "tabIndex", { /** * Specifies the number of the element when the Tab key is used for navigating. */ get: function () { return this._getOption('tabIndex'); }, set: function (value) { this._setOption('tabIndex', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxMenuComponent.prototype, "visible", { /** * Specifies whether the widget is visible. */ get: function () { return this._getOption('visible'); }, set: function (value) { this._setOption('visible', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxMenuComponent.prototype, "width", { /** * Specifies the widget's width. */ get: function () { return this._getOption('width'); }, set: function (value) { this._setOption('width', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxMenuComponent.prototype, "itemsChildren", { get: function () { return this._getOption('items'); }, set: function (value) { this.setChildren('items', value); }, enumerable: true, configurable: true }); DxMenuComponent.prototype._createInstance = function (element, options) { return new menu_1.default(element, options); }; DxMenuComponent.prototype.ngOnDestroy = function () { this._destroyWidget(); }; DxMenuComponent.prototype.ngOnChanges = function (changes) { _super.prototype.ngOnChanges.call(this, changes); this.setupChanges('dataSource', changes); this.setupChanges('items', changes); }; DxMenuComponent.prototype.setupChanges = function (prop, changes) { if (!(prop in this._optionsToUpdate)) { this._idh.setup(prop, changes); } }; DxMenuComponent.prototype.ngDoCheck = function () { this._idh.doCheck('dataSource'); this._idh.doCheck('items'); this._watcherHelper.checkWatchers(); _super.prototype.ngDoCheck.call(this); _super.prototype.clearChangedOptions.call(this); }; DxMenuComponent.prototype._setOption = function (name, value) { var isSetup = this._idh.setupSingle(name, value); var isChanged = this._idh.getChanges(name, value) !== null; if (isSetup || isChanged) { _super.prototype._setOption.call(this, name, value); } }; DxMenuComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dx-menu', template: '', providers: [ template_host_1.DxTemplateHost, watcher_helper_1.WatcherHelper, nested_option_1.NestedOptionHost, iterable_differ_helper_1.IterableDifferHelper ] },] }, ]; /** @nocollapse */ DxMenuComponent.ctorParameters = function () { return [ { type: core_1.ElementRef, }, { type: core_1.NgZone, }, { type: template_host_1.DxTemplateHost, }, { type: watcher_helper_1.WatcherHelper, }, { type: iterable_differ_helper_1.IterableDifferHelper, }, { type: nested_option_1.NestedOptionHost, }, ]; }; DxMenuComponent.propDecorators = { 'accessKey': [{ type: core_1.Input },], 'activeStateEnabled': [{ type: core_1.Input },], 'adaptivityEnabled': [{ type: core_1.Input },], 'animation': [{ type: core_1.Input },], 'cssClass': [{ type: core_1.Input },], 'dataSource': [{ type: core_1.Input },], 'disabled': [{ type: core_1.Input },], 'disabledExpr': [{ type: core_1.Input },], 'displayExpr': [{ type: core_1.Input },], 'elementAttr': [{ type: core_1.Input },], 'focusStateEnabled': [{ type: core_1.Input },], 'height': [{ type: core_1.Input },], 'hideSubmenuOnMouseLeave': [{ type: core_1.Input },], 'hint': [{ type: core_1.Input },], 'hoverStateEnabled': [{ type: core_1.Input },], 'items': [{ type: core_1.Input },], 'itemsExpr': [{ type: core_1.Input },], 'itemTemplate': [{ type: core_1.Input },], 'orientation': [{ type: core_1.Input },], 'rtlEnabled': [{ type: core_1.Input },], 'selectByClick': [{ type: core_1.Input },], 'selectedExpr': [{ type: core_1.Input },], 'selectedItem': [{ type: core_1.Input },], 'selectionByClick': [{ type: core_1.Input },], 'selectionMode': [{ type: core_1.Input },], 'showFirstSubmenuMode': [{ type: core_1.Input },], 'showSubmenuMode': [{ type: core_1.Input },], 'submenuDirection': [{ type: core_1.Input },], 'tabIndex': [{ type: core_1.Input },], 'visible': [{ type: core_1.Input },], 'width': [{ type: core_1.Input },], 'onContentReady': [{ type: core_1.Output },], 'onDisposing': [{ type: core_1.Output },], 'onInitialized': [{ type: core_1.Output },], 'onItemClick': [{ type: core_1.Output },], 'onItemContextMenu': [{ type: core_1.Output },], 'onItemRendered': [{ type: core_1.Output },], 'onOptionChanged': [{ type: core_1.Output },], 'onSelectionChanged': [{ type: core_1.Output },], 'onSubmenuHidden': [{ type: core_1.Output },], 'onSubmenuHiding': [{ type: core_1.Output },], 'onSubmenuShowing': [{ type: core_1.Output },], 'onSubmenuShown': [{ type: core_1.Output },], 'accessKeyChange': [{ type: core_1.Output },], 'activeStateEnabledChange': [{ type: core_1.Output },], 'adaptivityEnabledChange': [{ type: core_1.Output },], 'animationChange': [{ type: core_1.Output },], 'cssClassChange': [{ type: core_1.Output },], 'dataSourceChange': [{ type: core_1.Output },], 'disabledChange': [{ type: core_1.Output },], 'disabledExprChange': [{ type: core_1.Output },], 'displayExprChange': [{ type: core_1.Output },], 'elementAttrChange': [{ type: core_1.Output },], 'focusStateEnabledChange': [{ type: core_1.Output },], 'heightChange': [{ type: core_1.Output },], 'hideSubmenuOnMouseLeaveChange': [{ type: core_1.Output },], 'hintChange': [{ type: core_1.Output },], 'hoverStateEnabledChange': [{ type: core_1.Output },], 'itemsChange': [{ type: core_1.Output },], 'itemsExprChange': [{ type: core_1.Output },], 'itemTemplateChange': [{ type: core_1.Output },], 'orientationChange': [{ type: core_1.Output },], 'rtlEnabledChange': [{ type: core_1.Output },], 'selectByClickChange': [{ type: core_1.Output },], 'selectedExprChange': [{ type: core_1.Output },], 'selectedItemChange': [{ type: core_1.Output },], 'selectionByClickChange': [{ type: core_1.Output },], 'selectionModeChange': [{ type: core_1.Output },], 'showFirstSubmenuModeChange': [{ type: core_1.Output },], 'showSubmenuModeChange': [{ type: core_1.Output },], 'submenuDirectionChange': [{ type: core_1.Output },], 'tabIndexChange': [{ type: core_1.Output },], 'visibleChange': [{ type: core_1.Output },], 'widthChange': [{ type: core_1.Output },], 'itemsChildren': [{ type: core_1.ContentChildren, args: [item_dxi_2.DxiItemComponent,] },], }; return DxMenuComponent; }(component_1.DxComponent)); exports.DxMenuComponent = DxMenuComponent; var DxMenuModule = (function () { function DxMenuModule() { } DxMenuModule.decorators = [ { type: core_1.NgModule, args: [{ imports: [ animation_1.DxoAnimationModule, hide_1.DxoHideModule, show_1.DxoShowModule, item_dxi_1.DxiItemModule, show_first_submenu_mode_1.DxoShowFirstSubmenuModeModule, delay_1.DxoDelayModule, show_submenu_mode_1.DxoShowSubmenuModeModule, template_1.DxTemplateModule ], declarations: [ DxMenuComponent ], exports: [ DxMenuComponent, animation_1.DxoAnimationModule, hide_1.DxoHideModule, show_1.DxoShowModule, item_dxi_1.DxiItemModule, show_first_submenu_mode_1.DxoShowFirstSubmenuModeModule, delay_1.DxoDelayModule, show_submenu_mode_1.DxoShowSubmenuModeModule, template_1.DxTemplateModule ], },] }, ]; /** @nocollapse */ DxMenuModule.ctorParameters = function () { return []; }; return DxMenuModule; }()); exports.DxMenuModule = DxMenuModule; //# sourceMappingURL=menu.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/multi-view.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var multi_view_1 = __webpack_require__("./node_modules/devextreme/ui/multi_view.js"); var component_1 = __webpack_require__("./node_modules/devextreme-angular/core/component.js"); var template_host_1 = __webpack_require__("./node_modules/devextreme-angular/core/template-host.js"); var template_1 = __webpack_require__("./node_modules/devextreme-angular/core/template.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var watcher_helper_1 = __webpack_require__("./node_modules/devextreme-angular/core/watcher-helper.js"); var iterable_differ_helper_1 = __webpack_require__("./node_modules/devextreme-angular/core/iterable-differ-helper.js"); var item_dxi_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/item-dxi.js"); var item_dxi_2 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/item-dxi.js"); /** * The MultiView is a widget that contains several views. An end user navigates through the views by swiping them in the horizontal direction. */ var DxMultiViewComponent = (function (_super) { __extends(DxMultiViewComponent, _super); function DxMultiViewComponent(elementRef, ngZone, templateHost, _watcherHelper, _idh, optionHost) { var _this = _super.call(this, elementRef, ngZone, templateHost, _watcherHelper) || this; _this._watcherHelper = _watcherHelper; _this._idh = _idh; _this._createEventEmitters([ { subscribe: 'contentReady', emit: 'onContentReady' }, { subscribe: 'disposing', emit: 'onDisposing' }, { subscribe: 'initialized', emit: 'onInitialized' }, { subscribe: 'itemClick', emit: 'onItemClick' }, { subscribe: 'itemContextMenu', emit: 'onItemContextMenu' }, { subscribe: 'itemHold', emit: 'onItemHold' }, { subscribe: 'itemRendered', emit: 'onItemRendered' }, { subscribe: 'optionChanged', emit: 'onOptionChanged' }, { subscribe: 'selectionChanged', emit: 'onSelectionChanged' }, { emit: 'accessKeyChange' }, { emit: 'activeStateEnabledChange' }, { emit: 'animationEnabledChange' }, { emit: 'dataSourceChange' }, { emit: 'deferRenderingChange' }, { emit: 'disabledChange' }, { emit: 'elementAttrChange' }, { emit: 'focusStateEnabledChange' }, { emit: 'heightChange' }, { emit: 'hintChange' }, { emit: 'hoverStateEnabledChange' }, { emit: 'itemHoldTimeoutChange' }, { emit: 'itemsChange' }, { emit: 'itemTemplateChange' }, { emit: 'loopChange' }, { emit: 'noDataTextChange' }, { emit: 'rtlEnabledChange' }, { emit: 'selectedIndexChange' }, { emit: 'selectedItemChange' }, { emit: 'swipeEnabledChange' }, { emit: 'tabIndexChange' }, { emit: 'visibleChange' }, { emit: 'widthChange' } ]); _this._idh.setHost(_this); optionHost.setHost(_this); return _this; } Object.defineProperty(DxMultiViewComponent.prototype, "accessKey", { /** * Specifies the shortcut key that sets focus on the widget. */ get: function () { return this._getOption('accessKey'); }, set: function (value) { this._setOption('accessKey', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxMultiViewComponent.prototype, "activeStateEnabled", { /** * Specifies whether or not the widget changes its state when interacting with a user. */ get: function () { return this._getOption('activeStateEnabled'); }, set: function (value) { this._setOption('activeStateEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxMultiViewComponent.prototype, "animationEnabled", { /** * Specifies whether or not to animate the displayed item change. */ get: function () { return this._getOption('animationEnabled'); }, set: function (value) { this._setOption('animationEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxMultiViewComponent.prototype, "dataSource", { /** * A data source used to fetch data to be displayed by the widget. */ get: function () { return this._getOption('dataSource'); }, set: function (value) { this._setOption('dataSource', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxMultiViewComponent.prototype, "deferRendering", { /** * Specifies whether widget content is rendered when the widget is shown or when rendering the widget. */ get: function () { return this._getOption('deferRendering'); }, set: function (value) { this._setOption('deferRendering', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxMultiViewComponent.prototype, "disabled", { /** * Specifies whether the widget responds to user interaction. */ get: function () { return this._getOption('disabled'); }, set: function (value) { this._setOption('disabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxMultiViewComponent.prototype, "elementAttr", { /** * Specifies the attributes to be attached to the widget's root element. */ get: function () { return this._getOption('elementAttr'); }, set: function (value) { this._setOption('elementAttr', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxMultiViewComponent.prototype, "focusStateEnabled", { /** * Specifies whether the widget can be focused using keyboard navigation. */ get: function () { return this._getOption('focusStateEnabled'); }, set: function (value) { this._setOption('focusStateEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxMultiViewComponent.prototype, "height", { /** * Specifies the widget's height. */ get: function () { return this._getOption('height'); }, set: function (value) { this._setOption('height', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxMultiViewComponent.prototype, "hint", { /** * Specifies text for a hint that appears when a user pauses on the widget. */ get: function () { return this._getOption('hint'); }, set: function (value) { this._setOption('hint', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxMultiViewComponent.prototype, "hoverStateEnabled", { /** * Specifies whether the widget changes its state when a user pauses on it. */ get: function () { return this._getOption('hoverStateEnabled'); }, set: function (value) { this._setOption('hoverStateEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxMultiViewComponent.prototype, "itemHoldTimeout", { /** * The time period in milliseconds before the onItemHold event is raised. */ get: function () { return this._getOption('itemHoldTimeout'); }, set: function (value) { this._setOption('itemHoldTimeout', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxMultiViewComponent.prototype, "items", { /** * An array of items displayed by the widget. */ get: function () { return this._getOption('items'); }, set: function (value) { this._setOption('items', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxMultiViewComponent.prototype, "itemTemplate", { /** * Specifies a custom template for items. */ get: function () { return this._getOption('itemTemplate'); }, set: function (value) { this._setOption('itemTemplate', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxMultiViewComponent.prototype, "loop", { /** * A Boolean value specifying whether or not to scroll back to the first item after the last item is swiped. */ get: function () { return this._getOption('loop'); }, set: function (value) { this._setOption('loop', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxMultiViewComponent.prototype, "noDataText", { /** * The text or HTML markup displayed by the widget if the item collection is empty. */ get: function () { return this._getOption('noDataText'); }, set: function (value) { this._setOption('noDataText', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxMultiViewComponent.prototype, "rtlEnabled", { /** * Switches the widget to a right-to-left representation. */ get: function () { return this._getOption('rtlEnabled'); }, set: function (value) { this._setOption('rtlEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxMultiViewComponent.prototype, "selectedIndex", { /** * The index of the currently displayed item. */ get: function () { return this._getOption('selectedIndex'); }, set: function (value) { this._setOption('selectedIndex', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxMultiViewComponent.prototype, "selectedItem", { /** * The selected item object. */ get: function () { return this._getOption('selectedItem'); }, set: function (value) { this._setOption('selectedItem', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxMultiViewComponent.prototype, "swipeEnabled", { /** * A Boolean value specifying whether or not to allow users to change the selected index by swiping. */ get: function () { return this._getOption('swipeEnabled'); }, set: function (value) { this._setOption('swipeEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxMultiViewComponent.prototype, "tabIndex", { /** * Specifies the number of the element when the Tab key is used for navigating. */ get: function () { return this._getOption('tabIndex'); }, set: function (value) { this._setOption('tabIndex', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxMultiViewComponent.prototype, "visible", { /** * Specifies whether the widget is visible. */ get: function () { return this._getOption('visible'); }, set: function (value) { this._setOption('visible', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxMultiViewComponent.prototype, "width", { /** * Specifies the widget's width. */ get: function () { return this._getOption('width'); }, set: function (value) { this._setOption('width', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxMultiViewComponent.prototype, "itemsChildren", { get: function () { return this._getOption('items'); }, set: function (value) { this.setChildren('items', value); }, enumerable: true, configurable: true }); DxMultiViewComponent.prototype._createInstance = function (element, options) { return new multi_view_1.default(element, options); }; DxMultiViewComponent.prototype.ngOnDestroy = function () { this._destroyWidget(); }; DxMultiViewComponent.prototype.ngOnChanges = function (changes) { _super.prototype.ngOnChanges.call(this, changes); this.setupChanges('dataSource', changes); this.setupChanges('items', changes); }; DxMultiViewComponent.prototype.setupChanges = function (prop, changes) { if (!(prop in this._optionsToUpdate)) { this._idh.setup(prop, changes); } }; DxMultiViewComponent.prototype.ngDoCheck = function () { this._idh.doCheck('dataSource'); this._idh.doCheck('items'); this._watcherHelper.checkWatchers(); _super.prototype.ngDoCheck.call(this); _super.prototype.clearChangedOptions.call(this); }; DxMultiViewComponent.prototype._setOption = function (name, value) { var isSetup = this._idh.setupSingle(name, value); var isChanged = this._idh.getChanges(name, value) !== null; if (isSetup || isChanged) { _super.prototype._setOption.call(this, name, value); } }; DxMultiViewComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dx-multi-view', template: '', providers: [ template_host_1.DxTemplateHost, watcher_helper_1.WatcherHelper, nested_option_1.NestedOptionHost, iterable_differ_helper_1.IterableDifferHelper ] },] }, ]; /** @nocollapse */ DxMultiViewComponent.ctorParameters = function () { return [ { type: core_1.ElementRef, }, { type: core_1.NgZone, }, { type: template_host_1.DxTemplateHost, }, { type: watcher_helper_1.WatcherHelper, }, { type: iterable_differ_helper_1.IterableDifferHelper, }, { type: nested_option_1.NestedOptionHost, }, ]; }; DxMultiViewComponent.propDecorators = { 'accessKey': [{ type: core_1.Input },], 'activeStateEnabled': [{ type: core_1.Input },], 'animationEnabled': [{ type: core_1.Input },], 'dataSource': [{ type: core_1.Input },], 'deferRendering': [{ type: core_1.Input },], 'disabled': [{ type: core_1.Input },], 'elementAttr': [{ type: core_1.Input },], 'focusStateEnabled': [{ type: core_1.Input },], 'height': [{ type: core_1.Input },], 'hint': [{ type: core_1.Input },], 'hoverStateEnabled': [{ type: core_1.Input },], 'itemHoldTimeout': [{ type: core_1.Input },], 'items': [{ type: core_1.Input },], 'itemTemplate': [{ type: core_1.Input },], 'loop': [{ type: core_1.Input },], 'noDataText': [{ type: core_1.Input },], 'rtlEnabled': [{ type: core_1.Input },], 'selectedIndex': [{ type: core_1.Input },], 'selectedItem': [{ type: core_1.Input },], 'swipeEnabled': [{ type: core_1.Input },], 'tabIndex': [{ type: core_1.Input },], 'visible': [{ type: core_1.Input },], 'width': [{ type: core_1.Input },], 'onContentReady': [{ type: core_1.Output },], 'onDisposing': [{ type: core_1.Output },], 'onInitialized': [{ type: core_1.Output },], 'onItemClick': [{ type: core_1.Output },], 'onItemContextMenu': [{ type: core_1.Output },], 'onItemHold': [{ type: core_1.Output },], 'onItemRendered': [{ type: core_1.Output },], 'onOptionChanged': [{ type: core_1.Output },], 'onSelectionChanged': [{ type: core_1.Output },], 'accessKeyChange': [{ type: core_1.Output },], 'activeStateEnabledChange': [{ type: core_1.Output },], 'animationEnabledChange': [{ type: core_1.Output },], 'dataSourceChange': [{ type: core_1.Output },], 'deferRenderingChange': [{ type: core_1.Output },], 'disabledChange': [{ type: core_1.Output },], 'elementAttrChange': [{ type: core_1.Output },], 'focusStateEnabledChange': [{ type: core_1.Output },], 'heightChange': [{ type: core_1.Output },], 'hintChange': [{ type: core_1.Output },], 'hoverStateEnabledChange': [{ type: core_1.Output },], 'itemHoldTimeoutChange': [{ type: core_1.Output },], 'itemsChange': [{ type: core_1.Output },], 'itemTemplateChange': [{ type: core_1.Output },], 'loopChange': [{ type: core_1.Output },], 'noDataTextChange': [{ type: core_1.Output },], 'rtlEnabledChange': [{ type: core_1.Output },], 'selectedIndexChange': [{ type: core_1.Output },], 'selectedItemChange': [{ type: core_1.Output },], 'swipeEnabledChange': [{ type: core_1.Output },], 'tabIndexChange': [{ type: core_1.Output },], 'visibleChange': [{ type: core_1.Output },], 'widthChange': [{ type: core_1.Output },], 'itemsChildren': [{ type: core_1.ContentChildren, args: [item_dxi_2.DxiItemComponent,] },], }; return DxMultiViewComponent; }(component_1.DxComponent)); exports.DxMultiViewComponent = DxMultiViewComponent; var DxMultiViewModule = (function () { function DxMultiViewModule() { } DxMultiViewModule.decorators = [ { type: core_1.NgModule, args: [{ imports: [ item_dxi_1.DxiItemModule, template_1.DxTemplateModule ], declarations: [ DxMultiViewComponent ], exports: [ DxMultiViewComponent, item_dxi_1.DxiItemModule, template_1.DxTemplateModule ], },] }, ]; /** @nocollapse */ DxMultiViewModule.ctorParameters = function () { return []; }; return DxMultiViewModule; }()); exports.DxMultiViewModule = DxMultiViewModule; //# sourceMappingURL=multi-view.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nav-bar.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var nav_bar_1 = __webpack_require__("./node_modules/devextreme/ui/nav_bar.js"); var component_1 = __webpack_require__("./node_modules/devextreme-angular/core/component.js"); var template_host_1 = __webpack_require__("./node_modules/devextreme-angular/core/template-host.js"); var template_1 = __webpack_require__("./node_modules/devextreme-angular/core/template.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var watcher_helper_1 = __webpack_require__("./node_modules/devextreme-angular/core/watcher-helper.js"); var iterable_differ_helper_1 = __webpack_require__("./node_modules/devextreme-angular/core/iterable-differ-helper.js"); var item_dxi_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/item-dxi.js"); var item_dxi_2 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/item-dxi.js"); /** * The NavBar is a widget that navigates the application views. */ var DxNavBarComponent = (function (_super) { __extends(DxNavBarComponent, _super); function DxNavBarComponent(elementRef, ngZone, templateHost, _watcherHelper, _idh, optionHost) { var _this = _super.call(this, elementRef, ngZone, templateHost, _watcherHelper) || this; _this._watcherHelper = _watcherHelper; _this._idh = _idh; _this._createEventEmitters([ { subscribe: 'contentReady', emit: 'onContentReady' }, { subscribe: 'disposing', emit: 'onDisposing' }, { subscribe: 'initialized', emit: 'onInitialized' }, { subscribe: 'itemClick', emit: 'onItemClick' }, { subscribe: 'itemContextMenu', emit: 'onItemContextMenu' }, { subscribe: 'itemHold', emit: 'onItemHold' }, { subscribe: 'itemRendered', emit: 'onItemRendered' }, { subscribe: 'optionChanged', emit: 'onOptionChanged' }, { subscribe: 'selectionChanged', emit: 'onSelectionChanged' }, { emit: 'accessKeyChange' }, { emit: 'dataSourceChange' }, { emit: 'disabledChange' }, { emit: 'elementAttrChange' }, { emit: 'focusStateEnabledChange' }, { emit: 'heightChange' }, { emit: 'hintChange' }, { emit: 'hoverStateEnabledChange' }, { emit: 'itemHoldTimeoutChange' }, { emit: 'itemsChange' }, { emit: 'itemTemplateChange' }, { emit: 'keyExprChange' }, { emit: 'rtlEnabledChange' }, { emit: 'scrollByContentChange' }, { emit: 'selectedIndexChange' }, { emit: 'selectedItemChange' }, { emit: 'selectedItemKeysChange' }, { emit: 'selectedItemsChange' }, { emit: 'selectionModeChange' }, { emit: 'tabIndexChange' }, { emit: 'visibleChange' }, { emit: 'widthChange' } ]); _this._idh.setHost(_this); optionHost.setHost(_this); return _this; } Object.defineProperty(DxNavBarComponent.prototype, "accessKey", { /** * Specifies the shortcut key that sets focus on the widget. */ get: function () { return this._getOption('accessKey'); }, set: function (value) { this._setOption('accessKey', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxNavBarComponent.prototype, "dataSource", { /** * A data source used to fetch data to be displayed by the widget. */ get: function () { return this._getOption('dataSource'); }, set: function (value) { this._setOption('dataSource', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxNavBarComponent.prototype, "disabled", { /** * Specifies whether the widget responds to user interaction. */ get: function () { return this._getOption('disabled'); }, set: function (value) { this._setOption('disabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxNavBarComponent.prototype, "elementAttr", { /** * Specifies the attributes to be attached to the widget's root element. */ get: function () { return this._getOption('elementAttr'); }, set: function (value) { this._setOption('elementAttr', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxNavBarComponent.prototype, "focusStateEnabled", { /** * Specifies whether the widget can be focused using keyboard navigation. */ get: function () { return this._getOption('focusStateEnabled'); }, set: function (value) { this._setOption('focusStateEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxNavBarComponent.prototype, "height", { /** * Specifies the widget's height. */ get: function () { return this._getOption('height'); }, set: function (value) { this._setOption('height', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxNavBarComponent.prototype, "hint", { /** * Specifies text for a hint that appears when a user pauses on the widget. */ get: function () { return this._getOption('hint'); }, set: function (value) { this._setOption('hint', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxNavBarComponent.prototype, "hoverStateEnabled", { /** * Specifies whether the widget changes its state when a user pauses on it. */ get: function () { return this._getOption('hoverStateEnabled'); }, set: function (value) { this._setOption('hoverStateEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxNavBarComponent.prototype, "itemHoldTimeout", { /** * The time period in milliseconds before the onItemHold event is raised. */ get: function () { return this._getOption('itemHoldTimeout'); }, set: function (value) { this._setOption('itemHoldTimeout', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxNavBarComponent.prototype, "items", { /** * An array of items displayed by the widget. */ get: function () { return this._getOption('items'); }, set: function (value) { this._setOption('items', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxNavBarComponent.prototype, "itemTemplate", { /** * Specifies a custom template for items. */ get: function () { return this._getOption('itemTemplate'); }, set: function (value) { this._setOption('itemTemplate', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxNavBarComponent.prototype, "keyExpr", { /** * Specifies which data field provides keys for widget items. */ get: function () { return this._getOption('keyExpr'); }, set: function (value) { this._setOption('keyExpr', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxNavBarComponent.prototype, "rtlEnabled", { /** * Switches the widget to a right-to-left representation. */ get: function () { return this._getOption('rtlEnabled'); }, set: function (value) { this._setOption('rtlEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxNavBarComponent.prototype, "scrollByContent", { /** * Specifies whether or not an end-user can scroll tabs by swiping. */ get: function () { return this._getOption('scrollByContent'); }, set: function (value) { this._setOption('scrollByContent', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxNavBarComponent.prototype, "selectedIndex", { /** * The index of the currently selected widget item. */ get: function () { return this._getOption('selectedIndex'); }, set: function (value) { this._setOption('selectedIndex', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxNavBarComponent.prototype, "selectedItem", { /** * The selected item object. */ get: function () { return this._getOption('selectedItem'); }, set: function (value) { this._setOption('selectedItem', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxNavBarComponent.prototype, "selectedItemKeys", { /** * Specifies an array of currently selected item keys. */ get: function () { return this._getOption('selectedItemKeys'); }, set: function (value) { this._setOption('selectedItemKeys', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxNavBarComponent.prototype, "selectedItems", { /** * An array of currently selected item objects. */ get: function () { return this._getOption('selectedItems'); }, set: function (value) { this._setOption('selectedItems', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxNavBarComponent.prototype, "selectionMode", { /** * Specifies whether the widget enables an end-user to select only a single item or multiple items. */ get: function () { return this._getOption('selectionMode'); }, set: function (value) { this._setOption('selectionMode', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxNavBarComponent.prototype, "tabIndex", { /** * Specifies the number of the element when the Tab key is used for navigating. */ get: function () { return this._getOption('tabIndex'); }, set: function (value) { this._setOption('tabIndex', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxNavBarComponent.prototype, "visible", { /** * Specifies whether the widget is visible. */ get: function () { return this._getOption('visible'); }, set: function (value) { this._setOption('visible', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxNavBarComponent.prototype, "width", { /** * Specifies the widget's width. */ get: function () { return this._getOption('width'); }, set: function (value) { this._setOption('width', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxNavBarComponent.prototype, "itemsChildren", { get: function () { return this._getOption('items'); }, set: function (value) { this.setChildren('items', value); }, enumerable: true, configurable: true }); DxNavBarComponent.prototype._createInstance = function (element, options) { return new nav_bar_1.default(element, options); }; DxNavBarComponent.prototype.ngOnDestroy = function () { this._destroyWidget(); }; DxNavBarComponent.prototype.ngOnChanges = function (changes) { _super.prototype.ngOnChanges.call(this, changes); this.setupChanges('dataSource', changes); this.setupChanges('items', changes); this.setupChanges('selectedItemKeys', changes); this.setupChanges('selectedItems', changes); }; DxNavBarComponent.prototype.setupChanges = function (prop, changes) { if (!(prop in this._optionsToUpdate)) { this._idh.setup(prop, changes); } }; DxNavBarComponent.prototype.ngDoCheck = function () { this._idh.doCheck('dataSource'); this._idh.doCheck('items'); this._idh.doCheck('selectedItemKeys'); this._idh.doCheck('selectedItems'); this._watcherHelper.checkWatchers(); _super.prototype.ngDoCheck.call(this); _super.prototype.clearChangedOptions.call(this); }; DxNavBarComponent.prototype._setOption = function (name, value) { var isSetup = this._idh.setupSingle(name, value); var isChanged = this._idh.getChanges(name, value) !== null; if (isSetup || isChanged) { _super.prototype._setOption.call(this, name, value); } }; DxNavBarComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dx-nav-bar', template: '', providers: [ template_host_1.DxTemplateHost, watcher_helper_1.WatcherHelper, nested_option_1.NestedOptionHost, iterable_differ_helper_1.IterableDifferHelper ] },] }, ]; /** @nocollapse */ DxNavBarComponent.ctorParameters = function () { return [ { type: core_1.ElementRef, }, { type: core_1.NgZone, }, { type: template_host_1.DxTemplateHost, }, { type: watcher_helper_1.WatcherHelper, }, { type: iterable_differ_helper_1.IterableDifferHelper, }, { type: nested_option_1.NestedOptionHost, }, ]; }; DxNavBarComponent.propDecorators = { 'accessKey': [{ type: core_1.Input },], 'dataSource': [{ type: core_1.Input },], 'disabled': [{ type: core_1.Input },], 'elementAttr': [{ type: core_1.Input },], 'focusStateEnabled': [{ type: core_1.Input },], 'height': [{ type: core_1.Input },], 'hint': [{ type: core_1.Input },], 'hoverStateEnabled': [{ type: core_1.Input },], 'itemHoldTimeout': [{ type: core_1.Input },], 'items': [{ type: core_1.Input },], 'itemTemplate': [{ type: core_1.Input },], 'keyExpr': [{ type: core_1.Input },], 'rtlEnabled': [{ type: core_1.Input },], 'scrollByContent': [{ type: core_1.Input },], 'selectedIndex': [{ type: core_1.Input },], 'selectedItem': [{ type: core_1.Input },], 'selectedItemKeys': [{ type: core_1.Input },], 'selectedItems': [{ type: core_1.Input },], 'selectionMode': [{ type: core_1.Input },], 'tabIndex': [{ type: core_1.Input },], 'visible': [{ type: core_1.Input },], 'width': [{ type: core_1.Input },], 'onContentReady': [{ type: core_1.Output },], 'onDisposing': [{ type: core_1.Output },], 'onInitialized': [{ type: core_1.Output },], 'onItemClick': [{ type: core_1.Output },], 'onItemContextMenu': [{ type: core_1.Output },], 'onItemHold': [{ type: core_1.Output },], 'onItemRendered': [{ type: core_1.Output },], 'onOptionChanged': [{ type: core_1.Output },], 'onSelectionChanged': [{ type: core_1.Output },], 'accessKeyChange': [{ type: core_1.Output },], 'dataSourceChange': [{ type: core_1.Output },], 'disabledChange': [{ type: core_1.Output },], 'elementAttrChange': [{ type: core_1.Output },], 'focusStateEnabledChange': [{ type: core_1.Output },], 'heightChange': [{ type: core_1.Output },], 'hintChange': [{ type: core_1.Output },], 'hoverStateEnabledChange': [{ type: core_1.Output },], 'itemHoldTimeoutChange': [{ type: core_1.Output },], 'itemsChange': [{ type: core_1.Output },], 'itemTemplateChange': [{ type: core_1.Output },], 'keyExprChange': [{ type: core_1.Output },], 'rtlEnabledChange': [{ type: core_1.Output },], 'scrollByContentChange': [{ type: core_1.Output },], 'selectedIndexChange': [{ type: core_1.Output },], 'selectedItemChange': [{ type: core_1.Output },], 'selectedItemKeysChange': [{ type: core_1.Output },], 'selectedItemsChange': [{ type: core_1.Output },], 'selectionModeChange': [{ type: core_1.Output },], 'tabIndexChange': [{ type: core_1.Output },], 'visibleChange': [{ type: core_1.Output },], 'widthChange': [{ type: core_1.Output },], 'itemsChildren': [{ type: core_1.ContentChildren, args: [item_dxi_2.DxiItemComponent,] },], }; return DxNavBarComponent; }(component_1.DxComponent)); exports.DxNavBarComponent = DxNavBarComponent; var DxNavBarModule = (function () { function DxNavBarModule() { } DxNavBarModule.decorators = [ { type: core_1.NgModule, args: [{ imports: [ item_dxi_1.DxiItemModule, template_1.DxTemplateModule ], declarations: [ DxNavBarComponent ], exports: [ DxNavBarComponent, item_dxi_1.DxiItemModule, template_1.DxTemplateModule ], },] }, ]; /** @nocollapse */ DxNavBarModule.ctorParameters = function () { return []; }; return DxNavBarModule; }()); exports.DxNavBarModule = DxNavBarModule; //# sourceMappingURL=nav-bar.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/adapter.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var nested_option_2 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var DxoAdapterComponent = (function (_super) { __extends(DxoAdapterComponent, _super); function DxoAdapterComponent(parentOptionHost, optionHost) { var _this = _super.call(this) || this; parentOptionHost.setNestedOption(_this); optionHost.setHost(_this, _this._fullOptionPath.bind(_this)); return _this; } Object.defineProperty(DxoAdapterComponent.prototype, "applyValidationResults", { get: function () { return this._getOption('applyValidationResults'); }, set: function (value) { this._setOption('applyValidationResults', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoAdapterComponent.prototype, "bypass", { get: function () { return this._getOption('bypass'); }, set: function (value) { this._setOption('bypass', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoAdapterComponent.prototype, "focus", { get: function () { return this._getOption('focus'); }, set: function (value) { this._setOption('focus', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoAdapterComponent.prototype, "getValue", { get: function () { return this._getOption('getValue'); }, set: function (value) { this._setOption('getValue', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoAdapterComponent.prototype, "reset", { get: function () { return this._getOption('reset'); }, set: function (value) { this._setOption('reset', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoAdapterComponent.prototype, "validationRequestsCallbacks", { get: function () { return this._getOption('validationRequestsCallbacks'); }, set: function (value) { this._setOption('validationRequestsCallbacks', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoAdapterComponent.prototype, "_optionPath", { get: function () { return 'adapter'; }, enumerable: true, configurable: true }); DxoAdapterComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dxo-adapter', template: '', styles: [''], providers: [nested_option_1.NestedOptionHost] },] }, ]; /** @nocollapse */ DxoAdapterComponent.ctorParameters = function () { return [ { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.SkipSelf }, { type: core_1.Host },] }, { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.Host },] }, ]; }; DxoAdapterComponent.propDecorators = { 'applyValidationResults': [{ type: core_1.Input },], 'bypass': [{ type: core_1.Input },], 'focus': [{ type: core_1.Input },], 'getValue': [{ type: core_1.Input },], 'reset': [{ type: core_1.Input },], 'validationRequestsCallbacks': [{ type: core_1.Input },], }; return DxoAdapterComponent; }(nested_option_2.NestedOption)); exports.DxoAdapterComponent = DxoAdapterComponent; var DxoAdapterModule = (function () { function DxoAdapterModule() { } DxoAdapterModule.decorators = [ { type: core_1.NgModule, args: [{ declarations: [ DxoAdapterComponent ], exports: [ DxoAdapterComponent ], },] }, ]; /** @nocollapse */ DxoAdapterModule.ctorParameters = function () { return []; }; return DxoAdapterModule; }()); exports.DxoAdapterModule = DxoAdapterModule; //# sourceMappingURL=adapter.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/adaptive-layout.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var nested_option_2 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var DxoAdaptiveLayoutComponent = (function (_super) { __extends(DxoAdaptiveLayoutComponent, _super); function DxoAdaptiveLayoutComponent(parentOptionHost, optionHost) { var _this = _super.call(this) || this; parentOptionHost.setNestedOption(_this); optionHost.setHost(_this, _this._fullOptionPath.bind(_this)); return _this; } Object.defineProperty(DxoAdaptiveLayoutComponent.prototype, "height", { get: function () { return this._getOption('height'); }, set: function (value) { this._setOption('height', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoAdaptiveLayoutComponent.prototype, "keepLabels", { get: function () { return this._getOption('keepLabels'); }, set: function (value) { this._setOption('keepLabels', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoAdaptiveLayoutComponent.prototype, "width", { get: function () { return this._getOption('width'); }, set: function (value) { this._setOption('width', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoAdaptiveLayoutComponent.prototype, "_optionPath", { get: function () { return 'adaptiveLayout'; }, enumerable: true, configurable: true }); DxoAdaptiveLayoutComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dxo-adaptive-layout', template: '', styles: [''], providers: [nested_option_1.NestedOptionHost] },] }, ]; /** @nocollapse */ DxoAdaptiveLayoutComponent.ctorParameters = function () { return [ { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.SkipSelf }, { type: core_1.Host },] }, { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.Host },] }, ]; }; DxoAdaptiveLayoutComponent.propDecorators = { 'height': [{ type: core_1.Input },], 'keepLabels': [{ type: core_1.Input },], 'width': [{ type: core_1.Input },], }; return DxoAdaptiveLayoutComponent; }(nested_option_2.NestedOption)); exports.DxoAdaptiveLayoutComponent = DxoAdaptiveLayoutComponent; var DxoAdaptiveLayoutModule = (function () { function DxoAdaptiveLayoutModule() { } DxoAdaptiveLayoutModule.decorators = [ { type: core_1.NgModule, args: [{ declarations: [ DxoAdaptiveLayoutComponent ], exports: [ DxoAdaptiveLayoutComponent ], },] }, ]; /** @nocollapse */ DxoAdaptiveLayoutModule.ctorParameters = function () { return []; }; return DxoAdaptiveLayoutModule; }()); exports.DxoAdaptiveLayoutModule = DxoAdaptiveLayoutModule; //# sourceMappingURL=adaptive-layout.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/animation.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); /* tslint:disable:use-input-property-decorator */ var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var animation_config_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/base/animation-config.js"); var DxoAnimationComponent = (function (_super) { __extends(DxoAnimationComponent, _super); function DxoAnimationComponent(parentOptionHost, optionHost) { var _this = _super.call(this) || this; parentOptionHost.setNestedOption(_this); optionHost.setHost(_this, _this._fullOptionPath.bind(_this)); return _this; } Object.defineProperty(DxoAnimationComponent.prototype, "_optionPath", { get: function () { return 'animation'; }, enumerable: true, configurable: true }); DxoAnimationComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dxo-animation', template: '', styles: [''], providers: [nested_option_1.NestedOptionHost], inputs: [ 'duration', 'easing', 'enabled', 'maxPointCountSupported', 'hide', 'show', 'complete', 'delay', 'direction', 'from', 'staggerDelay', 'start', 'to', 'type' ] },] }, ]; /** @nocollapse */ DxoAnimationComponent.ctorParameters = function () { return [ { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.SkipSelf }, { type: core_1.Host },] }, { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.Host },] }, ]; }; return DxoAnimationComponent; }(animation_config_1.DxoAnimationConfig)); exports.DxoAnimationComponent = DxoAnimationComponent; var DxoAnimationModule = (function () { function DxoAnimationModule() { } DxoAnimationModule.decorators = [ { type: core_1.NgModule, args: [{ declarations: [ DxoAnimationComponent ], exports: [ DxoAnimationComponent ], },] }, ]; /** @nocollapse */ DxoAnimationModule.ctorParameters = function () { return []; }; return DxoAnimationModule; }()); exports.DxoAnimationModule = DxoAnimationModule; //# sourceMappingURL=animation.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/area-settings.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var nested_option_2 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var DxoAreaSettingsComponent = (function (_super) { __extends(DxoAreaSettingsComponent, _super); function DxoAreaSettingsComponent(parentOptionHost, optionHost) { var _this = _super.call(this) || this; parentOptionHost.setNestedOption(_this); optionHost.setHost(_this, _this._fullOptionPath.bind(_this)); return _this; } Object.defineProperty(DxoAreaSettingsComponent.prototype, "borderColor", { get: function () { return this._getOption('borderColor'); }, set: function (value) { this._setOption('borderColor', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoAreaSettingsComponent.prototype, "borderWidth", { get: function () { return this._getOption('borderWidth'); }, set: function (value) { this._setOption('borderWidth', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoAreaSettingsComponent.prototype, "color", { get: function () { return this._getOption('color'); }, set: function (value) { this._setOption('color', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoAreaSettingsComponent.prototype, "colorGroupingField", { get: function () { return this._getOption('colorGroupingField'); }, set: function (value) { this._setOption('colorGroupingField', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoAreaSettingsComponent.prototype, "colorGroups", { get: function () { return this._getOption('colorGroups'); }, set: function (value) { this._setOption('colorGroups', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoAreaSettingsComponent.prototype, "customize", { get: function () { return this._getOption('customize'); }, set: function (value) { this._setOption('customize', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoAreaSettingsComponent.prototype, "hoveredBorderColor", { get: function () { return this._getOption('hoveredBorderColor'); }, set: function (value) { this._setOption('hoveredBorderColor', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoAreaSettingsComponent.prototype, "hoveredBorderWidth", { get: function () { return this._getOption('hoveredBorderWidth'); }, set: function (value) { this._setOption('hoveredBorderWidth', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoAreaSettingsComponent.prototype, "hoveredColor", { get: function () { return this._getOption('hoveredColor'); }, set: function (value) { this._setOption('hoveredColor', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoAreaSettingsComponent.prototype, "hoverEnabled", { get: function () { return this._getOption('hoverEnabled'); }, set: function (value) { this._setOption('hoverEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoAreaSettingsComponent.prototype, "label", { get: function () { return this._getOption('label'); }, set: function (value) { this._setOption('label', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoAreaSettingsComponent.prototype, "palette", { get: function () { return this._getOption('palette'); }, set: function (value) { this._setOption('palette', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoAreaSettingsComponent.prototype, "paletteSize", { get: function () { return this._getOption('paletteSize'); }, set: function (value) { this._setOption('paletteSize', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoAreaSettingsComponent.prototype, "selectedBorderColor", { get: function () { return this._getOption('selectedBorderColor'); }, set: function (value) { this._setOption('selectedBorderColor', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoAreaSettingsComponent.prototype, "selectedBorderWidth", { get: function () { return this._getOption('selectedBorderWidth'); }, set: function (value) { this._setOption('selectedBorderWidth', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoAreaSettingsComponent.prototype, "selectedColor", { get: function () { return this._getOption('selectedColor'); }, set: function (value) { this._setOption('selectedColor', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoAreaSettingsComponent.prototype, "selectionMode", { get: function () { return this._getOption('selectionMode'); }, set: function (value) { this._setOption('selectionMode', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoAreaSettingsComponent.prototype, "_optionPath", { get: function () { return 'areaSettings'; }, enumerable: true, configurable: true }); DxoAreaSettingsComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dxo-area-settings', template: '', styles: [''], providers: [nested_option_1.NestedOptionHost] },] }, ]; /** @nocollapse */ DxoAreaSettingsComponent.ctorParameters = function () { return [ { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.SkipSelf }, { type: core_1.Host },] }, { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.Host },] }, ]; }; DxoAreaSettingsComponent.propDecorators = { 'borderColor': [{ type: core_1.Input },], 'borderWidth': [{ type: core_1.Input },], 'color': [{ type: core_1.Input },], 'colorGroupingField': [{ type: core_1.Input },], 'colorGroups': [{ type: core_1.Input },], 'customize': [{ type: core_1.Input },], 'hoveredBorderColor': [{ type: core_1.Input },], 'hoveredBorderWidth': [{ type: core_1.Input },], 'hoveredColor': [{ type: core_1.Input },], 'hoverEnabled': [{ type: core_1.Input },], 'label': [{ type: core_1.Input },], 'palette': [{ type: core_1.Input },], 'paletteSize': [{ type: core_1.Input },], 'selectedBorderColor': [{ type: core_1.Input },], 'selectedBorderWidth': [{ type: core_1.Input },], 'selectedColor': [{ type: core_1.Input },], 'selectionMode': [{ type: core_1.Input },], }; return DxoAreaSettingsComponent; }(nested_option_2.NestedOption)); exports.DxoAreaSettingsComponent = DxoAreaSettingsComponent; var DxoAreaSettingsModule = (function () { function DxoAreaSettingsModule() { } DxoAreaSettingsModule.decorators = [ { type: core_1.NgModule, args: [{ declarations: [ DxoAreaSettingsComponent ], exports: [ DxoAreaSettingsComponent ], },] }, ]; /** @nocollapse */ DxoAreaSettingsModule.ctorParameters = function () { return []; }; return DxoAreaSettingsModule; }()); exports.DxoAreaSettingsModule = DxoAreaSettingsModule; //# sourceMappingURL=area-settings.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/area.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); /* tslint:disable:use-input-property-decorator */ var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var chart_common_series_settings_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/base/chart-common-series-settings.js"); var DxoAreaComponent = (function (_super) { __extends(DxoAreaComponent, _super); function DxoAreaComponent(parentOptionHost, optionHost) { var _this = _super.call(this) || this; parentOptionHost.setNestedOption(_this); optionHost.setHost(_this, _this._fullOptionPath.bind(_this)); return _this; } Object.defineProperty(DxoAreaComponent.prototype, "_optionPath", { get: function () { return 'area'; }, enumerable: true, configurable: true }); DxoAreaComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dxo-area', template: '', styles: [''], providers: [nested_option_1.NestedOptionHost], inputs: [ 'area', 'argumentField', 'axis', 'bar', 'border', 'bubble', 'candlestick', 'closeValueField', 'color', 'cornerRadius', 'dashStyle', 'fullstackedarea', 'fullstackedbar', 'fullstackedline', 'fullstackedspline', 'fullstackedsplinearea', 'highValueField', 'hoverMode', 'hoverStyle', 'ignoreEmptyPoints', 'innerColor', 'label', 'line', 'lowValueField', 'maxLabelCount', 'minBarSize', 'opacity', 'openValueField', 'pane', 'point', 'rangearea', 'rangebar', 'rangeValue1Field', 'rangeValue2Field', 'reduction', 'scatter', 'selectionMode', 'selectionStyle', 'showInLegend', 'sizeField', 'spline', 'splinearea', 'stack', 'stackedarea', 'stackedbar', 'stackedline', 'stackedspline', 'stackedsplinearea', 'steparea', 'stepline', 'stock', 'tagField', 'type', 'valueErrorBar', 'valueField', 'visible', 'width', 'closed' ] },] }, ]; /** @nocollapse */ DxoAreaComponent.ctorParameters = function () { return [ { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.SkipSelf }, { type: core_1.Host },] }, { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.Host },] }, ]; }; return DxoAreaComponent; }(chart_common_series_settings_1.DxoChartCommonSeriesSettings)); exports.DxoAreaComponent = DxoAreaComponent; var DxoAreaModule = (function () { function DxoAreaModule() { } DxoAreaModule.decorators = [ { type: core_1.NgModule, args: [{ declarations: [ DxoAreaComponent ], exports: [ DxoAreaComponent ], },] }, ]; /** @nocollapse */ DxoAreaModule.ctorParameters = function () { return []; }; return DxoAreaModule; }()); exports.DxoAreaModule = DxoAreaModule; //# sourceMappingURL=area.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/argument-axis.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var nested_option_2 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var break_dxi_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/break-dxi.js"); var constant_line_dxi_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/constant-line-dxi.js"); var strip_dxi_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/strip-dxi.js"); var DxoArgumentAxisComponent = (function (_super) { __extends(DxoArgumentAxisComponent, _super); function DxoArgumentAxisComponent(parentOptionHost, optionHost) { var _this = _super.call(this) || this; parentOptionHost.setNestedOption(_this); optionHost.setHost(_this, _this._fullOptionPath.bind(_this)); return _this; } Object.defineProperty(DxoArgumentAxisComponent.prototype, "allowDecimals", { get: function () { return this._getOption('allowDecimals'); }, set: function (value) { this._setOption('allowDecimals', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoArgumentAxisComponent.prototype, "argumentType", { get: function () { return this._getOption('argumentType'); }, set: function (value) { this._setOption('argumentType', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoArgumentAxisComponent.prototype, "axisDivisionFactor", { get: function () { return this._getOption('axisDivisionFactor'); }, set: function (value) { this._setOption('axisDivisionFactor', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoArgumentAxisComponent.prototype, "breaks", { get: function () { return this._getOption('breaks'); }, set: function (value) { this._setOption('breaks', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoArgumentAxisComponent.prototype, "breakStyle", { get: function () { return this._getOption('breakStyle'); }, set: function (value) { this._setOption('breakStyle', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoArgumentAxisComponent.prototype, "categories", { get: function () { return this._getOption('categories'); }, set: function (value) { this._setOption('categories', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoArgumentAxisComponent.prototype, "color", { get: function () { return this._getOption('color'); }, set: function (value) { this._setOption('color', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoArgumentAxisComponent.prototype, "constantLines", { get: function () { return this._getOption('constantLines'); }, set: function (value) { this._setOption('constantLines', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoArgumentAxisComponent.prototype, "constantLineStyle", { get: function () { return this._getOption('constantLineStyle'); }, set: function (value) { this._setOption('constantLineStyle', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoArgumentAxisComponent.prototype, "discreteAxisDivisionMode", { get: function () { return this._getOption('discreteAxisDivisionMode'); }, set: function (value) { this._setOption('discreteAxisDivisionMode', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoArgumentAxisComponent.prototype, "endOnTick", { get: function () { return this._getOption('endOnTick'); }, set: function (value) { this._setOption('endOnTick', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoArgumentAxisComponent.prototype, "grid", { get: function () { return this._getOption('grid'); }, set: function (value) { this._setOption('grid', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoArgumentAxisComponent.prototype, "holidays", { get: function () { return this._getOption('holidays'); }, set: function (value) { this._setOption('holidays', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoArgumentAxisComponent.prototype, "hoverMode", { get: function () { return this._getOption('hoverMode'); }, set: function (value) { this._setOption('hoverMode', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoArgumentAxisComponent.prototype, "inverted", { get: function () { return this._getOption('inverted'); }, set: function (value) { this._setOption('inverted', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoArgumentAxisComponent.prototype, "label", { get: function () { return this._getOption('label'); }, set: function (value) { this._setOption('label', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoArgumentAxisComponent.prototype, "logarithmBase", { get: function () { return this._getOption('logarithmBase'); }, set: function (value) { this._setOption('logarithmBase', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoArgumentAxisComponent.prototype, "max", { get: function () { return this._getOption('max'); }, set: function (value) { this._setOption('max', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoArgumentAxisComponent.prototype, "maxValueMargin", { get: function () { return this._getOption('maxValueMargin'); }, set: function (value) { this._setOption('maxValueMargin', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoArgumentAxisComponent.prototype, "min", { get: function () { return this._getOption('min'); }, set: function (value) { this._setOption('min', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoArgumentAxisComponent.prototype, "minorGrid", { get: function () { return this._getOption('minorGrid'); }, set: function (value) { this._setOption('minorGrid', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoArgumentAxisComponent.prototype, "minorTick", { get: function () { return this._getOption('minorTick'); }, set: function (value) { this._setOption('minorTick', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoArgumentAxisComponent.prototype, "minorTickCount", { get: function () { return this._getOption('minorTickCount'); }, set: function (value) { this._setOption('minorTickCount', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoArgumentAxisComponent.prototype, "minorTickInterval", { get: function () { return this._getOption('minorTickInterval'); }, set: function (value) { this._setOption('minorTickInterval', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoArgumentAxisComponent.prototype, "minValueMargin", { get: function () { return this._getOption('minValueMargin'); }, set: function (value) { this._setOption('minValueMargin', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoArgumentAxisComponent.prototype, "opacity", { get: function () { return this._getOption('opacity'); }, set: function (value) { this._setOption('opacity', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoArgumentAxisComponent.prototype, "placeholderSize", { get: function () { return this._getOption('placeholderSize'); }, set: function (value) { this._setOption('placeholderSize', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoArgumentAxisComponent.prototype, "position", { get: function () { return this._getOption('position'); }, set: function (value) { this._setOption('position', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoArgumentAxisComponent.prototype, "setTicksAtUnitBeginning", { get: function () { return this._getOption('setTicksAtUnitBeginning'); }, set: function (value) { this._setOption('setTicksAtUnitBeginning', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoArgumentAxisComponent.prototype, "singleWorkdays", { get: function () { return this._getOption('singleWorkdays'); }, set: function (value) { this._setOption('singleWorkdays', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoArgumentAxisComponent.prototype, "strips", { get: function () { return this._getOption('strips'); }, set: function (value) { this._setOption('strips', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoArgumentAxisComponent.prototype, "stripStyle", { get: function () { return this._getOption('stripStyle'); }, set: function (value) { this._setOption('stripStyle', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoArgumentAxisComponent.prototype, "tick", { get: function () { return this._getOption('tick'); }, set: function (value) { this._setOption('tick', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoArgumentAxisComponent.prototype, "tickInterval", { get: function () { return this._getOption('tickInterval'); }, set: function (value) { this._setOption('tickInterval', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoArgumentAxisComponent.prototype, "title", { get: function () { return this._getOption('title'); }, set: function (value) { this._setOption('title', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoArgumentAxisComponent.prototype, "type", { get: function () { return this._getOption('type'); }, set: function (value) { this._setOption('type', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoArgumentAxisComponent.prototype, "valueMarginsEnabled", { get: function () { return this._getOption('valueMarginsEnabled'); }, set: function (value) { this._setOption('valueMarginsEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoArgumentAxisComponent.prototype, "visible", { get: function () { return this._getOption('visible'); }, set: function (value) { this._setOption('visible', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoArgumentAxisComponent.prototype, "width", { get: function () { return this._getOption('width'); }, set: function (value) { this._setOption('width', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoArgumentAxisComponent.prototype, "workdaysOnly", { get: function () { return this._getOption('workdaysOnly'); }, set: function (value) { this._setOption('workdaysOnly', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoArgumentAxisComponent.prototype, "workWeek", { get: function () { return this._getOption('workWeek'); }, set: function (value) { this._setOption('workWeek', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoArgumentAxisComponent.prototype, "firstPointOnStartAngle", { get: function () { return this._getOption('firstPointOnStartAngle'); }, set: function (value) { this._setOption('firstPointOnStartAngle', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoArgumentAxisComponent.prototype, "originValue", { get: function () { return this._getOption('originValue'); }, set: function (value) { this._setOption('originValue', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoArgumentAxisComponent.prototype, "period", { get: function () { return this._getOption('period'); }, set: function (value) { this._setOption('period', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoArgumentAxisComponent.prototype, "startAngle", { get: function () { return this._getOption('startAngle'); }, set: function (value) { this._setOption('startAngle', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoArgumentAxisComponent.prototype, "_optionPath", { get: function () { return 'argumentAxis'; }, enumerable: true, configurable: true }); Object.defineProperty(DxoArgumentAxisComponent.prototype, "breaksChildren", { get: function () { return this._getOption('breaks'); }, set: function (value) { this.setChildren('breaks', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoArgumentAxisComponent.prototype, "constantLinesChildren", { get: function () { return this._getOption('constantLines'); }, set: function (value) { this.setChildren('constantLines', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoArgumentAxisComponent.prototype, "stripsChildren", { get: function () { return this._getOption('strips'); }, set: function (value) { this.setChildren('strips', value); }, enumerable: true, configurable: true }); DxoArgumentAxisComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dxo-argument-axis', template: '', styles: [''], providers: [nested_option_1.NestedOptionHost] },] }, ]; /** @nocollapse */ DxoArgumentAxisComponent.ctorParameters = function () { return [ { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.SkipSelf }, { type: core_1.Host },] }, { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.Host },] }, ]; }; DxoArgumentAxisComponent.propDecorators = { 'allowDecimals': [{ type: core_1.Input },], 'argumentType': [{ type: core_1.Input },], 'axisDivisionFactor': [{ type: core_1.Input },], 'breaks': [{ type: core_1.Input },], 'breakStyle': [{ type: core_1.Input },], 'categories': [{ type: core_1.Input },], 'color': [{ type: core_1.Input },], 'constantLines': [{ type: core_1.Input },], 'constantLineStyle': [{ type: core_1.Input },], 'discreteAxisDivisionMode': [{ type: core_1.Input },], 'endOnTick': [{ type: core_1.Input },], 'grid': [{ type: core_1.Input },], 'holidays': [{ type: core_1.Input },], 'hoverMode': [{ type: core_1.Input },], 'inverted': [{ type: core_1.Input },], 'label': [{ type: core_1.Input },], 'logarithmBase': [{ type: core_1.Input },], 'max': [{ type: core_1.Input },], 'maxValueMargin': [{ type: core_1.Input },], 'min': [{ type: core_1.Input },], 'minorGrid': [{ type: core_1.Input },], 'minorTick': [{ type: core_1.Input },], 'minorTickCount': [{ type: core_1.Input },], 'minorTickInterval': [{ type: core_1.Input },], 'minValueMargin': [{ type: core_1.Input },], 'opacity': [{ type: core_1.Input },], 'placeholderSize': [{ type: core_1.Input },], 'position': [{ type: core_1.Input },], 'setTicksAtUnitBeginning': [{ type: core_1.Input },], 'singleWorkdays': [{ type: core_1.Input },], 'strips': [{ type: core_1.Input },], 'stripStyle': [{ type: core_1.Input },], 'tick': [{ type: core_1.Input },], 'tickInterval': [{ type: core_1.Input },], 'title': [{ type: core_1.Input },], 'type': [{ type: core_1.Input },], 'valueMarginsEnabled': [{ type: core_1.Input },], 'visible': [{ type: core_1.Input },], 'width': [{ type: core_1.Input },], 'workdaysOnly': [{ type: core_1.Input },], 'workWeek': [{ type: core_1.Input },], 'firstPointOnStartAngle': [{ type: core_1.Input },], 'originValue': [{ type: core_1.Input },], 'period': [{ type: core_1.Input },], 'startAngle': [{ type: core_1.Input },], 'breaksChildren': [{ type: core_1.ContentChildren, args: [core_1.forwardRef(function () { return break_dxi_1.DxiBreakComponent; }),] },], 'constantLinesChildren': [{ type: core_1.ContentChildren, args: [core_1.forwardRef(function () { return constant_line_dxi_1.DxiConstantLineComponent; }),] },], 'stripsChildren': [{ type: core_1.ContentChildren, args: [core_1.forwardRef(function () { return strip_dxi_1.DxiStripComponent; }),] },], }; return DxoArgumentAxisComponent; }(nested_option_2.NestedOption)); exports.DxoArgumentAxisComponent = DxoArgumentAxisComponent; var DxoArgumentAxisModule = (function () { function DxoArgumentAxisModule() { } DxoArgumentAxisModule.decorators = [ { type: core_1.NgModule, args: [{ declarations: [ DxoArgumentAxisComponent ], exports: [ DxoArgumentAxisComponent ], },] }, ]; /** @nocollapse */ DxoArgumentAxisModule.ctorParameters = function () { return []; }; return DxoArgumentAxisModule; }()); exports.DxoArgumentAxisModule = DxoArgumentAxisModule; //# sourceMappingURL=argument-axis.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/argument-format.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); /* tslint:disable:use-input-property-decorator */ var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var format_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/base/format.js"); var DxoArgumentFormatComponent = (function (_super) { __extends(DxoArgumentFormatComponent, _super); function DxoArgumentFormatComponent(parentOptionHost, optionHost) { var _this = _super.call(this) || this; parentOptionHost.setNestedOption(_this); optionHost.setHost(_this, _this._fullOptionPath.bind(_this)); return _this; } Object.defineProperty(DxoArgumentFormatComponent.prototype, "_optionPath", { get: function () { return 'argumentFormat'; }, enumerable: true, configurable: true }); DxoArgumentFormatComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dxo-argument-format', template: '', styles: [''], providers: [nested_option_1.NestedOptionHost], inputs: [ 'currency', 'formatter', 'parser', 'precision', 'type' ] },] }, ]; /** @nocollapse */ DxoArgumentFormatComponent.ctorParameters = function () { return [ { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.SkipSelf }, { type: core_1.Host },] }, { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.Host },] }, ]; }; return DxoArgumentFormatComponent; }(format_1.DxoFormat)); exports.DxoArgumentFormatComponent = DxoArgumentFormatComponent; var DxoArgumentFormatModule = (function () { function DxoArgumentFormatModule() { } DxoArgumentFormatModule.decorators = [ { type: core_1.NgModule, args: [{ declarations: [ DxoArgumentFormatComponent ], exports: [ DxoArgumentFormatComponent ], },] }, ]; /** @nocollapse */ DxoArgumentFormatModule.ctorParameters = function () { return []; }; return DxoArgumentFormatModule; }()); exports.DxoArgumentFormatModule = DxoArgumentFormatModule; //# sourceMappingURL=argument-format.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/at.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var nested_option_2 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var DxoAtComponent = (function (_super) { __extends(DxoAtComponent, _super); function DxoAtComponent(parentOptionHost, optionHost) { var _this = _super.call(this) || this; parentOptionHost.setNestedOption(_this); optionHost.setHost(_this, _this._fullOptionPath.bind(_this)); return _this; } Object.defineProperty(DxoAtComponent.prototype, "x", { get: function () { return this._getOption('x'); }, set: function (value) { this._setOption('x', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoAtComponent.prototype, "y", { get: function () { return this._getOption('y'); }, set: function (value) { this._setOption('y', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoAtComponent.prototype, "_optionPath", { get: function () { return 'at'; }, enumerable: true, configurable: true }); DxoAtComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dxo-at', template: '', styles: [''], providers: [nested_option_1.NestedOptionHost] },] }, ]; /** @nocollapse */ DxoAtComponent.ctorParameters = function () { return [ { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.SkipSelf }, { type: core_1.Host },] }, { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.Host },] }, ]; }; DxoAtComponent.propDecorators = { 'x': [{ type: core_1.Input },], 'y': [{ type: core_1.Input },], }; return DxoAtComponent; }(nested_option_2.NestedOption)); exports.DxoAtComponent = DxoAtComponent; var DxoAtModule = (function () { function DxoAtModule() { } DxoAtModule.decorators = [ { type: core_1.NgModule, args: [{ declarations: [ DxoAtComponent ], exports: [ DxoAtComponent ], },] }, ]; /** @nocollapse */ DxoAtModule.ctorParameters = function () { return []; }; return DxoAtModule; }()); exports.DxoAtModule = DxoAtModule; //# sourceMappingURL=at.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/background-image.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var nested_option_2 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var DxoBackgroundImageComponent = (function (_super) { __extends(DxoBackgroundImageComponent, _super); function DxoBackgroundImageComponent(parentOptionHost, optionHost) { var _this = _super.call(this) || this; parentOptionHost.setNestedOption(_this); optionHost.setHost(_this, _this._fullOptionPath.bind(_this)); return _this; } Object.defineProperty(DxoBackgroundImageComponent.prototype, "height", { get: function () { return this._getOption('height'); }, set: function (value) { this._setOption('height', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoBackgroundImageComponent.prototype, "url", { get: function () { return this._getOption('url'); }, set: function (value) { this._setOption('url', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoBackgroundImageComponent.prototype, "width", { get: function () { return this._getOption('width'); }, set: function (value) { this._setOption('width', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoBackgroundImageComponent.prototype, "_optionPath", { get: function () { return 'backgroundImage'; }, enumerable: true, configurable: true }); DxoBackgroundImageComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dxo-background-image', template: '', styles: [''], providers: [nested_option_1.NestedOptionHost] },] }, ]; /** @nocollapse */ DxoBackgroundImageComponent.ctorParameters = function () { return [ { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.SkipSelf }, { type: core_1.Host },] }, { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.Host },] }, ]; }; DxoBackgroundImageComponent.propDecorators = { 'height': [{ type: core_1.Input },], 'url': [{ type: core_1.Input },], 'width': [{ type: core_1.Input },], }; return DxoBackgroundImageComponent; }(nested_option_2.NestedOption)); exports.DxoBackgroundImageComponent = DxoBackgroundImageComponent; var DxoBackgroundImageModule = (function () { function DxoBackgroundImageModule() { } DxoBackgroundImageModule.decorators = [ { type: core_1.NgModule, args: [{ declarations: [ DxoBackgroundImageComponent ], exports: [ DxoBackgroundImageComponent ], },] }, ]; /** @nocollapse */ DxoBackgroundImageModule.ctorParameters = function () { return []; }; return DxoBackgroundImageModule; }()); exports.DxoBackgroundImageModule = DxoBackgroundImageModule; //# sourceMappingURL=background-image.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/background.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var nested_option_2 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var DxoBackgroundComponent = (function (_super) { __extends(DxoBackgroundComponent, _super); function DxoBackgroundComponent(parentOptionHost, optionHost) { var _this = _super.call(this) || this; parentOptionHost.setNestedOption(_this); optionHost.setHost(_this, _this._fullOptionPath.bind(_this)); return _this; } Object.defineProperty(DxoBackgroundComponent.prototype, "color", { get: function () { return this._getOption('color'); }, set: function (value) { this._setOption('color', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoBackgroundComponent.prototype, "image", { get: function () { return this._getOption('image'); }, set: function (value) { this._setOption('image', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoBackgroundComponent.prototype, "visible", { get: function () { return this._getOption('visible'); }, set: function (value) { this._setOption('visible', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoBackgroundComponent.prototype, "borderColor", { get: function () { return this._getOption('borderColor'); }, set: function (value) { this._setOption('borderColor', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoBackgroundComponent.prototype, "_optionPath", { get: function () { return 'background'; }, enumerable: true, configurable: true }); DxoBackgroundComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dxo-background', template: '', styles: [''], providers: [nested_option_1.NestedOptionHost] },] }, ]; /** @nocollapse */ DxoBackgroundComponent.ctorParameters = function () { return [ { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.SkipSelf }, { type: core_1.Host },] }, { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.Host },] }, ]; }; DxoBackgroundComponent.propDecorators = { 'color': [{ type: core_1.Input },], 'image': [{ type: core_1.Input },], 'visible': [{ type: core_1.Input },], 'borderColor': [{ type: core_1.Input },], }; return DxoBackgroundComponent; }(nested_option_2.NestedOption)); exports.DxoBackgroundComponent = DxoBackgroundComponent; var DxoBackgroundModule = (function () { function DxoBackgroundModule() { } DxoBackgroundModule.decorators = [ { type: core_1.NgModule, args: [{ declarations: [ DxoBackgroundComponent ], exports: [ DxoBackgroundComponent ], },] }, ]; /** @nocollapse */ DxoBackgroundModule.ctorParameters = function () { return []; }; return DxoBackgroundModule; }()); exports.DxoBackgroundModule = DxoBackgroundModule; //# sourceMappingURL=background.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/bar.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); /* tslint:disable:use-input-property-decorator */ var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var chart_common_series_settings_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/base/chart-common-series-settings.js"); var DxoBarComponent = (function (_super) { __extends(DxoBarComponent, _super); function DxoBarComponent(parentOptionHost, optionHost) { var _this = _super.call(this) || this; parentOptionHost.setNestedOption(_this); optionHost.setHost(_this, _this._fullOptionPath.bind(_this)); return _this; } Object.defineProperty(DxoBarComponent.prototype, "_optionPath", { get: function () { return 'bar'; }, enumerable: true, configurable: true }); DxoBarComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dxo-bar', template: '', styles: [''], providers: [nested_option_1.NestedOptionHost], inputs: [ 'area', 'argumentField', 'axis', 'bar', 'border', 'bubble', 'candlestick', 'closeValueField', 'color', 'cornerRadius', 'dashStyle', 'fullstackedarea', 'fullstackedbar', 'fullstackedline', 'fullstackedspline', 'fullstackedsplinearea', 'highValueField', 'hoverMode', 'hoverStyle', 'ignoreEmptyPoints', 'innerColor', 'label', 'line', 'lowValueField', 'maxLabelCount', 'minBarSize', 'opacity', 'openValueField', 'pane', 'point', 'rangearea', 'rangebar', 'rangeValue1Field', 'rangeValue2Field', 'reduction', 'scatter', 'selectionMode', 'selectionStyle', 'showInLegend', 'sizeField', 'spline', 'splinearea', 'stack', 'stackedarea', 'stackedbar', 'stackedline', 'stackedspline', 'stackedsplinearea', 'steparea', 'stepline', 'stock', 'tagField', 'type', 'valueErrorBar', 'valueField', 'visible', 'width', 'closed' ] },] }, ]; /** @nocollapse */ DxoBarComponent.ctorParameters = function () { return [ { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.SkipSelf }, { type: core_1.Host },] }, { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.Host },] }, ]; }; return DxoBarComponent; }(chart_common_series_settings_1.DxoChartCommonSeriesSettings)); exports.DxoBarComponent = DxoBarComponent; var DxoBarModule = (function () { function DxoBarModule() { } DxoBarModule.decorators = [ { type: core_1.NgModule, args: [{ declarations: [ DxoBarComponent ], exports: [ DxoBarComponent ], },] }, ]; /** @nocollapse */ DxoBarModule.ctorParameters = function () { return []; }; return DxoBarModule; }()); exports.DxoBarModule = DxoBarModule; //# sourceMappingURL=bar.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/base/animation-config.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var DxoAnimationConfig = (function (_super) { __extends(DxoAnimationConfig, _super); function DxoAnimationConfig() { return _super !== null && _super.apply(this, arguments) || this; } Object.defineProperty(DxoAnimationConfig.prototype, "duration", { get: function () { return this._getOption('duration'); }, set: function (value) { this._setOption('duration', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoAnimationConfig.prototype, "easing", { get: function () { return this._getOption('easing'); }, set: function (value) { this._setOption('easing', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoAnimationConfig.prototype, "enabled", { get: function () { return this._getOption('enabled'); }, set: function (value) { this._setOption('enabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoAnimationConfig.prototype, "maxPointCountSupported", { get: function () { return this._getOption('maxPointCountSupported'); }, set: function (value) { this._setOption('maxPointCountSupported', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoAnimationConfig.prototype, "hide", { get: function () { return this._getOption('hide'); }, set: function (value) { this._setOption('hide', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoAnimationConfig.prototype, "show", { get: function () { return this._getOption('show'); }, set: function (value) { this._setOption('show', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoAnimationConfig.prototype, "complete", { get: function () { return this._getOption('complete'); }, set: function (value) { this._setOption('complete', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoAnimationConfig.prototype, "delay", { get: function () { return this._getOption('delay'); }, set: function (value) { this._setOption('delay', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoAnimationConfig.prototype, "direction", { get: function () { return this._getOption('direction'); }, set: function (value) { this._setOption('direction', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoAnimationConfig.prototype, "from", { get: function () { return this._getOption('from'); }, set: function (value) { this._setOption('from', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoAnimationConfig.prototype, "staggerDelay", { get: function () { return this._getOption('staggerDelay'); }, set: function (value) { this._setOption('staggerDelay', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoAnimationConfig.prototype, "start", { get: function () { return this._getOption('start'); }, set: function (value) { this._setOption('start', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoAnimationConfig.prototype, "to", { get: function () { return this._getOption('to'); }, set: function (value) { this._setOption('to', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoAnimationConfig.prototype, "type", { get: function () { return this._getOption('type'); }, set: function (value) { this._setOption('type', value); }, enumerable: true, configurable: true }); return DxoAnimationConfig; }(nested_option_1.NestedOption)); exports.DxoAnimationConfig = DxoAnimationConfig; //# sourceMappingURL=animation-config.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/base/box-options.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var DxoBoxOptions = (function (_super) { __extends(DxoBoxOptions, _super); function DxoBoxOptions() { return _super !== null && _super.apply(this, arguments) || this; } Object.defineProperty(DxoBoxOptions.prototype, "align", { get: function () { return this._getOption('align'); }, set: function (value) { this._setOption('align', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoBoxOptions.prototype, "crossAlign", { get: function () { return this._getOption('crossAlign'); }, set: function (value) { this._setOption('crossAlign', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoBoxOptions.prototype, "dataSource", { get: function () { return this._getOption('dataSource'); }, set: function (value) { this._setOption('dataSource', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoBoxOptions.prototype, "direction", { get: function () { return this._getOption('direction'); }, set: function (value) { this._setOption('direction', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoBoxOptions.prototype, "disabled", { get: function () { return this._getOption('disabled'); }, set: function (value) { this._setOption('disabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoBoxOptions.prototype, "elementAttr", { get: function () { return this._getOption('elementAttr'); }, set: function (value) { this._setOption('elementAttr', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoBoxOptions.prototype, "height", { get: function () { return this._getOption('height'); }, set: function (value) { this._setOption('height', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoBoxOptions.prototype, "hoverStateEnabled", { get: function () { return this._getOption('hoverStateEnabled'); }, set: function (value) { this._setOption('hoverStateEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoBoxOptions.prototype, "itemHoldTimeout", { get: function () { return this._getOption('itemHoldTimeout'); }, set: function (value) { this._setOption('itemHoldTimeout', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoBoxOptions.prototype, "items", { get: function () { return this._getOption('items'); }, set: function (value) { this._setOption('items', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoBoxOptions.prototype, "itemTemplate", { get: function () { return this._getOption('itemTemplate'); }, set: function (value) { this._setOption('itemTemplate', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoBoxOptions.prototype, "onContentReady", { get: function () { return this._getOption('onContentReady'); }, set: function (value) { this._setOption('onContentReady', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoBoxOptions.prototype, "onDisposing", { get: function () { return this._getOption('onDisposing'); }, set: function (value) { this._setOption('onDisposing', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoBoxOptions.prototype, "onInitialized", { get: function () { return this._getOption('onInitialized'); }, set: function (value) { this._setOption('onInitialized', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoBoxOptions.prototype, "onItemClick", { get: function () { return this._getOption('onItemClick'); }, set: function (value) { this._setOption('onItemClick', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoBoxOptions.prototype, "onItemContextMenu", { get: function () { return this._getOption('onItemContextMenu'); }, set: function (value) { this._setOption('onItemContextMenu', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoBoxOptions.prototype, "onItemHold", { get: function () { return this._getOption('onItemHold'); }, set: function (value) { this._setOption('onItemHold', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoBoxOptions.prototype, "onItemRendered", { get: function () { return this._getOption('onItemRendered'); }, set: function (value) { this._setOption('onItemRendered', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoBoxOptions.prototype, "onOptionChanged", { get: function () { return this._getOption('onOptionChanged'); }, set: function (value) { this._setOption('onOptionChanged', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoBoxOptions.prototype, "rtlEnabled", { get: function () { return this._getOption('rtlEnabled'); }, set: function (value) { this._setOption('rtlEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoBoxOptions.prototype, "visible", { get: function () { return this._getOption('visible'); }, set: function (value) { this._setOption('visible', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoBoxOptions.prototype, "width", { get: function () { return this._getOption('width'); }, set: function (value) { this._setOption('width', value); }, enumerable: true, configurable: true }); return DxoBoxOptions; }(nested_option_1.NestedOption)); exports.DxoBoxOptions = DxoBoxOptions; //# sourceMappingURL=box-options.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/base/chart-common-series-settings.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var DxoChartCommonSeriesSettings = (function (_super) { __extends(DxoChartCommonSeriesSettings, _super); function DxoChartCommonSeriesSettings() { return _super !== null && _super.apply(this, arguments) || this; } Object.defineProperty(DxoChartCommonSeriesSettings.prototype, "area", { get: function () { return this._getOption('area'); }, set: function (value) { this._setOption('area', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoChartCommonSeriesSettings.prototype, "argumentField", { get: function () { return this._getOption('argumentField'); }, set: function (value) { this._setOption('argumentField', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoChartCommonSeriesSettings.prototype, "axis", { get: function () { return this._getOption('axis'); }, set: function (value) { this._setOption('axis', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoChartCommonSeriesSettings.prototype, "bar", { get: function () { return this._getOption('bar'); }, set: function (value) { this._setOption('bar', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoChartCommonSeriesSettings.prototype, "border", { get: function () { return this._getOption('border'); }, set: function (value) { this._setOption('border', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoChartCommonSeriesSettings.prototype, "bubble", { get: function () { return this._getOption('bubble'); }, set: function (value) { this._setOption('bubble', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoChartCommonSeriesSettings.prototype, "candlestick", { get: function () { return this._getOption('candlestick'); }, set: function (value) { this._setOption('candlestick', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoChartCommonSeriesSettings.prototype, "closeValueField", { get: function () { return this._getOption('closeValueField'); }, set: function (value) { this._setOption('closeValueField', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoChartCommonSeriesSettings.prototype, "color", { get: function () { return this._getOption('color'); }, set: function (value) { this._setOption('color', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoChartCommonSeriesSettings.prototype, "cornerRadius", { get: function () { return this._getOption('cornerRadius'); }, set: function (value) { this._setOption('cornerRadius', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoChartCommonSeriesSettings.prototype, "dashStyle", { get: function () { return this._getOption('dashStyle'); }, set: function (value) { this._setOption('dashStyle', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoChartCommonSeriesSettings.prototype, "fullstackedarea", { get: function () { return this._getOption('fullstackedarea'); }, set: function (value) { this._setOption('fullstackedarea', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoChartCommonSeriesSettings.prototype, "fullstackedbar", { get: function () { return this._getOption('fullstackedbar'); }, set: function (value) { this._setOption('fullstackedbar', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoChartCommonSeriesSettings.prototype, "fullstackedline", { get: function () { return this._getOption('fullstackedline'); }, set: function (value) { this._setOption('fullstackedline', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoChartCommonSeriesSettings.prototype, "fullstackedspline", { get: function () { return this._getOption('fullstackedspline'); }, set: function (value) { this._setOption('fullstackedspline', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoChartCommonSeriesSettings.prototype, "fullstackedsplinearea", { get: function () { return this._getOption('fullstackedsplinearea'); }, set: function (value) { this._setOption('fullstackedsplinearea', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoChartCommonSeriesSettings.prototype, "highValueField", { get: function () { return this._getOption('highValueField'); }, set: function (value) { this._setOption('highValueField', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoChartCommonSeriesSettings.prototype, "hoverMode", { get: function () { return this._getOption('hoverMode'); }, set: function (value) { this._setOption('hoverMode', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoChartCommonSeriesSettings.prototype, "hoverStyle", { get: function () { return this._getOption('hoverStyle'); }, set: function (value) { this._setOption('hoverStyle', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoChartCommonSeriesSettings.prototype, "ignoreEmptyPoints", { get: function () { return this._getOption('ignoreEmptyPoints'); }, set: function (value) { this._setOption('ignoreEmptyPoints', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoChartCommonSeriesSettings.prototype, "innerColor", { get: function () { return this._getOption('innerColor'); }, set: function (value) { this._setOption('innerColor', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoChartCommonSeriesSettings.prototype, "label", { get: function () { return this._getOption('label'); }, set: function (value) { this._setOption('label', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoChartCommonSeriesSettings.prototype, "line", { get: function () { return this._getOption('line'); }, set: function (value) { this._setOption('line', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoChartCommonSeriesSettings.prototype, "lowValueField", { get: function () { return this._getOption('lowValueField'); }, set: function (value) { this._setOption('lowValueField', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoChartCommonSeriesSettings.prototype, "maxLabelCount", { get: function () { return this._getOption('maxLabelCount'); }, set: function (value) { this._setOption('maxLabelCount', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoChartCommonSeriesSettings.prototype, "minBarSize", { get: function () { return this._getOption('minBarSize'); }, set: function (value) { this._setOption('minBarSize', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoChartCommonSeriesSettings.prototype, "opacity", { get: function () { return this._getOption('opacity'); }, set: function (value) { this._setOption('opacity', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoChartCommonSeriesSettings.prototype, "openValueField", { get: function () { return this._getOption('openValueField'); }, set: function (value) { this._setOption('openValueField', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoChartCommonSeriesSettings.prototype, "pane", { get: function () { return this._getOption('pane'); }, set: function (value) { this._setOption('pane', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoChartCommonSeriesSettings.prototype, "point", { get: function () { return this._getOption('point'); }, set: function (value) { this._setOption('point', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoChartCommonSeriesSettings.prototype, "rangearea", { get: function () { return this._getOption('rangearea'); }, set: function (value) { this._setOption('rangearea', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoChartCommonSeriesSettings.prototype, "rangebar", { get: function () { return this._getOption('rangebar'); }, set: function (value) { this._setOption('rangebar', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoChartCommonSeriesSettings.prototype, "rangeValue1Field", { get: function () { return this._getOption('rangeValue1Field'); }, set: function (value) { this._setOption('rangeValue1Field', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoChartCommonSeriesSettings.prototype, "rangeValue2Field", { get: function () { return this._getOption('rangeValue2Field'); }, set: function (value) { this._setOption('rangeValue2Field', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoChartCommonSeriesSettings.prototype, "reduction", { get: function () { return this._getOption('reduction'); }, set: function (value) { this._setOption('reduction', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoChartCommonSeriesSettings.prototype, "scatter", { get: function () { return this._getOption('scatter'); }, set: function (value) { this._setOption('scatter', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoChartCommonSeriesSettings.prototype, "selectionMode", { get: function () { return this._getOption('selectionMode'); }, set: function (value) { this._setOption('selectionMode', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoChartCommonSeriesSettings.prototype, "selectionStyle", { get: function () { return this._getOption('selectionStyle'); }, set: function (value) { this._setOption('selectionStyle', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoChartCommonSeriesSettings.prototype, "showInLegend", { get: function () { return this._getOption('showInLegend'); }, set: function (value) { this._setOption('showInLegend', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoChartCommonSeriesSettings.prototype, "sizeField", { get: function () { return this._getOption('sizeField'); }, set: function (value) { this._setOption('sizeField', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoChartCommonSeriesSettings.prototype, "spline", { get: function () { return this._getOption('spline'); }, set: function (value) { this._setOption('spline', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoChartCommonSeriesSettings.prototype, "splinearea", { get: function () { return this._getOption('splinearea'); }, set: function (value) { this._setOption('splinearea', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoChartCommonSeriesSettings.prototype, "stack", { get: function () { return this._getOption('stack'); }, set: function (value) { this._setOption('stack', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoChartCommonSeriesSettings.prototype, "stackedarea", { get: function () { return this._getOption('stackedarea'); }, set: function (value) { this._setOption('stackedarea', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoChartCommonSeriesSettings.prototype, "stackedbar", { get: function () { return this._getOption('stackedbar'); }, set: function (value) { this._setOption('stackedbar', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoChartCommonSeriesSettings.prototype, "stackedline", { get: function () { return this._getOption('stackedline'); }, set: function (value) { this._setOption('stackedline', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoChartCommonSeriesSettings.prototype, "stackedspline", { get: function () { return this._getOption('stackedspline'); }, set: function (value) { this._setOption('stackedspline', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoChartCommonSeriesSettings.prototype, "stackedsplinearea", { get: function () { return this._getOption('stackedsplinearea'); }, set: function (value) { this._setOption('stackedsplinearea', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoChartCommonSeriesSettings.prototype, "steparea", { get: function () { return this._getOption('steparea'); }, set: function (value) { this._setOption('steparea', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoChartCommonSeriesSettings.prototype, "stepline", { get: function () { return this._getOption('stepline'); }, set: function (value) { this._setOption('stepline', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoChartCommonSeriesSettings.prototype, "stock", { get: function () { return this._getOption('stock'); }, set: function (value) { this._setOption('stock', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoChartCommonSeriesSettings.prototype, "tagField", { get: function () { return this._getOption('tagField'); }, set: function (value) { this._setOption('tagField', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoChartCommonSeriesSettings.prototype, "type", { get: function () { return this._getOption('type'); }, set: function (value) { this._setOption('type', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoChartCommonSeriesSettings.prototype, "valueErrorBar", { get: function () { return this._getOption('valueErrorBar'); }, set: function (value) { this._setOption('valueErrorBar', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoChartCommonSeriesSettings.prototype, "valueField", { get: function () { return this._getOption('valueField'); }, set: function (value) { this._setOption('valueField', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoChartCommonSeriesSettings.prototype, "visible", { get: function () { return this._getOption('visible'); }, set: function (value) { this._setOption('visible', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoChartCommonSeriesSettings.prototype, "width", { get: function () { return this._getOption('width'); }, set: function (value) { this._setOption('width', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoChartCommonSeriesSettings.prototype, "argumentType", { get: function () { return this._getOption('argumentType'); }, set: function (value) { this._setOption('argumentType', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoChartCommonSeriesSettings.prototype, "innerRadius", { get: function () { return this._getOption('innerRadius'); }, set: function (value) { this._setOption('innerRadius', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoChartCommonSeriesSettings.prototype, "minSegmentSize", { get: function () { return this._getOption('minSegmentSize'); }, set: function (value) { this._setOption('minSegmentSize', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoChartCommonSeriesSettings.prototype, "segmentsDirection", { get: function () { return this._getOption('segmentsDirection'); }, set: function (value) { this._setOption('segmentsDirection', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoChartCommonSeriesSettings.prototype, "smallValuesGrouping", { get: function () { return this._getOption('smallValuesGrouping'); }, set: function (value) { this._setOption('smallValuesGrouping', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoChartCommonSeriesSettings.prototype, "startAngle", { get: function () { return this._getOption('startAngle'); }, set: function (value) { this._setOption('startAngle', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoChartCommonSeriesSettings.prototype, "closed", { get: function () { return this._getOption('closed'); }, set: function (value) { this._setOption('closed', value); }, enumerable: true, configurable: true }); return DxoChartCommonSeriesSettings; }(nested_option_1.NestedOption)); exports.DxoChartCommonSeriesSettings = DxoChartCommonSeriesSettings; //# sourceMappingURL=chart-common-series-settings.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/base/chart-series-dxi.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var DxiChartSeries = (function (_super) { __extends(DxiChartSeries, _super); function DxiChartSeries() { return _super !== null && _super.apply(this, arguments) || this; } Object.defineProperty(DxiChartSeries.prototype, "argumentField", { get: function () { return this._getOption('argumentField'); }, set: function (value) { this._setOption('argumentField', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiChartSeries.prototype, "axis", { get: function () { return this._getOption('axis'); }, set: function (value) { this._setOption('axis', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiChartSeries.prototype, "border", { get: function () { return this._getOption('border'); }, set: function (value) { this._setOption('border', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiChartSeries.prototype, "closeValueField", { get: function () { return this._getOption('closeValueField'); }, set: function (value) { this._setOption('closeValueField', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiChartSeries.prototype, "color", { get: function () { return this._getOption('color'); }, set: function (value) { this._setOption('color', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiChartSeries.prototype, "cornerRadius", { get: function () { return this._getOption('cornerRadius'); }, set: function (value) { this._setOption('cornerRadius', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiChartSeries.prototype, "dashStyle", { get: function () { return this._getOption('dashStyle'); }, set: function (value) { this._setOption('dashStyle', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiChartSeries.prototype, "highValueField", { get: function () { return this._getOption('highValueField'); }, set: function (value) { this._setOption('highValueField', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiChartSeries.prototype, "hoverMode", { get: function () { return this._getOption('hoverMode'); }, set: function (value) { this._setOption('hoverMode', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiChartSeries.prototype, "hoverStyle", { get: function () { return this._getOption('hoverStyle'); }, set: function (value) { this._setOption('hoverStyle', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiChartSeries.prototype, "ignoreEmptyPoints", { get: function () { return this._getOption('ignoreEmptyPoints'); }, set: function (value) { this._setOption('ignoreEmptyPoints', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiChartSeries.prototype, "innerColor", { get: function () { return this._getOption('innerColor'); }, set: function (value) { this._setOption('innerColor', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiChartSeries.prototype, "label", { get: function () { return this._getOption('label'); }, set: function (value) { this._setOption('label', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiChartSeries.prototype, "lowValueField", { get: function () { return this._getOption('lowValueField'); }, set: function (value) { this._setOption('lowValueField', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiChartSeries.prototype, "maxLabelCount", { get: function () { return this._getOption('maxLabelCount'); }, set: function (value) { this._setOption('maxLabelCount', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiChartSeries.prototype, "minBarSize", { get: function () { return this._getOption('minBarSize'); }, set: function (value) { this._setOption('minBarSize', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiChartSeries.prototype, "name", { get: function () { return this._getOption('name'); }, set: function (value) { this._setOption('name', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiChartSeries.prototype, "opacity", { get: function () { return this._getOption('opacity'); }, set: function (value) { this._setOption('opacity', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiChartSeries.prototype, "openValueField", { get: function () { return this._getOption('openValueField'); }, set: function (value) { this._setOption('openValueField', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiChartSeries.prototype, "pane", { get: function () { return this._getOption('pane'); }, set: function (value) { this._setOption('pane', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiChartSeries.prototype, "point", { get: function () { return this._getOption('point'); }, set: function (value) { this._setOption('point', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiChartSeries.prototype, "rangeValue1Field", { get: function () { return this._getOption('rangeValue1Field'); }, set: function (value) { this._setOption('rangeValue1Field', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiChartSeries.prototype, "rangeValue2Field", { get: function () { return this._getOption('rangeValue2Field'); }, set: function (value) { this._setOption('rangeValue2Field', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiChartSeries.prototype, "reduction", { get: function () { return this._getOption('reduction'); }, set: function (value) { this._setOption('reduction', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiChartSeries.prototype, "selectionMode", { get: function () { return this._getOption('selectionMode'); }, set: function (value) { this._setOption('selectionMode', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiChartSeries.prototype, "selectionStyle", { get: function () { return this._getOption('selectionStyle'); }, set: function (value) { this._setOption('selectionStyle', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiChartSeries.prototype, "showInLegend", { get: function () { return this._getOption('showInLegend'); }, set: function (value) { this._setOption('showInLegend', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiChartSeries.prototype, "sizeField", { get: function () { return this._getOption('sizeField'); }, set: function (value) { this._setOption('sizeField', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiChartSeries.prototype, "stack", { get: function () { return this._getOption('stack'); }, set: function (value) { this._setOption('stack', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiChartSeries.prototype, "tag", { get: function () { return this._getOption('tag'); }, set: function (value) { this._setOption('tag', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiChartSeries.prototype, "tagField", { get: function () { return this._getOption('tagField'); }, set: function (value) { this._setOption('tagField', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiChartSeries.prototype, "type", { get: function () { return this._getOption('type'); }, set: function (value) { this._setOption('type', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiChartSeries.prototype, "valueErrorBar", { get: function () { return this._getOption('valueErrorBar'); }, set: function (value) { this._setOption('valueErrorBar', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiChartSeries.prototype, "valueField", { get: function () { return this._getOption('valueField'); }, set: function (value) { this._setOption('valueField', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiChartSeries.prototype, "visible", { get: function () { return this._getOption('visible'); }, set: function (value) { this._setOption('visible', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiChartSeries.prototype, "width", { get: function () { return this._getOption('width'); }, set: function (value) { this._setOption('width', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiChartSeries.prototype, "argumentType", { get: function () { return this._getOption('argumentType'); }, set: function (value) { this._setOption('argumentType', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiChartSeries.prototype, "innerRadius", { get: function () { return this._getOption('innerRadius'); }, set: function (value) { this._setOption('innerRadius', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiChartSeries.prototype, "minSegmentSize", { get: function () { return this._getOption('minSegmentSize'); }, set: function (value) { this._setOption('minSegmentSize', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiChartSeries.prototype, "segmentsDirection", { get: function () { return this._getOption('segmentsDirection'); }, set: function (value) { this._setOption('segmentsDirection', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiChartSeries.prototype, "smallValuesGrouping", { get: function () { return this._getOption('smallValuesGrouping'); }, set: function (value) { this._setOption('smallValuesGrouping', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiChartSeries.prototype, "startAngle", { get: function () { return this._getOption('startAngle'); }, set: function (value) { this._setOption('startAngle', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiChartSeries.prototype, "closed", { get: function () { return this._getOption('closed'); }, set: function (value) { this._setOption('closed', value); }, enumerable: true, configurable: true }); return DxiChartSeries; }(nested_option_1.CollectionNestedOption)); exports.DxiChartSeries = DxiChartSeries; //# sourceMappingURL=chart-series-dxi.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/base/context-menu-item-dxi.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var DxiContextMenuItem = (function (_super) { __extends(DxiContextMenuItem, _super); function DxiContextMenuItem() { return _super !== null && _super.apply(this, arguments) || this; } Object.defineProperty(DxiContextMenuItem.prototype, "disabled", { get: function () { return this._getOption('disabled'); }, set: function (value) { this._setOption('disabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiContextMenuItem.prototype, "html", { get: function () { return this._getOption('html'); }, set: function (value) { this._setOption('html', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiContextMenuItem.prototype, "icon", { get: function () { return this._getOption('icon'); }, set: function (value) { this._setOption('icon', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiContextMenuItem.prototype, "iconSrc", { get: function () { return this._getOption('iconSrc'); }, set: function (value) { this._setOption('iconSrc', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiContextMenuItem.prototype, "template", { get: function () { return this._getOption('template'); }, set: function (value) { this._setOption('template', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiContextMenuItem.prototype, "text", { get: function () { return this._getOption('text'); }, set: function (value) { this._setOption('text', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiContextMenuItem.prototype, "title", { get: function () { return this._getOption('title'); }, set: function (value) { this._setOption('title', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiContextMenuItem.prototype, "visible", { get: function () { return this._getOption('visible'); }, set: function (value) { this._setOption('visible', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiContextMenuItem.prototype, "onClick", { get: function () { return this._getOption('onClick'); }, set: function (value) { this._setOption('onClick', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiContextMenuItem.prototype, "type", { get: function () { return this._getOption('type'); }, set: function (value) { this._setOption('type', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiContextMenuItem.prototype, "baseSize", { get: function () { return this._getOption('baseSize'); }, set: function (value) { this._setOption('baseSize', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiContextMenuItem.prototype, "box", { get: function () { return this._getOption('box'); }, set: function (value) { this._setOption('box', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiContextMenuItem.prototype, "ratio", { get: function () { return this._getOption('ratio'); }, set: function (value) { this._setOption('ratio', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiContextMenuItem.prototype, "shrink", { get: function () { return this._getOption('shrink'); }, set: function (value) { this._setOption('shrink', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiContextMenuItem.prototype, "beginGroup", { get: function () { return this._getOption('beginGroup'); }, set: function (value) { this._setOption('beginGroup', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiContextMenuItem.prototype, "closeMenuOnClick", { get: function () { return this._getOption('closeMenuOnClick'); }, set: function (value) { this._setOption('closeMenuOnClick', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiContextMenuItem.prototype, "items", { get: function () { return this._getOption('items'); }, set: function (value) { this._setOption('items', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiContextMenuItem.prototype, "selectable", { get: function () { return this._getOption('selectable'); }, set: function (value) { this._setOption('selectable', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiContextMenuItem.prototype, "selected", { get: function () { return this._getOption('selected'); }, set: function (value) { this._setOption('selected', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiContextMenuItem.prototype, "colSpan", { get: function () { return this._getOption('colSpan'); }, set: function (value) { this._setOption('colSpan', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiContextMenuItem.prototype, "cssClass", { get: function () { return this._getOption('cssClass'); }, set: function (value) { this._setOption('cssClass', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiContextMenuItem.prototype, "dataField", { get: function () { return this._getOption('dataField'); }, set: function (value) { this._setOption('dataField', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiContextMenuItem.prototype, "editorOptions", { get: function () { return this._getOption('editorOptions'); }, set: function (value) { this._setOption('editorOptions', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiContextMenuItem.prototype, "editorType", { get: function () { return this._getOption('editorType'); }, set: function (value) { this._setOption('editorType', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiContextMenuItem.prototype, "helpText", { get: function () { return this._getOption('helpText'); }, set: function (value) { this._setOption('helpText', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiContextMenuItem.prototype, "isRequired", { get: function () { return this._getOption('isRequired'); }, set: function (value) { this._setOption('isRequired', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiContextMenuItem.prototype, "itemType", { get: function () { return this._getOption('itemType'); }, set: function (value) { this._setOption('itemType', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiContextMenuItem.prototype, "label", { get: function () { return this._getOption('label'); }, set: function (value) { this._setOption('label', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiContextMenuItem.prototype, "name", { get: function () { return this._getOption('name'); }, set: function (value) { this._setOption('name', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiContextMenuItem.prototype, "validationRules", { get: function () { return this._getOption('validationRules'); }, set: function (value) { this._setOption('validationRules', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiContextMenuItem.prototype, "visibleIndex", { get: function () { return this._getOption('visibleIndex'); }, set: function (value) { this._setOption('visibleIndex', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiContextMenuItem.prototype, "alignItemLabels", { get: function () { return this._getOption('alignItemLabels'); }, set: function (value) { this._setOption('alignItemLabels', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiContextMenuItem.prototype, "caption", { get: function () { return this._getOption('caption'); }, set: function (value) { this._setOption('caption', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiContextMenuItem.prototype, "colCount", { get: function () { return this._getOption('colCount'); }, set: function (value) { this._setOption('colCount', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiContextMenuItem.prototype, "colCountByScreen", { get: function () { return this._getOption('colCountByScreen'); }, set: function (value) { this._setOption('colCountByScreen', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiContextMenuItem.prototype, "tabPanelOptions", { get: function () { return this._getOption('tabPanelOptions'); }, set: function (value) { this._setOption('tabPanelOptions', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiContextMenuItem.prototype, "tabs", { get: function () { return this._getOption('tabs'); }, set: function (value) { this._setOption('tabs', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiContextMenuItem.prototype, "badge", { get: function () { return this._getOption('badge'); }, set: function (value) { this._setOption('badge', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiContextMenuItem.prototype, "tabTemplate", { get: function () { return this._getOption('tabTemplate'); }, set: function (value) { this._setOption('tabTemplate', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiContextMenuItem.prototype, "imageAlt", { get: function () { return this._getOption('imageAlt'); }, set: function (value) { this._setOption('imageAlt', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiContextMenuItem.prototype, "imageSrc", { get: function () { return this._getOption('imageSrc'); }, set: function (value) { this._setOption('imageSrc', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiContextMenuItem.prototype, "key", { get: function () { return this._getOption('key'); }, set: function (value) { this._setOption('key', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiContextMenuItem.prototype, "showChevron", { get: function () { return this._getOption('showChevron'); }, set: function (value) { this._setOption('showChevron', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiContextMenuItem.prototype, "titleTemplate", { get: function () { return this._getOption('titleTemplate'); }, set: function (value) { this._setOption('titleTemplate', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiContextMenuItem.prototype, "location", { get: function () { return this._getOption('location'); }, set: function (value) { this._setOption('location', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiContextMenuItem.prototype, "menuTemplate", { get: function () { return this._getOption('menuTemplate'); }, set: function (value) { this._setOption('menuTemplate', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiContextMenuItem.prototype, "heightRatio", { get: function () { return this._getOption('heightRatio'); }, set: function (value) { this._setOption('heightRatio', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiContextMenuItem.prototype, "widthRatio", { get: function () { return this._getOption('widthRatio'); }, set: function (value) { this._setOption('widthRatio', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiContextMenuItem.prototype, "locateInMenu", { get: function () { return this._getOption('locateInMenu'); }, set: function (value) { this._setOption('locateInMenu', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiContextMenuItem.prototype, "menuItemTemplate", { get: function () { return this._getOption('menuItemTemplate'); }, set: function (value) { this._setOption('menuItemTemplate', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiContextMenuItem.prototype, "options", { get: function () { return this._getOption('options'); }, set: function (value) { this._setOption('options', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiContextMenuItem.prototype, "showText", { get: function () { return this._getOption('showText'); }, set: function (value) { this._setOption('showText', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiContextMenuItem.prototype, "widget", { get: function () { return this._getOption('widget'); }, set: function (value) { this._setOption('widget', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiContextMenuItem.prototype, "expanded", { get: function () { return this._getOption('expanded'); }, set: function (value) { this._setOption('expanded', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiContextMenuItem.prototype, "hasItems", { get: function () { return this._getOption('hasItems'); }, set: function (value) { this._setOption('hasItems', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiContextMenuItem.prototype, "parentId", { get: function () { return this._getOption('parentId'); }, set: function (value) { this._setOption('parentId', value); }, enumerable: true, configurable: true }); return DxiContextMenuItem; }(nested_option_1.CollectionNestedOption)); exports.DxiContextMenuItem = DxiContextMenuItem; //# sourceMappingURL=context-menu-item-dxi.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/base/data-grid-column-dxi.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var DxiDataGridColumn = (function (_super) { __extends(DxiDataGridColumn, _super); function DxiDataGridColumn() { return _super !== null && _super.apply(this, arguments) || this; } Object.defineProperty(DxiDataGridColumn.prototype, "alignment", { get: function () { return this._getOption('alignment'); }, set: function (value) { this._setOption('alignment', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiDataGridColumn.prototype, "allowEditing", { get: function () { return this._getOption('allowEditing'); }, set: function (value) { this._setOption('allowEditing', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiDataGridColumn.prototype, "allowExporting", { get: function () { return this._getOption('allowExporting'); }, set: function (value) { this._setOption('allowExporting', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiDataGridColumn.prototype, "allowFiltering", { get: function () { return this._getOption('allowFiltering'); }, set: function (value) { this._setOption('allowFiltering', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiDataGridColumn.prototype, "allowFixing", { get: function () { return this._getOption('allowFixing'); }, set: function (value) { this._setOption('allowFixing', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiDataGridColumn.prototype, "allowGrouping", { get: function () { return this._getOption('allowGrouping'); }, set: function (value) { this._setOption('allowGrouping', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiDataGridColumn.prototype, "allowHeaderFiltering", { get: function () { return this._getOption('allowHeaderFiltering'); }, set: function (value) { this._setOption('allowHeaderFiltering', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiDataGridColumn.prototype, "allowHiding", { get: function () { return this._getOption('allowHiding'); }, set: function (value) { this._setOption('allowHiding', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiDataGridColumn.prototype, "allowReordering", { get: function () { return this._getOption('allowReordering'); }, set: function (value) { this._setOption('allowReordering', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiDataGridColumn.prototype, "allowResizing", { get: function () { return this._getOption('allowResizing'); }, set: function (value) { this._setOption('allowResizing', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiDataGridColumn.prototype, "allowSearch", { get: function () { return this._getOption('allowSearch'); }, set: function (value) { this._setOption('allowSearch', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiDataGridColumn.prototype, "allowSorting", { get: function () { return this._getOption('allowSorting'); }, set: function (value) { this._setOption('allowSorting', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiDataGridColumn.prototype, "autoExpandGroup", { get: function () { return this._getOption('autoExpandGroup'); }, set: function (value) { this._setOption('autoExpandGroup', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiDataGridColumn.prototype, "calculateCellValue", { get: function () { return this._getOption('calculateCellValue'); }, set: function (value) { this._setOption('calculateCellValue', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiDataGridColumn.prototype, "calculateDisplayValue", { get: function () { return this._getOption('calculateDisplayValue'); }, set: function (value) { this._setOption('calculateDisplayValue', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiDataGridColumn.prototype, "calculateFilterExpression", { get: function () { return this._getOption('calculateFilterExpression'); }, set: function (value) { this._setOption('calculateFilterExpression', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiDataGridColumn.prototype, "calculateGroupValue", { get: function () { return this._getOption('calculateGroupValue'); }, set: function (value) { this._setOption('calculateGroupValue', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiDataGridColumn.prototype, "calculateSortValue", { get: function () { return this._getOption('calculateSortValue'); }, set: function (value) { this._setOption('calculateSortValue', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiDataGridColumn.prototype, "caption", { get: function () { return this._getOption('caption'); }, set: function (value) { this._setOption('caption', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiDataGridColumn.prototype, "cellTemplate", { get: function () { return this._getOption('cellTemplate'); }, set: function (value) { this._setOption('cellTemplate', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiDataGridColumn.prototype, "columns", { get: function () { return this._getOption('columns'); }, set: function (value) { this._setOption('columns', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiDataGridColumn.prototype, "cssClass", { get: function () { return this._getOption('cssClass'); }, set: function (value) { this._setOption('cssClass', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiDataGridColumn.prototype, "customizeText", { get: function () { return this._getOption('customizeText'); }, set: function (value) { this._setOption('customizeText', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiDataGridColumn.prototype, "dataField", { get: function () { return this._getOption('dataField'); }, set: function (value) { this._setOption('dataField', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiDataGridColumn.prototype, "dataType", { get: function () { return this._getOption('dataType'); }, set: function (value) { this._setOption('dataType', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiDataGridColumn.prototype, "editCellTemplate", { get: function () { return this._getOption('editCellTemplate'); }, set: function (value) { this._setOption('editCellTemplate', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiDataGridColumn.prototype, "editorOptions", { get: function () { return this._getOption('editorOptions'); }, set: function (value) { this._setOption('editorOptions', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiDataGridColumn.prototype, "encodeHtml", { get: function () { return this._getOption('encodeHtml'); }, set: function (value) { this._setOption('encodeHtml', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiDataGridColumn.prototype, "falseText", { get: function () { return this._getOption('falseText'); }, set: function (value) { this._setOption('falseText', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiDataGridColumn.prototype, "filterOperations", { get: function () { return this._getOption('filterOperations'); }, set: function (value) { this._setOption('filterOperations', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiDataGridColumn.prototype, "filterType", { get: function () { return this._getOption('filterType'); }, set: function (value) { this._setOption('filterType', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiDataGridColumn.prototype, "filterValue", { get: function () { return this._getOption('filterValue'); }, set: function (value) { this._setOption('filterValue', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiDataGridColumn.prototype, "filterValues", { get: function () { return this._getOption('filterValues'); }, set: function (value) { this._setOption('filterValues', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiDataGridColumn.prototype, "fixed", { get: function () { return this._getOption('fixed'); }, set: function (value) { this._setOption('fixed', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiDataGridColumn.prototype, "fixedPosition", { get: function () { return this._getOption('fixedPosition'); }, set: function (value) { this._setOption('fixedPosition', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiDataGridColumn.prototype, "format", { get: function () { return this._getOption('format'); }, set: function (value) { this._setOption('format', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiDataGridColumn.prototype, "formItem", { get: function () { return this._getOption('formItem'); }, set: function (value) { this._setOption('formItem', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiDataGridColumn.prototype, "groupCellTemplate", { get: function () { return this._getOption('groupCellTemplate'); }, set: function (value) { this._setOption('groupCellTemplate', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiDataGridColumn.prototype, "groupIndex", { get: function () { return this._getOption('groupIndex'); }, set: function (value) { this._setOption('groupIndex', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiDataGridColumn.prototype, "headerCellTemplate", { get: function () { return this._getOption('headerCellTemplate'); }, set: function (value) { this._setOption('headerCellTemplate', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiDataGridColumn.prototype, "headerFilter", { get: function () { return this._getOption('headerFilter'); }, set: function (value) { this._setOption('headerFilter', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiDataGridColumn.prototype, "hidingPriority", { get: function () { return this._getOption('hidingPriority'); }, set: function (value) { this._setOption('hidingPriority', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiDataGridColumn.prototype, "isBand", { get: function () { return this._getOption('isBand'); }, set: function (value) { this._setOption('isBand', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiDataGridColumn.prototype, "lookup", { get: function () { return this._getOption('lookup'); }, set: function (value) { this._setOption('lookup', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiDataGridColumn.prototype, "minWidth", { get: function () { return this._getOption('minWidth'); }, set: function (value) { this._setOption('minWidth', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiDataGridColumn.prototype, "name", { get: function () { return this._getOption('name'); }, set: function (value) { this._setOption('name', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiDataGridColumn.prototype, "ownerBand", { get: function () { return this._getOption('ownerBand'); }, set: function (value) { this._setOption('ownerBand', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiDataGridColumn.prototype, "precision", { get: function () { return this._getOption('precision'); }, set: function (value) { this._setOption('precision', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiDataGridColumn.prototype, "selectedFilterOperation", { get: function () { return this._getOption('selectedFilterOperation'); }, set: function (value) { this._setOption('selectedFilterOperation', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiDataGridColumn.prototype, "setCellValue", { get: function () { return this._getOption('setCellValue'); }, set: function (value) { this._setOption('setCellValue', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiDataGridColumn.prototype, "showEditorAlways", { get: function () { return this._getOption('showEditorAlways'); }, set: function (value) { this._setOption('showEditorAlways', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiDataGridColumn.prototype, "showInColumnChooser", { get: function () { return this._getOption('showInColumnChooser'); }, set: function (value) { this._setOption('showInColumnChooser', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiDataGridColumn.prototype, "showWhenGrouped", { get: function () { return this._getOption('showWhenGrouped'); }, set: function (value) { this._setOption('showWhenGrouped', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiDataGridColumn.prototype, "sortIndex", { get: function () { return this._getOption('sortIndex'); }, set: function (value) { this._setOption('sortIndex', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiDataGridColumn.prototype, "sortingMethod", { get: function () { return this._getOption('sortingMethod'); }, set: function (value) { this._setOption('sortingMethod', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiDataGridColumn.prototype, "sortOrder", { get: function () { return this._getOption('sortOrder'); }, set: function (value) { this._setOption('sortOrder', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiDataGridColumn.prototype, "trueText", { get: function () { return this._getOption('trueText'); }, set: function (value) { this._setOption('trueText', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiDataGridColumn.prototype, "validationRules", { get: function () { return this._getOption('validationRules'); }, set: function (value) { this._setOption('validationRules', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiDataGridColumn.prototype, "visible", { get: function () { return this._getOption('visible'); }, set: function (value) { this._setOption('visible', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiDataGridColumn.prototype, "visibleIndex", { get: function () { return this._getOption('visibleIndex'); }, set: function (value) { this._setOption('visibleIndex', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiDataGridColumn.prototype, "width", { get: function () { return this._getOption('width'); }, set: function (value) { this._setOption('width', value); }, enumerable: true, configurable: true }); return DxiDataGridColumn; }(nested_option_1.CollectionNestedOption)); exports.DxiDataGridColumn = DxiDataGridColumn; //# sourceMappingURL=data-grid-column-dxi.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/base/filter-builder-field-dxi.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var DxiFilterBuilderField = (function (_super) { __extends(DxiFilterBuilderField, _super); function DxiFilterBuilderField() { return _super !== null && _super.apply(this, arguments) || this; } Object.defineProperty(DxiFilterBuilderField.prototype, "caption", { get: function () { return this._getOption('caption'); }, set: function (value) { this._setOption('caption', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiFilterBuilderField.prototype, "customizeText", { get: function () { return this._getOption('customizeText'); }, set: function (value) { this._setOption('customizeText', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiFilterBuilderField.prototype, "dataField", { get: function () { return this._getOption('dataField'); }, set: function (value) { this._setOption('dataField', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiFilterBuilderField.prototype, "dataType", { get: function () { return this._getOption('dataType'); }, set: function (value) { this._setOption('dataType', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiFilterBuilderField.prototype, "editorOptions", { get: function () { return this._getOption('editorOptions'); }, set: function (value) { this._setOption('editorOptions', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiFilterBuilderField.prototype, "editorTemplate", { get: function () { return this._getOption('editorTemplate'); }, set: function (value) { this._setOption('editorTemplate', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiFilterBuilderField.prototype, "falseText", { get: function () { return this._getOption('falseText'); }, set: function (value) { this._setOption('falseText', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiFilterBuilderField.prototype, "filterOperations", { get: function () { return this._getOption('filterOperations'); }, set: function (value) { this._setOption('filterOperations', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiFilterBuilderField.prototype, "format", { get: function () { return this._getOption('format'); }, set: function (value) { this._setOption('format', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiFilterBuilderField.prototype, "lookup", { get: function () { return this._getOption('lookup'); }, set: function (value) { this._setOption('lookup', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiFilterBuilderField.prototype, "trueText", { get: function () { return this._getOption('trueText'); }, set: function (value) { this._setOption('trueText', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiFilterBuilderField.prototype, "allowCrossGroupCalculation", { get: function () { return this._getOption('allowCrossGroupCalculation'); }, set: function (value) { this._setOption('allowCrossGroupCalculation', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiFilterBuilderField.prototype, "allowExpandAll", { get: function () { return this._getOption('allowExpandAll'); }, set: function (value) { this._setOption('allowExpandAll', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiFilterBuilderField.prototype, "allowFiltering", { get: function () { return this._getOption('allowFiltering'); }, set: function (value) { this._setOption('allowFiltering', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiFilterBuilderField.prototype, "allowSorting", { get: function () { return this._getOption('allowSorting'); }, set: function (value) { this._setOption('allowSorting', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiFilterBuilderField.prototype, "allowSortingBySummary", { get: function () { return this._getOption('allowSortingBySummary'); }, set: function (value) { this._setOption('allowSortingBySummary', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiFilterBuilderField.prototype, "area", { get: function () { return this._getOption('area'); }, set: function (value) { this._setOption('area', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiFilterBuilderField.prototype, "areaIndex", { get: function () { return this._getOption('areaIndex'); }, set: function (value) { this._setOption('areaIndex', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiFilterBuilderField.prototype, "calculateCustomSummary", { get: function () { return this._getOption('calculateCustomSummary'); }, set: function (value) { this._setOption('calculateCustomSummary', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiFilterBuilderField.prototype, "calculateSummaryValue", { get: function () { return this._getOption('calculateSummaryValue'); }, set: function (value) { this._setOption('calculateSummaryValue', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiFilterBuilderField.prototype, "displayFolder", { get: function () { return this._getOption('displayFolder'); }, set: function (value) { this._setOption('displayFolder', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiFilterBuilderField.prototype, "expanded", { get: function () { return this._getOption('expanded'); }, set: function (value) { this._setOption('expanded', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiFilterBuilderField.prototype, "filterType", { get: function () { return this._getOption('filterType'); }, set: function (value) { this._setOption('filterType', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiFilterBuilderField.prototype, "filterValues", { get: function () { return this._getOption('filterValues'); }, set: function (value) { this._setOption('filterValues', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiFilterBuilderField.prototype, "groupIndex", { get: function () { return this._getOption('groupIndex'); }, set: function (value) { this._setOption('groupIndex', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiFilterBuilderField.prototype, "groupInterval", { get: function () { return this._getOption('groupInterval'); }, set: function (value) { this._setOption('groupInterval', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiFilterBuilderField.prototype, "groupName", { get: function () { return this._getOption('groupName'); }, set: function (value) { this._setOption('groupName', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiFilterBuilderField.prototype, "headerFilter", { get: function () { return this._getOption('headerFilter'); }, set: function (value) { this._setOption('headerFilter', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiFilterBuilderField.prototype, "isMeasure", { get: function () { return this._getOption('isMeasure'); }, set: function (value) { this._setOption('isMeasure', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiFilterBuilderField.prototype, "precision", { get: function () { return this._getOption('precision'); }, set: function (value) { this._setOption('precision', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiFilterBuilderField.prototype, "runningTotal", { get: function () { return this._getOption('runningTotal'); }, set: function (value) { this._setOption('runningTotal', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiFilterBuilderField.prototype, "selector", { get: function () { return this._getOption('selector'); }, set: function (value) { this._setOption('selector', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiFilterBuilderField.prototype, "showGrandTotals", { get: function () { return this._getOption('showGrandTotals'); }, set: function (value) { this._setOption('showGrandTotals', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiFilterBuilderField.prototype, "showTotals", { get: function () { return this._getOption('showTotals'); }, set: function (value) { this._setOption('showTotals', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiFilterBuilderField.prototype, "showValues", { get: function () { return this._getOption('showValues'); }, set: function (value) { this._setOption('showValues', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiFilterBuilderField.prototype, "sortBy", { get: function () { return this._getOption('sortBy'); }, set: function (value) { this._setOption('sortBy', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiFilterBuilderField.prototype, "sortBySummaryField", { get: function () { return this._getOption('sortBySummaryField'); }, set: function (value) { this._setOption('sortBySummaryField', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiFilterBuilderField.prototype, "sortBySummaryPath", { get: function () { return this._getOption('sortBySummaryPath'); }, set: function (value) { this._setOption('sortBySummaryPath', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiFilterBuilderField.prototype, "sortingMethod", { get: function () { return this._getOption('sortingMethod'); }, set: function (value) { this._setOption('sortingMethod', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiFilterBuilderField.prototype, "sortOrder", { get: function () { return this._getOption('sortOrder'); }, set: function (value) { this._setOption('sortOrder', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiFilterBuilderField.prototype, "summaryDisplayMode", { get: function () { return this._getOption('summaryDisplayMode'); }, set: function (value) { this._setOption('summaryDisplayMode', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiFilterBuilderField.prototype, "summaryType", { get: function () { return this._getOption('summaryType'); }, set: function (value) { this._setOption('summaryType', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiFilterBuilderField.prototype, "visible", { get: function () { return this._getOption('visible'); }, set: function (value) { this._setOption('visible', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiFilterBuilderField.prototype, "width", { get: function () { return this._getOption('width'); }, set: function (value) { this._setOption('width', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiFilterBuilderField.prototype, "wordWrapEnabled", { get: function () { return this._getOption('wordWrapEnabled'); }, set: function (value) { this._setOption('wordWrapEnabled', value); }, enumerable: true, configurable: true }); return DxiFilterBuilderField; }(nested_option_1.CollectionNestedOption)); exports.DxiFilterBuilderField = DxiFilterBuilderField; //# sourceMappingURL=filter-builder-field-dxi.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/base/form-options.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var DxoFormOptions = (function (_super) { __extends(DxoFormOptions, _super); function DxoFormOptions() { return _super !== null && _super.apply(this, arguments) || this; } Object.defineProperty(DxoFormOptions.prototype, "accessKey", { get: function () { return this._getOption('accessKey'); }, set: function (value) { this._setOption('accessKey', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFormOptions.prototype, "activeStateEnabled", { get: function () { return this._getOption('activeStateEnabled'); }, set: function (value) { this._setOption('activeStateEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFormOptions.prototype, "alignItemLabels", { get: function () { return this._getOption('alignItemLabels'); }, set: function (value) { this._setOption('alignItemLabels', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFormOptions.prototype, "alignItemLabelsInAllGroups", { get: function () { return this._getOption('alignItemLabelsInAllGroups'); }, set: function (value) { this._setOption('alignItemLabelsInAllGroups', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFormOptions.prototype, "colCount", { get: function () { return this._getOption('colCount'); }, set: function (value) { this._setOption('colCount', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFormOptions.prototype, "colCountByScreen", { get: function () { return this._getOption('colCountByScreen'); }, set: function (value) { this._setOption('colCountByScreen', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFormOptions.prototype, "customizeItem", { get: function () { return this._getOption('customizeItem'); }, set: function (value) { this._setOption('customizeItem', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFormOptions.prototype, "disabled", { get: function () { return this._getOption('disabled'); }, set: function (value) { this._setOption('disabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFormOptions.prototype, "elementAttr", { get: function () { return this._getOption('elementAttr'); }, set: function (value) { this._setOption('elementAttr', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFormOptions.prototype, "focusStateEnabled", { get: function () { return this._getOption('focusStateEnabled'); }, set: function (value) { this._setOption('focusStateEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFormOptions.prototype, "formData", { get: function () { return this._getOption('formData'); }, set: function (value) { this._setOption('formData', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFormOptions.prototype, "height", { get: function () { return this._getOption('height'); }, set: function (value) { this._setOption('height', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFormOptions.prototype, "hint", { get: function () { return this._getOption('hint'); }, set: function (value) { this._setOption('hint', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFormOptions.prototype, "hoverStateEnabled", { get: function () { return this._getOption('hoverStateEnabled'); }, set: function (value) { this._setOption('hoverStateEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFormOptions.prototype, "items", { get: function () { return this._getOption('items'); }, set: function (value) { this._setOption('items', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFormOptions.prototype, "labelLocation", { get: function () { return this._getOption('labelLocation'); }, set: function (value) { this._setOption('labelLocation', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFormOptions.prototype, "minColWidth", { get: function () { return this._getOption('minColWidth'); }, set: function (value) { this._setOption('minColWidth', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFormOptions.prototype, "onContentReady", { get: function () { return this._getOption('onContentReady'); }, set: function (value) { this._setOption('onContentReady', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFormOptions.prototype, "onDisposing", { get: function () { return this._getOption('onDisposing'); }, set: function (value) { this._setOption('onDisposing', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFormOptions.prototype, "onEditorEnterKey", { get: function () { return this._getOption('onEditorEnterKey'); }, set: function (value) { this._setOption('onEditorEnterKey', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFormOptions.prototype, "onFieldDataChanged", { get: function () { return this._getOption('onFieldDataChanged'); }, set: function (value) { this._setOption('onFieldDataChanged', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFormOptions.prototype, "onInitialized", { get: function () { return this._getOption('onInitialized'); }, set: function (value) { this._setOption('onInitialized', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFormOptions.prototype, "onOptionChanged", { get: function () { return this._getOption('onOptionChanged'); }, set: function (value) { this._setOption('onOptionChanged', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFormOptions.prototype, "optionalMark", { get: function () { return this._getOption('optionalMark'); }, set: function (value) { this._setOption('optionalMark', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFormOptions.prototype, "readOnly", { get: function () { return this._getOption('readOnly'); }, set: function (value) { this._setOption('readOnly', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFormOptions.prototype, "requiredMark", { get: function () { return this._getOption('requiredMark'); }, set: function (value) { this._setOption('requiredMark', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFormOptions.prototype, "requiredMessage", { get: function () { return this._getOption('requiredMessage'); }, set: function (value) { this._setOption('requiredMessage', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFormOptions.prototype, "rtlEnabled", { get: function () { return this._getOption('rtlEnabled'); }, set: function (value) { this._setOption('rtlEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFormOptions.prototype, "screenByWidth", { get: function () { return this._getOption('screenByWidth'); }, set: function (value) { this._setOption('screenByWidth', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFormOptions.prototype, "scrollingEnabled", { get: function () { return this._getOption('scrollingEnabled'); }, set: function (value) { this._setOption('scrollingEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFormOptions.prototype, "showColonAfterLabel", { get: function () { return this._getOption('showColonAfterLabel'); }, set: function (value) { this._setOption('showColonAfterLabel', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFormOptions.prototype, "showOptionalMark", { get: function () { return this._getOption('showOptionalMark'); }, set: function (value) { this._setOption('showOptionalMark', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFormOptions.prototype, "showRequiredMark", { get: function () { return this._getOption('showRequiredMark'); }, set: function (value) { this._setOption('showRequiredMark', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFormOptions.prototype, "showValidationSummary", { get: function () { return this._getOption('showValidationSummary'); }, set: function (value) { this._setOption('showValidationSummary', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFormOptions.prototype, "tabIndex", { get: function () { return this._getOption('tabIndex'); }, set: function (value) { this._setOption('tabIndex', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFormOptions.prototype, "validationGroup", { get: function () { return this._getOption('validationGroup'); }, set: function (value) { this._setOption('validationGroup', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFormOptions.prototype, "visible", { get: function () { return this._getOption('visible'); }, set: function (value) { this._setOption('visible', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFormOptions.prototype, "width", { get: function () { return this._getOption('width'); }, set: function (value) { this._setOption('width', value); }, enumerable: true, configurable: true }); return DxoFormOptions; }(nested_option_1.NestedOption)); exports.DxoFormOptions = DxoFormOptions; //# sourceMappingURL=form-options.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/base/form-simple-item.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var DxoFormSimpleItem = (function (_super) { __extends(DxoFormSimpleItem, _super); function DxoFormSimpleItem() { return _super !== null && _super.apply(this, arguments) || this; } Object.defineProperty(DxoFormSimpleItem.prototype, "colSpan", { get: function () { return this._getOption('colSpan'); }, set: function (value) { this._setOption('colSpan', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFormSimpleItem.prototype, "cssClass", { get: function () { return this._getOption('cssClass'); }, set: function (value) { this._setOption('cssClass', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFormSimpleItem.prototype, "dataField", { get: function () { return this._getOption('dataField'); }, set: function (value) { this._setOption('dataField', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFormSimpleItem.prototype, "editorOptions", { get: function () { return this._getOption('editorOptions'); }, set: function (value) { this._setOption('editorOptions', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFormSimpleItem.prototype, "editorType", { get: function () { return this._getOption('editorType'); }, set: function (value) { this._setOption('editorType', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFormSimpleItem.prototype, "helpText", { get: function () { return this._getOption('helpText'); }, set: function (value) { this._setOption('helpText', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFormSimpleItem.prototype, "isRequired", { get: function () { return this._getOption('isRequired'); }, set: function (value) { this._setOption('isRequired', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFormSimpleItem.prototype, "itemType", { get: function () { return this._getOption('itemType'); }, set: function (value) { this._setOption('itemType', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFormSimpleItem.prototype, "label", { get: function () { return this._getOption('label'); }, set: function (value) { this._setOption('label', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFormSimpleItem.prototype, "name", { get: function () { return this._getOption('name'); }, set: function (value) { this._setOption('name', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFormSimpleItem.prototype, "template", { get: function () { return this._getOption('template'); }, set: function (value) { this._setOption('template', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFormSimpleItem.prototype, "validationRules", { get: function () { return this._getOption('validationRules'); }, set: function (value) { this._setOption('validationRules', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFormSimpleItem.prototype, "visible", { get: function () { return this._getOption('visible'); }, set: function (value) { this._setOption('visible', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFormSimpleItem.prototype, "visibleIndex", { get: function () { return this._getOption('visibleIndex'); }, set: function (value) { this._setOption('visibleIndex', value); }, enumerable: true, configurable: true }); return DxoFormSimpleItem; }(nested_option_1.NestedOption)); exports.DxoFormSimpleItem = DxoFormSimpleItem; //# sourceMappingURL=form-simple-item.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/base/format.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var DxoFormat = (function (_super) { __extends(DxoFormat, _super); function DxoFormat() { return _super !== null && _super.apply(this, arguments) || this; } Object.defineProperty(DxoFormat.prototype, "currency", { get: function () { return this._getOption('currency'); }, set: function (value) { this._setOption('currency', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFormat.prototype, "formatter", { get: function () { return this._getOption('formatter'); }, set: function (value) { this._setOption('formatter', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFormat.prototype, "parser", { get: function () { return this._getOption('parser'); }, set: function (value) { this._setOption('parser', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFormat.prototype, "precision", { get: function () { return this._getOption('precision'); }, set: function (value) { this._setOption('precision', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFormat.prototype, "type", { get: function () { return this._getOption('type'); }, set: function (value) { this._setOption('type', value); }, enumerable: true, configurable: true }); return DxoFormat; }(nested_option_1.NestedOption)); exports.DxoFormat = DxoFormat; //# sourceMappingURL=format.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/base/gauge-indicator.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var DxoGaugeIndicator = (function (_super) { __extends(DxoGaugeIndicator, _super); function DxoGaugeIndicator() { return _super !== null && _super.apply(this, arguments) || this; } Object.defineProperty(DxoGaugeIndicator.prototype, "arrowLength", { get: function () { return this._getOption('arrowLength'); }, set: function (value) { this._setOption('arrowLength', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoGaugeIndicator.prototype, "backgroundColor", { get: function () { return this._getOption('backgroundColor'); }, set: function (value) { this._setOption('backgroundColor', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoGaugeIndicator.prototype, "baseValue", { get: function () { return this._getOption('baseValue'); }, set: function (value) { this._setOption('baseValue', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoGaugeIndicator.prototype, "beginAdaptingAtRadius", { get: function () { return this._getOption('beginAdaptingAtRadius'); }, set: function (value) { this._setOption('beginAdaptingAtRadius', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoGaugeIndicator.prototype, "color", { get: function () { return this._getOption('color'); }, set: function (value) { this._setOption('color', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoGaugeIndicator.prototype, "horizontalOrientation", { get: function () { return this._getOption('horizontalOrientation'); }, set: function (value) { this._setOption('horizontalOrientation', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoGaugeIndicator.prototype, "indentFromCenter", { get: function () { return this._getOption('indentFromCenter'); }, set: function (value) { this._setOption('indentFromCenter', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoGaugeIndicator.prototype, "length", { get: function () { return this._getOption('length'); }, set: function (value) { this._setOption('length', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoGaugeIndicator.prototype, "offset", { get: function () { return this._getOption('offset'); }, set: function (value) { this._setOption('offset', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoGaugeIndicator.prototype, "palette", { get: function () { return this._getOption('palette'); }, set: function (value) { this._setOption('palette', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoGaugeIndicator.prototype, "secondColor", { get: function () { return this._getOption('secondColor'); }, set: function (value) { this._setOption('secondColor', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoGaugeIndicator.prototype, "secondFraction", { get: function () { return this._getOption('secondFraction'); }, set: function (value) { this._setOption('secondFraction', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoGaugeIndicator.prototype, "size", { get: function () { return this._getOption('size'); }, set: function (value) { this._setOption('size', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoGaugeIndicator.prototype, "spindleGapSize", { get: function () { return this._getOption('spindleGapSize'); }, set: function (value) { this._setOption('spindleGapSize', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoGaugeIndicator.prototype, "spindleSize", { get: function () { return this._getOption('spindleSize'); }, set: function (value) { this._setOption('spindleSize', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoGaugeIndicator.prototype, "text", { get: function () { return this._getOption('text'); }, set: function (value) { this._setOption('text', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoGaugeIndicator.prototype, "type", { get: function () { return this._getOption('type'); }, set: function (value) { this._setOption('type', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoGaugeIndicator.prototype, "verticalOrientation", { get: function () { return this._getOption('verticalOrientation'); }, set: function (value) { this._setOption('verticalOrientation', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoGaugeIndicator.prototype, "width", { get: function () { return this._getOption('width'); }, set: function (value) { this._setOption('width', value); }, enumerable: true, configurable: true }); return DxoGaugeIndicator; }(nested_option_1.NestedOption)); exports.DxoGaugeIndicator = DxoGaugeIndicator; //# sourceMappingURL=gauge-indicator.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/base/pivot-grid-data-source.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var DxoPivotGridDataSource = (function (_super) { __extends(DxoPivotGridDataSource, _super); function DxoPivotGridDataSource() { return _super !== null && _super.apply(this, arguments) || this; } Object.defineProperty(DxoPivotGridDataSource.prototype, "fields", { get: function () { return this._getOption('fields'); }, set: function (value) { this._setOption('fields', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoPivotGridDataSource.prototype, "filter", { get: function () { return this._getOption('filter'); }, set: function (value) { this._setOption('filter', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoPivotGridDataSource.prototype, "onChanged", { get: function () { return this._getOption('onChanged'); }, set: function (value) { this._setOption('onChanged', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoPivotGridDataSource.prototype, "onFieldsPrepared", { get: function () { return this._getOption('onFieldsPrepared'); }, set: function (value) { this._setOption('onFieldsPrepared', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoPivotGridDataSource.prototype, "onLoadError", { get: function () { return this._getOption('onLoadError'); }, set: function (value) { this._setOption('onLoadError', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoPivotGridDataSource.prototype, "onLoadingChanged", { get: function () { return this._getOption('onLoadingChanged'); }, set: function (value) { this._setOption('onLoadingChanged', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoPivotGridDataSource.prototype, "remoteOperations", { get: function () { return this._getOption('remoteOperations'); }, set: function (value) { this._setOption('remoteOperations', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoPivotGridDataSource.prototype, "retrieveFields", { get: function () { return this._getOption('retrieveFields'); }, set: function (value) { this._setOption('retrieveFields', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoPivotGridDataSource.prototype, "store", { get: function () { return this._getOption('store'); }, set: function (value) { this._setOption('store', value); }, enumerable: true, configurable: true }); return DxoPivotGridDataSource; }(nested_option_1.NestedOption)); exports.DxoPivotGridDataSource = DxoPivotGridDataSource; //# sourceMappingURL=pivot-grid-data-source.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/base/popup-options.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var DxoPopupOptions = (function (_super) { __extends(DxoPopupOptions, _super); function DxoPopupOptions() { return _super !== null && _super.apply(this, arguments) || this; } Object.defineProperty(DxoPopupOptions.prototype, "accessKey", { get: function () { return this._getOption('accessKey'); }, set: function (value) { this._setOption('accessKey', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoPopupOptions.prototype, "animation", { get: function () { return this._getOption('animation'); }, set: function (value) { this._setOption('animation', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoPopupOptions.prototype, "buttons", { get: function () { return this._getOption('buttons'); }, set: function (value) { this._setOption('buttons', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoPopupOptions.prototype, "closeOnBackButton", { get: function () { return this._getOption('closeOnBackButton'); }, set: function (value) { this._setOption('closeOnBackButton', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoPopupOptions.prototype, "closeOnOutsideClick", { get: function () { return this._getOption('closeOnOutsideClick'); }, set: function (value) { this._setOption('closeOnOutsideClick', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoPopupOptions.prototype, "contentTemplate", { get: function () { return this._getOption('contentTemplate'); }, set: function (value) { this._setOption('contentTemplate', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoPopupOptions.prototype, "deferRendering", { get: function () { return this._getOption('deferRendering'); }, set: function (value) { this._setOption('deferRendering', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoPopupOptions.prototype, "disabled", { get: function () { return this._getOption('disabled'); }, set: function (value) { this._setOption('disabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoPopupOptions.prototype, "dragEnabled", { get: function () { return this._getOption('dragEnabled'); }, set: function (value) { this._setOption('dragEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoPopupOptions.prototype, "elementAttr", { get: function () { return this._getOption('elementAttr'); }, set: function (value) { this._setOption('elementAttr', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoPopupOptions.prototype, "focusStateEnabled", { get: function () { return this._getOption('focusStateEnabled'); }, set: function (value) { this._setOption('focusStateEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoPopupOptions.prototype, "fullScreen", { get: function () { return this._getOption('fullScreen'); }, set: function (value) { this._setOption('fullScreen', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoPopupOptions.prototype, "height", { get: function () { return this._getOption('height'); }, set: function (value) { this._setOption('height', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoPopupOptions.prototype, "hint", { get: function () { return this._getOption('hint'); }, set: function (value) { this._setOption('hint', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoPopupOptions.prototype, "hoverStateEnabled", { get: function () { return this._getOption('hoverStateEnabled'); }, set: function (value) { this._setOption('hoverStateEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoPopupOptions.prototype, "maxHeight", { get: function () { return this._getOption('maxHeight'); }, set: function (value) { this._setOption('maxHeight', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoPopupOptions.prototype, "maxWidth", { get: function () { return this._getOption('maxWidth'); }, set: function (value) { this._setOption('maxWidth', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoPopupOptions.prototype, "minHeight", { get: function () { return this._getOption('minHeight'); }, set: function (value) { this._setOption('minHeight', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoPopupOptions.prototype, "minWidth", { get: function () { return this._getOption('minWidth'); }, set: function (value) { this._setOption('minWidth', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoPopupOptions.prototype, "onContentReady", { get: function () { return this._getOption('onContentReady'); }, set: function (value) { this._setOption('onContentReady', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoPopupOptions.prototype, "onDisposing", { get: function () { return this._getOption('onDisposing'); }, set: function (value) { this._setOption('onDisposing', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoPopupOptions.prototype, "onHidden", { get: function () { return this._getOption('onHidden'); }, set: function (value) { this._setOption('onHidden', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoPopupOptions.prototype, "onHiding", { get: function () { return this._getOption('onHiding'); }, set: function (value) { this._setOption('onHiding', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoPopupOptions.prototype, "onInitialized", { get: function () { return this._getOption('onInitialized'); }, set: function (value) { this._setOption('onInitialized', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoPopupOptions.prototype, "onOptionChanged", { get: function () { return this._getOption('onOptionChanged'); }, set: function (value) { this._setOption('onOptionChanged', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoPopupOptions.prototype, "onResize", { get: function () { return this._getOption('onResize'); }, set: function (value) { this._setOption('onResize', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoPopupOptions.prototype, "onResizeEnd", { get: function () { return this._getOption('onResizeEnd'); }, set: function (value) { this._setOption('onResizeEnd', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoPopupOptions.prototype, "onResizeStart", { get: function () { return this._getOption('onResizeStart'); }, set: function (value) { this._setOption('onResizeStart', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoPopupOptions.prototype, "onShowing", { get: function () { return this._getOption('onShowing'); }, set: function (value) { this._setOption('onShowing', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoPopupOptions.prototype, "onShown", { get: function () { return this._getOption('onShown'); }, set: function (value) { this._setOption('onShown', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoPopupOptions.prototype, "onTitleRendered", { get: function () { return this._getOption('onTitleRendered'); }, set: function (value) { this._setOption('onTitleRendered', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoPopupOptions.prototype, "position", { get: function () { return this._getOption('position'); }, set: function (value) { this._setOption('position', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoPopupOptions.prototype, "resizeEnabled", { get: function () { return this._getOption('resizeEnabled'); }, set: function (value) { this._setOption('resizeEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoPopupOptions.prototype, "rtlEnabled", { get: function () { return this._getOption('rtlEnabled'); }, set: function (value) { this._setOption('rtlEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoPopupOptions.prototype, "shading", { get: function () { return this._getOption('shading'); }, set: function (value) { this._setOption('shading', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoPopupOptions.prototype, "shadingColor", { get: function () { return this._getOption('shadingColor'); }, set: function (value) { this._setOption('shadingColor', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoPopupOptions.prototype, "showCloseButton", { get: function () { return this._getOption('showCloseButton'); }, set: function (value) { this._setOption('showCloseButton', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoPopupOptions.prototype, "showTitle", { get: function () { return this._getOption('showTitle'); }, set: function (value) { this._setOption('showTitle', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoPopupOptions.prototype, "tabIndex", { get: function () { return this._getOption('tabIndex'); }, set: function (value) { this._setOption('tabIndex', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoPopupOptions.prototype, "title", { get: function () { return this._getOption('title'); }, set: function (value) { this._setOption('title', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoPopupOptions.prototype, "titleTemplate", { get: function () { return this._getOption('titleTemplate'); }, set: function (value) { this._setOption('titleTemplate', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoPopupOptions.prototype, "toolbarItems", { get: function () { return this._getOption('toolbarItems'); }, set: function (value) { this._setOption('toolbarItems', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoPopupOptions.prototype, "visible", { get: function () { return this._getOption('visible'); }, set: function (value) { this._setOption('visible', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoPopupOptions.prototype, "width", { get: function () { return this._getOption('width'); }, set: function (value) { this._setOption('width', value); }, enumerable: true, configurable: true }); return DxoPopupOptions; }(nested_option_1.NestedOption)); exports.DxoPopupOptions = DxoPopupOptions; //# sourceMappingURL=popup-options.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/base/position-config.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var DxoPositionConfig = (function (_super) { __extends(DxoPositionConfig, _super); function DxoPositionConfig() { return _super !== null && _super.apply(this, arguments) || this; } Object.defineProperty(DxoPositionConfig.prototype, "at", { get: function () { return this._getOption('at'); }, set: function (value) { this._setOption('at', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoPositionConfig.prototype, "boundary", { get: function () { return this._getOption('boundary'); }, set: function (value) { this._setOption('boundary', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoPositionConfig.prototype, "boundaryOffset", { get: function () { return this._getOption('boundaryOffset'); }, set: function (value) { this._setOption('boundaryOffset', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoPositionConfig.prototype, "collision", { get: function () { return this._getOption('collision'); }, set: function (value) { this._setOption('collision', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoPositionConfig.prototype, "my", { get: function () { return this._getOption('my'); }, set: function (value) { this._setOption('my', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoPositionConfig.prototype, "of", { get: function () { return this._getOption('of'); }, set: function (value) { this._setOption('of', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoPositionConfig.prototype, "offset", { get: function () { return this._getOption('offset'); }, set: function (value) { this._setOption('offset', value); }, enumerable: true, configurable: true }); return DxoPositionConfig; }(nested_option_1.NestedOption)); exports.DxoPositionConfig = DxoPositionConfig; //# sourceMappingURL=position-config.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/base/tab-panel-options.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var DxoTabPanelOptions = (function (_super) { __extends(DxoTabPanelOptions, _super); function DxoTabPanelOptions() { return _super !== null && _super.apply(this, arguments) || this; } Object.defineProperty(DxoTabPanelOptions.prototype, "accessKey", { get: function () { return this._getOption('accessKey'); }, set: function (value) { this._setOption('accessKey', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoTabPanelOptions.prototype, "activeStateEnabled", { get: function () { return this._getOption('activeStateEnabled'); }, set: function (value) { this._setOption('activeStateEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoTabPanelOptions.prototype, "animationEnabled", { get: function () { return this._getOption('animationEnabled'); }, set: function (value) { this._setOption('animationEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoTabPanelOptions.prototype, "dataSource", { get: function () { return this._getOption('dataSource'); }, set: function (value) { this._setOption('dataSource', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoTabPanelOptions.prototype, "deferRendering", { get: function () { return this._getOption('deferRendering'); }, set: function (value) { this._setOption('deferRendering', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoTabPanelOptions.prototype, "disabled", { get: function () { return this._getOption('disabled'); }, set: function (value) { this._setOption('disabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoTabPanelOptions.prototype, "elementAttr", { get: function () { return this._getOption('elementAttr'); }, set: function (value) { this._setOption('elementAttr', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoTabPanelOptions.prototype, "focusStateEnabled", { get: function () { return this._getOption('focusStateEnabled'); }, set: function (value) { this._setOption('focusStateEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoTabPanelOptions.prototype, "height", { get: function () { return this._getOption('height'); }, set: function (value) { this._setOption('height', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoTabPanelOptions.prototype, "hint", { get: function () { return this._getOption('hint'); }, set: function (value) { this._setOption('hint', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoTabPanelOptions.prototype, "hoverStateEnabled", { get: function () { return this._getOption('hoverStateEnabled'); }, set: function (value) { this._setOption('hoverStateEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoTabPanelOptions.prototype, "itemHoldTimeout", { get: function () { return this._getOption('itemHoldTimeout'); }, set: function (value) { this._setOption('itemHoldTimeout', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoTabPanelOptions.prototype, "items", { get: function () { return this._getOption('items'); }, set: function (value) { this._setOption('items', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoTabPanelOptions.prototype, "itemTemplate", { get: function () { return this._getOption('itemTemplate'); }, set: function (value) { this._setOption('itemTemplate', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoTabPanelOptions.prototype, "itemTitleTemplate", { get: function () { return this._getOption('itemTitleTemplate'); }, set: function (value) { this._setOption('itemTitleTemplate', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoTabPanelOptions.prototype, "loop", { get: function () { return this._getOption('loop'); }, set: function (value) { this._setOption('loop', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoTabPanelOptions.prototype, "noDataText", { get: function () { return this._getOption('noDataText'); }, set: function (value) { this._setOption('noDataText', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoTabPanelOptions.prototype, "onContentReady", { get: function () { return this._getOption('onContentReady'); }, set: function (value) { this._setOption('onContentReady', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoTabPanelOptions.prototype, "onDisposing", { get: function () { return this._getOption('onDisposing'); }, set: function (value) { this._setOption('onDisposing', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoTabPanelOptions.prototype, "onInitialized", { get: function () { return this._getOption('onInitialized'); }, set: function (value) { this._setOption('onInitialized', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoTabPanelOptions.prototype, "onItemClick", { get: function () { return this._getOption('onItemClick'); }, set: function (value) { this._setOption('onItemClick', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoTabPanelOptions.prototype, "onItemContextMenu", { get: function () { return this._getOption('onItemContextMenu'); }, set: function (value) { this._setOption('onItemContextMenu', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoTabPanelOptions.prototype, "onItemHold", { get: function () { return this._getOption('onItemHold'); }, set: function (value) { this._setOption('onItemHold', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoTabPanelOptions.prototype, "onItemRendered", { get: function () { return this._getOption('onItemRendered'); }, set: function (value) { this._setOption('onItemRendered', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoTabPanelOptions.prototype, "onOptionChanged", { get: function () { return this._getOption('onOptionChanged'); }, set: function (value) { this._setOption('onOptionChanged', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoTabPanelOptions.prototype, "onSelectionChanged", { get: function () { return this._getOption('onSelectionChanged'); }, set: function (value) { this._setOption('onSelectionChanged', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoTabPanelOptions.prototype, "onTitleClick", { get: function () { return this._getOption('onTitleClick'); }, set: function (value) { this._setOption('onTitleClick', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoTabPanelOptions.prototype, "onTitleHold", { get: function () { return this._getOption('onTitleHold'); }, set: function (value) { this._setOption('onTitleHold', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoTabPanelOptions.prototype, "onTitleRendered", { get: function () { return this._getOption('onTitleRendered'); }, set: function (value) { this._setOption('onTitleRendered', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoTabPanelOptions.prototype, "rtlEnabled", { get: function () { return this._getOption('rtlEnabled'); }, set: function (value) { this._setOption('rtlEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoTabPanelOptions.prototype, "scrollByContent", { get: function () { return this._getOption('scrollByContent'); }, set: function (value) { this._setOption('scrollByContent', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoTabPanelOptions.prototype, "scrollingEnabled", { get: function () { return this._getOption('scrollingEnabled'); }, set: function (value) { this._setOption('scrollingEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoTabPanelOptions.prototype, "selectedIndex", { get: function () { return this._getOption('selectedIndex'); }, set: function (value) { this._setOption('selectedIndex', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoTabPanelOptions.prototype, "selectedItem", { get: function () { return this._getOption('selectedItem'); }, set: function (value) { this._setOption('selectedItem', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoTabPanelOptions.prototype, "showNavButtons", { get: function () { return this._getOption('showNavButtons'); }, set: function (value) { this._setOption('showNavButtons', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoTabPanelOptions.prototype, "swipeEnabled", { get: function () { return this._getOption('swipeEnabled'); }, set: function (value) { this._setOption('swipeEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoTabPanelOptions.prototype, "tabIndex", { get: function () { return this._getOption('tabIndex'); }, set: function (value) { this._setOption('tabIndex', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoTabPanelOptions.prototype, "visible", { get: function () { return this._getOption('visible'); }, set: function (value) { this._setOption('visible', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoTabPanelOptions.prototype, "width", { get: function () { return this._getOption('width'); }, set: function (value) { this._setOption('width', value); }, enumerable: true, configurable: true }); return DxoTabPanelOptions; }(nested_option_1.NestedOption)); exports.DxoTabPanelOptions = DxoTabPanelOptions; //# sourceMappingURL=tab-panel-options.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/base/text-box-options.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var DxoTextBoxOptions = (function (_super) { __extends(DxoTextBoxOptions, _super); function DxoTextBoxOptions() { return _super !== null && _super.apply(this, arguments) || this; } Object.defineProperty(DxoTextBoxOptions.prototype, "accessKey", { get: function () { return this._getOption('accessKey'); }, set: function (value) { this._setOption('accessKey', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoTextBoxOptions.prototype, "activeStateEnabled", { get: function () { return this._getOption('activeStateEnabled'); }, set: function (value) { this._setOption('activeStateEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoTextBoxOptions.prototype, "attr", { get: function () { return this._getOption('attr'); }, set: function (value) { this._setOption('attr', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoTextBoxOptions.prototype, "disabled", { get: function () { return this._getOption('disabled'); }, set: function (value) { this._setOption('disabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoTextBoxOptions.prototype, "elementAttr", { get: function () { return this._getOption('elementAttr'); }, set: function (value) { this._setOption('elementAttr', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoTextBoxOptions.prototype, "focusStateEnabled", { get: function () { return this._getOption('focusStateEnabled'); }, set: function (value) { this._setOption('focusStateEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoTextBoxOptions.prototype, "height", { get: function () { return this._getOption('height'); }, set: function (value) { this._setOption('height', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoTextBoxOptions.prototype, "hint", { get: function () { return this._getOption('hint'); }, set: function (value) { this._setOption('hint', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoTextBoxOptions.prototype, "hoverStateEnabled", { get: function () { return this._getOption('hoverStateEnabled'); }, set: function (value) { this._setOption('hoverStateEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoTextBoxOptions.prototype, "inputAttr", { get: function () { return this._getOption('inputAttr'); }, set: function (value) { this._setOption('inputAttr', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoTextBoxOptions.prototype, "isValid", { get: function () { return this._getOption('isValid'); }, set: function (value) { this._setOption('isValid', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoTextBoxOptions.prototype, "mask", { get: function () { return this._getOption('mask'); }, set: function (value) { this._setOption('mask', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoTextBoxOptions.prototype, "maskChar", { get: function () { return this._getOption('maskChar'); }, set: function (value) { this._setOption('maskChar', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoTextBoxOptions.prototype, "maskInvalidMessage", { get: function () { return this._getOption('maskInvalidMessage'); }, set: function (value) { this._setOption('maskInvalidMessage', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoTextBoxOptions.prototype, "maskRules", { get: function () { return this._getOption('maskRules'); }, set: function (value) { this._setOption('maskRules', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoTextBoxOptions.prototype, "maxLength", { get: function () { return this._getOption('maxLength'); }, set: function (value) { this._setOption('maxLength', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoTextBoxOptions.prototype, "mode", { get: function () { return this._getOption('mode'); }, set: function (value) { this._setOption('mode', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoTextBoxOptions.prototype, "name", { get: function () { return this._getOption('name'); }, set: function (value) { this._setOption('name', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoTextBoxOptions.prototype, "onChange", { get: function () { return this._getOption('onChange'); }, set: function (value) { this._setOption('onChange', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoTextBoxOptions.prototype, "onContentReady", { get: function () { return this._getOption('onContentReady'); }, set: function (value) { this._setOption('onContentReady', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoTextBoxOptions.prototype, "onCopy", { get: function () { return this._getOption('onCopy'); }, set: function (value) { this._setOption('onCopy', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoTextBoxOptions.prototype, "onCut", { get: function () { return this._getOption('onCut'); }, set: function (value) { this._setOption('onCut', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoTextBoxOptions.prototype, "onDisposing", { get: function () { return this._getOption('onDisposing'); }, set: function (value) { this._setOption('onDisposing', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoTextBoxOptions.prototype, "onEnterKey", { get: function () { return this._getOption('onEnterKey'); }, set: function (value) { this._setOption('onEnterKey', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoTextBoxOptions.prototype, "onFocusIn", { get: function () { return this._getOption('onFocusIn'); }, set: function (value) { this._setOption('onFocusIn', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoTextBoxOptions.prototype, "onFocusOut", { get: function () { return this._getOption('onFocusOut'); }, set: function (value) { this._setOption('onFocusOut', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoTextBoxOptions.prototype, "onInitialized", { get: function () { return this._getOption('onInitialized'); }, set: function (value) { this._setOption('onInitialized', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoTextBoxOptions.prototype, "onInput", { get: function () { return this._getOption('onInput'); }, set: function (value) { this._setOption('onInput', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoTextBoxOptions.prototype, "onKeyDown", { get: function () { return this._getOption('onKeyDown'); }, set: function (value) { this._setOption('onKeyDown', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoTextBoxOptions.prototype, "onKeyPress", { get: function () { return this._getOption('onKeyPress'); }, set: function (value) { this._setOption('onKeyPress', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoTextBoxOptions.prototype, "onKeyUp", { get: function () { return this._getOption('onKeyUp'); }, set: function (value) { this._setOption('onKeyUp', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoTextBoxOptions.prototype, "onOptionChanged", { get: function () { return this._getOption('onOptionChanged'); }, set: function (value) { this._setOption('onOptionChanged', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoTextBoxOptions.prototype, "onPaste", { get: function () { return this._getOption('onPaste'); }, set: function (value) { this._setOption('onPaste', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoTextBoxOptions.prototype, "onValueChanged", { get: function () { return this._getOption('onValueChanged'); }, set: function (value) { this._setOption('onValueChanged', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoTextBoxOptions.prototype, "placeholder", { get: function () { return this._getOption('placeholder'); }, set: function (value) { this._setOption('placeholder', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoTextBoxOptions.prototype, "readOnly", { get: function () { return this._getOption('readOnly'); }, set: function (value) { this._setOption('readOnly', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoTextBoxOptions.prototype, "rtlEnabled", { get: function () { return this._getOption('rtlEnabled'); }, set: function (value) { this._setOption('rtlEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoTextBoxOptions.prototype, "showClearButton", { get: function () { return this._getOption('showClearButton'); }, set: function (value) { this._setOption('showClearButton', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoTextBoxOptions.prototype, "showMaskMode", { get: function () { return this._getOption('showMaskMode'); }, set: function (value) { this._setOption('showMaskMode', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoTextBoxOptions.prototype, "spellcheck", { get: function () { return this._getOption('spellcheck'); }, set: function (value) { this._setOption('spellcheck', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoTextBoxOptions.prototype, "tabIndex", { get: function () { return this._getOption('tabIndex'); }, set: function (value) { this._setOption('tabIndex', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoTextBoxOptions.prototype, "text", { get: function () { return this._getOption('text'); }, set: function (value) { this._setOption('text', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoTextBoxOptions.prototype, "useMaskedValue", { get: function () { return this._getOption('useMaskedValue'); }, set: function (value) { this._setOption('useMaskedValue', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoTextBoxOptions.prototype, "validationError", { get: function () { return this._getOption('validationError'); }, set: function (value) { this._setOption('validationError', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoTextBoxOptions.prototype, "validationMessageMode", { get: function () { return this._getOption('validationMessageMode'); }, set: function (value) { this._setOption('validationMessageMode', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoTextBoxOptions.prototype, "value", { get: function () { return this._getOption('value'); }, set: function (value) { this._setOption('value', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoTextBoxOptions.prototype, "valueChangeEvent", { get: function () { return this._getOption('valueChangeEvent'); }, set: function (value) { this._setOption('valueChangeEvent', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoTextBoxOptions.prototype, "visible", { get: function () { return this._getOption('visible'); }, set: function (value) { this._setOption('visible', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoTextBoxOptions.prototype, "width", { get: function () { return this._getOption('width'); }, set: function (value) { this._setOption('width', value); }, enumerable: true, configurable: true }); return DxoTextBoxOptions; }(nested_option_1.NestedOption)); exports.DxoTextBoxOptions = DxoTextBoxOptions; //# sourceMappingURL=text-box-options.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/base/viz-font.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var DxoVizFont = (function (_super) { __extends(DxoVizFont, _super); function DxoVizFont() { return _super !== null && _super.apply(this, arguments) || this; } Object.defineProperty(DxoVizFont.prototype, "color", { get: function () { return this._getOption('color'); }, set: function (value) { this._setOption('color', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoVizFont.prototype, "family", { get: function () { return this._getOption('family'); }, set: function (value) { this._setOption('family', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoVizFont.prototype, "opacity", { get: function () { return this._getOption('opacity'); }, set: function (value) { this._setOption('opacity', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoVizFont.prototype, "size", { get: function () { return this._getOption('size'); }, set: function (value) { this._setOption('size', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoVizFont.prototype, "weight", { get: function () { return this._getOption('weight'); }, set: function (value) { this._setOption('weight', value); }, enumerable: true, configurable: true }); return DxoVizFont; }(nested_option_1.NestedOption)); exports.DxoVizFont = DxoVizFont; //# sourceMappingURL=viz-font.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/behavior.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var nested_option_2 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var DxoBehaviorComponent = (function (_super) { __extends(DxoBehaviorComponent, _super); function DxoBehaviorComponent(parentOptionHost, optionHost) { var _this = _super.call(this) || this; parentOptionHost.setNestedOption(_this); optionHost.setHost(_this, _this._fullOptionPath.bind(_this)); return _this; } Object.defineProperty(DxoBehaviorComponent.prototype, "allowSlidersSwap", { get: function () { return this._getOption('allowSlidersSwap'); }, set: function (value) { this._setOption('allowSlidersSwap', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoBehaviorComponent.prototype, "animationEnabled", { get: function () { return this._getOption('animationEnabled'); }, set: function (value) { this._setOption('animationEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoBehaviorComponent.prototype, "callSelectedRangeChanged", { get: function () { return this._getOption('callSelectedRangeChanged'); }, set: function (value) { this._setOption('callSelectedRangeChanged', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoBehaviorComponent.prototype, "callValueChanged", { get: function () { return this._getOption('callValueChanged'); }, set: function (value) { this._setOption('callValueChanged', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoBehaviorComponent.prototype, "manualRangeSelectionEnabled", { get: function () { return this._getOption('manualRangeSelectionEnabled'); }, set: function (value) { this._setOption('manualRangeSelectionEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoBehaviorComponent.prototype, "moveSelectedRangeByClick", { get: function () { return this._getOption('moveSelectedRangeByClick'); }, set: function (value) { this._setOption('moveSelectedRangeByClick', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoBehaviorComponent.prototype, "snapToTicks", { get: function () { return this._getOption('snapToTicks'); }, set: function (value) { this._setOption('snapToTicks', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoBehaviorComponent.prototype, "_optionPath", { get: function () { return 'behavior'; }, enumerable: true, configurable: true }); DxoBehaviorComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dxo-behavior', template: '', styles: [''], providers: [nested_option_1.NestedOptionHost] },] }, ]; /** @nocollapse */ DxoBehaviorComponent.ctorParameters = function () { return [ { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.SkipSelf }, { type: core_1.Host },] }, { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.Host },] }, ]; }; DxoBehaviorComponent.propDecorators = { 'allowSlidersSwap': [{ type: core_1.Input },], 'animationEnabled': [{ type: core_1.Input },], 'callSelectedRangeChanged': [{ type: core_1.Input },], 'callValueChanged': [{ type: core_1.Input },], 'manualRangeSelectionEnabled': [{ type: core_1.Input },], 'moveSelectedRangeByClick': [{ type: core_1.Input },], 'snapToTicks': [{ type: core_1.Input },], }; return DxoBehaviorComponent; }(nested_option_2.NestedOption)); exports.DxoBehaviorComponent = DxoBehaviorComponent; var DxoBehaviorModule = (function () { function DxoBehaviorModule() { } DxoBehaviorModule.decorators = [ { type: core_1.NgModule, args: [{ declarations: [ DxoBehaviorComponent ], exports: [ DxoBehaviorComponent ], },] }, ]; /** @nocollapse */ DxoBehaviorModule.ctorParameters = function () { return []; }; return DxoBehaviorModule; }()); exports.DxoBehaviorModule = DxoBehaviorModule; //# sourceMappingURL=behavior.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/border.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var nested_option_2 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var DxoBorderComponent = (function (_super) { __extends(DxoBorderComponent, _super); function DxoBorderComponent(parentOptionHost, optionHost) { var _this = _super.call(this) || this; parentOptionHost.setNestedOption(_this); optionHost.setHost(_this, _this._fullOptionPath.bind(_this)); return _this; } Object.defineProperty(DxoBorderComponent.prototype, "color", { get: function () { return this._getOption('color'); }, set: function (value) { this._setOption('color', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoBorderComponent.prototype, "dashStyle", { get: function () { return this._getOption('dashStyle'); }, set: function (value) { this._setOption('dashStyle', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoBorderComponent.prototype, "opacity", { get: function () { return this._getOption('opacity'); }, set: function (value) { this._setOption('opacity', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoBorderComponent.prototype, "visible", { get: function () { return this._getOption('visible'); }, set: function (value) { this._setOption('visible', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoBorderComponent.prototype, "width", { get: function () { return this._getOption('width'); }, set: function (value) { this._setOption('width', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoBorderComponent.prototype, "bottom", { get: function () { return this._getOption('bottom'); }, set: function (value) { this._setOption('bottom', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoBorderComponent.prototype, "left", { get: function () { return this._getOption('left'); }, set: function (value) { this._setOption('left', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoBorderComponent.prototype, "right", { get: function () { return this._getOption('right'); }, set: function (value) { this._setOption('right', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoBorderComponent.prototype, "top", { get: function () { return this._getOption('top'); }, set: function (value) { this._setOption('top', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoBorderComponent.prototype, "cornerRadius", { get: function () { return this._getOption('cornerRadius'); }, set: function (value) { this._setOption('cornerRadius', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoBorderComponent.prototype, "_optionPath", { get: function () { return 'border'; }, enumerable: true, configurable: true }); DxoBorderComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dxo-border', template: '', styles: [''], providers: [nested_option_1.NestedOptionHost] },] }, ]; /** @nocollapse */ DxoBorderComponent.ctorParameters = function () { return [ { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.SkipSelf }, { type: core_1.Host },] }, { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.Host },] }, ]; }; DxoBorderComponent.propDecorators = { 'color': [{ type: core_1.Input },], 'dashStyle': [{ type: core_1.Input },], 'opacity': [{ type: core_1.Input },], 'visible': [{ type: core_1.Input },], 'width': [{ type: core_1.Input },], 'bottom': [{ type: core_1.Input },], 'left': [{ type: core_1.Input },], 'right': [{ type: core_1.Input },], 'top': [{ type: core_1.Input },], 'cornerRadius': [{ type: core_1.Input },], }; return DxoBorderComponent; }(nested_option_2.NestedOption)); exports.DxoBorderComponent = DxoBorderComponent; var DxoBorderModule = (function () { function DxoBorderModule() { } DxoBorderModule.decorators = [ { type: core_1.NgModule, args: [{ declarations: [ DxoBorderComponent ], exports: [ DxoBorderComponent ], },] }, ]; /** @nocollapse */ DxoBorderModule.ctorParameters = function () { return []; }; return DxoBorderModule; }()); exports.DxoBorderModule = DxoBorderModule; //# sourceMappingURL=border.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/boundary-offset.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var nested_option_2 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var DxoBoundaryOffsetComponent = (function (_super) { __extends(DxoBoundaryOffsetComponent, _super); function DxoBoundaryOffsetComponent(parentOptionHost, optionHost) { var _this = _super.call(this) || this; parentOptionHost.setNestedOption(_this); optionHost.setHost(_this, _this._fullOptionPath.bind(_this)); return _this; } Object.defineProperty(DxoBoundaryOffsetComponent.prototype, "x", { get: function () { return this._getOption('x'); }, set: function (value) { this._setOption('x', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoBoundaryOffsetComponent.prototype, "y", { get: function () { return this._getOption('y'); }, set: function (value) { this._setOption('y', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoBoundaryOffsetComponent.prototype, "_optionPath", { get: function () { return 'boundaryOffset'; }, enumerable: true, configurable: true }); DxoBoundaryOffsetComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dxo-boundary-offset', template: '', styles: [''], providers: [nested_option_1.NestedOptionHost] },] }, ]; /** @nocollapse */ DxoBoundaryOffsetComponent.ctorParameters = function () { return [ { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.SkipSelf }, { type: core_1.Host },] }, { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.Host },] }, ]; }; DxoBoundaryOffsetComponent.propDecorators = { 'x': [{ type: core_1.Input },], 'y': [{ type: core_1.Input },], }; return DxoBoundaryOffsetComponent; }(nested_option_2.NestedOption)); exports.DxoBoundaryOffsetComponent = DxoBoundaryOffsetComponent; var DxoBoundaryOffsetModule = (function () { function DxoBoundaryOffsetModule() { } DxoBoundaryOffsetModule.decorators = [ { type: core_1.NgModule, args: [{ declarations: [ DxoBoundaryOffsetComponent ], exports: [ DxoBoundaryOffsetComponent ], },] }, ]; /** @nocollapse */ DxoBoundaryOffsetModule.ctorParameters = function () { return []; }; return DxoBoundaryOffsetModule; }()); exports.DxoBoundaryOffsetModule = DxoBoundaryOffsetModule; //# sourceMappingURL=boundary-offset.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/box.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); /* tslint:disable:use-input-property-decorator */ var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var box_options_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/base/box-options.js"); var item_dxi_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/item-dxi.js"); var DxoBoxComponent = (function (_super) { __extends(DxoBoxComponent, _super); function DxoBoxComponent(parentOptionHost, optionHost) { var _this = _super.call(this) || this; parentOptionHost.setNestedOption(_this); optionHost.setHost(_this, _this._fullOptionPath.bind(_this)); return _this; } Object.defineProperty(DxoBoxComponent.prototype, "_optionPath", { get: function () { return 'box'; }, enumerable: true, configurable: true }); Object.defineProperty(DxoBoxComponent.prototype, "itemsChildren", { get: function () { return this._getOption('items'); }, set: function (value) { this.setChildren('items', value); }, enumerable: true, configurable: true }); DxoBoxComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dxo-box', template: '', styles: [''], providers: [nested_option_1.NestedOptionHost], inputs: [ 'align', 'crossAlign', 'dataSource', 'direction', 'disabled', 'elementAttr', 'height', 'hoverStateEnabled', 'itemHoldTimeout', 'items', 'itemTemplate', 'onContentReady', 'onDisposing', 'onInitialized', 'onItemClick', 'onItemContextMenu', 'onItemHold', 'onItemRendered', 'onOptionChanged', 'rtlEnabled', 'visible', 'width' ] },] }, ]; /** @nocollapse */ DxoBoxComponent.ctorParameters = function () { return [ { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.SkipSelf }, { type: core_1.Host },] }, { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.Host },] }, ]; }; DxoBoxComponent.propDecorators = { 'itemsChildren': [{ type: core_1.ContentChildren, args: [core_1.forwardRef(function () { return item_dxi_1.DxiItemComponent; }),] },], }; return DxoBoxComponent; }(box_options_1.DxoBoxOptions)); exports.DxoBoxComponent = DxoBoxComponent; var DxoBoxModule = (function () { function DxoBoxModule() { } DxoBoxModule.decorators = [ { type: core_1.NgModule, args: [{ declarations: [ DxoBoxComponent ], exports: [ DxoBoxComponent ], },] }, ]; /** @nocollapse */ DxoBoxModule.ctorParameters = function () { return []; }; return DxoBoxModule; }()); exports.DxoBoxModule = DxoBoxModule; //# sourceMappingURL=box.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/break-dxi.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var nested_option_2 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var DxiBreakComponent = (function (_super) { __extends(DxiBreakComponent, _super); function DxiBreakComponent(parentOptionHost, optionHost) { var _this = _super.call(this) || this; parentOptionHost.setNestedOption(_this); optionHost.setHost(_this, _this._fullOptionPath.bind(_this)); return _this; } Object.defineProperty(DxiBreakComponent.prototype, "endValue", { get: function () { return this._getOption('endValue'); }, set: function (value) { this._setOption('endValue', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiBreakComponent.prototype, "startValue", { get: function () { return this._getOption('startValue'); }, set: function (value) { this._setOption('startValue', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiBreakComponent.prototype, "_optionPath", { get: function () { return 'breaks'; }, enumerable: true, configurable: true }); DxiBreakComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dxi-break', template: '', styles: [''], providers: [nested_option_1.NestedOptionHost] },] }, ]; /** @nocollapse */ DxiBreakComponent.ctorParameters = function () { return [ { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.SkipSelf }, { type: core_1.Host },] }, { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.Host },] }, ]; }; DxiBreakComponent.propDecorators = { 'endValue': [{ type: core_1.Input },], 'startValue': [{ type: core_1.Input },], }; return DxiBreakComponent; }(nested_option_2.CollectionNestedOption)); exports.DxiBreakComponent = DxiBreakComponent; var DxiBreakModule = (function () { function DxiBreakModule() { } DxiBreakModule.decorators = [ { type: core_1.NgModule, args: [{ declarations: [ DxiBreakComponent ], exports: [ DxiBreakComponent ], },] }, ]; /** @nocollapse */ DxiBreakModule.ctorParameters = function () { return []; }; return DxiBreakModule; }()); exports.DxiBreakModule = DxiBreakModule; //# sourceMappingURL=break-dxi.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/break-style.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var nested_option_2 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var DxoBreakStyleComponent = (function (_super) { __extends(DxoBreakStyleComponent, _super); function DxoBreakStyleComponent(parentOptionHost, optionHost) { var _this = _super.call(this) || this; parentOptionHost.setNestedOption(_this); optionHost.setHost(_this, _this._fullOptionPath.bind(_this)); return _this; } Object.defineProperty(DxoBreakStyleComponent.prototype, "color", { get: function () { return this._getOption('color'); }, set: function (value) { this._setOption('color', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoBreakStyleComponent.prototype, "line", { get: function () { return this._getOption('line'); }, set: function (value) { this._setOption('line', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoBreakStyleComponent.prototype, "width", { get: function () { return this._getOption('width'); }, set: function (value) { this._setOption('width', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoBreakStyleComponent.prototype, "_optionPath", { get: function () { return 'breakStyle'; }, enumerable: true, configurable: true }); DxoBreakStyleComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dxo-break-style', template: '', styles: [''], providers: [nested_option_1.NestedOptionHost] },] }, ]; /** @nocollapse */ DxoBreakStyleComponent.ctorParameters = function () { return [ { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.SkipSelf }, { type: core_1.Host },] }, { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.Host },] }, ]; }; DxoBreakStyleComponent.propDecorators = { 'color': [{ type: core_1.Input },], 'line': [{ type: core_1.Input },], 'width': [{ type: core_1.Input },], }; return DxoBreakStyleComponent; }(nested_option_2.NestedOption)); exports.DxoBreakStyleComponent = DxoBreakStyleComponent; var DxoBreakStyleModule = (function () { function DxoBreakStyleModule() { } DxoBreakStyleModule.decorators = [ { type: core_1.NgModule, args: [{ declarations: [ DxoBreakStyleComponent ], exports: [ DxoBreakStyleComponent ], },] }, ]; /** @nocollapse */ DxoBreakStyleModule.ctorParameters = function () { return []; }; return DxoBreakStyleModule; }()); exports.DxoBreakStyleModule = DxoBreakStyleModule; //# sourceMappingURL=break-style.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/bubble.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); /* tslint:disable:use-input-property-decorator */ var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var chart_common_series_settings_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/base/chart-common-series-settings.js"); var DxoBubbleComponent = (function (_super) { __extends(DxoBubbleComponent, _super); function DxoBubbleComponent(parentOptionHost, optionHost) { var _this = _super.call(this) || this; parentOptionHost.setNestedOption(_this); optionHost.setHost(_this, _this._fullOptionPath.bind(_this)); return _this; } Object.defineProperty(DxoBubbleComponent.prototype, "_optionPath", { get: function () { return 'bubble'; }, enumerable: true, configurable: true }); DxoBubbleComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dxo-bubble', template: '', styles: [''], providers: [nested_option_1.NestedOptionHost], inputs: [ 'area', 'argumentField', 'axis', 'bar', 'border', 'bubble', 'candlestick', 'closeValueField', 'color', 'cornerRadius', 'dashStyle', 'fullstackedarea', 'fullstackedbar', 'fullstackedline', 'fullstackedspline', 'fullstackedsplinearea', 'highValueField', 'hoverMode', 'hoverStyle', 'ignoreEmptyPoints', 'innerColor', 'label', 'line', 'lowValueField', 'maxLabelCount', 'minBarSize', 'opacity', 'openValueField', 'pane', 'point', 'rangearea', 'rangebar', 'rangeValue1Field', 'rangeValue2Field', 'reduction', 'scatter', 'selectionMode', 'selectionStyle', 'showInLegend', 'sizeField', 'spline', 'splinearea', 'stack', 'stackedarea', 'stackedbar', 'stackedline', 'stackedspline', 'stackedsplinearea', 'steparea', 'stepline', 'stock', 'tagField', 'type', 'valueErrorBar', 'valueField', 'visible', 'width' ] },] }, ]; /** @nocollapse */ DxoBubbleComponent.ctorParameters = function () { return [ { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.SkipSelf }, { type: core_1.Host },] }, { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.Host },] }, ]; }; return DxoBubbleComponent; }(chart_common_series_settings_1.DxoChartCommonSeriesSettings)); exports.DxoBubbleComponent = DxoBubbleComponent; var DxoBubbleModule = (function () { function DxoBubbleModule() { } DxoBubbleModule.decorators = [ { type: core_1.NgModule, args: [{ declarations: [ DxoBubbleComponent ], exports: [ DxoBubbleComponent ], },] }, ]; /** @nocollapse */ DxoBubbleModule.ctorParameters = function () { return []; }; return DxoBubbleModule; }()); exports.DxoBubbleModule = DxoBubbleModule; //# sourceMappingURL=bubble.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/candlestick.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); /* tslint:disable:use-input-property-decorator */ var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var chart_common_series_settings_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/base/chart-common-series-settings.js"); var DxoCandlestickComponent = (function (_super) { __extends(DxoCandlestickComponent, _super); function DxoCandlestickComponent(parentOptionHost, optionHost) { var _this = _super.call(this) || this; parentOptionHost.setNestedOption(_this); optionHost.setHost(_this, _this._fullOptionPath.bind(_this)); return _this; } Object.defineProperty(DxoCandlestickComponent.prototype, "_optionPath", { get: function () { return 'candlestick'; }, enumerable: true, configurable: true }); DxoCandlestickComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dxo-candlestick', template: '', styles: [''], providers: [nested_option_1.NestedOptionHost], inputs: [ 'area', 'argumentField', 'axis', 'bar', 'border', 'bubble', 'candlestick', 'closeValueField', 'color', 'cornerRadius', 'dashStyle', 'fullstackedarea', 'fullstackedbar', 'fullstackedline', 'fullstackedspline', 'fullstackedsplinearea', 'highValueField', 'hoverMode', 'hoverStyle', 'ignoreEmptyPoints', 'innerColor', 'label', 'line', 'lowValueField', 'maxLabelCount', 'minBarSize', 'opacity', 'openValueField', 'pane', 'point', 'rangearea', 'rangebar', 'rangeValue1Field', 'rangeValue2Field', 'reduction', 'scatter', 'selectionMode', 'selectionStyle', 'showInLegend', 'sizeField', 'spline', 'splinearea', 'stack', 'stackedarea', 'stackedbar', 'stackedline', 'stackedspline', 'stackedsplinearea', 'steparea', 'stepline', 'stock', 'tagField', 'type', 'valueErrorBar', 'valueField', 'visible', 'width' ] },] }, ]; /** @nocollapse */ DxoCandlestickComponent.ctorParameters = function () { return [ { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.SkipSelf }, { type: core_1.Host },] }, { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.Host },] }, ]; }; return DxoCandlestickComponent; }(chart_common_series_settings_1.DxoChartCommonSeriesSettings)); exports.DxoCandlestickComponent = DxoCandlestickComponent; var DxoCandlestickModule = (function () { function DxoCandlestickModule() { } DxoCandlestickModule.decorators = [ { type: core_1.NgModule, args: [{ declarations: [ DxoCandlestickComponent ], exports: [ DxoCandlestickComponent ], },] }, ]; /** @nocollapse */ DxoCandlestickModule.ctorParameters = function () { return []; }; return DxoCandlestickModule; }()); exports.DxoCandlestickModule = DxoCandlestickModule; //# sourceMappingURL=candlestick.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/center-dxi.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var nested_option_2 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var DxiCenterComponent = (function (_super) { __extends(DxiCenterComponent, _super); function DxiCenterComponent(parentOptionHost, optionHost) { var _this = _super.call(this) || this; parentOptionHost.setNestedOption(_this); optionHost.setHost(_this, _this._fullOptionPath.bind(_this)); return _this; } Object.defineProperty(DxiCenterComponent.prototype, "lat", { get: function () { return this._getOption('lat'); }, set: function (value) { this._setOption('lat', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiCenterComponent.prototype, "lng", { get: function () { return this._getOption('lng'); }, set: function (value) { this._setOption('lng', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiCenterComponent.prototype, "_optionPath", { get: function () { return 'center'; }, enumerable: true, configurable: true }); DxiCenterComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dxi-center', template: '', styles: [''], providers: [nested_option_1.NestedOptionHost] },] }, ]; /** @nocollapse */ DxiCenterComponent.ctorParameters = function () { return [ { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.SkipSelf }, { type: core_1.Host },] }, { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.Host },] }, ]; }; DxiCenterComponent.propDecorators = { 'lat': [{ type: core_1.Input },], 'lng': [{ type: core_1.Input },], }; return DxiCenterComponent; }(nested_option_2.CollectionNestedOption)); exports.DxiCenterComponent = DxiCenterComponent; var DxiCenterModule = (function () { function DxiCenterModule() { } DxiCenterModule.decorators = [ { type: core_1.NgModule, args: [{ declarations: [ DxiCenterComponent ], exports: [ DxiCenterComponent ], },] }, ]; /** @nocollapse */ DxiCenterModule.ctorParameters = function () { return []; }; return DxiCenterModule; }()); exports.DxiCenterModule = DxiCenterModule; //# sourceMappingURL=center-dxi.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/chart.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var nested_option_2 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var series_dxi_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/series-dxi.js"); var DxoChartComponent = (function (_super) { __extends(DxoChartComponent, _super); function DxoChartComponent(parentOptionHost, optionHost) { var _this = _super.call(this) || this; parentOptionHost.setNestedOption(_this); optionHost.setHost(_this, _this._fullOptionPath.bind(_this)); return _this; } Object.defineProperty(DxoChartComponent.prototype, "barWidth", { get: function () { return this._getOption('barWidth'); }, set: function (value) { this._setOption('barWidth', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoChartComponent.prototype, "bottomIndent", { get: function () { return this._getOption('bottomIndent'); }, set: function (value) { this._setOption('bottomIndent', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoChartComponent.prototype, "commonSeriesSettings", { get: function () { return this._getOption('commonSeriesSettings'); }, set: function (value) { this._setOption('commonSeriesSettings', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoChartComponent.prototype, "dataPrepareSettings", { get: function () { return this._getOption('dataPrepareSettings'); }, set: function (value) { this._setOption('dataPrepareSettings', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoChartComponent.prototype, "equalBarWidth", { get: function () { return this._getOption('equalBarWidth'); }, set: function (value) { this._setOption('equalBarWidth', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoChartComponent.prototype, "negativesAsZeroes", { get: function () { return this._getOption('negativesAsZeroes'); }, set: function (value) { this._setOption('negativesAsZeroes', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoChartComponent.prototype, "palette", { get: function () { return this._getOption('palette'); }, set: function (value) { this._setOption('palette', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoChartComponent.prototype, "series", { get: function () { return this._getOption('series'); }, set: function (value) { this._setOption('series', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoChartComponent.prototype, "seriesTemplate", { get: function () { return this._getOption('seriesTemplate'); }, set: function (value) { this._setOption('seriesTemplate', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoChartComponent.prototype, "topIndent", { get: function () { return this._getOption('topIndent'); }, set: function (value) { this._setOption('topIndent', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoChartComponent.prototype, "useAggregation", { get: function () { return this._getOption('useAggregation'); }, set: function (value) { this._setOption('useAggregation', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoChartComponent.prototype, "valueAxis", { get: function () { return this._getOption('valueAxis'); }, set: function (value) { this._setOption('valueAxis', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoChartComponent.prototype, "_optionPath", { get: function () { return 'chart'; }, enumerable: true, configurable: true }); Object.defineProperty(DxoChartComponent.prototype, "seriesChildren", { get: function () { return this._getOption('series'); }, set: function (value) { this.setChildren('series', value); }, enumerable: true, configurable: true }); DxoChartComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dxo-chart', template: '', styles: [''], providers: [nested_option_1.NestedOptionHost] },] }, ]; /** @nocollapse */ DxoChartComponent.ctorParameters = function () { return [ { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.SkipSelf }, { type: core_1.Host },] }, { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.Host },] }, ]; }; DxoChartComponent.propDecorators = { 'barWidth': [{ type: core_1.Input },], 'bottomIndent': [{ type: core_1.Input },], 'commonSeriesSettings': [{ type: core_1.Input },], 'dataPrepareSettings': [{ type: core_1.Input },], 'equalBarWidth': [{ type: core_1.Input },], 'negativesAsZeroes': [{ type: core_1.Input },], 'palette': [{ type: core_1.Input },], 'series': [{ type: core_1.Input },], 'seriesTemplate': [{ type: core_1.Input },], 'topIndent': [{ type: core_1.Input },], 'useAggregation': [{ type: core_1.Input },], 'valueAxis': [{ type: core_1.Input },], 'seriesChildren': [{ type: core_1.ContentChildren, args: [core_1.forwardRef(function () { return series_dxi_1.DxiSeriesComponent; }),] },], }; return DxoChartComponent; }(nested_option_2.NestedOption)); exports.DxoChartComponent = DxoChartComponent; var DxoChartModule = (function () { function DxoChartModule() { } DxoChartModule.decorators = [ { type: core_1.NgModule, args: [{ declarations: [ DxoChartComponent ], exports: [ DxoChartComponent ], },] }, ]; /** @nocollapse */ DxoChartModule.ctorParameters = function () { return []; }; return DxoChartModule; }()); exports.DxoChartModule = DxoChartModule; //# sourceMappingURL=chart.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/col-count-by-screen.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var nested_option_2 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var DxoColCountByScreenComponent = (function (_super) { __extends(DxoColCountByScreenComponent, _super); function DxoColCountByScreenComponent(parentOptionHost, optionHost) { var _this = _super.call(this) || this; parentOptionHost.setNestedOption(_this); optionHost.setHost(_this, _this._fullOptionPath.bind(_this)); return _this; } Object.defineProperty(DxoColCountByScreenComponent.prototype, "lg", { get: function () { return this._getOption('lg'); }, set: function (value) { this._setOption('lg', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoColCountByScreenComponent.prototype, "md", { get: function () { return this._getOption('md'); }, set: function (value) { this._setOption('md', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoColCountByScreenComponent.prototype, "sm", { get: function () { return this._getOption('sm'); }, set: function (value) { this._setOption('sm', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoColCountByScreenComponent.prototype, "xs", { get: function () { return this._getOption('xs'); }, set: function (value) { this._setOption('xs', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoColCountByScreenComponent.prototype, "_optionPath", { get: function () { return 'colCountByScreen'; }, enumerable: true, configurable: true }); DxoColCountByScreenComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dxo-col-count-by-screen', template: '', styles: [''], providers: [nested_option_1.NestedOptionHost] },] }, ]; /** @nocollapse */ DxoColCountByScreenComponent.ctorParameters = function () { return [ { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.SkipSelf }, { type: core_1.Host },] }, { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.Host },] }, ]; }; DxoColCountByScreenComponent.propDecorators = { 'lg': [{ type: core_1.Input },], 'md': [{ type: core_1.Input },], 'sm': [{ type: core_1.Input },], 'xs': [{ type: core_1.Input },], }; return DxoColCountByScreenComponent; }(nested_option_2.NestedOption)); exports.DxoColCountByScreenComponent = DxoColCountByScreenComponent; var DxoColCountByScreenModule = (function () { function DxoColCountByScreenModule() { } DxoColCountByScreenModule.decorators = [ { type: core_1.NgModule, args: [{ declarations: [ DxoColCountByScreenComponent ], exports: [ DxoColCountByScreenComponent ], },] }, ]; /** @nocollapse */ DxoColCountByScreenModule.ctorParameters = function () { return []; }; return DxoColCountByScreenModule; }()); exports.DxoColCountByScreenModule = DxoColCountByScreenModule; //# sourceMappingURL=col-count-by-screen.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/col-dxi.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var nested_option_2 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var DxiColComponent = (function (_super) { __extends(DxiColComponent, _super); function DxiColComponent(parentOptionHost, optionHost) { var _this = _super.call(this) || this; parentOptionHost.setNestedOption(_this); optionHost.setHost(_this, _this._fullOptionPath.bind(_this)); return _this; } Object.defineProperty(DxiColComponent.prototype, "baseSize", { get: function () { return this._getOption('baseSize'); }, set: function (value) { this._setOption('baseSize', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiColComponent.prototype, "ratio", { get: function () { return this._getOption('ratio'); }, set: function (value) { this._setOption('ratio', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiColComponent.prototype, "screen", { get: function () { return this._getOption('screen'); }, set: function (value) { this._setOption('screen', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiColComponent.prototype, "shrink", { get: function () { return this._getOption('shrink'); }, set: function (value) { this._setOption('shrink', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiColComponent.prototype, "_optionPath", { get: function () { return 'cols'; }, enumerable: true, configurable: true }); DxiColComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dxi-col', template: '', styles: [''], providers: [nested_option_1.NestedOptionHost] },] }, ]; /** @nocollapse */ DxiColComponent.ctorParameters = function () { return [ { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.SkipSelf }, { type: core_1.Host },] }, { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.Host },] }, ]; }; DxiColComponent.propDecorators = { 'baseSize': [{ type: core_1.Input },], 'ratio': [{ type: core_1.Input },], 'screen': [{ type: core_1.Input },], 'shrink': [{ type: core_1.Input },], }; return DxiColComponent; }(nested_option_2.CollectionNestedOption)); exports.DxiColComponent = DxiColComponent; var DxiColModule = (function () { function DxiColModule() { } DxiColModule.decorators = [ { type: core_1.NgModule, args: [{ declarations: [ DxiColComponent ], exports: [ DxiColComponent ], },] }, ]; /** @nocollapse */ DxiColModule.ctorParameters = function () { return []; }; return DxiColModule; }()); exports.DxiColModule = DxiColModule; //# sourceMappingURL=col-dxi.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/collision.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var nested_option_2 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var DxoCollisionComponent = (function (_super) { __extends(DxoCollisionComponent, _super); function DxoCollisionComponent(parentOptionHost, optionHost) { var _this = _super.call(this) || this; parentOptionHost.setNestedOption(_this); optionHost.setHost(_this, _this._fullOptionPath.bind(_this)); return _this; } Object.defineProperty(DxoCollisionComponent.prototype, "x", { get: function () { return this._getOption('x'); }, set: function (value) { this._setOption('x', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoCollisionComponent.prototype, "y", { get: function () { return this._getOption('y'); }, set: function (value) { this._setOption('y', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoCollisionComponent.prototype, "_optionPath", { get: function () { return 'collision'; }, enumerable: true, configurable: true }); DxoCollisionComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dxo-collision', template: '', styles: [''], providers: [nested_option_1.NestedOptionHost] },] }, ]; /** @nocollapse */ DxoCollisionComponent.ctorParameters = function () { return [ { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.SkipSelf }, { type: core_1.Host },] }, { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.Host },] }, ]; }; DxoCollisionComponent.propDecorators = { 'x': [{ type: core_1.Input },], 'y': [{ type: core_1.Input },], }; return DxoCollisionComponent; }(nested_option_2.NestedOption)); exports.DxoCollisionComponent = DxoCollisionComponent; var DxoCollisionModule = (function () { function DxoCollisionModule() { } DxoCollisionModule.decorators = [ { type: core_1.NgModule, args: [{ declarations: [ DxoCollisionComponent ], exports: [ DxoCollisionComponent ], },] }, ]; /** @nocollapse */ DxoCollisionModule.ctorParameters = function () { return []; }; return DxoCollisionModule; }()); exports.DxoCollisionModule = DxoCollisionModule; //# sourceMappingURL=collision.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/colorizer.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var nested_option_2 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var DxoColorizerComponent = (function (_super) { __extends(DxoColorizerComponent, _super); function DxoColorizerComponent(parentOptionHost, optionHost) { var _this = _super.call(this) || this; parentOptionHost.setNestedOption(_this); optionHost.setHost(_this, _this._fullOptionPath.bind(_this)); return _this; } Object.defineProperty(DxoColorizerComponent.prototype, "colorCodeField", { get: function () { return this._getOption('colorCodeField'); }, set: function (value) { this._setOption('colorCodeField', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoColorizerComponent.prototype, "colorizeGroups", { get: function () { return this._getOption('colorizeGroups'); }, set: function (value) { this._setOption('colorizeGroups', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoColorizerComponent.prototype, "palette", { get: function () { return this._getOption('palette'); }, set: function (value) { this._setOption('palette', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoColorizerComponent.prototype, "range", { get: function () { return this._getOption('range'); }, set: function (value) { this._setOption('range', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoColorizerComponent.prototype, "type", { get: function () { return this._getOption('type'); }, set: function (value) { this._setOption('type', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoColorizerComponent.prototype, "_optionPath", { get: function () { return 'colorizer'; }, enumerable: true, configurable: true }); DxoColorizerComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dxo-colorizer', template: '', styles: [''], providers: [nested_option_1.NestedOptionHost] },] }, ]; /** @nocollapse */ DxoColorizerComponent.ctorParameters = function () { return [ { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.SkipSelf }, { type: core_1.Host },] }, { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.Host },] }, ]; }; DxoColorizerComponent.propDecorators = { 'colorCodeField': [{ type: core_1.Input },], 'colorizeGroups': [{ type: core_1.Input },], 'palette': [{ type: core_1.Input },], 'range': [{ type: core_1.Input },], 'type': [{ type: core_1.Input },], }; return DxoColorizerComponent; }(nested_option_2.NestedOption)); exports.DxoColorizerComponent = DxoColorizerComponent; var DxoColorizerModule = (function () { function DxoColorizerModule() { } DxoColorizerModule.decorators = [ { type: core_1.NgModule, args: [{ declarations: [ DxoColorizerComponent ], exports: [ DxoColorizerComponent ], },] }, ]; /** @nocollapse */ DxoColorizerModule.ctorParameters = function () { return []; }; return DxoColorizerModule; }()); exports.DxoColorizerModule = DxoColorizerModule; //# sourceMappingURL=colorizer.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/column-chooser.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var nested_option_2 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var DxoColumnChooserComponent = (function (_super) { __extends(DxoColumnChooserComponent, _super); function DxoColumnChooserComponent(parentOptionHost, optionHost) { var _this = _super.call(this) || this; parentOptionHost.setNestedOption(_this); optionHost.setHost(_this, _this._fullOptionPath.bind(_this)); return _this; } Object.defineProperty(DxoColumnChooserComponent.prototype, "allowSearch", { get: function () { return this._getOption('allowSearch'); }, set: function (value) { this._setOption('allowSearch', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoColumnChooserComponent.prototype, "emptyPanelText", { get: function () { return this._getOption('emptyPanelText'); }, set: function (value) { this._setOption('emptyPanelText', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoColumnChooserComponent.prototype, "enabled", { get: function () { return this._getOption('enabled'); }, set: function (value) { this._setOption('enabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoColumnChooserComponent.prototype, "height", { get: function () { return this._getOption('height'); }, set: function (value) { this._setOption('height', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoColumnChooserComponent.prototype, "mode", { get: function () { return this._getOption('mode'); }, set: function (value) { this._setOption('mode', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoColumnChooserComponent.prototype, "title", { get: function () { return this._getOption('title'); }, set: function (value) { this._setOption('title', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoColumnChooserComponent.prototype, "width", { get: function () { return this._getOption('width'); }, set: function (value) { this._setOption('width', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoColumnChooserComponent.prototype, "_optionPath", { get: function () { return 'columnChooser'; }, enumerable: true, configurable: true }); DxoColumnChooserComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dxo-column-chooser', template: '', styles: [''], providers: [nested_option_1.NestedOptionHost] },] }, ]; /** @nocollapse */ DxoColumnChooserComponent.ctorParameters = function () { return [ { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.SkipSelf }, { type: core_1.Host },] }, { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.Host },] }, ]; }; DxoColumnChooserComponent.propDecorators = { 'allowSearch': [{ type: core_1.Input },], 'emptyPanelText': [{ type: core_1.Input },], 'enabled': [{ type: core_1.Input },], 'height': [{ type: core_1.Input },], 'mode': [{ type: core_1.Input },], 'title': [{ type: core_1.Input },], 'width': [{ type: core_1.Input },], }; return DxoColumnChooserComponent; }(nested_option_2.NestedOption)); exports.DxoColumnChooserComponent = DxoColumnChooserComponent; var DxoColumnChooserModule = (function () { function DxoColumnChooserModule() { } DxoColumnChooserModule.decorators = [ { type: core_1.NgModule, args: [{ declarations: [ DxoColumnChooserComponent ], exports: [ DxoColumnChooserComponent ], },] }, ]; /** @nocollapse */ DxoColumnChooserModule.ctorParameters = function () { return []; }; return DxoColumnChooserModule; }()); exports.DxoColumnChooserModule = DxoColumnChooserModule; //# sourceMappingURL=column-chooser.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/column-dxi.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); /* tslint:disable:use-input-property-decorator */ var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var data_grid_column_dxi_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/base/data-grid-column-dxi.js"); var validation_rule_dxi_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/validation-rule-dxi.js"); var DxiColumnComponent = (function (_super) { __extends(DxiColumnComponent, _super); function DxiColumnComponent(parentOptionHost, optionHost) { var _this = _super.call(this) || this; parentOptionHost.setNestedOption(_this); optionHost.setHost(_this, _this._fullOptionPath.bind(_this)); return _this; } Object.defineProperty(DxiColumnComponent.prototype, "_optionPath", { get: function () { return 'columns'; }, enumerable: true, configurable: true }); Object.defineProperty(DxiColumnComponent.prototype, "columnsChildren", { get: function () { return this._getOption('columns'); }, set: function (value) { this.setChildren('columns', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiColumnComponent.prototype, "validationRulesChildren", { get: function () { return this._getOption('validationRules'); }, set: function (value) { this.setChildren('validationRules', value); }, enumerable: true, configurable: true }); DxiColumnComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dxi-column', template: '', styles: [''], providers: [nested_option_1.NestedOptionHost], inputs: [ 'alignment', 'allowEditing', 'allowExporting', 'allowFiltering', 'allowFixing', 'allowGrouping', 'allowHeaderFiltering', 'allowHiding', 'allowReordering', 'allowResizing', 'allowSearch', 'allowSorting', 'autoExpandGroup', 'calculateCellValue', 'calculateDisplayValue', 'calculateFilterExpression', 'calculateGroupValue', 'calculateSortValue', 'caption', 'cellTemplate', 'columns', 'cssClass', 'customizeText', 'dataField', 'dataType', 'editCellTemplate', 'editorOptions', 'encodeHtml', 'falseText', 'filterOperations', 'filterType', 'filterValue', 'filterValues', 'fixed', 'fixedPosition', 'format', 'formItem', 'groupCellTemplate', 'groupIndex', 'headerCellTemplate', 'headerFilter', 'hidingPriority', 'isBand', 'lookup', 'minWidth', 'name', 'ownerBand', 'precision', 'selectedFilterOperation', 'setCellValue', 'showEditorAlways', 'showInColumnChooser', 'showWhenGrouped', 'sortIndex', 'sortingMethod', 'sortOrder', 'trueText', 'validationRules', 'visible', 'visibleIndex', 'width' ] },] }, ]; /** @nocollapse */ DxiColumnComponent.ctorParameters = function () { return [ { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.SkipSelf }, { type: core_1.Host },] }, { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.Host },] }, ]; }; DxiColumnComponent.propDecorators = { 'columnsChildren': [{ type: core_1.ContentChildren, args: [core_1.forwardRef(function () { return DxiColumnComponent; }),] },], 'validationRulesChildren': [{ type: core_1.ContentChildren, args: [core_1.forwardRef(function () { return validation_rule_dxi_1.DxiValidationRuleComponent; }),] },], }; return DxiColumnComponent; }(data_grid_column_dxi_1.DxiDataGridColumn)); exports.DxiColumnComponent = DxiColumnComponent; var DxiColumnModule = (function () { function DxiColumnModule() { } DxiColumnModule.decorators = [ { type: core_1.NgModule, args: [{ declarations: [ DxiColumnComponent ], exports: [ DxiColumnComponent ], },] }, ]; /** @nocollapse */ DxiColumnModule.ctorParameters = function () { return []; }; return DxiColumnModule; }()); exports.DxiColumnModule = DxiColumnModule; //# sourceMappingURL=column-dxi.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/column-fixing.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var nested_option_2 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var DxoColumnFixingComponent = (function (_super) { __extends(DxoColumnFixingComponent, _super); function DxoColumnFixingComponent(parentOptionHost, optionHost) { var _this = _super.call(this) || this; parentOptionHost.setNestedOption(_this); optionHost.setHost(_this, _this._fullOptionPath.bind(_this)); return _this; } Object.defineProperty(DxoColumnFixingComponent.prototype, "enabled", { get: function () { return this._getOption('enabled'); }, set: function (value) { this._setOption('enabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoColumnFixingComponent.prototype, "texts", { get: function () { return this._getOption('texts'); }, set: function (value) { this._setOption('texts', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoColumnFixingComponent.prototype, "_optionPath", { get: function () { return 'columnFixing'; }, enumerable: true, configurable: true }); DxoColumnFixingComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dxo-column-fixing', template: '', styles: [''], providers: [nested_option_1.NestedOptionHost] },] }, ]; /** @nocollapse */ DxoColumnFixingComponent.ctorParameters = function () { return [ { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.SkipSelf }, { type: core_1.Host },] }, { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.Host },] }, ]; }; DxoColumnFixingComponent.propDecorators = { 'enabled': [{ type: core_1.Input },], 'texts': [{ type: core_1.Input },], }; return DxoColumnFixingComponent; }(nested_option_2.NestedOption)); exports.DxoColumnFixingComponent = DxoColumnFixingComponent; var DxoColumnFixingModule = (function () { function DxoColumnFixingModule() { } DxoColumnFixingModule.decorators = [ { type: core_1.NgModule, args: [{ declarations: [ DxoColumnFixingComponent ], exports: [ DxoColumnFixingComponent ], },] }, ]; /** @nocollapse */ DxoColumnFixingModule.ctorParameters = function () { return []; }; return DxoColumnFixingModule; }()); exports.DxoColumnFixingModule = DxoColumnFixingModule; //# sourceMappingURL=column-fixing.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/common-axis-settings.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var nested_option_2 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var DxoCommonAxisSettingsComponent = (function (_super) { __extends(DxoCommonAxisSettingsComponent, _super); function DxoCommonAxisSettingsComponent(parentOptionHost, optionHost) { var _this = _super.call(this) || this; parentOptionHost.setNestedOption(_this); optionHost.setHost(_this, _this._fullOptionPath.bind(_this)); return _this; } Object.defineProperty(DxoCommonAxisSettingsComponent.prototype, "allowDecimals", { get: function () { return this._getOption('allowDecimals'); }, set: function (value) { this._setOption('allowDecimals', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoCommonAxisSettingsComponent.prototype, "breakStyle", { get: function () { return this._getOption('breakStyle'); }, set: function (value) { this._setOption('breakStyle', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoCommonAxisSettingsComponent.prototype, "color", { get: function () { return this._getOption('color'); }, set: function (value) { this._setOption('color', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoCommonAxisSettingsComponent.prototype, "constantLineStyle", { get: function () { return this._getOption('constantLineStyle'); }, set: function (value) { this._setOption('constantLineStyle', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoCommonAxisSettingsComponent.prototype, "discreteAxisDivisionMode", { get: function () { return this._getOption('discreteAxisDivisionMode'); }, set: function (value) { this._setOption('discreteAxisDivisionMode', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoCommonAxisSettingsComponent.prototype, "endOnTick", { get: function () { return this._getOption('endOnTick'); }, set: function (value) { this._setOption('endOnTick', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoCommonAxisSettingsComponent.prototype, "grid", { get: function () { return this._getOption('grid'); }, set: function (value) { this._setOption('grid', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoCommonAxisSettingsComponent.prototype, "inverted", { get: function () { return this._getOption('inverted'); }, set: function (value) { this._setOption('inverted', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoCommonAxisSettingsComponent.prototype, "label", { get: function () { return this._getOption('label'); }, set: function (value) { this._setOption('label', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoCommonAxisSettingsComponent.prototype, "maxValueMargin", { get: function () { return this._getOption('maxValueMargin'); }, set: function (value) { this._setOption('maxValueMargin', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoCommonAxisSettingsComponent.prototype, "minorGrid", { get: function () { return this._getOption('minorGrid'); }, set: function (value) { this._setOption('minorGrid', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoCommonAxisSettingsComponent.prototype, "minorTick", { get: function () { return this._getOption('minorTick'); }, set: function (value) { this._setOption('minorTick', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoCommonAxisSettingsComponent.prototype, "minValueMargin", { get: function () { return this._getOption('minValueMargin'); }, set: function (value) { this._setOption('minValueMargin', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoCommonAxisSettingsComponent.prototype, "opacity", { get: function () { return this._getOption('opacity'); }, set: function (value) { this._setOption('opacity', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoCommonAxisSettingsComponent.prototype, "placeholderSize", { get: function () { return this._getOption('placeholderSize'); }, set: function (value) { this._setOption('placeholderSize', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoCommonAxisSettingsComponent.prototype, "setTicksAtUnitBeginning", { get: function () { return this._getOption('setTicksAtUnitBeginning'); }, set: function (value) { this._setOption('setTicksAtUnitBeginning', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoCommonAxisSettingsComponent.prototype, "stripStyle", { get: function () { return this._getOption('stripStyle'); }, set: function (value) { this._setOption('stripStyle', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoCommonAxisSettingsComponent.prototype, "tick", { get: function () { return this._getOption('tick'); }, set: function (value) { this._setOption('tick', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoCommonAxisSettingsComponent.prototype, "title", { get: function () { return this._getOption('title'); }, set: function (value) { this._setOption('title', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoCommonAxisSettingsComponent.prototype, "valueMarginsEnabled", { get: function () { return this._getOption('valueMarginsEnabled'); }, set: function (value) { this._setOption('valueMarginsEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoCommonAxisSettingsComponent.prototype, "visible", { get: function () { return this._getOption('visible'); }, set: function (value) { this._setOption('visible', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoCommonAxisSettingsComponent.prototype, "width", { get: function () { return this._getOption('width'); }, set: function (value) { this._setOption('width', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoCommonAxisSettingsComponent.prototype, "_optionPath", { get: function () { return 'commonAxisSettings'; }, enumerable: true, configurable: true }); DxoCommonAxisSettingsComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dxo-common-axis-settings', template: '', styles: [''], providers: [nested_option_1.NestedOptionHost] },] }, ]; /** @nocollapse */ DxoCommonAxisSettingsComponent.ctorParameters = function () { return [ { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.SkipSelf }, { type: core_1.Host },] }, { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.Host },] }, ]; }; DxoCommonAxisSettingsComponent.propDecorators = { 'allowDecimals': [{ type: core_1.Input },], 'breakStyle': [{ type: core_1.Input },], 'color': [{ type: core_1.Input },], 'constantLineStyle': [{ type: core_1.Input },], 'discreteAxisDivisionMode': [{ type: core_1.Input },], 'endOnTick': [{ type: core_1.Input },], 'grid': [{ type: core_1.Input },], 'inverted': [{ type: core_1.Input },], 'label': [{ type: core_1.Input },], 'maxValueMargin': [{ type: core_1.Input },], 'minorGrid': [{ type: core_1.Input },], 'minorTick': [{ type: core_1.Input },], 'minValueMargin': [{ type: core_1.Input },], 'opacity': [{ type: core_1.Input },], 'placeholderSize': [{ type: core_1.Input },], 'setTicksAtUnitBeginning': [{ type: core_1.Input },], 'stripStyle': [{ type: core_1.Input },], 'tick': [{ type: core_1.Input },], 'title': [{ type: core_1.Input },], 'valueMarginsEnabled': [{ type: core_1.Input },], 'visible': [{ type: core_1.Input },], 'width': [{ type: core_1.Input },], }; return DxoCommonAxisSettingsComponent; }(nested_option_2.NestedOption)); exports.DxoCommonAxisSettingsComponent = DxoCommonAxisSettingsComponent; var DxoCommonAxisSettingsModule = (function () { function DxoCommonAxisSettingsModule() { } DxoCommonAxisSettingsModule.decorators = [ { type: core_1.NgModule, args: [{ declarations: [ DxoCommonAxisSettingsComponent ], exports: [ DxoCommonAxisSettingsComponent ], },] }, ]; /** @nocollapse */ DxoCommonAxisSettingsModule.ctorParameters = function () { return []; }; return DxoCommonAxisSettingsModule; }()); exports.DxoCommonAxisSettingsModule = DxoCommonAxisSettingsModule; //# sourceMappingURL=common-axis-settings.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/common-pane-settings.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var nested_option_2 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var DxoCommonPaneSettingsComponent = (function (_super) { __extends(DxoCommonPaneSettingsComponent, _super); function DxoCommonPaneSettingsComponent(parentOptionHost, optionHost) { var _this = _super.call(this) || this; parentOptionHost.setNestedOption(_this); optionHost.setHost(_this, _this._fullOptionPath.bind(_this)); return _this; } Object.defineProperty(DxoCommonPaneSettingsComponent.prototype, "backgroundColor", { get: function () { return this._getOption('backgroundColor'); }, set: function (value) { this._setOption('backgroundColor', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoCommonPaneSettingsComponent.prototype, "border", { get: function () { return this._getOption('border'); }, set: function (value) { this._setOption('border', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoCommonPaneSettingsComponent.prototype, "_optionPath", { get: function () { return 'commonPaneSettings'; }, enumerable: true, configurable: true }); DxoCommonPaneSettingsComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dxo-common-pane-settings', template: '', styles: [''], providers: [nested_option_1.NestedOptionHost] },] }, ]; /** @nocollapse */ DxoCommonPaneSettingsComponent.ctorParameters = function () { return [ { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.SkipSelf }, { type: core_1.Host },] }, { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.Host },] }, ]; }; DxoCommonPaneSettingsComponent.propDecorators = { 'backgroundColor': [{ type: core_1.Input },], 'border': [{ type: core_1.Input },], }; return DxoCommonPaneSettingsComponent; }(nested_option_2.NestedOption)); exports.DxoCommonPaneSettingsComponent = DxoCommonPaneSettingsComponent; var DxoCommonPaneSettingsModule = (function () { function DxoCommonPaneSettingsModule() { } DxoCommonPaneSettingsModule.decorators = [ { type: core_1.NgModule, args: [{ declarations: [ DxoCommonPaneSettingsComponent ], exports: [ DxoCommonPaneSettingsComponent ], },] }, ]; /** @nocollapse */ DxoCommonPaneSettingsModule.ctorParameters = function () { return []; }; return DxoCommonPaneSettingsModule; }()); exports.DxoCommonPaneSettingsModule = DxoCommonPaneSettingsModule; //# sourceMappingURL=common-pane-settings.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/common-series-settings.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); /* tslint:disable:use-input-property-decorator */ var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var chart_common_series_settings_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/base/chart-common-series-settings.js"); var DxoCommonSeriesSettingsComponent = (function (_super) { __extends(DxoCommonSeriesSettingsComponent, _super); function DxoCommonSeriesSettingsComponent(parentOptionHost, optionHost) { var _this = _super.call(this) || this; parentOptionHost.setNestedOption(_this); optionHost.setHost(_this, _this._fullOptionPath.bind(_this)); return _this; } Object.defineProperty(DxoCommonSeriesSettingsComponent.prototype, "_optionPath", { get: function () { return 'commonSeriesSettings'; }, enumerable: true, configurable: true }); DxoCommonSeriesSettingsComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dxo-common-series-settings', template: '', styles: [''], providers: [nested_option_1.NestedOptionHost], inputs: [ 'area', 'argumentField', 'axis', 'bar', 'border', 'bubble', 'candlestick', 'closeValueField', 'color', 'cornerRadius', 'dashStyle', 'fullstackedarea', 'fullstackedbar', 'fullstackedline', 'fullstackedspline', 'fullstackedsplinearea', 'highValueField', 'hoverMode', 'hoverStyle', 'ignoreEmptyPoints', 'innerColor', 'label', 'line', 'lowValueField', 'maxLabelCount', 'minBarSize', 'opacity', 'openValueField', 'pane', 'point', 'rangearea', 'rangebar', 'rangeValue1Field', 'rangeValue2Field', 'reduction', 'scatter', 'selectionMode', 'selectionStyle', 'showInLegend', 'sizeField', 'spline', 'splinearea', 'stack', 'stackedarea', 'stackedbar', 'stackedline', 'stackedspline', 'stackedsplinearea', 'steparea', 'stepline', 'stock', 'tagField', 'type', 'valueErrorBar', 'valueField', 'visible', 'width', 'argumentType', 'innerRadius', 'minSegmentSize', 'segmentsDirection', 'smallValuesGrouping', 'startAngle', 'closed' ] },] }, ]; /** @nocollapse */ DxoCommonSeriesSettingsComponent.ctorParameters = function () { return [ { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.SkipSelf }, { type: core_1.Host },] }, { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.Host },] }, ]; }; return DxoCommonSeriesSettingsComponent; }(chart_common_series_settings_1.DxoChartCommonSeriesSettings)); exports.DxoCommonSeriesSettingsComponent = DxoCommonSeriesSettingsComponent; var DxoCommonSeriesSettingsModule = (function () { function DxoCommonSeriesSettingsModule() { } DxoCommonSeriesSettingsModule.decorators = [ { type: core_1.NgModule, args: [{ declarations: [ DxoCommonSeriesSettingsComponent ], exports: [ DxoCommonSeriesSettingsComponent ], },] }, ]; /** @nocollapse */ DxoCommonSeriesSettingsModule.ctorParameters = function () { return []; }; return DxoCommonSeriesSettingsModule; }()); exports.DxoCommonSeriesSettingsModule = DxoCommonSeriesSettingsModule; //# sourceMappingURL=common-series-settings.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/connector.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var nested_option_2 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var DxoConnectorComponent = (function (_super) { __extends(DxoConnectorComponent, _super); function DxoConnectorComponent(parentOptionHost, optionHost) { var _this = _super.call(this) || this; parentOptionHost.setNestedOption(_this); optionHost.setHost(_this, _this._fullOptionPath.bind(_this)); return _this; } Object.defineProperty(DxoConnectorComponent.prototype, "color", { get: function () { return this._getOption('color'); }, set: function (value) { this._setOption('color', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoConnectorComponent.prototype, "visible", { get: function () { return this._getOption('visible'); }, set: function (value) { this._setOption('visible', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoConnectorComponent.prototype, "width", { get: function () { return this._getOption('width'); }, set: function (value) { this._setOption('width', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoConnectorComponent.prototype, "opacity", { get: function () { return this._getOption('opacity'); }, set: function (value) { this._setOption('opacity', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoConnectorComponent.prototype, "_optionPath", { get: function () { return 'connector'; }, enumerable: true, configurable: true }); DxoConnectorComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dxo-connector', template: '', styles: [''], providers: [nested_option_1.NestedOptionHost] },] }, ]; /** @nocollapse */ DxoConnectorComponent.ctorParameters = function () { return [ { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.SkipSelf }, { type: core_1.Host },] }, { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.Host },] }, ]; }; DxoConnectorComponent.propDecorators = { 'color': [{ type: core_1.Input },], 'visible': [{ type: core_1.Input },], 'width': [{ type: core_1.Input },], 'opacity': [{ type: core_1.Input },], }; return DxoConnectorComponent; }(nested_option_2.NestedOption)); exports.DxoConnectorComponent = DxoConnectorComponent; var DxoConnectorModule = (function () { function DxoConnectorModule() { } DxoConnectorModule.decorators = [ { type: core_1.NgModule, args: [{ declarations: [ DxoConnectorComponent ], exports: [ DxoConnectorComponent ], },] }, ]; /** @nocollapse */ DxoConnectorModule.ctorParameters = function () { return []; }; return DxoConnectorModule; }()); exports.DxoConnectorModule = DxoConnectorModule; //# sourceMappingURL=connector.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/constant-line-dxi.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var nested_option_2 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var DxiConstantLineComponent = (function (_super) { __extends(DxiConstantLineComponent, _super); function DxiConstantLineComponent(parentOptionHost, optionHost) { var _this = _super.call(this) || this; parentOptionHost.setNestedOption(_this); optionHost.setHost(_this, _this._fullOptionPath.bind(_this)); return _this; } Object.defineProperty(DxiConstantLineComponent.prototype, "color", { get: function () { return this._getOption('color'); }, set: function (value) { this._setOption('color', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiConstantLineComponent.prototype, "dashStyle", { get: function () { return this._getOption('dashStyle'); }, set: function (value) { this._setOption('dashStyle', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiConstantLineComponent.prototype, "label", { get: function () { return this._getOption('label'); }, set: function (value) { this._setOption('label', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiConstantLineComponent.prototype, "paddingLeftRight", { get: function () { return this._getOption('paddingLeftRight'); }, set: function (value) { this._setOption('paddingLeftRight', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiConstantLineComponent.prototype, "paddingTopBottom", { get: function () { return this._getOption('paddingTopBottom'); }, set: function (value) { this._setOption('paddingTopBottom', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiConstantLineComponent.prototype, "value", { get: function () { return this._getOption('value'); }, set: function (value) { this._setOption('value', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiConstantLineComponent.prototype, "width", { get: function () { return this._getOption('width'); }, set: function (value) { this._setOption('width', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiConstantLineComponent.prototype, "_optionPath", { get: function () { return 'constantLines'; }, enumerable: true, configurable: true }); DxiConstantLineComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dxi-constant-line', template: '', styles: [''], providers: [nested_option_1.NestedOptionHost] },] }, ]; /** @nocollapse */ DxiConstantLineComponent.ctorParameters = function () { return [ { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.SkipSelf }, { type: core_1.Host },] }, { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.Host },] }, ]; }; DxiConstantLineComponent.propDecorators = { 'color': [{ type: core_1.Input },], 'dashStyle': [{ type: core_1.Input },], 'label': [{ type: core_1.Input },], 'paddingLeftRight': [{ type: core_1.Input },], 'paddingTopBottom': [{ type: core_1.Input },], 'value': [{ type: core_1.Input },], 'width': [{ type: core_1.Input },], }; return DxiConstantLineComponent; }(nested_option_2.CollectionNestedOption)); exports.DxiConstantLineComponent = DxiConstantLineComponent; var DxiConstantLineModule = (function () { function DxiConstantLineModule() { } DxiConstantLineModule.decorators = [ { type: core_1.NgModule, args: [{ declarations: [ DxiConstantLineComponent ], exports: [ DxiConstantLineComponent ], },] }, ]; /** @nocollapse */ DxiConstantLineModule.ctorParameters = function () { return []; }; return DxiConstantLineModule; }()); exports.DxiConstantLineModule = DxiConstantLineModule; //# sourceMappingURL=constant-line-dxi.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/constant-line-style.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var nested_option_2 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var DxoConstantLineStyleComponent = (function (_super) { __extends(DxoConstantLineStyleComponent, _super); function DxoConstantLineStyleComponent(parentOptionHost, optionHost) { var _this = _super.call(this) || this; parentOptionHost.setNestedOption(_this); optionHost.setHost(_this, _this._fullOptionPath.bind(_this)); return _this; } Object.defineProperty(DxoConstantLineStyleComponent.prototype, "color", { get: function () { return this._getOption('color'); }, set: function (value) { this._setOption('color', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoConstantLineStyleComponent.prototype, "dashStyle", { get: function () { return this._getOption('dashStyle'); }, set: function (value) { this._setOption('dashStyle', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoConstantLineStyleComponent.prototype, "label", { get: function () { return this._getOption('label'); }, set: function (value) { this._setOption('label', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoConstantLineStyleComponent.prototype, "paddingLeftRight", { get: function () { return this._getOption('paddingLeftRight'); }, set: function (value) { this._setOption('paddingLeftRight', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoConstantLineStyleComponent.prototype, "paddingTopBottom", { get: function () { return this._getOption('paddingTopBottom'); }, set: function (value) { this._setOption('paddingTopBottom', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoConstantLineStyleComponent.prototype, "width", { get: function () { return this._getOption('width'); }, set: function (value) { this._setOption('width', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoConstantLineStyleComponent.prototype, "_optionPath", { get: function () { return 'constantLineStyle'; }, enumerable: true, configurable: true }); DxoConstantLineStyleComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dxo-constant-line-style', template: '', styles: [''], providers: [nested_option_1.NestedOptionHost] },] }, ]; /** @nocollapse */ DxoConstantLineStyleComponent.ctorParameters = function () { return [ { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.SkipSelf }, { type: core_1.Host },] }, { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.Host },] }, ]; }; DxoConstantLineStyleComponent.propDecorators = { 'color': [{ type: core_1.Input },], 'dashStyle': [{ type: core_1.Input },], 'label': [{ type: core_1.Input },], 'paddingLeftRight': [{ type: core_1.Input },], 'paddingTopBottom': [{ type: core_1.Input },], 'width': [{ type: core_1.Input },], }; return DxoConstantLineStyleComponent; }(nested_option_2.NestedOption)); exports.DxoConstantLineStyleComponent = DxoConstantLineStyleComponent; var DxoConstantLineStyleModule = (function () { function DxoConstantLineStyleModule() { } DxoConstantLineStyleModule.decorators = [ { type: core_1.NgModule, args: [{ declarations: [ DxoConstantLineStyleComponent ], exports: [ DxoConstantLineStyleComponent ], },] }, ]; /** @nocollapse */ DxoConstantLineStyleModule.ctorParameters = function () { return []; }; return DxoConstantLineStyleModule; }()); exports.DxoConstantLineStyleModule = DxoConstantLineStyleModule; //# sourceMappingURL=constant-line-style.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/control-bar.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var nested_option_2 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var DxoControlBarComponent = (function (_super) { __extends(DxoControlBarComponent, _super); function DxoControlBarComponent(parentOptionHost, optionHost) { var _this = _super.call(this) || this; parentOptionHost.setNestedOption(_this); optionHost.setHost(_this, _this._fullOptionPath.bind(_this)); return _this; } Object.defineProperty(DxoControlBarComponent.prototype, "borderColor", { get: function () { return this._getOption('borderColor'); }, set: function (value) { this._setOption('borderColor', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoControlBarComponent.prototype, "color", { get: function () { return this._getOption('color'); }, set: function (value) { this._setOption('color', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoControlBarComponent.prototype, "enabled", { get: function () { return this._getOption('enabled'); }, set: function (value) { this._setOption('enabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoControlBarComponent.prototype, "horizontalAlignment", { get: function () { return this._getOption('horizontalAlignment'); }, set: function (value) { this._setOption('horizontalAlignment', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoControlBarComponent.prototype, "margin", { get: function () { return this._getOption('margin'); }, set: function (value) { this._setOption('margin', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoControlBarComponent.prototype, "opacity", { get: function () { return this._getOption('opacity'); }, set: function (value) { this._setOption('opacity', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoControlBarComponent.prototype, "verticalAlignment", { get: function () { return this._getOption('verticalAlignment'); }, set: function (value) { this._setOption('verticalAlignment', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoControlBarComponent.prototype, "_optionPath", { get: function () { return 'controlBar'; }, enumerable: true, configurable: true }); DxoControlBarComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dxo-control-bar', template: '', styles: [''], providers: [nested_option_1.NestedOptionHost] },] }, ]; /** @nocollapse */ DxoControlBarComponent.ctorParameters = function () { return [ { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.SkipSelf }, { type: core_1.Host },] }, { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.Host },] }, ]; }; DxoControlBarComponent.propDecorators = { 'borderColor': [{ type: core_1.Input },], 'color': [{ type: core_1.Input },], 'enabled': [{ type: core_1.Input },], 'horizontalAlignment': [{ type: core_1.Input },], 'margin': [{ type: core_1.Input },], 'opacity': [{ type: core_1.Input },], 'verticalAlignment': [{ type: core_1.Input },], }; return DxoControlBarComponent; }(nested_option_2.NestedOption)); exports.DxoControlBarComponent = DxoControlBarComponent; var DxoControlBarModule = (function () { function DxoControlBarModule() { } DxoControlBarModule.decorators = [ { type: core_1.NgModule, args: [{ declarations: [ DxoControlBarComponent ], exports: [ DxoControlBarComponent ], },] }, ]; /** @nocollapse */ DxoControlBarModule.ctorParameters = function () { return []; }; return DxoControlBarModule; }()); exports.DxoControlBarModule = DxoControlBarModule; //# sourceMappingURL=control-bar.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/crosshair.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var nested_option_2 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var DxoCrosshairComponent = (function (_super) { __extends(DxoCrosshairComponent, _super); function DxoCrosshairComponent(parentOptionHost, optionHost) { var _this = _super.call(this) || this; parentOptionHost.setNestedOption(_this); optionHost.setHost(_this, _this._fullOptionPath.bind(_this)); return _this; } Object.defineProperty(DxoCrosshairComponent.prototype, "color", { get: function () { return this._getOption('color'); }, set: function (value) { this._setOption('color', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoCrosshairComponent.prototype, "dashStyle", { get: function () { return this._getOption('dashStyle'); }, set: function (value) { this._setOption('dashStyle', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoCrosshairComponent.prototype, "enabled", { get: function () { return this._getOption('enabled'); }, set: function (value) { this._setOption('enabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoCrosshairComponent.prototype, "horizontalLine", { get: function () { return this._getOption('horizontalLine'); }, set: function (value) { this._setOption('horizontalLine', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoCrosshairComponent.prototype, "label", { get: function () { return this._getOption('label'); }, set: function (value) { this._setOption('label', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoCrosshairComponent.prototype, "opacity", { get: function () { return this._getOption('opacity'); }, set: function (value) { this._setOption('opacity', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoCrosshairComponent.prototype, "verticalLine", { get: function () { return this._getOption('verticalLine'); }, set: function (value) { this._setOption('verticalLine', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoCrosshairComponent.prototype, "width", { get: function () { return this._getOption('width'); }, set: function (value) { this._setOption('width', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoCrosshairComponent.prototype, "_optionPath", { get: function () { return 'crosshair'; }, enumerable: true, configurable: true }); DxoCrosshairComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dxo-crosshair', template: '', styles: [''], providers: [nested_option_1.NestedOptionHost] },] }, ]; /** @nocollapse */ DxoCrosshairComponent.ctorParameters = function () { return [ { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.SkipSelf }, { type: core_1.Host },] }, { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.Host },] }, ]; }; DxoCrosshairComponent.propDecorators = { 'color': [{ type: core_1.Input },], 'dashStyle': [{ type: core_1.Input },], 'enabled': [{ type: core_1.Input },], 'horizontalLine': [{ type: core_1.Input },], 'label': [{ type: core_1.Input },], 'opacity': [{ type: core_1.Input },], 'verticalLine': [{ type: core_1.Input },], 'width': [{ type: core_1.Input },], }; return DxoCrosshairComponent; }(nested_option_2.NestedOption)); exports.DxoCrosshairComponent = DxoCrosshairComponent; var DxoCrosshairModule = (function () { function DxoCrosshairModule() { } DxoCrosshairModule.decorators = [ { type: core_1.NgModule, args: [{ declarations: [ DxoCrosshairComponent ], exports: [ DxoCrosshairComponent ], },] }, ]; /** @nocollapse */ DxoCrosshairModule.ctorParameters = function () { return []; }; return DxoCrosshairModule; }()); exports.DxoCrosshairModule = DxoCrosshairModule; //# sourceMappingURL=crosshair.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/data-prepare-settings.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var nested_option_2 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var DxoDataPrepareSettingsComponent = (function (_super) { __extends(DxoDataPrepareSettingsComponent, _super); function DxoDataPrepareSettingsComponent(parentOptionHost, optionHost) { var _this = _super.call(this) || this; parentOptionHost.setNestedOption(_this); optionHost.setHost(_this, _this._fullOptionPath.bind(_this)); return _this; } Object.defineProperty(DxoDataPrepareSettingsComponent.prototype, "checkTypeForAllData", { get: function () { return this._getOption('checkTypeForAllData'); }, set: function (value) { this._setOption('checkTypeForAllData', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoDataPrepareSettingsComponent.prototype, "convertToAxisDataType", { get: function () { return this._getOption('convertToAxisDataType'); }, set: function (value) { this._setOption('convertToAxisDataType', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoDataPrepareSettingsComponent.prototype, "sortingMethod", { get: function () { return this._getOption('sortingMethod'); }, set: function (value) { this._setOption('sortingMethod', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoDataPrepareSettingsComponent.prototype, "_optionPath", { get: function () { return 'dataPrepareSettings'; }, enumerable: true, configurable: true }); DxoDataPrepareSettingsComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dxo-data-prepare-settings', template: '', styles: [''], providers: [nested_option_1.NestedOptionHost] },] }, ]; /** @nocollapse */ DxoDataPrepareSettingsComponent.ctorParameters = function () { return [ { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.SkipSelf }, { type: core_1.Host },] }, { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.Host },] }, ]; }; DxoDataPrepareSettingsComponent.propDecorators = { 'checkTypeForAllData': [{ type: core_1.Input },], 'convertToAxisDataType': [{ type: core_1.Input },], 'sortingMethod': [{ type: core_1.Input },], }; return DxoDataPrepareSettingsComponent; }(nested_option_2.NestedOption)); exports.DxoDataPrepareSettingsComponent = DxoDataPrepareSettingsComponent; var DxoDataPrepareSettingsModule = (function () { function DxoDataPrepareSettingsModule() { } DxoDataPrepareSettingsModule.decorators = [ { type: core_1.NgModule, args: [{ declarations: [ DxoDataPrepareSettingsComponent ], exports: [ DxoDataPrepareSettingsComponent ], },] }, ]; /** @nocollapse */ DxoDataPrepareSettingsModule.ctorParameters = function () { return []; }; return DxoDataPrepareSettingsModule; }()); exports.DxoDataPrepareSettingsModule = DxoDataPrepareSettingsModule; //# sourceMappingURL=data-prepare-settings.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/data-source.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); /* tslint:disable:use-input-property-decorator */ var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var pivot_grid_data_source_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/base/pivot-grid-data-source.js"); var field_dxi_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/field-dxi.js"); var DxoDataSourceComponent = (function (_super) { __extends(DxoDataSourceComponent, _super); function DxoDataSourceComponent(parentOptionHost, optionHost) { var _this = _super.call(this) || this; parentOptionHost.setNestedOption(_this); optionHost.setHost(_this, _this._fullOptionPath.bind(_this)); if ((console) && (console.warn)) { console.warn('The nested \'dxo-data-source\' component is deprecated in 17.2. ' + 'Use the \'dataSource\' option instead. ' + 'See:\nhttps://github.com/DevExpress/devextreme-angular/blob/master/CHANGELOG.md#17.2.3'); } return _this; } Object.defineProperty(DxoDataSourceComponent.prototype, "_optionPath", { get: function () { return 'dataSource'; }, enumerable: true, configurable: true }); Object.defineProperty(DxoDataSourceComponent.prototype, "fieldsChildren", { get: function () { return this._getOption('fields'); }, set: function (value) { this.setChildren('fields', value); }, enumerable: true, configurable: true }); DxoDataSourceComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dxo-data-source', template: '', styles: [''], providers: [nested_option_1.NestedOptionHost], inputs: [ 'fields', 'filter', 'onChanged', 'onFieldsPrepared', 'onLoadError', 'onLoadingChanged', 'remoteOperations', 'retrieveFields', 'store' ] },] }, ]; /** @nocollapse */ DxoDataSourceComponent.ctorParameters = function () { return [ { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.SkipSelf }, { type: core_1.Host },] }, { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.Host },] }, ]; }; DxoDataSourceComponent.propDecorators = { 'fieldsChildren': [{ type: core_1.ContentChildren, args: [core_1.forwardRef(function () { return field_dxi_1.DxiFieldComponent; }),] },], }; return DxoDataSourceComponent; }(pivot_grid_data_source_1.DxoPivotGridDataSource)); exports.DxoDataSourceComponent = DxoDataSourceComponent; var DxoDataSourceModule = (function () { function DxoDataSourceModule() { } DxoDataSourceModule.decorators = [ { type: core_1.NgModule, args: [{ declarations: [ DxoDataSourceComponent ], exports: [ DxoDataSourceComponent ], },] }, ]; /** @nocollapse */ DxoDataSourceModule.ctorParameters = function () { return []; }; return DxoDataSourceModule; }()); exports.DxoDataSourceModule = DxoDataSourceModule; //# sourceMappingURL=data-source.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/delay.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var nested_option_2 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var DxoDelayComponent = (function (_super) { __extends(DxoDelayComponent, _super); function DxoDelayComponent(parentOptionHost, optionHost) { var _this = _super.call(this) || this; parentOptionHost.setNestedOption(_this); optionHost.setHost(_this, _this._fullOptionPath.bind(_this)); return _this; } Object.defineProperty(DxoDelayComponent.prototype, "hide", { get: function () { return this._getOption('hide'); }, set: function (value) { this._setOption('hide', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoDelayComponent.prototype, "show", { get: function () { return this._getOption('show'); }, set: function (value) { this._setOption('show', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoDelayComponent.prototype, "_optionPath", { get: function () { return 'delay'; }, enumerable: true, configurable: true }); DxoDelayComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dxo-delay', template: '', styles: [''], providers: [nested_option_1.NestedOptionHost] },] }, ]; /** @nocollapse */ DxoDelayComponent.ctorParameters = function () { return [ { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.SkipSelf }, { type: core_1.Host },] }, { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.Host },] }, ]; }; DxoDelayComponent.propDecorators = { 'hide': [{ type: core_1.Input },], 'show': [{ type: core_1.Input },], }; return DxoDelayComponent; }(nested_option_2.NestedOption)); exports.DxoDelayComponent = DxoDelayComponent; var DxoDelayModule = (function () { function DxoDelayModule() { } DxoDelayModule.decorators = [ { type: core_1.NgModule, args: [{ declarations: [ DxoDelayComponent ], exports: [ DxoDelayComponent ], },] }, ]; /** @nocollapse */ DxoDelayModule.ctorParameters = function () { return []; }; return DxoDelayModule; }()); exports.DxoDelayModule = DxoDelayModule; //# sourceMappingURL=delay.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/display-format.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); /* tslint:disable:use-input-property-decorator */ var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var format_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/base/format.js"); var DxoDisplayFormatComponent = (function (_super) { __extends(DxoDisplayFormatComponent, _super); function DxoDisplayFormatComponent(parentOptionHost, optionHost) { var _this = _super.call(this) || this; parentOptionHost.setNestedOption(_this); optionHost.setHost(_this, _this._fullOptionPath.bind(_this)); return _this; } Object.defineProperty(DxoDisplayFormatComponent.prototype, "_optionPath", { get: function () { return 'displayFormat'; }, enumerable: true, configurable: true }); DxoDisplayFormatComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dxo-display-format', template: '', styles: [''], providers: [nested_option_1.NestedOptionHost], inputs: [ 'currency', 'formatter', 'parser', 'precision', 'type' ] },] }, ]; /** @nocollapse */ DxoDisplayFormatComponent.ctorParameters = function () { return [ { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.SkipSelf }, { type: core_1.Host },] }, { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.Host },] }, ]; }; return DxoDisplayFormatComponent; }(format_1.DxoFormat)); exports.DxoDisplayFormatComponent = DxoDisplayFormatComponent; var DxoDisplayFormatModule = (function () { function DxoDisplayFormatModule() { } DxoDisplayFormatModule.decorators = [ { type: core_1.NgModule, args: [{ declarations: [ DxoDisplayFormatComponent ], exports: [ DxoDisplayFormatComponent ], },] }, ]; /** @nocollapse */ DxoDisplayFormatModule.ctorParameters = function () { return []; }; return DxoDisplayFormatModule; }()); exports.DxoDisplayFormatModule = DxoDisplayFormatModule; //# sourceMappingURL=display-format.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/drop-down-options.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); /* tslint:disable:use-input-property-decorator */ var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var popup_options_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/base/popup-options.js"); var toolbar_item_dxi_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/toolbar-item-dxi.js"); var DxoDropDownOptionsComponent = (function (_super) { __extends(DxoDropDownOptionsComponent, _super); function DxoDropDownOptionsComponent(parentOptionHost, optionHost) { var _this = _super.call(this) || this; parentOptionHost.setNestedOption(_this); optionHost.setHost(_this, _this._fullOptionPath.bind(_this)); return _this; } Object.defineProperty(DxoDropDownOptionsComponent.prototype, "_optionPath", { get: function () { return 'dropDownOptions'; }, enumerable: true, configurable: true }); Object.defineProperty(DxoDropDownOptionsComponent.prototype, "toolbarItemsChildren", { get: function () { return this._getOption('toolbarItems'); }, set: function (value) { this.setChildren('toolbarItems', value); }, enumerable: true, configurable: true }); DxoDropDownOptionsComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dxo-drop-down-options', template: '', styles: [''], providers: [nested_option_1.NestedOptionHost], inputs: [ 'accessKey', 'animation', 'buttons', 'closeOnBackButton', 'closeOnOutsideClick', 'contentTemplate', 'deferRendering', 'disabled', 'dragEnabled', 'elementAttr', 'focusStateEnabled', 'fullScreen', 'height', 'hint', 'hoverStateEnabled', 'maxHeight', 'maxWidth', 'minHeight', 'minWidth', 'onContentReady', 'onDisposing', 'onHidden', 'onHiding', 'onInitialized', 'onOptionChanged', 'onResize', 'onResizeEnd', 'onResizeStart', 'onShowing', 'onShown', 'onTitleRendered', 'position', 'resizeEnabled', 'rtlEnabled', 'shading', 'shadingColor', 'showCloseButton', 'showTitle', 'tabIndex', 'title', 'titleTemplate', 'toolbarItems', 'visible', 'width' ] },] }, ]; /** @nocollapse */ DxoDropDownOptionsComponent.ctorParameters = function () { return [ { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.SkipSelf }, { type: core_1.Host },] }, { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.Host },] }, ]; }; DxoDropDownOptionsComponent.propDecorators = { 'toolbarItemsChildren': [{ type: core_1.ContentChildren, args: [core_1.forwardRef(function () { return toolbar_item_dxi_1.DxiToolbarItemComponent; }),] },], }; return DxoDropDownOptionsComponent; }(popup_options_1.DxoPopupOptions)); exports.DxoDropDownOptionsComponent = DxoDropDownOptionsComponent; var DxoDropDownOptionsModule = (function () { function DxoDropDownOptionsModule() { } DxoDropDownOptionsModule.decorators = [ { type: core_1.NgModule, args: [{ declarations: [ DxoDropDownOptionsComponent ], exports: [ DxoDropDownOptionsComponent ], },] }, ]; /** @nocollapse */ DxoDropDownOptionsModule.ctorParameters = function () { return []; }; return DxoDropDownOptionsModule; }()); exports.DxoDropDownOptionsModule = DxoDropDownOptionsModule; //# sourceMappingURL=drop-down-options.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/editing.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var nested_option_2 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var DxoEditingComponent = (function (_super) { __extends(DxoEditingComponent, _super); function DxoEditingComponent(parentOptionHost, optionHost) { var _this = _super.call(this) || this; parentOptionHost.setNestedOption(_this); optionHost.setHost(_this, _this._fullOptionPath.bind(_this)); return _this; } Object.defineProperty(DxoEditingComponent.prototype, "allowAdding", { get: function () { return this._getOption('allowAdding'); }, set: function (value) { this._setOption('allowAdding', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoEditingComponent.prototype, "allowDeleting", { get: function () { return this._getOption('allowDeleting'); }, set: function (value) { this._setOption('allowDeleting', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoEditingComponent.prototype, "allowUpdating", { get: function () { return this._getOption('allowUpdating'); }, set: function (value) { this._setOption('allowUpdating', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoEditingComponent.prototype, "editEnabled", { get: function () { return this._getOption('editEnabled'); }, set: function (value) { this._setOption('editEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoEditingComponent.prototype, "editMode", { get: function () { return this._getOption('editMode'); }, set: function (value) { this._setOption('editMode', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoEditingComponent.prototype, "form", { get: function () { return this._getOption('form'); }, set: function (value) { this._setOption('form', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoEditingComponent.prototype, "insertEnabled", { get: function () { return this._getOption('insertEnabled'); }, set: function (value) { this._setOption('insertEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoEditingComponent.prototype, "mode", { get: function () { return this._getOption('mode'); }, set: function (value) { this._setOption('mode', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoEditingComponent.prototype, "popup", { get: function () { return this._getOption('popup'); }, set: function (value) { this._setOption('popup', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoEditingComponent.prototype, "removeEnabled", { get: function () { return this._getOption('removeEnabled'); }, set: function (value) { this._setOption('removeEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoEditingComponent.prototype, "texts", { get: function () { return this._getOption('texts'); }, set: function (value) { this._setOption('texts', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoEditingComponent.prototype, "allowDragging", { get: function () { return this._getOption('allowDragging'); }, set: function (value) { this._setOption('allowDragging', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoEditingComponent.prototype, "allowResizing", { get: function () { return this._getOption('allowResizing'); }, set: function (value) { this._setOption('allowResizing', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoEditingComponent.prototype, "_optionPath", { get: function () { return 'editing'; }, enumerable: true, configurable: true }); DxoEditingComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dxo-editing', template: '', styles: [''], providers: [nested_option_1.NestedOptionHost] },] }, ]; /** @nocollapse */ DxoEditingComponent.ctorParameters = function () { return [ { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.SkipSelf }, { type: core_1.Host },] }, { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.Host },] }, ]; }; DxoEditingComponent.propDecorators = { 'allowAdding': [{ type: core_1.Input },], 'allowDeleting': [{ type: core_1.Input },], 'allowUpdating': [{ type: core_1.Input },], 'editEnabled': [{ type: core_1.Input },], 'editMode': [{ type: core_1.Input },], 'form': [{ type: core_1.Input },], 'insertEnabled': [{ type: core_1.Input },], 'mode': [{ type: core_1.Input },], 'popup': [{ type: core_1.Input },], 'removeEnabled': [{ type: core_1.Input },], 'texts': [{ type: core_1.Input },], 'allowDragging': [{ type: core_1.Input },], 'allowResizing': [{ type: core_1.Input },], }; return DxoEditingComponent; }(nested_option_2.NestedOption)); exports.DxoEditingComponent = DxoEditingComponent; var DxoEditingModule = (function () { function DxoEditingModule() { } DxoEditingModule.decorators = [ { type: core_1.NgModule, args: [{ declarations: [ DxoEditingComponent ], exports: [ DxoEditingComponent ], },] }, ]; /** @nocollapse */ DxoEditingModule.ctorParameters = function () { return []; }; return DxoEditingModule; }()); exports.DxoEditingModule = DxoEditingModule; //# sourceMappingURL=editing.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/export.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var nested_option_2 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var DxoExportComponent = (function (_super) { __extends(DxoExportComponent, _super); function DxoExportComponent(parentOptionHost, optionHost) { var _this = _super.call(this) || this; parentOptionHost.setNestedOption(_this); optionHost.setHost(_this, _this._fullOptionPath.bind(_this)); return _this; } Object.defineProperty(DxoExportComponent.prototype, "backgroundColor", { get: function () { return this._getOption('backgroundColor'); }, set: function (value) { this._setOption('backgroundColor', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoExportComponent.prototype, "enabled", { get: function () { return this._getOption('enabled'); }, set: function (value) { this._setOption('enabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoExportComponent.prototype, "fileName", { get: function () { return this._getOption('fileName'); }, set: function (value) { this._setOption('fileName', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoExportComponent.prototype, "formats", { get: function () { return this._getOption('formats'); }, set: function (value) { this._setOption('formats', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoExportComponent.prototype, "printingEnabled", { get: function () { return this._getOption('printingEnabled'); }, set: function (value) { this._setOption('printingEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoExportComponent.prototype, "proxyUrl", { get: function () { return this._getOption('proxyUrl'); }, set: function (value) { this._setOption('proxyUrl', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoExportComponent.prototype, "allowExportSelectedData", { get: function () { return this._getOption('allowExportSelectedData'); }, set: function (value) { this._setOption('allowExportSelectedData', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoExportComponent.prototype, "excelFilterEnabled", { get: function () { return this._getOption('excelFilterEnabled'); }, set: function (value) { this._setOption('excelFilterEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoExportComponent.prototype, "excelWrapTextEnabled", { get: function () { return this._getOption('excelWrapTextEnabled'); }, set: function (value) { this._setOption('excelWrapTextEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoExportComponent.prototype, "texts", { get: function () { return this._getOption('texts'); }, set: function (value) { this._setOption('texts', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoExportComponent.prototype, "_optionPath", { get: function () { return 'export'; }, enumerable: true, configurable: true }); DxoExportComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dxo-export', template: '', styles: [''], providers: [nested_option_1.NestedOptionHost] },] }, ]; /** @nocollapse */ DxoExportComponent.ctorParameters = function () { return [ { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.SkipSelf }, { type: core_1.Host },] }, { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.Host },] }, ]; }; DxoExportComponent.propDecorators = { 'backgroundColor': [{ type: core_1.Input },], 'enabled': [{ type: core_1.Input },], 'fileName': [{ type: core_1.Input },], 'formats': [{ type: core_1.Input },], 'printingEnabled': [{ type: core_1.Input },], 'proxyUrl': [{ type: core_1.Input },], 'allowExportSelectedData': [{ type: core_1.Input },], 'excelFilterEnabled': [{ type: core_1.Input },], 'excelWrapTextEnabled': [{ type: core_1.Input },], 'texts': [{ type: core_1.Input },], }; return DxoExportComponent; }(nested_option_2.NestedOption)); exports.DxoExportComponent = DxoExportComponent; var DxoExportModule = (function () { function DxoExportModule() { } DxoExportModule.decorators = [ { type: core_1.NgModule, args: [{ declarations: [ DxoExportComponent ], exports: [ DxoExportComponent ], },] }, ]; /** @nocollapse */ DxoExportModule.ctorParameters = function () { return []; }; return DxoExportModule; }()); exports.DxoExportModule = DxoExportModule; //# sourceMappingURL=export.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/field-chooser.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var nested_option_2 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var DxoFieldChooserComponent = (function (_super) { __extends(DxoFieldChooserComponent, _super); function DxoFieldChooserComponent(parentOptionHost, optionHost) { var _this = _super.call(this) || this; parentOptionHost.setNestedOption(_this); optionHost.setHost(_this, _this._fullOptionPath.bind(_this)); return _this; } Object.defineProperty(DxoFieldChooserComponent.prototype, "allowSearch", { get: function () { return this._getOption('allowSearch'); }, set: function (value) { this._setOption('allowSearch', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFieldChooserComponent.prototype, "enabled", { get: function () { return this._getOption('enabled'); }, set: function (value) { this._setOption('enabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFieldChooserComponent.prototype, "height", { get: function () { return this._getOption('height'); }, set: function (value) { this._setOption('height', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFieldChooserComponent.prototype, "layout", { get: function () { return this._getOption('layout'); }, set: function (value) { this._setOption('layout', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFieldChooserComponent.prototype, "texts", { get: function () { return this._getOption('texts'); }, set: function (value) { this._setOption('texts', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFieldChooserComponent.prototype, "title", { get: function () { return this._getOption('title'); }, set: function (value) { this._setOption('title', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFieldChooserComponent.prototype, "width", { get: function () { return this._getOption('width'); }, set: function (value) { this._setOption('width', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFieldChooserComponent.prototype, "_optionPath", { get: function () { return 'fieldChooser'; }, enumerable: true, configurable: true }); DxoFieldChooserComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dxo-field-chooser', template: '', styles: [''], providers: [nested_option_1.NestedOptionHost] },] }, ]; /** @nocollapse */ DxoFieldChooserComponent.ctorParameters = function () { return [ { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.SkipSelf }, { type: core_1.Host },] }, { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.Host },] }, ]; }; DxoFieldChooserComponent.propDecorators = { 'allowSearch': [{ type: core_1.Input },], 'enabled': [{ type: core_1.Input },], 'height': [{ type: core_1.Input },], 'layout': [{ type: core_1.Input },], 'texts': [{ type: core_1.Input },], 'title': [{ type: core_1.Input },], 'width': [{ type: core_1.Input },], }; return DxoFieldChooserComponent; }(nested_option_2.NestedOption)); exports.DxoFieldChooserComponent = DxoFieldChooserComponent; var DxoFieldChooserModule = (function () { function DxoFieldChooserModule() { } DxoFieldChooserModule.decorators = [ { type: core_1.NgModule, args: [{ declarations: [ DxoFieldChooserComponent ], exports: [ DxoFieldChooserComponent ], },] }, ]; /** @nocollapse */ DxoFieldChooserModule.ctorParameters = function () { return []; }; return DxoFieldChooserModule; }()); exports.DxoFieldChooserModule = DxoFieldChooserModule; //# sourceMappingURL=field-chooser.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/field-dxi.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); /* tslint:disable:use-input-property-decorator */ var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var filter_builder_field_dxi_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/base/filter-builder-field-dxi.js"); var DxiFieldComponent = (function (_super) { __extends(DxiFieldComponent, _super); function DxiFieldComponent(parentOptionHost, optionHost) { var _this = _super.call(this) || this; parentOptionHost.setNestedOption(_this); optionHost.setHost(_this, _this._fullOptionPath.bind(_this)); return _this; } Object.defineProperty(DxiFieldComponent.prototype, "_optionPath", { get: function () { return 'fields'; }, enumerable: true, configurable: true }); DxiFieldComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dxi-field', template: '', styles: [''], providers: [nested_option_1.NestedOptionHost], inputs: [ 'caption', 'customizeText', 'dataField', 'dataType', 'editorOptions', 'editorTemplate', 'falseText', 'filterOperations', 'format', 'lookup', 'trueText', 'allowCrossGroupCalculation', 'allowExpandAll', 'allowFiltering', 'allowSorting', 'allowSortingBySummary', 'area', 'areaIndex', 'calculateCustomSummary', 'calculateSummaryValue', 'displayFolder', 'expanded', 'filterType', 'filterValues', 'groupIndex', 'groupInterval', 'groupName', 'headerFilter', 'isMeasure', 'precision', 'runningTotal', 'selector', 'showGrandTotals', 'showTotals', 'showValues', 'sortBy', 'sortBySummaryField', 'sortBySummaryPath', 'sortingMethod', 'sortOrder', 'summaryDisplayMode', 'summaryType', 'visible', 'width', 'wordWrapEnabled' ] },] }, ]; /** @nocollapse */ DxiFieldComponent.ctorParameters = function () { return [ { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.SkipSelf }, { type: core_1.Host },] }, { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.Host },] }, ]; }; return DxiFieldComponent; }(filter_builder_field_dxi_1.DxiFilterBuilderField)); exports.DxiFieldComponent = DxiFieldComponent; var DxiFieldModule = (function () { function DxiFieldModule() { } DxiFieldModule.decorators = [ { type: core_1.NgModule, args: [{ declarations: [ DxiFieldComponent ], exports: [ DxiFieldComponent ], },] }, ]; /** @nocollapse */ DxiFieldModule.ctorParameters = function () { return []; }; return DxiFieldModule; }()); exports.DxiFieldModule = DxiFieldModule; //# sourceMappingURL=field-dxi.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/field-panel.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var nested_option_2 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var DxoFieldPanelComponent = (function (_super) { __extends(DxoFieldPanelComponent, _super); function DxoFieldPanelComponent(parentOptionHost, optionHost) { var _this = _super.call(this) || this; parentOptionHost.setNestedOption(_this); optionHost.setHost(_this, _this._fullOptionPath.bind(_this)); return _this; } Object.defineProperty(DxoFieldPanelComponent.prototype, "allowFieldDragging", { get: function () { return this._getOption('allowFieldDragging'); }, set: function (value) { this._setOption('allowFieldDragging', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFieldPanelComponent.prototype, "showColumnFields", { get: function () { return this._getOption('showColumnFields'); }, set: function (value) { this._setOption('showColumnFields', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFieldPanelComponent.prototype, "showDataFields", { get: function () { return this._getOption('showDataFields'); }, set: function (value) { this._setOption('showDataFields', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFieldPanelComponent.prototype, "showFilterFields", { get: function () { return this._getOption('showFilterFields'); }, set: function (value) { this._setOption('showFilterFields', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFieldPanelComponent.prototype, "showRowFields", { get: function () { return this._getOption('showRowFields'); }, set: function (value) { this._setOption('showRowFields', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFieldPanelComponent.prototype, "texts", { get: function () { return this._getOption('texts'); }, set: function (value) { this._setOption('texts', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFieldPanelComponent.prototype, "visible", { get: function () { return this._getOption('visible'); }, set: function (value) { this._setOption('visible', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFieldPanelComponent.prototype, "_optionPath", { get: function () { return 'fieldPanel'; }, enumerable: true, configurable: true }); DxoFieldPanelComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dxo-field-panel', template: '', styles: [''], providers: [nested_option_1.NestedOptionHost] },] }, ]; /** @nocollapse */ DxoFieldPanelComponent.ctorParameters = function () { return [ { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.SkipSelf }, { type: core_1.Host },] }, { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.Host },] }, ]; }; DxoFieldPanelComponent.propDecorators = { 'allowFieldDragging': [{ type: core_1.Input },], 'showColumnFields': [{ type: core_1.Input },], 'showDataFields': [{ type: core_1.Input },], 'showFilterFields': [{ type: core_1.Input },], 'showRowFields': [{ type: core_1.Input },], 'texts': [{ type: core_1.Input },], 'visible': [{ type: core_1.Input },], }; return DxoFieldPanelComponent; }(nested_option_2.NestedOption)); exports.DxoFieldPanelComponent = DxoFieldPanelComponent; var DxoFieldPanelModule = (function () { function DxoFieldPanelModule() { } DxoFieldPanelModule.decorators = [ { type: core_1.NgModule, args: [{ declarations: [ DxoFieldPanelComponent ], exports: [ DxoFieldPanelComponent ], },] }, ]; /** @nocollapse */ DxoFieldPanelModule.ctorParameters = function () { return []; }; return DxoFieldPanelModule; }()); exports.DxoFieldPanelModule = DxoFieldPanelModule; //# sourceMappingURL=field-panel.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/filter-operation-descriptions.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var nested_option_2 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var DxoFilterOperationDescriptionsComponent = (function (_super) { __extends(DxoFilterOperationDescriptionsComponent, _super); function DxoFilterOperationDescriptionsComponent(parentOptionHost, optionHost) { var _this = _super.call(this) || this; parentOptionHost.setNestedOption(_this); optionHost.setHost(_this, _this._fullOptionPath.bind(_this)); return _this; } Object.defineProperty(DxoFilterOperationDescriptionsComponent.prototype, "contains", { get: function () { return this._getOption('contains'); }, set: function (value) { this._setOption('contains', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFilterOperationDescriptionsComponent.prototype, "endsWith", { get: function () { return this._getOption('endsWith'); }, set: function (value) { this._setOption('endsWith', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFilterOperationDescriptionsComponent.prototype, "equal", { get: function () { return this._getOption('equal'); }, set: function (value) { this._setOption('equal', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFilterOperationDescriptionsComponent.prototype, "greaterThan", { get: function () { return this._getOption('greaterThan'); }, set: function (value) { this._setOption('greaterThan', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFilterOperationDescriptionsComponent.prototype, "greaterThanOrEqual", { get: function () { return this._getOption('greaterThanOrEqual'); }, set: function (value) { this._setOption('greaterThanOrEqual', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFilterOperationDescriptionsComponent.prototype, "isBlank", { get: function () { return this._getOption('isBlank'); }, set: function (value) { this._setOption('isBlank', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFilterOperationDescriptionsComponent.prototype, "isNotBlank", { get: function () { return this._getOption('isNotBlank'); }, set: function (value) { this._setOption('isNotBlank', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFilterOperationDescriptionsComponent.prototype, "lessThan", { get: function () { return this._getOption('lessThan'); }, set: function (value) { this._setOption('lessThan', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFilterOperationDescriptionsComponent.prototype, "lessThanOrEqual", { get: function () { return this._getOption('lessThanOrEqual'); }, set: function (value) { this._setOption('lessThanOrEqual', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFilterOperationDescriptionsComponent.prototype, "notContains", { get: function () { return this._getOption('notContains'); }, set: function (value) { this._setOption('notContains', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFilterOperationDescriptionsComponent.prototype, "notEqual", { get: function () { return this._getOption('notEqual'); }, set: function (value) { this._setOption('notEqual', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFilterOperationDescriptionsComponent.prototype, "startsWith", { get: function () { return this._getOption('startsWith'); }, set: function (value) { this._setOption('startsWith', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFilterOperationDescriptionsComponent.prototype, "_optionPath", { get: function () { return 'filterOperationDescriptions'; }, enumerable: true, configurable: true }); DxoFilterOperationDescriptionsComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dxo-filter-operation-descriptions', template: '', styles: [''], providers: [nested_option_1.NestedOptionHost] },] }, ]; /** @nocollapse */ DxoFilterOperationDescriptionsComponent.ctorParameters = function () { return [ { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.SkipSelf }, { type: core_1.Host },] }, { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.Host },] }, ]; }; DxoFilterOperationDescriptionsComponent.propDecorators = { 'contains': [{ type: core_1.Input },], 'endsWith': [{ type: core_1.Input },], 'equal': [{ type: core_1.Input },], 'greaterThan': [{ type: core_1.Input },], 'greaterThanOrEqual': [{ type: core_1.Input },], 'isBlank': [{ type: core_1.Input },], 'isNotBlank': [{ type: core_1.Input },], 'lessThan': [{ type: core_1.Input },], 'lessThanOrEqual': [{ type: core_1.Input },], 'notContains': [{ type: core_1.Input },], 'notEqual': [{ type: core_1.Input },], 'startsWith': [{ type: core_1.Input },], }; return DxoFilterOperationDescriptionsComponent; }(nested_option_2.NestedOption)); exports.DxoFilterOperationDescriptionsComponent = DxoFilterOperationDescriptionsComponent; var DxoFilterOperationDescriptionsModule = (function () { function DxoFilterOperationDescriptionsModule() { } DxoFilterOperationDescriptionsModule.decorators = [ { type: core_1.NgModule, args: [{ declarations: [ DxoFilterOperationDescriptionsComponent ], exports: [ DxoFilterOperationDescriptionsComponent ], },] }, ]; /** @nocollapse */ DxoFilterOperationDescriptionsModule.ctorParameters = function () { return []; }; return DxoFilterOperationDescriptionsModule; }()); exports.DxoFilterOperationDescriptionsModule = DxoFilterOperationDescriptionsModule; //# sourceMappingURL=filter-operation-descriptions.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/filter-row.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var nested_option_2 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var DxoFilterRowComponent = (function (_super) { __extends(DxoFilterRowComponent, _super); function DxoFilterRowComponent(parentOptionHost, optionHost) { var _this = _super.call(this) || this; parentOptionHost.setNestedOption(_this); optionHost.setHost(_this, _this._fullOptionPath.bind(_this)); return _this; } Object.defineProperty(DxoFilterRowComponent.prototype, "applyFilter", { get: function () { return this._getOption('applyFilter'); }, set: function (value) { this._setOption('applyFilter', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFilterRowComponent.prototype, "applyFilterText", { get: function () { return this._getOption('applyFilterText'); }, set: function (value) { this._setOption('applyFilterText', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFilterRowComponent.prototype, "betweenEndText", { get: function () { return this._getOption('betweenEndText'); }, set: function (value) { this._setOption('betweenEndText', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFilterRowComponent.prototype, "betweenStartText", { get: function () { return this._getOption('betweenStartText'); }, set: function (value) { this._setOption('betweenStartText', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFilterRowComponent.prototype, "operationDescriptions", { get: function () { return this._getOption('operationDescriptions'); }, set: function (value) { this._setOption('operationDescriptions', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFilterRowComponent.prototype, "resetOperationText", { get: function () { return this._getOption('resetOperationText'); }, set: function (value) { this._setOption('resetOperationText', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFilterRowComponent.prototype, "showAllText", { get: function () { return this._getOption('showAllText'); }, set: function (value) { this._setOption('showAllText', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFilterRowComponent.prototype, "showOperationChooser", { get: function () { return this._getOption('showOperationChooser'); }, set: function (value) { this._setOption('showOperationChooser', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFilterRowComponent.prototype, "visible", { get: function () { return this._getOption('visible'); }, set: function (value) { this._setOption('visible', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoFilterRowComponent.prototype, "_optionPath", { get: function () { return 'filterRow'; }, enumerable: true, configurable: true }); DxoFilterRowComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dxo-filter-row', template: '', styles: [''], providers: [nested_option_1.NestedOptionHost] },] }, ]; /** @nocollapse */ DxoFilterRowComponent.ctorParameters = function () { return [ { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.SkipSelf }, { type: core_1.Host },] }, { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.Host },] }, ]; }; DxoFilterRowComponent.propDecorators = { 'applyFilter': [{ type: core_1.Input },], 'applyFilterText': [{ type: core_1.Input },], 'betweenEndText': [{ type: core_1.Input },], 'betweenStartText': [{ type: core_1.Input },], 'operationDescriptions': [{ type: core_1.Input },], 'resetOperationText': [{ type: core_1.Input },], 'showAllText': [{ type: core_1.Input },], 'showOperationChooser': [{ type: core_1.Input },], 'visible': [{ type: core_1.Input },], }; return DxoFilterRowComponent; }(nested_option_2.NestedOption)); exports.DxoFilterRowComponent = DxoFilterRowComponent; var DxoFilterRowModule = (function () { function DxoFilterRowModule() { } DxoFilterRowModule.decorators = [ { type: core_1.NgModule, args: [{ declarations: [ DxoFilterRowComponent ], exports: [ DxoFilterRowComponent ], },] }, ]; /** @nocollapse */ DxoFilterRowModule.ctorParameters = function () { return []; }; return DxoFilterRowModule; }()); exports.DxoFilterRowModule = DxoFilterRowModule; //# sourceMappingURL=filter-row.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/font.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); /* tslint:disable:use-input-property-decorator */ var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var viz_font_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/base/viz-font.js"); var DxoFontComponent = (function (_super) { __extends(DxoFontComponent, _super); function DxoFontComponent(parentOptionHost, optionHost) { var _this = _super.call(this) || this; parentOptionHost.setNestedOption(_this); optionHost.setHost(_this, _this._fullOptionPath.bind(_this)); return _this; } Object.defineProperty(DxoFontComponent.prototype, "_optionPath", { get: function () { return 'font'; }, enumerable: true, configurable: true }); DxoFontComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dxo-font', template: '', styles: [''], providers: [nested_option_1.NestedOptionHost], inputs: [ 'color', 'family', 'opacity', 'size', 'weight' ] },] }, ]; /** @nocollapse */ DxoFontComponent.ctorParameters = function () { return [ { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.SkipSelf }, { type: core_1.Host },] }, { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.Host },] }, ]; }; return DxoFontComponent; }(viz_font_1.DxoVizFont)); exports.DxoFontComponent = DxoFontComponent; var DxoFontModule = (function () { function DxoFontModule() { } DxoFontModule.decorators = [ { type: core_1.NgModule, args: [{ declarations: [ DxoFontComponent ], exports: [ DxoFontComponent ], },] }, ]; /** @nocollapse */ DxoFontModule.ctorParameters = function () { return []; }; return DxoFontModule; }()); exports.DxoFontModule = DxoFontModule; //# sourceMappingURL=font.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/form-item.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); /* tslint:disable:use-input-property-decorator */ var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var form_simple_item_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/base/form-simple-item.js"); var validation_rule_dxi_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/validation-rule-dxi.js"); var DxoFormItemComponent = (function (_super) { __extends(DxoFormItemComponent, _super); function DxoFormItemComponent(parentOptionHost, optionHost) { var _this = _super.call(this) || this; parentOptionHost.setNestedOption(_this); optionHost.setHost(_this, _this._fullOptionPath.bind(_this)); return _this; } Object.defineProperty(DxoFormItemComponent.prototype, "_optionPath", { get: function () { return 'formItem'; }, enumerable: true, configurable: true }); Object.defineProperty(DxoFormItemComponent.prototype, "validationRulesChildren", { get: function () { return this._getOption('validationRules'); }, set: function (value) { this.setChildren('validationRules', value); }, enumerable: true, configurable: true }); DxoFormItemComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dxo-form-item', template: '', styles: [''], providers: [nested_option_1.NestedOptionHost], inputs: [ 'colSpan', 'cssClass', 'dataField', 'editorOptions', 'editorType', 'helpText', 'isRequired', 'itemType', 'label', 'name', 'template', 'validationRules', 'visible', 'visibleIndex' ] },] }, ]; /** @nocollapse */ DxoFormItemComponent.ctorParameters = function () { return [ { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.SkipSelf }, { type: core_1.Host },] }, { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.Host },] }, ]; }; DxoFormItemComponent.propDecorators = { 'validationRulesChildren': [{ type: core_1.ContentChildren, args: [core_1.forwardRef(function () { return validation_rule_dxi_1.DxiValidationRuleComponent; }),] },], }; return DxoFormItemComponent; }(form_simple_item_1.DxoFormSimpleItem)); exports.DxoFormItemComponent = DxoFormItemComponent; var DxoFormItemModule = (function () { function DxoFormItemModule() { } DxoFormItemModule.decorators = [ { type: core_1.NgModule, args: [{ declarations: [ DxoFormItemComponent ], exports: [ DxoFormItemComponent ], },] }, ]; /** @nocollapse */ DxoFormItemModule.ctorParameters = function () { return []; }; return DxoFormItemModule; }()); exports.DxoFormItemModule = DxoFormItemModule; //# sourceMappingURL=form-item.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/form.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); /* tslint:disable:use-input-property-decorator */ var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var form_options_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/base/form-options.js"); var item_dxi_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/item-dxi.js"); var DxoFormComponent = (function (_super) { __extends(DxoFormComponent, _super); function DxoFormComponent(parentOptionHost, optionHost) { var _this = _super.call(this) || this; parentOptionHost.setNestedOption(_this); optionHost.setHost(_this, _this._fullOptionPath.bind(_this)); return _this; } Object.defineProperty(DxoFormComponent.prototype, "_optionPath", { get: function () { return 'form'; }, enumerable: true, configurable: true }); Object.defineProperty(DxoFormComponent.prototype, "itemsChildren", { get: function () { return this._getOption('items'); }, set: function (value) { this.setChildren('items', value); }, enumerable: true, configurable: true }); DxoFormComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dxo-form', template: '', styles: [''], providers: [nested_option_1.NestedOptionHost], inputs: [ 'accessKey', 'activeStateEnabled', 'alignItemLabels', 'alignItemLabelsInAllGroups', 'colCount', 'colCountByScreen', 'customizeItem', 'disabled', 'elementAttr', 'focusStateEnabled', 'formData', 'height', 'hint', 'hoverStateEnabled', 'items', 'labelLocation', 'minColWidth', 'onContentReady', 'onDisposing', 'onEditorEnterKey', 'onFieldDataChanged', 'onInitialized', 'onOptionChanged', 'optionalMark', 'readOnly', 'requiredMark', 'requiredMessage', 'rtlEnabled', 'screenByWidth', 'scrollingEnabled', 'showColonAfterLabel', 'showOptionalMark', 'showRequiredMark', 'showValidationSummary', 'tabIndex', 'validationGroup', 'visible', 'width' ] },] }, ]; /** @nocollapse */ DxoFormComponent.ctorParameters = function () { return [ { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.SkipSelf }, { type: core_1.Host },] }, { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.Host },] }, ]; }; DxoFormComponent.propDecorators = { 'itemsChildren': [{ type: core_1.ContentChildren, args: [core_1.forwardRef(function () { return item_dxi_1.DxiItemComponent; }),] },], }; return DxoFormComponent; }(form_options_1.DxoFormOptions)); exports.DxoFormComponent = DxoFormComponent; var DxoFormModule = (function () { function DxoFormModule() { } DxoFormModule.decorators = [ { type: core_1.NgModule, args: [{ declarations: [ DxoFormComponent ], exports: [ DxoFormComponent ], },] }, ]; /** @nocollapse */ DxoFormModule.ctorParameters = function () { return []; }; return DxoFormModule; }()); exports.DxoFormModule = DxoFormModule; //# sourceMappingURL=form.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/format.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); /* tslint:disable:use-input-property-decorator */ var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var format_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/base/format.js"); var DxoFormatComponent = (function (_super) { __extends(DxoFormatComponent, _super); function DxoFormatComponent(parentOptionHost, optionHost) { var _this = _super.call(this) || this; parentOptionHost.setNestedOption(_this); optionHost.setHost(_this, _this._fullOptionPath.bind(_this)); return _this; } Object.defineProperty(DxoFormatComponent.prototype, "_optionPath", { get: function () { return 'format'; }, enumerable: true, configurable: true }); DxoFormatComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dxo-format', template: '', styles: [''], providers: [nested_option_1.NestedOptionHost], inputs: [ 'currency', 'formatter', 'parser', 'precision', 'type' ] },] }, ]; /** @nocollapse */ DxoFormatComponent.ctorParameters = function () { return [ { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.SkipSelf }, { type: core_1.Host },] }, { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.Host },] }, ]; }; return DxoFormatComponent; }(format_1.DxoFormat)); exports.DxoFormatComponent = DxoFormatComponent; var DxoFormatModule = (function () { function DxoFormatModule() { } DxoFormatModule.decorators = [ { type: core_1.NgModule, args: [{ declarations: [ DxoFormatComponent ], exports: [ DxoFormatComponent ], },] }, ]; /** @nocollapse */ DxoFormatModule.ctorParameters = function () { return []; }; return DxoFormatModule; }()); exports.DxoFormatModule = DxoFormatModule; //# sourceMappingURL=format.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/fullstackedarea.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); /* tslint:disable:use-input-property-decorator */ var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var chart_common_series_settings_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/base/chart-common-series-settings.js"); var DxoFullstackedareaComponent = (function (_super) { __extends(DxoFullstackedareaComponent, _super); function DxoFullstackedareaComponent(parentOptionHost, optionHost) { var _this = _super.call(this) || this; parentOptionHost.setNestedOption(_this); optionHost.setHost(_this, _this._fullOptionPath.bind(_this)); return _this; } Object.defineProperty(DxoFullstackedareaComponent.prototype, "_optionPath", { get: function () { return 'fullstackedarea'; }, enumerable: true, configurable: true }); DxoFullstackedareaComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dxo-fullstackedarea', template: '', styles: [''], providers: [nested_option_1.NestedOptionHost], inputs: [ 'area', 'argumentField', 'axis', 'bar', 'border', 'bubble', 'candlestick', 'closeValueField', 'color', 'cornerRadius', 'dashStyle', 'fullstackedarea', 'fullstackedbar', 'fullstackedline', 'fullstackedspline', 'fullstackedsplinearea', 'highValueField', 'hoverMode', 'hoverStyle', 'ignoreEmptyPoints', 'innerColor', 'label', 'line', 'lowValueField', 'maxLabelCount', 'minBarSize', 'opacity', 'openValueField', 'pane', 'point', 'rangearea', 'rangebar', 'rangeValue1Field', 'rangeValue2Field', 'reduction', 'scatter', 'selectionMode', 'selectionStyle', 'showInLegend', 'sizeField', 'spline', 'splinearea', 'stack', 'stackedarea', 'stackedbar', 'stackedline', 'stackedspline', 'stackedsplinearea', 'steparea', 'stepline', 'stock', 'tagField', 'type', 'valueErrorBar', 'valueField', 'visible', 'width' ] },] }, ]; /** @nocollapse */ DxoFullstackedareaComponent.ctorParameters = function () { return [ { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.SkipSelf }, { type: core_1.Host },] }, { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.Host },] }, ]; }; return DxoFullstackedareaComponent; }(chart_common_series_settings_1.DxoChartCommonSeriesSettings)); exports.DxoFullstackedareaComponent = DxoFullstackedareaComponent; var DxoFullstackedareaModule = (function () { function DxoFullstackedareaModule() { } DxoFullstackedareaModule.decorators = [ { type: core_1.NgModule, args: [{ declarations: [ DxoFullstackedareaComponent ], exports: [ DxoFullstackedareaComponent ], },] }, ]; /** @nocollapse */ DxoFullstackedareaModule.ctorParameters = function () { return []; }; return DxoFullstackedareaModule; }()); exports.DxoFullstackedareaModule = DxoFullstackedareaModule; //# sourceMappingURL=fullstackedarea.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/fullstackedbar.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); /* tslint:disable:use-input-property-decorator */ var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var chart_common_series_settings_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/base/chart-common-series-settings.js"); var DxoFullstackedbarComponent = (function (_super) { __extends(DxoFullstackedbarComponent, _super); function DxoFullstackedbarComponent(parentOptionHost, optionHost) { var _this = _super.call(this) || this; parentOptionHost.setNestedOption(_this); optionHost.setHost(_this, _this._fullOptionPath.bind(_this)); return _this; } Object.defineProperty(DxoFullstackedbarComponent.prototype, "_optionPath", { get: function () { return 'fullstackedbar'; }, enumerable: true, configurable: true }); DxoFullstackedbarComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dxo-fullstackedbar', template: '', styles: [''], providers: [nested_option_1.NestedOptionHost], inputs: [ 'area', 'argumentField', 'axis', 'bar', 'border', 'bubble', 'candlestick', 'closeValueField', 'color', 'cornerRadius', 'dashStyle', 'fullstackedarea', 'fullstackedbar', 'fullstackedline', 'fullstackedspline', 'fullstackedsplinearea', 'highValueField', 'hoverMode', 'hoverStyle', 'ignoreEmptyPoints', 'innerColor', 'label', 'line', 'lowValueField', 'maxLabelCount', 'minBarSize', 'opacity', 'openValueField', 'pane', 'point', 'rangearea', 'rangebar', 'rangeValue1Field', 'rangeValue2Field', 'reduction', 'scatter', 'selectionMode', 'selectionStyle', 'showInLegend', 'sizeField', 'spline', 'splinearea', 'stack', 'stackedarea', 'stackedbar', 'stackedline', 'stackedspline', 'stackedsplinearea', 'steparea', 'stepline', 'stock', 'tagField', 'type', 'valueErrorBar', 'valueField', 'visible', 'width' ] },] }, ]; /** @nocollapse */ DxoFullstackedbarComponent.ctorParameters = function () { return [ { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.SkipSelf }, { type: core_1.Host },] }, { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.Host },] }, ]; }; return DxoFullstackedbarComponent; }(chart_common_series_settings_1.DxoChartCommonSeriesSettings)); exports.DxoFullstackedbarComponent = DxoFullstackedbarComponent; var DxoFullstackedbarModule = (function () { function DxoFullstackedbarModule() { } DxoFullstackedbarModule.decorators = [ { type: core_1.NgModule, args: [{ declarations: [ DxoFullstackedbarComponent ], exports: [ DxoFullstackedbarComponent ], },] }, ]; /** @nocollapse */ DxoFullstackedbarModule.ctorParameters = function () { return []; }; return DxoFullstackedbarModule; }()); exports.DxoFullstackedbarModule = DxoFullstackedbarModule; //# sourceMappingURL=fullstackedbar.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/fullstackedline.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); /* tslint:disable:use-input-property-decorator */ var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var chart_common_series_settings_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/base/chart-common-series-settings.js"); var DxoFullstackedlineComponent = (function (_super) { __extends(DxoFullstackedlineComponent, _super); function DxoFullstackedlineComponent(parentOptionHost, optionHost) { var _this = _super.call(this) || this; parentOptionHost.setNestedOption(_this); optionHost.setHost(_this, _this._fullOptionPath.bind(_this)); return _this; } Object.defineProperty(DxoFullstackedlineComponent.prototype, "_optionPath", { get: function () { return 'fullstackedline'; }, enumerable: true, configurable: true }); DxoFullstackedlineComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dxo-fullstackedline', template: '', styles: [''], providers: [nested_option_1.NestedOptionHost], inputs: [ 'area', 'argumentField', 'axis', 'bar', 'border', 'bubble', 'candlestick', 'closeValueField', 'color', 'cornerRadius', 'dashStyle', 'fullstackedarea', 'fullstackedbar', 'fullstackedline', 'fullstackedspline', 'fullstackedsplinearea', 'highValueField', 'hoverMode', 'hoverStyle', 'ignoreEmptyPoints', 'innerColor', 'label', 'line', 'lowValueField', 'maxLabelCount', 'minBarSize', 'opacity', 'openValueField', 'pane', 'point', 'rangearea', 'rangebar', 'rangeValue1Field', 'rangeValue2Field', 'reduction', 'scatter', 'selectionMode', 'selectionStyle', 'showInLegend', 'sizeField', 'spline', 'splinearea', 'stack', 'stackedarea', 'stackedbar', 'stackedline', 'stackedspline', 'stackedsplinearea', 'steparea', 'stepline', 'stock', 'tagField', 'type', 'valueErrorBar', 'valueField', 'visible', 'width' ] },] }, ]; /** @nocollapse */ DxoFullstackedlineComponent.ctorParameters = function () { return [ { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.SkipSelf }, { type: core_1.Host },] }, { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.Host },] }, ]; }; return DxoFullstackedlineComponent; }(chart_common_series_settings_1.DxoChartCommonSeriesSettings)); exports.DxoFullstackedlineComponent = DxoFullstackedlineComponent; var DxoFullstackedlineModule = (function () { function DxoFullstackedlineModule() { } DxoFullstackedlineModule.decorators = [ { type: core_1.NgModule, args: [{ declarations: [ DxoFullstackedlineComponent ], exports: [ DxoFullstackedlineComponent ], },] }, ]; /** @nocollapse */ DxoFullstackedlineModule.ctorParameters = function () { return []; }; return DxoFullstackedlineModule; }()); exports.DxoFullstackedlineModule = DxoFullstackedlineModule; //# sourceMappingURL=fullstackedline.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/fullstackedspline.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); /* tslint:disable:use-input-property-decorator */ var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var chart_common_series_settings_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/base/chart-common-series-settings.js"); var DxoFullstackedsplineComponent = (function (_super) { __extends(DxoFullstackedsplineComponent, _super); function DxoFullstackedsplineComponent(parentOptionHost, optionHost) { var _this = _super.call(this) || this; parentOptionHost.setNestedOption(_this); optionHost.setHost(_this, _this._fullOptionPath.bind(_this)); return _this; } Object.defineProperty(DxoFullstackedsplineComponent.prototype, "_optionPath", { get: function () { return 'fullstackedspline'; }, enumerable: true, configurable: true }); DxoFullstackedsplineComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dxo-fullstackedspline', template: '', styles: [''], providers: [nested_option_1.NestedOptionHost], inputs: [ 'area', 'argumentField', 'axis', 'bar', 'border', 'bubble', 'candlestick', 'closeValueField', 'color', 'cornerRadius', 'dashStyle', 'fullstackedarea', 'fullstackedbar', 'fullstackedline', 'fullstackedspline', 'fullstackedsplinearea', 'highValueField', 'hoverMode', 'hoverStyle', 'ignoreEmptyPoints', 'innerColor', 'label', 'line', 'lowValueField', 'maxLabelCount', 'minBarSize', 'opacity', 'openValueField', 'pane', 'point', 'rangearea', 'rangebar', 'rangeValue1Field', 'rangeValue2Field', 'reduction', 'scatter', 'selectionMode', 'selectionStyle', 'showInLegend', 'sizeField', 'spline', 'splinearea', 'stack', 'stackedarea', 'stackedbar', 'stackedline', 'stackedspline', 'stackedsplinearea', 'steparea', 'stepline', 'stock', 'tagField', 'type', 'valueErrorBar', 'valueField', 'visible', 'width' ] },] }, ]; /** @nocollapse */ DxoFullstackedsplineComponent.ctorParameters = function () { return [ { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.SkipSelf }, { type: core_1.Host },] }, { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.Host },] }, ]; }; return DxoFullstackedsplineComponent; }(chart_common_series_settings_1.DxoChartCommonSeriesSettings)); exports.DxoFullstackedsplineComponent = DxoFullstackedsplineComponent; var DxoFullstackedsplineModule = (function () { function DxoFullstackedsplineModule() { } DxoFullstackedsplineModule.decorators = [ { type: core_1.NgModule, args: [{ declarations: [ DxoFullstackedsplineComponent ], exports: [ DxoFullstackedsplineComponent ], },] }, ]; /** @nocollapse */ DxoFullstackedsplineModule.ctorParameters = function () { return []; }; return DxoFullstackedsplineModule; }()); exports.DxoFullstackedsplineModule = DxoFullstackedsplineModule; //# sourceMappingURL=fullstackedspline.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/fullstackedsplinearea.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); /* tslint:disable:use-input-property-decorator */ var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var chart_common_series_settings_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/base/chart-common-series-settings.js"); var DxoFullstackedsplineareaComponent = (function (_super) { __extends(DxoFullstackedsplineareaComponent, _super); function DxoFullstackedsplineareaComponent(parentOptionHost, optionHost) { var _this = _super.call(this) || this; parentOptionHost.setNestedOption(_this); optionHost.setHost(_this, _this._fullOptionPath.bind(_this)); return _this; } Object.defineProperty(DxoFullstackedsplineareaComponent.prototype, "_optionPath", { get: function () { return 'fullstackedsplinearea'; }, enumerable: true, configurable: true }); DxoFullstackedsplineareaComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dxo-fullstackedsplinearea', template: '', styles: [''], providers: [nested_option_1.NestedOptionHost], inputs: [ 'area', 'argumentField', 'axis', 'bar', 'border', 'bubble', 'candlestick', 'closeValueField', 'color', 'cornerRadius', 'dashStyle', 'fullstackedarea', 'fullstackedbar', 'fullstackedline', 'fullstackedspline', 'fullstackedsplinearea', 'highValueField', 'hoverMode', 'hoverStyle', 'ignoreEmptyPoints', 'innerColor', 'label', 'line', 'lowValueField', 'maxLabelCount', 'minBarSize', 'opacity', 'openValueField', 'pane', 'point', 'rangearea', 'rangebar', 'rangeValue1Field', 'rangeValue2Field', 'reduction', 'scatter', 'selectionMode', 'selectionStyle', 'showInLegend', 'sizeField', 'spline', 'splinearea', 'stack', 'stackedarea', 'stackedbar', 'stackedline', 'stackedspline', 'stackedsplinearea', 'steparea', 'stepline', 'stock', 'tagField', 'type', 'valueErrorBar', 'valueField', 'visible', 'width' ] },] }, ]; /** @nocollapse */ DxoFullstackedsplineareaComponent.ctorParameters = function () { return [ { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.SkipSelf }, { type: core_1.Host },] }, { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.Host },] }, ]; }; return DxoFullstackedsplineareaComponent; }(chart_common_series_settings_1.DxoChartCommonSeriesSettings)); exports.DxoFullstackedsplineareaComponent = DxoFullstackedsplineareaComponent; var DxoFullstackedsplineareaModule = (function () { function DxoFullstackedsplineareaModule() { } DxoFullstackedsplineareaModule.decorators = [ { type: core_1.NgModule, args: [{ declarations: [ DxoFullstackedsplineareaComponent ], exports: [ DxoFullstackedsplineareaComponent ], },] }, ]; /** @nocollapse */ DxoFullstackedsplineareaModule.ctorParameters = function () { return []; }; return DxoFullstackedsplineareaModule; }()); exports.DxoFullstackedsplineareaModule = DxoFullstackedsplineareaModule; //# sourceMappingURL=fullstackedsplinearea.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/geometry.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var nested_option_2 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var DxoGeometryComponent = (function (_super) { __extends(DxoGeometryComponent, _super); function DxoGeometryComponent(parentOptionHost, optionHost) { var _this = _super.call(this) || this; parentOptionHost.setNestedOption(_this); optionHost.setHost(_this, _this._fullOptionPath.bind(_this)); return _this; } Object.defineProperty(DxoGeometryComponent.prototype, "endAngle", { get: function () { return this._getOption('endAngle'); }, set: function (value) { this._setOption('endAngle', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoGeometryComponent.prototype, "startAngle", { get: function () { return this._getOption('startAngle'); }, set: function (value) { this._setOption('startAngle', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoGeometryComponent.prototype, "orientation", { get: function () { return this._getOption('orientation'); }, set: function (value) { this._setOption('orientation', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoGeometryComponent.prototype, "_optionPath", { get: function () { return 'geometry'; }, enumerable: true, configurable: true }); DxoGeometryComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dxo-geometry', template: '', styles: [''], providers: [nested_option_1.NestedOptionHost] },] }, ]; /** @nocollapse */ DxoGeometryComponent.ctorParameters = function () { return [ { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.SkipSelf }, { type: core_1.Host },] }, { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.Host },] }, ]; }; DxoGeometryComponent.propDecorators = { 'endAngle': [{ type: core_1.Input },], 'startAngle': [{ type: core_1.Input },], 'orientation': [{ type: core_1.Input },], }; return DxoGeometryComponent; }(nested_option_2.NestedOption)); exports.DxoGeometryComponent = DxoGeometryComponent; var DxoGeometryModule = (function () { function DxoGeometryModule() { } DxoGeometryModule.decorators = [ { type: core_1.NgModule, args: [{ declarations: [ DxoGeometryComponent ], exports: [ DxoGeometryComponent ], },] }, ]; /** @nocollapse */ DxoGeometryModule.ctorParameters = function () { return []; }; return DxoGeometryModule; }()); exports.DxoGeometryModule = DxoGeometryModule; //# sourceMappingURL=geometry.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/grid.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var nested_option_2 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var DxoGridComponent = (function (_super) { __extends(DxoGridComponent, _super); function DxoGridComponent(parentOptionHost, optionHost) { var _this = _super.call(this) || this; parentOptionHost.setNestedOption(_this); optionHost.setHost(_this, _this._fullOptionPath.bind(_this)); return _this; } Object.defineProperty(DxoGridComponent.prototype, "color", { get: function () { return this._getOption('color'); }, set: function (value) { this._setOption('color', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoGridComponent.prototype, "opacity", { get: function () { return this._getOption('opacity'); }, set: function (value) { this._setOption('opacity', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoGridComponent.prototype, "visible", { get: function () { return this._getOption('visible'); }, set: function (value) { this._setOption('visible', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoGridComponent.prototype, "width", { get: function () { return this._getOption('width'); }, set: function (value) { this._setOption('width', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoGridComponent.prototype, "_optionPath", { get: function () { return 'grid'; }, enumerable: true, configurable: true }); DxoGridComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dxo-grid', template: '', styles: [''], providers: [nested_option_1.NestedOptionHost] },] }, ]; /** @nocollapse */ DxoGridComponent.ctorParameters = function () { return [ { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.SkipSelf }, { type: core_1.Host },] }, { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.Host },] }, ]; }; DxoGridComponent.propDecorators = { 'color': [{ type: core_1.Input },], 'opacity': [{ type: core_1.Input },], 'visible': [{ type: core_1.Input },], 'width': [{ type: core_1.Input },], }; return DxoGridComponent; }(nested_option_2.NestedOption)); exports.DxoGridComponent = DxoGridComponent; var DxoGridModule = (function () { function DxoGridModule() { } DxoGridModule.decorators = [ { type: core_1.NgModule, args: [{ declarations: [ DxoGridComponent ], exports: [ DxoGridComponent ], },] }, ]; /** @nocollapse */ DxoGridModule.ctorParameters = function () { return []; }; return DxoGridModule; }()); exports.DxoGridModule = DxoGridModule; //# sourceMappingURL=grid.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/group-item-dxi.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var nested_option_2 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var DxiGroupItemComponent = (function (_super) { __extends(DxiGroupItemComponent, _super); function DxiGroupItemComponent(parentOptionHost, optionHost) { var _this = _super.call(this) || this; parentOptionHost.setNestedOption(_this); optionHost.setHost(_this, _this._fullOptionPath.bind(_this)); return _this; } Object.defineProperty(DxiGroupItemComponent.prototype, "alignByColumn", { get: function () { return this._getOption('alignByColumn'); }, set: function (value) { this._setOption('alignByColumn', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiGroupItemComponent.prototype, "column", { get: function () { return this._getOption('column'); }, set: function (value) { this._setOption('column', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiGroupItemComponent.prototype, "customizeText", { get: function () { return this._getOption('customizeText'); }, set: function (value) { this._setOption('customizeText', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiGroupItemComponent.prototype, "displayFormat", { get: function () { return this._getOption('displayFormat'); }, set: function (value) { this._setOption('displayFormat', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiGroupItemComponent.prototype, "name", { get: function () { return this._getOption('name'); }, set: function (value) { this._setOption('name', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiGroupItemComponent.prototype, "precision", { get: function () { return this._getOption('precision'); }, set: function (value) { this._setOption('precision', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiGroupItemComponent.prototype, "showInColumn", { get: function () { return this._getOption('showInColumn'); }, set: function (value) { this._setOption('showInColumn', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiGroupItemComponent.prototype, "showInGroupFooter", { get: function () { return this._getOption('showInGroupFooter'); }, set: function (value) { this._setOption('showInGroupFooter', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiGroupItemComponent.prototype, "skipEmptyValues", { get: function () { return this._getOption('skipEmptyValues'); }, set: function (value) { this._setOption('skipEmptyValues', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiGroupItemComponent.prototype, "summaryType", { get: function () { return this._getOption('summaryType'); }, set: function (value) { this._setOption('summaryType', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiGroupItemComponent.prototype, "valueFormat", { get: function () { return this._getOption('valueFormat'); }, set: function (value) { this._setOption('valueFormat', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiGroupItemComponent.prototype, "_optionPath", { get: function () { return 'groupItems'; }, enumerable: true, configurable: true }); DxiGroupItemComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dxi-group-item', template: '', styles: [''], providers: [nested_option_1.NestedOptionHost] },] }, ]; /** @nocollapse */ DxiGroupItemComponent.ctorParameters = function () { return [ { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.SkipSelf }, { type: core_1.Host },] }, { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.Host },] }, ]; }; DxiGroupItemComponent.propDecorators = { 'alignByColumn': [{ type: core_1.Input },], 'column': [{ type: core_1.Input },], 'customizeText': [{ type: core_1.Input },], 'displayFormat': [{ type: core_1.Input },], 'name': [{ type: core_1.Input },], 'precision': [{ type: core_1.Input },], 'showInColumn': [{ type: core_1.Input },], 'showInGroupFooter': [{ type: core_1.Input },], 'skipEmptyValues': [{ type: core_1.Input },], 'summaryType': [{ type: core_1.Input },], 'valueFormat': [{ type: core_1.Input },], }; return DxiGroupItemComponent; }(nested_option_2.CollectionNestedOption)); exports.DxiGroupItemComponent = DxiGroupItemComponent; var DxiGroupItemModule = (function () { function DxiGroupItemModule() { } DxiGroupItemModule.decorators = [ { type: core_1.NgModule, args: [{ declarations: [ DxiGroupItemComponent ], exports: [ DxiGroupItemComponent ], },] }, ]; /** @nocollapse */ DxiGroupItemModule.ctorParameters = function () { return []; }; return DxiGroupItemModule; }()); exports.DxiGroupItemModule = DxiGroupItemModule; //# sourceMappingURL=group-item-dxi.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/group-operation-descriptions.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var nested_option_2 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var DxoGroupOperationDescriptionsComponent = (function (_super) { __extends(DxoGroupOperationDescriptionsComponent, _super); function DxoGroupOperationDescriptionsComponent(parentOptionHost, optionHost) { var _this = _super.call(this) || this; parentOptionHost.setNestedOption(_this); optionHost.setHost(_this, _this._fullOptionPath.bind(_this)); return _this; } Object.defineProperty(DxoGroupOperationDescriptionsComponent.prototype, "and", { get: function () { return this._getOption('and'); }, set: function (value) { this._setOption('and', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoGroupOperationDescriptionsComponent.prototype, "notAnd", { get: function () { return this._getOption('notAnd'); }, set: function (value) { this._setOption('notAnd', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoGroupOperationDescriptionsComponent.prototype, "notOr", { get: function () { return this._getOption('notOr'); }, set: function (value) { this._setOption('notOr', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoGroupOperationDescriptionsComponent.prototype, "or", { get: function () { return this._getOption('or'); }, set: function (value) { this._setOption('or', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoGroupOperationDescriptionsComponent.prototype, "_optionPath", { get: function () { return 'groupOperationDescriptions'; }, enumerable: true, configurable: true }); DxoGroupOperationDescriptionsComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dxo-group-operation-descriptions', template: '', styles: [''], providers: [nested_option_1.NestedOptionHost] },] }, ]; /** @nocollapse */ DxoGroupOperationDescriptionsComponent.ctorParameters = function () { return [ { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.SkipSelf }, { type: core_1.Host },] }, { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.Host },] }, ]; }; DxoGroupOperationDescriptionsComponent.propDecorators = { 'and': [{ type: core_1.Input },], 'notAnd': [{ type: core_1.Input },], 'notOr': [{ type: core_1.Input },], 'or': [{ type: core_1.Input },], }; return DxoGroupOperationDescriptionsComponent; }(nested_option_2.NestedOption)); exports.DxoGroupOperationDescriptionsComponent = DxoGroupOperationDescriptionsComponent; var DxoGroupOperationDescriptionsModule = (function () { function DxoGroupOperationDescriptionsModule() { } DxoGroupOperationDescriptionsModule.decorators = [ { type: core_1.NgModule, args: [{ declarations: [ DxoGroupOperationDescriptionsComponent ], exports: [ DxoGroupOperationDescriptionsComponent ], },] }, ]; /** @nocollapse */ DxoGroupOperationDescriptionsModule.ctorParameters = function () { return []; }; return DxoGroupOperationDescriptionsModule; }()); exports.DxoGroupOperationDescriptionsModule = DxoGroupOperationDescriptionsModule; //# sourceMappingURL=group-operation-descriptions.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/group-panel.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var nested_option_2 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var DxoGroupPanelComponent = (function (_super) { __extends(DxoGroupPanelComponent, _super); function DxoGroupPanelComponent(parentOptionHost, optionHost) { var _this = _super.call(this) || this; parentOptionHost.setNestedOption(_this); optionHost.setHost(_this, _this._fullOptionPath.bind(_this)); return _this; } Object.defineProperty(DxoGroupPanelComponent.prototype, "allowColumnDragging", { get: function () { return this._getOption('allowColumnDragging'); }, set: function (value) { this._setOption('allowColumnDragging', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoGroupPanelComponent.prototype, "emptyPanelText", { get: function () { return this._getOption('emptyPanelText'); }, set: function (value) { this._setOption('emptyPanelText', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoGroupPanelComponent.prototype, "visible", { get: function () { return this._getOption('visible'); }, set: function (value) { this._setOption('visible', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoGroupPanelComponent.prototype, "_optionPath", { get: function () { return 'groupPanel'; }, enumerable: true, configurable: true }); DxoGroupPanelComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dxo-group-panel', template: '', styles: [''], providers: [nested_option_1.NestedOptionHost] },] }, ]; /** @nocollapse */ DxoGroupPanelComponent.ctorParameters = function () { return [ { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.SkipSelf }, { type: core_1.Host },] }, { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.Host },] }, ]; }; DxoGroupPanelComponent.propDecorators = { 'allowColumnDragging': [{ type: core_1.Input },], 'emptyPanelText': [{ type: core_1.Input },], 'visible': [{ type: core_1.Input },], }; return DxoGroupPanelComponent; }(nested_option_2.NestedOption)); exports.DxoGroupPanelComponent = DxoGroupPanelComponent; var DxoGroupPanelModule = (function () { function DxoGroupPanelModule() { } DxoGroupPanelModule.decorators = [ { type: core_1.NgModule, args: [{ declarations: [ DxoGroupPanelComponent ], exports: [ DxoGroupPanelComponent ], },] }, ]; /** @nocollapse */ DxoGroupPanelModule.ctorParameters = function () { return []; }; return DxoGroupPanelModule; }()); exports.DxoGroupPanelModule = DxoGroupPanelModule; //# sourceMappingURL=group-panel.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/group.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var nested_option_2 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var DxoGroupComponent = (function (_super) { __extends(DxoGroupComponent, _super); function DxoGroupComponent(parentOptionHost, optionHost) { var _this = _super.call(this) || this; parentOptionHost.setNestedOption(_this); optionHost.setHost(_this, _this._fullOptionPath.bind(_this)); return _this; } Object.defineProperty(DxoGroupComponent.prototype, "border", { get: function () { return this._getOption('border'); }, set: function (value) { this._setOption('border', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoGroupComponent.prototype, "color", { get: function () { return this._getOption('color'); }, set: function (value) { this._setOption('color', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoGroupComponent.prototype, "headerHeight", { get: function () { return this._getOption('headerHeight'); }, set: function (value) { this._setOption('headerHeight', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoGroupComponent.prototype, "hoverEnabled", { get: function () { return this._getOption('hoverEnabled'); }, set: function (value) { this._setOption('hoverEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoGroupComponent.prototype, "hoverStyle", { get: function () { return this._getOption('hoverStyle'); }, set: function (value) { this._setOption('hoverStyle', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoGroupComponent.prototype, "label", { get: function () { return this._getOption('label'); }, set: function (value) { this._setOption('label', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoGroupComponent.prototype, "selectionStyle", { get: function () { return this._getOption('selectionStyle'); }, set: function (value) { this._setOption('selectionStyle', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoGroupComponent.prototype, "_optionPath", { get: function () { return 'group'; }, enumerable: true, configurable: true }); DxoGroupComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dxo-group', template: '', styles: [''], providers: [nested_option_1.NestedOptionHost] },] }, ]; /** @nocollapse */ DxoGroupComponent.ctorParameters = function () { return [ { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.SkipSelf }, { type: core_1.Host },] }, { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.Host },] }, ]; }; DxoGroupComponent.propDecorators = { 'border': [{ type: core_1.Input },], 'color': [{ type: core_1.Input },], 'headerHeight': [{ type: core_1.Input },], 'hoverEnabled': [{ type: core_1.Input },], 'hoverStyle': [{ type: core_1.Input },], 'label': [{ type: core_1.Input },], 'selectionStyle': [{ type: core_1.Input },], }; return DxoGroupComponent; }(nested_option_2.NestedOption)); exports.DxoGroupComponent = DxoGroupComponent; var DxoGroupModule = (function () { function DxoGroupModule() { } DxoGroupModule.decorators = [ { type: core_1.NgModule, args: [{ declarations: [ DxoGroupComponent ], exports: [ DxoGroupComponent ], },] }, ]; /** @nocollapse */ DxoGroupModule.ctorParameters = function () { return []; }; return DxoGroupModule; }()); exports.DxoGroupModule = DxoGroupModule; //# sourceMappingURL=group.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/grouping.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var nested_option_2 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var DxoGroupingComponent = (function (_super) { __extends(DxoGroupingComponent, _super); function DxoGroupingComponent(parentOptionHost, optionHost) { var _this = _super.call(this) || this; parentOptionHost.setNestedOption(_this); optionHost.setHost(_this, _this._fullOptionPath.bind(_this)); return _this; } Object.defineProperty(DxoGroupingComponent.prototype, "allowCollapsing", { get: function () { return this._getOption('allowCollapsing'); }, set: function (value) { this._setOption('allowCollapsing', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoGroupingComponent.prototype, "autoExpandAll", { get: function () { return this._getOption('autoExpandAll'); }, set: function (value) { this._setOption('autoExpandAll', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoGroupingComponent.prototype, "contextMenuEnabled", { get: function () { return this._getOption('contextMenuEnabled'); }, set: function (value) { this._setOption('contextMenuEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoGroupingComponent.prototype, "expandMode", { get: function () { return this._getOption('expandMode'); }, set: function (value) { this._setOption('expandMode', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoGroupingComponent.prototype, "groupContinuedMessage", { get: function () { return this._getOption('groupContinuedMessage'); }, set: function (value) { this._setOption('groupContinuedMessage', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoGroupingComponent.prototype, "groupContinuesMessage", { get: function () { return this._getOption('groupContinuesMessage'); }, set: function (value) { this._setOption('groupContinuesMessage', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoGroupingComponent.prototype, "texts", { get: function () { return this._getOption('texts'); }, set: function (value) { this._setOption('texts', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoGroupingComponent.prototype, "_optionPath", { get: function () { return 'grouping'; }, enumerable: true, configurable: true }); DxoGroupingComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dxo-grouping', template: '', styles: [''], providers: [nested_option_1.NestedOptionHost] },] }, ]; /** @nocollapse */ DxoGroupingComponent.ctorParameters = function () { return [ { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.SkipSelf }, { type: core_1.Host },] }, { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.Host },] }, ]; }; DxoGroupingComponent.propDecorators = { 'allowCollapsing': [{ type: core_1.Input },], 'autoExpandAll': [{ type: core_1.Input },], 'contextMenuEnabled': [{ type: core_1.Input },], 'expandMode': [{ type: core_1.Input },], 'groupContinuedMessage': [{ type: core_1.Input },], 'groupContinuesMessage': [{ type: core_1.Input },], 'texts': [{ type: core_1.Input },], }; return DxoGroupingComponent; }(nested_option_2.NestedOption)); exports.DxoGroupingComponent = DxoGroupingComponent; var DxoGroupingModule = (function () { function DxoGroupingModule() { } DxoGroupingModule.decorators = [ { type: core_1.NgModule, args: [{ declarations: [ DxoGroupingComponent ], exports: [ DxoGroupingComponent ], },] }, ]; /** @nocollapse */ DxoGroupingModule.ctorParameters = function () { return []; }; return DxoGroupingModule; }()); exports.DxoGroupingModule = DxoGroupingModule; //# sourceMappingURL=grouping.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/hatching.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var nested_option_2 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var DxoHatchingComponent = (function (_super) { __extends(DxoHatchingComponent, _super); function DxoHatchingComponent(parentOptionHost, optionHost) { var _this = _super.call(this) || this; parentOptionHost.setNestedOption(_this); optionHost.setHost(_this, _this._fullOptionPath.bind(_this)); return _this; } Object.defineProperty(DxoHatchingComponent.prototype, "direction", { get: function () { return this._getOption('direction'); }, set: function (value) { this._setOption('direction', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoHatchingComponent.prototype, "opacity", { get: function () { return this._getOption('opacity'); }, set: function (value) { this._setOption('opacity', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoHatchingComponent.prototype, "step", { get: function () { return this._getOption('step'); }, set: function (value) { this._setOption('step', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoHatchingComponent.prototype, "width", { get: function () { return this._getOption('width'); }, set: function (value) { this._setOption('width', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoHatchingComponent.prototype, "_optionPath", { get: function () { return 'hatching'; }, enumerable: true, configurable: true }); DxoHatchingComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dxo-hatching', template: '', styles: [''], providers: [nested_option_1.NestedOptionHost] },] }, ]; /** @nocollapse */ DxoHatchingComponent.ctorParameters = function () { return [ { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.SkipSelf }, { type: core_1.Host },] }, { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.Host },] }, ]; }; DxoHatchingComponent.propDecorators = { 'direction': [{ type: core_1.Input },], 'opacity': [{ type: core_1.Input },], 'step': [{ type: core_1.Input },], 'width': [{ type: core_1.Input },], }; return DxoHatchingComponent; }(nested_option_2.NestedOption)); exports.DxoHatchingComponent = DxoHatchingComponent; var DxoHatchingModule = (function () { function DxoHatchingModule() { } DxoHatchingModule.decorators = [ { type: core_1.NgModule, args: [{ declarations: [ DxoHatchingComponent ], exports: [ DxoHatchingComponent ], },] }, ]; /** @nocollapse */ DxoHatchingModule.ctorParameters = function () { return []; }; return DxoHatchingModule; }()); exports.DxoHatchingModule = DxoHatchingModule; //# sourceMappingURL=hatching.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/header-filter.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var nested_option_2 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var DxoHeaderFilterComponent = (function (_super) { __extends(DxoHeaderFilterComponent, _super); function DxoHeaderFilterComponent(parentOptionHost, optionHost) { var _this = _super.call(this) || this; parentOptionHost.setNestedOption(_this); optionHost.setHost(_this, _this._fullOptionPath.bind(_this)); return _this; } Object.defineProperty(DxoHeaderFilterComponent.prototype, "allowSearch", { get: function () { return this._getOption('allowSearch'); }, set: function (value) { this._setOption('allowSearch', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoHeaderFilterComponent.prototype, "dataSource", { get: function () { return this._getOption('dataSource'); }, set: function (value) { this._setOption('dataSource', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoHeaderFilterComponent.prototype, "groupInterval", { get: function () { return this._getOption('groupInterval'); }, set: function (value) { this._setOption('groupInterval', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoHeaderFilterComponent.prototype, "height", { get: function () { return this._getOption('height'); }, set: function (value) { this._setOption('height', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoHeaderFilterComponent.prototype, "width", { get: function () { return this._getOption('width'); }, set: function (value) { this._setOption('width', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoHeaderFilterComponent.prototype, "texts", { get: function () { return this._getOption('texts'); }, set: function (value) { this._setOption('texts', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoHeaderFilterComponent.prototype, "visible", { get: function () { return this._getOption('visible'); }, set: function (value) { this._setOption('visible', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoHeaderFilterComponent.prototype, "_optionPath", { get: function () { return 'headerFilter'; }, enumerable: true, configurable: true }); DxoHeaderFilterComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dxo-header-filter', template: '', styles: [''], providers: [nested_option_1.NestedOptionHost] },] }, ]; /** @nocollapse */ DxoHeaderFilterComponent.ctorParameters = function () { return [ { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.SkipSelf }, { type: core_1.Host },] }, { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.Host },] }, ]; }; DxoHeaderFilterComponent.propDecorators = { 'allowSearch': [{ type: core_1.Input },], 'dataSource': [{ type: core_1.Input },], 'groupInterval': [{ type: core_1.Input },], 'height': [{ type: core_1.Input },], 'width': [{ type: core_1.Input },], 'texts': [{ type: core_1.Input },], 'visible': [{ type: core_1.Input },], }; return DxoHeaderFilterComponent; }(nested_option_2.NestedOption)); exports.DxoHeaderFilterComponent = DxoHeaderFilterComponent; var DxoHeaderFilterModule = (function () { function DxoHeaderFilterModule() { } DxoHeaderFilterModule.decorators = [ { type: core_1.NgModule, args: [{ declarations: [ DxoHeaderFilterComponent ], exports: [ DxoHeaderFilterComponent ], },] }, ]; /** @nocollapse */ DxoHeaderFilterModule.ctorParameters = function () { return []; }; return DxoHeaderFilterModule; }()); exports.DxoHeaderFilterModule = DxoHeaderFilterModule; //# sourceMappingURL=header-filter.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/height.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var nested_option_2 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var DxoHeightComponent = (function (_super) { __extends(DxoHeightComponent, _super); function DxoHeightComponent(parentOptionHost, optionHost) { var _this = _super.call(this) || this; parentOptionHost.setNestedOption(_this); optionHost.setHost(_this, _this._fullOptionPath.bind(_this)); return _this; } Object.defineProperty(DxoHeightComponent.prototype, "rangeMaxPoint", { get: function () { return this._getOption('rangeMaxPoint'); }, set: function (value) { this._setOption('rangeMaxPoint', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoHeightComponent.prototype, "rangeMinPoint", { get: function () { return this._getOption('rangeMinPoint'); }, set: function (value) { this._setOption('rangeMinPoint', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoHeightComponent.prototype, "_optionPath", { get: function () { return 'height'; }, enumerable: true, configurable: true }); DxoHeightComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dxo-height', template: '', styles: [''], providers: [nested_option_1.NestedOptionHost] },] }, ]; /** @nocollapse */ DxoHeightComponent.ctorParameters = function () { return [ { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.SkipSelf }, { type: core_1.Host },] }, { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.Host },] }, ]; }; DxoHeightComponent.propDecorators = { 'rangeMaxPoint': [{ type: core_1.Input },], 'rangeMinPoint': [{ type: core_1.Input },], }; return DxoHeightComponent; }(nested_option_2.NestedOption)); exports.DxoHeightComponent = DxoHeightComponent; var DxoHeightModule = (function () { function DxoHeightModule() { } DxoHeightModule.decorators = [ { type: core_1.NgModule, args: [{ declarations: [ DxoHeightComponent ], exports: [ DxoHeightComponent ], },] }, ]; /** @nocollapse */ DxoHeightModule.ctorParameters = function () { return []; }; return DxoHeightModule; }()); exports.DxoHeightModule = DxoHeightModule; //# sourceMappingURL=height.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/hide-event.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var nested_option_2 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var DxoHideEventComponent = (function (_super) { __extends(DxoHideEventComponent, _super); function DxoHideEventComponent(parentOptionHost, optionHost) { var _this = _super.call(this) || this; parentOptionHost.setNestedOption(_this); optionHost.setHost(_this, _this._fullOptionPath.bind(_this)); return _this; } Object.defineProperty(DxoHideEventComponent.prototype, "delay", { get: function () { return this._getOption('delay'); }, set: function (value) { this._setOption('delay', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoHideEventComponent.prototype, "name", { get: function () { return this._getOption('name'); }, set: function (value) { this._setOption('name', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoHideEventComponent.prototype, "_optionPath", { get: function () { return 'hideEvent'; }, enumerable: true, configurable: true }); DxoHideEventComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dxo-hide-event', template: '', styles: [''], providers: [nested_option_1.NestedOptionHost] },] }, ]; /** @nocollapse */ DxoHideEventComponent.ctorParameters = function () { return [ { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.SkipSelf }, { type: core_1.Host },] }, { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.Host },] }, ]; }; DxoHideEventComponent.propDecorators = { 'delay': [{ type: core_1.Input },], 'name': [{ type: core_1.Input },], }; return DxoHideEventComponent; }(nested_option_2.NestedOption)); exports.DxoHideEventComponent = DxoHideEventComponent; var DxoHideEventModule = (function () { function DxoHideEventModule() { } DxoHideEventModule.decorators = [ { type: core_1.NgModule, args: [{ declarations: [ DxoHideEventComponent ], exports: [ DxoHideEventComponent ], },] }, ]; /** @nocollapse */ DxoHideEventModule.ctorParameters = function () { return []; }; return DxoHideEventModule; }()); exports.DxoHideEventModule = DxoHideEventModule; //# sourceMappingURL=hide-event.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/hide.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); /* tslint:disable:use-input-property-decorator */ var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var animation_config_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/base/animation-config.js"); var DxoHideComponent = (function (_super) { __extends(DxoHideComponent, _super); function DxoHideComponent(parentOptionHost, optionHost) { var _this = _super.call(this) || this; parentOptionHost.setNestedOption(_this); optionHost.setHost(_this, _this._fullOptionPath.bind(_this)); return _this; } Object.defineProperty(DxoHideComponent.prototype, "_optionPath", { get: function () { return 'hide'; }, enumerable: true, configurable: true }); DxoHideComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dxo-hide', template: '', styles: [''], providers: [nested_option_1.NestedOptionHost], inputs: [ 'complete', 'delay', 'direction', 'duration', 'easing', 'from', 'staggerDelay', 'start', 'to', 'type' ] },] }, ]; /** @nocollapse */ DxoHideComponent.ctorParameters = function () { return [ { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.SkipSelf }, { type: core_1.Host },] }, { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.Host },] }, ]; }; return DxoHideComponent; }(animation_config_1.DxoAnimationConfig)); exports.DxoHideComponent = DxoHideComponent; var DxoHideModule = (function () { function DxoHideModule() { } DxoHideModule.decorators = [ { type: core_1.NgModule, args: [{ declarations: [ DxoHideComponent ], exports: [ DxoHideComponent ], },] }, ]; /** @nocollapse */ DxoHideModule.ctorParameters = function () { return []; }; return DxoHideModule; }()); exports.DxoHideModule = DxoHideModule; //# sourceMappingURL=hide.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/horizontal-line.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var nested_option_2 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var DxoHorizontalLineComponent = (function (_super) { __extends(DxoHorizontalLineComponent, _super); function DxoHorizontalLineComponent(parentOptionHost, optionHost) { var _this = _super.call(this) || this; parentOptionHost.setNestedOption(_this); optionHost.setHost(_this, _this._fullOptionPath.bind(_this)); return _this; } Object.defineProperty(DxoHorizontalLineComponent.prototype, "color", { get: function () { return this._getOption('color'); }, set: function (value) { this._setOption('color', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoHorizontalLineComponent.prototype, "dashStyle", { get: function () { return this._getOption('dashStyle'); }, set: function (value) { this._setOption('dashStyle', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoHorizontalLineComponent.prototype, "label", { get: function () { return this._getOption('label'); }, set: function (value) { this._setOption('label', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoHorizontalLineComponent.prototype, "opacity", { get: function () { return this._getOption('opacity'); }, set: function (value) { this._setOption('opacity', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoHorizontalLineComponent.prototype, "visible", { get: function () { return this._getOption('visible'); }, set: function (value) { this._setOption('visible', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoHorizontalLineComponent.prototype, "width", { get: function () { return this._getOption('width'); }, set: function (value) { this._setOption('width', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoHorizontalLineComponent.prototype, "_optionPath", { get: function () { return 'horizontalLine'; }, enumerable: true, configurable: true }); DxoHorizontalLineComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dxo-horizontal-line', template: '', styles: [''], providers: [nested_option_1.NestedOptionHost] },] }, ]; /** @nocollapse */ DxoHorizontalLineComponent.ctorParameters = function () { return [ { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.SkipSelf }, { type: core_1.Host },] }, { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.Host },] }, ]; }; DxoHorizontalLineComponent.propDecorators = { 'color': [{ type: core_1.Input },], 'dashStyle': [{ type: core_1.Input },], 'label': [{ type: core_1.Input },], 'opacity': [{ type: core_1.Input },], 'visible': [{ type: core_1.Input },], 'width': [{ type: core_1.Input },], }; return DxoHorizontalLineComponent; }(nested_option_2.NestedOption)); exports.DxoHorizontalLineComponent = DxoHorizontalLineComponent; var DxoHorizontalLineModule = (function () { function DxoHorizontalLineModule() { } DxoHorizontalLineModule.decorators = [ { type: core_1.NgModule, args: [{ declarations: [ DxoHorizontalLineComponent ], exports: [ DxoHorizontalLineComponent ], },] }, ]; /** @nocollapse */ DxoHorizontalLineModule.ctorParameters = function () { return []; }; return DxoHorizontalLineModule; }()); exports.DxoHorizontalLineModule = DxoHorizontalLineModule; //# sourceMappingURL=horizontal-line.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/hover-style.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var nested_option_2 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var DxoHoverStyleComponent = (function (_super) { __extends(DxoHoverStyleComponent, _super); function DxoHoverStyleComponent(parentOptionHost, optionHost) { var _this = _super.call(this) || this; parentOptionHost.setNestedOption(_this); optionHost.setHost(_this, _this._fullOptionPath.bind(_this)); return _this; } Object.defineProperty(DxoHoverStyleComponent.prototype, "border", { get: function () { return this._getOption('border'); }, set: function (value) { this._setOption('border', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoHoverStyleComponent.prototype, "color", { get: function () { return this._getOption('color'); }, set: function (value) { this._setOption('color', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoHoverStyleComponent.prototype, "dashStyle", { get: function () { return this._getOption('dashStyle'); }, set: function (value) { this._setOption('dashStyle', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoHoverStyleComponent.prototype, "hatching", { get: function () { return this._getOption('hatching'); }, set: function (value) { this._setOption('hatching', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoHoverStyleComponent.prototype, "width", { get: function () { return this._getOption('width'); }, set: function (value) { this._setOption('width', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoHoverStyleComponent.prototype, "size", { get: function () { return this._getOption('size'); }, set: function (value) { this._setOption('size', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoHoverStyleComponent.prototype, "_optionPath", { get: function () { return 'hoverStyle'; }, enumerable: true, configurable: true }); DxoHoverStyleComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dxo-hover-style', template: '', styles: [''], providers: [nested_option_1.NestedOptionHost] },] }, ]; /** @nocollapse */ DxoHoverStyleComponent.ctorParameters = function () { return [ { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.SkipSelf }, { type: core_1.Host },] }, { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.Host },] }, ]; }; DxoHoverStyleComponent.propDecorators = { 'border': [{ type: core_1.Input },], 'color': [{ type: core_1.Input },], 'dashStyle': [{ type: core_1.Input },], 'hatching': [{ type: core_1.Input },], 'width': [{ type: core_1.Input },], 'size': [{ type: core_1.Input },], }; return DxoHoverStyleComponent; }(nested_option_2.NestedOption)); exports.DxoHoverStyleComponent = DxoHoverStyleComponent; var DxoHoverStyleModule = (function () { function DxoHoverStyleModule() { } DxoHoverStyleModule.decorators = [ { type: core_1.NgModule, args: [{ declarations: [ DxoHoverStyleComponent ], exports: [ DxoHoverStyleComponent ], },] }, ]; /** @nocollapse */ DxoHoverStyleModule.ctorParameters = function () { return []; }; return DxoHoverStyleModule; }()); exports.DxoHoverStyleModule = DxoHoverStyleModule; //# sourceMappingURL=hover-style.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/image.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var nested_option_2 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var DxoImageComponent = (function (_super) { __extends(DxoImageComponent, _super); function DxoImageComponent(parentOptionHost, optionHost) { var _this = _super.call(this) || this; parentOptionHost.setNestedOption(_this); optionHost.setHost(_this, _this._fullOptionPath.bind(_this)); return _this; } Object.defineProperty(DxoImageComponent.prototype, "height", { get: function () { return this._getOption('height'); }, set: function (value) { this._setOption('height', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoImageComponent.prototype, "url", { get: function () { return this._getOption('url'); }, set: function (value) { this._setOption('url', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoImageComponent.prototype, "width", { get: function () { return this._getOption('width'); }, set: function (value) { this._setOption('width', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoImageComponent.prototype, "location", { get: function () { return this._getOption('location'); }, set: function (value) { this._setOption('location', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoImageComponent.prototype, "_optionPath", { get: function () { return 'image'; }, enumerable: true, configurable: true }); DxoImageComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dxo-image', template: '', styles: [''], providers: [nested_option_1.NestedOptionHost] },] }, ]; /** @nocollapse */ DxoImageComponent.ctorParameters = function () { return [ { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.SkipSelf }, { type: core_1.Host },] }, { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.Host },] }, ]; }; DxoImageComponent.propDecorators = { 'height': [{ type: core_1.Input },], 'url': [{ type: core_1.Input },], 'width': [{ type: core_1.Input },], 'location': [{ type: core_1.Input },], }; return DxoImageComponent; }(nested_option_2.NestedOption)); exports.DxoImageComponent = DxoImageComponent; var DxoImageModule = (function () { function DxoImageModule() { } DxoImageModule.decorators = [ { type: core_1.NgModule, args: [{ declarations: [ DxoImageComponent ], exports: [ DxoImageComponent ], },] }, ]; /** @nocollapse */ DxoImageModule.ctorParameters = function () { return []; }; return DxoImageModule; }()); exports.DxoImageModule = DxoImageModule; //# sourceMappingURL=image.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/indent.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var nested_option_2 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var DxoIndentComponent = (function (_super) { __extends(DxoIndentComponent, _super); function DxoIndentComponent(parentOptionHost, optionHost) { var _this = _super.call(this) || this; parentOptionHost.setNestedOption(_this); optionHost.setHost(_this, _this._fullOptionPath.bind(_this)); return _this; } Object.defineProperty(DxoIndentComponent.prototype, "left", { get: function () { return this._getOption('left'); }, set: function (value) { this._setOption('left', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoIndentComponent.prototype, "right", { get: function () { return this._getOption('right'); }, set: function (value) { this._setOption('right', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoIndentComponent.prototype, "_optionPath", { get: function () { return 'indent'; }, enumerable: true, configurable: true }); DxoIndentComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dxo-indent', template: '', styles: [''], providers: [nested_option_1.NestedOptionHost] },] }, ]; /** @nocollapse */ DxoIndentComponent.ctorParameters = function () { return [ { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.SkipSelf }, { type: core_1.Host },] }, { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.Host },] }, ]; }; DxoIndentComponent.propDecorators = { 'left': [{ type: core_1.Input },], 'right': [{ type: core_1.Input },], }; return DxoIndentComponent; }(nested_option_2.NestedOption)); exports.DxoIndentComponent = DxoIndentComponent; var DxoIndentModule = (function () { function DxoIndentModule() { } DxoIndentModule.decorators = [ { type: core_1.NgModule, args: [{ declarations: [ DxoIndentComponent ], exports: [ DxoIndentComponent ], },] }, ]; /** @nocollapse */ DxoIndentModule.ctorParameters = function () { return []; }; return DxoIndentModule; }()); exports.DxoIndentModule = DxoIndentModule; //# sourceMappingURL=indent.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/item-dxi.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); /* tslint:disable:use-input-property-decorator */ var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var template_host_1 = __webpack_require__("./node_modules/devextreme-angular/core/template-host.js"); var context_menu_item_dxi_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/base/context-menu-item-dxi.js"); var validation_rule_dxi_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/validation-rule-dxi.js"); var tab_dxi_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/tab-dxi.js"); var location_dxi_1 = __webpack_require__("./node_modules/devextreme-angular/ui/nested/location-dxi.js"); var DxiItemComponent = (function (_super) { __extends(DxiItemComponent, _super); function DxiItemComponent(parentOptionHost, optionHost, templateHost, element) { var _this = _super.call(this) || this; _this.element = element; parentOptionHost.setNestedOption(_this); optionHost.setHost(_this, _this._fullOptionPath.bind(_this)); templateHost.setHost(_this); return _this; } Object.defineProperty(DxiItemComponent.prototype, "_optionPath", { get: function () { return 'items'; }, enumerable: true, configurable: true }); Object.defineProperty(DxiItemComponent.prototype, "itemsChildren", { get: function () { return this._getOption('items'); }, set: function (value) { this.setChildren('items', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiItemComponent.prototype, "validationRulesChildren", { get: function () { return this._getOption('validationRules'); }, set: function (value) { this.setChildren('validationRules', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiItemComponent.prototype, "tabsChildren", { get: function () { return this._getOption('tabs'); }, set: function (value) { this.setChildren('tabs', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiItemComponent.prototype, "locationChildren", { get: function () { return this._getOption('location'); }, set: function (value) { this.setChildren('location', value); }, enumerable: true, configurable: true }); DxiItemComponent.prototype.setTemplate = function (template) { this.template = template; }; DxiItemComponent.prototype.ngAfterViewInit = function () { nested_option_1.extractTemplate(this, this.element); }; DxiItemComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dxi-item', template: '<ng-content></ng-content>', styles: [':host { display: block; }'], providers: [nested_option_1.NestedOptionHost, template_host_1.DxTemplateHost], inputs: [ 'disabled', 'html', 'icon', 'iconSrc', 'template', 'text', 'title', 'visible', 'onClick', 'type', 'baseSize', 'box', 'ratio', 'shrink', 'beginGroup', 'closeMenuOnClick', 'items', 'selectable', 'selected', 'colSpan', 'cssClass', 'dataField', 'editorOptions', 'editorType', 'helpText', 'isRequired', 'itemType', 'label', 'name', 'validationRules', 'visibleIndex', 'alignItemLabels', 'caption', 'colCount', 'colCountByScreen', 'tabPanelOptions', 'tabs', 'badge', 'tabTemplate', 'imageAlt', 'imageSrc', 'key', 'showChevron', 'titleTemplate', 'location', 'menuTemplate', 'heightRatio', 'widthRatio', 'locateInMenu', 'menuItemTemplate', 'options', 'showText', 'widget', 'expanded', 'hasItems', 'parentId' ] },] }, ]; /** @nocollapse */ DxiItemComponent.ctorParameters = function () { return [ { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.SkipSelf }, { type: core_1.Host },] }, { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.Host },] }, { type: template_host_1.DxTemplateHost, decorators: [{ type: core_1.Host },] }, { type: core_1.ElementRef, }, ]; }; DxiItemComponent.propDecorators = { 'itemsChildren': [{ type: core_1.ContentChildren, args: [core_1.forwardRef(function () { return DxiItemComponent; }),] },], 'validationRulesChildren': [{ type: core_1.ContentChildren, args: [core_1.forwardRef(function () { return validation_rule_dxi_1.DxiValidationRuleComponent; }),] },], 'tabsChildren': [{ type: core_1.ContentChildren, args: [core_1.forwardRef(function () { return tab_dxi_1.DxiTabComponent; }),] },], 'locationChildren': [{ type: core_1.ContentChildren, args: [core_1.forwardRef(function () { return location_dxi_1.DxiLocationComponent; }),] },], }; return DxiItemComponent; }(context_menu_item_dxi_1.DxiContextMenuItem)); exports.DxiItemComponent = DxiItemComponent; var DxiItemModule = (function () { function DxiItemModule() { } DxiItemModule.decorators = [ { type: core_1.NgModule, args: [{ declarations: [ DxiItemComponent ], exports: [ DxiItemComponent ], },] }, ]; /** @nocollapse */ DxiItemModule.ctorParameters = function () { return []; }; return DxiItemModule; }()); exports.DxiItemModule = DxiItemModule; //# sourceMappingURL=item-dxi.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/item.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var nested_option_2 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var DxoItemComponent = (function (_super) { __extends(DxoItemComponent, _super); function DxoItemComponent(parentOptionHost, optionHost) { var _this = _super.call(this) || this; parentOptionHost.setNestedOption(_this); optionHost.setHost(_this, _this._fullOptionPath.bind(_this)); return _this; } Object.defineProperty(DxoItemComponent.prototype, "border", { get: function () { return this._getOption('border'); }, set: function (value) { this._setOption('border', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoItemComponent.prototype, "hoverStyle", { get: function () { return this._getOption('hoverStyle'); }, set: function (value) { this._setOption('hoverStyle', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoItemComponent.prototype, "selectionStyle", { get: function () { return this._getOption('selectionStyle'); }, set: function (value) { this._setOption('selectionStyle', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoItemComponent.prototype, "_optionPath", { get: function () { return 'item'; }, enumerable: true, configurable: true }); DxoItemComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dxo-item', template: '', styles: [''], providers: [nested_option_1.NestedOptionHost] },] }, ]; /** @nocollapse */ DxoItemComponent.ctorParameters = function () { return [ { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.SkipSelf }, { type: core_1.Host },] }, { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.Host },] }, ]; }; DxoItemComponent.propDecorators = { 'border': [{ type: core_1.Input },], 'hoverStyle': [{ type: core_1.Input },], 'selectionStyle': [{ type: core_1.Input },], }; return DxoItemComponent; }(nested_option_2.NestedOption)); exports.DxoItemComponent = DxoItemComponent; var DxoItemModule = (function () { function DxoItemModule() { } DxoItemModule.decorators = [ { type: core_1.NgModule, args: [{ declarations: [ DxoItemComponent ], exports: [ DxoItemComponent ], },] }, ]; /** @nocollapse */ DxoItemModule.ctorParameters = function () { return []; }; return DxoItemModule; }()); exports.DxoItemModule = DxoItemModule; //# sourceMappingURL=item.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/key.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var nested_option_2 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var DxoKeyComponent = (function (_super) { __extends(DxoKeyComponent, _super); function DxoKeyComponent(parentOptionHost, optionHost) { var _this = _super.call(this) || this; parentOptionHost.setNestedOption(_this); optionHost.setHost(_this, _this._fullOptionPath.bind(_this)); return _this; } Object.defineProperty(DxoKeyComponent.prototype, "bing", { get: function () { return this._getOption('bing'); }, set: function (value) { this._setOption('bing', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoKeyComponent.prototype, "google", { get: function () { return this._getOption('google'); }, set: function (value) { this._setOption('google', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoKeyComponent.prototype, "googleStatic", { get: function () { return this._getOption('googleStatic'); }, set: function (value) { this._setOption('googleStatic', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoKeyComponent.prototype, "_optionPath", { get: function () { return 'key'; }, enumerable: true, configurable: true }); DxoKeyComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dxo-key', template: '', styles: [''], providers: [nested_option_1.NestedOptionHost] },] }, ]; /** @nocollapse */ DxoKeyComponent.ctorParameters = function () { return [ { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.SkipSelf }, { type: core_1.Host },] }, { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.Host },] }, ]; }; DxoKeyComponent.propDecorators = { 'bing': [{ type: core_1.Input },], 'google': [{ type: core_1.Input },], 'googleStatic': [{ type: core_1.Input },], }; return DxoKeyComponent; }(nested_option_2.NestedOption)); exports.DxoKeyComponent = DxoKeyComponent; var DxoKeyModule = (function () { function DxoKeyModule() { } DxoKeyModule.decorators = [ { type: core_1.NgModule, args: [{ declarations: [ DxoKeyComponent ], exports: [ DxoKeyComponent ], },] }, ]; /** @nocollapse */ DxoKeyModule.ctorParameters = function () { return []; }; return DxoKeyModule; }()); exports.DxoKeyModule = DxoKeyModule; //# sourceMappingURL=key.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/label.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var nested_option_2 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var DxoLabelComponent = (function (_super) { __extends(DxoLabelComponent, _super); function DxoLabelComponent(parentOptionHost, optionHost) { var _this = _super.call(this) || this; parentOptionHost.setNestedOption(_this); optionHost.setHost(_this, _this._fullOptionPath.bind(_this)); return _this; } Object.defineProperty(DxoLabelComponent.prototype, "connectorColor", { get: function () { return this._getOption('connectorColor'); }, set: function (value) { this._setOption('connectorColor', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoLabelComponent.prototype, "connectorWidth", { get: function () { return this._getOption('connectorWidth'); }, set: function (value) { this._setOption('connectorWidth', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoLabelComponent.prototype, "customizeText", { get: function () { return this._getOption('customizeText'); }, set: function (value) { this._setOption('customizeText', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoLabelComponent.prototype, "font", { get: function () { return this._getOption('font'); }, set: function (value) { this._setOption('font', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoLabelComponent.prototype, "format", { get: function () { return this._getOption('format'); }, set: function (value) { this._setOption('format', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoLabelComponent.prototype, "indent", { get: function () { return this._getOption('indent'); }, set: function (value) { this._setOption('indent', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoLabelComponent.prototype, "precision", { get: function () { return this._getOption('precision'); }, set: function (value) { this._setOption('precision', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoLabelComponent.prototype, "visible", { get: function () { return this._getOption('visible'); }, set: function (value) { this._setOption('visible', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoLabelComponent.prototype, "horizontalAlignment", { get: function () { return this._getOption('horizontalAlignment'); }, set: function (value) { this._setOption('horizontalAlignment', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoLabelComponent.prototype, "position", { get: function () { return this._getOption('position'); }, set: function (value) { this._setOption('position', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoLabelComponent.prototype, "text", { get: function () { return this._getOption('text'); }, set: function (value) { this._setOption('text', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoLabelComponent.prototype, "verticalAlignment", { get: function () { return this._getOption('verticalAlignment'); }, set: function (value) { this._setOption('verticalAlignment', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoLabelComponent.prototype, "alignment", { get: function () { return this._getOption('alignment'); }, set: function (value) { this._setOption('alignment', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoLabelComponent.prototype, "customizeHint", { get: function () { return this._getOption('customizeHint'); }, set: function (value) { this._setOption('customizeHint', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoLabelComponent.prototype, "displayMode", { get: function () { return this._getOption('displayMode'); }, set: function (value) { this._setOption('displayMode', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoLabelComponent.prototype, "indentFromAxis", { get: function () { return this._getOption('indentFromAxis'); }, set: function (value) { this._setOption('indentFromAxis', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoLabelComponent.prototype, "overlappingBehavior", { get: function () { return this._getOption('overlappingBehavior'); }, set: function (value) { this._setOption('overlappingBehavior', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoLabelComponent.prototype, "rotationAngle", { get: function () { return this._getOption('rotationAngle'); }, set: function (value) { this._setOption('rotationAngle', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoLabelComponent.prototype, "staggeringSpacing", { get: function () { return this._getOption('staggeringSpacing'); }, set: function (value) { this._setOption('staggeringSpacing', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoLabelComponent.prototype, "argumentFormat", { get: function () { return this._getOption('argumentFormat'); }, set: function (value) { this._setOption('argumentFormat', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoLabelComponent.prototype, "argumentPrecision", { get: function () { return this._getOption('argumentPrecision'); }, set: function (value) { this._setOption('argumentPrecision', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoLabelComponent.prototype, "backgroundColor", { get: function () { return this._getOption('backgroundColor'); }, set: function (value) { this._setOption('backgroundColor', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoLabelComponent.prototype, "border", { get: function () { return this._getOption('border'); }, set: function (value) { this._setOption('border', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoLabelComponent.prototype, "connector", { get: function () { return this._getOption('connector'); }, set: function (value) { this._setOption('connector', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoLabelComponent.prototype, "horizontalOffset", { get: function () { return this._getOption('horizontalOffset'); }, set: function (value) { this._setOption('horizontalOffset', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoLabelComponent.prototype, "percentPrecision", { get: function () { return this._getOption('percentPrecision'); }, set: function (value) { this._setOption('percentPrecision', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoLabelComponent.prototype, "showForZeroValues", { get: function () { return this._getOption('showForZeroValues'); }, set: function (value) { this._setOption('showForZeroValues', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoLabelComponent.prototype, "verticalOffset", { get: function () { return this._getOption('verticalOffset'); }, set: function (value) { this._setOption('verticalOffset', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoLabelComponent.prototype, "hideFirstOrLast", { get: function () { return this._getOption('hideFirstOrLast'); }, set: function (value) { this._setOption('hideFirstOrLast', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoLabelComponent.prototype, "indentFromTick", { get: function () { return this._getOption('indentFromTick'); }, set: function (value) { this._setOption('indentFromTick', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoLabelComponent.prototype, "useRangeColors", { get: function () { return this._getOption('useRangeColors'); }, set: function (value) { this._setOption('useRangeColors', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoLabelComponent.prototype, "location", { get: function () { return this._getOption('location'); }, set: function (value) { this._setOption('location', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoLabelComponent.prototype, "showColon", { get: function () { return this._getOption('showColon'); }, set: function (value) { this._setOption('showColon', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoLabelComponent.prototype, "radialOffset", { get: function () { return this._getOption('radialOffset'); }, set: function (value) { this._setOption('radialOffset', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoLabelComponent.prototype, "topIndent", { get: function () { return this._getOption('topIndent'); }, set: function (value) { this._setOption('topIndent', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoLabelComponent.prototype, "dataField", { get: function () { return this._getOption('dataField'); }, set: function (value) { this._setOption('dataField', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoLabelComponent.prototype, "enabled", { get: function () { return this._getOption('enabled'); }, set: function (value) { this._setOption('enabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxoLabelComponent.prototype, "_optionPath", { get: function () { return 'label'; }, enumerable: true, configurable: true }); DxoLabelComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dxo-label', template: '', styles: [''], providers: [nested_option_1.NestedOptionHost] },] }, ]; /** @nocollapse */ DxoLabelComponent.ctorParameters = function () { return [ { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.SkipSelf }, { type: core_1.Host },] }, { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.Host },] }, ]; }; DxoLabelComponent.propDecorators = { 'connectorColor': [{ type: core_1.Input },], 'connectorWidth': [{ type: core_1.Input },], 'customizeText': [{ type: core_1.Input },], 'font': [{ type: core_1.Input },], 'format': [{ type: core_1.Input },], 'indent': [{ type: core_1.Input },], 'precision': [{ type: core_1.Input },], 'visible': [{ type: core_1.Input },], 'horizontalAlignment': [{ type: core_1.Input },], 'position': [{ type: core_1.Input },], 'text': [{ type: core_1.Input },], 'verticalAlignment': [{ type: core_1.Input },], 'alignment': [{ type: core_1.Input },], 'customizeHint': [{ type: core_1.Input },], 'displayMode': [{ type: core_1.Input },], 'indentFromAxis': [{ type: core_1.Input },], 'overlappingBehavior': [{ type: core_1.Input },], 'rotationAngle': [{ type: core_1.Input },], 'staggeringSpacing': [{ type: core_1.Input },], 'argumentFormat': [{ type: core_1.Input },], 'argumentPrecision': [{ type: core_1.Input },], 'backgroundColor': [{ type: core_1.Input },], 'border': [{ type: core_1.Input },], 'connector': [{ type: core_1.Input },], 'horizontalOffset': [{ type: core_1.Input },], 'percentPrecision': [{ type: core_1.Input },], 'showForZeroValues': [{ type: core_1.Input },], 'verticalOffset': [{ type: core_1.Input },], 'hideFirstOrLast': [{ type: core_1.Input },], 'indentFromTick': [{ type: core_1.Input },], 'useRangeColors': [{ type: core_1.Input },], 'location': [{ type: core_1.Input },], 'showColon': [{ type: core_1.Input },], 'radialOffset': [{ type: core_1.Input },], 'topIndent': [{ type: core_1.Input },], 'dataField': [{ type: core_1.Input },], 'enabled': [{ type: core_1.Input },], }; return DxoLabelComponent; }(nested_option_2.NestedOption)); exports.DxoLabelComponent = DxoLabelComponent; var DxoLabelModule = (function () { function DxoLabelModule() { } DxoLabelModule.decorators = [ { type: core_1.NgModule, args: [{ declarations: [ DxoLabelComponent ], exports: [ DxoLabelComponent ], },] }, ]; /** @nocollapse */ DxoLabelModule.ctorParameters = function () { return []; }; return DxoLabelModule; }()); exports.DxoLabelModule = DxoLabelModule; //# sourceMappingURL=label.js.map /***/ }), /***/ "./node_modules/devextreme-angular/ui/nested/layer-dxi.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * devextreme-angular * Version: 17.2.7 * Build date: Wed Mar 21 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("./node_modules/@angular/core/esm2015/core.js"); var nested_option_1 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var nested_option_2 = __webpack_require__("./node_modules/devextreme-angular/core/nested-option.js"); var DxiLayerComponent = (function (_super) { __extends(DxiLayerComponent, _super); function DxiLayerComponent(parentOptionHost, optionHost) { var _this = _super.call(this) || this; parentOptionHost.setNestedOption(_this); optionHost.setHost(_this, _this._fullOptionPath.bind(_this)); return _this; } Object.defineProperty(DxiLayerComponent.prototype, "borderColor", { get: function () { return this._getOption('borderColor'); }, set: function (value) { this._setOption('borderColor', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiLayerComponent.prototype, "borderWidth", { get: function () { return this._getOption('borderWidth'); }, set: function (value) { this._setOption('borderWidth', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiLayerComponent.prototype, "color", { get: function () { return this._getOption('color'); }, set: function (value) { this._setOption('color', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiLayerComponent.prototype, "colorGroupingField", { get: function () { return this._getOption('colorGroupingField'); }, set: function (value) { this._setOption('colorGroupingField', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiLayerComponent.prototype, "colorGroups", { get: function () { return this._getOption('colorGroups'); }, set: function (value) { this._setOption('colorGroups', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiLayerComponent.prototype, "customize", { get: function () { return this._getOption('customize'); }, set: function (value) { this._setOption('customize', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiLayerComponent.prototype, "data", { get: function () { return this._getOption('data'); }, set: function (value) { this._setOption('data', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiLayerComponent.prototype, "dataField", { get: function () { return this._getOption('dataField'); }, set: function (value) { this._setOption('dataField', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiLayerComponent.prototype, "dataSource", { get: function () { return this._getOption('dataSource'); }, set: function (value) { this._setOption('dataSource', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiLayerComponent.prototype, "elementType", { get: function () { return this._getOption('elementType'); }, set: function (value) { this._setOption('elementType', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiLayerComponent.prototype, "hoveredBorderColor", { get: function () { return this._getOption('hoveredBorderColor'); }, set: function (value) { this._setOption('hoveredBorderColor', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiLayerComponent.prototype, "hoveredBorderWidth", { get: function () { return this._getOption('hoveredBorderWidth'); }, set: function (value) { this._setOption('hoveredBorderWidth', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiLayerComponent.prototype, "hoveredColor", { get: function () { return this._getOption('hoveredColor'); }, set: function (value) { this._setOption('hoveredColor', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiLayerComponent.prototype, "hoverEnabled", { get: function () { return this._getOption('hoverEnabled'); }, set: function (value) { this._setOption('hoverEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiLayerComponent.prototype, "label", { get: function () { return this._getOption('label'); }, set: function (value) { this._setOption('label', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiLayerComponent.prototype, "maxSize", { get: function () { return this._getOption('maxSize'); }, set: function (value) { this._setOption('maxSize', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiLayerComponent.prototype, "minSize", { get: function () { return this._getOption('minSize'); }, set: function (value) { this._setOption('minSize', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiLayerComponent.prototype, "name", { get: function () { return this._getOption('name'); }, set: function (value) { this._setOption('name', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiLayerComponent.prototype, "opacity", { get: function () { return this._getOption('opacity'); }, set: function (value) { this._setOption('opacity', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiLayerComponent.prototype, "palette", { get: function () { return this._getOption('palette'); }, set: function (value) { this._setOption('palette', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiLayerComponent.prototype, "paletteSize", { get: function () { return this._getOption('paletteSize'); }, set: function (value) { this._setOption('paletteSize', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiLayerComponent.prototype, "selectedBorderColor", { get: function () { return this._getOption('selectedBorderColor'); }, set: function (value) { this._setOption('selectedBorderColor', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiLayerComponent.prototype, "selectedBorderWidth", { get: function () { return this._getOption('selectedBorderWidth'); }, set: function (value) { this._setOption('selectedBorderWidth', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiLayerComponent.prototype, "selectedColor", { get: function () { return this._getOption('selectedColor'); }, set: function (value) { this._setOption('selectedColor', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiLayerComponent.prototype, "selectionMode", { get: function () { return this._getOption('selectionMode'); }, set: function (value) { this._setOption('selectionMode', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiLayerComponent.prototype, "size", { get: function () { return this._getOption('size'); }, set: function (value) { this._setOption('size', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiLayerComponent.prototype, "sizeGroupingField", { get: function () { return this._getOption('sizeGroupingField'); }, set: function (value) { this._setOption('sizeGroupingField', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiLayerComponent.prototype, "sizeGroups", { get: function () { return this._getOption('sizeGroups'); }, set: function (value) { this._setOption('sizeGroups', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiLayerComponent.prototype, "type", { get: function () { return this._getOption('type'); }, set: function (value) { this._setOption('type', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxiLayerComponent.prototype, "_optionPath", { get: function () { return 'layers'; }, enumerable: true, configurable: true }); DxiLayerComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'dxi-layer', template: '', styles: [''], providers: [nested_option_1.NestedOptionHost] },] }, ]; /** @nocollapse */ DxiLayerComponent.ctorParameters = function () { return [ { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.SkipSelf }, { type: core_1.Host },] }, { type: nested_option_1.NestedOptionHost, decorators: [{ type: core_1.Host },] }, ]; }; DxiLayerComponent.propDecorators = { 'borderColor': [{ type: core_1.Input },], 'borderWidth': [{ type: core_1.Input },], 'color': [{ type: core_1.Input },], 'colorGroupingField': [{ type: core_1.Input },], 'colorGroups': [{ type: core_1.Input },], 'customize': [{ type: core_1.Input },], 'data': [{ type: core_1.Input },], 'dataField': [{ type: core_1.Input },], 'dataSource': [{ type: core_1.Input },], 'elementType': [{ type: core_1.Input },], 'hoveredBorderColor': [{ type: core_1.Input },], 'hoveredBorderWidth': [{ type: core_1.Input },], 'hoveredColor': [{ type: core_1.Input },], 'hoverEnabled': [{ type: core_1.Input },], 'label': [{ type: core_1.Input },], 'maxSize': [{ type: core_1.Input },], 'minSize': [{ type: core_1.Input },], 'name': [{ type: core_1.Input },], 'opacity': [{ type: core_1.Input },], 'palette': [{ type: core_1.Input },], 'paletteSize': [{ type: core_1.Input },], 'selectedBorderColor': [{ type: core_1.Input },], 'selectedBorderWidth': [{ type: core_1.Input },], 'selectedColor': [{ type: core_1.Input },], 'selectionMode': [{ type: core_1.Input },], 'size': [{ type: core_1.Input },], 'sizeGroupingField': [{ type: core_1.Input },], 'sizeGroups': [{ type: core_1.Input },], 'type'